/***********************************************************************
*                                                                      *
*               This software is part of the ast package               *
*          Copyright (c) 1990-2012 AT&T Intellectual Property          *
*          Copyright (c) 2020-2021 Contributors to ksh 93u+m           *
*                      and is licensed under the                       *
*                 Eclipse Public License, Version 1.0                  *
*                    by AT&T Intellectual Property                     *
*                                                                      *
*                A copy of the License is available at                 *
*          http://www.eclipse.org/org/documents/epl-v10.html           *
*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
*                                                                      *
*              Information and Software Systems Research               *
*                            AT&T Research                             *
*                           Florham Park NJ                            *
*                                                                      *
*                 Glenn Fowler <gsf@research.att.com>                  *
*                                                                      *
***********************************************************************/
#pragma clang diagnostic ignored "-Wdeprecated-register"
#pragma clang diagnostic ignored "-Wparentheses"
#pragma clang diagnostic ignored "-Wunused-value"
#pragma clang diagnostic ignored "-Wstring-plus-int"

/*
 * ksh 93u+m distribution note:
 *
 * AT&T used proto for two purposes:
 *
 *   1. To convert ANSI C code to a form compatible with ancient (pre-ANSI) K&R
 *      C compilers using extremely complex macro voodo. It was similarly
 *      capable of translating to C++. Theoretically, this entire code base
 *      should compile on anything from a 1980s K&R C compiler to a modern C++
 *      compiler. In practice, given the massive amount of bit rot we
 *      inherited, I am 99.9% sure that this has been broken for many years.
 *
 *   2. To automagically insert license comments into source files based on an
 *      extremely complicated license database system. (In all-too-typical AT&T
 *      fashion, this second function of proto is completely unrelated to the
 *      first.)
 *
 * Function 2 has now been removed because, unlike the AT&T legal department,
 * I don't think it's worth going to unspeakably extreme lengths to avoid
 * maintaining license information in source code files by hand.
 *
 * In the process, the code below was cleaned up, but it's still generated
 * code; most macros have been expanded to their numeric value, etc. So don't
 * expect to understand the code below. The actual source code is in various
 * places in these two directories in the ast-open-history repo:
 *
 * https://github.com/ksh93/ast-open-history/tree/master/src/cmd/proto
 * https://github.com/ksh93/ast-open-history/tree/master/src/lib/libpp
 *
 * Meanwhile, nobody wants to compile ksh with a pre-ANSI K&R C compiler in
 * 2021 -- and there's no good reason to be compatible with C++ as standard C
 * compilers are universally available. So, proto will go away when I manage to
 * figure out how to pry it loose from the innards of this build system.
 */

/* : : generated by proto : : */

#if !defined(__PROTO__)
#  if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#    if defined(__cplusplus)
#      define __LINKAGE__	"C"
#    else
#      define __LINKAGE__
#    endif
#    define __STDARG__
#    define __PROTO__(x)	x
#    define __OTORP__(x)
#    define __PARAM__(n,o)	n
#    if !defined(__STDC__) && !defined(__cplusplus)
#      if !defined(c_plusplus)
#      	define const
#      endif
#      define signed
#      define void		int
#      define volatile
#      define __V_		char
#    else
#      define __V_		void
#    endif
#  else
#    define __PROTO__(x)	()
#    define __OTORP__(x)	x
#    define __PARAM__(n,o)	o
#    define __LINKAGE__
#    define __V_		char
#    define const
#    define signed
#    define void		int
#    define volatile
#  endif
#  define __MANGLE__	__LINKAGE__
#  if defined(__cplusplus) || defined(c_plusplus)
#    define __VARARG__	...
#  else
#    define __VARARG__
#  endif
#  if defined(__STDARG__)
#    define __VA_START__(p,a)	va_start(p,a)
#  else
#    define __VA_START__(p,a)	va_start(p)
#  endif
#  if !defined(__INLINE__)
#    if defined(__cplusplus)
#      define __INLINE__	extern __MANGLE__ inline
#    else
#      if defined(_WIN32) && !defined(__GNUC__)
#      	define __INLINE__	__inline
#      endif
#    endif
#  endif
#endif
#if !defined(__LINKAGE__)
#define __LINKAGE__		/* 2004-08-11 transition */
#endif

# ifndef __STDC__
# ifndef creat
# define creat		_huh_creat
# endif
# ifndef access
# define access		_huh_access
# endif
# ifndef ctime
# define ctime		_huh_ctime
# endif
# ifndef mkdir
# define mkdir		_huh_mkdir
# endif
# endif

# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <stdio.h>

# ifndef __STDC__
# undef	access
# undef	ctime
# undef	creat
# undef	mkdir
# endif

# ifndef O_RDONLY
# define O_RDONLY	0
# endif

# ifndef S_IRUSR
# define S_IRUSR		0400
# endif
# ifndef S_IWUSR
# define S_IWUSR		0200
# endif
# ifndef S_IXUSR
# define S_IXUSR		0100
# endif
# ifndef S_IRGRP
# define S_IRGRP		0040
# endif
# ifndef S_IWGRP
# define S_IWGRP		0020
# endif
# ifndef S_IXGRP
# define S_IXGRP		0010
# endif
# ifndef S_IROTH
# define S_IROTH		0004
# endif
# ifndef S_IWOTH
# define S_IWOTH		0002
# endif
# ifndef S_IXOTH
# define S_IXOTH		0001
# endif

# ifndef __STDC__
# if !_WIN32 && !_WINIX
# define remove(x)	unlink(x)
# define rename(x,y)	((link(x,y)||remove(x))?-1:0)
# endif

extern __MANGLE__ int	access __PROTO__((const char*, int));
extern __MANGLE__ int	mkdir __PROTO__((const char*, int));

# endif

extern __MANGLE__ int	utime __PROTO__((const char*, time_t*));

int
replace __PARAM__((const char* newfile, const char* oldfile, int preserve), (newfile, oldfile, preserve)) __OTORP__(const char* newfile; const char* oldfile; int preserve;)
{
	struct stat	st;
	time_t		ut[2];

	if (stat(oldfile, &st))
	{
		if (preserve)
			return -1;
		st.st_mode = 0;
	}
	if (remove(oldfile) || rename(newfile, oldfile))
		return -1;
	if (st.st_mode &= (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH))
		chmod(oldfile, st.st_mode);
	if (preserve)
	{
		ut[0] = st.st_atime;
		ut[1] = st.st_mtime;
		preserve = utime(oldfile, ut);
	}
	return preserve;
}

# undef	utime
# define utime		______utime

static const char id[] = "\n@(#)$Id: proto (AT&T Research) 2012-04-14 $\000\n";

struct ppsymbol;
struct ppindex;

typedef char*	(*PPBUILTIN) __PROTO__((char*, const char*, const char*));
typedef void	(*PPCOMMENT) __PROTO__((const char*, const char*, const char*, int));
typedef void	(*PPINCREF) __PROTO__((const char*, const char*, int, int));
typedef void	(*PPLINESYNC) __PROTO__((int, const char*));
typedef void	(*PPMACREF) __PROTO__((struct ppsymbol*, const char*, int, int, unsigned long));
typedef int	(*PPOPTARG) __PROTO__((int, int, const char*));
typedef void	(*PPPRAGMA) __PROTO__((const char*, const char*, const char*, const char*, int));

struct ppinstk				 
{
	char*		nextchr;	 
	struct ppinstk*	next;		 
	struct ppinstk*	prev;		 
	long*		control;	 
	char*		buffer;		 
	char*		file;		 
	char*		prefix;		 
	struct ppsymbol* symbol;	 

	struct ppindex*	index;		 
	int		buflen;		 

	int		line;		 
	int		vendor;		 
	short		fd;		 
	short		hide;		 
	short		flags;		 
	char		type;		 
};

struct pplist				 
{
	char*		value;		 
	struct pplist*	next;		 
};

struct oplist				 
{
	int		op;		 
	char*		value;		 
	struct oplist*	next;		 
};

struct pphide				 
{
	struct ppmacro*	macro;		 
	unsigned long	flags;		 
	int		level;		 
};

struct ppmacstk				 
{
	struct ppmacstk* next;		 
	struct ppmacstk* prev;		 
	int		line;		 
	char*		arg[1];		 
};

struct ppmember				 
{
	struct ppdirs*	archive;	 
	unsigned long	offset;		 
	unsigned long	size;		 
};

struct counter				 
{
	int		candidate;	 
	int		function;	 
	int		macro;		 
	int		pplex;		 
	int		push;		 
	int		terminal;	 
	int		token;		 
};

struct pptuple				 
{
	struct pptuple*	nomatch;	 
	struct pptuple*	match;		 
	char		token[1];	 
};

struct ppfileid				 
{
	unsigned long	st_dev;		 
	unsigned long	st_ino;		 
};

struct pathid				 
{
	char*		path;		 
	struct ppfileid	id;		 
};

struct ppdirs				 
{
	char*		name;		 
	struct ppdirs*	next;		 

	unsigned char c; unsigned char index; unsigned char type; union { char* buffer; char* sp; struct ppdirs* subdir; } info; struct ppfileid id;

};

struct ppkeyword			 
{
	char*		name;		 
	int		value;		 
};

struct ppmacro				 
{
	int		arity;		 
	char*		value;		 
	struct pptuple* tuple; char* formals; int size;
};

struct ppsymbol				 
{
	int hash_header;			 
	unsigned long	flags;		 
	struct ppmacro*	macro;		 
	__V_*		value;		 
	struct pphide* hidden;
};

struct ppglobals			 
{
	const char*	version;	 
	char*		lineid;		 
	char*		outfile;	 
	char*		pass;		 
	char*		token;		 
	struct ppsymbol* symbol;	  

	char*		outb;		 
	char*		outbuf;		 
	char*		outp;	    	 
	char*		oute;	    	 
	unsigned long	offset;		 

	struct ppdirs* lcldirs; struct ppdirs* stddirs; int flags; char* symtab;		 

	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;		 

	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];		 
};

extern __MANGLE__ struct ppglobals	pp;
extern __MANGLE__ char		_pp_ctype[];

extern __MANGLE__ int		ppargs __PROTO__((char**, int));
extern __MANGLE__ void		ppcpp __PROTO__((void));
extern __MANGLE__ void		ppcomment __PROTO__((char*, char*, char*, int));
extern __MANGLE__ __V_*		ppcontext __PROTO__((__V_*, int));
extern __MANGLE__ void		pperror __PROTO__((int, ...));
extern __MANGLE__ void		ppincref __PROTO__((char*, char*, int, int));
extern __MANGLE__ void		ppinput __PROTO__((char*, char*, int));
extern __MANGLE__ int		pplex __PROTO__((void));
extern __MANGLE__ void		ppline __PROTO__((int, char*));
extern __MANGLE__ void		ppmacref __PROTO__((struct ppsymbol*, char*, int, int, unsigned long));
extern __MANGLE__ void		ppop __PROTO__((int, ...));
extern __MANGLE__ void		pppragma __PROTO__((char*, char*, char*, char*, int));
extern __MANGLE__ int		ppprintf __PROTO__((char*, ...));
extern __MANGLE__ int		ppsync __PROTO__((void));

extern __MANGLE__ struct ppkeyword	ppkey[];

