diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 1999-12-03 10:26:08 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 1999-12-03 10:26:08 +0000 |
commit | ad6a333f081a303cce93d86709f04a2802c61d06 (patch) | |
tree | 865e798c8b0b3351b7c3b2acde67418eec8c52c2 /toplevel | |
parent | 904d1a15806f482ffddd845a69a24255fccefc0c (diff) |
add directives #modern and #warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2667 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'toplevel')
-rw-r--r-- | toplevel/topdirs.ml | 12 | ||||
-rw-r--r-- | toplevel/toploop.ml | 2 | ||||
-rw-r--r-- | toplevel/toploop.mli | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/toplevel/topdirs.ml b/toplevel/topdirs.ml index a9c08dcaa..68140e59a 100644 --- a/toplevel/topdirs.ml +++ b/toplevel/topdirs.ml @@ -248,3 +248,15 @@ let _ = Hashtbl.add directive_table "print_depth" (Directive_int(fun n -> max_printer_depth := n)) let _ = Hashtbl.add directive_table "print_length" (Directive_int(fun n -> max_printer_steps := n)) + +(* Set various compiler flags *) + +let _ = Hashtbl.add directive_table "modern" + (Directive_bool(fun b -> Clflags.classic := not b)) + +let parse_warnings s = + try Warnings.parse_options s + with Arg.Bad err -> printf "%s." err + +let _ = Hashtbl.add directive_table "warnings" + (Directive_string parse_warnings) diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml index 9dbb82ddf..cd3682f02 100644 --- a/toplevel/toploop.ml +++ b/toplevel/toploop.ml @@ -28,6 +28,7 @@ type directive_fun = | Directive_string of (string -> unit) | Directive_int of (int -> unit) | Directive_ident of (Longident.t -> unit) + | Directive_bool of (bool -> unit) (* Hooks for parsing functions *) @@ -175,6 +176,7 @@ let execute_phrase print_outcome phr = | (Directive_string f, Pdir_string s) -> f s; true | (Directive_int f, Pdir_int n) -> f n; true | (Directive_ident f, Pdir_ident lid) -> f lid; true + | (Directive_bool f, Pdir_bool b) -> f b; true | (_, _) -> print_string "Wrong type of argument for directive `"; print_string dir_name; print_string "'"; print_newline(); diff --git a/toplevel/toploop.mli b/toplevel/toploop.mli index e3400c125..e2ad52b5b 100644 --- a/toplevel/toploop.mli +++ b/toplevel/toploop.mli @@ -27,6 +27,7 @@ type directive_fun = | Directive_string of (string -> unit) | Directive_int of (int -> unit) | Directive_ident of (Longident.t -> unit) + | Directive_bool of (bool -> unit) val directive_table: (string, directive_fun) Hashtbl.t (* Table of known directives, with their execution function *) |