Commit b48028b1 authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Add a global flag to silence warning 58 complaining about -opaque and external libraries.

parent 66290bb1
......@@ -3,3 +3,4 @@ include (Cduce_curl: sig end)
include (Cduce_expat: sig end)
include (Fake_cduce_pxp: sig end)
include (System: sig end)
module Run = Run
\ No newline at end of file
(library
(name cduce_native_backend)
(public_name cduce.native_backend)
(public_name cduce.lib.native_backend)
(library_flags (-linkall))
(modules
(:standard
......@@ -9,7 +9,7 @@
(libraries
unix
cduce-types
cduce.core
cduce_core
(select
cduce_curl.ml
from
......@@ -34,16 +34,16 @@
(library
(name cduce_pxp)
(public_name cduce.native_backend.pxp)
(public_name cduce.lib.native_backend.pxp)
(optional)
(modules cduce_pxp)
(library_flags (-linkall))
(libraries threads pxp cduce-types cduce.core))
(libraries threads.posix pxp cduce-types cduce_core))
(library
(name cduce_netclient)
(public_name cduce.native_backend.netclient)
(public_name cduce.lib.native_backend.netclient)
(optional)
(modules cduce_netclient)
(library_flags (-linkall))
(libraries threads netclient cduce-types cduce.core))
(libraries threads.posix netclient cduce-types cduce_core))
open Cduce_lib
open Cduce_core
let out_dir = ref [] (* directory of the output file *)
let src = ref []
......@@ -17,12 +16,12 @@ let mlstub = ref false
let topstub = ref false
let version () =
Printf.eprintf "CDuce, version %s\n" Cduce_core.Version.cduce_version;
Printf.eprintf "Using OCaml %s compiler\n" Cduce_core.Version.ocaml_compiler;
Printf.eprintf "CDuce, version %s\n" Version.cduce_version;
Printf.eprintf "Using OCaml %s compiler\n" Version.ocaml_compiler;
Printf.eprintf "Supported features: \n";
List.iter
(fun (n, d) -> Printf.eprintf "- %s: %s\n" n d)
(Cduce_core.Cduce_config.descrs ());
(Cduce_config.descrs ());
exit 0
let specs =
......@@ -137,6 +136,7 @@ let toploop () =
in
let quit () =
outflush "\n";
restore ();
exit 0
in
......@@ -176,7 +176,7 @@ let main () =
Cduce_loc.set_viewport (Html.create false);
let m = mode () in
(* May call Cduce_config.inhibit while parsing the command line *)
let () = Cduce_core.Cduce_config.init_all () in
let () = Cduce_config.init_all () in
match m with
| `Toplevel args ->
Cduce_driver.set_argv args;
......
Run.main ()
Cduce_lib.Run.main ()
\ No newline at end of file
......@@ -2,10 +2,19 @@
(name cduce_lib)
(public_name cduce.lib)
(library_flags (-linkall))
(libraries cduce-types cduce.core cduce.native_backend cduce.ocamliface)
)
(libraries
cduce-types
cduce.lib.core
cduce.lib.native_backend
cduce.lib.ocamliface))
(rule
(deps )
(target cduce_lib.ml)
(action (write-file %{target} "include Cduce_core")))
\ No newline at end of file
(env
(dev
(flags
(:standard -w -58))))
(rule
(deps)
(target cduce_lib.ml)
(action
(write-file %{target} "include Cduce_core\ninclude Cduce_native_backend")))
(lang dune 2.8)
(using menhir 2.0)
(version 0.7.0-rc5)
(generate_opam_files true)
(source (uri "https://gitlab.math.univ-paris-diderot.fr/cduce/cduce/"))
(source
(uri "https://gitlab.math.univ-paris-diderot.fr/cduce/cduce/"))
(license MIT)
(authors "Alain Frisch")
(maintainers "Kim Nguyen")
(maintainers "Kim Nguyen")
(package
(name cduce-types)
(synopsis "CDuce type library")
(description "aa")
)
(description "aa"))
(package
(name cduce)
(synopsis "The CDuce compiler")
(description "aa")
(depends cduce-types)
)
\ No newline at end of file
(depends cduce-types))
......@@ -2,8 +2,8 @@
(library
(name cduce_core)
(public_name cduce.core)
(libraries dune-build-info cduce-types sedlex)
(public_name cduce.lib.core)
(libraries cduce-types sedlex)
(flags
(-open Cduce_types))
(modules
......@@ -28,14 +28,7 @@
(>= %{ocaml_version} 4.10)))
(rule
(deps )
(deps ../tools/print_version.exe)
(target version.ml)
(action (write-file %{target} "
let cduce_version =
(match Build_info.V1.version () with
| None -> \"n/a\"
| Some v -> Build_info.V1.Version.to_string v)
let ocaml_compiler = \"%{ocaml_version}\"
"))
(action (with-stdout-to %{target} (run ../tools/print_version.exe)))
)
\ No newline at end of file
(library
(name cduce_ocamliface)
(public_name cduce.ocamliface)
(public_name cduce.lib.ocamliface)
(library_flags (-linkall))
(modules
(:standard
......
......@@ -56,9 +56,9 @@ and typ_descr = function
| Builtin ("array", [t]) -> Types.descr (Sequence.star_node (typ t))
| Builtin ("Stdlib.ref", [t]) -> Builtin_defs.ref_type (typ t)
| Builtin ("Big_int.big_int", []) -> Builtin_defs.int
| Builtin ("Cduce_core.Value.t", []) -> Types.any
| Builtin ("Cduce_core.Encodings.Utf8.t", []) -> Builtin_defs.string
| Builtin ("Cduce_core.Atoms.V.t", []) -> Builtin_defs.atom
| Builtin ("Cduce_lib.Value.t", []) -> Types.any
| Builtin ("Cduce_lib.Encodings.Utf8.t", []) -> Builtin_defs.string
| Builtin ("Cduce_lib.Atoms.V.t", []) -> Builtin_defs.atom
| Builtin ("unit", []) -> Sequence.nil_type
| Builtin ("option", [t]) -> Sequence.option (typ t)
| Var i -> Types.descr (!vars).(i)
......@@ -180,13 +180,13 @@ end
module CD =
struct
let atom_ascii lab =
ML.sapply "Cduce_core.Value.atom_ascii" [ ML.str_e lab ]
ML.sapply "Cduce_lib.Value.atom_ascii" [ ML.str_e lab ]
let label_ascii lab =
ML.sapply "Cduce_core.Value.label_ascii" [ ML.str_e lab ]
ML.sapply "Cduce_lib.Value.label_ascii" [ ML.str_e lab ]
let pair e1 e2 =
ML.constr "Cduce_core.Value.Pair"
ML.constr "Cduce_lib.Value.Pair"
(Some (ML.tuple [e1; e2]))
let rec tuple = function
......@@ -196,12 +196,12 @@ struct
let rec matches ine oute = function
| [v1;v2] ->
ML.let_in (ML.pat_tuple [ML.pat_var v1; ML.pat_var v2]) (ML.sapply "Cduce_core.Value.get_pair" [ ine ])
ML.let_in (ML.pat_tuple [ML.pat_var v1; ML.pat_var v2]) (ML.sapply "Cduce_lib.Value.get_pair" [ ine ])
oute
| v::vl ->
let r = mk_var () in
let oute = matches (ML.var r) oute vl in
ML.let_in (ML.pat_tuple [ML.pat_var v; (ML.pat_var r)]) (ML.sapply "Cduce_core.Value.get_pair" [ ine ])
ML.let_in (ML.pat_tuple [ML.pat_var v; (ML.pat_var r)]) (ML.sapply "Cduce_lib.Value.get_pair" [ ine ])
oute
| [] -> assert false
......@@ -298,7 +298,7 @@ and to_cd_descr e = function
ML.(some (cons (tuple [tt;ss]) nil))
else ML.none
in
ML.constr "Cduce_core.Value.Abstraction" (Some ML.(tuple [iface; abs]))
ML.constr "Cduce_lib.Value.Abstraction" (Some ML.(tuple [iface; abs]))
)
e
| Tuple tl ->
......@@ -357,18 +357,18 @@ and to_cd_descr e = function
ML.tuple [CD.label_ascii lab; e])
l
in
ML.sapply "Cduce_core.Value.record" [ (ML.list_list l) ])
ML.sapply "Cduce_lib.Value.record" [ (ML.list_list l) ])
e
| Abstract "int" -> ML.sapply "Cduce_core.Value.ocaml2cduce_int" [e]
| Abstract "char" -> ML.sapply "Cduce_core.Value.ocaml2cduce_char" [e]
| Abstract "string" -> ML.sapply "Cduce_core.Value.ocaml2cduce_string" [e]
| Abstract s -> ML.sapply "Cduce_core.Value.abstract" [ML.str_e s; e]
| Abstract "int" -> ML.sapply "Cduce_lib.Value.ocaml2cduce_int" [e]
| Abstract "char" -> ML.sapply "Cduce_lib.Value.ocaml2cduce_char" [e]
| Abstract "string" -> ML.sapply "Cduce_lib.Value.ocaml2cduce_string" [e]
| Abstract s -> ML.sapply "Cduce_lib.Value.abstract" [ML.str_e s; e]
| Builtin ("list", [t]) ->
(* Value.sequence_rev (List.rev_map fun_t <...>) *)
ML.(sapply "Cduce_core.Value.sequence_rev" [ (sapply "Stdlib.List.rev_map" [var (to_cd_fun t); e])])
ML.(sapply "Cduce_lib.Value.sequence_rev" [ (sapply "Stdlib.List.rev_map" [var (to_cd_fun t); e])])
| Builtin ("array",[t]) ->
ML.(sapply "Cduce_core.Value.sequence_rev"
ML.(sapply "Cduce_lib.Value.sequence_rev"
[ (sapply "Stdlib.List.rev_map" [var (to_cd_fun t);
(sapply "Stdlib.Array.to_list" [e])])])
| Builtin ("Stdlib.ref",[t]) ->
......@@ -400,21 +400,21 @@ and to_cd_descr e = function
let y = mk_var () in
let tr_y = to_ml (var y) t in
let set = fun_ y (setfield e (lid "contents") tr_y) in
ML.sapply "Cduce_core.Value.mk_ext_ref" [ tt; get; set ]
ML.sapply "Cduce_lib.Value.mk_ext_ref" [ tt; get; set ]
) e)
| Builtin ("Big_int.big_int", []) ->
ML.sapply "Cduce_core.Value.ocaml2cduce_bigint" [ e ]
| Builtin ("Cduce_core.Value.t", []) -> e
| Builtin ("Cduce_core.Encodings.Utf8.t", []) ->
ML.sapply "Cduce_core.Value.ocaml2cduce_string_utf8" [e]
| Builtin ("Cduce_core.Atoms.V.t", []) ->
ML.sapply "Cduce_core.Value.ocaml2cduce_atom" [e]
ML.sapply "Cduce_lib.Value.ocaml2cduce_bigint" [ e ]
| Builtin ("Cduce_lib.Value.t", []) -> e
| Builtin ("Cduce_lib.Encodings.Utf8.t", []) ->
ML.sapply "Cduce_lib.Value.ocaml2cduce_string_utf8" [e]
| Builtin ("Cduce_lib.Atoms.V.t", []) ->
ML.sapply "Cduce_lib.Value.ocaml2cduce_atom" [e]
| Builtin ("unit", []) ->
ML.(let_in (pany()) e (var "Cduce_core.Value.nil"))
ML.(let_in (pany()) e (var "Cduce_lib.Value.nil"))
| Var _ -> e
| Builtin ("option", [t]) ->
ML.sapply "Cduce_core.Value.ocaml2cduce_option" [ ML.var (to_cd_fun t); e]
ML.sapply "Cduce_lib.Value.ocaml2cduce_option" [ ML.var (to_cd_fun t); e]
| _ -> assert false
and tuple_to_cd tl vars =
......@@ -436,7 +436,7 @@ and to_ml_descr e = function
(fun y ->
let x = mk_var () in
let arg = to_cd (ML.var x) t in
let res = to_ml (ML.sapply "Cduce_core.Eval.eval_apply" [y; arg]) s in
let res = to_ml (ML.sapply "Cduce_lib.Eval.eval_apply" [y; arg]) s in
abstr_lab l x res
)
e
......@@ -471,7 +471,7 @@ and to_ml_descr e = function
l
in
let cases = cases @ [ ML.(case (pany()) assert_false) ] in
ML.pmatch (ML.sapply "Cduce_core.Value.get_variant" [e]) cases
ML.pmatch (ML.sapply "Cduce_lib.Value.get_variant" [e]) cases
| Variant (_,l,false) -> failwith "Private Sum type"
| Variant (p,l,true) ->
let cases =
......@@ -513,7 +513,7 @@ and to_ml_descr e = function
) l
in
let cases = cases @ [ ML.(case (pany()) assert_false) ] in
ML.pmatch (ML.sapply "Cduce_core.Value.get_variant" [e]) cases
ML.pmatch (ML.sapply "Cduce_lib.Value.get_variant" [e]) cases
| Record (_,l,false) -> failwith "Private Record type"
| Record (p,l,true) ->
(* (\* let x = <...> in
......@@ -540,33 +540,33 @@ and to_ml_descr e = function
)
| Abstract "int" -> ML.sapply "Cduce_core.Value.cduce2ocaml_int" [e]
| Abstract "char" -> ML.sapply "Cduce_core.Value.cduce2ocaml_char" [e]
| Abstract "string" -> ML.sapply "Cduce_core.Value.cduce2ocaml_string" [e]
| Abstract _ -> ML.sapply "Cduce_core.Value.get_abstract" [e]
| Abstract "int" -> ML.sapply "Cduce_lib.Value.cduce2ocaml_int" [e]
| Abstract "char" -> ML.sapply "Cduce_lib.Value.cduce2ocaml_char" [e]
| Abstract "string" -> ML.sapply "Cduce_lib.Value.cduce2ocaml_string" [e]
| Abstract _ -> ML.sapply "Cduce_lib.Value.get_abstract" [e]
| Builtin ("list",[t]) ->
(* List.rev_map fun_t (Value.get_sequence_rev <...> *)
ML.sapply "Stdlib.List.rev_map" [
ML.var (to_ml_fun t);
ML.sapply "Cduce_core.Value.get_sequence_rev" [e]]
ML.sapply "Cduce_lib.Value.get_sequence_rev" [e]]
| Builtin ("array",[t]) ->
ML.sapply "Stdlib.Array.of_list" [
ML.sapply "Stdlib.List.rev_map" [
ML.var (to_ml_fun t) ;
ML.sapply "Cduce_core.Value.get_sequence_rev" [e]]
ML.sapply "Cduce_lib.Value.get_sequence_rev" [e]]
]
| Builtin ("Stdlib.ref",[t]) ->
let f = ML.sapply "Cduce_core.Value.get_field" [e; (CD.label_ascii "get")] in
let e = ML.sapply "Cduce_core.Eval.eval_apply" [f; ML.var "Cduce_core.Value.nil" ] in
let f = ML.sapply "Cduce_lib.Value.get_field" [e; (CD.label_ascii "get")] in
let e = ML.sapply "Cduce_lib.Eval.eval_apply" [f; ML.var "Cduce_lib.Value.nil" ] in
ML.sapply "Stdlib.ref" [ to_ml e t ]
| Builtin ("Big_int.big_int", []) -> ML.sapply "Cduce_core.Value.cduce2ocaml_bigint" [e]
| Builtin ("Cduce_core.Value.t", []) -> e
| Builtin ("Cduce_core.Encodings.Utf8.t", []) -> ML.sapply "Cduce_core.Value.cduce2ocaml_string_utf8" [e]
| Builtin ("Cduce_core.Atoms.V.t", []) -> ML.sapply "Cduce_core.Value.cduce2ocaml_atom" [e]
| Builtin ("Big_int.big_int", []) -> ML.sapply "Cduce_lib.Value.cduce2ocaml_bigint" [e]
| Builtin ("Cduce_lib.Value.t", []) -> e
| Builtin ("Cduce_lib.Encodings.Utf8.t", []) -> ML.sapply "Cduce_lib.Value.cduce2ocaml_string_utf8" [e]
| Builtin ("Cduce_lib.Atoms.V.t", []) -> ML.sapply "Cduce_lib.Value.cduce2ocaml_atom" [e]
| Builtin ("unit", []) -> ML.(let_in (pany ()) e unit)
| Builtin ("option", [t]) ->
ML.sapply "Cduce_core.Value.cduce2ocaml_option" [ ML.var (to_ml_fun t); e]
ML.sapply "Cduce_lib.Value.cduce2ocaml_option" [ ML.var (to_ml_fun t); e]
| Var _ -> e
| _ -> assert false
......@@ -672,13 +672,13 @@ let stub ty_env c_env exts values mk prolog =
Exp.(letmodule (Ocaml_common.Location.mknoloc
(Mlcompat.Mlstub.noloc "C")) (
Mod.structure [
Mlcompat.Mlstub.str_open (lid "Cduce_core");
Mlcompat.Mlstub.str_open (lid "Cduce_lib");
Str.eval (sapply "Cduce_config.init_all" [ unit ]);
Str.value non_rec
[(bind (pat_tuple [ pat_var "types"; pat_var "set_externals";
pat_var "slots";
pat_var "run" ])
(sapply "Cduce_core.Librarian.ocaml_stub" [(str raw)]))];
(sapply "Cduce_lib.Librarian.ocaml_stub" [(str raw)]))];
Str.value rec_ g;
Str.eval (sapply "set_externals" [ (Exp.array exts) ]);
Str.eval (sapply "run" [unit]);
......@@ -750,7 +750,7 @@ let wrapper values =
in
let g = global_transl () in
ML.[
Mlcompat.Mlstub.str_open (lid "Cduce_core");
Mlcompat.Mlstub.str_open (lid "Cduce_lib");
Str.eval (sapply "Cduce_config.init_all" [ unit ]);
Str.value rec_ g;
] @ exts
......@@ -788,7 +788,7 @@ let make_wrapper fn =
Format.printf "%s\n" "let () = Cduce_loc.obj_path := [";
List.iter (fun s -> Format.printf " %S;\n" s) !Cduce_core.Cduce_loc.obj_path;
Format.printf "%s\n" " ];;";
Format.printf "%s\n" "let () = Cduce_core.Run.main ();;"
Format.printf "%s\n" "let () = Cduce_lib.Run.main ();;"
(* Dynamic coercions *)
......
(executable
(name dtd2cduce)
(public_name dtd2cduce)
(package cduce)
(optional)
(modules dtd2cduce)
(libraries threads netcgi2 pxp)
)
(executable
(name print_version)
(modules print_version)
(libraries dune-build-info)
)
(rule
(deps )
(target print_version.ml)
(action (write-file %{target} "
let () = \n
let open Build_info.V1 in
let v = match version () with
Some s -> Version.to_string s
| None -> \"n/a\" in
Printf.printf {|\n
let cduce_version = \"%s\"\n
let ocaml_compiler = \"%{ocaml_version}\" \n
|} v")))
\ No newline at end of file
......@@ -2,4 +2,4 @@
(name misc)
(public_name cduce-types.misc)
(wrapped false)
)
)
\ No newline at end of file
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