[CM] Examples of printing out errors in S7?
iainduncanlists at gmail.com
Fri Apr 10 10:37:28 PDT 2020
Thanks Bill, I'll chew on all that and see how far I can get. Much
On Fri, Apr 10, 2020 at 10:15 AM <bil at ccrma.stanford.edu> wrote:
> Normally, s7_error (called either from C or scheme) sends its error
> to the current error-port. It defaults to *stderr*, so in GUI-based
> you may need to redirect the output to your interface. One example is
> s7/tools/grepl.c. Its evaluator function wraps up the s7_eval_c_string:
> old_port = s7_set_current_error_port(s7, s7_open_output_string(s7));
> result = s7_eval_c_string(s7, text);
> errmsg = s7_get_output_string(s7, s7_current_error_port(s7));
> and if errmsg is not NULL, it posts it somewhere (via
> since it's using the repl in glistener.c). Snd uses largely the same
> code (snd-motif.c and glistener.c if in gtk). See also s7.html under
> "glistener". If you don't want s7's error messages, you can go down
> a level via *error-hook*.
> I don't know why your program exits silently, but a first fix might be
> to wrap the string being evaluated in a catch (s7.html under "errors").
> If you're calling s7_apply_function, you may need to make sure
> a catch exists. In Snd, if I remember right, this involves
> top_level_catch (snd.c, snd-nogui.c, etc). Or you can use s7_call
> instead of s7_apply_function.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cmdist