1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1990-2016 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Eclipse Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.eclipse.org/org/documents/epl-v10.html *
11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <glenn.s.fowler@gmail.com> *
19 ***********************************************************************/
21 /* : : generated by proto : : */
23 #if !defined(__PROTO__)
24 # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
25 # if defined(__cplusplus)
26 # define __LINKAGE__ "C"
31 # define __PROTO__(x) x
33 # define __PARAM__(n,o) n
34 # if !defined(__STDC__) && !defined(__cplusplus)
35 # if !defined(c_plusplus)
46 # define __PROTO__(x) ()
47 # define __OTORP__(x) x
48 # define __PARAM__(n,o) o
56 # define __MANGLE__ __LINKAGE__
57 # if defined(__cplusplus) || defined(c_plusplus)
58 # define __VARARG__ ...
62 # if defined(__STDARG__)
63 # define __VA_START__(p,a) va_start(p,a)
65 # define __VA_START__(p,a) va_start(p)
67 # if !defined(__INLINE__)
68 # if defined(__cplusplus)
69 # define __INLINE__ extern __MANGLE__ inline
71 # if defined(_WIN32) && !defined(__GNUC__)
72 # define __INLINE__ __inline
77 #if !defined(__LINKAGE__)
78 #define __LINKAGE__ /* 2004-08-11 transition */
88 # define creat _huh_creat
92 # define access _huh_access
95 # define ctime _huh_ctime
98 # define mkdir _huh_mkdir
103 # include <sys/types.h>
104 # include <sys/stat.h>
124 # define S_IRUSR 0400
127 # define S_IWUSR 0200
130 # define S_IXUSR 0100
133 # define S_IRGRP 0040
136 # define S_IWGRP 0020
139 # define S_IXGRP 0010
142 # define S_IROTH 0004
145 # define S_IWOTH 0002
148 # define S_IXOTH 0001
152 # if !_WIN32 && !_WINIX
153 # define remove(x) unlink(x)
154 # define rename(x,y) ((link(x,y)||remove(x))?-1:0)
158 extern __MANGLE__
int access
__PROTO__((const char*, int));
159 extern __MANGLE__
int mkdir
__PROTO__((const char*, int));
165 extern __MANGLE__
int utime
__PROTO__((const char*, time_t*));
174 replace
__PARAM__((const char* newfile
, const char* oldfile
, int preserve
), (newfile
, oldfile
, preserve
)) __OTORP__(const char* newfile
; const char* oldfile
; int preserve
;){
178 if (stat(oldfile
, &st
))
184 if (remove(oldfile
) || rename(newfile
, oldfile
))
186 if (st
.st_mode
&= (S_IRUSR
|S_IWUSR
|S_IXUSR
|S_IRGRP
|S_IWGRP
|S_IXGRP
|S_IROTH
|S_IWOTH
|S_IXOTH
))
187 chmod(oldfile
, st
.st_mode
);
192 preserve
= utime(oldfile
, ut
);
198 # define utime ______utime
200 #line 1 "../../lib/libpp/ppproto.c"
203 static const char id
[] = "\n@(#)$Id: proto (AT&T Research) 2012-04-14 $\000\n";
205 #line 1 "../../lib/libpp/ppfsm.c"
207 #line 1 "../../lib/libpp/pplib.h"
213 typedef char* (*PPBUILTIN
) __PROTO__((char*, const char*, const char*));
214 typedef void (*PPCOMMENT
) __PROTO__((const char*, const char*, const char*, int));
215 typedef void (*PPINCREF
) __PROTO__((const char*, const char*, int, int));
216 typedef void (*PPLINESYNC
) __PROTO__((int, const char*));
217 typedef void (*PPMACREF
) __PROTO__((struct ppsymbol
*, const char*, int, int, unsigned long));
218 typedef int (*PPOPTARG
) __PROTO__((int, int, const char*));
219 typedef void (*PPPRAGMA
) __PROTO__((const char*, const char*, const char*, const char*, int));
224 struct ppinstk
* next
;
225 struct ppinstk
* prev
;
230 struct ppsymbol
* symbol
;
232 struct ppindex
* index
;
266 struct ppmacro
* macro
;
273 struct ppmacstk
* next
;
274 struct ppmacstk
* prev
;
281 struct ppdirs
* archive
;
282 unsigned long offset
;
299 struct pptuple
* nomatch
;
300 struct pptuple
* match
;
306 unsigned long st_dev
;
307 unsigned long st_ino
;
316 #line 1 "../../lib/libpp/pp.h"
329 unsigned char c
; unsigned char index
; unsigned char type
; union { char* buffer
; char* sp
; struct ppdirs
* subdir
; } info
; struct ppfileid id
;
346 struct pptuple
* tuple
; char* formals
; int size
;
355 struct ppmacro
* macro
;
359 struct pphide
* hidden
;
372 struct ppsymbol
* symbol
;
380 unsigned long offset
;
383 struct ppdirs
* lcldirs
; struct ppdirs
* stddirs
; int flags
; char* symtab
;
387 struct ppcontext
* context
; long state
; long mode
; long option
; long test
; struct { char* sp
; long flags
; } filedeps
; struct ppdirs
* firstdir
; struct ppdirs
* lastdir
; int hide
; int column
; int pending
; char* firstfile
; char* lastfile
; char* ignore
; char* probe
; char* filtab
; char* prdtab
; char* date
; char* time
; char* maps
; long ro_state
; long ro_mode
; long ro_option
; long ro_op
[2]; struct pathid cdir
; struct pathid hostdir
; char* ppdefault
; struct ppindex
* firstindex
; struct ppindex
* lastindex
; struct oplist
* firstop
; struct oplist
* lastop
; struct oplist
* firsttx
; struct oplist
* lasttx
; unsigned char arg_file
; unsigned char arg_mode
; unsigned char arg_style
; unsigned char c
; unsigned char hosted
; unsigned char ignoresrc
; unsigned char initialized
; unsigned char standalone
; unsigned char spare_1
;
391 char* checkpoint
; int constack
; struct ppinstk
* in
; char* addp
; char* args
; char* addbuf
; char* catbuf
; char* hdrbuf
; char* hidebuf
; char* path
; char* tmpbuf
; char* valbuf
; char* optflags
; int lastout
; char* include
; char* prefix
; struct ppmember
* member
; int hidden
; int hiding
; int level
; struct { int input
; int output
; } pool
; struct { long ro_state
; long ro_mode
; long ro_option
; long ro_op
[2]; int on
; char* symtab
; } reset
; int truncate
; struct ppmacstk
* macp
; char* maxmac
; char* mactop
; char* toknxt
; long* control
; long* maxcon
; struct oplist
* chop
; struct ppfile
* insert
; struct ppfile
* original
; struct ppdirs
* found
; int vendor
; char* dirtab
; char* strtab
; PPBUILTIN builtin
; PPCOMMENT comment
; PPINCREF incref
; PPLINESYNC linesync
; PPLINESYNC olinesync
; PPMACREF macref
; PPOPTARG optarg
; PPPRAGMA pragma
; struct counter counter
; char funbuf
[256];
402 extern __MANGLE__
struct ppglobals pp
;
403 extern __MANGLE__
char _pp_ctype
[];
405 extern __MANGLE__
int ppargs
__PROTO__((char**, int));
406 extern __MANGLE__
void ppcpp
__PROTO__((void));
407 extern __MANGLE__
void ppcomment
__PROTO__((char*, char*, char*, int));
408 extern __MANGLE__ __V_
* ppcontext
__PROTO__((__V_
*, int));
409 extern __MANGLE__
void pperror
__PROTO__((int, ...));
410 extern __MANGLE__
void ppincref
__PROTO__((char*, char*, int, int));
411 extern __MANGLE__
void ppinput
__PROTO__((char*, char*, int));
412 extern __MANGLE__
int pplex
__PROTO__((void));
413 extern __MANGLE__
void ppline
__PROTO__((int, char*));
414 extern __MANGLE__
void ppmacref
__PROTO__((struct ppsymbol
*, char*, int, int, unsigned long));
415 extern __MANGLE__
void ppop
__PROTO__((int, ...));
416 extern __MANGLE__
void pppragma
__PROTO__((char*, char*, char*, char*, int));
417 extern __MANGLE__
int ppprintf
__PROTO__((char*, ...));
418 extern __MANGLE__
int ppsync
__PROTO__((void));
420 #line 388 "../../lib/libpp/pplib.h"
422 #line 1 "../../lib/libpp/ppdef.h"
424 #line 389 "../../lib/libpp/pplib.h"
426 #line 1 "../../lib/libpp/ppkey.h"
431 extern __MANGLE__
struct ppkeyword ppkey
[];
433 #line 390 "../../lib/libpp/pplib.h"
438 struct ppdirs
* lcldirs
; struct ppdirs
* stddirs
; int flags
; char* symtab
;
439 struct ppcontext
* context
; long state
; long mode
; long option
; long test
; struct { char* sp
; long flags
; } filedeps
; struct ppdirs
* firstdir
; struct ppdirs
* lastdir
; int hide
; int column
; int pending
; char* firstfile
; char* lastfile
; char* ignore
; char* probe
; char* filtab
; char* prdtab
; char* date
; char* time
; char* maps
; long ro_state
; long ro_mode
; long ro_option
; long ro_op
[2]; struct pathid cdir
; struct pathid hostdir
; char* ppdefault
; struct ppindex
* firstindex
; struct ppindex
* lastindex
; struct oplist
* firstop
; struct oplist
* lastop
; struct oplist
* firsttx
; struct oplist
* lasttx
; unsigned char arg_file
; unsigned char arg_mode
; unsigned char arg_style
; unsigned char c
; unsigned char hosted
; unsigned char ignoresrc
; unsigned char initialized
; unsigned char standalone
; unsigned char spare_1
;
445 struct ppsymbol
* guard
;
446 struct ppfile
* bound
[4];
454 struct ppindex
* next
;
480 extern __MANGLE__ __V_
* realloc
__PROTO__((__V_
*, size_t));
481 extern __MANGLE__ __V_
* calloc
__PROTO__((size_t, size_t));
482 extern __MANGLE__
char* ctime
__PROTO__((time_t*));
483 extern __MANGLE__
void free
__PROTO__((__V_
*));
487 extern __MANGLE__
int access
__PROTO__((const char*, int));
488 extern __MANGLE__
int close
__PROTO__((int));
489 extern __MANGLE__
int creat
__PROTO__((const char*, int));
490 extern __MANGLE__
void exit
__PROTO__((int));
491 extern __MANGLE__
int link
__PROTO__((const char*, const char*));
492 extern __MANGLE__
int open
__PROTO__((const char*, int, ...));
493 extern __MANGLE__
int read
__PROTO__((int, __V_
*, int));
494 extern __MANGLE__
time_t time
__PROTO__((time_t*));
495 extern __MANGLE__
int unlink
__PROTO__((const char*));
496 extern __MANGLE__
int write
__PROTO__((int, const __V_
*, int));
503 extern __MANGLE__
void ppassert
__PROTO__((int, char*, char*));
504 extern __MANGLE__
void ppbuiltin
__PROTO__((void));
505 extern __MANGLE__
int ppcall
__PROTO__((struct ppsymbol
*, int));
506 extern __MANGLE__
int ppcontrol
__PROTO__((void));
507 extern __MANGLE__
void ppdump
__PROTO__((void));
508 extern __MANGLE__
char* ppexpand
__PROTO__((char*));
509 extern __MANGLE__
long ppexpr
__PROTO__((int*));
510 extern __MANGLE__
void ppfsm
__PROTO__((int, char*));
511 extern __MANGLE__
char* ppinstr
__PROTO__((struct ppinstk
*));
512 extern __MANGLE__
char* ppkeyname
__PROTO__((int, int));
513 extern __MANGLE__
char* pplexstr
__PROTO__((int));
514 extern __MANGLE__
void ppload
__PROTO__((char*));
515 extern __MANGLE__
void ppmapinclude
__PROTO__((char*, char*));
516 extern __MANGLE__
char* ppmodestr
__PROTO__((long));
517 extern __MANGLE__
int ppmultiple
__PROTO__((struct ppfile
*, struct ppsymbol
*));
518 extern __MANGLE__
void ppnest
__PROTO__((void));
519 extern __MANGLE__
int ppoption
__PROTO__((char*));
520 extern __MANGLE__
char* ppoptionstr
__PROTO__((long));
521 extern __MANGLE__
void pppclose
__PROTO__((char*));
522 extern __MANGLE__
int pppdrop
__PROTO__((char*));
523 extern __MANGLE__
char* pppopen
__PROTO__((char*, int, char*, char*, char*, char*, int));
524 extern __MANGLE__
int pppread
__PROTO__((char*));
525 extern __MANGLE__
int pppredargs
__PROTO__((void));
526 extern __MANGLE__
void pppush
__PROTO__((int, char*, char*, int));
527 extern __MANGLE__
struct ppsymbol
* pprefmac
__PROTO__((char*, int));
528 extern __MANGLE__
int ppsearch
__PROTO__((char*, int, int));
529 extern __MANGLE__
int ppset
__PROTO__((long*, long, int));
530 extern __MANGLE__
char* ppstatestr
__PROTO__((long));
531 extern __MANGLE__
char* pptokstr
__PROTO__((char*, int));
532 extern __MANGLE__
void pptrace
__PROTO__((int));
534 #line 30 "../../lib/libpp/ppfsm.c"
536 #line 1 "../../lib/libpp/ppfsm.h"
541 extern __MANGLE__
short _pp_fsmtab
[(0+28)+1][255+1];
547 extern __MANGLE__
char _pp_trigraph
[255+1];
549 extern __MANGLE__
void _pp_refill
__PROTO__((int));
551 #line 31 "../../lib/libpp/ppfsm.c"
562 static struct fsminit fsminit
[] =
565 { 0, { 023 }, ((0+28)+11), },
566 { 0, { 002 }, (0), },
567 { 0, { 001 }, (0+23), },
568 { 0, { '.' }, (0+25), },
569 { 0, { 021 }, (0+19), },
570 { 0, { 'L' }, (0+20), },
571 { 0, { 'd', 'e', 'f', 'i' }, (0+1), },
572 { 0, { 'r', 's', 't', 'v' }, (0+1), },
573 { 0, { 'w', 'N' }, (0+1), },
574 { 0, { '"', '\'' }, ((0+28)+3), },
575 { 0, { '/' }, (0+12), },
576 { 0, { '\n' }, ((0+28)+7), },
577 { 0, { ' ','\t','\f','\013' }, (0+27), },
580 { (0+1), { 023 }, ((0+28)+6), },
581 { (0+1), { 021, 001 }, (0+19), },
582 { (0+1), { 'a' }, (0+2), },
583 { (0+1), { 'e' }, (0+3), },
584 { (0+1), { 'f' }, (0+4), },
585 { (0+1), { 'h' }, (0+5), },
586 { (0+1), { 'l' }, (0+6), },
587 { (0+1), { 'n' }, (0+7), },
588 { (0+1), { 'o' }, (0+8), },
589 { (0+1), { 't' }, (0+9), },
590 { (0+1), { 'x' }, (0+10), },
591 { (0+1), { 'y' }, (0+11), },
594 { (0+2), { 023 }, (((0+28)+12)), },
595 { (0+2), { 021, 001 }, (0+19), },
596 { (0+2), { '_','s','t','a' }, (0+2), },
597 { (0+2), { 'r' }, (0+2), },
600 { (0+3), { 023 }, (((0+28)+12)), },
601 { (0+3), { 021, 001 }, (0+19), },
602 { (0+3), { 't','u','r','n' }, (0+3), },
605 { (0+4), { 023 }, (((0+28)+12)), },
606 { (0+4), { 021, 001 }, (0+19), },
609 { (0+5), { 023 }, (((0+28)+12)), },
610 { (0+5), { 021, 001 }, (0+19), },
611 { (0+5), { 'i','l','e' }, (0+5), },
614 { (0+6), { 023 }, (((0+28)+12)), },
615 { (0+6), { 021, 001 }, (0+19), },
616 { (0+6), { 's','e' }, (0+6), },
619 { (0+7), { 023 }, (((0+28)+12)), },
620 { (0+7), { 021, 001 }, (0+19), },
621 { (0+7), { 'l','i','n','e' }, (0+7), },
624 { (0+8), { 023 }, (((0+28)+12)), },
625 { (0+8), { 021, 001 }, (0+19), },
626 { (0+8), { 'r','i','d','N' }, (0+8), },
629 { (0+9), { 023 }, (((0+28)+12)), },
630 { (0+9), { 021, 001 }, (0+19), },
631 { (0+9), { 'a','t','i','c' }, (0+9), },
634 { (0+10), { 023 }, (((0+28)+12)), },
635 { (0+10), { 021, 001 }, (0+19), },
636 { (0+10), { 't','e','r','n' }, (0+10), },
639 { (0+11), { 023 }, (((0+28)+12)), },
640 { (0+11), { 021, 001 }, (0+19), },
641 { (0+11), { 'p','e','d','f' }, (0+11), },
644 { (0+12), { 023 }, ((0+28)+0), },
645 { (0+12), { '*' }, (0+13), },
647 { (0+12), { '/' }, (0+16), },
651 { (0+13), { 023 }, (0+13), },
652 { (0+13), { '\n', 002 }, ((0+28)+1), },
653 { (0+13), { '/' }, (0+15), },
654 { (0+13), { '*' }, (0+14), },
655 { (0+13), { '#', ';', ')' }, ((( (0+13))<<(7+1))|(((0+28)+8))), },
658 { (0+14), { 023 }, (0+13), },
659 { (0+14), { '\n', 002 }, ((0+28)+1), },
660 { (0+14), { '#', ';', ')' }, ((( (0+13))<<(7+1))|(((0+28)+8))), },
661 { (0+14), { '*' }, (0+14), },
662 { (0+14), { '/' }, ((0+28)+1), },
665 { (0+15), { 023 }, (0+13), },
666 { (0+15), { '*', '\n', 002 }, ((0+28)+1), },
667 { (0+15), { '/' }, (0+15), },
670 { (0+16), { 023 }, (0+16), },
671 { (0+16), { '\n', 002 }, ((0+28)+1), },
672 { (0+16), { '/' }, (0+17), },
673 { (0+16), { '*' }, (0+18), },
676 { (0+17), { 023 }, (0+16), },
677 { (0+17), { '*', '\n', 002 }, ((0+28)+1), },
678 { (0+17), { '/' }, (0+17), },
681 { (0+18), { 023 }, (0+16), },
682 { (0+18), { '\n', 002 }, ((0+28)+1), },
683 { (0+18), { '*' }, (0+18), },
684 { (0+18), { '/' }, ((0+28)+1), },
687 { (0+19), { 023 }, ((0+28)+6), },
688 { (0+19), { 021, 001 }, (0+19), },
691 { (0+25), { 023 }, ((0+28)+0), },
692 { (0+25), { '.' }, (0+26), },
693 { (0+25), { 001 }, (0+23), },
696 { (0+26), { 023 }, (((( (0401+1))-0401)<<(7+1))|( ((0+28)+14))), },
697 { (0+26), { '.' }, (((( (0401+29))-0401)<<(7+1))|( ((0+28)+13))), },
700 { (0+20), { 023 }, ((0+28)+6), },
701 { (0+20), { 021, 001 }, (0+19), },
702 { (0+20), { '"', '\'' }, ((( (0+21))<<(7+1))|(((0+28)+8))), },
705 { (0+21), { 023 }, (0+21), },
706 { (0+21), { '"', '\'' }, ((0+28)+4), },
707 { (0+21), { '\n', 002 }, ((0+28)+4), },
708 { (0+21), { '\\' }, (0+22), },
711 { (0+22), { 023 }, ((0+28)+5), },
712 { (0+22), { '\n', 002 }, ((0+28)+4), },
715 { (0+23), { 023 }, (((( (0401+1))-0401)<<(7+1))|( ((0+28)+14))), },
716 { (0+23), { 021, 001, '.' }, (0+23), },
717 { (0+23), { 'e', 'E' }, (0+24), },
720 { (0+24), { 023 }, (((( (0401+1))-0401)<<(7+1))|( ((0+28)+14))), },
721 { (0+24), { 021, 001, '.' }, (0+23), },
722 { (0+24), { '+', '-' }, (0+23), },
725 { (0+27), { 023 }, ((0+28)+15), },
726 { (0+27), { ' ', '\t' }, (0+27), },
727 { (0+27), { '\f', '\013' }, ((0+28)+10), },
922 short _pp_fsmtab
[(0+28)+1][255+1];
924 char _pp_trigraph
[255+1];
927 static char spl
[] = { '\\', '\r', 0 };
928 static char aln
[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$@";
933 static char* let
= &aln
[10];
934 static char hex
[] = "fedcbaFEDCBA9876543210";
935 static char* dec
= &hex
[12];
936 static char* oct
= &hex
[14];
944 ppfsm
__PARAM__((int op
, register char* s
), (op
, s
)) __OTORP__(int op
; register char* s
;){
949 register struct fsminit
* fp
;
987 for (fp
= fsminit
;; fp
++)
989 if ((n
= fp
->nextstate
) >= (0+28)) n
= ~n
;
990 if (fp
->state
== (-1))
1007 rp
= _pp_fsmtab
[fp
->state
];
1008 for (i
= 0; i
< sizeof(fp
->ch
) && (c
= fp
->ch
[i
]); i
++)
1013 for (c
= 0; c
<= 255; c
++)
1018 _pp_fsmtab
[(0+28)][fp
->state
+1] = n
< 0 ? ~n
: n
;
1051 for (i
= 0; i
< (0+28); i
++)
1056 if (c
!= '@' || !(( rp
)>=_pp_fsmtab
[(0+13)]&&( rp
)<=_pp_fsmtab
[(0+18)]))
1058 if (rp
[c
] >= 0) rp
[c
] = ~rp
[c
];
1061 rp
[0] = ~((0+28)+2);
1062 for (c
= 0; c
<= 255; c
++)
1066 _pp_fsmtab
[(0+28)][0] = ~((0+28)+2);
1278 #line 37 "../../lib/libpp/ppproto.c"
1280 #line 1 "../../../include/ast/hashkey.h"
1288 extern __MANGLE__
long strkey
__PROTO__((const char*));
1290 #line 39 "../../lib/libpp/ppproto.c"
1293 typedef struct Key_s
1301 typedef struct Proto_s
1336 static const Key_t pragmas
[] =
1338 { "prototyped",sizeof( "prototyped")-1, 0x01, 1},
1339 { "noprototyped",sizeof( "noprototyped")-1, 0x01, 0},
1340 { "noticed",sizeof( "noticed")-1, 0x02, 1},
1341 { "nonoticed",sizeof( "nonoticed")-1, 0x02, 0},
1344 static const Key_t notices
[] =
1346 { "Copyright",sizeof( "Copyright")-1, 0x02, 1},
1347 { "COPYRIGHT",sizeof( "COPYRIGHT")-1, 0x02, 1},
1348 { "copyright",sizeof( "copyright")-1, 0x02, 1},
1349 { "Public Domain",sizeof( "Public Domain")-1, 0x02, 0},
1350 { "PUBLIC DOMAIN",sizeof( "PUBLIC DOMAIN")-1, 0x02, 0},
1359 number
__PARAM__((register char* p
, register long n
), (p
, n
)) __OTORP__(register char* p
; register long n
;){
1362 for (d
= 1000000; d
> 1; d
/= 10)
1363 if (n
>= d
) *p
++ = '0' + (n
/ d
) % 10;
1364 *p
++ = '0' + n
% 10;
1379 sstrlen
__PARAM__((register const char* s
), (s
)) __OTORP__(register const char* s
;){
1380 register const char* b
;
1382 for (b
= s
; *s
; s
++);
1391 sstrncmp
__PARAM__((register const char* s
, register const char* t
, register int n
), (s
, t
, n
)) __OTORP__(register const char* s
; register const char* t
; register int n
;){
1392 register const char* e
= s
+ n
;
1396 if (*s
!= *t
|| !*s
)
1409 strcopy
__PARAM__((register char* s
, register const char* t
), (s
, t
)) __OTORP__(register char* s
; register const char* t
;){
1410 while (*s
++ = *t
++);
1420 proto_error
__PARAM__((char* iob
, int level
, char* msg
, char* arg
), (iob
, level
, msg
, arg
)) __OTORP__(char* iob
; int level
; char* msg
; char* arg
;){
1424 p
= strcopy(( buf
),( "proto: "));
1427 register Proto_t
* proto
= (Proto_t
*)(iob
- sizeof(Proto_t
));
1434 p
= strcopy(( p
),( proto
->file
));
1439 p
= strcopy(( p
),( "line "));
1440 p
= number(p
, proto
->line
);
1442 else if (proto
->file
)
1443 p
= strcopy(( p
),( proto
->file
));
1447 p
= strcopy(( p
),( msg
));
1451 if (*(p
- 1) != ' ')
1457 p
= strcopy(( p
),( "warning: "));
1458 p
= strcopy(( p
),( msg
));
1462 p
= strcopy(( p
),( arg
));
1465 write(2, buf
, p
- buf
);
1477 memcopy
__PARAM__((register char* s
, register char* t
, int n
), (s
, t
, n
)) __OTORP__(register char* s
; register char* t
; int n
;){
1478 register char* e
= t
+ n
;
1480 while (t
< e
) *s
++ = *t
++;
1484 #line 1 "../../lib/libast/port/astlicense.c"
1489 typedef struct Buffer_s
1497 typedef struct Item_s
1516 static const Item_t key
[] =
1518 { "author",sizeof( "author")-1,0},
1519 { "class",sizeof( "class")-1,0},
1520 { "company",sizeof( "company")-1,0},
1521 { "component",sizeof( "component")-1,0},
1522 { "contributor",sizeof( "contributor")-1,0},
1523 { "corporation",sizeof( "corporation")-1,0},
1524 { "domain",sizeof( "domain")-1,0},
1525 { "id",sizeof( "id")-1,0},
1526 { "incorporation",sizeof( "incorporation")-1,0},
1527 { "license",sizeof( "license")-1,0},
1528 { "location",sizeof( "location")-1,0},
1529 { "name",sizeof( "name")-1,0},
1530 { "notice",sizeof( "notice")-1,0},
1531 { "organization",sizeof( "organization")-1,0},
1532 { "package",sizeof( "package")-1,0},
1533 { "parent",sizeof( "parent")-1,0},
1534 { "query",sizeof( "query")-1,0},
1535 { "since",sizeof( "since")-1,0},
1536 { "source",sizeof( "source")-1,0},
1537 { "start",sizeof( "start")-1,0},
1538 { "type",sizeof( "type")-1,0},
1539 { "url",sizeof( "url")-1,0},
1540 { "urlmd5",sizeof( "urlmd5")-1,0},
1541 { "version",sizeof( "version")-1,0},
1549 static const Item_t lic
[] =
1551 { "none",sizeof( "none")-1, 0},
1552 { "inline",sizeof( "inline")-1, 12},
1553 { "test",sizeof( "test")-1, 2},
1554 { "verbose",sizeof( "verbose")-1, 3},
1555 { "usage",sizeof( "usage")-1, 4},
1556 { "open",sizeof( "open")-1, 5},
1557 { "cpl",sizeof( "cpl")-1, 5},
1558 { "epl",sizeof( "epl")-1, 5},
1559 { "bsd",sizeof( "bsd")-1, 5},
1560 { "zlib",sizeof( "zlib")-1, 5},
1561 { "mit",sizeof( "mit")-1, 5},
1562 { "gpl",sizeof( "gpl")-1, 11},
1563 { "special",sizeof( "special")-1, 12},
1564 { "nonexclusive",sizeof( "nonexclusive")-1, 12},
1565 { "noncommercial",sizeof( "noncommercial")-1, 12},
1566 { "proprietary",sizeof( "proprietary")-1, 15},
1570 typedef struct Notice_s
1576 Item_t item
[(sizeof(key
)/sizeof(key
[0])-1)];
1586 lookup
__PARAM__((register const Item_t
* item
, const char* name
, int size
), (item
, name
, size
)) __OTORP__(register const Item_t
* item
; const char* name
; int size
;){
1591 for (i
= 0; item
[i
].data
; i
++)
1592 if (c
== item
[i
].data
[0] && size
== item
[i
].size
&& !sstrncmp( name
, item
[i
].data
, size
))
1603 copy
__PARAM__((register Buffer_t
* b
, register char* s
, int n
), (b
, s
, n
)) __OTORP__(register Buffer_t
* b
; register char* s
; int n
;){
1607 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( *s
++)):(( *s
++),(-1)));
1613 comment
__PARAM__((Notice_t
* notice
, register Buffer_t
* b
, register char* s
, register int n
, int u
), (notice
, b
, s
, n
, u
)) __OTORP__(Notice_t
* notice
; register Buffer_t
* b
; register char* s
; register int n
; int u
;){
1624 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( notice
->cc
[n
> 0 ? 0 : 1])):(( notice
->cc
[n
> 0 ? 0 : 1]),(-1)));
1625 for (i
= 0; i
< 70; i
++)
1626 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( cc
)):(( cc
),(-1)));
1627 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( notice
->cc
[n
> 0 ? 1 : 2])):(( notice
->cc
[n
> 0 ? 1 : 2]),(-1)));
1636 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( cc
)):(( cc
),(-1)));
1637 m
= (u
< 0) ? 1 : (70 - n
) / 2;
1638 if ((x
= 70 - m
- n
) < 0)
1641 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( ' ')):(( ' '),(-1)));
1645 if (u
> 0 && i
>= 'a' && i
<= 'z')
1647 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( i
)):(( i
),(-1)));
1650 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( ' ')):(( ' '),(-1)));
1651 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( cc
)):(( cc
),(-1)));
1653 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( '\n')):(( '\n'),(-1)));
1661 expand
__PARAM__((Notice_t
* notice
, register Buffer_t
* b
, const Item_t
* item
), (notice
, b
, item
)) __OTORP__(Notice_t
* notice
; register Buffer_t
* b
; const Item_t
* item
;){
1679 if (*t
== '$' && t
< (e
+ 2) && *(t
+ 1) == '{')
1683 while (t
< e
&& (c
= *t
++) != '}')
1696 if ((c
= lookup(key
, x
, t
- x
- 1)) >= 0 && (x
= notice
->item
[c
].data
))
1698 z
= x
+ notice
->item
[c
].size
;
1702 if (!m
|| c
>= '0' && c
<= '9')
1703 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( c
)):(( c
),(-1)));
1715 if ((c
= *t
++) == '{')
1717 else if (c
== '}' && !--k
)
1721 else if (q
> 0 && *t
== '\\' && (*(t
+ 1) == q
|| *(t
+ 1) == '\\'))
1723 else if (*t
== '}' && i
)
1729 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( *t
++)):(( *t
++),(-1)));
1739 copyright
__PARAM__((Notice_t
* notice
, register Buffer_t
* b
), (notice
, b
)) __OTORP__(Notice_t
* notice
; register Buffer_t
* b
;){
1744 copy(b
, "Copyright (c) ", -1);
1747 clock
= (time_t)1000212300;
1748 t
= ctime(&clock
) + 20;
1750 else if (!(t
= notice
->item
[18].data
))
1753 t
= ctime(&clock
) + 20;
1755 if ((x
= notice
->item
[19].data
) && sstrncmp( t
, x
, 4) < 0)
1757 if ((x
= notice
->item
[17].data
) && sstrncmp( x
, t
, 4) < 0)
1759 expand(notice
, b
, ¬ice
->item
[17]);
1760 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( '-')):(( '-'),(-1)));
1763 if (notice
->item
[15].data
)
1765 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( ' ')):(( ' '),(-1)));
1766 expand(notice
, b
, ¬ice
->item
[15]);
1768 if (notice
->item
[5].data
)
1770 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( ' ')):(( ' '),(-1)));
1771 expand(notice
, b
, ¬ice
->item
[5]);
1772 if (notice
->item
[8].data
)
1774 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( ' ')):(( ' '),(-1)));
1775 expand(notice
, b
, ¬ice
->item
[8]);
1778 else if (notice
->item
[2].data
)
1780 ((( b
)->nxt
<( b
)->end
)?(*( b
)->nxt
++=( ' ')):(( ' '),(-1)));
1781 expand(notice
, b
, ¬ice
->item
[2]);
1785 typedef struct Stack_s
1794 push
__PARAM__((Stack_t
* sp
, char* file
, char* parent
, char* info
, int size
, Buffer_t
* buf
), (sp
, file
, parent
, info
, size
, buf
)) __OTORP__(Stack_t
* sp
; char* file
; char* parent
; char* info
; int size
; Buffer_t
* buf
;){
1803 copy(buf
, file
, -1);
1804 copy(buf
, ": no space", -1);
1805 ((( buf
)->nxt
<( buf
)->end
)?(*( buf
)->nxt
++=( 0)):(( 0),(-1)));
1808 if (*file
!= '/' && parent
&& (s
= strrchr(parent
, '/')))
1811 if ((sstrlen( file
) + n
+ 1) <= sizeof(path
))
1813 memcopy( path
, parent
, n
);
1814 strcopy( path
+ n
, file
);
1818 if ((i
= open(file
, O_RDONLY
|0)) < 0)
1822 for (s
= path
; *s
; s
++)
1823 if (s
[0] == '/' && s
[1] == 'a' && s
[2] == 'r' && s
[3] == 'c' && s
[4] == 'h' && s
[5] == '/')
1826 for (s
+= 6; *s
&& *s
!= '/'; s
++);
1827 while (*t
++ = *s
++);
1828 i
= open(file
, O_RDONLY
|0);
1832 copy(buf
, file
, -1);
1833 copy(buf
, ": cannot open", -1);
1834 ((( buf
)->nxt
<( buf
)->end
)?(*( buf
)->nxt
++=( 0)):(( 0),(-1)));
1838 n
= read(i
, info
, size
- 1);
1842 copy(buf
, file
, -1);
1843 copy(buf
, ": cannot read", -1);
1844 ((( buf
)->nxt
<( buf
)->end
)?(*( buf
)->nxt
++=( 0)):(( 0),(-1)));
1862 astlicense
__PARAM__((char* p
, int size
, char* file
, char* options
, int cc1
, int cc2
, int cc3
), (p
, size
, file
, options
, cc1
, cc2
, cc3
)) __OTORP__(char* p
; int size
; char* file
; char* options
; int cc1
; int cc2
; int cc3
;){
1877 char tmpbuf
[(70+4)];
1878 char info
[8 * 1024];
1885 buf
.end
= (buf
.buf
= buf
.nxt
= p
) + size
;
1886 tmp
.end
= (tmp
.buf
= tmp
.nxt
= tmpbuf
) + sizeof(tmpbuf
);
1893 input
[level
].file
= "<options>";
1894 input
[level
].info
= options
;
1895 input
[level
].line
= 0;
1899 if (push(&input
[++level
], file
, 0, data
, &info
[sizeof(info
)] - data
, &buf
))
1901 data
+= input
[level
].size
;
1905 s
= input
[level
].info
;
1913 for (i
= 0; i
< (sizeof(key
)/sizeof(key
[0])-1); i
++)
1914 notice
.item
[i
].data
= 0;
1915 notice
.item
[20] = notice
.item
[1] = lic
[notice
.type
];
1916 notice
.item
[20].quote
= notice
.item
[1].quote
= 0;
1917 contributor
= i
= k
= 0;
1923 while (c
== ' ' || c
== '\t' || c
== '\n' && ++input
[level
].line
|| c
== '\r' || c
== ',' || c
== ';' || c
== ')')
1929 while (*++s
&& *s
!= '\n');
1932 input
[level
].line
++;
1937 while ((c
= *++s
) && (c
== ' ' || c
== '\t'));
1939 while (c
&& c
!= ' ' && c
!= '\t' && c
!= '\r' && c
!= '\n')
1942 while (c
&& c
!= '\n')
1946 input
[level
].info
= s
+ (c
!= 0);
1947 if (++level
>= (sizeof(input
) / sizeof(input
[0])) || push(&input
[level
], file
, input
[level
-1].file
, data
, &info
[sizeof(info
)] - data
, &buf
))
1949 data
+= input
[level
].size
;
1950 s
= input
[level
].info
;
1957 input
[level
].line
++;
1964 while (c
&& c
!= '+' && c
!= '=' && c
!= ']' && c
!= ')' && c
!= ',' && c
!= ' ' && c
!= '\t' && c
!= '\n' && c
!= '\r')
1967 h
= lookup(key
, x
, n
);
1968 if (c
== '+' || c
== ']')
1971 if (c
== '=' || first
)
1975 q
= ((c
= *++s
) == '"' || c
== '\'') ? *s
++ : 0;
2006 else if (i
== *(s
- 1))
2010 if (*s
== i
&& i
== '"')
2014 input
[level
].line
++;
2025 while ((c
= *s
) && (q
== '"' && (c
== '\\' && (*(s
+ 1) == '"' || *(s
+ 1) == '\\') && s
++ && (quote
= q
)) || q
&& c
!= q
|| !q
&& c
!= ' ' && c
!= '\t' && c
!= '\n' && c
!= '\r' && c
!= ',' && c
!= ';'))
2028 input
[level
].line
++;
2038 input
[level
].line
++;
2041 for (i
= 0; i
< notice
.ids
; i
++)
2042 if (n
== notice
.id
[i
].name
.size
&& !sstrncmp( x
, notice
.id
[i
].name
.data
, n
))
2046 notice
.id
[i
].name
.data
= x
;
2047 notice
.id
[i
].name
.size
= n
;
2048 notice
.id
[i
].name
.quote
= 0;
2049 notice
.id
[i
].value
.data
= v
;
2050 notice
.id
[i
].value
.size
= s
- v
;
2051 notice
.id
[i
].value
.quote
= quote
;
2052 if (notice
.ids
<= i
)
2058 if ((s
- v
) == 3 && v
[0] == 'a' && v
[1] == 'l' && v
[2] == 'l')
2060 for (i
= 0; i
< (sizeof(key
)/sizeof(key
[0])-1); i
++)
2061 if (notice
.item
[i
].size
)
2063 expand(¬ice
, &buf
, &key
[i
]);
2064 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( '=')):(( '='),(-1)));
2066 if (h
>= notice
.item
[i
].size
)
2071 else if (notice
.item
[i
].data
[h
] == ' ' || notice
.item
[i
].data
[h
] == '\t')
2074 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( '\'')):(( '\''),(-1)));
2075 expand(¬ice
, &buf
, ¬ice
.item
[i
]);
2077 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( '\'')):(( '\''),(-1)));
2078 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( '\n')):(( '\n'),(-1)));
2083 if ((h
= lookup(key
, v
, s
- v
)) < 0)
2088 expand(¬ice
, &buf
, &item
);
2091 expand(¬ice
, &buf
, ¬ice
.item
[h
]);
2092 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( '\n')):(( '\n'),(-1)));
2094 return (*(( &buf
)->nxt
>=( &buf
)->end
?(( &buf
)->nxt
=( &buf
)->end
-1):( &buf
)->nxt
)=0,( &buf
)->nxt
-( &buf
)->buf
);
2099 switch (c
= lookup(lic
, v
, s
- v
))
2120 notice
.item
[1].data
= lic
[lic
[c
].quote
].data
;
2121 notice
.item
[1].size
= lic
[lic
[c
].quote
].size
;
2122 if (notice
.item
[20].data
!= lic
[0].data
)
2128 notice
.item
[h
].data
= (notice
.item
[h
].size
= s
- v
) ? v
: (char*)0;
2129 notice
.item
[h
].quote
= quote
;
2136 if (input
[level
].file
)
2138 copy(&buf
, "\"", -1);
2139 copy(&buf
, input
[level
].file
, -1);
2140 copy(&buf
, "\", line ", -1);
2141 x
= &tmpbuf
[sizeof(tmpbuf
)];
2143 n
= ++input
[level
].line
;
2144 do *--x
= ("0123456789")[n
% 10]; while (n
/= 10);
2146 copy(&buf
, ": ", -1);
2148 copy(&buf
, "option error: assignment expected", -1);
2149 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( 0)):(( 0),(-1)));
2158 s
= input
[level
].info
;
2162 if (notice
.type
== 1 && (!notice
.verbose
|| !notice
.item
[12].data
))
2164 if (notice
.type
!= 4)
2168 comment(¬ice
, &buf
, ((char*)0), 1, 0);
2169 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2170 if (notice
.item
[14].data
)
2172 copy(&tmp
, "This software is part of the ", -1);
2173 expand(¬ice
, &tmp
, ¬ice
.item
[14]);
2174 copy(&tmp
, " package", -1);
2175 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2177 if (notice
.type
>= 5)
2179 copyright(¬ice
, &tmp
);
2180 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2181 if (notice
.type
>= 12)
2182 comment( ¬ice
, &buf
, "All Rights Reserved",sizeof( "All Rights Reserved")-1, 0);
2184 if (notice
.type
== 6 || notice
.type
== 7)
2186 copy(&tmp
, notice
.item
[14].data
? "and": "This software", -1);
2187 copy(&tmp
, " is licensed under the", -1);
2188 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2189 if (notice
.type
== 7)
2190 copy(&tmp
, "Eclipse Public License", -1);
2192 copy(&tmp
, "Common Public License", -1);
2193 if (notice
.item
[23].data
)
2195 copy(&tmp
, ", Version ", -1);
2196 expand(¬ice
, &tmp
, ¬ice
.item
[23]);
2198 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2199 if (notice
.item
[5].data
|| notice
.item
[2].data
)
2201 copy(&tmp
, "by ", -1);
2202 if (notice
.item
[15].data
)
2204 expand(¬ice
, &tmp
, ¬ice
.item
[15]);
2205 copy(&tmp
, " ", -1);
2207 if (notice
.item
[5].data
)
2209 expand(¬ice
, &tmp
, ¬ice
.item
[5]);
2210 if (notice
.item
[8].data
)
2212 copy(&tmp
, " ", -1);
2213 expand(¬ice
, &tmp
, ¬ice
.item
[8]);
2216 else if (notice
.item
[2].data
)
2217 expand(¬ice
, &tmp
, ¬ice
.item
[2]);
2218 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2220 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2221 comment( ¬ice
, &buf
, "A copy of the License is available at",sizeof( "A copy of the License is available at")-1, 0);
2222 if (notice
.item
[21].data
)
2224 expand(¬ice
, &tmp
, ¬ice
.item
[21]);
2225 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2226 if (notice
.item
[22].data
)
2228 copy(&tmp
, "(with md5 checksum ", -1);
2229 expand(¬ice
, &tmp
, ¬ice
.item
[22]);
2230 copy(&tmp
, ")", -1);
2231 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2234 else if (notice
.type
== 7)
2235 comment( ¬ice
, &buf
, "http://www.eclipse.org/org/documents/epl-v10.html",sizeof( "http://www.eclipse.org/org/documents/epl-v10.html")-1, 0);
2237 comment( ¬ice
, &buf
, "http://www.opensource.org/licenses/cpl",sizeof( "http://www.opensource.org/licenses/cpl")-1, 0);
2238 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2240 else if (notice
.type
== 5)
2242 copy(&tmp
, notice
.item
[14].data
? "and it": "This software", -1);
2243 copy(&tmp
, " may only be used by you under license from", -1);
2244 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2245 if (notice
.item
[i
= 5].data
)
2247 if (notice
.item
[15].data
)
2249 expand(¬ice
, &tmp
, ¬ice
.item
[i
= 15]);
2250 copy(&tmp
, " ", -1);
2252 expand(¬ice
, &tmp
, ¬ice
.item
[5]);
2253 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2255 else if (notice
.item
[i
= 2].data
)
2257 if (notice
.item
[15].data
)
2259 expand(¬ice
, &tmp
, ¬ice
.item
[i
= 15]);
2260 copy(&tmp
, " ", -1);
2262 expand(¬ice
, &tmp
, ¬ice
.item
[2]);
2263 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2267 if (notice
.item
[21].data
)
2269 comment( ¬ice
, &buf
, "A copy of the Source Code Agreement is available",sizeof( "A copy of the Source Code Agreement is available")-1, 0);
2270 copy(&tmp
, "at the ", -1);
2272 expand(¬ice
, &tmp
, ¬ice
.item
[i
]);
2273 copy(&tmp
, " Internet web site URL", -1);
2274 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2275 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2276 expand(¬ice
, &tmp
, ¬ice
.item
[21]);
2277 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2278 if (notice
.item
[22].data
)
2280 copy(&tmp
, "(with an md5 checksum of ", -1);
2281 expand(¬ice
, &tmp
, ¬ice
.item
[22]);
2282 copy(&tmp
, ")", -1);
2283 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2285 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2287 comment( ¬ice
, &buf
, "If you have copied or used this software without agreeing",sizeof( "If you have copied or used this software without agreeing")-1, 0);
2288 comment( ¬ice
, &buf
, "to the terms of the license you are infringing on",sizeof( "to the terms of the license you are infringing on")-1, 0);
2289 comment( ¬ice
, &buf
, "the license and copyright and are violating",sizeof( "the license and copyright and are violating")-1, 0);
2291 expand(¬ice
, &tmp
, ¬ice
.item
[i
]);
2292 copy(&tmp
, "'s", -1);
2294 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2296 ((( &tmp
)->nxt
<( &tmp
)->end
)?(*( &tmp
)->nxt
++=( ' ')):(( ' '),(-1)));
2297 copy(&tmp
, "intellectual property rights.", -1);
2298 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2299 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2301 else if (notice
.type
== 11)
2303 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2304 comment( ¬ice
, &buf
, "This is free software; you can redistribute it and/or",sizeof( "This is free software; you can redistribute it and/or")-1, 0);
2305 comment( ¬ice
, &buf
, "modify it under the terms of the GNU General Public License",sizeof( "modify it under the terms of the GNU General Public License")-1, 0);
2306 comment( ¬ice
, &buf
, "as published by the Free Software Foundation;",sizeof( "as published by the Free Software Foundation;")-1, 0);
2307 comment( ¬ice
, &buf
, "either version 2, or (at your option) any later version.",sizeof( "either version 2, or (at your option) any later version.")-1, 0);
2308 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2309 comment( ¬ice
, &buf
, "This software is distributed in the hope that it",sizeof( "This software is distributed in the hope that it")-1, 0);
2310 comment( ¬ice
, &buf
, "will be useful, but WITHOUT ANY WARRANTY;",sizeof( "will be useful, but WITHOUT ANY WARRANTY;")-1, 0);
2311 comment( ¬ice
, &buf
, "without even the implied warranty of MERCHANTABILITY",sizeof( "without even the implied warranty of MERCHANTABILITY")-1, 0);
2312 comment( ¬ice
, &buf
, "or FITNESS FOR A PARTICULAR PURPOSE.",sizeof( "or FITNESS FOR A PARTICULAR PURPOSE.")-1, 0);
2313 comment( ¬ice
, &buf
, "See the GNU General Public License for more details.",sizeof( "See the GNU General Public License for more details.")-1, 0);
2314 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2315 comment( ¬ice
, &buf
, "You should have received a copy of the",sizeof( "You should have received a copy of the")-1, 0);
2316 comment( ¬ice
, &buf
, "GNU General Public License",sizeof( "GNU General Public License")-1, 0);
2317 comment( ¬ice
, &buf
, "along with this software (see the file COPYING.)",sizeof( "along with this software (see the file COPYING.)")-1, 0);
2318 comment( ¬ice
, &buf
, "If not, a copy is available at",sizeof( "If not, a copy is available at")-1, 0);
2319 comment( ¬ice
, &buf
, "http://www.gnu.org/copyleft/gpl.html",sizeof( "http://www.gnu.org/copyleft/gpl.html")-1, 0);
2320 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2322 else if (notice
.type
== 8)
2324 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2325 comment( ¬ice
, &buf
, "Redistribution and use in source and binary forms, with or",sizeof( "Redistribution and use in source and binary forms, with or")-1, -1);
2326 comment( ¬ice
, &buf
, "without modification, are permitted provided that the following",sizeof( "without modification, are permitted provided that the following")-1, -1);
2327 comment( ¬ice
, &buf
, "conditions are met:",sizeof( "conditions are met:")-1, -1);
2328 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2329 comment( ¬ice
, &buf
, " 1. Redistributions of source code must retain the above",sizeof( " 1. Redistributions of source code must retain the above")-1, -1);
2330 comment( ¬ice
, &buf
, " copyright notice, this list of conditions and the",sizeof( " copyright notice, this list of conditions and the")-1, -1);
2331 comment( ¬ice
, &buf
, " following disclaimer.",sizeof( " following disclaimer.")-1, -1);
2332 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2333 comment( ¬ice
, &buf
, " 2. Redistributions in binary form must reproduce the above",sizeof( " 2. Redistributions in binary form must reproduce the above")-1, -1);
2334 comment( ¬ice
, &buf
, " copyright notice, this list of conditions and the",sizeof( " copyright notice, this list of conditions and the")-1, -1);
2335 comment( ¬ice
, &buf
, " following disclaimer in the documentation and/or other",sizeof( " following disclaimer in the documentation and/or other")-1, -1);
2336 comment( ¬ice
, &buf
, " materials provided with the distribution.",sizeof( " materials provided with the distribution.")-1, -1);
2337 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2338 copy(&tmp
, " 3. Neither the name of ", -1);
2339 if (notice
.item
[i
= 15].data
|| notice
.item
[i
= 5].data
|| notice
.item
[i
= 2].data
)
2340 expand(¬ice
, &tmp
, ¬ice
.item
[i
]);
2342 copy(&tmp
, "the copyright holder", -1);
2343 copy(&tmp
, " nor the", -1);
2344 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), -1);
2345 comment( ¬ice
, &buf
, " names of its contributors may be used to endorse or",sizeof( " names of its contributors may be used to endorse or")-1, -1);
2346 comment( ¬ice
, &buf
, " promote products derived from this software without",sizeof( " promote products derived from this software without")-1, -1);
2347 comment( ¬ice
, &buf
, " specific prior written permission.",sizeof( " specific prior written permission.")-1, -1);
2348 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2349 comment( ¬ice
, &buf
, "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND",sizeof( "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND")-1, -1);
2350 comment( ¬ice
, &buf
, "CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,",sizeof( "CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,")-1, -1);
2351 comment( ¬ice
, &buf
, "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF",sizeof( "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF")-1, -1);
2352 comment( ¬ice
, &buf
, "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE",sizeof( "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE")-1, -1);
2353 comment( ¬ice
, &buf
, "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS",sizeof( "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS")-1, -1);
2354 comment( ¬ice
, &buf
, "BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,",sizeof( "BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,")-1, -1);
2355 comment( ¬ice
, &buf
, "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED",sizeof( "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED")-1, -1);
2356 comment( ¬ice
, &buf
, "TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,",sizeof( "TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,")-1, -1);
2357 comment( ¬ice
, &buf
, "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON",sizeof( "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON")-1, -1);
2358 comment( ¬ice
, &buf
, "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,",sizeof( "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,")-1, -1);
2359 comment( ¬ice
, &buf
, "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY",sizeof( "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY")-1, -1);
2360 comment( ¬ice
, &buf
, "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE",sizeof( "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE")-1, -1);
2361 comment( ¬ice
, &buf
, "POSSIBILITY OF SUCH DAMAGE.",sizeof( "POSSIBILITY OF SUCH DAMAGE.")-1, -1);
2362 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2364 else if (notice
.type
== 9)
2366 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2367 comment( ¬ice
, &buf
, "This software is provided 'as-is', without any express or implied",sizeof( "This software is provided 'as-is', without any express or implied")-1, -1);
2368 comment( ¬ice
, &buf
, "warranty. In no event will the authors be held liable for any",sizeof( "warranty. In no event will the authors be held liable for any")-1, -1);
2369 comment( ¬ice
, &buf
, "damages arising from the use of this software.",sizeof( "damages arising from the use of this software.")-1, -1);
2370 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2371 comment( ¬ice
, &buf
, "Permission is granted to anyone to use this software for any",sizeof( "Permission is granted to anyone to use this software for any")-1, -1);
2372 comment( ¬ice
, &buf
, "purpose, including commercial applications, and to alter it and",sizeof( "purpose, including commercial applications, and to alter it and")-1, -1);
2373 comment( ¬ice
, &buf
, "redistribute it freely, subject to the following restrictions:",sizeof( "redistribute it freely, subject to the following restrictions:")-1, -1);
2374 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2375 comment( ¬ice
, &buf
, " 1. The origin of this software must not be misrepresented;",sizeof( " 1. The origin of this software must not be misrepresented;")-1, -1);
2376 comment( ¬ice
, &buf
, " you must not claim that you wrote the original software. If",sizeof( " you must not claim that you wrote the original software. If")-1, -1);
2377 comment( ¬ice
, &buf
, " you use this software in a product, an acknowledgment in the",sizeof( " you use this software in a product, an acknowledgment in the")-1, -1);
2378 comment( ¬ice
, &buf
, " product documentation would be appreciated but is not",sizeof( " product documentation would be appreciated but is not")-1, -1);
2379 comment( ¬ice
, &buf
, " required.",sizeof( " required.")-1, -1);
2380 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2381 comment( ¬ice
, &buf
, " 2. Altered source versions must be plainly marked as such,",sizeof( " 2. Altered source versions must be plainly marked as such,")-1, -1);
2382 comment( ¬ice
, &buf
, " and must not be misrepresented as being the original",sizeof( " and must not be misrepresented as being the original")-1, -1);
2383 comment( ¬ice
, &buf
, " software.",sizeof( " software.")-1, -1);
2384 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2385 comment( ¬ice
, &buf
, " 3. This notice may not be removed or altered from any source",sizeof( " 3. This notice may not be removed or altered from any source")-1, -1);
2386 comment( ¬ice
, &buf
, " distribution.",sizeof( " distribution.")-1, -1);
2387 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2389 else if (notice
.type
== 10)
2391 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2392 comment( ¬ice
, &buf
, "Permission is hereby granted, free of charge, to any person",sizeof( "Permission is hereby granted, free of charge, to any person")-1, 0);
2393 comment( ¬ice
, &buf
, "obtaining a copy of this software and associated",sizeof( "obtaining a copy of this software and associated")-1, 0);
2394 comment( ¬ice
, &buf
, "documentation files (the \"Software\"), to deal in the",sizeof( "documentation files (the \"Software\"), to deal in the")-1, 0);
2395 comment( ¬ice
, &buf
, "Software without restriction, including without limitation",sizeof( "Software without restriction, including without limitation")-1, 0);
2396 comment( ¬ice
, &buf
, "the rights to use, copy, modify, merge, publish, distribute,",sizeof( "the rights to use, copy, modify, merge, publish, distribute,")-1, 0);
2397 comment( ¬ice
, &buf
, "sublicense, and/or sell copies of the Software, and to",sizeof( "sublicense, and/or sell copies of the Software, and to")-1, 0);
2398 comment( ¬ice
, &buf
, "permit persons to whom the Software is furnished to do so,",sizeof( "permit persons to whom the Software is furnished to do so,")-1, 0);
2399 comment( ¬ice
, &buf
, "subject to the following conditions:",sizeof( "subject to the following conditions:")-1, 0);
2400 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2401 comment( ¬ice
, &buf
, "The above copyright notice and this permission notice shall",sizeof( "The above copyright notice and this permission notice shall")-1, 0);
2402 comment( ¬ice
, &buf
, "be included in all copies or substantial portions of the",sizeof( "be included in all copies or substantial portions of the")-1, 0);
2403 comment( ¬ice
, &buf
, "Software.",sizeof( "Software.")-1, 0);
2404 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2405 comment( ¬ice
, &buf
, "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY",sizeof( "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY")-1, 0);
2406 comment( ¬ice
, &buf
, "KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE",sizeof( "KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE")-1, 0);
2407 comment( ¬ice
, &buf
, "WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR",sizeof( "WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR")-1, 0);
2408 comment( ¬ice
, &buf
, "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS",sizeof( "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS")-1, 0);
2409 comment( ¬ice
, &buf
, "OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR",sizeof( "OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR")-1, 0);
2410 comment( ¬ice
, &buf
, "OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR",sizeof( "OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR")-1, 0);
2411 comment( ¬ice
, &buf
, "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE",sizeof( "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE")-1, 0);
2412 comment( ¬ice
, &buf
, "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",sizeof( "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.")-1, 0);
2413 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2417 if (notice
.type
== 15)
2419 if (notice
.item
[i
= 15].data
|| notice
.item
[i
= 5].data
|| notice
.item
[i
= 2].data
)
2421 expand(¬ice
, &tmp
, ¬ice
.item
[i
]);
2422 copy(&tmp
, " - ", -1);
2426 copy(&tmp
, "Proprietary", -1);
2427 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 1);
2428 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2429 if (notice
.item
[21].data
)
2431 copy(&tmp
, "This is proprietary source code", -1);
2433 copy(&tmp
, " licensed by", -1);
2434 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 1);
2435 if (notice
.item
[15].data
)
2437 expand(¬ice
, &tmp
, ¬ice
.item
[15]);
2438 copy(&tmp
, " ", -1);
2440 if (notice
.item
[5].data
)
2442 expand(¬ice
, &tmp
, ¬ice
.item
[5]);
2443 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 1);
2445 else if (notice
.item
[2].data
)
2447 expand(¬ice
, &tmp
, ¬ice
.item
[2]);
2448 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 1);
2453 copy(&tmp
, "This is unpublished proprietary source code", -1);
2455 copy(&tmp
, " of", -1);
2456 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 1);
2457 if (notice
.item
[i
= 15].data
|| notice
.item
[i
= 5].data
)
2458 expand(¬ice
, &tmp
, ¬ice
.item
[i
]);
2459 if (notice
.item
[2].data
)
2461 if ((( &tmp
)->nxt
-( &tmp
)->buf
))
2462 ((( &tmp
)->nxt
<( &tmp
)->end
)?(*( &tmp
)->nxt
++=( ' ')):(( ' '),(-1)));
2463 expand(¬ice
, &tmp
, ¬ice
.item
[2]);
2465 if ((( &tmp
)->nxt
-( &tmp
)->buf
))
2466 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 1);
2467 comment( ¬ice
, &buf
, "and is not to be disclosed or used except in",sizeof( "and is not to be disclosed or used except in")-1, 1);
2468 comment( ¬ice
, &buf
, "accordance with applicable agreements",sizeof( "accordance with applicable agreements")-1, 1);
2470 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2472 else if (notice
.type
== 13)
2474 comment( ¬ice
, &buf
, "For nonexclusive individual use",sizeof( "For nonexclusive individual use")-1, 1);
2475 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2477 else if (notice
.type
== 14)
2479 comment( ¬ice
, &buf
, "For noncommercial use",sizeof( "For noncommercial use")-1, 1);
2480 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2482 if (notice
.type
>= 15 && !notice
.item
[21].data
)
2484 comment( ¬ice
, &buf
, "Unpublished & Not for Publication",sizeof( "Unpublished & Not for Publication")-1, 0);
2485 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2487 if (notice
.item
[21].data
)
2489 copy(&tmp
, "This software is licensed", -1);
2490 if (notice
.item
[5].data
|| notice
.item
[2].data
)
2492 copy(&tmp
, " by", -1);
2493 if ((notice
.item
[15].size
+ (notice
.item
[5].data
? (notice
.item
[5].size
+ notice
.item
[8].size
) : notice
.item
[2].size
)) >= ((70-32) - 6))
2494 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2496 ((( &tmp
)->nxt
<( &tmp
)->end
)?(*( &tmp
)->nxt
++=( ' ')):(( ' '),(-1)));
2497 if (notice
.item
[15].data
)
2499 expand(¬ice
, &tmp
, ¬ice
.item
[15]);
2500 copy(&tmp
, " ", -1);
2502 if (notice
.item
[5].data
)
2504 expand(¬ice
, &tmp
, ¬ice
.item
[5]);
2505 if (notice
.item
[8].data
)
2507 copy(&tmp
, " ", -1);
2508 expand(¬ice
, &tmp
, ¬ice
.item
[8]);
2511 else if (notice
.item
[2].data
)
2512 expand(¬ice
, &tmp
, ¬ice
.item
[2]);
2514 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2515 comment( ¬ice
, &buf
, "under the terms and conditions of the license in",sizeof( "under the terms and conditions of the license in")-1, 0);
2516 expand(¬ice
, &tmp
, ¬ice
.item
[21]);
2517 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2518 if (notice
.item
[22].data
)
2520 copy(&tmp
, "(with an md5 checksum of ", -1);
2521 expand(¬ice
, &tmp
, ¬ice
.item
[22]);
2522 copy(&tmp
, ")", -1);
2523 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2525 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2527 else if (notice
.type
== 15)
2529 comment( ¬ice
, &buf
, "The copyright notice above does not evidence any",sizeof( "The copyright notice above does not evidence any")-1, 0);
2530 comment( ¬ice
, &buf
, "actual or intended publication of such source code",sizeof( "actual or intended publication of such source code")-1, 0);
2531 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2534 if (v
= notice
.item
[12].data
)
2536 x
= v
+ notice
.item
[12].size
;
2539 item
.quote
= notice
.item
[12].quote
;
2542 for (item
.data
= v
; v
< x
&& *v
!= '\n'; v
++);
2543 if ((item
.size
= v
- item
.data
) && *item
.data
== '\t')
2551 expand(¬ice
, &tmp
, &item
);
2552 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), h
);
2555 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2557 if (notice
.item
[13].data
)
2559 expand(¬ice
, &tmp
, ¬ice
.item
[13]);
2560 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2561 if (notice
.item
[i
= 15].data
|| notice
.item
[i
= 5].data
)
2562 expand(¬ice
, &tmp
, ¬ice
.item
[i
]);
2563 if (notice
.item
[2].data
)
2565 if ((( &tmp
)->nxt
-( &tmp
)->buf
))
2566 ((( &tmp
)->nxt
<( &tmp
)->end
)?(*( &tmp
)->nxt
++=( ' ')):(( ' '),(-1)));
2567 expand(¬ice
, &tmp
, ¬ice
.item
[2]);
2569 if ((( &tmp
)->nxt
-( &tmp
)->buf
))
2570 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2571 if (notice
.item
[10].data
)
2573 expand(¬ice
, &tmp
, ¬ice
.item
[10]);
2574 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2576 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2579 if (v
= notice
.item
[0].data
)
2581 x
= v
+ notice
.item
[0].size
;
2582 q
= (x
- v
) == 1 && (*v
== '*' || *v
== '-');
2583 k
= q
&& notice
.type
!= 4 ? -1 : 0;
2588 while (v
< x
&& (*v
== ' ' || *v
== '\t' || *v
== '\r' || *v
== '\n' || *v
== ',' || *v
== '+'))
2593 while (v
< x
&& *v
!= ',' && *v
!= '+' && *v
++ != '>');
2594 item
.size
= v
- item
.data
;
2595 item
.quote
= notice
.item
[0].quote
;
2598 for (i
= 0; i
< notice
.ids
; i
++)
2599 if (q
|| item
.size
== notice
.id
[i
].name
.size
&& !sstrncmp( item
.data
, notice
.id
[i
].name
.data
, item
.size
))
2602 if (notice
.type
== 4)
2604 copy(&buf
, "[-author?", -1);
2605 expand(¬ice
, &buf
, ¬ice
.id
[i
].value
);
2606 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( ']')):(( ']'),(-1)));
2612 comment( ¬ice
, &buf
, "CONTRIBUTORS",sizeof( "CONTRIBUTORS")-1, 0);
2613 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2616 expand(¬ice
, &tmp
, ¬ice
.id
[i
].value
);
2617 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2626 if (notice
.type
== 4)
2628 copy(&buf
, "[-author?", -1);
2629 expand(¬ice
, &buf
, &item
);
2630 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( ']')):(( ']'),(-1)));
2636 comment( ¬ice
, &buf
, "CONTRIBUTORS",sizeof( "CONTRIBUTORS")-1, 0);
2637 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2640 expand(¬ice
, &tmp
, &item
);
2641 comment(¬ice
, &buf
, (( &tmp
)->buf
), (( &tmp
)->siz
=( &tmp
)->nxt
-( &tmp
)->buf
,( &tmp
)->nxt
=( &tmp
)->buf
,( &tmp
)->siz
), 0);
2646 comment(¬ice
, &buf
, ((char*)0), 0, 0);
2648 if (notice
.type
== 4)
2650 copy(&buf
, "[-copyright?", -1);
2651 copyright(¬ice
, &buf
);
2652 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( ']')):(( ']'),(-1)));
2653 if (notice
.item
[21].data
)
2655 copy(&buf
, "[-license?", -1);
2656 expand(¬ice
, &buf
, ¬ice
.item
[21]);
2657 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( ']')):(( ']'),(-1)));
2659 ((( &buf
)->nxt
<( &buf
)->end
)?(*( &buf
)->nxt
++=( '\n')):(( '\n'),(-1)));
2662 comment(¬ice
, &buf
, ((char*)0), -1, 0);
2663 return (*(( &buf
)->nxt
>=( &buf
)->end
?(( &buf
)->nxt
=( &buf
)->end
-1):( &buf
)->nxt
)=0,( &buf
)->nxt
-( &buf
)->buf
);
2665 #line 358 "../../lib/libpp/ppproto.c"
2669 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
;){
2671 if (proto
->flags
& (1L<<13))
2675 p
= strcopy(( p
),( "\n#line "));
2691 init
__PARAM__((Proto_t
* proto
, char* op
, int flags
), (proto
, op
, flags
)) __OTORP__(Proto_t
* proto
; char* op
; int flags
;){
2694 if (flags
& (1L<<10))
2698 strcopy(( op
),( "\n#if !defined(__PROTO__)\n# if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)\n# if defined(__cplusplus)\n# define __LINKAGE__ \"C\"\n# else\n# define __LINKAGE__\n# endif\n# define __STDARG__\n# define __PROTO__(x) x\n# define __OTORP__(x)\n# define __PARAM__(n,o) n\n# if !defined(__STDC__) && !defined(__cplusplus)\n# if !defined(c_plusplus)\n# define const\n# endif\n# define signed\n# define void int\n# define volatile\n# define __V_ char\n# else\n# define __V_ void\n# endif\n# else\n# define __PROTO__(x) ()\n# define __OTORP__(x) x\n# define __PARAM__(n,o) o\n# define __LINKAGE__\n# define __V_ char\n# define const\n# define signed\n# define void int\n# define volatile\n# endif\n# define __MANGLE__ __LINKAGE__\n# if defined(__cplusplus) || defined(c_plusplus)\n# define __VARARG__ ...\n# else\n# define __VARARG__\n# endif\n# if defined(__STDARG__)\n# define __VA_START__(p,a) va_start(p,a)\n# else\n# define __VA_START__(p,a) va_start(p)\n# endif\n# if !defined(__INLINE__)\n# if defined(__cplusplus)\n# define __INLINE__ extern __MANGLE__ inline\n# else\n# if defined(_WIN32) && !defined(__GNUC__)\n# define __INLINE__ __inline\n# endif\n# endif\n# endif\n#endif\n#if !defined(__LINKAGE__)\n#define __LINKAGE__ /* 2004-08-11 transition */\n#endif\n"));
2703 strcopy(( op
),( "\n#if !defined(__PROTO__)\n#include <prototyped.h>\n#endif\n#if !defined(__LINKAGE__)\n#define __LINKAGE__ /* 2004-08-11 transition */\n#endif\n"));
2707 #ifndef __MANGLE_%_DATA__\n\
2709 # ifdef __EXPORT__\n\
2710 # define __MANGLE_%_DATA__ __MANGLE__ __EXPORT__\n\
2712 # define __MANGLE_%_DATA__ __MANGLE__\n\
2714 # define __MANGLE_%_FUNC__ __MANGLE__\n\
2716 # ifdef __IMPORT__\n\
2717 # define __MANGLE_%_DATA__ __MANGLE__ __IMPORT__\n\
2719 # define __MANGLE_%_DATA__ __MANGLE__\n\
2721 # define __MANGLE_%_FUNC__ __MANGLE__\n\
2727 switch (*op
++ = *s
++)
2733 op
= strcopy(( op
- 1),( proto
->package
));
2747 nns
__PARAM__((register char* s
), (s
)) __OTORP__(register char* s
;){
2748 while (*s
== ' ' || *s
== '\t' || *s
== '\n')
2756 directive
__PARAM__((register char* s
, int dir
), (s
, dir
)) __OTORP__(register char* s
; int dir
;){
2757 switch (*(s
= nns(s
)))
2786 lex
__PARAM__((register Proto_t
* proto
, register long flags
), (proto
, flags
)) __OTORP__(register Proto_t
* proto
; register long flags
;){
2824 do{(ip
=proto
->ip
);(op
=proto
->op
);call
=proto
->call
;}while(0);
2826 if (flags
& (1L<<5)) (ko
=op
);
2834 rp
= _pp_fsmtab
[state
];
2836 while (!(state
= rp
[c
= (*(unsigned char*)ip
++)]));
2839 } while (state
> 0);
2840 if ((n
= ip
- bp
- 1) > 0)
2843 do switch( n
) { default : memcopy( op
, ip
, n
); op
+= n
; ip
+= n
; break; case 7 : * op
++ = * ip
++; case 6 : * op
++ = * ip
++; case 5 : * op
++ = * ip
++; case 4 : * op
++ = * ip
++; case 3 : * op
++ = * ip
++; case 2 : * op
++ = * ip
++; case 1 : * op
++ = * ip
++; case 0 : break; } while (0);
2848 switch ((( state
)&((1<<(7+1))-1)))
2851 if (op
> proto
->ob
&& *(op
- 1) == '=' && (op
== proto
->ob
+ 1 || *(op
- 2) != '=')) switch (c
)
2872 if ((( rp
)>=_pp_fsmtab
[(0+16)]&&( rp
)<=_pp_fsmtab
[(0+18)])) goto fsm_newline
;
2875 rp
= _pp_fsmtab
[(0+13)];
2879 if ((flags
& ((1L<<5)|(1L<<15))) == (1L<<5)) (op
=ko
);
2883 if ((( rp
)>=_pp_fsmtab
[(0+16)]&&( rp
)<=_pp_fsmtab
[(0+18)]))
2885 rp
= _pp_fsmtab
[(0+16)];
2893 if ((flags
& ((1L<<5)|(1L<<15))) == (1L<<5)) (op
=ko
);
2897 rp
= _pp_fsmtab
[(( rp
)>=_pp_fsmtab
[(0+16)]&&( rp
)<=_pp_fsmtab
[(0+18)]) ? (0+16) : (0+14)];
2906 if (state
= _pp_fsmtab
[(0+28)][((( rp
)-_pp_fsmtab
[0])/(255+1))+1])
2908 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);
2913 if ((flags
& ((1L<<1)|((1L<<16))|(1L<<21))) == ((1L<<16)) && (proto
->flags
& (1L<<16)))
2916 if (!(flags
& (1L<<5)))
2920 if (!(flags
& (1L<<15)))
2925 if (ip
- n
< proto
->ib
)
2926 proto
->flags
|= (1L<<4);
2927 memcopy(proto
->ib
- n
, ip
- n
, n
);
2931 if (flags
& (1L<<15))
2940 if ((n
= read(proto
->fd
, ip
, proto
->iz
)) > 0)
2942 if ((proto
->options
& (1L<<0)) && n
< proto
->iz
)
2944 proto
->flags
&= ~(1L<<16);
2954 proto
->flags
&= ~(1L<<16);
2960 if (!(flags
& (1L<<21)) && (state
= rp
[c
= (255+1)]))
2965 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);
2973 for (n
= 0, t
= qe
+ 1; t
< op
&& (*t
== ' ' || *t
== '\t' || *t
== '\n' && ++n
|| *t
>= 'A' && *t
<= 'Z' || *t
== '_'); t
++);
2985 rp
= _pp_fsmtab
[(0+21)];
2993 if (!(flags
& (1L<<3)))
2994 qe
= (c
== '"') ? op
: (char*)0;
3005 else if (c
!= '\n' && c
!= (255+1))
3027 if (flags
& (1L<<0)) (*op
++=( c
));
3033 n
= (('A'==0301)?0057:0007);
3036 n
= (('A'==0301)?0047:0033);
3042 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);
3043 lex(proto
, (flags
& ((1L<<16))) | (1L<<21));
3044 for (n
= x
= 0; (c
= (*(unsigned char*)ip
++)), x
< 3; x
++) switch (c
)
3046 case '0': case '1': case '2': case '3':
3047 case '4': case '5': case '6': case '7':
3049 n
= (n
<< 4) + c
- '0';
3051 case 'a': case 'b': case 'c': case 'd':
3053 n
= (n
<< 4) + c
- 'a' + 10;
3055 case 'A': case 'B': case 'C': case 'D':
3057 n
= (n
<< 4) + c
- 'A' + 10;
3065 (*op
++=( ((n
>> 6) & 07) + '0'));
3066 (*op
++=( ((n
>> 3) & 07) + '0'));
3067 (*op
++=( (n
& 07) + '0'));
3073 rp
= _pp_fsmtab
[(0+21)];
3080 if ((flags
& (1L<<5)) && *proto
->tp
== 's' && !sstrncmp( proto
->tp
, "static", 6))
3086 if (*proto
->tp
== '_' && !sstrncmp( proto
->tp
, "__STDPP__directive", 6)) c
= '#';
3095 if (flags
& (1L<<5))
3097 if (op
!= proto
->ob
&& (*(op
-1)) != ' ' && (*(op
-1)) != '\n')
3103 if (flags
& (1L<<3))
3106 if (flags
& (1L<<0))
3108 if (flags
& (1L<<5)) (op
=ko
);
3109 if (flags
& (1L<<12))
3112 op
= strcopy(( om
),( "/* "));
3113 op
= strcopy(( op
),( im
));
3114 op
= strcopy(( op
),( " */\n"));
3116 flags
&= ~((1L<<2)|(1L<<3)|(1L<<7)|(1L<<8)|(1L<<12)|(1L<<15)|(1L<<22)|(1L<<26));
3121 if ((flags
& ((1L<<2)|(1L<<22))) == ((1L<<2)|(1L<<22)))
3124 op
= strcopy(( om
),( "#if defined(__STDC__) || defined(__STDPP__)\n"));
3125 op
= strcopy(( op
),( im
));
3126 op
= strcopy(( op
),( "\n#else\n"));
3131 if (*op
++ == '#' && *ip
!= '(')
3134 while (*--op
== ' ' || *op
== '\t');
3137 op
= strcopy(( op
+ 1),( "/**/"));
3138 while (*++ip
== ' ' || *ip
== '\t');
3142 if (*op
!= '"') *++op
= '"';
3144 while (*ip
== ' ' || *ip
== '\t') ip
++;
3145 while ((c
= *ip
) >= 'A' && c
<= 'Z' || c
>= 'a' && c
<= 'z' || c
>= '0' && c
<= '9' || c
== '_') *op
++ = *ip
++;
3146 while (*ip
== ' ' || *ip
== '\t') ip
++;
3147 if (*ip
== '"') ip
++;
3152 op
= strcopy(( op
),( "\n#endif\n"));
3153 op
= linesync(proto
, op
, proto
->line
);
3155 flags
&= ~((1L<<2)|(1L<<3)|(1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<22)|(1L<<23)|(1L<<25)|(1L<<26));
3162 if (paren
== 0 && (flags
& ((1L<<15)|(1L<<21)|(1L<<23)|(1L<<24))) == (1L<<24))
3165 if (flags
& (1L<<5)) (op
=ko
);
3167 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);
3174 rp
= _pp_fsmtab
[((( state
)>>(7+1))&((1<<7)-1))];
3180 c
= (((( state
)>>(7+1))&((1<<7)-1))+0401);
3185 c
= (((( state
)>>(7+1))&((1<<7)-1))+0401);
3191 if (!(flags
& (1L<<1))) switch (((((long)( *proto
->tp
))<<16)|(((long)( *(ip
- 1)))<<8)|((long)( ip
- proto
->tp
))))
3193 case ((((long)( 'N'))<<16)|(((long)( 'N'))<<8)|((long)( 3))):
3194 if (proto
->tp
[1] == 'o')
3197 case ((((long)( 'd'))<<16)|(((long)( 'o'))<<8)|((long)( 2))):
3200 case ((((long)( 'e'))<<16)|(((long)( 'e'))<<8)|((long)( 4))):
3201 if (!(flags
& (1L<<21)) && (flags
& ((1L<<3)|(1L<<25))) != (1L<<3) && !sstrncmp( proto
->tp
, "else", 4))
3207 case ((((long)( 'e'))<<16)|(((long)( 'n'))<<8)|((long)( 6))):
3208 if (!sstrncmp( proto
->tp
, "extern", 6))
3211 case ((((long)( 'f'))<<16)|(((long)( 'r'))<<8)|((long)( 3))):
3212 if (!(flags
& (1L<<21)) && !sstrncmp( proto
->tp
, "for", 3))
3218 case ((((long)( 'i'))<<16)|(((long)( 'f'))<<8)|((long)( 2))):
3221 case ((((long)( 'i'))<<16)|(((long)( 'e'))<<8)|((long)( 6))):
3222 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))
3225 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);
3227 op
= strcopy(( op
- 6),( "__INLINE__"));
3228 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);
3231 case ((((long)( 'r'))<<16)|(((long)( 'n'))<<8)|((long)( 6))):
3232 if (!(flags
& (1L<<21)) && !sstrncmp( proto
->tp
, "return", 6))
3238 case ((((long)( 's'))<<16)|(((long)( 'c'))<<8)|((long)( 6))):
3239 if ((proto
->options
& (1L<<6)) && !sstrncmp( proto
->tp
, "static", 6))
3245 case ((((long)( 't'))<<16)|(((long)( 'f'))<<8)|((long)( 7))):
3246 if (!(flags
& (1L<<21)) && !sstrncmp( proto
->tp
, "typedef", 7))
3252 case ((((long)( 'v'))<<16)|(((long)( 't'))<<8)|((long)( 8))):
3253 if (*ip
== '(' && !sstrncmp( proto
->tp
, "va_start", 8)) c
= (0500+1);
3255 case ((((long)( 'v'))<<16)|(((long)( 'd'))<<8)|((long)( 4))):
3256 if (!sstrncmp( proto
->tp
, "void", 4))
3258 if (flags
& ((1L<<0)|(1L<<19)|(1L<<10)|(1L<<11))) c
= ((0500+4)+30);
3261 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);
3263 if (lex(proto
, (flags
& ((1L<<16))) | (1L<<21)) == '*')
3265 memcopy(op
- 4, "__V_", 4);
3266 memcopy(ip
- 4, "__V_", 4);
3268 else c
= ((0500+4)+30);
3270 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);
3275 case ((((long)( 'w'))<<16)|(((long)( 'e'))<<8)|((long)( 5))):
3276 if (!(flags
& (1L<<21)) && !sstrncmp( proto
->tp
, "while", 5))
3284 if ((flags
& (1L<<0)) && c
!= ((0500+4)+9))
3295 if ((flags
& ((1L<<5)|(1L<<15))) == (1L<<5))
3297 while (op
> proto
->ob
&& (*(op
- 1) == ' ' || *(op
- 1) == '\t'))
3299 if (op
> proto
->ob
&& *(op
- 1) != '\n') *op
++ = ' ';
3309 if (!(n
= (*(unsigned char*)ip
++)))
3314 n
= (*(unsigned char*)ip
++);
3327 if (state
>= (0+28))
3329 rp
= _pp_fsmtab
[state
];
3335 if (!(flags
& ((1L<<10)|(1L<<11)|(1L<<21))))
3337 if (!(flags
& (1L<<3))) switch (c
)
3341 if (!(flags
& (1L<<0)) || proto
->brace
== 0)
3347 if (!(flags
& (1L<<0)) || group
<= 1)
3353 if (group
++ == 0) group
++;
3354 else if (flags
& (1L<<8)) call
++;
3361 else if (paren
== 2 && !aim
)
3369 else if (flags
& (1L<<8))
3374 else if ((flags
& ((1L<<15)|(1L<<25))) == (1L<<15))
3376 for (m
= ip
- 2; m
> im
&& (*m
== ' ' || *m
== '\t'); m
--);
3377 if (m
!= im
&& sub
== 1)
3379 m
= im
+ (*nns(ip
) == '*');
3387 else if ((flags
& (1L<<15)) && sub
== 1 && *nns(ip
) != '*')
3398 if (!(flags
& (1L<<0)) || proto
->brace
== 0)
3403 if (flags
& (1L<<0))
3415 else if (paren
== 1 && (flags
& (1L<<8)) && !aie
)
3419 if (last
== '(' && group
== 2)
3430 dir
= directive(ip
, dir
);
3431 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))
3433 else if (!(flags
& ((1L<<1)|(1L<<3))))
3436 if (!(flags
& (1L<<19)))
3439 while (*ip
== ' ' || *ip
== '\t') ip
++;
3440 if (*ip
== 'l' && *++ip
== 'i' && *++ip
== 'n' && *++ip
== 'e')
3442 if (*++ip
== ' ' || *ip
== '\t')
3445 while (*++ip
>= '0' && *ip
<= '9')
3446 proto
->line
= proto
->line
* 10 + *ip
- '0';
3451 else if ((flags
& ((1L<<0)|(1L<<5))) == (1L<<0))
3455 while (ip
< t
&& *ip
>= 'a' && *ip
<= 'z')
3456 n
= ((( n
)<<5)+(( *ip
++)-('a'-1)));
3459 case ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'l')-('a'-1))))<<5)+(( 's')-('a'-1))))<<5)+(( 'e')-('a'-1))):
3460 case ((( ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'f')-('a'-1))):
3461 while (*ip
== ' ' || *ip
== '\t') ip
++;
3462 if (*ip
!= '\n' && *ip
!= '/' && *(ip
+ 1) != '*')
3464 flags
|= (1L<<12)|(1L<<15);
3466 om
= op
+ (ip
- bp
);
3469 case ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'l')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'f')-('a'-1))):
3470 case ((( ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'r')-('a'-1))))<<5)+(( 'r')-('a'-1))))<<5)+(( 'o')-('a'-1))))<<5)+(( 'r')-('a'-1))):
3471 case ((( (( 'i')-('a'-1)))<<5)+(( 'f')-('a'-1))):
3472 case ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'f')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))):
3473 case ((( ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'f')-('a'-1))))<<5)+(( 'n')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))):
3474 case ((( ((( ((( ((( (( 'u')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))):
3476 case ((( ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'c')-('a'-1))))<<5)+(( 'l')-('a'-1))))<<5)+(( 'u')-('a'-1))))<<5)+(( 'd')-('a'-1))):
3477 if (*ip
== 'e') ip
++;
3479 case ((( ((( ((( ((( ((( (( 'd')-('a'-1)))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'n')-('a'-1))))<<5)+(( 'e')-('a'-1))):
3480 case ((( ((( ((( ((( ((( (( 'p')-('a'-1)))<<5)+(( 'r')-('a'-1))))<<5)+(( 'a')-('a'-1))))<<5)+(( 'g')-('a'-1))))<<5)+(( 'm')-('a'-1))))<<5)+(( 'a')-('a'-1))):
3481 if (*ip
< 'a' || *ip
> 'z') break;
3484 flags
|= (1L<<12)|(1L<<15);
3493 if (*ip
== 'i' && *++ip
== 'n' && *++ip
== 'c' && *++ip
== 'l' && *++ip
== 'u' && *++ip
== 'd' && *++ip
== 'e')
3495 while (*++ip
== ' ' || *ip
== '\t');
3496 if (*ip
++ == '<' && *ip
++ == 's' && *ip
++ == 't' && *ip
++ == 'd' && *ip
++ == 'a' && *ip
++ == 'r' && *ip
++ == 'g' && *ip
++ == '.' && *ip
++ == 'h' && *ip
++ == '>')
3500 strcopy(( op
),( "if !defined(va_start)\n#if defined(__STDARG__)\n#include <stdarg.h>\n#else\n#include <varargs.h>\n#endif\n#endif\n"));
3501 op
= linesync(proto
, op
, proto
->line
);
3505 else if (*ip
== 'd' && *++ip
== 'e' && *++ ip
== 'f' && *++ip
== 'i' && *++ip
== 'n' && *++ip
== 'e' && (*++ip
== ' ' || *ip
== '\t'))
3507 while (*++ip
== ' ' || *ip
== '\t');
3508 if (*ip
== 'e' && *++ip
== 'x' && *++ ip
== 't' && *++ip
== 'e' && *++ip
== 'r' && *++ip
== 'n' && (*++ip
== ' ' || *ip
== '\t'))
3511 while (*++t
== ' ' || *t
== '\t');
3512 if (*t
== 'e' && *++t
== 'x' && *++ t
== 't' && *++t
== 'e' && *++t
== 'r' && *++t
== 'n' && (*++t
== ' ' || *t
== '\t' || *t
== '\n' || *t
== '\r'))
3515 while (*++t
== ' ' || *t
== '\t');
3516 if (*t
== '_' && *(t
+ 1) == '_')
3518 op
= strcopy(( op
),( "undef __MANGLE__\n"));
3519 op
= linesync(proto
, op
, proto
->line
);
3520 op
= strcopy(( op
),( "#define __MANGLE__ __LINKAGE__"));
3524 flags
|= (1L<<2)|(1L<<15);
3528 else if (*ip
== 'u' && *++ip
== 'n' && *++ ip
== 'd' && *++ip
== 'e' && *++ip
== 'f' && (*++ip
== ' ' || *ip
== '\t'))
3530 while (*++ip
== ' ' || *ip
== '\t');
3531 if (*ip
== 'e' && *++ip
== 'x' && *++ ip
== 't' && *++ip
== 'e' && *++ip
== 'r' && *++ip
== 'n' && (*++ip
== ' ' || *ip
== '\t' || *ip
== '\n' || *ip
== '\r'))
3533 op
= strcopy(( op
),( "undef __MANGLE__\n"));
3534 op
= linesync(proto
, op
, proto
->line
);
3535 op
= strcopy(( op
),( "#define __MANGLE__ __LINKAGE__"));
3538 flags
|= (1L<<2)|(1L<<15);
3551 if (proto
->brace
++ == 0 && paren
== 0)
3553 if (last
== '=') flags
|= (1L<<9);
3555 else if (flags
& (1L<<0))
3557 if ((flags
& ((1L<<15)|(1L<<17)|(1L<<23))) == (1L<<15))
3561 v
= number(op
, args
< 0 ? -args
: args
);
3562 v
= strcopy(( v
),( " argument actual/formal mismatch"));
3564 v
= memcopy(v
, im
, ie
- im
);
3566 proto_error((char*)proto
+ sizeof(Proto_t
), 2, op
, ((char*)0));
3572 if (*ie
++ == '/' && *ie
== '*')
3579 while (ie
< ip
&& *ie
== '*') ie
++;
3580 if (ie
< ip
&& *ie
== '/')
3582 while (++ie
< ip
&& (*ie
== ' ' || *ie
== '\t'));
3583 while (e
> v
&& (*(e
- 1) == ' ' || *(e
- 1) == '\t')) e
--;
3584 if (e
> v
&& *e
!= '\n') *e
++ = ' ';
3597 if (flags
& (1L<<5))
3600 while (v
> ko
&& *--v
!= ' ');
3603 om
= (v
= (op
+= 4)) + 1;
3609 memcopy(ko
, "int ", 4);
3613 while (*(v
+ 1) == '*')
3618 om
= (e
= ++op
) + 1;
3626 om
= (v
= (op
+= 7)) + 1;
3632 memcopy(ko
, "extern ", 7);
3640 if ((c
= *ie
) == ' ' || c
== '\t' || c
== '\n')
3642 while ((c
= *++ie
) == ' ' || c
== '\t' || c
== '\n');
3643 if (ie
>= ip
) break;
3644 if (c
!= '*' && op
> om
) (*op
++=( ' '));
3646 if ((n
= ((c
= *ie
) == ',')) || c
== ';')
3648 if (flags
& (1L<<5))
3651 while (op
> om
&& ((c
= *(op
- 1)) == '(' || c
== ')' || c
== '[' || c
== ']'))
3654 while (op
> om
&& (c
= *(op
- 1)) != ' ' && c
!= '*')
3656 while (*(op
- 1) == ' ')
3661 while (e
> om
&& *(e
- 1) == '*')
3669 op
= strcopy(( op
),( "int"));
3670 else if (*(op
- 1) == ',')
3671 op
= strcopy(( op
),( " int"));
3679 if (x
= !e
) e
= op
- 1;
3687 while (*--e
!= ' ');
3688 while (*(e
- 1) == '*') e
--;
3692 while ((c
= *++ie
) == ' ' || c
== '\t' || c
== '\n');
3693 if (ie
>= ip
) (op
--);
3694 else (*op
++=( ' '));
3701 else if (*ie
== '*')
3703 if (op
> om
&& (c
= *(op
- 1)) == ' ') op
--;
3704 while (*ie
== '*') (*op
++=( *ie
++));
3705 while (*ie
== ' ' || *ie
== '\t' || *ie
== '\n') ie
++;
3706 if (c
!= '(') (*op
++=( ' '));
3708 else if (*ie
== '(')
3710 if (op
> om
&& *(op
- 1) == ' ') op
--;
3712 while (*ie
== ' ' || *ie
== '\t' || *ie
== '\n') ie
++;
3714 else if (*ie
== ')')
3716 if (op
> om
&& *(op
- 1) == '(')
3717 proto_error((char*)proto
+ sizeof(Proto_t
), 1, "function pointer argument prototype omitted", ((char*)0));
3719 while (*ie
== ' ' || *ie
== '\t' || *ie
== '\n') ie
++;
3721 else if ((flags
& (1L<<5)) && (op
== om
|| *(op
- 1) == ' ') && *ie
== 'r' && !sstrncmp( ie
, "register", 8) && (*(ie
+ 8) == ' ' || *(ie
+ 8) == '\t' || *(ie
+ 8) == '\n'))
3724 if (op
> om
) (op
--);
3726 else (*op
++=( *ie
++));
3729 if (op
<= om
) op
= strcopy(( op
),( "void"));
3731 if (flags
& (1L<<5))
3744 flags
&= ~((1L<<15)|(1L<<23));
3748 else if ((flags
& ((1L<<15)|(1L<<19)|(1L<<23)|(1L<<25))) == ((1L<<15)|(1L<<25)))
3751 op
= strcopy(( om
),( " __PARAM__("));
3752 op
= memcopy(op
, im
, ie
- im
);
3756 flags
&= ~((1L<<15)|(1L<<23));
3757 if (flags
& (1L<<27))
3759 if ((vc
= ie
- im
+ 1) > sizeof(proto
->variadic
)) vc
= sizeof(proto
->variadic
);
3760 memcopy(proto
->variadic
, im
, vc
);
3761 op
= strcopy(( op
),( "va_alist)) __OTORP__(va_dcl)\n{"));
3772 switch (lex(proto
, (flags
& ((1L<<16))) | (1L<<21)))
3781 if (paren
++) group
++;
3787 if (flags
& (1L<<15))
3789 flags
&= ~((1L<<15)|(1L<<23));
3790 op
= memcopy(op
, m
, e
- m
);
3799 if (flags
& (1L<<15))
3801 flags
&= ~((1L<<15)|(1L<<23));
3802 op
= memcopy(op
, m
, e
- m
);
3810 if (group
<= 1 && !brack
)
3825 if (!(flags
& (1L<<23)))
3828 proto
->op
= strcopy(( op
),( " __OTORP__("));
3834 lex(proto
, (flags
& ((1L<<16))) | (1L<<1));
3841 if (flags
& (1L<<6)) memcopy( proto
->ox
, "extern", 6);
3842 op
= linesync(proto
, op
, proto
->line
= line
);
3843 if (flags
& (1L<<3))
3849 else if (!(flags
& (1L<<27))) (*op
++=( '{'));
3852 flags
&= ~((1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<23));
3857 flags
&= ~((1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<23)|(1L<<25));
3858 if (--proto
->brace
== 0)
3860 flags
&= ~((1L<<9)|(1L<<27)|(1L<<28));
3862 if (flags
& (1L<<5)) (op
=ko
);
3870 if (last
== '?') flags
|= (1L<<3);
3871 else if (paren
== 0 && (flags
& ((1L<<9)|(1L<<15)|(1L<<23))) == (1L<<15))
3873 if (last
== ')' && proto
->brace
&& (group
!= 2 || call
!= 2)) flags
|= (1L<<23);
3874 else goto fsm_statement
;
3879 if (flags
& (1L<<0))
3881 if (paren
== 1) args
++;
3890 if (paren
== 0 && (flags
& (1L<<1))) *(op
- 1) = c
= ';';
3894 if (flags
& (1L<<9)) ;
3896 else if (flags
& (1L<<0))
3900 if ((flags
& (1L<<15)) && last
== ')')
3902 if (!(flags
& (1L<<15)))
3907 if (flags
& (1L<<5)) (op
=ko
);
3908 if (flags
& (1L<<24))
3910 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);
3917 if ((flags
& ((1L<<5)|(1L<<23))) == ((1L<<5)|(1L<<23)))
3923 else if (paren
== 0)
3925 if ((flags
& ((1L<<15)|(1L<<17)|(1L<<23))) == (1L<<15) && call
> 1)
3927 if ((flags
& (1L<<14)) && func
)
3935 if ((flags
& ((1L<<1)|(1L<<8))) == (1L<<8) && aim
&& aie
< im
)
3937 while (aie
< ip
&& (*aie
== ' ' || *aie
== '\t' || *aie
== '\n')) aie
++;
3940 if (*v
++ == ')') break;
3941 while (v
< aie
&& (*v
== ' ' || *v
== '\t' || *v
== '\n')) v
++;
3942 if (v
== aie
|| !(flags
& (1L<<20)))
3944 if (flags
& (1L<<20)) n
= 3;
3945 else if (v
== aie
&& *v
== '(') n
= 10;
3955 if (flags
& (1L<<20)) memcopy(aom
, "(...))", 6);
3956 else if (n
== 10) memcopy(aom
, "(__VARARG__))", 13);
3959 ko
= strcopy(( aom
),( " __PROTO__("));
3960 ko
= memcopy(ko
, aim
, aie
- aim
);
3970 else if (flags
& (1L<<26))
3973 while (*--op
== ' ' || *op
== '\t' || *op
== '\n');
3978 while ((x
= *(op
- 14)) >= 'A' && x
<= 'Z' || x
>= 'a' && x
<= 'z' || x
>= '0' && x
<= '9' || x
== '_')
3980 memcopy(op
- 13, "(__OTORP__(*)", 13);
3983 if (flags
& (1L<<17))
3985 else if (flags
& (1L<<20))
3988 if (!(flags
& (1L<<25))) op
= strcopy(( op
),( "(...)"));
3989 else op
= memcopy(op
, im
, ie
- im
);
3994 if (flags
& (1L<<1)) op
= strcopy(( om
),( "()"));
3995 else if (!(flags
& (1L<<25))) op
= strcopy(( om
),( "(__VARARG__)"));
3998 op
= strcopy(( om
),( " __PROTO__("));
3999 op
= memcopy(op
, im
, ie
- im
);
4002 if (flags
& (1L<<6)) memcopy( proto
->ox
, "extern", 6);
4005 flags
&= ~((1L<<15)|(1L<<27)|(1L<<28));
4006 if (c
== ',' && !(flags
& (1L<<8)))
4013 else if (flags
& ((1L<<17)|(1L<<23))) call
= 0;
4016 flags
&= ~((1L<<6)|(1L<<14)|(1L<<25)|(1L<<26));
4018 if (flags
& (1L<<24))
4020 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);
4024 else call
= call
> 1 && c
== ',';
4026 flags
&= ~((1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<23));
4028 else if (paren
== 1 && group
== 1 && !(flags
& ((1L<<7)|(1L<<14)))) flags
|= (1L<<25)|(1L<<17);
4032 flags
|= (1L<<25)|(1L<<23);
4036 if (flags
& (1L<<0))
4038 if (proto
->brace
== 0)
4043 if (paren
== 0 && !(flags
& (1L<<26)))
4046 if (!(flags
& (1L<<19)) || proto
->package
)
4048 op
= strcopy(( op
),( " __MANGLE__"));
4051 op
= strcopy(( op
- 1),( proto
->package
));
4053 op
= strcopy(( op
),( "_DATA__"));
4061 if (paren
== 0 && (flags
& ((1L<<1)|(1L<<27))) == (1L<<1))
4064 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);
4067 if (paren
== 1 && !(flags
& (1L<<23)))
4074 if ((flags
& ((1L<<19)|(1L<<27))) == (1L<<27))
4078 op
= strcopy(( op
- 8),( "__VA_START__"));
4079 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);
4082 switch (lex(proto
, (flags
& ((1L<<16))) | (1L<<21)))
4088 if (!(flags
& (1L<<15)))
4100 do{(ip
=proto
->ip
);(op
=proto
->op
);call
=proto
->call
;}while(0);
4101 if (flags
& (1L<<15))
4111 op
= strcopy(( op
),( " __OTORP__("));
4112 proto
->ip
= proto
->variadic
;
4117 if (*bp
== 'r' && !sstrncmp( bp
, "register", 8) && (*(bp
+ 8) == ' ' || *(bp
+ 8) == '\t')) bp
+= 9;
4120 switch (lex(proto
, (flags
& ((1L<<16))) | (1L<<21)))
4123 if (paren
++) group
++;
4128 if (flags
& (1L<<15))
4131 if (!(flags
& (1L<<28)))
4133 op
= memcopy(op
, m
, e
- m
);
4134 op
= strcopy(( op
),( " = "));
4136 op
= strcopy(( op
),( "va_arg("));
4137 op
= memcopy(op
, v
, n
);
4140 if (m
> bp
) op
= memcopy(op
, bp
, m
- bp
);
4141 else op
= strcopy(( op
),( "int "));
4142 if (group
> 1) op
= strcopy(( op
),( ")()"));
4143 else op
= memcopy(op
, e
, proto
->ip
- e
- 1);
4154 if (flags
& (1L<<15))
4157 if (!(flags
& (1L<<28)))
4159 op
= memcopy(op
, m
, e
- m
);
4160 op
= strcopy(( op
),( " = "));
4162 op
= strcopy(( op
),( "va_arg("));
4163 op
= memcopy(op
, v
, n
);
4166 if (m
> bp
) op
= memcopy(op
, bp
, m
- bp
);
4167 else op
= strcopy(( op
),( "int "));
4168 if (group
> 1) op
= strcopy(( op
),( ")()"));
4169 else op
= memcopy(op
, e
, proto
->ip
- e
- 1);
4173 if (*bp
== 'r' && !sstrncmp( bp
, "register", 8) && (*(bp
+ 8) == ' ' || *(bp
+ 8) == '\t')) bp
+= 9;
4192 op
= strcopy(( op
),( ")"));
4202 if (flags
& (1L<<0))
4204 if (!args
&& paren
== 1) args
++;
4212 if (proto
->brace
== 0 && !(flags
& (1L<<1))) flags
|= (1L<<23);
4215 else if ((flags
& (1L<<23)) || c
== (0401+0) || c
== ((0500+4)+30)) call
++;
4216 else flags
|= (1L<<23);
4217 if (last
== (0401+0)) flags
|= (1L<<7);
4223 if (*proto
->tp
>= '0' && *proto
->tp
<= '9')
4233 while ((c
= *--t
) >= '0' && c
<= '9' || c
>= 'a' && c
<= 'z' || c
>= 'A' && c
<= 'Z');
4244 while ((c
= *--t
) >= '0' && c
<= '9' || c
>= 'a' && c
<= 'z' || c
>= 'A' && c
<= 'Z');
4266 while ((c
= *--m
) >= '0' && c
<= '9' || c
>= 'a' && c
<= 'z' || c
>= 'A' && c
<= 'Z')
4269 strcopy(( m
+ 1),( "(unsigned)"));
4277 if ((flags
& (1L<<0)) && paren
== 0 && group
<= 2) flags
|= (1L<<23);
4283 if (flags
& (1L<<0)) break;
4286 if (paren
== 0) flags
|= (1L<<17);
4289 else if (c
== '#' && *ip
!= '(') flags
|= (1L<<22);
4292 if ((flags
& ((1L<<5)|(1L<<15))) == ((1L<<5)|(1L<<15)) && ((flags
& ((1L<<3)|(1L<<23))) || proto
->brace
|| c
!= '(' && c
!= ')' && c
!= '*' && c
!= (0401+0)))
4299 else if (flags
& ((1L<<10)|(1L<<11)))
4302 if ((flags
& (1L<<29)) && c
== '%' && *ip
== '{')
4309 for (t
= ip
; *t
== ' ' || *t
== '\t'; t
++);
4310 if (*t
++ == 'i' && *t
++ == 'f' && *t
++ == 'n' && *t
++ == 'd' && *t
++ == 'e' && *t
++ == 'f')
4336 op
= init(proto
, op
, flags
);
4337 op
= linesync(proto
, op
, proto
->line
);
4338 flags
&= ~((1L<<10)|(1L<<11));
4339 proto
->flags
&= ~((1L<<10)|(1L<<11));
4342 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);
4351 pppclose
__PARAM__((char* iob
), (iob
)) __OTORP__(char* iob
;){
4352 register Proto_t
* proto
= (Proto_t
*)(iob
- sizeof(Proto_t
));
4354 if (proto
->flags
& (1L<<16)) close(proto
->fd
);
4361 pppopen
__PARAM__((char* file
, int fd
, char* notice
, char* options
, char* package
, char* comment
, int flags
), (file
, fd
, notice
, options
, package
, comment
, flags
)) __OTORP__(char* file
; int fd
; char* notice
; char* options
; char* package
; char* comment
; int flags
;){
4362 register Proto_t
* proto
;
4386 if (flags
& (1<<0)) flags
&= ~(1<<5);
4388 if (flags
& (1<<11)) flags
&= ~retain
;
4389 else retain
&= (1<<6);
4390 if (file
&& (fd
= open(file
, O_RDONLY
)) < 0) return 0;
4419 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)))))
4423 proto
->flags
|= (1L<<16);
4426 proto
->package
= package
;
4427 iob
= (char*)proto
+ sizeof(Proto_t
);
4428 proto
->op
= proto
->ob
= iob
;
4429 proto
->ip
= proto
->ib
= iob
+ proto
->oz
+ n
;
4430 if (m
) proto
->options
|= (1L<<0);
4433 if (!(proto
->cc
[0] = comment
[0]))
4434 notice
= options
= 0;
4435 else if (comment
[1])
4437 proto
->cc
[1] = comment
[1];
4438 proto
->cc
[2] = comment
[2] ? comment
[2] : comment
[0];
4441 proto
->cc
[1] = proto
->cc
[2] = comment
[0];
4447 n
= read(fd
, proto
->ip
, proto
->iz
);
4448 if (!(proto
->flags
& (1L<<16)))
4455 *(proto
->ip
+ n
) = 0;
4459 if (!notice
&& !options
|| (comlen
= astlicense(com
, sizeof(com
), ((char*)0), "type=check", proto
->cc
[0], proto
->cc
[1], proto
->cc
[2])) <= 0)
4462 hit
= (notice
|| options
) ? 0 : 0x02;
4466 while (m
-- > 0 && *s
&& hit
!= (0x01|0x02))
4468 while (*s
== ' ' || *s
== '\t')
4473 while (*s
== ' ' || *s
== '\t')
4475 if (*s
== *"pragma"&& !sstrncmp( s
, "pragma", sizeof("pragma") - 1) && (*(s
+= sizeof("pragma") - 1) == ' ' || *s
== '\t'))
4478 while (*s
&& *s
!= '\r' && *s
!= '\n')
4480 for (; *s
== ' ' || *s
== '\t'; s
++);
4481 for (t
= s
; *s
&& *s
!= ' ' && *s
!= '\t' && *s
!= '\r' && *s
!= '\n'; s
++);
4483 for (i
= 0; i
< (sizeof( pragmas
)/sizeof( pragmas
[0])); i
++)
4484 if (pragmas
[i
].size
== z
&& !sstrncmp( t
, pragmas
[i
].name
, z
))
4487 hit
|= pragmas
[i
].hit
;
4488 switch (pragmas
[i
].hit
)
4491 notice
= options
= 0;
4494 pragma
= pragmas
[i
].val
;
4502 if (!(flags
& (1<<1)) || (flags
& (1<<8)))
4504 for (; b
< s
; *b
++ = ' ');
4508 else if (*s
== *"/* : : generated by proto : : */\n"&& !sstrncmp( s
, "/* : : generated by proto : : */\n", sizeof("/* : : generated by proto : : */\n") - 1))
4514 else if (*s
== '%' && *(s
+ 1) == '{')
4515 proto
->flags
|= (1L<<29);
4516 else if (!(hit
& 0x02))
4518 if (*s
== *com
&& !sstrncmp( s
, com
, comlen
))
4521 notice
= options
= 0;
4524 for (; *s
&& *s
!= '\n' && !(hit
& 0x02); s
++)
4525 for (i
= 0; i
< (sizeof( notices
)/sizeof( notices
[0])); i
++)
4526 if (*s
== notices
[i
].name
[0] && !sstrncmp( s
, notices
[i
].name
, notices
[i
].size
))
4528 s
+= notices
[i
].size
;
4531 while (*s
== ' ' || *s
== '\t')
4533 if (*s
== '(' && (*(s
+ 1) == 'c' || *(s
+ 1) == 'C') && *(s
+ 2) == ')' || *s
>= '0' && *s
<= '9' && *(s
+ 1) >= '0' && *(s
+ 1) <= '9')
4535 hit
|= notices
[i
].hit
;
4536 notice
= options
= 0;
4541 hit
|= notices
[i
].hit
;
4542 notice
= options
= 0;
4548 while (*s
&& *s
++ != '\n');
4550 if (flags
& (1<<10)) proto
->flags
|= (1L<<20);
4551 if (flags
& (1<<12)) proto
->test
= 1;
4552 if (flags
& (1<<2)) proto
->options
|= (1L<<6);
4554 if (flags
& (1<<0)) pragma
= -pragma
;
4555 if (flags
& (1<<1)) pragma
= 0;
4556 if (flags
& (1<<7)) proto
->flags
|= (1L<<13);
4557 if (!(proto
->flags
& (1L<<29)) && file
&& (m
= sstrlen( file
)) > 2 && file
[--m
] == 'y' && file
[--m
] == '.')
4558 proto
->flags
|= (1L<<29);
4562 if (flags
& (1<<10))
4564 flags
&= ~((1<<4)|(1<<5));
4565 proto
->flags
|= (1L<<19);
4567 else if (!(flags
& ((1<<3)|(1<<9))))
4572 else if ((flags
& ((1<<3)|(1<<9))) == (1<<9) || !pragma
)
4574 proto
->flags
|= (1L<<18);
4575 if (proto
->flags
& (1L<<16))
4576 proto
->oz
+= proto
->iz
;
4578 if (notice
|| options
)
4580 if (proto
->cc
[0] == '#' && proto
->ip
[0] == '#' && proto
->ip
[1] == '!')
4583 while (*s
&& *s
++ != '\n');
4585 proto
->op
= memcopy(proto
->op
, proto
->ip
, m
);
4592 if ((comlen
= astlicense(proto
->op
, proto
->oz
, notice
, options
, proto
->cc
[0], proto
->cc
[1], proto
->cc
[2])) < 0)
4593 proto_error((char*)proto
+ sizeof(Proto_t
), 1, proto
->op
, ((char*)0));
4595 proto
->op
+= comlen
;
4597 if (!(flags
& (1<<0)) && !(proto
->flags
& (1L<<29)))
4599 proto
->op
= linesync(proto
, proto
->op
, 1);
4600 proto
->iz
+= proto
->op
- proto
->ob
;
4602 memcopy(proto
->op
, proto
->ip
, n
);
4607 if (!(retain
& (1<<6)))
4610 ppfsm(4, ((char*)0));
4615 if (notice
|| options
|| (flags
& ((1<<4)|(1<<5))))
4618 if (notice
|| options
)
4620 if ((comlen
= astlicense(proto
->op
, proto
->oz
, notice
, options
, proto
->cc
[0], proto
->cc
[1], proto
->cc
[2])) < 0)
4621 proto_error((char*)proto
+ sizeof(Proto_t
), 1, proto
->op
, ((char*)0));
4623 proto
->op
+= comlen
;
4628 proto
->flags
|= (1L<<11);
4629 if (flags
& (1<<11))
4632 else if (flags
& (1<<4))
4634 if (flags
& (1<<11)) retain
|= (1<<4);
4639 proto
->op
= strcopy(( proto
->op
),( "pragma"));
4641 proto
->op
= strcopy(( proto
->op
),( pragmas
[0].name
));
4642 *proto
->op
++ = '\n';
4646 proto
->flags
|= (1L<<10);
4649 if (!(flags
& (1<<0)))
4651 if (proto
->flags
& (1L<<29))
4653 proto
->op
= strcopy(( proto
->op
),( "\n%{\n"+ !notice
));
4654 proto
->op
= strcopy(( proto
->op
),( "/* : : generated by proto : : */\n"));
4655 proto
->op
= strcopy(( proto
->op
),( "%}\n"));
4659 if (n
|| notice
|| options
)
4660 *proto
->op
++ = '\n';
4661 proto
->op
= strcopy(( proto
->op
),( "/* : : generated by proto : : */\n"));
4663 proto
->op
= linesync(proto
, proto
->op
, proto
->line
);
4664 else if (proto
->flags
& ((1L<<10)|(1L<<11)))
4665 proto
->op
= init(proto
, proto
->op
, proto
->flags
);
4675 proto
->flags
|= (1L<<0);
4676 if (!(flags
& (1<<4))) proto
->flags
|= (1L<<5);
4688 pppread
__PARAM__((char* iob
), (iob
)) __OTORP__(char* iob
;){
4689 register Proto_t
* proto
= (Proto_t
*)(iob
- sizeof(Proto_t
));
4692 if (proto
->flags
& (1L<<18))
4699 else if (!(proto
->flags
& (1L<<16))) n
= 0;
4700 else if ((n
= read(proto
->fd
, proto
->ob
, proto
->oz
)) <= 0 || (proto
->options
& (1L<<0)) && n
< proto
->oz
)
4702 proto
->flags
&= ~(1L<<16);
4708 if (proto
->op
== proto
->ob
)
4710 if (proto
->flags
& (1L<<4)) return -1;
4712 if (proto
->flags
& (1L<<29))
4714 register char* ip
= proto
->ip
;
4715 register char* op
= proto
->ob
;
4716 register char* ep
= proto
->ob
+ proto
->oz
- 2;
4720 ip
= proto
->ip
= proto
->ib
;
4721 if (!(proto
->flags
& (1L<<16))) n
= 0;
4722 else if ((n
= read(proto
->fd
, ip
, proto
->iz
)) <= 0 || (proto
->options
& (1L<<0)) && n
< proto
->iz
)
4725 proto
->flags
&= ~(1L<<16);
4730 if (proto
->flags
& (1L<<30))
4732 proto
->flags
&= ~(1L<<30);
4736 if (proto
->flags
& (1L<<31)) proto
->flags
&= ~(1L<<29);
4737 else proto
->flags
|= (1L<<31);
4740 if (proto
->flags
& (1L<<29))
4741 while (op
< ep
&& (n
= *op
++ = *ip
))
4746 if (*ip
== '%' && (ip
== proto
->ip
+ 1 || *(ip
- 2) == '\n'))
4749 if (proto
->flags
& (1L<<31)) proto
->flags
&= ~(1L<<29);
4750 else proto
->flags
|= (1L<<31);
4756 proto
->flags
|= (1L<<30);
4760 else if (n
== '\n') proto
->line
++;
4762 proto
->op
= memcopy(proto
->ob
, proto
->ip
, ip
- proto
->ip
);
4767 lex(proto
, proto
->flags
);
4768 if ((proto
->flags
& ((1L<<4)|(1L<<16))) == (1L<<4))
4769 proto
->op
= strcopy(( proto
->op
),( "/* NOTE: some constructs may not have been converted */\n"));
4771 n
= proto
->op
- proto
->ob
;
4772 proto
->op
= proto
->ob
;
4795 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
;){
4805 if (file
&& access(file
, 4))
4806 proto_error(((char*)0), 2, file
, "not found");
4807 else if (b
= pppopen(file
, 0, license
, options
, package
, comment
, flags
))
4811 else if (flags
& ((1<<13)<<1))
4813 e
= file
+ sstrlen( file
) - 1;
4816 if ((fd
= creat(file
, S_IRUSR
|S_IWUSR
|S_IRGRP
|S_IROTH
)) < 0)
4818 proto_error(b
, 2, file
, "cannot create temporary file");
4820 return flags
| ((1<<13)<<0);
4826 if (((n
= sstrlen( copy
)) + sstrlen( file
) + 2) > sizeof(buf
))
4828 proto_error(b
, 2, copy
, "copy path too long");
4830 return flags
| ((1<<13)<<0);
4832 strcopy( buf
, copy
);
4837 if ((fd
= creat(buf
, S_IRUSR
|S_IWUSR
|S_IRGRP
|S_IROTH
)) < 0)
4839 for (e
= buf
; *e
== '/'; e
++);
4845 if (access(buf
, 0) && mkdir(buf
, S_IRUSR
|S_IWUSR
|S_IXUSR
|S_IRGRP
|S_IXGRP
|S_IROTH
|S_IXOTH
))
4847 proto_error(b
, 2, buf
, "cannot create copy directory");
4849 return flags
| ((1<<13)<<0);
4854 if ((fd
= creat(buf
, S_IRUSR
|S_IWUSR
|S_IRGRP
|S_IROTH
)) < 0)
4856 proto_error(b
, 2, buf
, "cannot create copy file");
4858 return flags
| ((1<<13)<<0);
4865 if (file
&& (flags
& ((1<<13)<<2)))
4866 proto_error(b
, 0, "convert to", file
);
4867 while ((n
= pppread(b
)) > 0)
4872 if ((m
= write(fd
, p
, n
)) <= 0)
4874 proto_error(b
, 2, "write error", ((char*)0));
4875 flags
|= ((1<<13)<<0);
4887 if (file
&& (flags
& ((1<<13)<<1)))
4892 if (replace(b
, file
, !(flags
& (1<<0))))
4893 proto_error(b
, 2, "cannot rename to", file
);
4913 typedef struct Sufcom_s
4919 static const Sufcom_t sufcom
[] =
4964 type
__PARAM__((register char* file
, char* comment
), (file
, comment
)) __OTORP__(register char* file
; char* comment
;){
4965 register char* suffix
;
4968 if (file
&& (!comment
|| !*comment
))
4974 if (suffix
&& sstrlen( suffix
) <= 3)
4975 for (i
= 0; i
< sizeof(sufcom
) / sizeof(sufcom
[0]); i
++)
4976 if (!strcmp(suffix
, sufcom
[i
].suffix
))
4977 return (char*)sufcom
[i
].comment
;
4983 main
__PARAM__((int argc
, char** argv
), (argc
, argv
)) __OTORP__(int argc
; char** argv
;){
5002 while ((file
= *++argv
) && *file
== '-' && *(file
+ 1))
5011 if (!*(comment
= ++file
))
5018 if (!*(package
= ++file
) && !(package
= *++argv
))
5034 if (!*(license
= ++file
) && !(license
= *++argv
))
5044 if (!*(b
= ++file
) && !(b
= *++argv
))
5052 oe
= op
+ sizeof(opt
) - 1;
5055 if ((n
+ 1) >= (oe
- op
))
5056 proto_error(((char*)0), 3, b
, "too many options");
5060 memcopy( op
, b
, n
+ 1);
5068 flags
|= ((1<<13)<<1);
5077 flags
|= ((1<<13)<<2);
5083 flags
|= (1<<1)|(1<<8);
5086 if (!*(copy
= ++file
) && !(copy
= *++argv
))
5093 if (!*(list
= ++file
) && !(list
= *++argv
))
5107 proto_error(((char*)0), 2, file
, "unknown option");
5110 b
= "Usage: proto [-dfhinprstvzP+S] [-C directory] [-e package] [-l file]\n [-o \"name='value' ...\"] [-L file] file ...\n";
5111 write(2, b
, sstrlen( b
));
5212 if (*list
== '-' && !*(list
+ 1))
5214 else if ((fd
= open(list
, O_RDONLY
)) < 0)
5215 proto_error(((char*)0), 3, list
, "not found");
5218 for (b
= buf
; (n
= read(fd
, b
, 1)) > 0 && *b
!= '\n' && b
< &buf
[sizeof(buf
) - 1]; b
++);
5222 flags
= proto(buf
, license
, options
, package
, copy
, type(buf
, comment
), flags
);
5229 do flags
= proto(file
, license
, options
, package
, copy
, type(file
, comment
), flags
); while (file
= *++argv
);
5231 flags
= proto(file
, license
, options
, package
, copy
, type(file
, comment
), flags
);
5232 return errors
? 1 : (flags
& ((1<<13)<<0)) ? 2 : 0;