[q-lang-cvs] q-csv README,1.9,1.10
Brought to you by:
agraef
From: RER <ed...@us...> - 2008-01-22 16:47:38
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9417 Modified Files: README Log Message: updated README Index: README =================================================================== RCS file: /cvsroot/q-lang/q-csv/README,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README 14 Jan 2008 06:43:09 -0000 1.9 --- README 22 Jan 2008 16:47:30 -0000 1.10 *************** *** 4,10 **** The CSV library provides an interface to read and write comma separated value ! files. The reading and writing functions abide by RFC 4180 ! (http://www.ietf.org/rfc/rfc4180.txt) except for additional parameters ! that allow field delimiters and quote delimiters to be changed. INSTALLATION --- 4,9 ---- The CSV library provides an interface to read and write comma separated value ! files. The reading and writing functions are loosely based on Python's CSV ! module (http://docs.python.org/lib/module-csv.html) INSTALLATION *************** *** 21,41 **** USAGE ! Data records are represented as tuples of strings and numeric data. Two ! variants of reading and writing are available. Basically, the functions whose ! names end in _data will convert numeric (integer and floating point) values ! automatically, while the _string variants will treat them as ordinary (string) ! data. More precisely: ! - freadcsv_data converts non-quoted numeric fields to integer or double values ! automatically. Invalidly formatted CSV causes return of a 'csv_error MSG' ! term (see NOTES below). ! fwritecsv_data writes integer or double values to non-quoted fields. The ! handling of quoted or non-quoted fields is automatic. Fields with types ! other than floats, integers or strings cause return of a 'csv_error MSG' ! term (see NOTES below). ! ! - freadcsv_string and fwritecsv_string read all fields as strings ! disregarding any conversion. ! fwritecsv_string writes all values as quoted fields. The above routines are defined in terms of the following primary interface --- 20,41 ---- USAGE ! Data records are represented as tuples of strings and numeric data. Dialects ! are created using csv_dialect with a list of specifications outlined in csv.q. ! - sreadcsv reads a CSV formated string and converts it to a tuple of fields ! according to the dialect specified. If no dialect is specified, conversion ! is performed using RFC 4180 rules (http://www.ietf.org/rfc/rfc4180.txt). ! Invalidly formatted CSV causes return of a 'csv_error MSG' term ! (see NOTES below). ! ! - swritecsv converts a tuple of fields, which includes only strings, integers, ! and floats to a CSV formated string according to the dialect specified. If ! no dialect is specified, conversion is performed using RFC 4180 rules ! (http://www.ietf.org/rfc/rfc4180.txt). Tuples that are not strings, integers, ! or floats invoke a 'csv_error MSG' term (see NOTES below). ! ! - freadcsv is equivalent to sreadcsv except that reading is from a file. ! ! - fwritecsv is equivalent to swritecsv except that writing is to a file. The above routines are defined in terms of the following primary interface *************** *** 53,64 **** The routines described above read/write one record at a time. Additional ! functions (freadcsvfile_data and fwritecsvfile_data) are provided to convert ! between entire CSV files and lists of tuples. Note that these require that ! the entire data fits into RAM and will thus be inefficient for huge datasets. NOTES ! - Errors in the conversion routines (input strings that do not abide by the ! RFC 4180 rules; records containing field types other than strings, integers and floats) cause a special 'csv_error MSG' term to be returned, where MSG is a string describing the particular error. To handle error conditions, --- 53,65 ---- The routines described above read/write one record at a time. Additional ! functions (sreadcsvlist, swritecsvlist, freadcsvlist and fwritecsvlist) are ! provided to convert between entire CSV files and lists of tuples. Note that ! these require that the entire data fits into RAM and will thus be inefficient ! for huge datasets. NOTES ! - Errors in the conversion routines (input that does not abide by the ! dialect rules; records containing field types other than strings, integers and floats) cause a special 'csv_error MSG' term to be returned, where MSG is a string describing the particular error. To handle error conditions, *************** *** 69,76 **** csv_error MSG = throw MSG; ! - MS Excel files should be read using the _string variants as Excel does not ! quote values such as 0004. These types of values will be converted to ! integers and the leading significant 0s will be lost. Significant leading or ! trailing space may likewise be lost without using the _string variant. TO DO --- 70,76 ---- csv_error MSG = throw MSG; ! - MS Excel files should be written using "=""0004""" if leading 0s are ! significant. Use the same technique if leading space is significant. Use this ! quirk only if written files are going to be imported to MS Excel. TO DO |