return(KEYW);
rp = hshtab[ihash];
while (rp) {
- if (strcmp(symbuf, rp->name) != 0)
+ if (strcmp(symbuf, rp->nl_name) != 0)
goto no;
- if (mossym != (rp->hflag&FKIND))
+ if (mossym != (rp->nl_flag&FKIND))
goto no;
csym = rp;
return(NAME);
no:
- rp = rp->nextnm;
+ rp = rp->nl_nextnm;
}
rp = (struct nmlist *)Dblock(sizeof(struct nmlist));
- rp->nextnm = hshtab[ihash];
+ rp->nl_nextnm = hshtab[ihash];
hshtab[ihash] = rp;
- rp->hclass = 0;
- rp->htype = 0;
- rp->hoffset = 0;
- rp->hsubsp = NULL;
- rp->hstrp = NULL;
- rp->sparent = NULL;
- rp->hblklev = blklev;
- rp->hflag = mossym;
- rp->name = Dblock((strlen(symbuf) + 1 + LNCPW - 1) & ~(LNCPW - 1));
- strcpy(rp->name, symbuf);
+ rp->nl_class = 0;
+ rp->nl_type = 0;
+ rp->nl_offset = 0;
+ rp->nl_subsp = NULL;
+ rp->nl_strp = NULL;
+ rp->nl_sparent = NULL;
+ rp->nl_blklev = blklev;
+ rp->nl_flag = mossym;
+ rp->nl_name = Dblock((strlen(symbuf) + 1 + LNCPW - 1) & ~(LNCPW - 1));
+ strcpy(rp->nl_name, symbuf);
csym = rp;
return(NAME);
}
case NAME:
cs = csym;
- if (cs->hclass==TYPEDEF)
+ if (cs->nl_class==TYPEDEF)
goto atype;
- if (cs->hclass==ENUMCON) {
- *cp++ = (struct node *)cblock(cs->hoffset);
+ if (cs->nl_class==ENUMCON) {
+ *cp++ = (struct node *)cblock(cs->nl_offset);
goto tand;
}
- if (cs->hclass==0 && cs->htype==0)
+ if (cs->nl_class==0 && cs->nl_type==0)
if(nextchar()=='(') {
/* set function */
- cs->hclass = EXTERN;
- cs->htype = FUNC;
+ cs->nl_class = EXTERN;
+ cs->nl_type = FUNC;
} else {
- cs->hclass = STATIC;
- error0("%s undefined; func. %s", cs->name,
- funcsym ? funcsym->name : "(none)");
+ cs->nl_class = STATIC;
+ error0("%s undefined; func. %s", cs->nl_name,
+ funcsym ? funcsym->nl_name : "(none)");
}
*cp++ = (struct node *)nblock(cs);
goto tand;
else
putstr(cval, 0);
cs = (struct nmlist *)Tblock(sizeof(struct nmlist));
- cs->hclass = STATIC;
- /* cs->hoffset = cval;
+ cs->nl_class = STATIC;
+ /* cs->nl_offset = cval;
*cp++ = block(NAME, unscflg? ARRAY+UNCHAR:ARRAY+CHAR, &nchstr,
(union str *)NULL, (struct node *)cs, (struct node *)NULL);*/
- cs->hflag = 0;
- cs->htype = unscflg? ARRAY+UNCHAR:ARRAY+CHAR;
- cs->hstrp = (union str *)&nchstr;
- cs->hoffset = cval;
- cs->nextnm = 0;
- cs->sparent = 0;
- cs->hblklev = 0;
- cs->name = 0;
+ cs->nl_flag = 0;
+ cs->nl_type = unscflg? ARRAY+UNCHAR:ARRAY+CHAR;
+ cs->nl_strp = (union str *)&nchstr;
+ cs->nl_offset = cval;
+ cs->nl_nextnm = 0;
+ cs->nl_sparent = 0;
+ cs->nl_blklev = 0;
+ cs->nl_name = 0;
*cp++ = (struct node *)nblock(cs);
tand:
scp = cp;
sc = DEFXTRN; /* will cause error if class mentioned */
getkeywords(&sc, &typer);
- absname.hclass = 0;
- absname.hblklev = blklev;
- absname.hsubsp = NULL;
- absname.hstrp = NULL;
- absname.htype = 0;
+ absname.nl_class = 0;
+ absname.nl_blklev = blklev;
+ absname.nl_subsp = NULL;
+ absname.nl_strp = NULL;
+ absname.nl_type = 0;
decl1(sc, &typer, 0, &absname);
cp = scp;
- return(block(ETYPE, absname.htype, absname.hsubsp,
- absname.hstrp, (struct node *)NULL, (struct node *)NULL));
+ return(block(ETYPE, absname.nl_type, absname.nl_subsp,
+ absname.nl_strp, (struct node *)NULL, (struct node *)NULL));
}
/*char *copnum(len) int len; {
* then * is tacked on to access the member.
*/
case ARROW:
- if (p2->n_op!=NAME || ((struct nnode *)p2)->nn_nmlist->hclass!=MOS) {
+ if (p2->n_op!=NAME || ((struct nnode *)p2)->nn_nmlist->nl_class!=MOS) {
error0("Illegal structure ref");
*cp++ = p1;
return;
#define np2 ((struct nnode *)p2)
structident(p1, np2);
t2 = np2->nn_type;
- if (t2==INT && np2->nn_nmlist->hflag&FFIELD)
+ if (t2==INT && np2->nn_nmlist->nl_flag&FFIELD)
t2 = UNSIGN;
t = incref0(t2);
chkw(p1, -1);
setype(p1, t, (struct node *)np2);
*cp++ = (struct node *)block(PLUS, t, np2->nn_subsp, np2->nn_strp,
- p1, (struct node *)cblock(np2->nn_nmlist->hoffset));
+ p1, (struct node *)cblock(np2->nn_nmlist->nl_offset));
build(STAR);
- if (np2->nn_nmlist->hflag&FFIELD)
+ if (np2->nn_nmlist->nl_flag&FFIELD)
#if 1
cp[-1] = (struct node *)block(FSEL, UNSIGN, (int *)NULL, (union str *)NULL,
- cp[-1], (struct node *)np2->nn_nmlist->hstrp);
+ cp[-1], (struct node *)np2->nn_nmlist->nl_strp);
#else
*cp++ = (struct node *)block(FSEL, UNSIGN, (int *)NULL, (union str *)NULL,
- *--cp, (struct node *)np2->nn_nmlist->hstrp);
+ *--cp, (struct node *)np2->nn_nmlist->nl_strp);
#endif
return;
#undef np2
np = nporig = p2->nn_nmlist;
for (;;) {
- if (namesame && p1->n_type==STRUCT+PTR && p1->n_strp == np->sparent) {
- p2->nn_type = np->htype;
- p2->nn_strp = np->hstrp;
- p2->nn_subsp = np->hsubsp;
+ if (namesame && p1->n_type==STRUCT+PTR && p1->n_strp == np->nl_sparent) {
+ p2->nn_type = np->nl_type;
+ p2->nn_strp = np->nl_strp;
+ p2->nn_subsp = np->nl_subsp;
p2->nn_nmlist = np;
return;
}
- np = np->nextnm;
+ np = np->nl_nextnm;
if (np==NULL)
break;
namesame = 0;
- if (strcmp(nporig->name, np->name) != 0)
+ if (strcmp(nporig->nl_name, np->nl_name) != 0)
continue;
- if ((nporig->hflag&FKIND) != (np->hflag&FMOS))
+ if ((nporig->nl_flag&FKIND) != (np->nl_flag&FMOS))
continue;
namesame = 1;
- if (nporig->htype==np->htype && nporig->hoffset==np->hoffset)
+ if (nporig->nl_type==np->nl_type && nporig->nl_offset==np->nl_offset)
continue;
vartypes++;
}
if (vartypes)
- error0("Ambiguous structure reference for %s",nporig->name);
+ error0("Ambiguous structure reference for %s",nporig->nl_name);
else
- werror0("%s not member of cited struct/union",nporig->name);
+ werror0("%s not member of cited struct/union",nporig->nl_name);
}
/*
return(p);
/* check array & not MOS and not typer */
if (((t = p->n_type)&XTYPE)!=ARRAY
- || p->n_op==NAME && ((struct nnode *)p)->nn_nmlist->hclass==MOS
+ || p->n_op==NAME && ((struct nnode *)p)->nn_nmlist->nl_class==MOS
|| p->n_op==ETYPE)
return(p);
p->n_subsp++;
}
struct nnode *nblock(ds) register struct nmlist *ds; {
- /* return(block(NAME, ds->htype, ds->hsubsp, ds->hstrp, (struct node *)ds, (struct node *)NULL));*/
+ /* return(block(NAME, ds->nl_type, ds->nl_subsp, ds->nl_strp, (struct node *)ds, (struct node *)NULL));*/
struct nnode *p;
- if (ds->hclass == EXTERN) {
+ if (ds->nl_class == EXTERN) {
#define extp (*(struct extnnode **)&p)
extp = (struct extnnode *)Tblock(sizeof(struct extnnode));
- extp->extnn_name = Tblock((strlen(ds->name)+2+LNCPW-1) & ~(LNCPW-1));
+ extp->extnn_name = Tblock((strlen(ds->nl_name)+2+LNCPW-1) & ~(LNCPW-1));
extp->extnn_name[0] = '_';
- strcpy(extp->extnn_name + 1, ds->name);
+ strcpy(extp->extnn_name + 1, ds->nl_name);
#undef extp
}
else {
#define locp (*(struct locnnode **)&p)
locp = (struct locnnode *)Tblock(sizeof(struct locnnode));
- locp->locnn_nloc = ds->hoffset;
+ locp->locnn_nloc = ds->nl_offset;
#undef locp
}
p->nn_op = NAME;
- p->nn_type = ds->htype;
- p->nn_subsp = ds->hsubsp;
- p->nn_strp = ds->hstrp;
+ p->nn_type = ds->nl_type;
+ p->nn_subsp = ds->nl_subsp;
+ p->nn_strp = ds->nl_strp;
p->nn_nmlist = ds;
- p->nn_class = ds->hclass==0?STATIC:ds->hclass;
+ p->nn_class = ds->nl_class==0?STATIC:ds->nl_class;
p->nn_regno = 0;
p->nn_offset = 0;
return p;
register struct nmlist *tp;
tp = (struct nmlist *)Tblock(sizeof(struct nmlist));
- tp->hclass = AUTO;
- tp->htype = type;
- tp->hflag = 0;
- tp->hsubsp = NULL;
- tp->hstrp = NULL;
- tp->hblklev = blklev;
+ tp->nl_class = AUTO;
+ tp->nl_type = type;
+ tp->nl_flag = 0;
+ tp->nl_subsp = NULL;
+ tp->nl_strp = NULL;
+ tp->nl_blklev = blklev;
autolen -= rlength((struct node *)tp);
- tp->hoffset = autolen;
+ tp->nl_offset = autolen;
if (autolen < maxauto)
maxauto = autolen;
return(tp);
if ((ds=defsym)==0)
return;
funcsym = ds;
- if ((ds->htype&XTYPE)==FUNC) {
+ if ((ds->nl_type&XTYPE)==FUNC) {
if ((peeksym=symbol())==LBRACE || peeksym==KEYW
- || (peeksym==NAME && csym->hclass==TYPEDEF)) {
+ || (peeksym==NAME && csym->nl_class==TYPEDEF)) {
/* create a fake local variable of same type as function's return type */
- funcblk.locnn_type = decref0(ds->htype);
- funcblk.locnn_strp = ds->hstrp;
+ funcblk.locnn_type = decref0(ds->nl_type);
+ funcblk.locnn_strp = ds->nl_strp;
setinit(ds);
- outcode("BS", SYMDEF, sclass==EXTERN?ds->name:"");
+ outcode("BS", SYMDEF, sclass==EXTERN?ds->nl_name:"");
cfunc();
return;
}
o = (length((struct node *)ds)+ALIGN) & ~ALIGN;
if (sclass==STATIC) {
setinit(ds);
- outcode("BSBBSBN", SYMDEF, "", BSS, NLABEL, ds->name, SSPACE, o);
+ outcode("BSBBSBN", SYMDEF, "", BSS, NLABEL, ds->nl_name, SSPACE, o);
} else if (scflag)
- outcode("BSN", CSPACE, ds->name, o);
+ outcode("BSN", CSPACE, ds->nl_name, o);
} else {
if (o!=ASSIGN) {
error0("Declaration syntax");
}
setinit(ds);
if (sclass==EXTERN)
- outcode("BS", SYMDEF, ds->name);
- outcode("BBS", DATA, NLABEL, ds->name);
+ outcode("BS", SYMDEF, ds->nl_name);
+ outcode("BBS", DATA, NLABEL, ds->nl_name);
if (cinit(ds, 1, sclass) & ALIGN)
outcode("B", EVEN);
}
sloc = isn0;
isn0 += 2;
- outcode("BBS", PROG, RLABEL, funcsym->name);
+ outcode("BBS", PROG, RLABEL, funcsym->nl_name);
regvar = 5;
autolen = STAUTO;
maxauto = STAUTO;
declist(ARG);
outcode("B", SAVE);
if (proflg)
- outcode("BNS", PROFIL, isn0++, funcsym->name);
+ outcode("BNS", PROFIL, isn0++, funcsym->nl_name);
funchead();
branch0(sloc);
label0(sloc+1);
struct node *s;
np = *anp;
- realtype = np.htype;
+ realtype = np.nl_type;
isarray = 0;
if ((realtype&XTYPE) == ARRAY)
isarray++;
if (isarray || realtype==STRUCT)
error0("No auto. aggregate initialization");
if (isarray) {
- np.htype = decref0(realtype);
- np.hsubsp++;
+ np.nl_type = decref0(realtype);
+ np.nl_subsp++;
if (width==0 && flex==0)
- error0("0-length row: %s", anp->name);
+ error0("0-length row: %s", anp->nl_name);
o = length((struct node *)&np);
nel = (unsigned)width/o;
width = o;
}
brace = 0;
- if ((peeksym=symbol())==LBRACE && (isarray || np.htype!=STRUCT)) {
+ if ((peeksym=symbol())==LBRACE && (isarray || np.nl_type!=STRUCT)) {
peeksym = -1;
brace++;
}
ninit += nchstr;
o = symbol();
break;
- } else if (np.htype==STRUCT) {
+ } else if (np.nl_type==STRUCT) {
strinit(&np, sclass);
- } else if ((np.htype&ARRAY)==ARRAY || peeksym==LBRACE)
+ } else if ((np.nl_type&ARRAY)==ARRAY || peeksym==LBRACE)
cinit(&np, 0, sclass);
else {
char *st;
st = starttree();
s = tree(/*0*/);
initflg = 0;
- if (np.hflag&FFIELD)
+ if (np.nl_flag&FFIELD)
error0("No field initialization");
*cp++ = (struct node *)nblock(&np);
*cp++ = s;
rcexpr0(*--cp);
else if (sclass==ENUMCON) {
if (s->n_op!=CON)
- error0("Illegal enum constant for %s", anp->name);
- anp->hoffset = ((struct cnode *)s)->cn_value;
+ error0("Illegal enum constant for %s", anp->nl_name);
+ anp->nl_offset = ((struct cnode *)s)->cn_value;
} else
- rcexpr0((struct node *)block(INIT,np.htype,(int *)NULL,
+ rcexpr0((struct node *)block(INIT,np.nl_type,(int *)NULL,
(union str *)NULL, ((struct tnode *)(*--cp))->tn_tr2, (struct node *)NULL));
endtree(st);
}
outcode("BN", SSPACE, (nel-ninit)*width);
else if (ninit>nel) {
if (flex && nel==0) {
- np.hsubsp[-1] = ninit;
+ np.nl_subsp[-1] = ninit;
} else
- error0("Too many initializers: %s", anp->name);
+ error0("Too many initializers: %s", anp->nl_name);
nel = ninit;
}
return(nel*width);
static struct nmlist *zerloc = NULL;
register int o, brace;
- if ((mlp = np->hstrp->S.memlist)==NULL) {
+ if ((mlp = np->nl_strp->S.memlist)==NULL) {
mlp = &zerloc;
error0("Undefined structure initialization");
}
mlp++;
}
/* DAG -- union initialization bug fix */
- if (*mlp && mlp[-1]->hoffset == (*mlp)->hoffset) {
+ if (*mlp && mlp[-1]->nl_offset == (*mlp)->nl_offset) {
werror0("union initialization non-portable");
while (*mlp) /* will NOT be &structhole */
mlp++; /* skip other members of union */
} while ((o=symbol())==COMMA && (*mlp || brace));
if (sclass!=AUTO && sclass!=REG) {
if (*mlp)
- outcode("BN", SSPACE, np->hstrp->S.ssize - (*mlp)->hoffset);
+ outcode("BN", SSPACE, np->nl_strp->S.ssize - (*mlp)->nl_offset);
outcode("B", EVEN);
}
if (o!=RBRACE || brace==0)
*/
void setinit(np) register struct nmlist *np; {
- if (np->hflag&FINIT)
- error0("%s multiply defined", np->name);
- np->hflag |= FINIT;
+ if (np->nl_flag&FINIT)
+ error0("%s multiply defined", np->nl_name);
+ np->nl_flag |= FINIT;
}
/*
if (nextchar()==':') {
peekc = 0;
np = csym;
- if (np->hclass>0) {
- if (np->hblklev==0) {
+ if (np->nl_class>0) {
+ if (np->nl_blklev==0) {
np = pushdecl(np);
- np->hoffset = 0;
+ np->nl_offset = 0;
} else {
defsym = np;
redec();
goto stmt;
}
}
- np->hclass = STATIC;
- np->htype = ARRAY;
- np->hflag |= FLABL;
- if (np->hoffset==0)
- np->hoffset = isn0++;
- label0(np->hoffset);
+ np->nl_class = STATIC;
+ np->nl_type = ARRAY;
+ np->nl_flag |= FLABL;
+ if (np->nl_offset==0)
+ np->nl_offset = isn0++;
+ label0(np->nl_offset);
goto stmt;
}
}
pl = STARG;
while(paraml) {
- parame->sparent = NULL;
+ parame->nl_sparent = NULL;
cs = paraml;
- paraml = ¶ml->sparent->P;
- if (cs->htype==FLOAT)
- cs->htype = DOUBLE;
- cs->hoffset = pl;
- if ((cs->htype&XTYPE) == ARRAY) {
- cs->htype -= (ARRAY-PTR); /* set ptr */
- cs->hsubsp++; /* pop dims */
+ paraml = ¶ml->nl_sparent->P;
+ if (cs->nl_type==FLOAT)
+ cs->nl_type = DOUBLE;
+ cs->nl_offset = pl;
+ if ((cs->nl_type&XTYPE) == ARRAY) {
+ cs->nl_type -= (ARRAY-PTR); /* set ptr */
+ cs->nl_subsp++; /* pop dims */
}
pl += rlength((struct node *)cs);
- if (cs->hclass==AREG && (hreg.hoffset=goodreg(cs))>=0) {
+ if (cs->nl_class==AREG && (hreg.nl_offset=goodreg(cs))>=0) {
st = starttree();
*cp++ = (struct node *)&areg;
*cp++ = (struct node *)nblock(cs);
- areg.locnn_type = cs->htype;
- areg.locnn_strp = cs->hstrp;
- cs->hclass = AUTO;
+ areg.locnn_type = cs->nl_type;
+ areg.locnn_strp = cs->nl_strp;
+ cs->nl_class = AUTO;
build(ASSIGN);
rcexpr0(*--cp);
- cs->hoffset = hreg.hoffset;
- cs->hclass = REG;
+ cs->nl_offset = hreg.nl_offset;
+ cs->nl_class = REG;
endtree(st);
} else
- cs->hclass = AUTO;
+ cs->nl_class = AUTO;
prste(cs);
}
for (pl=0; pl<HSHSIZ; pl++) {
- for (cs = hshtab[pl]; cs!=NULL; cs = cs->nextnm) {
- if (cs->hclass == ARG || cs->hclass==AREG)
- error0("Not an argument: %s", cs->name);
+ for (cs = hshtab[pl]; cs!=NULL; cs = cs->nl_nextnm) {
+ if (cs->nl_class == ARG || cs->nl_class==AREG)
+ error0("Not an argument: %s", cs->nl_name);
}
}
outcode("BN", SETREG, regvar);
lcs = &hshtab[i];
cs = *lcs;
while (cs) {
- if (cs->hblklev > blklev
- && (((cs->hflag&FLABL)==0 && cs->hclass!=EXTERN) || blklev<=0)) {
- if (cs->hclass==0)
- error0("%s undefined", cs->name);
- if (cs->hclass==EXTERN)
+ if (cs->nl_blklev > blklev
+ && (((cs->nl_flag&FLABL)==0 && cs->nl_class!=EXTERN) || blklev<=0)) {
+ if (cs->nl_class==0)
+ error0("%s undefined", cs->nl_name);
+ if (cs->nl_class==EXTERN)
nameconflict(hshtab[i], cs);
- *lcs = cs->nextnm;
+ *lcs = cs->nl_nextnm;
} else
- lcs = &cs->nextnm;
- cs = cs->nextnm;
+ lcs = &cs->nl_nextnm;
+ cs = cs->nl_nextnm;
}
}
}
void nameconflict(ocs, cs) register struct nmlist *ocs; register struct nmlist *cs; {
- for (; ocs!=NULL; ocs = ocs->nextnm)
- if (ocs!=cs && ocs->hclass==EXTERN &&
- strncmp(cs->name, ocs->name, MAXCPS-1) == 0)
- error0("names %s and %s conflict", cs->name, ocs->name);
+ for (; ocs!=NULL; ocs = ocs->nl_nextnm)
+ if (ocs!=cs && ocs->nl_class==EXTERN &&
+ strncmp(cs->nl_name, ocs->nl_name, MAXCPS-1) == 0)
+ error0("names %s and %s conflict", cs->nl_name, ocs->nl_name);
}
/*
void prste(cs) struct nmlist *cs; {
register int nkind;
- switch (cs->hclass) {
+ switch (cs->nl_class) {
case REG:
nkind = RNAME;
break;
return;
}
- outcode("BSN", nkind, cs->name, cs->hoffset);
+ outcode("BSN", nkind, cs->nl_name, cs->nl_offset);
}
/*
isadecl = 0;
longf = 0;
unsignf = 0;
- tptr->htype = INT;
- tptr->hstrp = NULL;
- tptr->hsubsp = NULL;
+ tptr->nl_type = INT;
+ tptr->nl_strp = NULL;
+ tptr->nl_subsp = NULL;
tkw = -1;
skw = *scptr;
ismos = skw==MOS||skw==MOU? FMOS: 0;
for (;;) {
mosflg = isadecl? ismos: 0;
o = symbol();
- if (o==NAME && csym->hclass==TYPEDEF) {
+ if (o==NAME && csym->nl_class==TYPEDEF) {
if (tkw >= 0)
error0("type clash");
- tkw = csym->htype;
- tptr->hsubsp = csym->hsubsp;
- tptr->hstrp = csym->hstrp;
+ tkw = csym->nl_type;
+ tptr->nl_subsp = csym->nl_subsp;
+ tptr->nl_strp = csym->nl_strp;
isadecl++;
continue;
}
case UNION:
case STRUCT:
- tptr->hstrp = strdec(ismos, cval);
+ tptr->nl_strp = strdec(ismos, cval);
cval = STRUCT;
case INT:
case CHAR:
error0("Misplaced 'long'");
}
*scptr = skw;
- tptr->htype = tkw;
+ tptr->nl_type = tkw;
return(1);
}
isadecl++;
ssym = csym;
mosflg = mosf;
o = symbol();
- if (o==LBRACE && ssym->hblklev<blklev)
+ if (o==LBRACE && ssym->nl_blklev<blklev)
ssym = pushdecl(ssym);
- if (ssym->hclass && ssym->hclass!=tagkind) {
+ if (ssym->nl_class && ssym->nl_class!=tagkind) {
defsym = ssym;
redec();
ssym = pushdecl(ssym);
}
- if (ssym->hclass==0) {
- ssym->hclass = tagkind;
- ssym->hstrp = (union str *)Dblock(sizeof(struct SS));
- ssym->hstrp->S.ssize = 0;
- ssym->hstrp->S.memlist = NULL;
+ if (ssym->nl_class==0) {
+ ssym->nl_class = tagkind;
+ ssym->nl_strp = (union str *)Dblock(sizeof(struct SS));
+ ssym->nl_strp->S.ssize = 0;
+ ssym->nl_strp->S.memlist = NULL;
}
- strp = ssym->hstrp;
+ strp = ssym->nl_strp;
} else {
strp = (union str *)Dblock(sizeof(struct SS));
strp->S.ssize = 0;
if (o != LBRACE) {
if (ssym==0)
goto syntax;
- if (ssym->hclass!=tagkind)
+ if (ssym->nl_class!=tagkind)
error0("Bad structure/union/enum name");
peeksym = o;
} else {
nmems = 2;
bitoffs = 0;
if (kind==ENUM) {
- typer.htype = INT;
- typer.hstrp = strp;
+ typer.nl_type = INT;
+ typer.nl_strp = strp;
declare(ENUM, &typer, 0);
} else
elsize = declist(kind==UNION?MOU:MOS);
#else
defsym = ds;
if (strp->S.ssize)
- error0("%s redeclared", ssym->name);
+ error0("%s redeclared", ssym->nl_name);
#endif
strp->S.ssize = elsize;
*memlist++ = NULL;
break;
}
if (skw == MOS) {
- abs.hclass = 0;
- abs.hflag = 0;
- abs.htype = 0;
- abs.hsubsp = 0;
- abs.hstrp = 0;
- abs.nextnm = 0;
- abs.sparent = 0;
- abs.hblklev = blklev;
- abs.name = "<none>";
+ abs.nl_class = 0;
+ abs.nl_flag = 0;
+ abs.nl_type = 0;
+ abs.nl_subsp = 0;
+ abs.nl_strp = 0;
+ abs.nl_nextnm = 0;
+ abs.nl_sparent = 0;
+ abs.nl_blklev = blklev;
+ abs.nl_name = "<none>";
aptr = &abs;
} else
aptr = NULL;
error0("Negative field width");
t1 = 0;
}
- elsize = align(tptr->htype, offset, t1);
+ elsize = align(tptr->nl_type, offset, t1);
bitoffs += t1;
return(elsize);
}
return(0);
if (defsym)
absname = NULL;
- if (tptr->hsubsp) {
- type = tptr->htype;
+ if (tptr->nl_subsp) {
+ type = tptr->nl_type;
for (a=0; type&XTYPE;) {
if ((type&XTYPE)==ARRAY)
- dim.dimens[dim.rank++] = tptr->hsubsp[a++];
+ dim.dimens[dim.rank++] = tptr->nl_subsp[a++];
type >>= TYLEN;
}
}
- type = tptr->htype & ~TYPE;
+ type = tptr->nl_type & ~TYPE;
while (t1&XTYPE) {
if (type&BIGTYPE) {
typov();
type = type<<TYLEN | (t1 & XTYPE);
t1 >>= TYLEN;
}
- type |= tptr->htype&TYPE;
+ type |= tptr->nl_type&TYPE;
if ((type&XTYPE) == FUNC) {
if (skw==AUTO)
skw = EXTERN;
return(0);
}
if (defsym)
- if (dsym->hblklev<blklev || dsym->hclass==MOS && skw==MOS) {
- if (skw==MOS && dsym->sparent==sparent)
+ if (dsym->nl_blklev<blklev || dsym->nl_class==MOS && skw==MOS) {
+ if (skw==MOS && dsym->nl_sparent==sparent)
redec();
defsym = dsym;
if (skw==EXTERN) {
- for (; dsym!=NULL; dsym = dsym->nextnm) {
- if (dsym->hclass==EXTERN
- && strcmp(dsym->name, defsym->name)==0) {
+ for (; dsym!=NULL; dsym = dsym->nl_nextnm) {
+ if (dsym->nl_class==EXTERN
+ && strcmp(dsym->nl_name, defsym->nl_name)==0) {
defsym = dsym;
break;
}
defsym = dsym = pushdecl(dsym);
}
if (dim.rank == 0)
- dsym->hsubsp = NULL;
+ dsym->nl_subsp = NULL;
else {
/*
* If an array is declared twice, make sure the declarations
* agree in dimension. This happens typically when a .h
* and .c file both declare a variable.
*/
- if (dsym->hsubsp) {
- for (a=0, t1 = dsym->htype;
+ if (dsym->nl_subsp) {
+ for (a=0, t1 = dsym->nl_type;
a<dim.rank && (t1&XTYPE)==ARRAY;
a++, t1 >>= TYLEN)
/*
* If we haven't seen a declaration for this
* dimension yet, take what's been given now.
*/
- if (!dsym->hsubsp[a])
- dsym->hsubsp[a] = dim.dimens[a];
+ if (!dsym->nl_subsp[a])
+ dsym->nl_subsp[a] = dim.dimens[a];
else if (dim.dimens[a]
- && dim.dimens[a] != dsym->hsubsp[a])
+ && dim.dimens[a] != dsym->nl_subsp[a])
redec();
if (a<dim.rank || (t1&XTYPE)==ARRAY)
redec();
dp = (int *)Dblock(dim.rank*sizeof(dim.rank));
for (a=0; a<dim.rank; a++)
dp[a] = dim.dimens[a];
- dsym->hsubsp = dp;
+ dsym->nl_subsp = dp;
}
}
- if (!(dsym->hclass==0
- || ((skw==ARG||skw==AREG) && dsym->hclass==ARG1)
- || (skw==EXTERN && dsym->hclass==EXTERN && dsym->htype==type))) {
+ if (!(dsym->nl_class==0
+ || ((skw==ARG||skw==AREG) && dsym->nl_class==ARG1)
+ || (skw==EXTERN && dsym->nl_class==EXTERN && dsym->nl_type==type))) {
redec();
goto syntax;
}
- if (dsym->hclass && (dsym->htype&TYPE)==STRUCT && (type&TYPE)==STRUCT)
- if (dsym->hstrp != tptr->hstrp) {
+ if (dsym->nl_class && (dsym->nl_type&TYPE)==STRUCT && (type&TYPE)==STRUCT)
+ if (dsym->nl_strp != tptr->nl_strp) {
error0("structure redeclaration");
}
- dsym->htype = type;
- if (tptr->hstrp)
- dsym->hstrp = tptr->hstrp;
+ dsym->nl_type = type;
+ if (tptr->nl_strp)
+ dsym->nl_strp = tptr->nl_strp;
if (skw==TYPEDEF) {
- dsym->hclass = TYPEDEF;
+ dsym->nl_class = TYPEDEF;
return(0);
}
if (skw==ARG1) {
if (paraml==NULL)
paraml = dsym;
else
- parame->sparent = (union str *)dsym;
+ parame->nl_sparent = (union str *)dsym;
parame = dsym;
- dsym->hclass = skw;
+ dsym->nl_class = skw;
return(0);
}
elsize = 0;
peeksym = -1;
t1 = conexp();
a = align(type, offset, t1);
- if (dsym->hflag&FFIELD) {
- if (dsym->hstrp->F.bitoffs!=bitoffs
- || dsym->hstrp->F.flen!=t1)
+ if (dsym->nl_flag&FFIELD) {
+ if (dsym->nl_strp->F.bitoffs!=bitoffs
+ || dsym->nl_strp->F.flen!=t1)
redec();
} else {
- dsym->hstrp = (union str *)Dblock(sizeof(struct FS));
+ dsym->nl_strp = (union str *)Dblock(sizeof(struct FS));
}
- dsym->hflag |= FFIELD;
- dsym->hstrp->F.bitoffs = bitoffs;
- dsym->hstrp->F.flen = t1;
+ dsym->nl_flag |= FFIELD;
+ dsym->nl_strp->F.bitoffs = bitoffs;
+ dsym->nl_strp->F.flen = t1;
bitoffs += t1;
} else
a = align(type, offset, 0);
}
if (a)
*memlist++ = &structhole;
- dsym->hoffset = offset;
+ dsym->nl_offset = offset;
*memlist++ = dsym;
- dsym->sparent = sparent;
+ dsym->nl_sparent = sparent;
}
if (skw==REG)
- if ((dsym->hoffset = goodreg(dsym)) < 0)
+ if ((dsym->nl_offset = goodreg(dsym)) < 0)
skw = AUTO;
- dsym->hclass = skw;
+ dsym->nl_class = skw;
isinit = 0;
if ((a=symbol()) == ASSIGN)
isinit++;
peeksym = a;
if (skw==AUTO) {
/* if (STAUTO < 0) { */
- /*fprintf(stderr, "%s autolen %d -> ", dsym->name, autolen);*/
+ /*fprintf(stderr, "%s autolen %d -> ", dsym->nl_name, autolen);*/
autolen -= rlength((struct node *)dsym);
- dsym->hoffset = autolen;
+ dsym->nl_offset = autolen;
if (autolen < maxauto)
maxauto = autolen;
/*fprintf(stderr, "%d maxauto %d\n", autolen, maxauto);*/
/* } else { */
- /* dsym->hoffset = autolen; */
+ /* dsym->nl_offset = autolen; */
/* autolen += rlength(dsym); */
/* if (autolen > maxauto) */
/* maxauto = autolen; */
cinit(dsym, 0, AUTO);
isinit = 0;
} else if (skw==STATIC) {
- dsym->hoffset = isn0;
+ dsym->nl_offset = isn0;
if (isinit) {
outcode("BBN", DATA, LABEL, isn0++);
if (cinit(dsym, 1, STATIC) & ALIGN)
isinit = 0;
} else if (skw==ENUM) {
if (type!=INT)
- error0("Illegal enumeration %s", dsym->name);
- dsym->hclass = ENUMCON;
- dsym->hoffset = offset;
+ error0("Illegal enumeration %s", dsym->nl_name);
+ dsym->nl_class = ENUMCON;
+ dsym->nl_offset = offset;
if (isinit)
cinit(dsym, 0, ENUMCON);
- elsize = dsym->hoffset-offset+1;
+ elsize = dsym->nl_offset-offset+1;
isinit = 0;
}
if (absname==0)
nsp = (struct nmlist *)Dblock(sizeof(struct nmlist));
*nsp = *sp;
- nsp->hclass = 0;
- nsp->hflag &= FKIND;
- nsp->htype = 0;
- nsp->hoffset = 0;
- nsp->hblklev = blklev;
- nsp->hstrp = NULL;
- nsp->hsubsp = NULL;
- nsp->sparent = NULL;
- hsp = &hshtab[hash(sp->name)];
- nsp->nextnm = *hsp;
+ nsp->nl_class = 0;
+ nsp->nl_flag &= FKIND;
+ nsp->nl_type = 0;
+ nsp->nl_offset = 0;
+ nsp->nl_blklev = blklev;
+ nsp->nl_strp = NULL;
+ nsp->nl_subsp = NULL;
+ nsp->nl_sparent = NULL;
+ hsp = &hshtab[hash(sp->nl_name)];
+ nsp->nl_nextnm = *hsp;
*hsp = nsp;
return(nsp);
}
* Complain about a redeclaration
*/
void redec() {
- error0("%s redeclared", defsym->name);
+ error0("%s redeclared", defsym->nl_name);
}
/*
int goodreg(hp) struct nmlist *hp; {
int type;
- type = hp->htype;
+ type = hp->nl_type;
if ((type!=INT && type!=UNSIGN && (type&XTYPE)==0)
|| (type&XTYPE)>PTR || regvar<3)
return(-1);
case NAME:
hp = (struct nmlist *)tp->tn_tr1;
- if (hp->hclass==TYPEDEF)
+ if (hp->nl_class==TYPEDEF)
error0("Illegal use of type name");
#if 1
- if (hp->hclass==EXTERN)
- outcode("BNNS", NAME, EXTERN, tp->tn_type, hp->name);
+ if (hp->nl_class==EXTERN)
+ outcode("BNNS", NAME, EXTERN, tp->tn_type, hp->nl_name);
else
- outcode("BNNN", NAME, hp->hclass==0?STATIC:hp->hclass, tp->tn_type, hp->hoffset);
+ outcode("BNNN", NAME, hp->nl_class==0?STATIC:hp->nl_class, tp->tn_type, hp->nl_offset);
#else
- outcode("BNN", NAME, hp->hclass==0?STATIC:hp->hclass, tp->tn_type);
- if (hp->hclass==EXTERN)
- outcode("S", hp->name);
+ outcode("BNN", NAME, hp->nl_class==0?STATIC:hp->nl_class, tp->tn_type);
+ if (hp->nl_class==EXTERN)
+ outcode("S", hp->nl_name);
else
- outcode("N", hp->hoffset);
+ outcode("N", hp->nl_offset);
#endif
break;
if ((peeksym=symbol())==NAME && nextchar()==';') {
csp = csym;
- if (csp->hblklev == 0)
+ if (csp->nl_blklev == 0)
csp = pushdecl(csp);
- if (csp->hclass==0 && csp->htype==0) {
- csp->htype = ARRAY;
- csp->hflag |= FLABL;
- if (csp->hoffset==0)
- csp->hoffset = isn0++;
+ if (csp->nl_class==0 && csp->nl_type==0) {
+ csp->nl_type = ARRAY;
+ csp->nl_flag |= FLABL;
+ if (csp->nl_offset==0)
+ csp->nl_offset = isn0++;
}
- if ((csp->hclass==0||csp->hclass==STATIC)
- && csp->htype==ARRAY) {
+ if ((csp->nl_class==0||csp->nl_class==STATIC)
+ && csp->nl_type==ARRAY) {
peeksym = -1;
- return(csp->hoffset);
+ return(csp->nl_offset);
}
}
return(0);
*/
struct nmlist {
/* note: this must be compatible with struct node in respect of the */
- /* htype and hsubsp fields, because of length(), rlength() computations */
- char hclass; /* storage class */
- char hflag; /* various flags */
- int htype; /* type */
- int *hsubsp; /* subscript list */
- union str *hstrp; /* structure description */
- int hoffset; /* post-allocation location */
- struct nmlist *nextnm; /* next name in chain */
- union str *sparent; /* Structure of which this is member */
- char hblklev; /* Block level of definition */
- char *name; /* ASCII name */
+ /* nl_type, nl_subsp fields, because of length(), rlength() computations */
+ char nl_class; /* storage class */
+ char nl_flag; /* various flags */
+ int nl_type; /* type */
+ int *nl_subsp; /* subscript list */
+ union str *nl_strp; /* structure description */
+ int nl_offset; /* post-allocation location */
+ struct nmlist *nl_nextnm; /* next name in chain */
+ union str *nl_sparent; /* Structure of which this is member */
+ char nl_blklev; /* Block level of definition */
+ char *nl_name; /* ASCII name */
};
/*
s/@F@\.@degree@/@fa_degree@/g
s/@F@\.@mask@/@fa_mask@/g
+# nmlist
+s/\.@hclass@/.@nl_class@/g
+s/\.@hflag@/.@nl_flag@/g
+s/\.@htype@/.@nl_type@/g
+s/\.@hsubsp@/.@nl_subsp@/g
+s/\.@hstrp@/.@nl_strp@/g
+s/\.@hoffset@/.@nl_offset@/g
+s/\.@nextnm@/.@nl_nextnm@/g
+s/\.@sparent@/.@nl_sparent@/g
+s/\.@hblklev@/.@nl_blklev@/g
+s/\.@name@/.@nl_name@/g
+s/->@hclass@/->@nl_class@/g
+s/->@hflag@/->@nl_flag@/g
+s/->@htype@/->@nl_type@/g
+s/->@hsubsp@/->@nl_subsp@/g
+s/->@hstrp@/->@nl_strp@/g
+s/->@hoffset@/->@nl_offset@/g
+s/->@nextnm@/->@nl_nextnm@/g
+s/->@sparent@/->@nl_sparent@/g
+s/->@hblklev@/->@nl_blklev@/g
+s/->@name@/->@nl_name@/g
+
s/@//g
s/ATSIGN/@/g