struct ppcontext			 
{
	struct ppdirs* lcldirs; struct ppdirs* stddirs; int flags; char* symtab;
	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;
};

struct ppfile 
{
	int hash_header;			 
	struct ppsymbol* guard;		 
	struct ppfile*	bound[4];	 
	int		flags;		 
};

struct ppindex				 
{
	struct ppindex*	next;		 
	struct ppfile*	file;		 
	unsigned long	begin;		 
	unsigned long	end;		 
};

struct ppsymkey				 
{
	struct ppsymbol	sym;		 
	int		lex;		 
};

# ifdef __STDC__

# include <stdlib.h>
# include <unistd.h>
# include <time.h>
# include <string.h>

# else

# define size_t		int

extern __MANGLE__ __V_*		realloc __PROTO__((__V_*, size_t));
extern __MANGLE__ __V_*		calloc __PROTO__((size_t, size_t));
extern __MANGLE__ char*		ctime __PROTO__((time_t*));
extern __MANGLE__ void		free __PROTO__((__V_*));

# ifndef O_RDONLY

extern __MANGLE__ int		access __PROTO__((const char*, int));
extern __MANGLE__ int		close __PROTO__((int));
extern __MANGLE__ int		creat __PROTO__((const char*, int));
extern __MANGLE__ void		exit __PROTO__((int));
extern __MANGLE__ int		link __PROTO__((const char*, const char*));
extern __MANGLE__ int		open __PROTO__((const char*, int, ...));
extern __MANGLE__ int		read __PROTO__((int, __V_*, int));
extern __MANGLE__ time_t		time __PROTO__((time_t*));
extern __MANGLE__ int		unlink __PROTO__((const char*));
extern __MANGLE__ int		write __PROTO__((int, const __V_*, int));

# endif

# endif

struct fsminit				 
{
	int		state;		 
	unsigned char	ch[4];		 
	int		nextstate;	 
};

static struct fsminit	fsminit[] =
{
	{	0,	{ 023 },		((0+28)+11),			},
	{	0,	{ 002 },		(0),			},
	{	0,	{ 001 },		(0+23),			},
	{	0,	{ '.' },		(0+25),			},
	{	0,	{ 021 },		(0+19),			},
	{	0,	{ 'L' },		(0+20),			},
	{	0,	{ 'd', 'e', 'f', 'i' },	(0+1),			},
	{	0,	{ 'r', 's', 't', 'v' },	(0+1),			},
	{	0,	{ 'w', 'N' },		(0+1),			},
	{	0,	{ '"', '\'' },		((0+28)+3),		},
	{	0,	{ '/' },		(0+12),			},
	{	0,	{ '\n' },		((0+28)+7),			},
	{	0,	{ ' ','\t','\f','\013' },	(0+27),			},

	{	(0+1),	{ 023 },		((0+28)+6),		},
	{	(0+1),	{ 021, 001 },	(0+19),			},
	{	(0+1),	{ 'a' },		(0+2),			},
	{	(0+1),	{ 'e' },		(0+3),			},
	{	(0+1),	{ 'f' },		(0+4),			},
	{	(0+1),	{ 'h' },		(0+5),			},
	{	(0+1),	{ 'l' },		(0+6),			},
	{	(0+1),	{ 'n' },		(0+7),			},
	{	(0+1),	{ 'o' },		(0+8),			},
	{	(0+1),	{ 't' },		(0+9),			},
	{	(0+1),	{ 'x' },		(0+10),			},
	{	(0+1),	{ 'y' },		(0+11),			},

	{	(0+2),	{ 023 },		(((0+28)+12)),		},
	{	(0+2),	{ 021, 001 },	(0+19),			},
	{	(0+2),	{ '_','s','t','a' },	(0+2),			},
	{	(0+2),	{ 'r' },		(0+2),			},

	{	(0+3),	{ 023 },		(((0+28)+12)),		},
	{	(0+3),	{ 021, 001 },	(0+19),			},
	{	(0+3),	{ 't','u','r','n' },	(0+3),			},

	{	(0+4),	{ 023 },		(((0+28)+12)),		},
	{	(0+4),	{ 021, 001 },	(0+19),			},

	{	(0+5),	{ 023 },		(((0+28)+12)),		},
	{	(0+5),	{ 021, 001 },	(0+19),			},
	{	(0+5),	{ 'i','l','e' },	(0+5),			},

	{	(0+6),	{ 023 },		(((0+28)+12)),		},
	{	(0+6),	{ 021, 001 },	(0+19),			},
	{	(0+6),	{ 's','e' },		(0+6),			},

	{	(0+7),	{ 023 },		(((0+28)+12)),		},
	{	(0+7),	{ 021, 001 },	(0+19),			},
	{	(0+7),	{ 'l','i','n','e' },	(0+7),			},

	{	(0+8),	{ 023 },		(((0+28)+12)),		},
	{	(0+8),	{ 021, 001 },	(0+19),			},
	{	(0+8),	{ 'r','i','d','N' },	(0+8),			},

	{	(0+9),	{ 023 },		(((0+28)+12)),		},
	{	(0+9),	{ 021, 001 },	(0+19),			},
	{	(0+9),	{ 'a','t','i','c' },	(0+9),			},

	{	(0+10),	{ 023 },		(((0+28)+12)),		},
	{	(0+10),	{ 021, 001 },	(0+19),			},
	{	(0+10),	{ 't','e','r','n' },	(0+10),			},

	{	(0+11),	{ 023 },		(((0+28)+12)),		},
	{	(0+11),	{ 021, 001 },	(0+19),			},
	{	(0+11),	{ 'p','e','d','f' },	(0+11),			},

	{	(0+12),	{ 023 },		((0+28)+0),			},
	{	(0+12),	{ '*' },		(0+13),			},

	{	(0+12),	{ '/' },		(0+16),			},

	{	(0+13),	{ 023 },		(0+13),			},
	{	(0+13),	{ '\n', 002 },	((0+28)+1),		},
	{	(0+13),	{ '/' },		(0+15),			},
	{	(0+13),	{ '*' },		(0+14),			},
	{	(0+13),	{ '#', ';', ')' },	((( (0+13))<<(7+1))|(((0+28)+8))),		},

	{	(0+14),	{ 023 },		(0+13),			},
	{	(0+14),	{ '\n', 002 },	((0+28)+1),		},
	{	(0+14),	{ '#', ';', ')' },	((( (0+13))<<(7+1))|(((0+28)+8))),		},
	{	(0+14),	{ '*' },		(0+14),			},
	{	(0+14),	{ '/' },		((0+28)+1),		},

	{	(0+15),	{ 023 },		(0+13),			},
	{	(0+15),	{ '*', '\n', 002 },	((0+28)+1),		},
	{	(0+15),	{ '/' },		(0+15),			},

	{	(0+16),	{ 023 },		(0+16),			},
	{	(0+16),	{ '\n', 002 },	((0+28)+1),		},
	{	(0+16),	{ '/' },		(0+17),			},
	{	(0+16),	{ '*' },		(0+18),			},

	{	(0+17),	{ 023 },		(0+16),			},
	{	(0+17),	{ '*', '\n', 002 },	((0+28)+1),		},
	{	(0+17),	{ '/' },		(0+17),			},

	{	(0+18),	{ 023 },		(0+16),			},
	{	(0+18),	{ '\n', 002 },	((0+28)+1),		},
	{	(0+18),	{ '*' },		(0+18),			},
	{	(0+18),	{ '/' },		((0+28)+1),		},

	{	(0+19),	{ 023 },		((0+28)+6),		},
	{	(0+19),	{ 021, 001 },	(0+19),			},

	{	(0+25),	{ 023 },		((0+28)+0),			},
	{	(0+25),	{ '.' },		(0+26),			},
	{	(0+25),	{ 001 },		(0+23),			},

	{	(0+26),	{ 023 },		(((( (0401+1))-0401)<<(7+1))|( ((0+28)+14))),	},
	{	(0+26),	{ '.' },		(((( (0401+29))-0401)<<(7+1))|( ((0+28)+13))),	},

	{	(0+20),	{ 023 },		((0+28)+6),		},
	{	(0+20),	{ 021, 001 },	(0+19),			},
	{	(0+20),	{ '"', '\'' },		((( (0+21))<<(7+1))|(((0+28)+8))),		},

	{	(0+21),	{ 023 },		(0+21),			},
	{	(0+21),	{ '"', '\'' },		((0+28)+4),		},
	{	(0+21),	{ '\n', 002 },	((0+28)+4),		},
	{	(0+21),	{ '\\' },		(0+22),			},

	{	(0+22),	{ 023 },		((0+28)+5),		},
	{	(0+22),	{ '\n', 002 },	((0+28)+4),		},

	{	(0+23),	{ 023 },		(((( (0401+1))-0401)<<(7+1))|( ((0+28)+14))),	},
	{	(0+23),	{ 021, 001, '.' },	(0+23),			},
	{	(0+23),	{ 'e', 'E' },		(0+24),			},

	{	(0+24),	{ 023 },		(((( (0401+1))-0401)<<(7+1))|( ((0+28)+14))),	},
	{	(0+24),	{ 021, 001, '.' },	(0+23),			},
	{	(0+24),	{ '+', '-' },		(0+23),			},

	{	(0+27),	{ 023 },		((0+28)+15),			},
	{	(0+27),	{ ' ', '\t' },		(0+27),			},
	{	(0+27),	{ '\f', '\013' },		((0+28)+10),			},

	{	(-1),	{ 0 },			0,			}
};

short		_pp_fsmtab[(0+28)+1][255+1];

char		_pp_trigraph[255+1];

