parrotcode: Exceptions | |
Contents | C |
src/exceptions.c - Exceptions
Define the internal interpreter exceptions.
enum_class
of the Exception isn't fixed.void internal_exception(int exitcode, const char *format, ...)
void do_panic(Interp *interpreter, const char *message, const char *file, int line)
void push_exception(Interp *interpreter, PMC *handler)
void Parrot_push_action(Interp *interpreter, PMC *sub)
void Parrot_push_mark(Interp *interpreter, INTVAL mark)
void Parrot_pop_mark(Interp *interpreter, INTVAL mark)
static PMC *find_exception_handler(Interp *interpreter, PMC *exception)
exception
.void pop_exception(Interp *interpreter)
PMC *new_c_exception_handler(Interp *interpreter, Parrot_exception *jb)
void push_new_c_exception_handler(Interp *interpreter, Parrot_exception *jb)
void *throw_exception(Interp *interpreter, PMC *exception, void *dest)
void *rethrow_exception(Interp *interpreter, PMC *exception)
void rethrow_c_exception(Interp *interpreter)
REG_PMC(5)
and that this is called from within a handler setup with new_c_exception
static size_t dest2offset(Interp *interpreter, opcode_t *dest)
static opcode_t *create_exception(Interp *interpreter)
size_t handle_exception(Interp *interpreter)
void new_internal_exception(Interp *interpreter)
void free_internal_exception(Interp *interpreter)
void do_exception(Interp *interpreter, exception_severity severity, long error)
longjmp
in front of the runloop,
which calls handle_exception()
,
returning the handler address where execution then resumes.void real_exception(Interp *interpreter, void *ret_addr, int exitcode, const char *format, ...)
internal_exception()
this throws a real exception.void Parrot_init_exceptions(Interp *interpreter)
interpreter->exception_list = mem_sys_allocate(
sizeof(PMC*) * (E_LAST_PYTHON_E + 1));
for (i = 0; i <= E_LAST_PYTHON_E; ++i) {
ex = pmc_new(interpreter, enum_class_Exception);
interpreter->exception_list[i] = ex;
VTABLE_set_integer_keyed_int(interpreter, ex, 1, i);
}
}
include/parrot/exceptions.h.
|