1 (** csv.mli - comma separated values parser
3 * $Id: csv.mli,v 1.1 2003-12-17 16:05:08 rich Exp $
6 type t = string list list
7 (** Representation of CSV files. *)
9 exception Bad_CSV_file of string
10 (** Badly formed CSV files throw this exception: *)
13 (** Work out the number of lines in a CSV file. *)
15 val columns : t -> int
16 (** Work out the (maximum) number of columns in a CSV file. Note that each
17 line may be a different length, so this finds the one with the most
20 val load_in : in_channel -> t
22 * @param chan Input file stream
25 val load : string -> t
27 * @param filename CSV filename.
30 val load_rows : (string list -> unit) -> in_channel -> unit
31 (** For very large CSV files which cannot be processed in memory at once,
32 * this function is appropriate. It parses the input one row at a time and
33 * calls your function once for each row.
35 * @param f Callout function.
36 * @param chan Input file stream.
40 (** Print string list list - same as [save_out stdout] *)
42 val save_out : out_channel -> t -> unit
43 (** Save string list list to a channel. *)
45 val save : string -> t -> unit
46 (** Save string list list to a file. *)