This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
>I'd like to use continuations to jump back and >forth between Scheme and C code, with the Scheme code preferably being >evaluated from a string inside the C code. The problem is that this >explodes, because scm_eval_string, which is what ultimately gets >called to deal with evaluating a string file, closes the port it >internally creates when it exits, and can't deal if it is re-entered >via a continuation. I think the solution is for scm_eval_string not to close the port it creates. Since it's a string port, it doesn't correspond to any external resources, so the only difference between closing it early and letting the GC pick it up at its leisure is that it gives you errors. Sun Sep 28 00:04:29 1997 Jim Blandy <jimb@totoro.red-bean.com> * strports.c (scm_eval_string): Don't close the port. The change should be visible in tomorrow's snapshot. If you want to make it yourself, here's the patch: Index: strports.c =================================================================== RCS file: /u/src/master/guile-core/libguile/strports.c,v retrieving revision 1.15 diff -c -c -r1.15 strports.c *** strports.c 1997/09/22 00:43:51 1.15 --- strports.c 1997/09/28 04:05:36 *************** *** 273,279 **** while (!SCM_EOF_OBJECT_P (form = scm_read (port))) ans = scm_eval_x (form); ! scm_close_port (port); return ans; } --- 273,283 ---- while (!SCM_EOF_OBJECT_P (form = scm_read (port))) ans = scm_eval_x (form); ! /* Don't close the port here; if we re-enter this function via a ! continuation, then the next time we enter it, we'll get an error. ! It's a string port anyway, so there's no advantage to closing it ! early. */ ! return ans; }