Added 'make dist' rule.
[ocaml-csv.git] / csv.mli
1 (** csv.mli - comma separated values parser
2   *
3   * $Id: csv.mli,v 1.1 2003-12-17 16:05:08 rich Exp $
4   *)
5
6 type t = string list list
7 (** Representation of CSV files. *)
8
9 exception Bad_CSV_file of string
10 (** Badly formed CSV files throw this exception: *)
11
12 val lines : t -> int
13 (** Work out the number of lines in a CSV file. *)
14
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
18    columns. *)
19
20 val load_in : in_channel -> t
21 (** Load a CSV file.
22   * @param chan Input file stream
23   *)
24
25 val load : string -> t
26 (** Load a CSV file.
27   * @param filename CSV filename.
28   *)
29
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.
34   *
35   * @param f Callout function.
36   * @param chan Input file stream.
37   *)
38
39 val print : t -> unit
40 (** Print string list list - same as [save_out stdout] *)
41
42 val save_out : out_channel -> t -> unit
43 (** Save string list list to a channel. *)
44
45 val save : string -> t -> unit
46 (** Save string list list to a file. *)