[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: es signal catching
|> It seems to me that I want to be able to "catch" these exceptions in the
|> doit() loop, but I can't see how to do that.
| the other thing you have to do is add the signals you want to
| catch to the list $signals. no promises that it works, but it
| has been tested a little. please let me know whether it works.
Well, yes, that part I (sort of) had figured out, and it works as far
as it goes:
;; signals = ($signals sigusr1)
;; kill -USR1 $pid
uncaught exception: signal sigusr1
;;
So, since it's not getting any clearer to me how to install a signal handler
for the main read/eval loop, I added a couple of lines to doit() to see if I
could add support for rc's "fn sigxxx" convention. It seems to work, and I
include the code below. Still, I would much rather use es as distributed,
if anyone can clue me in as to how.
Donn Cave, University Computing Services, University of Washington
donn@cac.washington.edu
-------------------------------
caveat:
The following was done in haste, by someone who has virtually no
idea how es' memory management works.
----------------------------------------
*** input.c.v2 Tue Oct 20 15:59:01 1992
--- input.c Mon Dec 21 15:36:16 1992
***************
*** 299,304 ****
--- 299,305 ----
execit = FALSE;
while ((e = pushhandler(&h)) != NULL) {
+ List *signalfunc;
if (!interactive) {
popinput();
throw(e);
***************
*** 305,310 ****
--- 306,313 ----
}
if (streq(getstr(e->term), "error"))
eprint("%L\n", e->next, " ");
+ else if (streq(getstr(e->term), "signal") && (signalfunc = varlookup2 ("fn-", e->next->term->str)))
+ eval(mklist(signalfunc->term, e->next), NULL, TRUE, exitonfalse);
else if (!issilentsignal(e))
eprint("uncaught exception: %L\n", e, " ");
}