Plan 9 from Bell Labs’s /usr/web/sources/contrib/cnielsen/cuetools/cue_parse.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <stdlib.h>
#ifdef Plan9
#include <bsd.h>
#endif
#ifndef lint
#ifdef __unused
__unused
#endif
static char const 
yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.37 2003/02/12 18:03:55 davidc Exp $";
#endif
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYLEX yylex()
#define YYEMPTY -1
#define yyclearin (yychar=(YYEMPTY))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING() (yyerrflag!=0)
#if defined(__cplusplus) || __STDC__
static int yygrowstack(void);
#else
static int yygrowstack();
#endif
#define yyparse cue_yyparse
#define yylex cue_yylex
#define yyerror cue_yyerror
#define yychar cue_yychar
#define yyval cue_yyval
#define yylval cue_yylval
#define yydebug cue_yydebug
#define yynerrs cue_yynerrs
#define yyerrflag cue_yyerrflag
#define yyss cue_yyss
#define yyssp cue_yyssp
#define yyvs cue_yyvs
#define yyvsp cue_yyvsp
#define yylhs cue_yylhs
#define yylen cue_yylen
#define yydefred cue_yydefred
#define yydgoto cue_yydgoto
#define yysindex cue_yysindex
#define yyrindex cue_yyrindex
#define yygindex cue_yygindex
#define yytable cue_yytable
#define yycheck cue_yycheck
#define yyname cue_yyname
#define yyrule cue_yyrule
#define yysslim cue_yysslim
#define yystacksize cue_yystacksize
#define YYPREFIX "cue_yy"
#line 2 "cue_parse.y"
/*
 * cue_parse.y -- parser for cue files
 *
 * Copyright (C) 2004 Svend Sorensen
 * For license terms, see the file COPYING in this distribution.
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "cd.h"
#include "time.h"

#define YYDEBUG 1

extern int cue_yylex();
void yyerror (char *s);

static Cd *cd = NULL; 
static Track *track = NULL;
static Track *prev_track = NULL;
static Cdtext *cdtext = NULL;
static char *prev_filename = NULL;	/* last file in or before last track */
static char *cur_filename = NULL;	/* last file in the last track */
static char *new_filename = NULL;	/* last file in this track */
#line 31 "cue_parse.y"
typedef union {
	long ival;
	char *sval;
} YYSTYPE;
#line 81 "cue_parse.c"
#define YYERRCODE 256
#define NUMBER 257
#define STRING 258
#define CATALOG 259
#define CDTEXTFILE 260
#define FFILE 261
#define BINARY 262
#define MOTOROLA 263
#define AIFF 264
#define WAVE 265
#define MP3 266
#define TRACK 267
#define AUDIO 268
#define MODE1_2048 269
#define MODE1_2352 270
#define MODE2_2336 271
#define MODE2_2048 272
#define MODE2_2342 273
#define MODE2_2332 274
#define MODE2_2352 275
#define TRACK_ISRC 276
#define FLAGS 277
#define PRE 278
#define DCP 279
#define FOUR_CH 280
#define SCMS 281
#define PREGAP 282
#define INDEX 283
#define POSTGAP 284
#define TITLE 285
#define PERFORMER 286
#define SONGWRITER 287
#define COMPOSER 288
#define ARRANGER 289
#define MESSAGE 290
#define DISC_ID 291
#define GENRE 292
#define TOC_INFO1 293
#define TOC_INFO2 294
#define UPC_EAN 295
#define ISRC 296
#define SIZE_INFO 297
const short cue_yylhs[] = {                                        -1,
    0,    5,    6,    6,    8,    8,    8,    8,    8,   10,
    7,    7,   12,   11,   11,   11,   11,   11,   13,   14,
    1,    1,    1,    1,    1,    1,    1,    1,   15,   15,
   16,   16,   16,   16,   16,   16,   16,   16,   17,   17,
    2,    2,    2,    2,    9,    4,    4,    4,    4,    4,
    4,    4,    4,    4,    4,    4,    4,    4,    3,    3,
};
const short cue_yylen[] = {                                         2,
    3,    0,    0,    2,    3,    3,    1,    1,    2,    4,
    1,    2,    3,    1,    1,    1,    1,    1,    0,    4,
    1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
    1,    3,    3,    3,    4,    3,    1,    2,    0,    2,
    1,    1,    1,    1,    3,    1,    1,    1,    1,    1,
    1,    1,    1,    1,    1,    1,    1,    1,    1,    5,
};
const short cue_yydefred[] = {                                      2,
    0,    3,    0,    0,    0,    0,    0,   46,   47,   48,
   49,   50,   51,   52,   53,   54,   55,   56,   57,   58,
    0,    0,    4,    7,    8,   11,    0,    9,    0,    0,
    0,    0,   12,    0,    0,    5,    6,   14,   15,   16,
   17,   18,    0,   45,    0,    0,    0,   39,    0,    0,
    0,   31,   37,    0,   29,   10,   21,   22,   23,   24,
   25,   26,   27,   28,    0,   38,    0,    0,    0,    0,
    0,    0,   30,   20,   33,   41,   42,   43,   44,   32,
   40,    0,   34,    0,   36,    0,   35,    0,   60,
};
const short cue_yydgoto[] = {                                       1,
   65,   81,   70,   21,    2,    3,   22,   23,   52,   53,
   43,   26,   27,   35,   54,   55,   68,
};
const short cue_yysindex[] = {                                      0,
    0,    0, -241,   -7, -250, -244, -242,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 -234,    0,    0,    0,    0,    0, -263,    0,    7,   15,
 -253,   16,    0, -230, -254,    0,    0,    0,    0,    0,
    0,    0,   55,    0, -211,   56, -191,    0, -189, -188,
 -189,    0,    0, -254,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   60,    0,   61,  -10,   14,   63,
 -189,   64,    0,    0,    0,    0,    0,    0,    0,    0,
    0, -182,    0,   66,    0,   19,    0, -179,    0,
};
const short cue_yyrindex[] = {                                      0,
    0,    0, -187,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    5,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    6,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   69,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,
};
const short cue_yygindex[] = {                                      0,
    0,    0,  -50,    0,    0,    0,    0,    0,   78,   79,
    0,   62,    0,    0,    0,   29,    0,
};
#define YYTABLESIZE 273
const short cue_yytable[] = {                                      80,
   72,   46,   28,   34,    1,   13,    7,   29,   38,   39,
   40,   41,   42,   30,    4,   31,   36,    5,    6,    7,
   84,   47,   48,   32,   37,   44,   45,   49,   50,   51,
    8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
   18,   19,   20,    8,    9,   10,   11,   12,   13,   14,
   15,   16,   17,   18,   19,   20,   57,   58,   59,   60,
   61,   62,   63,   64,   56,   66,   67,   69,   71,   74,
   75,   82,   83,   85,   86,   87,   88,   89,   59,   19,
   24,   25,   73,   33,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,   76,   77,   78,
   79,   19,   13,
};
const short cue_yycheck[] = {                                      10,
   51,  256,   10,  267,    0,    0,  261,  258,  262,  263,
  264,  265,  266,  258,  256,  258,   10,  259,  260,  261,
   71,  276,  277,  258,   10,   10,  257,  282,  283,  284,
  285,  286,  287,  288,  289,  290,  291,  292,  293,  294,
  295,  296,  297,  285,  286,  287,  288,  289,  290,  291,
  292,  293,  294,  295,  296,  297,  268,  269,  270,  271,
  272,  273,  274,  275,   10,   10,  258,  257,  257,   10,
   10,   58,   10,   10,  257,   10,   58,  257,   10,  267,
    3,    3,   54,   22,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  278,  279,  280,
  281,  267,  267,
};
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 297
#if YYDEBUG
const char * const cue_yyname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"NUMBER","STRING",
"CATALOG","CDTEXTFILE","FFILE","BINARY","MOTOROLA","AIFF","WAVE","MP3","TRACK",
"AUDIO","MODE1_2048","MODE1_2352","MODE2_2336","MODE2_2048","MODE2_2342",
"MODE2_2332","MODE2_2352","TRACK_ISRC","FLAGS","PRE","DCP","FOUR_CH","SCMS",
"PREGAP","INDEX","POSTGAP","TITLE","PERFORMER","SONGWRITER","COMPOSER",
"ARRANGER","MESSAGE","DISC_ID","GENRE","TOC_INFO1","TOC_INFO2","UPC_EAN","ISRC",
"SIZE_INFO",
};
const char * const cue_yyrule[] = {
"$accept : cuefile",
"cuefile : new_cd global_statements track_list",
"new_cd :",
"global_statements :",
"global_statements : global_statements global_statement",
"global_statement : CATALOG STRING '\\n'",
"global_statement : CDTEXTFILE STRING '\\n'",
"global_statement : cdtext",
"global_statement : track_data",
"global_statement : error '\\n'",
"track_data : FFILE STRING file_format '\\n'",
"track_list : track",
"track_list : track_list track",
"track : new_track track_def track_statements",
"file_format : BINARY",
"file_format : MOTOROLA",
"file_format : AIFF",
"file_format : WAVE",
"file_format : MP3",
"new_track :",
"track_def : TRACK NUMBER track_mode '\\n'",
"track_mode : AUDIO",
"track_mode : MODE1_2048",
"track_mode : MODE1_2352",
"track_mode : MODE2_2336",
"track_mode : MODE2_2048",
"track_mode : MODE2_2342",
"track_mode : MODE2_2332",
"track_mode : MODE2_2352",
"track_statements : track_statement",
"track_statements : track_statements track_statement",
"track_statement : cdtext",
"track_statement : FLAGS track_flags '\\n'",
"track_statement : TRACK_ISRC STRING '\\n'",
"track_statement : PREGAP time '\\n'",
"track_statement : INDEX NUMBER time '\\n'",
"track_statement : POSTGAP time '\\n'",
"track_statement : track_data",
"track_statement : error '\\n'",
"track_flags :",
"track_flags : track_flags track_flag",
"track_flag : PRE",
"track_flag : DCP",
"track_flag : FOUR_CH",
"track_flag : SCMS",
"cdtext : cdtext_item STRING '\\n'",
"cdtext_item : TITLE",
"cdtext_item : PERFORMER",
"cdtext_item : SONGWRITER",
"cdtext_item : COMPOSER",
"cdtext_item : ARRANGER",
"cdtext_item : MESSAGE",
"cdtext_item : DISC_ID",
"cdtext_item : GENRE",
"cdtext_item : TOC_INFO1",
"cdtext_item : TOC_INFO2",
"cdtext_item : UPC_EAN",
"cdtext_item : ISRC",
"cdtext_item : SIZE_INFO",
"time : NUMBER",
"time : NUMBER ':' NUMBER ':' NUMBER",
};
#endif
#if YYDEBUG
#include <stdio.h>
#endif
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 10000
#define YYMAXDEPTH 10000
#endif
#endif
#define YYINITSTACKSIZE 200
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
short *yyss;
short *yysslim;
YYSTYPE *yyvs;
int yystacksize;
#line 259 "cue_parse.y"

