home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / biology / gsrc208a.zip / LEXYY.C < prev    next >
C/C++ Source or Header  |  1992-12-06  |  33KB  |  1,301 lines

  1. #include "copyleft.h"
  2.  
  3. /*
  4.     GEPASI - a simulator of metabolic pathways and other dynamical systems
  5.     Copyright (C) 1989, 1992  Pedro Mendes
  6. */
  7.  
  8. /*************************************/
  9. /*                                   */
  10. /*          GWTOP - Topology         */
  11. /*        MS-WINDOWS front end       */
  12. /*                                   */
  13. /*          Loops dialog box         */
  14. /*                                   */
  15. /*           QuickC/WIN 1.0          */
  16. /*                                   */
  17. /*   (include here compilers that    */
  18. /*   compiled GWSIM successfully)    */
  19. /*                                   */
  20. /*************************************/
  21.  
  22.  
  23. /* A lexical scanner generated by flex */
  24. /* version 2.3.6 for DOS */
  25. /* the header flex.ske was hacked by Pedro Mendes */
  26.  
  27. /* scanner skeleton version:
  28.  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $
  29.  */
  30.  
  31. #define FLEX_SCANNER
  32.  
  33. #include <stdio.h>
  34.  
  35. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  36. #ifdef c_plusplus
  37. #ifndef __cplusplus
  38. #define __cplusplus
  39. #endif
  40. #endif
  41.  
  42. /* THIS IS A PROBLEM DUE TO LACK OF FUNCTION PROTOTYPES!!!!    */
  43. /* #pragma alloc_text( CODE2, yylex, yyreset, yy_get_next_buffer, yy_state_type yy_get_previous_state, yy_try_NUL_trans, yyunput, input, yyrestart, yy_switch_to_buffer, yy_load_buffer_state, yy_create_buffer, yy_delete_buffer, yy_init_buffer ) */
  44.  
  45. #ifdef __cplusplus
  46.  
  47. #include <stdlib.h>
  48. #include <osfcn.h>
  49.  
  50. /* use prototypes in function declarations */
  51. #define YY_USE_PROTOS
  52.  
  53. /* the "const" storage-class-modifier is valid */
  54. #define YY_USE_CONST
  55.  
  56. #else    /* ! __cplusplus */
  57.  
  58. #ifdef __STDC__
  59.  
  60. #ifdef __GNUC__
  61. #include <stddef.h>
  62. void *malloc( size_t );
  63. void free( void* );
  64. #else
  65. #include <stdlib.h>
  66. #endif    /* __GNUC__ */
  67.  
  68. #define YY_USE_PROTOS
  69. #define YY_USE_CONST
  70.  
  71. #endif    /* __STDC__ */
  72. #endif    /* ! __cplusplus */
  73.  
  74.  
  75. #ifdef __TURBOC__
  76. #define YY_USE_CONST
  77. #endif
  78.  
  79.  
  80. #ifndef YY_USE_CONST
  81. #define const
  82. #endif
  83.  
  84.  
  85. #ifdef YY_USE_PROTOS
  86. #define YY_PROTO(proto) proto
  87. #else
  88. #define YY_PROTO(proto) ()
  89. /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
  90.  * so it's got to be a K&R compiler, and therefore there's no standard
  91.  * place from which to include these definitions
  92.  */
  93. char *malloc();
  94. int free();
  95. int read();
  96. #endif
  97.  
  98.  
  99. /* amount of stuff to slurp up with each read */
  100. #ifndef YY_READ_BUF_SIZE
  101. #define YY_READ_BUF_SIZE 4096
  102. #endif
  103.  
  104. /* returned upon end-of-file */
  105. #define YY_END_TOK 0
  106.  
  107. /* copy whatever the last rule matched to the standard output */
  108.  
  109. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  110. /* this used to be an fputs(), but since the string might contain NUL's,
  111.  * we now use fwrite()
  112.  */
  113. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  114.  
  115. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  116.  * is returned in "result".
  117.  */
  118. #define YY_INPUT(buf,result,max_size) \
  119.     do \
  120.     { \
  121.      strncpy( buf, yyin, max_size ); \
  122.      if ( strlen( yyin ) < max_size ) \
  123.       result=strlen( yyin ); \
  124.      else \
  125.       result=max_size; \
  126.      yyin += result; \
  127.     }while(0)
  128. #define YY_NULL 0
  129.  
  130. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  131.  * we don't want an extra ';' after the "return" because that will cause
  132.  * some compilers to complain about unreachable statements.
  133.  */
  134. #define yyterminate() return ( YY_NULL )
  135.  
  136. /* report a fatal error */
  137.  
  138. /* The funky do-while is used to turn this macro definition into
  139.  * a single C statement (which needs a semi-colon terminator).
  140.  * This avoids problems with code like:
  141.  *
  142.  *     if ( something_happens )
  143.  *        YY_FATAL_ERROR( "oops, the something happened" );
  144.  *    else
  145.  *        everything_okay();
  146.  *
  147.  * Prior to using the do-while the compiler would get upset at the
  148.  * "else" because it interpreted the "if" statement as being all
  149.  * done when it reached the ';' after the YY_FATAL_ERROR() call.
  150.  */
  151.  
  152. #define YY_FATAL_ERROR(msg) \
  153.     do \
  154.         { \
  155.         (void) fputs( msg, stderr ); \
  156.         (void) putc( '\n', stderr ); \
  157.         exit( 1 ); \
  158.         } \
  159.     while ( 0 )
  160.  
  161. /* default yywrap function - always treat EOF as an EOF */
  162. #define yywrap() 1
  163.  
  164. /* enter a start condition.  This macro really ought to take a parameter,
  165.  * but we do it the disgusting crufty way forced on us by the ()-less
  166.  * definition of BEGIN
  167.  */
  168. #define BEGIN yy_start = 1 + 2 *
  169.  
  170. /* action number for EOF rule of a given start state */
  171. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  172.  
  173. /* special action meaning "start processing a new file" */
  174. #define YY_NEW_FILE \
  175.     do \
  176.         { \
  177.         yy_init_buffer( yy_current_buffer, yyin ); \
  178.         yy_load_buffer_state(); \
  179.         } \
  180.     while ( 0 )
  181.  
  182. /* default declaration of generated scanner - a define so the user can
  183.  * easily add parameters
  184.  */
  185. #define YY_DECL int yylex YY_PROTO(( void ))
  186.  
  187. /* code executed at the end of each rule */
  188. #define YY_BREAK break;
  189.  
  190. #define YY_END_OF_BUFFER_CHAR 0
  191.  
  192. #ifndef YY_BUF_SIZE
  193. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  194. #endif
  195.  
  196. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  197.  
  198. #define YY_CHAR char
  199. #define INITIAL 0
  200. /* scanner for arithmetic expressions */
  201. /* the generated file MUST have the macro YY_FATAL_ERROR edited  */
  202. /* in order to point ot an externaly defined function that sends */
  203. /* the error messages through a message box (and not via printf) */
  204. #include <string.h>
  205. #include <math.h>
  206.  
  207. struct nodet{
  208.              char item;
  209.              unsigned char val;
  210.              unsigned char left;
  211.              unsigned char right;
  212.             } ;
  213.  
  214. struct treet{
  215.              struct nodet node[256];
  216.              char id[64][10];
  217.              float constant[32];
  218.              int nnode,
  219.                  nnum,
  220.                  nid,
  221.                  nsub,
  222.                  npro,
  223.                  nmodf,
  224.                  nconst,
  225.                  revers;
  226.              char descr[64];
  227.             } ;
  228.  
  229. extern    char            errstr[80];                /* string to hold lex and parser errors    */
  230. extern    unsigned char    lex;                    /* index for parser                        */
  231. extern  struct treet    tr;
  232. extern  int             errfl;
  233.  
  234. int lexyy_fatal( char *m );
  235. #define YY_FATAL_ERROR(msg) \
  236.     do \
  237.         { \
  238.         (void) lexyy_fatal( msg ); \
  239.         return YY_NULL; \
  240.         } \
  241.     while ( 0 )
  242.  
  243. int k;
  244. float faux;
  245.  
  246. /* done after the current pattern has been matched and before the
  247.  * corresponding action - sets up yytext
  248.  */
  249. #define YY_DO_BEFORE_ACTION \
  250.     yytext = yy_bp; \
  251.     yyleng = yy_cp - yy_bp; \
  252.     yy_hold_char = *yy_cp; \
  253.     *yy_cp = '\0'; \
  254.     yy_c_buf_p = yy_cp;
  255.  
  256. #define EOB_ACT_CONTINUE_SCAN 0
  257. #define EOB_ACT_END_OF_FILE 1
  258. #define EOB_ACT_LAST_MATCH 2
  259.  
  260. /* return all but the first 'n' matched characters back to the input stream */
  261. #define yyless(n) \
  262.     do \
  263.         { \
  264.         /* undo effects of setting up yytext */ \
  265.         *yy_cp = yy_hold_char; \
  266.         yy_c_buf_p = yy_cp = yy_bp + n; \
  267.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  268.         } \
  269.     while ( 0 )
  270.  
  271. #define unput(c) yyunput( c, yytext )
  272.  
  273.  
  274. struct yy_buffer_state
  275.     {
  276.     char *yy_input_file;
  277.  
  278.     YY_CHAR *yy_ch_buf;        /* input buffer */
  279.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  280.  
  281.     /* size of input buffer in bytes, not including room for EOB characters*/
  282.     int yy_buf_size;
  283.  
  284.     /* number of characters read into yy_ch_buf, not including EOB characters */
  285.     int yy_n_chars;
  286.  
  287.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  288. #define EOF_NOT_SEEN 0
  289.     /* "pending" happens when the EOF has been seen but there's still
  290.      * some text process
  291.      */
  292. #define EOF_PENDING 1
  293. #define EOF_DONE 2
  294.     };
  295.  
  296. static YY_BUFFER_STATE yy_current_buffer;
  297.  
  298. /* we provide macros for accessing buffer states in case in the
  299.  * future we want to put the buffer states in a more general
  300.  * "scanner state"
  301.  */
  302. #define YY_CURRENT_BUFFER yy_current_buffer
  303.  
  304.  
  305. /* yy_hold_char holds the character lost when yytext is formed */
  306. static YY_CHAR yy_hold_char;
  307.  
  308. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  309.  
  310.  
  311.  
  312. #ifndef YY_USER_ACTION
  313. #define YY_USER_ACTION
  314. #endif
  315.  
  316. #ifndef YY_USER_INIT
  317. #define YY_USER_INIT
  318. #endif
  319.  
  320. extern YY_CHAR *yytext;
  321. extern int yyleng;
  322. extern FILE *yyout;
  323. extern char *yyin;
  324.  
  325. YY_CHAR *yytext;
  326. int yyleng;
  327.  
  328. FILE *yyout = (FILE *) 0;
  329. char *yyin = (char *) NULL;
  330.  
  331. #define YY_END_OF_BUFFER 18
  332. typedef int yy_state_type;
  333. static const short int yy_accept[39] =
  334.     {   0,
  335.         0,    0,   18,   16,   15,   15,   13,   14,   10,    8,
  336.         9,   16,   11,    1,    7,   12,    7,    7,    7,    7,
  337.        15,    1,    1,    1,    0,    7,    7,    7,    3,    7,
  338.         7,    0,    1,    6,    4,    2,    5,    0
  339.     } ;
  340.  
  341. static const YY_CHAR yy_ec[128] =
  342.     {   0,
  343.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  344.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  345.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  346.         1,    2,    1,    1,    1,    1,    1,    1,    1,    4,
  347.         5,    6,    7,    1,    8,    9,   10,   11,   11,   11,
  348.        11,   11,   11,   11,   11,   11,   11,    1,    1,    1,
  349.         1,    1,    1,    1,   12,   12,   12,   12,   13,   12,
  350.        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
  351.        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
  352.         1,    1,    1,   14,    1,    1,   12,   12,   15,   12,
  353.  
  354.        16,   12,   17,   12,   18,   12,   12,   19,   12,   20,
  355.        21,   22,   12,   12,   23,   12,   12,   12,   12,   24,
  356.        12,   12,    1,    1,    1,    1,    1
  357.     } ;
  358.  
  359. static const YY_CHAR yy_meta[25] =
  360.     {   0,
  361.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  362.         2,    2,    2,    1,    2,    2,    2,    2,    2,    2,
  363.         2,    2,    2,    2
  364.     } ;
  365.  
  366. static const short int yy_base[40] =
  367.     {   0,
  368.         0,    0,   57,   58,   23,   25,   58,   58,   58,   58,
  369.        58,   45,   58,   20,    0,   58,   34,   30,   14,   35,
  370.        35,   28,   29,    0,   39,    0,   29,   29,    0,   32,
  371.        28,   32,   21,    0,    0,    0,    0,   58,   28
  372.     } ;
  373.  
  374. static const short int yy_def[40] =
  375.     {   0,
  376.        38,    1,   38,   38,   38,   38,   38,   38,   38,   38,
  377.        38,   38,   38,   38,   39,   38,   39,   39,   39,   39,
  378.        38,   38,   38,   14,   38,   39,   39,   39,   39,   39,
  379.        39,   38,   38,   39,   39,   39,   39,    0,   38
  380.     } ;
  381.  
  382. static const short int yy_nxt[83] =
  383.     {   0,
  384.         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
  385.        14,   15,   15,   16,   17,   18,   15,   15,   19,   15,
  386.        15,   15,   20,   15,   21,   21,   21,   21,   23,   26,
  387.        24,   33,   25,   29,   30,   25,   21,   21,   22,   22,
  388.        25,   25,   33,   25,   25,   32,   32,   37,   36,   33,
  389.        35,   34,   31,   28,   27,   22,   38,    3,   38,   38,
  390.        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  391.        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  392.        38,   38
  393.     } ;
  394.  
  395. static const short int yy_chk[83] =
  396.     {   0,
  397.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  398.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  399.         1,    1,    1,    1,    5,    5,    6,    6,   14,   39,
  400.        14,   33,   14,   19,   19,   14,   21,   21,   22,   23,
  401.        22,   23,   32,   22,   23,   25,   25,   31,   30,   25,
  402.        28,   27,   20,   18,   17,   12,    3,   38,   38,   38,
  403.        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  404.        38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
  405.        38,   38
  406.     } ;
  407.  
  408. static yy_state_type yy_last_accepting_state;
  409. static YY_CHAR *yy_last_accepting_cpos;
  410.  
  411. /* the intent behind this definition is that it'll catch
  412.  * any uses of REJECT which flex missed
  413.  */
  414. #define REJECT reject_used_but_not_detected
  415. #define yymore() yymore_used_but_not_detected
  416. #define YY_MORE_ADJ 0
  417.  
  418. /* these variables are all declared out here so that section 3 code can
  419.  * manipulate them
  420.  */
  421. /* points to current character in buffer */
  422. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  423. static int yy_init = 1;        /* whether we need to initialize */
  424. static int yy_start = 0;    /* start state number */
  425.  
  426. /* flag which is used to allow yywrap()'s to do buffer switches
  427.  * instead of setting up a fresh yyin.  A bit of a hack ...
  428.  */
  429. static int yy_did_buffer_switch_on_eof;
  430.  
  431. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  432. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  433. static int yy_get_next_buffer YY_PROTO(( void ));
  434. static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
  435. void yyrestart YY_PROTO(( FILE *input_file ));
  436. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  437. void yy_load_buffer_state YY_PROTO(( void ));
  438. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( char *file, int size ));
  439. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  440. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, char *file ));
  441.  
  442. #define yy_new_buffer yy_create_buffer
  443.  
  444. #ifdef __cplusplus
  445. static int yyinput YY_PROTO(( void ));
  446. #else
  447. static int input YY_PROTO(( void ));
  448. #endif
  449.  
  450. void yyreset( void );
  451.  
  452. YY_DECL
  453.     {
  454.     register yy_state_type yy_current_state;
  455.     register YY_CHAR *yy_cp, *yy_bp;
  456.     register int yy_act;
  457.  
  458.  
  459.  
  460.     if ( yy_init )
  461.     {
  462.     YY_USER_INIT;
  463.  
  464.     if ( ! yy_start )
  465.         yy_start = 1;    /* first start state */
  466.  
  467.     if ( ! yyin )
  468.         YY_FATAL_ERROR( "yyin is a NULL pointer" );
  469.  
  470.     if ( ! yyout )
  471.         yyout = stdout;
  472.  
  473.     if ( yy_current_buffer )
  474.         yy_init_buffer( yy_current_buffer, yyin );
  475.     else
  476.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  477.  
  478.     yy_load_buffer_state();
  479.  
  480.     yy_init = 0;
  481.     }
  482.  
  483.     while ( 1 )        /* loops until end-of-file is reached */
  484.     {
  485.     yy_cp = yy_c_buf_p;
  486.  
  487.     /* support of yytext */
  488.     *yy_cp = yy_hold_char;
  489.  
  490.     /* yy_bp points to the position in yy_ch_buf of the start of the
  491.      * current run.
  492.      */
  493.     yy_bp = yy_cp;
  494.  
  495.     yy_current_state = yy_start;
  496. yy_match:
  497.     do
  498.         {
  499.         register YY_CHAR yy_c = yy_ec[*yy_cp];
  500.         if ( yy_accept[yy_current_state] )
  501.         {
  502.         yy_last_accepting_state = yy_current_state;
  503.         yy_last_accepting_cpos = yy_cp;
  504.         }
  505.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  506.         {
  507.         yy_current_state = yy_def[yy_current_state];
  508.         if ( yy_current_state >= 39 )
  509.             yy_c = yy_meta[yy_c];
  510.         }
  511.         yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  512.         ++yy_cp;
  513.         }
  514.     while ( yy_current_state != 38 );
  515.     yy_cp = yy_last_accepting_cpos;
  516.     yy_current_state = yy_last_accepting_state;
  517.  
  518. yy_find_action:
  519.     yy_act = yy_accept[yy_current_state];
  520.  
  521.     YY_DO_BEFORE_ACTION;
  522.     YY_USER_ACTION;
  523.  
  524. do_action:    /* this label is used only to access EOF actions */
  525.  
  526.  
  527.     switch ( yy_act )
  528.         {
  529.         case 0: /* must backtrack */
  530.         /* undo the effects of YY_DO_BEFORE_ACTION */
  531.         *yy_cp = yy_hold_char;
  532.         yy_cp = yy_last_accepting_cpos;
  533.         yy_current_state = yy_last_accepting_state;
  534.         goto yy_find_action;
  535.  
  536. case 1:
  537. {
  538.          faux = (float) atof( yytext );
  539.          tr.node[tr.nnode].item = 'N';
  540.          for( k=0; k<tr.nnum; k++ )
  541.           if( faux == tr.constant[k] ) break;
  542.          tr.node[tr.nnode].val = (unsigned char) k;
  543.          if( k==tr.nnum )
  544.          {
  545.           tr.constant[tr.nnum] = faux;
  546.           ++tr.nnum;
  547.          }
  548.          if( tr.nnode==253 )
  549.          {
  550.           if( !errfl )
  551.            sprintf( errstr, "ERROR - expression too long." );
  552.           errfl++;
  553.           yyterminate();
  554.          }
  555.          ++tr.nnode;
  556.          return 1;
  557.          }
  558.     YY_BREAK
  559. case 2:
  560. {
  561.          tr.node[tr.nnode].item = 'F';
  562.          tr.node[tr.nnode].val = 'L';
  563.          if( tr.nnode==253 )
  564.          {
  565.           if( !errfl )
  566.            sprintf( errstr, "ERROR - expression too long." );
  567.           errfl++;
  568.           yyterminate();
  569.          }
  570.          ++tr.nnode;
  571.          return 1;
  572.         }
  573.     YY_BREAK
  574. case 3:
  575. {
  576.          tr.node[tr.nnode].item = 'F';
  577.          tr.node[tr.nnode].val = 'l';
  578.          if( tr.nnode==253 )
  579.          {
  580.           if( !errfl )
  581.            sprintf( errstr, "ERROR - expression too long." );
  582.           errfl++;
  583.           yyterminate();
  584.          }
  585.          ++tr.nnode;
  586.          return 1;
  587.         }
  588.     YY_BREAK
  589. case 4:
  590. {
  591.          tr.node[tr.nnode].item = 'F';
  592.          tr.node[tr.nnode].val = 'e';
  593.          if( tr.nnode==253 )
  594.          {
  595.           if( !errfl )
  596.            sprintf( errstr, "ERROR - expression too long." );
  597.           errfl++;
  598.           yyterminate();
  599.          }
  600.          ++tr.nnode;
  601.          return 1;
  602.         }
  603.     YY_BREAK
  604. case 5:
  605. {
  606.          tr.node[tr.nnode].item = 'F';
  607.          tr.node[tr.nnode].val = 'S';
  608.          if( tr.nnode==253 )
  609.          {
  610.           if( !errfl )
  611.            sprintf( errstr, "ERROR - expression too long." );
  612.           errfl++;
  613.           yyterminate();
  614.          }
  615.          ++tr.nnode;
  616.          return 1;
  617.         }
  618.     YY_BREAK
  619. case 6:
  620. {
  621.          tr.node[tr.nnode].item = 'F';
  622.          tr.node[tr.nnode].val = 'C';
  623.          if( tr.nnode==253 )
  624.          {
  625.           if( !errfl )
  626.            sprintf( errstr, "ERROR - expression too long." );
  627.           errfl++;
  628.           yyterminate();
  629.          }
  630.          ++tr.nnode;
  631.          return 1;
  632.         }
  633.     YY_BREAK
  634. case 7:
  635. {
  636.          tr.node[tr.nnode].item = 'I';
  637.          for( k=0; k<tr.nid; k++ )
  638.           if( strncmp( &tr.id[k][0], yytext, 8 ) == 0 ) break;
  639.          tr.node[tr.nnode].val = (unsigned char) k;
  640.          if( k==tr.nid )
  641.          {
  642.           strncpy( &tr.id[tr.nid][0], yytext, 8 );
  643.           tr.id[tr.nid][8] = '\0';
  644.           tr.id[tr.nid][9] = '\0';
  645.           ++tr.nid;
  646.          }
  647.          if( tr.nnode==253 )
  648.          {
  649.           if( !errfl )
  650.            sprintf( errstr, "ERROR - expression too long." );
  651.           errfl++;
  652.           yyterminate();
  653.          }
  654.          ++tr.nnode;
  655.          return 1;
  656.         }
  657.     YY_BREAK
  658. case 8:
  659. {
  660.          tr.node[tr.nnode].item = 'O';
  661.          tr.node[tr.nnode].val = '+';
  662.          if( tr.nnode==253 )
  663.          {
  664.           if( !errfl )
  665.            sprintf( errstr, "ERROR - expression too long." );
  666.           errfl++;
  667.           yyterminate();
  668.          }
  669.          ++tr.nnode;
  670.          return 1;
  671.         }
  672.     YY_BREAK
  673. case 9:
  674. {
  675.          tr.node[tr.nnode].item = 'O';
  676.          tr.node[tr.nnode].val = '-';
  677.          if( tr.nnode==253 )
  678.          {
  679.           if( !errfl )
  680.            sprintf( errstr, "ERROR - expression too long." );
  681.           errfl++;
  682.           yyterminate();
  683.          }
  684.          ++tr.nnode;
  685.          return 1;
  686.         }
  687.     YY_BREAK
  688. case 10:
  689. {
  690.          tr.node[tr.nnode].item = 'O';
  691.          tr.node[tr.nnode].val = '*';
  692.          ++tr.nnode;
  693.          return 1;
  694.         }
  695.     YY_BREAK
  696. case 11:
  697. {
  698.          tr.node[tr.nnode].item = 'O';
  699.          tr.node[tr.nnode].val = '/';
  700.          if( tr.nnode==253 )
  701.          {
  702.           if( !errfl )
  703.            sprintf( errstr, "ERROR - expression too long." );
  704.           errfl++;
  705.           yyterminate();
  706.          }
  707.          ++tr.nnode;
  708.          return 1;
  709.         }
  710.     YY_BREAK
  711. case 12:
  712. {
  713.          tr.node[tr.nnode].item = 'O';
  714.          tr.node[tr.nnode].val = '^';
  715.          if( tr.nnode==253 )
  716.          {
  717.           if( !errfl )
  718.            sprintf( errstr, "ERROR - expression too long." );
  719.           errfl++;
  720.           yyterminate();
  721.          }
  722.          ++tr.nnode;
  723.          return 1;
  724.         }
  725.     YY_BREAK
  726. case 13:
  727. {
  728.          tr.node[tr.nnode].item = 'O';
  729.          tr.node[tr.nnode].val = '(';
  730.          if( tr.nnode==253 )
  731.          {
  732.           if( !errfl )
  733.            sprintf( errstr, "ERROR - expression too long." );
  734.           errfl++;
  735.           yyterminate();
  736.          }
  737.          ++tr.nnode;
  738.          return 1;
  739.         }
  740.     YY_BREAK
  741. case 14:
  742. {
  743.          tr.node[tr.nnode].item = 'O';
  744.          tr.node[tr.nnode].val = ')';
  745.          if( tr.nnode==253 )
  746.          {
  747.           if( !errfl )
  748.            sprintf( errstr, "ERROR - expression too long." );
  749.           errfl++;
  750.           yyterminate();
  751.          }
  752.          ++tr.nnode;
  753.          return 1;
  754.         }
  755.     YY_BREAK
  756. case 15:
  757. /* eat up whitespace    */
  758.     YY_BREAK
  759. case 16:
  760. {
  761.          if( !errfl )
  762.           sprintf( errstr, "ERROR - character not allowed: %s", yytext );
  763.          errfl++;
  764.          yyterminate();
  765.         }
  766.     YY_BREAK
  767. case 17:
  768. YY_FATAL_ERROR( "flex scanner jammed" );
  769.     YY_BREAK
  770. case YY_STATE_EOF(INITIAL):
  771.     yyterminate();
  772.  
  773.         case YY_END_OF_BUFFER:
  774.         {
  775.         /* amount of text matched not including the EOB char */
  776.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  777.  
  778.         /* undo the effects of YY_DO_BEFORE_ACTION */
  779.         *yy_cp = yy_hold_char;
  780.  
  781.         /* note that here we test for yy_c_buf_p "<=" to the position
  782.          * of the first EOB in the buffer, since yy_c_buf_p will
  783.          * already have been incremented past the NUL character
  784.          * (since all states make transitions on EOB to the end-
  785.          * of-buffer state).  Contrast this with the test in yyinput().
  786.          */
  787.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  788.             /* this was really a NUL */
  789.             {
  790.             yy_state_type yy_next_state;
  791.  
  792.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  793.  
  794.             yy_current_state = yy_get_previous_state();
  795.  
  796.             /* okay, we're now positioned to make the
  797.              * NUL transition.  We couldn't have
  798.              * yy_get_previous_state() go ahead and do it
  799.              * for us because it doesn't know how to deal
  800.              * with the possibility of jamming (and we
  801.              * don't want to build jamming into it because
  802.              * then it will run more slowly)
  803.              */
  804.  
  805.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  806.  
  807.             yy_bp = yytext + YY_MORE_ADJ;
  808.  
  809.             if ( yy_next_state )
  810.             {
  811.             /* consume the NUL */
  812.             yy_cp = ++yy_c_buf_p;
  813.             yy_current_state = yy_next_state;
  814.             goto yy_match;
  815.             }
  816.  
  817.             else
  818.             {
  819.                 yy_cp = yy_last_accepting_cpos;
  820.                 yy_current_state = yy_last_accepting_state;
  821.             goto yy_find_action;
  822.             }
  823.             }
  824.  
  825.         else switch ( yy_get_next_buffer() )
  826.             {
  827.             case EOB_ACT_END_OF_FILE:
  828.             {
  829.             yy_did_buffer_switch_on_eof = 0;
  830.  
  831.             if ( yywrap() )
  832.                 {
  833.                 /* note: because we've taken care in
  834.                  * yy_get_next_buffer() to have set up yytext,
  835.                  * we can now set up yy_c_buf_p so that if some
  836.                  * total hoser (like flex itself) wants
  837.                  * to call the scanner after we return the
  838.                  * YY_NULL, it'll still work - another YY_NULL
  839.                  * will get returned.
  840.                  */
  841.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  842.  
  843.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  844.                 goto do_action;
  845.                 }
  846.  
  847.             else
  848.                 {
  849.                 if ( ! yy_did_buffer_switch_on_eof )
  850.                 YY_NEW_FILE;
  851.                 }
  852.             }
  853.             break;
  854.  
  855.             case EOB_ACT_CONTINUE_SCAN:
  856.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  857.  
  858.             yy_current_state = yy_get_previous_state();
  859.  
  860.             yy_cp = yy_c_buf_p;
  861.             yy_bp = yytext + YY_MORE_ADJ;
  862.             goto yy_match;
  863.  
  864.             case EOB_ACT_LAST_MATCH:
  865.             yy_c_buf_p =
  866.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  867.  
  868.             yy_current_state = yy_get_previous_state();
  869.  
  870.             yy_cp = yy_c_buf_p;
  871.             yy_bp = yytext + YY_MORE_ADJ;
  872.             goto yy_find_action;
  873.             }
  874.         break;
  875.         }
  876.  
  877.         default:
  878.         YY_FATAL_ERROR(
  879.             "fatal flex scanner internal error--no action found" );
  880.         }
  881.     }
  882.     }
  883.  
  884.  
  885. /* yy_get_next_buffer - try to read in a new buffer
  886.  *
  887.  * synopsis
  888.  *     int yy_get_next_buffer();
  889.  *
  890.  * returns a code representing an action
  891.  *     EOB_ACT_LAST_MATCH -
  892.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  893.  *     EOB_ACT_END_OF_FILE - end of file
  894.  */
  895.  
  896. static int yy_get_next_buffer()
  897.  
  898.     {
  899.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  900.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  901.     register int number_to_move, i;
  902.     int ret_val;
  903.  
  904.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  905.     YY_FATAL_ERROR(
  906.         "fatal flex scanner internal error--end of buffer missed" );
  907.  
  908.     /* try to read more data */
  909.  
  910.     /* first move last chars to start of buffer */
  911.     number_to_move = yy_c_buf_p - yytext;
  912.  
  913.     for ( i = 0; i < number_to_move; ++i )
  914.     *(dest++) = *(source++);
  915.  
  916.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  917.     /* don't do the read, it's not guaranteed to return an EOF,
  918.      * just force an EOF
  919.      */
  920.     yy_n_chars = 0;
  921.  
  922.     else
  923.     {
  924.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  925.  
  926.     if ( num_to_read > YY_READ_BUF_SIZE )
  927.         num_to_read = YY_READ_BUF_SIZE;
  928.  
  929.     else if ( num_to_read <= 0 )
  930.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  931.  
  932.      strncpy( (char *) &yy_current_buffer->yy_ch_buf[number_to_move], yyin, num_to_read );
  933.      if ( strlen( yyin ) < num_to_read )
  934.       yy_n_chars=strlen( yyin );
  935.      else
  936.       yy_n_chars=num_to_read;
  937.      yyin += yy_n_chars;
  938.  
  939. /*    YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  940.           yy_n_chars, num_to_read );*/
  941.     }
  942.  
  943.     if ( yy_n_chars == 0 )
  944.     {
  945.     if ( number_to_move == 1 )
  946.         {
  947.         ret_val = EOB_ACT_END_OF_FILE;
  948.         yy_current_buffer->yy_eof_status = EOF_DONE;
  949.         }
  950.  
  951.     else
  952.         {
  953.         ret_val = EOB_ACT_LAST_MATCH;
  954.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  955.         }
  956.     }
  957.  
  958.     else
  959.     ret_val = EOB_ACT_CONTINUE_SCAN;
  960.  
  961.     yy_n_chars += number_to_move;
  962.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  963.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  964.  
  965.     /* yytext begins at the second character in yy_ch_buf; the first
  966.      * character is the one which preceded it before reading in the latest
  967.      * buffer; it needs to be kept around in case it's a newline, so
  968.      * yy_get_previous_state() will have with '^' rules active
  969.      */
  970.  
  971.     yytext = &yy_current_buffer->yy_ch_buf[1];
  972.  
  973.     return ( ret_val );
  974.     }
  975.  
  976.  
  977. /* yy_get_previous_state - get the state just before the EOB char was reached
  978.  *
  979.  * synopsis
  980.  *     yy_state_type yy_get_previous_state();
  981.  */
  982.  
  983. static yy_state_type yy_get_previous_state()
  984.  
  985.     {
  986.     register yy_state_type yy_current_state;
  987.     register YY_CHAR *yy_cp;
  988.  
  989.     yy_current_state = yy_start;
  990.  
  991.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  992.     {
  993.     register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
  994.     if ( yy_accept[yy_current_state] )
  995.         {
  996.         yy_last_accepting_state = yy_current_state;
  997.         yy_last_accepting_cpos = yy_cp;
  998.         }
  999.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1000.         {
  1001.         yy_current_state = yy_def[yy_current_state];
  1002.         if ( yy_current_state >= 39 )
  1003.         yy_c = yy_meta[yy_c];
  1004.         }
  1005.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1006.     }
  1007.  
  1008.     return ( yy_current_state );
  1009.     }
  1010.  
  1011.  
  1012. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1013.  *
  1014.  * synopsis
  1015.  *     next_state = yy_try_NUL_trans( current_state );
  1016.  */
  1017.  
  1018. #ifdef YY_USE_PROTOS
  1019. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  1020. #else
  1021. static yy_state_type yy_try_NUL_trans( yy_current_state )
  1022. register yy_state_type yy_current_state;
  1023. #endif
  1024.  
  1025.     {
  1026.     register int yy_is_jam;
  1027.     register YY_CHAR *yy_cp = yy_c_buf_p;
  1028.  
  1029.     register YY_CHAR yy_c = 1;
  1030.     if ( yy_accept[yy_current_state] )
  1031.     {
  1032.     yy_last_accepting_state = yy_current_state;
  1033.     yy_last_accepting_cpos = yy_cp;
  1034.     }
  1035.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1036.     {
  1037.     yy_current_state = yy_def[yy_current_state];
  1038.     if ( yy_current_state >= 39 )
  1039.         yy_c = yy_meta[yy_c];
  1040.     }
  1041.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1042.     yy_is_jam = (yy_current_state == 38);
  1043.  
  1044.     return ( yy_is_jam ? 0 : yy_current_state );
  1045.     }
  1046.  
  1047.  
  1048. #ifdef YY_USE_PROTOS
  1049. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  1050. #else
  1051. static void yyunput( c, yy_bp )
  1052. YY_CHAR c;
  1053. register YY_CHAR *yy_bp;
  1054. #endif
  1055.  
  1056.     {
  1057.     register YY_CHAR *yy_cp = yy_c_buf_p;
  1058.  
  1059.     /* undo effects of setting up yytext */
  1060.     *yy_cp = yy_hold_char;
  1061.  
  1062.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1063.     { /* need to shift things up to make room */
  1064.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  1065.     register YY_CHAR *dest =
  1066.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  1067.     register YY_CHAR *source =
  1068.         &yy_current_buffer->yy_ch_buf[number_to_move];
  1069.  
  1070.     while ( source > yy_current_buffer->yy_ch_buf )
  1071.         *--dest = *--source;
  1072.  
  1073.     yy_cp += dest - source;
  1074.     yy_bp += dest - source;
  1075.     yy_n_chars = yy_current_buffer->yy_buf_size;
  1076.  
  1077.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1078.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1079.     }
  1080.  
  1081.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  1082.     yy_cp[-2] = '\n';
  1083.  
  1084.     *--yy_cp = c;
  1085.  
  1086.     /* note: the formal parameter *must* be called "yy_bp" for this
  1087.      *       macro to now work correctly
  1088.      */
  1089.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  1090.     }
  1091.  
  1092.  
  1093. #ifdef __cplusplus
  1094. static int yyinput()
  1095. #else
  1096. static int input()
  1097. #endif
  1098.  
  1099.     {
  1100.     int c;
  1101.     YY_CHAR *yy_cp = yy_c_buf_p;
  1102.  
  1103.     *yy_cp = yy_hold_char;
  1104.  
  1105.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1106.     {
  1107.     /* yy_c_buf_p now points to the character we want to return.
  1108.      * If this occurs *before* the EOB characters, then it's a
  1109.      * valid NUL; if not, then we've hit the end of the buffer.
  1110.      */
  1111.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1112.         /* this was really a NUL */
  1113.         *yy_c_buf_p = '\0';
  1114.  
  1115.     else
  1116.         { /* need more input */
  1117.         yytext = yy_c_buf_p;
  1118.         ++yy_c_buf_p;
  1119.  
  1120.         switch ( yy_get_next_buffer() )
  1121.         {
  1122.         case EOB_ACT_END_OF_FILE:
  1123.             {
  1124.             if ( yywrap() )
  1125.             {
  1126.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  1127.             return ( EOF );
  1128.             }
  1129.  
  1130.             YY_NEW_FILE;
  1131.  
  1132. #ifdef __cplusplus
  1133.             return ( yyinput() );
  1134. #else
  1135.             return ( input() );
  1136. #endif
  1137.             }
  1138.             break;
  1139.  
  1140.         case EOB_ACT_CONTINUE_SCAN:
  1141.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  1142.             break;
  1143.  
  1144.         case EOB_ACT_LAST_MATCH:
  1145. #ifdef __cplusplus
  1146.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  1147. #else
  1148.             YY_FATAL_ERROR( "unexpected last match in input()" );
  1149. #endif
  1150.         }
  1151.         }
  1152.     }
  1153.  
  1154.     c = *yy_c_buf_p;
  1155.     yy_hold_char = *++yy_c_buf_p;
  1156.  
  1157.     return ( c );
  1158.     }
  1159.  
  1160.  
  1161. #ifdef YY_USE_PROTOS
  1162. void yyrestart( char *input_file )
  1163. #else
  1164. void yyrestart( input_file )
  1165. char *input_file;
  1166. #endif
  1167.  
  1168.     {
  1169.     yy_init_buffer( yy_current_buffer, input_file );
  1170.     yy_load_buffer_state();
  1171.     }
  1172.  
  1173.  
  1174. #ifdef YY_USE_PROTOS
  1175. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1176. #else
  1177. void yy_switch_to_buffer( new_buffer )
  1178. YY_BUFFER_STATE new_buffer;
  1179. #endif
  1180.  
  1181.     {
  1182.     if ( yy_current_buffer == new_buffer )
  1183.     return;
  1184.  
  1185.     if ( yy_current_buffer )
  1186.     {
  1187.     /* flush out information for old buffer */
  1188.     *yy_c_buf_p = yy_hold_char;
  1189.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1190.     yy_current_buffer->yy_n_chars = yy_n_chars;
  1191.     }
  1192.  
  1193.     yy_current_buffer = new_buffer;
  1194.     yy_load_buffer_state();
  1195.  
  1196.     /* we don't actually know whether we did this switch during
  1197.      * EOF (yywrap()) processing, but the only time this flag
  1198.      * is looked at is after yywrap() is called, so it's safe
  1199.      * to go ahead and always set it.
  1200.      */
  1201.     yy_did_buffer_switch_on_eof = 1;
  1202.     }
  1203.  
  1204.  
  1205. #ifdef YY_USE_PROTOS
  1206. void yy_load_buffer_state( void )
  1207. #else
  1208. void yy_load_buffer_state()
  1209. #endif
  1210.  
  1211.     {
  1212.     yy_n_chars = yy_current_buffer->yy_n_chars;
  1213.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1214.     yyin = yy_current_buffer->yy_input_file;
  1215.     yy_hold_char = *yy_c_buf_p;
  1216.     }
  1217.  
  1218.  
  1219. #ifdef YY_USE_PROTOS
  1220. YY_BUFFER_STATE yy_create_buffer( char *file, int size )
  1221. #else
  1222. YY_BUFFER_STATE yy_create_buffer( file, size )
  1223. char *file;
  1224. int size;
  1225. #endif
  1226.  
  1227.     {
  1228.     YY_BUFFER_STATE b;
  1229.  
  1230.     b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  1231.  
  1232.     if ( ! b )
  1233.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1234.  
  1235.     b->yy_buf_size = size;
  1236.  
  1237.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1238.      * we need to put in 2 end-of-buffer characters.
  1239.      */
  1240.     b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  1241.  
  1242.     if ( ! b->yy_ch_buf )
  1243.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1244.  
  1245.     yy_init_buffer( b, file );
  1246.  
  1247.     return ( b );
  1248.     }
  1249.  
  1250.  
  1251. #ifdef YY_USE_PROTOS
  1252. void yy_delete_buffer( YY_BUFFER_STATE b )
  1253. #else
  1254. void yy_delete_buffer( b )
  1255. YY_BUFFER_STATE b;
  1256. #endif
  1257.  
  1258.     {
  1259.     if ( b == yy_current_buffer )
  1260.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  1261.  
  1262.     free( (char *) b->yy_ch_buf );
  1263.     free( (char *) b );
  1264.     }
  1265.  
  1266.  
  1267. #ifdef YY_USE_PROTOS
  1268. void yy_init_buffer( YY_BUFFER_STATE b, char *file )
  1269. #else
  1270. void yy_init_buffer( b, file )
  1271. YY_BUFFER_STATE b;
  1272. char *file;
  1273. #endif
  1274.  
  1275.     {
  1276.     b->yy_input_file = file;
  1277.  
  1278.     /* we put in the '\n' and start reading from [1] so that an
  1279.      * initial match-at-newline will be true.
  1280.      */
  1281.  
  1282.     b->yy_ch_buf[0] = '\n';
  1283.     b->yy_n_chars = 1;
  1284.  
  1285.     /* we always need two end-of-buffer characters.  The first causes
  1286.      * a transition to the end-of-buffer state.  The second causes
  1287.      * a jam in that state.
  1288.      */
  1289.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1290.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1291.  
  1292.     b->yy_buf_pos = &b->yy_ch_buf[1];
  1293.  
  1294.     b->yy_eof_status = EOF_NOT_SEEN;
  1295.     }
  1296.  
  1297. void yyreset( void )
  1298. {
  1299.  YY_NEW_FILE;
  1300. }
  1301.