Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.CSV.CSV

This package reads and writes CSV files. License: AGPL3 Copyright Pascal J. Bourguignon 2003 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Public

LOAD-RECORDS (PATH &KEY (EXTERNAL-FORMAT DEFAULT) (ELEMENT-TYPE 'CHARACTER) (IF-END-OF-FILE-IN-LAST-RECORD ERROR) (FIELD-SEPARATOR ,) (DECIMAL-POINT .))

RETURN: A list of rows, each row being a list of cells. PATH: A pathname designator of the CSV file to read. EXTERNAL-FORMAT: The external format. ELEMENT-TYPE: The type of element of the file (should be CHARACTER or a subtype of CHARACTER). IF-END-OF-FILE-IN-LAST-RECORD: :ERROR or :IGNORE. FIELD-SEPARATOR: The field separator; default: #, DECIMAL-POINT: The decimal point; default: #.

WRITE-RECORD (FIELDS &OPTIONAL (OUT *STANDARD-OUTPUT*))

DO: write the record FIELDS to the stream OUT (default *STANDARD-OUTPUT*).

Private

Undocumented

ESCAPE-FIELD (FIELD)

MAKE-SCANNER (&KEY (SOURCE *STANDARD-INPUT*) (FIELD-SEPARATOR ,) (DECIMAL-POINT .))

MACRO

Private

UNTIL (CONDITION &BODY BODY)

Until loop.

WHILE (CONDITION &BODY BODY)

While loop.

GENERIC-FUNCTION

Private

Undocumented

ADVANCE (PARSER)

CSV-PARSE-FILE (SELF)

CSV-PARSE-RECORD (SELF)

GET-TOKEN (SCANNER)

NEWLINE (SCANNER)

REPORT-ERROR (PARSER MESSAGE &REST ARGS)

SCAN-NEWLINE (SCANNER CH)

TEXT-TERM (SCANNER)

SLOT-ACCESSOR

Private

Undocumented

DECIMAL-POINT (OBJECT)

SETFDECIMAL-POINT (NEW-VALUE OBJECT)

FIELD-SEPARATOR (OBJECT)

SETFFIELD-SEPARATOR (NEW-VALUE OBJECT)

IF-END-OF-FILE-IN-LAST-RECORD (OBJECT)

SETFIF-END-OF-FILE-IN-LAST-RECORD (NEW-VALUE OBJECT)

PARSER-NEXT-TOKEN (OBJECT)

SETFPARSER-NEXT-TOKEN (NEW-VALUE OBJECT)

PARSER-NEXT-VALUE (OBJECT)

SETFPARSER-NEXT-VALUE (NEW-VALUE OBJECT)

PARSER-SCANNER (OBJECT)

SETFPARSER-SCANNER (NEW-VALUE OBJECT)

PARSER-TOKEN (OBJECT)

SETFPARSER-TOKEN (NEW-VALUE OBJECT)

PARSER-VALUE (OBJECT)

SETFPARSER-VALUE (NEW-VALUE OBJECT)

SCANNER-CRCNT (OBJECT)

SETFSCANNER-CRCNT (NEW-VALUE OBJECT)

SCANNER-CRLFCNT (OBJECT)

SETFSCANNER-CRLFCNT (NEW-VALUE OBJECT)

SCANNER-LFCNT (OBJECT)

SETFSCANNER-LFCNT (NEW-VALUE OBJECT)

SCANNER-NEWLINE (OBJECT)

SETFSCANNER-NEWLINE (NEW-VALUE OBJECT)

SCANNER-SOURCE (OBJECT)

SETFSCANNER-SOURCE (NEW-VALUE OBJECT)

VARIABLE

Private

Undocumented

+C+CR+

+C+LF+

+CR+

+CRLF+

+LF+

+NEWLINE+

+SPACES+

CLASS

Private

PARSER

A parser.

SCANNER

A scanner. If not set newline is automatically determined from statistics on newlines found in the source. At the beginning of the file, or when newlines are inconsistent, a default newline = LF is used. This imports for escapes.

Undocumented

CSV-PARSER