Read and write CSV converting to or from Smalltalk objects.
Description from: https://github.com/svenvc/docs/blob/master/neo/neo-csv-paper.md
Basically, NeoCSV deals with a format that
- is text based (ASCII, Latin1, Unicode)
- consists of records, 1 per line (any line ending convention)
- where records consist of fields separated by a delimiter (comma, tab, semicolon)
- where every record has the same number of fields
- where fields can be quoted should they contain separators or line endings
https://github.com/svenvc/docs/blob/master/neo/neo-csv-paper.md
The port was done from from http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo.
Now on github: https://github.com/svenvc/NeoCSV
To do: find out if there are changes in the meantime that need to be ported also.
Log of port of 2015 version
Name: Neo-CSV-Core-SvenVanCaekenberghe.22 Author: SvenVanCaekenberghe Time: 10 May 2015, 10:07:22.199998 pm
Name: Neo-CSV-Tests-SvenVanCaekenberghe.19 Author: SvenVanCaekenberghe Time: 10 May 2015, 10:07:41.797345 pm
For Cuis version Cuis4.2-2243.image
Changes by Hilaire Fernandez to bring it up to Cuis 7 have been merged.
-
In Pharo 4.0 (May 2015) load NeoCSV package (one-click).
-
File out class packages
- Neo-CSV-Core
- Neo-CSV-Tests
-
Rename files to
- Neo-CSV-Core-orig.st
- Neo-CSV-Tests-orig.st
-
In Cuis open File List.
-
Install package SqueakCompatibility.pck.st
-
Do the following string replacements in the original files
Replace
codePoint
withunicodeCodePoint
Replace
String crlf
withString crlfString
Replace
String cr
withString crString
Note: there is a space after 'cr' and 'crString'
Replace
String lf
withString lfString
-
Get code browser on 'Neo-CSV-Core-orig.st'
-
File in classes in the following order
- NeoNumberParser
- NeoCSVReader
- NeoCSVWriter
-
Open 'World Menu'
-
Choose 'Open'
-
Choose 'Installed Packages'
-
Click on 'Create Package'
-
Type package name 'Neo-CSV-Core'
-
Enter a description. Include reference to source of the ported file. Port of Neo-CSV-Core-SvenVanCaekenberghe.22
-
Click on 'Save'
-
Open File list on 'Neo-CSV-Tests.st'
-
Get a code browser on 'Neo-CSV-Tests.st'
-
File in class #NeoCSVTestObject
-
File in NeoNumberParserTests
-
File in NeoCSVReaderTests
-
File in NeoCSVWriterTests
-
Do not file in class #NeoCSVBenchmark as it gives a waring Wthat ZnBufferedWriteStream and ZnBufferedReadStream are not defined.
-
Created a package 'Neo-CSV-Tests' Description: Port of Neo-CSV-Tests-SvenVanCaekenberghe.19
Run SUnit tests on code which was filed in:
Result is that 51 out of 52 tests passed.
The following test fails
testHexadecimalIntegers
self assert: (NeoNumberParser parse: '7B' base: 16) equals: 123.
self assert: (NeoNumberParser parse: '7b' base: 16) equals: 123.
self assert: (NeoNumberParser parse: '-7B' base: 16) equals: -123.
self assert: (NeoNumberParser parse: '-7b' base: 16) equals: -123.
self assert: (NeoNumberParser parse: '0' base: 16) equals: 0.
The test does not fail if the code is changed to
testHexadecimalIntegers
self assert: (NeoNumberParser parse: '7B' base: 16) equals: 123.
"self assert: (NeoNumberParser parse: '7b' base: 16) equals: 123."
self assert: (NeoNumberParser parse: '-7B' base: 16) equals: -123.
"self assert: (NeoNumberParser parse: '-7b' base: 16) equals: -123."
self assert: (NeoNumberParser parse: '0' base: 16) equals: 0.
Fix code as described under section 2 -- analysis
52 out of 52 tests are green.
-
The port is OK.
-
The package requires
SqueakCompatibility.pck.st
to be loaded and at least Cuis4.2-2243.image -
The following changes were applied to the code before file in
Replace
codePoint
withunicodeCodePoint
Replace
String crlf
withString crlfString
Replace
String cr
withString crString
Note: there is a space after 'cr' and 'crString'
Replace
String lf
withString lfString
-
Class #NeoCSVBenchmark has not been ported.
-
Major port is done as of May 2015.