home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / lex / lex.skel < prev    next >
Encoding:
Text File  |  1991-05-06  |  18.8 KB  |  809 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* scanner skeleton version:
  4.  *
  5.  * $Header: flex/RCS/flex.skel,v 2.13 90/05/26 17:24:13 vern Exp $
  6.  *
  7.  *    @(#)lex.skel    5.5 (Berkeley) 5/6/91
  8.  */
  9.  
  10. #define FLEX_SCANNER
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14.  
  15. #ifdef __STDC__
  16.  
  17. #define YY_USE_PROTOS
  18. #endif
  19.  
  20.  
  21. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  22. #ifdef c_plusplus
  23. #ifndef __cplusplus
  24. #define __cplusplus
  25. #endif
  26. #endif
  27.  
  28.  
  29. #ifdef __cplusplus
  30.  
  31. #include <osfcn.h>
  32.  
  33. /* use prototypes in function declarations */
  34. #define YY_USE_PROTOS
  35.  
  36. #endif
  37.  
  38.  
  39. #ifdef YY_USE_PROTOS
  40. #define YY_PROTO(proto) proto
  41. #else
  42. #define YY_PROTO(proto) ()
  43. #endif
  44.  
  45.  
  46. /* amount of stuff to slurp up with each read */
  47. #ifndef YY_READ_BUF_SIZE
  48. #define YY_READ_BUF_SIZE 8192
  49. #endif
  50.  
  51. /* returned upon end-of-file */
  52. #define YY_END_TOK 0
  53.  
  54. /* copy whatever the last rule matched to the standard output */
  55.  
  56. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  57. /* this used to be an fputs(), but since the string might contain NUL's,
  58.  * we now use fwrite()
  59.  */
  60. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  61.  
  62. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  63.  * is returned in "result".
  64.  */
  65. #define YY_INPUT(buf,result,max_size) \
  66.     if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  67.         YY_FATAL_ERROR( "read() in flex scanner failed" );
  68. #define YY_NULL 0
  69.  
  70. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  71.  * we don't want an extra ';' after the "return" because that will cause
  72.  * some compilers to complain about unreachable statements.
  73.  */
  74. #define yyterminate() return ( YY_NULL )
  75.  
  76. /* report a fatal error */
  77.  
  78. /* The funky do-while is used to turn this macro definition into
  79.  * a single C statement (which needs a semi-colon terminator).
  80.  * This avoids problems with code like:
  81.  *
  82.  *     if ( something_happens )
  83.  *        YY_FATAL_ERROR( "oops, the something happened" );
  84.  *    else
  85.  *        everything_okay();
  86.  *
  87.  * Prior to using the do-while the compiler would get upset at the
  88.  * "else" because it interpreted the "if" statement as being all
  89.  * done when it reached the ';' after the YY_FATAL_ERROR() call.
  90.  */
  91.  
  92. #define YY_FATAL_ERROR(msg) \
  93.     do \
  94.         { \
  95.         (void) fputs( msg, stderr ); \
  96.         (void) putc( '\n', stderr ); \
  97.         exit( 1 ); \
  98.         } \
  99.     while ( 0 )
  100.  
  101. /* default yywrap function - always treat EOF as an EOF */
  102. #define yywrap() 1
  103.  
  104. /* enter a start condition.  This macro really ought to take a parameter,
  105.  * but we do it the disgusting crufty way forced on us by the ()-less
  106.  * definition of BEGIN
  107.  */
  108. #define BEGIN yy_start = 1 + 2 *
  109.  
  110. /* action number for EOF rule of a given start state */
  111. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  112.  
  113. /* special action meaning "start processing a new file" */
  114. #define YY_NEW_FILE \
  115.     do \
  116.         { \
  117.         yy_init_buffer( yy_current_buffer, yyin ); \
  118.         yy_load_buffer_state(); \
  119.         } \
  120.     while ( 0 )
  121.  
  122. /* default declaration of generated scanner - a define so the user can
  123.  * easily add parameters
  124.  */
  125. #define YY_DECL int yylex YY_PROTO(( void )) 
  126.  
  127. /* code executed at the end of each rule */
  128. #define YY_BREAK break;
  129.  
  130. #define YY_END_OF_BUFFER_CHAR 0
  131.  
  132. #ifndef YY_BUF_SIZE
  133. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  134. #endif
  135.  
  136. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  137.  
  138. %% section 1 definitions go here
  139.  
  140. /* done after the current pattern has been matched and before the
  141.  * corresponding action - sets up yytext
  142.  */
  143. #define YY_DO_BEFORE_ACTION \
  144.     yytext = yy_bp; \
  145. %% code to fiddle yytext and yyleng for yymore() goes here
  146.     yy_hold_char = *yy_cp; \
  147.     *yy_cp = '\0'; \
  148.     yy_c_buf_p = yy_cp;
  149.  
  150. #define EOB_ACT_CONTINUE_SCAN 0
  151. #define EOB_ACT_END_OF_FILE 1
  152. #define EOB_ACT_LAST_MATCH 2
  153.  
  154. /* return all but the first 'n' matched characters back to the input stream */
  155. #define yyless(n) \
  156.     do \
  157.         { \
  158.         /* undo effects of setting up yytext */ \
  159.         *yy_cp = yy_hold_char; \
  160.         yy_c_buf_p = yy_cp = yy_bp + n; \
  161.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  162.         } \
  163.     while ( 0 )
  164.  
  165. #define unput(c) yyunput( c, yytext )
  166.  
  167.  
  168. struct yy_buffer_state
  169.     {
  170.     FILE *yy_input_file;
  171.  
  172.     YY_CHAR *yy_ch_buf;        /* input buffer */
  173.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  174.  
  175.     /* size of input buffer in bytes, not including room for EOB characters*/
  176.     int yy_buf_size;    
  177.  
  178.     /* number of characters read into yy_ch_buf, not including EOB characters */
  179.     int yy_n_chars;
  180.  
  181.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  182. #define EOF_NOT_SEEN 0
  183.     /* "pending" happens when the EOF has been seen but there's still
  184.      * some text process
  185.      */
  186. #define EOF_PENDING 1
  187. #define EOF_DONE 2
  188.     };
  189.  
  190. static YY_BUFFER_STATE yy_current_buffer;
  191.  
  192. /* we provide macros for accessing buffer states in case in the
  193.  * future we want to put the buffer states in a more general
  194.  * "scanner state"
  195.  */
  196. #define YY_CURRENT_BUFFER yy_current_buffer
  197.  
  198.  
  199. /* yy_hold_char holds the character lost when yytext is formed */
  200. static YY_CHAR yy_hold_char;
  201.  
  202. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  203.  
  204.  
  205.  
  206. #ifndef YY_USER_ACTION
  207. #define YY_USER_ACTION
  208. #endif
  209.  
  210. #ifndef YY_USER_INIT
  211. #define YY_USER_INIT
  212. #endif
  213.  
  214. extern YY_CHAR *yytext;
  215. extern int yyleng;
  216. extern FILE *yyin, *yyout;
  217.  
  218. YY_CHAR *yytext;
  219. int yyleng;
  220.  
  221. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  222.  
  223. %% data tables for the DFA go here
  224.  
  225. /* these variables are all declared out here so that section 3 code can
  226.  * manipulate them
  227.  */
  228. /* points to current character in buffer */
  229. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  230. static int yy_init = 1;        /* whether we need to initialize */
  231. static int yy_start = 0;    /* start state number */
  232.  
  233. /* flag which is used to allow yywrap()'s to do buffer switches
  234.  * instead of setting up a fresh yyin.  A bit of a hack ...
  235.  */
  236. static int yy_did_buffer_switch_on_eof;
  237.  
  238. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  239. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  240. static int yy_get_next_buffer YY_PROTO(( void ));
  241. static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
  242. void yyrestart YY_PROTO(( FILE *input_file ));
  243. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  244. void yy_load_buffer_state YY_PROTO(( void ));
  245. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  246. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  247. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  248.  
  249. #define yy_new_buffer yy_create_buffer
  250.  
  251. #ifdef __cplusplus
  252. static int yyinput YY_PROTO(( void ));
  253. #else
  254. static int input YY_PROTO(( void ));
  255. #endif
  256.  
  257. YY_DECL
  258.     {
  259.     register yy_state_type yy_current_state;
  260.     register YY_CHAR *yy_cp, *yy_bp;
  261.     register int yy_act;
  262.  
  263. %% user's declarations go here
  264.  
  265.     if ( yy_init )
  266.     {
  267.     YY_USER_INIT;
  268.  
  269.     if ( ! yy_start )
  270.         yy_start = 1;    /* first start state */
  271.  
  272.     if ( ! yyin )
  273.         yyin = stdin;
  274.  
  275.     if ( ! yyout )
  276.         yyout = stdout;
  277.  
  278.     if ( yy_current_buffer )
  279.         yy_init_buffer( yy_current_buffer, yyin );
  280.     else
  281.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  282.  
  283.     yy_load_buffer_state();
  284.  
  285.     yy_init = 0;
  286.     }
  287.  
  288.     while ( 1 )        /* loops until end-of-file is reached */
  289.     {
  290. %% yymore()-related code goes here
  291.     yy_cp = yy_c_buf_p;
  292.  
  293.     /* support of yytext */
  294.     *yy_cp = yy_hold_char;
  295.  
  296.     /* yy_bp points to the position in yy_ch_buf of the start of the
  297.      * current run.
  298.      */
  299.     yy_bp = yy_cp;
  300.  
  301. %% code to set up and find next match goes here
  302.  
  303. yy_find_action:
  304. %% code to find the action number goes here
  305.  
  306.     YY_DO_BEFORE_ACTION;
  307.     YY_USER_ACTION;
  308.  
  309. do_action:    /* this label is used only to access EOF actions */
  310.  
  311. %% debug code goes here
  312.  
  313.     switch ( yy_act )
  314.         {
  315. %% actions go here
  316.  
  317.         case YY_END_OF_BUFFER:
  318.         {
  319.         /* amount of text matched not including the EOB char */
  320.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  321.  
  322.         /* undo the effects of YY_DO_BEFORE_ACTION */
  323.         *yy_cp = yy_hold_char;
  324.  
  325.         /* note that here we test for yy_c_buf_p "<=" to the position
  326.          * of the first EOB in the buffer, since yy_c_buf_p will
  327.          * already have been incremented past the NUL character
  328.          * (since all states make transitions on EOB to the end-
  329.          * of-buffer state).  Contrast this with the test in yyinput().
  330.          */
  331.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  332.             /* this was really a NUL */
  333.             {
  334.             yy_state_type yy_next_state;
  335.  
  336.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  337.  
  338.             yy_current_state = yy_get_previous_state();
  339.  
  340.             /* okay, we're now positioned to make the
  341.              * NUL transition.  We couldn't have
  342.              * yy_get_previous_state() go ahead and do it
  343.              * for us because it doesn't know how to deal
  344.              * with the possibility of jamming (and we
  345.              * don't want to build jamming into it because
  346.              * then it will run more slowly)
  347.              */
  348.  
  349.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  350.  
  351.             yy_bp = yytext + YY_MORE_ADJ;
  352.  
  353.             if ( yy_next_state )
  354.             {
  355.             /* consume the NUL */
  356.             yy_cp = ++yy_c_buf_p;
  357.             yy_current_state = yy_next_state;
  358.             goto yy_match;
  359.             }
  360.  
  361.             else
  362.             {
  363. %% code to do backtracking for compressed tables and set up yy_cp goes here
  364.             goto yy_find_action;
  365.             }
  366.             }
  367.  
  368.         else switch ( yy_get_next_buffer() )
  369.             {
  370.             case EOB_ACT_END_OF_FILE:
  371.             {
  372.             yy_did_buffer_switch_on_eof = 0;
  373.  
  374.             if ( yywrap() )
  375.                 {
  376.                 /* note: because we've taken care in
  377.                  * yy_get_next_buffer() to have set up yytext,
  378.                  * we can now set up yy_c_buf_p so that if some
  379.                  * total hoser (like flex itself) wants
  380.                  * to call the scanner after we return the
  381.                  * YY_NULL, it'll still work - another YY_NULL
  382.                  * will get returned.
  383.                  */
  384.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  385.  
  386.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  387.                 goto do_action;
  388.                 }
  389.  
  390.             else
  391.                 {
  392.                 if ( ! yy_did_buffer_switch_on_eof )
  393.                 YY_NEW_FILE;
  394.                 }
  395.             }
  396.             break;
  397.  
  398.             case EOB_ACT_CONTINUE_SCAN:
  399.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  400.  
  401.             yy_current_state = yy_get_previous_state();
  402.  
  403.             yy_cp = yy_c_buf_p;
  404.             yy_bp = yytext + YY_MORE_ADJ;
  405.             goto yy_match;
  406.  
  407.             case EOB_ACT_LAST_MATCH:
  408.             yy_c_buf_p =
  409.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  410.  
  411.             yy_current_state = yy_get_previous_state();
  412.  
  413.             yy_cp = yy_c_buf_p;
  414.             yy_bp = yytext + YY_MORE_ADJ;
  415.             goto yy_find_action;
  416.             }
  417.         break;
  418.         }
  419.  
  420.         default:
  421. #ifdef FLEX_DEBUG
  422.         printf( "action # %d\n", yy_act );
  423. #endif
  424.         YY_FATAL_ERROR(
  425.             "fatal flex scanner internal error--no action found" );
  426.         }
  427.     }
  428.     }
  429.  
  430.  
  431. /* yy_get_next_buffer - try to read in a new buffer
  432.  *
  433.  * synopsis
  434.  *     int yy_get_next_buffer();
  435.  *     
  436.  * returns a code representing an action
  437.  *     EOB_ACT_LAST_MATCH - 
  438.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  439.  *     EOB_ACT_END_OF_FILE - end of file
  440.  */
  441.  
  442. static int yy_get_next_buffer()
  443.  
  444.     {
  445.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  446.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  447.     register int number_to_move, i;
  448.     int ret_val;
  449.  
  450.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  451.     YY_FATAL_ERROR(
  452.         "fatal flex scanner internal error--end of buffer missed" );
  453.  
  454.     /* try to read more data */
  455.  
  456.     /* first move last chars to start of buffer */
  457.     number_to_move = yy_c_buf_p - yytext;
  458.  
  459.     for ( i = 0; i < number_to_move; ++i )
  460.     *(dest++) = *(source++);
  461.  
  462.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  463.     /* don't do the read, it's not guaranteed to return an EOF,
  464.      * just force an EOF
  465.      */
  466.     yy_n_chars = 0;
  467.  
  468.     else
  469.     {
  470.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  471.  
  472.     if ( num_to_read > YY_READ_BUF_SIZE )
  473.         num_to_read = YY_READ_BUF_SIZE;
  474.  
  475.     else if ( num_to_read <= 0 )
  476.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  477.  
  478.     /* read in more data */
  479.     YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  480.           yy_n_chars, num_to_read );
  481.     }
  482.  
  483.     if ( yy_n_chars == 0 )
  484.     {
  485.     if ( number_to_move == 1 )
  486.         {
  487.         ret_val = EOB_ACT_END_OF_FILE;
  488.         yy_current_buffer->yy_eof_status = EOF_DONE;
  489.         }
  490.  
  491.     else
  492.         {
  493.         ret_val = EOB_ACT_LAST_MATCH;
  494.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  495.         }
  496.     }
  497.  
  498.     else
  499.     ret_val = EOB_ACT_CONTINUE_SCAN;
  500.  
  501.     yy_n_chars += number_to_move;
  502.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  503.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  504.  
  505.     /* yytext begins at the second character in yy_ch_buf; the first
  506.      * character is the one which preceded it before reading in the latest
  507.      * buffer; it needs to be kept around in case it's a newline, so
  508.      * yy_get_previous_state() will have with '^' rules active
  509.      */
  510.  
  511.     yytext = &yy_current_buffer->yy_ch_buf[1];
  512.  
  513.     return ( ret_val );
  514.     }
  515.  
  516.  
  517. /* yy_get_previous_state - get the state just before the EOB char was reached
  518.  *
  519.  * synopsis
  520.  *     yy_state_type yy_get_previous_state();
  521.  */
  522.  
  523. static yy_state_type yy_get_previous_state()
  524.  
  525.     {
  526.     register yy_state_type yy_current_state;
  527.     register YY_CHAR *yy_cp;
  528.  
  529. %% code to get the start state into yy_current_state goes here
  530.  
  531.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  532.     {
  533. %% code to find the next state goes here
  534.     }
  535.  
  536.     return ( yy_current_state );
  537.     }
  538.  
  539.  
  540. /* yy_try_NUL_trans - try to make a transition on the NUL character
  541.  *
  542.  * synopsis
  543.  *     next_state = yy_try_NUL_trans( current_state );
  544.  */
  545.  
  546. #ifdef YY_USE_PROTOS
  547. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  548. #else
  549. static yy_state_type yy_try_NUL_trans( yy_current_state )
  550. register yy_state_type yy_current_state;
  551. #endif
  552.  
  553.     {
  554.     register int yy_is_jam;
  555. %% code to find the next state, and perhaps do backtracking, goes here
  556.  
  557.     return ( yy_is_jam ? 0 : yy_current_state );
  558.     }
  559.  
  560.  
  561. #ifdef YY_USE_PROTOS
  562. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  563. #else
  564. static void yyunput( c, yy_bp )
  565. YY_CHAR c;
  566. register YY_CHAR *yy_bp;
  567. #endif
  568.  
  569.     {
  570.     register YY_CHAR *yy_cp = yy_c_buf_p;
  571.  
  572.     /* undo effects of setting up yytext */
  573.     *yy_cp = yy_hold_char;
  574.  
  575.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  576.     { /* need to shift things up to make room */
  577.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  578.     register YY_CHAR *dest =
  579.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  580.     register YY_CHAR *source =
  581.         &yy_current_buffer->yy_ch_buf[number_to_move];
  582.  
  583.     while ( source > yy_current_buffer->yy_ch_buf )
  584.         *--dest = *--source;
  585.  
  586.     yy_cp += dest - source;
  587.     yy_bp += dest - source;
  588.     yy_n_chars = yy_current_buffer->yy_buf_size;
  589.  
  590.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  591.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  592.     }
  593.  
  594.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  595.     yy_cp[-2] = '\n';
  596.  
  597.     *--yy_cp = c;
  598.  
  599.     /* note: the formal parameter *must* be called "yy_bp" for this
  600.      *       macro to now work correctly
  601.      */
  602.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  603.     }
  604.  
  605.  
  606. #ifdef __cplusplus
  607. static int yyinput()
  608. #else
  609. static int input()
  610. #endif
  611.  
  612.     {
  613.     int c;
  614.     YY_CHAR *yy_cp = yy_c_buf_p;
  615.  
  616.     *yy_cp = yy_hold_char;
  617.  
  618.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  619.     {
  620.     /* yy_c_buf_p now points to the character we want to return.
  621.      * If this occurs *before* the EOB characters, then it's a
  622.      * valid NUL; if not, then we've hit the end of the buffer.
  623.      */
  624.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  625.         /* this was really a NUL */
  626.         *yy_c_buf_p = '\0';
  627.  
  628.     else
  629.         { /* need more input */
  630.         yytext = yy_c_buf_p;
  631.         ++yy_c_buf_p;
  632.  
  633.         switch ( yy_get_next_buffer() )
  634.         {
  635.         case EOB_ACT_END_OF_FILE:
  636.             {
  637.             if ( yywrap() )
  638.             {
  639.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  640.             return ( EOF );
  641.             }
  642.  
  643.             YY_NEW_FILE;
  644.  
  645. #ifdef __cplusplus
  646.             return ( yyinput() );
  647. #else
  648.             return ( input() );
  649. #endif
  650.             }
  651.             break;
  652.  
  653.         case EOB_ACT_CONTINUE_SCAN:
  654.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  655.             break;
  656.  
  657.         case EOB_ACT_LAST_MATCH:
  658. #ifdef __cplusplus
  659.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  660. #else
  661.             YY_FATAL_ERROR( "unexpected last match in input()" );
  662. #endif
  663.         }
  664.         }
  665.     }
  666.  
  667.     c = *yy_c_buf_p;
  668.     yy_hold_char = *++yy_c_buf_p;
  669.  
  670.     return ( c );
  671.     }
  672.  
  673.  
  674. #ifdef YY_USE_PROTOS
  675. void yyrestart( FILE *input_file )
  676. #else
  677. void yyrestart( input_file )
  678. FILE *input_file;
  679. #endif
  680.  
  681.     {
  682.     yy_init_buffer( yy_current_buffer, input_file );
  683.     yy_load_buffer_state();
  684.     }
  685.  
  686.  
  687. #ifdef YY_USE_PROTOS
  688. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  689. #else
  690. void yy_switch_to_buffer( new_buffer )
  691. YY_BUFFER_STATE new_buffer;
  692. #endif
  693.  
  694.     {
  695.     if ( yy_current_buffer == new_buffer )
  696.     return;
  697.  
  698.     if ( yy_current_buffer )
  699.     {
  700.     /* flush out information for old buffer */
  701.     *yy_c_buf_p = yy_hold_char;
  702.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  703.     yy_current_buffer->yy_n_chars = yy_n_chars;
  704.     }
  705.  
  706.     yy_current_buffer = new_buffer;
  707.     yy_load_buffer_state();
  708.  
  709.     /* we don't actually know whether we did this switch during
  710.      * EOF (yywrap()) processing, but the only time this flag
  711.      * is looked at is after yywrap() is called, so it's safe
  712.      * to go ahead and always set it.
  713.      */
  714.     yy_did_buffer_switch_on_eof = 1;
  715.     }
  716.  
  717.  
  718. #ifdef YY_USE_PROTOS
  719. void yy_load_buffer_state( void )
  720. #else
  721. void yy_load_buffer_state()
  722. #endif
  723.  
  724.     {
  725.     yy_n_chars = yy_current_buffer->yy_n_chars;
  726.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  727.     yyin = yy_current_buffer->yy_input_file;
  728.     yy_hold_char = *yy_c_buf_p;
  729.     }
  730.  
  731.  
  732. #ifdef YY_USE_PROTOS
  733. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  734. #else
  735. YY_BUFFER_STATE yy_create_buffer( file, size )
  736. FILE *file;
  737. int size;
  738. #endif
  739.  
  740.     {
  741.     YY_BUFFER_STATE b;
  742.  
  743.     b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  744.  
  745.     if ( ! b )
  746.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  747.  
  748.     b->yy_buf_size = size;
  749.  
  750.     /* yy_ch_buf has to be 2 characters longer than the size given because
  751.      * we need to put in 2 end-of-buffer characters.
  752.      */
  753.     b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  754.  
  755.     if ( ! b->yy_ch_buf )
  756.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  757.  
  758.     yy_init_buffer( b, file );
  759.  
  760.     return ( b );
  761.     }
  762.  
  763.  
  764. #ifdef YY_USE_PROTOS
  765. void yy_delete_buffer( YY_BUFFER_STATE b )
  766. #else
  767. void yy_delete_buffer( b )
  768. YY_BUFFER_STATE b;
  769. #endif
  770.  
  771.     {
  772.     if ( b == yy_current_buffer )
  773.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  774.  
  775.     free( (char *) b->yy_ch_buf );
  776.     free( (char *) b );
  777.     }
  778.  
  779.  
  780. #ifdef YY_USE_PROTOS
  781. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  782. #else
  783. void yy_init_buffer( b, file )
  784. YY_BUFFER_STATE b;
  785. FILE *file;
  786. #endif
  787.  
  788.     {
  789.     b->yy_input_file = file;
  790.  
  791.     /* we put in the '\n' and start reading from [1] so that an
  792.      * initial match-at-newline will be true.
  793.      */
  794.  
  795.     b->yy_ch_buf[0] = '\n';
  796.     b->yy_n_chars = 1;
  797.  
  798.     /* we always need two end-of-buffer characters.  The first causes
  799.      * a transition to the end-of-buffer state.  The second causes
  800.      * a jam in that state.
  801.      */
  802.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  803.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  804.  
  805.     b->yy_buf_pos = &b->yy_ch_buf[1];
  806.  
  807.     b->yy_eof_status = EOF_NOT_SEEN;
  808.     }
  809.