[CM] C Stack Unwinding

Woody Douglass wdouglass at carnegierobotics.com
Thu Nov 4 06:37:17 PDT 2021


Sorry for the message flood, but I have one more thing to show. See the
attached C file

It seems consecutive calls to s7_call_with_catch carry some state;
consecutive calls with the same arguments and no global state
manipulation show different results.

Thanks again, and sorry again for the email avalanche!
Woody

On Thu, 2021-11-04 at 13:26 +0000, Woody Douglass wrote:
> 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
> appreciated!
> 
> Thanks again,
> Woody
> 
> 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.
> > 
> 
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testerror3.c
Type: text/x-csrc
Size: 909 bytes
Desc: testerror3.c
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20211104/e6f4bd98/attachment.bin>


More information about the Cmdist mailing list