static char	spl[] = { '\\', '\r', 0 };
static char	aln[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$@";

static char*	let = &aln[10];
static char	hex[] = "fedcbaFEDCBA9876543210";
static char*	dec = &hex[12];
static char*	oct = &hex[14];

void
ppfsm __PARAM__((int op, register char* s), (op, s)) __OTORP__(int op; register char* s;)
{
	register int			c;
	register int			n;
	register int			i;
	register short*			rp;
	register struct fsminit*	fp;

	switch (op)
	{
	case 4:
		for (fp = fsminit;; fp++)
		{
			if ((n = fp->nextstate) >= (0+28)) n = ~n;
			if (fp->state == (-1))
				break;
			rp = _pp_fsmtab[fp->state];
			for (i = 0; i < sizeof(fp->ch) && (c = fp->ch[i]); i++)
			{
				switch (c)
				{
				case 023:
					for (c = 0; c <= 255; c++)
						rp[c] = n;
					/* FALLTHROUGH */

				case 002:
					_pp_fsmtab[(0+28)][fp->state+1] = n < 0 ? ~n : n;
					continue;

				case 021:
					s = let;
					break;

				case 003:
					s = hex;
					break;

				case 001:
					s = dec;
					break;

				case 022:
					s = oct;
					break;

				default:
					rp[c] = n;
					continue;
				}
				while (c = *s++)
					rp[c] = n;
			}
		}
		for (i = 0; i < (0+28); i++)
		{
			rp = _pp_fsmtab[i];
			s = spl;
			while (c = *s++)
				if (c != '@' || !(( rp)>=_pp_fsmtab[(0+13)]&&( rp)<=_pp_fsmtab[(0+18)]))
				{
					if (rp[c] >= 0) rp[c] = ~rp[c];
					rp[c] &= ~(1<<7);
				}
			rp[0] = ~((0+28)+2);
			for (c = 0; c <= 255; c++)
				if (rp[c] == i)
					rp[c] = 0;
		}
		_pp_fsmtab[(0+28)][0] = ~((0+28)+2);
		break;
	}
}

extern __MANGLE__  long	strkey  __PROTO__((const char*));

typedef struct Key_s
{
	const char*	name;
	size_t		size;
	int		hit;
	int		val;
} Key_t;

typedef struct Proto_s 
{
	int		brace;		 
	int		call;		 
	int		fd;		 
	char*		file;		 
	long		flags;		 
	long		options;	 
	char*		package;	 
	int		line;		 
	int		test;		 

	char*		tp;		 

	int		iz;		 
	char*		ib;		 
	char*		ip;		 

	int		oz;		 
	char*		ob;		 
	char*		op;		 
	char*		ox;		 

	char		cc[3];		 
	char		pushback[4];	 

	char		variadic[256];	    
} Proto_t;

static const Key_t	pragmas[] =
{
	{ "prototyped",sizeof( "prototyped")-1, 0x01, 1},	 
	{ "noprototyped",sizeof( "noprototyped")-1, 0x01, 0},
	{ "noticed",sizeof( "noticed")-1, 0x02, 1},
	{ "nonoticed",sizeof( "nonoticed")-1, 0x02, 0},
};

static const Key_t	notices[] =
{
	{ "Copyright",sizeof( "Copyright")-1, 0x02, 1},
	{ "COPYRIGHT",sizeof( "COPYRIGHT")-1, 0x02, 1},
	{ "copyright",sizeof( "copyright")-1, 0x02, 1},
	{ "Public Domain",sizeof( "Public Domain")-1, 0x02, 0},
	{ "PUBLIC DOMAIN",sizeof( "PUBLIC DOMAIN")-1, 0x02, 0},
};

static char*
number __PARAM__((register char* p, register long n), (p, n)) __OTORP__(register char* p; register long n;)
{
	register long	d;

	for (d = 1000000; d > 1; d /= 10)
		if (n >= d) *p++ = '0' + (n / d) % 10;
	*p++ = '0' + n % 10;
	return p;
}

static int		errors;

static int
sstrlen __PARAM__((register const char* s), (s)) __OTORP__(register const char* s;)
{
	register const char*	b;

	for (b = s; *s; s++);
	return s - b;
}

static int
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;)
{
	register const char*	e = s + n;

	while (s < e)
	{
		if (*s != *t || !*s)
			return *s - *t;
		s++;
		t++;
	}
	return 0;
}

static char*
strcopy __PARAM__((register char* s, register const char* t), (s, t)) __OTORP__(register char* s; register const char* t;)
{
	while (*s++ = *t++);
	return s - 1;
}

static void
proto_error __PARAM__((char* iob, int level, char* msg, char* arg), (iob, level, msg, arg)) __OTORP__(char* iob; int level; char* msg; char* arg;)
{
	register char*	p;
	char		buf[1024];

	p = strcopy(buf, "proto: ");
	if (iob)
	{
		register Proto_t*	proto = (Proto_t*)(iob - sizeof(Proto_t));

		if (proto->line)
		{
			if (proto->file)
			{
				*p++ = '"';
				p = strcopy(p, proto->file);
				*p++ = '"';
				*p++ = ',';
				*p++ = ' ';
			}
			p = strcopy(p, "line ");
			p = number(p, proto->line);
		}
		else if (proto->file)
			p = strcopy(p, proto->file);
	}
	else
	{
		p = strcopy(p, msg);
		msg = arg;
		arg = 0;
	}
	if (*(p - 1) != ' ')
	{
		*p++ = ':';
		*p++ = ' ';
	}
	if (level == 1)
		p = strcopy(p, "warning: ");
	p = strcopy(p, msg);
	if (arg)
	{
		*p++ = ' ';
		p = strcopy(p, arg);
	}
	*p++ = '\n';
	write(2, buf, p - buf);
	if (level >= 3)
		exit(level - 2);
	if (level >= 2)
		errors++;
}

static char*
memcopy __PARAM__((register char* s, register char* t, int n), (s, t, n)) __OTORP__(register char* s; register char* t; int n;)
{
	register char*	e = t + n;

	while (t < e) *s++ = *t++;
	return s;
}

static char*
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;)
{
	if (proto->flags & (1L<<13))
	{

		p = strcopy(p, "\n#line ");

		p = number(p, n);
		*p++ = '\n';
	}
	return p;
}

static char*
init __PARAM__((Proto_t* proto, char* op, int flags), (proto, op, flags)) __OTORP__(Proto_t* proto; char* op; int flags;)
{
	register char*	s;
	if (flags & (1L<<10))
	{
		op = 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\
");
	}
	else
		op = 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\
");
	if (proto->package)
	{
		s = "\
#ifndef	__MANGLE_%_DATA__\n\
#  ifdef _BLD_%\n\
#    ifdef __EXPORT__\n\
#      define	__MANGLE_%_DATA__	__MANGLE__ __EXPORT__\n\
#    else\n\
#      define	__MANGLE_%_DATA__	__MANGLE__\n\
#    endif\n\
#    define	__MANGLE_%_FUNC__	__MANGLE__\n\
#  else\n\
#    ifdef __IMPORT__\n\
#      define	__MANGLE_%_DATA__	__MANGLE__ __IMPORT__\n\
#    else\n\
#      define	__MANGLE_%_DATA__	__MANGLE__\n\
#    endif\n\
#    define	__MANGLE_%_FUNC__	__MANGLE__\n\
#  endif\n\
#endif\n\
";
		for (;;)
		{
			switch (*op++ = *s++)
			{
			case 0:
				op--;
				break;
			case '%':
				op = strcopy(op - 1, proto->package);
				continue;
			default:
				continue;
			}
			break;
		}
	}
	return op;
}

static char*
nns __PARAM__((register char* s), (s)) __OTORP__(register char* s;)
{
	while (*s == ' ' || *s == '\t' || *s == '\n')
		s++;
	return s;
}

static int
directive __PARAM__((register char* s, int dir), (s, dir)) __OTORP__(register char* s; int dir;)
{
	switch (*(s = nns(s)))
	{
	case 'e':
	case 'i':
		dir <<= 2;
		switch (*++s)
		{
		case 'f':
			dir |= 01;
			break;
		case 'l':
			dir |= 02;
			break;
		case 'n':
			dir |= 03;
			break;
		}
		break;
	}
	return dir;
}

