From d2ed4971af94812bb8df88448a91db8d917f2de2 Mon Sep 17 00:00:00 2001 From: rich Date: Fri, 24 Nov 2006 09:43:15 +0000 Subject: [PATCH] Use findlib. Separate Makefile.config. Allow library to be compiled with Extlib to handle large CSV files. --- MANIFEST | 1 + Makefile | 33 ++++++++++++++++++--------------- Makefile.config | 4 ++++ csv.ml | 7 ++++++- 4 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 Makefile.config diff --git a/MANIFEST b/MANIFEST index cbfbf46..680ff65 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,6 +1,7 @@ .cvsignore .depend Makefile +Makefile.config MANIFEST csv.ml csv.mli diff --git a/Makefile b/Makefile index 0fa1d54..f6531f5 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,20 @@ -# $Id: Makefile,v 1.9 2006-10-01 13:06:04 rich Exp $ +# $Id: Makefile,v 1.10 2006-11-24 09:43:15 rich Exp $ -PACKAGE := ocaml-csv -VERSION := 1.1.2 +include Makefile.config + +# To enable support for Extlib, also uncomment 'open ExtList' at the top +# of file csv.ml. -OCAMLC := ocamlc OCAMLCINCS := -OCAMLCFLAGS := -w s -g +#OCAMLCINCS := -package extlib +OCAMLCFLAGS := -g OCAMLCLIBS := +#OCAMLCLIBS := -linkpkg -OCAMLOPT := ocamlopt OCAMLOPTINCS := $(OCAMLCINCS) -OCAMLOPTFLAGS := -w s +OCAMLOPTFLAGS := OCAMLOPTLIBS := +#OCAMLOPTLIBS := -linkpkg OBJS := csv.cmo XOBJS := $(OBJS:.cmo=.cmx) @@ -21,29 +24,29 @@ OCAMLDOCFLAGS := -html -stars -sort $(OCAMLCINCS) all: csv.cma csv.cmxa example csvtool csv.cma: $(OBJS) - $(OCAMLC) $(OCAMLCFLAGS) -a -o $@ $^ + ocamlfind ocamlc $(OCAMLCINCS) $(OCAMLCFLAGS) -a -o $@ $^ csv.cmxa: $(XOBJS) - $(OCAMLOPT) $(OCAMLOPTFLAGS) -a -o $@ $^ + ocamlfind ocamlopt $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) -a -o $@ $^ example: csv.cma example.ml - $(OCAMLC) $^ -o $@ + ocamlfind ocamlc $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) $^ -o $@ test: csv.cma test.ml - $(OCAMLC) $^ -o $@ + ocamlfind ocamlc $^ -o $@ ./test csvtool: csv.cmxa csvtool.ml - $(OCAMLOPT) $^ -o $@ + ocamlfind ocamlopt $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) $^ -o $@ # Common rules for building OCaml objects. .mli.cmi: - $(OCAMLC) $(OCAMLCFLAGS) $(OCAMLCINCS) -c $< + ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCINCS) -c $< .ml.cmo: - $(OCAMLC) $(OCAMLCFLAGS) $(OCAMLCINCS) -c $< + ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCINCS) -c $< .ml.cmx: - $(OCAMLOPT) $(OCAMLOPTFLAGS) $(OCAMLOPTINCS) -c $< + ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTINCS) -c $< .SUFFIXES: .cmo .cmi .cmx .ml .mli diff --git a/Makefile.config b/Makefile.config new file mode 100644 index 0000000..a3f90cc --- /dev/null +++ b/Makefile.config @@ -0,0 +1,4 @@ +# $Id: Makefile.config,v 1.1 2006-11-24 09:43:15 rich Exp $ + +PACKAGE := ocaml-csv +VERSION := 1.1.3 diff --git a/csv.ml b/csv.ml index b76f4b3..ee0623e 100644 --- a/csv.ml +++ b/csv.ml @@ -1,6 +1,6 @@ (* csv.ml - comma separated values parser * - * $Id: csv.ml,v 1.12 2006-10-18 14:56:12 rich Exp $ + * $Id: csv.ml,v 1.13 2006-11-24 09:43:15 rich Exp $ *) (* The format of CSV files: @@ -42,6 +42,11 @@ open Printf +(* Uncomment the next line to enable Extlib's List function. These + * avoid stack overflows on really huge CSV files. + *) +(*open ExtList*) + type t = string list list exception Bad_CSV_file of string -- 1.8.3.1