paul@143 | 1 | #ifndef __EXCEPTIONS_H__ |
paul@143 | 2 | #define __EXCEPTIONS_H__ |
paul@143 | 3 | |
paul@143 | 4 | #include "cexcept.h" |
paul@143 | 5 | #include "types.h" |
paul@143 | 6 | |
paul@143 | 7 | /* Define the exception type. */ |
paul@143 | 8 | |
paul@143 | 9 | typedef struct |
paul@143 | 10 | { |
paul@143 | 11 | __attr arg; |
paul@143 | 12 | int raising; |
paul@143 | 13 | int raising_else; |
paul@143 | 14 | int completing; |
paul@143 | 15 | } __exc; |
paul@143 | 16 | |
paul@143 | 17 | define_exception_type(__exc); |
paul@143 | 18 | #undef define_exception_type |
paul@143 | 19 | |
paul@143 | 20 | extern struct __exception_context __the_exception_context[1]; |
paul@143 | 21 | |
paul@143 | 22 | /* More specific macros. */ |
paul@143 | 23 | |
paul@143 | 24 | #define __Raise(value) __Throw ((__exc) {value, 1, 0, 0}) |
paul@143 | 25 | #define __RaiseElse(value) __Throw ((__exc) {value, 0, 1, 0}) |
paul@143 | 26 | #define __Return(value) __Throw ((__exc) {value, 0, 0, 1}) |
paul@143 | 27 | #define __Complete __Throw((__exc) {__NULL, 0, 0, 1}) |
paul@143 | 28 | |
paul@143 | 29 | #endif /* __EXCEPTIONS_H__ */ |