Commit efc13d09 authored by Pietro Abate's avatar Pietro Abate

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

Original author: cvscast
Date: 2003-05-31 11:02:27+00:00
parent c5632d3a
NATIVE = true
PROFILE = false
PXP_WLEX = false
EXPAT = false
PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi"
ifeq ($(PXP_WLEX), true)
......@@ -20,6 +21,10 @@ else
SYNTAX += -symbol ocaml_compiler=\"bytecode\"
endif
ifeq ($(EXPAT), true)
SYNTAX += -symbol EXPAT=
endif
VERSION = 0.0.9
SYNTAX_PARSER = -pp '$(SYNTAX)'
......@@ -41,10 +46,16 @@ CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) $(PACKAGES)
ifeq ($(NATIVE), true)
EXTENSION = cmx
LINK = $(CAMLOPT) -linkpkg gramlib.cmxa mlexpat.cmxa
LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
ifeq ($(EXPAT), true)
LINK += mlexpat.cmxa
endif
else
EXTENSION = cmo
LINK = $(CAMLC) -custom -linkpkg gramlib.cma mlexpat.cma
ifeq ($(EXPAT), true)
LINK += mlexpat.cma
endif
endif
all: cduce dtd2cduce local_website
......@@ -79,7 +90,11 @@ WEBIFACE = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
DTD2CDUCE = tools/dtd2cduce.cmo
DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %) -I expat
INCLUDES = $(DIRS:%=-I %)
ifeq ($(EXPAT), true)
INCLUDES += -I expat
endif
cduce: $(CDUCE:.cmo=.$(EXTENSION))
$(LINK) $(INCLUDES) -o $@ $^
......@@ -115,7 +130,7 @@ clean:
.SUFFIXES: .ml .mli .cmo .cmi .cmx
misc/q_symbol.cmo: misc/q_symbol.ml
$(CAMLC) -c $<
$(CAMLC) -c -pp 'camlp4o pa_extend.cmo q_MLast.cmo' $<
.PHONY: expat
expat:
......
......@@ -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
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
runtime/load_xml.cmo: misc/q_symbol.cmo types/atoms.cmi misc/encodings.cmi expat/expat.cmi \
types/ident.cmo parser/location.cmi runtime/value.cmi \
runtime/load_xml.cmi
runtime/load_xml.cmx: misc/q_symbol.cmo types/atoms.cmx misc/encodings.cmx expat/expat.cmx \
types/ident.cmx parser/location.cmx runtime/value.cmx \
runtime/load_xml.cmi
runtime/load_xml.cmo: misc/q_symbol.cmo types/atoms.cmi misc/encodings.cmi types/ident.cmo \
parser/location.cmi runtime/value.cmi runtime/load_xml.cmi
runtime/load_xml.cmx: misc/q_symbol.cmo types/atoms.cmx misc/encodings.cmx 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 \
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 \
......
EXPAT_LIB=-L/usr/lib -lexpat
EXPAT_LIBDIR=/usr/lib
EXPAT_INCDIR=/usr/include
EXPAT_INC=-I /usr/include
libmlexpat.a: expat_stubs.o expat.cmo expat.cmx
ocamlmklib -verbose -o mlexpat $^ $(EXPAT_LIB)
......@@ -14,5 +13,8 @@ expat.cmx: expat.cmi expat.ml
expat.cmi: expat.mli
ocamlc -c expat.mli
expat_stubs.o: expat_stubs.c
ocamlc -c $(EXPAT_INC) expat_stubs.c
clean:
rm -f *.o *.a *.so *.cmo *.cmx *.cmi *.cma *.cmxa
......@@ -8,6 +8,23 @@ let define s =
(String.sub s 0 i, String.sub s (i + 1) (String.length s - i - 1)) ::
!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 =
try List.assoc s !symbols
with Not_found -> failwith ("No definition for symbol " ^ s)
......
......@@ -72,6 +72,8 @@ let rec create_elt accu = function
let buflen = 1000
let buf = String.create buflen
ifdef EXPAT then
let load_expat s =
let p = Expat.parser_create "" in
Expat.set_start_element_handler p
......@@ -107,6 +109,12 @@ let load_expat s =
Expat.Expat_error e ->
failwith ("Expat ("^s^"):"^Expat.xml_error_to_string e)
else
let load_expat s =
failwith "Expat support not included"
let handle_event = function
| 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