Commit 5a5a933f authored by Pietro Abate's avatar Pietro Abate

[r2004-06-28 09:02:17 by afrisch] MD5 checksum for dynlinked code

Original author: afrisch
Date: 2004-06-28 09:02:17+00:00
parent 36182d0c
......@@ -226,7 +226,13 @@ let load_from_string id raw dig depend =
let register_unit id raw dig depend =
let id = C.mk (Ident.U.mk id) in
let depend = List.map (fun (x,y) -> (Ident.U.mk x,y)) depend in
ignore (load_from_string id raw dig depend)
ignore (load_from_string id raw dig depend);
id
let load_unit id dig =
let id = C.mk (Ident.U.mk id) in
ignore (load_check id dig);
id
let rec run id =
let cu = find id in
......
......@@ -11,7 +11,10 @@ val run: Types.CompUnit.t -> unit
val import: Types.CompUnit.t -> unit
val import_check: Types.CompUnit.t -> Digest.t -> unit
val import_from_string: Types.CompUnit.t -> string -> string -> (Ident.U.t * Digest.t) list -> unit
val register_unit: string -> string -> string -> (string * string) list -> unit
val register_unit: string -> string -> string -> (string * string) list -> Types.CompUnit.t
val load_unit: string -> string -> Types.CompUnit.t
val import_and_run: Types.CompUnit.t -> unit
val save: string -> Types.CompUnit.t -> string -> unit
......
......@@ -37,13 +37,19 @@ let () =
| Some x -> x in
print_endline "(* Automatically generated by cdo2ml.ml. Do no edit ! *)";
if static then (
Printf.printf
"let () = CDuce_all.Librarian.register_unit %S %S %S ["
name raw digest;
List.iter (fun (cu,chk) -> Printf.printf "(%S,%S)" cu chk) depend;
Printf.printf "]\n";
);
if static then
(
Printf.printf
"let cu = CDuce_all.Librarian.register_unit %S %S %S ["
name raw digest;
List.iter (fun (cu,chk) -> Printf.printf "(%S,%S)" cu chk) depend;
Printf.printf "]\n"
)
else
(
Printf.printf "let cu = CDuce_all.Librarian.load_unit %S %S\n"
name digest
);
print_endline prolog;
let code = List.map (fun x -> (x,loc)) code in
......
......@@ -3,7 +3,7 @@
(* TODO:
- optimizations: generate labels and atoms only once.
- MD5 checksum
- embeded CDuce code in OCaml
- translate record to open record on positive occurence
*)
......@@ -454,7 +454,7 @@ let stub name ty_env c_env values =
[ <:str_item< open Cdml >>;
<:str_item< open CDuce_all >>;
<:str_item< value cu = Cdml.initialize $str: String.escaped name$ >>;
(* <:str_item< value cu = Cdml.initialize $str:String.escaped name$ >>; *)
<:str_item< value types = Librarian.registered_types cu >>;
<:str_item< declare $list:exts$ end >>;
<:str_item< Librarian.run cu >>
......
# Do "make install_cdml" before running this test
STATIC=
run:
ocamlc -c a.mli
../../cduce --compile c.cd
../../cduce --compile a.cd
../../cdo2ml -static c.cdo > c.ml
../../cdo2ml -static a.cdo > a.ml
../../cdo2ml $(STATIC) c.cdo > c.ml
../../cdo2ml $(STATIC) a.cdo > a.ml
ocamlfind ocamlc -package cduce -linkpkg -o a c.ml a.ml b.ml
ifeq ($(STATIC),-static)
rm *.cdo
endif
./a
clean:
......
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