[q-lang-cvs] q-csv/examples readsamples.q, 1.3, 1.4 writesamples.q, 1.3, 1.4
Brought to you by:
agraef
From: RER <ed...@us...> - 2008-01-18 21:34:23
|
Update of /cvsroot/q-lang/q-csv/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16832/examples Modified Files: readsamples.q writesamples.q Log Message: Bugfix in tuple_to_csvstr and fixed comments in readsamples.q and writesamples.q Index: writesamples.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/writesamples.q,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** writesamples.q 13 Jan 2008 17:27:14 -0000 1.3 --- writesamples.q 18 Jan 2008 21:34:13 -0000 1.4 *************** *** 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. *************** *** 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 --- 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: readsamples.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/readsamples.q,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** readsamples.q 13 Jan 2008 17:27:14 -0000 1.3 --- readsamples.q 18 Jan 2008 21:34:13 -0000 1.4 *************** *** 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 */ *************** *** 30,47 **** /* 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 --- 30,47 ---- /* 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)\n" || write (readfile (fopen "read-sample1.csv" "r")) || writes "\n\n-----" ! || writes "Reading 'read-sample1.csv:' (standard CSV, no convertions)\n" || write (readfile_string (fopen "read-sample1.csv" "r")) || writes "\n\n-----" ! || writes "Reading 'read-sample2.csv:' (tab delimited)\n" || write (readfile_tab (fopen "read-sample2.csv" "r")) || writes "\n\n-----" ! || writes "Reading 'read-sample3.csv:' (tab delimited, single quoted)\n" ! || write (readfile_tab_quote (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 |