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 *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* System interface *)
|
|
|
|
|
1996-10-07 07:04:03 -07:00
|
|
|
type config = { os_type : string; word_size : int };;
|
|
|
|
external get_config: unit -> config = "sys_get_config"
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
external get_argv: unit -> string array = "sys_get_argv"
|
|
|
|
|
|
|
|
let argv = get_argv()
|
|
|
|
|
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"
|
|
|
|
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)
|
|
|
|
|
|
|
|
external signal: int -> signal_behavior -> unit = "install_signal_handler"
|
|
|
|
|
|
|
|
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
|
|
|
|
signal sigint (Signal_handle(fun _ -> raise Break))
|
|
|
|
else
|
|
|
|
signal sigint Signal_default
|