Outdated egg!
This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
csv-xml
Documentation
A CHICKEN version of "csv-scheme". Some additions/extensions to the original.
Input
See csv-scheme for the full documentation.
csv-reader?
- csv-reader? OBJECTprocedure
Is the OBJECT a csv-reader?
check-csv-reader
error-csv-reader
reader-spec
csv-reader-spec?
- csv-reader-spec? OBJECTprocedure
Is the OBJECT a csv-reader-spec?
check-csv-reader-spec
error-csv-reader-spec
Output
make-csv-writer-maker
- make-csv-writer-maker #!optional WRITER-SPECprocedure
See writer-spec below for the default WRITER-SPEC.
make-csv-writer
- make-csv-writer OUT-OR-STR #!optional WRITER-SPECprocedure
Returns a procedure of 1 argument, a scheme-object, the ROW-DATA-OBJECT.
OUT-OR-STR is output-port or string. A string is interpreted as a pathname to yield an output-port.
See writer-spec below for the default WRITER-SPEC.
When the ROW-DATA-OBJECT is a list then it is interpreted as row data. Otherwise assumed to be a comment.
The ROW-DATA-OBJECT argument will be converted to an output string, according to the associated csv-writer-spec, and printed to the associated output-port.
csv-writer?
- csv-writer? OBJECTprocedure
Is the OBJECT a csv-writer?
check-csv-writer
error-csv-writer
writer-spec
- (writer-spec [(newline-char: NEWLINE-CHAR #t) (separator-char: SEPARATOR-CHAR #\,) (quote-char: QUOTE-CHAR #\") (comment-char: COMMENT-CHAR #\#) (quote-doubling-escapes?: QUOTE-DOUBLING-ESCAPES? #t) (quote-controls?: QUOTE-CONTROLS? #t) (always-quote?: ALWAYS-QUOTE? #t)]) => csv-writer-specprocedure
NEWLINE-CHAR is #t, cr, lf, or crlf.
COMMENT-CHAR is #f, or a character. #f means no comment support.
QUOTE-DOUBLING-ESCAPES? is a boolean.
QUOTE-CONTROLS? is a boolean, quoting strings with iso-control characters?
ALWAYS-QUOTE? is a boolean.
csv-writer-spec?
- csv-writer-spec? OBJECTprocedure
Is the OBJECT a csv-writer-spec?
check-csv-writer-spec
error-csv-writer-spec
list->csv
- list->csv LS #!optional WRITER-OR-OUTprocedure
LS is a list-of list | string, a list of row-item.
WRITER-OR-OUT is a csv-writer or output-port. Default is the (current-output-port). Note that when an output-port is specified the default csv-writer-spec will be used.
When the current row-item is a string, and not a list, then it is treated as a line-comment. Note that comments are processed only when the associated csv-writer-spec comment-char is a character.
;assumes string output & comment-char is #\# (list->csv '((1 22 333) "a comment" (11 2222 333333))) ;=> "\"1\",\"22\",\"333\"\n#a comment\n\"11\",\"2222\",\"333333\"\n"
Usage
(require-extension csv-xml)
Author
Neil van Dyke
Kon Lovett for CHICKEN
Bugs & Limitations
- The quote-doubling-escapes? and quote-controls? are currently ignored by csv-writer.
Version history
- 0.12.1
- 0.12.0
- Use quote-doubling-escapes? and quote-controls?. Add always-quote?.
- 0.11.1
- Fix writer-spec defaults.
- 0.11.0
- Add reader-spec, csv-out stuff.
- 0.10.2
- Escape character, '\', in quoted strings.
- 0.10.1
- 0.10.0
- Release of csv:0.10 for Chicken