/* lexer interface */
extern int cue_lineno;
extern int cue_yydebug;
extern FILE *cue_yyin;

void yyerror (char *s)
{
	fprintf(stderr, "%d: %s\n", cue_lineno, s);
}

Cd *cue_parse (FILE *fp)
{
	cue_yyin = fp;
	cue_yydebug = 0;

	if (0 == cue_yyparse())
		return cd;

	return NULL;
}
#line 376 "cue_parse.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack()
{
    int newsize, i;
    short *newss;
    YYSTYPE *newvs;

    if ((newsize = yystacksize) == 0)
        newsize = YYINITSTACKSIZE;
    else if (newsize >= YYMAXDEPTH)
        return -1;
    else if ((newsize *= 2) > YYMAXDEPTH)
        newsize = YYMAXDEPTH;
    i = yyssp - yyss;
    newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
      (short *)malloc(newsize * sizeof *newss);
    if (newss == NULL)
        return -1;
    yyss = newss;
    yyssp = newss + i;
    newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
      (YYSTYPE *)malloc(newsize * sizeof *newvs);
    if (newvs == NULL)
        return -1;
    yyvs = newvs;
    yyvsp = newvs + i;
    yystacksize = newsize;
    yysslim = yyss + newsize - 1;
    return 0;
}