static int
lex __PARAM__((register Proto_t* proto, register long flags), (proto, flags)) __OTORP__(register Proto_t* proto; register long flags;)
{
	register char*		ip;
	register char*		op;
	register int		c;
	register int		state;
	register short*		rp;
	char*			m;
	char*			e;
	char*			t;
	char*			bp;
	char*			v;
	char*			im;
	char*			ko;
	char*			aom;
	int			n;
	int			line;
	int			quot;
	int			brack;
	int			sub;
	int			x;
	int			vc;

	char*			ie = 0;
	char*			om = 0;
	char*			aim = 0;
	char*			aie = 0;
	char*			func = 0;
	int			call = 0;
	int			dir = 0;
	int			group = 0;
	int			last = 0;
	int			paren = 0;

	char*			qe = 0;
	int			qn = 0;
	int			args = 0;

	do{(ip=proto->ip);(op=proto->op);call=proto->call;}while(0);

	if (flags & (1L<<5)) (ko=op);

 fsm_start:
	proto->tp = ip;
	state = 0;
	bp = ip;
	do
	{
		rp = _pp_fsmtab[state];
 fsm_get:
		while (!(state = rp[c = (*(unsigned char*)ip++)]));
 fsm_next:
		;
	} while (state > 0);
	if ((n = ip - bp - 1) > 0)
	{
		ip = bp;
		do switch(n)
		{
			default:
				memcopy(op, ip, n);
				op += n;
				ip += n;
				break;
			case 7:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 6:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 5:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 4:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 3:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 2:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 1:
				*op++ = *ip++;
				/*FALLTHROUGH */
			case 0:
				break;
		} while (0);
		ip++;
	}
	state = ~state;
 fsm_terminal:
	switch ((( state)&((1<<(7+1))-1)))
	{
	case ((0+28)+11):
		if (op > proto->ob && *(op - 1) == '=' && (op == proto->ob + 1 || *(op - 2) != '=')) switch (c)
		{
		case '+':
		case '-':
		case '*':
		case '&':
			(*op++=( ' '));
			break;
		}
		(*op++=( c));
		break;

	case ((0+28)+0):
		(ip--);
		c = (*(op-1));
		break;

	case ((0+28)+1):
		switch (c)
		{
		case '\n':
			if ((( rp)>=_pp_fsmtab[(0+16)]&&( rp)<=_pp_fsmtab[(0+18)])) goto fsm_newline;
			(*op++=( c));
			proto->line++;
			rp = _pp_fsmtab[(0+13)];
			break;
		case '/':

			if ((flags & ((1L<<5)|(1L<<15))) == (1L<<5)) (op=ko);
			else

			(*op++=( c));
			if ((( rp)>=_pp_fsmtab[(0+16)]&&( rp)<=_pp_fsmtab[(0+18)]))
			{
				rp = _pp_fsmtab[(0+16)];
				break;
			}
			goto fsm_start;
		case (255+1):
			break;
		default:

			if ((flags & ((1L<<5)|(1L<<15))) == (1L<<5)) (op=ko);
			else

			(*op++=( c));
			rp = _pp_fsmtab[(( rp)>=_pp_fsmtab[(0+16)]&&( rp)<=_pp_fsmtab[(0+18)]) ? (0+16) : (0+14)];
			break;
		}
		bp = ip;
		goto fsm_get;

	case ((0+28)+2):
		if (c)
		{
			if (state = _pp_fsmtab[(0+28)][((( rp)-_pp_fsmtab[0])/(255+1))+1])
				goto fsm_terminal;
			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);
			return 0;
		}
		(ip--);
 fsm_eob:
		if ((flags & ((1L<<1)|((1L<<16))|(1L<<21))) == ((1L<<16)) && (proto->flags & (1L<<16)))
		{

			if (!(flags & (1L<<5)))  

			flags |= (1L<<24);
			c = ip - proto->ib;
			if (!(flags & (1L<<15)))
				im = proto->tp;
			if (ip > proto->ib)
			{
				n = ip - im;
				if (ip - n < proto->ib)
					proto->flags |= (1L<<4);
				memcopy(proto->ib - n, ip - n, n);
				ip = proto->ib;
			}
			proto->tp -= c;
			if (flags & (1L<<15))
			{
				im -= c;
				ie -= c;
			}
			if (aim)
				aim -= c;
			if (aie)
				aie -= c;
			if ((n = read(proto->fd, ip, proto->iz)) > 0)
			{
				if ((proto->options & (1L<<0)) && n < proto->iz)
				{
					proto->flags &= ~(1L<<16);
					close(proto->fd);
				}
				*(ip + n) = 0;
				if (state & (1<<7))
					goto fsm_splice;
				bp = ip;
				goto fsm_get;
			}
			*ip = 0;
			proto->flags &= ~(1L<<16);
			close(proto->fd);
		}
		if (state & (1<<7))
			goto fsm_splice;

		if (!(flags & (1L<<21)) && (state = rp[c = (255+1)]))
		{
			bp = ip;
			goto fsm_next;
		}
		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);
		return 0;

	case ((0+28)+3):
		quot = c;

		if (c == '"' && qe)
		{
			for (n = 0, t = qe + 1; t < op && (*t == ' ' || *t == '\t' || *t == '\n' && ++n || *t >= 'A' && *t <= 'Z' || *t == '_'); t++);
			if (t == op)
			{
				op = qe;
				qe = 0;
				qn = n;
			}
			else (*op++=( c));
		}
		else

		(*op++=( c));
		rp = _pp_fsmtab[(0+21)];
		bp = ip;
		goto fsm_get;

	case ((0+28)+4):
		if (c == quot)
		{

			if (!(flags & (1L<<3)))
				qe = (c == '"') ? op : (char*)0;

			(*op++=( c));

			while (qn > 0)
			{
				qn--;
				(*op++=( '\n'));
			}

		}
		else if (c != '\n' && c != (255+1))
		{
			(*op++=( c));
			bp = ip;
			goto fsm_get;
		}
		else
		{

			while (qn > 0)
			{
				qn--;
				(*op++=( '\n'));
			}

			(ip--);
		}
		c = (0401+1);
		break;

	case ((0+28)+5):

		if (flags & (1L<<0)) (*op++=( c));
		else

		switch (c)
		{
		case 'a':
			n = (('A'==0301)?0057:0007);
			goto fsm_oct;
		case 'E':
			n = (('A'==0301)?0047:0033);
			goto fsm_oct;
		case 'v':
			n = 0013;
			goto fsm_oct;
		case 'x':
			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);
			lex(proto, (flags & ((1L<<16))) | (1L<<21));
			for (n = x = 0; (c = (*(unsigned char*)ip++)), x < 3; x++) switch (c)
			{
			case '0': case '1': case '2': case '3':
			case '4': case '5': case '6': case '7':
			case '8': case '9':
				n = (n << 4) + c - '0';
				break;
			case 'a': case 'b': case 'c': case 'd':
			case 'e': case 'f':
				n = (n << 4) + c - 'a' + 10;
				break;
			case 'A': case 'B': case 'C': case 'D':
			case 'E': case 'F':
				n = (n << 4) + c - 'A' + 10;
				break;
			default:
				goto fsm_hex;
			}
 fsm_hex:
			(ip--);
 fsm_oct:
			(*op++=( ((n >> 6) & 07) + '0'));
			(*op++=( ((n >> 3) & 07) + '0'));
			(*op++=( (n & 07) + '0'));
			break;
		default:
			(*op++=( c));
			break;
		}
		rp = _pp_fsmtab[(0+21)];
		bp = ip;
		goto fsm_get;

	case ((0+28)+6):
		(ip--);

		if ((flags & (1L<<5)) && *proto->tp == 's' && !sstrncmp( proto->tp, "static", 6))
		{
			c = ((0500+4)+9);
			break;
		}

		if (*proto->tp == '_' && !sstrncmp( proto->tp, "__STDPP__directive", 6)) c = '#';
		else c = (0401+0);

		break;

	case ((0+28)+7):
 fsm_newline:
		proto->line++;

		if (flags & (1L<<5))
		{
			if (op != proto->ob && (*(op-1)) != ' ' && (*(op-1)) != '\n')
				(*op++=( ' '));
		}
		else

		(*op++=( c));
		if (flags & (1L<<3))
		{

			if (flags & (1L<<0))
			{
				if (flags & (1L<<5)) (op=ko);
				if (flags & (1L<<12))
				{
					*(ip - 1) = 0;
					op = strcopy(om, "/* ");
					op = strcopy(op, im);
					op = strcopy(op, " */\n");
				}
				flags &= ~((1L<<2)|(1L<<3)|(1L<<7)|(1L<<8)|(1L<<12)|(1L<<15)|(1L<<22)|(1L<<26));
			}
			else

			{
				if ((flags & ((1L<<2)|(1L<<22))) == ((1L<<2)|(1L<<22)))
				{
					*(ip - 1) = 0;
					op = strcopy(om, "#if defined(__STDC__) || defined(__STDPP__)\n");
					op = strcopy(op, im);
					op = strcopy(op, "\n#else\n");
					bp = ip;
					ip = im;
					*op++ = *ip++;
					while (*op = *ip++)
						if (*op++ == '#' && *ip != '(')
						{
							op--;
							while (*--op == ' ' || *op == '\t');
							if (*ip == '#')
							{
								op = strcopy(op + 1, "/**/");
								while (*++ip == ' ' || *ip == '\t');
							}
							else
							{
								if (*op != '"') *++op = '"';
								op++;
								while (*ip == ' ' || *ip == '\t') ip++;
								while ((c = *ip) >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '_') *op++ = *ip++;
								while (*ip == ' ' || *ip == '\t') ip++;
								if (*ip == '"') ip++;
								else *op++ = '"';
							}
						}
					ip = bp;
					op = strcopy(op, "\n#endif\n");
					op = linesync(proto, op, proto->line);
				}
				flags &= ~((1L<<2)|(1L<<3)|(1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<22)|(1L<<23)|(1L<<25)|(1L<<26));
			}
			call = 0;
			group = 0;
			paren = 0;
			last = '\n';
		}
		if (paren == 0 && (flags & ((1L<<15)|(1L<<21)|(1L<<23)|(1L<<24))) == (1L<<24))
		{

			if (flags & (1L<<5)) (op=ko);

			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);
			return 0;
		}
		goto fsm_start;

	case ((0+28)+8):
		(*op++=( c));
		rp = _pp_fsmtab[((( state)>>(7+1))&((1<<7)-1))];
		bp = ip;
		goto fsm_get;

	case ((0+28)+13):
		(*op++=( c));
		c = (((( state)>>(7+1))&((1<<7)-1))+0401);
		break;

	case ((0+28)+14):
		(ip--);
		c = (((( state)>>(7+1))&((1<<7)-1))+0401);
		break;

	case (((0+28)+12)):
		(ip--);
		c = (0401+0);
		if (!(flags & (1L<<1))) switch (((((long)( *proto->tp))<<16)|(((long)( *(ip - 1)))<<8)|((long)( ip - proto->tp))))
		{
		case ((((long)( 'N'))<<16)|(((long)( 'N'))<<8)|((long)( 3))):
			if (proto->tp[1] == 'o')
				c = ((0500+4)+6);
			break;
		case ((((long)( 'd'))<<16)|(((long)( 'o'))<<8)|((long)( 2))):
			c = ((0500+4)+6);
			break;
		case ((((long)( 'e'))<<16)|(((long)( 'e'))<<8)|((long)( 4))):
			if (!(flags & (1L<<21)) && (flags & ((1L<<3)|(1L<<25))) != (1L<<3) && !sstrncmp( proto->tp, "else", 4))
			{
				c = ((0500+4)+8);
				goto fsm_id;
			}
			break;
		case ((((long)( 'e'))<<16)|(((long)( 'n'))<<8)|((long)( 6))):
			if (!sstrncmp( proto->tp, "extern", 6))
				c = ((0500+4)+9);
			break;
		case ((((long)( 'f'))<<16)|(((long)( 'r'))<<8)|((long)( 3))):
			if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "for", 3))
			{
				c = ((0500+4)+11);
				goto fsm_id;
			}
			break;
		case ((((long)( 'i'))<<16)|(((long)( 'f'))<<8)|((long)( 2))):
			c = ((0500+4)+13);
			break;
		case ((((long)( 'i'))<<16)|(((long)( 'e'))<<8)|((long)( 6))):
			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))
			{
				flags |= (1L<<23);
				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);
				line = proto->line;
				op = strcopy(op - 6, "__INLINE__");
				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);
			}
			break;
		case ((((long)( 'r'))<<16)|(((long)( 'n'))<<8)|((long)( 6))):
			if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "return", 6))
			{
				c = ((0500+4)+17);
				goto fsm_id;
			}
			break;
		case ((((long)( 's'))<<16)|(((long)( 'c'))<<8)|((long)( 6))):
			if ((proto->options & (1L<<6)) && !sstrncmp( proto->tp, "static", 6))
			{
				proto->ox = op - 6;
				flags |= (1L<<6);
			}
			break;
		case ((((long)( 't'))<<16)|(((long)( 'f'))<<8)|((long)( 7))):
			if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "typedef", 7))
			{
				flags |= (1L<<26);
				c = ((0500+4)+9);
			}
			break;
		case ((((long)( 'v'))<<16)|(((long)( 't'))<<8)|((long)( 8))):
			if (*ip == '(' && !sstrncmp( proto->tp, "va_start", 8)) c = (0500+1);
			break;
		case ((((long)( 'v'))<<16)|(((long)( 'd'))<<8)|((long)( 4))):
			if (!sstrncmp( proto->tp, "void", 4))
			{
				if (flags & ((1L<<0)|(1L<<19)|(1L<<10)|(1L<<11))) c = ((0500+4)+30);
				else
				{
					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);
					line = proto->line;
					if (lex(proto, (flags & ((1L<<16))) | (1L<<21)) == '*')
					{
						memcopy(op - 4, "__V_", 4);
						memcopy(ip - 4, "__V_", 4);
					}
					else c = ((0500+4)+30);
					proto->line = line;
					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);
					bp = ip;
				}
			}
			break;
		case ((((long)( 'w'))<<16)|(((long)( 'e'))<<8)|((long)( 5))):
			if (!(flags & (1L<<21)) && !sstrncmp( proto->tp, "while", 5))
			{
				c = ((0500+4)+26);
				goto fsm_id;
			}
			break;
		}

		if ((flags & (1L<<0)) && c != ((0500+4)+9))
			c = (0401+0);

		break;

	case ((0+28)+10):
		goto fsm_start;

	case ((0+28)+15):
		(ip--);

		if ((flags & ((1L<<5)|(1L<<15))) == (1L<<5))
		{
			while (op > proto->ob && (*(op - 1) == ' ' || *(op - 1) == '\t'))
				op--;
			if (op > proto->ob && *(op - 1) != '\n') *op++ = ' ';
		}

		goto fsm_start;

	default:
		if (state & (1<<7))
		{
			if (c == '\\')
			{
				if (!(n = (*(unsigned char*)ip++)))
				{
					goto fsm_eob;
 fsm_splice:
					c = '\\';
					n = (*(unsigned char*)ip++);
				}
				if (n == '\n')
				{
					proto->line++;
					(*op++=( '\\'));
					(*op++=( '\n'));
					bp = ip;
					goto fsm_get;
				}
				(ip--);
			}
			state &= ~(1<<7);
			if (state >= (0+28))
				goto fsm_terminal;
			rp = _pp_fsmtab[state];
		}
		(*op++=( c));
		bp = ip;
		goto fsm_get;
	}
	if (!(flags & ((1L<<10)|(1L<<11)|(1L<<21))))
	{
		if (!(flags & (1L<<3))) switch (c)
		{
		case '(':

			if (!(flags & (1L<<0)) || proto->brace == 0)
			{
				if (paren++ == 0)
				{

					if (!(flags & (1L<<0)) || group <= 1)
					{

						args = 0;

						if (group++ == 0) group++;
						else if (flags & (1L<<8)) call++;
						flags |= (1L<<15);
						im = ip - 1;
						om = op - 1;
					}
					sub = 0;
				}
				else if (paren == 2 && !aim)
				{
					sub++;
					if (last == '(')
					{
						flags &= ~(1L<<15);
						om = 0;
					}
					else if (flags & (1L<<8))
					{
						aim = ip - 1;
						aom = op - 1;
					}
					else if ((flags & ((1L<<15)|(1L<<25))) == (1L<<15))
					{
						for (m = ip - 2; m > im && (*m == ' ' || *m == '\t'); m--);
						if (m != im && sub == 1)
						{
							m = im + (*nns(ip) == '*');
						}
						if (m == im)
						{
							flags &= ~(1L<<15);
							om = 0;
						}
					}
					else if ((flags & (1L<<15)) && sub == 1 && *nns(ip) != '*')
					{
						flags &= ~(1L<<15);
						om = 0;
					}
				}
				flags &= ~(1L<<25);
			}
			break;
		case ')':

			if (!(flags & (1L<<0)) || proto->brace == 0)

			if (--paren == 0)
			{

				if (flags & (1L<<0))
				{
					if (group != 2)
					{
						c = (0401+0);
						break;
					}
					group++;
				}

				ie = ip;
			}
			else if (paren == 1 && (flags & (1L<<8)) && !aie)
				aie = ip;
			break;
		case '*':
			if (last == '(' && group == 2)
			{
				group--;
				if (paren == 1)
				{
					flags |= (1L<<8);
					aim = aie = 0;
				}
			}
			break;
		case '#':
			dir = directive(ip, dir);
			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))
				flags |= (1L<<3);
			else if (!(flags & ((1L<<1)|(1L<<3))))
			{
				flags |= (1L<<3);
				if (!(flags & (1L<<19)))
				{
					bp = ip;
					while (*ip == ' ' || *ip == '\t') ip++;
					if (*ip == 'l' && *++ip == 'i' && *++ip == 'n' && *++ip == 'e')
					{
						if (*++ip == ' ' || *ip == '\t')
						{
							proto->line = 0;
							while (*++ip >= '0' && *ip <= '9')
								proto->line = proto->line * 10 + *ip - '0';
							proto->line--;
						}
					}

					else if ((flags & ((1L<<0)|(1L<<5))) == (1L<<0))
					{
						n = 0;
						t = ip + 6;
						while (ip < t && *ip >= 'a' && *ip <= 'z')
							n = ((( n)<<5)+(( *ip++)-('a'-1)));
						switch (n)
						{
						case ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'l')-('a'-1))))<<5)+(( 's')-('a'-1))))<<5)+(( 'e')-('a'-1))):
						case ((( ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'f')-('a'-1))):
							while (*ip == ' ' || *ip == '\t') ip++;
							if (*ip != '\n' && *ip != '/' && *(ip + 1) != '*')
							{
								flags |= (1L<<12)|(1L<<15);
								im = ip;
								om = op + (ip - bp);
							}
							break;
						case ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'l')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'f')-('a'-1))):
						case ((( ((( ((( ((( (( 'e')-('a'-1)))<<5)+(( 'r')-('a'-1))))<<5)+(( 'r')-('a'-1))))<<5)+(( 'o')-('a'-1))))<<5)+(( 'r')-('a'-1))):
						case ((( (( 'i')-('a'-1)))<<5)+(( 'f')-('a'-1))):
						case ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'f')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))):
						case ((( ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'f')-('a'-1))))<<5)+(( 'n')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))):
						case ((( ((( ((( ((( (( 'u')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'd')-('a'-1))))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))):
							break;
						case ((( ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'c')-('a'-1))))<<5)+(( 'l')-('a'-1))))<<5)+(( 'u')-('a'-1))))<<5)+(( 'd')-('a'-1))):
							if (*ip == 'e') ip++;
 							/* FALLTHROUGH */
						case ((( ((( ((( ((( ((( (( 'd')-('a'-1)))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'n')-('a'-1))))<<5)+(( 'e')-('a'-1))):
						case ((( ((( ((( ((( ((( (( 'p')-('a'-1)))<<5)+(( 'r')-('a'-1))))<<5)+(( 'a')-('a'-1))))<<5)+(( 'g')-('a'-1))))<<5)+(( 'm')-('a'-1))))<<5)+(( 'a')-('a'-1))):
							if (*ip < 'a' || *ip > 'z') break;
							/* FALLTHROUGH */
						default:
							flags |= (1L<<12)|(1L<<15);
							im = bp - 1;
							om = op - 1;
							break;
						}
					}
					else

					{
						if (*ip == 'i' && *++ip == 'n' && *++ip == 'c' && *++ip == 'l' && *++ip == 'u' && *++ip == 'd' && *++ip == 'e')
						{
							while (*++ip == ' ' || *ip == '\t');
							if (*ip++ == '<' && *ip++ == 's' && *ip++ == 't' && *ip++ == 'd' && *ip++ == 'a' && *ip++ == 'r' && *ip++ == 'g' && *ip++ == '.' && *ip++ == 'h' && *ip++ == '>')
							{
								op = 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\
");
								op = linesync(proto, op, proto->line);
								break;
							}
						}
						else if (*ip == 'd' && *++ip == 'e' && *++ ip == 'f' && *++ip == 'i' && *++ip == 'n' && *++ip == 'e' && (*++ip == ' ' || *ip == '\t'))
						{
							while (*++ip == ' ' || *ip == '\t');
							if (*ip == 'e' && *++ip == 'x' && *++ ip == 't' && *++ip == 'e' && *++ip == 'r' && *++ip == 'n' && (*++ip == ' ' || *ip == '\t'))
							{
								t = ip;
								while (*++t == ' ' || *t == '\t');
								if (*t == 'e' && *++t == 'x' && *++ t == 't' && *++t == 'e' && *++t == 'r' && *++t == 'n' && (*++t == ' ' || *t == '\t' || *t == '\n' || *t == '\r'))
									ip = t;
								t = ip;
								while (*++t == ' ' || *t == '\t');
								if (*t == '_' && *(t + 1) == '_')
								{
									op = strcopy(op, "undef __MANGLE__\n");
									op = linesync(proto, op, proto->line);
									op = strcopy(op, "#define __MANGLE__ __LINKAGE__");
									break;
								}
							}
							flags |= (1L<<2)|(1L<<15);
							im = bp - 1;
							om = op - 1;
						}
						else if (*ip == 'u' && *++ip == 'n' && *++ ip == 'd' && *++ip == 'e' && *++ip == 'f' && (*++ip == ' ' || *ip == '\t'))
						{
							while (*++ip == ' ' || *ip == '\t');
							if (*ip == 'e' && *++ip == 'x' && *++ ip == 't' && *++ip == 'e' && *++ip == 'r' && *++ip == 'n' && (*++ip == ' ' || *ip == '\t' || *ip == '\n' || *ip == '\r'))
							{
								op = strcopy(op, "undef __MANGLE__\n");
								op = linesync(proto, op, proto->line);
								op = strcopy(op, "#define __MANGLE__ __LINKAGE__");
								break;
							}
							flags |= (1L<<2)|(1L<<15);
							im = bp - 1;
							om = op - 1;
						}
					}
					ip = bp;
				}
				break;
			}
			else
				break;

		case '{':
			if (proto->brace++ == 0 && paren == 0)
			{
				if (last == '=') flags |= (1L<<9);

				else if (flags & (1L<<0))
				{
					if ((flags & ((1L<<15)|(1L<<17)|(1L<<23))) == (1L<<15))
					{
						if (args)
						{
							v = number(op, args < 0 ? -args : args);
							v = strcopy(v, " argument actual/formal mismatch");
							*v++ = ' ';
							v = memcopy(v, im, ie - im);
							*v = 0;
							proto_error((char*)proto + sizeof(Proto_t), 2, op, ((char*)0));
						}
						ip--;

						v = ie;
						while (ie < ip)
							if (*ie++ == '/' && *ie == '*')
							{
								e = ie - 1;
								while (++ie < ip)
								{
									if (*ie == '*')
									{
										while (ie < ip && *ie == '*') ie++;
										if (ie < ip && *ie == '/')
										{
											while (++ie < ip && (*ie == ' ' || *ie == '\t'));
											while (e > v && (*(e - 1) == ' ' || *(e - 1) == '\t')) e--;
											if (e > v && *e != '\n') *e++ = ' ';
											t = ie;
											while (--e >= v)
												*--t = *e;
											v = t;
											break;
										}
									}
								}
							}
						ie = v;

						op = om++;
						if (flags & (1L<<5))
						{
							v = op;
							while (v > ko && *--v != ' ');
							if (*v != ' ')
							{
								om = (v = (op += 4)) + 1;
								while (v >= ko + 4)
								{
									*v = *(v - 4);
									v--;
								}
								memcopy(ko, "int ", 4);
							}
							if (*v == ' ')
							{
								while (*(v + 1) == '*')
									*v++ = '*';
								*v = '\t';
								if ((v - ko) <= 8)
								{
									om = (e = ++op) + 1;
									while (e > v)
									{
										*e = *(e - 1);
										e--;
									}
								}
							}
							om = (v = (op += 7)) + 1;
							while (v >= ko + 7)
							{
								*v = *(v - 7);
								v--;
							}
							memcopy(ko, "extern ", 7);
						}
						(*op++=( '('));
						t = op;
						e = 0;

						while (ie < ip)
						{
							if ((c = *ie) == ' ' || c == '\t' || c == '\n')
							{
								while ((c = *++ie) == ' ' || c == '\t' || c == '\n');
								if (ie >= ip) break;
								if (c != '*' && op > om) (*op++=( ' '));
							}
							if ((n = ((c = *ie) == ',')) || c == ';')
							{
								if (flags & (1L<<5))
								{
									m = op;
									while (op > om && ((c = *(op - 1)) == '(' || c == ')' || c == '[' || c == ']'))
										op--;
									v = op;
									while (op > om && (c = *(op - 1)) != ' ' && c != '*')
										op--;
									while (*(op - 1) == ' ')
										op--;
									if (!e)
									{
										e = op;
										while (e > om && *(e - 1) == '*')
											e--;
									}

									if (op <= om)
										op = strcopy(op, "int");
									else if (*(op - 1) == ',')
										op = strcopy(op, " int");

									while (v < m)
										(*op++=( *v++));
								}
								(*op++=( ','));
								if (n)
								{
									if (x = !e) e = op - 1;
									(*op++=( ' '));
									m = t;
									while (m < e)
										(*op++=( *m++));
									if (x)
									{
										m = e;
										while (*--e != ' ');
										while (*(e - 1) == '*') e--;
										op -= m - e;
									}
								}
								while ((c = *++ie) == ' ' || c == '\t' || c == '\n');
								if (ie >= ip) (op--);
								else (*op++=( ' '));
								if (!n)
								{
									t = op;
									e = 0;
								}
							}
							else if (*ie == '*')
							{
								if (op > om && (c = *(op - 1)) == ' ') op--;
								while (*ie == '*') (*op++=( *ie++));
								while (*ie == ' ' || *ie == '\t' || *ie == '\n') ie++;
								if (c != '(') (*op++=( ' '));
							}
							else if (*ie == '(')
							{
								if (op > om && *(op - 1) == ' ') op--;
								(*op++=( *ie++));
								while (*ie == ' ' || *ie == '\t' || *ie == '\n') ie++;
							}
							else if (*ie == ')')
							{
								if (op > om && *(op - 1) == '(')
									proto_error((char*)proto + sizeof(Proto_t), 1, "function pointer argument prototype omitted", ((char*)0));
								(*op++=( *ie++));
								while (*ie == ' ' || *ie == '\t' || *ie == '\n') ie++;
							}
							else if ((flags & (1L<<5)) && (op == om || *(op - 1) == ' ') && *ie == 'r' && !sstrncmp( ie, "register", 8) && (*(ie + 8) == ' ' || *(ie + 8) == '\t' || *(ie + 8) == '\n'))
							{
								ie += 8;
								if (op > om) (op--);
							}
							else (*op++=( *ie++));
						}

						if (op <= om) op = strcopy(op, "void");
						(*op++=( ')'));
						if (flags & (1L<<5))
						{
							(*op++=( ';'));
							(*op++=( '\n'));
							(proto->op=op);
							(ko=op);
						}
						else
						{
							(*op++=( '\n'));
							(*op++=( *ip));
						}
						ip++;
						flags &= ~((1L<<15)|(1L<<23));
					}
				}

				else if ((flags & ((1L<<15)|(1L<<19)|(1L<<23)|(1L<<25))) == ((1L<<15)|(1L<<25)))
				{
					line = proto->line;
					op = strcopy(om, " __PARAM__(");
					op = memcopy(op, im, ie - im);
					(*op++=( ','));
					(*op++=( ' '));
					(*op++=( '('));
					flags &= ~((1L<<15)|(1L<<23));
					if (flags & (1L<<27))
					{
						if ((vc = ie - im + 1) > sizeof(proto->variadic)) vc = sizeof(proto->variadic);
						memcopy(proto->variadic, im, vc);
						op = strcopy(op, "va_alist)) __OTORP__(va_dcl)\n{");
					}
					else
					{
						flags |= (1L<<23);
						proto->ip = im;
						proto->op = op;
						group = 0;
						brack = 0;
						for (;;)
						{
							switch (lex(proto, (flags & ((1L<<16))) | (1L<<21)))
							{
							case '[':
								brack++;
								continue;
							case ']':
								brack--;
								continue;
							case '(':
								if (paren++) group++;
								continue;
							case ')':
								if (--paren == 0)
								{
									group = 0;
									if (flags & (1L<<15))
									{
										flags &= ~((1L<<15)|(1L<<23));
										op = memcopy(op, m, e - m);
									}
									break;
								}
								continue;
							case ',':
								if (paren == 1)
								{
									group = 0;
									if (flags & (1L<<15))
									{
										flags &= ~((1L<<15)|(1L<<23));
										op = memcopy(op, m, e - m);
									}
									(*op++=( ','));
									(*op++=( ' '));
									proto->op = op;
								}
								continue;
							case (0401+0):
								if (group <= 1 && !brack)
								{
									flags |= (1L<<15);
									m = proto->tp;
									e = proto->ip;
								}
								continue;
							default:
								continue;
							}
							break;
						}
						(*op++=( ')'));
						(*op++=( ')'));
					}
					if (!(flags & (1L<<23)))
					{
						flags |= (1L<<23);
						proto->op = strcopy(op, " __OTORP__(");
						proto->ip = im + 1;
						n = *(ie - 1);
						*(ie - 1) = ';';
						c = *ie;
						*ie = 0;
						lex(proto, (flags & ((1L<<16))) | (1L<<1));
						*(ie - 1) = n;
						*ie = c;
						proto->ip = ie;
						op = proto->op;
						(*op++=( ')'));
					}
					if (flags & (1L<<6)) memcopy( proto->ox, "extern", 6);
					op = linesync(proto, op, proto->line = line);
					if (flags & (1L<<3))
					{
						proto->brace = 0;
						(*op++=( '\n'));
						(*op++=( '#'));
					}
					else if (!(flags & (1L<<27))) (*op++=( '{'));
				}
			}
			flags &= ~((1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<23));
			call = 0;
			group = 0;
			break;
		case '}':
			flags &= ~((1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<23)|(1L<<25));
			if (--proto->brace == 0)
			{
				flags &= ~((1L<<9)|(1L<<27)|(1L<<28));

				if (flags & (1L<<5)) (op=ko);

			}
			call = 0;
			group = 0;
			paren = 0;
			break;
		case '=':
			if (last == '?') flags |= (1L<<3);
			else if (paren == 0 && (flags & ((1L<<9)|(1L<<15)|(1L<<23))) == (1L<<15))
			{
				if (last == ')' && proto->brace && (group != 2 || call != 2)) flags |= (1L<<23);
				else goto fsm_statement;
			}
			goto fsm_other;
		case ',':

			if (flags & (1L<<0))
			{
				if (paren == 1) args++;
				else
				{
					args--;
					flags &= ~(1L<<15);
				}
				break;
			}

			if (paren == 0 && (flags & (1L<<1))) *(op - 1) = c = ';';

		case ';':
 fsm_statement:
			if (flags & (1L<<9))  ;

			else if (flags & (1L<<0))
			{
				if (paren == 0)
				{
					if ((flags & (1L<<15)) && last == ')')
						flags &= ~(1L<<15);
					if (!(flags & (1L<<15)))
					{
						call = 0;
						group = 0;
						flags &= ~(1L<<23);
						if (flags & (1L<<5)) (op=ko);
						if (flags & (1L<<24))
						{
							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);
							return 0;
						}
					}
					else
					{
						args--;
						if ((flags & ((1L<<5)|(1L<<23))) == ((1L<<5)|(1L<<23)))
							(op=ko);
					}
				}
			}

			else if (paren == 0)
			{
				if ((flags & ((1L<<15)|(1L<<17)|(1L<<23))) == (1L<<15) && call > 1)
				{
					if ((flags & (1L<<14)) && func)
					{
						func[0] = 'F';
						func[1] = 'U';
						func[2] = 'N';
						func[3] = 'C';
						func = 0;
					}
					if ((flags & ((1L<<1)|(1L<<8))) == (1L<<8) && aim && aie < im)
					{
						while (aie < ip && (*aie == ' ' || *aie == '\t' || *aie == '\n')) aie++;
						v = aim;
						while (v < aie)
							if (*v++ == ')') break;
						while (v < aie && (*v == ' ' || *v == '\t' || *v == '\n')) v++;
						if (v == aie || !(flags & (1L<<20)))
						{
							if (flags & (1L<<20)) n = 3;
							else if (v == aie && *v == '(') n = 10;
							else n = 11;
							ko = op;
							om += n;
							v = op += n;
							while (v >= ko + n)
							{
								*v = *(v - n);
								v--;
							}
							if (flags & (1L<<20)) memcopy(aom, "(...))", 6);
							else if (n == 10) memcopy(aom, "(__VARARG__))", 13);
							else
							{
								ko = strcopy(aom, " __PROTO__(");
								ko = memcopy(ko, aim, aie - aim);
								*ko = ')';
								if (++ko >= om)
								{
									*ko++ = ')';
									om = ko;
								}
							}
						}
					}
					else if (flags & (1L<<26))
					{
						op = om;
						while (*--op == ' ' || *op == '\t' || *op == '\n');
						if (*op != ')')
						{
							op = om += 14;
							*--op = ')';
							while ((x = *(op - 14)) >= 'A' && x <= 'Z' || x >= 'a' && x <= 'z' || x >= '0' && x <= '9' || x == '_')
								*--op = x;
							memcopy(op - 13, "(__OTORP__(*)", 13);
						}
					}
					if (flags & (1L<<17))
						;
					else if (flags & (1L<<20))
					{
						op = om;
						if (!(flags & (1L<<25))) op = strcopy(op, "(...)");
						else op = memcopy(op, im, ie - im);
						(*op++=( c));
					}
					else
					{
						if (flags & (1L<<1)) op = strcopy(om, "()");
						else if (!(flags & (1L<<25))) op = strcopy(om, "(__VARARG__)");
						else
						{
							op = strcopy(om, " __PROTO__(");
							op = memcopy(op, im, ie - im);
							(*op++=( ')'));
						}
						if (flags & (1L<<6)) memcopy( proto->ox, "extern", 6);
						(*op++=( c));
					}
					flags &= ~((1L<<15)|(1L<<27)|(1L<<28));
					if (c == ',' && !(flags & (1L<<8)))
					{
						call = 1;
						group = 0;
						break;
					}
				}
				else if (flags & ((1L<<17)|(1L<<23))) call = 0;
				if (c == ';')
				{
					flags &= ~((1L<<6)|(1L<<14)|(1L<<25)|(1L<<26));
					call = 0;
					if (flags & (1L<<24))
					{
						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);
						return 0;
					}
				}
				else call = call > 1 && c == ',';
				group = 0;
				flags &= ~((1L<<7)|(1L<<8)|(1L<<15)|(1L<<17)|(1L<<23));
			}
			else if (paren == 1 && group == 1 && !(flags & ((1L<<7)|(1L<<14)))) flags |= (1L<<25)|(1L<<17);
			break;
		case ((0500+4)+6):
		case ((0500+4)+13):
			flags |= (1L<<25)|(1L<<23);
			break;
		case ((0500+4)+9):

			if (flags & (1L<<0))
			{
				if (proto->brace == 0)
					flags |= (1L<<23);
			}
			else

			if (paren == 0 && !(flags & (1L<<26)))
			{
				flags |= (1L<<14);
				if (!(flags & (1L<<19)) || proto->package)
				{
					op = strcopy(op, " __MANGLE__");
					if (proto->package)
					{
						op = strcopy(op - 1, proto->package);
						func = op + 1;
						op = strcopy(op, "_DATA__");
					}
				}
				else
					func = 0;
			}
			break;
		case (0401+29):
			if (paren == 0 && (flags & ((1L<<1)|(1L<<27))) == (1L<<1))
			{
				op -= 3;
				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);
				return c;
			}
			if (paren == 1 && !(flags & (1L<<23)))
				flags |= (1L<<27);
			flags |= (1L<<25);
			break;
		case ((0500+4)+30):
			goto fsm_id;
		case (0500+1):
			if ((flags & ((1L<<19)|(1L<<27))) == (1L<<27))
			{
				flags &= ~(1L<<15);
				line = proto->line;
				op = strcopy(op - 8, "__VA_START__");
				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);
				for (;;)
				{
					switch (lex(proto, (flags & ((1L<<16))) | (1L<<21)))
					{
					case 0:
					case ';':
						break;
					case (0401+0):
						if (!(flags & (1L<<15)))
						{
							flags |= (1L<<15);
							m = proto->tp;
							e = proto->ip;
						}
						continue;
					default:
						continue;
					}
					break;
				}
				do{(ip=proto->ip);(op=proto->op);call=proto->call;}while(0);
				if (flags & (1L<<15))
				{
					v = m;
					n = e - m;
				}
				else
				{
					v = "ap";
					n = 2;
				}
				op = strcopy(op, " __OTORP__(");
				proto->ip = proto->variadic;
				proto->op = op;
				flags &= ~(1L<<15);
				group = 0;
				bp = proto->ip + 1;
				if (*bp == 'r' && !sstrncmp( bp, "register", 8) && (*(bp + 8) == ' ' || *(bp + 8) == '\t')) bp += 9;
				for (;;)
				{
					switch (lex(proto, (flags & ((1L<<16))) | (1L<<21)))
					{
					case '(':
						if (paren++) group++;
						continue;
					case ')':
						if (--paren == 0)
						{
							if (flags & (1L<<15))
							{
								flags &= ~(1L<<15);
								if (!(flags & (1L<<28)))
								{
									op = memcopy(op, m, e - m);
									op = strcopy(op, " = ");
								}
								op = strcopy(op, "va_arg(");
								op = memcopy(op, v, n);
								(*op++=( ','));
								(*op++=( ' '));
								if (m > bp) op = memcopy(op, bp, m - bp);
								else op = strcopy(op, "int ");
								if (group > 1) op = strcopy(op, ")()");
								else op = memcopy(op, e, proto->ip - e - 1);
								(*op++=( ')'));
								(*op++=( ';'));
							}
							group = 0;
							break;
						}
						continue;
					case ',':
						if (paren == 1)
						{
							if (flags & (1L<<15))
							{
								flags &= ~(1L<<15);
								if (!(flags & (1L<<28)))
								{
									op = memcopy(op, m, e - m);
									op = strcopy(op, " = ");
								}
								op = strcopy(op, "va_arg(");
								op = memcopy(op, v, n);
								(*op++=( ','));
								(*op++=( ' '));
								if (m > bp) op = memcopy(op, bp, m - bp);
								else op = strcopy(op, "int ");
								if (group > 1) op = strcopy(op, ")()");
								else op = memcopy(op, e, proto->ip - e - 1);
								(*op++=( ')'));
								(*op++=( ';'));
								bp = proto->ip + 1;
								if (*bp == 'r' && !sstrncmp( bp, "register", 8) && (*(bp + 8) == ' ' || *(bp + 8) == '\t')) bp += 9;
							}
							group = 0;
							proto->op = op;
						}
						continue;
					case (0401+0):
						if (group <= 1)
						{
							flags |= (1L<<15);
							m = proto->tp;
							e = proto->ip;
						}
						continue;
					default:
						continue;
					}
					break;
				}
				op = strcopy(op, ")");
				flags |= (1L<<28);
				proto->line = line;
				call = 0;
				break;
			}
			/* FALLTHROUGH */
		case (0401+0):
 fsm_id:

			if (flags & (1L<<0))
			{
				if (!args && paren == 1) args++;
				break;
			}

			if (paren == 0)
			{
				if (last == ')')
				{
					if (proto->brace == 0 && !(flags & (1L<<1))) flags |= (1L<<23);
					call = !call;
				}
				else if ((flags & (1L<<23)) || c == (0401+0) || c == ((0500+4)+30)) call++;
				else flags |= (1L<<23);
				if (last == (0401+0)) flags |= (1L<<7);
			}
			c = (0401+0);
			flags |= (1L<<25);
			break;
		case (0401+1):
			if (*proto->tp >= '0' && *proto->tp <= '9')
			{
				n = 0;
				for (;; op--)
				{
					switch (*(op - 1))
					{
					case 'f':
					case 'F':
						t = op;
						while ((c = *--t) >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z');
						if (*t == '.')
							op--;
						n = 0;
						break;
					case 'l':
					case 'L':
						if (!(n & 01))
						{
							n |= 01;
							t = op;
							while ((c = *--t) >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z');
							if (*t == '.')
							{
								n = 0;
								op--;
								break;
							}
						}
						continue;
					case 'u':
					case 'U':
						n |= 02;
						continue;
					}
					break;
				}
				if (n & 01)
					*op++ = 'L';
				if (n & 02)
				{
					m = op;
					t = op = m + 10;
					while ((c = *--m) >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
						*--t = c;
					c = *t;
					strcopy(m + 1, "(unsigned)");
					*t = c;
					break;
				}
			}
			goto fsm_other;

		case '[':
			if ((flags & (1L<<0)) && paren == 0 && group <= 2) flags |= (1L<<23);

		default:
 fsm_other:

			if (flags & (1L<<0)) break;

			flags |= (1L<<25);
			if (paren == 0) flags |= (1L<<17);
			break;
		}
		else if (c == '#' && *ip != '(') flags |= (1L<<22);
		last = c;

		if ((flags & ((1L<<5)|(1L<<15))) == ((1L<<5)|(1L<<15)) && ((flags & ((1L<<3)|(1L<<23))) || proto->brace || c != '(' && c != ')' && c != '*' && c != (0401+0)))
			(op=proto->op);
		else

		(proto->op=op);
		goto fsm_start;
	}
	else if (flags & ((1L<<10)|(1L<<11)))
	{

		if ((flags & (1L<<29)) && c == '%' && *ip == '{')
			t = 0;
		else

		{
			if (c == '#')
			{
				for (t = ip; *t == ' ' || *t == '\t'; t++);
				if (*t++ == 'i' && *t++ == 'f' && *t++ == 'n' && *t++ == 'd' && *t++ == 'e' && *t++ == 'f')
				{

						t = 0;
				}
			}
			else
				t = "";
		}
		if (t)
		{

			n = ip - proto->tp;
			ip -= n;
			op -= n;

		}
		else
			while (*ip != '\n')
				*op++ = *ip++;
		op = init(proto, op, flags);
		op = linesync(proto, op, proto->line);
		flags &= ~((1L<<10)|(1L<<11));
		proto->flags &= ~((1L<<10)|(1L<<11));
		goto fsm_start;
	}
	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);
	return c;
}

