#define yy_create_buffer pp_create_buffer
#define yy_delete_buffer pp_delete_buffer
#define yy_scan_buffer pp_scan_buffer
#define yy_scan_string pp_scan_string
#define yy_scan_bytes pp_scan_bytes
#define yy_flex_debug pp_flex_debug
#define yy_init_buffer pp_init_buffer
#define yy_flush_buffer pp_flush_buffer
#define yy_load_buffer_state pp_load_buffer_state
#define yy_switch_to_buffer pp_switch_to_buffer
#define yyin ppin
#define yyleng ppleng
#define yylex pplex
#define yyout ppout
#define yyrestart pprestart
#define yytext pptext
#define yywrap ppwrap

#line 20 "lex.ppl.c"
/* A lexical scanner generated by flex */

/* Scanner skeleton version:
 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/tools/wrc/lex.ppl.c,v 1.1 2001-04-16 17:11:50 sandervl Exp $
 */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5

#include <stdio.h>


/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif


#ifdef __cplusplus

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

/* Use prototypes in function declarations. */
#define YY_USE_PROTOS

/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST

#else	/* ! __cplusplus */

#if __STDC__

#define YY_USE_PROTOS
#define YY_USE_CONST

#endif	/* __STDC__ */
#endif	/* ! __cplusplus */

#ifdef __TURBOC__
 #pragma warn -rch
 #pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif


#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif

/* Returned upon end-of-file. */
#define YY_NULL 0

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)

/* Enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN.
 */
#define BEGIN yy_start = 1 + 2 *

/* Translate the current start state into a value that can be later handed
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 * compatibility.
 */
#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START

/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#define YY_BUF_SIZE 16384

typedef struct yy_buffer_state *YY_BUFFER_STATE;

extern int yyleng;
extern FILE *yyin, *yyout;

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

/* The funky do-while in the following #define is used to turn the definition
 * int a single C statement (which needs a semi-colon terminator).  This
 * avoids problems with code like:
 *
 * 	if ( condition_holds )
 *		yyless( 5 );
 *	else
 *		do_something_else();
 *
 * Prior to using the do-while the compiler would get upset at the
 * "else" because it interpreted the "if" statement as being all
 * done when it reached the ';' after the yyless() call.
 */

/* Return all but the first 'n' matched characters back to the input stream. */

#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up yytext. */ \
		*yy_cp = yy_hold_char; \
		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
		} \
	while ( 0 )

#define unput(c) yyunput( c, yytext_ptr )

/* The following is because we cannot portably get our hands on size_t
 * (without autoconf's help, which isn't available because we want
 * flex-generated scanners to compile on their own).
 */
typedef unsigned int yy_size_t;


struct yy_buffer_state
	{
	FILE *yy_input_file;

	char *yy_ch_buf;		/* input buffer */
	char *yy_buf_pos;		/* current position in input buffer */

	/* Size of input buffer in bytes, not including room for EOB
	 * characters.
	 */
	yy_size_t yy_buf_size;

	/* Number of characters read into yy_ch_buf, not including EOB
	 * characters.
	 */
	int yy_n_chars;

	/* Whether we "own" the buffer - i.e., we know we created it,
	 * and can realloc() it to grow it, and should free() it to
	 * delete it.
	 */
	int yy_is_our_buffer;

	/* Whether this is an "interactive" input source; if so, and
	 * if we're using stdio for input, then we want to use getc()
	 * instead of fread(), to make sure we stop fetching input after
	 * each newline.
	 */
	int yy_is_interactive;

	/* Whether we're considered to be at the beginning of a line.
	 * If so, '^' rules will be active on the next match, otherwise
	 * not.
	 */
	int yy_at_bol;

	/* Whether to try to fill the input buffer when we reach the
	 * end of it.
	 */
	int yy_fill_buffer;

	int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
	/* When an EOF's been seen but there's still some text to process
	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
	 * shouldn't try reading from the input source any more.  We might
	 * still have a bunch of tokens to match, though, because of
	 * possible backing-up.
	 *
	 * When we actually see the EOF, we change the status to "new"
	 * (via yyrestart()), so that the user can continue scanning by
	 * just pointing yyin at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2
	};

static YY_BUFFER_STATE yy_current_buffer = 0;

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 */
#define YY_CURRENT_BUFFER yy_current_buffer


/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;

static int yy_n_chars;		/* number of characters read into yy_ch_buf */


int yyleng;

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */

/* Flag which is used to allow yywrap()'s to do buffer switches
 * instead of setting up a fresh yyin.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

void yyrestart YY_PROTO(( FILE *input_file ));

void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )

YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));

static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));

#define yy_new_buffer yy_create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! yy_current_buffer ) \
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
	yy_current_buffer->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! yy_current_buffer ) \
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
	yy_current_buffer->yy_at_bol = at_bol; \
	}

#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)


#define FLEX_DEBUG
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;

#define FLEX_DEBUG
extern char *yytext;
#define yytext_ptr yytext

static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up yytext.
 */
#define YY_DO_BEFORE_ACTION \
	yytext_ptr = yy_bp; \
	yyleng = (int) (yy_cp - yy_bp); \
	yy_hold_char = *yy_cp; \
	*yy_cp = '\0'; \
	yy_c_buf_p = yy_cp;

#define YY_NUM_RULES 136
#define YY_END_OF_BUFFER 137
static yyconst short int yy_accept[394] =
    {   0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,  113,  113,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      137,  129,  130,  131,  117,  135,  118,  129,  128,  129,
      130,    1,   21,   16,   18,   16,   21,   20,   17,   17,
       17,   17,   17,   17,   17,   17,   64,   67,   65,   66,
       28,   25,   26,   24,   28,   23,   28,   28,  119,  127,
      120,  135,  121,  122,  135,  123,  124,  113,  114,  113,
       73,   71,   73,   73,   70,   73,   74,   78,   80,   79,

      135,   75,   86,   82,   86,   81,   84,   86,   86,   83,
       86,   88,   96,   98,   91,   97,   93,   92,   89,   93,
       88,  102,  102,  100,   99,  102,  110,  109,  106,  107,
      103,  104,  105,  110,  110,  129,  130,  134,  117,  134,
      118,  129,  128,  129,   53,   50,   47,   53,   52,   53,
       51,   53,   33,   35,   53,   53,   53,   53,   49,   53,
       53,   58,   55,   56,   58,   54,   58,   22,   63,   60,
       63,   61,   63,   59,   63,   29,   30,   32,   32,   32,
       29,    1,  129,  130,  129,  112,  116,  128,  132,  133,
      130,    1,   16,   17,   17,   17,   17,   17,   17,   17,

       17,   18,   19,   20,   17,   17,   17,   17,   17,   11,
       17,   17,   17,   17,   17,   64,   65,   66,   68,   66,
       25,   27,   28,  119,  126,  125,  126,  121,  123,  113,
      113,  113,  115,   71,   69,   70,   72,   73,   74,   75,
       77,   75,   82,   81,   86,   83,   87,   86,   88,   90,
       93,   92,   89,   95,   93,   88,  102,  100,   99,  102,
      101,  102,  110,  110,  108,  111,  110,  129,  134,  134,
       50,   44,   41,   33,   34,   33,   33,   37,   35,   35,
       35,   39,   45,   43,   46,   40,   48,   49,  128,   42,
       55,   54,   57,   58,   22,   60,   59,   63,   62,   63,

       29,   31,   32,   29,  116,   17,   17,   17,   17,   17,
       17,   11,   17,   17,   17,   17,   17,   17,   17,   65,
       76,   85,   94,   34,   34,   33,   33,   33,   36,   35,
       35,   35,  128,   17,   12,   13,   17,   17,   17,   17,
       17,   17,   15,   17,   17,   17,   34,   34,   34,   33,
       36,   36,   35,  128,   17,   12,   13,   14,    4,    7,
        9,   17,   17,   15,   17,    8,   17,   34,   36,   36,
       36,  128,    3,   14,    4,    7,    9,   10,   17,    6,
        8,   17,   36,  128,    3,   10,    2,    6,    5,   38,
        2,    5,    0

    } ;

static yyconst int yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        2,    2,    4,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    5,    6,    7,    1,    1,    8,    9,   10,
       11,   12,    1,   13,    1,   14,   15,   16,   17,   17,
       17,   17,   17,   17,   17,   18,   18,    1,    1,   19,
       20,   21,    1,    1,   22,   22,   22,   22,   22,   22,
       23,   23,   23,   23,   23,   24,   23,   23,   23,   23,
       23,   23,   23,   23,   25,   23,   23,   26,   23,   23,
        1,   27,    1,    1,   28,    1,   29,   30,   31,   32,

       33,   34,   35,   36,   37,   36,   36,   38,   39,   40,
       41,   42,   36,   43,   44,   45,   46,   36,   47,   48,
       36,   36,    1,   49,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
    } ;

static yyconst int yy_meta[50] =
    {   0,
        1,    2,    3,    2,    1,    4,    5,    1,    6,    7,
        8,    9,    8,    1,   10,   11,   11,   11,    1,    1,
       12,   13,   14,   14,   14,   14,   15,   16,   13,   13,
       13,   13,   13,   13,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,    1
    } ;

static yyconst short int yy_base[433] =
    {   0,
        0,   48,   55,    0,  102,  103,  130,    0,  177,  178,
      179,  182,  186,  187,  104,  107,  214,    0,  261,  262,
      289,    0,  338,    0,  386,  389,  414,  439,  466,    0,
      515,    0,  564,    0,  612,  638,  665,    0,  391,  407,
     1390,    0,   49, 1527, 1527, 1527, 1527,   96,    0,  109,
      118, 1527, 1527,  713, 1527, 1383,  111,  111,  760, 1352,
      154,  161, 1347, 1340, 1339, 1341,    0, 1527,  184,  124,
     1527,  196, 1527, 1527,  254, 1527,    0,  199,    0, 1527,
     1527,  269,    0, 1527, 1366,    0, 1527,    0, 1527,  263,
     1527,  208, 1527,  267, 1358,  277,    0, 1527, 1527, 1527,

      271,  281, 1527,  393, 1527,  398, 1527, 1353,  389,    0,
      404,    0, 1527, 1527, 1356, 1527,  400,    0,    0,  427,
      807, 1527,  433, 1527, 1527,  429,    0, 1527, 1527, 1527,
     1527, 1527, 1527,  432,  435,    0,  401, 1527, 1527, 1527,
     1527,  441,    0,  856, 1527,  417, 1527, 1342, 1527, 1353,
     1527,  443,  890,  607,  442, 1339,  443,    0,  616, 1325,
     1305, 1527,  424, 1527,  621,    0,  618,  630, 1527,  455,
     1527, 1527,  622,    0,  623,    0, 1527, 1527,  623,  646,
      655, 1527,    0,  656,  649, 1527,    0,    0, 1527, 1350,
      714, 1527,    0,    0, 1319,  682,  692, 1314, 1304, 1304,

     1296, 1527, 1527, 1317, 1282,  686, 1282, 1270, 1276,  731,
     1275, 1264, 1274, 1270, 1244,    0,    0, 1527, 1527, 1274,
      725, 1527, 1268,    0, 1527, 1527, 1264,    0,    0,    0,
      716,  722, 1527,  734, 1527, 1254, 1527, 1252,    0, 1527,
      737, 1248,  763,  764, 1228,    0, 1527, 1236,    0, 1527,
      757,    0,    0,  771, 1216,    0,  774, 1527, 1527,  648,
     1527, 1205,    0,  767, 1527, 1527, 1204,  768, 1527,    0,
      783, 1527, 1527,  806,  816,  812,  427,    0,  863,  858,
      750, 1527, 1527, 1527, 1527, 1527, 1527, 1184, 1148, 1527,
      787,    0, 1527, 1172,  778,  801,    0, 1527, 1527, 1168,

        0, 1527, 1165,  841,    0, 1123, 1124, 1124, 1119, 1111,
     1108,  812, 1114, 1113,  943,  893,  890,  889,  854,    0,
      845, 1527,  849,  865,  762,  694,  766,  775,  874,  800,
      847,  854,  831,  825,  882,  889,  821,  799,  794,  799,
      799,  783,  893,  771,  747,  733,  813,  886,  889, 1527,
      893,  895, 1527,  623,  610,  898,  919,  928,  933,  938,
      939,  583,  414,  942,  411,  943,  247, 1527,  904,  910,
      925,  241,  949,  950,  953,  954,  957,  958,  153,  962,
      963,   74, 1527,   22,  966,  967,  970,  971,  974,    0,
      975,  978, 1527,  982,  998, 1014, 1030, 1046, 1062, 1078,

     1094, 1110, 1126, 1142, 1154, 1156, 1172, 1188, 1204, 1220,
     1236, 1252, 1268, 1284, 1294, 1310, 1326, 1332, 1348, 1364,
     1380, 1386, 1402, 1418, 1434, 1440, 1446, 1462, 1478, 1494,
     1510, 1133
    } ;

