[q-lang-cvs] q-csv/examples read-sample1.csv, 1.1.1.1, 1.2 read-sample2.csv, 1.1.1.1, 1.2 read-samp
Brought to you by:
agraef
From: RER <ed...@us...> - 2008-01-13 17:27:20
|
Update of /cvsroot/q-lang/q-csv/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31912/examples Modified Files: read-sample1.csv read-sample2.csv read-sample4.csv readsamples.q writesamples.q Log Message: updated README, read samples, write samples, csv.c, and csv.q Index: writesamples.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/writesamples.q,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** writesamples.q 10 Jan 2008 22:54:02 -0000 1.2 --- writesamples.q 13 Jan 2008 17:27:14 -0000 1.3 *************** *** 2,6 **** To run: ! At the command line> q writesamples.q At the prompt ==> main Using your favorite editor open the write samples to see what was wrought. --- 2,6 ---- To run: ! At the command line> Q writesamples.q At the prompt ==> main Using your favorite editor open the write samples to see what was wrought. *************** *** 17,21 **** Note that certain fields are not quoted. */ writefile F [] = (); ! writefile F [L|Ls] = [fwritecsv F L | writefile F Ls]; /* Illustration of writecsv_string --- 17,21 ---- Note that certain fields are not quoted. */ writefile F [] = (); ! writefile F [L|Ls] = [fwritecsv_data F L | writefile F Ls]; /* Illustration of writecsv_string *************** *** 26,30 **** /* Illustration of fwritecsv with tab delimeter */ writefile_tab F [] = (); ! writefile_tab F [L|Ls] = [fwritecsv (F, "\t") L | writefile_tab F Ls]; /* Illustration of fwritecsv with tab and quote delimeters */ --- 26,30 ---- /* Illustration of fwritecsv with tab delimeter */ writefile_tab F [] = (); ! writefile_tab F [L|Ls] = [fwritecsv_data (F, "\t", "\"") L | writefile_tab F Ls]; /* Illustration of fwritecsv with tab and quote delimeters */ *************** *** 45,61 **** ("a, b", "", 0, 0.0, "00")]; ! main = writes "Writing 'write-sample1.csv': (standard CSV)\n" || writefile (fopen "write-sample1.csv" "w") Sample1 ! || writes "\ndone.\n\n-----\n" ! || writes "Writing 'write-sample2.csv': (standard CSV, quoted)\n" || writefile_string (fopen "write-sample2.csv" "w") Sample1 ! || writes "\ndone.\n\n-----\n" ! || writes "Writing 'write-sample3.csv': (tab delimited)\n" || writefile_tab (fopen "write-sample3.csv" "w") Sample2 ! || writes "\ndone.\n\n-----\n" ! || writes "Writing 'write-sample4.csv': (tab delimited, single quoted)\n" || writefile_tab_quote (fopen "write-sample4.csv" "w") Sample3 ! || writes "\ndone.\n\n-----\n"; ! ! main2 = fwritefilecsv_data (F, "\t", "'") Sample3 ! where F = fopen "write-sample4.csv" "w"; \ No newline at end of file --- 45,58 ---- ("a, b", "", 0, 0.0, "00")]; ! main = writes "Writing 'write-sample1.csv: (standard CSV)" || writefile (fopen "write-sample1.csv" "w") Sample1 ! || writes "\ndone.\n\n-----" ! || writes "Writing 'write-sample2.csv: (standard CSV, quoted)" || writefile_string (fopen "write-sample2.csv" "w") Sample1 ! || writes "\ndone.\n\n-----" ! || writes "Writing 'write-sample3.csv: (tab delimited)" || writefile_tab (fopen "write-sample3.csv" "w") Sample2 ! || writes "\ndone.\n\n-----" ! || writes "Writing 'write-sample4.csv: (tab delimited, single quoted)" || writefile_tab_quote (fopen "write-sample4.csv" "w") Sample3 ! || writes "\ndone.\n\n-----"; \ No newline at end of file Index: read-sample2.csv =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/read-sample2.csv,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** read-sample2.csv 10 Jan 2008 22:41:21 -0000 1.1.1.1 --- read-sample2.csv 13 Jan 2008 17:27:14 -0000 1.2 *************** *** 1,4 **** ! 4 "0004" ! "this has an embedded tab" 3.2 "0000" ! "embedded ""quotes""" "-10", 0 " " ! 2.3e-4 54-23 \ No newline at end of file --- 1,4 ---- ! 4 "0004" ! "this has an embedded tab" 3.2 "0000" ! " this""quotes""" "-10, 0" " " ! 2.3e-4 54-23 \ No newline at end of file Index: readsamples.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/readsamples.q,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** readsamples.q 10 Jan 2008 22:54:02 -0000 1.2 --- readsamples.q 13 Jan 2008 17:27:14 -0000 1.3 *************** *** 2,6 **** To run: ! at the command line> q readsamples.q at the prompt ==> main */ --- 2,6 ---- To run: ! at the command line> Q readsamples.q at the prompt ==> main */ *************** *** 17,21 **** Note that integer and float fields are automatically converted. */ readfile F = [] if feof F; ! = [freadcsv F | readfile F]; /* Illustration of freadcsv_string --- 17,21 ---- Note that integer and float fields are automatically converted. */ readfile F = [] if feof F; ! = [freadcsv_data F | readfile F]; /* Illustration of freadcsv_string *************** *** 26,47 **** /* Illustration of freadcsv with tab delimeter */ readfile_tab F = [] if feof F; ! = [freadcsv (F, "\t") | readfile_tab F]; /* Illustration of freadcsv with tab and quote delimeters */ readfile_tab_quote F = [] if feof F; ! = [freadcsv (F, "\t", ",") | readfile_tab_quote F]; ! main = writes "Reading 'read-sample1.csv': (standard CSV)\n" || write (readfile (fopen "read-sample1.csv" "r")) ! || writes "\n\n-----\n" ! || writes "Reading 'read-sample1.csv': (standard CSV, no convertions)\n" || write (readfile_string (fopen "read-sample1.csv" "r")) ! || writes "\n\n-----\n" ! || writes "Reading 'read-sample2.csv': (tab delimited)\n" || write (readfile_tab (fopen "read-sample2.csv" "r")) ! || writes "\n\n-----\n" ! || writes "Reading 'read-sample3.csv': (tab delimited, single quoted)\n" || write (readfile_tab (fopen "read-sample3.csv" "r")) ! || writes "\n\n-----\n" ! || writes "Reading 'read-sample4.csv': (Malformed)\n" || write (readfile (fopen "read-sample4.csv" "r")); \ No newline at end of file --- 26,47 ---- /* Illustration of freadcsv with tab delimeter */ readfile_tab F = [] if feof F; ! = [freadcsv_data (F, "\t", "\"") | readfile_tab F]; /* Illustration of freadcsv with tab and quote delimeters */ readfile_tab_quote F = [] if feof F; ! = [freadcsv_data (F, "\t", ",") | readfile_tab_quote F]; ! main = writes "Reading 'read-sample1.csv: (standard CSV)" || write (readfile (fopen "read-sample1.csv" "r")) ! || writes "\n\n-----" ! || writes "Reading 'read-sample1.csv: (standard CSV, no convertions)" || write (readfile_string (fopen "read-sample1.csv" "r")) ! || writes "\n\n-----" ! || writes "Reading 'read-sample2.csv: (tab delimited)" || write (readfile_tab (fopen "read-sample2.csv" "r")) ! || writes "\n\n-----" ! || writes "Reading 'read-sample3.csv: (tab delimited, single quoted)" || write (readfile_tab (fopen "read-sample3.csv" "r")) ! || writes "\n\n-----" ! || writes "Reading 'read-sample4.csv: (Malformed)\n" || write (readfile (fopen "read-sample4.csv" "r")); \ No newline at end of file Index: read-sample1.csv =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/read-sample1.csv,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** read-sample1.csv 10 Jan 2008 22:41:21 -0000 1.1.1.1 --- read-sample1.csv 13 Jan 2008 17:27:14 -0000 1.2 *************** *** 1,3 **** ! ,,4,"0004" "this, has an embedded ," ,, 3.2, "0000" "embedded ""quotes""", "-10", 0 , " " --- 1,6 ---- ! ,,4,"0004" ! "embedded ! new ! lines", "4", 0.1, "----" "this, has an embedded ," ,, 3.2, "0000" "embedded ""quotes""", "-10", 0 , " " Index: read-sample4.csv =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/read-sample4.csv,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** read-sample4.csv 10 Jan 2008 22:41:21 -0000 1.1.1.1 --- read-sample4.csv 13 Jan 2008 17:27:14 -0000 1.2 *************** *** 1,4 **** ! ,,4,"0004" "this, has an embedded ," ,, 3.2, "0000" embedded ""quotes"", "-10", 0 , " " ! , , , 2.3e-4 , "54-23 \ No newline at end of file --- 1,4 ---- ! ,,4,"0004" "this, has an embedded ," ,, 3.2, "0000" embedded ""quotes"", "-10", 0 , " " ! ," , , 2.3e-4 , "54-23 \ No newline at end of file |