1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Caml Special Light *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1995 Institut National de Recherche en Informatique et *)
|
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* System interface *)
|
|
|
|
|
|
|
|
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"
|
|
|
|
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
|
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
|