home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.lbl.gov / 2014.05.ftp.ee.lbl.gov.tar / ftp.ee.lbl.gov / bmd-1.0beta.tar.Z / bmd-1.0beta.tar / bmd-1.0beta / app / omtd / parse.c < prev    next >
C/C++ Source or Header  |  1991-03-14  |  28KB  |  973 lines

  1.  
  2. /*  A Bison parser, made from parse.y  */
  3.  
  4. #define    TK_QUIT    258
  5. #define    TK_RUN    259
  6. #define    TK_STOP    260
  7. #define    TK_PRINT    261
  8. #define    TK_MERGE    262
  9. #define    TK_TEMPO    263
  10. #define    TK_DUMP    264
  11. #define    TK_ECHO    265
  12. #define    TK_CHANNEL    266
  13. #define    TK_CLICK    267
  14. #define    TK_DELETE    268
  15. #define    TK_COPY    269
  16. #define    TK_MUTE    270
  17. #define    TK_UNMUTE    271
  18. #define    TK_QUANTIZE    272
  19. #define    TK_SAVE    273
  20. #define    TK_LOAD    274
  21. #define    TK_TRACKS    275
  22. #define    TK_NEW    276
  23. #define    TK_INSERT    277
  24. #define    TK_VOLUME    278
  25. #define    TK_TRANS    279
  26. #define    TK_SET    280
  27. #define    TK_SETTING    281
  28. #define    TK_OFF    282
  29. #define    TK_CLEAR    283
  30. #define    TK_MOVE    284
  31. #define    TK_ID    285
  32. #define    TK_INT    286
  33. #define    TK_REAL    287
  34. #define    TK_STRING    288
  35. #define    TK_EOF    289
  36.  
  37. #line 30 "parse.y"
  38.  
  39. #include <sys/types.h>
  40. #include "setting.h"
  41. #include "track.h"
  42.  
  43. #define YYDEBUG
  44. char *prompt = "(mtd) ";
  45.  
  46. #line 39 "parse.y"
  47. typedef union {
  48.     int i;
  49.     char *s;
  50.     float f;
  51.     struct track *trk;
  52.     struct {
  53.         int s, e; 
  54.     } w;
  55. } YYSTYPE;
  56.  
  57. #ifndef YYLTYPE
  58. typedef
  59.   struct yyltype
  60.     {
  61.       int timestamp;
  62.       int first_line;
  63.       int first_column;
  64.       int last_line;
  65.       int last_column;
  66.       char *text;
  67.    }
  68.   yyltype;
  69.  
  70. #define YYLTYPE yyltype
  71. #endif
  72.  
  73. #define    YYACCEPT    return(0)
  74. #define    YYABORT    return(1)
  75. #define    YYERROR    goto yyerrlab
  76. #include <stdio.h>
  77.  
  78. #ifndef __STDC__
  79. #define const
  80. #endif
  81.  
  82.  
  83.  
  84. #define    YYFINAL        91
  85. #define    YYFLAG        -32768
  86. #define    YYNTBASE    39
  87.  
  88. #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 70)
  89.  
  90. static const char yytranslate[] = {     0,
  91.      2,     2,     2,     2,     2,     2,     2,     2,     2,    35,
  92.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  93.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  94.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  95.      2,     2,     2,    38,     2,     2,    36,     2,     2,     2,
  96.      2,     2,     2,     2,     2,     2,     2,    37,     2,     2,
  97.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  98.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  99.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  100.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  101.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  102.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  103.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  104.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  105.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  106.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  107.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  108.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  109.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  110.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  111.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  112.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  113.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  114.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  115.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  116.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  117.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  118.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  119.     26,    27,    28,    29,    30,    31,    32,    33,    34
  120. };
  121.  
  122. static const short yyrline[] = {     0,
  123.     55,    56,    58,    59,    60,    62,    64,    66,    67,    68,
  124.     69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
  125.     79,    80,    81,    82,    84,    86,    87,    88,    89,    91,
  126.     93,    95,    99,   101,   103,   108,   109,   111,   112,   113,
  127.    114,   116,   118,   120,   127,   129,   131,   132,   134,   137,
  128.    138,   140,   142,   143,   145,   146,   148,   149,   150,   152,
  129.    154,   156,   158,   160,   161,   162
  130. };
  131.  
  132. static const char * const yytname[] = {     0,
  133. "error","$illegal.","TK_QUIT","TK_RUN","TK_STOP","TK_PRINT","TK_MERGE","TK_TEMPO","TK_DUMP","TK_ECHO",
  134. "TK_CHANNEL","TK_CLICK","TK_DELETE","TK_COPY","TK_MUTE","TK_UNMUTE","TK_QUANTIZE","TK_SAVE","TK_LOAD","TK_TRACKS",
  135. "TK_NEW","TK_INSERT","TK_VOLUME","TK_TRANS","TK_SET","TK_SETTING","TK_OFF","TK_CLEAR","TK_MOVE","TK_ID",
  136. "TK_INT","TK_REAL","TK_STRING","TK_EOF","'\\n'","'/'","':'","','","input"
  137. };
  138.  
  139. static const short yyr1[] = {     0,
  140.     39,    39,    40,    40,    40,    41,    42,    43,    43,    43,
  141.     43,    43,    43,    43,    43,    43,    43,    43,    43,    43,
  142.     43,    43,    43,    43,    44,    45,    45,    45,    45,    46,
  143.     47,    48,    49,    50,    51,    52,    52,    53,    53,    53,
  144.     53,    54,    55,    56,    57,    58,    59,    59,    60,    61,
  145.     61,    62,    62,    62,    63,    63,    64,    64,    64,    65,
  146.     66,    67,    68,    69,    69,    69
  147. };
  148.  
  149. static const short yyr2[] = {     0,
  150.      3,     3,     0,     1,     1,     2,     0,     1,     1,     1,
  151.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  152.      1,     1,     1,     1,     2,     1,     2,     2,     3,     1,
  153.      2,     3,     1,     1,     6,     1,     2,     2,     1,     2,
  154.      3,     2,     2,     5,     2,     3,     3,     2,     2,     2,
  155.      2,     0,     1,     2,     0,     1,     0,     1,     1,     3,
  156.      1,     1,     1,     1,     3,     5
  157. };
  158.  
  159. static const short yydefact[] = {     7,
  160.      0,     0,     5,    30,    26,     0,     0,     0,    36,     0,
  161.     39,     0,    52,     0,     0,     0,     0,     0,    33,    34,
  162.      0,     0,     4,    24,     8,     9,    10,    11,    12,    13,
  163.     14,    15,    16,    17,    18,    19,    20,    21,    23,    22,
  164.      0,    61,    64,    28,    27,    62,    31,    45,    25,    37,
  165.      0,    38,    40,    49,    53,     0,     0,    51,    50,     0,
  166.     42,    43,    57,     7,     2,     1,     0,    29,    63,    32,
  167.     41,    54,    57,     0,    46,    59,    58,     6,    65,     0,
  168.      0,     0,     0,    55,    44,    60,    66,    35,    56,     0,
  169.      0
  170. };
  171.  
  172. static const short yydefgoto[] = {     1,
  173.     22,    65,     2,    23,    24,    25,    26,    27,    28,    29,
  174.     30,    31,    32,    33,    34,    35,    36,    37,    38,    -1,
  175.     39,    40,    57,    88,    75,    76,    44,    47,    70,    77
  176. };
  177.  
  178. static const short yypact[] = {-32768,
  179.     13,    46,-32768,-32768,   -12,   -18,   -27,     5,     6,   -18,
  180.    -24,     5,   -26,     5,     5,     5,     8,    10,-32768,-32768,
  181.      5,     1,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  182. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  183.      1,-32768,     7,    11,-32768,-32768,-32768,-32768,-32768,-32768,
  184.     12,-32768,    14,-32768,-32768,    15,     5,-32768,-32768,    21,
  185. -32768,-32768,    11,-32768,-32768,-32768,    37,-32768,-32768,-32768,
  186. -32768,-32768,    11,    33,-32768,-32768,    32,-32768,    35,   -18,
  187.     42,    11,    44,    11,-32768,-32768,-32768,-32768,-32768,    76,
  188. -32768
  189. };
  190.  
  191. static const short yypgoto[] = {-32768,
  192.     78,    41,    19,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  193. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  194. -32768,-32768,-32768,-32768,    16,-32768,    -6,    -9,-32768,    -5
  195. };
  196.  
  197.  
  198. #define    YYLAST        89
  199.  
  200.  
  201. static const short yytable[] = {    45,
  202.     51,    49,    52,    48,    55,    54,    53,    58,    59,    60,
  203.     56,    46,    90,     3,    63,     4,     5,    42,    43,     6,
  204.      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
  205.     17,    18,    19,    20,    42,    64,    50,    61,    68,    62,
  206.     21,    43,    69,    67,    71,    72,     3,    -3,     4,     5,
  207.     73,    74,     6,     7,     8,     9,    10,    11,    12,    13,
  208.     14,    15,    16,    17,    18,    19,    20,    79,    81,    82,
  209.     84,    83,    85,    21,    87,    91,    86,     0,    89,    41,
  210.     -3,    66,    78,     0,     0,     0,     0,     0,    80
  211. };
  212.  
  213. static const short yycheck[] = {     5,
  214.     10,     8,    27,    31,    31,    12,    31,    14,    15,    16,
  215.     37,    30,     0,     1,    21,     3,     4,    30,    31,     7,
  216.      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
  217.     18,    19,    20,    21,    30,    35,    31,    30,    44,    30,
  218.     28,    31,    31,    37,    31,    31,     1,    35,     3,     4,
  219.     57,    31,     7,     8,     9,    10,    11,    12,    13,    14,
  220.     15,    16,    17,    18,    19,    20,    21,    31,    36,    38,
  221.     80,    37,    31,    28,    31,     0,    82,    -1,    84,     2,
  222.     35,    41,    64,    -1,    -1,    -1,    -1,    -1,    73
  223. };
  224. #define YYPURE 1
  225.  
  226. #line 2 "bison.simple"
  227.  
  228. /* Skeleton output parser for bison,
  229.    copyright (C) 1984 Bob Corbett and Richard Stallman
  230.  
  231.                NO WARRANTY
  232.  
  233.   BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  234. NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  235. WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  236. RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
  237. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  238. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  239. FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  240. AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
  241. DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  242. CORRECTION.
  243.  
  244.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
  245. STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
  246. WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
  247. LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
  248. OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  249. USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
  250. DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
  251. A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
  252. PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
  253. DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  254.  
  255.         GENERAL PUBLIC LICENSE TO COPY
  256.  
  257.   1. You may copy and distribute verbatim copies of this source file
  258. as you receive it, in any medium, provided that you conspicuously and
  259. appropriately publish on each copy a valid copyright notice "Copyright
  260. (C) 1985 Free Software Foundation, Inc."; and include following the
  261. copyright notice a verbatim copy of the above disclaimer of warranty
  262. and of this License.  You may charge a distribution fee for the
  263. physical act of transferring a copy.
  264.  
  265.   2. You may modify your copy or copies of this source file or
  266. any portion of it, and copy and distribute such modifications under
  267. the terms of Paragraph 1 above, provided that you also do the following:
  268.  
  269.     a) cause the modified files to carry prominent notices stating
  270.     that you changed the files and the date of any change; and
  271.  
  272.     b) cause the whole of any work that you distribute or publish,
  273.     that in whole or in part contains or is a derivative of this
  274.     program or any part thereof, to be licensed at no charge to all
  275.     third parties on terms identical to those contained in this
  276.     License Agreement (except that you may choose to grant more extensive
  277.     warranty protection to some or all third parties, at your option).
  278.  
  279.     c) You may charge a distribution fee for the physical act of
  280.     transferring a copy, and you may at your option offer warranty
  281.     protection in exchange for a fee.
  282.  
  283. Mere aggregation of another unrelated program with this program (or its
  284. derivative) on a volume of a storage or distribution medium does not bring
  285. the other program under the scope of these terms.
  286.  
  287.   3. You may copy and distribute this program (or a portion or derivative
  288. of it, under Paragraph 2) in object code or executable form under the terms
  289. of Paragraphs 1 and 2 above provided that you also do one of the following:
  290.  
  291.     a) accompany it with the complete corresponding machine-readable
  292.     source code, which must be distributed under the terms of
  293.     Paragraphs 1 and 2 above; or,
  294.  
  295.     b) accompany it with a written offer, valid for at least three
  296.     years, to give any third party free (except for a nominal
  297.     shipping charge) a complete machine-readable copy of the
  298.     corresponding source code, to be distributed under the terms of
  299.     Paragraphs 1 and 2 above; or,
  300.  
  301.     c) accompany it with the information you received as to where the
  302.     corresponding source code may be obtained.  (This alternative is
  303.     allowed only for noncommercial distribution and only if you
  304.     received the program in object code or executable form alone.)
  305.  
  306. For an executable file, complete source code means all the source code for
  307. all modules it contains; but, as a special exception, it need not include
  308. source code for modules which are standard libraries that accompany the
  309. operating system on which the executable file runs.
  310.  
  311.   4. You may not copy, sublicense, distribute or transfer this program
  312. except as expressly provided under this License Agreement.  Any attempt
  313. otherwise to copy, sublicense, distribute or transfer this program is void and
  314. your rights to use the program under this License agreement shall be
  315. automatically terminated.  However, parties who have received computer
  316. software programs from you with this License Agreement will not have
  317. their licenses terminated so long as such parties remain in full compliance.
  318.  
  319.   5. If you wish to incorporate parts of this program into other free
  320. programs whose distribution conditions are different, write to the Free
  321. Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
  322. worked out a simple rule that can be stated here, but we will often permit
  323. this.  We will be guided by the two goals of preserving the free status of
  324. all derivatives of our free software and of promoting the sharing and reuse of
  325. software.
  326.  
  327.  
  328. In other words, you are welcome to use, share and improve this program.
  329. You are forbidden to forbid anyone else to use, share and improve
  330. what you give them.   Help stamp out software-hoarding!  */
  331.  
  332. #ifdef __GNUC__
  333. #define alloca __builtin_alloca
  334. #else
  335. #ifdef sparc
  336. #include <alloca.h>
  337. #else
  338. char *alloca ();
  339. #endif
  340. #endif
  341.  
  342. /* This is the parser code that is written into each bison parser
  343.   when the %semantic_parser declaration is not specified in the grammar.
  344.   It was written by Richard Stallman by simplifying the hairy parser
  345.   used when %semantic_parser is specified.  */
  346.  
  347. /* Note: there must be only one dollar sign in this file.
  348.    It is replaced by the list of actions, each action
  349.    as one case of the switch.  */
  350.  
  351. #define yyerrok        (yyerrstatus = 0)
  352. #define yyclearin    (yychar = YYEMPTY)
  353. #define YYEMPTY        -2
  354. #define YYEOF        0
  355. #define YYFAIL        goto yyerrlab;
  356.  
  357. #define YYTERROR    1
  358.  
  359. #ifndef YYIMPURE
  360. #define YYLEX        yylex()
  361. #endif
  362.  
  363. #ifndef YYPURE
  364. #define YYLEX        yylex(&yylval, &yylloc)
  365. #endif
  366.  
  367. /* If nonreentrant, generate the variables here */
  368.  
  369. #ifndef YYIMPURE
  370.  
  371. int    yychar;            /*  the lookahead symbol        */
  372. YYSTYPE    yylval;            /*  the semantic value of the        */
  373.                 /*  lookahead symbol            */
  374.  
  375. YYLTYPE yylloc;            /*  location data for the lookahead    */
  376.                 /*  symbol                */
  377.  
  378. int yynerr;            /*  number of parse errors so far       */
  379.  
  380. #ifdef YYDEBUG
  381. int yydebug = 0;        /*  nonzero means print parse trace    */
  382. #endif
  383.  
  384. #endif  /* YYIMPURE */
  385.  
  386.  
  387. /*  YYMAXDEPTH indicates the initial size of the parser's stacks    */
  388.  
  389. #ifndef    YYMAXDEPTH
  390. #define YYMAXDEPTH 200
  391. #endif
  392.  
  393. /*  YYMAXLIMIT is the maximum size the stacks can grow to
  394.     (effective only if the built-in stack extension method is used).  */
  395.  
  396. #ifndef YYMAXLIMIT
  397. #define YYMAXLIMIT 10000
  398. #endif
  399.  
  400.  
  401. #line 167 "bison.simple"
  402. int
  403. yyparse()
  404. {
  405.   register int yystate;
  406.   register int yyn;
  407.   register short *yyssp;
  408.   register YYSTYPE *yyvsp;
  409.   YYLTYPE *yylsp;
  410.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  411.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  412.  
  413.   short    yyssa[YYMAXDEPTH];    /*  the state stack            */
  414.   YYSTYPE yyvsa[YYMAXDEPTH];    /*  the semantic value stack        */
  415.   YYLTYPE yylsa[YYMAXDEPTH];    /*  the location stack            */
  416.  
  417.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  418.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  419.   YYLTYPE *yyls = yylsa;
  420.  
  421.   int yymaxdepth = YYMAXDEPTH;
  422.  
  423. #ifndef YYPURE
  424.   int yychar;
  425.   YYSTYPE yylval;
  426.   YYLTYPE yylloc;
  427. #endif
  428.  
  429. #ifdef YYDEBUG
  430.   extern int yydebug;
  431. #endif
  432.  
  433.  
  434.   YYSTYPE yyval;        /*  the variable used to return        */
  435.                 /*  semantic values from the action    */
  436.                 /*  routines                */
  437.  
  438.   int yylen;
  439.  
  440. #ifdef YYDEBUG
  441.   if (yydebug)
  442.     fprintf(stderr, "Starting parse\n");
  443. #endif
  444.  
  445.   yystate = 0;
  446.   yyerrstatus = 0;
  447.   yynerr = 0;
  448.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  449.  
  450.   /* Initialize stack pointers.
  451.      Waste one element of value and location stack
  452.      so that they stay on the same level as the state stack.  */
  453.  
  454.   yyssp = yyss - 1;
  455.   yyvsp = yyvs;
  456.   yylsp = yyls;
  457.  
  458. /* Push a new state, which is found in  yystate  .  */
  459. /* In all cases, when you get here, the value and location stacks
  460.    have just been pushed. so pushing a state here evens the stacks.  */
  461. yynewstate:
  462.  
  463.   *++yyssp = yystate;
  464.  
  465.   if (yyssp >= yyss + yymaxdepth - 1)
  466.     {
  467.       /* Give user a chance to reallocate the stack */
  468.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  469.       YYSTYPE *yyvs1 = yyvs;
  470.       YYLTYPE *yyls1 = yyls;
  471.       short *yyss1 = yyss;
  472.  
  473.       /* Get the current used size of the three stacks, in elements.  */
  474.       int size = yyssp - yyss + 1;
  475.  
  476. #ifdef yyoverflow
  477.       /* Each stack pointer address is followed by the size of
  478.      the data in use in that stack, in bytes.  */
  479.       yyoverflow("parser stack overflow",
  480.          &yyss1, size * sizeof (*yyssp),
  481.          &yyvs1, size * sizeof (*yyvsp),
  482.          &yyls1, size * sizeof (*yylsp),
  483.          &yymaxdepth);
  484.  
  485.       yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
  486. #else /* no yyoverflow */
  487.       /* Extend the stack our own way.  */
  488.       if (yymaxdepth >= YYMAXLIMIT)
  489.     yyerror("parser stack overflow");
  490.       yymaxdepth *= 2;
  491.       if (yymaxdepth > YYMAXLIMIT)
  492.     yymaxdepth = YYMAXLIMIT;
  493.       yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
  494.       bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  495.       yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
  496.       bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  497. #ifdef YYLSP_NEEDED
  498.       yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
  499.       bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  500. #endif
  501. #endif /* no yyoverflow */
  502.  
  503.       yyssp = yyss + size - 1;
  504.       yyvsp = yyvs + size - 1;
  505. #ifdef YYLSP_NEEDED
  506.       yylsp = yyls + size - 1;
  507. #endif
  508.  
  509. #ifdef YYDEBUG
  510.       if (yydebug)
  511.     fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
  512. #endif
  513.  
  514.       if (yyssp >= yyss + yymaxdepth - 1)
  515.     YYABORT;
  516.     }
  517.  
  518. #ifdef YYDEBUG
  519.   if (yydebug)
  520.     fprintf(stderr, "Entering state %d\n", yystate);
  521. #endif
  522.  
  523. /* Do appropriate processing given the current state.  */
  524. /* Read a lookahead token if we need one and don't already have one.  */
  525. yyresume:
  526.  
  527.   /* First try to decide what to do without reference to lookahead token.  */
  528.  
  529.   yyn = yypact[yystate];
  530.   if (yyn == YYFLAG)
  531.     goto yydefault;
  532.  
  533.   /* Not known => get a lookahead token if don't already have one.  */
  534.  
  535.   /* yychar is either YYEMPTY or YYEOF
  536.      or a valid token in external form.  */
  537.  
  538.   if (yychar == YYEMPTY)
  539.     {
  540. #ifdef YYDEBUG
  541.       if (yydebug)
  542.     fprintf(stderr, "Reading a token: ");
  543. #endif
  544.       yychar = YYLEX;
  545.     }
  546.  
  547.   /* Convert token to internal form (in yychar1) for indexing tables with */
  548.  
  549.   if (yychar <= 0)        /* This means end of input. */
  550.     {
  551.       yychar1 = 0;
  552.       yychar = YYEOF;        /* Don't call YYLEX any more */
  553.  
  554. #ifdef YYDEBUG
  555.       if (yydebug)
  556.     fprintf(stderr, "Now at end of input.\n");
  557. #endif
  558.     }
  559.   else
  560.     {
  561.       yychar1 = YYTRANSLATE(yychar);
  562.  
  563. #ifdef YYDEBUG
  564.       if (yydebug)
  565.     fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
  566. #endif
  567.     }
  568.  
  569.   yyn += yychar1;
  570.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  571.     goto yydefault;
  572.  
  573.   yyn = yytable[yyn];
  574.  
  575.   /* yyn is what to do for this token type in this state.
  576.      Negative => reduce, -yyn is rule number.
  577.      Positive => shift, yyn is new state.
  578.        New state is final state => don't bother to shift,
  579.        just return success.
  580.      0, or most negative number => error.  */
  581.  
  582.   if (yyn < 0)
  583.     {
  584.       if (yyn == YYFLAG)
  585.     goto yyerrlab;
  586.       yyn = -yyn;
  587.       goto yyreduce;
  588.     }
  589.   else if (yyn == 0)
  590.     goto yyerrlab;
  591.  
  592.   if (yyn == YYFINAL)
  593.     YYACCEPT;
  594.  
  595.   /* Shift the lookahead token.  */
  596.  
  597. #ifdef YYDEBUG
  598.   if (yydebug)
  599.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  600. #endif
  601.  
  602.   /* Discard the token being shifted unless it is eof.  */
  603.   if (yychar != YYEOF)
  604.     yychar = YYEMPTY;
  605.  
  606.   *++yyvsp = yylval;
  607. #ifdef YYLSP_NEEDED
  608.   *++yylsp = yylloc;
  609. #endif
  610.  
  611.   /* count tokens shifted since error; after three, turn off error status.  */
  612.   if (yyerrstatus) yyerrstatus--;
  613.  
  614.   yystate = yyn;
  615.   goto yynewstate;
  616.  
  617. /* Do the default action for the current state.  */
  618. yydefault:
  619.  
  620.   yyn = yydefact[yystate];
  621.   if (yyn == 0)
  622.     goto yyerrlab;
  623.  
  624. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  625. yyreduce:
  626.   yylen = yyr2[yyn];
  627.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  628.  
  629. #ifdef YYDEBUG
  630.   if (yydebug)
  631.     {
  632.       if (yylen == 1)
  633.     fprintf (stderr, "Reducing 1 value via line %d, ",
  634.          yyrline[yyn]);
  635.       else
  636.     fprintf (stderr, "Reducing %d values via line %d, ",
  637.          yylen, yyrline[yyn]);
  638.     }
  639. #endif
  640.  
  641.  
  642.   switch (yyn) {
  643.  
  644. case 7:
  645. #line 64 "parse.y"
  646. { fputs(prompt, stdout); fflush(stdout); ;
  647.     break;}
  648. case 25:
  649. #line 84 "parse.y"
  650. { dump_command(yyvsp[0].trk); ;
  651.     break;}
  652. case 26:
  653. #line 86 "parse.y"
  654. { run_command(0, (void *)0); ;
  655.     break;}
  656. case 27:
  657. #line 87 "parse.y"
  658. { run_command(yyvsp[0].i, (void *)0); ;
  659.     break;}
  660. case 28:
  661. #line 88 "parse.y"
  662. { run_command(0, yyvsp[0].trk); ;
  663.     break;}
  664. case 29:
  665. #line 89 "parse.y"
  666. { run_command(yyvsp[0].i, yyvsp[-1].trk); ;
  667.     break;}
  668. case 30:
  669. #line 91 "parse.y"
  670. { exit(0); ;
  671.     break;}
  672. case 31:
  673. #line 93 "parse.y"
  674. { merge_command(yyvsp[0].trk); ;
  675.     break;}
  676. case 32:
  677. #line 97 "parse.y"
  678. { channel_command(yyvsp[-1].trk, yyvsp[0].i); ;
  679.     break;}
  680. case 33:
  681. #line 99 "parse.y"
  682. { tracks_command(); ;
  683.     break;}
  684. case 34:
  685. #line 101 "parse.y"
  686. { new_command(); ;
  687.     break;}
  688. case 35:
  689. #line 104 "parse.y"
  690. {
  691.     if (yyvsp[-3].trk)
  692.         copy_command(yyvsp[-3].trk, yyvsp[-2].w.s, yyvsp[-2].w.e, yyvsp[-1].trk, yyvsp[0].i, yyvsp[-4].i);
  693. ;
  694.     break;}
  695. case 36:
  696. #line 108 "parse.y"
  697. { echo_command(-1); ;
  698.     break;}
  699. case 37:
  700. #line 109 "parse.y"
  701. { echo_command(yyvsp[0].i); ;
  702.     break;}
  703. case 38:
  704. #line 111 "parse.y"
  705. { click_off(); ;
  706.     break;}
  707. case 39:
  708. #line 112 "parse.y"
  709. { click_on(-1, -1); ;
  710.     break;}
  711. case 40:
  712. #line 113 "parse.y"
  713. { click_on(yyvsp[0].i, -1); ;
  714.     break;}
  715. case 41:
  716. #line 114 "parse.y"
  717. { click_on(yyvsp[-1].i, yyvsp[0].i); ;
  718.     break;}
  719. case 42:
  720. #line 116 "parse.y"
  721. { save_command(yyvsp[0].s); ;
  722.     break;}
  723. case 43:
  724. #line 118 "parse.y"
  725. { load_command(yyvsp[0].s); ;
  726.     break;}
  727. case 44:
  728. #line 122 "parse.y"
  729. {
  730.     if (yyvsp[-3].trk)
  731.         quantize_command(yyvsp[-3].trk, yyvsp[-2].i, yyvsp[0].i);
  732. ;
  733.     break;}
  734. case 45:
  735. #line 127 "parse.y"
  736. { tempo_command(yyvsp[0].i); ;
  737.     break;}
  738. case 46:
  739. #line 129 "parse.y"
  740. { clear_command(yyvsp[-1].trk, yyvsp[0].w.s, yyvsp[0].w.e); ;
  741.     break;}
  742. case 47:
  743. #line 131 "parse.y"
  744. { move_command(yyvsp[-1].i, yyvsp[0].i); ;
  745.     break;}
  746. case 48:
  747. #line 132 "parse.y"
  748. { move_command(yyvsp[0].i, 0); ;
  749.     break;}
  750. case 49:
  751. #line 134 "parse.y"
  752. { clear_command(yyvsp[0].trk, 0, ~0);
  753.                   delete_command(yyvsp[0].trk); ;
  754.     break;}
  755. case 50:
  756. #line 137 "parse.y"
  757. { mute_command(yyvsp[0].trk, 0); ;
  758.     break;}
  759. case 51:
  760. #line 138 "parse.y"
  761. { mute_command(yyvsp[0].trk, 1); ;
  762.     break;}
  763. case 52:
  764. #line 141 "parse.y"
  765. { yyval.i = 1; ;
  766.     break;}
  767. case 54:
  768. #line 143 "parse.y"
  769. { yyval.i = yyvsp[0].i; ;
  770.     break;}
  771. case 55:
  772. #line 145 "parse.y"
  773. { yyval.i = 0; ;
  774.     break;}
  775. case 57:
  776. #line 148 "parse.y"
  777. { yyval.w.s = 0; yyval.w.e = ~0; ;
  778.     break;}
  779. case 58:
  780. #line 149 "parse.y"
  781. { yyval.w.s = yyvsp[0].i; yyval.w.e = ~0; ;
  782.     break;}
  783. case 60:
  784. #line 152 "parse.y"
  785. { yyval.w.s = yyvsp[-2].i; yyval.w.e = yyvsp[0].i; ;
  786.     break;}
  787. case 61:
  788. #line 154 "parse.y"
  789. { yyval.trk = find_track(yyvsp[0].s); ;
  790.     break;}
  791. case 62:
  792. #line 156 "parse.y"
  793. { yyval.trk = lookup_track(yyvsp[0].s, s.echo_channel); ;
  794.     break;}
  795. case 64:
  796. #line 160 "parse.y"
  797. { yyval.i = ttt(yyvsp[0].i, 0, 0); ;
  798.     break;}
  799. case 65:
  800. #line 161 "parse.y"
  801. { yyval.i = ttt(yyvsp[-2].i, yyvsp[0].i, 0); ;
  802.     break;}
  803. case 66:
  804. #line 162 "parse.y"
  805. { yyval.i = ttt(yyvsp[-4].i, yyvsp[-2].i, yyvsp[0].i); ;
  806.     break;}
  807. }
  808.    /* the action file gets copied in in place of this dollarsign */
  809. #line 408 "bison.simple"
  810.  
  811.   yyvsp -= yylen;
  812.   yyssp -= yylen;
  813. #ifdef YYLSP_NEEDED
  814.   yylsp -= yylen;
  815. #endif
  816.  
  817. #ifdef YYDEBUG
  818.   if (yydebug)
  819.     {
  820.       short *ssp1 = yyss - 1;
  821.       fprintf (stderr, "state stack now");
  822.       while (ssp1 != yyssp)
  823.     fprintf (stderr, " %d", *++ssp1);
  824.       fprintf (stderr, "\n");
  825.     }
  826. #endif
  827.  
  828.   *++yyvsp = yyval;
  829.  
  830. #ifdef YYLSP_NEEDED
  831.   yylsp++;
  832.   if (yylen == 0)
  833.     {
  834.       yylsp->first_line = yylloc.first_line;
  835.       yylsp->first_column = yylloc.first_column;
  836.       yylsp->last_line = (yylsp-1)->last_line;
  837.       yylsp->last_column = (yylsp-1)->last_column;
  838.       yylsp->text = 0;
  839.     }
  840.   else
  841.     {
  842.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  843.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  844.     }
  845. #endif
  846.  
  847.   /* Now "shift" the result of the reduction.
  848.      Determine what state that goes to,
  849.      based on the state we popped back to
  850.      and the rule number reduced by.  */
  851.  
  852.   yyn = yyr1[yyn];
  853.  
  854.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  855.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  856.     yystate = yytable[yystate];
  857.   else
  858.     yystate = yydefgoto[yyn - YYNTBASE];
  859.  
  860.   goto yynewstate;
  861.  
  862. yyerrlab:   /* here on detecting error */
  863.  
  864.   if (! yyerrstatus)
  865.     /* If not already recovering from an error, report this error.  */
  866.     {
  867.       ++yynerr;
  868.       yyerror("parse error");
  869.     }
  870.  
  871.   if (yyerrstatus == 3)
  872.     {
  873.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  874.  
  875.       /* return failure if at end of input */
  876.       if (yychar == YYEOF)
  877.     YYABORT;
  878.  
  879. #ifdef YYDEBUG
  880.       if (yydebug)
  881.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  882. #endif
  883.  
  884.       yychar = YYEMPTY;
  885.     }
  886.  
  887.   /* Else will try to reuse lookahead token
  888.      after shifting the error token.  */
  889.  
  890.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  891.  
  892.   goto yyerrhandle;
  893.  
  894. yyerrdefault:  /* current state does not do anything special for the error token. */
  895.  
  896. #if 0
  897.   /* This is wrong; only states that explicitly want error tokens
  898.      should shift them.  */
  899.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  900.   if (yyn) goto yydefault;
  901. #endif
  902.  
  903. yyerrpop:   /* pop the current state because it cannot handle the error token */
  904.  
  905.   if (yyssp == yyss) YYABORT;
  906.   yyvsp--;
  907.   yystate = *--yyssp;
  908. #ifdef YYLSP_NEEDED
  909.   yylsp--;
  910. #endif
  911.  
  912. #ifdef YYDEBUG
  913.   if (yydebug)
  914.     {
  915.       short *ssp1 = yyss - 1;
  916.       fprintf (stderr, "Error: state stack now");
  917.       while (ssp1 != yyssp)
  918.     fprintf (stderr, " %d", *++ssp1);
  919.       fprintf (stderr, "\n");
  920.     }
  921. #endif
  922.  
  923. yyerrhandle:
  924.  
  925.   yyn = yypact[yystate];
  926.   if (yyn == YYFLAG)
  927.     goto yyerrdefault;
  928.  
  929.   yyn += YYTERROR;
  930.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  931.     goto yyerrdefault;
  932.  
  933.   yyn = yytable[yyn];
  934.   if (yyn < 0)
  935.     {
  936.       if (yyn == YYFLAG)
  937.     goto yyerrpop;
  938.       yyn = -yyn;
  939.       goto yyreduce;
  940.     }
  941.   else if (yyn == 0)
  942.     goto yyerrpop;
  943.  
  944.   if (yyn == YYFINAL)
  945.     YYACCEPT;
  946.  
  947. #ifdef YYDEBUG
  948.   if (yydebug)
  949.     fprintf(stderr, "Shifting error token, ");
  950. #endif
  951.  
  952.   *++yyvsp = yylval;
  953. #ifdef YYLSP_NEEDED
  954.   *++yylsp = yylloc;
  955. #endif
  956.  
  957.   yystate = yyn;
  958.   goto yynewstate;
  959. }
  960. #line 164 "parse.y"
  961.  
  962. yyerror(s)
  963.     char *s;
  964. {
  965.     printf("syntax error\n");
  966. }
  967.  
  968. ttt(bar, beat, tick)
  969.     int bar, beat, tick;
  970. {
  971.     return tick + s.ticks_per_beat * (beat + bar * s.beats_per_bar);
  972. }
  973.