#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab

#ifndef YYPARSE_PARAM
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG void
#define YYPARSE_PARAM_DECL
#else	/* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif	/* ANSI-C/C++ */
#else	/* YYPARSE_PARAM */
#ifndef YYPARSE_PARAM_TYPE
#define YYPARSE_PARAM_TYPE void *
#endif
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else	/* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
#endif	/* ANSI-C/C++ */
#endif	/* ! YYPARSE_PARAM */

int
yyparse (YYPARSE_PARAM_ARG)
    YYPARSE_PARAM_DECL
{
    int yym, yyn, yystate;
#if YYDEBUG
    const char *yys;

    if ((yys = getenv("YYDEBUG")))
    {
        yyn = *yys;
        if (yyn >= '0' && yyn <= '9')
            yydebug = yyn - '0';
    }
#endif

    yynerrs = 0;
    yyerrflag = 0;
    yychar = (-1);

    if (yyss == NULL && yygrowstack()) goto yyoverflow;
    yyssp = yyss;
    yyvsp = yyvs;
    *yyssp = yystate = 0;

yyloop:
    if ((yyn = yydefred[yystate])) goto yyreduce;
    if (yychar < 0)
    {
        if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
        if (yydebug)
        {
            yys = 0;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (!yys) yys = "illegal-symbol";
            printf("%sdebug: state %d, reading %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
    }
    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: state %d, shifting to state %d\n",
                    YYPREFIX, yystate, yytable[yyn]);
#endif
        if (yyssp >= yysslim && yygrowstack())
        {
            goto yyoverflow;
        }
        *++yyssp = yystate = yytable[yyn];
        *++yyvsp = yylval;
        yychar = (-1);
        if (yyerrflag > 0)  --yyerrflag;
        goto yyloop;
    }
    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
        yyn = yytable[yyn];
        goto yyreduce;
    }
    if (yyerrflag) goto yyinrecovery;
