diff options
author | gingold | 2006-03-10 01:53:55 +0000 |
---|---|---|
committer | gingold | 2006-03-10 01:53:55 +0000 |
commit | 04f194de79f5b4b44ac09c42bd926c7e7732bc54 (patch) | |
tree | ba6394b662801ad0031d5d3152708c8c08a0139a /translate/grt/config/linux.c | |
parent | a519edeff15246963006756abeef8ee304d371ff (diff) | |
download | ghdl-04f194de79f5b4b44ac09c42bd926c7e7732bc54.tar.gz ghdl-04f194de79f5b4b44ac09c42bd926c7e7732bc54.tar.bz2 ghdl-04f194de79f5b4b44ac09c42bd926c7e7732bc54.zip |
setjmp/longjmp moved from cbinding to config
Diffstat (limited to 'translate/grt/config/linux.c')
-rw-r--r-- | translate/grt/config/linux.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/translate/grt/config/linux.c b/translate/grt/config/linux.c index 2fe92c0..6b73cb4 100644 --- a/translate/grt/config/linux.c +++ b/translate/grt/config/linux.c @@ -285,3 +285,28 @@ grt_stack_allocate (void) res->cur_length = stack_size; return res; } + +#include <setjmp.h> +static int run_env_en; +static jmp_buf run_env; + +void +__ghdl_maybe_return_via_longjump (int val) +{ + if (run_env_en) + longjmp (run_env, val); +} + +int +__ghdl_run_through_longjump (int (*func)(void)) +{ + int res; + + run_env_en = 1; + res = setjmp (run_env); + if (res == 0) + res = (*func)(); + run_env_en = 0; + return res; +} + |