renaming: contain? -> any?, deep-contains? -> deep-any?, pad-left -> pad-head, pad...
[factor/jcg.git] / vm / errors.h
blobc7f8bc8712a5a918235c5199f7dbd9f91949cd41
1 /* Runtime errors */
2 typedef enum
4 ERROR_EXPIRED = 0,
5 ERROR_IO,
6 ERROR_NOT_IMPLEMENTED,
7 ERROR_TYPE,
8 ERROR_DIVIDE_BY_ZERO,
9 ERROR_SIGNAL,
10 ERROR_ARRAY_SIZE,
11 ERROR_C_STRING,
12 ERROR_FFI,
13 ERROR_HEAP_SCAN,
14 ERROR_UNDEFINED_SYMBOL,
15 ERROR_DS_UNDERFLOW,
16 ERROR_DS_OVERFLOW,
17 ERROR_RS_UNDERFLOW,
18 ERROR_RS_OVERFLOW,
19 ERROR_MEMORY,
20 } F_ERRORTYPE;
22 void out_of_memory(void);
23 void fatal_error(char* msg, CELL tagged);
24 void critical_error(char* msg, CELL tagged);
25 void primitive_die(void);
27 void throw_error(CELL error, F_STACK_FRAME *native_stack);
28 void general_error(F_ERRORTYPE error, CELL arg1, CELL arg2, F_STACK_FRAME *native_stack);
29 void divide_by_zero_error(F_STACK_FRAME *native_stack);
30 void memory_protection_error(CELL addr, F_STACK_FRAME *native_stack);
31 void signal_error(int signal, F_STACK_FRAME *native_stack);
32 void type_error(CELL type, CELL tagged);
33 void not_implemented_error(void);
35 void primitive_throw(void);
36 void primitive_call_clear(void);
38 INLINE void type_check(CELL type, CELL tagged)
40 if(type_of(tagged) != type) type_error(type,tagged);
43 #define DEFINE_UNTAG(type,check,name) \
44 INLINE type *untag_##name(CELL obj) \
45 { \
46 type_check(check,obj); \
47 return untag_object(obj); \
50 /* Global variables used to pass fault handler state from signal handler to
51 user-space */
52 CELL signal_number;
53 CELL signal_fault_addr;
54 void *signal_callstack_top;
56 void memory_signal_handler_impl(void);
57 void divide_by_zero_signal_handler_impl(void);
58 void misc_signal_handler_impl(void);
60 void primitive_unimplemented(void);