nlr: Add implementation using setjmp/longjmp.

Having an optimized asm implementation is good, but if we want portability,
that's it.
This commit is contained in:
Paul Sokolovsky
2014-04-17 00:16:45 +03:00
parent a1c67206c8
commit 3a83b805fc
3 changed files with 36 additions and 1 deletions

16
py/nlrsetjmp.c Normal file
View File

@@ -0,0 +1,16 @@
#include <setjmp.h>
#include <stdio.h>
#include "nlr.h"
#if MICROPY_NLR_SETJMP
nlr_buf_t *nlr_setjmp_top;
void nlr_setjmp_jump(void *val) {
nlr_buf_t *buf = nlr_setjmp_top;
nlr_setjmp_top = buf->prev;
buf->ret_val = val;
longjmp(buf->jmpbuf, 1);
}
#endif