Lines Matching refs:sym
60 register struct ppsymbol* sym;
95 if (sym = ppsymref(pp.symtab, pred))
96 sym->flags &= ~SYM_PREDICATE;
108 if (sym = ppsymset(pp.symtab, pred))
109 sym->flags |= SYM_PREDICATE;
162 register struct ppsymbol* sym;
169 sym = pprefmac(pp.token, REF_CREATE);
170 if ((sym->flags & SYM_FINAL) && (pp.mode & HOSTED)) return 0;
171 if (sym->flags & (SYM_ACTIVE|SYM_READONLY))
174 error(2, "%s: macro is %s", sym->name, (sym->flags & SYM_READONLY) ? "readonly" : "active");
177 if (!sym->macro) sym->macro = newof(0, struct ppmacro, 1, 0);
178 return sym;
261 register struct ppsymbol* sym;
422 sym = pprefmac(pp.token, REF_IF);
431 pp.in->symbol = sym ? sym : pprefmac(pp.token, REF_CREATE);
437 sym = 0;
441 *pp.control |= ((sym != 0) == (directive == IFDEF)) ? KEPT : SKIP;
651 if (!(sym = macsym(c)))
655 mac = sym->macro;
661 i0 = sym->flags;
662 sym->flags &= ~(SYM_BUILTIN|SYM_EMPTY|SYM_FINAL|SYM_FUNCTION|SYM_INIT|SYM_INITIAL|SYM_MULTILINE|SYM_NOEXPAND|SYM_PREDEFINED|SYM_REDEFINE|SYM_VARIADIC);
665 sym->flags |= SYM_MULTILINE;
675 sym->flags |= SYM_FUNCTION;
694 else error(2, "%s: formal argument %s ignored", sym->name, pp.token);
768 error(1, "%s: macro formal argument expected", sym->name);
776 if (sym->flags & SYM_VARIADIC)
777 error(2, "%s: %s: duplicate macro formal argument", sym->name, pp.token);
778 sym->flags |= SYM_VARIADIC;
784 if (sym->flags & SYM_VARIADIC)
785 error(2, "%s: %s: macro formal argument cannot follow ...", sym->name, v);
787 error(2, "%s: %s: invalid macro formal argument", sym->name, v);
795 error(2, "%s: %s: duplicate macro formal argument", sym->name, v);
800 error(2, "%s: %s: macro formal argument ignored", sym->name, v);
808 error(1, "%s: macro formal argument expected", sym->name);
817 if (sym->flags & SYM_VARIADIC)
818 error(2, "%s: %s: duplicate macro formal argument", sym->name, pp.token);
819 sym->flags |= SYM_VARIADIC;
848 error(2, "%s: invalid macro formal argument list", sym->name);
856 sym->macro = 0;
926 error(1, "%s: %s: formal should be parenthesized in macro value (t=%x o=%#c c=%#c)", sym->name, pp.token, var.type, o, c);
937 sym->flags |= SYM_EMPTY;
952 if (!(sym->flags & (SYM_FUNCTION|SYM_MULTILINE))) break;
954 if (!(sym->flags & SYM_FUNCTION)) break;
972 if (sym->flags & SYM_MULTILINE)
1046 if ((sym->flags & SYM_FUNCTION) && (pp.state & (COMPATIBILITY|TRANSITION)))
1089 if (sym->flags & SYM_MULTILINE)
1102 error(2, "%s: missing #%s", sym->name, dirname(ENDMAC));
1193 if ((i0 & SYM_FUNCTION) != (sym->flags & SYM_FUNCTION) || old.arity != mac->arity || !streq(old.value, mac->value)) goto redefined;
1228 error(1, "%s redefined", sym->name);
1239 else if (!pp.truncate) ppfsm(FSM_MACRO, sym->name);
1241 if ((pp.option & (DEFINITIONS|PREDEFINITIONS|REGUARD)) && !sym->hidden && !(sym->flags & SYM_MULTILINE) && ((pp.option & PREDEFINITIONS) || !(pp.mode & INIT)) && ((pp.option & (DEFINITIONS|PREDEFINITIONS)) || !(pp.state & NOTEXT)))
1244 ppprintf("#%s %s", dirname(DEFINE), sym->name);
1245 if (sym->flags & SYM_FUNCTION)
1288 if (pp.mode & BUILTIN) sym->flags |= SYM_BUILTIN;
1289 if (pp.option & FINAL) sym->flags |= SYM_FINAL;
1290 if (pp.mode & INIT) sym->flags |= SYM_INIT;
1291 if (pp.option & INITIAL) sym->flags |= SYM_INITIAL;
1292 if (pp.state & NOEXPAND) sym->flags |= SYM_NOEXPAND;
1293 if (pp.option & PREDEFINED) sym->flags |= SYM_PREDEFINED;
1294 if (pp.mode & READONLY) sym->flags |= SYM_READONLY;
1295 if (pp.macref) (*pp.macref)(sym, error_info.file, n2, mac ? error_info.line - n2 + 1 : REF_UNDEF, mac ? strsum(mac->value, (long)mac->arity) : 0L);
1337 ppfsm(FSM_MACRO, sym->name);
1364 error(2, "%s: > omitted in tuple macro definition", sym->name);
1411 if (!(sym = macsym(c = pplex()))) goto eatdirective;
1414 error(2, "%s: = expected", sym->name);
1417 sym->flags &= ~(SYM_BUILTIN|SYM_FUNCTION|SYM_MULTILINE|SYM_PREDEFINED|SYM_VARIADIC);
1418 mac = sym->macro;
1422 if (!(sym->flags & SYM_REDEFINE) && !sym->hidden)
1423 error(1, "%s: redefined", sym->name);
1434 ppfsm(FSM_MACRO, sym->name);
1446 sym->flags |= SYM_REDEFINE;
1746 else if (sym = ppsymset(pp.symtab, pp.token))
1750 sym->flags &= ~SYM_NOTICED;
1751 ppfsm(FSM_MACRO, sym->name);
1755 if (!sym->hidden && !(sym->hidden = newof(0, struct pphide, 1, 0)))
1757 if (!sym->macro)
1758 ppfsm(FSM_MACRO, sym->name);
1759 if (!sym->hidden->level++)
1762 if (sym->macro && !(sym->flags & (SYM_ACTIVE|SYM_READONLY)))
1764 sym->hidden->macro = sym->macro;
1765 sym->macro = 0;
1766 sym->hidden->flags = sym->flags;
1767 sym->flags &= ~(SYM_BUILTIN|SYM_FUNCTION|SYM_INIT|SYM_MULTILINE|SYM_PREDEFINED|SYM_REDEFINE|SYM_VARIADIC);
1771 else if (sym->hidden)
1773 if ((mac = sym->macro) && !(sym->flags & (SYM_ACTIVE|SYM_READONLY)))
1778 sym->macro = 0;
1779 sym->flags &= ~(SYM_BUILTIN|SYM_FUNCTION|SYM_INIT|SYM_MULTILINE|SYM_PREDEFINED|SYM_REDEFINE|SYM_VARIADIC);
1781 if (!--sym->hidden->level)
1784 if (sym->hidden->macro)
1786 sym->macro = sym->hidden->macro;
1787 sym->flags = sym->hidden->flags;
1789 free(sym->hidden);
1790 sym->hidden = 0;
2131 if (!(sym = pprefmac(pp.token, REF_DELETE)) || !sym->macro)
2133 if (sym->flags & (SYM_ACTIVE|SYM_READONLY))
2136 error(2, "%s: macro is %s", sym->name, (sym->flags & SYM_READONLY) ? "readonly" : "active");
2160 var.symbol->flags = sym->flags;
2161 sym->flags &= ~(SYM_BUILTIN|SYM_FUNCTION|SYM_INIT|SYM_MULTILINE|SYM_PREDEFINED|SYM_REDEFINE|SYM_VARIADIC);
2162 var.symbol->macro = sym->macro;
2163 sym->macro = 0;
2171 if (sym = pprefmac(pp.token, REF_DELETE))
2173 if (mac = sym->macro)
2175 if (sym->flags & (SYM_ACTIVE|SYM_READONLY))
2178 error(2, "%s: macro is %s", sym->name, (sym->flags & SYM_READONLY) ? "readonly" : "active");
2184 mac = sym->macro = 0;
2186 if ((pp.option & (DEFINITIONS|PREDEFINITIONS|REGUARD)) && !sym->hidden && !(sym->flags & SYM_MULTILINE) && ((pp.option & PREDEFINITIONS) || !(pp.mode & INIT)) && ((pp.option & (DEFINITIONS|PREDEFINITIONS)) || !(pp.state & NOTEXT)))
2189 ppprintf("#%s %s", dirname(UNDEF), sym->name);
2192 sym->flags &= ~(SYM_BUILTIN|SYM_FUNCTION|SYM_INIT|SYM_MULTILINE|SYM_PREDEFINED|SYM_REDEFINE|SYM_VARIADIC);