Bill et all,

consider the following program

```
#include "s7.h"
#include "stdio.h"

s7_pointer inner_test(s7_scheme *s, s7_pointer args) {
    s7_error(s, s7_make_symbol(s, "test-error"), s7_list(s, 1, 
s7_make_string(s, "TEST ERROR")));
    return s7_nil(s);
}

s7_pointer test_fn(s7_scheme *s, s7_pointer args) {
    fprintf(stderr, "before INNER call\n");
    s7_call_with_catch(s, s7_t(s), s7_name_to_value(s, "inner-test"), 
s7_name_to_value(s, "inner-test-handler"));
    fprintf(stderr, "after INNER call\n");    
    return s7_nil(s);
}

s7_pointer inner_test_handler(s7_scheme *s, s7_pointer args) {
    fprintf(stderr, "INNER CATCH\n");
    return s7_nil(s);
}

int main(int argc, char *argv) {
    s7_scheme *s = s7_init();
    s7_define_function(s, "test-fn", test_fn, 1, 0, false, "call the inner 
test");
    s7_define_function(s, "inner-test", inner_test, 0, 0, false, "throw");
    s7_define_function(s, "inner-test-handler", inner_test_handler, 2, 0, 
false, "do nothing");

    s7_eval_c_string(s, "(call-with-exit test-fn)");
    s7_quit(s);
}
```

When `inner_test` throws its error, i expect `inner_test_handler` to get 
called, and then control return after the s7_call_with_catch
call. However, when called inside `call-with-exit` (as above), control returns 
after that call (at the bottom of the program)

this was tested with s7 a667b1f36282a6401a634035b25b2ac82a635ebd

I'm going to keep looking at this tonight, but if anyone else can see the issue 
I'd appreciate it!

Thanks,
Woody Douglass

PS
I'm compiling this program with the following
```
gcc -o catch-return-test catch-return-test.c s7.c -ldl -lm
```


_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to