ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/calfunc.c
(Generate patch)

Comparing ray/src/common/calfunc.c (file contents):
Revision 2.1 by greg, Tue Nov 12 16:55:16 1991 UTC vs.
Revision 2.2 by greg, Fri May 15 16:38:47 1992 UTC

# Line 88 | Line 88 | static int  libsize = 5;
88  
89   extern char  *savestr(), *emalloc();
90  
91 extern LIBR  *liblookup();
92
91   extern VARDEF  *argf();
92  
93   #ifdef  VARIABLE
# Line 157 | Line 155 | double  (*fptr)();
155   {
156      register LIBR  *lp;
157  
158 <    if ((lp = liblookup(fname)) == NULL) {
158 >    if ((lp = liblookup(fname)) == NULL) {      /* insert */
159          if (libsize >= MAXLIB) {
160              eputs("Too many library functons!\n");
161              quit(1);
# Line 172 | Line 170 | double  (*fptr)();
170                  break;
171          libsize++;
172      }
173 <    lp[0].fname = fname;                /* must be static! */
174 <    lp[0].nargs = nargs;
175 <    lp[0].atyp = assign;
176 <    lp[0].f = fptr;
173 >    if (fptr == NULL) {                         /* delete */
174 >        while (lp < &library[libsize-1]) {
175 >            lp[0].fname = lp[1].fname;
176 >            lp[0].nargs = lp[1].nargs;
177 >            lp[0].atyp = lp[1].atyp;
178 >            lp[0].f = lp[1].f;
179 >            lp++;
180 >        }
181 >        libsize--;
182 >    } else {                                    /* or assign */
183 >        lp[0].fname = fname;            /* string must be static! */
184 >        lp[0].nargs = nargs;
185 >        lp[0].atyp = assign;
186 >        lp[0].f = fptr;
187 >    }
188 >    libupdate(fname);                   /* relink library */
189   }
190  
191  
# Line 369 | Line 379 | register VARDEF  *vp;
379  
380      if (vp == NULL) {
381          vp = &dumdef;
382 <        vp->lib = NULL;
382 >        vp->lib = liblookup(fname);
383      }
384 <    if (((vp->lib == NULL || strcmp(fname, vp->lib->fname)) &&
375 <                                (vp->lib = liblookup(fname)) == NULL) ||
376 <                vp->lib->f == NULL) {
384 >    if (vp->lib == NULL) {
385          eputs(fname);
386          eputs(": undefined function\n");
387          quit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines