PreScheme exception handling
Thomas Hintz <[email protected]> Mon, 16 Nov 2015 15:27:09 -0800
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm attempting to use setjmp and longjmp with PreScheme to handle
exceptions. The problem is PreScheme pulls the result of the setjmp call
out of the if statement and instead stores its result in a variable
which the if statement then checks. For setjmp the call needs to be in
the if test itself or you get some wacky behavior (it would seem).
So I need:
if (!setjmp(buf)) {
handle_error
} else {
code_that_calls_longjmp();
}
but PreScheme generates:
v = setjmp(buf));
if ((0 == v)) {
code_that_calls_longjmp();
} else {
handle_error
}
Is there maybe some trick to get PreScheme to do what I want? Or is
there a better way to do it within PreScheme?
Thanks and all the best,
Thomas Hintz