static yyconst short int yy_def[433] =
    {   0,
      393,    1,  393,    3,  394,  394,  393,    7,  395,  395,
      396,  396,  397,  397,  398,  398,  393,   17,  399,  399,
      393,   21,  393,   23,  400,  400,  401,  401,  393,   29,
      393,   31,  393,   33,  402,  402,  393,   37,  403,  403,
      393,  404,  393,  393,  393,  393,  393,  405,  406,  405,
      393,  393,  393,  393,  393,   54,  393,  393,   54,   59,
       59,   59,   59,   59,   59,   59,  407,  393,  408,  393,
      393,  393,  393,  393,  393,  393,  406,  393,  409,  393,
      393,  410,  411,  393,  410,  412,  393,  413,  393,  414,
      393,  393,  393,  393,  415,  393,  416,  393,  393,  393,

      417,  393,  393,  393,  393,  393,  393,  393,  393,  418,
      393,  419,  393,  393,  393,  393,  420,  421,  422,  393,
      422,  393,  393,  393,  393,  393,  423,  393,  393,  393,
      393,  393,  393,  424,  393,  404,  393,  393,  393,  393,
      393,  405,  406,  425,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  406,  393,  406,
      393,  393,  393,  393,  393,  426,  393,  393,  393,  393,
      393,  393,  393,  427,  428,  429,  393,  393,  393,  393,
      429,  393,  404,  393,  405,  393,  430,  406,  393,  393,
      393,  393,   54,   59,   59,   59,   59,   59,   59,   59,

       59,  393,  393,  393,   59,   59,   59,   59,   59,   59,
       59,   59,   59,   59,   59,  407,  431,  393,  393,  393,
      393,  393,  393,  409,  393,  393,  393,  411,  412,  413,
      414,  414,  393,  393,  393,  415,  393,  393,  416,  393,
      393,  393,  393,  393,  393,  418,  393,  393,  419,  393,
      420,  421,  422,  393,  393,  121,  393,  393,  393,  393,
      393,  393,  423,  424,  393,  393,  393,  405,  393,  425,
      393,  393,  393,  393,  393,  393,  393,  432,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  406,  393,
      393,  426,  393,  393,  393,  393,  427,  393,  393,  393,

      429,  393,  393,  429,  430,   59,   59,   59,   59,   59,
       59,  393,   59,   59,   59,   59,   59,   59,   59,  431,
      393,  393,  393,  393,  393,  393,  393,  393,  432,  393,
      393,  393,  406,   59,   59,   59,   59,   59,   59,   59,
       59,   59,   59,   59,   59,   59,  393,  393,  393,  393,
      393,  393,  393,  406,   59,  393,  393,   59,   59,   59,
       59,   59,   59,  393,   59,   59,   59,  393,  393,  393,
      393,  406,   59,  393,  393,  393,  393,   59,   59,   59,
      393,   59,  393,  406,  393,  393,   59,  393,   59,  406,
      393,  393,    0,  393,  393,  393,  393,  393,  393,  393,

      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393
    } ;

static yyconst short int yy_nxt[1577] =
    {   0,
       42,   43,   44,   43,   42,   45,   46,   42,   47,   42,
       42,   42,   42,   42,   48,   42,   42,   42,   42,   42,
       42,   49,   49,   49,   49,   49,   50,   49,   49,   49,
       49,   49,   49,   49,   49,   49,   49,   49,   49,   49,
       49,   49,   49,   49,   49,   49,   49,   49,   42,   51,
      184,   51,  184,  390,   52,   53,   54,   55,   56,   53,
       53,   53,   53,   53,   53,   53,   53,   53,   53,   57,
       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
       53,   58,   53,   59,   59,   59,   60,   61,   59,   59,
       59,   62,   63,   59,   59,   59,   64,   59,   59,   59,

       65,   66,   59,   53,   68,   68,   89,  186,  389,   89,
      187,  189,  190,  203,  204,   90,   69,   69,   90,  191,
      393,  191,  186,  393,  192,  187,  219,  220,   70,   70,
       71,   72,   73,   72,   71,   74,   71,   71,   71,   71,
       71,   71,   71,   71,   75,   71,   71,   71,   76,   71,
       71,   77,   77,   77,   77,   77,   78,   77,   77,   77,
       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
       77,   77,   77,   77,   77,   77,   77,   77,   71,   80,
       80,   80,   81,   81,   80,  387,  218,   84,   80,   80,
       84,  206,  209,  207,  210,  186,  208,  221,  187,  221,

      211,  222,  223,   82,   82,   85,   87,   87,   85,  234,
      218,  234,   85,   85,   91,   92,   93,   92,   91,   91,
       91,   91,   91,   91,   91,   91,   91,   91,   94,   91,
       91,   91,   91,   91,   91,   95,   95,   95,   95,   95,
       96,   95,   95,   95,   95,   95,   95,   95,   95,   95,
       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
       95,   95,   91,   98,   98,  186,   99,   99,  187,  100,
      100,  226,  227,  384,  232,  101,  101,  233,  186,  237,
      238,  187,  186,  241,  242,  187,  382,  102,  102,  103,
      104,  105,  104,  103,  103,  103,  103,  103,  103,  106,

      103,  107,  108,  109,  103,  103,  103,  103,  103,  103,
      110,  110,  110,  110,  110,  111,  110,  110,  110,  110,
      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,
      110,  110,  110,  110,  110,  110,  110,  103,  112,  112,
      113,  112,  112,  114,  115,  112,  116,  112,  112,  112,
      112,  112,  117,  118,  118,  118,  112,  112,  112,  119,
      119,  119,  119,  119,  120,  121,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  112,  123,  124,  123,
      123,  124,  123,  177,  243,  125,  243,  178,  125,  244,

      186,  244,  184,  187,  184,  179,  247,  248,  181,  177,
      181,  186,  126,  182,  187,  126,  128,  180,  271,  129,
      271,  179,  130,  131,  132,  291,  133,  291,  134,  254,
      255,  261,  262,  180,  257,  258,  257,  266,  267,  380,
      135,  128,  259,  265,  129,  379,  187,  130,  131,  132,
      328,  133,  393,  134,  186,  393,  296,  187,  296,  260,
      282,  283,  285,  286,  328,  135,  136,  137,  138,  137,
      136,  139,  140,  136,  141,  136,  136,  136,  136,  136,
      142,  136,  136,  136,  136,  136,  136,  143,  143,  143,
      143,  143,  144,  143,  143,  143,  143,  143,  143,  143,

      143,  143,  143,  143,  143,  143,  143,  143,  143,  143,
      143,  143,  143,  143,  136,  145,  146,  147,  146,  148,
      149,  145,  150,  151,  145,  145,  145,  145,  145,  152,
      153,  154,  154,  155,  156,  157,  158,  158,  158,  158,
      158,  159,  158,  158,  158,  158,  160,  158,  158,  158,
      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
      158,  158,  158,  161,  162,  163,  164,  163,  162,  162,
      162,  162,  162,  162,  162,  162,  162,  162,  165,  162,
      162,  162,  162,  162,  162,  166,  166,  166,  166,  166,
      167,  166,  166,  166,  166,  166,  166,  166,  166,  166,

      166,  166,  166,  166,  166,  166,  166,  166,  166,  166,
      166,  166,  162,   72,   73,   72,  378,   74,  287,  288,
      293,  294,  279,  279,  279,  299,  300,  168,  168,  168,
      280,  281,  186,  186,  186,  187,  187,  187,   78,   72,
       73,   72,  373,   74,  280,  295,  295,  295,  302,  303,
      261,  262,  281,  168,  168,  168,  304,  184,  304,  184,
      393,  192,  372,  393,   78,  169,  170,  171,  170,  169,
      169,  169,  169,  169,  172,  172,  169,  169,  169,  173,
      169,  169,  169,  169,  169,  169,  174,  174,  174,  174,
      174,  175,  174,  174,  174,  174,  174,  174,  174,  174,

      174,  174,  174,  174,  174,  174,  174,  174,  174,  174,
      174,  174,  174,  169,  193,  191,  193,  191,  350,  206,
      192,  207,  307,  209,  208,  210,  221,  393,  221,  308,
      393,  211,  312,  232,  312,  234,  233,  234,  321,  350,
      321,  194,  194,  194,  195,  196,  194,  194,  194,  197,
      198,  194,  194,  194,  199,  194,  194,  194,  200,  201,
      194,  393,  313,  393,  243,  244,  243,  244,  393,  367,
      314,  393,  323,  332,  323,  257,  258,  257,  393,  393,
      366,  393,  393,  259,  271,  349,  271,  332,  291,  350,
      291,  194,  194,  295,  295,  295,  194,  194,  350,  349,

      260,  194,  296,  350,  296,  194,  194,  249,  249,  365,
      249,  249,  350,  312,  249,  312,  249,  249,  249,  249,
      249,  274,  274,  275,  353,  249,  249,  249,  363,  276,
      277,  362,  361,  275,  256,  326,  327,  368,  360,  324,
      325,  359,  304,  276,  304,  353,  321,  192,  321,  326,
      323,  277,  323,  324,  358,  249,  268,  327,  368,  270,
      268,  325,  268,  268,  355,  268,  268,  354,  268,  268,
      353,  268,  268,  268,  268,  268,  268,  353,  279,  279,
      279,  330,  331,  356,  353,  356,  280,  281,  347,  348,
      357,  353,  357,  346,  364,  330,  364,  351,  352,  356,

      280,  356,  347,  331,  268,  274,  274,  275,  281,  368,
      348,  351,  368,  276,  277,  278,  369,  370,  371,  352,
      357,  345,  357,  368,  344,  343,  368,  276,  383,  374,
      369,  374,  371,  383,  375,  277,  375,  278,  370,  376,
      377,  376,  377,  364,  381,  364,  381,  383,  383,  383,
      385,  374,  385,  374,  375,  376,  375,  376,  377,  386,
      377,  386,  383,  388,  381,  388,  381,  385,  386,  385,
      386,  391,  388,  391,  388,  392,  391,  392,  391,  392,
      342,  392,   67,   67,   67,   67,   67,   67,   67,   67,
       67,   67,   67,   67,   67,   67,   67,   67,   79,   79,

       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
       79,   79,   79,   79,   83,   83,   83,   83,   83,   83,
       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
       86,   86,   86,   86,   86,   86,   88,   88,   88,   88,
       88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
       88,   88,   97,   97,   97,   97,   97,   97,   97,   97,
       97,   97,   97,   97,   97,   97,   97,   97,  122,  122,
      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,
      122,  122,  122,  122,  127,  127,  127,  127,  127,  127,

      127,  127,  127,  127,  127,  127,  127,  127,  127,  127,
       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
       71,   71,   71,   71,   71,   71,  176,  176,  176,  176,
      176,  176,  176,  176,  176,  176,  176,  176,  176,  176,
      176,  176,  183,  329,  341,  329,  340,  339,  183,  183,
      183,  338,  183,  183,  185,  337,  336,  335,  185,  334,
      185,  185,  185,  185,  185,  185,  188,  302,  188,  188,
      299,  188,  216,  216,  293,  216,  216,  216,  216,  216,
      216,  333,  216,  216,  216,  216,  287,  216,  217,  217,
      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,

      217,  217,  217,  217,  224,  224,  266,  261,  224,  224,
      224,  224,  224,  224,  224,  224,  224,  224,  254,  224,
      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
      225,  225,  225,  225,  225,  225,  228,  228,  247,  228,
      228,  322,  228,  228,  228,  228,  228,  228,  228,  228,
      241,  228,  229,  229,  237,  229,  229,  229,  229,  229,
      229,  229,  229,  235,  229,  229,  226,  229,  230,  230,
      222,  230,  230,  230,  230,  230,  219,  230,  230,  230,
      230,  230,  230,  230,  231,  231,  319,  231,  231,  231,
      231,  231,  231,  231,  231,  231,  231,  231,  231,  231,

      236,  318,  317,  316,  236,  315,  236,  236,  311,  236,
      239,  239,  310,  309,  239,  306,  239,  239,  239,  203,
      239,  239,  239,  239,  215,  239,  240,  240,  240,  240,
      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
      240,  240,  246,  214,  246,  246,  213,  246,  249,  249,
      212,  205,  189,  290,  249,  249,  249,  289,  284,  249,
      273,  272,  250,  249,  251,  251,  245,  235,  393,  215,
      251,  251,  251,  251,  251,  251,  251,  251,  214,  251,
      252,  252,  213,  212,  205,  202,  252,  252,  252,  393,
      252,  252,  252,  252,  393,  252,  253,  393,  253,  253,

      393,  253,  263,  263,  393,  393,  263,  393,  393,  393,
      263,  393,  263,  263,  263,  263,  393,  263,  264,  264,
      393,  393,  264,  393,  393,  393,  264,  264,  264,  264,
      264,  264,  393,  264,  269,  269,  269,  269,  269,  269,
      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
      292,  393,  292,  292,  393,  292,  297,  393,  297,  297,
      393,  297,  298,  298,  298,  298,  298,  298,  298,  298,
      298,  298,  298,  298,  298,  298,  298,  298,  301,  301,
      393,  301,  393,  301,  301,  301,  301,  393,  301,  301,
      301,  301,  393,  301,  305,  305,  393,  305,  305,  305,

      305,  305,  305,  305,  305,  305,  305,  305,  305,  305,
      320,  320,  393,  320,  320,  320,  320,  320,  393,  393,
      320,  320,  320,  320,  393,  320,   41,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393
    } ;

