Lines Matching refs:proto

21 /* : : generated by proto : : */
80 #line 1 "proto.c"
201 static const char id[] = "\n@(#)$Id: proto (AT&T Research) 2012-04-14 $\000\n";
1417 p = strcopy(buf, "proto: ");
1420 register Proto_t* proto = (Proto_t*)(iob - sizeof(Proto_t));
1422 if (proto->line)
1424 if (proto->file)
1427 p = strcopy(p, proto->file);
1433 p = number(p, proto->line);
1435 else if (proto->file)
1436 p = strcopy(p, proto->file);
2662 linesync __PARAM__((register Proto_t* proto, register char* p, register long n), (proto, p, n)) __OTORP__(register Proto_t* proto; register char* p; register long n;){
2664 if (proto->flags & (1L<<13))
2684 init __PARAM__((Proto_t* proto, char* op, int flags), (proto, op, flags)) __OTORP__(Proto_t* proto; char* op; int flags;){
2760 if (proto->package)
2789 op = strcopy(op - 1, proto->package);
2842 lex __PARAM__((register Proto_t* proto, register long flags), (proto, flags)) __OTORP__(register Proto_t* proto; register long flags;){
2880 do{(ip=proto->ip);(op=proto->op);call=proto->call;}while(0);
2885 proto->tp = ip;
2907 if (op > proto->ob && *(op - 1) == '=' && (op == proto->ob + 1 || *(op - 2) != '=')) switch (c)
2930 proto->line++;
2964 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
2969 if ((flags & ((1L<<1)|((1L<<16))|(1L<<21))) == ((1L<<16)) && (proto->flags & (1L<<16)))
2975 c = ip - proto->ib;
2977 im = proto->tp;
2978 if (ip > proto->ib)
2981 if (ip - n < proto->ib)
2982 proto->flags |= (1L<<4);
2983 memcopy(proto->ib - n, ip - n, n);
2984 ip = proto->ib;
2986 proto->tp -= c;
2996 if ((n = read(proto->fd, ip, proto->iz)) > 0)
2998 if ((proto->options & (1L<<0)) && n < proto->iz)
3000 proto->flags &= ~(1L<<16);
3001 close(proto->fd);
3010 proto->flags &= ~(1L<<16);
3011 close(proto->fd);
3021 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3098 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3099 lex(proto, (flags & ((1L<<16))) | (1L<<21));
3136 if ((flags & (1L<<5)) && *proto->tp == 's' && !sstrncmp( proto->tp, "static", 6))
3142 if (*proto->tp == '_' && !sstrncmp( proto->tp, "__STDPP__directive", 6)) c = '#';
3149 proto->line++;
3153 if (op != proto->ob && (*(op-1)) != ' ' && (*(op-1)) != '\n')
3209 op = linesync(proto, op, proto->line);
3223 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3247 if (!(flags & (1L<<1))) switch (((((long)( *proto->tp))<<16)|(((long)( *(ip - 1)))<<8)|((long)( ip - proto->tp))))
3250 if (proto->tp[1] == 'o')
3257 if (!(flags & (1L<<21)) && (flags & ((1L<<3)|(1L<<25))) != (1L<<3) && !sstrncmp( proto->tp, "else", 4))
3264 if (!sstrncmp( proto->tp, "extern", 6))
3268 if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "for", 3))
3278 if (!sstrncmp( proto->tp, "inline", 6) && !(flags & ((1L<<15)|(1L<<23)|(1L<<25)|(1L<<26))) && proto->brace == 0 && paren == 0 && group == 0 && (last == ';' || last == '}' || last == '\n' || last == 0))
3281 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3282 line = proto->line;
3284 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3288 if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "return", 6))
3295 if ((proto->options & (1L<<6)) && !sstrncmp( proto->tp, "static", 6))
3297 proto->ox = op - 6;
3302 if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "typedef", 7))
3309 if (*ip == '(' && !sstrncmp( proto->tp, "va_start", 8)) c = (0500+1);
3312 if (!sstrncmp( proto->tp, "void", 4))
3317 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3318 line = proto->line;
3319 if (lex(proto, (flags & ((1L<<16))) | (1L<<21)) == '*')
3325 proto->line = line;
3326 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
3332 if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "while", 5))
3353 while (op > proto->ob && (*(op - 1) == ' ' || *(op - 1) == '\t'))
3355 if (op > proto->ob && *(op - 1) != '\n') *op++ = ' ';
3374 proto->line++;
3397 if (!(flags & (1L<<0)) || proto->brace == 0)
3454 if (!(flags & (1L<<0)) || proto->brace == 0)
3487 if (proto->brace == 0 && paren == 0 && last != '=' && (flags & ((1L<<0)|(1L<<1)|(1L<<3)|(1L<<15)|(1L<<19)|(1L<<23)|(1L<<25))) == ((1L<<15)|(1L<<25)) && ((dir & 03) != 03 || ((dir>>2) & 03) != 01))
3500 proto->line = 0;
3502 proto->line = proto->line * 10 + *ip - '0';
3503 proto->line--;
3563 op = linesync(proto, op, proto->line);
3581 op = linesync(proto, op, proto->line);
3596 op = linesync(proto, op, proto->line);
3613 if (proto->brace++ == 0 && paren == 0)
3628 proto_error((char*)proto + sizeof(Proto_t), 2, op, ((char*)0));
3779 proto_error((char*)proto + sizeof(Proto_t), 1, "function pointer argument prototype omitted", ((char*)0));
3797 (proto->op=op);
3812 line = proto->line;
3821 if ((vc = ie - im + 1) > sizeof(proto->variadic)) vc = sizeof(proto->variadic);
3822 memcopy(proto->variadic, im, vc);
3828 proto->ip = im;
3829 proto->op = op;
3834 switch (lex(proto, (flags & ((1L<<16))) | (1L<<21)))
3868 proto->op = op;
3875 m = proto->tp;
3876 e = proto->ip;
3890 proto->op = strcopy(op, " __OTORP__(");
3891 proto->ip = im + 1;
3896 lex(proto, (flags & ((1L<<16))) | (1L<<1));
3899 proto->ip = ie;
3900 op = proto->op;
3903 if (flags & (1L<<6)) memcopy( proto->ox, "extern", 6);
3904 op = linesync(proto, op, proto->line = line);
3907 proto->brace = 0;
3920 if (--proto->brace == 0)
3935 if (last == ')' && proto->brace && (group != 2 || call != 2)) flags |= (1L<<23);
3972 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
4064 if (flags & (1L<<6)) memcopy( proto->ox, "extern", 6);
4082 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
4100 if (proto->brace == 0)
4108 if (!(flags & (1L<<19)) || proto->package)
4111 if (proto->package)
4113 op = strcopy(op - 1, proto->package);
4126 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
4139 line = proto->line;
4141 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
4144 switch (lex(proto, (flags & ((1L<<16))) | (1L<<21)))
4153 m = proto->tp;
4154 e = proto->ip;
4162 do{(ip=proto->ip);(op=proto->op);call=proto->call;}while(0);
4174 proto->ip = proto->variadic;
4175 proto->op = op;
4178 bp = proto->ip + 1;
4182 switch (lex(proto, (flags & ((1L<<16))) | (1L<<21)))
4205 else op = memcopy(op, e, proto->ip - e - 1);
4231 else op = memcopy(op, e, proto->ip - e - 1);
4234 bp = proto->ip + 1;
4238 proto->op = op;
4245 m = proto->tp;
4246 e = proto->ip;
4256 proto->line = line;
4274 if (proto->brace == 0 && !(flags & (1L<<1))) flags |= (1L<<23);
4285 if (*proto->tp >= '0' && *proto->tp <= '9')
4354 if ((flags & ((1L<<5)|(1L<<15))) == ((1L<<5)|(1L<<15)) && ((flags & ((1L<<3)|(1L<<23))) || proto->brace || c != '(' && c != ')' && c != '*' && c != (0401+0)))
4355 (op=proto->op);
4358 (proto->op=op);
4387 n = ip - proto->tp;
4398 op = init(proto, op, flags);
4399 op = linesync(proto, op, proto->line);
4401 proto->flags &= ~((1L<<10)|(1L<<11));
4404 do{(proto->ip=ip);(proto->op=op);proto->flags&=~((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->flags|=flags&((1L<<5)|(1L<<9)|(1L<<17)|(1L<<27)|(1L<<28));proto->call=call;}while(0);
4414 register Proto_t* proto = (Proto_t*)(iob - sizeof(Proto_t));
4416 if (proto->flags & (1L<<16)) close(proto->fd);
4417 free((char*)proto);
4424 register Proto_t* proto;
4481 if (!(proto = (( 0)?( Proto_t*)realloc((char*)( 0),sizeof( Proto_t)*( 1)+( 5 * n + 2)):( Proto_t*)calloc(1,sizeof( Proto_t)*( 1)+( 5 * n + 2)))))
4483 proto->iz = n;
4484 proto->oz = 3 * n;
4485 proto->flags |= (1L<<16);
4487 proto->fd = fd;
4488 proto->package = package;
4489 iob = (char*)proto + sizeof(Proto_t);
4490 proto->op = proto->ob = iob;
4491 proto->ip = proto->ib = iob + proto->oz + n;
4492 if (m) proto->options |= (1L<<0);
4495 if (!(proto->cc[0] = comment[0]))
4499 proto->cc[1] = comment[1];
4500 proto->cc[2] = comment[2] ? comment[2] : comment[0];
4503 proto->cc[1] = proto->cc[2] = comment[0];
4509 n = read(fd, proto->ip, proto->iz);
4510 if (!(proto->flags & (1L<<16)))
4517 *(proto->ip + n) = 0;
4521 if (!notice && !options || (comlen = astlicense(com, sizeof(com), ((char*)0), "type=check", proto->cc[0], proto->cc[1], proto->cc[2])) <= 0)
4526 s = proto->ip;
4570 else if (*s == *"/* : : generated by proto : : */\n"&& !sstrncmp( s, "/* : : generated by proto : : */\n", sizeof("/* : : generated by proto : : */\n") - 1))
4577 proto->flags |= (1L<<29);
4612 if (flags & (1<<10)) proto->flags |= (1L<<20);
4613 if (flags & (1<<12)) proto->test = 1;
4614 if (flags & (1<<2)) proto->options |= (1L<<6);
4618 if (flags & (1<<7)) proto->flags |= (1L<<13);
4619 if (!(proto->flags & (1L<<29)) && file && (m = sstrlen( file)) > 2 && file[--m] == 'y' && file[--m] == '.')
4620 proto->flags |= (1L<<29);
4627 proto->flags |= (1L<<19);
4636 proto->flags |= (1L<<18);
4637 if (proto->flags & (1L<<16))
4638 proto->oz += proto->iz;
4639 proto->iz = n;
4642 if (proto->cc[0] == '#' && proto->ip[0] == '#' && proto->ip[1] == '!')
4644 s = proto->ip;
4646 m = s - proto->ip;
4647 proto->op = memcopy(proto->op, proto->ip, m);
4648 proto->ip = s;
4649 proto->iz = n -= m;
4652 if (proto->cc[0])
4654 if ((comlen = astlicense(proto->op, proto->oz, notice, options, proto->cc[0], proto->cc[1], proto->cc[2])) < 0)
4655 proto_error((char*)proto + sizeof(Proto_t), 1, proto->op, ((char*)0));
4657 proto->op += comlen;
4659 if (!(flags & (1<<0)) && !(proto->flags & (1L<<29)))
4661 proto->op = linesync(proto, proto->op, 1);
4662 proto->iz += proto->op - proto->ob;
4664 memcopy(proto->op, proto->ip, n);
4675 proto->line = 1;
4682 if ((comlen = astlicense(proto->op, proto->oz, notice, options, proto->cc[0], proto->cc[1], proto->cc[2])) < 0)
4683 proto_error((char*)proto + sizeof(Proto_t), 1, proto->op, ((char*)0));
4685 proto->op += comlen;
4690 proto->flags |= (1L<<11);
4700 *proto->op++ = '#';
4701 proto->op = strcopy(proto->op, "pragma");
4702 *proto->op++ = ' ';
4703 proto->op = strcopy(proto->op, pragmas[0].name);
4704 *proto->op++ = '\n';
4708 proto->flags |= (1L<<10);
4713 if (proto->flags & (1L<<29))
4715 proto->op = strcopy(proto->op, "\n%{\n"+ !notice);
4716 proto->op = strcopy(proto->op, "/* : : generated by proto : : */\n");
4717 proto->op = strcopy(proto->op, "%}\n");
4722 *proto->op++ = '\n';
4723 proto->op = strcopy(proto->op, "/* : : generated by proto : : */\n");
4725 proto->op = linesync(proto, proto->op, proto->line);
4726 else if (proto->flags & ((1L<<10)|(1L<<11)))
4727 proto->op = init(proto, proto->op, proto->flags);
4734 proto->file = file;
4737 proto->flags |= (1L<<0);
4738 if (!(flags & (1<<4))) proto->flags |= (1L<<5);
4751 register Proto_t* proto = (Proto_t*)(iob - sizeof(Proto_t));
4754 if (proto->flags & (1L<<18))
4756 if (proto->iz)
4758 n = proto->iz;
4759 proto->iz = 0;
4761 else if (!(proto->flags & (1L<<16))) n = 0;
4762 else if ((n = read(proto->fd, proto->ob, proto->oz)) <= 0 || (proto->options & (1L<<0)) && n < proto->oz)
4764 proto->flags &= ~(1L<<16);
4765 close(proto->fd);
4770 if (proto->op == proto->ob)
4772 if (proto->flags & (1L<<4)) return -1;
4774 if (proto->flags & (1L<<29))
4776 register char* ip = proto->ip;
4777 register char* op = proto->ob;
4778 register char* ep = proto->ob + proto->oz - 2;
4782 ip = proto->ip = proto->ib;
4783 if (!(proto->flags & (1L<<16))) n = 0;
4784 else if ((n = read(proto->fd, ip, proto->iz)) <= 0 || (proto->options & (1L<<0)) && n < proto->iz)
4787 proto->flags &= ~(1L<<16);
4788 close(proto->fd);
4792 if (proto->flags & (1L<<30))
4794 proto->flags &= ~(1L<<30);
4798 if (proto->flags & (1L<<31)) proto->flags &= ~(1L<<29);
4799 else proto->flags |= (1L<<31);
4802 if (proto->flags & (1L<<29))
4808 if (*ip == '%' && (ip == proto->ip + 1 || *(ip - 2) == '\n'))
4811 if (proto->flags & (1L<<31)) proto->flags &= ~(1L<<29);
4812 else proto->flags |= (1L<<31);
4818 proto->flags |= (1L<<30);
4822 else if (n == '\n') proto->line++;
4824 proto->op = memcopy(proto->ob, proto->ip, ip - proto->ip);
4825 proto->ip = ip;
4829 lex(proto, proto->flags);
4830 if ((proto->flags & ((1L<<4)|(1L<<16))) == (1L<<4))
4831 proto->op = strcopy(proto->op, "/* NOTE: some constructs may not have been converted */\n");
4833 n = proto->op - proto->ob;
4834 proto->op = proto->ob;
4850 #line 269 "proto.c"
4857 proto __PARAM__((char* file, char* license, char* options, char* package, char* copy, char* comment, int flags), (file, license, options, package, copy, comment, flags)) __OTORP__(char* file; char* license; char* options; char* package; char* copy; char* comment; int flags;){
5163 b = "Usage: proto [-dfhinprstvzP+S] [-C directory] [-e package] [-l file]\n [-o \"name='value' ...\"] [-L file] file ...\n";
5275 flags = proto(buf, license, options, package, copy, type(buf, comment), flags);
5282 do flags = proto(file, license, options, package, copy, type(file, comment), flags); while (file = *++argv);
5284 flags = proto(file, license, options, package, copy, type(file, comment), flags);