XLISP 1.2+ Initialization Bug
John Woods
jfw at mit-eddie.UUCP
Sat Sep 22 08:38:03 AEST 1984
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 at MIT-XX
" `The Ego posits itself'...Rubbish!" -M.P.
More information about the Comp.sources.unix
mailing list