static yyconst short int yy_chk[1577] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
       43,    2,   43,  384,    2,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,

        3,    3,    3,    3,    5,    6,   15,   48,  382,   16,
       48,   50,   50,   58,   58,   15,    5,    6,   16,   51,
       50,   51,   57,   50,   51,   57,   70,   70,    5,    6,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    9,
       10,   11,    9,   10,   12,  379,   69,   11,   13,   14,
       12,   61,   62,   61,   62,   69,   61,   72,   69,   72,

       62,   78,   78,    9,   10,   11,   13,   14,   12,   92,
       69,   92,   13,   14,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   19,   20,   75,   19,   20,   75,   19,
       20,   82,   82,  372,   90,   19,   20,   90,   94,   96,
       96,   94,  101,  102,  102,  101,  367,   19,   20,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,

       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   23,   23,
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
       23,   23,   23,   23,   23,   23,   23,   25,   25,   25,
       26,   26,   26,   39,  104,   25,  104,   39,   26,  106,

      109,  106,  137,  109,  137,   39,  111,  111,   40,   40,
       40,  117,   25,   40,  117,   26,   27,   39,  146,   27,
      146,   40,   27,   27,   27,  163,   27,  163,   27,  120,
      120,  126,  126,   40,  123,  123,  123,  135,  135,  365,
       27,   28,  123,  134,   28,  363,  134,   28,   28,   28,
      277,   28,  142,   28,  152,  142,  170,  152,  170,  123,
      155,  155,  157,  157,  277,   28,   29,   29,   29,   29,
       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,

       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
       29,   29,   29,   29,   29,   31,   31,   31,   31,   31,
       31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
       31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
       31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
       31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
       31,   31,   31,   31,   33,   33,   33,   33,   33,   33,
       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,

       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
       33,   33,   33,   35,   35,   35,  362,   35,  159,  159,
      167,  167,  154,  154,  154,  175,  175,   35,   35,   35,
      154,  154,  165,  173,  179,  165,  173,  179,   35,   36,
       36,   36,  355,   36,  154,  168,  168,  168,  180,  180,
      260,  260,  154,   36,   36,   36,  181,  184,  181,  184,
      185,  181,  354,  185,   36,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,

       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   54,  191,   54,  191,  326,  196,
      191,  196,  206,  197,  196,  197,  221,  231,  221,  206,
      231,  197,  210,  232,  210,  234,  232,  234,  241,  326,
      241,   54,   54,   54,   54,   54,   54,   54,   54,   54,
       54,   54,   54,   54,   54,   54,   54,   54,   54,   54,
       54,   59,  210,   59,  243,  244,  243,  244,  251,  346,
      210,  251,  254,  281,  254,  257,  257,  257,  264,  268,
      345,  264,  268,  257,  271,  325,  271,  281,  291,  327,
      291,   59,   59,  295,  295,  295,   59,   59,  328,  325,

      257,   59,  296,  327,  296,   59,   59,  121,  121,  344,
      121,  121,  328,  312,  121,  312,  121,  121,  121,  121,
      121,  274,  274,  274,  330,  121,  121,  121,  342,  274,
      274,  341,  340,  275,  121,  276,  276,  347,  339,  275,
      275,  338,  304,  274,  304,  330,  321,  304,  321,  276,
      323,  274,  323,  275,  337,  121,  144,  276,  347,  144,
      144,  275,  144,  144,  334,  144,  144,  333,  144,  144,
      331,  144,  144,  144,  144,  144,  144,  332,  279,  279,
      279,  280,  280,  335,  331,  335,  279,  279,  324,  324,
      336,  332,  336,  319,  343,  280,  343,  329,  329,  356,

      279,  356,  324,  280,  144,  153,  153,  153,  279,  348,
      324,  329,  349,  153,  153,  153,  351,  351,  352,  329,
      357,  318,  357,  348,  317,  316,  349,  153,  369,  358,
      351,  358,  352,  370,  359,  153,  359,  153,  351,  360,
      361,  360,  361,  364,  366,  364,  366,  370,  371,  369,
      373,  374,  373,  374,  375,  376,  375,  376,  377,  378,
      377,  378,  371,  380,  381,  380,  381,  385,  386,  385,
      386,  387,  388,  387,  388,  389,  391,  389,  391,  392,
      315,  392,  394,  394,  394,  394,  394,  394,  394,  394,
      394,  394,  394,  394,  394,  394,  394,  394,  395,  395,

      395,  395,  395,  395,  395,  395,  395,  395,  395,  395,
      395,  395,  395,  395,  396,  396,  396,  396,  396,  396,
      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  398,  398,  398,  398,
      398,  398,  398,  398,  398,  398,  398,  398,  398,  398,
      398,  398,  399,  399,  399,  399,  399,  399,  399,  399,
      399,  399,  399,  399,  399,  399,  399,  399,  400,  400,
      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,
      400,  400,  400,  400,  401,  401,  401,  401,  401,  401,

      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
      402,  402,  402,  402,  402,  402,  402,  402,  402,  402,
      402,  402,  402,  402,  402,  402,  403,  403,  403,  403,
      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
      403,  403,  404,  432,  314,  432,  313,  311,  404,  404,
      404,  310,  404,  404,  405,  309,  308,  307,  405,  306,
      405,  405,  405,  405,  405,  405,  406,  303,  406,  406,
      300,  406,  407,  407,  294,  407,  407,  407,  407,  407,
      407,  289,  407,  407,  407,  407,  288,  407,  408,  408,
      408,  408,  408,  408,  408,  408,  408,  408,  408,  408,

      408,  408,  408,  408,  409,  409,  267,  262,  409,  409,
      409,  409,  409,  409,  409,  409,  409,  409,  255,  409,
      410,  410,  410,  410,  410,  410,  410,  410,  410,  410,
      410,  410,  410,  410,  410,  410,  411,  411,  248,  411,
      411,  245,  411,  411,  411,  411,  411,  411,  411,  411,
      242,  411,  412,  412,  238,  412,  412,  412,  412,  412,
      412,  412,  412,  236,  412,  412,  227,  412,  413,  413,
      223,  413,  413,  413,  413,  413,  220,  413,  413,  413,
      413,  413,  413,  413,  414,  414,  215,  414,  414,  414,
      414,  414,  414,  414,  414,  414,  414,  414,  414,  414,

      415,  214,  213,  212,  415,  211,  415,  415,  209,  415,
      416,  416,  208,  207,  416,  205,  416,  416,  416,  204,
      416,  416,  416,  416,  201,  416,  417,  417,  417,  417,
      417,  417,  417,  417,  417,  417,  417,  417,  417,  417,
      417,  417,  418,  200,  418,  418,  199,  418,  419,  419,
      198,  195,  190,  161,  419,  419,  419,  160,  156,  419,
      150,  148,  115,  419,  420,  420,  108,   95,   85,   66,
      420,  420,  420,  420,  420,  420,  420,  420,   65,  420,
      421,  421,   64,   63,   60,   56,  421,  421,  421,   41,
      421,  421,  421,  421,    0,  421,  422,    0,  422,  422,

        0,  422,  423,  423,    0,    0,  423,    0,    0,    0,
      423,    0,  423,  423,  423,  423,    0,  423,  424,  424,
        0,    0,  424,    0,    0,    0,  424,  424,  424,  424,
      424,  424,    0,  424,  425,  425,  425,  425,  425,  425,
      425,  425,  425,  425,  425,  425,  425,  425,  425,  425,
      426,    0,  426,  426,    0,  426,  427,    0,  427,  427,
        0,  427,  428,  428,  428,  428,  428,  428,  428,  428,
      428,  428,  428,  428,  428,  428,  428,  428,  429,  429,
        0,  429,    0,  429,  429,  429,  429,    0,  429,  429,
      429,  429,    0,  429,  430,  430,    0,  430,  430,  430,

      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
      431,  431,    0,  431,  431,  431,  431,  431,    0,    0,
      431,  431,  431,  431,    0,  431,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393,  393,  393,  393,  393,
      393,  393,  393,  393,  393,  393
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

extern int yy_flex_debug;
int yy_flex_debug = 1;

static yyconst short int yy_rule_linenum[136] =
    {   0,
      303,  308,  309,  310,  311,  312,  313,  314,  315,  316,
      317,  318,  319,  320,  321,  322,  323,  324,  325,  326,
      327,  332,  333,  334,  335,  336,  337,  338,  343,  344,
      345,  346,  355,  356,  357,  358,  359,  360,  361,  362,
      363,  364,  365,  366,  367,  368,  369,  370,  371,  372,
      373,  374,  375,  381,  382,  383,  384,  385,  392,  393,
      394,  395,  396,  404,  405,  406,  407,  408,  413,  414,
      415,  416,  417,  422,  423,  424,  425,  426,  427,  428,
      433,  434,  435,  436,  437,  438,  439,  444,  445,  446,
      447,  448,  449,  450,  451,  452,  453,  454,  465,  466,

      470,  471,  483,  487,  496,  502,  503,  504,  505,  506,
      507,  512,  513,  514,  515,  520,  528,  529,  530,  531,
      547,  548,  562,  563,  569,  593,  594,  603,  643,  644,
      645,  646,  647,  653,  659
    } ;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
char *yytext;
#line 1 "ppl.l"
#define INITIAL 0
/*
 * Wrc preprocessor lexical analysis
 *
 * Copyright 1999-2000	Bertho A. Stultiens (BS)
 *
 * 24-Apr-2000 BS	- Started from scratch to restructure everything
 *			  and reintegrate the source into the wine-tree.
 * 04-Jan-2000 BS	- Added comments about the lexicographical
 *			  grammar to give some insight in the complexity.
 * 28-Dec-1999 BS	- Eliminated backing-up of the flexer by running
 *			  `flex -b' on the source. This results in some
 *			  weirdo extra rules, but a much faster scanner.
 * 23-Dec-1999 BS	- Started this file
 *
 *-------------------------------------------------------------------------
 * The preprocessor's lexographical grammar (approximately):
 *
 * pp		:= {ws} # {ws} if {ws} {expr} {ws} \n
 *		|  {ws} # {ws} ifdef {ws} {id} {ws} \n
 *		|  {ws} # {ws} ifndef {ws} {id} {ws} \n
 *		|  {ws} # {ws} elif {ws} {expr} {ws} \n
 *		|  {ws} # {ws} else {ws} \n
 *		|  {ws} # {ws} endif {ws} \n
 *		|  {ws} # {ws} include {ws} < {anytext} > \n
 *		|  {ws} # {ws} include {ws} " {anytext} " \n
 *		|  {ws} # {ws} define {ws} {anytext} \n
 *		|  {ws} # {ws} define( {arglist} ) {ws} {expansion} \n
 *		|  {ws} # {ws} pragma {ws} {anytext} \n
 *		|  {ws} # {ws} ident {ws} {anytext} \n
 *		|  {ws} # {ws} error {ws} {anytext} \n
 *		|  {ws} # {ws} warning {ws} {anytext} \n
 *		|  {ws} # {ws} line {ws} " {anytext} " {number} \n
 *		|  {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}]] \n
 *		|  {ws} # {ws} \n
 *
 * ws		:= [ \t\r\f\v]*
 *
 * expr		:= {expr} [+-*%^/|&] {expr}
 *		|  {expr} {logor|logand} {expr}
 *		|  [!~+-] {expr}
 *		|  {expr} ? {expr} : {expr}
 *
 * logor	:= ||
 *
 * logand	:= &&
 *
 * id		:= [a-zA-Z_][a-zA-Z0-9_]*
 *
 * anytext	:= [^\n]*	(see note)
 *
 * arglist	:=
 *		|  {id}
 *		|  {arglist} , {id}
 *		|  {arglist} , {id} ...
 *
 * expansion	:= {id}
 *		|  # {id}
 *		|  {anytext}
 *		|  {anytext} ## {anytext}
 *
 * number	:= [0-9]+
 *
 * Note: "anytext" is not always "[^\n]*". This is because the
 *	 trailing context must be considered as well.
 *
 * The only certain assumption for the preprocessor to make is that
 * directives start at the beginning of the line, followed by a '#'
 * and end with a newline.
 * Any directive may be suffixed with a line-continuation. Also
 * classical comment / *...* / (note: no comments within comments,
 * therefore spaces) is considered to be a line-continuation
 * (according to gcc and egcs AFAIK, ANSI is a bit vague).
 * Comments have not been added to the above grammer for simplicity
 * reasons. However, it is allowed to enter comment anywhere within
 * the directives as long as they do not interfere with the context.
 * All comments are considered to be deletable whitespace (both
 * classical form "/ *...* /" and C++ form "//...\n").
 *
 * All recursive scans, except for macro-expansion, are done by the
 * parser, whereas the simple state transitions of non-recursive
 * directives are done in the scanner. This results in the many
 * exclusive start-conditions of the scanner.
 *
 * Macro expansions are slightly more difficult because they have to
 * prescan the arguments. Parameter substitution is literal if the
 * substitution is # or ## (either side). This enables new identifiers
 * to be created (see 'info cpp' node Macro|Pitfalls|Prescan for more
 * information).
 *
 * FIXME: Variable macro parameters is recognized, but not yet
 * expanded. I have to reread the ANSI standard on the subject (yes,
 * ANSI defines it).
 *
 * The following special defines are supported:
 * __FILE__	-> "thissource.c"
 * __LINE__	-> 123
 * __DATE__	-> "May  1 2000"
 * __TIME__	-> "23:59:59"
 * These macros expand, as expected, into their ANSI defined values.
 *
 * The same include prevention is implemented as gcc and egcs does.
 * This results in faster processing because we do not read the text
 * at all. Some wine-sources attempt to include the same file 4 or 5
 * times. This strategy also saves a lot blank output-lines, which in
 * its turn improves the real resource scanner/parser.
 *
 */