void
pppclose __PARAM__((char* iob), (iob)) __OTORP__(char* iob;)
{
	register Proto_t*	proto = (Proto_t*)(iob - sizeof(Proto_t));

	if (proto->flags & (1L<<16)) close(proto->fd);
	free((char*)proto);  
}

char*
pppopen __PARAM__((char* file, int fd, char* package, char* comment, int flags), (file, fd, package, comment, flags)) __OTORP__(char* file; int fd; char* package; char* comment; int flags;)
{
	register Proto_t*	proto;
	register char*		iob;
	register long		n;
	register char*		s;
	char*			t;
	int			pragma;
	int			clr;
	int			hit;
	int			i;
	int			z;
	char*			b;

	char			com[80];

	int			m = 0;

	static int		retain;

	if (flags & (1<<0)) flags &= ~(1<<5);

	if (flags & (1<<11)) flags &= ~retain;
	else retain &= (1<<6);
	if (file && (fd = open(file, O_RDONLY)) < 0) return 0;

	{
		n = (16*1024);
		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)))))
			return 0;
		proto->iz = n;
		proto->oz = 3 * n;
		proto->flags |= (1L<<16);
	}
	proto->fd = fd;
	proto->package = package;
	iob = (char*)proto + sizeof(Proto_t);
	proto->op = proto->ob = iob;
	proto->ip = proto->ib = iob + proto->oz + n;
	if (m) proto->options |= (1L<<0);
	if (!comment)
		comment = "/*";
	else if (comment[1])
	{
		proto->cc[1] = comment[1];
		proto->cc[2] = comment[2] ? comment[2] : comment[0];
	}
	else
		proto->cc[1] = proto->cc[2] = comment[0];

	n = read(fd, proto->ip, proto->iz);
	if (!(proto->flags & (1L<<16)))
		close(fd);
	if (n < 0)
	{
		pppclose(iob);
		return 0;
	}
	*(proto->ip + n) = 0;

	/* license comment */
	*com = 0;

	hit = 0x02;
	pragma = -1;
	s = proto->ip;
	m = 80;
	while (m-- > 0 && *s && hit != (0x01|0x02))
	{
		while (*s == ' ' || *s == '\t')
			s++;
		if (*s == '#')
		{
			b = s++;
			while (*s == ' ' || *s == '\t')
				s++;
			if (*s == *"pragma"&& !sstrncmp( s, "pragma", sizeof("pragma") - 1) && (*(s += sizeof("pragma") - 1) == ' ' || *s == '\t'))
			{
				clr = 0;
				while (*s && *s != '\r' && *s != '\n')
				{
					for (; *s == ' ' || *s == '\t'; s++);
					for (t = s; *s && *s != ' ' && *s != '\t' && *s != '\r' && *s != '\n'; s++);
					z = s - t;
					for (i = 0; i < (sizeof( pragmas)/sizeof( pragmas[0])); i++)
						if (pragmas[i].size == z && !sstrncmp( t, pragmas[i].name, z))
						{
							clr = 1;
							hit |= pragmas[i].hit;
							switch (pragmas[i].hit)
							{
							case 0x01:
								pragma = pragmas[i].val;
								break;
							}
						}
				}
				if (clr)
				{

					if (!(flags & (1<<1)) || (flags & (1<<8)))

					for (; b < s; *b++ = ' ');
				}
			}
		}
		else if (*s == *"/* : : generated by proto : : */\n"&& !sstrncmp( s, "/* : : generated by proto : : */\n", sizeof("/* : : generated by proto : : */\n") - 1))
		{
			pragma = 0;
			break;
		}
		else if (*s == '%' && *(s + 1) == '{')
			proto->flags |= (1L<<29);
		while (*s && *s++ != '\n')
			;
	}
	if (flags & (1<<10)) proto->flags |= (1L<<20);
	if (flags & (1<<12)) proto->test = 1;
	if (flags & (1<<2)) proto->options |= (1L<<6);
	if (flags & (1<<0)) pragma = -pragma;
	if (flags & (1<<1)) pragma = 0;
	if (flags & (1<<7)) proto->flags |= (1L<<13);
	if (!(proto->flags & (1L<<29)) && file && (m = sstrlen( file)) > 2 && file[--m] == 'y' && file[--m] == '.')
		proto->flags |= (1L<<29);
	if (pragma <= 0)
	{
		if (flags & (1<<10))
		{
			flags &= ~((1<<4)|(1<<5));
			proto->flags |= (1L<<19);
		}
		else if (!(flags & ((1<<3)|(1<<9))))
		{
			pppclose(iob);
			return 0;
		}
		else if ((flags & ((1<<3)|(1<<9))) == (1<<9) || !pragma)
		{
			proto->flags |= (1L<<18);
			if (proto->flags & (1L<<16))
				proto->oz += proto->iz;
			proto->iz = n;
			memcopy(proto->op, proto->ip, n);
			return iob;
		}
	}

	if (!(retain & (1<<6)))
	{
		retain |= (1<<6);
		ppfsm(4, ((char*)0));
	}

	proto->line = 1;

	if (flags & ((1<<4)|(1<<5)))
	{
		if (flags & (1<<5))
		{
			proto->flags |= (1L<<11);
			if (flags & (1<<11))
				retain |= (1<<5);
		}
		else if (flags & (1<<4))
		{
			if (flags & (1<<11)) retain |= (1<<4);

			if (flags & (1<<0))
			{
				*proto->op++ = '#';
				proto->op = strcopy(proto->op, "pragma");
				*proto->op++ = ' ';
				proto->op = strcopy(proto->op, pragmas[0].name);
				*proto->op++ = '\n';
			}
			else

			proto->flags |= (1L<<10);
		}

		if (!(flags & (1<<0)))
		{
			if (proto->flags & (1L<<29))
			{
				proto->op = strcopy(proto->op, "%{\n");
				proto->op = strcopy(proto->op, "/* : : generated by proto : : */\n");
				proto->op = strcopy(proto->op, "%}\n");
			}
			else
			{
				if (n)
					*proto->op++ = '\n';
				proto->op = strcopy(proto->op, "/* : : generated by proto : : */\n");
				if (n)
					proto->op = linesync(proto, proto->op, proto->line);
				else if (proto->flags & ((1L<<10)|(1L<<11)))
					proto->op = init(proto, proto->op, proto->flags);
			}
		}

	}

	proto->file = file;
	if (flags & (1<<0))
	{
		proto->flags |= (1L<<0);
		if (!(flags & (1<<4))) proto->flags |= (1L<<5);
	}

	return iob;
}

