1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
open Format
|
|
|
|
|
2000-05-16 09:19:04 -07:00
|
|
|
(* Accessors for the table of toplevel value bindings. These functions
|
|
|
|
must appear as first and second exported functions in this module.
|
|
|
|
(See module Translmod.) *)
|
|
|
|
val getvalue : string -> Obj.t
|
|
|
|
val setvalue : string -> Obj.t -> unit
|
|
|
|
|
2002-02-07 18:56:04 -08:00
|
|
|
(* Set the load paths, before running anything *)
|
|
|
|
|
|
|
|
val set_paths : unit -> unit
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* The interactive toplevel loop *)
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
val loop : formatter -> unit
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-07-03 07:32:35 -07:00
|
|
|
(* Read and execute a script from the given file *)
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
val run_script : formatter -> string -> string array -> bool
|
2000-02-06 19:29:29 -08:00
|
|
|
(* true if successful, false if error *)
|
1997-07-03 07:32:35 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Interface with toplevel directives *)
|
|
|
|
|
|
|
|
type directive_fun =
|
2000-03-06 14:12:09 -08:00
|
|
|
| Directive_none of (unit -> unit)
|
|
|
|
| Directive_string of (string -> unit)
|
|
|
|
| Directive_int of (int -> unit)
|
|
|
|
| Directive_ident of (Longident.t -> unit)
|
|
|
|
| Directive_bool of (bool -> unit)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
val directive_table : (string, directive_fun) Hashtbl.t
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Table of known directives, with their execution function *)
|
2000-03-06 14:12:09 -08:00
|
|
|
val toplevel_env : Env.t ref
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Typing environment for the toplevel *)
|
2000-03-06 14:12:09 -08:00
|
|
|
val print_exception_outcome : formatter -> exn -> unit
|
1997-07-03 07:32:35 -07:00
|
|
|
(* Print an exception resulting from the evaluation of user code. *)
|
2000-03-06 14:12:09 -08:00
|
|
|
val execute_phrase : bool -> formatter -> Parsetree.toplevel_phrase -> bool
|
1997-07-03 07:32:35 -07:00
|
|
|
(* Execute the given toplevel phrase. Return [true] if the
|
|
|
|
phrase executed with no errors and [false] otherwise.
|
|
|
|
First bool says whether the values and types of the results
|
|
|
|
should be printed. Uncaught exceptions are always printed. *)
|
2000-03-06 14:12:09 -08:00
|
|
|
val use_file : formatter -> string -> bool
|
|
|
|
val use_silently : formatter -> string -> bool
|
1997-07-03 07:32:35 -07:00
|
|
|
(* Read and execute commands from a file.
|
|
|
|
[use_file] prints the types and values of the results.
|
|
|
|
[use_silently] does not print them. *)
|
2000-11-07 05:18:20 -08:00
|
|
|
val eval_path: Path.t -> Obj.t
|
|
|
|
(* Return the toplevel object referred to by the given path *)
|
|
|
|
|
|
|
|
(* Printing of values *)
|
|
|
|
|
|
|
|
val print_value: Env.t -> Obj.t -> formatter -> Types.type_expr -> unit
|
|
|
|
val print_untyped_exception: formatter -> Obj.t -> unit
|
|
|
|
|
2001-07-03 04:04:10 -07:00
|
|
|
val install_printer :
|
|
|
|
Path.t -> Types.type_expr -> (formatter -> Obj.t -> unit) -> unit
|
2000-11-07 05:18:20 -08:00
|
|
|
val remove_printer : Path.t -> unit
|
|
|
|
|
|
|
|
val max_printer_depth: int ref
|
|
|
|
val max_printer_steps: int ref
|
1997-07-03 07:32:35 -07:00
|
|
|
|
2001-08-02 01:51:55 -07:00
|
|
|
(* Hooks for external parsers and printers *)
|
1997-07-03 07:32:35 -07:00
|
|
|
|
1996-05-22 05:43:11 -07:00
|
|
|
val parse_toplevel_phrase : (Lexing.lexbuf -> Parsetree.toplevel_phrase) ref
|
1997-07-03 07:32:35 -07:00
|
|
|
val parse_use_file : (Lexing.lexbuf -> Parsetree.toplevel_phrase list) ref
|
2000-03-06 14:12:09 -08:00
|
|
|
val print_location : formatter -> Location.t -> unit
|
|
|
|
val print_warning : Location.t -> formatter -> Warnings.t -> unit
|
1997-07-03 07:32:35 -07:00
|
|
|
val input_name : string ref
|
2001-02-12 06:32:38 -08:00
|
|
|
|
2001-08-02 01:51:55 -07:00
|
|
|
val print_out_value : (formatter -> Outcometree.out_value -> unit) ref
|
2001-08-04 03:08:19 -07:00
|
|
|
val print_out_type : (formatter -> Outcometree.out_type -> unit) ref
|
2001-08-06 05:28:50 -07:00
|
|
|
val print_out_sig_item : (formatter -> Outcometree.out_sig_item -> unit) ref
|
2001-08-07 05:12:33 -07:00
|
|
|
val print_out_phrase : (formatter -> Outcometree.out_phrase -> unit) ref
|
2001-08-02 01:51:55 -07:00
|
|
|
|
2001-02-12 06:32:38 -08:00
|
|
|
(* Used by Trace module *)
|
|
|
|
|
|
|
|
val may_trace : bool ref
|