/*
 * Special flex options and exclusive scanner start-conditions
 */
#define YY_STACK_USED 1
#define YY_NEVER_INTERACTIVE 1
#define pp_pp 1

#define pp_eol 2

#define pp_inc 3

#define pp_dqs 4

#define pp_sqs 5

#define pp_iqs 6

#define pp_comment 7

#define pp_def 8

#define pp_define 9

#define pp_macro 10

#define pp_mbody 11

#define pp_macign 12

#define pp_macscan 13

#define pp_macexp 14

#define pp_if 15

#define pp_ifd 16

#define pp_line 17

#define pp_defined 18

#define pp_ignore 19

#line 140 "ppl.l"
#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>

#include "utils.h"
#include "wrc.h"
#include "preproc.h"

#include "ppy.tab.h"

/*
 * Make sure that we are running an appropriate version of flex.
 */
#if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005)
#error Must use flex version 2.5.1 or higher (yy_scan_* routines are required).
#endif

#define YY_USE_PROTOS
#define YY_NO_UNPUT
#define YY_READ_BUF_SIZE	65536		/* So we read most of a file at once */

#define yy_current_state()	YY_START
#define yy_pp_state(x)		yy_pop_state(); yy_push_state(x)

/*
 * Always update the current character position within a line
 */
#define YY_USER_ACTION	char_number+=ppleng;

/*
 * Buffer management for includes and expansions
 */
#define MAXBUFFERSTACK	128	/* Nesting more than 128 includes or macro expansion textss is insane */

typedef struct bufferstackentry {
	YY_BUFFER_STATE	bufferstate;	/* Buffer to switch back to */
	pp_entry_t	*define;	/* Points to expanding define or NULL if handling includes */
	int		line_number;	/* Line that we were handling */
	int		char_number;	/* The current position on that line */
	char		*filename;	/* Filename that we were handling */
	int		if_depth;	/* How many #if:s deep to check matching #endif:s */
	int		ncontinuations;	/* Remember the continuation state */
	int		should_pop;	/* Set if we must pop the start-state on EOF */
	/* Include management */
	int		include_state;
	char		*include_ppp;
	char		*include_filename;
	int		include_ifdepth;
	int		seen_junk;
} bufferstackentry_t;

#define ALLOCBLOCKSIZE	(1 << 10)	/* Allocate these chunks at a time for string-buffers */

/*
 * Macro expansion nesting
 * We need the stack to handle expansions while scanning
 * a macro's arguments. The TOS must always be the macro
 * that receives the current expansion from the scanner.
 */
#define MAXMACEXPSTACK	128	/* Nesting more than 128 macro expansions is insane */

typedef struct macexpstackentry {
	pp_entry_t	*ppp;		/* This macro we are scanning */
	char		**args;		/* With these arguments */
	char		**ppargs;	/* Resulting in these preprocessed arguments */
	int		*nnls;		/* Number of newlines per argument */
	int		nargs;		/* And this many arguments scanned */
	int		parentheses;	/* Nesting level of () */
	int		curargsize;	/* Current scanning argument's size */
	int		curargalloc;	/* Current scanning argument's block allocated */
	char		*curarg;	/* Current scanning argument's content */
} macexpstackentry_t;

#define MACROPARENTHESES()	(top_macro()->parentheses)

/*
 * Prototypes
 */
static void newline(int);
static int make_number(int radix, YYSTYPE *val, char *str, int len);
static void put_buffer(char *s, int len);
/* Buffer management */
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop);
static bufferstackentry_t *pop_buffer(void);
/* String functions */
static void new_string(void);
static void add_string(char *str, int len);
static char *get_string(void);
static void put_string(void);
static int string_start(void);
/* Macro functions */
static void push_macro(pp_entry_t *ppp);
static macexpstackentry_t *top_macro(void);
static macexpstackentry_t *pop_macro(void);
static void free_macro(macexpstackentry_t *mep);
static void add_text_to_macro(char *text, int len);
static void macro_add_arg(int last);
static void macro_add_expansion(void);
/* Expansion */
static void expand_special(pp_entry_t *ppp);
static void expand_define(pp_entry_t *ppp);
static void expand_macro(macexpstackentry_t *mep);

/*
 * Local variables
 */
static int ncontinuations;

static int strbuf_idx = 0;
static int strbuf_alloc = 0;
static char *strbuffer = NULL;
static int str_startline;

static macexpstackentry_t *macexpstack[MAXMACEXPSTACK];
static int macexpstackidx = 0;

static bufferstackentry_t bufferstack[MAXBUFFERSTACK];
static int bufferstackidx = 0;

/*
 * Global variables
 */
/*
 * Trace the include files to prevent double reading.
 * This save 20..30% of processing time for most stuff
 * that uses complex includes.
 * States:
 * -1	Don't track or seen junk
 *  0	New include, waiting for "#ifndef __xxx_h"
 *  1	Seen #ifndef, waiting for "#define __xxx_h ..."
 *  2	Seen #endif, waiting for EOF
 */
int include_state = -1;
char *include_ppp = NULL;	/* The define to be set from the #ifndef */
int include_ifdepth = 0;	/* The level of ifs at the #ifdef */
int seen_junk = 0;		/* Set when junk is seen */
includelogicentry_t *includelogiclist = NULL;

/*
 **************************************************************************
 * The scanner starts here
 **************************************************************************
 */
#line 1189 "lex.ppl.c"

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif

#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif

#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif

#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif

#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif

#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif

#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines.  This will fail
 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
 * or sizeof(void*) != sizeof(int).
 */
#endif
#endif

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

/* Copy whatever the last rule matched to the standard output. */