#if defined(lint) || defined(__GNUC__)
    goto yynewerror;
#endif
yynewerror:
    yyerror("syntax error");
#if defined(lint) || defined(__GNUC__)
    goto yyerrlab;
#endif
yyerrlab:
    ++yynerrs;
yyinrecovery:
    if (yyerrflag < 3)
    {
        yyerrflag = 3;
        for (;;)
        {
            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: state %d, error recovery shifting\
 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
                if (yyssp >= yysslim && yygrowstack())
                {
                    goto yyoverflow;
                }
                *++yyssp = yystate = yytable[yyn];
                *++yyvsp = yylval;
                goto yyloop;
            }
            else
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: error recovery discarding state %d\n",
                            YYPREFIX, *yyssp);
#endif
                if (yyssp <= yyss) goto yyabort;
                --yyssp;
                --yyvsp;
            }
        }
    }
    else
    {
        if (yychar == 0) goto yyabort;
#if YYDEBUG
        if (yydebug)
        {
            yys = 0;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (!yys) yys = "illegal-symbol";
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
        yychar = (-1);
        goto yyloop;
    }
yyreduce:
#if YYDEBUG
    if (yydebug)
        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
                YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
    yym = yylen[yyn];
    yyval = yyvsp[1-yym];
    switch (yyn)
    {
case 2:
#line 102 "cue_parse.y"
{
		cd = cd_init();
		cdtext = cd_get_cdtext(cd);
	}
break;
case 5:
#line 114 "cue_parse.y"
{ cd_set_catalog(cd, yyvsp[-1].sval); }
break;
case 6:
#line 115 "cue_parse.y"
{ /* ignored */ }
break;
case 10:
#line 122 "cue_parse.y"
{
		if (NULL != new_filename) {
			yyerror("too many files specified\n");
			free(new_filename);
		}
		new_filename = strdup(yyvsp[-2].sval);
	}
break;
case 19:
#line 149 "cue_parse.y"
{
		/* save previous track, to later set length */
		prev_track = track;

		track = cd_add_track(cd);
		cdtext = track_get_cdtext(track);

		cur_filename = new_filename;
		if (NULL != cur_filename)
			prev_filename = cur_filename;

		if (NULL == prev_filename)
			yyerror("no file specified for track");
		else
			track_set_filename(track, prev_filename);

		new_filename = NULL;
	}
break;
case 20:
#line 170 "cue_parse.y"
{
		track_set_mode(track, yyvsp[-1].ival);
	}
break;
case 33:
#line 194 "cue_parse.y"
{ track_set_isrc(track, yyvsp[-1].sval); }
break;
case 34:
#line 195 "cue_parse.y"
{ track_set_zero_pre(track, yyvsp[-1].ival); }
break;
case 35:
#line 196 "cue_parse.y"
{
		int i = track_get_nindex(track);
		long prev_length;

		if (0 == i) {
			/* first index */
			track_set_start(track, yyvsp[-1].ival);

			if (NULL != prev_track && NULL == cur_filename) {
				/* track shares file with previous track */
				prev_length = yyvsp[-1].ival - track_get_start(prev_track);
				track_set_length(prev_track, prev_length);
			}
		}

		for (; i <= yyvsp[-2].ival; i++)
			track_add_index(track, \
			track_get_zero_pre(track) + yyvsp[-1].ival \
			- track_get_start(track));
	}
break;
case 36:
#line 216 "cue_parse.y"
{ track_set_zero_post(track, yyvsp[-1].ival); }
break;
case 40:
#line 223 "cue_parse.y"
{ track_set_flag(track, yyvsp[0].ival); }
break;
case 45:
#line 234 "cue_parse.y"
{ cdtext_set (yyvsp[-2].ival, yyvsp[-1].sval, cdtext); }
break;
case 60:
#line 255 "cue_parse.y"
{ yyval.ival = time_msf_to_frame(yyvsp[-4].ival, yyvsp[-2].ival, yyvsp[0].ival); }
break;
#line 670 "cue_parse.c"
    }
    yyssp -= yym;
    yystate = *yyssp;
    yyvsp -= yym;
    yym = yylhs[yyn];
    if (yystate == 0 && yym == 0)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: after reduction, shifting from state 0 to\
 state %d\n", YYPREFIX, YYFINAL);
#endif
        yystate = YYFINAL;
        *++yyssp = YYFINAL;
        *++yyvsp = yyval;
        if (yychar < 0)
        {
            if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
            if (yydebug)
            {
                yys = 0;
                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                if (!yys) yys = "illegal-symbol";
                printf("%sdebug: state %d, reading %d (%s)\n",
                        YYPREFIX, YYFINAL, yychar, yys);
            }
#endif
        }
        if (yychar == 0) goto yyaccept;
        goto yyloop;
    }
    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
        yystate = yytable[yyn];
    else
        yystate = yydgoto[yym];
#if YYDEBUG
    if (yydebug)
        printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
    if (yyssp >= yysslim && yygrowstack())
    {
        goto yyoverflow;
    }
    *++yyssp = yystate;
    *++yyvsp = yyval;
    goto yyloop;
yyoverflow:
    yyerror("yacc stack overflow");
yyabort:
    return (1);
yyaccept:
    return (0);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].