ACATS 4.1 User's Guide
Title Page
Contents   Index   References   Previous   Next 

6.5 CSV File Reference

Several of the files used by the Grading Tool are .CSV (Comma Separated Value) files. This format was chosen as it:
is a pure text format that is easy to write in Ada. Records can be appended to an existing file by opening the file with Text_IO in Append_Mode, Put_Line the line of values for the record, then closing the file. No end markers need to be moved.
is reasonably easy to read in Ada using Text_IO. Get_Line and some string operations are sufficient.
can be read by most spreadsheet and database programs. Thus, we don't need to provide tools to inspect, check, or edit the contents of these files. 
A CSV consists of list of records, one record per line. Each line is a set of values, separated by commas. Each line should have the same number of values, so when loaded in a spreadsheet it becomes a series of columns with each Ada component associated with a column.
There are a number of varieties of CSV files, so we have adopted one of the simplest in order to have the widest applicability.
There are only a few restrictions on the values in our CSV files. Unquoted values must not contain commas, spaces, tabs, or semicolons. A value can be quoted with double quotes, in which case commas, spaces, tabs, and semicolons are allowed, but double quotes are not allowed in quoted strings. Line breaks are not allowed in or outside of values of a single record (they delimit the records).
We require that values are limited to 150 characters (primarily to prevent excessively long messages from making reports hard to read).
There is an example of writing a CSV file (an event trace - see 6.2) in the file Report.A, in procedure Put_Event_Trace. Most of the code involves limiting the length of, and removing any double quotes from, the (quoted) message string. 

Contents   Index   References   Previous   Next