Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / byterun / fail.h
blob5a55c57c5a65fbdab72f9d3235dbfe9359baa5e5
1 /***********************************************************************/
2 /* */
3 /* Objective Caml */
4 /* */
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
6 /* */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../LICENSE. */
11 /* */
12 /***********************************************************************/
14 /* $Id$ */
16 #ifndef CAML_FAIL_H
17 #define CAML_FAIL_H
19 /* <private> */
20 #include <setjmp.h>
21 /* </private> */
23 #ifndef CAML_NAME_SPACE
24 #include "compatibility.h"
25 #endif
26 #include "misc.h"
27 #include "mlvalues.h"
29 /* <private> */
30 #define OUT_OF_MEMORY_EXN 0 /* "Out_of_memory" */
31 #define SYS_ERROR_EXN 1 /* "Sys_error" */
32 #define FAILURE_EXN 2 /* "Failure" */
33 #define INVALID_EXN 3 /* "Invalid_argument" */
34 #define END_OF_FILE_EXN 4 /* "End_of_file" */
35 #define ZERO_DIVIDE_EXN 5 /* "Division_by_zero" */
36 #define NOT_FOUND_EXN 6 /* "Not_found" */
37 #define MATCH_FAILURE_EXN 7 /* "Match_failure" */
38 #define STACK_OVERFLOW_EXN 8 /* "Stack_overflow" */
39 #define SYS_BLOCKED_IO 9 /* "Sys_blocked_io" */
40 #define ASSERT_FAILURE_EXN 10 /* "Assert_failure" */
41 #define UNDEFINED_RECURSIVE_MODULE_EXN 11 /* "Undefined_recursive_module" */
43 #ifdef POSIX_SIGNALS
44 struct longjmp_buffer {
45 sigjmp_buf buf;
47 #else
48 struct longjmp_buffer {
49 jmp_buf buf;
51 #define sigsetjmp(buf,save) setjmp(buf)
52 #define siglongjmp(buf,val) longjmp(buf,val)
53 #endif
55 CAMLextern struct longjmp_buffer * caml_external_raise;
56 extern value caml_exn_bucket;
58 /* </private> */
60 CAMLextern void caml_raise (value bucket) Noreturn;
61 CAMLextern void caml_raise_constant (value tag) Noreturn;
62 CAMLextern void caml_raise_with_arg (value tag, value arg) Noreturn;
63 CAMLextern void caml_raise_with_string (value tag, char const * msg) Noreturn;
64 CAMLextern void caml_failwith (char const *) Noreturn;
65 CAMLextern void caml_invalid_argument (char const *) Noreturn;
66 CAMLextern void caml_raise_out_of_memory (void) Noreturn;
67 CAMLextern void caml_raise_stack_overflow (void) Noreturn;
68 CAMLextern void caml_raise_sys_error (value) Noreturn;
69 CAMLextern void caml_raise_end_of_file (void) Noreturn;
70 CAMLextern void caml_raise_zero_divide (void) Noreturn;
71 CAMLextern void caml_raise_not_found (void) Noreturn;
72 CAMLextern void caml_init_exceptions (void);
73 CAMLextern void caml_array_bound_error (void) Noreturn;
74 CAMLextern void caml_raise_sys_blocked_io (void) Noreturn;
76 #endif /* CAML_FAIL_H */