coan 4.2.4
|
Files | |
file | exception.c |
file | exception.h |
Defines | |
#define | catch() setjmp(exception_context) |
#define | throw(x) longjmp(exception_context,(x)) |
Variables | |
jmp_buf | exception_context |
bool | exceptions_enabled |
This component provides a very rudimentary exception handling facility using setjmp()
and longjmp()
. Exceptions are integer error codes. Throwing an exception can return execution to a point prior to the occurrence of the exception, where by testing the exception it can take an alternative course. It is not possible to re-throw an exception.
#define catch | ( | ) | setjmp(exception_context) |
Catch an exception. The macro returns 0 if no exception was thrown, else the integer exception.
Definition at line 63 of file exception.h.
#define throw | ( | x | ) | longjmp(exception_context,(x)) |
Throw an exception. The function causes control to pass to the site of the last call to catch()
, which will then return the value exception
Definition at line 70 of file exception.h.
jmp_buf exception_context |
The execution context to which exceptions return.
Definition at line 44 of file exception.c.
Status of exception handling, enabled/disabled
Definition at line 46 of file exception.c.
Referenced by node_proc(), and vbail().