<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 26, 2022 at 9:28 AM <<a href="mailto:bil@ccrma.stanford.edu">bil@ccrma.stanford.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">*error-hook* is only called if there is no catch; it resets the s7 stack<br>
when it returns, so you're back at the top level. My first thought is<br>
that you need a catch in convert.scm where you do the s7_call. Maybe<br>
I have the wrong model of what's happening.<br>
<br>
The s7 stack can be viewed via (*s7* 'stack); it is independent of the<br>
C stack (I assume that's what you're seeing with backtrace). I don't<br>
think the GC is the culprit. s7_show_stack can give an abbreviated<br>
view of the s7 stack from C (you'll need a declaration -- it's not<br>
in s7.h, but it is accessible globally -- I thought of it as a<br>
debugging aid -- (*s7* 'stack) is sometimes very verbose).<br></blockquote><div><br></div><div>Looks like the s7 stack is the issue. I got rid of the error-hook. Now my 'return' statement hangs. Here is the code, details omitted:</div><div><br></div>for each dune file (composed of "stanza" sexps):<br><br> while(true) {<br> s7_pointer stanza = s7_read(s7, port);<br> s7_show_stack(s7);<br> errmsg = s7_get_output_string(s7, s7_current_error_port(s7));<br> if ((errmsg) && (*errmsg)) {<br> if (strstr(errmsg,<br> ";read-error (\"unexpected close paren:") != NULL) {<br> ... fix problem, reading entire dune file ...<br> break;<br> }<br> }<br> if (stanza == s7_eof_object(s7)) {<br> break;<br> }<br> ... do stuff with stanza ...<br> }<br><div><br></div><div>If the file has no errors, the stack looks like this:</div><div><br></div><div>stack:<br> let*1<br> let*1<br> eval_done<br> gc_protect<br></div><div><br></div><div>But when we try to s7_read a stanza with the dot syntax error, the stack is:</div><div><br></div><div>reading stanza<br>stack:<br> read_list<br> read_list<br> eval_done<br> barrier<br> let*1<br> let*1<br> eval_done<br> gc_protect<br></div><div><br></div><div>I can still fix the error by reading the file into a string, fixing it, and then s7_read the string-port. But now my return hangs.</div><div><br></div><div>Is there any way to unwind the stack past "barrier"? Or is there a way to call s7_read with a catch that will allow me to recover in situ?</div><div><br></div><div>Thanks,</div><div><br></div><div>Gregg</div></div></div>