Use findlib.
authorrich <rich>
Fri, 24 Nov 2006 09:43:15 +0000 (09:43 +0000)
committerrich <rich>
Fri, 24 Nov 2006 09:43:15 +0000 (09:43 +0000)
Separate Makefile.config.
Allow library to be compiled with Extlib to handle large CSV files.

MANIFEST
Makefile
Makefile.config [new file with mode: 0644]
csv.ml

index cbfbf46..680ff65 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,6 +1,7 @@
 .cvsignore
 .depend
 Makefile
+Makefile.config
 MANIFEST
 csv.ml
 csv.mli
index 0fa1d54..f6531f5 100644 (file)
--- 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 (file)
index 0000000..a3f90cc
--- /dev/null
@@ -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 (file)
--- 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:
 
 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