#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
	if ( yy_current_buffer->yy_is_interactive ) \
		{ \
		int c = '*', n; \
		for ( n = 0; n < max_size && \
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( yyin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
		  && ferror( yyin ) ) \
		YY_FATAL_ERROR( "input in flex scanner failed" );
#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif

/* Code executed at the beginning of each rule, after yytext and yyleng
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif

#define YY_RULE_SETUP \
	if ( yyleng > 0 ) \
		yy_current_buffer->yy_at_bol = \
				(yytext[yyleng - 1] == '\n'); \
	YY_USER_ACTION

YY_DECL
	{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;

#line 290 "ppl.l"

	/*
	 * Catch line-continuations.
	 * Note: Gcc keeps the line-continuations in, for example, strings
	 * intact. However, I prefer to remove them all so that the next
	 * scanner will not need to reduce the continuation state.
	 *
	 * <*>\\\n		newline(0);
	 */

	/*
	 * Detect the leading # of a preprocessor directive.
	 */
#line 1353 "lex.ppl.c"

	if ( yy_init )
		{
		yy_init = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

		if ( ! yy_start )
			yy_start = 1;	/* first start state */

		if ( ! yyin )
			yyin = stdin;

		if ( ! yyout )
			yyout = stdout;

		if ( ! yy_current_buffer )
			yy_current_buffer =
				yy_create_buffer( yyin, YY_BUF_SIZE );

		yy_load_buffer_state();
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
		yy_cp = yy_c_buf_p;

		/* Support of yytext. */
		*yy_cp = yy_hold_char;

		/* yy_bp points to the position in yy_ch_buf of the start of
		 * the current run.
		 */
		yy_bp = yy_cp;

		yy_current_state = yy_start;
		yy_current_state += YY_AT_BOL();
yy_match:
		do
			{
			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
			if ( yy_accept[yy_current_state] )
				{
				yy_last_accepting_state = yy_current_state;
				yy_last_accepting_cpos = yy_cp;
				}
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
				{
				yy_current_state = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 394 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 1527 );

yy_find_action:
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = yy_last_accepting_cpos;
			yy_current_state = yy_last_accepting_state;
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;


do_action:	/* This label is used only to access EOF actions. */

		if ( yy_flex_debug )
			{
			if ( yy_act == 0 )
				fprintf( stderr, "--scanner backing up\n" );
			else if ( yy_act < 136 )
				fprintf( stderr, "--accepting rule at line %d (\"%s\")\n",
				         yy_rule_linenum[yy_act], yytext );
			else if ( yy_act == 136 )
				fprintf( stderr, "--accepting default rule (\"%s\")\n",
				         yytext );
			else if ( yy_act == 137 )
				fprintf( stderr, "--(end of buffer or a NUL)\n" );
			else
				fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
			}

		switch ( yy_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of YY_DO_BEFORE_ACTION */
			*yy_cp = yy_hold_char;
			yy_cp = yy_last_accepting_cpos;
			yy_current_state = yy_last_accepting_state;
			goto yy_find_action;

case 1:
YY_RULE_SETUP
#line 303 "ppl.l"
seen_junk++; yy_push_state(pp_pp);
	YY_BREAK
/*
	 * Scan for the preprocessor directives
	 */
case 2:
YY_RULE_SETUP
#line 308 "ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);}
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 309 "ppl.l"
yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol);
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 310 "ppl.l"
yy_pp_state(pp_eol);	if(yy_top_state() != pp_ignore) return tERROR;
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 311 "ppl.l"
yy_pp_state(pp_eol);	if(yy_top_state() != pp_ignore) return tWARNING;
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 312 "ppl.l"
yy_pp_state(pp_eol);	if(yy_top_state() != pp_ignore) return tPRAGMA;
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 313 "ppl.l"
yy_pp_state(pp_eol);	if(yy_top_state() != pp_ignore) return tPPIDENT;
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 314 "ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);}
	YY_BREAK
case 9:
YY_RULE_SETUP
#line 315 "ppl.l"
yy_pp_state(pp_ifd);	return tIFDEF;
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 316 "ppl.l"
seen_junk--; yy_pp_state(pp_ifd);	return tIFNDEF;
	YY_BREAK
case 11:
YY_RULE_SETUP
#line 317 "ppl.l"
yy_pp_state(pp_if);	return tIF;
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 318 "ppl.l"
yy_pp_state(pp_if);	return tELIF;
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 319 "ppl.l"
return tELSE;
	YY_BREAK
case 14:
YY_RULE_SETUP
#line 320 "ppl.l"
return tENDIF;
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 321 "ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);}
	YY_BREAK
case 16:
YY_RULE_SETUP
#line 322 "ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);}
	YY_BREAK
case 17:
YY_RULE_SETUP
#line 323 "ppl.l"
pperror("Invalid preprocessor token '%s'", pptext);
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 324 "ppl.l"
newline(1); yy_pop_state(); return tNL;	/* This could be the null-token */
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 325 "ppl.l"
newline(0);
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 326 "ppl.l"
pperror("Preprocessor junk '%s'", pptext);
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 327 "ppl.l"
return *pptext;
	YY_BREAK
/*
	 * Handle #include and #line
	 */
case 22:
YY_RULE_SETUP
#line 332 "ppl.l"
return make_number(10, &pplval, pptext, ppleng);
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 333 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_iqs);
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 334 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 335 "ppl.l"
;
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 336 "ppl.l"
newline(1); yy_pop_state(); return tNL;
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 337 "ppl.l"
newline(0);
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 338 "ppl.l"
pperror(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line");
	YY_BREAK
/*
	 * Ignore all input when a false clause is parsed
	 */
case 29:
YY_RULE_SETUP
#line 343 "ppl.l"
;
	YY_BREAK
case 30:
YY_RULE_SETUP
#line 344 "ppl.l"
newline(1);
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 345 "ppl.l"
newline(0);
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 346 "ppl.l"
;
	YY_BREAK
/*
	 * Handle #if and #elif.
	 * These require conditionals to be evaluated, but we do not
	 * want to jam the scanner normally when we see these tokens.
	 * Note: tIDENT is handled below.
	 */
case 33:
YY_RULE_SETUP
#line 355 "ppl.l"
return make_number(8, &pplval, pptext, ppleng);
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 356 "ppl.l"
pperror("Invalid octal digit");
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 357 "ppl.l"
return make_number(10, &pplval, pptext, ppleng);
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 358 "ppl.l"
return make_number(16, &pplval, pptext, ppleng);
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 359 "ppl.l"
pperror("Invalid hex number");
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 360 "ppl.l"
yy_push_state(pp_defined); return tDEFINED;
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 361 "ppl.l"
return tLSHIFT;
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 362 "ppl.l"
return tRSHIFT;
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 363 "ppl.l"
return tLOGAND;
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 364 "ppl.l"
return tLOGOR;
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 365 "ppl.l"
return tEQ;
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 366 "ppl.l"
return tNE;
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 367 "ppl.l"
return tLTE;
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 368 "ppl.l"
return tGTE;
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 369 "ppl.l"
newline(1); yy_pop_state(); return tNL;
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 370 "ppl.l"
newline(0);
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 371 "ppl.l"
pperror("Junk in conditional expression");
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 372 "ppl.l"
;
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 373 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 374 "ppl.l"
pperror("String constants not allowed in conditionals");
	YY_BREAK
case 53:
YY_RULE_SETUP
#line 375 "ppl.l"
return *pptext;
	YY_BREAK
/*
	 * Handle #ifdef, #ifndef and #undef
	 * to get only an untranslated/unexpanded identifier
	 */
case 54:
YY_RULE_SETUP
#line 381 "ppl.l"
pplval.cptr = xstrdup(pptext); return tIDENT;
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 382 "ppl.l"
;
	YY_BREAK
case 56:
YY_RULE_SETUP
#line 383 "ppl.l"
newline(1); yy_pop_state(); return tNL;
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 384 "ppl.l"
newline(0);
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 385 "ppl.l"
pperror("Identifier expected");
	YY_BREAK
/*
	 * Handle the special 'defined' keyword.
	 * This is necessary to get the identifier prior to any
	 * substitutions.
	 */
case 59:
YY_RULE_SETUP
#line 392 "ppl.l"
yy_pop_state(); pplval.cptr = xstrdup(pptext); return tIDENT;
	YY_BREAK
case 60:
YY_RULE_SETUP
#line 393 "ppl.l"
;
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 394 "ppl.l"
return *pptext;
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 395 "ppl.l"
newline(0);
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 396 "ppl.l"
pperror("Identifier expected");
	YY_BREAK
/*
	 * Handle #error, #warning, #pragma and #ident.
	 * Pass everything literally to the parser, which
	 * will act appropriately.
	 * Comments are stripped from the literal text.
	 */
case 64:
YY_RULE_SETUP
#line 404 "ppl.l"
if(yy_top_state() != pp_ignore) { pplval.cptr = xstrdup(pptext); return tLITERAL; }
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 405 "ppl.l"
if(yy_top_state() != pp_ignore) { pplval.cptr = xstrdup(pptext); return tLITERAL; }
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 406 "ppl.l"
if(yy_top_state() != pp_ignore) { pplval.cptr = xstrdup(pptext); return tLITERAL; }
	YY_BREAK
case 67:
YY_RULE_SETUP
#line 407 "ppl.l"
newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 408 "ppl.l"
newline(0);
	YY_BREAK
/*
	 * Handle left side of #define
	 */
case 69:
YY_RULE_SETUP
#line 413 "ppl.l"
pplval.cptr = xstrdup(pptext); pplval.cptr[ppleng-1] = '\0'; yy_pp_state(pp_macro);  return tMACRO;
	YY_BREAK
case 70:
YY_RULE_SETUP
#line 414 "ppl.l"
pplval.cptr = xstrdup(pptext); yy_pp_state(pp_define); return tDEFINE;
	YY_BREAK
case 71:
YY_RULE_SETUP
#line 415 "ppl.l"
;
	YY_BREAK
case 72:
YY_RULE_SETUP
#line 416 "ppl.l"
newline(0);
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 417 "ppl.l"
perror("Identifier expected");
	YY_BREAK
/*
	 * Scan the substitution of a define
	 */
case 74:
YY_RULE_SETUP
#line 422 "ppl.l"
pplval.cptr = xstrdup(pptext); return tLITERAL;
	YY_BREAK
case 75:
YY_RULE_SETUP
#line 423 "ppl.l"
pplval.cptr = xstrdup(pptext); return tLITERAL;
	YY_BREAK
case 76:
YY_RULE_SETUP
#line 424 "ppl.l"
newline(0); pplval.cptr = xstrdup(" "); return tLITERAL;
	YY_BREAK
case 77:
YY_RULE_SETUP
#line 425 "ppl.l"
newline(0);
	YY_BREAK
case 78:
YY_RULE_SETUP
#line 426 "ppl.l"
newline(1); yy_pop_state(); return tNL;
	YY_BREAK
case 79:
YY_RULE_SETUP
#line 427 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
	YY_BREAK
case 80:
YY_RULE_SETUP
#line 428 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
	YY_BREAK
/*
	 * Scan the definition macro arguments
	 */
case 81:
YY_RULE_SETUP
#line 433 "ppl.l"
yy_pp_state(pp_mbody); return tMACROEND;
	YY_BREAK
case 82:
YY_RULE_SETUP
#line 434 "ppl.l"
;
	YY_BREAK
case 83:
YY_RULE_SETUP
#line 435 "ppl.l"
pplval.cptr = xstrdup(pptext); return tIDENT;
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 436 "ppl.l"
return ',';
	YY_BREAK
case 85:
YY_RULE_SETUP
#line 437 "ppl.l"
return tELIPSIS;
	YY_BREAK
case 86:
YY_RULE_SETUP
#line 438 "ppl.l"
pperror("Argument identifier expected");
	YY_BREAK
case 87:
YY_RULE_SETUP
#line 439 "ppl.l"
newline(0);
	YY_BREAK
/*
	 * Scan the substitution of a macro
	 */
case 88:
YY_RULE_SETUP
#line 444 "ppl.l"
pplval.cptr = xstrdup(pptext); return tLITERAL;
	YY_BREAK
case 89:
YY_RULE_SETUP
#line 445 "ppl.l"
pplval.cptr = xstrdup(pptext); return tIDENT;
	YY_BREAK
case 90:
YY_RULE_SETUP
#line 446 "ppl.l"
return tCONCAT;
	YY_BREAK
case 91:
YY_RULE_SETUP
#line 447 "ppl.l"
return tSTRINGIZE;
	YY_BREAK
case 92:
YY_RULE_SETUP
#line 448 "ppl.l"
pplval.cptr = xstrdup(pptext); return tLITERAL;
	YY_BREAK
case 93:
YY_RULE_SETUP
#line 449 "ppl.l"
pplval.cptr = xstrdup(pptext); return tLITERAL;
	YY_BREAK
case 94:
YY_RULE_SETUP
#line 450 "ppl.l"
newline(0); pplval.cptr = xstrdup(" "); return tLITERAL;
	YY_BREAK
case 95:
YY_RULE_SETUP
#line 451 "ppl.l"
newline(0);
	YY_BREAK
case 96:
YY_RULE_SETUP
#line 452 "ppl.l"
newline(1); yy_pop_state(); return tNL;
	YY_BREAK
case 97:
YY_RULE_SETUP
#line 453 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
	YY_BREAK
case 98:
YY_RULE_SETUP
#line 454 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
	YY_BREAK
/*
	 * Macro expansion text scanning.
	 * This state is active just after the identifier is scanned
	 * that triggers an expansion. We *must* delete the leading
	 * whitespace before we can start scanning for arguments.
	 *
	 * If we do not see a '(' as next trailing token, then we have
	 * a false alarm. We just continue with a nose-bleed...
	 */
case 99:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 465 "ppl.l"
yy_pp_state(pp_macscan);
	YY_BREAK
case 100:
YY_RULE_SETUP
#line 466 "ppl.l"
{
		if(yy_top_state() != pp_macscan)
			newline(0);
	}
	YY_BREAK
case 101:
YY_RULE_SETUP
#line 470 "ppl.l"
newline(0);
	YY_BREAK
case 102:
YY_RULE_SETUP
#line 471 "ppl.l"
{
		macexpstackentry_t *mac = pop_macro();
		yy_pop_state();
		put_buffer(mac->ppp->ident, strlen(mac->ppp->ident));
		put_buffer(pptext, ppleng);
		free_macro(mac);
	}
	YY_BREAK
/*
	 * Macro expansion argument text scanning.
	 * This state is active when a macro's arguments are being read for expansion.
	 */
case 103:
YY_RULE_SETUP
#line 483 "ppl.l"
{
		if(++MACROPARENTHESES() > 1)
			add_text_to_macro(pptext, ppleng);
	}
	YY_BREAK
case 104:
YY_RULE_SETUP
#line 487 "ppl.l"
{
		if(--MACROPARENTHESES() == 0)
		{
			yy_pop_state();
			macro_add_arg(1);
		}
		else
			add_text_to_macro(pptext, ppleng);
	}
	YY_BREAK
case 105:
YY_RULE_SETUP
#line 496 "ppl.l"
{
		if(MACROPARENTHESES() > 1)
			add_text_to_macro(pptext, ppleng);
		else
			macro_add_arg(0);
	}
	YY_BREAK
case 106:
YY_RULE_SETUP
#line 502 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
	YY_BREAK
case 107:
YY_RULE_SETUP
#line 503 "ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
	YY_BREAK
case 108:
YY_RULE_SETUP
#line 504 "ppl.l"
yy_push_state(pp_comment); add_text_to_macro(" ", 1);
	YY_BREAK
case 109:
YY_RULE_SETUP
#line 505 "ppl.l"
line_number++; char_number = 1; add_text_to_macro(pptext, ppleng);
	YY_BREAK
case 110:
YY_RULE_SETUP
#line 506 "ppl.l"
add_text_to_macro(pptext, ppleng);
	YY_BREAK
case 111:
YY_RULE_SETUP
#line 507 "ppl.l"
newline(0);
	YY_BREAK
/*
	 * Comment handling (almost all start-conditions)
	 */
case 112:
YY_RULE_SETUP
#line 512 "ppl.l"
yy_push_state(pp_comment);
	YY_BREAK
case 113:
YY_RULE_SETUP
#line 513 "ppl.l"
;
	YY_BREAK
case 114:
YY_RULE_SETUP
#line 514 "ppl.l"
newline(0);
	YY_BREAK
case 115:
YY_RULE_SETUP
#line 515 "ppl.l"
yy_pop_state();
	YY_BREAK
/*
	 * Remove C++ style comment (almost all start-conditions)
	 */
case 116:
YY_RULE_SETUP
#line 520 "ppl.l"
{
		if(pptext[ppleng-1] == '\\')
			ppwarning("C++ style comment ends with an escaped newline (escape ignored)");
	}
	YY_BREAK
/*
	 * Single, double and <> quoted constants
	 */
case 117:
YY_RULE_SETUP
#line 528 "ppl.l"
seen_junk++; new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
	YY_BREAK
case 118:
YY_RULE_SETUP
#line 529 "ppl.l"
seen_junk++; new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
	YY_BREAK
case 119:
YY_RULE_SETUP
#line 530 "ppl.l"
add_string(pptext, ppleng);
	YY_BREAK
case 120:
YY_RULE_SETUP
#line 531 "ppl.l"
{
		add_string(pptext, ppleng);
		yy_pop_state();
		switch(yy_current_state())
		{
		case pp_pp:
		case pp_define:
		case pp_mbody:
		case pp_inc:
		case pp_line:
			pplval.cptr = get_string();
			return tDQSTRING;
		default:
			put_string();
		}
	}
	YY_BREAK
case 121:
YY_RULE_SETUP
#line 547 "ppl.l"
add_string(pptext, ppleng);
	YY_BREAK
case 122:
YY_RULE_SETUP
#line 548 "ppl.l"
{
		add_string(pptext, ppleng);
		yy_pop_state();
		switch(yy_current_state())
		{
		case pp_if:
		case pp_define:
		case pp_mbody:
			pplval.cptr = get_string();
			return tSQSTRING;
		default:
			put_string();
		}
	}
	YY_BREAK
case 123:
YY_RULE_SETUP
#line 562 "ppl.l"
add_string(pptext, ppleng);
	YY_BREAK
case 124:
YY_RULE_SETUP
#line 563 "ppl.l"
{
		add_string(pptext, ppleng);
		yy_pop_state();
		pplval.cptr = get_string();
		return tIQSTRING;
	}
	YY_BREAK
case 125:
YY_RULE_SETUP
#line 569 "ppl.l"
{
		/*
		 * This is tricky; we need to remove the line-continuation
		 * from preprocessor strings, but OTOH retain them in all
		 * other strings. This is because the resource grammar is
		 * even more braindead than initially analysed and line-
		 * continuations in strings introduce, sigh, newlines in
		 * the output. There goes the concept of non-breaking, non-
		 * spacing whitespace.
		 */
		switch(yy_top_state())
		{
		case pp_pp:
		case pp_define:
		case pp_mbody:
		case pp_inc:
		case pp_line:
			newline(0);
			break;
		default:
			add_string(pptext, ppleng);
			newline(-1);
		}
	}
	YY_BREAK
case 126:
YY_RULE_SETUP
#line 593 "ppl.l"
add_string(pptext, ppleng);
	YY_BREAK
case 127:
YY_RULE_SETUP
#line 594 "ppl.l"
{
		newline(1);
		add_string(pptext, ppleng);
		ppwarning("Newline in string constant encounterd (started line %d)", string_start());
	}
	YY_BREAK
/*
	 * Identifier scanning
	 */
case 128:
YY_RULE_SETUP
#line 603 "ppl.l"
{
		pp_entry_t *ppp;
		seen_junk++;
		if(!(ppp = pplookup(pptext)))
		{
			if(yy_current_state() == pp_inc)
				pperror("Expected include filename");

			if(yy_current_state() == pp_if)
			{
				pplval.cptr = xstrdup(pptext);
				return tIDENT;
			}
			else
				put_buffer(pptext, ppleng);
		}
		else if(!ppp->expanding)
		{
			switch(ppp->type)
			{
			case def_special:
				expand_special(ppp);
				break;
			case def_define:
				expand_define(ppp);
				break;
			case def_macro:
				yy_push_state(pp_macign);
				push_macro(ppp);
				break;
			default:
				internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type);
			}
		}
	}
	YY_BREAK
/*
	 * Everything else that needs to be passed and
	 * newline and continuation handling
	 */
case 129:
YY_RULE_SETUP
#line 643 "ppl.l"
seen_junk++; put_buffer(pptext, ppleng);
	YY_BREAK
case 130:
YY_RULE_SETUP
#line 644 "ppl.l"
put_buffer(pptext, ppleng);
	YY_BREAK
case 131:
YY_RULE_SETUP
#line 645 "ppl.l"
newline(1);
	YY_BREAK
case 132:
YY_RULE_SETUP
#line 646 "ppl.l"
newline(0);
	YY_BREAK
case 133:
YY_RULE_SETUP
#line 647 "ppl.l"
seen_junk++; put_buffer(pptext, ppleng);
	YY_BREAK
/*
	 * Special catcher for macro argmument expansion to prevent
	 * newlines to propagate to the output or admin.
	 */
case 134:
YY_RULE_SETUP
#line 653 "ppl.l"
put_buffer(pptext, ppleng);
	YY_BREAK
/*
	 * This is a 'catch-all' rule to discover errors in the scanner
	 * in an orderly manner.
	 */
case 135:
YY_RULE_SETUP
#line 659 "ppl.l"
seen_junk++; ppwarning("Unmatched text '%c' (0x%02x); please report\n", isprint(*pptext & 0xff) ? *pptext : ' ', *pptext);
	YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(pp_pp):
case YY_STATE_EOF(pp_eol):
case YY_STATE_EOF(pp_inc):
case YY_STATE_EOF(pp_dqs):
case YY_STATE_EOF(pp_sqs):
case YY_STATE_EOF(pp_iqs):
case YY_STATE_EOF(pp_comment):
case YY_STATE_EOF(pp_def):
case YY_STATE_EOF(pp_define):
case YY_STATE_EOF(pp_macro):
case YY_STATE_EOF(pp_mbody):
case YY_STATE_EOF(pp_macign):
case YY_STATE_EOF(pp_macscan):
case YY_STATE_EOF(pp_macexp):
case YY_STATE_EOF(pp_if):
case YY_STATE_EOF(pp_ifd):
case YY_STATE_EOF(pp_line):
case YY_STATE_EOF(pp_defined):
case YY_STATE_EOF(pp_ignore):
#line 661 "ppl.l"
{
		YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
		bufferstackentry_t *bep = pop_buffer();

		if((!bep && get_if_depth()) || (bep && get_if_depth() != bep->if_depth))
			ppwarning("Unmatched #if/#endif at end of file");

		if(!bep)
		{
			if(YY_START != INITIAL)
				pperror("Unexpected end of file during preprocessing");
			yyterminate();
		}
		else if(bep->should_pop == 2)
		{
			macexpstackentry_t *mac;
			mac = pop_macro();
			expand_macro(mac);
		}
		pp_delete_buffer(b);
	}
	YY_BREAK
case 136:
YY_RULE_SETUP
#line 683 "ppl.l"
ECHO;
	YY_BREAK
#line 2379 "lex.ppl.c"

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = yy_hold_char;

		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed yyin at a new source and called
			 * yylex().  If so, then we have to assure
			 * consistency between yy_current_buffer and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			yy_n_chars = yy_current_buffer->yy_n_chars;
			yy_current_buffer->yy_input_file = yyin;
			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* Note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the
		 * end-of-buffer state).  Contrast this with the test
		 * in input().
		 */
		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state();

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * yy_get_previous_state() go ahead and do it
			 * for us because it doesn't know how to deal
			 * with the possibility of jamming (and we don't
			 * want to build jamming into it because then it
			 * will run more slowly).
			 */

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = yytext_ptr + YY_MORE_ADJ;

			if ( yy_next_state )
				{
				/* Consume the NUL. */
				yy_cp = ++yy_c_buf_p;
				yy_current_state = yy_next_state;
				goto yy_match;
				}

			else
				{
				yy_cp = yy_c_buf_p;
				goto yy_find_action;
				}
			}

		else switch ( yy_get_next_buffer() )
			{
			case EOB_ACT_END_OF_FILE:
				{
				yy_did_buffer_switch_on_eof = 0;

				if ( yywrap() )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * yytext, we can now set up
					 * yy_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * YY_NULL, it'll still work - another
					 * YY_NULL will get returned.
					 */
					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

				else
					{
					if ( ! yy_did_buffer_switch_on_eof )
						YY_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				yy_c_buf_p =
					yytext_ptr + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state();

				yy_cp = yy_c_buf_p;
				yy_bp = yytext_ptr + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				yy_c_buf_p =
				&yy_current_buffer->yy_ch_buf[yy_n_chars];

				yy_current_state = yy_get_previous_state();

				yy_cp = yy_c_buf_p;
				yy_bp = yytext_ptr + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
	} /* end of yylex */


/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
 */

static int yy_get_next_buffer()
	{
	register char *dest = yy_current_buffer->yy_ch_buf;
	register char *source = yytext_ptr;
	register int number_to_move, i;
	int ret_val;

	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( yy_current_buffer->yy_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
			{
			/* We matched a singled characater, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{
			/* We matched some text prior to the EOB, first
			 * process it.
			 */
			return EOB_ACT_LAST_MATCH;
			}
		}

	/* Try to read more data. */

	/* First move last chars to start of buffer. */
	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;

	for ( i = 0; i < number_to_move; ++i )
		*(dest++) = *(source++);

	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		yy_n_chars = 0;

	else
		{
		int num_to_read =
			yy_current_buffer->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
			YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else

			/* just a shorter name for the current buffer */
			YY_BUFFER_STATE b = yy_current_buffer;

			int yy_c_buf_p_offset =
				(int) (yy_c_buf_p - b->yy_ch_buf);

			if ( b->yy_is_our_buffer )
				{
				int new_size = b->yy_buf_size * 2;

				if ( new_size <= 0 )
					b->yy_buf_size += b->yy_buf_size / 8;
				else
					b->yy_buf_size *= 2;

				b->yy_ch_buf = (char *)
					/* Include room in for 2 EOB chars. */
					yy_flex_realloc( (void *) b->yy_ch_buf,
							 b->yy_buf_size + 2 );
				}
			else
				/* Can't grow it, we don't own it. */
				b->yy_ch_buf = 0;

			if ( ! b->yy_ch_buf )
				YY_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];

			num_to_read = yy_current_buffer->yy_buf_size -
						number_to_move - 1;
#endif
			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

		/* Read in more data. */
		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
			yy_n_chars, num_to_read );
		}

	if ( yy_n_chars == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			yyrestart( yyin );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			yy_current_buffer->yy_buffer_status =
				YY_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	yy_n_chars += number_to_move;
	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;

	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];

	return ret_val;
	}


/* yy_get_previous_state - get the state just before the EOB char was reached */

static yy_state_type yy_get_previous_state()
	{
	register yy_state_type yy_current_state;
	register char *yy_cp;

	yy_current_state = yy_start;
	yy_current_state += YY_AT_BOL();

	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
		{
		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			yy_last_accepting_state = yy_current_state;
			yy_last_accepting_cpos = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 394 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
		}

	return yy_current_state;
	}


/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = yy_try_NUL_trans( current_state );
 */

#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
	{
	register int yy_is_jam;
	register char *yy_cp = yy_c_buf_p;

	register YY_CHAR yy_c = 1;
	if ( yy_accept[yy_current_state] )
		{
		yy_last_accepting_state = yy_current_state;
		yy_last_accepting_cpos = yy_cp;
		}
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 394 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 393);

	return yy_is_jam ? 0 : yy_current_state;
	}


