Installing Variables in Symbol Table
/* install variables in symbol table */
instvars(TOKEN idlist, TOKEN typetok)
{ SYMBOL sym, typesym; int align;
typesym = typetok-> symtype;
align = (typesym-> size > WORDSIZE) ?
ALIGNSIZE : typesym-> size ;
while ( idlist != NULL ) /* for each id */
{ sym = insertsym(idlist-> stringval);
sym-> kind = VARSYM;
sym-> offset =
wordaddress(blockoffs[blocknumber],
align);
sym-> size = typesym-> size;
blockoffs[blocknumber] =
sym-> offset + sym-> size;
sym-> datatype = typesym;
sym-> basicdt = typesym-> basicdt;
idlist = idlist-> link;
};
}
blockoffs[blocknumber] is the offset in the current block; this is the next value for this storage allocation.
Contents    Page-10    Prev    Next    Page+10    Index