source: project/release/4/csv-xml/trunk/csv-xml.scm @ 34884

Last change on this file since 34884 was 34884, checked in by Kon Lovett, 4 years ago

mind p's & q's

File size: 2.4 KB
Line 
1;;;; csv-xml.scm  -*- Hen -*-
2;;;; Kon Lovett, Jun '17
3;;;; Kon Lovett, ??? '??
4
5(module csv-xml
6
7(;export
8  ;
9  reader-spec
10  ;
11  make-csv-reader
12  make-csv-reader-maker
13  ;
14  csv->list
15  csv->sxml
16  csv-for-each
17  csv-map
18  ;
19  csv-reader? check-csv-reader error-csv-reader
20  csv-reader-spec? check-csv-reader-spec error-csv-reader-spec
21  ;
22  writer-spec
23  ;
24  make-csv-writer-maker
25  make-csv-writer
26  ;
27  list->csv
28  #;list->sxml
29  ;
30  csv-writer? check-csv-writer error-csv-writer
31  csv-writer-spec? check-csv-writer-spec error-csv-writer-spec)
32
33(import scheme)
34
35(import (except chicken provide))
36
37;;;
38
39;Need to process `#lang' as well. So just "commented out" the "offending"
40;sections in the source.
41#;(define-syntax provide (syntax-rules () ((_ ?x0 ...) (begin))))
42(define null '())
43
44(include "csv.ss")
45
46;;;
47
48(import (only data-structures conc intersperse ->string alist-ref string-translate*))
49(require-library data-structures)
50
51#;(import (only list-utils alist?))
52(import (only (srfi 1) every iota append! map))
53(require-library (srfi 1))
54
55(import (only (srfi 13) string-index))
56(require-library (srfi 13))
57
58(import (only (srfi 14) char-set:iso-control))
59(require-library (srfi 14))
60
61(import (only type-checks define-check+error-type check-string check-list))
62(require-library type-checks)
63
64(import (only unicode-utils unicode-char->string))
65(require-library unicode-utils)
66
67(require-extension moremacros)
68
69;(from list-utils egg)
70(define (alist? obj)
71  (if (pair? obj)
72    (every pair? obj)
73    (null? obj) ) )
74
75;very loose ...
76(define csv-reader-spec? alist?)
77(define-check+error-type csv-reader-spec)
78
79(define csv-reader? procedure?)
80(define-check+error-type csv-reader)
81
82(define (reader-spec
83          #!key
84          (newline-type 'lax)
85          (separator-chars '(#\,))
86          (quote-char #\")
87          (quote-doubling-escapes? #t)
88          (comment-chars '())
89          (whitespace-chars '(#\space))
90          (strip-leading-whitespace? #f)
91          (strip-trailing-whitespace? #f)
92          (newlines-in-quotes? #t))
93  `((newline-type . ,newline-type)
94    (separator-chars . ,separator-chars)
95    (quote-char . ,quote-char)
96    (quote-doubling-escapes? . ,quote-doubling-escapes?)
97    (comment-chars . ,comment-chars)
98    (whitespace-chars . ,whitespace-chars)
99    (strip-leading-whitespace? . ,strip-leading-whitespace?)
100    (strip-trailing-whitespace? . ,strip-trailing-whitespace?)
101    (newlines-in-quotes? . ,newlines-in-quotes?)) )
102
103;;;
104
105(include "csv-out.impl")
106
107) ;csv-xml
Note: See TracBrowser for help on using the repository browser.