home *** CD-ROM | disk | FTP | other *** search
- /* gvadr() -- Get variable address from vlist, with type checking.
- * This routine allows numerous copies of same name as long as
- * all copies have different types. Probably doesnt matter since
- * the parser does the type checking.
- */
- struct dictnode *gvadr(s,ty)
- char *s;
- int ty;
- {
- register int i;
- register int qual; /* type qualifier */
-
- /* Inefficient */
- for(i=0; vlist[i].name!=0 && i<VLSIZ; i++)
- if(vlist[i].type_of_value==ty && strcmp(s,vlist[i].name)==0)
- /* match found */
- break;
- if(i >= VLSIZ) {
- fprintf(stderr,"gvadr: out of room in variable list for %s\n",s);
- exit(1);
- }
- /* not on list, enter it */
- if(vlist[i].name == 0) {
- vlist[i].name = myalloc(strlen(s)+1);
- strcpy(vlist[i].name,s);
- vlist[i].val.rval = 0;
- vlist[i].type_of_value = ty;
- if(ty&T_QMASK == Q_ARY)
- vlist[i].val.arval = myalloc(13*sizeof(union value));
- }
- return(&vlist[i]);
- }
-