int
pppread __PARAM__((char* iob), (iob)) __OTORP__(char* iob;)
{
	register Proto_t*	proto = (Proto_t*)(iob - sizeof(Proto_t));
	register int		n;

	if (proto->flags & (1L<<18))
	{
		if (proto->iz)
		{
			n = proto->iz;
			proto->iz = 0;
		}
		else if (!(proto->flags & (1L<<16))) n = 0;
		else if ((n = read(proto->fd, proto->ob, proto->oz)) <= 0 || (proto->options & (1L<<0)) && n < proto->oz)
		{
			proto->flags &= ~(1L<<16);
			close(proto->fd);
		}
	}
	else
	{
		if (proto->op == proto->ob)
		{
			if (proto->flags & (1L<<4)) return -1;

			if (proto->flags & (1L<<29))
			{
				register char*	ip = proto->ip;
				register char*	op = proto->ob;
				register char*	ep = proto->ob + proto->oz - 2;

				if (!*ip)
				{
					ip = proto->ip = proto->ib;
					if (!(proto->flags & (1L<<16))) n = 0;
					else if ((n = read(proto->fd, ip, proto->iz)) <= 0 || (proto->options & (1L<<0)) && n < proto->iz)
					{
						if (n < 0) n = 0;
						proto->flags &= ~(1L<<16);
						close(proto->fd);
					}
					ip[n] = 0;
				}
				if (proto->flags & (1L<<30))
				{
					proto->flags &= ~(1L<<30);
					if (*ip == '%')
					{
						*op++ = *ip++;
						if (proto->flags & (1L<<31)) proto->flags &= ~(1L<<29);
						else proto->flags |= (1L<<31);
					}
				}
				if (proto->flags & (1L<<29))
					while (op < ep && (n = *op++ = *ip))
					{
						ip++;
						if (n == '%')
						{
							if (*ip == '%' && (ip == proto->ip + 1 || *(ip - 2) == '\n'))
							{
								*op++ = *ip++;
								if (proto->flags & (1L<<31)) proto->flags &= ~(1L<<29);
								else proto->flags |= (1L<<31);
								break;
							}
							if (!*ip)
							{
								*op++ = '%';
								proto->flags |= (1L<<30);
								break;
							}
						}
						else if (n == '\n') proto->line++;
					}
				proto->op = memcopy(proto->ob, proto->ip, ip - proto->ip);
				proto->ip = ip;
			}
			else

			lex(proto, proto->flags);
			if ((proto->flags & ((1L<<4)|(1L<<16))) == (1L<<4))
				proto->op = strcopy(proto->op, "/* NOTE: some constructs may not have been converted */\n");
		}
		n = proto->op - proto->ob;
		proto->op = proto->ob;
	}
	return n;
}

