[CM] s7: Legality of calling s7_error from C (without being called from scheme)

Kjetil Matheussen k.s.matheussen at gmail.com
Mon May 8 06:49:13 PDT 2017


Hi,

I wonder about this code:

int main(){

  do_lots_of_things();

  s7scheme *s7 = s7_init();

  load_some_scheme_code(s7);

  do_lots_of_more_things();

  s7_pointer data = s7_call(s7, s7_name_to_value(s7,
"get-some-data"), s7_list(s7, 0));

 if (!s7_is_number(data))
    s7_error(s7,
             s7_make_symbol(s7, "wrong-data"),
             s7_list(s7,
                     1,
                     s7_make_string(s7, "got wrong data""))
             );

  printf("hello\n");

  do_even_more_things();

  return 0;
}


Is this fully supported to work in s7? Will "hello" always be printed to
the terminal even if "get-some-data" doesn't return a number? (i.e. could
's7_error' call 'longjmp' or similar functions in the code above?)

I do this to make my *rootlet-redefinition-hook* hook print out history of
the last executed scheme code. It seems to work just fine, but I don't feel
confident enough about what's happening.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20170508/dc0197a3/attachment.html>


More information about the Cmdist mailing list