Lines Matching refs:proto

296 		register Proto_t*	proto = (Proto_t*)(iob - sizeof(Proto_t));  in proto_error()  local
298 if (proto->line) in proto_error()
300 if (proto->file) in proto_error()
303 p = strcopy(p, proto->file); in proto_error()
309 p = number(p, proto->line); in proto_error()
311 else if (proto->file) in proto_error()
312 p = strcopy(p, proto->file); in proto_error()
368 linesync(register Proto_t* proto, register char* p, register long n) in linesync() argument
371 if (proto->flags & LINESYNC) in linesync()
391 init(Proto_t* proto, char* op, int flags) in init() argument
468 if (proto->package) in init()
497 op = strcopy(op - 1, proto->package); in init()
509 #define CACHE() do{CACHEIN();CACHEOUT();call=proto->call;}while(0)
510 #define CACHEIN() (ip=proto->ip)
511 #define CACHEOUT() (op=proto->op)
516 …NCIN();SYNCOUT();proto->flags&=~(EXTERN|INIT|OTHER|VARIADIC|VARIADIC2);proto->flags|=flags&(EXTERN…
517 #define SYNCIN() (proto->ip=ip)
518 #define SYNCOUT() (proto->op=op)
575 lex(register Proto_t* proto, register long flags) in lex() argument
619 proto->tp = ip; in lex()
641 if (op > proto->ob && *(op - 1) == '=' && (op == proto->ob + 1 || *(op - 2) != '=')) switch (c) in lex()
664 proto->line++; in lex()
703 if ((flags & (DECLARE|GLOBAL|RECURSIVE)) == GLOBAL && (proto->flags & MORE)) in lex()
709 c = ip - proto->ib; in lex()
711 im = proto->tp; in lex()
712 if (ip > proto->ib) in lex()
715 if (ip - n < proto->ib) in lex()
716 proto->flags |= ERROR; in lex()
717 memcopy(proto->ib - n, ip - n, n); in lex()
718 ip = proto->ib; in lex()
720 proto->tp -= c; in lex()
730 if ((n = read(proto->fd, ip, proto->iz)) > 0) in lex()
732 if ((proto->options & REGULAR) && n < proto->iz) in lex()
734 proto->flags &= ~MORE; in lex()
735 close(proto->fd); in lex()
744 proto->flags &= ~MORE; in lex()
745 close(proto->fd); in lex()
833 lex(proto, (flags & GLOBAL) | RECURSIVE); in lex()
870 if ((flags & EXTERN) && *proto->tp == 's' && !strncmp(proto->tp, "static", 6)) in lex()
876 if (*proto->tp == '_' && !strncmp(proto->tp, "__STDPP__directive", 6)) c = '#'; in lex()
883 proto->line++; in lex()
887 if (op != proto->ob && LASTOUT() != ' ' && LASTOUT() != '\n') in lex()
943 op = linesync(proto, op, proto->line); in lex()
981 if (!(flags & DECLARE)) switch (RESERVED(*proto->tp, *(ip - 1), ip - proto->tp)) in lex()
984 if (proto->tp[1] == 'o') in lex()
991 …if (!(flags & RECURSIVE) && (flags & (DIRECTIVE|TOKENS)) != DIRECTIVE && !strncmp(proto->tp, "else… in lex()
998 if (!strncmp(proto->tp, "extern", 6)) in lex()
1002 if (!(flags & RECURSIVE) && !strncmp(proto->tp, "for", 3)) in lex()
1012 …if (!strncmp(proto->tp, "inline", 6) && !(flags & (MATCH|SKIP|TOKENS|TYPEDEF)) && proto->brace == … in lex()
1016 line = proto->line; in lex()
1022 if (!(flags & RECURSIVE) && !strncmp(proto->tp, "return", 6)) in lex()
1029 if ((proto->options & EXTERNALIZE) && !strncmp(proto->tp, "static", 6)) in lex()
1031 proto->ox = op - 6; in lex()
1036 if (!(flags & RECURSIVE) && !strncmp(proto->tp, "typedef", 7)) in lex()
1043 if (*ip == '(' && !strncmp(proto->tp, "va_start", 8)) c = T_VA_START; in lex()
1046 if (!strncmp(proto->tp, "void", 4)) in lex()
1052 line = proto->line; in lex()
1053 if (lex(proto, (flags & GLOBAL) | RECURSIVE) == '*') in lex()
1059 proto->line = line; in lex()
1066 if (!(flags & RECURSIVE) && !strncmp(proto->tp, "while", 5)) in lex()
1087 while (op > proto->ob && (*(op - 1) == ' ' || *(op - 1) == '\t')) in lex()
1089 if (op > proto->ob && *(op - 1) != '\n') *op++ = ' '; in lex()
1108 proto->line++; in lex()
1131 if (!(flags & CLASSIC) || proto->brace == 0) in lex()
1188 if (!(flags & CLASSIC) || proto->brace == 0) in lex()
1221 …if (proto->brace == 0 && paren == 0 && last != '=' && (flags & (CLASSIC|DECLARE|DIRECTIVE|MATCH|PL… in lex()
1234 proto->line = 0; in lex()
1236 proto->line = proto->line * 10 + *ip - '0'; in lex()
1237 proto->line--; in lex()
1297 op = linesync(proto, op, proto->line); in lex()
1315 op = linesync(proto, op, proto->line); in lex()
1330 op = linesync(proto, op, proto->line); in lex()
1347 if (proto->brace++ == 0 && paren == 0) in lex()
1362 proto_error((char*)proto + sizeof(Proto_t), 2, op, NiL); in lex()
1513 …proto_error((char*)proto + sizeof(Proto_t), 1, "function pointer argument prototype omitted", NiL); in lex()
1546 line = proto->line; in lex()
1555 if ((vc = ie - im + 1) > sizeof(proto->variadic)) vc = sizeof(proto->variadic); in lex()
1556 memcopy(proto->variadic, im, vc); in lex()
1562 proto->ip = im; in lex()
1563 proto->op = op; in lex()
1568 switch (lex(proto, (flags & GLOBAL) | RECURSIVE)) in lex()
1602 proto->op = op; in lex()
1609 m = proto->tp; in lex()
1610 e = proto->ip; in lex()
1624 proto->op = strcopy(op, " __OTORP__("); in lex()
1625 proto->ip = im + 1; in lex()
1630 lex(proto, (flags & GLOBAL) | DECLARE); in lex()
1633 proto->ip = ie; in lex()
1634 op = proto->op; in lex()
1637 if (flags & EXTERNALIZE) memcpy(proto->ox, "extern", 6); in lex()
1638 op = linesync(proto, op, proto->line = line); in lex()
1641 proto->brace = 0; in lex()
1654 if (--proto->brace == 0) in lex()
1669 if (last == ')' && proto->brace && (group != 2 || call != 2)) flags |= SKIP; in lex()
1798 if (flags & EXTERNALIZE) memcpy(proto->ox, "extern", 6); in lex()
1834 if (proto->brace == 0) in lex()
1842 if (!(flags & PLUSONLY) || proto->package) in lex()
1845 if (proto->package) in lex()
1847 op = strcopy(op - 1, proto->package); in lex()
1873 line = proto->line; in lex()
1878 switch (lex(proto, (flags & GLOBAL) | RECURSIVE)) in lex()
1887 m = proto->tp; in lex()
1888 e = proto->ip; in lex()
1908 proto->ip = proto->variadic; in lex()
1909 proto->op = op; in lex()
1912 bp = proto->ip + 1; in lex()
1916 switch (lex(proto, (flags & GLOBAL) | RECURSIVE)) in lex()
1939 else op = memcopy(op, e, proto->ip - e - 1); in lex()
1965 else op = memcopy(op, e, proto->ip - e - 1); in lex()
1968 bp = proto->ip + 1; in lex()
1972 proto->op = op; in lex()
1979 m = proto->tp; in lex()
1980 e = proto->ip; in lex()
1990 proto->line = line; in lex()
2008 if (proto->brace == 0 && !(flags & DECLARE)) flags |= SKIP; in lex()
2019 if (*proto->tp >= '0' && *proto->tp <= '9') in lex()
2088 …if ((flags & (EXTERN|MATCH)) == (EXTERN|MATCH) && ((flags & (DIRECTIVE|SKIP)) || proto->brace || c… in lex()
2121 n = ip - proto->tp; in lex()
2126 op = proto->op; in lex()
2132 op = init(proto, op, flags); in lex()
2133 op = linesync(proto, op, proto->line); in lex()
2135 proto->flags &= ~(INIT_DEFINE|INIT_INCLUDE); in lex()
2149 register Proto_t* proto = (Proto_t*)(iob - sizeof(Proto_t)); in pppclose() local
2151 if (proto->flags & MORE) close(proto->fd); in pppclose()
2152 free((char*)proto); /* some ANSI cc's botch the free() prototype */ in pppclose()
2170 register Proto_t* proto; in pppopen() local
2213 if (!(proto = newof(0, Proto_t, 1, 4 * n + 2))) in pppopen()
2215 proto->iz = n; in pppopen()
2216 proto->oz = 3 * n; in pppopen()
2227 if (!(proto = newof(0, Proto_t, 1, 5 * n + 2))) in pppopen()
2229 proto->iz = n; in pppopen()
2230 proto->oz = 3 * n; in pppopen()
2231 proto->flags |= MORE; in pppopen()
2233 proto->fd = fd; in pppopen()
2234 proto->package = package; in pppopen()
2235 iob = (char*)proto + sizeof(Proto_t); in pppopen()
2236 proto->op = proto->ob = iob; in pppopen()
2237 proto->ip = proto->ib = iob + proto->oz + n; in pppopen()
2238 if (m) proto->options |= REGULAR; in pppopen()
2241 if (!(proto->cc[0] = comment[0])) in pppopen()
2245 proto->cc[1] = comment[1]; in pppopen()
2246 proto->cc[2] = comment[2] ? comment[2] : comment[0]; in pppopen()
2249 proto->cc[1] = proto->cc[2] = comment[0]; in pppopen()
2255 n = read(fd, proto->ip, proto->iz); in pppopen()
2256 if (!(proto->flags & MORE)) in pppopen()
2263 *(proto->ip + n) = 0; in pppopen()
2277 …| (comlen = astlicense(com, sizeof(com), NiL, "type=check", proto->cc[0], proto->cc[1], proto->cc[… in pppopen()
2282 s = proto->ip; in pppopen()
2333 proto->flags |= YACC; in pppopen()
2368 if (flags & PROTO_PLUSPLUS) proto->flags |= PLUSPLUS; in pppopen()
2369 if (flags & PROTO_TEST) proto->test = 1; in pppopen()
2370 if (flags & PROTO_EXTERNALIZE) proto->options |= EXTERNALIZE; in pppopen()
2374 if (flags & PROTO_LINESYNC) proto->flags |= LINESYNC; in pppopen()
2375 …if (!(proto->flags & YACC) && file && (m = strlen(file)) > 2 && file[--m] == 'y' && file[--m] == '… in pppopen()
2376 proto->flags |= YACC; in pppopen()
2383 proto->flags |= PLUSONLY; in pppopen()
2392 proto->flags |= PASS; in pppopen()
2393 if (proto->flags & MORE) in pppopen()
2394 proto->oz += proto->iz; in pppopen()
2395 proto->iz = n; in pppopen()
2398 if (proto->cc[0] == '#' && proto->ip[0] == '#' && proto->ip[1] == '!') in pppopen()
2400 s = proto->ip; in pppopen()
2402 m = s - proto->ip; in pppopen()
2403 proto->op = memcopy(proto->op, proto->ip, m); in pppopen()
2404 proto->ip = s; in pppopen()
2405 proto->iz = n -= m; in pppopen()
2408 if (proto->cc[0]) in pppopen()
2410 …if ((comlen = astlicense(proto->op, proto->oz, notice, options, proto->cc[0], proto->cc[1], proto-… in pppopen()
2411 proto_error((char*)proto + sizeof(Proto_t), 1, proto->op, NiL); in pppopen()
2413 proto->op += comlen; in pppopen()
2415 if (!(flags & PROTO_CLASSIC) && !(proto->flags & YACC)) in pppopen()
2417 proto->op = linesync(proto, proto->op, 1); in pppopen()
2418 proto->iz += proto->op - proto->ob; in pppopen()
2420 memcopy(proto->op, proto->ip, n); in pppopen()
2431 proto->line = 1; in pppopen()
2438 …if ((comlen = astlicense(proto->op, proto->oz, notice, options, proto->cc[0], proto->cc[1], proto-… in pppopen()
2439 proto_error((char*)proto + sizeof(Proto_t), 1, proto->op, NiL); in pppopen()
2441 proto->op += comlen; in pppopen()
2446 proto->flags |= INIT_INCLUDE; in pppopen()
2456 *proto->op++ = '#'; in pppopen()
2457 proto->op = strcopy(proto->op, PRAGMADIR); in pppopen()
2458 *proto->op++ = ' '; in pppopen()
2459 proto->op = strcopy(proto->op, pragmas[0].name); in pppopen()
2460 *proto->op++ = '\n'; in pppopen()
2464 proto->flags |= INIT_DEFINE; in pppopen()
2469 if (proto->flags & YACC) in pppopen()
2471 proto->op = strcopy(proto->op, "\n%{\n" + !notice); in pppopen()
2472 proto->op = strcopy(proto->op, GENERATED); in pppopen()
2473 proto->op = strcopy(proto->op, "%}\n"); in pppopen()
2478 *proto->op++ = '\n'; in pppopen()
2479 proto->op = strcopy(proto->op, GENERATED); in pppopen()
2481 proto->op = linesync(proto, proto->op, proto->line); in pppopen()
2482 else if (proto->flags & (INIT_DEFINE|INIT_INCLUDE)) in pppopen()
2483 proto->op = init(proto, proto->op, proto->flags); in pppopen()
2490 proto->file = file; in pppopen()
2493 proto->flags |= CLASSIC; in pppopen()
2494 if (!(flags & PROTO_HEADER)) proto->flags |= EXTERN; in pppopen()
2508 register Proto_t* proto = (Proto_t*)(iob - sizeof(Proto_t)); in pppread() local
2511 if (proto->flags & PASS) in pppread()
2513 if (proto->iz) in pppread()
2515 n = proto->iz; in pppread()
2516 proto->iz = 0; in pppread()
2518 else if (!(proto->flags & MORE)) n = 0; in pppread()
2519 …else if ((n = read(proto->fd, proto->ob, proto->oz)) <= 0 || (proto->options & REGULAR) && n < pro… in pppread()
2521 proto->flags &= ~MORE; in pppread()
2522 close(proto->fd); in pppread()
2527 if (proto->op == proto->ob) in pppread()
2529 if (proto->flags & ERROR) return -1; in pppread()
2531 if (proto->flags & YACC) in pppread()
2533 register char* ip = proto->ip; in pppread()
2534 register char* op = proto->ob; in pppread()
2535 register char* ep = proto->ob + proto->oz - 2; in pppread()
2539 ip = proto->ip = proto->ib; in pppread()
2540 if (!(proto->flags & MORE)) n = 0; in pppread()
2541 … else if ((n = read(proto->fd, ip, proto->iz)) <= 0 || (proto->options & REGULAR) && n < proto->iz) in pppread()
2544 proto->flags &= ~MORE; in pppread()
2545 close(proto->fd); in pppread()
2549 if (proto->flags & YACCSPLIT) in pppread()
2551 proto->flags &= ~YACCSPLIT; in pppread()
2555 if (proto->flags & YACC2) proto->flags &= ~YACC; in pppread()
2556 else proto->flags |= YACC2; in pppread()
2559 if (proto->flags & YACC) in pppread()
2565 if (*ip == '%' && (ip == proto->ip + 1 || *(ip - 2) == '\n')) in pppread()
2568 if (proto->flags & YACC2) proto->flags &= ~YACC; in pppread()
2569 else proto->flags |= YACC2; in pppread()
2575 proto->flags |= YACCSPLIT; in pppread()
2579 else if (n == '\n') proto->line++; in pppread()
2581 proto->op = memcopy(proto->ob, proto->ip, ip - proto->ip); in pppread()
2582 proto->ip = ip; in pppread()
2586 lex(proto, proto->flags); in pppread()
2587 if ((proto->flags & (ERROR|MORE)) == ERROR) in pppread()
2588 proto->op = strcopy(proto->op, "/* NOTE: some constructs may not have been converted */\n"); in pppread()
2590 n = proto->op - proto->ob; in pppread()
2591 proto->op = proto->ob; in pppread()
2607 register Proto_t* proto = (Proto_t*)(iob - sizeof(Proto_t)); in pppdrop() local
2609 if (proto->flags & MORE) in pppdrop()
2611 proto->flags &= ~MORE; in pppdrop()
2612 return proto->fd; in pppdrop()