static int
proto __PARAM__((char* file, char* package, char* copy, char* comment, int flags), (file, package, copy, comment, flags)) __OTORP__(char* file; char* package; char* copy; char* comment; int flags;)
{
	char*		b;
	char*		e;
	char*		p;
	int		n;
	int		m;
	int		x;
	int		fd;
	char		buf[1024];

	if (file && access(file, 4))
		proto_error(((char*)0), 2, file, "not found");
	else if (b = pppopen(file, 0, package, comment, flags))
	{
		if (!file)
			fd = 1;
		else if (flags & ((1<<13)<<1))
		{
			e = file + sstrlen( file) - 1;
			x = *e;
			*e = '_';
			if ((fd = creat(file, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
			{
				proto_error(b, 2, file, "cannot create temporary file");
				pppclose(b);
				return flags | ((1<<13)<<0);
			}
			*e = x;
		}
		else if (copy)
		{
			if (((n = sstrlen( copy)) + sstrlen( file) + 2) > sizeof(buf))
			{
				proto_error(b, 2, copy, "copy path too long");
				pppclose(b);
				return flags | ((1<<13)<<0);
			}
			strcopy( buf, copy);
			e = buf + n;
			if (*file != '/')
				*e++ = '/';
			strcopy( e, file);
			if ((fd = creat(buf, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
			{
				for (e = buf; *e == '/'; e++);
				do
				{
					if (*e == '/')
					{
						*e = 0;
						if (access(buf, 0) && mkdir(buf, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH))
						{
							proto_error(b, 2, buf, "cannot create copy directory");
							pppclose(b);
							return flags | ((1<<13)<<0);
						}
						*e = '/';
					}
				} while (*e++);
				if ((fd = creat(buf, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
				{
					proto_error(b, 2, buf, "cannot create copy file");
					pppclose(b);
					return flags | ((1<<13)<<0);
				}
			}
			file = buf;
		}
		else
			fd = 1;
		if (file && (flags & ((1<<13)<<2)))
			proto_error(b, 0, "convert to", file);
		while ((n = pppread(b)) > 0)
		{
			p = b;
			for (;;)
			{
				if ((m = write(fd, p, n)) <= 0)
				{
					proto_error(b, 2, "write error", ((char*)0));
					flags |= ((1<<13)<<0);
					break;
				}
				if ((n -= m) <= 0)
					break;
				p += m;
			}
			if (m < 0)
				break;
		}
		if (fd > 1)
			close(fd);
		if (file && (flags & ((1<<13)<<1)))
		{
			*e = '_';
			strcopy( b, file);
			*e = x;
			if (replace(b, file, !(flags & (1<<0))))
				proto_error(b, 2, "cannot rename to", file);
		}
		pppclose(b);
	}
	return flags;
}

typedef struct Sufcom_s
{
	char		suffix[4];
	char		comment[4];
} Sufcom_t;

static const Sufcom_t	sufcom[] =
{
	"c",		"/*",
	"cpp",		"/*",
	"cxx",		"/*",
	"c++",		"/*",
	"C",		"/*",
	"CPP",		"/*",
	"CXX",		"/*",
	"C++",		"/*",
	"f",		"C",
	"F",		"C",
	"h",		"/*",
	"hpp",		"/*",
	"hxx",		"/*",
	"H",		"/*",
	"HPP",		"/*",
	"HXX",		"/*",
	"ksh",		"#",
	"KSH",		"#",
	"l",		"/*",
	"L",		"/*",
	"p",		"(*)",
	"pas",		"(*)",
	"P",		"(*)",
	"PAS",		"(*)",
	"pl",		"#",
	"PL",		"#",
	"pl1",		"/*",
	"pli",		"/*",
	"PL1",		"/*",
	"PLI",		"/*",
	"sh",		"#",
	"SH",		"#",
	"sml",		"(*)",
	"SML",		"(*)",
	"y",		"/*",
	"Y",		"/*",
};

static char*
type __PARAM__((register char* file, char* comment), (file, comment)) __OTORP__(register char* file; char* comment;)
{
	register char*	suffix;
	register int	i;

	if (file && (!comment || !*comment))
	{
		suffix = 0;
		while (*file)
			if (*file++ == '.')
				suffix = file;
		if (suffix && sstrlen( suffix) <= 3)
			for (i = 0; i < sizeof(sufcom) / sizeof(sufcom[0]); i++)
				if (!strcmp(suffix, sufcom[i].suffix))
					return (char*)sufcom[i].comment;
	}
	return comment;
}

int
main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;)
{
	char*		b;
	char*		file;
	int		fd;
	int		n;
	char*		op;
	char*		oe;
	char*		comment = 0;
	char*		copy = 0;
	char*		list = 0;
	char*		package = 0;
	int		flags = (1<<4);
	char		buf[1024];
	char		opt[4 * 1024];

	while ((file = *++argv) && *file == '-' && *(file + 1))
	{
		for (;;)
		{
			switch (*++file)
			{
			case 0:
				break;
			case 'c':
				if (!*(comment = ++file))
					comment = *++argv;
				break;
			case 'd':
				flags |= (1<<1);
				continue;
			case 'e':
				if (!*(package = ++file) && !(package = *++argv))
				{
					file = "??";
					continue;
				}
				break;
			case 'f':
				flags |= (1<<3);
				continue;
			case 'h':
				flags &= ~(1<<4);
				continue;
			case 'i':
				flags |= (1<<0);
				continue;
			case 'n':
				flags |= (1<<7);
				continue;
			case 'p':
				flags |= (1<<9);
				continue;
			case 'r':
				flags |= ((1<<13)<<1);
				continue;
			case 's':
				flags |= (1<<5);
				continue;
			case 't':
				flags |= (1<<12);
				continue;
			case 'v':
				flags |= ((1<<13)<<2);
				continue;
			case 'x':
				flags |= (1<<2);
				continue;
			case 'z':
				flags |= (1<<1)|(1<<8);
				continue;
			case 'C':
				if (!*(copy = ++file) && !(copy = *++argv))
				{
					file = "??";
					continue;
				}
				break;
			case 'L':
				if (!*(list = ++file) && !(list = *++argv))
				{
					file = "??";
					continue;
				}
				break;
			case 'P':
			case '+':
				flags |= (1<<10);
				continue;
			case 'S':
				comment = "#";
				continue;
			default:
				proto_error(((char*)0), 2, file, "unknown option");
				/* FALLTHROUGH */
			case '?':
				b = "Usage: proto [-dfhinprstvzP+S] [-C directory] [-e package]\n             [-L file] file ...\n";
				write(2, b, sstrlen( b));
				return 2;
			}
			break;
		}
	}
	if (list)
	{
		if (*list == '-' && !*(list + 1))
			fd = 0;
		else if ((fd = open(list, O_RDONLY)) < 0)
			proto_error(((char*)0), 3, list, "not found");
		do
		{
			for (b = buf; (n = read(fd, b, 1)) > 0 && *b != '\n' && b < &buf[sizeof(buf) - 1]; b++);
			if (b > buf)
			{
				*b = 0;
				flags = proto(buf, package, copy, type(buf, comment), flags);
			}
		} while (n > 0);
		if (fd > 0)
			close(fd);
	}
	if (file)
		do flags = proto(file, package, copy, type(file, comment), flags); while (file = *++argv);
	else if (!list)
		flags = proto(file, package, copy, type(file, comment), flags);
	return errors ? 1 : (flags & ((1<<13)<<0)) ? 2 : 0;
}
