summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2013-08-04 19:58:09 +0000
committerGabriel Scherer <gabriel.scherer@gmail.com>2013-08-04 19:58:09 +0000
commitb1c5fa3e5260e8b1d5acb21a93fdcb826627391c (patch)
tree28e7e0ff0bd206f70ccb5666ff6655fd7b76dc1a
parentda3011fec235bb5bbecbefc11b247bc28a840195 (diff)
PR#6071: Add a -noinit option to the toplevel [patch by David Sheets]
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13972 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--Changes1
-rw-r--r--driver/main_args.ml8
-rw-r--r--driver/main_args.mli2
-rw-r--r--toplevel/opttoploop.ml3
-rw-r--r--toplevel/toploop.ml3
-rw-r--r--toplevel/topmain.ml1
-rw-r--r--utils/clflags.ml2
-rw-r--r--utils/clflags.mli1
8 files changed, 18 insertions, 3 deletions
diff --git a/Changes b/Changes
index 4d2b49240..d29453055 100644
--- a/Changes
+++ b/Changes
@@ -17,6 +17,7 @@ Standard library:
Features wishes:
- PR#4243: make the Makefiles parallelizable
- PR#4323: have "of_string" in Num and Big_int work with binary and hexa representations (patch by zoep)
+- PR#6071: Add a -noinit option to the toplevel (patch by David Sheets)
OCaml 4.01.0:
diff --git a/driver/main_args.ml b/driver/main_args.ml
index 487a929f6..3d5449786 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -168,6 +168,10 @@ let mk_nodynlink f =
" Enable optimizations for code that will not be dynlinked"
;;
+let mk_noinit f =
+ "-noinit", Arg.Unit f,
+ " Do not load any init file"
+
let mk_nolabels f =
"-nolabels", Arg.Unit f, " Ignore non-optional labels in types"
;;
@@ -487,6 +491,7 @@ module type Bytetop_options = sig
val _labels : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
+ val _noinit : unit -> unit
val _nolabels : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
@@ -598,6 +603,7 @@ module type Opttop_options = sig
val _labels : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
+ val _noinit : unit -> unit
val _nolabels : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
@@ -724,6 +730,7 @@ struct
mk_labels F._labels;
mk_no_app_funct F._no_app_funct;
mk_noassert F._noassert;
+ mk_noinit F._noinit;
mk_nolabels F._nolabels;
mk_noprompt F._noprompt;
mk_nopromptcont F._nopromptcont;
@@ -841,6 +848,7 @@ module Make_opttop_options (F : Opttop_options) = struct
mk_labels F._labels;
mk_no_app_funct F._no_app_funct;
mk_noassert F._noassert;
+ mk_noinit F._noinit;
mk_nolabels F._nolabels;
mk_noprompt F._noprompt;
mk_nopromptcont F._nopromptcont;
diff --git a/driver/main_args.mli b/driver/main_args.mli
index 6d431e7fd..99c109fdd 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -82,6 +82,7 @@ module type Bytetop_options = sig
val _labels : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
+ val _noinit : unit -> unit
val _nolabels : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
@@ -193,6 +194,7 @@ module type Opttop_options = sig
val _labels : unit -> unit
val _no_app_funct : unit -> unit
val _noassert : unit -> unit
+ val _noinit : unit -> unit
val _nolabels : unit -> unit
val _noprompt : unit -> unit
val _nopromptcont : unit -> unit
diff --git a/toplevel/opttoploop.ml b/toplevel/opttoploop.ml
index e547bbd4d..cad72b956 100644
--- a/toplevel/opttoploop.ml
+++ b/toplevel/opttoploop.ml
@@ -387,7 +387,8 @@ let _ =
()
let load_ocamlinit ppf =
- match !Clflags.init_file with
+ if !Clflags.noinit then ()
+ else match !Clflags.init_file with
| Some f -> if Sys.file_exists f then ignore (use_silently ppf f)
else fprintf ppf "Init file not found: \"%s\".@." f
| None ->
diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml
index 636fe15fb..7aea705fa 100644
--- a/toplevel/toploop.ml
+++ b/toplevel/toploop.ml
@@ -415,7 +415,8 @@ let _ =
crc_intfs
let load_ocamlinit ppf =
- match !Clflags.init_file with
+ if !Clflags.noinit then ()
+ else match !Clflags.init_file with
| Some f -> if Sys.file_exists f then ignore (use_silently ppf f)
else fprintf ppf "Init file not found: \"%s\".@." f
| None ->
diff --git a/toplevel/topmain.ml b/toplevel/topmain.ml
index 87c36d110..cc6295e62 100644
--- a/toplevel/topmain.ml
+++ b/toplevel/topmain.ml
@@ -65,6 +65,7 @@ module Options = Main_args.Make_bytetop_options (struct
let dir = Misc.expand_directory Config.standard_library dir in
include_dirs := dir :: !include_dirs
let _init s = init_file := Some s
+ let _noinit = set noinit
let _labels = clear classic
let _no_app_funct = clear applicative_functors
let _noassert = set noassert
diff --git a/utils/clflags.ml b/utils/clflags.ml
index 4ff808f33..7a40afe42 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -42,6 +42,7 @@ and verbose = ref false (* -verbose *)
and noprompt = ref false (* -noprompt *)
and nopromptcont = ref false (* -nopromptcont *)
and init_file = ref (None : string option) (* -init *)
+and noinit = ref false (* -noinit *)
and use_prims = ref "" (* -use-prims ... *)
and use_runtime = ref "" (* -use-runtime ... *)
and principal = ref false (* -principal *)
@@ -101,4 +102,3 @@ let shared = ref false (* -shared *)
let dlcode = ref true (* not -nodynlink *)
let runtime_variant = ref "";; (* -runtime-variant *)
-
diff --git a/utils/clflags.mli b/utils/clflags.mli
index e67113363..ad2ce36a9 100644
--- a/utils/clflags.mli
+++ b/utils/clflags.mli
@@ -39,6 +39,7 @@ val verbose : bool ref
val noprompt : bool ref
val nopromptcont : bool ref
val init_file : string option ref
+val noinit : bool ref
val use_prims : string ref
val use_runtime : string ref
val principal : bool ref