From 16411d76697ae9153c45d72e7faa61098ba401d1 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 4 Jul 2020 13:47:51 +1000 Subject: [PATCH] dep/libcue: Prefix functions to avoid name clash with glslang --- dep/libcue/src/cue_parser.c | 233 +++++++------- dep/libcue/src/cue_parser.h | 51 ++-- dep/libcue/src/cue_parser.y | 59 ++-- dep/libcue/src/cue_scanner.c | 485 +++++++++++++++++++++++------- dep/libcue/src/cue_scanner.l | 87 +++--- dep/libcue/src/generate_parser.sh | 5 + 6 files changed, 606 insertions(+), 314 deletions(-) create mode 100644 dep/libcue/src/generate_parser.sh diff --git a/dep/libcue/src/cue_parser.c b/dep/libcue/src/cue_parser.c index 2f93d46a4..2614d7678 100644 --- a/dep/libcue/src/cue_parser.c +++ b/dep/libcue/src/cue_parser.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.3.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.3.2" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -62,11 +62,20 @@ /* Pull parsers. */ #define YYPULL 1 +/* Substitute the type names. */ +#define YYSTYPE CUEPARSERSTYPE +/* Substitute the variable and function names. */ +#define yyparse cueparserparse +#define yylex cueparserlex +#define yyerror cueparsererror +#define yydebug cueparserdebug +#define yynerrs cueparsernerrs - +#define yylval cueparserlval +#define yychar cueparserchar /* First part of user prologue. */ -#line 1 "cue_parser.y" /* yacc.c:337 */ +#line 1 "cue_parser.y" /* * Copyright (c) 2004, 2005, 2006, 2007, Svend Sorensen @@ -81,20 +90,20 @@ #include "cd.h" #include "time.h" -#ifdef YY_BUF_SIZE -#undef YY_BUF_SIZE +#ifdef CUEPARSER_BUF_SIZE +#undef CUEPARSER_BUF_SIZE #endif -#define YY_BUF_SIZE 16384 +#define CUEPARSER_BUF_SIZE 16384 -#define YYDEBUG 1 +#define CUEPARSERDEBUG 1 char fnamebuf[PARSER_BUFFER]; /* debugging */ -//int yydebug = 1; +//int cueparserdebug = 1; -extern int yylineno; -extern FILE* yyin; +extern int cueparserlineno; +extern FILE* cueparserin; static Cd *cd = NULL; static Track *track = NULL; @@ -106,21 +115,22 @@ static char *cur_filename = NULL; /* last file in the last track */ static char *new_filename = NULL; /* last file in this track */ /* lexer interface */ -typedef struct yy_buffer_state* YY_BUFFER_STATE; +typedef struct cueparser_buffer_state* CUEPARSER_BUFFER_STATE; -int yylex(void); -void yyerror(const char*); -YY_BUFFER_STATE yy_scan_string(const char*); -YY_BUFFER_STATE yy_create_buffer(FILE*, int); -void yy_switch_to_buffer(YY_BUFFER_STATE); -void yy_delete_buffer(YY_BUFFER_STATE); +int cueparserlex(void); +void cueparsererror(const char*); +CUEPARSER_BUFFER_STATE cueparser_scan_string(const char*); +CUEPARSER_BUFFER_STATE cueparser_create_buffer(FILE*, int); +void cueparser_switch_to_buffer(CUEPARSER_BUFFER_STATE); +void cueparser_delete_buffer(CUEPARSER_BUFFER_STATE); /* parser interface */ -int yyparse(void); +int cueparserparse(void); Cd *cue_parse_file(FILE *fp); Cd *cue_parse_string(const char*); -#line 124 "cue_parser.c" /* yacc.c:337 */ +#line 133 "cue_parser.c" + # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus @@ -141,22 +151,30 @@ Cd *cue_parse_string(const char*); # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "cue_parser.h". */ -#ifndef YY_YY_CUE_PARSER_H_INCLUDED -# define YY_YY_CUE_PARSER_H_INCLUDED +/* Use api.header.include to #include this header + instead of duplicating it here. */ +#ifndef YY_CUEPARSER_CUE_PARSER_H_INCLUDED +# define YY_CUEPARSER_CUE_PARSER_H_INCLUDED /* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +#ifndef CUEPARSERDEBUG +# if defined YYDEBUG #if YYDEBUG -extern int yydebug; +# define CUEPARSERDEBUG 1 +# else +# define CUEPARSERDEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define CUEPARSERDEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined CUEPARSERDEBUG */ +#if CUEPARSERDEBUG +extern int cueparserdebug; #endif /* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype +#ifndef CUEPARSERTOKENTYPE +# define CUEPARSERTOKENTYPE + enum cueparsertokentype { NUMBER = 258, STRING = 259, @@ -210,29 +228,28 @@ extern int yydebug; #endif /* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +#if ! defined CUEPARSERSTYPE && ! defined CUEPARSERSTYPE_IS_DECLARED +union CUEPARSERSTYPE { -#line 57 "cue_parser.y" /* yacc.c:352 */ +#line 58 "cue_parser.y" long ival; char *sval; -#line 223 "cue_parser.c" /* yacc.c:352 */ -}; +#line 240 "cue_parser.c" -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 +}; +typedef union CUEPARSERSTYPE CUEPARSERSTYPE; +# define CUEPARSERSTYPE_IS_TRIVIAL 1 +# define CUEPARSERSTYPE_IS_DECLARED 1 #endif -extern YYSTYPE yylval; +extern CUEPARSERSTYPE cueparserlval; -int yyparse (void); +int cueparserparse (void); -#endif /* !YY_YY_CUE_PARSER_H_INCLUDED */ +#endif /* !YY_CUEPARSER_CUE_PARSER_H_INCLUDED */ @@ -336,6 +353,8 @@ typedef short yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -406,7 +425,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined CUEPARSERSTYPE_IS_TRIVIAL && CUEPARSERSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -523,22 +542,22 @@ static const yytype_uint8 yytranslate[] = 45, 46, 47, 48, 49, 50 }; -#if YYDEBUG +#if CUEPARSERDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 133, 133, 137, 144, 146, 150, 151, 152, 153, - 154, 155, 159, 173, 174, 178, 182, 183, 184, 185, - 186, 187, 191, 213, 219, 220, 221, 222, 223, 224, - 225, 226, 230, 231, 235, 236, 237, 238, 239, 240, - 263, 264, 265, 268, 270, 274, 275, 276, 277, 281, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 301, 302, 306, 307, 311, 312, 313, - 314, 315 + 0, 134, 134, 138, 146, 147, 151, 152, 153, 154, + 155, 156, 160, 174, 175, 179, 183, 184, 185, 186, + 187, 188, 192, 214, 220, 221, 222, 223, 224, 225, + 226, 227, 231, 232, 236, 237, 238, 239, 240, 241, + 264, 265, 266, 270, 271, 275, 276, 277, 278, 282, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 302, 303, 307, 308, 312, 313, 314, + 315, 316 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +#if CUEPARSERDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -758,7 +777,7 @@ static const yytype_uint8 yyr2[] = /* Enable debugging if requested. */ -#if YYDEBUG +#if CUEPARSERDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ @@ -879,12 +898,12 @@ do { \ /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; -#else /* !YYDEBUG */ +#else /* !CUEPARSERDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ +#endif /* !CUEPARSERDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ @@ -1237,6 +1256,8 @@ yynewstate: | yynewstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) @@ -1299,8 +1320,6 @@ yysetstate: } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) YYACCEPT; @@ -1368,7 +1387,6 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; @@ -1403,33 +1421,33 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 3: -#line 137 "cue_parser.y" /* yacc.c:1652 */ + case 3: +#line 138 "cue_parser.y" { cd = cd_init(); cdtext = cd_get_cdtext(cd); rem = cd_get_rem(cd); } -#line 1414 "cue_parser.c" /* yacc.c:1652 */ +#line 1432 "cue_parser.c" break; case 6: -#line 150 "cue_parser.y" /* yacc.c:1652 */ +#line 151 "cue_parser.y" { cd_set_catalog(cd, (yyvsp[-1].sval)); } -#line 1420 "cue_parser.c" /* yacc.c:1652 */ +#line 1438 "cue_parser.c" break; case 7: -#line 151 "cue_parser.y" /* yacc.c:1652 */ +#line 152 "cue_parser.y" { cd_set_cdtextfile(cd, (yyvsp[-1].sval)); } -#line 1426 "cue_parser.c" /* yacc.c:1652 */ +#line 1444 "cue_parser.c" break; case 12: -#line 159 "cue_parser.y" /* yacc.c:1652 */ +#line 160 "cue_parser.y" { if (NULL != new_filename) { - yyerror("too many files specified\n"); + cueparsererror("too many files specified\n"); } if (track && track_get_index(track, 1) == -1) { track_set_filename (track, (yyvsp[-2].sval)); @@ -1438,11 +1456,11 @@ yyreduce: new_filename[sizeof(fnamebuf) - 1] = '\0'; } } -#line 1442 "cue_parser.c" /* yacc.c:1652 */ +#line 1460 "cue_parser.c" break; case 22: -#line 191 "cue_parser.y" /* yacc.c:1652 */ +#line 192 "cue_parser.y" { /* save previous track, to later set length */ prev_track = track; @@ -1456,37 +1474,37 @@ yyreduce: prev_filename = cur_filename; if (NULL == prev_filename) - yyerror("no file specified for track"); + cueparsererror("no file specified for track"); else track_set_filename(track, prev_filename); new_filename = NULL; } -#line 1466 "cue_parser.c" /* yacc.c:1652 */ +#line 1484 "cue_parser.c" break; case 23: -#line 213 "cue_parser.y" /* yacc.c:1652 */ +#line 214 "cue_parser.y" { track_set_mode(track, (yyvsp[-1].ival)); } -#line 1474 "cue_parser.c" /* yacc.c:1652 */ +#line 1492 "cue_parser.c" break; case 37: -#line 238 "cue_parser.y" /* yacc.c:1652 */ +#line 239 "cue_parser.y" { track_set_isrc(track, (yyvsp[-1].sval)); } -#line 1480 "cue_parser.c" /* yacc.c:1652 */ +#line 1498 "cue_parser.c" break; case 38: -#line 239 "cue_parser.y" /* yacc.c:1652 */ +#line 240 "cue_parser.y" { track_set_zero_pre(track, (yyvsp[-1].ival)); } -#line 1486 "cue_parser.c" /* yacc.c:1652 */ +#line 1504 "cue_parser.c" break; case 39: -#line 240 "cue_parser.y" /* yacc.c:1652 */ +#line 241 "cue_parser.y" { long prev_length; @@ -1510,47 +1528,48 @@ yyreduce: track_set_index (track, (yyvsp[-2].ival), (yyvsp[-1].ival)); } -#line 1514 "cue_parser.c" /* yacc.c:1652 */ +#line 1532 "cue_parser.c" break; case 40: -#line 263 "cue_parser.y" /* yacc.c:1652 */ +#line 264 "cue_parser.y" { track_set_zero_post(track, (yyvsp[-1].ival)); } -#line 1520 "cue_parser.c" /* yacc.c:1652 */ +#line 1538 "cue_parser.c" break; case 44: -#line 270 "cue_parser.y" /* yacc.c:1652 */ +#line 271 "cue_parser.y" { track_set_flag(track, (yyvsp[0].ival)); } -#line 1526 "cue_parser.c" /* yacc.c:1652 */ +#line 1544 "cue_parser.c" break; case 49: -#line 281 "cue_parser.y" /* yacc.c:1652 */ +#line 282 "cue_parser.y" { cdtext_set ((yyvsp[-2].ival), (yyvsp[-1].sval), cdtext); } -#line 1532 "cue_parser.c" /* yacc.c:1652 */ +#line 1550 "cue_parser.c" break; case 64: -#line 302 "cue_parser.y" /* yacc.c:1652 */ +#line 303 "cue_parser.y" { (yyval.ival) = time_msf_to_frame((yyvsp[-4].ival), (yyvsp[-2].ival), (yyvsp[0].ival)); } -#line 1538 "cue_parser.c" /* yacc.c:1652 */ +#line 1556 "cue_parser.c" break; case 65: -#line 306 "cue_parser.y" /* yacc.c:1652 */ +#line 307 "cue_parser.y" { rem_set((yyvsp[-2].ival), (yyvsp[-1].sval), rem); } -#line 1544 "cue_parser.c" /* yacc.c:1652 */ +#line 1562 "cue_parser.c" break; case 66: -#line 307 "cue_parser.y" /* yacc.c:1652 */ +#line 308 "cue_parser.y" { cdtext_set((yyvsp[-2].ival), (yyvsp[-1].sval), cdtext); } -#line 1550 "cue_parser.c" /* yacc.c:1652 */ +#line 1568 "cue_parser.c" break; -#line 1554 "cue_parser.c" /* yacc.c:1652 */ +#line 1572 "cue_parser.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1781,14 +1800,14 @@ yyreturn: #endif return yyresult; } -#line 317 "cue_parser.y" /* yacc.c:1918 */ +#line 318 "cue_parser.y" /* lexer interface */ -void yyerror (const char *s) +void cueparsererror (const char *s) { - fprintf(stderr, "%d: %s\n", yylineno, s); + fprintf(stderr, "%d: %s\n", cueparserlineno, s); } static void reset_static_vars() @@ -1805,20 +1824,20 @@ static void reset_static_vars() Cd *cue_parse_file(FILE *fp) { - YY_BUFFER_STATE buffer = NULL; + CUEPARSER_BUFFER_STATE buffer = NULL; - yyin = fp; + cueparserin = fp; - buffer = yy_create_buffer(yyin, YY_BUF_SIZE); + buffer = cueparser_create_buffer(cueparserin, CUEPARSER_BUF_SIZE); - yy_switch_to_buffer(buffer); + cueparser_switch_to_buffer(buffer); Cd *ret_cd = NULL; - if (0 == yyparse()) ret_cd = cd; + if (0 == cueparserparse()) ret_cd = cd; else ret_cd = NULL; - yy_delete_buffer(buffer); + cueparser_delete_buffer(buffer); reset_static_vars(); return ret_cd; @@ -1826,16 +1845,16 @@ Cd *cue_parse_file(FILE *fp) Cd *cue_parse_string(const char* string) { - YY_BUFFER_STATE buffer = NULL; + CUEPARSER_BUFFER_STATE buffer = NULL; - buffer = yy_scan_string(string); + buffer = cueparser_scan_string(string); Cd *ret_cd = NULL; - if (0 == yyparse()) ret_cd = cd; + if (0 == cueparserparse()) ret_cd = cd; else ret_cd = NULL; - yy_delete_buffer(buffer); + cueparser_delete_buffer(buffer); reset_static_vars(); return ret_cd; diff --git a/dep/libcue/src/cue_parser.h b/dep/libcue/src/cue_parser.h index 19c61d022..7dacd1f88 100644 --- a/dep/libcue/src/cue_parser.h +++ b/dep/libcue/src/cue_parser.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.3.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison interface for Yacc-like parsers in C @@ -34,20 +34,28 @@ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ -#ifndef YY_YY_CUE_PARSER_H_INCLUDED -# define YY_YY_CUE_PARSER_H_INCLUDED +#ifndef YY_CUEPARSER_CUE_PARSER_H_INCLUDED +# define YY_CUEPARSER_CUE_PARSER_H_INCLUDED /* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +#ifndef CUEPARSERDEBUG +# if defined YYDEBUG #if YYDEBUG -extern int yydebug; +# define CUEPARSERDEBUG 1 +# else +# define CUEPARSERDEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define CUEPARSERDEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined CUEPARSERDEBUG */ +#if CUEPARSERDEBUG +extern int cueparserdebug; #endif /* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype +#ifndef CUEPARSERTOKENTYPE +# define CUEPARSERTOKENTYPE + enum cueparsertokentype { NUMBER = 258, STRING = 259, @@ -101,26 +109,25 @@ extern int yydebug; #endif /* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +#if ! defined CUEPARSERSTYPE && ! defined CUEPARSERSTYPE_IS_DECLARED +union CUEPARSERSTYPE { -#line 57 "cue_parser.y" /* yacc.c:1921 */ +#line 58 "cue_parser.y" long ival; char *sval; -#line 114 "cue_parser.h" /* yacc.c:1921 */ -}; +#line 121 "cue_parser.h" -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 +}; +typedef union CUEPARSERSTYPE CUEPARSERSTYPE; +# define CUEPARSERSTYPE_IS_TRIVIAL 1 +# define CUEPARSERSTYPE_IS_DECLARED 1 #endif -extern YYSTYPE yylval; +extern CUEPARSERSTYPE cueparserlval; -int yyparse (void); +int cueparserparse (void); -#endif /* !YY_YY_CUE_PARSER_H_INCLUDED */ +#endif /* !YY_CUEPARSER_CUE_PARSER_H_INCLUDED */ diff --git a/dep/libcue/src/cue_parser.y b/dep/libcue/src/cue_parser.y index 5b5b5bd6e..c25fbe3c4 100644 --- a/dep/libcue/src/cue_parser.y +++ b/dep/libcue/src/cue_parser.y @@ -12,20 +12,20 @@ #include "cd.h" #include "time.h" -#ifdef YY_BUF_SIZE -#undef YY_BUF_SIZE +#ifdef CUEPARSER_BUF_SIZE +#undef CUEPARSER_BUF_SIZE #endif -#define YY_BUF_SIZE 16384 +#define CUEPARSER_BUF_SIZE 16384 -#define YYDEBUG 1 +#define CUEPARSERDEBUG 1 char fnamebuf[PARSER_BUFFER]; /* debugging */ -//int yydebug = 1; +//int cueparserdebug = 1; -extern int yylineno; -extern FILE* yyin; +extern int cueparserlineno; +extern FILE* cueparserin; static Cd *cd = NULL; static Track *track = NULL; @@ -37,22 +37,23 @@ static char *cur_filename = NULL; /* last file in the last track */ static char *new_filename = NULL; /* last file in this track */ /* lexer interface */ -typedef struct yy_buffer_state* YY_BUFFER_STATE; +typedef struct cueparser_buffer_state* CUEPARSER_BUFFER_STATE; -int yylex(void); -void yyerror(const char*); -YY_BUFFER_STATE yy_scan_string(const char*); -YY_BUFFER_STATE yy_create_buffer(FILE*, int); -void yy_switch_to_buffer(YY_BUFFER_STATE); -void yy_delete_buffer(YY_BUFFER_STATE); +int cueparserlex(void); +void cueparsererror(const char*); +CUEPARSER_BUFFER_STATE cueparser_scan_string(const char*); +CUEPARSER_BUFFER_STATE cueparser_create_buffer(FILE*, int); +void cueparser_switch_to_buffer(CUEPARSER_BUFFER_STATE); +void cueparser_delete_buffer(CUEPARSER_BUFFER_STATE); /* parser interface */ -int yyparse(void); +int cueparserparse(void); Cd *cue_parse_file(FILE *fp); Cd *cue_parse_string(const char*); %} %start cuefile +%define api.prefix {cueparser} %union { long ival; @@ -158,7 +159,7 @@ global_statement track_data : FFILE STRING file_format '\n' { if (NULL != new_filename) { - yyerror("too many files specified\n"); + cueparsererror("too many files specified\n"); } if (track && track_get_index(track, 1) == -1) { track_set_filename (track, $2); @@ -201,7 +202,7 @@ new_track prev_filename = cur_filename; if (NULL == prev_filename) - yyerror("no file specified for track"); + cueparsererror("no file specified for track"); else track_set_filename(track, prev_filename); @@ -318,9 +319,9 @@ rem_item /* lexer interface */ -void yyerror (const char *s) +void cueparsererror (const char *s) { - fprintf(stderr, "%d: %s\n", yylineno, s); + fprintf(stderr, "%d: %s\n", cueparserlineno, s); } static void reset_static_vars() @@ -337,20 +338,20 @@ static void reset_static_vars() Cd *cue_parse_file(FILE *fp) { - YY_BUFFER_STATE buffer = NULL; + CUEPARSER_BUFFER_STATE buffer = NULL; - yyin = fp; + cueparserin = fp; - buffer = yy_create_buffer(yyin, YY_BUF_SIZE); + buffer = cueparser_create_buffer(cueparserin, CUEPARSER_BUF_SIZE); - yy_switch_to_buffer(buffer); + cueparser_switch_to_buffer(buffer); Cd *ret_cd = NULL; - if (0 == yyparse()) ret_cd = cd; + if (0 == cueparserparse()) ret_cd = cd; else ret_cd = NULL; - yy_delete_buffer(buffer); + cueparser_delete_buffer(buffer); reset_static_vars(); return ret_cd; @@ -358,16 +359,16 @@ Cd *cue_parse_file(FILE *fp) Cd *cue_parse_string(const char* string) { - YY_BUFFER_STATE buffer = NULL; + CUEPARSER_BUFFER_STATE buffer = NULL; - buffer = yy_scan_string(string); + buffer = cueparser_scan_string(string); Cd *ret_cd = NULL; - if (0 == yyparse()) ret_cd = cd; + if (0 == cueparserparse()) ret_cd = cd; else ret_cd = NULL; - yy_delete_buffer(buffer); + cueparser_delete_buffer(buffer); reset_static_vars(); return ret_cd; diff --git a/dep/libcue/src/cue_scanner.c b/dep/libcue/src/cue_scanner.c index 6569a2b95..e9cb749b0 100644 --- a/dep/libcue/src/cue_scanner.c +++ b/dep/libcue/src/cue_scanner.c @@ -6,6 +6,31 @@ /* A lexical scanner generated by flex */ +#define yy_create_buffer cueparser_create_buffer +#define yy_delete_buffer cueparser_delete_buffer +#define yy_scan_buffer cueparser_scan_buffer +#define yy_scan_string cueparser_scan_string +#define yy_scan_bytes cueparser_scan_bytes +#define yy_init_buffer cueparser_init_buffer +#define yy_flush_buffer cueparser_flush_buffer +#define yy_load_buffer_state cueparser_load_buffer_state +#define yy_switch_to_buffer cueparser_switch_to_buffer +#define yypush_buffer_state cueparserpush_buffer_state +#define yypop_buffer_state cueparserpop_buffer_state +#define yyensure_buffer_stack cueparserensure_buffer_stack +#define yy_flex_debug cueparser_flex_debug +#define yyin cueparserin +#define yyleng cueparserleng +#define yylex cueparserlex +#define yylineno cueparserlineno +#define yyout cueparserout +#define yyrestart cueparserrestart +#define yytext cueparsertext +#define yywrap cueparserwrap +#define yyalloc cueparseralloc +#define yyrealloc cueparserrealloc +#define yyfree cueparserfree + #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 @@ -14,6 +39,240 @@ #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define cueparser_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer cueparser_create_buffer +#endif + +#ifdef yy_delete_buffer +#define cueparser_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer cueparser_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define cueparser_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer cueparser_scan_buffer +#endif + +#ifdef yy_scan_string +#define cueparser_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string cueparser_scan_string +#endif + +#ifdef yy_scan_bytes +#define cueparser_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes cueparser_scan_bytes +#endif + +#ifdef yy_init_buffer +#define cueparser_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer cueparser_init_buffer +#endif + +#ifdef yy_flush_buffer +#define cueparser_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer cueparser_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define cueparser_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state cueparser_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define cueparser_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer cueparser_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define cueparserpush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state cueparserpush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define cueparserpop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state cueparserpop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define cueparserensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack cueparserensure_buffer_stack +#endif + +#ifdef yylex +#define cueparserlex_ALREADY_DEFINED +#else +#define yylex cueparserlex +#endif + +#ifdef yyrestart +#define cueparserrestart_ALREADY_DEFINED +#else +#define yyrestart cueparserrestart +#endif + +#ifdef yylex_init +#define cueparserlex_init_ALREADY_DEFINED +#else +#define yylex_init cueparserlex_init +#endif + +#ifdef yylex_init_extra +#define cueparserlex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra cueparserlex_init_extra +#endif + +#ifdef yylex_destroy +#define cueparserlex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy cueparserlex_destroy +#endif + +#ifdef yyget_debug +#define cueparserget_debug_ALREADY_DEFINED +#else +#define yyget_debug cueparserget_debug +#endif + +#ifdef yyset_debug +#define cueparserset_debug_ALREADY_DEFINED +#else +#define yyset_debug cueparserset_debug +#endif + +#ifdef yyget_extra +#define cueparserget_extra_ALREADY_DEFINED +#else +#define yyget_extra cueparserget_extra +#endif + +#ifdef yyset_extra +#define cueparserset_extra_ALREADY_DEFINED +#else +#define yyset_extra cueparserset_extra +#endif + +#ifdef yyget_in +#define cueparserget_in_ALREADY_DEFINED +#else +#define yyget_in cueparserget_in +#endif + +#ifdef yyset_in +#define cueparserset_in_ALREADY_DEFINED +#else +#define yyset_in cueparserset_in +#endif + +#ifdef yyget_out +#define cueparserget_out_ALREADY_DEFINED +#else +#define yyget_out cueparserget_out +#endif + +#ifdef yyset_out +#define cueparserset_out_ALREADY_DEFINED +#else +#define yyset_out cueparserset_out +#endif + +#ifdef yyget_leng +#define cueparserget_leng_ALREADY_DEFINED +#else +#define yyget_leng cueparserget_leng +#endif + +#ifdef yyget_text +#define cueparserget_text_ALREADY_DEFINED +#else +#define yyget_text cueparserget_text +#endif + +#ifdef yyget_lineno +#define cueparserget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno cueparserget_lineno +#endif + +#ifdef yyset_lineno +#define cueparserset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno cueparserset_lineno +#endif + +#ifdef yywrap +#define cueparserwrap_ALREADY_DEFINED +#else +#define yywrap cueparserwrap +#endif + +#ifdef yyalloc +#define cueparseralloc_ALREADY_DEFINED +#else +#define yyalloc cueparseralloc +#endif + +#ifdef yyrealloc +#define cueparserrealloc_ALREADY_DEFINED +#else +#define yyrealloc cueparserrealloc +#endif + +#ifdef yyfree +#define cueparserfree_ALREADY_DEFINED +#else +#define yyfree cueparserfree +#endif + +#ifdef yytext +#define cueparsertext_ALREADY_DEFINED +#else +#define yytext cueparsertext +#endif + +#ifdef yyleng +#define cueparserleng_ALREADY_DEFINED +#else +#define yyleng cueparserleng +#endif + +#ifdef yyin +#define cueparserin_ALREADY_DEFINED +#else +#define yyin cueparserin +#endif + +#ifdef yyout +#define cueparserout_ALREADY_DEFINED +#else +#define yyout cueparserout +#endif + +#ifdef yy_flex_debug +#define cueparser_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug cueparser_flex_debug +#endif + +#ifdef yylineno +#define cueparserlineno_ALREADY_DEFINED +#else +#define yylineno cueparserlineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -343,7 +602,7 @@ void yyfree ( void * ); /* Begin user sect3 */ -#define yywrap() (/*CONSTCOND*/1) +#define cueparserwrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef flex_uint8_t YY_CHAR; @@ -789,13 +1048,13 @@ char *yytext; #include "cd.h" #include "cue_parser.h" -char yy_buffer[PARSER_BUFFER]; +char cueparser_buffer[PARSER_BUFFER]; -int yylex(void); -#line 796 "cue_scanner.c" +int cueparserlex(void); +#line 1055 "cue_scanner.c" #define YY_NO_INPUT 1 -#line 799 "cue_scanner.c" +#line 1058 "cue_scanner.c" #define INITIAL 0 #define NAME 1 @@ -1009,10 +1268,10 @@ YY_DECL } { -#line 32 "cue_scanner.l" +#line 33 "cue_scanner.l" -#line 1016 "cue_scanner.c" +#line 1275 "cue_scanner.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1082,351 +1341,351 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ -#line 35 "cue_scanner.l" +#line 36 "cue_scanner.l" case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 35 "cue_scanner.l" +#line 36 "cue_scanner.l" { - yylval.sval = strncpy( yy_buffer, + cueparserlval.sval = strncpy( cueparser_buffer, ++yytext, - (yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)); - yylval.sval[(yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng) - 2] = '\0'; + (yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)); + cueparserlval.sval[(yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng) - 2] = '\0'; BEGIN(INITIAL); return STRING; } YY_BREAK case 3: YY_RULE_SETUP -#line 44 "cue_scanner.l" +#line 45 "cue_scanner.l" { - yylval.sval = strncpy( yy_buffer, + cueparserlval.sval = strncpy( cueparser_buffer, yytext, - (yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)); - yylval.sval[(yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)] = '\0'; + (yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)); + cueparserlval.sval[(yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)] = '\0'; BEGIN(INITIAL); return STRING; } YY_BREAK case 4: YY_RULE_SETUP -#line 53 "cue_scanner.l" +#line 54 "cue_scanner.l" { BEGIN(NAME); return CATALOG; } YY_BREAK case 5: YY_RULE_SETUP -#line 54 "cue_scanner.l" +#line 55 "cue_scanner.l" { BEGIN(NAME); return CDTEXTFILE; } YY_BREAK case 6: YY_RULE_SETUP -#line 56 "cue_scanner.l" +#line 57 "cue_scanner.l" { BEGIN(NAME); return FFILE; } YY_BREAK case 7: YY_RULE_SETUP -#line 57 "cue_scanner.l" +#line 58 "cue_scanner.l" { return BINARY; } YY_BREAK case 8: YY_RULE_SETUP -#line 58 "cue_scanner.l" +#line 59 "cue_scanner.l" { return MOTOROLA; } YY_BREAK case 9: YY_RULE_SETUP -#line 59 "cue_scanner.l" +#line 60 "cue_scanner.l" { return AIFF; } YY_BREAK case 10: YY_RULE_SETUP -#line 60 "cue_scanner.l" +#line 61 "cue_scanner.l" { return WAVE; } YY_BREAK case 11: YY_RULE_SETUP -#line 61 "cue_scanner.l" +#line 62 "cue_scanner.l" { return MP3; } YY_BREAK case 12: YY_RULE_SETUP -#line 62 "cue_scanner.l" +#line 63 "cue_scanner.l" { return FLAC; } YY_BREAK case 13: YY_RULE_SETUP -#line 64 "cue_scanner.l" +#line 65 "cue_scanner.l" { return TRACK; } YY_BREAK case 14: YY_RULE_SETUP -#line 65 "cue_scanner.l" -{ yylval.ival = MODE_AUDIO; return AUDIO; } +#line 66 "cue_scanner.l" +{ cueparserlval.ival = MODE_AUDIO; return AUDIO; } YY_BREAK case 15: YY_RULE_SETUP -#line 66 "cue_scanner.l" -{ yylval.ival = MODE_MODE1; return MODE1_2048; } +#line 67 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE1; return MODE1_2048; } YY_BREAK case 16: YY_RULE_SETUP -#line 67 "cue_scanner.l" -{ yylval.ival = MODE_MODE1_RAW; return MODE1_2352; } +#line 68 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE1_RAW; return MODE1_2352; } YY_BREAK case 17: YY_RULE_SETUP -#line 68 "cue_scanner.l" -{ yylval.ival = MODE_MODE2; return MODE2_2336; } +#line 69 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE2; return MODE2_2336; } YY_BREAK case 18: YY_RULE_SETUP -#line 69 "cue_scanner.l" -{ yylval.ival = MODE_MODE2_FORM1; return MODE2_2048; } +#line 70 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE2_FORM1; return MODE2_2048; } YY_BREAK case 19: YY_RULE_SETUP -#line 70 "cue_scanner.l" -{ yylval.ival = MODE_MODE2_FORM2; return MODE2_2342; } +#line 71 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE2_FORM2; return MODE2_2342; } YY_BREAK case 20: YY_RULE_SETUP -#line 71 "cue_scanner.l" -{ yylval.ival = MODE_MODE2_FORM_MIX; return MODE2_2332; } +#line 72 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE2_FORM_MIX; return MODE2_2332; } YY_BREAK case 21: YY_RULE_SETUP -#line 72 "cue_scanner.l" -{ yylval.ival = MODE_MODE2_RAW; return MODE2_2352; } +#line 73 "cue_scanner.l" +{ cueparserlval.ival = MODE_MODE2_RAW; return MODE2_2352; } YY_BREAK case 22: YY_RULE_SETUP -#line 74 "cue_scanner.l" +#line 75 "cue_scanner.l" { return FLAGS; } YY_BREAK case 23: YY_RULE_SETUP -#line 75 "cue_scanner.l" -{ yylval.ival = FLAG_PRE_EMPHASIS; return PRE; } +#line 76 "cue_scanner.l" +{ cueparserlval.ival = FLAG_PRE_EMPHASIS; return PRE; } YY_BREAK case 24: YY_RULE_SETUP -#line 76 "cue_scanner.l" -{ yylval.ival = FLAG_COPY_PERMITTED; return DCP; } +#line 77 "cue_scanner.l" +{ cueparserlval.ival = FLAG_COPY_PERMITTED; return DCP; } YY_BREAK case 25: YY_RULE_SETUP -#line 77 "cue_scanner.l" -{ yylval.ival = FLAG_FOUR_CHANNEL; return FOUR_CH; } +#line 78 "cue_scanner.l" +{ cueparserlval.ival = FLAG_FOUR_CHANNEL; return FOUR_CH; } YY_BREAK case 26: YY_RULE_SETUP -#line 78 "cue_scanner.l" -{ yylval.ival = FLAG_SCMS; return SCMS; } +#line 79 "cue_scanner.l" +{ cueparserlval.ival = FLAG_SCMS; return SCMS; } YY_BREAK case 27: YY_RULE_SETUP -#line 80 "cue_scanner.l" +#line 81 "cue_scanner.l" { return PREGAP; } YY_BREAK case 28: YY_RULE_SETUP -#line 81 "cue_scanner.l" +#line 82 "cue_scanner.l" { return INDEX; } YY_BREAK case 29: YY_RULE_SETUP -#line 82 "cue_scanner.l" +#line 83 "cue_scanner.l" { return POSTGAP; } YY_BREAK case 30: YY_RULE_SETUP -#line 84 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_TITLE; return TITLE; } +#line 85 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_TITLE; return TITLE; } YY_BREAK case 31: YY_RULE_SETUP -#line 85 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_PERFORMER; return PERFORMER; } +#line 86 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_PERFORMER; return PERFORMER; } YY_BREAK case 32: YY_RULE_SETUP -#line 86 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_SONGWRITER; return SONGWRITER; } +#line 87 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_SONGWRITER; return SONGWRITER; } YY_BREAK case 33: YY_RULE_SETUP -#line 87 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_COMPOSER; return COMPOSER; } +#line 88 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_COMPOSER; return COMPOSER; } YY_BREAK case 34: YY_RULE_SETUP -#line 88 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_ARRANGER; return ARRANGER; } +#line 89 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_ARRANGER; return ARRANGER; } YY_BREAK case 35: YY_RULE_SETUP -#line 89 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_MESSAGE; return MESSAGE; } +#line 90 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_MESSAGE; return MESSAGE; } YY_BREAK case 36: YY_RULE_SETUP -#line 90 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_DISC_ID; return DISC_ID; } +#line 91 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_DISC_ID; return DISC_ID; } YY_BREAK case 37: YY_RULE_SETUP -#line 91 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_GENRE; return GENRE; } +#line 92 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_GENRE; return GENRE; } YY_BREAK case 38: YY_RULE_SETUP -#line 92 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_TOC_INFO1; return TOC_INFO1; } +#line 93 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_TOC_INFO1; return TOC_INFO1; } YY_BREAK case 39: YY_RULE_SETUP -#line 93 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_TOC_INFO2; return TOC_INFO2; } +#line 94 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_TOC_INFO2; return TOC_INFO2; } YY_BREAK case 40: YY_RULE_SETUP -#line 94 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_UPC_ISRC; return UPC_EAN; } +#line 95 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_UPC_ISRC; return UPC_EAN; } YY_BREAK case 41: *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ (yy_c_buf_p) = yy_cp = yy_bp + 4; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 95 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_UPC_ISRC; return ISRC; } +#line 96 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_UPC_ISRC; return ISRC; } YY_BREAK case 42: YY_RULE_SETUP -#line 96 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_SIZE_INFO; return SIZE_INFO; } +#line 97 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_SIZE_INFO; return SIZE_INFO; } YY_BREAK case 43: YY_RULE_SETUP -#line 98 "cue_scanner.l" +#line 99 "cue_scanner.l" { BEGIN(NAME); return TRACK_ISRC; } YY_BREAK case 44: YY_RULE_SETUP -#line 100 "cue_scanner.l" +#line 101 "cue_scanner.l" { BEGIN(REM); /* exclusive rules for special exceptions */ } YY_BREAK case 45: YY_RULE_SETUP -#line 102 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = REM_DATE; return DATE; } +#line 103 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = REM_DATE; return DATE; } YY_BREAK case 46: YY_RULE_SETUP -#line 103 "cue_scanner.l" -{ BEGIN(NAME); yylval.ival = PTI_GENRE; return XXX_GENRE; } +#line 104 "cue_scanner.l" +{ BEGIN(NAME); cueparserlval.ival = PTI_GENRE; return XXX_GENRE; } YY_BREAK case 47: YY_RULE_SETUP -#line 104 "cue_scanner.l" -{ BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_ALBUM_GAIN; +#line 105 "cue_scanner.l" +{ BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_ALBUM_GAIN; return REPLAYGAIN_ALBUM_GAIN; } YY_BREAK case 48: YY_RULE_SETUP -#line 106 "cue_scanner.l" -{ BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_ALBUM_PEAK; +#line 107 "cue_scanner.l" +{ BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_ALBUM_PEAK; return REPLAYGAIN_ALBUM_PEAK; } YY_BREAK case 49: YY_RULE_SETUP -#line 108 "cue_scanner.l" -{ BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_TRACK_GAIN; +#line 109 "cue_scanner.l" +{ BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_TRACK_GAIN; return REPLAYGAIN_TRACK_GAIN; } YY_BREAK case 50: YY_RULE_SETUP -#line 110 "cue_scanner.l" -{ BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_TRACK_PEAK; +#line 111 "cue_scanner.l" +{ BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_TRACK_PEAK; return REPLAYGAIN_TRACK_PEAK; } YY_BREAK case 51: YY_RULE_SETUP -#line 113 "cue_scanner.l" +#line 114 "cue_scanner.l" { BEGIN(REM); } YY_BREAK case 52: YY_RULE_SETUP -#line 114 "cue_scanner.l" +#line 115 "cue_scanner.l" { BEGIN(REM); } YY_BREAK case 53: /* rule 53 can match eol */ YY_RULE_SETUP -#line 115 "cue_scanner.l" +#line 116 "cue_scanner.l" { BEGIN(INITIAL); } YY_BREAK case 54: YY_RULE_SETUP -#line 117 "cue_scanner.l" +#line 118 "cue_scanner.l" { - yylval.sval = strncpy( yy_buffer, + cueparserlval.sval = strncpy( cueparser_buffer, yytext, - (yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)); - yylval.sval[(yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)] = '\0'; + (yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)); + cueparserlval.sval[(yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)] = '\0'; BEGIN(SKIP); return STRING; } YY_BREAK case 55: YY_RULE_SETUP -#line 126 "cue_scanner.l" +#line 127 "cue_scanner.l" { BEGIN(RPG); } YY_BREAK case 56: /* rule 56 can match eol */ YY_RULE_SETUP -#line 128 "cue_scanner.l" +#line 129 "cue_scanner.l" { BEGIN(INITIAL); yylineno++; return '\n'; } YY_BREAK case 57: YY_RULE_SETUP -#line 130 "cue_scanner.l" +#line 131 "cue_scanner.l" { /* ignore whitespace */ } YY_BREAK case 58: YY_RULE_SETUP -#line 132 "cue_scanner.l" -{ yylval.ival = atoi(yytext); return NUMBER; } +#line 133 "cue_scanner.l" +{ cueparserlval.ival = atoi(yytext); return NUMBER; } YY_BREAK case 59: YY_RULE_SETUP -#line 133 "cue_scanner.l" +#line 134 "cue_scanner.l" { return yytext[0]; } YY_BREAK case 60: /* rule 60 can match eol */ YY_RULE_SETUP -#line 135 "cue_scanner.l" +#line 136 "cue_scanner.l" { yylineno++; /* blank line */ } YY_BREAK case 61: /* rule 61 can match eol */ YY_RULE_SETUP -#line 136 "cue_scanner.l" +#line 137 "cue_scanner.l" { yylineno++; return '\n'; } YY_BREAK case 62: YY_RULE_SETUP -#line 137 "cue_scanner.l" +#line 138 "cue_scanner.l" { fprintf(stderr, "bad character '%c'\n", yytext[0]); } YY_BREAK case 63: YY_RULE_SETUP -#line 139 "cue_scanner.l" +#line 140 "cue_scanner.l" ECHO; YY_BREAK -#line 1430 "cue_scanner.c" +#line 1689 "cue_scanner.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(NAME): case YY_STATE_EOF(REM): @@ -2408,6 +2667,6 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 139 "cue_scanner.l" +#line 140 "cue_scanner.l" diff --git a/dep/libcue/src/cue_scanner.l b/dep/libcue/src/cue_scanner.l index 9912cbaf9..c052a21f4 100644 --- a/dep/libcue/src/cue_scanner.l +++ b/dep/libcue/src/cue_scanner.l @@ -11,9 +11,9 @@ #include "cd.h" #include "cue_parser.h" -char yy_buffer[PARSER_BUFFER]; +char cueparser_buffer[PARSER_BUFFER]; -int yylex(void); +int cueparserlex(void); %} ws [ \t\r] @@ -23,6 +23,7 @@ nonws [^ \t\r\n] %option noyywrap %option noinput %option nounput +%option prefix="cueparser" %s NAME %x REM @@ -33,19 +34,19 @@ nonws [^ \t\r\n] \'([^\']|\\\')*\' | \"([^\"]|\\\")*\" { - yylval.sval = strncpy( yy_buffer, + cueparserlval.sval = strncpy( cueparser_buffer, ++yytext, - (yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)); - yylval.sval[(yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng) - 2] = '\0'; + (yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)); + cueparserlval.sval[(yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng) - 2] = '\0'; BEGIN(INITIAL); return STRING; } {nonws}+ { - yylval.sval = strncpy( yy_buffer, + cueparserlval.sval = strncpy( cueparser_buffer, yytext, - (yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)); - yylval.sval[(yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)] = '\0'; + (yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)); + cueparserlval.sval[(yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)] = '\0'; BEGIN(INITIAL); return STRING; } @@ -62,52 +63,52 @@ MP3 { return MP3; } FLAC { return FLAC; } TRACK { return TRACK; } -AUDIO { yylval.ival = MODE_AUDIO; return AUDIO; } -MODE1\/2048 { yylval.ival = MODE_MODE1; return MODE1_2048; } -MODE1\/2352 { yylval.ival = MODE_MODE1_RAW; return MODE1_2352; } -MODE2\/2336 { yylval.ival = MODE_MODE2; return MODE2_2336; } -MODE2\/2048 { yylval.ival = MODE_MODE2_FORM1; return MODE2_2048; } -MODE2\/2342 { yylval.ival = MODE_MODE2_FORM2; return MODE2_2342; } -MODE2\/2332 { yylval.ival = MODE_MODE2_FORM_MIX; return MODE2_2332; } -MODE2\/2352 { yylval.ival = MODE_MODE2_RAW; return MODE2_2352; } +AUDIO { cueparserlval.ival = MODE_AUDIO; return AUDIO; } +MODE1\/2048 { cueparserlval.ival = MODE_MODE1; return MODE1_2048; } +MODE1\/2352 { cueparserlval.ival = MODE_MODE1_RAW; return MODE1_2352; } +MODE2\/2336 { cueparserlval.ival = MODE_MODE2; return MODE2_2336; } +MODE2\/2048 { cueparserlval.ival = MODE_MODE2_FORM1; return MODE2_2048; } +MODE2\/2342 { cueparserlval.ival = MODE_MODE2_FORM2; return MODE2_2342; } +MODE2\/2332 { cueparserlval.ival = MODE_MODE2_FORM_MIX; return MODE2_2332; } +MODE2\/2352 { cueparserlval.ival = MODE_MODE2_RAW; return MODE2_2352; } FLAGS { return FLAGS; } -PRE { yylval.ival = FLAG_PRE_EMPHASIS; return PRE; } -DCP { yylval.ival = FLAG_COPY_PERMITTED; return DCP; } -4CH { yylval.ival = FLAG_FOUR_CHANNEL; return FOUR_CH; } -SCMS { yylval.ival = FLAG_SCMS; return SCMS; } +PRE { cueparserlval.ival = FLAG_PRE_EMPHASIS; return PRE; } +DCP { cueparserlval.ival = FLAG_COPY_PERMITTED; return DCP; } +4CH { cueparserlval.ival = FLAG_FOUR_CHANNEL; return FOUR_CH; } +SCMS { cueparserlval.ival = FLAG_SCMS; return SCMS; } PREGAP { return PREGAP; } INDEX { return INDEX; } POSTGAP { return POSTGAP; } -TITLE { BEGIN(NAME); yylval.ival = PTI_TITLE; return TITLE; } -PERFORMER { BEGIN(NAME); yylval.ival = PTI_PERFORMER; return PERFORMER; } -SONGWRITER { BEGIN(NAME); yylval.ival = PTI_SONGWRITER; return SONGWRITER; } -COMPOSER { BEGIN(NAME); yylval.ival = PTI_COMPOSER; return COMPOSER; } -ARRANGER { BEGIN(NAME); yylval.ival = PTI_ARRANGER; return ARRANGER; } -MESSAGE { BEGIN(NAME); yylval.ival = PTI_MESSAGE; return MESSAGE; } -DISC_ID { BEGIN(NAME); yylval.ival = PTI_DISC_ID; return DISC_ID; } -GENRE { BEGIN(NAME); yylval.ival = PTI_GENRE; return GENRE; } -TOC_INFO1 { BEGIN(NAME); yylval.ival = PTI_TOC_INFO1; return TOC_INFO1; } -TOC_INFO2 { BEGIN(NAME); yylval.ival = PTI_TOC_INFO2; return TOC_INFO2; } -UPC_EAN { BEGIN(NAME); yylval.ival = PTI_UPC_ISRC; return UPC_EAN; } -ISRC/{ws}+\" { BEGIN(NAME); yylval.ival = PTI_UPC_ISRC; return ISRC; } -SIZE_INFO { BEGIN(NAME); yylval.ival = PTI_SIZE_INFO; return SIZE_INFO; } +TITLE { BEGIN(NAME); cueparserlval.ival = PTI_TITLE; return TITLE; } +PERFORMER { BEGIN(NAME); cueparserlval.ival = PTI_PERFORMER; return PERFORMER; } +SONGWRITER { BEGIN(NAME); cueparserlval.ival = PTI_SONGWRITER; return SONGWRITER; } +COMPOSER { BEGIN(NAME); cueparserlval.ival = PTI_COMPOSER; return COMPOSER; } +ARRANGER { BEGIN(NAME); cueparserlval.ival = PTI_ARRANGER; return ARRANGER; } +MESSAGE { BEGIN(NAME); cueparserlval.ival = PTI_MESSAGE; return MESSAGE; } +DISC_ID { BEGIN(NAME); cueparserlval.ival = PTI_DISC_ID; return DISC_ID; } +GENRE { BEGIN(NAME); cueparserlval.ival = PTI_GENRE; return GENRE; } +TOC_INFO1 { BEGIN(NAME); cueparserlval.ival = PTI_TOC_INFO1; return TOC_INFO1; } +TOC_INFO2 { BEGIN(NAME); cueparserlval.ival = PTI_TOC_INFO2; return TOC_INFO2; } +UPC_EAN { BEGIN(NAME); cueparserlval.ival = PTI_UPC_ISRC; return UPC_EAN; } +ISRC/{ws}+\" { BEGIN(NAME); cueparserlval.ival = PTI_UPC_ISRC; return ISRC; } +SIZE_INFO { BEGIN(NAME); cueparserlval.ival = PTI_SIZE_INFO; return SIZE_INFO; } ISRC { BEGIN(NAME); return TRACK_ISRC; } REM { BEGIN(REM); /* exclusive rules for special exceptions */ } -DATE { BEGIN(NAME); yylval.ival = REM_DATE; return DATE; } -GENRE { BEGIN(NAME); yylval.ival = PTI_GENRE; return XXX_GENRE; } -REPLAYGAIN_ALBUM_GAIN { BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_ALBUM_GAIN; +DATE { BEGIN(NAME); cueparserlval.ival = REM_DATE; return DATE; } +GENRE { BEGIN(NAME); cueparserlval.ival = PTI_GENRE; return XXX_GENRE; } +REPLAYGAIN_ALBUM_GAIN { BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_ALBUM_GAIN; return REPLAYGAIN_ALBUM_GAIN; } -REPLAYGAIN_ALBUM_PEAK { BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_ALBUM_PEAK; +REPLAYGAIN_ALBUM_PEAK { BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_ALBUM_PEAK; return REPLAYGAIN_ALBUM_PEAK; } -REPLAYGAIN_TRACK_GAIN { BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_TRACK_GAIN; +REPLAYGAIN_TRACK_GAIN { BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_TRACK_GAIN; return REPLAYGAIN_TRACK_GAIN; } -REPLAYGAIN_TRACK_PEAK { BEGIN(RPG); yylval.ival = REM_REPLAYGAIN_TRACK_PEAK; +REPLAYGAIN_TRACK_PEAK { BEGIN(RPG); cueparserlval.ival = REM_REPLAYGAIN_TRACK_PEAK; return REPLAYGAIN_TRACK_PEAK; } {ws}+ { BEGIN(REM); } @@ -115,10 +116,10 @@ REM { BEGIN(REM); /* exclusive rules for special exceptions */ } \n { BEGIN(INITIAL); } {nonws}+ { - yylval.sval = strncpy( yy_buffer, + cueparserlval.sval = strncpy( cueparser_buffer, yytext, - (yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)); - yylval.sval[(yyleng > sizeof(yy_buffer) ? sizeof(yy_buffer) : yyleng)] = '\0'; + (yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)); + cueparserlval.sval[(yyleng > sizeof(cueparser_buffer) ? sizeof(cueparser_buffer) : yyleng)] = '\0'; BEGIN(SKIP); return STRING; } @@ -129,7 +130,7 @@ REM { BEGIN(REM); /* exclusive rules for special exceptions */ } {ws}+ { /* ignore whitespace */ } -[[:digit:]]+ { yylval.ival = atoi(yytext); return NUMBER; } +[[:digit:]]+ { cueparserlval.ival = atoi(yytext); return NUMBER; } : { return yytext[0]; } ^{ws}*\n { yylineno++; /* blank line */ } diff --git a/dep/libcue/src/generate_parser.sh b/dep/libcue/src/generate_parser.sh new file mode 100644 index 000000000..9838bbb71 --- /dev/null +++ b/dep/libcue/src/generate_parser.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +flex --nounistd -o cue_scanner.c cue_scanner.l +bison --defines=cue_parser.h -o cue_parser.c cue_parser.y +