betz (04/13/83)
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