#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
	{
	register char *yy_cp = yy_c_buf_p;

	/* undo effects of setting up yytext */
	*yy_cp = yy_hold_char;

	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
		{ /* need to shift things up to make room */
		/* +2 for EOB chars. */
		register int number_to_move = yy_n_chars + 2;
		register char *dest = &yy_current_buffer->yy_ch_buf[
					yy_current_buffer->yy_buf_size + 2];
		register char *source =
				&yy_current_buffer->yy_ch_buf[number_to_move];

		while ( source > yy_current_buffer->yy_ch_buf )
			*--dest = *--source;

		yy_cp += (int) (dest - source);
		yy_bp += (int) (dest - source);
		yy_n_chars = yy_current_buffer->yy_buf_size;

		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
			YY_FATAL_ERROR( "flex scanner push-back overflow" );
		}

	*--yy_cp = (char) c;


	yytext_ptr = yy_bp;
	yy_hold_char = *yy_cp;
	yy_c_buf_p = yy_cp;
	}
#endif	/* ifndef YY_NO_UNPUT */


#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif
	{
	int c;

	*yy_c_buf_p = yy_hold_char;

	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
			/* This was really a NUL. */
			*yy_c_buf_p = '\0';

		else
			{ /* need more input */
			yytext_ptr = yy_c_buf_p;
			++yy_c_buf_p;

			switch ( yy_get_next_buffer() )
				{
				case EOB_ACT_END_OF_FILE:
					{
					if ( yywrap() )
						{
						yy_c_buf_p =
						yytext_ptr + YY_MORE_ADJ;
						return EOF;
						}

					if ( ! yy_did_buffer_switch_on_eof )
						YY_NEW_FILE;
#ifdef __cplusplus
					return yyinput();
#else
					return input();
#endif
					}

				case EOB_ACT_CONTINUE_SCAN:
					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
					break;

				case EOB_ACT_LAST_MATCH:
#ifdef __cplusplus
					YY_FATAL_ERROR(
					"unexpected last match in yyinput()" );
#else
					YY_FATAL_ERROR(
					"unexpected last match in input()" );
#endif
				}
			}
		}

	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
	*yy_c_buf_p = '\0';	/* preserve yytext */
	yy_hold_char = *++yy_c_buf_p;

	yy_current_buffer->yy_at_bol = (c == '\n');

	return c;
	}


#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
	{
	if ( ! yy_current_buffer )
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );

	yy_init_buffer( yy_current_buffer, input_file );
	yy_load_buffer_state();
	}


