Commit 587fce9a authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-31 11:02:27 by cvscast] expat

Original author: cvscast
Date: 2003-05-31 11:02:27+00:00
parent aaf2760b
NATIVE = true NATIVE = true
PROFILE = false PROFILE = false
PXP_WLEX = false PXP_WLEX = false
EXPAT = false
PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi" PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi"
ifeq ($(PXP_WLEX), true) ifeq ($(PXP_WLEX), true)
...@@ -20,6 +21,10 @@ else ...@@ -20,6 +21,10 @@ else
SYNTAX += -symbol ocaml_compiler=\"bytecode\" SYNTAX += -symbol ocaml_compiler=\"bytecode\"
endif endif
ifeq ($(EXPAT), true)
SYNTAX += -symbol EXPAT=
endif
VERSION = 0.0.9 VERSION = 0.0.9
SYNTAX_PARSER = -pp '$(SYNTAX)' SYNTAX_PARSER = -pp '$(SYNTAX)'
...@@ -41,10 +46,16 @@ CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) $(PACKAGES) ...@@ -41,10 +46,16 @@ CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) $(PACKAGES)
ifeq ($(NATIVE), true) ifeq ($(NATIVE), true)
EXTENSION = cmx EXTENSION = cmx
LINK = $(CAMLOPT) -linkpkg gramlib.cmxa mlexpat.cmxa LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
ifeq ($(EXPAT), true)
LINK += mlexpat.cmxa
endif
else else
EXTENSION = cmo EXTENSION = cmo
LINK = $(CAMLC) -custom -linkpkg gramlib.cma mlexpat.cma LINK = $(CAMLC) -custom -linkpkg gramlib.cma mlexpat.cma
ifeq ($(EXPAT), true)
LINK += mlexpat.cma
endif
endif endif
all: cduce dtd2cduce local_website all: cduce dtd2cduce local_website
...@@ -79,7 +90,11 @@ WEBIFACE = $(OBJECTS) driver/examples.cmo driver/webiface.cmo ...@@ -79,7 +90,11 @@ WEBIFACE = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
DTD2CDUCE = tools/dtd2cduce.cmo DTD2CDUCE = tools/dtd2cduce.cmo
DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli) DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %) -I expat INCLUDES = $(DIRS:%=-I %)
ifeq ($(EXPAT), true)
INCLUDES += -I expat
endif
cduce: $(CDUCE:.cmo=.$(EXTENSION)) cduce: $(CDUCE:.cmo=.$(EXTENSION))
$(LINK) $(INCLUDES) -o $@ $^ $(LINK) $(INCLUDES) -o $@ $^
...@@ -115,7 +130,7 @@ clean: ...@@ -115,7 +130,7 @@ clean:
.SUFFIXES: .ml .mli .cmo .cmi .cmx .SUFFIXES: .ml .mli .cmo .cmi .cmx
misc/q_symbol.cmo: misc/q_symbol.ml misc/q_symbol.cmo: misc/q_symbol.ml
$(CAMLC) -c $< $(CAMLC) -c -pp 'camlp4o pa_extend.cmo q_MLast.cmo' $<
.PHONY: expat .PHONY: expat
expat: expat:
......
...@@ -74,12 +74,10 @@ runtime/eval.cmo: misc/q_symbol.cmo types/ident.cmo types/patterns.cmi runtime/r ...@@ -74,12 +74,10 @@ runtime/eval.cmo: misc/q_symbol.cmo types/ident.cmo types/patterns.cmi runtime/r
typing/typed.cmo types/types.cmi runtime/value.cmi runtime/eval.cmi typing/typed.cmo types/types.cmi runtime/value.cmi runtime/eval.cmi
runtime/eval.cmx: misc/q_symbol.cmo types/ident.cmx types/patterns.cmx runtime/run_dispatch.cmx \ runtime/eval.cmx: misc/q_symbol.cmo types/ident.cmx types/patterns.cmx runtime/run_dispatch.cmx \
typing/typed.cmx types/types.cmx runtime/value.cmx runtime/eval.cmi typing/typed.cmx types/types.cmx runtime/value.cmx runtime/eval.cmi
runtime/load_xml.cmo: misc/q_symbol.cmo types/atoms.cmi misc/encodings.cmi expat/expat.cmi \ runtime/load_xml.cmo: misc/q_symbol.cmo types/atoms.cmi misc/encodings.cmi types/ident.cmo \
types/ident.cmo parser/location.cmi runtime/value.cmi \ parser/location.cmi runtime/value.cmi runtime/load_xml.cmi
runtime/load_xml.cmi runtime/load_xml.cmx: misc/q_symbol.cmo types/atoms.cmx misc/encodings.cmx types/ident.cmx \
runtime/load_xml.cmx: misc/q_symbol.cmo types/atoms.cmx misc/encodings.cmx expat/expat.cmx \ parser/location.cmx runtime/value.cmx runtime/load_xml.cmi
types/ident.cmx parser/location.cmx runtime/value.cmx \
runtime/load_xml.cmi
runtime/print_xml.cmo: misc/q_symbol.cmo types/atoms.cmi misc/encodings.cmi types/ident.cmo \ runtime/print_xml.cmo: misc/q_symbol.cmo types/atoms.cmi misc/encodings.cmi types/ident.cmo \
parser/location.cmi types/sequence.cmi runtime/value.cmi parser/location.cmi types/sequence.cmi runtime/value.cmi
runtime/print_xml.cmx: misc/q_symbol.cmo types/atoms.cmx misc/encodings.cmx types/ident.cmx \ runtime/print_xml.cmx: misc/q_symbol.cmo types/atoms.cmx misc/encodings.cmx types/ident.cmx \
......
EXPAT_LIB=-L/usr/lib -lexpat EXPAT_LIB=-L/usr/lib -lexpat
EXPAT_LIBDIR=/usr/lib EXPAT_INC=-I /usr/include
EXPAT_INCDIR=/usr/include
libmlexpat.a: expat_stubs.o expat.cmo expat.cmx libmlexpat.a: expat_stubs.o expat.cmo expat.cmx
ocamlmklib -verbose -o mlexpat $^ $(EXPAT_LIB) ocamlmklib -verbose -o mlexpat $^ $(EXPAT_LIB)
...@@ -14,5 +13,8 @@ expat.cmx: expat.cmi expat.ml ...@@ -14,5 +13,8 @@ expat.cmx: expat.cmi expat.ml
expat.cmi: expat.mli expat.cmi: expat.mli
ocamlc -c expat.mli ocamlc -c expat.mli
expat_stubs.o: expat_stubs.c
ocamlc -c $(EXPAT_INC) expat_stubs.c
clean: clean:
rm -f *.o *.a *.so *.cmo *.cmx *.cmi *.cma *.cmxa rm -f *.o *.a *.so *.cmo *.cmx *.cmi *.cma *.cmxa
...@@ -8,6 +8,23 @@ let define s = ...@@ -8,6 +8,23 @@ let define s =
(String.sub s 0 i, String.sub s (i + 1) (String.length s - i - 1)) :: (String.sub s 0 i, String.sub s (i + 1) (String.length s - i - 1)) ::
!symbols !symbols
EXTEND
GLOBAL: Pcaml.str_item;
Pcaml.str_item: FIRST
[ [ "ifdef"; c = UIDENT; "then"; e1 = SELF;
"else"; e2 = SELF ->
if List.mem_assoc c !symbols then e1 else e2
| "ifdef"; c = UIDENT; "then"; e1 = SELF ->
if List.mem_assoc c !symbols then e1 else <:str_item< declare end >>
| "ifndef"; c = UIDENT; "then"; e1 = SELF;
"else"; e2 = SELF ->
if List.mem_assoc c !symbols then e2 else e1
| "ifndef"; c = UIDENT; "then"; e1 = SELF ->
if List.mem_assoc c !symbols then <:str_item< declare end >> else e1
] ];
END
let expr _ s = let expr _ s =
try List.assoc s !symbols try List.assoc s !symbols
with Not_found -> failwith ("No definition for symbol " ^ s) with Not_found -> failwith ("No definition for symbol " ^ s)
......
...@@ -72,6 +72,8 @@ let rec create_elt accu = function ...@@ -72,6 +72,8 @@ let rec create_elt accu = function
let buflen = 1000 let buflen = 1000
let buf = String.create buflen let buf = String.create buflen
ifdef EXPAT then
let load_expat s = let load_expat s =
let p = Expat.parser_create "" in let p = Expat.parser_create "" in
Expat.set_start_element_handler p Expat.set_start_element_handler p
...@@ -107,6 +109,12 @@ let load_expat s = ...@@ -107,6 +109,12 @@ let load_expat s =
Expat.Expat_error e -> Expat.Expat_error e ->
failwith ("Expat ("^s^"):"^Expat.xml_error_to_string e) failwith ("Expat ("^s^"):"^Expat.xml_error_to_string e)
else
let load_expat s =
failwith "Expat support not included"
let handle_event = function let handle_event = function
| E_start_tag (name,att,_) -> | E_start_tag (name,att,_) ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment