tokenparser.c

Go to the documentation of this file.
00001 
00002 #line 3 "tokenparser.c"
00003 
00004 #define  YY_INT_ALIGNED short int
00005 
00006 /* A lexical scanner generated by flex */
00007 
00008 #define yy_create_buffer tp_create_buffer
00009 #define yy_delete_buffer tp_delete_buffer
00010 #define yy_flex_debug tp_flex_debug
00011 #define yy_init_buffer tp_init_buffer
00012 #define yy_flush_buffer tp_flush_buffer
00013 #define yy_load_buffer_state tp_load_buffer_state
00014 #define yy_switch_to_buffer tp_switch_to_buffer
00015 #define yyin tpin
00016 #define yyleng tpleng
00017 #define yylex tplex
00018 #define yylineno tplineno
00019 #define yyout tpout
00020 #define yyrestart tprestart
00021 #define yytext tptext
00022 #define yywrap tpwrap
00023 #define yyalloc tpalloc
00024 #define yyrealloc tprealloc
00025 #define yyfree tpfree
00026 
00027 #define FLEX_SCANNER
00028 #define YY_FLEX_MAJOR_VERSION 2
00029 #define YY_FLEX_MINOR_VERSION 5
00030 #define YY_FLEX_SUBMINOR_VERSION 35
00031 #if YY_FLEX_SUBMINOR_VERSION > 0
00032 #define FLEX_BETA
00033 #endif
00034 
00035 /* First, we deal with  platform-specific or compiler-specific issues. */
00036 
00037 /* begin standard C headers. */
00038 #include <stdio.h>
00039 #include <string.h>
00040 #include <errno.h>
00041 #include <stdlib.h>
00042 
00043 /* end standard C headers. */
00044 
00045 /* flex integer type definitions */
00046 
00047 #ifndef FLEXINT_H
00048 #define FLEXINT_H
00049 
00050 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00051 
00052 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00053 
00054 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00055  * if you want the limit (max/min) macros for int types. 
00056  */
00057 #ifndef __STDC_LIMIT_MACROS
00058 #define __STDC_LIMIT_MACROS 1
00059 #endif
00060 
00061 #include <inttypes.h>
00062 typedef int8_t flex_int8_t;
00063 typedef uint8_t flex_uint8_t;
00064 typedef int16_t flex_int16_t;
00065 typedef uint16_t flex_uint16_t;
00066 typedef int32_t flex_int32_t;
00067 typedef uint32_t flex_uint32_t;
00068 #else
00069 typedef signed char flex_int8_t;
00070 typedef short int flex_int16_t;
00071 typedef int flex_int32_t;
00072 typedef unsigned char flex_uint8_t; 
00073 typedef unsigned short int flex_uint16_t;
00074 typedef unsigned int flex_uint32_t;
00075 #endif /* ! C99 */
00076 
00077 /* Limits of integral types. */
00078 #ifndef INT8_MIN
00079 #define INT8_MIN               (-128)
00080 #endif
00081 #ifndef INT16_MIN
00082 #define INT16_MIN              (-32767-1)
00083 #endif
00084 #ifndef INT32_MIN
00085 #define INT32_MIN              (-2147483647-1)
00086 #endif
00087 #ifndef INT8_MAX
00088 #define INT8_MAX               (127)
00089 #endif
00090 #ifndef INT16_MAX
00091 #define INT16_MAX              (32767)
00092 #endif
00093 #ifndef INT32_MAX
00094 #define INT32_MAX              (2147483647)
00095 #endif
00096 #ifndef UINT8_MAX
00097 #define UINT8_MAX              (255U)
00098 #endif
00099 #ifndef UINT16_MAX
00100 #define UINT16_MAX             (65535U)
00101 #endif
00102 #ifndef UINT32_MAX
00103 #define UINT32_MAX             (4294967295U)
00104 #endif
00105 
00106 #endif /* ! FLEXINT_H */
00107 
00108 #ifdef __cplusplus
00109 
00110 /* The "const" storage-class-modifier is valid. */
00111 #define YY_USE_CONST
00112 
00113 #else   /* ! __cplusplus */
00114 
00115 /* C99 requires __STDC__ to be defined as 1. */
00116 #if defined (__STDC__)
00117 
00118 #define YY_USE_CONST
00119 
00120 #endif  /* defined (__STDC__) */
00121 #endif  /* ! __cplusplus */
00122 
00123 #ifdef YY_USE_CONST
00124 #define yyconst const
00125 #else
00126 #define yyconst
00127 #endif
00128 
00129 /* Returned upon end-of-file. */
00130 #define YY_NULL 0
00131 
00132 /* Promotes a possibly negative, possibly signed char to an unsigned
00133  * integer for use as an array index.  If the signed char is negative,
00134  * we want to instead treat it as an 8-bit unsigned char, hence the
00135  * double cast.
00136  */
00137 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00138 
00139 /* Enter a start condition.  This macro really ought to take a parameter,
00140  * but we do it the disgusting crufty way forced on us by the ()-less
00141  * definition of BEGIN.
00142  */
00143 #define BEGIN (yy_start) = 1 + 2 *
00144 
00145 /* Translate the current start state into a value that can be later handed
00146  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00147  * compatibility.
00148  */
00149 #define YY_START (((yy_start) - 1) / 2)
00150 #define YYSTATE YY_START
00151 
00152 /* Action number for EOF rule of a given start state. */
00153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00154 
00155 /* Special action meaning "start processing a new file". */
00156 #define YY_NEW_FILE tprestart(tpin  )
00157 
00158 #define YY_END_OF_BUFFER_CHAR 0
00159 
00160 /* Size of default input buffer. */
00161 #ifndef YY_BUF_SIZE
00162 #define YY_BUF_SIZE 16384
00163 #endif
00164 
00165 /* The state buf must be large enough to hold one state per character in the main buffer.
00166  */
00167 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00168 
00169 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00170 #define YY_TYPEDEF_YY_BUFFER_STATE
00171 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00172 #endif
00173 
00174 extern int tpleng;
00175 
00176 extern FILE *tpin, *tpout;
00177 
00178 #define EOB_ACT_CONTINUE_SCAN 0
00179 #define EOB_ACT_END_OF_FILE 1
00180 #define EOB_ACT_LAST_MATCH 2
00181 
00182     #define YY_LESS_LINENO(n)
00183     
00184 /* Return all but the first "n" matched characters back to the input stream. */
00185 #define yyless(n) \
00186     do \
00187         { \
00188         /* Undo effects of setting up tptext. */ \
00189         int yyless_macro_arg = (n); \
00190         YY_LESS_LINENO(yyless_macro_arg);\
00191         *yy_cp = (yy_hold_char); \
00192         YY_RESTORE_YY_MORE_OFFSET \
00193         (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00194         YY_DO_BEFORE_ACTION; /* set up tptext again */ \
00195         } \
00196     while ( 0 )
00197 
00198 #define unput(c) yyunput( c, (yytext_ptr)  )
00199 
00200 #ifndef YY_TYPEDEF_YY_SIZE_T
00201 #define YY_TYPEDEF_YY_SIZE_T
00202 typedef size_t yy_size_t;
00203 #endif
00204 
00205 #ifndef YY_STRUCT_YY_BUFFER_STATE
00206 #define YY_STRUCT_YY_BUFFER_STATE
00207 struct yy_buffer_state
00208     {
00209     FILE *yy_input_file;
00210 
00211     char *yy_ch_buf;        /* input buffer */
00212     char *yy_buf_pos;       /* current position in input buffer */
00213 
00214     /* Size of input buffer in bytes, not including room for EOB
00215      * characters.
00216      */
00217     yy_size_t yy_buf_size;
00218 
00219     /* Number of characters read into yy_ch_buf, not including EOB
00220      * characters.
00221      */
00222     int yy_n_chars;
00223 
00224     /* Whether we "own" the buffer - i.e., we know we created it,
00225      * and can realloc() it to grow it, and should free() it to
00226      * delete it.
00227      */
00228     int yy_is_our_buffer;
00229 
00230     /* Whether this is an "interactive" input source; if so, and
00231      * if we're using stdio for input, then we want to use getc()
00232      * instead of fread(), to make sure we stop fetching input after
00233      * each newline.
00234      */
00235     int yy_is_interactive;
00236 
00237     /* Whether we're considered to be at the beginning of a line.
00238      * If so, '^' rules will be active on the next match, otherwise
00239      * not.
00240      */
00241     int yy_at_bol;
00242 
00243     int yy_bs_lineno; 
00244     int yy_bs_column; 
00246     /* Whether to try to fill the input buffer when we reach the
00247      * end of it.
00248      */
00249     int yy_fill_buffer;
00250 
00251     int yy_buffer_status;
00252 
00253 #define YY_BUFFER_NEW 0
00254 #define YY_BUFFER_NORMAL 1
00255     /* When an EOF's been seen but there's still some text to process
00256      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00257      * shouldn't try reading from the input source any more.  We might
00258      * still have a bunch of tokens to match, though, because of
00259      * possible backing-up.
00260      *
00261      * When we actually see the EOF, we change the status to "new"
00262      * (via tprestart()), so that the user can continue scanning by
00263      * just pointing tpin at a new input file.
00264      */
00265 #define YY_BUFFER_EOF_PENDING 2
00266 
00267     };
00268 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00269 
00270 /* Stack of input buffers. */
00271 static size_t yy_buffer_stack_top = 0; 
00272 static size_t yy_buffer_stack_max = 0; 
00273 static YY_BUFFER_STATE * yy_buffer_stack = 0; 
00275 /* We provide macros for accessing buffer states in case in the
00276  * future we want to put the buffer states in a more general
00277  * "scanner state".
00278  *
00279  * Returns the top of the stack, or NULL.
00280  */
00281 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
00282                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
00283                           : NULL)
00284 
00285 /* Same as previous macro, but useful when we know that the buffer stack is not
00286  * NULL or when we need an lvalue. For internal use only.
00287  */
00288 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
00289 
00290 /* yy_hold_char holds the character lost when tptext is formed. */
00291 static char yy_hold_char;
00292 static int yy_n_chars;      /* number of characters read into yy_ch_buf */
00293 int tpleng;
00294 
00295 /* Points to current character in buffer. */
00296 static char *yy_c_buf_p = (char *) 0;
00297 static int yy_init = 0;     /* whether we need to initialize */
00298 static int yy_start = 0;    /* start state number */
00299 
00300 /* Flag which is used to allow tpwrap()'s to do buffer switches
00301  * instead of setting up a fresh tpin.  A bit of a hack ...
00302  */
00303 static int yy_did_buffer_switch_on_eof;
00304 
00305 void tprestart (FILE *input_file  );
00306 void tp_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
00307 YY_BUFFER_STATE tp_create_buffer (FILE *file,int size  );
00308 void tp_delete_buffer (YY_BUFFER_STATE b  );
00309 void tp_flush_buffer (YY_BUFFER_STATE b  );
00310 void tppush_buffer_state (YY_BUFFER_STATE new_buffer  );
00311 void tppop_buffer_state (void );
00312 
00313 static void tpensure_buffer_stack (void );
00314 static void tp_load_buffer_state (void );
00315 static void tp_init_buffer (YY_BUFFER_STATE b,FILE *file  );
00316 
00317 #define YY_FLUSH_BUFFER tp_flush_buffer(YY_CURRENT_BUFFER )
00318 
00319 YY_BUFFER_STATE tp_scan_buffer (char *base,yy_size_t size  );
00320 YY_BUFFER_STATE tp_scan_string (yyconst char *yy_str  );
00321 YY_BUFFER_STATE tp_scan_bytes (yyconst char *bytes,int len  );
00322 
00323 void *tpalloc (yy_size_t  );
00324 void *tprealloc (void *,yy_size_t  );
00325 void tpfree (void *  );
00326 
00327 #define yy_new_buffer tp_create_buffer
00328 
00329 #define yy_set_interactive(is_interactive) \
00330     { \
00331     if ( ! YY_CURRENT_BUFFER ){ \
00332         tpensure_buffer_stack (); \
00333         YY_CURRENT_BUFFER_LVALUE =    \
00334             tp_create_buffer(tpin,YY_BUF_SIZE ); \
00335     } \
00336     YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00337     }
00338 
00339 #define yy_set_bol(at_bol) \
00340     { \
00341     if ( ! YY_CURRENT_BUFFER ){\
00342         tpensure_buffer_stack (); \
00343         YY_CURRENT_BUFFER_LVALUE =    \
00344             tp_create_buffer(tpin,YY_BUF_SIZE ); \
00345     } \
00346     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00347     }
00348 
00349 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00350 
00351 /* Begin user sect3 */
00352 
00353 #define tpwrap(n) 1
00354 #define YY_SKIP_YYWRAP
00355 
00356 typedef unsigned char YY_CHAR;
00357 
00358 FILE *tpin = (FILE *) 0, *tpout = (FILE *) 0;
00359 
00360 typedef int yy_state_type;
00361 
00362 extern int tplineno;
00363 
00364 int tplineno = 1;
00365 
00366 extern char *tptext;
00367 #define yytext_ptr tptext
00368 
00369 static yy_state_type yy_get_previous_state (void );
00370 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
00371 static int yy_get_next_buffer (void );
00372 static void yy_fatal_error (yyconst char msg[]  );
00373 
00374 /* Done after the current pattern has been matched and before the
00375  * corresponding action - sets up tptext.
00376  */
00377 #define YY_DO_BEFORE_ACTION \
00378     (yytext_ptr) = yy_bp; \
00379     tpleng = (size_t) (yy_cp - yy_bp); \
00380     (yy_hold_char) = *yy_cp; \
00381     *yy_cp = '\0'; \
00382     (yy_c_buf_p) = yy_cp;
00383 
00384 #define YY_NUM_RULES 7
00385 #define YY_END_OF_BUFFER 8
00386 /* This struct is not used in this scanner,
00387    but its presence is necessary. */
00388 struct yy_trans_info
00389     {
00390     flex_int32_t yy_verify;
00391     flex_int32_t yy_nxt;
00392     };
00393 static yyconst flex_int16_t yy_accept[39] =
00394     {   0,
00395         0,    0,    8,    6,    4,    2,    1,    6,    1,    0,
00396         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00397         0,    0,    0,    0,    0,    0,    0,    0,    0,    3,
00398         0,    0,    0,    0,    0,    0,    5,    0
00399     } ;
00400 
00401 static yyconst flex_int32_t yy_ec[256] =
00402     {   0,
00403         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00404         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00405         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00406         1,    2,    4,    4,    5,    4,    4,    4,    4,    4,
00407         4,    4,    4,    4,    4,    4,    6,    7,    7,    7,
00408         7,    7,    7,    7,    7,    7,    7,    4,    1,    8,
00409         4,    9,    4,    4,   10,   10,   10,   10,   10,   10,
00410        10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
00411        10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
00412         1,    1,    1,    4,    4,    1,   11,   11,   11,   11,
00413 
00414        12,   11,   13,   11,   14,   11,   15,   11,   11,   16,
00415        11,   11,   11,   17,   18,   19,   11,   11,   11,   11,
00416        20,   11,    1,    1,    1,    4,    1,    1,    1,    1,
00417         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00418         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00419         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00420         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00421         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00422         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00423         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00424 
00425         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00426         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00427         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00428         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00429         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00430         1,    1,    1,    1,    1
00431     } ;
00432 
00433 static yyconst flex_int32_t yy_meta[21] =
00434     {   0,
00435         1,    2,    3,    4,    4,    4,    2,    1,    1,    2,
00436         2,    2,    2,    2,    2,    2,    2,    2,    2,    2
00437     } ;
00438 
00439 static yyconst flex_int16_t yy_base[43] =
00440     {   0,
00441         0,    7,   49,   50,   50,   50,    0,    1,    0,   36,
00442        28,   26,   28,   35,   29,    0,   26,   33,   27,   33,
00443        29,   22,    0,   24,   27,   14,   27,   23,   13,   50,
00444        10,    9,    4,    1,    0,    2,   50,   50,   19,   23,
00445         2,   26
00446     } ;
00447 
00448 static yyconst flex_int16_t yy_def[43] =
00449     {   0,
00450        39,   39,   38,   38,   38,   38,   40,   38,   40,   38,
00451        38,   38,   38,   38,   38,   41,   38,   41,   38,   38,
00452        38,   38,   42,   38,   42,   38,   38,   38,   38,   38,
00453        38,   38,   38,   38,   38,   38,   38,    0,   38,   38,
00454        38,   38
00455     } ;
00456 
00457 static yyconst flex_int16_t yy_nxt[71] =
00458     {   0,
00459        38,    5,    6,   18,    7,   38,   38,    8,    5,    6,
00460        37,    7,   36,   38,    8,   10,   35,   34,   11,    4,
00461         4,    4,    4,    9,    9,   33,    9,   25,   32,   25,
00462        31,   30,   29,   28,   27,   26,   24,   23,   22,   21,
00463        20,   19,   17,   16,   15,   14,   13,   12,   38,    3,
00464        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
00465        38,   38,   38,   38,   38,   38,   38,   38,   38,   38
00466     } ;
00467 
00468 static yyconst flex_int16_t yy_chk[71] =
00469     {   0,
00470         0,    1,    1,   41,    1,    0,    0,    1,    2,    2,
00471        36,    2,   35,    0,    2,    8,   34,   33,    8,   39,
00472        39,   39,   39,   40,   40,   32,   40,   42,   31,   42,
00473        29,   28,   27,   26,   25,   24,   22,   21,   20,   19,
00474        18,   17,   15,   14,   13,   12,   11,   10,    3,   38,
00475        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
00476        38,   38,   38,   38,   38,   38,   38,   38,   38,   38
00477     } ;
00478 
00479 static yy_state_type yy_last_accepting_state;
00480 static char *yy_last_accepting_cpos;
00481 
00482 extern int tp_flex_debug;
00483 int tp_flex_debug = 0;
00484 
00485 /* The intent behind this definition is that it'll catch
00486  * any uses of REJECT which flex missed.
00487  */
00488 #define REJECT reject_used_but_not_detected
00489 #define yymore() yymore_used_but_not_detected
00490 #define YY_MORE_ADJ 0
00491 #define YY_RESTORE_YY_MORE_OFFSET
00492 char *tptext;
00493 #line 1 "tokenparser.l"
00494 /*
00495  * Reads lexical config files and updates database.
00496  *
00497  * MUSCLE SmartCard Development ( http://www.linuxnet.com )
00498  *
00499  * Copyright (C) 2001-2003
00500  *  David Corcoran <corcoran@linuxnet.com>
00501  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
00502  *
00503  * $Id: tokenparser.l 2309 2007-01-06 20:30:33Z rousseau $
00504  */
00510 #line 20 "tokenparser.l"
00511 
00512 #include "config.h"
00513 #include <stdio.h>
00514 #include <string.h>
00515 #include <errno.h>
00516 
00517 #include "misc.h"
00518 #include "debug.h"
00519 #include "parser.h"
00520 #include "strlcpycat.h"
00521 
00522 void tpevalToken(char *pcToken, int tokType);
00523 
00524 static const char *pcDesiredKey = NULL;
00525 static char pcKey[TOKEN_MAX_KEY_SIZE];
00526 static char pcValue[TOKEN_MAX_VALUE_SIZE];
00527 static char pcFinValue[TOKEN_MAX_VALUE_SIZE];
00528 static int valueIndex = 0;
00529 static int desiredIndex = 0;
00530 
00531 void tperrorCheck (char *pcToken_error);
00532 
00533 #line 534 "tokenparser.c"
00534 
00535 #define INITIAL 0
00536 
00537 #ifndef YY_NO_UNISTD_H
00538 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00539  * down here because we want the user's section 1 to have been scanned first.
00540  * The user has a chance to override it with an option.
00541  */
00542 #include <unistd.h>
00543 #endif
00544 
00545 #ifndef YY_EXTRA_TYPE
00546 #define YY_EXTRA_TYPE void *
00547 #endif
00548 
00549 static int yy_init_globals (void );
00550 
00551 /* Accessor methods to globals.
00552    These are made visible to non-reentrant scanners for convenience. */
00553 
00554 int tplex_destroy (void );
00555 
00556 int tpget_debug (void );
00557 
00558 void tpset_debug (int debug_flag  );
00559 
00560 YY_EXTRA_TYPE tpget_extra (void );
00561 
00562 void tpset_extra (YY_EXTRA_TYPE user_defined  );
00563 
00564 FILE *tpget_in (void );
00565 
00566 void tpset_in  (FILE * in_str  );
00567 
00568 FILE *tpget_out (void );
00569 
00570 void tpset_out  (FILE * out_str  );
00571 
00572 int tpget_leng (void );
00573 
00574 char *tpget_text (void );
00575 
00576 int tpget_lineno (void );
00577 
00578 void tpset_lineno (int line_number  );
00579 
00580 /* Macros after this point can all be overridden by user definitions in
00581  * section 1.
00582  */
00583 
00584 #ifndef YY_SKIP_YYWRAP
00585 #ifdef __cplusplus
00586 extern "C" int tpwrap (void );
00587 #else
00588 extern int tpwrap (void );
00589 #endif
00590 #endif
00591 
00592 #ifndef yytext_ptr
00593 static void yy_flex_strncpy (char *,yyconst char *,int );
00594 #endif
00595 
00596 #ifdef YY_NEED_STRLEN
00597 static int yy_flex_strlen (yyconst char * );
00598 #endif
00599 
00600 #ifndef YY_NO_INPUT
00601 
00602 #ifdef __cplusplus
00603 static int yyinput (void );
00604 #else
00605 static int input (void );
00606 #endif
00607 
00608 #endif
00609 
00610 /* Amount of stuff to slurp up with each read. */
00611 #ifndef YY_READ_BUF_SIZE
00612 #define YY_READ_BUF_SIZE 8192
00613 #endif
00614 
00615 /* Copy whatever the last rule matched to the standard output. */
00616 #ifndef ECHO
00617 /* This used to be an fputs(), but since the string might contain NUL's,
00618  * we now use fwrite().
00619  */
00620 #define ECHO fwrite( tptext, tpleng, 1, tpout )
00621 #endif
00622 
00623 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00624  * is returned in "result".
00625  */
00626 #ifndef YY_INPUT
00627 #define YY_INPUT(buf,result,max_size) \
00628     if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00629         { \
00630         int c = '*'; \
00631         int n; \
00632         for ( n = 0; n < max_size && \
00633                  (c = getc( tpin )) != EOF && c != '\n'; ++n ) \
00634             buf[n] = (char) c; \
00635         if ( c == '\n' ) \
00636             buf[n++] = (char) c; \
00637         if ( c == EOF && ferror( tpin ) ) \
00638             YY_FATAL_ERROR( "input in flex scanner failed" ); \
00639         result = n; \
00640         } \
00641     else \
00642         { \
00643         errno=0; \
00644         while ( (result = fread(buf, 1, max_size, tpin))==0 && ferror(tpin)) \
00645             { \
00646             if( errno != EINTR) \
00647                 { \
00648                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
00649                 break; \
00650                 } \
00651             errno=0; \
00652             clearerr(tpin); \
00653             } \
00654         }\
00655 \
00656 
00657 #endif
00658 
00659 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00660  * we don't want an extra ';' after the "return" because that will cause
00661  * some compilers to complain about unreachable statements.
00662  */
00663 #ifndef yyterminate
00664 #define yyterminate() return YY_NULL
00665 #endif
00666 
00667 /* Number of entries by which start-condition stack grows. */
00668 #ifndef YY_START_STACK_INCR
00669 #define YY_START_STACK_INCR 25
00670 #endif
00671 
00672 /* Report a fatal error. */
00673 #ifndef YY_FATAL_ERROR
00674 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
00675 #endif
00676 
00677 /* end tables serialization structures and prototypes */
00678 
00679 /* Default declaration of generated scanner - a define so the user can
00680  * easily add parameters.
00681  */
00682 #ifndef YY_DECL
00683 #define YY_DECL_IS_OURS 1
00684 
00685 extern int tplex (void);
00686 
00687 #define YY_DECL int tplex (void)
00688 #endif /* !YY_DECL */
00689 
00690 /* Code executed at the beginning of each rule, after tptext and tpleng
00691  * have been set up.
00692  */
00693 #ifndef YY_USER_ACTION
00694 #define YY_USER_ACTION
00695 #endif
00696 
00697 /* Code executed at the end of each rule. */
00698 #ifndef YY_BREAK
00699 #define YY_BREAK break;
00700 #endif
00701 
00702 #define YY_RULE_SETUP \
00703     YY_USER_ACTION
00704 
00707 YY_DECL
00708 {
00709     register yy_state_type yy_current_state;
00710     register char *yy_cp, *yy_bp;
00711     register int yy_act;
00712     
00713 #line 47 "tokenparser.l"
00714 
00715 
00716 #line 717 "tokenparser.c"
00717 
00718     if ( !(yy_init) )
00719         {
00720         (yy_init) = 1;
00721 
00722 #ifdef YY_USER_INIT
00723         YY_USER_INIT;
00724 #endif
00725 
00726         if ( ! (yy_start) )
00727             (yy_start) = 1; /* first start state */
00728 
00729         if ( ! tpin )
00730             tpin = stdin;
00731 
00732         if ( ! tpout )
00733             tpout = stdout;
00734 
00735         if ( ! YY_CURRENT_BUFFER ) {
00736             tpensure_buffer_stack ();
00737             YY_CURRENT_BUFFER_LVALUE =
00738                 tp_create_buffer(tpin,YY_BUF_SIZE );
00739         }
00740 
00741         tp_load_buffer_state( );
00742         }
00743 
00744     while ( 1 )     /* loops until end-of-file is reached */
00745         {
00746         yy_cp = (yy_c_buf_p);
00747 
00748         /* Support of tptext. */
00749         *yy_cp = (yy_hold_char);
00750 
00751         /* yy_bp points to the position in yy_ch_buf of the start of
00752          * the current run.
00753          */
00754         yy_bp = yy_cp;
00755 
00756         yy_current_state = (yy_start);
00757 yy_match:
00758         do
00759             {
00760             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00761             if ( yy_accept[yy_current_state] )
00762                 {
00763                 (yy_last_accepting_state) = yy_current_state;
00764                 (yy_last_accepting_cpos) = yy_cp;
00765                 }
00766             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00767                 {
00768                 yy_current_state = (int) yy_def[yy_current_state];
00769                 if ( yy_current_state >= 39 )
00770                     yy_c = yy_meta[(unsigned int) yy_c];
00771                 }
00772             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00773             ++yy_cp;
00774             }
00775         while ( yy_base[yy_current_state] != 50 );
00776 
00777 yy_find_action:
00778         yy_act = yy_accept[yy_current_state];
00779         if ( yy_act == 0 )
00780             { /* have to back up */
00781             yy_cp = (yy_last_accepting_cpos);
00782             yy_current_state = (yy_last_accepting_state);
00783             yy_act = yy_accept[yy_current_state];
00784             }
00785 
00786         YY_DO_BEFORE_ACTION;
00787 
00788 do_action:  /* This label is used only to access EOF actions. */
00789 
00790         switch ( yy_act )
00791     { /* beginning of action switch */
00792             case 0: /* must back up */
00793             /* undo the effects of YY_DO_BEFORE_ACTION */
00794             *yy_cp = (yy_hold_char);
00795             yy_cp = (yy_last_accepting_cpos);
00796             yy_current_state = (yy_last_accepting_state);
00797             goto yy_find_action;
00798 
00799 case 1:
00800 YY_RULE_SETUP
00801 #line 49 "tokenparser.l"
00802 {}
00803     YY_BREAK
00804 case 2:
00805 /* rule 2 can match eol */
00806 YY_RULE_SETUP
00807 #line 50 "tokenparser.l"
00808 {}
00809     YY_BREAK
00810 case 3:
00811 YY_RULE_SETUP
00812 #line 51 "tokenparser.l"
00813 { valueIndex = 0; tpevalToken(tptext, TOKEN_TYPE_KEY); }
00814     YY_BREAK
00815 case 4:
00816 YY_RULE_SETUP
00817 #line 52 "tokenparser.l"
00818 {}
00819     YY_BREAK
00820 case 5:
00821 YY_RULE_SETUP
00822 #line 53 "tokenparser.l"
00823 {tpevalToken(tptext, TOKEN_TYPE_STRING); valueIndex += 1;}
00824     YY_BREAK
00825 case 6:
00826 YY_RULE_SETUP
00827 #line 54 "tokenparser.l"
00828 { tperrorCheck(tptext); }
00829     YY_BREAK
00830 case 7:
00831 YY_RULE_SETUP
00832 #line 55 "tokenparser.l"
00833 ECHO;
00834     YY_BREAK
00835 #line 836 "tokenparser.c"
00836 case YY_STATE_EOF(INITIAL):
00837     yyterminate();
00838 
00839     case YY_END_OF_BUFFER:
00840         {
00841         /* Amount of text matched not including the EOB char. */
00842         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
00843 
00844         /* Undo the effects of YY_DO_BEFORE_ACTION. */
00845         *yy_cp = (yy_hold_char);
00846         YY_RESTORE_YY_MORE_OFFSET
00847 
00848         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
00849             {
00850             /* We're scanning a new file or input source.  It's
00851              * possible that this happened because the user
00852              * just pointed tpin at a new source and called
00853              * tplex().  If so, then we have to assure
00854              * consistency between YY_CURRENT_BUFFER and our
00855              * globals.  Here is the right place to do so, because
00856              * this is the first action (other than possibly a
00857              * back-up) that will match for the new input source.
00858              */
00859             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
00860             YY_CURRENT_BUFFER_LVALUE->yy_input_file = tpin;
00861             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
00862             }
00863 
00864         /* Note that here we test for yy_c_buf_p "<=" to the position
00865          * of the first EOB in the buffer, since yy_c_buf_p will
00866          * already have been incremented past the NUL character
00867          * (since all states make transitions on EOB to the
00868          * end-of-buffer state).  Contrast this with the test
00869          * in input().
00870          */
00871         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
00872             { /* This was really a NUL. */
00873             yy_state_type yy_next_state;
00874 
00875             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
00876 
00877             yy_current_state = yy_get_previous_state(  );
00878 
00879             /* Okay, we're now positioned to make the NUL
00880              * transition.  We couldn't have
00881              * yy_get_previous_state() go ahead and do it
00882              * for us because it doesn't know how to deal
00883              * with the possibility of jamming (and we don't
00884              * want to build jamming into it because then it
00885              * will run more slowly).
00886              */
00887 
00888             yy_next_state = yy_try_NUL_trans( yy_current_state );
00889 
00890             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00891 
00892             if ( yy_next_state )
00893                 {
00894                 /* Consume the NUL. */
00895                 yy_cp = ++(yy_c_buf_p);
00896                 yy_current_state = yy_next_state;
00897                 goto yy_match;
00898                 }
00899 
00900             else
00901                 {
00902                 yy_cp = (yy_c_buf_p);
00903                 goto yy_find_action;
00904                 }
00905             }
00906 
00907         else switch ( yy_get_next_buffer(  ) )
00908             {
00909             case EOB_ACT_END_OF_FILE:
00910                 {
00911                 (yy_did_buffer_switch_on_eof) = 0;
00912 
00913                 if ( tpwrap( ) )
00914                     {
00915                     /* Note: because we've taken care in
00916                      * yy_get_next_buffer() to have set up
00917                      * tptext, we can now set up
00918                      * yy_c_buf_p so that if some total
00919                      * hoser (like flex itself) wants to
00920                      * call the scanner after we return the
00921                      * YY_NULL, it'll still work - another
00922                      * YY_NULL will get returned.
00923                      */
00924                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
00925 
00926                     yy_act = YY_STATE_EOF(YY_START);
00927                     goto do_action;
00928                     }
00929 
00930                 else
00931                     {
00932                     if ( ! (yy_did_buffer_switch_on_eof) )
00933                         YY_NEW_FILE;
00934                     }
00935                 break;
00936                 }
00937 
00938             case EOB_ACT_CONTINUE_SCAN:
00939                 (yy_c_buf_p) =
00940                     (yytext_ptr) + yy_amount_of_matched_text;
00941 
00942                 yy_current_state = yy_get_previous_state(  );
00943 
00944                 yy_cp = (yy_c_buf_p);
00945                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00946                 goto yy_match;
00947 
00948             case EOB_ACT_LAST_MATCH:
00949                 (yy_c_buf_p) =
00950                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
00951 
00952                 yy_current_state = yy_get_previous_state(  );
00953 
00954                 yy_cp = (yy_c_buf_p);
00955                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00956                 goto yy_find_action;
00957             }
00958         break;
00959         }
00960 
00961     default:
00962         YY_FATAL_ERROR(
00963             "fatal flex scanner internal error--no action found" );
00964     } /* end of action switch */
00965         } /* end of scanning one token */
00966 } /* end of tplex */
00967 
00968 /* yy_get_next_buffer - try to read in a new buffer
00969  *
00970  * Returns a code representing an action:
00971  *  EOB_ACT_LAST_MATCH -
00972  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
00973  *  EOB_ACT_END_OF_FILE - end of file
00974  */
00975 static int yy_get_next_buffer (void)
00976 {
00977         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
00978     register char *source = (yytext_ptr);
00979     register int number_to_move, i;
00980     int ret_val;
00981 
00982     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
00983         YY_FATAL_ERROR(
00984         "fatal flex scanner internal error--end of buffer missed" );
00985 
00986     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
00987         { /* Don't try to fill the buffer, so this is an EOF. */
00988         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
00989             {
00990             /* We matched a single character, the EOB, so
00991              * treat this as a final EOF.
00992              */
00993             return EOB_ACT_END_OF_FILE;
00994             }
00995 
00996         else
00997             {
00998             /* We matched some text prior to the EOB, first
00999              * process it.
01000              */
01001             return EOB_ACT_LAST_MATCH;
01002             }
01003         }
01004 
01005     /* Try to read more data. */
01006 
01007     /* First move last chars to start of buffer. */
01008     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
01009 
01010     for ( i = 0; i < number_to_move; ++i )
01011         *(dest++) = *(source++);
01012 
01013     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01014         /* don't do the read, it's not guaranteed to return an EOF,
01015          * just force an EOF
01016          */
01017         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
01018 
01019     else
01020         {
01021             int num_to_read =
01022             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01023 
01024         while ( num_to_read <= 0 )
01025             { /* Not enough room in the buffer - grow it. */
01026 
01027             /* just a shorter name for the current buffer */
01028             YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01029 
01030             int yy_c_buf_p_offset =
01031                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
01032 
01033             if ( b->yy_is_our_buffer )
01034                 {
01035                 int new_size = b->yy_buf_size * 2;
01036 
01037                 if ( new_size <= 0 )
01038                     b->yy_buf_size += b->yy_buf_size / 8;
01039                 else
01040                     b->yy_buf_size *= 2;
01041 
01042                 b->yy_ch_buf = (char *)
01043                     /* Include room in for 2 EOB chars. */
01044                     tprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
01045                 }
01046             else
01047                 /* Can't grow it, we don't own it. */
01048                 b->yy_ch_buf = 0;
01049 
01050             if ( ! b->yy_ch_buf )
01051                 YY_FATAL_ERROR(
01052                 "fatal error - scanner input buffer overflow" );
01053 
01054             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
01055 
01056             num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01057                         number_to_move - 1;
01058 
01059             }
01060 
01061         if ( num_to_read > YY_READ_BUF_SIZE )
01062             num_to_read = YY_READ_BUF_SIZE;
01063 
01064         /* Read in more data. */
01065         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01066             (yy_n_chars), (size_t) num_to_read );
01067 
01068         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01069         }
01070 
01071     if ( (yy_n_chars) == 0 )
01072         {
01073         if ( number_to_move == YY_MORE_ADJ )
01074             {
01075             ret_val = EOB_ACT_END_OF_FILE;
01076             tprestart(tpin  );
01077             }
01078 
01079         else
01080             {
01081             ret_val = EOB_ACT_LAST_MATCH;
01082             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01083                 YY_BUFFER_EOF_PENDING;
01084             }
01085         }
01086 
01087     else
01088         ret_val = EOB_ACT_CONTINUE_SCAN;
01089 
01090     if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
01091         /* Extend the array by 50%, plus the number we really need. */
01092         yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
01093         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
01094         if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01095             YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
01096     }
01097 
01098     (yy_n_chars) += number_to_move;
01099     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
01100     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
01101 
01102     (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01103 
01104     return ret_val;
01105 }
01106 
01107 /* yy_get_previous_state - get the state just before the EOB char was reached */
01108 
01109     static yy_state_type yy_get_previous_state (void)
01110 {
01111     register yy_state_type yy_current_state;
01112     register char *yy_cp;
01113     
01114     yy_current_state = (yy_start);
01115 
01116     for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
01117         {
01118         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01119         if ( yy_accept[yy_current_state] )
01120             {
01121             (yy_last_accepting_state) = yy_current_state;
01122             (yy_last_accepting_cpos) = yy_cp;
01123             }
01124         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01125             {
01126             yy_current_state = (int) yy_def[yy_current_state];
01127             if ( yy_current_state >= 39 )
01128                 yy_c = yy_meta[(unsigned int) yy_c];
01129             }
01130         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01131         }
01132 
01133     return yy_current_state;
01134 }
01135 
01136 /* yy_try_NUL_trans - try to make a transition on the NUL character
01137  *
01138  * synopsis
01139  *  next_state = yy_try_NUL_trans( current_state );
01140  */
01141     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
01142 {
01143     register int yy_is_jam;
01144         register char *yy_cp = (yy_c_buf_p);
01145 
01146     register YY_CHAR yy_c = 1;
01147     if ( yy_accept[yy_current_state] )
01148         {
01149         (yy_last_accepting_state) = yy_current_state;
01150         (yy_last_accepting_cpos) = yy_cp;
01151         }
01152     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01153         {
01154         yy_current_state = (int) yy_def[yy_current_state];
01155         if ( yy_current_state >= 39 )
01156             yy_c = yy_meta[(unsigned int) yy_c];
01157         }
01158     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01159     yy_is_jam = (yy_current_state == 38);
01160 
01161     return yy_is_jam ? 0 : yy_current_state;
01162 }
01163 
01164 #ifndef YY_NO_INPUT
01165 #ifdef __cplusplus
01166     static int yyinput (void)
01167 #else
01168     static int input  (void)
01169 #endif
01170 
01171 {
01172     int c;
01173     
01174     *(yy_c_buf_p) = (yy_hold_char);
01175 
01176     if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
01177         {
01178         /* yy_c_buf_p now points to the character we want to return.
01179          * If this occurs *before* the EOB characters, then it's a
01180          * valid NUL; if not, then we've hit the end of the buffer.
01181          */
01182         if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01183             /* This was really a NUL. */
01184             *(yy_c_buf_p) = '\0';
01185 
01186         else
01187             { /* need more input */
01188             int offset = (yy_c_buf_p) - (yytext_ptr);
01189             ++(yy_c_buf_p);
01190 
01191             switch ( yy_get_next_buffer(  ) )
01192                 {
01193                 case EOB_ACT_LAST_MATCH:
01194                     /* This happens because yy_g_n_b()
01195                      * sees that we've accumulated a
01196                      * token and flags that we need to
01197                      * try matching the token before
01198                      * proceeding.  But for input(),
01199                      * there's no matching to consider.
01200                      * So convert the EOB_ACT_LAST_MATCH
01201                      * to EOB_ACT_END_OF_FILE.
01202                      */
01203 
01204                     /* Reset buffer status. */
01205                     tprestart(tpin );
01206 
01207                     /*FALLTHROUGH*/
01208 
01209                 case EOB_ACT_END_OF_FILE:
01210                     {
01211                     if ( tpwrap( ) )
01212                         return EOF;
01213 
01214                     if ( ! (yy_did_buffer_switch_on_eof) )
01215                         YY_NEW_FILE;
01216 #ifdef __cplusplus
01217                     return yyinput();
01218 #else
01219                     return input();
01220 #endif
01221                     }
01222 
01223                 case EOB_ACT_CONTINUE_SCAN:
01224                     (yy_c_buf_p) = (yytext_ptr) + offset;
01225                     break;
01226                 }
01227             }
01228         }
01229 
01230     c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
01231     *(yy_c_buf_p) = '\0';   /* preserve tptext */
01232     (yy_hold_char) = *++(yy_c_buf_p);
01233 
01234     return c;
01235 }
01236 #endif  /* ifndef YY_NO_INPUT */
01237 
01243     void tprestart  (FILE * input_file )
01244 {
01245     
01246     if ( ! YY_CURRENT_BUFFER ){
01247         tpensure_buffer_stack ();
01248         YY_CURRENT_BUFFER_LVALUE =
01249             tp_create_buffer(tpin,YY_BUF_SIZE );
01250     }
01251 
01252     tp_init_buffer(YY_CURRENT_BUFFER,input_file );
01253     tp_load_buffer_state( );
01254 }
01255 
01260     void tp_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
01261 {
01262     
01263     /* TODO. We should be able to replace this entire function body
01264      * with
01265      *      tppop_buffer_state();
01266      *      tppush_buffer_state(new_buffer);
01267      */
01268     tpensure_buffer_stack ();
01269     if ( YY_CURRENT_BUFFER == new_buffer )
01270         return;
01271 
01272     if ( YY_CURRENT_BUFFER )
01273         {
01274         /* Flush out information for old buffer. */
01275         *(yy_c_buf_p) = (yy_hold_char);
01276         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01277         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01278         }
01279 
01280     YY_CURRENT_BUFFER_LVALUE = new_buffer;
01281     tp_load_buffer_state( );
01282 
01283     /* We don't actually know whether we did this switch during
01284      * EOF (tpwrap()) processing, but the only time this flag
01285      * is looked at is after tpwrap() is called, so it's safe
01286      * to go ahead and always set it.
01287      */
01288     (yy_did_buffer_switch_on_eof) = 1;
01289 }
01290 
01291 static void tp_load_buffer_state  (void)
01292 {
01293         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01294     (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01295     tpin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01296     (yy_hold_char) = *(yy_c_buf_p);
01297 }
01298 
01305     YY_BUFFER_STATE tp_create_buffer  (FILE * file, int  size )
01306 {
01307     YY_BUFFER_STATE b;
01308     
01309     b = (YY_BUFFER_STATE) tpalloc(sizeof( struct yy_buffer_state )  );
01310     if ( ! b )
01311         YY_FATAL_ERROR( "out of dynamic memory in tp_create_buffer()" );
01312 
01313     b->yy_buf_size = size;
01314 
01315     /* yy_ch_buf has to be 2 characters longer than the size given because
01316      * we need to put in 2 end-of-buffer characters.
01317      */
01318     b->yy_ch_buf = (char *) tpalloc(b->yy_buf_size + 2  );
01319     if ( ! b->yy_ch_buf )
01320         YY_FATAL_ERROR( "out of dynamic memory in tp_create_buffer()" );
01321 
01322     b->yy_is_our_buffer = 1;
01323 
01324     tp_init_buffer(b,file );
01325 
01326     return b;
01327 }
01328 
01333     void tp_delete_buffer (YY_BUFFER_STATE  b )
01334 {
01335     
01336     if ( ! b )
01337         return;
01338 
01339     if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01340         YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01341 
01342     if ( b->yy_is_our_buffer )
01343         tpfree((void *) b->yy_ch_buf  );
01344 
01345     tpfree((void *) b  );
01346 }
01347 
01348 /* Initializes or reinitializes a buffer.
01349  * This function is sometimes called more than once on the same buffer,
01350  * such as during a tprestart() or at EOF.
01351  */
01352     static void tp_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
01353 
01354 {
01355     int oerrno = errno;
01356     
01357     tp_flush_buffer(b );
01358 
01359     b->yy_input_file = file;
01360     b->yy_fill_buffer = 1;
01361 
01362     /* If b is the current buffer, then tp_init_buffer was _probably_
01363      * called from tprestart() or through yy_get_next_buffer.
01364      * In that case, we don't want to reset the lineno or column.
01365      */
01366     if (b != YY_CURRENT_BUFFER){
01367         b->yy_bs_lineno = 1;
01368         b->yy_bs_column = 0;
01369     }
01370 
01371         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01372     
01373     errno = oerrno;
01374 }
01375 
01380     void tp_flush_buffer (YY_BUFFER_STATE  b )
01381 {
01382         if ( ! b )
01383         return;
01384 
01385     b->yy_n_chars = 0;
01386 
01387     /* We always need two end-of-buffer characters.  The first causes
01388      * a transition to the end-of-buffer state.  The second causes
01389      * a jam in that state.
01390      */
01391     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01392     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01393 
01394     b->yy_buf_pos = &b->yy_ch_buf[0];
01395 
01396     b->yy_at_bol = 1;
01397     b->yy_buffer_status = YY_BUFFER_NEW;
01398 
01399     if ( b == YY_CURRENT_BUFFER )
01400         tp_load_buffer_state( );
01401 }
01402 
01409 void tppush_buffer_state (YY_BUFFER_STATE new_buffer )
01410 {
01411         if (new_buffer == NULL)
01412         return;
01413 
01414     tpensure_buffer_stack();
01415 
01416     /* This block is copied from tp_switch_to_buffer. */
01417     if ( YY_CURRENT_BUFFER )
01418         {
01419         /* Flush out information for old buffer. */
01420         *(yy_c_buf_p) = (yy_hold_char);
01421         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01422         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01423         }
01424 
01425     /* Only push if top exists. Otherwise, replace top. */
01426     if (YY_CURRENT_BUFFER)
01427         (yy_buffer_stack_top)++;
01428     YY_CURRENT_BUFFER_LVALUE = new_buffer;
01429 
01430     /* copied from tp_switch_to_buffer. */
01431     tp_load_buffer_state( );
01432     (yy_did_buffer_switch_on_eof) = 1;
01433 }
01434 
01439 void tppop_buffer_state (void)
01440 {
01441         if (!YY_CURRENT_BUFFER)
01442         return;
01443 
01444     tp_delete_buffer(YY_CURRENT_BUFFER );
01445     YY_CURRENT_BUFFER_LVALUE = NULL;
01446     if ((yy_buffer_stack_top) > 0)
01447         --(yy_buffer_stack_top);
01448 
01449     if (YY_CURRENT_BUFFER) {
01450         tp_load_buffer_state( );
01451         (yy_did_buffer_switch_on_eof) = 1;
01452     }
01453 }
01454 
01455 /* Allocates the stack if it does not exist.
01456  *  Guarantees space for at least one push.
01457  */
01458 static void tpensure_buffer_stack (void)
01459 {
01460     int num_to_alloc;
01461     
01462     if (!(yy_buffer_stack)) {
01463 
01464         /* First allocation is just for 2 elements, since we don't know if this
01465          * scanner will even need a stack. We use 2 instead of 1 to avoid an
01466          * immediate realloc on the next call.
01467          */
01468         num_to_alloc = 1;
01469         (yy_buffer_stack) = (struct yy_buffer_state**)tpalloc
01470                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01471                                 );
01472         if ( ! (yy_buffer_stack) )
01473             YY_FATAL_ERROR( "out of dynamic memory in tpensure_buffer_stack()" );
01474                                   
01475         memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01476                 
01477         (yy_buffer_stack_max) = num_to_alloc;
01478         (yy_buffer_stack_top) = 0;
01479         return;
01480     }
01481 
01482     if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
01483 
01484         /* Increase the buffer to prepare for a possible push. */
01485         int grow_size = 8 /* arbitrary grow size */;
01486 
01487         num_to_alloc = (yy_buffer_stack_max) + grow_size;
01488         (yy_buffer_stack) = (struct yy_buffer_state**)tprealloc
01489                                 ((yy_buffer_stack),
01490                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01491                                 );
01492         if ( ! (yy_buffer_stack) )
01493             YY_FATAL_ERROR( "out of dynamic memory in tpensure_buffer_stack()" );
01494 
01495         /* zero only the new slots.*/
01496         memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
01497         (yy_buffer_stack_max) = num_to_alloc;
01498     }
01499 }
01500 
01507 YY_BUFFER_STATE tp_scan_buffer  (char * base, yy_size_t  size )
01508 {
01509     YY_BUFFER_STATE b;
01510     
01511     if ( size < 2 ||
01512          base[size-2] != YY_END_OF_BUFFER_CHAR ||
01513          base[size-1] != YY_END_OF_BUFFER_CHAR )
01514         /* They forgot to leave room for the EOB's. */
01515         return 0;
01516 
01517     b = (YY_BUFFER_STATE) tpalloc(sizeof( struct yy_buffer_state )  );
01518     if ( ! b )
01519         YY_FATAL_ERROR( "out of dynamic memory in tp_scan_buffer()" );
01520 
01521     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
01522     b->yy_buf_pos = b->yy_ch_buf = base;
01523     b->yy_is_our_buffer = 0;
01524     b->yy_input_file = 0;
01525     b->yy_n_chars = b->yy_buf_size;
01526     b->yy_is_interactive = 0;
01527     b->yy_at_bol = 1;
01528     b->yy_fill_buffer = 0;
01529     b->yy_buffer_status = YY_BUFFER_NEW;
01530 
01531     tp_switch_to_buffer(b  );
01532 
01533     return b;
01534 }
01535 
01544 YY_BUFFER_STATE tp_scan_string (yyconst char * yystr )
01545 {
01546     
01547     return tp_scan_bytes(yystr,strlen(yystr) );
01548 }
01549 
01557 YY_BUFFER_STATE tp_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
01558 {
01559     YY_BUFFER_STATE b;
01560     char *buf;
01561     yy_size_t n;
01562     int i;
01563     
01564     /* Get memory for full buffer, including space for trailing EOB's. */
01565     n = _yybytes_len + 2;
01566     buf = (char *) tpalloc(n  );
01567     if ( ! buf )
01568         YY_FATAL_ERROR( "out of dynamic memory in tp_scan_bytes()" );
01569 
01570     for ( i = 0; i < _yybytes_len; ++i )
01571         buf[i] = yybytes[i];
01572 
01573     buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
01574 
01575     b = tp_scan_buffer(buf,n );
01576     if ( ! b )
01577         YY_FATAL_ERROR( "bad buffer in tp_scan_bytes()" );
01578 
01579     /* It's okay to grow etc. this buffer, and we should throw it
01580      * away when we're done.
01581      */
01582     b->yy_is_our_buffer = 1;
01583 
01584     return b;
01585 }
01586 
01587 #ifndef YY_EXIT_FAILURE
01588 #define YY_EXIT_FAILURE 2
01589 #endif
01590 
01591 static void yy_fatal_error (yyconst char* msg )
01592 {
01593         (void) fprintf( stderr, "%s\n", msg );
01594     exit( YY_EXIT_FAILURE );
01595 }
01596 
01597 /* Redefine yyless() so it works in section 3 code. */
01598 
01599 #undef yyless
01600 #define yyless(n) \
01601     do \
01602         { \
01603         /* Undo effects of setting up tptext. */ \
01604         int yyless_macro_arg = (n); \
01605         YY_LESS_LINENO(yyless_macro_arg);\
01606         tptext[tpleng] = (yy_hold_char); \
01607         (yy_c_buf_p) = tptext + yyless_macro_arg; \
01608         (yy_hold_char) = *(yy_c_buf_p); \
01609         *(yy_c_buf_p) = '\0'; \
01610         tpleng = yyless_macro_arg; \
01611         } \
01612     while ( 0 )
01613 
01614 /* Accessor  methods (get/set functions) to struct members. */
01615 
01619 int tpget_lineno  (void)
01620 {
01621         
01622     return tplineno;
01623 }
01624 
01628 FILE *tpget_in  (void)
01629 {
01630         return tpin;
01631 }
01632 
01636 FILE *tpget_out  (void)
01637 {
01638         return tpout;
01639 }
01640 
01644 int tpget_leng  (void)
01645 {
01646         return tpleng;
01647 }
01648 
01653 char *tpget_text  (void)
01654 {
01655         return tptext;
01656 }
01657 
01662