#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
	{
	if ( yy_current_buffer == new_buffer )
		return;

	if ( yy_current_buffer )
		{
		/* Flush out information for old buffer. */
		*yy_c_buf_p = yy_hold_char;
		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
		yy_current_buffer->yy_n_chars = yy_n_chars;
		}

	yy_current_buffer = new_buffer;
	yy_load_buffer_state();

	/* We don't actually know whether we did this switch during
	 * EOF (yywrap()) processing, but the only time this flag
	 * is looked at is after yywrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	yy_did_buffer_switch_on_eof = 1;
	}


#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
	{
	yy_n_chars = yy_current_buffer->yy_n_chars;
	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
	yyin = yy_current_buffer->yy_input_file;
	yy_hold_char = *yy_c_buf_p;
	}


#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
	{
	YY_BUFFER_STATE b;

	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_buf_size = size;

	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_is_our_buffer = 1;

	yy_init_buffer( b, file );

	return b;
	}


#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
	{
	if ( ! b )
		return;

	if ( b == yy_current_buffer )
		yy_current_buffer = (YY_BUFFER_STATE) 0;

	if ( b->yy_is_our_buffer )
		yy_flex_free( (void *) b->yy_ch_buf );

	yy_flex_free( (void *) b );
	}


#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif

#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif


	{
	yy_flush_buffer( b );

	b->yy_input_file = file;
	b->yy_fill_buffer = 1;

#if YY_ALWAYS_INTERACTIVE
	b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
	b->yy_is_interactive = 0;
#else
	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
	}


#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif

	{
	b->yy_n_chars = 0;

	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;

	b->yy_buf_pos = &b->yy_ch_buf[0];

	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;

	if ( b == yy_current_buffer )
		yy_load_buffer_state();
	}


#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
	{
	YY_BUFFER_STATE b;

	if ( size < 2 ||
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return 0;

	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );

	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
	b->yy_buf_pos = b->yy_ch_buf = base;
	b->yy_is_our_buffer = 0;
	b->yy_input_file = 0;
	b->yy_n_chars = b->yy_buf_size;
	b->yy_is_interactive = 0;
	b->yy_at_bol = 1;
	b->yy_fill_buffer = 0;
	b->yy_buffer_status = YY_BUFFER_NEW;

	yy_switch_to_buffer( b );

	return b;
	}
#endif


#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *str )
#else
YY_BUFFER_STATE yy_scan_string( str )
yyconst char *str;
#endif
	{
	int len;
	for ( len = 0; str[len]; ++len )
		;

	return yy_scan_bytes( str, len );
	}
#endif


#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
int len;
#endif
	{
	YY_BUFFER_STATE b;
	char *buf;
	yy_size_t n;
	int i;

	/* Get memory for full buffer, including space for trailing EOB's. */
	n = len + 2;
	buf = (char *) yy_flex_alloc( n );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );

	for ( i = 0; i < len; ++i )
		buf[i] = bytes[i];

	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;

	b = yy_scan_buffer( buf, n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );

	/* It's okay to grow etc. this buffer, and we should throw it
	 * away when we're done.
	 */
	b->yy_is_our_buffer = 1;

	return b;
	}
#endif


#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
	{
	if ( yy_start_stack_ptr >= yy_start_stack_depth )
		{
		yy_size_t new_size;

		yy_start_stack_depth += YY_START_STACK_INCR;
		new_size = yy_start_stack_depth * sizeof( int );

		if ( ! yy_start_stack )
			yy_start_stack = (int *) yy_flex_alloc( new_size );

		else
			yy_start_stack = (int *) yy_flex_realloc(
					(void *) yy_start_stack, new_size );

		if ( ! yy_start_stack )
			YY_FATAL_ERROR(
			"out of memory expanding start-condition stack" );
		}

	yy_start_stack[yy_start_stack_ptr++] = YY_START;

	BEGIN(new_state);
	}
#endif


#ifndef YY_NO_POP_STATE
static void yy_pop_state()
	{
	if ( --yy_start_stack_ptr < 0 )
		YY_FATAL_ERROR( "start-condition stack underflow" );

	BEGIN(yy_start_stack[yy_start_stack_ptr]);
	}
#endif


#ifndef YY_NO_TOP_STATE
static int yy_top_state()
	{
	return yy_start_stack[yy_start_stack_ptr - 1];
	}
#endif

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
	{
	(void) fprintf( stderr, "%s\n", msg );
	exit( YY_EXIT_FAILURE );
	}



/* Redefine yyless() so it works in section 3 code. */

#undef yyless
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up yytext. */ \
		yytext[yyleng] = yy_hold_char; \
		yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
		yy_hold_char = *yy_c_buf_p; \
		*yy_c_buf_p = '\0'; \
		yyleng = n; \
		} \
	while ( 0 )


/* Internal utility routines. */

#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
int n;
#endif
	{
	register int i;
	for ( i = 0; i < n; ++i )
		s1[i] = s2[i];
	}
#endif


#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
	{
	return (void *) malloc( size );
	}

#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
	{
	/* The cast to (char *) in the following accommodates both
	 * implementations that use char* generic pointers, and those
	 * that use void* generic pointers.  It works with the latter
	 * because both ANSI C and C++ allow castless assignment from
	 * any pointer type to void*, and deal with argument conversions
	 * as though doing an assignment.
	 */
	return (void *) realloc( (char *) ptr, size );
	}

#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
	{
	free( ptr );
	}

#if YY_MAIN
int main()
	{
	yylex();
	return 0;
	}
#endif
#line 683 "ppl.l"

/*
 **************************************************************************
 * Support functions
 **************************************************************************
 */

#ifndef ppwrap
int ppwrap(void)
{
	return 1;
}
#endif


/*
 *-------------------------------------------------------------------------
 * Output newlines or set them as continuations
 *
 * Input: -1 - Don't count this one, but update local position (see pp_dqs)
 *	   0 - Line-continuation seen and cache output
 *	   1 - Newline seen and flush output
 *-------------------------------------------------------------------------
 */
static void newline(int dowrite)
{
	line_number++;
	char_number = 1;

	if(dowrite == -1)
		return;

	ncontinuations++;
	if(dowrite)
	{
		for(;ncontinuations; ncontinuations--)
			put_buffer("\n", 1);
	}
}


/*
 *-------------------------------------------------------------------------
 * Make a number out of an any-base and suffixed string
 *
 * Possible number extensions:
 * - ""		int
 * - "L"	long int
 * - "LL"	long long int
 * - "U"	unsigned int
 * - "UL"	unsigned long int
 * - "ULL"	unsigned long long int
 * - "LU"	unsigned long int
 * - "LLU"	unsigned long long int
 * - "LUL"	invalid
 *
 * FIXME:
 * The sizes of resulting 'int' and 'long' are compiler specific.
 * I depend on sizeof(int) > 2 here (although a relatively safe
 * assumption).
 * Long longs are not yet implemented because this is very compiler
 * specific and I don't want to think too much about the problems.
 *
 *-------------------------------------------------------------------------
 */
static int make_number(int radix, YYSTYPE *val, char *str, int len)
{
	int is_l  = 0;
	int is_ll = 0;
	int is_u  = 0;
	char ext[4];

	ext[3] = '\0';
	ext[2] = toupper(str[len-1]);
	ext[1] = len > 1 ? toupper(str[len-2]) : ' ';
	ext[0] = len > 2 ? toupper(str[len-3]) : ' ';

	if(!strcmp(ext, "LUL"))
		pperror("Invalid constant suffix");
	else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL"))
	{
		is_ll++;
		is_u++;
	}
	else if(!strcmp(ext+1, "LU") || !strcmp(ext+1, "UL"))
	{
		is_l++;
		is_u++;
	}
	else if(!strcmp(ext+1, "LL"))
	{
		is_ll++;
	}
	else if(!strcmp(ext+2, "L"))
	{
		is_l++;
	}
	else if(!strcmp(ext+2, "U"))
	{
		is_u++;
	}

	if(is_ll)
		internal_error(__FILE__, __LINE__, "long long constants not implemented yet");

	if(is_u && is_l)
	{
		val->ulong = strtoul(str, NULL, radix);
		return tULONG;
	}
	else if(!is_u && is_l)
	{
		val->slong = strtol(str, NULL, radix);
		return tSLONG;
	}
	else if(is_u && !is_l)
	{
		val->uint = (unsigned int)strtoul(str, NULL, radix);
		if(!win32 && val->uint > 65535)
		{
			pperror("Constant overflow");
		}
		return tUINT;
	}

	/* Else it must be an int... */
	val->sint = (int)strtol(str, NULL, radix);
	if(!win32 && (val->sint < -32768 || val->sint > 32768))
	{
		/*
		 * Note: test must be > 32768 because unary minus
		 * is handled as an expression! This can result in
		 * failure and must be checked in the parser.
		 */
		pperror("Constant overflow");
	}
	return tSINT;
}


/*
 *-------------------------------------------------------------------------
 * Macro and define expansion support
 *
 * FIXME: Variable macro arguments.
 *-------------------------------------------------------------------------
 */
static void expand_special(pp_entry_t *ppp)
{
	char *dbgtext = "?";
	static char *buf = NULL;

	assert(ppp->type == def_special);

	if(!strcmp(ppp->ident, "__LINE__"))
	{
		dbgtext = "def_special(__LINE__)";
		buf = xrealloc(buf, 32);
		sprintf(buf, "%d", line_number);
	}
	else if(!strcmp(ppp->ident, "__FILE__"))
	{
		dbgtext = "def_special(__FILE__)";
		buf = xrealloc(buf, strlen(input_name) + 3);
		sprintf(buf, "\"%s\"", input_name);
	}
	else if(!strcmp(ppp->ident, "__DATE__"))
	{
		dbgtext = "def_special(__DATE__)";
		buf = xrealloc(buf, 32);
		strftime(buf, 32, "\"%b %d %Y\"", localtime(&now));
	}
	else if(!strcmp(ppp->ident, "__TIME__"))
	{
		dbgtext = "def_special(__TIME__)";
		buf = xrealloc(buf, 32);
		strftime(buf, 32, "\"%H:%M:%S\"", localtime(&now));
	}
	else
		internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident);

	if(debuglevel & DEBUGLEVEL_PPLEX)
		fprintf(stderr, "expand_special(%d): %s:%d: '%s' -> '%s'\n",
			macexpstackidx,
			input_name,
			line_number,
			ppp->ident,
			buf ? buf : "");

	if(buf && buf[0])
	{
		push_buffer(ppp, NULL, NULL, 0);
		yy_scan_string(buf);
	}
}

static void expand_define(pp_entry_t *ppp)
{
	assert(ppp->type == def_define);

	if(debuglevel & DEBUGLEVEL_PPLEX)
		fprintf(stderr, "expand_define(%d): %s:%d: '%s' -> '%s'\n",
			macexpstackidx,
			input_name,
			line_number,
			ppp->ident,
			ppp->subst.text);
	if(ppp->subst.text && ppp->subst.text[0])
	{
		push_buffer(ppp, NULL, NULL, 0);
		yy_scan_string(ppp->subst.text);
	}
}

static int curdef_idx = 0;
static int curdef_alloc = 0;
static char *curdef_text = NULL;

static void add_text(char *str, int len)
{
	if(len == 0)
		return;
	if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len)
	{
		curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
		curdef_text = xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0]));
		if(curdef_alloc > 65536)
			ppwarning("Reallocating macro-expansion buffer larger than 64kB");
	}
	memcpy(&curdef_text[curdef_idx], str, len);
	curdef_idx += len;
}

static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl)
{
	char *cptr;
	char *exp;
	int tag;
	int n;

	if(mtp == NULL)
		return NULL;

	switch(mtp->type)
	{
	case exp_text:
		if(debuglevel & DEBUGLEVEL_PPLEX)
			fprintf(stderr, "add_expand_text: exp_text: '%s'\n", mtp->subst.text);
		add_text(mtp->subst.text, strlen(mtp->subst.text));
		break;

	case exp_stringize:
		if(debuglevel & DEBUGLEVEL_PPLEX)
			fprintf(stderr, "add_expand_text: exp_stringize(%d): '%s'\n",
				mtp->subst.argidx,
				mep->args[mtp->subst.argidx]);
		cptr = mep->args[mtp->subst.argidx];
		add_text("\"", 1);
		while(*cptr)
		{
			if(*cptr == '"' || *cptr == '\\')
				add_text("\\", 1);
			add_text(cptr, 1);
			cptr++;
		}
		add_text("\"", 1);
		break;

	case exp_concat:
		if(debuglevel & DEBUGLEVEL_PPLEX)
			fprintf(stderr, "add_expand_text: exp_concat\n");
		/* Remove trailing whitespace from current expansion text */
		while(curdef_idx)
		{
			if(isspace(curdef_text[curdef_idx-1] & 0xff))
				curdef_idx--;
			else
				break;
		}
		/* tag current position and recursively expand the next part */
		tag = curdef_idx;
		mtp = add_expand_text(mtp->next, mep, nnl);

		/* Now get rid of the leading space of the expansion */
		cptr = &curdef_text[tag];
		n = curdef_idx - tag;
		while(n)
		{
			if(isspace(*cptr & 0xff))
			{
				cptr++;
				n--;
			}
			else
				break;
		}
		if(cptr != &curdef_text[tag])
		{	
			memmove(&curdef_text[tag], cptr, n);
			curdef_idx -= (curdef_idx - tag) - n;
		}
		break;

	case exp_subst:
		if((mtp->next && mtp->next->type == exp_concat) || (mtp->prev && mtp->prev->type == exp_concat))
			exp = mep->args[mtp->subst.argidx];
		else
			exp = mep->ppargs[mtp->subst.argidx];
		if(exp)
		{
			add_text(exp, strlen(exp));
			*nnl -= mep->nnls[mtp->subst.argidx];
			cptr = strchr(exp, '\n');
			while(cptr)
			{
				*cptr = ' ';
				cptr = strchr(cptr+1, '\n');
			}
			mep->nnls[mtp->subst.argidx] = 0;
		}
		if(debuglevel & DEBUGLEVEL_PPLEX)
			fprintf(stderr, "add_expand_text: exp_subst(%d): '%s'\n", mtp->subst.argidx, exp);
		break;

	default:
		internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type);
	}
	return mtp;
}

