home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / command.l.c < prev    next >
Encoding:
C/C++ Source or Header  |  2006-10-19  |  58.1 KB  |  2,342 lines

  1. #line 2 "command.l.c"
  2. /* A lexical scanner generated by flex */
  3.  
  4. /* Scanner skeleton version:
  5.  * $Header: /usr/cvs/V9t9/source/command.l.c,v 1.22 2000/12/28 02:32:19 ejs 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. #include <unistd.h>
  14.  
  15.  
  16. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  17. #ifdef c_plusplus
  18. #ifndef __cplusplus
  19. #define __cplusplus
  20. #endif
  21. #endif
  22.  
  23.  
  24. #ifdef __cplusplus
  25.  
  26. #include <stdlib.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 *yy_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. typedef unsigned char YY_CHAR;
  266. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  267. typedef int yy_state_type;
  268. extern char *yytext;
  269. #define yytext_ptr yytext
  270.  
  271. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  272. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  273. static int yy_get_next_buffer YY_PROTO(( void ));
  274. static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
  275.  
  276. /* Done after the current pattern has been matched and before the
  277.  * corresponding action - sets up yytext.
  278.  */
  279. #define YY_DO_BEFORE_ACTION \
  280.     yytext_ptr = yy_bp; \
  281.     yyleng = (int) (yy_cp - yy_bp); \
  282.     yy_hold_char = *yy_cp; \
  283.     *yy_cp = '\0'; \
  284.     yy_c_buf_p = yy_cp;
  285.  
  286. #define YY_NUM_RULES 57
  287. #define YY_END_OF_BUFFER 58
  288. static yyconst short int yy_accept[186] =
  289.     {   0,
  290.         0,    0,   42,   42,   36,   36,    0,    0,    0,    0,
  291.        58,   56,   34,   27,   27,   56,   45,   28,   56,   56,
  292.        56,   55,    4,    4,   56,   56,   56,   55,   55,   55,
  293.        55,   55,   55,   55,   55,   55,   55,   55,   55,   41,
  294.        56,   55,   55,   55,   55,   55,   56,   42,   57,   44,
  295.        36,   37,   37,   38,   32,   31,   31,   32,   54,   53,
  296.        53,   52,   54,   27,   12,    2,   13,    0,    0,    4,
  297.         4,   55,   35,   55,    3,    0,    8,   10,   11,    9,
  298.         7,   55,   55,   55,   55,   55,   55,    6,   55,    5,
  299.        14,   55,   55,   55,   55,   15,   55,   17,   55,   55,
  300.  
  301.        14,   42,    0,   36,   37,   37,   38,   39,   39,   38,
  302.        40,   31,    0,   53,   46,   51,   48,   50,   49,   47,
  303.        55,    0,   33,   33,    1,   13,   55,   55,   55,   55,
  304.        55,   55,   55,   23,   55,   15,   16,   55,   18,    0,
  305.         0,   55,   55,   55,   55,   55,   22,   55,   55,   43,
  306.        43,    0,    0,   55,   55,   55,   55,   55,   55,   19,
  307.         0,   21,   55,   25,   55,   55,    0,   55,   55,   20,
  308.         0,   55,   55,   30,   26,   55,   30,   30,   30,   55,
  309.        30,   24,   29,   29,    0
  310.     } ;
  311.  
  312. static yyconst int yy_ec[256] =
  313.     {   0,
  314.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  315.         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
  316.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  317.         1,    2,    5,    6,    7,    8,    1,    9,    1,   10,
  318.        10,   11,   10,    1,   12,    1,   13,   14,   15,   15,
  319.        15,   15,   15,   15,   15,   16,   17,    1,   10,   18,
  320.        19,   20,    1,    1,   21,   22,   23,   24,   25,   26,
  321.        27,   28,   29,   28,   30,   31,   32,   33,   34,   28,
  322.        28,   35,   36,   37,   38,   39,   28,   40,   41,   28,
  323.        42,   43,   44,   45,   46,    1,   47,   48,   49,   50,
  324.  
  325.        51,   52,   28,   28,   53,   28,   28,   54,   28,   55,
  326.        56,   57,   28,   58,   59,   60,   61,   28,   28,   62,
  327.        41,   28,    1,   63,    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.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  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.  
  336.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  337.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  338.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  339.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  340.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  341.         1,    1,    1,    1,    1
  342.     } ;
  343.  
  344. static yyconst int yy_meta[64] =
  345.     {   0,
  346.         1,    2,    3,    2,    1,    2,    2,    1,    2,    2,
  347.         4,    2,    1,    5,    5,    5,    5,    1,    2,    1,
  348.         5,    5,    5,    5,    5,    5,    1,    1,    1,    1,
  349.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  350.         1,    1,    1,    6,    2,    1,    5,    5,    5,    5,
  351.         5,    5,    1,    1,    1,    1,    1,    1,    1,    1,
  352.         1,    1,    1
  353.     } ;
  354.  
  355. static yyconst short int yy_base[200] =
  356.     {   0,
  357.         0,    0,   61,   63,   65,   67,   69,   71,   76,   80,
  358.       450,  451,  451,  451,  446,  429,  451,  451,    0,  438,
  359.        73,   80,   80,   84,   84,  427,   89,   81,   95,  434,
  360.        99,  100,  101,  102,  114,  104,  106,  110,  123,  451,
  361.       399,  107,  116,  128,  115,  120,  380,  438,  451,  451,
  362.       125,  451,  438,  164,  451,  451,  437,  384,  451,  451,
  363.       435,  451,  144,  451,  451,    0,  451,    0,  181,  191,
  364.       195,  426,  451,  252,  199,    0,  451,  451,  451,  451,
  365.       451,  132,  122,  140,  142,  167,  149,  425,  174,  424,
  366.       423,  159,  179,  192,  207,  451,  173,  422,  214,  161,
  367.  
  368.       451,  428,  428,  217,  451,  427,  225,  451,  426,  228,
  369.       451,  451,  379,  451,  451,  451,  451,  451,  451,  451,
  370.       296,  230,  451,  424,    0,  415,  219,  211,  213,  148,
  371.       233,  237,  239,  414,  226,  413,  412,  224,  408,  242,
  372.       359,  249,  262,  246,  241,  264,  379,  272,  265,  451,
  373.       381,  277,  317,  271,  280,  273,  299,  277,  303,  366,
  374.       300,  335,  121,  333,  306,  300,  292,  308,  307,  329,
  375.       336,  309,  312,  283,  323,  311,    0,  290,  322,  313,
  376.       325,  282,  333,  345,  451,  351,  357,  363,  369,  152,
  377.       375,  381,  386,  392,  398,   72,  404,  410,  416
  378.  
  379.     } ;
  380.  
  381. static yyconst short int yy_def[200] =
  382.     {   0,
  383.       185,    1,  186,  186,  187,  187,  188,  188,  189,  189,
  384.       185,  185,  185,  185,  185,  185,  185,  185,  190,  185,
  385.       185,  191,  185,  185,  185,  185,  185,  191,  191,  191,
  386.       191,  191,  191,  191,  191,  191,  191,  191,  191,  185,
  387.       185,  191,  191,  191,  191,  191,  185,  192,  185,  185,
  388.       193,  185,  185,  194,  185,  185,  185,  185,  185,  185,
  389.       185,  185,  185,  185,  185,  190,  185,  190,  185,  185,
  390.       185,  191,  185,  195,  185,  196,  185,  185,  185,  185,
  391.       185,  191,  191,  191,  191,  191,  191,  191,  191,  191,
  392.       191,  191,  191,  191,  191,  185,  191,  191,  191,  191,
  393.  
  394.       185,  192,  185,  193,  185,  185,  194,  185,  185,  194,
  395.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  396.       195,  197,  185,  185,  196,  191,  191,  191,  191,  191,
  397.       191,  191,  191,  191,  191,  191,  191,  191,  191,  185,
  398.       185,  191,  191,  191,  191,  191,  191,  191,  191,  185,
  399.       185,  185,  185,  191,  191,  191,  191,  191,  191,  191,
  400.       185,  191,  191,  191,  191,  191,  185,  191,  191,  191,
  401.       185,  191,  191,  198,  191,  191,  198,  198,  199,  191,
  402.       199,  191,  199,  199,    0,  185,  185,  185,  185,  185,
  403.       185,  185,  185,  185,  185,  185,  185,  185,  185
  404.  
  405.     } ;
  406.  
  407. static yyconst short int yy_nxt[515] =
  408.     {   0,
  409.        12,   13,   14,   15,   16,   17,   18,   19,   20,   12,
  410.        12,   21,   22,   23,   24,   24,   24,   25,   26,   27,
  411.        28,   29,   30,   30,   30,   31,   32,   30,   30,   30,
  412.        30,   33,   34,   35,   36,   30,   37,   30,   30,   38,
  413.        39,   40,   12,   12,   41,   30,   42,   30,   30,   30,
  414.        30,   43,   30,   30,   34,   44,   45,   30,   30,   37,
  415.        30,   46,   47,   49,   49,   49,   49,   52,   53,   52,
  416.        53,   56,   57,   56,   57,   54,  125,   54,   60,   61,
  417.        68,   62,   60,   61,   69,   62,   70,   71,   71,   71,
  418.        73,  185,   74,   75,   75,   71,   71,   71,   71,   71,
  419.  
  420.        71,   77,   78,   65,   50,  185,   50,   80,   81,  185,
  421.       185,  185,  185,   82,  185,   83,  185,  185,   63,   84,
  422.       185,   58,   63,   58,  185,  185,  185,  105,  106,   87,
  423.       185,  185,  185,  185,   86,   88,   84,   92,  185,   89,
  424.        93,   76,  185,   94,   85,   84,   90,   95,   91,  115,
  425.       185,  168,  185,   89,  127,  126,   66,   88,  185,  185,
  426.        90,   97,   84,   93,  145,   89,  108,  109,   90,  185,
  427.       128,  185,   99,   95,  110,  100,  111,  185,  129,   89,
  428.       130,  133,   90,  185,  185,   98,  116,  131,   68,  185,
  429.       134,  117,   69,  128,   70,   71,   71,   71,  118,   88,
  430.  
  431.       132,  119,  185,  120,   75,   75,   71,   71,   71,   71,
  432.        71,   71,   75,   75,   71,   71,  135,  185,  139,  105,
  433.       106,  185,  137,  185,  185,   88,  136,  108,  109,  185,
  434.       108,  109,  123,  124,  185,  185,  185,  185,  110,  135,
  435.       111,  144,   90,  185,  150,  151,  143,  185,  142,  185,
  436.        90,  185,   76,  122,  123,  124,  185,  122,  122,  185,
  437.       122,  122,  122,  122,  146,   90,  138,  148,  147,  143,
  438.       122,  155,  185,  154,  185,  185,   90,  156,  149,  150,
  439.       151,  185,  185,  185,  178,  152,   88,  185,  179,  164,
  440.       185,  178,  185,  158,  162,  179,  122,  122,  123,  124,
  441.  
  442.       157,  122,  122,  159,  122,  122,  122,  122,  163,  185,
  443.       185,  165,   88,  185,  122,  164,  185,  185,  185,  185,
  444.       152,  185,  185,  185,  160,  177,  169,  166,  177,  173,
  445.       183,  170,  172,  185,  184,  180,  177,  174,  183,  185,
  446.       122,  176,  171,  185,  175,  185,  184,  182,  177,  167,
  447.       183,   48,   48,   48,   48,   48,   48,   51,   51,   51,
  448.        51,   51,   51,   55,   55,   55,   55,   55,   55,   59,
  449.        59,   59,   59,   59,   59,   72,  185,  161,   72,   72,
  450.        72,  102,  102,  150,  102,  102,  104,  104,  104,  185,
  451.       104,  104,  107,  107,  107,  107,  107,  107,  121,  121,
  452.  
  453.       121,  121,  121,  121,  122,  122,  122,  122,  122,  122,
  454.       177,  177,  153,  177,  177,  177,  181,  181,  185,  181,
  455.       181,  181,  185,  185,  185,  185,  123,  141,  108,  105,
  456.       140,  185,  185,  185,  185,  185,  185,  114,  113,  112,
  457.       105,  103,  101,   96,  185,   79,   67,   65,   64,  185,
  458.        11,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  459.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  460.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  461.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  462.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  463.  
  464.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  465.       185,  185,  185,  185
  466.     } ;
  467.  
  468. static yyconst short int yy_chk[515] =
  469.     {   0,
  470.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  471.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  472.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  473.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  474.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  475.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  476.         1,    1,    1,    3,    3,    4,    4,    5,    5,    6,
  477.         6,    7,    7,    8,    8,    5,  196,    6,    9,    9,
  478.        21,    9,   10,   10,   21,   10,   21,   21,   21,   21,
  479.        22,   28,   22,   23,   23,   23,   23,   24,   24,   24,
  480.  
  481.        24,   25,   25,   25,    3,   29,    4,   27,   27,   31,
  482.        32,   33,   34,   28,   36,   29,   37,   42,    9,   31,
  483.        38,    7,   10,    8,   35,   45,   43,   51,   51,   33,
  484.        46,  163,   83,   39,   32,   34,   43,   36,   44,   35,
  485.        37,   23,   82,   38,   31,   31,   35,   39,   35,   63,
  486.        84,  163,   85,   44,   83,   82,  190,   34,  130,   87,
  487.        44,   42,   43,   37,  130,   35,   54,   54,   35,   92,
  488.        84,  100,   45,   39,   54,   46,   54,   86,   85,   44,
  489.        85,   87,   44,   97,   89,   44,   63,   86,   69,   93,
  490.        92,   63,   69,   84,   69,   69,   69,   69,   63,   89,
  491.  
  492.        86,   63,   94,   63,   70,   70,   70,   70,   71,   71,
  493.        71,   71,   75,   75,   75,   75,   93,   95,  100,  104,
  494.       104,  128,   97,  129,   99,   89,   94,  107,  107,  127,
  495.       110,  110,  122,  122,  138,  107,  135,  107,  110,   93,
  496.       110,  129,   95,  131,  140,  140,  128,  132,  127,  133,
  497.       135,  145,   70,   74,   74,   74,  144,   74,   74,  142,
  498.        74,   74,   74,   74,  131,   95,   99,  133,  132,  128,
  499.        74,  144,  143,  142,  146,  149,  135,  145,  138,  152,
  500.       152,  154,  148,  156,  174,  140,  143,  158,  174,  156,
  501.       155,  178,  182,  146,  154,  178,   74,  121,  121,  121,
  502.  
  503.       145,  121,  121,  148,  121,  121,  121,  121,  155,  157,
  504.       166,  158,  143,  159,  121,  157,  165,  169,  168,  172,
  505.       152,  176,  173,  180,  149,  179,  165,  159,  181,  169,
  506.       181,  166,  168,  175,  183,  176,  183,  171,  183,  170,
  507.       121,  173,  167,  164,  172,  162,  184,  180,  184,  161,
  508.       184,  186,  186,  186,  186,  186,  186,  187,  187,  187,
  509.       187,  187,  187,  188,  188,  188,  188,  188,  188,  189,
  510.       189,  189,  189,  189,  189,  191,  160,  153,  191,  191,
  511.       191,  192,  192,  151,  192,  192,  193,  193,  193,  147,
  512.       193,  193,  194,  194,  194,  194,  194,  194,  195,  195,
  513.  
  514.       195,  195,  195,  195,  197,  197,  197,  197,  197,  197,
  515.       198,  198,  141,  198,  198,  198,  199,  199,  139,  199,
  516.       199,  199,  137,  136,  134,  126,  124,  113,  109,  106,
  517.       103,  102,   98,   91,   90,   88,   72,   61,   58,   57,
  518.        53,   48,   47,   41,   30,   26,   20,   16,   15,   11,
  519.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  520.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  521.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  522.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  523.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  524.  
  525.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  526.       185,  185,  185,  185
  527.     } ;
  528.  
  529. static yy_state_type yy_last_accepting_state;
  530. static char *yy_last_accepting_cpos;
  531.  
  532. /* The intent behind this definition is that it'll catch
  533.  * any uses of REJECT which flex missed.
  534.  */
  535. #define REJECT reject_used_but_not_detected
  536. #define yymore() yymore_used_but_not_detected
  537. #define YY_MORE_ADJ 0
  538. #define YY_RESTORE_YY_MORE_OFFSET
  539. char *yytext;
  540. #line 1 "command.l"
  541. #define INITIAL 0
  542. /*    scanner for configuration tokens  */
  543. #line 5 "command.l"
  544.     #define YY_NEVER_INTERACTIVE 1
  545.     #define YY_INPUT(buf,result,maxsize) result = command_context_getstring(cf, buf, maxsize)
  546.  
  547.     #include <stdarg.h>
  548.     #include <stdlib.h>
  549.     #include <string.h>
  550.     #include "StringUtils.h"
  551.  
  552.     #define __COMMAND_L__
  553.  
  554.     #include "log.h"
  555.  
  556.     #define _L LOG_COMMANDS | LOG_INFO
  557.  
  558.     #include "xmalloc.h"
  559.     #include "moduledb.h"
  560.     #include "command.h"
  561.     #include "command_parser.h"
  562.     #include "command_lexer.h"
  563.     
  564.     #undef DEBUG
  565. //    #define DEBUG 1
  566.  
  567.  
  568.         /*    Utilities  */
  569.  
  570.     static int 
  571.     command_context_new_text(command_context **context,
  572.             const command_context *outer,
  573.             const char *name, const char *data, int len);
  574.  
  575.     static int 
  576.     command_context_new_file(command_context **context,
  577.             const command_context *outer,
  578.             const char *filename);
  579.  
  580.     static void 
  581.     command_context_free(command_context **context);
  582.  
  583.     static int 
  584.     command_context_getstring(command_context *context, 
  585.         char *buf, int maxsize);
  586.  
  587.     command_symbol_table *command_scope = NULL;
  588.  
  589.     #define TEST_MEMERR(x)  do { if ((x) != OS_NOERR) logger(_L | LOG_FATAL,"Out of memory\n"); } while (0)
  590.  
  591.     /*    Current command context being used by the scanner. */
  592.     static command_context *cf;
  593.     
  594.     /*    String buffer */
  595.     OSHandle lexer_string;
  596.  
  597.     #include "command.y.h"
  598.     
  599.         // F_V9t9 and F_TIFILES
  600.     #include "fiad.h"
  601. #define grouper 1
  602.  
  603. #define comment 2
  604.  
  605. #define preproc 3
  606.  
  607. #define string 4
  608.  
  609. /*
  610. STRINGCHAR        [^\r\n\t +-\*]
  611. STRINGFIRST        [^\r\n\t 0123456789\"]
  612. */
  613. /* STRINGCHAR        ({STRINGFIRST}|[:\\0-9\~]) */
  614. /*
  615. IDFIRST            [A-Za-z_\$]
  616. ID                 ({IDFIRST})({IDFIRST}|[0-9])*
  617. */
  618. #line 619 "command.l.c"
  619.  
  620. /* Macros after this point can all be overridden by user definitions in
  621.  * section 1.
  622.  */
  623.  
  624. #ifndef YY_SKIP_YYWRAP
  625. #ifdef __cplusplus
  626. extern "C" int yywrap YY_PROTO(( void ));
  627. #else
  628. extern int yywrap YY_PROTO(( void ));
  629. #endif
  630. #endif
  631.  
  632. #ifndef YY_NO_UNPUT
  633. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  634. #endif
  635.  
  636. #ifndef yytext_ptr
  637. static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
  638. #endif
  639.  
  640. #ifdef YY_NEED_STRLEN
  641. static int yy_flex_strlen YY_PROTO(( yyconst char * ));
  642. #endif
  643.  
  644. #ifndef YY_NO_INPUT
  645. #ifdef __cplusplus
  646. static int yyinput YY_PROTO(( void ));
  647. #else
  648. static int input YY_PROTO(( void ));
  649. #endif
  650. #endif
  651.  
  652. #if YY_STACK_USED
  653. static int yy_start_stack_ptr = 0;
  654. static int yy_start_stack_depth = 0;
  655. static int *yy_start_stack = 0;
  656. #ifndef YY_NO_PUSH_STATE
  657. static void yy_push_state YY_PROTO(( int new_state ));
  658. #endif
  659. #ifndef YY_NO_POP_STATE
  660. static void yy_pop_state YY_PROTO(( void ));
  661. #endif
  662. #ifndef YY_NO_TOP_STATE
  663. static int yy_top_state YY_PROTO(( void ));
  664. #endif
  665.  
  666. #else
  667. #define YY_NO_PUSH_STATE 1
  668. #define YY_NO_POP_STATE 1
  669. #define YY_NO_TOP_STATE 1
  670. #endif
  671.  
  672. #ifdef YY_MALLOC_DECL
  673. YY_MALLOC_DECL
  674. #else
  675. #if __STDC__
  676. #ifndef __cplusplus
  677. #include <stdlib.h>
  678. #endif
  679. #else
  680. /* Just try to get by without declaring the routines.  This will fail
  681.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  682.  * or sizeof(void*) != sizeof(int).
  683.  */
  684. #endif
  685. #endif
  686.  
  687. /* Amount of stuff to slurp up with each read. */
  688. #ifndef YY_READ_BUF_SIZE
  689. #define YY_READ_BUF_SIZE 8192
  690. #endif
  691.  
  692. /* Copy whatever the last rule matched to the standard output. */
  693.  
  694. #ifndef ECHO
  695. /* This used to be an fputs(), but since the string might contain NUL's,
  696.  * we now use fwrite().
  697.  */
  698. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  699. #endif
  700.  
  701. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  702.  * is returned in "result".
  703.  */
  704. #ifndef YY_INPUT
  705. #define YY_INPUT(buf,result,max_size) \
  706.     if ( yy_current_buffer->yy_is_interactive ) \
  707.         { \
  708.         int c = '*', n; \
  709.         for ( n = 0; n < max_size && \
  710.                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  711.             buf[n] = (char) c; \
  712.         if ( c == '\n' ) \
  713.             buf[n++] = (char) c; \
  714.         if ( c == EOF && ferror( yyin ) ) \
  715.             YY_FATAL_ERROR( "input in flex scanner failed" ); \
  716.         result = n; \
  717.         } \
  718.     else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
  719.           && ferror( yyin ) ) \
  720.         YY_FATAL_ERROR( "input in flex scanner failed" );
  721. #endif
  722.  
  723. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  724.  * we don't want an extra ';' after the "return" because that will cause
  725.  * some compilers to complain about unreachable statements.
  726.  */
  727. #ifndef yyterminate
  728. #define yyterminate() return YY_NULL
  729. #endif
  730.  
  731. /* Number of entries by which start-condition stack grows. */
  732. #ifndef YY_START_STACK_INCR
  733. #define YY_START_STACK_INCR 25
  734. #endif
  735.  
  736. /* Report a fatal error. */
  737. #ifndef YY_FATAL_ERROR
  738. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  739. #endif
  740.  
  741. /* Default declaration of generated scanner - a define so the user can
  742.  * easily add parameters.
  743.  */
  744. #ifndef YY_DECL
  745. #define YY_DECL int yylex YY_PROTO(( void ))
  746. #endif
  747.  
  748. /* Code executed at the beginning of each rule, after yytext and yyleng
  749.  * have been set up.
  750.  */
  751. #ifndef YY_USER_ACTION
  752. #define YY_USER_ACTION
  753. #endif
  754.  
  755. /* Code executed at the end of each rule. */
  756. #ifndef YY_BREAK
  757. #define YY_BREAK break;
  758. #endif
  759.  
  760. #define YY_RULE_SETUP \
  761.     YY_USER_ACTION
  762.  
  763. YY_DECL
  764.     {
  765.     register yy_state_type yy_current_state;
  766.     register char *yy_cp = NULL, *yy_bp = NULL;
  767.     register int yy_act;
  768.  
  769. #line 89 "command.l"
  770.  
  771.  
  772.  
  773. #line 774 "command.l.c"
  774.  
  775.     if ( yy_init )
  776.         {
  777.         yy_init = 0;
  778.  
  779. #ifdef YY_USER_INIT
  780.         YY_USER_INIT;
  781. #endif
  782.  
  783.         if ( ! yy_start )
  784.             yy_start = 1;    /* first start state */
  785.  
  786.         if ( ! yyin )
  787.             yyin = stdin;
  788.  
  789.         if ( ! yyout )
  790.             yyout = stdout;
  791.  
  792.         if ( ! yy_current_buffer )
  793.             yy_current_buffer =
  794.                 yy_create_buffer( yyin, YY_BUF_SIZE );
  795.  
  796.         yy_load_buffer_state();
  797.         }
  798.  
  799.     while ( 1 )        /* loops until end-of-file is reached */
  800.         {
  801.         yy_cp = yy_c_buf_p;
  802.  
  803.         /* Support of yytext. */
  804.         *yy_cp = yy_hold_char;
  805.  
  806.         /* yy_bp points to the position in yy_ch_buf of the start of
  807.          * the current run.
  808.          */
  809.         yy_bp = yy_cp;
  810.  
  811.         yy_current_state = yy_start;
  812. yy_match:
  813.         do
  814.             {
  815.             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  816.             if ( yy_accept[yy_current_state] )
  817.                 {
  818.                 yy_last_accepting_state = yy_current_state;
  819.                 yy_last_accepting_cpos = yy_cp;
  820.                 }
  821.             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  822.                 {
  823.                 yy_current_state = (int) yy_def[yy_current_state];
  824.                 if ( yy_current_state >= 186 )
  825.                     yy_c = yy_meta[(unsigned int) yy_c];
  826.                 }
  827.             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  828.             ++yy_cp;
  829.             }
  830.         while ( yy_base[yy_current_state] != 451 );
  831.  
  832. yy_find_action:
  833.         yy_act = yy_accept[yy_current_state];
  834.         if ( yy_act == 0 )
  835.             { /* have to back up */
  836.             yy_cp = yy_last_accepting_cpos;
  837.             yy_current_state = yy_last_accepting_state;
  838.             yy_act = yy_accept[yy_current_state];
  839.             }
  840.  
  841.         YY_DO_BEFORE_ACTION;
  842.  
  843.  
  844. do_action:    /* This label is used only to access EOF actions. */
  845.  
  846.  
  847.         switch ( yy_act )
  848.     { /* beginning of action switch */
  849.             case 0: /* must back up */
  850.             /* undo the effects of YY_DO_BEFORE_ACTION */
  851.             *yy_cp = yy_hold_char;
  852.             yy_cp = yy_last_accepting_cpos;
  853.             yy_current_state = yy_last_accepting_state;
  854.             goto yy_find_action;
  855.  
  856. case 1:
  857. YY_RULE_SETUP
  858. #line 92 "command.l"
  859. {
  860.                     int sign = *yytext == '-';
  861.                 #ifdef DEBUG
  862.                     logger(_L | LOG_USER, "a hex number: %s\n", yytext);
  863.                 #endif
  864.                     yylval.expr.type = ca_NUM;
  865.                     yylval.expr.u.num = strtol(yytext+2+sign, NULL, 16);
  866.                     if (sign) yylval.expr.u.num = -yylval.expr.u.num;
  867.                     return NUM;
  868.                 }
  869.     YY_BREAK
  870. case 2:
  871. YY_RULE_SETUP
  872. #line 103 "command.l"
  873. {
  874.                     int sign = *yytext == '-';
  875.                 #ifdef DEBUG
  876.                     logger(_L | LOG_USER, "a hex number: %s\n", yytext);
  877.                 #endif
  878.                     yylval.expr.type = ca_NUM;
  879.                     yylval.expr.u.num = strtol(yytext+1, NULL, 16);
  880.                     if (sign) yylval.expr.u.num = -yylval.expr.u.num;
  881.                     return NUM;
  882.                 }
  883.     YY_BREAK
  884. case 3:
  885. YY_RULE_SETUP
  886. #line 114 "command.l"
  887. {
  888.                 #ifdef DEBUG
  889.                     logger(_L | LOG_USER, "an oct number: %s\n", yytext);
  890.                 #endif
  891.                     yylval.expr.type = ca_NUM;
  892.                     yylval.expr.u.num = strtol(yytext, NULL, 8);
  893.                     return NUM;
  894.                 }
  895.     YY_BREAK
  896. case 4:
  897. YY_RULE_SETUP
  898. #line 123 "command.l"
  899. {
  900.                 #ifdef DEBUG
  901.                     logger(_L | LOG_USER, "a decimal number: %s\n", yytext);
  902.                 #endif
  903.                     yylval.expr.type = ca_NUM;
  904.                     yylval.expr.u.num = strtol(yytext, NULL, 10);
  905.                     return NUM;    
  906.                 } 
  907.     YY_BREAK
  908. /* boolean values */
  909. case 5:
  910. YY_RULE_SETUP
  911. #line 133 "command.l"
  912.                     yylval.expr.type = ca_NUM; 
  913.                     yylval.expr.u.num = 1; 
  914.                     return NUM; 
  915.                     }
  916.     YY_BREAK
  917. case 6:
  918. YY_RULE_SETUP
  919. #line 138 "command.l"
  920.                     yylval.expr.type = ca_NUM; 
  921.                     yylval.expr.u.num = 0; 
  922.                     return NUM; 
  923.                     }
  924.     YY_BREAK
  925. case 7:
  926. YY_RULE_SETUP
  927. #line 144 "command.l"
  928. return RSHIFT;
  929.     YY_BREAK
  930. case 8:
  931. YY_RULE_SETUP
  932. #line 145 "command.l"
  933. return LSHIFT;
  934.     YY_BREAK
  935. case 9:
  936. YY_RULE_SETUP
  937. #line 146 "command.l"
  938. return COMPGE;
  939.     YY_BREAK
  940. case 10:
  941. YY_RULE_SETUP
  942. #line 147 "command.l"
  943. return COMPLE;
  944.     YY_BREAK
  945. case 11:
  946. YY_RULE_SETUP
  947. #line 148 "command.l"
  948. return COMPEQ;
  949.     YY_BREAK
  950. case 12:
  951. YY_RULE_SETUP
  952. #line 149 "command.l"
  953. return COMPNE;
  954.     YY_BREAK
  955. case 13:
  956. YY_RULE_SETUP
  957. #line 150 "command.l"
  958. return COMPAND;
  959.     YY_BREAK
  960. case 14:
  961. YY_RULE_SETUP
  962. #line 151 "command.l"
  963. return COMPOR;
  964.     YY_BREAK
  965. case 15:
  966. YY_RULE_SETUP
  967. #line 152 "command.l"
  968. return COMPXOR;
  969.     YY_BREAK
  970. case 16:
  971. YY_RULE_SETUP
  972. #line 153 "command.l"
  973. return '&';
  974.     YY_BREAK
  975. case 17:
  976. YY_RULE_SETUP
  977. #line 154 "command.l"
  978. return '|';
  979.     YY_BREAK
  980. case 18:
  981. YY_RULE_SETUP
  982. #line 155 "command.l"
  983. return '^';
  984.     YY_BREAK
  985. case 19:
  986. YY_RULE_SETUP
  987. #line 157 "command.l"
  988. return PRINT;
  989.     YY_BREAK
  990. /* identifiers for modules.inf */
  991. case 20:
  992. YY_RULE_SETUP
  993. #line 161 "command.l"
  994. yylval.expr.type = ca_NUM; yylval.expr.u.num = MOD_PART_MINIMEM; return NUM;
  995.     YY_BREAK
  996. case 21:
  997. YY_RULE_SETUP
  998. #line 162 "command.l"
  999. yylval.expr.type = ca_NUM; yylval.expr.u.num = MOD_PART_BANKED; return NUM;
  1000.     YY_BREAK
  1001. case 22:
  1002. YY_RULE_SETUP
  1003. #line 163 "command.l"
  1004. yylval.expr.type = ca_NUM; yylval.expr.u.num = MOD_PART_GROM; return NUM;
  1005.     YY_BREAK
  1006. case 23:
  1007. YY_RULE_SETUP
  1008. #line 164 "command.l"
  1009. yylval.expr.type = ca_NUM; yylval.expr.u.num = MOD_PART_ROM; return NUM;
  1010.     YY_BREAK
  1011. case 24:
  1012. YY_RULE_SETUP
  1013. #line 165 "command.l"
  1014. yylval.expr.type = ca_NUM; yylval.expr.u.num = MOD_PART_GRAMKRACKER; return NUM;
  1015.     YY_BREAK
  1016. /* identifiers for fileformat */
  1017. case 25:
  1018. YY_RULE_SETUP
  1019. #line 169 "command.l"
  1020. yylval.expr.type = ca_NUM; yylval.expr.u.num = F_V9t9; return NUM;
  1021.     YY_BREAK
  1022. case 26:
  1023. YY_RULE_SETUP
  1024. #line 170 "command.l"
  1025. yylval.expr.type = ca_NUM; yylval.expr.u.num = F_TIFILES; return NUM;
  1026.     YY_BREAK
  1027. case 27:
  1028. YY_RULE_SETUP
  1029. #line 173 "command.l"
  1030. {
  1031.                 #ifdef DEBUG
  1032.                     logger(_L | LOG_USER, "line ending\n");
  1033.                 #endif
  1034.                     cf->line++;
  1035.                     return '\n';
  1036.                 }
  1037.     YY_BREAK
  1038. case 28:
  1039. YY_RULE_SETUP
  1040. #line 182 "command.l"
  1041. BEGIN(preproc);
  1042.     YY_BREAK
  1043. case 29:
  1044. YY_RULE_SETUP
  1045. #line 184 "command.l"
  1046.                     lexer_include(yytext);
  1047.                     BEGIN(INITIAL);
  1048.                 }
  1049.     YY_BREAK
  1050. case 30:
  1051. YY_RULE_SETUP
  1052. #line 189 "command.l"
  1053. {
  1054.                     lexer_error("incorrectly formed #include statement");
  1055.                 }
  1056.     YY_BREAK
  1057. case 31:
  1058. YY_RULE_SETUP
  1059. #line 193 "command.l"
  1060. { BEGIN(INITIAL); cf->line++; }
  1061.     YY_BREAK
  1062. case 32:
  1063. YY_RULE_SETUP
  1064. #line 195 "command.l"
  1065. /* ignore rest of comment */
  1066.     YY_BREAK
  1067. case 33:
  1068. YY_RULE_SETUP
  1069. #line 197 "command.l"
  1070. cf->line++;
  1071.     YY_BREAK
  1072. case 34:
  1073. YY_RULE_SETUP
  1074. #line 199 "command.l"
  1075. /* ignore whitespace */
  1076.     YY_BREAK
  1077. /* comment rules stolen from flex manual */
  1078. case 35:
  1079. YY_RULE_SETUP
  1080. #line 203 "command.l"
  1081. BEGIN(comment);
  1082.     YY_BREAK
  1083. case 36:
  1084. YY_RULE_SETUP
  1085. #line 205 "command.l"
  1086.  
  1087.     YY_BREAK
  1088. case 37:
  1089. YY_RULE_SETUP
  1090. #line 206 "command.l"
  1091. cf->line++;
  1092.     YY_BREAK
  1093. case 38:
  1094. YY_RULE_SETUP
  1095. #line 207 "command.l"
  1096.  
  1097.     YY_BREAK
  1098. case 39:
  1099. YY_RULE_SETUP
  1100. #line 208 "command.l"
  1101. cf->line++;
  1102.     YY_BREAK
  1103. case 40:
  1104. YY_RULE_SETUP
  1105. #line 209 "command.l"
  1106. BEGIN(INITIAL);
  1107.     YY_BREAK
  1108. /* grouper */
  1109. case 41:
  1110. YY_RULE_SETUP
  1111. #line 213 "command.l"
  1112. BEGIN(grouper);
  1113.     YY_BREAK
  1114. case 42:
  1115. YY_RULE_SETUP
  1116. #line 215 "command.l"
  1117.  
  1118.     YY_BREAK
  1119. case 43:
  1120. YY_RULE_SETUP
  1121. #line 216 "command.l"
  1122. cf->line++;
  1123.     YY_BREAK
  1124. case 44:
  1125. YY_RULE_SETUP
  1126. #line 217 "command.l"
  1127. BEGIN(INITIAL);
  1128.     YY_BREAK
  1129. case YY_STATE_EOF(INITIAL):
  1130. case YY_STATE_EOF(grouper):
  1131. case YY_STATE_EOF(comment):
  1132. case YY_STATE_EOF(preproc):
  1133. case YY_STATE_EOF(string):
  1134. #line 219 "command.l"
  1135. { if (!lexer_pop_context()) yyterminate(); }
  1136.     YY_BREAK
  1137. /* explicit string constant */
  1138. case 45:
  1139. YY_RULE_SETUP
  1140. #line 222 "command.l"
  1141.                 #ifdef DEBUG
  1142.                     logger(_L | LOG_USER, "a string: ");
  1143.                 #endif
  1144.                     BEGIN(string); 
  1145.                     TEST_MEMERR(OS_NewHandle(0, &lexer_string)); 
  1146.                 }
  1147.     YY_BREAK
  1148. case 46:
  1149. YY_RULE_SETUP
  1150. #line 230 "command.l"
  1151. TEST_MEMERR(OS_AppendHandle(&lexer_string, "\"", 1));
  1152.     YY_BREAK
  1153. case 47:
  1154. YY_RULE_SETUP
  1155. #line 232 "command.l"
  1156. TEST_MEMERR(OS_AppendHandle(&lexer_string, "\t", 1));
  1157.     YY_BREAK
  1158. case 48:
  1159. YY_RULE_SETUP
  1160. #line 233 "command.l"
  1161. TEST_MEMERR(OS_AppendHandle(&lexer_string, "\b", 1));
  1162.     YY_BREAK
  1163. case 49:
  1164. YY_RULE_SETUP
  1165. #line 234 "command.l"
  1166. TEST_MEMERR(OS_AppendHandle(&lexer_string, "\r", 1));
  1167.     YY_BREAK
  1168. case 50:
  1169. YY_RULE_SETUP
  1170. #line 235 "command.l"
  1171. TEST_MEMERR(OS_AppendHandle(&lexer_string, "\n", 1));
  1172.     YY_BREAK
  1173. case 51:
  1174. YY_RULE_SETUP
  1175. #line 236 "command.l"
  1176. TEST_MEMERR(OS_AppendHandle(&lexer_string, "\\", 1));
  1177.     YY_BREAK
  1178. case 52:
  1179. YY_RULE_SETUP
  1180. #line 238 "command.l"
  1181.                     TEST_MEMERR(OS_AppendHandle(&lexer_string, "", 1)); 
  1182.                     yylval.expr.u.str = strdup(OS_LockHandle(&lexer_string));
  1183.                     OS_UnlockHandle(&lexer_string);
  1184.                     OS_FreeHandle(&lexer_string);
  1185.                 #ifdef DEBUG
  1186.                     logger(_L | LOG_USER, "%s\n", yylval.expr.u.str);
  1187.                 #endif
  1188.                     BEGIN(INITIAL);
  1189.                     return STRING;
  1190.                 }
  1191.     YY_BREAK
  1192. case 53:
  1193. YY_RULE_SETUP
  1194. #line 250 "command.l"
  1195.  
  1196.     YY_BREAK
  1197. #line 251 "command.l"
  1198. {
  1199.                     TEST_MEMERR(OS_AppendHandle(&lexer_string, "", 1)); 
  1200.                     yylval.expr.u.str = xstrdup(OS_LockHandle(&lexer_string));
  1201.                     OS_UnlockHandle(&lexer_string);
  1202.                     OS_FreeHandle(&lexer_string);
  1203.                     lexer_error("Unterminated string (%s)\n", yylval.expr.u.str);
  1204.                     BEGIN(INITIAL);
  1205.                     return STRING;
  1206.                 }
  1207.     YY_BREAK
  1208. case 54:
  1209. YY_RULE_SETUP
  1210. #line 260 "command.l"
  1211. TEST_MEMERR(OS_AppendHandle(&lexer_string, yytext, strlen(yytext)));
  1212.     YY_BREAK
  1213. /* implicit string constant */
  1214. case 55:
  1215. YY_RULE_SETUP
  1216. #line 264 "command.l"
  1217. {
  1218. /*
  1219.                 char *str;
  1220.                 command_symbol *sym;
  1221. #ifdef DEBUG
  1222.                 logger(_L | LOG_USER, "an unquoted string: '%s'", yytext);
  1223. #endif
  1224.  
  1225.                 if (command_match_symbol(command_scope, yytext, &sym))
  1226.                 {
  1227.                     yylval.expr.type = ca_SYM;        
  1228.                     yylval.expr.u.str = xstrdup(yytext);
  1229.                 #ifdef DEBUG
  1230.                     logger(_L | L_0, "got an ID (%s)\n", yytext);
  1231.                 #endif
  1232.                     return IDSTRING;
  1233.                 }
  1234.                 else
  1235. */
  1236.                 {
  1237.                     yylval.expr.type = ca_STRING;
  1238.                     yylval.expr.u.str = xstrdup(yytext);
  1239.                     return IDSTRING;
  1240.                 }
  1241.                 }
  1242.     YY_BREAK
  1243. case 56:
  1244. YY_RULE_SETUP
  1245. #line 290 "command.l"
  1246. {
  1247.                 //yylval.expr.type = ca_STRING;
  1248.                 //yylval.expr.u.str = xstrdup(yytext);
  1249.                 //return STRING;
  1250.                 return *yytext;
  1251.                 }
  1252.     YY_BREAK
  1253. case 57:
  1254. YY_RULE_SETUP
  1255. #line 297 "command.l"
  1256. ECHO;
  1257.     YY_BREAK
  1258. #line 1264 "command.l.c"
  1259.  
  1260.     case YY_END_OF_BUFFER:
  1261.         {
  1262.         /* Amount of text matched not including the EOB char. */
  1263.         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
  1264.  
  1265.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1266.         *yy_cp = yy_hold_char;
  1267.         YY_RESTORE_YY_MORE_OFFSET
  1268.  
  1269.         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  1270.             {
  1271.             /* We're scanning a new file or input source.  It's
  1272.              * possible that this happened because the user
  1273.              * just pointed yyin at a new source and called
  1274.              * yylex().  If so, then we have to assure
  1275.              * consistency between yy_current_buffer and our
  1276.              * globals.  Here is the right place to do so, because
  1277.              * this is the first action (other than possibly a
  1278.              * back-up) that will match for the new input source.
  1279.              */
  1280.             yy_n_chars = yy_current_buffer->yy_n_chars;
  1281.             yy_current_buffer->yy_input_file = yyin;
  1282.             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  1283.             }
  1284.  
  1285.         /* Note that here we test for yy_c_buf_p "<=" to the position
  1286.          * of the first EOB in the buffer, since yy_c_buf_p will
  1287.          * already have been incremented past the NUL character
  1288.          * (since all states make transitions on EOB to the
  1289.          * end-of-buffer state).  Contrast this with the test
  1290.          * in input().
  1291.          */
  1292.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1293.             { /* This was really a NUL. */
  1294.             yy_state_type yy_next_state;
  1295.  
  1296.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  1297.  
  1298.             yy_current_state = yy_get_previous_state();
  1299.  
  1300.             /* Okay, we're now positioned to make the NUL
  1301.              * transition.  We couldn't have
  1302.              * yy_get_previous_state() go ahead and do it
  1303.              * for us because it doesn't know how to deal
  1304.              * with the possibility of jamming (and we don't
  1305.              * want to build jamming into it because then it
  1306.              * will run more slowly).
  1307.              */
  1308.  
  1309.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  1310.  
  1311.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  1312.  
  1313.             if ( yy_next_state )
  1314.                 {
  1315.                 /* Consume the NUL. */
  1316.                 yy_cp = ++yy_c_buf_p;
  1317.                 yy_current_state = yy_next_state;
  1318.                 goto yy_match;
  1319.                 }
  1320.  
  1321.             else
  1322.                 {
  1323.                 yy_cp = yy_c_buf_p;
  1324.                 goto yy_find_action;
  1325.                 }
  1326.             }
  1327.  
  1328.         else switch ( yy_get_next_buffer() )
  1329.             {
  1330.             case EOB_ACT_END_OF_FILE:
  1331.                 {
  1332.                 yy_did_buffer_switch_on_eof = 0;
  1333.  
  1334.                 if ( yywrap() )
  1335.                     {
  1336.                     /* Note: because we've taken care in
  1337.                      * yy_get_next_buffer() to have set up
  1338.                      * yytext, we can now set up
  1339.                      * yy_c_buf_p so that if some total
  1340.                      * hoser (like flex itself) wants to
  1341.                      * call the scanner after we return the
  1342.                      * YY_NULL, it'll still work - another
  1343.                      * YY_NULL will get returned.
  1344.                      */
  1345.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  1346.  
  1347.                     yy_act = YY_STATE_EOF(YY_START);
  1348.                     goto do_action;
  1349.                     }
  1350.  
  1351.                 else
  1352.                     {
  1353.                     if ( ! yy_did_buffer_switch_on_eof )
  1354.                         YY_NEW_FILE;
  1355.                     }
  1356.                 break;
  1357.                 }
  1358.  
  1359.             case EOB_ACT_CONTINUE_SCAN:
  1360.                 yy_c_buf_p =
  1361.                     yytext_ptr + yy_amount_of_matched_text;
  1362.  
  1363.                 yy_current_state = yy_get_previous_state();
  1364.  
  1365.                 yy_cp = yy_c_buf_p;
  1366.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  1367.                 goto yy_match;
  1368.  
  1369.             case EOB_ACT_LAST_MATCH:
  1370.                 yy_c_buf_p =
  1371.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  1372.  
  1373.                 yy_current_state = yy_get_previous_state();
  1374.  
  1375.                 yy_cp = yy_c_buf_p;
  1376.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  1377.                 goto yy_find_action;
  1378.             }
  1379.         break;
  1380.         }
  1381.  
  1382.     default:
  1383.         YY_FATAL_ERROR(
  1384.             "fatal flex scanner internal error--no action found" );
  1385.     } /* end of action switch */
  1386.         } /* end of scanning one token */
  1387.     } /* end of yylex */
  1388.  
  1389.  
  1390. /* yy_get_next_buffer - try to read in a new buffer
  1391.  *
  1392.  * Returns a code representing an action:
  1393.  *    EOB_ACT_LAST_MATCH -
  1394.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1395.  *    EOB_ACT_END_OF_FILE - end of file
  1396.  */
  1397.  
  1398. static int yy_get_next_buffer()
  1399.     {
  1400.     register char *dest = yy_current_buffer->yy_ch_buf;
  1401.     register char *source = yytext_ptr;
  1402.     register int number_to_move, i;
  1403.     int ret_val;
  1404.  
  1405.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  1406.         YY_FATAL_ERROR(
  1407.         "fatal flex scanner internal error--end of buffer missed" );
  1408.  
  1409.     if ( yy_current_buffer->yy_fill_buffer == 0 )
  1410.         { /* Don't try to fill the buffer, so this is an EOF. */
  1411.         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  1412.             {
  1413.             /* We matched a single character, the EOB, so
  1414.              * treat this as a final EOF.
  1415.              */
  1416.             return EOB_ACT_END_OF_FILE;
  1417.             }
  1418.  
  1419.         else
  1420.             {
  1421.             /* We matched some text prior to the EOB, first
  1422.              * process it.
  1423.              */
  1424.             return EOB_ACT_LAST_MATCH;
  1425.             }
  1426.         }
  1427.  
  1428.     /* Try to read more data. */
  1429.  
  1430.     /* First move last chars to start of buffer. */
  1431.     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
  1432.  
  1433.     for ( i = 0; i < number_to_move; ++i )
  1434.         *(dest++) = *(source++);
  1435.  
  1436.     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1437.         /* don't do the read, it's not guaranteed to return an EOF,
  1438.          * just force an EOF
  1439.          */
  1440.         yy_current_buffer->yy_n_chars = yy_n_chars = 0;
  1441.  
  1442.     else
  1443.         {
  1444.         int num_to_read =
  1445.             yy_current_buffer->yy_buf_size - number_to_move - 1;
  1446.  
  1447.         while ( num_to_read <= 0 )
  1448.             { /* Not enough room in the buffer - grow it. */
  1449. #ifdef YY_USES_REJECT
  1450.             YY_FATAL_ERROR(
  1451. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  1452. #else
  1453.  
  1454.             /* just a shorter name for the current buffer */
  1455.             YY_BUFFER_STATE b = yy_current_buffer;
  1456.  
  1457.             int yy_c_buf_p_offset =
  1458.                 (int) (yy_c_buf_p - b->yy_ch_buf);
  1459.  
  1460.             if ( b->yy_is_our_buffer )
  1461.                 {
  1462.                 int new_size = b->yy_buf_size * 2;
  1463.  
  1464.                 if ( new_size <= 0 )
  1465.                     b->yy_buf_size += b->yy_buf_size / 8;
  1466.                 else
  1467.                     b->yy_buf_size *= 2;
  1468.  
  1469.                 b->yy_ch_buf = (char *)
  1470.                     /* Include room in for 2 EOB chars. */
  1471.                     yy_flex_realloc( (void *) b->yy_ch_buf,
  1472.                              b->yy_buf_size + 2 );
  1473.                 }
  1474.             else
  1475.                 /* Can't grow it, we don't own it. */
  1476.                 b->yy_ch_buf = 0;
  1477.  
  1478.             if ( ! b->yy_ch_buf )
  1479.                 YY_FATAL_ERROR(
  1480.                 "fatal error - scanner input buffer overflow" );
  1481.  
  1482.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  1483.  
  1484.             num_to_read = yy_current_buffer->yy_buf_size -
  1485.                         number_to_move - 1;
  1486. #endif
  1487.             }
  1488.  
  1489.         if ( num_to_read > YY_READ_BUF_SIZE )
  1490.             num_to_read = YY_READ_BUF_SIZE;
  1491.  
  1492.         /* Read in more data. */
  1493.         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  1494.             yy_n_chars, num_to_read );
  1495.  
  1496.         yy_current_buffer->yy_n_chars = yy_n_chars;
  1497.         }
  1498.  
  1499.     if ( yy_n_chars == 0 )
  1500.         {
  1501.         if ( number_to_move == YY_MORE_ADJ )
  1502.             {
  1503.             ret_val = EOB_ACT_END_OF_FILE;
  1504.             yyrestart( yyin );
  1505.             }
  1506.  
  1507.         else
  1508.             {
  1509.             ret_val = EOB_ACT_LAST_MATCH;
  1510.             yy_current_buffer->yy_buffer_status =
  1511.                 YY_BUFFER_EOF_PENDING;
  1512.             }
  1513.         }
  1514.  
  1515.     else
  1516.         ret_val = EOB_ACT_CONTINUE_SCAN;
  1517.  
  1518.     yy_n_chars += number_to_move;
  1519.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1520.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1521.  
  1522.     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
  1523.  
  1524.     return ret_val;
  1525.     }
  1526.  
  1527.  
  1528. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1529.  
  1530. static yy_state_type yy_get_previous_state()
  1531.     {
  1532.     register yy_state_type yy_current_state;
  1533.     register char *yy_cp;
  1534.  
  1535.     yy_current_state = yy_start;
  1536.  
  1537.     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  1538.         {
  1539.         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1540.         if ( yy_accept[yy_current_state] )
  1541.             {
  1542.             yy_last_accepting_state = yy_current_state;
  1543.             yy_last_accepting_cpos = yy_cp;
  1544.             }
  1545.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1546.             {
  1547.             yy_current_state = (int) yy_def[yy_current_state];
  1548.             if ( yy_current_state >= 186 )
  1549.                 yy_c = yy_meta[(unsigned int) yy_c];
  1550.             }
  1551.         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1552.         }
  1553.  
  1554.     return yy_current_state;
  1555.     }
  1556.  
  1557.  
  1558. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1559.  *
  1560.  * synopsis
  1561.  *    next_state = yy_try_NUL_trans( current_state );
  1562.  */
  1563.  
  1564. #ifdef YY_USE_PROTOS
  1565. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  1566. #else
  1567. static yy_state_type yy_try_NUL_trans( yy_current_state )
  1568. yy_state_type yy_current_state;
  1569. #endif
  1570.     {
  1571.     register int yy_is_jam;
  1572.     register char *yy_cp = yy_c_buf_p;
  1573.  
  1574.     register YY_CHAR yy_c = 1;
  1575.     if ( yy_accept[yy_current_state] )
  1576.         {
  1577.         yy_last_accepting_state = yy_current_state;
  1578.         yy_last_accepting_cpos = yy_cp;
  1579.         }
  1580.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1581.         {
  1582.         yy_current_state = (int) yy_def[yy_current_state];
  1583.         if ( yy_current_state >= 186 )
  1584.             yy_c = yy_meta[(unsigned int) yy_c];
  1585.         }
  1586.     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1587.     yy_is_jam = (yy_current_state == 185);
  1588.  
  1589.     return yy_is_jam ? 0 : yy_current_state;
  1590.     }
  1591.  
  1592.  
  1593. #ifndef YY_NO_UNPUT
  1594. #ifdef YY_USE_PROTOS
  1595. static void yyunput( int c, register char *yy_bp )
  1596. #else
  1597. static void yyunput( c, yy_bp )
  1598. int c;
  1599. register char *yy_bp;
  1600. #endif
  1601.     {
  1602.     register char *yy_cp = yy_c_buf_p;
  1603.  
  1604.     /* undo effects of setting up yytext */
  1605.     *yy_cp = yy_hold_char;
  1606.  
  1607.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1608.         { /* need to shift things up to make room */
  1609.         /* +2 for EOB chars. */
  1610.         register int number_to_move = yy_n_chars + 2;
  1611.         register char *dest = &yy_current_buffer->yy_ch_buf[
  1612.                     yy_current_buffer->yy_buf_size + 2];
  1613.         register char *source =
  1614.                 &yy_current_buffer->yy_ch_buf[number_to_move];
  1615.  
  1616.         while ( source > yy_current_buffer->yy_ch_buf )
  1617.             *--dest = *--source;
  1618.  
  1619.         yy_cp += (int) (dest - source);
  1620.         yy_bp += (int) (dest - source);
  1621.         yy_current_buffer->yy_n_chars =
  1622.             yy_n_chars = yy_current_buffer->yy_buf_size;
  1623.  
  1624.         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1625.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1626.         }
  1627.  
  1628.     *--yy_cp = (char) c;
  1629.  
  1630.  
  1631.     yytext_ptr = yy_bp;
  1632.     yy_hold_char = *yy_cp;
  1633.     yy_c_buf_p = yy_cp;
  1634.     }
  1635. #endif    /* ifndef YY_NO_UNPUT */
  1636.  
  1637.  
  1638. #ifdef __cplusplus
  1639. static int yyinput()
  1640. #else
  1641. static int input()
  1642. #endif
  1643.     {
  1644.     int c;
  1645.  
  1646.     *yy_c_buf_p = yy_hold_char;
  1647.  
  1648.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1649.         {
  1650.         /* yy_c_buf_p now points to the character we want to return.
  1651.          * If this occurs *before* the EOB characters, then it's a
  1652.          * valid NUL; if not, then we've hit the end of the buffer.
  1653.          */
  1654.         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1655.             /* This was really a NUL. */
  1656.             *yy_c_buf_p = '\0';
  1657.  
  1658.         else
  1659.             { /* need more input */
  1660.             int offset = yy_c_buf_p - yytext_ptr;
  1661.             ++yy_c_buf_p;
  1662.  
  1663.             switch ( yy_get_next_buffer() )
  1664.                 {
  1665.                 case EOB_ACT_LAST_MATCH:
  1666.                     /* This happens because yy_g_n_b()
  1667.                      * sees that we've accumulated a
  1668.                      * token and flags that we need to
  1669.                      * try matching the token before
  1670.                      * proceeding.  But for input(),
  1671.                      * there's no matching to consider.
  1672.                      * So convert the EOB_ACT_LAST_MATCH
  1673.                      * to EOB_ACT_END_OF_FILE.
  1674.                      */
  1675.  
  1676.                     /* Reset buffer status. */
  1677.                     yyrestart( yyin );
  1678.  
  1679.                     /* fall through */
  1680.  
  1681.                 case EOB_ACT_END_OF_FILE:
  1682.                     {
  1683.                     if ( yywrap() )
  1684.                         return EOF;
  1685.  
  1686.                     if ( ! yy_did_buffer_switch_on_eof )
  1687.                         YY_NEW_FILE;
  1688. #ifdef __cplusplus
  1689.                     return yyinput();
  1690. #else
  1691.                     return input();
  1692. #endif
  1693.                     }
  1694.  
  1695.                 case EOB_ACT_CONTINUE_SCAN:
  1696.                     yy_c_buf_p = yytext_ptr + offset;
  1697.                     break;
  1698.                 }
  1699.             }
  1700.         }
  1701.  
  1702.     c = *(unsigned char *) yy_c_buf_p;    /* cast for 8-bit char's */
  1703.     *yy_c_buf_p = '\0';    /* preserve yytext */
  1704.     yy_hold_char = *++yy_c_buf_p;
  1705.  
  1706.  
  1707.     return c;
  1708.     }
  1709.  
  1710.  
  1711. #ifdef YY_USE_PROTOS
  1712. void yyrestart( FILE *input_file )
  1713. #else
  1714. void yyrestart( input_file )
  1715. FILE *input_file;
  1716. #endif
  1717.     {
  1718.     if ( ! yy_current_buffer )
  1719.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  1720.  
  1721.     yy_init_buffer( yy_current_buffer, input_file );
  1722.     yy_load_buffer_state();
  1723.     }
  1724.  
  1725.  
  1726. #ifdef YY_USE_PROTOS
  1727. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1728. #else
  1729. void yy_switch_to_buffer( new_buffer )
  1730. YY_BUFFER_STATE new_buffer;
  1731. #endif
  1732.     {
  1733.     if ( yy_current_buffer == new_buffer )
  1734.         return;
  1735.  
  1736.     if ( yy_current_buffer )
  1737.         {
  1738.         /* Flush out information for old buffer. */
  1739.         *yy_c_buf_p = yy_hold_char;
  1740.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1741.         yy_current_buffer->yy_n_chars = yy_n_chars;
  1742.         }
  1743.  
  1744.     yy_current_buffer = new_buffer;
  1745.     yy_load_buffer_state();
  1746.  
  1747.     /* We don't actually know whether we did this switch during
  1748.      * EOF (yywrap()) processing, but the only time this flag
  1749.      * is looked at is after yywrap() is called, so it's safe
  1750.      * to go ahead and always set it.
  1751.      */
  1752.     yy_did_buffer_switch_on_eof = 1;
  1753.     }
  1754.  
  1755.  
  1756. #ifdef YY_USE_PROTOS
  1757. void yy_load_buffer_state( void )
  1758. #else
  1759. void yy_load_buffer_state()
  1760. #endif
  1761.     {
  1762.     yy_n_chars = yy_current_buffer->yy_n_chars;
  1763.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1764.     yyin = yy_current_buffer->yy_input_file;
  1765.     yy_hold_char = *yy_c_buf_p;
  1766.     }
  1767.  
  1768.  
  1769. #ifdef YY_USE_PROTOS
  1770. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  1771. #else
  1772. YY_BUFFER_STATE yy_create_buffer( file, size )
  1773. FILE *file;
  1774. int size;
  1775. #endif
  1776.     {
  1777.     YY_BUFFER_STATE b;
  1778.  
  1779.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1780.     if ( ! b )
  1781.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1782.  
  1783.     b->yy_buf_size = size;
  1784.  
  1785.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1786.      * we need to put in 2 end-of-buffer characters.
  1787.      */
  1788.     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  1789.     if ( ! b->yy_ch_buf )
  1790.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1791.  
  1792.     b->yy_is_our_buffer = 1;
  1793.  
  1794.     yy_init_buffer( b, file );
  1795.  
  1796.     return b;
  1797.     }
  1798.  
  1799.  
  1800. #ifdef YY_USE_PROTOS
  1801. void yy_delete_buffer( YY_BUFFER_STATE b )
  1802. #else
  1803. void yy_delete_buffer( b )
  1804. YY_BUFFER_STATE b;
  1805. #endif
  1806.     {
  1807.     if ( ! b )
  1808.         return;
  1809.  
  1810.     if ( b == yy_current_buffer )
  1811.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  1812.  
  1813.     if ( b->yy_is_our_buffer )
  1814.         yy_flex_free( (void *) b->yy_ch_buf );
  1815.  
  1816.     yy_flex_free( (void *) b );
  1817.     }
  1818.  
  1819.  
  1820.  
  1821. #ifdef YY_USE_PROTOS
  1822. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1823. #else
  1824. void yy_init_buffer( b, file )
  1825. YY_BUFFER_STATE b;
  1826. FILE *file;
  1827. #endif
  1828.  
  1829.  
  1830.     {
  1831.     yy_flush_buffer( b );
  1832.  
  1833.     b->yy_input_file = file;
  1834.     b->yy_fill_buffer = 1;
  1835.  
  1836. #if YY_ALWAYS_INTERACTIVE
  1837.     b->yy_is_interactive = 1;
  1838. #else
  1839. #if YY_NEVER_INTERACTIVE
  1840.     b->yy_is_interactive = 0;
  1841. #else
  1842.     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1843. #endif
  1844. #endif
  1845.     }
  1846.  
  1847.  
  1848. #ifdef YY_USE_PROTOS
  1849. void yy_flush_buffer( YY_BUFFER_STATE b )
  1850. #else
  1851. void yy_flush_buffer( b )
  1852. YY_BUFFER_STATE b;
  1853. #endif
  1854.  
  1855.     {
  1856.     if ( ! b )
  1857.         return;
  1858.  
  1859.     b->yy_n_chars = 0;
  1860.  
  1861.     /* We always need two end-of-buffer characters.  The first causes
  1862.      * a transition to the end-of-buffer state.  The second causes
  1863.      * a jam in that state.
  1864.      */
  1865.     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1866.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1867.  
  1868.     b->yy_buf_pos = &b->yy_ch_buf[0];
  1869.  
  1870.     b->yy_at_bol = 1;
  1871.     b->yy_buffer_status = YY_BUFFER_NEW;
  1872.  
  1873.     if ( b == yy_current_buffer )
  1874.         yy_load_buffer_state();
  1875.     }
  1876.  
  1877.  
  1878. #ifndef YY_NO_SCAN_BUFFER
  1879. #ifdef YY_USE_PROTOS
  1880. YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
  1881. #else
  1882. YY_BUFFER_STATE yy_scan_buffer( base, size )
  1883. char *base;
  1884. yy_size_t size;
  1885. #endif
  1886.     {
  1887.     YY_BUFFER_STATE b;
  1888.  
  1889.     if ( size < 2 ||
  1890.          base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1891.          base[size-1] != YY_END_OF_BUFFER_CHAR )
  1892.         /* They forgot to leave room for the EOB's. */
  1893.         return 0;
  1894.  
  1895.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1896.     if ( ! b )
  1897.         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1898.  
  1899.     b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
  1900.     b->yy_buf_pos = b->yy_ch_buf = base;
  1901.     b->yy_is_our_buffer = 0;
  1902.     b->yy_input_file = 0;
  1903.     b->yy_n_chars = b->yy_buf_size;
  1904.     b->yy_is_interactive = 0;
  1905.     b->yy_at_bol = 1;
  1906.     b->yy_fill_buffer = 0;
  1907.     b->yy_buffer_status = YY_BUFFER_NEW;
  1908.  
  1909.     yy_switch_to_buffer( b );
  1910.  
  1911.     return b;
  1912.     }
  1913. #endif
  1914.  
  1915.  
  1916. #ifndef YY_NO_SCAN_STRING
  1917. #ifdef YY_USE_PROTOS
  1918. YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
  1919. #else
  1920. YY_BUFFER_STATE yy_scan_string( yy_str )
  1921. yyconst char *yy_str;
  1922. #endif
  1923.     {
  1924.     int len;
  1925.     for ( len = 0; yy_str[len]; ++len )
  1926.         ;
  1927.  
  1928.     return yy_scan_bytes( yy_str, len );
  1929.     }
  1930. #endif
  1931.  
  1932.  
  1933. #ifndef YY_NO_SCAN_BYTES
  1934. #ifdef YY_USE_PROTOS
  1935. YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
  1936. #else
  1937. YY_BUFFER_STATE yy_scan_bytes( bytes, len )
  1938. yyconst char *bytes;
  1939. int len;
  1940. #endif
  1941.     {
  1942.     YY_BUFFER_STATE b;
  1943.     char *buf;
  1944.     yy_size_t n;
  1945.     int i;
  1946.  
  1947.     /* Get memory for full buffer, including space for trailing EOB's. */
  1948.     n = len + 2;
  1949.     buf = (char *) yy_flex_alloc( n );
  1950.     if ( ! buf )
  1951.         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1952.  
  1953.     for ( i = 0; i < len; ++i )
  1954.         buf[i] = bytes[i];
  1955.  
  1956.     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1957.  
  1958.     b = yy_scan_buffer( buf, n );
  1959.     if ( ! b )
  1960.         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1961.  
  1962.     /* It's okay to grow etc. this buffer, and we should throw it
  1963.      * away when we're done.
  1964.      */
  1965.     b->yy_is_our_buffer = 1;
  1966.  
  1967.     return b;
  1968.     }
  1969. #endif
  1970.  
  1971.  
  1972. #ifndef YY_NO_PUSH_STATE
  1973. #ifdef YY_USE_PROTOS
  1974. static void yy_push_state( int new_state )
  1975. #else
  1976. static void yy_push_state( new_state )
  1977. int new_state;
  1978. #endif
  1979.     {
  1980.     if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1981.         {
  1982.         yy_size_t new_size;
  1983.  
  1984.         yy_start_stack_depth += YY_START_STACK_INCR;
  1985.         new_size = yy_start_stack_depth * sizeof( int );
  1986.  
  1987.         if ( ! yy_start_stack )
  1988.             yy_start_stack = (int *) yy_flex_alloc( new_size );
  1989.  
  1990.         else
  1991.             yy_start_stack = (int *) yy_flex_realloc(
  1992.                     (void *) yy_start_stack, new_size );
  1993.  
  1994.         if ( ! yy_start_stack )
  1995.             YY_FATAL_ERROR(
  1996.             "out of memory expanding start-condition stack" );
  1997.         }
  1998.  
  1999.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  2000.  
  2001.     BEGIN(new_state);
  2002.     }
  2003. #endif
  2004.  
  2005.  
  2006. #ifndef YY_NO_POP_STATE
  2007. static void yy_pop_state()
  2008.     {
  2009.     if ( --yy_start_stack_ptr < 0 )
  2010.         YY_FATAL_ERROR( "start-condition stack underflow" );
  2011.  
  2012.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  2013.     }
  2014. #endif
  2015.  
  2016.  
  2017. #ifndef YY_NO_TOP_STATE
  2018. static int yy_top_state()
  2019.     {
  2020.     return yy_start_stack[yy_start_stack_ptr - 1];
  2021.     }
  2022. #endif
  2023.  
  2024. #ifndef YY_EXIT_FAILURE
  2025. #define YY_EXIT_FAILURE 2
  2026. #endif
  2027.  
  2028. #ifdef YY_USE_PROTOS
  2029. static void yy_fatal_error( yyconst char msg[] )
  2030. #else
  2031. static void yy_fatal_error( msg )
  2032. char msg[];
  2033. #endif
  2034.     {
  2035.     (void) fprintf( stderr, "%s\n", msg );
  2036.     exit( YY_EXIT_FAILURE );
  2037.     }
  2038.  
  2039.  
  2040.  
  2041. /* Redefine yyless() so it works in section 3 code. */
  2042.  
  2043. #undef yyless
  2044. #define yyless(n) \
  2045.     do \
  2046.         { \
  2047.         /* Undo effects of setting up yytext. */ \
  2048.         yytext[yyleng] = yy_hold_char; \
  2049.         yy_c_buf_p = yytext + n; \
  2050.         yy_hold_char = *yy_c_buf_p; \
  2051.         *yy_c_buf_p = '\0'; \
  2052.         yyleng = n; \
  2053.         } \
  2054.     while ( 0 )
  2055.  
  2056.  
  2057. /* Internal utility routines. */
  2058.  
  2059. #ifndef yytext_ptr
  2060. #ifdef YY_USE_PROTOS
  2061. static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
  2062. #else
  2063. static void yy_flex_strncpy( s1, s2, n )
  2064. char *s1;
  2065. yyconst char *s2;
  2066. int n;
  2067. #endif
  2068.     {
  2069.     register int i;
  2070.     for ( i = 0; i < n; ++i )
  2071.         s1[i] = s2[i];
  2072.     }
  2073. #endif
  2074.  
  2075. #ifdef YY_NEED_STRLEN
  2076. #ifdef YY_USE_PROTOS
  2077. static int yy_flex_strlen( yyconst char *s )
  2078. #else
  2079. static int yy_flex_strlen( s )
  2080. yyconst char *s;
  2081. #endif
  2082.     {
  2083.     register int n;
  2084.     for ( n = 0; s[n]; ++n )
  2085.         ;
  2086.  
  2087.     return n;
  2088.     }
  2089. #endif
  2090.  
  2091.  
  2092. #ifdef YY_USE_PROTOS
  2093. static void *yy_flex_alloc( yy_size_t size )
  2094. #else
  2095. static void *yy_flex_alloc( size )
  2096. yy_size_t size;
  2097. #endif
  2098.     {
  2099.     return (void *) malloc( size );
  2100.     }
  2101.  
  2102. #ifdef YY_USE_PROTOS
  2103. static void *yy_flex_realloc( void *ptr, yy_size_t size )
  2104. #else
  2105. static void *yy_flex_realloc( ptr, size )
  2106. void *ptr;
  2107. yy_size_t size;
  2108. #endif
  2109.     {
  2110.     /* The cast to (char *) in the following accommodates both
  2111.      * implementations that use char* generic pointers, and those
  2112.      * that use void* generic pointers.  It works with the latter
  2113.      * because both ANSI C and C++ allow castless assignment from
  2114.      * any pointer type to void*, and deal with argument conversions
  2115.      * as though doing an assignment.
  2116.      */
  2117.     return (void *) realloc( (char *) ptr, size );
  2118.     }
  2119.  
  2120. #ifdef YY_USE_PROTOS
  2121. static void yy_flex_free( void *ptr )
  2122. #else
  2123. static void yy_flex_free( ptr )
  2124. void *ptr;
  2125. #endif
  2126.     {
  2127.     free( ptr );
  2128.     }
  2129.  
  2130. #if YY_MAIN
  2131. int main()
  2132.     {
  2133.     yylex();
  2134.     return 0;
  2135.     }
  2136. #endif
  2137. #line 297 "command.l"
  2138.  
  2139.  
  2140. static int 
  2141. command_context_new_text(command_context **context,
  2142.         const command_context *outer,
  2143.         const char *name, const char *data, int len)
  2144. {
  2145.     my_assert(data != NULL);
  2146.  
  2147.     *context = (command_context *)xmalloc(sizeof(command_context));
  2148.     
  2149.     (*context)->outer = outer;
  2150.  
  2151.     if (name) (*context)->name = xstrdup(name); 
  2152.     else (*context)->name = xstrdup("(unnamed)");
  2153.     
  2154.     if (!(*context) || !(*context)->name || 
  2155.         OS_NewHandle(len, &(*context)->hand) != OS_NOERR)    
  2156.         return 0;
  2157.     
  2158.     (*context)->len = len;
  2159.     memcpy(OS_LockHandle(&(*context)->hand), data, len);
  2160.     OS_UnlockHandle(&(*context)->hand);
  2161.     
  2162.     (*context)->offs = 0;
  2163.     (*context)->line = 1;
  2164.  
  2165.     
  2166.     return 1;
  2167. }        
  2168.  
  2169. static int 
  2170. command_context_new_file(command_context **context,
  2171.         const command_context *outer,
  2172.         const char *filename)
  2173. {
  2174.     OSFileHandle fhand;
  2175.     OSError err;
  2176.     OSSpec spec;
  2177.  
  2178.     my_assert(filename != NULL);
  2179.  
  2180.     *context = (command_context *)xmalloc(sizeof(command_context));
  2181.     if (!*context)        return 0;
  2182.     
  2183.     (*context)->outer = outer;
  2184.  
  2185.     (*context)->name = (char *)xstrdup(filename); 
  2186.     if (!(*context)->name)    return 0;
  2187.  
  2188.     if ((err = OS_MakeFileSpec(filename, &spec)) != OS_NOERR ||
  2189.         (err = OS_NewFileHandle(&spec, NULL, false, &fhand)) != OS_NOERR ||
  2190.         (err = OS_CopyHandle(&fhand.hand, &(*context)->hand)) != OS_NOERR ||
  2191.         (err = OS_FreeFileHandle(&fhand)) != OS_NOERR)
  2192.     {
  2193.         logger(LOG_COMMANDS|LOG_ERROR|LOG_USER, "Couldn't get/copy file text from '%s':\n%s\n", filename, OS_GetErrText(err));
  2194.         return 0;
  2195.     }
  2196.  
  2197.     OS_GetHandleSize(&(*context)->hand, &(*context)->len);
  2198.     
  2199.     (*context)->offs = 0;
  2200.     (*context)->line = 1;
  2201.  
  2202.     return 1;
  2203. }
  2204.  
  2205. static void 
  2206. command_context_free(command_context **context)
  2207. {
  2208.     if (context == NULL || *context == NULL)
  2209.         return;
  2210.         
  2211.     if ((*context)->name)    xfree((*context)->name);
  2212.     OS_FreeHandle(&(*context)->hand);
  2213.     xfree(*context);
  2214.     
  2215.     *context = NULL;
  2216. }
  2217.  
  2218.  
  2219. /*    Routine to read text from our command buffer instead of stdin */    
  2220. static int command_context_getstring(command_context *context, 
  2221.     char *buf, int maxsize)
  2222. {
  2223.     void *ptr;
  2224.     OSSize cpy;
  2225. //    my_assert(context != NULL);
  2226.  
  2227.     if (context == NULL)
  2228.         return 0;
  2229.  
  2230.     ptr = OS_LockHandle(&context->hand);
  2231.  
  2232.     cpy = ((context->len - context->offs) < maxsize) ? 
  2233.         (context->len - context->offs) : 
  2234.         maxsize;
  2235.     memcpy(buf, ((char *)ptr) + context->offs, cpy);
  2236.     context->offs += cpy;
  2237.  
  2238.     OS_UnlockHandle(&context->hand);
  2239.     
  2240.     return cpy;
  2241. }
  2242.  
  2243. /******************************/
  2244.  
  2245. command_context *lexer_push_text(const char *name, const char *data, int len)
  2246. {
  2247.     command_context *cc;
  2248. #ifdef DEBUG
  2249.     logger(_L | LOG_USER, "lexer: reading from text '%s'\n", name);
  2250. #endif
  2251.     if (!command_context_new_text(&cc, cf, name, data, len))
  2252.         return NULL;
  2253.  
  2254.     if (cf)
  2255.     {
  2256.         cf->yybuf = YY_CURRENT_BUFFER;
  2257.         yy_switch_to_buffer(yy_create_buffer(NULL, cc->len));
  2258.     }
  2259.     
  2260.     cf = cc;
  2261.     return cf;
  2262. }
  2263.  
  2264. command_context *lexer_push_file(const char *filename)
  2265. {
  2266.     command_context *cc;
  2267. #ifdef DEBUG
  2268.     logger(_L | LOG_USER, "lexer: reading from file '%s'\n", filename);
  2269. #endif
  2270.     if (!command_context_new_file(&cc, cf, filename))
  2271.         return NULL;
  2272.  
  2273.     if (cf)
  2274.     {
  2275.         cf->yybuf = YY_CURRENT_BUFFER;
  2276.         yy_switch_to_buffer(yy_create_buffer(NULL, cc->len));
  2277.     }
  2278.  
  2279.     cf = cc;
  2280.     return cf;
  2281. }
  2282.  
  2283. command_context *lexer_pop_context(void)
  2284. {
  2285.     if (cf != NULL)
  2286.     {
  2287.         command_context *outer = (command_context *)cf->outer;
  2288.         command_context_free(&cf);
  2289.  
  2290.         if (outer)
  2291.         {
  2292.             yy_delete_buffer(YY_CURRENT_BUFFER);
  2293.             yy_switch_to_buffer(outer->yybuf);
  2294.         }
  2295.         
  2296.         cf = outer;
  2297.     #ifdef DEBUG
  2298.         logger(_L | LOG_USER, "lexer: popping context to '%s'\n", cf ? cf->name : "<null>");
  2299.     #endif
  2300.         return cf;
  2301.     }
  2302.  
  2303. #ifdef DEBUG
  2304.     logger(LOG_FATAL,"popped null lexer context\n");
  2305. #endif
  2306.     return NULL;
  2307. }
  2308.  
  2309. void    lexer_error(const char *comm, ...)
  2310. {
  2311.     va_list va;
  2312.     static char buf[256], *bptr;
  2313.     va_start(va, comm);
  2314.     bptr = mvprintf(buf, sizeof(buf), comm, va);
  2315.     logger(LOG_USER|LOG_ERROR, "%s:%d: %s\n", cf ? cf->name : "<unnamed>", 
  2316.             cf ? cf->line : 0, bptr);
  2317.     if (bptr != buf) free(bptr);
  2318. }
  2319.  
  2320. void    lexer_include(char *yy)
  2321. {
  2322.     char extract[256];
  2323.     
  2324.     char *st = strchr(yy, '\"')+1;
  2325.     char *en = strchr(st, '\"');
  2326.     if (en-st > 256) en = st+256;
  2327.     memcpy(extract, st, en-st);
  2328.     extract[en-st] = 0;
  2329.     
  2330.     lexer_push_file(extract);
  2331. }
  2332.  
  2333. int yywrap(void)
  2334. {
  2335.     return 1;
  2336. }
  2337.