Commit b5cae60a authored by Giuseppe Castagna's avatar Giuseppe Castagna

Merge branch 'master' of https://git.cduce.org/cduce

Conflicts:
	CHANGES
parents d86115db 95a432f0
<<<<<<< HEAD
current
......@@ -12,10 +13,27 @@ current
- Build:
* replaced netcgi2 for netcgi1
=======
0.6.1
* Fix the source so that it can be compiled with Ocaml 4.02 and the external version of camlp4
* Upgrade Ocaml interface to support ocaml 4.02
* Modularise the Ocaml interface. This version of CDuce now supports the following combinations:
ocaml compiler | ocaml sources (for the CDuce-Ocaml interface)
3.11.x 3.12.x | 3.11.x 3.12.x
4.00/4.01 | 3.11.x 3.12.x 4.00 4.01
4.02 | 4.02
It is however recommended to use the same version of for the Ocaml compiler and the Ocaml sources
* Parallelize the Makefile (make -j works as exptected)
0.6.0
* Upgrade the Ocaml interface to support ocaml 4.00 and 4.01 (contributed by Julien Lopez)
Warning: the Ocaml interface now requires ocaml >= 4.00 and < 4.02 (4.02 is not supported)
>>>>>>> 95a432f0d7807165e15f4c5e271a2680ac8dadc7
0.5.5
* Added load_xml_subst and print_xml_subst for namespaces substitution.
(necessary for Web Services with OcCDuce and CDuce_WS).
(necessary for Web Services with OcCDuce and CDuce_WS).
0.5.4
* Added Services for Ocsigen.
......@@ -54,10 +72,10 @@ current
0.4.2
- Language:
- Language:
* Added int_of_char
- Bug fix:
- Bug fix:
* "match 1 with (x := `nil) -> x" raised an assert failure
......@@ -74,14 +92,14 @@ current
on each branch
* New "dump_xml" and "dump_xml_utf8", equivalent to the composition
of print and print_xml, but more efficient
- Implementation:
* New subtyping algorithm
* Small improvement to the pattern matching compiler
* Improve type-checking time for map
* Improve type-checking of record expressions
* Don't display warnings for unused branches in ghost (generated) pattern
* Don't display warnings for unused branches in ghost (generated) pattern
matching
- Bug fix:
......@@ -192,16 +210,16 @@ current
- ".." to denote open record types/patterns:
open record: { l1=t1 l2=t2 .. }
closed record: { l1=t1 l2=t2 }
- the ";" between fields is optional even for records
- the ";" between fields is optional even for records
(used to be optional only for attributes)
* Keywords are now allowed as type names
* Concatenation @ allowed in types
* Record concatenation + allowed in types
* Changed "string://" URL-pseudo schema to "string:"
* Changed "string://" URL-pseudo schema to "string:"
* Better resolution of external entities for PXP and expat
- Tools:
* A new tool cduce_mktop produces customized CDuce toplevels with embedded
* A new tool cduce_mktop produces customized CDuce toplevels with embedded
OCaml externals.
* Removed the validate tool.
* Don't build dtd2cduce by default (it requires PXP). An online
......@@ -225,7 +243,7 @@ current
0.2.2
- Language:
* Runtime type-check: (e :? t) raises an exception when e doesn't
* Runtime type-check: (e :? t) raises an exception when e doesn't
have type t; the exception is an explanation of why this is not the case.
(The actual message may change in the future.)
* Better return type for load_xml, defined as:
......@@ -262,7 +280,7 @@ current
Now, [ ... x::Any* ] is as efficient as [ ... ; x ]. Can also be written
[ ... /x _* ]. The [ ... ; ... ] syntax is no longer necessary
and might be deprecated.
- Bug fixes, including:
* Bug fixes in configure/Makefile for Cygwin.
* Bug fix for the compilation of complex patterns with records.
......@@ -289,7 +307,7 @@ current
* Support for URLs in load_xml, load_html, load_file, and schemas:
e.g. you can write `` load_html "http://www.cduce.org/" ''
(need either the ocurl package or the netclient package).
* More advanced (and documented) support for XML Schemas.
* More advanced (and documented) support for XML Schemas.
* Preliminary integration of CQL query language that is:
select e from p1 in e1, ... ,pn in en where e'.
* Allow structured constants in default value patterns (p := c).
......@@ -302,7 +320,7 @@ current
* argv is now an operator of type [] -> [ String* ].
* The --dump, --load, --save options are deprecated.
* Changes to the command line. "--pxp" is replaced with "--no expat".
- Implementation:
* Code upgraded to Ocaml 3.07.
* Major cleaning in progress.
......@@ -324,7 +342,7 @@ current
* Various bug fixes (expat might now work)
* Sequencing operator e1;e2 (equivalent to: let [] = e1 in e2)
* Encoded references
0.1.0
* Support for XML Namespaces
......@@ -342,7 +360,7 @@ current
* Second alpha release
* Bug fixes and syntax changes (e.g. making "fun" optional in "let fun")
* Experimenting with expat support (see expat/README)
0.0.9
0.0.9
* First public release (alpha release)
......@@ -3,6 +3,11 @@ default: cduce
include Makefile.conf
include VERSION
ifneq ($(ML_INTERFACE), false)
OCAMLIFACE=ocamliface/$(ML_INTERFACE_VERSION)
else
OCAMLIFACE=
endif
ALL_TARGET=cduce cduce_lib.cma
INSTALL_BINARIES=cduce$(EXE)
......@@ -14,10 +19,11 @@ endif
OUNIT_TESTS=eval cdnum cdsdl misc
ifeq ($(NATIVE),true)
all: cduce_lib.cmxa
ALL_TARGET += cduce_lib.cmxa
endif
PACKAGES = dynlink camlp4 ulex pcre num netstring
ALL_ML_IFACE = 3.x 4.01 4.02
# Call make with VERBOSE=true to get a trace of commands
......@@ -41,14 +47,14 @@ SYNTAX_PARSER = -syntax camlp4o $(SYNTAX:%=-ppopt %)
CAMLC_P = ocamlc -g
DEPEND_OCAMLDEP = misc/q_symbol.cmo
ifeq ($(PROFILE), true)
CAMLOPT_P = ocamlopt -p -inline 10000
CAMLOPT_P = ocamlopt -p -inline 100
ifeq ($(NATIVE), false)
CAMLC_P = ocamlcp -p a
SYNTAX_PARSER =
DEPEND_OCAMLDEP =
endif
else
CAMLOPT_P = ocamlopt -inline 10000
CAMLOPT_P = ocamlopt -inline 100
endif
OPT = -warn-error FPSXY
......@@ -138,8 +144,11 @@ help:
# Source directories
DIRS = misc parser schema typing types compile runtime driver query ocamliface win32
CLEAN_DIRS = $(DIRS) tools tests
DIRS_DEPEND = misc parser schema typing types compile runtime driver query win32
CLEAN_DIRS := $(DIRS_DEPEND) tools tests
DIRS := $(DIRS_DEPEND) $(OCAMLIFACE)
# Objects to build
......@@ -182,18 +191,11 @@ schema/schema_types.ml: schema/schema_types.mli
compile/auto_pat.ml: compile/auto_pat.mli
cp $^ $@
ML_INTERFACE_OBJS = \
ocamliface/caml_cduce.cmo \
ocamliface/mltypes.cmo ocamliface/mlstub.cmo
ifneq ($(ML_INTERFACE), false)
OBJECTS += $(ML_INTERFACE_OBJS)
endif
ifneq ($(CURL), false)
OBJECTS += parser/cduce_curl.cmo
PACKAGES += curl
endif
ifneq ($(NETCLIENT), false)
OBJECTS += parser/cduce_netclient.cmo
PACKAGES += netclient
......@@ -229,22 +231,38 @@ endif
all: $(ALL_TARGET)
OBJECTS += driver/run.cmo
ML_INTERFACE_BASE_OBJS = caml_cduce.cmo mltypes.cmo mlstub.cmo
ML_INTERFACE_BASE_SRC = $(ML_INTERFACE_BASE_OBJS:.cmo=.ml) $(ML_INTERFACE_BASE_OBJS:.cmo=.mli)
ML_INTERFACE_OBJS = \
$(ML_INTERFACE_BASE_OBJS:%=$(OCAMLIFACE)/%)
OBJECTS_NO_MLIFACE := $(OBJECTS)
ifneq ($(ML_INTERFACE), false)
OBJECTS += $(ML_INTERFACE_OBJS)
endif
CDUCE = $(OBJECTS) driver/start.cmo
ALL_OBJECTS = $(OBJECTS) \
ALL_OBJECTS = $(OBJECTS_NO_MLIFACE) \
driver/start.cmo driver/examples.cmo \
driver/webiface.cmo driver/evaluator.cmo \
tools/validate.cmo \
$(ML_INTERFACE_OBJS) parser/cduce_curl.cmo \
parser/cduce_curl.cmo \
parser/cduce_netclient.cmo \
runtime/cduce_expat.cmo runtime/cduce_pxp.cmo
ALL_INTERFACES = schema/schema_types.mli
#types/var.mli types/boolVar.mli
DEPEND = $(ALL_OBJECTS:.cmo=.ml) $(ALL_OBJECTS:.cmo=.mli) $(ALL_INTERFACES)
INCLUDES = $(DIRS:%=-I %)
INCLUDES_DEPEND = $(DIRS_DEPEND:%=-I %)
# -I +camlp4
cduce: $(CDUCE:.cmo=.$(EXTENSION))
......@@ -271,16 +289,25 @@ dtd2cduce: tools/dtd2cduce.ml
$(HIDE)$(OCAMLFIND) $(CAML) -o $@ -package "$(PXP_PACK) netcgi2" -linkpkg $^
.PHONY: compute_depend
compute_depend: $(DEPEND_OCAMLDEP)
@echo "Computing dependencies ..."
ocamlfind ocamldep -package "$(PACKAGES)" \
$(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
$(INCLUDES_DEPEND) $(SYNTAX_PARSER) -ppopt pa_extend.cmo -ppopt q_MLast.cmo $(DEPEND) > depend
for i in $(ALL_ML_IFACE); do \
touch ocamliface/$$i/caml_cduce.ml; \
ocamlfind ocamldep -package "$(PACKAGES)" \
$(INCLUDES_DEPEND) -I ocamliface/$$i $(SYNTAX_PARSER) -ppopt pa_extend.cmo -ppopt q_MLast.cmo \
$(ML_INTERFACE_BASE_SRC:%=ocamliface/$$i/%) >> depend;\
rm -f ocamliface/$$i/caml_cduce.ml; \
done
clean:
for i in $(CLEAN_DIRS); do \
(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa *~); \
done
rm -f misc/q_symbol.cmo.stamp
(cd ocamliface; $(MAKE) clean)
test -n "$(OCAMLIFACE)" && (cd $(OCAMLIFACE); $(MAKE) clean) || true
rm -f `find . -name "*~"`
rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~ META
rm -f cduce$(EXE) ocamlprof.dump
......@@ -300,36 +327,40 @@ clean:
distclean: clean
rm -f Makefile.conf
ocamliface/mltypes.$(EXTENSION): ocamliface/caml_cduce.$(EXTENSION)
.SUFFIXES: .ml .mli .cmo .cmi .cmx
$(OCAMLIFACE)/mltypes.$(EXTENSION): $(OCAMLIFACE)/caml_cduce.$(EXTENSION)
$(ALL_INTERFACES): misc/q_symbol.cmo
$(ALL_OBJECTS:.cmo=.cmi): misc/q_symbol.cmo
$(ALL_OBJECTS:.cmo=.cmx) caml_cduce.cmx: misc/q_symbol.cmo
$(ALL_OBJECTS) caml_cduce.cmo: misc/q_symbol.cmo
$(ALL_INTERFACES): misc/q_symbol.cmo.stamp
$(ALL_OBJECTS:.cmo=.cmi): misc/q_symbol.cmo.stamp
$(ALL_OBJECTS:.cmo=.cmx) caml_cduce.cmx: misc/q_symbol.cmo.stamp
$(ALL_OBJECTS) caml_cduce.cmo: misc/q_symbol.cmo.stamp
$(OCAMLIFACE)/mlstub.$(EXTENSION): SYNTAX += q_MLast.cmo
misc/q_symbol.cmo: misc/q_symbol.ml
misc/q_symbol.cmo.stamp: misc/q_symbol.ml
@echo "Build $@"
$(HIDE) $(CAMLC) -c -pp camlp4orf $<
$(HIDE) sync
$(HIDE) touch misc/q_symbol.cmo.stamp
.SUFFIXES: .ml .mli .cmo .cmi .cmx
types/boolVar.cmo: SYNTAX_PARSER=
types/boolVar.cmi: SYNTAX_PARSER=
types/boolVar.cmx: SYNTAX_PARSER=
parser/parser.$(EXTENSION): PACKAGES += camlp4.extend
.ml.cmo:
@echo "Build $@"
$(HIDE)$(CAMLC) -c $(INCLUDES) $(SYNTAX_PARSER) $<
$(HIDE)$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.ml.cmx:
@echo "Build $@"
$(HIDE)$(CAMLOPT) $(FORPACKOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
$(HIDE) $(CAMLOPT) $(FORPACKOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.mli.cmi:
@echo "Build $@"
$(HIDE)$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
$(HIDE) $(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
include depend
......@@ -360,10 +391,13 @@ install_doc: doc
### Pack OCaml modules for the CDuce/OCaml interface
ocamliface/caml_cduce.cmo:
@cd ocamliface; \
$(MAKE) caml_cduce.cmo
$(OCAMLIFACE)/caml_cduce.cmo:
@echo "Build $@"
@cd $(OCAMLIFACE); \
$(MAKE) -s MODE=byte CAMLC="$(OCAMLFIND) $(CAMLC_P)" caml_cduce.cmo
$(OCAMLIFACE)/caml_cduce.cmx:
@echo "Build $@"
@cd $(OCAMLIFACE); \
$(MAKE) -s MODE=opt CAMLOPT="$(OCAMLFIND) $(CAMLOPT_P)" caml_cduce.cmx
ocamliface/caml_cduce.cmx:
@cd ocamliface; \
$(MAKE) caml_cduce.cmx
......@@ -138,7 +138,7 @@ let check_feature f p =
else (print "disabled\n"; false)
let native =
check_feature "ocamlopt" (fun () -> command "ocamlfind ocamlopt") && !native
check_feature "ocamlopt" (fun () -> command "ocamlfind ocamlopt")
let check_pkg p () =
try
......@@ -179,7 +179,17 @@ let add_icon = match Sys.os_type with
let check_mliface dir =
(* Sys.file_exists (Filename.concat dir "typing/types.ml") *)
Sys.file_exists (Filename.concat dir "typing/types.ml")
List.for_all (fun f ->
Sys.file_exists (Filename.concat dir f))
[ "typing/types.ml"; "VERSION" ]
let mliface_version dir =
let ic = open_in (Filename.concat dir "VERSION") in
let s = input_line ic in
close_in ic;
if s < "4" then "3.x"
else if s < "4.02" then "4.01"
else "4.02"
let ocaml_stdlib () =
if (Sys.command "ocamlc -where > ocaml_stdlib" <> 0) then
......@@ -195,17 +205,19 @@ let make_absolute dir =
then Filename.concat (Sys.getcwd ()) dir
else dir
let ml_interface =
let ml_interface, mliface_version =
let dir1 = !(List.assoc "mliface" vars) in
let dirs = if dir1 = "" then [] else [ make_absolute dir1 ] in
print "ocaml sources... ";
let rec loop = function
| [] ->
print "not found (the interface will not be built)\n";
None
None, ""
| d::dirs ->
if check_mliface d then
(print ("found: " ^ d ^ "\n"); Some d)
let version = mliface_version d in
(print ("found: " ^ d ^ ", version " ^ version ^ "\n");
Some d, version)
else loop dirs
in
loop dirs
......@@ -285,7 +297,7 @@ let () =
fprintf out "# This file has been generated by the configure script\n";
fprintf out "NATIVE=%b\n" native;
(match ml_interface with
| Some d -> fprintf out "ML_INTERFACE=true\nOCAML_SRC=%s\n" d
| Some d -> fprintf out "ML_INTERFACE=true\nOCAML_SRC=%s\nML_INTERFACE_VERSION=%s\n" d mliface_version
| None -> fprintf out "ML_INTERFACE=false\n");
fprintf out "PXP=%b\n" pxp;
fprintf out "EXPAT=%b\n" expat;
......
......@@ -336,20 +336,6 @@ tools/validate.cmo : schema/schema_types.cmi schema/schema_parser.cmi \
schema/schema_common.cmi
tools/validate.cmx : schema/schema_types.cmx schema/schema_parser.cmx \
schema/schema_common.cmx
ocamliface/mltypes.cmo : types/ident.cmo ocamliface/config.cmo \
parser/cduce_loc.cmi ocamliface/mltypes.cmi
ocamliface/mltypes.cmx : types/ident.cmx ocamliface/config.cmx \
parser/cduce_loc.cmx ocamliface/mltypes.cmi
ocamliface/mlstub.cmo : types/types.cmi typing/typer.cmi types/sequence.cmi \
misc/ns.cmi ocamliface/mltypes.cmi driver/librarian.cmi types/ident.cmo \
types/externals.cmi compile/compile.cmi parser/cduce_loc.cmi \
driver/cduce_config.cmi types/builtin_defs.cmi types/atoms.cmi \
parser/ast.cmo ocamliface/mlstub.cmi
ocamliface/mlstub.cmx : types/types.cmx typing/typer.cmx types/sequence.cmx \
misc/ns.cmx ocamliface/mltypes.cmx driver/librarian.cmx types/ident.cmx \
types/externals.cmx compile/compile.cmx parser/cduce_loc.cmx \
driver/cduce_config.cmx types/builtin_defs.cmx types/atoms.cmx \
parser/ast.cmx ocamliface/mlstub.cmi
parser/cduce_curl.cmo : runtime/value.cmi parser/url.cmi \
driver/cduce_config.cmi
parser/cduce_curl.cmx : runtime/value.cmx parser/url.cmx \
......@@ -445,9 +431,69 @@ driver/cduce.cmi : runtime/value.cmi types/atoms.cmi
runtime/cduce_pxp.cmi :
runtime/cduce_pxp.cmi :
runtime/cduce_expat.cmi :
ocamliface/mltypes.cmi : types/types.cmi types/ident.cmo
ocamliface/mlstub.cmi : parser/ast.cmo
runtime/cduce_expat.cmi :
runtime/cduce_pxp.cmi :
schema/schema_types.cmi : runtime/value.cmi misc/ns.cmi misc/encodings.cmi \
types/atoms.cmi
ocamliface/3.x/caml_cduce.cmo :
ocamliface/3.x/caml_cduce.cmx :
ocamliface/3.x/mltypes.cmo : types/ident.cmo parser/cduce_loc.cmi \
ocamliface/3.x/caml_cduce.cmo ocamliface/3.x/mltypes.cmi
ocamliface/3.x/mltypes.cmx : types/ident.cmx parser/cduce_loc.cmx \
ocamliface/3.x/caml_cduce.cmx ocamliface/3.x/mltypes.cmi
ocamliface/3.x/mlstub.cmo : types/types.cmi typing/typer.cmi \
types/sequence.cmi misc/ns.cmi ocamliface/3.x/mltypes.cmi \
driver/librarian.cmi types/ident.cmo types/externals.cmi \
compile/compile.cmi parser/cduce_loc.cmi driver/cduce_config.cmi \
types/builtin_defs.cmi types/atoms.cmi parser/ast.cmo \
ocamliface/3.x/mlstub.cmi
ocamliface/3.x/mlstub.cmx : types/types.cmx typing/typer.cmx \
types/sequence.cmx misc/ns.cmx ocamliface/3.x/mltypes.cmx \
driver/librarian.cmx types/ident.cmx types/externals.cmx \
compile/compile.cmx parser/cduce_loc.cmx driver/cduce_config.cmx \
types/builtin_defs.cmx types/atoms.cmx parser/ast.cmx \
ocamliface/3.x/mlstub.cmi
ocamliface/3.x/mltypes.cmi : types/types.cmi ocamliface/3.x/caml_cduce.cmo
ocamliface/3.x/mlstub.cmi : parser/ast.cmo
ocamliface/4.01/caml_cduce.cmo :
ocamliface/4.01/caml_cduce.cmx :
ocamliface/4.01/mltypes.cmo : types/ident.cmo parser/cduce_loc.cmi \
ocamliface/4.01/caml_cduce.cmo ocamliface/4.01/mltypes.cmi
ocamliface/4.01/mltypes.cmx : types/ident.cmx parser/cduce_loc.cmx \
ocamliface/4.01/caml_cduce.cmx ocamliface/4.01/mltypes.cmi
ocamliface/4.01/mlstub.cmo : types/types.cmi typing/typer.cmi \
types/sequence.cmi misc/ns.cmi ocamliface/4.01/mltypes.cmi \
driver/librarian.cmi types/ident.cmo types/externals.cmi \
compile/compile.cmi parser/cduce_loc.cmi driver/cduce_config.cmi \
ocamliface/4.01/caml_cduce.cmo types/builtin_defs.cmi types/atoms.cmi \
parser/ast.cmo ocamliface/4.01/mlstub.cmi
ocamliface/4.01/mlstub.cmx : types/types.cmx typing/typer.cmx \
types/sequence.cmx misc/ns.cmx ocamliface/4.01/mltypes.cmx \
driver/librarian.cmx types/ident.cmx types/externals.cmx \
compile/compile.cmx parser/cduce_loc.cmx driver/cduce_config.cmx \
ocamliface/4.01/caml_cduce.cmx types/builtin_defs.cmx types/atoms.cmx \
parser/ast.cmx ocamliface/4.01/mlstub.cmi
ocamliface/4.01/mltypes.cmi : types/types.cmi types/ident.cmo \
ocamliface/4.01/caml_cduce.cmo
ocamliface/4.01/mlstub.cmi : parser/ast.cmo
ocamliface/4.02/caml_cduce.cmo :
ocamliface/4.02/caml_cduce.cmx :
ocamliface/4.02/mltypes.cmo : types/ident.cmo parser/cduce_loc.cmi \
ocamliface/4.02/caml_cduce.cmo ocamliface/4.02/mltypes.cmi
ocamliface/4.02/mltypes.cmx : types/ident.cmx parser/cduce_loc.cmx \
ocamliface/4.02/caml_cduce.cmx ocamliface/4.02/mltypes.cmi
ocamliface/4.02/mlstub.cmo : types/types.cmi typing/typer.cmi \
types/sequence.cmi misc/ns.cmi ocamliface/4.02/mltypes.cmi \
driver/librarian.cmi types/ident.cmo types/externals.cmi \
compile/compile.cmi parser/cduce_loc.cmi driver/cduce_config.cmi \
ocamliface/4.02/caml_cduce.cmo types/builtin_defs.cmi types/atoms.cmi \
parser/ast.cmo ocamliface/4.02/mlstub.cmi
ocamliface/4.02/mlstub.cmx : types/types.cmx typing/typer.cmx \
types/sequence.cmx misc/ns.cmx ocamliface/4.02/mltypes.cmx \
driver/librarian.cmx types/ident.cmx types/externals.cmx \
compile/compile.cmx parser/cduce_loc.cmx driver/cduce_config.cmx \
ocamliface/4.02/caml_cduce.cmx types/builtin_defs.cmx types/atoms.cmx \
parser/ast.cmx ocamliface/4.02/mlstub.cmi
ocamliface/4.02/mltypes.cmi : types/types.cmi types/ident.cmo \
ocamliface/4.02/caml_cduce.cmo
ocamliface/4.02/mlstub.cmi : parser/ast.cmo
This diff is collapsed.
Subproject commit f12f696955d17ef8a9074f1dc7fe7be24d6c95e5
Subproject commit ecc80c0d3850bc144760af4c63b7eab438615bdc
# This Makefile generates caml_cduce.cmo/.cmx
# It must be called with an OCAML_SRC argument pointing to the root
# of an OCaml source tree.
include ../../Makefile.conf
OCAMLFILES=ocaml_files.$(MODE)
all: caml_cduce.cmo caml_cduce.cmx
STDLIB=$(shell ocamlc -where)
ifeq ($(FORPACK),true)
FORPACKOPT1=-for-pack Cduce_lib.Caml_cduce
FORPACKOPT2=-for-pack Cduce_lib
else
FORPACKOPT1=
FORPACKOPT2=
endif
$(OCAMLFILES):
test -d $(OCAMLFILES) || mkdir $(OCAMLFILES)
$(HIDE)cp $(patsubst %,$(OCAML_SRC)/%, $(COPY_FILES)) $(OCAMLFILES)/
cp location.ml $(OCAMLFILES)/location.ml
cp $(OCAMLFILES)/asttypes.mli $(OCAMLFILES)/asttypes.ml
sed s=STDLIB=$(STDLIB)= config.mlp > $(OCAMLFILES)/config.ml
grep cmi_magic $(OCAML_SRC)/utils/config.mlp >> $(OCAMLFILES)/config.ml
caml_cduce.cmo: ocaml_files.byte
@echo "Build $@"
(cd ocaml_files.byte; \
ocamlc $(FORPACKOPT1) -c $(COMPILE_FILES); \
ocamlc $(FORPACKOPT2) -pack -o $@ $(OBJECTS); \
cp caml_cduce.cmo caml_cduce.cmi ..)
caml_cduce.cmx: ocaml_files.opt
@echo "Build $@"
(cd ocaml_files.opt; \
ocamlopt $(FORPACKOPT1) -c $(COMPILE_FILES); \
ocamlopt $(FORPACKOPT2) -pack -o $@ $(XOBJECTS); \
cp caml_cduce.cmx caml_cduce.o caml_cduce.cmi ..)
clean:
rm -Rf ocaml_files.* *~ *.cm* *.o
COPY_FILES=\
typing/annot.mli \
utils/misc.ml utils/tbl.ml \
utils/consistbl.ml utils/warnings.ml utils/terminfo.ml utils/clflags.ml \
parsing/asttypes.mli parsing/location.mli \
parsing/longident.ml \
typing/outcometree.mli \
typing/ident.ml typing/path.ml \
typing/primitive.ml typing/types.ml \
typing/btype.ml typing/oprint.ml \
typing/subst.ml typing/predef.ml \
typing/datarepr.ml typing/env.ml \
typing/ctype.ml typing/ctype.mli typing/printtyp.ml
COMPILE_FILES=\
asttypes.mli outcometree.mli asttypes.ml \
config.ml misc.ml tbl.ml \
clflags.ml consistbl.ml warnings.ml terminfo.ml \
location.mli location.ml annot.mli longident.ml \
ident.ml path.ml \
primitive.ml types.ml \
btype.ml oprint.ml \
subst.ml predef.ml \
datarepr.ml env.ml ctype.mli ctype.ml printtyp.ml
COMPILE_FILES_ML=$(filter %.ml,$(COMPILE_FILES))
OBJECTS=$(COMPILE_FILES_ML:.ml=.cmo)
XOBJECTS=$(COMPILE_FILES_ML:.ml=.cmx)
(* An implementation of the OCaml's Location signature (to cut dependencies
to other OCaml modules *)
open Lexing
type t = { loc_start: position; loc_end: position; loc_ghost: bool }
let none = { loc_start = dummy_pos; loc_end = dummy_pos; loc_ghost = true }
let dummy x = assert false
let in_file = dummy
let init = dummy
let curr = dummy
let symbol_rloc = dummy
let symbol_gloc = dummy
let rhs_loc = dummy
let input_name = ref ""
let input_lexbuf = ref None
let get_pos_info = dummy
let print_error_cur_file = dummy
let print_error = dummy
let print = dummy
let print_warning = dummy
let prerr_warning = dummy
let echo_eof = dummy
let reset = dummy
let highlight_locations = dummy
This diff is collapsed.
(**************************************************************************)
(* The CDuce compiler *)
(* Alain Frisch <Alain.Frisch@inria.fr> and the CDuce team *)
(* Copyright CNRS,INRIA, 2003-2009 (see LICENSE for details) *)
(**************************************************************************)
open Camlp4.PreCast
val gen_wrapper: string list -> Ast.str_item
This diff is collapsed.
(**************************************************************************)
(* The CDuce compiler *)
(* Alain Frisch <Alain.Frisch@inria.fr> and the CDuce team *)
(* Copyright CNRS,INRIA, 2003-2009 (see LICENSE for details) *)
(**************************************************************************)
open Caml_cduce
open Asttypes
open Types
exception Error of string
type t = { uid : int; mutable recurs : int; mutable def : def }
and def =
| Link of t
| Arrow of string * t * t
| Tuple of t list
| PVariant of (string * t option) list (* Polymorphic variant *)
| Variant of string * (string * t list) list * bool
| Record of string * (string * t) list * bool
| Builtin of string * t list
| Abstract of string
| Var of int
val reg_uid: t -> unit
(* Load an external .cmi *)
val has_cmi: string -> bool
val load_module: string -> (string * t) list
(* Load the .cmi corresponding to a CDuce compilation unit *)
val read_cmi: string -> string * (string * Types.type_expr * t) list
val print : Format.formatter -> t -> unit
val print_ocaml : Format.formatter -> Types.type_expr -> unit
val find_value: string -> t * int
# This Makefile generates caml_cduce.cmo/.cmx
# It must be called with an OCAML_SRC argument pointing to the root
# of an OCaml source tree.
include ../../Makefile.conf
OCAMLFILES=ocaml_files.$(MODE)
all: caml_cduce.cmo caml_cduce.cmx
STDLIB=$(shell ocamlc -where)
ifeq ($(FORPACK),true)
FORPACKOPT1=-for-pack Cduce_lib.Caml_cduce
FORPACKOPT2=-for-pack Cduce_lib
else
FORPACKOPT1=
FORPACKOPT2=
endif
$(OCAMLFILES):
test -d $(OCAMLFILES) || mkdir $(OCAMLFILES)
$(HIDE)cp $(patsubst %,$(OCAML_SRC)/%, $(COPY_FILES)) $(OCAMLFILES)/
cp location.ml $(OCAMLFILES)/location.ml
cp $(OCAMLFILES)/asttypes.mli $(OCAMLFILES)/asttypes.ml
sed s=STDLIB=$(STDLIB)= config.mlp > $(OCAMLFILES)/config.ml
grep cmi_magic $(OCAML_SRC)/utils/config.mlp | head -1 >> $(OCAMLFILES)/config.ml
caml_cduce.cmo: ocaml_files.byte
@echo "Build $@"
(cd ocaml_files.byte; \
ocamlc $(FORPACKOPT1) -c $(COMPILE_FILES); \
ocamlc $(FORPACKOPT2) -pack -o $@ $(OBJECTS); \
cp caml_cduce.cmo caml_cduce.cmi ..)
caml_cduce.cmx: ocaml_files.opt
@echo "Build $@"
(cd ocaml_files.opt; \
ocamlopt $(FORPACKOPT1) -c $(COMPILE_FILES); \
ocamlopt $(FORPACKOPT2) -pack -o $@ $(XOBJECTS); \
cp caml_cduce.cmx caml_cduce.o caml_cduce.cmi ..)
clean:
rm -Rf ocaml_files.* *~ *.cm* *.o
COPY_FILES=\
typing/annot.mli \
utils/misc.ml utils/tbl.ml \
utils/consistbl.ml utils/warnings.ml utils/terminfo.ml utils/clflags.mli \
utils/clflags.ml \
parsing/asttypes.mli parsing/location.mli \
parsing/longident.ml \
typing/outcometree.mli \
typing/ident.ml typing/path.ml \
typing/primitive.ml typing/types.ml \
typing/btype.ml typing/oprint.ml \
typing/subst.ml typing/predef.ml \
typing/datarepr.ml typing/env.ml \
typing/ctype.ml typing/ctype.mli typing/printtyp.ml typing/cmi_format.mli typing/cmi_format.ml
COMPILE_FILES=\
warnings.ml location.mli asttypes.mli outcometree.mli annot.mli asttypes.ml \
config.ml misc.ml tbl.ml \
clflags.mli \
clflags.ml consistbl.ml terminfo.ml \
location.ml longident.ml \
ident.ml path.ml \
primitive.ml types.ml \
btype.ml oprint.ml \
subst.ml predef.ml \
datarepr.ml cmi_format.mli cmi_format.ml env.ml ctype.mli ctype.ml printtyp.ml
COMPILE_FILES_ML=$(filter %.ml,$(COMPILE_FILES))
OBJECTS=$(COMPILE_FILES_ML:.ml=.cmo)
XOBJECTS=$(COMPILE_FILES_ML:.ml=.cmx)
let standard_library = "STDLIB"
let load_path = ref ([] : string list)
let bytecomp_c_compiler = ""
let bytecomp_c_linker = ""
#load "q_MLast.cmo";;
(* TODO:
- optimizations: generate labels and atoms only once.
- translate record to open record on positive occurence
......
# This Makefile generates caml_cduce.cmo/.cmx
# It must be called with an OCAML_SRC argument pointing to the root
# of an OCaml source tree.
include ../Makefile.conf
include ../../Makefile.conf
ifneq ($(VERBOSE), true)