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$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* The interactive toplevel loop *)
|
|
|
|
|
|
|
|
val loop: unit -> unit
|
|
|
|
|
1997-07-03 07:32:35 -07:00
|
|
|
(* Read and execute a script from the given file *)
|
|
|
|
|
|
|
|
val run_script: string -> bool (* true if successful, false if error *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Interface with toplevel directives *)
|
|
|
|
|
|
|
|
type directive_fun =
|
|
|
|
Directive_none of (unit -> unit)
|
|
|
|
| Directive_string of (string -> unit)
|
|
|
|
| Directive_int of (int -> unit)
|
|
|
|
| Directive_ident of (Longident.t -> unit)
|
1999-12-03 02:26:08 -08:00
|
|
|
| Directive_bool of (bool -> unit)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
val directive_table: (string, directive_fun) Hashtbl.t
|
|
|
|
(* Table of known directives, with their execution function *)
|
|
|
|
val toplevel_env: Env.t ref
|
|
|
|
(* Typing environment for the toplevel *)
|
1997-07-03 07:32:35 -07:00
|
|
|
val print_exception_outcome: exn -> unit
|
|
|
|
(* Print an exception resulting from the evaluation of user code. *)
|
|
|
|
val execute_phrase: bool -> Parsetree.toplevel_phrase -> bool
|
|
|
|
(* 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. *)
|
|
|
|
val use_file: string -> bool
|
|
|
|
val use_silently: string -> bool
|
|
|
|
(* Read and execute commands from a file.
|
|
|
|
[use_file] prints the types and values of the results.
|
|
|
|
[use_silently] does not print them. *)
|
|
|
|
|
|
|
|
(* Hooks for an external parser *)
|
|
|
|
|
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
|
|
|
|
val print_location : Location.t -> unit
|
1998-11-05 00:04:40 -08:00
|
|
|
val print_warning : Location.t -> Warnings.t -> unit
|
1997-07-03 07:32:35 -07:00
|
|
|
val input_name : string ref
|