home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / install / modutils / genksyms / lex.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-06  |  51.7 KB  |  2,132 lines

  1. #line 2 "lex.c"
  2. /* A lexical scanner generated by flex */
  3.  
  4. /* Scanner skeleton version:
  5.  * $Header: /usr/rhs/CVS/instmodutils/genksyms/lex.c,v 1.1.1.1 1998/01/06 20:51:07 ewt Exp $
  6.  */
  7.  
  8. #define FLEX_SCANNER
  9. #define YY_FLEX_MAJOR_VERSION 2
  10. #define YY_FLEX_MINOR_VERSION 5
  11.  
  12. #include <stdio.h>
  13.  
  14.  
  15. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  16. #ifdef c_plusplus
  17. #ifndef __cplusplus
  18. #define __cplusplus
  19. #endif
  20. #endif
  21.  
  22.  
  23. #ifdef __cplusplus
  24.  
  25. #include <stdlib.h>
  26. #include <unistd.h>
  27.  
  28. /* Use prototypes in function declarations. */
  29. #define YY_USE_PROTOS
  30.  
  31. /* The "const" storage-class-modifier is valid. */
  32. #define YY_USE_CONST
  33.  
  34. #else    /* ! __cplusplus */
  35.  
  36. #if __STDC__
  37.  
  38. #define YY_USE_PROTOS
  39. #define YY_USE_CONST
  40.  
  41. #endif    /* __STDC__ */
  42. #endif    /* ! __cplusplus */
  43.  
  44. #ifdef __TURBOC__
  45.  #pragma warn -rch
  46.  #pragma warn -use
  47. #include <io.h>
  48. #include <stdlib.h>
  49. #define YY_USE_CONST
  50. #define YY_USE_PROTOS
  51. #endif
  52.  
  53. #ifdef YY_USE_CONST
  54. #define yyconst const
  55. #else
  56. #define yyconst
  57. #endif
  58.  
  59.  
  60. #ifdef YY_USE_PROTOS
  61. #define YY_PROTO(proto) proto
  62. #else
  63. #define YY_PROTO(proto) ()
  64. #endif
  65.  
  66. /* Returned upon end-of-file. */
  67. #define YY_NULL 0
  68.  
  69. /* Promotes a possibly negative, possibly signed char to an unsigned
  70.  * integer for use as an array index.  If the signed char is negative,
  71.  * we want to instead treat it as an 8-bit unsigned char, hence the
  72.  * double cast.
  73.  */
  74. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  75.  
  76. /* Enter a start condition.  This macro really ought to take a parameter,
  77.  * but we do it the disgusting crufty way forced on us by the ()-less
  78.  * definition of BEGIN.
  79.  */
  80. #define BEGIN yy_start = 1 + 2 *
  81.  
  82. /* Translate the current start state into a value that can be later handed
  83.  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  84.  * compatibility.
  85.  */
  86. #define YY_START ((yy_start - 1) / 2)
  87. #define YYSTATE YY_START
  88.  
  89. /* Action number for EOF rule of a given start state. */
  90. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  91.  
  92. /* Special action meaning "start processing a new file". */
  93. #define YY_NEW_FILE yyrestart( yyin )
  94.  
  95. #define YY_END_OF_BUFFER_CHAR 0
  96.  
  97. /* Size of default input buffer. */
  98. #define YY_BUF_SIZE 16384
  99.  
  100. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  101.  
  102. extern int yyleng;
  103. extern FILE *yyin, *yyout;
  104.  
  105. #define EOB_ACT_CONTINUE_SCAN 0
  106. #define EOB_ACT_END_OF_FILE 1
  107. #define EOB_ACT_LAST_MATCH 2
  108.  
  109. /* The funky do-while in the following #define is used to turn the definition
  110.  * int a single C statement (which needs a semi-colon terminator).  This
  111.  * avoids problems with code like:
  112.  *
  113.  *     if ( condition_holds )
  114.  *        yyless( 5 );
  115.  *    else
  116.  *        do_something_else();
  117.  *
  118.  * Prior to using the do-while the compiler would get upset at the
  119.  * "else" because it interpreted the "if" statement as being all
  120.  * done when it reached the ';' after the yyless() call.
  121.  */
  122.  
  123. /* Return all but the first 'n' matched characters back to the input stream. */
  124.  
  125. #define yyless(n) \
  126.     do \
  127.         { \
  128.         /* Undo effects of setting up yytext. */ \
  129.         *yy_cp = yy_hold_char; \
  130.         YY_RESTORE_YY_MORE_OFFSET \
  131.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  132.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  133.         } \
  134.     while ( 0 )
  135.  
  136. #define unput(c) yyunput( c, yytext_ptr )
  137.  
  138. /* The following is because we cannot portably get our hands on size_t
  139.  * (without autoconf's help, which isn't available because we want
  140.  * flex-generated scanners to compile on their own).
  141.  */
  142. typedef unsigned int yy_size_t;
  143.  
  144.  
  145. struct yy_buffer_state
  146.     {
  147.     FILE *yy_input_file;
  148.  
  149.     char *yy_ch_buf;        /* input buffer */
  150.     char *yy_buf_pos;        /* current position in input buffer */
  151.  
  152.     /* Size of input buffer in bytes, not including room for EOB
  153.      * characters.
  154.      */
  155.     yy_size_t yy_buf_size;
  156.  
  157.     /* Number of characters read into yy_ch_buf, not including EOB
  158.      * characters.
  159.      */
  160.     int yy_n_chars;
  161.  
  162.     /* Whether we "own" the buffer - i.e., we know we created it,
  163.      * and can realloc() it to grow it, and should free() it to
  164.      * delete it.
  165.      */
  166.     int yy_is_our_buffer;
  167.  
  168.     /* Whether this is an "interactive" input source; if so, and
  169.      * if we're using stdio for input, then we want to use getc()
  170.      * instead of fread(), to make sure we stop fetching input after
  171.      * each newline.
  172.      */
  173.     int yy_is_interactive;
  174.  
  175.     /* Whether we're considered to be at the beginning of a line.
  176.      * If so, '^' rules will be active on the next match, otherwise
  177.      * not.
  178.      */
  179.     int yy_at_bol;
  180.  
  181.     /* Whether to try to fill the input buffer when we reach the
  182.      * end of it.
  183.      */
  184.     int yy_fill_buffer;
  185.  
  186.     int yy_buffer_status;
  187. #define YY_BUFFER_NEW 0
  188. #define YY_BUFFER_NORMAL 1
  189.     /* When an EOF's been seen but there's still some text to process
  190.      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  191.      * shouldn't try reading from the input source any more.  We might
  192.      * still have a bunch of tokens to match, though, because of
  193.      * possible backing-up.
  194.      *
  195.      * When we actually see the EOF, we change the status to "new"
  196.      * (via yyrestart()), so that the user can continue scanning by
  197.      * just pointing yyin at a new input file.
  198.      */
  199. #define YY_BUFFER_EOF_PENDING 2
  200.     };
  201.  
  202. static YY_BUFFER_STATE yy_current_buffer = 0;
  203.  
  204. /* We provide macros for accessing buffer states in case in the
  205.  * future we want to put the buffer states in a more general
  206.  * "scanner state".
  207.  */
  208. #define YY_CURRENT_BUFFER yy_current_buffer
  209.  
  210.  
  211. /* yy_hold_char holds the character lost when yytext is formed. */
  212. static char yy_hold_char;
  213.  
  214. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  215.  
  216.  
  217. int yyleng;
  218.  
  219. /* Points to current character in buffer. */
  220. static char *yy_c_buf_p = (char *) 0;
  221. static int yy_init = 1;        /* whether we need to initialize */
  222. static int yy_start = 0;    /* start state number */
  223.  
  224. /* Flag which is used to allow yywrap()'s to do buffer switches
  225.  * instead of setting up a fresh yyin.  A bit of a hack ...
  226.  */
  227. static int yy_did_buffer_switch_on_eof;
  228.  
  229. void yyrestart YY_PROTO(( FILE *input_file ));
  230.  
  231. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  232. void yy_load_buffer_state YY_PROTO(( void ));
  233. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  234. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  235. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  236. void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  237. #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
  238.  
  239. YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
  240. YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
  241. YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
  242.  
  243. static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
  244. static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
  245. static void yy_flex_free YY_PROTO(( void * ));
  246.  
  247. #define yy_new_buffer yy_create_buffer
  248.  
  249. #define yy_set_interactive(is_interactive) \
  250.     { \
  251.     if ( ! yy_current_buffer ) \
  252.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  253.     yy_current_buffer->yy_is_interactive = is_interactive; \
  254.     }
  255.  
  256. #define yy_set_bol(at_bol) \
  257.     { \
  258.     if ( ! yy_current_buffer ) \
  259.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  260.     yy_current_buffer->yy_at_bol = at_bol; \
  261.     }
  262.  
  263. #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
  264.  
  265.  
  266. #define yywrap() 1
  267. #define YY_SKIP_YYWRAP
  268.  
  269. #define FLEX_DEBUG
  270. typedef unsigned char YY_CHAR;
  271. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  272. typedef int yy_state_type;
  273.  
  274. #define FLEX_DEBUG
  275. extern char *yytext;
  276. #define yytext_ptr yytext
  277.  
  278. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  279. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  280. static int yy_get_next_buffer YY_PROTO(( void ));
  281. static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
  282.  
  283. /* Done after the current pattern has been matched and before the
  284.  * corresponding action - sets up yytext.
  285.  */
  286. #define YY_DO_BEFORE_ACTION \
  287.     yytext_ptr = yy_bp; \
  288.     yyleng = (int) (yy_cp - yy_bp); \
  289.     yy_hold_char = *yy_cp; \
  290.     *yy_cp = '\0'; \
  291.     yy_c_buf_p = yy_cp;
  292.  
  293. #define YY_NUM_RULES 13
  294. #define YY_END_OF_BUFFER 14
  295. static yyconst short int yy_accept[76] =
  296.     {   0,
  297.         0,    0,    0,    0,   14,   12,    4,    3,   12,   12,
  298.        12,    7,    7,   12,   12,   12,   12,   12,    9,    9,
  299.        12,   12,   12,    4,    0,    5,    0,    0,    6,    0,
  300.         0,    7,    0,    0,    0,    0,    2,    8,   10,   10,
  301.         9,    0,    0,    9,    9,    0,    9,    0,    0,   11,
  302.         0,    0,    0,   10,    0,   10,    9,    9,    0,    0,
  303.         0,    0,    0,    0,    0,   10,   10,    0,    0,    0,
  304.         0,    0,    0,    1,    0
  305.     } ;
  306.  
  307. static yyconst int yy_ec[256] =
  308.     {   0,
  309.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  310.         4,    4,    4,    1,    1,    1,    1,    1,    1,    1,
  311.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  312.         1,    2,    1,    5,    6,    1,    7,    8,    9,    1,
  313.         1,    7,   10,    1,   11,   12,    7,   13,   14,   14,
  314.        14,   14,   14,   14,   14,   15,   15,    1,    1,   16,
  315.        17,   18,    1,    1,   19,   19,   19,   19,   20,   21,
  316.        22,   22,   22,   22,   22,   23,   22,   22,   22,   22,
  317.        22,   22,   22,   22,   24,   22,   22,   25,   22,   22,
  318.         1,   26,    1,    7,   22,    1,   19,   19,   19,   19,
  319.  
  320.        20,   21,   22,   22,   22,   22,   22,   27,   22,   22,
  321.        22,   22,   22,   22,   22,   22,   24,   22,   22,   25,
  322.        22,   22,    1,   28,    1,    7,    1,    1,    1,    1,
  323.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  324.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  325.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  326.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  327.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  328.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  329.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  330.  
  331.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  332.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  333.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  334.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  335.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  336.         1,    1,    1,    1,    1
  337.     } ;
  338.  
  339. static yyconst int yy_meta[29] =
  340.     {   0,
  341.         1,    1,    2,    1,    1,    1,    1,    1,    1,    3,
  342.         3,    4,    5,    5,    5,    1,    1,    1,    6,    7,
  343.         6,    8,    8,    8,    8,    1,    8,    1
  344.     } ;
  345.  
  346. static yyconst short int yy_base[88] =
  347.     {   0,
  348.         0,  166,   22,  152,  151,  282,   39,  282,   26,   33,
  349.       138,    0,   39,   43,  124,   39,   36,   48,   52,   55,
  350.        41,   56,   54,   47,   73,  282,    0,   72,  282,    0,
  351.       116,    0,   78,   75,  122,  103,  282,  282,  106,    0,
  352.        97,   73,   76,   91,   65,    0,    0,   84,   81,  282,
  353.       132,   98,   84,  282,  117,  147,  282,   73,  134,   89,
  354.       100,  140,  172,  139,  134,  181,  282,  135,  106,  142,
  355.       168,   88,   52,  282,  282,  208,  216,  220,  228,  236,
  356.       244,  249,  254,  255,  260,  265,  273
  357.     } ;
  358.  
  359. static yyconst short int yy_def[88] =
  360.     {   0,
  361.        75,    1,    1,    3,   75,   75,   75,   75,   76,   77,
  362.        75,   78,   78,   79,   75,   75,   75,   75,   75,   19,
  363.        75,   75,   75,   75,   76,   75,   80,   77,   75,   81,
  364.        75,   78,   76,   77,   79,   79,   75,   75,   75,   39,
  365.        19,   82,   83,   75,   75,   84,   20,   76,   77,   75,
  366.        79,   51,   85,   75,   75,   75,   75,   84,   79,   51,
  367.        79,   79,   79,   51,   75,   75,   75,   86,   79,   63,
  368.        86,   87,   87,   75,    0,   75,   75,   75,   75,   75,
  369.        75,   75,   75,   75,   75,   75,   75
  370.     } ;
  371.  
  372. static yyconst short int yy_nxt[311] =
  373.     {   0,
  374.         6,    7,    8,    7,    9,    6,    6,    6,   10,    6,
  375.         6,   11,    6,    6,    6,    6,    6,    6,   12,   12,
  376.        12,   12,   13,   12,   12,    6,   12,    6,   15,   16,
  377.        26,   15,   17,   18,   19,   20,   20,   21,   15,   22,
  378.        24,   29,   24,   33,   36,   37,   38,   34,   24,   23,
  379.        24,   27,   38,   38,   74,   38,   38,   38,   30,   31,
  380.        39,   39,   39,   40,   41,   41,   42,   47,   47,   47,
  381.        38,   43,   38,   38,   44,   45,   46,   26,   44,   75,
  382.        29,   38,   26,   29,   40,   55,   55,   57,   26,   29,
  383.        74,   57,   43,   65,   65,   44,   45,   30,   27,   44,
  384.  
  385.        30,   59,   37,   27,   36,   37,   30,   59,   37,   27,
  386.        64,   64,   64,   35,   57,   51,   52,   52,   39,   39,
  387.        39,   75,   35,   69,   37,   53,   54,   50,   54,   56,
  388.        56,   56,   54,   59,   37,   59,   37,   37,   68,   35,
  389.        38,   59,   37,   59,   60,   60,   66,   66,   66,   31,
  390.        75,   64,   64,   64,   61,   62,   63,   14,   61,   56,
  391.        56,   56,   69,   35,   61,   62,   69,   67,   61,   67,
  392.        37,   14,   72,   67,   37,   75,   75,   75,   75,   75,
  393.        75,   75,   75,   75,   70,   70,   70,   75,   75,   75,
  394.        70,   70,   70,   66,   66,   66,   75,   75,   75,   75,
  395.  
  396.        75,   54,   75,   54,   75,   75,   75,   54,   25,   25,
  397.        25,   25,   25,   25,   25,   25,   28,   28,   28,   28,
  398.        28,   28,   28,   28,   32,   32,   32,   32,   35,   35,
  399.        35,   35,   35,   35,   35,   35,   48,   75,   48,   48,
  400.        48,   48,   48,   48,   49,   75,   49,   49,   49,   49,
  401.        49,   49,   42,   42,   75,   42,   56,   75,   56,   58,
  402.        58,   58,   66,   75,   66,   71,   71,   71,   71,   71,
  403.        71,   71,   71,   73,   73,   73,   73,   73,   73,   73,
  404.        73,    5,   75,   75,   75,   75,   75,   75,   75,   75,
  405.        75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
  406.  
  407.        75,   75,   75,   75,   75,   75,   75,   75,   75,   75
  408.     } ;
  409.  
  410. static yyconst short int yy_chk[311] =
  411.     {   0,
  412.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  413.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  414.         1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
  415.         9,    3,    3,    3,    3,    3,    3,    3,    3,    3,
  416.         7,   10,    7,   13,   14,   14,   16,   13,   24,    3,
  417.        24,    9,   17,   17,   73,   16,   21,   21,   10,   18,
  418.        18,   18,   18,   19,   19,   19,   19,   20,   20,   20,
  419.        23,   19,   22,   22,   19,   19,   19,   25,   19,   20,
  420.        28,   23,   33,   34,   42,   43,   43,   45,   48,   49,
  421.        72,   45,   42,   53,   53,   58,   58,   28,   25,   58,
  422.  
  423.        34,   61,   61,   33,   36,   36,   49,   69,   69,   48,
  424.        52,   52,   52,   60,   44,   36,   36,   36,   39,   39,
  425.        39,   41,   52,   61,   35,   39,   39,   31,   39,   55,
  426.        55,   55,   39,   51,   51,   59,   59,   68,   59,   68,
  427.        15,   62,   62,   70,   51,   51,   65,   65,   65,   11,
  428.         5,   64,   64,   64,   51,   51,   51,    4,   51,   56,
  429.        56,   56,   62,   64,   70,   70,   62,   56,   70,   56,
  430.        71,    2,   71,   56,   63,    0,    0,    0,    0,    0,
  431.         0,    0,    0,    0,   63,   63,   63,    0,    0,    0,
  432.        63,   63,   63,   66,   66,   66,    0,    0,    0,    0,
  433.  
  434.         0,   66,    0,   66,    0,    0,    0,   66,   76,   76,
  435.        76,   76,   76,   76,   76,   76,   77,   77,   77,   77,
  436.        77,   77,   77,   77,   78,   78,   78,   78,   79,   79,
  437.        79,   79,   79,   79,   79,   79,   80,    0,   80,   80,
  438.        80,   80,   80,   80,   81,    0,   81,   81,   81,   81,
  439.        81,   81,   82,   82,    0,   82,   83,    0,   83,   84,
  440.        84,   84,   85,    0,   85,   86,   86,   86,   86,   86,
  441.        86,   86,   86,   87,   87,   87,   87,   87,   87,   87,
  442.        87,   75,   75,   75,   75,   75,   75,   75,   75,   75,
  443.        75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
  444.  
  445.        75,   75,   75,   75,   75,   75,   75,   75,   75,   75
  446.     } ;
  447.  
  448. static yy_state_type yy_last_accepting_state;
  449. static char *yy_last_accepting_cpos;
  450.  
  451. extern int yy_flex_debug;
  452. int yy_flex_debug = 1;
  453.  
  454. static yyconst short int yy_rule_linenum[13] =
  455.     {   0,
  456.        70,   71,   72,   75,   78,   79,   80,   86,   87,   88,
  457.        93,   96
  458.     } ;
  459.  
  460. /* The intent behind this definition is that it'll catch
  461.  * any uses of REJECT which flex missed.
  462.  */
  463. #define REJECT reject_used_but_not_detected
  464. #define yymore() yymore_used_but_not_detected
  465. #define YY_MORE_ADJ 0
  466. #define YY_RESTORE_YY_MORE_OFFSET
  467. char *yytext;
  468. #line 1 "lex.l"
  469. #define INITIAL 0
  470. /* Lexical analysis for genksyms.
  471.    Copyright 1996, 1997 Linux International.
  472.  
  473.    New implementation contributed by Richard Henderson <rth@tamu.edu>
  474.    Based on original work by Bjorn Eckwall <bj0rn@blox.se>
  475.  
  476.    This file is part of the Linux modutils.
  477.  
  478.    This program is free software; you can redistribute it and/or modify it
  479.    under the terms of the GNU General Public License as published by the
  480.    Free Software Foundation; either version 2 of the License, or (at your
  481.    option) any later version.
  482.  
  483.    This program is distributed in the hope that it will be useful, but
  484.    WITHOUT ANY WARRANTY; without even the implied warranty of
  485.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  486.    General Public License for more details.
  487.  
  488.    You should have received a copy of the GNU General Public License
  489.    along with this program; if not, write to the Free Software Foundation,
  490.    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  491. #line 25 "lex.l"
  492. #ident "$Id: lex.c,v 1.1.1.1 1998/01/06 20:51:07 ewt Exp $"
  493.  
  494. #include <stdlib.h>
  495. #include <string.h>
  496. #include <ctype.h>
  497.  
  498. #include "genksyms.h"
  499. #include "parse.h"
  500. #include "util.h"
  501.  
  502. /* We've got a two-level lexer here.  We let flex do basic tokenization
  503.    and then we categorize those basic tokens in the second stage.  */
  504. #define YY_DECL        static int yylex1(void)
  505.  
  506. /* Version 2 checksumming does proper tokenization; version 1 wasn't
  507.    quite so pedantic.  */
  508. #define V2_TOKENS 1
  509.  
  510. /* We don't do multiple input files.  */
  511. #line 512 "lex.c"
  512.  
  513. /* Macros after this point can all be overridden by user definitions in
  514.  * section 1.
  515.  */
  516.  
  517. #ifndef YY_SKIP_YYWRAP
  518. #ifdef __cplusplus
  519. extern "C" int yywrap YY_PROTO(( void ));
  520. #else
  521. extern int yywrap YY_PROTO(( void ));
  522. #endif
  523. #endif
  524.  
  525. #ifndef YY_NO_UNPUT
  526. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  527. #endif
  528.  
  529. #ifndef yytext_ptr
  530. static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
  531. #endif
  532.  
  533. #ifdef YY_NEED_STRLEN
  534. static int yy_flex_strlen YY_PROTO(( yyconst char * ));
  535. #endif
  536.  
  537. #ifndef YY_NO_INPUT
  538. #ifdef __cplusplus
  539. static int yyinput YY_PROTO(( void ));
  540. #else
  541. static int input YY_PROTO(( void ));
  542. #endif
  543. #endif
  544.  
  545. #if YY_STACK_USED
  546. static int yy_start_stack_ptr = 0;
  547. static int yy_start_stack_depth = 0;
  548. static int *yy_start_stack = 0;
  549. #ifndef YY_NO_PUSH_STATE
  550. static void yy_push_state YY_PROTO(( int new_state ));
  551. #endif
  552. #ifndef YY_NO_POP_STATE
  553. static void yy_pop_state YY_PROTO(( void ));
  554. #endif
  555. #ifndef YY_NO_TOP_STATE
  556. static int yy_top_state YY_PROTO(( void ));
  557. #endif
  558.  
  559. #else
  560. #define YY_NO_PUSH_STATE 1
  561. #define YY_NO_POP_STATE 1
  562. #define YY_NO_TOP_STATE 1
  563. #endif
  564.  
  565. #ifdef YY_MALLOC_DECL
  566. YY_MALLOC_DECL
  567. #else
  568. #if __STDC__
  569. #ifndef __cplusplus
  570. #include <stdlib.h>
  571. #endif
  572. #else
  573. /* Just try to get by without declaring the routines.  This will fail
  574.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  575.  * or sizeof(void*) != sizeof(int).
  576.  */
  577. #endif
  578. #endif
  579.  
  580. /* Amount of stuff to slurp up with each read. */
  581. #ifndef YY_READ_BUF_SIZE
  582. #define YY_READ_BUF_SIZE 8192
  583. #endif
  584.  
  585. /* Copy whatever the last rule matched to the standard output. */
  586.  
  587. #ifndef ECHO
  588. /* This used to be an fputs(), but since the string might contain NUL's,
  589.  * we now use fwrite().
  590.  */
  591. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  592. #endif
  593.  
  594. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  595.  * is returned in "result".
  596.  */
  597. #ifndef YY_INPUT
  598. #define YY_INPUT(buf,result,max_size) \
  599.     if ( yy_current_buffer->yy_is_interactive ) \
  600.         { \
  601.         int c = '*', n; \
  602.         for ( n = 0; n < max_size && \
  603.                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  604.             buf[n] = (char) c; \
  605.         if ( c == '\n' ) \
  606.             buf[n++] = (char) c; \
  607.         if ( c == EOF && ferror( yyin ) ) \
  608.             YY_FATAL_ERROR( "input in flex scanner failed" ); \
  609.         result = n; \
  610.         } \
  611.     else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
  612.           && ferror( yyin ) ) \
  613.         YY_FATAL_ERROR( "input in flex scanner failed" );
  614. #endif
  615.  
  616. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  617.  * we don't want an extra ';' after the "return" because that will cause
  618.  * some compilers to complain about unreachable statements.
  619.  */
  620. #ifndef yyterminate
  621. #define yyterminate() return YY_NULL
  622. #endif
  623.  
  624. /* Number of entries by which start-condition stack grows. */
  625. #ifndef YY_START_STACK_INCR
  626. #define YY_START_STACK_INCR 25
  627. #endif
  628.  
  629. /* Report a fatal error. */
  630. #ifndef YY_FATAL_ERROR
  631. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  632. #endif
  633.  
  634. /* Default declaration of generated scanner - a define so the user can
  635.  * easily add parameters.
  636.  */
  637. #ifndef YY_DECL
  638. #define YY_DECL int yylex YY_PROTO(( void ))
  639. #endif
  640.  
  641. /* Code executed at the beginning of each rule, after yytext and yyleng
  642.  * have been set up.
  643.  */
  644. #ifndef YY_USER_ACTION
  645. #define YY_USER_ACTION
  646. #endif
  647.  
  648. /* Code executed at the end of each rule. */
  649. #ifndef YY_BREAK
  650. #define YY_BREAK break;
  651. #endif
  652.  
  653. #define YY_RULE_SETUP \
  654.     if ( yyleng > 0 ) \
  655.         yy_current_buffer->yy_at_bol = \
  656.                 (yytext[yyleng - 1] == '\n'); \
  657.     YY_USER_ACTION
  658.  
  659. YY_DECL
  660.     {
  661.     register yy_state_type yy_current_state;
  662.     register char *yy_cp, *yy_bp;
  663.     register int yy_act;
  664.  
  665. #line 66 "lex.l"
  666.  
  667.  
  668.  
  669.  /* Keep track of our location in the original source files.  */
  670. #line 671 "lex.c"
  671.  
  672.     if ( yy_init )
  673.         {
  674.         yy_init = 0;
  675.  
  676. #ifdef YY_USER_INIT
  677.         YY_USER_INIT;
  678. #endif
  679.  
  680.         if ( ! yy_start )
  681.             yy_start = 1;    /* first start state */
  682.  
  683.         if ( ! yyin )
  684.             yyin = stdin;
  685.  
  686.         if ( ! yyout )
  687.             yyout = stdout;
  688.  
  689.         if ( ! yy_current_buffer )
  690.             yy_current_buffer =
  691.                 yy_create_buffer( yyin, YY_BUF_SIZE );
  692.  
  693.         yy_load_buffer_state();
  694.         }
  695.  
  696.     while ( 1 )        /* loops until end-of-file is reached */
  697.         {
  698.         yy_cp = yy_c_buf_p;
  699.  
  700.         /* Support of yytext. */
  701.         *yy_cp = yy_hold_char;
  702.  
  703.         /* yy_bp points to the position in yy_ch_buf of the start of
  704.          * the current run.
  705.          */
  706.         yy_bp = yy_cp;
  707.  
  708.         yy_current_state = yy_start;
  709.         yy_current_state += YY_AT_BOL();
  710. yy_match:
  711.         do
  712.             {
  713.             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  714.             if ( yy_accept[yy_current_state] )
  715.                 {
  716.                 yy_last_accepting_state = yy_current_state;
  717.                 yy_last_accepting_cpos = yy_cp;
  718.                 }
  719.             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  720.                 {
  721.                 yy_current_state = (int) yy_def[yy_current_state];
  722.                 if ( yy_current_state >= 76 )
  723.                     yy_c = yy_meta[(unsigned int) yy_c];
  724.                 }
  725.             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  726.             ++yy_cp;
  727.             }
  728.         while ( yy_base[yy_current_state] != 282 );
  729.  
  730. yy_find_action:
  731.         yy_act = yy_accept[yy_current_state];
  732.         if ( yy_act == 0 )
  733.             { /* have to back up */
  734.             yy_cp = yy_last_accepting_cpos;
  735.             yy_current_state = yy_last_accepting_state;
  736.             yy_act = yy_accept[yy_current_state];
  737.             }
  738.  
  739.         YY_DO_BEFORE_ACTION;
  740.  
  741.  
  742. do_action:    /* This label is used only to access EOF actions. */
  743.  
  744.         if ( yy_flex_debug )
  745.             {
  746.             if ( yy_act == 0 )
  747.                 fprintf( stderr, "--scanner backing up\n" );
  748.             else if ( yy_act < 13 )
  749.                 fprintf( stderr, "--accepting rule at line %d (\"%s\")\n",
  750.                          yy_rule_linenum[yy_act], yytext );
  751.             else if ( yy_act == 13 )
  752.                 fprintf( stderr, "--accepting default rule (\"%s\")\n",
  753.                          yytext );
  754.             else if ( yy_act == 14 )
  755.                 fprintf( stderr, "--(end of buffer or a NUL)\n" );
  756.             else
  757.                 fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
  758.             }
  759.  
  760.         switch ( yy_act )
  761.     { /* beginning of action switch */
  762.             case 0: /* must back up */
  763.             /* undo the effects of YY_DO_BEFORE_ACTION */
  764.             *yy_cp = yy_hold_char;
  765.             yy_cp = yy_last_accepting_cpos;
  766.             yy_current_state = yy_last_accepting_state;
  767.             goto yy_find_action;
  768.  
  769. case 1:
  770. YY_RULE_SETUP
  771. #line 70 "lex.l"
  772. return FILENAME;
  773.     YY_BREAK
  774. case 2:
  775. YY_RULE_SETUP
  776. #line 71 "lex.l"
  777. cur_line++;
  778.     YY_BREAK
  779. case 3:
  780. YY_RULE_SETUP
  781. #line 72 "lex.l"
  782. cur_line++;
  783.     YY_BREAK
  784. /* Ignore all other whitespace.  */
  785. case 4:
  786. YY_RULE_SETUP
  787. #line 75 "lex.l"
  788. ;
  789.     YY_BREAK
  790. case 5:
  791. YY_RULE_SETUP
  792. #line 78 "lex.l"
  793. return STRING;
  794.     YY_BREAK
  795. case 6:
  796. YY_RULE_SETUP
  797. #line 79 "lex.l"
  798. return CHAR;
  799.     YY_BREAK
  800. case 7:
  801. YY_RULE_SETUP
  802. #line 80 "lex.l"
  803. return IDENT;
  804.     YY_BREAK
  805. /* The Pedant requires that the other C multi-character tokens be
  806.     recognized as tokens.  We don't actually use them since we don't
  807.     parse expressions, but we do want whitespace to be arranged
  808.     around them properly.  */
  809. case 8:
  810. YY_RULE_SETUP
  811. #line 86 "lex.l"
  812. return OTHER;
  813.     YY_BREAK
  814. case 9:
  815. YY_RULE_SETUP
  816. #line 87 "lex.l"
  817. return INT;
  818.     YY_BREAK
  819. case 10:
  820. YY_RULE_SETUP
  821. #line 88 "lex.l"
  822. return REAL;
  823.     YY_BREAK
  824. /* Version 1 checksums didn't recognize ellipsis as a token, but we
  825.     need it for proper parsing.  We'll take care of backward compatibility
  826.     by altering the text of the token in the second stage lexer.  */
  827. case 11:
  828. YY_RULE_SETUP
  829. #line 93 "lex.l"
  830. return DOTS;
  831.     YY_BREAK
  832. /* All other tokens are single characters.  */
  833. case 12:
  834. YY_RULE_SETUP
  835. #line 96 "lex.l"
  836. return yytext[0];
  837.     YY_BREAK
  838. case 13:
  839. YY_RULE_SETUP
  840. #line 99 "lex.l"
  841. ECHO;
  842.     YY_BREAK
  843. #line 844 "lex.c"
  844. case YY_STATE_EOF(INITIAL):
  845. case YY_STATE_EOF(V2_TOKENS):
  846.     yyterminate();
  847.  
  848.     case YY_END_OF_BUFFER:
  849.         {
  850.         /* Amount of text matched not including the EOB char. */
  851.         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
  852.  
  853.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  854.         *yy_cp = yy_hold_char;
  855.         YY_RESTORE_YY_MORE_OFFSET
  856.  
  857.         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  858.             {
  859.             /* We're scanning a new file or input source.  It's
  860.              * possible that this happened because the user
  861.              * just pointed yyin at a new source and called
  862.              * yylex().  If so, then we have to assure
  863.              * consistency between yy_current_buffer and our
  864.              * globals.  Here is the right place to do so, because
  865.              * this is the first action (other than possibly a
  866.              * back-up) that will match for the new input source.
  867.              */
  868.             yy_n_chars = yy_current_buffer->yy_n_chars;
  869.             yy_current_buffer->yy_input_file = yyin;
  870.             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  871.             }
  872.  
  873.         /* Note that here we test for yy_c_buf_p "<=" to the position
  874.          * of the first EOB in the buffer, since yy_c_buf_p will
  875.          * already have been incremented past the NUL character
  876.          * (since all states make transitions on EOB to the
  877.          * end-of-buffer state).  Contrast this with the test
  878.          * in input().
  879.          */
  880.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  881.             { /* This was really a NUL. */
  882.             yy_state_type yy_next_state;
  883.  
  884.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  885.  
  886.             yy_current_state = yy_get_previous_state();
  887.  
  888.             /* Okay, we're now positioned to make the NUL
  889.              * transition.  We couldn't have
  890.              * yy_get_previous_state() go ahead and do it
  891.              * for us because it doesn't know how to deal
  892.              * with the possibility of jamming (and we don't
  893.              * want to build jamming into it because then it
  894.              * will run more slowly).
  895.              */
  896.  
  897.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  898.  
  899.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  900.  
  901.             if ( yy_next_state )
  902.                 {
  903.                 /* Consume the NUL. */
  904.                 yy_cp = ++yy_c_buf_p;
  905.                 yy_current_state = yy_next_state;
  906.                 goto yy_match;
  907.                 }
  908.  
  909.             else
  910.                 {
  911.                 yy_cp = yy_c_buf_p;
  912.                 goto yy_find_action;
  913.                 }
  914.             }
  915.  
  916.         else switch ( yy_get_next_buffer() )
  917.             {
  918.             case EOB_ACT_END_OF_FILE:
  919.                 {
  920.                 yy_did_buffer_switch_on_eof = 0;
  921.  
  922.                 if ( yywrap() )
  923.                     {
  924.                     /* Note: because we've taken care in
  925.                      * yy_get_next_buffer() to have set up
  926.                      * yytext, we can now set up
  927.                      * yy_c_buf_p so that if some total
  928.                      * hoser (like flex itself) wants to
  929.                      * call the scanner after we return the
  930.                      * YY_NULL, it'll still work - another
  931.                      * YY_NULL will get returned.
  932.                      */
  933.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  934.  
  935.                     yy_act = YY_STATE_EOF(YY_START);
  936.                     goto do_action;
  937.                     }
  938.  
  939.                 else
  940.                     {
  941.                     if ( ! yy_did_buffer_switch_on_eof )
  942.                         YY_NEW_FILE;
  943.                     }
  944.                 break;
  945.                 }
  946.  
  947.             case EOB_ACT_CONTINUE_SCAN:
  948.                 yy_c_buf_p =
  949.                     yytext_ptr + yy_amount_of_matched_text;
  950.  
  951.                 yy_current_state = yy_get_previous_state();
  952.  
  953.                 yy_cp = yy_c_buf_p;
  954.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  955.                 goto yy_match;
  956.  
  957.             case EOB_ACT_LAST_MATCH:
  958.                 yy_c_buf_p =
  959.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  960.  
  961.                 yy_current_state = yy_get_previous_state();
  962.  
  963.                 yy_cp = yy_c_buf_p;
  964.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  965.                 goto yy_find_action;
  966.             }
  967.         break;
  968.         }
  969.  
  970.     default:
  971.         YY_FATAL_ERROR(
  972.             "fatal flex scanner internal error--no action found" );
  973.     } /* end of action switch */
  974.         } /* end of scanning one token */
  975.     } /* end of yylex */
  976.  
  977.  
  978. /* yy_get_next_buffer - try to read in a new buffer
  979.  *
  980.  * Returns a code representing an action:
  981.  *    EOB_ACT_LAST_MATCH -
  982.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  983.  *    EOB_ACT_END_OF_FILE - end of file
  984.  */
  985.  
  986. static int yy_get_next_buffer()
  987.     {
  988.     register char *dest = yy_current_buffer->yy_ch_buf;
  989.     register char *source = yytext_ptr;
  990.     register int number_to_move, i;
  991.     int ret_val;
  992.  
  993.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  994.         YY_FATAL_ERROR(
  995.         "fatal flex scanner internal error--end of buffer missed" );
  996.  
  997.     if ( yy_current_buffer->yy_fill_buffer == 0 )
  998.         { /* Don't try to fill the buffer, so this is an EOF. */
  999.         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  1000.             {
  1001.             /* We matched a single character, the EOB, so
  1002.              * treat this as a final EOF.
  1003.              */
  1004.             return EOB_ACT_END_OF_FILE;
  1005.             }
  1006.  
  1007.         else
  1008.             {
  1009.             /* We matched some text prior to the EOB, first
  1010.              * process it.
  1011.              */
  1012.             return EOB_ACT_LAST_MATCH;
  1013.             }
  1014.         }
  1015.  
  1016.     /* Try to read more data. */
  1017.  
  1018.     /* First move last chars to start of buffer. */
  1019.     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
  1020.  
  1021.     for ( i = 0; i < number_to_move; ++i )
  1022.         *(dest++) = *(source++);
  1023.  
  1024.     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1025.         /* don't do the read, it's not guaranteed to return an EOF,
  1026.          * just force an EOF
  1027.          */
  1028.         yy_n_chars = 0;
  1029.  
  1030.     else
  1031.         {
  1032.         int num_to_read =
  1033.             yy_current_buffer->yy_buf_size - number_to_move - 1;
  1034.  
  1035.         while ( num_to_read <= 0 )
  1036.             { /* Not enough room in the buffer - grow it. */
  1037. #ifdef YY_USES_REJECT
  1038.             YY_FATAL_ERROR(
  1039. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  1040. #else
  1041.  
  1042.             /* just a shorter name for the current buffer */
  1043.             YY_BUFFER_STATE b = yy_current_buffer;
  1044.  
  1045.             int yy_c_buf_p_offset =
  1046.                 (int) (yy_c_buf_p - b->yy_ch_buf);
  1047.  
  1048.             if ( b->yy_is_our_buffer )
  1049.                 {
  1050.                 int new_size = b->yy_buf_size * 2;
  1051.  
  1052.                 if ( new_size <= 0 )
  1053.                     b->yy_buf_size += b->yy_buf_size / 8;
  1054.                 else
  1055.                     b->yy_buf_size *= 2;
  1056.  
  1057.                 b->yy_ch_buf = (char *)
  1058.                     /* Include room in for 2 EOB chars. */
  1059.                     yy_flex_realloc( (void *) b->yy_ch_buf,
  1060.                              b->yy_buf_size + 2 );
  1061.                 }
  1062.             else
  1063.                 /* Can't grow it, we don't own it. */
  1064.                 b->yy_ch_buf = 0;
  1065.  
  1066.             if ( ! b->yy_ch_buf )
  1067.                 YY_FATAL_ERROR(
  1068.                 "fatal error - scanner input buffer overflow" );
  1069.  
  1070.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  1071.  
  1072.             num_to_read = yy_current_buffer->yy_buf_size -
  1073.                         number_to_move - 1;
  1074. #endif
  1075.             }
  1076.  
  1077.         if ( num_to_read > YY_READ_BUF_SIZE )
  1078.             num_to_read = YY_READ_BUF_SIZE;
  1079.  
  1080.         /* Read in more data. */
  1081.         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  1082.             yy_n_chars, num_to_read );
  1083.         }
  1084.  
  1085.     if ( yy_n_chars == 0 )
  1086.         {
  1087.         if ( number_to_move == YY_MORE_ADJ )
  1088.             {
  1089.             ret_val = EOB_ACT_END_OF_FILE;
  1090.             yyrestart( yyin );
  1091.             }
  1092.  
  1093.         else
  1094.             {
  1095.             ret_val = EOB_ACT_LAST_MATCH;
  1096.             yy_current_buffer->yy_buffer_status =
  1097.                 YY_BUFFER_EOF_PENDING;
  1098.             }
  1099.         }
  1100.  
  1101.     else
  1102.         ret_val = EOB_ACT_CONTINUE_SCAN;
  1103.  
  1104.     yy_n_chars += number_to_move;
  1105.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1106.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1107.  
  1108.     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
  1109.  
  1110.     return ret_val;
  1111.     }
  1112.  
  1113.  
  1114. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1115.  
  1116. static yy_state_type yy_get_previous_state()
  1117.     {
  1118.     register yy_state_type yy_current_state;
  1119.     register char *yy_cp;
  1120.  
  1121.     yy_current_state = yy_start;
  1122.     yy_current_state += YY_AT_BOL();
  1123.  
  1124.     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  1125.         {
  1126.         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1127.         if ( yy_accept[yy_current_state] )
  1128.             {
  1129.             yy_last_accepting_state = yy_current_state;
  1130.             yy_last_accepting_cpos = yy_cp;
  1131.             }
  1132.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1133.             {
  1134.             yy_current_state = (int) yy_def[yy_current_state];
  1135.             if ( yy_current_state >= 76 )
  1136.                 yy_c = yy_meta[(unsigned int) yy_c];
  1137.             }
  1138.         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1139.         }
  1140.  
  1141.     return yy_current_state;
  1142.     }
  1143.  
  1144.  
  1145. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1146.  *
  1147.  * synopsis
  1148.  *    next_state = yy_try_NUL_trans( current_state );
  1149.  */
  1150.  
  1151. #ifdef YY_USE_PROTOS
  1152. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  1153. #else
  1154. static yy_state_type yy_try_NUL_trans( yy_current_state )
  1155. yy_state_type yy_current_state;
  1156. #endif
  1157.     {
  1158.     register int yy_is_jam;
  1159.     register char *yy_cp = yy_c_buf_p;
  1160.  
  1161.     register YY_CHAR yy_c = 1;
  1162.     if ( yy_accept[yy_current_state] )
  1163.         {
  1164.         yy_last_accepting_state = yy_current_state;
  1165.         yy_last_accepting_cpos = yy_cp;
  1166.         }
  1167.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1168.         {
  1169.         yy_current_state = (int) yy_def[yy_current_state];
  1170.         if ( yy_current_state >= 76 )
  1171.             yy_c = yy_meta[(unsigned int) yy_c];
  1172.         }
  1173.     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1174.     yy_is_jam = (yy_current_state == 75);
  1175.  
  1176.     return yy_is_jam ? 0 : yy_current_state;
  1177.     }
  1178.  
  1179.  
  1180. #ifndef YY_NO_UNPUT
  1181. #ifdef YY_USE_PROTOS
  1182. static void yyunput( int c, register char *yy_bp )
  1183. #else
  1184. static void yyunput( c, yy_bp )
  1185. int c;
  1186. register char *yy_bp;
  1187. #endif
  1188.     {
  1189.     register char *yy_cp = yy_c_buf_p;
  1190.  
  1191.     /* undo effects of setting up yytext */
  1192.     *yy_cp = yy_hold_char;
  1193.  
  1194.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1195.         { /* need to shift things up to make room */
  1196.         /* +2 for EOB chars. */
  1197.         register int number_to_move = yy_n_chars + 2;
  1198.         register char *dest = &yy_current_buffer->yy_ch_buf[
  1199.                     yy_current_buffer->yy_buf_size + 2];
  1200.         register char *source =
  1201.                 &yy_current_buffer->yy_ch_buf[number_to_move];
  1202.  
  1203.         while ( source > yy_current_buffer->yy_ch_buf )
  1204.             *--dest = *--source;
  1205.  
  1206.         yy_cp += (int) (dest - source);
  1207.         yy_bp += (int) (dest - source);
  1208.         yy_n_chars = yy_current_buffer->yy_buf_size;
  1209.  
  1210.         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1211.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1212.         }
  1213.  
  1214.     *--yy_cp = (char) c;
  1215.  
  1216.  
  1217.     yytext_ptr = yy_bp;
  1218.     yy_hold_char = *yy_cp;
  1219.     yy_c_buf_p = yy_cp;
  1220.     }
  1221. #endif    /* ifndef YY_NO_UNPUT */
  1222.  
  1223.  
  1224. #ifdef __cplusplus
  1225. static int yyinput()
  1226. #else
  1227. static int input()
  1228. #endif
  1229.     {
  1230.     int c;
  1231.  
  1232.     *yy_c_buf_p = yy_hold_char;
  1233.  
  1234.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1235.         {
  1236.         /* yy_c_buf_p now points to the character we want to return.
  1237.          * If this occurs *before* the EOB characters, then it's a
  1238.          * valid NUL; if not, then we've hit the end of the buffer.
  1239.          */
  1240.         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1241.             /* This was really a NUL. */
  1242.             *yy_c_buf_p = '\0';
  1243.  
  1244.         else
  1245.             { /* need more input */
  1246.             int offset = yy_c_buf_p - yytext_ptr;
  1247.             ++yy_c_buf_p;
  1248.  
  1249.             switch ( yy_get_next_buffer() )
  1250.                 {
  1251.                 case EOB_ACT_END_OF_FILE:
  1252.                     {
  1253.                     if ( yywrap() )
  1254.                         {
  1255.                         yy_c_buf_p = yytext_ptr + offset;
  1256.                         return EOF;
  1257.                         }
  1258.  
  1259.                     if ( ! yy_did_buffer_switch_on_eof )
  1260.                         YY_NEW_FILE;
  1261. #ifdef __cplusplus
  1262.                     return yyinput();
  1263. #else
  1264.                     return input();
  1265. #endif
  1266.                     }
  1267.  
  1268.                 case EOB_ACT_CONTINUE_SCAN:
  1269.                     yy_c_buf_p = yytext_ptr + offset;
  1270.                     break;
  1271.  
  1272.                 case EOB_ACT_LAST_MATCH:
  1273. #ifdef __cplusplus
  1274.                     YY_FATAL_ERROR(
  1275.                     "unexpected last match in yyinput()" );
  1276. #else
  1277.                     YY_FATAL_ERROR(
  1278.                     "unexpected last match in input()" );
  1279. #endif
  1280.                 }
  1281.             }
  1282.         }
  1283.  
  1284.     c = *(unsigned char *) yy_c_buf_p;    /* cast for 8-bit char's */
  1285.     *yy_c_buf_p = '\0';    /* preserve yytext */
  1286.     yy_hold_char = *++yy_c_buf_p;
  1287.  
  1288.     yy_current_buffer->yy_at_bol = (c == '\n');
  1289.  
  1290.     return c;
  1291.     }
  1292.  
  1293.  
  1294. #ifdef YY_USE_PROTOS
  1295. void yyrestart( FILE *input_file )
  1296. #else
  1297. void yyrestart( input_file )
  1298. FILE *input_file;
  1299. #endif
  1300.     {
  1301.     if ( ! yy_current_buffer )
  1302.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  1303.  
  1304.     yy_init_buffer( yy_current_buffer, input_file );
  1305.     yy_load_buffer_state();
  1306.     }
  1307.  
  1308.  
  1309. #ifdef YY_USE_PROTOS
  1310. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1311. #else
  1312. void yy_switch_to_buffer( new_buffer )
  1313. YY_BUFFER_STATE new_buffer;
  1314. #endif
  1315.     {
  1316.     if ( yy_current_buffer == new_buffer )
  1317.         return;
  1318.  
  1319.     if ( yy_current_buffer )
  1320.         {
  1321.         /* Flush out information for old buffer. */
  1322.         *yy_c_buf_p = yy_hold_char;
  1323.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1324.         yy_current_buffer->yy_n_chars = yy_n_chars;
  1325.         }
  1326.  
  1327.     yy_current_buffer = new_buffer;
  1328.     yy_load_buffer_state();
  1329.  
  1330.     /* We don't actually know whether we did this switch during
  1331.      * EOF (yywrap()) processing, but the only time this flag
  1332.      * is looked at is after yywrap() is called, so it's safe
  1333.      * to go ahead and always set it.
  1334.      */
  1335.     yy_did_buffer_switch_on_eof = 1;
  1336.     }
  1337.  
  1338.  
  1339. #ifdef YY_USE_PROTOS
  1340. void yy_load_buffer_state( void )
  1341. #else
  1342. void yy_load_buffer_state()
  1343. #endif
  1344.     {
  1345.     yy_n_chars = yy_current_buffer->yy_n_chars;
  1346.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1347.     yyin = yy_current_buffer->yy_input_file;
  1348.     yy_hold_char = *yy_c_buf_p;
  1349.     }
  1350.  
  1351.  
  1352. #ifdef YY_USE_PROTOS
  1353. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  1354. #else
  1355. YY_BUFFER_STATE yy_create_buffer( file, size )
  1356. FILE *file;
  1357. int size;
  1358. #endif
  1359.     {
  1360.     YY_BUFFER_STATE b;
  1361.  
  1362.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1363.     if ( ! b )
  1364.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1365.  
  1366.     b->yy_buf_size = size;
  1367.  
  1368.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1369.      * we need to put in 2 end-of-buffer characters.
  1370.      */
  1371.     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  1372.     if ( ! b->yy_ch_buf )
  1373.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1374.  
  1375.     b->yy_is_our_buffer = 1;
  1376.  
  1377.     yy_init_buffer( b, file );
  1378.  
  1379.     return b;
  1380.     }
  1381.  
  1382.  
  1383. #ifdef YY_USE_PROTOS
  1384. void yy_delete_buffer( YY_BUFFER_STATE b )
  1385. #else
  1386. void yy_delete_buffer( b )
  1387. YY_BUFFER_STATE b;
  1388. #endif
  1389.     {
  1390.     if ( ! b )
  1391.         return;
  1392.  
  1393.     if ( b == yy_current_buffer )
  1394.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  1395.  
  1396.     if ( b->yy_is_our_buffer )
  1397.         yy_flex_free( (void *) b->yy_ch_buf );
  1398.  
  1399.     yy_flex_free( (void *) b );
  1400.     }
  1401.  
  1402.  
  1403. #ifndef YY_ALWAYS_INTERACTIVE
  1404. #ifndef YY_NEVER_INTERACTIVE
  1405. extern int isatty YY_PROTO(( int ));
  1406. #endif
  1407. #endif
  1408.  
  1409. #ifdef YY_USE_PROTOS
  1410. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1411. #else
  1412. void yy_init_buffer( b, file )
  1413. YY_BUFFER_STATE b;
  1414. FILE *file;
  1415. #endif
  1416.  
  1417.  
  1418.     {
  1419.     yy_flush_buffer( b );
  1420.  
  1421.     b->yy_input_file = file;
  1422.     b->yy_fill_buffer = 1;
  1423.  
  1424. #if YY_ALWAYS_INTERACTIVE
  1425.     b->yy_is_interactive = 1;
  1426. #else
  1427. #if YY_NEVER_INTERACTIVE
  1428.     b->yy_is_interactive = 0;
  1429. #else
  1430.     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1431. #endif
  1432. #endif
  1433.     }
  1434.  
  1435.  
  1436. #ifdef YY_USE_PROTOS
  1437. void yy_flush_buffer( YY_BUFFER_STATE b )
  1438. #else
  1439. void yy_flush_buffer( b )
  1440. YY_BUFFER_STATE b;
  1441. #endif
  1442.  
  1443.     {
  1444.     b->yy_n_chars = 0;
  1445.  
  1446.     /* We always need two end-of-buffer characters.  The first causes
  1447.      * a transition to the end-of-buffer state.  The second causes
  1448.      * a jam in that state.
  1449.      */
  1450.     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1451.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1452.  
  1453.     b->yy_buf_pos = &b->yy_ch_buf[0];
  1454.  
  1455.     b->yy_at_bol = 1;
  1456.     b->yy_buffer_status = YY_BUFFER_NEW;
  1457.  
  1458.     if ( b == yy_current_buffer )
  1459.         yy_load_buffer_state();
  1460.     }
  1461.  
  1462.  
  1463. #ifndef YY_NO_SCAN_BUFFER
  1464. #ifdef YY_USE_PROTOS
  1465. YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
  1466. #else
  1467. YY_BUFFER_STATE yy_scan_buffer( base, size )
  1468. char *base;
  1469. yy_size_t size;
  1470. #endif
  1471.     {
  1472.     YY_BUFFER_STATE b;
  1473.  
  1474.     if ( size < 2 ||
  1475.          base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1476.          base[size-1] != YY_END_OF_BUFFER_CHAR )
  1477.         /* They forgot to leave room for the EOB's. */
  1478.         return 0;
  1479.  
  1480.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1481.     if ( ! b )
  1482.         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1483.  
  1484.     b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
  1485.     b->yy_buf_pos = b->yy_ch_buf = base;
  1486.     b->yy_is_our_buffer = 0;
  1487.     b->yy_input_file = 0;
  1488.     b->yy_n_chars = b->yy_buf_size;
  1489.     b->yy_is_interactive = 0;
  1490.     b->yy_at_bol = 1;
  1491.     b->yy_fill_buffer = 0;
  1492.     b->yy_buffer_status = YY_BUFFER_NEW;
  1493.  
  1494.     yy_switch_to_buffer( b );
  1495.  
  1496.     return b;
  1497.     }
  1498. #endif
  1499.  
  1500.  
  1501. #ifndef YY_NO_SCAN_STRING
  1502. #ifdef YY_USE_PROTOS
  1503. YY_BUFFER_STATE yy_scan_string( yyconst char *str )
  1504. #else
  1505. YY_BUFFER_STATE yy_scan_string( str )
  1506. yyconst char *str;
  1507. #endif
  1508.     {
  1509.     int len;
  1510.     for ( len = 0; str[len]; ++len )
  1511.         ;
  1512.  
  1513.     return yy_scan_bytes( str, len );
  1514.     }
  1515. #endif
  1516.  
  1517.  
  1518. #ifndef YY_NO_SCAN_BYTES
  1519. #ifdef YY_USE_PROTOS
  1520. YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
  1521. #else
  1522. YY_BUFFER_STATE yy_scan_bytes( bytes, len )
  1523. yyconst char *bytes;
  1524. int len;
  1525. #endif
  1526.     {
  1527.     YY_BUFFER_STATE b;
  1528.     char *buf;
  1529.     yy_size_t n;
  1530.     int i;
  1531.  
  1532.     /* Get memory for full buffer, including space for trailing EOB's. */
  1533.     n = len + 2;
  1534.     buf = (char *) yy_flex_alloc( n );
  1535.     if ( ! buf )
  1536.         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1537.  
  1538.     for ( i = 0; i < len; ++i )
  1539.         buf[i] = bytes[i];
  1540.  
  1541.     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1542.  
  1543.     b = yy_scan_buffer( buf, n );
  1544.     if ( ! b )
  1545.         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1546.  
  1547.     /* It's okay to grow etc. this buffer, and we should throw it
  1548.      * away when we're done.
  1549.      */
  1550.     b->yy_is_our_buffer = 1;
  1551.  
  1552.     return b;
  1553.     }
  1554. #endif
  1555.  
  1556.  
  1557. #ifndef YY_NO_PUSH_STATE
  1558. #ifdef YY_USE_PROTOS
  1559. static void yy_push_state( int new_state )
  1560. #else
  1561. static void yy_push_state( new_state )
  1562. int new_state;
  1563. #endif
  1564.     {
  1565.     if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1566.         {
  1567.         yy_size_t new_size;
  1568.  
  1569.         yy_start_stack_depth += YY_START_STACK_INCR;
  1570.         new_size = yy_start_stack_depth * sizeof( int );
  1571.  
  1572.         if ( ! yy_start_stack )
  1573.             yy_start_stack = (int *) yy_flex_alloc( new_size );
  1574.  
  1575.         else
  1576.             yy_start_stack = (int *) yy_flex_realloc(
  1577.                     (void *) yy_start_stack, new_size );
  1578.  
  1579.         if ( ! yy_start_stack )
  1580.             YY_FATAL_ERROR(
  1581.             "out of memory expanding start-condition stack" );
  1582.         }
  1583.  
  1584.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1585.  
  1586.     BEGIN(new_state);
  1587.     }
  1588. #endif
  1589.  
  1590.  
  1591. #ifndef YY_NO_POP_STATE
  1592. static void yy_pop_state()
  1593.     {
  1594.     if ( --yy_start_stack_ptr < 0 )
  1595.         YY_FATAL_ERROR( "start-condition stack underflow" );
  1596.  
  1597.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1598.     }
  1599. #endif
  1600.  
  1601.  
  1602. #ifndef YY_NO_TOP_STATE
  1603. static int yy_top_state()
  1604.     {
  1605.     return yy_start_stack[yy_start_stack_ptr - 1];
  1606.     }
  1607. #endif
  1608.  
  1609. #ifndef YY_EXIT_FAILURE
  1610. #define YY_EXIT_FAILURE 2
  1611. #endif
  1612.  
  1613. #ifdef YY_USE_PROTOS
  1614. static void yy_fatal_error( yyconst char msg[] )
  1615. #else
  1616. static void yy_fatal_error( msg )
  1617. char msg[];
  1618. #endif
  1619.     {
  1620.     (void) fprintf( stderr, "%s\n", msg );
  1621.     exit( YY_EXIT_FAILURE );
  1622.     }
  1623.  
  1624.  
  1625.  
  1626. /* Redefine yyless() so it works in section 3 code. */
  1627.  
  1628. #undef yyless
  1629. #define yyless(n) \
  1630.     do \
  1631.         { \
  1632.         /* Undo effects of setting up yytext. */ \
  1633.         yytext[yyleng] = yy_hold_char; \
  1634.         yy_c_buf_p = yytext + n; \
  1635.         yy_hold_char = *yy_c_buf_p; \
  1636.         *yy_c_buf_p = '\0'; \
  1637.         yyleng = n; \
  1638.         } \
  1639.     while ( 0 )
  1640.  
  1641.  
  1642. /* Internal utility routines. */
  1643.  
  1644. #ifndef yytext_ptr
  1645. #ifdef YY_USE_PROTOS
  1646. static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
  1647. #else
  1648. static void yy_flex_strncpy( s1, s2, n )
  1649. char *s1;
  1650. yyconst char *s2;
  1651. int n;
  1652. #endif
  1653.     {
  1654.     register int i;
  1655.     for ( i = 0; i < n; ++i )
  1656.         s1[i] = s2[i];
  1657.     }
  1658. #endif
  1659.  
  1660. #ifdef YY_NEED_STRLEN
  1661. #ifdef YY_USE_PROTOS
  1662. static int yy_flex_strlen( yyconst char *s )
  1663. #else
  1664. static int yy_flex_strlen( s )
  1665. yyconst char *s;
  1666. #endif
  1667.     {
  1668.     register int n;
  1669.     for ( n = 0; s[n]; ++n )
  1670.         ;
  1671.  
  1672.     return n;
  1673.     }
  1674. #endif
  1675.  
  1676.  
  1677. #ifdef YY_USE_PROTOS
  1678. static void *yy_flex_alloc( yy_size_t size )
  1679. #else
  1680. static void *yy_flex_alloc( size )
  1681. yy_size_t size;
  1682. #endif
  1683.     {
  1684.     return (void *) malloc( size );
  1685.     }
  1686.  
  1687. #ifdef YY_USE_PROTOS
  1688. static void *yy_flex_realloc( void *ptr, yy_size_t size )
  1689. #else
  1690. static void *yy_flex_realloc( ptr, size )
  1691. void *ptr;
  1692. yy_size_t size;
  1693. #endif
  1694.     {
  1695.     /* The cast to (char *) in the following accommodates both
  1696.      * implementations that use char* generic pointers, and those
  1697.      * that use void* generic pointers.  It works with the latter
  1698.      * because both ANSI C and C++ allow castless assignment from
  1699.      * any pointer type to void*, and deal with argument conversions
  1700.      * as though doing an assignment.
  1701.      */
  1702.     return (void *) realloc( (char *) ptr, size );
  1703.     }
  1704.  
  1705. #ifdef YY_USE_PROTOS
  1706. static void yy_flex_free( void *ptr )
  1707. #else
  1708. static void yy_flex_free( ptr )
  1709. void *ptr;
  1710. #endif
  1711.     {
  1712.     free( ptr );
  1713.     }
  1714.  
  1715. #if YY_MAIN
  1716. int main()
  1717.     {
  1718.     yylex();
  1719.     return 0;
  1720.     }
  1721. #endif
  1722. #line 99 "lex.l"
  1723.  
  1724.  
  1725. /* Bring in the keyword recognizer.  */
  1726.  
  1727. #include "keywords.c"
  1728.  
  1729.  
  1730. /* Macros to append to our phrase collection list.  */
  1731.  
  1732. #define _APP(T,L)    do {                           \
  1733.               cur_node = next_node;                   \
  1734.               next_node = xmalloc(sizeof(*next_node));       \
  1735.               next_node->next = cur_node;               \
  1736.               cur_node->string = memcpy(xmalloc(L+1), T, L+1); \
  1737.               cur_node->tag = SYM_NORMAL;               \
  1738.             } while (0)
  1739.  
  1740. #define APP        _APP(yytext, yyleng)
  1741.  
  1742.  
  1743. /* The second stage lexer.  Here we incorporate knowledge of the state
  1744.    of the parser to tailor the tokens that are returned.  */
  1745.  
  1746. int
  1747. yylex(void)
  1748. {
  1749.   static enum {
  1750.     ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_BRACKET, ST_BRACE,
  1751.     ST_EXPRESSION, ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4,
  1752.     ST_TABLE_5, ST_TABLE_6
  1753.   } lexstate = ST_NOTSTARTED;
  1754.  
  1755.   static int suppress_type_lookup, dont_want_brace_phrase;
  1756.   static struct string_list *next_node;
  1757.  
  1758.   int token, count = 0;
  1759.   struct string_list *cur_node;
  1760.  
  1761.   if (lexstate == ST_NOTSTARTED)
  1762.     {
  1763.       if (checksum_version > 1)
  1764.     BEGIN(V2_TOKENS);
  1765.       next_node = xmalloc(sizeof(*next_node));
  1766.       next_node->next = NULL;
  1767.       lexstate = ST_NORMAL;
  1768.     }
  1769.  
  1770. repeat:
  1771.   token = yylex1();
  1772.  
  1773.   if (token == 0)
  1774.     return 0;
  1775.   else if (token == FILENAME)
  1776.     {
  1777.       char *file, *e;
  1778.  
  1779.       /* Save the filename and line number for later error messages.  */
  1780.  
  1781.       if (cur_filename)
  1782.     free(cur_filename);
  1783.  
  1784.       file = strchr(yytext, '\"')+1;
  1785.       e = strchr(file, '\"');
  1786.       *e = '\0';
  1787.       cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
  1788.       cur_line = atoi(yytext+2);
  1789.  
  1790.       /* Linux kernels 2.1.18 and above (roughly) get to ignore the
  1791.      hackery below.  */
  1792.       if (checksum_version == 1)
  1793.     {
  1794.       static const char symtab_begin[] = "linux/symtab_begin.h";
  1795.       static const char symtab_end[] = "linux/symtab_end.h";
  1796.  
  1797.       /* When building 2.0 kernels, we are only given the output directory
  1798.          and we're supposed to deduce the output filename from the cpp
  1799.          output.  */
  1800.  
  1801.       if (outfile == NULL)
  1802.         {
  1803.           char buffer[1024], *dot, *p, *q, *f;
  1804.  
  1805.           dot = strrchr(file, '.');
  1806.           f = strrchr(file, '/');
  1807.  
  1808.           if (dot) *dot = '\0';
  1809.           f = (f ? f+1 : file);
  1810.  
  1811.           snprintf(buffer, 1024, "%s/%s.ver", output_directory, f);
  1812.  
  1813.           if ((outfile = fopen(buffer, "w")) == NULL)
  1814.         {
  1815.           perror(buffer);
  1816.           exit(1);
  1817.         }
  1818.  
  1819.           fputs("/* This file is generated by genksyms  DO NOT EDIT! */\n"
  1820.             "#if (defined(CONFIG_MODVERSIONS) || defined(MODVERSIONS))"
  1821.             " && !defined(__GENKSYMS__)\n", outfile);
  1822.  
  1823.           q = buffer;
  1824.           *q++ = '_';
  1825.           for (p = f; *p ; ++p, ++q)
  1826.         *q = (*p == '.' ? '_' : toupper(*p));
  1827.           memcpy(q, "_VER_", 6);
  1828.  
  1829.           fprintf(outfile, "#ifndef %s\n", buffer);
  1830.           fprintf(outfile, "#define %s\n", buffer);
  1831.  
  1832.           if (dot) *dot = '.';
  1833.         }
  1834.  
  1835.       /* For 2.0 kernels, symbol tables are constructed in big initialized
  1836.          arrays that begin by including <linux/symtab_begin.h> and end by
  1837.          including <linux/symtab_end.h>.  We're going to transmute this
  1838.          little bit o' nastiness into something that, from the perspective
  1839.          of the grammar, resembles the 2.1 scheme in the following
  1840.          fashion:
  1841.  
  1842.          When we see a file name with a suffix matching symtab_begin we
  1843.          should be in ST_EXPRESSION, having already seen the "= {" bits.
  1844.          We get the grammar back to top-level in two stages, by returning
  1845.          EXPRESSION_PHRASE then ';' as we move through ST_TABLE_1 to
  1846.          ST_TABLE_2 eating the tokens we find that were contained in
  1847.          symtab_begin.h.  The body of the work is done in ST_TABLE_{2,5,6}
  1848.          by transmuting X to EXPORT_SYMBOL and ',' to ';'.  We return
  1849.          to normal mode when we see a file name with a suffix matching
  1850.          symtab_end.h.
  1851.  
  1852.          This is not particularly pretty, but it is better than either
  1853.          truely parsing expressions or some other bit o hackery to always
  1854.          recognize and record "X" tokens for later perusal.  */
  1855.  
  1856.       if (e-file > sizeof(symtab_begin)
  1857.           && strcmp(e-sizeof(symtab_begin)+1, symtab_begin) == 0)
  1858.         {
  1859.           if (lexstate != ST_TABLE_1)
  1860.         {
  1861.           lexstate = ST_TABLE_1;
  1862.           return EXPRESSION_PHRASE;
  1863.         }
  1864.         }
  1865.       else if (e-file > sizeof(symtab_end)
  1866.            && strcmp(e-sizeof(symtab_end)+1, symtab_end) == 0)
  1867.         lexstate = ST_TABLE_3;
  1868.       else if (lexstate == ST_TABLE_1)
  1869.         {
  1870.           lexstate = ST_TABLE_2;
  1871.           return ';';
  1872.         }
  1873.       else if (lexstate == ST_TABLE_3)
  1874.         lexstate = ST_TABLE_4;
  1875.     }
  1876.  
  1877.       goto repeat;
  1878.     }
  1879.  
  1880.   switch (lexstate)
  1881.     {
  1882.     case ST_NORMAL:
  1883.       switch (token)
  1884.     {
  1885.     case IDENT:
  1886.       APP;
  1887.       {
  1888.         const struct resword *r = is_reserved_word(yytext, yyleng);
  1889.         if (r)
  1890.           {
  1891.         switch (token = r->token)
  1892.           {
  1893.           case ATTRIBUTE_KEYW:
  1894.             lexstate = ST_ATTRIBUTE;
  1895.             count = 0;
  1896.             goto repeat;
  1897.           case ASM_KEYW:
  1898.             lexstate = ST_ASM;
  1899.             count = 0;
  1900.             goto repeat;
  1901.  
  1902.           case STRUCT_KEYW:
  1903.           case UNION_KEYW:
  1904.             dont_want_brace_phrase = 3;
  1905.           case ENUM_KEYW:
  1906.             suppress_type_lookup = 2;
  1907.             goto fini;
  1908.  
  1909.           case EXPORT_SYMBOL_KEYW:
  1910.             if (checksum_version > 1)
  1911.               goto fini;
  1912.             else
  1913.               token = IDENT;
  1914.           }
  1915.           }
  1916.         if (!suppress_type_lookup)
  1917.           {
  1918.         struct symbol *sym = find_symbol(yytext, SYM_TYPEDEF);
  1919.         if (sym && sym->type == SYM_TYPEDEF)
  1920.           token = TYPE;
  1921.           }
  1922.       }
  1923.       break;
  1924.  
  1925.     case '[':
  1926.       APP;
  1927.       lexstate = ST_BRACKET;
  1928.       count = 1;
  1929.       goto repeat;
  1930.  
  1931.     case '{':
  1932.       APP;
  1933.       if (dont_want_brace_phrase)
  1934.         break;
  1935.       lexstate = ST_BRACE;
  1936.       count = 1;
  1937.       goto repeat;
  1938.  
  1939.     case '=': case ':':
  1940.       APP;
  1941.       lexstate = ST_EXPRESSION;
  1942.       break;
  1943.  
  1944.     case DOTS:
  1945.       if (checksum_version == 1)
  1946.         {
  1947.           _APP(". . .", 5);
  1948.           break;
  1949.         }
  1950.     default:
  1951.       APP;
  1952.       break;
  1953.     }
  1954.       break;
  1955.  
  1956.     case ST_ATTRIBUTE:
  1957.       APP;
  1958.       switch (token)
  1959.     {
  1960.     case '(':
  1961.       ++count;
  1962.       goto repeat;
  1963.     case ')':
  1964.       if (--count == 0)
  1965.         {
  1966.           lexstate = ST_NORMAL;
  1967.           token = ATTRIBUTE_PHRASE;
  1968.           break;
  1969.         }
  1970.       goto repeat;
  1971.     default:
  1972.       goto repeat;
  1973.     }
  1974.       break;
  1975.  
  1976.     case ST_ASM:
  1977.       APP;
  1978.       switch (token)
  1979.     {
  1980.     case '(':
  1981.       ++count;
  1982.       goto repeat;
  1983.     case ')':
  1984.       if (--count == 0)
  1985.         {
  1986.           lexstate = ST_NORMAL;
  1987.           token = ASM_PHRASE;
  1988.           break;
  1989.         }
  1990.       goto repeat;
  1991.     default:
  1992.       goto repeat;
  1993.     }
  1994.       break;
  1995.  
  1996.     case ST_BRACKET:
  1997.       APP;
  1998.       switch (token)
  1999.     {
  2000.     case '[':
  2001.       ++count;
  2002.       goto repeat;
  2003.     case ']':
  2004.       if (--count == 0)
  2005.         {
  2006.           lexstate = ST_NORMAL;
  2007.           token = BRACKET_PHRASE;
  2008.           break;
  2009.         }
  2010.       goto repeat;
  2011.     default:
  2012.       goto repeat;
  2013.     }
  2014.       break;
  2015.  
  2016.     case ST_BRACE:
  2017.       APP;
  2018.       switch (token)
  2019.     {
  2020.     case '{':
  2021.       ++count;
  2022.       goto repeat;
  2023.     case '}':
  2024.       if (--count == 0)
  2025.         {
  2026.           lexstate = ST_NORMAL;
  2027.           token = BRACE_PHRASE;
  2028.           break;
  2029.         }
  2030.       goto repeat;
  2031.     default:
  2032.       goto repeat;
  2033.     }
  2034.       break;
  2035.  
  2036.     case ST_EXPRESSION:
  2037.       switch (token)
  2038.     {
  2039.     case '(': case '[': case '{':
  2040.       ++count;
  2041.       APP;
  2042.       goto repeat;
  2043.     case ')': case ']': case '}':
  2044.       --count;
  2045.       APP;
  2046.       goto repeat;
  2047.     case ',': case ';':
  2048.       if (count == 0)
  2049.         {
  2050.           /* Put back the token we just read so's we can find it again
  2051.          after registering the expression.  */
  2052.           unput(token);
  2053.  
  2054.           lexstate = ST_NORMAL;
  2055.           token = EXPRESSION_PHRASE;
  2056.           break;
  2057.         }
  2058.       APP;
  2059.       goto repeat;
  2060.     default:
  2061.       APP;
  2062.       goto repeat;
  2063.     }
  2064.       break;
  2065.  
  2066.     case ST_TABLE_1:
  2067.       goto repeat;
  2068.  
  2069.     case ST_TABLE_2:
  2070.       if (token == IDENT && yyleng == 1 && yytext[0] == 'X')
  2071.     {
  2072.       token = EXPORT_SYMBOL_KEYW;
  2073.       lexstate = ST_TABLE_5;
  2074.       APP;
  2075.       break;
  2076.     }
  2077.       lexstate = ST_TABLE_6;
  2078.       /* FALLTHRU */
  2079.  
  2080.     case ST_TABLE_6:
  2081.       switch (token)
  2082.     {
  2083.     case '{': case '[': case '(':
  2084.       ++count;
  2085.       break;
  2086.     case '}': case ']': case ')':
  2087.       --count;
  2088.       break;
  2089.     case ',':
  2090.       if (count == 0)
  2091.         lexstate = ST_TABLE_2;
  2092.       break;
  2093.     };
  2094.       goto repeat;
  2095.  
  2096.     case ST_TABLE_3:
  2097.       goto repeat;
  2098.  
  2099.     case ST_TABLE_4:
  2100.       if (token == ';')
  2101.     lexstate = ST_NORMAL;
  2102.       goto repeat;
  2103.  
  2104.     case ST_TABLE_5:
  2105.       switch (token)
  2106.     {
  2107.     case ',':
  2108.       token = ';';
  2109.       lexstate = ST_TABLE_2;
  2110.       APP;
  2111.       break;
  2112.     default:
  2113.       APP;
  2114.       break;
  2115.     }
  2116.       break;
  2117.  
  2118.     default:
  2119.       abort();
  2120.     }
  2121. fini:
  2122.  
  2123.   if (suppress_type_lookup > 0)
  2124.     --suppress_type_lookup;
  2125.   if (dont_want_brace_phrase > 0)
  2126.     --dont_want_brace_phrase;
  2127.  
  2128.   yylval = &next_node->next;
  2129.  
  2130.   return token;
  2131. }
  2132.