diff options
author | Damien Doligez <damien.doligez-inria.fr> | 1998-10-02 12:40:44 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 1998-10-02 12:40:44 +0000 |
commit | 89074600b8f8425a829f253a27580b5548fd8193 (patch) | |
tree | 55adfa794b11c201a66b31352170d618d48b759f | |
parent | 55668b9dd258e9d2b0777d5cac0d6f450b2394b7 (diff) | |
download | ocaml-89074600b8f8425a829f253a27580b5548fd8193.tar.gz |
ajout option -use_prims
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2110 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | bytecomp/bytelink.ml | 4 | ||||
-rw-r--r-- | bytecomp/symtable.ml | 18 | ||||
-rw-r--r-- | driver/main.ml | 3 | ||||
-rw-r--r-- | driver/main_args.ml | 4 | ||||
-rw-r--r-- | driver/main_args.mli | 1 | ||||
-rw-r--r-- | tools/ocamlcp.ml | 1 | ||||
-rw-r--r-- | utils/clflags.ml | 3 | ||||
-rw-r--r-- | utils/config.mlp | 2 |
8 files changed, 25 insertions, 11 deletions
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml index 20d9307687..7c05eab50b 100644 --- a/bytecomp/bytelink.ml +++ b/bytecomp/bytelink.ml @@ -5,7 +5,7 @@ (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) -(* Automatique. Distributed only by permission. *) +(* en Automatique. Distributed only by permission. *) (* *) (***********************************************************************) @@ -237,7 +237,7 @@ let link_bytecode objfiles exec_name copy_header = close_in inchan with Not_found | Sys_error _ -> () end; - (* The path to the bytecode interpreter (in use_vn mode) *) + (* The path to the bytecode interpreter (in use_runtime mode) *) let pos0 = pos_out outchan in if String.length !Clflags.use_runtime > 0 then begin output_string outchan (make_absolute !Clflags.use_runtime); diff --git a/bytecomp/symtable.ml b/bytecomp/symtable.ml index ffd64a88d8..08fc4824ef 100644 --- a/bytecomp/symtable.ml +++ b/bytecomp/symtable.ml @@ -5,7 +5,7 @@ (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) -(* Automatique. Distributed only by permission. *) +(* en Automatique. Distributed only by permission. *) (* *) (***********************************************************************) @@ -127,10 +127,15 @@ let init () = literal_table := (c, cst) :: !literal_table) Runtimedef.builtin_exceptions; (* Enter the known C primitives *) - if String.length !Clflags.use_runtime = 0 then - Array.iter (fun x -> enter_numtable c_prim_table x; ()) - Runtimedef.builtin_primitives - else begin + if String.length !Clflags.use_prims > 0 then begin + let ic = open_in !Clflags.use_prims in + try + while true do + enter_numtable c_prim_table (input_line ic) + done + with End_of_file -> close_in ic + | x -> close_in ic; raise x + end else if String.length !Clflags.use_runtime > 0 then begin let primfile = Filename.temp_file "camlprims" "" in try if Sys.command(Printf.sprintf "%s -p > %s" @@ -144,6 +149,9 @@ let init () = with End_of_file -> close_in ic | x -> close_in ic; raise x with x -> remove_file primfile; raise x + end else begin + Array.iter (fun x -> enter_numtable c_prim_table x; ()) + Runtimedef.builtin_primitives end (* Relocate a block of object bytecode *) diff --git a/driver/main.ml b/driver/main.ml index ef0e9d8ae3..6038d240de 100644 --- a/driver/main.ml +++ b/driver/main.ml @@ -5,7 +5,7 @@ (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) -(* Automatique. Distributed only by permission. *) +(* en Automatique. Distributed only by permission. *) (* *) (***********************************************************************) @@ -73,6 +73,7 @@ module Options = Main_args.Make_options (struct let _pp s = preprocessor := Some s let _thread = set thread_safe let _unsafe = set fast + let _use_prims s = use_prims := s let _use_runtime s = use_runtime := s let _v = print_version_number let _verbose = set verbose diff --git a/driver/main_args.ml b/driver/main_args.ml index 5ecc172448..7982b96a27 100644 --- a/driver/main_args.ml +++ b/driver/main_args.ml @@ -32,6 +32,7 @@ module Make_options (F : val _pp : string -> unit val _thread : unit -> unit val _unsafe : unit -> unit + val _use_prims : string -> unit val _use_runtime : string -> unit val _v : unit -> unit val _verbose : unit -> unit @@ -70,7 +71,7 @@ struct "-unsafe", Arg.Unit F._unsafe, " No bounds checking on array and string access"; "-use_runtime", Arg.String F._use_runtime, - "<path> Generate bytecode for the given runtime system"; + "<path> Generate bytecode for the given runtime system"; "-v", Arg.Unit F._v, " Print compiler version number"; "-verbose", Arg.Unit F._verbose, " Print calls to external commands"; @@ -78,6 +79,7 @@ struct "-drawlambda", Arg.Unit F._drawlambda, " (undocumented)"; "-dlambda", Arg.Unit F._dlambda, " (undocumented)"; "-dinstr", Arg.Unit F._dinstr, " (undocumented)"; + "-use_prims", Arg.String F._use_prims, " <file> (undocumented)"; "-", Arg.String F.anonymous, "<file> Treat <file> as a file name (even if it starts with `-')"; diff --git a/driver/main_args.mli b/driver/main_args.mli index 8cb7c90331..a78707d235 100644 --- a/driver/main_args.mli +++ b/driver/main_args.mli @@ -32,6 +32,7 @@ module Make_options (F : val _pp : string -> unit val _thread : unit -> unit val _unsafe : unit -> unit + val _use_prims : string -> unit val _use_runtime : string -> unit val _v : unit -> unit val _verbose : unit -> unit diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml index d8edc6410e..4b6aa95e21 100644 --- a/tools/ocamlcp.ml +++ b/tools/ocamlcp.ml @@ -49,6 +49,7 @@ module Options = Main_args.Make_options (struct let _pp s = incompatible "-pp" let _thread () = incompatible "-thread" let _unsafe = option "-unsafe" + let _use_prims s = option_with_arg "-use_prims" s let _use_runtime s = option_with_arg "-use_runtime" s let _v = option "-v" let _verbose = option "-verbose" diff --git a/utils/clflags.ml b/utils/clflags.ml index 50aaefc5cc..ad8c3584b2 100644 --- a/utils/clflags.ml +++ b/utils/clflags.ml @@ -5,7 +5,7 @@ (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) -(* Automatique. Distributed only by permission. *) +(* en Automatique. Distributed only by permission. *) (* *) (***********************************************************************) @@ -34,6 +34,7 @@ and preprocessor = ref(None : string option) (* -pp *) and thread_safe = ref false (* -thread *) and noassert = ref false (* -noassert *) and verbose = ref false (* -verbose *) +and use_prims = ref "" (* -use_prims ... *) and use_runtime = ref "" (* -use_runtime ... *) and make_runtime = ref false (* -make_runtime *) and gprofile = ref false (* -p *) diff --git a/utils/config.mlp b/utils/config.mlp index 10cb0f82ef..147149d6d6 100644 --- a/utils/config.mlp +++ b/utils/config.mlp @@ -11,7 +11,7 @@ (* $Id$ *) -let version = "2.00+2" +let version = "2.00+3" let standard_library = try |