Obj *copythru(char *s) /* collect the macro name or body for thru */ { Obj *p; char *q; p = lookup(s, 0); if (p != NULL) { if (p->type == DEFNAME) { p->val = addnewline(p->val); return p; } else ERROR "%s used as define and name", s FATAL; } /* have to collect the definition */ pbstr(s); /* first char is the delimiter */ q = delimstr("thru body"); p = lookup("nameless", 1); if (p != NULL) if (p->val) free(p->val); p->type = DEFNAME; p->val = q; p->val = addnewline(p->val); dprintf("installing nameless as `%s'\n", p->val); return p; }
struct symtab *copythru(char *s) /* collect the macro name or body for thru */ { struct symtab *p; char *q, *addnewline(char *); p = lookup(s); if (p != NULL) { if (p->s_type == DEFNAME) { p->s_val.p = addnewline(p->s_val.p); return p; } else ERROR "%s used as define and name", s FATAL; } /* have to collect the definition */ pbstr(s); /* first char is the delimiter */ q = delimstr("thru body"); s = "nameless"; p = lookup(s); if (p != NULL) { if (p->s_val.p) free(p->s_val.p); p->s_val.p = q; } else { YYSTYPE u; u.p = q; p = makevar(tostring(s), DEFNAME, u); } p->s_val.p = addnewline(p->s_val.p); dprintf("installing %s as `%s'\n", s, p->s_val.p); return p; }
void definition(char *s) /* collect definition for s and install */ /* char *s; definitions picked up lexically */ { char *p; struct symtab *stp; p = delimstr("definition"); stp = lookup(s); if (stp == NULL) /* it's not there already */ stp = newvar(tostring(s), DEFNAME); else { if (stp->s_type != DEFNAME) { yyerror("%s used as variable and definition", s); return; } free(stp->s_val.p); } stp->s_val.p = p; }
void definition(char *s) /* collect definition for s and install */ /* definitions picked up lexically */ { char *p; Obj *stp; p = delimstr("definition"); stp = lookup(s, 0); if (stp != NULL) { /* it's there before */ if (stp->type != DEFNAME) { ERROR "%s used as variable and definition", s WARNING; return; } free(stp->val); } else { stp = lookup(s, 1); stp->type = DEFNAME; } stp->val = p; dprintf("installing %s as `%s'\n", s, p); }
void definition(char *s) /* collect definition for s and install */ /* definitions picked up lexically */ { char *p; struct symtab *stp; p = delimstr("definition"); stp = lookup(s); if (stp != NULL) { /* it's there before */ if (stp->s_type != DEFNAME) { ERROR "%s used as variable and definition", s WARNING; return; } free(stp->s_val.p); stp->s_val.p = p; } else { YYSTYPE u; u.p = p; makevar(tostring(s), DEFNAME, u); } dprintf("installing %s as `%s'\n", s, p); }