summaryrefslogtreecommitdiffstatshomepage
path: root/py/nlrsetjmp.c
blob: a8756d9d879bac80f35a1eced75bc07a83975d34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <setjmp.h>
#include <stdio.h>
#include "mpconfig.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