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 *)
|
2001-12-07 05:41:02 -08:00
|
|
|
(* under the terms of the GNU Library General Public License, with *)
|
|
|
|
(* the special exception on linking described in file ../LICENSE. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* System interface *)
|
|
|
|
|
1996-11-07 03:00:19 -08:00
|
|
|
external get_config: unit -> string * int = "sys_get_config"
|
2002-02-11 05:51:40 -08:00
|
|
|
external get_argv: unit -> string * string array = "sys_get_argv"
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2002-02-11 05:51:40 -08:00
|
|
|
let (executable_name, argv) = get_argv()
|
1996-11-07 03:00:19 -08:00
|
|
|
let (os_type, word_size) = get_config()
|
1997-09-11 08:10:23 -07:00
|
|
|
let max_array_length = (1 lsl (word_size - 10)) - 1;;
|
|
|
|
let max_string_length = word_size / 8 * max_array_length - 1;;
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-05-04 05:48:07 -07:00
|
|
|
external file_exists: string -> bool = "sys_file_exists"
|
1995-05-04 03:15:53 -07:00
|
|
|
external remove: string -> unit = "sys_remove"
|
1995-12-06 08:05:59 -08:00
|
|
|
external rename : string -> string -> unit = "sys_rename"
|
1995-05-04 03:15:53 -07:00
|
|
|
external getenv: string -> string = "sys_getenv"
|
|
|
|
external command: string -> int = "sys_system_command"
|
1998-02-25 02:20:38 -08:00
|
|
|
external time: unit -> float = "sys_time"
|
1995-05-04 03:15:53 -07:00
|
|
|
external chdir: string -> unit = "sys_chdir"
|
1995-08-23 04:55:32 -07:00
|
|
|
external getcwd: unit -> string = "sys_getcwd"
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-10-26 09:25:03 -07:00
|
|
|
let interactive = ref false
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
type signal_behavior =
|
|
|
|
Signal_default
|
|
|
|
| Signal_ignore
|
|
|
|
| Signal_handle of (int -> unit)
|
|
|
|
|
1998-08-08 09:52:33 -07:00
|
|
|
external signal: int -> signal_behavior -> signal_behavior
|
|
|
|
= "install_signal_handler"
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1999-02-24 07:21:50 -08:00
|
|
|
let set_signal sig_num sig_beh = ignore(signal sig_num sig_beh)
|
1998-11-12 06:53:46 -08:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
let sigabrt = -1
|
|
|
|
let sigalrm = -2
|
|
|
|
let sigfpe = -3
|
|
|
|
let sighup = -4
|
|
|
|
let sigill = -5
|
|
|
|
let sigint = -6
|
|
|
|
let sigkill = -7
|
|
|
|
let sigpipe = -8
|
|
|
|
let sigquit = -9
|
|
|
|
let sigsegv = -10
|
|
|
|
let sigterm = -11
|
|
|
|
let sigusr1 = -12
|
|
|
|
let sigusr2 = -13
|
|
|
|
let sigchld = -14
|
|
|
|
let sigcont = -15
|
|
|
|
let sigstop = -16
|
|
|
|
let sigtstp = -17
|
|
|
|
let sigttin = -18
|
|
|
|
let sigttou = -19
|
1995-10-30 02:22:12 -08:00
|
|
|
let sigvtalrm = -20
|
1996-04-18 09:33:41 -07:00
|
|
|
let sigprof = -21
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
exception Break
|
|
|
|
|
|
|
|
let catch_break on =
|
|
|
|
if on then
|
1998-11-12 06:53:46 -08:00
|
|
|
set_signal sigint (Signal_handle(fun _ -> raise Break))
|
1995-05-04 03:15:53 -07:00
|
|
|
else
|
1998-11-12 06:53:46 -08:00
|
|
|
set_signal sigint Signal_default
|
2002-02-05 09:11:33 -08:00
|
|
|
|
|
|
|
|
2002-03-13 09:34:58 -08:00
|
|
|
(* OCaml version string, moved from utils/config.mlp.
|
2002-02-05 09:11:33 -08:00
|
|
|
Must be in the format described in sys.mli. *)
|
|
|
|
|
2002-06-18 03:47:33 -07:00
|
|
|
let ocaml_version = "3.04+15 (2002-06-18)"
|