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()
178 trp->tp = trp->bp; in doadefine()
181 if (trp->lp - trp->tp != 2 || trp->tp->type != NAME) in doadefine()
183 if ((np = lookup(trp->tp, 0)) == NULL) in doadefine()
191 if (trp->tp >= trp->lp || trp->tp->type != NAME) in doadefine()
193 trp->tp->type = ARCHITECTURE; in doadefine()
194 np = lookup(trp->tp, 1); in doadefine()
196 trp->tp += 1; in doadefine()
197 if (trp->tp >= trp->lp || trp->tp->type == END) in doadefine()
206 if (trp->tp >= trp->lp || trp->tp->type != NAME) in doadefine()
208 np = lookup(trp->tp, 1); in doadefine()
210 trp->tp += 1; in doadefine()
211 if (trp->tp >= trp->lp || trp->tp->type == END) in doadefine()
216 if (trp->tp->type != ASGN) in doadefine()
218 trp->tp += 1; in doadefine()
236 Token * tp; in expandrow() local
246 for (tp = trp->tp; tp < trp->lp;) in expandrow()
248 mvl_check(&validators, tp); in expandrow()
250 if (tp->type != NAME in expandrow()
251 || quicklook(tp->t[0], tp->len > 1 ? tp->t[1] : 0) == 0 in expandrow()
252 || (np = lookup(tp, 0)) == NULL in expandrow()
256 tp++; in expandrow()
259 trp->tp = tp; in expandrow()
262 tp->type = DEFINED; in expandrow()
263 if ((tp + 1) < trp->lp && (tp + 1)->type == NAME) in expandrow()
264 (tp + 1)->type = NAME1; in expandrow()
266 if ((tp + 3) < trp->lp && (tp + 1)->type == LP in expandrow()
267 && (tp + 2)->type == NAME && (tp + 3)->type == RP) in expandrow()
268 (tp + 2)->type = NAME1; in expandrow()
271 tp++; in expandrow()
277 if (((tp - 1) >= trp->bp) && ((tp - 1)->type == SHARP)) in expandrow()
279 tp->type = ARCHITECTURE; in expandrow()
280 if ((tp + 1) < trp->lp && (tp + 1)->type == NAME) in expandrow()
281 (tp + 1)->type = NAME2; in expandrow()
283 if ((tp + 3) < trp->lp && (tp + 1)->type == LP in expandrow()
284 && (tp + 2)->type == NAME && (tp + 3)->type == RP) in expandrow()
285 (tp + 2)->type = NAME2; in expandrow()
289 tp++; in expandrow()
297 tp = trp->tp; in expandrow()
324 error(INFO, "Macro expansion of %t with %s(%r)", trp->tp, np->name, np->ap); in expand()
326 error(INFO, "Macro expansion of %t with %s", trp->tp, np->name); in expand()
337 trp->tp++; in expand()
343 trp->tp += ntokc; in expand()
354 mvl_check(pValidators,trp->tp+i); in expand()
372 ntr.tp = ntr.bp; in expand()
373 makespace(&ntr, trp->tp); in expand()
395 if (trp->tp != trp->lp) in expand()
397 mvl_add(pValidators,np,trp->tp); in expand()
405 …trp->tp -= ntr.lp - ntr.bp; /* so the result will be tested for macros from the same position ag… in expand()
432 trp->tp++; in gatherargs()
434 if (trp->tp >= trp->lp) in gatherargs()
440 trp->tp -= ntok; in gatherargs()
444 if (trp->tp->type == LP) in gatherargs()
446 if (trp->tp->type != NL) in gatherargs()
452 trp->tp++; in gatherargs()
457 if (trp->tp >= trp->lp) in gatherargs()
464 if (trp->tp->type == END) in gatherargs()
467 trp->tp -= ntok; in gatherargs()
471 if (trp->tp->type == NL) in gatherargs()
473 trp->tp += 1; in gatherargs()
475 trp->tp -= 1; in gatherargs()
480 if (trp->tp->type == LP) in gatherargs()
483 if (trp->tp->type == RP) in gatherargs()
485 trp->tp++; in gatherargs()
488 trp->tp -= ntok; in gatherargs()
490 lp = bp = trp->tp + ntokp; in gatherargs()
507 ttr.bp = ttr.tp = bp; in gatherargs()
524 Token *tp; in substargs() local
527 for (rtr->tp = rtr->bp; rtr->tp < rtr->lp;) in substargs()
529 if (rtr->tp->type == SHARP) in substargs()
531 tp = rtr->tp; in substargs()
532 rtr->tp += 1; in substargs()
533 if ((argno = lookuparg(np, rtr->tp)) < 0) in substargs()
538 ntok = 1 + (rtr->tp - tp); in substargs()
539 rtr->tp = tp; in substargs()
543 if (rtr->tp->type == NAME in substargs()
544 && (argno = lookuparg(np, rtr->tp)) >= 0) in substargs()
546 if (((rtr->tp + 1) < rtr->lp && (rtr->tp + 1)->type == DSHARP) in substargs()
547 || (rtr->tp != rtr->bp && (rtr->tp - 1)->type == DSHARP)) in substargs()
550 makespace(&tatr, rtr->tp); in substargs()
557 makespace(&tatr, rtr->tp); in substargs()
564 rtr->tp++; in substargs()
578 for (trp->tp = trp->bp; trp->tp < trp->lp; trp->tp++) in doconcat()
580 if (trp->tp->type == DSHARP1) in doconcat()
581 trp->tp->type = DSHARP; in doconcat()
583 if (trp->tp->type == DSHARP) in doconcat()
588 ltp = trp->tp - 1; in doconcat()
589 ntp = trp->tp + 1; in doconcat()
609 if (ntp != trp->tp + 1) in doconcat()
621 ntp = trp->tp + i; in doconcat()
637 trp->tp = ltp; in doconcat()
641 trp->tp--; in doconcat()
652 lookuparg(Nlist * mac, Token * tp) in lookuparg() argument
656 if (tp->type != NAME || mac->ap == NULL) in lookuparg()
660 if (ap->len == tp->len && strncmp((char *) ap->t, (char *) tp->t, ap->len) == 0) in lookuparg()
675 Token *tp; in stringify() local
681 for (tp = vp->bp; tp < vp->lp; tp++) in stringify()
683 instring = tp->type == STRING || tp->type == CCON; in stringify()
684 if (sp + 2 * tp->len + tp->wslen >= &s[STRLEN - 10]) in stringify()
691 if ( tp->wslen > 0 ) in stringify()
695 for (i = 0, cp = tp->t; (unsigned int)i < tp->len; i++) in stringify()
717 Token *tp; in builtin() local
720 tp = trp->tp; in builtin()
721 trp->tp++; in builtin()
729 tp->type = STRING; in builtin()
730 if (tp->wslen) in builtin()
733 tp->wslen = 1; in builtin()
741 tp->type = NUMBER; in builtin()
771 if (tp->type == STRING) in builtin()
773 tp->t = (uchar *) outptr; in builtin()
774 tp->len = op - outptr; in builtin()