Advertisement
Guest User

Untitled

a guest
Mar 29th, 2009
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 47.35 KB | None | 0 0
  1. #line 2 "configlex.cpp"
  2.  
  3. #line 4 "configlex.cpp"
  4.  
  5. #define  YY_INT_ALIGNED short int
  6.  
  7. /* A lexical scanner generated by flex */
  8.  
  9. #define yy_create_buffer config_create_buffer
  10. #define yy_delete_buffer config_delete_buffer
  11. #define yy_flex_debug config_flex_debug
  12. #define yy_init_buffer config_init_buffer
  13. #define yy_flush_buffer config_flush_buffer
  14. #define yy_load_buffer_state config_load_buffer_state
  15. #define yy_switch_to_buffer config_switch_to_buffer
  16. #define yyin configin
  17. #define yyleng configleng
  18. #define yylex configlex
  19. #define yylineno configlineno
  20. #define yyout configout
  21. #define yyrestart configrestart
  22. #define yytext configtext
  23. #define yywrap configwrap
  24. #define yyalloc configalloc
  25. #define yyrealloc configrealloc
  26. #define yyfree configfree
  27.  
  28. #define FLEX_SCANNER
  29. #define YY_FLEX_MAJOR_VERSION 2
  30. #define YY_FLEX_MINOR_VERSION 5
  31. #define YY_FLEX_SUBMINOR_VERSION 35
  32. #if YY_FLEX_SUBMINOR_VERSION > 0
  33. #define FLEX_BETA
  34. #endif
  35.  
  36. /* First, we deal with  platform-specific or compiler-specific issues. */
  37.  
  38. /* begin standard C headers. */
  39. #include <stdio.h>
  40. #include <string.h>
  41. #include <errno.h>
  42. #include <stdlib.h>
  43.  
  44. /* end standard C headers. */
  45.  
  46. /* flex integer type definitions */
  47.  
  48. #ifndef FLEXINT_H
  49. #define FLEXINT_H
  50.  
  51. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  52.  
  53. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  54.  
  55. /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  56.  * if you want the limit (max/min) macros for int types.
  57.  */
  58. #ifndef __STDC_LIMIT_MACROS
  59. #define __STDC_LIMIT_MACROS 1
  60. #endif
  61.  
  62. #include <inttypes.h>
  63. typedef int8_t flex_int8_t;
  64. typedef uint8_t flex_uint8_t;
  65. typedef int16_t flex_int16_t;
  66. typedef uint16_t flex_uint16_t;
  67. typedef int32_t flex_int32_t;
  68. typedef uint32_t flex_uint32_t;
  69. #else
  70. typedef signed char flex_int8_t;
  71. typedef short int flex_int16_t;
  72. typedef int flex_int32_t;
  73. typedef unsigned char flex_uint8_t;
  74. typedef unsigned short int flex_uint16_t;
  75. typedef unsigned int flex_uint32_t;
  76.  
  77. /* Limits of integral types. */
  78. #ifndef INT8_MIN
  79. #define INT8_MIN               (-128)
  80. #endif
  81. #ifndef INT16_MIN
  82. #define INT16_MIN              (-32767-1)
  83. #endif
  84. #ifndef INT32_MIN
  85. #define INT32_MIN              (-2147483647-1)
  86. #endif
  87. #ifndef INT8_MAX
  88. #define INT8_MAX               (127)
  89. #endif
  90. #ifndef INT16_MAX
  91. #define INT16_MAX              (32767)
  92. #endif
  93. #ifndef INT32_MAX
  94. #define INT32_MAX              (2147483647)
  95. #endif
  96. #ifndef UINT8_MAX
  97. #define UINT8_MAX              (255U)
  98. #endif
  99. #ifndef UINT16_MAX
  100. #define UINT16_MAX             (65535U)
  101. #endif
  102. #ifndef UINT32_MAX
  103. #define UINT32_MAX             (4294967295U)
  104. #endif
  105.  
  106. #endif /* ! C99 */
  107.  
  108. #endif /* ! FLEXINT_H */
  109.  
  110. #ifdef __cplusplus
  111.  
  112. /* The "const" storage-class-modifier is valid. */
  113. #define YY_USE_CONST
  114.  
  115. #else   /* ! __cplusplus */
  116.  
  117. /* C99 requires __STDC__ to be defined as 1. */
  118. #if defined (__STDC__)
  119.  
  120. #define YY_USE_CONST
  121.  
  122. #endif  /* defined (__STDC__) */
  123. #endif  /* ! __cplusplus */
  124.  
  125. #ifdef YY_USE_CONST
  126. #define yyconst const
  127. #else
  128. #define yyconst
  129. #endif
  130.  
  131. /* Returned upon end-of-file. */
  132. #define YY_NULL 0
  133.  
  134. /* Promotes a possibly negative, possibly signed char to an unsigned
  135.  * integer for use as an array index.  If the signed char is negative,
  136.  * we want to instead treat it as an 8-bit unsigned char, hence the
  137.  * double cast.
  138.  */
  139. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  140.  
  141. /* Enter a start condition.  This macro really ought to take a parameter,
  142.  * but we do it the disgusting crufty way forced on us by the ()-less
  143.  * definition of BEGIN.
  144.  */
  145. #define BEGIN (yy_start) = 1 + 2 *
  146.  
  147. /* Translate the current start state into a value that can be later handed
  148.  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  149.  * compatibility.
  150.  */
  151. #define YY_START (((yy_start) - 1) / 2)
  152. #define YYSTATE YY_START
  153.  
  154. /* Action number for EOF rule of a given start state. */
  155. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  156.  
  157. /* Special action meaning "start processing a new file". */
  158. #define YY_NEW_FILE configrestart(configin  )
  159.  
  160. #define YY_END_OF_BUFFER_CHAR 0
  161.  
  162. /* Size of default input buffer. */
  163. #ifndef YY_BUF_SIZE
  164. #define YY_BUF_SIZE 16384
  165. #endif
  166.  
  167. /* The state buf must be large enough to hold one state per character in the main buffer.
  168.  */
  169. #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  170.  
  171. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  172. #define YY_TYPEDEF_YY_BUFFER_STATE
  173. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  174. #endif
  175.  
  176. extern int configleng;
  177.  
  178. extern FILE *configin, *configout;
  179.  
  180. #define EOB_ACT_CONTINUE_SCAN 0
  181. #define EOB_ACT_END_OF_FILE 1
  182. #define EOB_ACT_LAST_MATCH 2
  183.  
  184.     #define YY_LESS_LINENO(n)
  185.    
  186. /* Return all but the first "n" matched characters back to the input stream. */
  187. #define yyless(n) \
  188.     do \
  189.         { \
  190.         /* Undo effects of setting up configtext. */ \
  191.         int yyless_macro_arg = (n); \
  192.         YY_LESS_LINENO(yyless_macro_arg);\
  193.         *yy_cp = (yy_hold_char); \
  194.         YY_RESTORE_YY_MORE_OFFSET \
  195.         (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  196.         YY_DO_BEFORE_ACTION; /* set up configtext again */ \
  197.         } \
  198.     while ( 0 )
  199.  
  200. #define unput(c) yyunput( c, (yytext_ptr)  )
  201.  
  202. #ifndef YY_TYPEDEF_YY_SIZE_T
  203. #define YY_TYPEDEF_YY_SIZE_T
  204. typedef size_t yy_size_t;
  205. #endif
  206.  
  207. #ifndef YY_STRUCT_YY_BUFFER_STATE
  208. #define YY_STRUCT_YY_BUFFER_STATE
  209. struct yy_buffer_state
  210.     {
  211.     FILE *yy_input_file;
  212.  
  213.     char *yy_ch_buf;        /* input buffer */
  214.     char *yy_buf_pos;       /* current position in input buffer */
  215.  
  216.     /* Size of input buffer in bytes, not including room for EOB
  217.      * characters.
  218.      */
  219.     yy_size_t yy_buf_size;
  220.  
  221.     /* Number of characters read into yy_ch_buf, not including EOB
  222.      * characters.
  223.      */
  224.     int yy_n_chars;
  225.  
  226.     /* Whether we "own" the buffer - i.e., we know we created it,
  227.      * and can realloc() it to grow it, and should free() it to
  228.      * delete it.
  229.      */
  230.     int yy_is_our_buffer;
  231.  
  232.     /* Whether this is an "interactive" input source; if so, and
  233.      * if we're using stdio for input, then we want to use getc()
  234.      * instead of fread(), to make sure we stop fetching input after
  235.      * each newline.
  236.      */
  237.     int yy_is_interactive;
  238.  
  239.     /* Whether we're considered to be at the beginning of a line.
  240.      * If so, '^' rules will be active on the next match, otherwise
  241.      * not.
  242.      */
  243.     int yy_at_bol;
  244.  
  245.     int yy_bs_lineno; /**< The line count. */
  246.     int yy_bs_column; /**< The column count. */
  247.    
  248.     /* Whether to try to fill the input buffer when we reach the
  249.      * end of it.
  250.      */
  251.     int yy_fill_buffer;
  252.  
  253.     int yy_buffer_status;
  254.  
  255. #define YY_BUFFER_NEW 0
  256. #define YY_BUFFER_NORMAL 1
  257.     /* When an EOF's been seen but there's still some text to process
  258.      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  259.      * shouldn't try reading from the input source any more.  We might
  260.      * still have a bunch of tokens to match, though, because of
  261.      * possible backing-up.
  262.      *
  263.      * When we actually see the EOF, we change the status to "new"
  264.      * (via configrestart()), so that the user can continue scanning by
  265.      * just pointing configin at a new input file.
  266.      */
  267. #define YY_BUFFER_EOF_PENDING 2
  268.  
  269.     };
  270. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  271.  
  272. /* Stack of input buffers. */
  273. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  274. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  275. static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
  276.  
  277. /* We provide macros for accessing buffer states in case in the
  278.  * future we want to put the buffer states in a more general
  279.  * "scanner state".
  280.  *
  281.  * Returns the top of the stack, or NULL.
  282.  */
  283. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  284.                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  285.                           : NULL)
  286.  
  287. /* Same as previous macro, but useful when we know that the buffer stack is not
  288.  * NULL or when we need an lvalue. For internal use only.
  289.  */
  290. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  291.  
  292. /* yy_hold_char holds the character lost when configtext is formed. */
  293. static char yy_hold_char;
  294. static int yy_n_chars;      /* number of characters read into yy_ch_buf */
  295. int configleng;
  296.  
  297. /* Points to current character in buffer. */
  298. static char *yy_c_buf_p = (char *) 0;
  299. static int yy_init = 0;     /* whether we need to initialize */
  300. static int yy_start = 0;    /* start state number */
  301.  
  302. /* Flag which is used to allow configwrap()'s to do buffer switches
  303.  * instead of setting up a fresh configin.  A bit of a hack ...
  304.  */
  305. static int yy_did_buffer_switch_on_eof;
  306.  
  307. void configrestart (FILE *input_file  );
  308. void config_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
  309. YY_BUFFER_STATE config_create_buffer (FILE *file,int size  );
  310. void config_delete_buffer (YY_BUFFER_STATE b  );
  311. void config_flush_buffer (YY_BUFFER_STATE b  );
  312. void configpush_buffer_state (YY_BUFFER_STATE new_buffer  );
  313. void configpop_buffer_state (void );
  314.  
  315. static void configensure_buffer_stack (void );
  316. static void config_load_buffer_state (void );
  317. static void config_init_buffer (YY_BUFFER_STATE b,FILE *file  );
  318.  
  319. #define YY_FLUSH_BUFFER config_flush_buffer(YY_CURRENT_BUFFER )
  320.  
  321. YY_BUFFER_STATE config_scan_buffer (char *base,yy_size_t size  );
  322. YY_BUFFER_STATE config_scan_string (yyconst char *yy_str  );
  323. YY_BUFFER_STATE config_scan_bytes (yyconst char *bytes,int len  );
  324.  
  325. void *configalloc (yy_size_t  );
  326. void *configrealloc (void *,yy_size_t  );
  327. void configfree (void *  );
  328.  
  329. #define yy_new_buffer config_create_buffer
  330.  
  331. #define yy_set_interactive(is_interactive) \
  332.     { \
  333.     if ( ! YY_CURRENT_BUFFER ){ \
  334.         configensure_buffer_stack (); \
  335.         YY_CURRENT_BUFFER_LVALUE =    \
  336.             config_create_buffer(configin,YY_BUF_SIZE ); \
  337.     } \
  338.     YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  339.     }
  340.  
  341. #define yy_set_bol(at_bol) \
  342.     { \
  343.     if ( ! YY_CURRENT_BUFFER ){\
  344.         configensure_buffer_stack (); \
  345.         YY_CURRENT_BUFFER_LVALUE =    \
  346.             config_create_buffer(configin,YY_BUF_SIZE ); \
  347.     } \
  348.     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  349.     }
  350.  
  351. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  352.  
  353. /* Begin user sect3 */
  354.  
  355. typedef unsigned char YY_CHAR;
  356.  
  357. FILE *configin = (FILE *) 0, *configout = (FILE *) 0;
  358.  
  359. typedef int yy_state_type;
  360.  
  361. extern int configlineno;
  362.  
  363. int configlineno = 1;
  364.  
  365. extern char *configtext;
  366. #define yytext_ptr configtext
  367.  
  368. static yy_state_type yy_get_previous_state (void );
  369. static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
  370. static int yy_get_next_buffer (void );
  371. static void yy_fatal_error (yyconst char msg[]  );
  372.  
  373. /* Done after the current pattern has been matched and before the
  374.  * corresponding action - sets up configtext.
  375.  */
  376. #define YY_DO_BEFORE_ACTION \
  377.     (yytext_ptr) = yy_bp; \
  378.     configleng = (size_t) (yy_cp - yy_bp); \
  379.     (yy_hold_char) = *yy_cp; \
  380.     *yy_cp = '\0'; \
  381.     (yy_c_buf_p) = yy_cp;
  382.  
  383. #define YY_NUM_RULES 8
  384. #define YY_END_OF_BUFFER 9
  385. /* This struct is not used in this scanner,
  386.    but its presence is necessary. */
  387. struct yy_trans_info
  388.     {
  389.     flex_int32_t yy_verify;
  390.     flex_int32_t yy_nxt;
  391.     };
  392. static yyconst flex_int16_t yy_accept[18] =
  393.     {   0,
  394.         2,    2,    9,    7,    2,    3,    7,    5,    4,    2,
  395.         1,    0,    5,    4,    1,    6,    0
  396.     } ;
  397.  
  398. static yyconst flex_int32_t yy_ec[256] =
  399.     {   0,
  400.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  401.         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
  402.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  403.         1,    2,    1,    1,    1,    1,    1,    1,    1,    1,
  404.         1,    1,    1,    1,    1,    4,    5,    6,    6,    6,
  405.         6,    6,    6,    6,    6,    6,    6,    1,    1,    1,
  406.         1,    1,    1,    1,    7,    7,    7,    7,    7,    7,
  407.         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
  408.         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
  409.         1,    1,    1,    1,    7,    1,    7,    7,    7,    7,
  410.  
  411.         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
  412.         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
  413.         7,    7,    1,    1,    1,    1,    1,    1,    1,    1,
  414.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  415.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  416.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  417.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  418.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  419.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  420.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  421.  
  422.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  423.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  424.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  425.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  426.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  427.         1,    1,    1,    1,    1
  428.     } ;
  429.  
  430. static yyconst flex_int32_t yy_meta[8] =
  431.     {   0,
  432.         1,    1,    2,    1,    1,    3,    3
  433.     } ;
  434.  
  435. static yyconst flex_int16_t yy_base[20] =
  436.     {   0,
  437.         0,    0,   18,   19,   15,   19,   11,    4,    0,   13,
  438.         0,    8,    0,    0,    0,    6,   19,    6,   10
  439.     } ;
  440.  
  441. static yyconst flex_int16_t yy_def[20] =
  442.     {   0,
  443.        17,    1,   17,   17,   17,   17,   17,   17,   18,   17,
  444.        19,   17,    8,   18,   19,   17,    0,   17,   17
  445.     } ;
  446.  
  447. static yyconst flex_int16_t yy_nxt[27] =
  448.     {   0,
  449.         4,    5,    6,    4,    7,    8,    9,   12,   14,   13,
  450.        15,   16,   15,   16,   10,   11,   10,   17,    3,   17,
  451.        17,   17,   17,   17,   17,   17
  452.     } ;
  453.  
  454. static yyconst flex_int16_t yy_chk[27] =
  455.     {   0,
  456.         1,    1,    1,    1,    1,    1,    1,    8,   18,    8,
  457.        19,   16,   19,   12,   10,    7,    5,    3,   17,   17,
  458.        17,   17,   17,   17,   17,   17
  459.     } ;
  460.  
  461. static yy_state_type yy_last_accepting_state;
  462. static char *yy_last_accepting_cpos;
  463.  
  464. extern int config_flex_debug;
  465. int config_flex_debug = 0;
  466.  
  467. /* The intent behind this definition is that it'll catch
  468.  * any uses of REJECT which flex missed.
  469.  */
  470. #define REJECT reject_used_but_not_detected
  471. #define yymore() yymore_used_but_not_detected
  472. #define YY_MORE_ADJ 0
  473. #define YY_RESTORE_YY_MORE_OFFSET
  474. char *configtext;
  475. #line 1 "config.l"
  476. #line 2 "config.l"
  477.  
  478. #include "booksim.hpp"
  479. #include <stdlib.h>
  480. #include <string>
  481. #include <cstring>
  482.  
  483. #include "config_tab.hpp"
  484. #include "config_utils.hpp"
  485.  
  486. void configerror(string msg);
  487. extern "C" int configwrap() { return 1; }
  488.  
  489. extern int config_input(char *, int);
  490. #undef YY_INPUT
  491. #define YY_INPUT(b, r, ms) (r = config_input(b, ms))
  492.  
  493. unsigned int configlineno = 1;
  494.  
  495. #line 496 "configlex.cpp"
  496.  
  497. #define INITIAL 0
  498.  
  499. #ifndef YY_NO_UNISTD_H
  500. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  501.  * down here because we want the user's section 1 to have been scanned first.
  502.  * The user has a chance to override it with an option.
  503.  */
  504. #include <unistd.h>
  505. #endif
  506.  
  507. #ifndef YY_EXTRA_TYPE
  508. #define YY_EXTRA_TYPE void *
  509. #endif
  510.  
  511. static int yy_init_globals (void );
  512.  
  513. /* Accessor methods to globals.
  514.    These are made visible to non-reentrant scanners for convenience. */
  515.  
  516. int configlex_destroy (void );
  517.  
  518. int configget_debug (void );
  519.  
  520. void configset_debug (int debug_flag  );
  521.  
  522. YY_EXTRA_TYPE configget_extra (void );
  523.  
  524. void configset_extra (YY_EXTRA_TYPE user_defined  );
  525.  
  526. FILE *configget_in (void );
  527.  
  528. void configset_in  (FILE * in_str  );
  529.  
  530. FILE *configget_out (void );
  531.  
  532. void configset_out  (FILE * out_str  );
  533.  
  534. int configget_leng (void );
  535.  
  536. char *configget_text (void );
  537.  
  538. int configget_lineno (void );
  539.  
  540. void configset_lineno (int line_number  );
  541.  
  542. /* Macros after this point can all be overridden by user definitions in
  543.  * section 1.
  544.  */
  545.  
  546. #ifndef YY_SKIP_YYWRAP
  547. #ifdef __cplusplus
  548. extern "C" int configwrap (void );
  549. #else
  550. extern int configwrap (void );
  551. #endif
  552. #endif
  553.  
  554.     static void yyunput (int c,char *buf_ptr  );
  555.    
  556. #ifndef yytext_ptr
  557. static void yy_flex_strncpy (char *,yyconst char *,int );
  558. #endif
  559.  
  560. #ifdef YY_NEED_STRLEN
  561. static int yy_flex_strlen (yyconst char * );
  562. #endif
  563.  
  564. #ifndef YY_NO_INPUT
  565.  
  566. #ifdef __cplusplus
  567. static int yyinput (void );
  568. #else
  569. static int input (void );
  570. #endif
  571.  
  572. #endif
  573.  
  574. /* Amount of stuff to slurp up with each read. */
  575. #ifndef YY_READ_BUF_SIZE
  576. #define YY_READ_BUF_SIZE 8192
  577. #endif
  578.  
  579. /* Copy whatever the last rule matched to the standard output. */
  580. #ifndef ECHO
  581. /* This used to be an fputs(), but since the string might contain NUL's,
  582.  * we now use fwrite().
  583.  */
  584. #define ECHO do { if (fwrite( configtext, configleng, 1, configout )) {} } while (0)
  585. #endif
  586.  
  587. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  588.  * is returned in "result".
  589.  */
  590. #ifndef YY_INPUT
  591. #define YY_INPUT(buf,result,max_size) \
  592.     if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  593.         { \
  594.         int c = '*'; \
  595.         size_t n; \
  596.         for ( n = 0; n < max_size && \
  597.                  (c = getc( configin )) != EOF && c != '\n'; ++n ) \
  598.             buf[n] = (char) c; \
  599.         if ( c == '\n' ) \
  600.             buf[n++] = (char) c; \
  601.         if ( c == EOF && ferror( configin ) ) \
  602.             YY_FATAL_ERROR( "input in flex scanner failed" ); \
  603.         result = n; \
  604.         } \
  605.     else \
  606.         { \
  607.         errno=0; \
  608.         while ( (result = fread(buf, 1, max_size, configin))==0 && ferror(configin)) \
  609.             { \
  610.             if( errno != EINTR) \
  611.                 { \
  612.                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
  613.                 break; \
  614.                 } \
  615.             errno=0; \
  616.             clearerr(configin); \
  617.             } \
  618.         }\
  619. \
  620.  
  621. #endif
  622.  
  623. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  624.  * we don't want an extra ';' after the "return" because that will cause
  625.  * some compilers to complain about unreachable statements.
  626.  */
  627. #ifndef yyterminate
  628. #define yyterminate() return YY_NULL
  629. #endif
  630.  
  631. /* Number of entries by which start-condition stack grows. */
  632. #ifndef YY_START_STACK_INCR
  633. #define YY_START_STACK_INCR 25
  634. #endif
  635.  
  636. /* Report a fatal error. */
  637. #ifndef YY_FATAL_ERROR
  638. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  639. #endif
  640.  
  641. /* end tables serialization structures and prototypes */
  642.  
  643. /* Default declaration of generated scanner - a define so the user can
  644.  * easily add parameters.
  645.  */
  646. #ifndef YY_DECL
  647. #define YY_DECL_IS_OURS 1
  648.  
  649. extern int configlex (void);
  650.  
  651. #define YY_DECL int configlex (void)
  652. #endif /* !YY_DECL */
  653.  
  654. /* Code executed at the beginning of each rule, after configtext and configleng
  655.  * have been set up.
  656.  */
  657. #ifndef YY_USER_ACTION
  658. #define YY_USER_ACTION
  659. #endif
  660.  
  661. /* Code executed at the end of each rule. */
  662. #ifndef YY_BREAK
  663. #define YY_BREAK break;
  664. #endif
  665.  
  666. #define YY_RULE_SETUP \
  667.     YY_USER_ACTION
  668.  
  669. /** The main scanner function which does all the work.
  670.  */
  671. YY_DECL
  672. {
  673.     register yy_state_type yy_current_state;
  674.     register char *yy_cp, *yy_bp;
  675.     register int yy_act;
  676.    
  677. #line 22 "config.l"
  678.  
  679.  
  680.    /* Ignore comments and all spaces */
  681.  
  682. #line 683 "configlex.cpp"
  683.  
  684.     if ( !(yy_init) )
  685.         {
  686.         (yy_init) = 1;
  687.  
  688. #ifdef YY_USER_INIT
  689.         YY_USER_INIT;
  690. #endif
  691.  
  692.         if ( ! (yy_start) )
  693.             (yy_start) = 1; /* first start state */
  694.  
  695.         if ( ! configin )
  696.             configin = stdin;
  697.  
  698.         if ( ! configout )
  699.             configout = stdout;
  700.  
  701.         if ( ! YY_CURRENT_BUFFER ) {
  702.             configensure_buffer_stack ();
  703.             YY_CURRENT_BUFFER_LVALUE =
  704.                 config_create_buffer(configin,YY_BUF_SIZE );
  705.         }
  706.  
  707.         config_load_buffer_state( );
  708.         }
  709.  
  710.     while ( 1 )     /* loops until end-of-file is reached */
  711.         {
  712.         yy_cp = (yy_c_buf_p);
  713.  
  714.         /* Support of configtext. */
  715.         *yy_cp = (yy_hold_char);
  716.  
  717.         /* yy_bp points to the position in yy_ch_buf of the start of
  718.          * the current run.
  719.          */
  720.         yy_bp = yy_cp;
  721.  
  722.         yy_current_state = (yy_start);
  723. yy_match:
  724.         do
  725.             {
  726.             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  727.             if ( yy_accept[yy_current_state] )
  728.                 {
  729.                 (yy_last_accepting_state) = yy_current_state;
  730.                 (yy_last_accepting_cpos) = yy_cp;
  731.                 }
  732.             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  733.                 {
  734.                 yy_current_state = (int) yy_def[yy_current_state];
  735.                 if ( yy_current_state >= 18 )
  736.                     yy_c = yy_meta[(unsigned int) yy_c];
  737.                 }
  738.             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  739.             ++yy_cp;
  740.             }
  741.         while ( yy_base[yy_current_state] != 19 );
  742.  
  743. yy_find_action:
  744.         yy_act = yy_accept[yy_current_state];
  745.         if ( yy_act == 0 )
  746.             { /* have to back up */
  747.             yy_cp = (yy_last_accepting_cpos);
  748.             yy_current_state = (yy_last_accepting_state);
  749.             yy_act = yy_accept[yy_current_state];
  750.             }
  751.  
  752.         YY_DO_BEFORE_ACTION;
  753.  
  754. do_action:  /* This label is used only to access EOF actions. */
  755.  
  756.         switch ( yy_act )
  757.     { /* beginning of action switch */
  758.             case 0: /* must back up */
  759.             /* undo the effects of YY_DO_BEFORE_ACTION */
  760.             *yy_cp = (yy_hold_char);
  761.             yy_cp = (yy_last_accepting_cpos);
  762.             yy_current_state = (yy_last_accepting_state);
  763.             goto yy_find_action;
  764.  
  765. case 1:
  766. YY_RULE_SETUP
  767. #line 26 "config.l"
  768. ;
  769.     YY_BREAK
  770. case 2:
  771. YY_RULE_SETUP
  772. #line 27 "config.l"
  773. ;
  774.     YY_BREAK
  775. case 3:
  776. /* rule 3 can match eol */
  777. YY_RULE_SETUP
  778. #line 29 "config.l"
  779. { configlineno++; }
  780.     YY_BREAK
  781. /* Commands */
  782. case 4:
  783. YY_RULE_SETUP
  784. #line 33 "config.l"
  785. { configlval.name = strdup( configtext ); return STR; }
  786.     YY_BREAK
  787. case 5:
  788. YY_RULE_SETUP
  789. #line 35 "config.l"
  790. { configlval.num = strtoul( configtext, 0, 10 ); return NUM; }
  791.     YY_BREAK
  792. case 6:
  793. YY_RULE_SETUP
  794. #line 37 "config.l"
  795. { configlval.fnum = strtod( configtext, 0 ); return FNUM; }
  796.     YY_BREAK
  797. case 7:
  798. YY_RULE_SETUP
  799. #line 39 "config.l"
  800. { return configtext[0]; }
  801.     YY_BREAK
  802. case 8:
  803. YY_RULE_SETUP
  804. #line 41 "config.l"
  805. ECHO;
  806.     YY_BREAK
  807. #line 808 "configlex.cpp"
  808. case YY_STATE_EOF(INITIAL):
  809.     yyterminate();
  810.  
  811.     case YY_END_OF_BUFFER:
  812.         {
  813.         /* Amount of text matched not including the EOB char. */
  814.         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  815.  
  816.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  817.         *yy_cp = (yy_hold_char);
  818.         YY_RESTORE_YY_MORE_OFFSET
  819.  
  820.         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  821.             {
  822.             /* We're scanning a new file or input source.  It's
  823.              * possible that this happened because the user
  824.              * just pointed configin at a new source and called
  825.              * configlex().  If so, then we have to assure
  826.              * consistency between YY_CURRENT_BUFFER and our
  827.              * globals.  Here is the right place to do so, because
  828.              * this is the first action (other than possibly a
  829.              * back-up) that will match for the new input source.
  830.              */
  831.             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  832.             YY_CURRENT_BUFFER_LVALUE->yy_input_file = configin;
  833.             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  834.             }
  835.  
  836.         /* Note that here we test for yy_c_buf_p "<=" to the position
  837.          * of the first EOB in the buffer, since yy_c_buf_p will
  838.          * already have been incremented past the NUL character
  839.          * (since all states make transitions on EOB to the
  840.          * end-of-buffer state).  Contrast this with the test
  841.          * in input().
  842.          */
  843.         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  844.             { /* This was really a NUL. */
  845.             yy_state_type yy_next_state;
  846.  
  847.             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  848.  
  849.             yy_current_state = yy_get_previous_state(  );
  850.  
  851.             /* Okay, we're now positioned to make the NUL
  852.              * transition.  We couldn't have
  853.              * yy_get_previous_state() go ahead and do it
  854.              * for us because it doesn't know how to deal
  855.              * with the possibility of jamming (and we don't
  856.              * want to build jamming into it because then it
  857.              * will run more slowly).
  858.              */
  859.  
  860.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  861.  
  862.             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  863.  
  864.             if ( yy_next_state )
  865.                 {
  866.                 /* Consume the NUL. */
  867.                 yy_cp = ++(yy_c_buf_p);
  868.                 yy_current_state = yy_next_state;
  869.                 goto yy_match;
  870.                 }
  871.  
  872.             else
  873.                 {
  874.                 yy_cp = (yy_c_buf_p);
  875.                 goto yy_find_action;
  876.                 }
  877.             }
  878.  
  879.         else switch ( yy_get_next_buffer(  ) )
  880.             {
  881.             case EOB_ACT_END_OF_FILE:
  882.                 {
  883.                 (yy_did_buffer_switch_on_eof) = 0;
  884.  
  885.                 if ( configwrap( ) )
  886.                     {
  887.                     /* Note: because we've taken care in
  888.                      * yy_get_next_buffer() to have set up
  889.                      * configtext, we can now set up
  890.                      * yy_c_buf_p so that if some total
  891.                      * hoser (like flex itself) wants to
  892.                      * call the scanner after we return the
  893.                      * YY_NULL, it'll still work - another
  894.                      * YY_NULL will get returned.
  895.                      */
  896.                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  897.  
  898.                     yy_act = YY_STATE_EOF(YY_START);
  899.                     goto do_action;
  900.                     }
  901.  
  902.                 else
  903.                     {
  904.                     if ( ! (yy_did_buffer_switch_on_eof) )
  905.                         YY_NEW_FILE;
  906.                     }
  907.                 break;
  908.                 }
  909.  
  910.             case EOB_ACT_CONTINUE_SCAN:
  911.                 (yy_c_buf_p) =
  912.                     (yytext_ptr) + yy_amount_of_matched_text;
  913.  
  914.                 yy_current_state = yy_get_previous_state(  );
  915.  
  916.                 yy_cp = (yy_c_buf_p);
  917.                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  918.                 goto yy_match;
  919.  
  920.             case EOB_ACT_LAST_MATCH:
  921.                 (yy_c_buf_p) =
  922.                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  923.  
  924.                 yy_current_state = yy_get_previous_state(  );
  925.  
  926.                 yy_cp = (yy_c_buf_p);
  927.                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  928.                 goto yy_find_action;
  929.             }
  930.         break;
  931.         }
  932.  
  933.     default:
  934.         YY_FATAL_ERROR(
  935.             "fatal flex scanner internal error--no action found" );
  936.     } /* end of action switch */
  937.         } /* end of scanning one token */
  938. } /* end of configlex */
  939.  
  940. /* yy_get_next_buffer - try to read in a new buffer
  941.  *
  942.  * Returns a code representing an action:
  943.  *  EOB_ACT_LAST_MATCH -
  944.  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  945.  *  EOB_ACT_END_OF_FILE - end of file
  946.  */
  947. static int yy_get_next_buffer (void)
  948. {
  949.         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  950.     register char *source = (yytext_ptr);
  951.     register int number_to_move, i;
  952.     int ret_val;
  953.  
  954.     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  955.         YY_FATAL_ERROR(
  956.         "fatal flex scanner internal error--end of buffer missed" );
  957.  
  958.     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  959.         { /* Don't try to fill the buffer, so this is an EOF. */
  960.         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  961.             {
  962.             /* We matched a single character, the EOB, so
  963.              * treat this as a final EOF.
  964.              */
  965.             return EOB_ACT_END_OF_FILE;
  966.             }
  967.  
  968.         else
  969.             {
  970.             /* We matched some text prior to the EOB, first
  971.              * process it.
  972.              */
  973.             return EOB_ACT_LAST_MATCH;
  974.             }
  975.         }
  976.  
  977.     /* Try to read more data. */
  978.  
  979.     /* First move last chars to start of buffer. */
  980.     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  981.  
  982.     for ( i = 0; i < number_to_move; ++i )
  983.         *(dest++) = *(source++);
  984.  
  985.     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  986.         /* don't do the read, it's not guaranteed to return an EOF,
  987.          * just force an EOF
  988.          */
  989.         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  990.  
  991.     else
  992.         {
  993.             int num_to_read =
  994.             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  995.  
  996.         while ( num_to_read <= 0 )
  997.             { /* Not enough room in the buffer - grow it. */
  998.  
  999.             /* just a shorter name for the current buffer */
  1000.             YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  1001.  
  1002.             int yy_c_buf_p_offset =
  1003.                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
  1004.  
  1005.             if ( b->yy_is_our_buffer )
  1006.                 {
  1007.                 int new_size = b->yy_buf_size * 2;
  1008.  
  1009.                 if ( new_size <= 0 )
  1010.                     b->yy_buf_size += b->yy_buf_size / 8;
  1011.                 else
  1012.                     b->yy_buf_size *= 2;
  1013.  
  1014.                 b->yy_ch_buf = (char *)
  1015.                     /* Include room in for 2 EOB chars. */
  1016.                     configrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
  1017.                 }
  1018.             else
  1019.                 /* Can't grow it, we don't own it. */
  1020.                 b->yy_ch_buf = 0;
  1021.  
  1022.             if ( ! b->yy_ch_buf )
  1023.                 YY_FATAL_ERROR(
  1024.                 "fatal error - scanner input buffer overflow" );
  1025.  
  1026.             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1027.  
  1028.             num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1029.                         number_to_move - 1;
  1030.  
  1031.             }
  1032.  
  1033.         if ( num_to_read > YY_READ_BUF_SIZE )
  1034.             num_to_read = YY_READ_BUF_SIZE;
  1035.  
  1036.         /* Read in more data. */
  1037.         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1038.             (yy_n_chars), (size_t) num_to_read );
  1039.  
  1040.         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1041.         }
  1042.  
  1043.     if ( (yy_n_chars) == 0 )
  1044.         {
  1045.         if ( number_to_move == YY_MORE_ADJ )
  1046.             {
  1047.             ret_val = EOB_ACT_END_OF_FILE;
  1048.             configrestart(configin  );
  1049.             }
  1050.  
  1051.         else
  1052.             {
  1053.             ret_val = EOB_ACT_LAST_MATCH;
  1054.             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1055.                 YY_BUFFER_EOF_PENDING;
  1056.             }
  1057.         }
  1058.  
  1059.     else
  1060.         ret_val = EOB_ACT_CONTINUE_SCAN;
  1061.  
  1062.     if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1063.         /* Extend the array by 50%, plus the number we really need. */
  1064.         yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1065.         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) configrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
  1066.         if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1067.             YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1068.     }
  1069.  
  1070.     (yy_n_chars) += number_to_move;
  1071.     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1072.     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1073.  
  1074.     (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1075.  
  1076.     return ret_val;
  1077. }
  1078.  
  1079. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1080.  
  1081.     static yy_state_type yy_get_previous_state (void)
  1082. {
  1083.     register yy_state_type yy_current_state;
  1084.     register char *yy_cp;
  1085.    
  1086.     yy_current_state = (yy_start);
  1087.  
  1088.     for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1089.         {
  1090.         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1091.         if ( yy_accept[yy_current_state] )
  1092.             {
  1093.             (yy_last_accepting_state) = yy_current_state;
  1094.             (yy_last_accepting_cpos) = yy_cp;
  1095.             }
  1096.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1097.             {
  1098.             yy_current_state = (int) yy_def[yy_current_state];
  1099.             if ( yy_current_state >= 18 )
  1100.                 yy_c = yy_meta[(unsigned int) yy_c];
  1101.             }
  1102.         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1103.         }
  1104.  
  1105.     return yy_current_state;
  1106. }
  1107.  
  1108. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1109.  *
  1110.  * synopsis
  1111.  *  next_state = yy_try_NUL_trans( current_state );
  1112.  */
  1113.     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
  1114. {
  1115.     register int yy_is_jam;
  1116.         register char *yy_cp = (yy_c_buf_p);
  1117.  
  1118.     register YY_CHAR yy_c = 1;
  1119.     if ( yy_accept[yy_current_state] )
  1120.         {
  1121.         (yy_last_accepting_state) = yy_current_state;
  1122.         (yy_last_accepting_cpos) = yy_cp;
  1123.         }
  1124.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1125.         {
  1126.         yy_current_state = (int) yy_def[yy_current_state];
  1127.         if ( yy_current_state >= 18 )
  1128.             yy_c = yy_meta[(unsigned int) yy_c];
  1129.         }
  1130.     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1131.     yy_is_jam = (yy_current_state == 17);
  1132.  
  1133.     return yy_is_jam ? 0 : yy_current_state;
  1134. }
  1135.  
  1136.     static void yyunput (int c, register char * yy_bp )
  1137. {
  1138.     register char *yy_cp;
  1139.    
  1140.     yy_cp = (yy_c_buf_p);
  1141.  
  1142.     /* undo effects of setting up configtext */
  1143.     *yy_cp = (yy_hold_char);
  1144.  
  1145.     if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1146.         { /* need to shift things up to make room */
  1147.         /* +2 for EOB chars. */
  1148.         register int number_to_move = (yy_n_chars) + 2;
  1149.         register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  1150.                     YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  1151.         register char *source =
  1152.                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  1153.  
  1154.         while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1155.             *--dest = *--source;
  1156.  
  1157.         yy_cp += (int) (dest - source);
  1158.         yy_bp += (int) (dest - source);
  1159.         YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  1160.             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  1161.  
  1162.         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1163.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1164.         }
  1165.  
  1166.     *--yy_cp = (char) c;
  1167.  
  1168.     (yytext_ptr) = yy_bp;
  1169.     (yy_hold_char) = *yy_cp;
  1170.     (yy_c_buf_p) = yy_cp;
  1171. }
  1172.  
  1173. #ifndef YY_NO_INPUT
  1174. #ifdef __cplusplus
  1175.     static int yyinput (void)
  1176. #else
  1177.     static int input  (void)
  1178. #endif
  1179.  
  1180. {
  1181.     int c;
  1182.    
  1183.     *(yy_c_buf_p) = (yy_hold_char);
  1184.  
  1185.     if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1186.         {
  1187.         /* yy_c_buf_p now points to the character we want to return.
  1188.          * If this occurs *before* the EOB characters, then it's a
  1189.          * valid NUL; if not, then we've hit the end of the buffer.
  1190.          */
  1191.         if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1192.             /* This was really a NUL. */
  1193.             *(yy_c_buf_p) = '\0';
  1194.  
  1195.         else
  1196.             { /* need more input */
  1197.             int offset = (yy_c_buf_p) - (yytext_ptr);
  1198.             ++(yy_c_buf_p);
  1199.  
  1200.             switch ( yy_get_next_buffer(  ) )
  1201.                 {
  1202.                 case EOB_ACT_LAST_MATCH:
  1203.                     /* This happens because yy_g_n_b()
  1204.                      * sees that we've accumulated a
  1205.                      * token and flags that we need to
  1206.                      * try matching the token before
  1207.                      * proceeding.  But for input(),
  1208.                      * there's no matching to consider.
  1209.                      * So convert the EOB_ACT_LAST_MATCH
  1210.                      * to EOB_ACT_END_OF_FILE.
  1211.                      */
  1212.  
  1213.                     /* Reset buffer status. */
  1214.                     configrestart(configin );
  1215.  
  1216.                     /*FALLTHROUGH*/
  1217.  
  1218.                 case EOB_ACT_END_OF_FILE:
  1219.                     {
  1220.                     if ( configwrap( ) )
  1221.                         return EOF;
  1222.  
  1223.                     if ( ! (yy_did_buffer_switch_on_eof) )
  1224.                         YY_NEW_FILE;
  1225. #ifdef __cplusplus
  1226.                     return yyinput();
  1227. #else
  1228.                     return input();
  1229. #endif
  1230.                     }
  1231.  
  1232.                 case EOB_ACT_CONTINUE_SCAN:
  1233.                     (yy_c_buf_p) = (yytext_ptr) + offset;
  1234.                     break;
  1235.                 }
  1236.             }
  1237.         }
  1238.  
  1239.     c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
  1240.     *(yy_c_buf_p) = '\0';   /* preserve configtext */
  1241.     (yy_hold_char) = *++(yy_c_buf_p);
  1242.  
  1243.     return c;
  1244. }
  1245. #endif  /* ifndef YY_NO_INPUT */
  1246.  
  1247. /** Immediately switch to a different input stream.
  1248.  * @param input_file A readable stream.
  1249.  *
  1250.  * @note This function does not reset the start condition to @c INITIAL .
  1251.  */
  1252.     void configrestart  (FILE * input_file )
  1253. {
  1254.    
  1255.     if ( ! YY_CURRENT_BUFFER ){
  1256.         configensure_buffer_stack ();
  1257.         YY_CURRENT_BUFFER_LVALUE =
  1258.             config_create_buffer(configin,YY_BUF_SIZE );
  1259.     }
  1260.  
  1261.     config_init_buffer(YY_CURRENT_BUFFER,input_file );
  1262.     config_load_buffer_state( );
  1263. }
  1264.  
  1265. /** Switch to a different input buffer.
  1266.  * @param new_buffer The new input buffer.
  1267.  *
  1268.  */
  1269.     void config_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
  1270. {
  1271.    
  1272.     /* TODO. We should be able to replace this entire function body
  1273.      * with
  1274.      *      configpop_buffer_state();
  1275.      *      configpush_buffer_state(new_buffer);
  1276.      */
  1277.     configensure_buffer_stack ();
  1278.     if ( YY_CURRENT_BUFFER == new_buffer )
  1279.         return;
  1280.  
  1281.     if ( YY_CURRENT_BUFFER )
  1282.         {
  1283.         /* Flush out information for old buffer. */
  1284.         *(yy_c_buf_p) = (yy_hold_char);
  1285.         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1286.         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1287.         }
  1288.  
  1289.     YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1290.     config_load_buffer_state( );
  1291.  
  1292.     /* We don't actually know whether we did this switch during
  1293.      * EOF (configwrap()) processing, but the only time this flag
  1294.      * is looked at is after configwrap() is called, so it's safe
  1295.      * to go ahead and always set it.
  1296.      */
  1297.     (yy_did_buffer_switch_on_eof) = 1;
  1298. }
  1299.  
  1300. static void config_load_buffer_state  (void)
  1301. {
  1302.         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1303.     (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1304.     configin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1305.     (yy_hold_char) = *(yy_c_buf_p);
  1306. }
  1307.  
  1308. /** Allocate and initialize an input buffer state.
  1309.  * @param file A readable stream.
  1310.  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1311.  *
  1312.  * @return the allocated buffer state.
  1313.  */
  1314.     YY_BUFFER_STATE config_create_buffer  (FILE * file, int  size )
  1315. {
  1316.     YY_BUFFER_STATE b;
  1317.    
  1318.     b = (YY_BUFFER_STATE) configalloc(sizeof( struct yy_buffer_state )  );
  1319.     if ( ! b )
  1320.         YY_FATAL_ERROR( "out of dynamic memory in config_create_buffer()" );
  1321.  
  1322.     b->yy_buf_size = size;
  1323.  
  1324.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1325.      * we need to put in 2 end-of-buffer characters.
  1326.      */
  1327.     b->yy_ch_buf = (char *) configalloc(b->yy_buf_size + 2  );
  1328.     if ( ! b->yy_ch_buf )
  1329.         YY_FATAL_ERROR( "out of dynamic memory in config_create_buffer()" );
  1330.  
  1331.     b->yy_is_our_buffer = 1;
  1332.  
  1333.     config_init_buffer(b,file );
  1334.  
  1335.     return b;
  1336. }
  1337.  
  1338. /** Destroy the buffer.
  1339.  * @param b a buffer created with config_create_buffer()
  1340.  *
  1341.  */
  1342.     void config_delete_buffer (YY_BUFFER_STATE  b )
  1343. {
  1344.    
  1345.     if ( ! b )
  1346.         return;
  1347.  
  1348.     if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1349.         YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1350.  
  1351.     if ( b->yy_is_our_buffer )
  1352.         configfree((void *) b->yy_ch_buf  );
  1353.  
  1354.     configfree((void *) b  );
  1355. }
  1356.  
  1357. #ifndef __cplusplus
  1358. extern int isatty (int );
  1359. #endif /* __cplusplus */
  1360.    
  1361. /* Initializes or reinitializes a buffer.
  1362.  * This function is sometimes called more than once on the same buffer,
  1363.  * such as during a configrestart() or at EOF.
  1364.  */
  1365.     static void config_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
  1366.  
  1367. {
  1368.     int oerrno = errno;
  1369.    
  1370.     config_flush_buffer(b );
  1371.  
  1372.     b->yy_input_file = file;
  1373.     b->yy_fill_buffer = 1;
  1374.  
  1375.     /* If b is the current buffer, then config_init_buffer was _probably_
  1376.      * called from configrestart() or through yy_get_next_buffer.
  1377.      * In that case, we don't want to reset the lineno or column.
  1378.      */
  1379.     if (b != YY_CURRENT_BUFFER){
  1380.         b->yy_bs_lineno = 1;
  1381.         b->yy_bs_column = 0;
  1382.     }
  1383.  
  1384.         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1385.    
  1386.     errno = oerrno;
  1387. }
  1388.  
  1389. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1390.  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1391.  *
  1392.  */
  1393.     void config_flush_buffer (YY_BUFFER_STATE  b )
  1394. {
  1395.         if ( ! b )
  1396.         return;
  1397.  
  1398.     b->yy_n_chars = 0;
  1399.  
  1400.     /* We always need two end-of-buffer characters.  The first causes
  1401.      * a transition to the end-of-buffer state.  The second causes
  1402.      * a jam in that state.
  1403.      */
  1404.     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1405.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1406.  
  1407.     b->yy_buf_pos = &b->yy_ch_buf[0];
  1408.  
  1409.     b->yy_at_bol = 1;
  1410.     b->yy_buffer_status = YY_BUFFER_NEW;
  1411.  
  1412.     if ( b == YY_CURRENT_BUFFER )
  1413.         config_load_buffer_state( );
  1414. }
  1415.  
  1416. /** Pushes the new state onto the stack. The new state becomes
  1417.  *  the current state. This function will allocate the stack
  1418.  *  if necessary.
  1419.  *  @param new_buffer The new state.
  1420.  *  
  1421.  */
  1422. void configpush_buffer_state (YY_BUFFER_STATE new_buffer )
  1423. {
  1424.         if (new_buffer == NULL)
  1425.         return;
  1426.  
  1427.     configensure_buffer_stack();
  1428.  
  1429.     /* This block is copied from config_switch_to_buffer. */
  1430.     if ( YY_CURRENT_BUFFER )
  1431.         {
  1432.         /* Flush out information for old buffer. */
  1433.         *(yy_c_buf_p) = (yy_hold_char);
  1434.         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1435.         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1436.         }
  1437.  
  1438.     /* Only push if top exists. Otherwise, replace top. */
  1439.     if (YY_CURRENT_BUFFER)
  1440.         (yy_buffer_stack_top)++;
  1441.     YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1442.  
  1443.     /* copied from config_switch_to_buffer. */
  1444.     config_load_buffer_state( );
  1445.     (yy_did_buffer_switch_on_eof) = 1;
  1446. }
  1447.  
  1448. /** Removes and deletes the top of the stack, if present.
  1449.  *  The next element becomes the new top.
  1450.  *  
  1451.  */
  1452. void configpop_buffer_state (void)
  1453. {
  1454.         if (!YY_CURRENT_BUFFER)
  1455.         return;
  1456.  
  1457.     config_delete_buffer(YY_CURRENT_BUFFER );
  1458.     YY_CURRENT_BUFFER_LVALUE = NULL;
  1459.     if ((yy_buffer_stack_top) > 0)
  1460.         --(yy_buffer_stack_top);
  1461.  
  1462.     if (YY_CURRENT_BUFFER) {
  1463.         config_load_buffer_state( );
  1464.         (yy_did_buffer_switch_on_eof) = 1;
  1465.     }
  1466. }
  1467.  
  1468. /* Allocates the stack if it does not exist.
  1469.  *  Guarantees space for at least one push.
  1470.  */
  1471. static void configensure_buffer_stack (void)
  1472. {
  1473.     int num_to_alloc;
  1474.    
  1475.     if (!(yy_buffer_stack)) {
  1476.  
  1477.         /* First allocation is just for 2 elements, since we don't know if this
  1478.          * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1479.          * immediate realloc on the next call.
  1480.          */
  1481.         num_to_alloc = 1;
  1482.         (yy_buffer_stack) = (struct yy_buffer_state**)configalloc
  1483.                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
  1484.                                 );
  1485.         if ( ! (yy_buffer_stack) )
  1486.             YY_FATAL_ERROR( "out of dynamic memory in configensure_buffer_stack()" );
  1487.                                  
  1488.         memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1489.                
  1490.         (yy_buffer_stack_max) = num_to_alloc;
  1491.         (yy_buffer_stack_top) = 0;
  1492.         return;
  1493.     }
  1494.  
  1495.     if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1496.  
  1497.         /* Increase the buffer to prepare for a possible push. */
  1498.         int grow_size = 8 /* arbitrary grow size */;
  1499.  
  1500.         num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1501.         (yy_buffer_stack) = (struct yy_buffer_state**)configrealloc
  1502.                                 ((yy_buffer_stack),
  1503.                                 num_to_alloc * sizeof(struct yy_buffer_state*)
  1504.                                 );
  1505.         if ( ! (yy_buffer_stack) )
  1506.             YY_FATAL_ERROR( "out of dynamic memory in configensure_buffer_stack()" );
  1507.  
  1508.         /* zero only the new slots.*/
  1509.         memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1510.         (yy_buffer_stack_max) = num_to_alloc;
  1511.     }
  1512. }
  1513.  
  1514. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1515.  * @param base the character buffer
  1516.  * @param size the size in bytes of the character buffer
  1517.  *
  1518.  * @return the newly allocated buffer state object.
  1519.  */
  1520. YY_BUFFER_STATE config_scan_buffer  (char * base, yy_size_t  size )
  1521. {
  1522.     YY_BUFFER_STATE b;
  1523.    
  1524.     if ( size < 2 ||
  1525.          base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1526.          base[size-1] != YY_END_OF_BUFFER_CHAR )
  1527.         /* They forgot to leave room for the EOB's. */
  1528.         return 0;
  1529.  
  1530.     b = (YY_BUFFER_STATE) configalloc(sizeof( struct yy_buffer_state )  );
  1531.     if ( ! b )
  1532.         YY_FATAL_ERROR( "out of dynamic memory in config_scan_buffer()" );
  1533.  
  1534.     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
  1535.     b->yy_buf_pos = b->yy_ch_buf = base;
  1536.     b->yy_is_our_buffer = 0;
  1537.     b->yy_input_file = 0;
  1538.     b->yy_n_chars = b->yy_buf_size;
  1539.     b->yy_is_interactive = 0;
  1540.     b->yy_at_bol = 1;
  1541.     b->yy_fill_buffer = 0;
  1542.     b->yy_buffer_status = YY_BUFFER_NEW;
  1543.  
  1544.     config_switch_to_buffer(b  );
  1545.  
  1546.     return b;
  1547. }
  1548.  
  1549. /** Setup the input buffer state to scan a string. The next call to configlex() will
  1550.  * scan from a @e copy of @a str.
  1551.  * @param yystr a NUL-terminated string to scan
  1552.  *
  1553.  * @return the newly allocated buffer state object.
  1554.  * @note If you want to scan bytes that may contain NUL values, then use
  1555.  *       config_scan_bytes() instead.
  1556.  */
  1557. YY_BUFFER_STATE config_scan_string (yyconst char * yystr )
  1558. {
  1559.    
  1560.     return config_scan_bytes(yystr,strlen(yystr) );
  1561. }
  1562.  
  1563. /** Setup the input buffer state to scan the given bytes. The next call to configlex() will
  1564.  * scan from a @e copy of @a bytes.
  1565.  * @param bytes the byte buffer to scan
  1566.  * @param len the number of bytes in the buffer pointed to by @a bytes.
  1567.  *
  1568.  * @return the newly allocated buffer state object.
  1569.  */
  1570. YY_BUFFER_STATE config_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
  1571. {
  1572.     YY_BUFFER_STATE b;
  1573.     char *buf;
  1574.     yy_size_t n;
  1575.     int i;
  1576.    
  1577.     /* Get memory for full buffer, including space for trailing EOB's. */
  1578.     n = _yybytes_len + 2;
  1579.     buf = (char *) configalloc(n  );
  1580.     if ( ! buf )
  1581.         YY_FATAL_ERROR( "out of dynamic memory in config_scan_bytes()" );
  1582.  
  1583.     for ( i = 0; i < _yybytes_len; ++i )
  1584.         buf[i] = yybytes[i];
  1585.  
  1586.     buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1587.  
  1588.     b = config_scan_buffer(buf,n );
  1589.     if ( ! b )
  1590.         YY_FATAL_ERROR( "bad buffer in config_scan_bytes()" );
  1591.  
  1592.     /* It's okay to grow etc. this buffer, and we should throw it
  1593.      * away when we're done.
  1594.      */
  1595.     b->yy_is_our_buffer = 1;
  1596.  
  1597.     return b;
  1598. }
  1599.  
  1600. #ifndef YY_EXIT_FAILURE
  1601. #define YY_EXIT_FAILURE 2
  1602. #endif
  1603.  
  1604. static void yy_fatal_error (yyconst char* msg )
  1605. {
  1606.         (void) fprintf( stderr, "%s\n", msg );
  1607.     exit( YY_EXIT_FAILURE );
  1608. }
  1609.  
  1610. /* Redefine yyless() so it works in section 3 code. */
  1611.  
  1612. #undef yyless
  1613. #define yyless(n) \
  1614.     do \
  1615.         { \
  1616.         /* Undo effects of setting up configtext. */ \
  1617.         int yyless_macro_arg = (n); \
  1618.         YY_LESS_LINENO(yyless_macro_arg);\
  1619.         configtext[configleng] = (yy_hold_char); \
  1620.         (yy_c_buf_p) = configtext + yyless_macro_arg; \
  1621.         (yy_hold_char) = *(yy_c_buf_p); \
  1622.         *(yy_c_buf_p) = '\0'; \
  1623.         configleng = yyless_macro_arg; \
  1624.         } \
  1625.     while ( 0 )
  1626.  
  1627. /* Accessor  methods (get/set functions) to struct members. */
  1628.  
  1629. /** Get the current line number.
  1630.  *
  1631.  */
  1632. int configget_lineno  (void)
  1633. {
  1634.        
  1635.     return configlineno;
  1636. }
  1637.  
  1638. /** Get the input stream.
  1639.  *
  1640.  */
  1641. FILE *configget_in  (void)
  1642. {
  1643.         return configin;
  1644. }
  1645.  
  1646. /** Get the output stream.
  1647.  *
  1648.  */
  1649. FILE *configget_out  (void)
  1650. {
  1651.         return configout;
  1652. }
  1653.  
  1654. /** Get the length of the current token.
  1655.  *
  1656.  */
  1657. int configget_leng  (void)
  1658. {
  1659.         return configleng;
  1660. }
  1661.  
  1662. /** Get the current token.
  1663.  *
  1664.  */
  1665.  
  1666. char *configget_text  (void)
  1667. {
  1668.         return configtext;
  1669. }
  1670.  
  1671. /** Set the current line number.
  1672.  * @param line_number
  1673.  *
  1674.  */
  1675. void configset_lineno (int  line_number )
  1676. {
  1677.    
  1678.     configlineno = line_number;
  1679. }
  1680.  
  1681. /** Set the input stream. This does not discard the current
  1682.  * input buffer.
  1683.  * @param in_str A readable stream.
  1684.  *
  1685.  * @see config_switch_to_buffer
  1686.  */
  1687. void configset_in (FILE *  in_str )
  1688. {
  1689.         configin = in_str ;
  1690. }
  1691.  
  1692. void configset_out (FILE *  out_str )
  1693. {
  1694.         configout = out_str ;
  1695. }
  1696.  
  1697. int configget_debug  (void)
  1698. {
  1699.         return config_flex_debug;
  1700. }
  1701.  
  1702. void configset_debug (int  bdebug )
  1703. {
  1704.         config_flex_debug = bdebug ;
  1705. }
  1706.  
  1707. static int yy_init_globals (void)
  1708. {
  1709.         /* Initialization is the same as for the non-reentrant scanner.
  1710.      * This function is called from configlex_destroy(), so don't allocate here.
  1711.      */
  1712.  
  1713.     (yy_buffer_stack) = 0;
  1714.     (yy_buffer_stack_top) = 0;
  1715.     (yy_buffer_stack_max) = 0;
  1716.     (yy_c_buf_p) = (char *) 0;
  1717.     (yy_init) = 0;
  1718.     (yy_start) = 0;
  1719.  
  1720. /* Defined in main.c */
  1721. #ifdef YY_STDINIT
  1722.     configin = stdin;
  1723.     configout = stdout;
  1724. #else
  1725.     configin = (FILE *) 0;
  1726.     configout = (FILE *) 0;
  1727. #endif
  1728.  
  1729.     /* For future reference: Set errno on error, since we are called by
  1730.      * configlex_init()
  1731.      */
  1732.     return 0;
  1733. }
  1734.  
  1735. /* configlex_destroy is for both reentrant and non-reentrant scanners. */
  1736. int configlex_destroy  (void)
  1737. {
  1738.    
  1739.     /* Pop the buffer stack, destroying each element. */
  1740.     while(YY_CURRENT_BUFFER){
  1741.         config_delete_buffer(YY_CURRENT_BUFFER  );
  1742.         YY_CURRENT_BUFFER_LVALUE = NULL;
  1743.         configpop_buffer_state();
  1744.     }
  1745.  
  1746.     /* Destroy the stack itself. */
  1747.     configfree((yy_buffer_stack) );
  1748.     (yy_buffer_stack) = NULL;
  1749.  
  1750.     /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1751.      * configlex() is called, initialization will occur. */
  1752.     yy_init_globals( );
  1753.  
  1754.     return 0;
  1755. }
  1756.  
  1757. /*
  1758.  * Internal utility routines.
  1759.  */
  1760.  
  1761. #ifndef yytext_ptr
  1762. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  1763. {
  1764.     register int i;
  1765.     for ( i = 0; i < n; ++i )
  1766.         s1[i] = s2[i];
  1767. }
  1768. #endif
  1769.  
  1770. #ifdef YY_NEED_STRLEN
  1771. static int yy_flex_strlen (yyconst char * s )
  1772. {
  1773.     register int n;
  1774.     for ( n = 0; s[n]; ++n )
  1775.         ;
  1776.  
  1777.     return n;
  1778. }
  1779. #endif
  1780.  
  1781. void *configalloc (yy_size_t  size )
  1782. {
  1783.     return (void *) malloc( size );
  1784. }
  1785.  
  1786. void *configrealloc  (void * ptr, yy_size_t  size )
  1787. {
  1788.     /* The cast to (char *) in the following accommodates both
  1789.      * implementations that use char* generic pointers, and those
  1790.      * that use void* generic pointers.  It works with the latter
  1791.      * because both ANSI C and C++ allow castless assignment from
  1792.      * any pointer type to void*, and deal with argument conversions
  1793.      * as though doing an assignment.
  1794.      */
  1795.     return (void *) realloc( (char *) ptr, size );
  1796. }
  1797.  
  1798. void configfree (void * ptr )
  1799. {
  1800.     free( (char *) ptr );   /* see configrealloc() for (char *) cast */
  1801. }
  1802.  
  1803. #define YYTABLES_NAME "yytables"
  1804.  
  1805. #line 41 "config.l"
  1806.  
  1807.  
  1808.  
  1809. void configerror( string msg )
  1810. {
  1811.   Configuration::GetTheConfig( )->ParseError( msg, configlineno );
  1812. }
  1813.  
  1814.  
  1815.  
  1816.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement