[CM] C Stack Unwinding

Woody Douglass wdouglass at carnegierobotics.com
Thu Nov 4 06:26:57 PDT 2021

things just got even weirder. to get around the symbol problem i added

define_func = s7_let_ref(s, s7_rootlet(s), define_func);

so that define_func was the function and not a symbol. Now, the results
are still not consistent -- instead of getting
#f #t
like i did before this change, i now get
division-by-zero #t

instead of my catch being called, it seems like the default one is
being called

I'd eventually like to write a wrapper for s7_eval that looks something
like this

bool s7_eval_errorcheck(s7_scheme *s, s7_pointer arg, s7_pointer *out);

which returns true if out is the result of an error handler, and false
if not. that way, c functions can do something like 

s7_pointer in, out;
//initialize in here
if (s7_eval_errorcheck(s, in, &out)) {
    //do any c unwinding/cleanup, and then re-raise the
    //error to get back to where we started
    s7_error(s, s7_car(out), s7_cdr(out));

I'm still trying to figure out how feasible this is, any advice is

Thanks again,

On Thu, 2021-11-04 at 05:56 -0700, bil at ccrma.Stanford.EDU wrote:
> Argh -- this is two problems.  First the documentation
> is incomplete or incorrect (depending on whether you've
> had lunch), and has been for a long time -- s7_define_function
> returns the function name as a symbol, whereas s7_make_function
> returns the function.  The comment in s7.h is also wrong.
> Sorry about that!  The second bug is that you didn't get
> an error when the catch process tried to apply the symbol
> to the error info arguments.  I don't know why not yet.
> If you turn on S7_DEBUGGING, you'd get a complaint
> about trying to apply a symbol.

More information about the Cmdist mailing list