Commit 2c8136b9 authored by Pietro Abate's avatar Pietro Abate

[r2004-06-29 23:32:23 by afrisch] Inhibitable features

Original author: afrisch
Date: 2004-06-29 23:32:34+00:00
parent ab1f78b5
......@@ -188,11 +188,11 @@ ifneq ($(NETCLIENT), false)
PACKAGES += netclient
endif
OBJECTS += runtime/cduce_pxp.cmo
ifeq ($(EXPAT), true)
OBJECTS += runtime/cduce_expat.cmo
PACKAGES += expat
else
OBJECTS += runtime/cduce_pxp.cmo
endif
......
driver/config.cmo: driver/config.cmi
driver/config.cmx: driver/config.cmi
misc/stats.cmo: misc/stats.cmi
misc/stats.cmx: misc/stats.cmi
misc/serialize.cmo: misc/serialize.cmi
......@@ -238,14 +240,14 @@ driver/cduce.cmx: parser/ast.cmx types/builtin.cmx compile/compile.cmx \
types/patterns.cmx types/sample.cmx schema/schema_common.cmx \
misc/state.cmx typing/typer.cmx types/types.cmx parser/ulexer.cmx \
runtime/value.cmx driver/cduce.cmi
ocamliface/mltypes.cmo: ocamliface/asttypes.cmo driver/config.cmo \
ocamliface/mltypes.cmo: ocamliface/asttypes.cmo driver/config.cmi \
types/ident.cmo driver/librarian.cmi types/types.cmi \
ocamliface/mltypes.cmi
ocamliface/mltypes.cmx: ocamliface/asttypes.cmx driver/config.cmx \
types/ident.cmx driver/librarian.cmx types/types.cmx \
ocamliface/mltypes.cmi
ocamliface/mlstub.cmo: types/atoms.cmi types/builtin_defs.cmi \
compile/compile.cmi driver/config.cmo types/externals.cmi types/ident.cmo \
compile/compile.cmi driver/config.cmi types/externals.cmi types/ident.cmo \
driver/librarian.cmi parser/location.cmi ocamliface/mltypes.cmi \
misc/ns.cmi types/sequence.cmi typing/typer.cmi types/types.cmi \
ocamliface/mlstub.cmi
......@@ -254,8 +256,12 @@ ocamliface/mlstub.cmx: types/atoms.cmx types/builtin_defs.cmx \
driver/librarian.cmx parser/location.cmx ocamliface/mltypes.cmx \
misc/ns.cmx types/sequence.cmx typing/typer.cmx types/types.cmx \
ocamliface/mlstub.cmi
parser/cduce_curl.cmo: driver/config.cmo parser/url.cmi
parser/cduce_curl.cmo: driver/config.cmi parser/url.cmi
parser/cduce_curl.cmx: driver/config.cmx parser/url.cmx
runtime/cduce_expat.cmo: driver/config.cmi runtime/load_xml.cmi \
parser/location.cmi parser/url.cmi
runtime/cduce_expat.cmx: driver/config.cmx runtime/load_xml.cmx \
parser/location.cmx parser/url.cmx
query/query.cmo: parser/ast.cmo types/atoms.cmi types/builtin_defs.cmi \
types/chars.cmi types/ident.cmo types/intervals.cmi parser/location.cmi \
parser/parser.cmi types/types.cmi query/query.cmi
......@@ -268,7 +274,7 @@ query/query_parse.cmo: parser/ast.cmo types/atoms.cmi types/ident.cmo \
query/query_parse.cmx: parser/ast.cmx types/atoms.cmx types/ident.cmx \
parser/location.cmx parser/parser.cmx query/query.cmx types/sequence.cmx \
types/types.cmx
driver/run.cmo: types/builtin.cmi driver/cduce.cmi driver/config.cmo \
driver/run.cmo: types/builtin.cmi driver/cduce.cmi driver/config.cmi \
types/ident.cmo driver/librarian.cmi parser/location.cmi misc/state.cmi \
misc/stats.cmi parser/ulexer.cmi runtime/value.cmi
driver/run.cmx: types/builtin.cmx driver/cduce.cmx driver/config.cmx \
......
let ocaml_iface = ref false
let curl_support = ref false
let netclient_support = ref false
let expat_support = ref false
let pxp_support = ref false
let features = ref []
let init_all () = List.iter (fun (_,d,f) -> f()) (List.rev !features)
let register n d f = features := (n,d,f) :: !features
let descrs () = List.rev_map (fun (n,d,_) -> (n,d)) !features
let inhibit n = features := List.filter (fun (n',_,_) -> n <> n') !features
val init_all: unit -> unit
val register: string -> string -> (unit -> unit) -> unit
val descrs: unit -> (string * string) list
val inhibit: string -> unit
(* Last registered features are initialized last (and thus take priority) *)
......@@ -16,11 +16,8 @@ let version () =
Printf.eprintf "CDuce, version %s\n" <:symbol<cduce_version>>;
Printf.eprintf "built on %s\n" <:symbol<build_date>>;
Printf.eprintf "using OCaml %s compiler\n" <:symbol<ocaml_compiler>>;
Printf.eprintf "support for ocaml interfacing: %b\n" !Config.ocaml_iface;
Printf.eprintf "support for pxp: %b\n" !Config.pxp_support;
Printf.eprintf "support for expat: %b\n" !Config.expat_support;
Printf.eprintf "support for curl: %b\n" !Config.curl_support;
Printf.eprintf "support for netclient: %b\n" !Config.netclient_support;
Printf.eprintf "Supported features: \n";
List.iter (fun (n,d) -> Printf.eprintf "- %s: %s\n" n d) (Config.descrs ());
exit 0
let license () =
......@@ -50,6 +47,8 @@ let specs = ref
" execute the given .cdo file";
"--stdin", Arg.Unit (fun () -> src := "" :: !src),
" read CDuce script on standard input";
"--no", Arg.String Config.inhibit,
" disable a feature (cduce -v to get a list of features)";
"--debug", Arg.Unit (fun () -> Stats.set_verbosity Stats.Summary),
" print profiling/debugging information";
"-v", Arg.Unit version,
......@@ -73,6 +72,7 @@ let err s =
let mode () =
Arg.parse !specs (fun s -> src := s :: !src)
"Usage:\ncduce [OPTIONS ...] [FILE ...] [--arg argument ...]\n\nOptions:";
Config.init_all ();
match (!compile,!out_dir,!run,!src,!args) with
| false, _::_, _, _, _ ->
err "--obj-dir option can be used only with --compile"
......
......@@ -498,7 +498,7 @@ let stub name ty_env c_env values =
<:patt< ($list:items_pat$) >>, m, items_expr
let () =
let register () =
Librarian.stub_ml :=
(fun cu ty_env c_env ->
try
......@@ -534,6 +534,10 @@ let () =
let cdt = Types.descr (typ t) in
vars := [| |];
cdt
);
)
Config.ocaml_iface := true
let () =
Config.register
"ocaml"
"OCaml interface"
register
......@@ -8,6 +8,7 @@ let load_url s =
let () =
Url.load_url := load_url;
Config.curl_support := true
Config.register
"curl"
"Load external URLs with curl"
(fun () -> Url.load_url := load_url)
......@@ -27,5 +27,7 @@ let load_url s =
raise (Location.Generic msg)
let () =
Url.load_url := load_url;
Config.netclient_support := true
Config.register
"netclient"
"Load external URLs with netclient"
(fun () -> Url.load_url := load_url)
......@@ -42,6 +42,8 @@ let load_expat s =
in
raise (Location.Generic msg)
let () =
Load_xml.xml_parser := load_expat;
Config.pxp_support := true
let () =
Config.register
"expat"
"Expat XML parser"
(fun () -> Load_xml.xml_parser := load_expat)
......@@ -28,6 +28,8 @@ let load_pxp s =
with exn ->
raise (Location.Generic (Pxp_types.string_of_exn exn))
let () =
Load_xml.xml_parser := load_pxp;
Config.pxp_support := true
let () =
Config.register
"pxp"
"PXP XML parser"
(fun () -> Load_xml.xml_parser := load_pxp)
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