2013-10-15 17:25:17 -04:00
|
|
|
// non-local return
|
|
|
|
// exception handling, basically a stack of setjmp/longjmp buffers
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
2013-10-15 19:46:39 -04:00
|
|
|
//#ifndef __WORDSIZE
|
|
|
|
//#error __WORDSIZE needs to be defined
|
|
|
|
//#endif
|
2013-10-15 17:25:17 -04:00
|
|
|
|
|
|
|
typedef struct _nlr_buf_t nlr_buf_t;
|
|
|
|
struct _nlr_buf_t {
|
|
|
|
// the entries here must all be machine word size
|
|
|
|
nlr_buf_t *prev;
|
|
|
|
void *ret_val;
|
|
|
|
#if __WORDSIZE == 32
|
|
|
|
void *regs[6];
|
|
|
|
#elif __WORDSIZE == 64
|
|
|
|
void *regs[8];
|
|
|
|
#else
|
2013-10-15 19:46:39 -04:00
|
|
|
// hack for thumb
|
|
|
|
void *regs[10];
|
|
|
|
//#error Unsupported __WORDSIZE
|
2013-10-15 17:25:17 -04:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned int nlr_push(nlr_buf_t *);
|
2013-10-23 15:20:17 -04:00
|
|
|
void nlr_pop(void);
|
2013-10-15 17:25:17 -04:00
|
|
|
void nlr_jump(void *val) __attribute__((noreturn));
|