jfw@mit-eddie.UUCP (John Woods) (09/22/84)
There is a bug in XLISP's initialization code, which caused the value of a subr to become smashed (it turns out that I did not find this until I added a couple of new functions). What happens is: xlsubr creates a new subr object and then calls xlputprop. xlputprop creates some new list elements, but if it just happens to need a gc(), xlsubr forgot to save away it's subr on the lisp stack (and xlputprop assumes that it's inputs were protected by eval()). The fix: Replace, in xlsubr.c, these functions with this new code: /*************************************** * xlsubr - define a builtin function * ***************************************/ xlsubr(sname,subr) char *sname; struct node *(*subr)(); { struct node *sym, newsubr; struct node *oldstk = xlsave(&newsubr,NULL); sym = xlenter(sname); /* Enter the symbol */ (newsubr.n_ptr = newnode(SUBR))->n_subr = subr; xlputprop(sym,newsubr.n_ptr,Subrprop); xlstack = oldstk; } /********************************************* * xlfsubr - define a builtin funny function * **********************************************/ xlfsubr(sname,fsubr) char *sname; struct node *(*fsubr)(); { struct node *sym, newsubr; struct node *oldstk = xlsave(&newsubr,NULL); sym = xlenter(sname); /* Enter the symbol */ (newsubr.n_ptr = newnode(FSUBR))->n_subr = fsubr; xlputprop(sym,newsubr.n_ptr,Fsubrprop); xlstack = oldstk; } -- John Woods, Charles River Data Systems decvax!frog!john, mit-eddie!jfw, JFW@MIT-XX " `The Ego posits itself'...Rubbish!" -M.P.