Lines Matching refs:tp
46 Token *tp; in dodefine() local
52 tp = trp->tp + 1; in dodefine()
53 if (tp >= trp->lp || tp->type != NAME) in dodefine()
58 np = lookup(tp, 1); in dodefine()
61 error(ERROR, "#defined token %t can't be redefined", tp); in dodefine()
65 tp += 1; in dodefine()
67 if (tp < trp->lp && tp->type == LP && tp->wslen == 0) in dodefine()
72 tp += 1; in dodefine()
75 if (tp->type != RP) in dodefine()
83 if (tp->type != NAME) in dodefine()
91 if (atp->len == tp->len in dodefine()
92 && strncmp((char *) atp->t, (char *) tp->t, tp->len) == 0) in dodefine()
94 *args->lp++ = *tp; in dodefine()
96 tp += 1; in dodefine()
97 if (tp->type == RP) in dodefine()
99 if (tp->type != COMMA) in dodefine()
104 tp += 1; in dodefine()
112 tp += 1; in dodefine()
114 trp->tp = tp; in dodefine()
179 trp->tp = trp->bp; in doadefine()
182 if (trp->lp - trp->tp != 2 || trp->tp->type != NAME) in doadefine()
184 if ((np = lookup(trp->tp, 0)) == NULL) in doadefine()
192 if (trp->tp >= trp->lp || trp->tp->type != NAME) in doadefine()
194 trp->tp->type = ARCHITECTURE; in doadefine()
195 np = lookup(trp->tp, 1); in doadefine()
197 trp->tp += 1; in doadefine()
198 if (trp->tp >= trp->lp || trp->tp->type == END) in doadefine()
207 if (trp->tp >= trp->lp || trp->tp->type != NAME) in doadefine()
209 np = lookup(trp->tp, 1); in doadefine()
211 trp->tp += 1; in doadefine()
212 if (trp->tp >= trp->lp || trp->tp->type == END) in doadefine()
217 if (trp->tp->type != ASGN) in doadefine()
219 trp->tp += 1; in doadefine()
237 Token * tp; in expandrow() local
247 for (tp = trp->tp; tp < trp->lp;) in expandrow()
249 mvl_check(&validators, tp); in expandrow()
251 if (tp->type != NAME in expandrow()
252 || quicklook(tp->t[0], tp->len > 1 ? tp->t[1] : 0) == 0 in expandrow()
253 || (np = lookup(tp, 0)) == NULL in expandrow()
257 tp++; in expandrow()
260 trp->tp = tp; in expandrow()
263 tp->type = DEFINED; in expandrow()
264 if ((tp + 1) < trp->lp && (tp + 1)->type == NAME) in expandrow()
265 (tp + 1)->type = NAME1; in expandrow()
267 if ((tp + 3) < trp->lp && (tp + 1)->type == LP in expandrow()
268 && (tp + 2)->type == NAME && (tp + 3)->type == RP) in expandrow()
269 (tp + 2)->type = NAME1; in expandrow()
272 tp++; in expandrow()
278 if (((tp - 1) >= trp->bp) && ((tp - 1)->type == SHARP)) in expandrow()
280 tp->type = ARCHITECTURE; in expandrow()
281 if ((tp + 1) < trp->lp && (tp + 1)->type == NAME) in expandrow()
282 (tp + 1)->type = NAME2; in expandrow()
284 if ((tp + 3) < trp->lp && (tp + 1)->type == LP in expandrow()
285 && (tp + 2)->type == NAME && (tp + 3)->type == RP) in expandrow()
286 (tp + 2)->type = NAME2; in expandrow()
290 tp++; in expandrow()
298 tp = trp->tp; in expandrow()
325 error(INFO, "Macro expansion of %t with %s(%r)", trp->tp, np->name, np->ap); in expand()
327 error(INFO, "Macro expansion of %t with %s", trp->tp, np->name); in expand()
338 trp->tp++; in expand()
344 trp->tp += ntokc; in expand()
355 mvl_check(pValidators,trp->tp+i); in expand()
373 ntr.tp = ntr.bp; in expand()
374 makespace(&ntr, trp->tp); in expand()
396 if (trp->tp != trp->lp) in expand()
398 mvl_add(pValidators,np,trp->tp); in expand()
406 …trp->tp -= ntr.lp - ntr.bp; /* so the result will be tested for macros from the same position ag… in expand()
433 trp->tp++; in gatherargs()
435 if (trp->tp >= trp->lp) in gatherargs()
441 trp->tp -= ntok; in gatherargs()
445 if (trp->tp->type == LP) in gatherargs()
447 if (trp->tp->type != NL) in gatherargs()
453 trp->tp++; in gatherargs()
458 if (trp->tp >= trp->lp) in gatherargs()
465 if (trp->tp->type == END) in gatherargs()
468 trp->tp -= ntok; in gatherargs()
472 if (trp->tp->type == NL) in gatherargs()
474 trp->tp += 1; in gatherargs()
476 trp->tp -= 1; in gatherargs()
481 if (trp->tp->type == LP) in gatherargs()
484 if (trp->tp->type == RP) in gatherargs()
486 trp->tp++; in gatherargs()
489 trp->tp -= ntok; in gatherargs()
491 lp = bp = trp->tp + ntokp; in gatherargs()
508 ttr.bp = ttr.tp = bp; in gatherargs()
525 Token *tp; in substargs() local
528 for (rtr->tp = rtr->bp; rtr->tp < rtr->lp;) in substargs()
530 if (rtr->tp->type == SHARP) in substargs()
532 tp = rtr->tp; in substargs()
533 rtr->tp += 1; in substargs()
534 if ((argno = lookuparg(np, rtr->tp)) < 0) in substargs()
539 ntok = 1 + (rtr->tp - tp); in substargs()
540 rtr->tp = tp; in substargs()
544 if (rtr->tp->type == NAME in substargs()
545 && (argno = lookuparg(np, rtr->tp)) >= 0) in substargs()
547 if (((rtr->tp + 1) < rtr->lp && (rtr->tp + 1)->type == DSHARP) in substargs()
548 || (rtr->tp != rtr->bp && (rtr->tp - 1)->type == DSHARP)) in substargs()
551 makespace(&tatr, rtr->tp); in substargs()
558 makespace(&tatr, rtr->tp); in substargs()
565 rtr->tp++; in substargs()
579 for (trp->tp = trp->bp; trp->tp < trp->lp; trp->tp++) in doconcat()
581 if (trp->tp->type == DSHARP1) in doconcat()
582 trp->tp->type = DSHARP; in doconcat()
584 if (trp->tp->type == DSHARP) in doconcat()
589 ltp = trp->tp - 1; in doconcat()
590 ntp = trp->tp + 1; in doconcat()
610 if (ntp != trp->tp + 1) in doconcat()
622 ntp = trp->tp + i; in doconcat()
638 trp->tp = ltp; in doconcat()
642 trp->tp--; in doconcat()
653 lookuparg(Nlist * mac, Token * tp) in lookuparg() argument
657 if (tp->type != NAME || mac->ap == NULL) in lookuparg()
661 if (ap->len == tp->len && strncmp((char *) ap->t, (char *) tp->t, ap->len) == 0) in lookuparg()
676 Token *tp; in stringify() local
682 for (tp = vp->bp; tp < vp->lp; tp++) in stringify()
684 instring = tp->type == STRING || tp->type == CCON; in stringify()
685 if (sp + 2 * tp->len + tp->wslen >= &s[STRLEN - 10]) in stringify()
692 if ( tp->wslen > 0 ) in stringify()
696 for (i = 0, cp = tp->t; (unsigned int)i < tp->len; i++) in stringify()
718 Token *tp; in builtin() local
721 tp = trp->tp; in builtin()
722 trp->tp++; in builtin()
730 tp->type = STRING; in builtin()
731 if (tp->wslen) in builtin()
734 tp->wslen = 1; in builtin()
742 tp->type = NUMBER; in builtin()
772 if (tp->type == STRING) in builtin()
774 tp->t = (uchar *) outptr; in builtin()
775 tp->len = op - outptr; in builtin()