static void expand_macro(macexpstackentry_t *mep)
{
	mtext_t *mtp;
	int n, k;
	char *cptr;
	int nnl = 0;
	pp_entry_t *ppp = mep->ppp;
	int nargs = mep->nargs;

	assert(ppp->type == def_macro);
	assert(ppp->expanding == 0);

	if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs))
		pperror("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);

	for(n = 0; n < nargs; n++)
		nnl += mep->nnls[n];

	if(debuglevel & DEBUGLEVEL_PPLEX)
		fprintf(stderr, "expand_macro(%d): %s:%d: '%s'(%d,%d) -> ...\n",
			macexpstackidx,
			input_name,
			line_number,
			ppp->ident,
			mep->nargs,
			nnl);

	curdef_idx = 0;

	for(mtp = ppp->subst.mtext; mtp; mtp = mtp->next)
	{
		if(!(mtp = add_expand_text(mtp, mep, &nnl)))
			break;
	}

	for(n = 0; n < nnl; n++)
		add_text("\n", 1);

	/* To make sure there is room and termination (see below) */
	add_text(" \0", 2);

	/* Strip trailing whitespace from expansion */
	for(k = curdef_idx, cptr = &curdef_text[curdef_idx-1]; k > 0; k--, cptr--)
	{
		if(!isspace(*cptr & 0xff))
			break;
	}

	/*
	 * We must add *one* whitespace to make sure that there
	 * is a token-seperation after the expansion.
	 */
	*(++cptr) = ' ';
	*(++cptr) = '\0';
	k++;

	/* Strip leading whitespace from expansion */
	for(n = 0, cptr = curdef_text; n < k; n++, cptr++)
	{
		if(!isspace(*cptr & 0xff))
			break;
	}

	if(k - n > 0)
	{
		if(debuglevel & DEBUGLEVEL_PPLEX)
			fprintf(stderr, "expand_text: '%s'\n", curdef_text + n);
		push_buffer(ppp, NULL, NULL, 0);
		/*yy_scan_bytes(curdef_text + n, k - n);*/
		yy_scan_string(curdef_text + n);
	}
}

/*
 *-------------------------------------------------------------------------
 * String collection routines
 *-------------------------------------------------------------------------
 */
static void new_string(void)
{
#ifdef DEBUG
	if(strbuf_idx)
		ppwarning("new_string: strbuf_idx != 0");
#endif
	strbuf_idx = 0;
	str_startline = line_number;
}

static void add_string(char *str, int len)
{
	if(len == 0)
		return;
	if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len)
	{
		strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
		strbuffer = xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0]));
		if(strbuf_alloc > 65536)
			ppwarning("Reallocating string buffer larger than 64kB");
	}
	memcpy(&strbuffer[strbuf_idx], str, len);
	strbuf_idx += len;
}

static char *get_string(void)
{
	char *str = (char *)xmalloc(strbuf_idx + 1);
	memcpy(str, strbuffer, strbuf_idx);
	str[strbuf_idx] = '\0';
#ifdef DEBUG
	strbuf_idx = 0;
#endif
	return str;
}

static void put_string(void)
{
	put_buffer(strbuffer, strbuf_idx);
#ifdef DEBUG
	strbuf_idx = 0;
#endif
}

static int string_start(void)
{
	return str_startline;
}


/*
 *-------------------------------------------------------------------------
 * Buffer management
 *-------------------------------------------------------------------------
 */
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
{
	if(ppdebug)
		printf("push_buffer(%d): %p %p %p %d\n", bufferstackidx, ppp, filename, incname, pop);
	if(bufferstackidx >= MAXBUFFERSTACK)
		internal_error(__FILE__, __LINE__, "Buffer stack overflow");

	memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
	bufferstack[bufferstackidx].bufferstate	= YY_CURRENT_BUFFER;
	bufferstack[bufferstackidx].define	= ppp;
	bufferstack[bufferstackidx].line_number	= line_number;
	bufferstack[bufferstackidx].char_number	= char_number;
	bufferstack[bufferstackidx].if_depth	= get_if_depth();
	bufferstack[bufferstackidx].should_pop	= pop;
	bufferstack[bufferstackidx].filename	= input_name;
	bufferstack[bufferstackidx].ncontinuations	= ncontinuations;
	bufferstack[bufferstackidx].include_state	= include_state;
	bufferstack[bufferstackidx].include_ppp		= include_ppp;
	bufferstack[bufferstackidx].include_filename	= incname;
	bufferstack[bufferstackidx].include_ifdepth	= include_ifdepth;
	bufferstack[bufferstackidx].seen_junk		= seen_junk;

	if(ppp)
		ppp->expanding = 1;
	else if(filename)
	{
		/* These will track the pperror to the correct file and line */
		line_number = 1;
		char_number = 1;
		input_name  = filename;
		ncontinuations = 0;
	}
	else if(!pop)
		internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
	bufferstackidx++;
}

static bufferstackentry_t *pop_buffer(void)
{
	if(bufferstackidx < 0)
		internal_error(__FILE__, __LINE__, "Bufferstack underflow?");

	if(bufferstackidx == 0)
		return NULL;

	bufferstackidx--;

	if(bufferstack[bufferstackidx].define)
		bufferstack[bufferstackidx].define->expanding = 0;
	else
	{
		line_number = bufferstack[bufferstackidx].line_number;
		char_number = bufferstack[bufferstackidx].char_number;
		input_name  = bufferstack[bufferstackidx].filename;
		ncontinuations = bufferstack[bufferstackidx].ncontinuations;
		if(!bufferstack[bufferstackidx].should_pop)
		{
			fclose(ppin);
			fprintf(ppout, "# %d \"%s\" 2\n", line_number, input_name);

			/* We have EOF, check the include logic */
			if(include_state == 2 && !seen_junk && include_ppp)
			{
				pp_entry_t *ppp = pplookup(include_ppp);
				if(ppp)
				{
					includelogicentry_t *iep = xmalloc(sizeof(includelogicentry_t));
					iep->ppp = ppp;
					ppp->iep = iep;
					iep->filename = bufferstack[bufferstackidx].include_filename;
					iep->next = includelogiclist;
					if(iep->next)
						iep->next->prev = iep;
					includelogiclist = iep;
					if(debuglevel & DEBUGLEVEL_PPMSG)
						fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", input_name, line_number, include_ppp, iep->filename);
				}
				else if(bufferstack[bufferstackidx].include_filename)
					free(bufferstack[bufferstackidx].include_filename);
			}
			if(include_ppp)
				free(include_ppp);
			include_state	= bufferstack[bufferstackidx].include_state;
			include_ppp	= bufferstack[bufferstackidx].include_ppp;
			include_ifdepth	= bufferstack[bufferstackidx].include_ifdepth;
			seen_junk	= bufferstack[bufferstackidx].seen_junk;
		}
	}

	if(ppdebug)
		printf("pop_buffer(%d): %p %p (%d, %d, %d) %p %d\n",
			bufferstackidx,
			bufferstack[bufferstackidx].bufferstate,
			bufferstack[bufferstackidx].define,
			bufferstack[bufferstackidx].line_number,
			bufferstack[bufferstackidx].char_number,
			bufferstack[bufferstackidx].if_depth,
			bufferstack[bufferstackidx].filename,
			bufferstack[bufferstackidx].should_pop);

	pp_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);

	if(bufferstack[bufferstackidx].should_pop)
	{
		if(yy_current_state() == pp_macexp)
			macro_add_expansion();
		else
			internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state"); 
		yy_pop_state();
	}

	return &bufferstack[bufferstackidx];
}


/*
 *-------------------------------------------------------------------------
 * Macro nestng support
 *-------------------------------------------------------------------------
 */
static void push_macro(pp_entry_t *ppp)
{
	if(macexpstackidx >= MAXMACEXPSTACK)
		pperror("Too many nested macros");

	macexpstack[macexpstackidx] = xmalloc(sizeof(macexpstack[0][0]));

	macexpstack[macexpstackidx]->ppp = ppp;
	macexpstackidx++;
}

static macexpstackentry_t *top_macro(void)
{
	return macexpstackidx > 0 ? macexpstack[macexpstackidx-1] : NULL;
}

static macexpstackentry_t *pop_macro(void)
{
	if(macexpstackidx <= 0)
		internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n");
	return macexpstack[--macexpstackidx];
}

static void free_macro(macexpstackentry_t *mep)
{
	int i;

	for(i = 0; i < mep->nargs; i++)
		free(mep->args[i]);
	if(mep->args)
		free(mep->args);
	if(mep->nnls)
		free(mep->nnls);
	if(mep->curarg)
		free(mep->curarg);
	free(mep);
}

static void add_text_to_macro(char *text, int len)
{
	macexpstackentry_t *mep = top_macro();

	assert(mep->ppp->expanding == 0);

	if(mep->curargalloc - mep->curargsize <= len+1)	/* +1 for '\0' */
	{
		mep->curargalloc += MAX(ALLOCBLOCKSIZE, len+1);
		mep->curarg = xrealloc(mep->curarg, mep->curargalloc * sizeof(mep->curarg[0]));
	}
	memcpy(mep->curarg + mep->curargsize, text, len);
	mep->curargsize += len;
	mep->curarg[mep->curargsize] = '\0';
}

static void macro_add_arg(int last)
{
	int nnl = 0;
	char *cptr;
	macexpstackentry_t *mep = top_macro();

	assert(mep->ppp->expanding == 0);

	mep->args = xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0]));
	mep->ppargs = xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0]));
	mep->nnls = xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0]));
	mep->args[mep->nargs] = xstrdup(mep->curarg ? mep->curarg : "");
	cptr = mep->args[mep->nargs]-1;
	while((cptr = strchr(cptr+1, '\n')))
	{
		nnl++;
	}
	mep->nnls[mep->nargs] = nnl;
	mep->nargs++;
	free(mep->curarg);
	mep->curargalloc = mep->curargsize = 0;
	mep->curarg = NULL;

	if(debuglevel & DEBUGLEVEL_PPLEX)
		fprintf(stderr, "macro_add_arg: %s:%d: %d -> '%s'\n",
			input_name,
			line_number,
			mep->nargs-1,
			mep->args[mep->nargs-1]);

	/* Each macro argument must be expanded to cope with stingize */
	if(last || mep->args[mep->nargs-1][0])
	{
		yy_push_state(pp_macexp);
		push_buffer(NULL, NULL, NULL, last ? 2 : 1);
		yy_scan_string(mep->args[mep->nargs-1]);
		/*mep->bufferstackidx = bufferstackidx;	 But not nested! */
	}
}

static void macro_add_expansion(void)
{
	macexpstackentry_t *mep = top_macro();

	assert(mep->ppp->expanding == 0);

	mep->ppargs[mep->nargs-1] = xstrdup(mep->curarg ? mep->curarg : "");
	free(mep->curarg);
	mep->curargalloc = mep->curargsize = 0;
	mep->curarg = NULL;

	if(debuglevel & DEBUGLEVEL_PPLEX)
		fprintf(stderr, "macro_add_expansion: %s:%d: %d -> '%s'\n",
			input_name,
			line_number,
			mep->nargs-1,
			mep->ppargs[mep->nargs-1]);
}


/*
 *-------------------------------------------------------------------------
 * Output management
 *-------------------------------------------------------------------------
 */
static void put_buffer(char *s, int len)
{
	if(top_macro())
		add_text_to_macro(s, len);
	else
		fwrite(s, 1, len, ppout);
}


/*
 *-------------------------------------------------------------------------
 * Include management
 *-------------------------------------------------------------------------
 */
void do_include(char *fname, int type)
{
	char *newpath;
	int n;
	includelogicentry_t *iep;

	for(iep = includelogiclist; iep; iep = iep->next)
	{
		if(!strcmp(iep->filename, fname))
		{
			/*
			 * We are done. The file was included before.
			 * If the define was deleted, then this entry would have
			 * been deleted too.
			 */
			return;
		}
	}

	n = strlen(fname);

	if(n <= 2)
		pperror("Empty include filename");

	/* Undo the effect of the quotation */
	fname[n-1] = '\0';

	if((ppin = open_include(fname+1, type, &newpath)) == NULL)
		pperror("Unable to open include file %s", fname+1);

	fname[n-1] = *fname;	/* Redo the quotes */
	push_buffer(NULL, newpath, fname, 0);
	seen_junk = 0;
	include_state = 0;
	include_ppp = NULL;
	if(debuglevel & DEBUGLEVEL_PPMSG)
		fprintf(stderr, "do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", input_name, line_number, include_state, include_ppp, include_ifdepth);
	pp_switch_to_buffer(pp_create_buffer(ppin, YY_BUF_SIZE));

	fprintf(ppout, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); 
}

/*
 *-------------------------------------------------------------------------
 * Push/pop preprocessor ignore state when processing conditionals
 * which are false.
 *-------------------------------------------------------------------------
 */
void push_ignore_state(void)
{
	yy_push_state(pp_ignore);
}

void pop_ignore_state(void)
{
	yy_pop_state();
}


