Another XLISP patch (oh well)
utzoo!decvax!betz
utzoo!decvax!betz
Wed Apr 13 11:04:20 AEST 1983
Another Patch for XLISP Version 1.0
It turns out that there is another fairly serious problem
with the version of 'xlobj.c' that I sent out with the most
recent xlisp distribution. The problem occurs when a
subclass is created. When a subclass adds instance
variables to those in its superclass (which it almost always
does), xlisp doesn't know how to find those new instance
variables correctly (or the old ones from the superclass for
that matter). In order to solve this problem, the following
routine should be inserted into the distribution copy of
'xlobj.c' replacing the routine with the same name.
Another Patch for XLISP Version 1.0 Page 2
/* findvar - find a class or instance variable */
static struct node *findvar(obj,sym)
struct node *obj,*sym;
{
struct node *cls,*lptr;
int base,varnum;
int found;
/* get the class of the object */
cls = obj->n_obclass;
/* get the total number of instance variables */
base = getivcnt(cls,IVARTOTAL);
/* find the variable */
found = FALSE;
for (; cls != NULL; cls = xlivar(cls,SUPERCLASS)->n_listvalue) {
/* get the number of instance variables for this class */
if ((base -= getivcnt(cls,IVARCNT)) < 0)
xlfail("error finding instance variable");
/* check for finding the class of the current message */
if (!found && cls == msgclass->n_symvalue)
found = TRUE;
/* lookup the instance variable */
varnum = 0;
for (lptr = xlivar(cls,IVARS)->n_listvalue;
lptr != NULL;
lptr = lptr->n_listnext)
if (found && lptr->n_listvalue == sym)
return (xlivar(obj,base + varnum));
else
varnum++;
/* skip the class variables if the message class hasn't been found */
if (!found)
continue;
/* lookup the class variable */
varnum = 0;
for (lptr = xlivar(cls,CVARS)->n_listvalue;
lptr != NULL;
lptr = lptr->n_listnext)
if (lptr->n_listvalue == sym)
return (xlcvar(cls,varnum));
else
varnum++;
}
/* variable not found */
return (NULL);
}
Another Patch for XLISP Version 1.0 Page 3
After replacing the 'findvar' routine, 'xlobj.c' should be
recompiled and xlisp should be relinked.
Sorry about that!
David Betz
More information about the Comp.sources.unix
mailing list