From: Peter Johnson Date: Thu, 27 Dec 2001 03:52:10 +0000 (-0000) Subject: Fix issues with yy->nasm_parser_ renaming. AM_YFLAGS/AM_LFLAGS are not an X-Git-Tag: v0.1.0~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac056aa1fc20de3b72d23f9988e82c3ff8e64e26;p=yasm Fix issues with yy->nasm_parser_ renaming. AM_YFLAGS/AM_LFLAGS are not an option because those are /global/ for the entire project. svn path=/trunk/yasm/; revision=409 --- diff --git a/modules/parsers/nasm/Makefile.inc b/modules/parsers/nasm/Makefile.inc index 9b0e6144..dbe7010d 100644 --- a/modules/parsers/nasm/Makefile.inc +++ b/modules/parsers/nasm/Makefile.inc @@ -2,6 +2,7 @@ YASMPARSERFILES += \ src/parsers/nasm/nasm-parser.c \ + src/parsers/nasm/nasm-defs.h \ nasm-bison.y \ nasm-bison.h \ nasm-token.l @@ -38,9 +39,6 @@ endif noinst_SCRIPTS = src/parsers/nasm/gen_instr.pl -AM_YFLAGS = -d --name-prefix=nasm_parser_ -AM_LFLAGS = -Pnasm_parser_ -olex.yy.c - BUILT_SOURCES += \ nasm-bison.y \ nasm-bison.c \ diff --git a/modules/parsers/nasm/bison.y.in b/modules/parsers/nasm/bison.y.in index 87d4c67a..d16775b9 100644 --- a/modules/parsers/nasm/bison.y.in +++ b/modules/parsers/nasm/bison.y.in @@ -42,6 +42,8 @@ RCSID("$IdPath$"); #include "arch.h" +#include "src/parsers/nasm/nasm-defs.h" + void init_table(void); extern int nasm_parser_lex(void); void nasm_parser_error(const char *); diff --git a/modules/parsers/nasm/nasm-bison.y b/modules/parsers/nasm/nasm-bison.y index 87d4c67a..d16775b9 100644 --- a/modules/parsers/nasm/nasm-bison.y +++ b/modules/parsers/nasm/nasm-bison.y @@ -42,6 +42,8 @@ RCSID("$IdPath$"); #include "arch.h" +#include "src/parsers/nasm/nasm-defs.h" + void init_table(void); extern int nasm_parser_lex(void); void nasm_parser_error(const char *); diff --git a/modules/parsers/nasm/nasm-defs.h b/modules/parsers/nasm/nasm-defs.h new file mode 100644 index 00000000..cfbc7cd9 --- /dev/null +++ b/modules/parsers/nasm/nasm-defs.h @@ -0,0 +1,80 @@ +/* $IdPath$ + * Variable name redefinitions for NASM-compatible parser + * + * Copyright (C) 2001 Peter Johnson + * + * This file is part of YASM. + * + * YASM is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * YASM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define yy_create_buffer nasm_parser__create_buffer +#define yy_delete_buffer nasm_parser__delete_buffer +#define yy_init_buffer nasm_parser__init_buffer +#define yy_load_buffer_state nasm_parser__load_buffer_state +#define yy_switch_to_buffer nasm_parser__switch_to_buffer +#define yyact nasm_parser_act +#define yyback nasm_parser_back +#define yybgin nasm_parser_bgin +#define yychar nasm_parser_char +#define yychk nasm_parser_chk +#define yycrank nasm_parser_crank +#define yydebug nasm_parser_debug +#define yydef nasm_parser_def +#define yyerrflag nasm_parser_errflag +#define yyerror nasm_parser_error +#define yyestate nasm_parser_estate +#define yyexca nasm_parser_exca +#define yyextra nasm_parser_extra +#define yyfnd nasm_parser_fnd +#define yyin nasm_parser_in +#define yyinput nasm_parser_input +#define yyleng nasm_parser_leng +#define yylex nasm_parser_lex +#define yylineno nasm_parser_lineno +#define yylook nasm_parser_look +#define yylsp nasm_parser_lsp +#define yylstate nasm_parser_lstate +#define yylval nasm_parser_lval +#define yymatch nasm_parser_match +#define yymorfg nasm_parser_morfg +#define yynerrs nasm_parser_nerrs +#define yyolsp nasm_parser_olsp +#define yyout nasm_parser_out +#define yyoutput nasm_parser_output +#define yypact nasm_parser_pact +#define yyparse nasm_parser_parse +#define yypgo nasm_parser_pgo +#define yyprevious nasm_parser_previous +#define yyps nasm_parser_ps +#define yypv nasm_parser_pv +#define yyr1 nasm_parser_r1 +#define yyr2 nasm_parser_r2 +#define yyreds nasm_parser_reds +#define yyrestart nasm_parser_restart +#define yys nasm_parser_s +#define yysbuf nasm_parser_sbuf +#define yysptr nasm_parser_sptr +#define yystate nasm_parser_state +#define yysvec nasm_parser_svec +#define yytchar nasm_parser_tchar +#define yytext nasm_parser_text +#define yytmp nasm_parser_tmp +#define yytoks nasm_parser_toks +#define yytop nasm_parser_top +#define yyunput nasm_parser_unput +#define yyv nasm_parser_v +#define yyval nasm_parser_val +#define yyvstop nasm_parser_vstop +/*#define yywrap nasm_parser_wrap*/ diff --git a/modules/parsers/nasm/nasm-parser.c b/modules/parsers/nasm/nasm-parser.c index 0b896f94..0911ce75 100644 --- a/modules/parsers/nasm/nasm-parser.c +++ b/modules/parsers/nasm/nasm-parser.c @@ -35,7 +35,7 @@ extern int nasm_parser_debug; extern int nasm_parser_parse(void); -size_t (*nasm_parser_yyinput) (char *buf, size_t max_size); +size_t (*nasm_parser_input) (char *buf, size_t max_size); sectionhead nasm_parser_sections; /*@dependent@*/ section *nasm_parser_cur_section; @@ -48,7 +48,7 @@ nasm_parser_do_parse(parser *p, FILE *f) { p->current_pp->initialize(f); nasm_parser_in = f; - nasm_parser_yyinput = p->current_pp->input; + nasm_parser_input = p->current_pp->input; /* Initialize section list */ nasm_parser_cur_section = sections_initialize(&nasm_parser_sections); diff --git a/modules/parsers/nasm/token.l.in b/modules/parsers/nasm/token.l.in index 70b14b76..b0b160c4 100644 --- a/modules/parsers/nasm/token.l.in +++ b/modules/parsers/nasm/token.l.in @@ -35,18 +35,17 @@ RCSID("$IdPath$"); #include "arch.h" +#include "src/parsers/nasm/nasm-defs.h" #include "nasm-bison.h" #define YY_NEVER_INTERACTIVE 1 -#define yylval nasm_parser_lval - int nasm_parser_lex(void); -extern size_t (*nasm_parser_yyinput) (char *buf, size_t max_size); +extern size_t (*nasm_parser_input) (char *buf, size_t max_size); #undef YY_INPUT -#define YY_INPUT(b, r, ms) (r = nasm_parser_yyinput(b, ms)) +#define YY_INPUT(b, r, ms) (r = nasm_parser_input(b, ms)) /* starting size of string buffer */ #define STRBUF_ALLOC_SIZE 128 @@ -66,6 +65,9 @@ static int linechg_numcount; %option noyywrap %option nounput %option case-insensitive +%option never-interactive +%option prefix="nasm_parser_" +%option outfile="lex.yy.c" %x DIRECTIVE LINECHG LINECHG2 %s DIRECTIVE2 diff --git a/src/parsers/nasm/Makefile.inc b/src/parsers/nasm/Makefile.inc index 9b0e6144..dbe7010d 100644 --- a/src/parsers/nasm/Makefile.inc +++ b/src/parsers/nasm/Makefile.inc @@ -2,6 +2,7 @@ YASMPARSERFILES += \ src/parsers/nasm/nasm-parser.c \ + src/parsers/nasm/nasm-defs.h \ nasm-bison.y \ nasm-bison.h \ nasm-token.l @@ -38,9 +39,6 @@ endif noinst_SCRIPTS = src/parsers/nasm/gen_instr.pl -AM_YFLAGS = -d --name-prefix=nasm_parser_ -AM_LFLAGS = -Pnasm_parser_ -olex.yy.c - BUILT_SOURCES += \ nasm-bison.y \ nasm-bison.c \ diff --git a/src/parsers/nasm/bison.y.in b/src/parsers/nasm/bison.y.in index 87d4c67a..d16775b9 100644 --- a/src/parsers/nasm/bison.y.in +++ b/src/parsers/nasm/bison.y.in @@ -42,6 +42,8 @@ RCSID("$IdPath$"); #include "arch.h" +#include "src/parsers/nasm/nasm-defs.h" + void init_table(void); extern int nasm_parser_lex(void); void nasm_parser_error(const char *); diff --git a/src/parsers/nasm/nasm-bison.y b/src/parsers/nasm/nasm-bison.y index 87d4c67a..d16775b9 100644 --- a/src/parsers/nasm/nasm-bison.y +++ b/src/parsers/nasm/nasm-bison.y @@ -42,6 +42,8 @@ RCSID("$IdPath$"); #include "arch.h" +#include "src/parsers/nasm/nasm-defs.h" + void init_table(void); extern int nasm_parser_lex(void); void nasm_parser_error(const char *); diff --git a/src/parsers/nasm/nasm-defs.h b/src/parsers/nasm/nasm-defs.h new file mode 100644 index 00000000..cfbc7cd9 --- /dev/null +++ b/src/parsers/nasm/nasm-defs.h @@ -0,0 +1,80 @@ +/* $IdPath$ + * Variable name redefinitions for NASM-compatible parser + * + * Copyright (C) 2001 Peter Johnson + * + * This file is part of YASM. + * + * YASM is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * YASM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define yy_create_buffer nasm_parser__create_buffer +#define yy_delete_buffer nasm_parser__delete_buffer +#define yy_init_buffer nasm_parser__init_buffer +#define yy_load_buffer_state nasm_parser__load_buffer_state +#define yy_switch_to_buffer nasm_parser__switch_to_buffer +#define yyact nasm_parser_act +#define yyback nasm_parser_back +#define yybgin nasm_parser_bgin +#define yychar nasm_parser_char +#define yychk nasm_parser_chk +#define yycrank nasm_parser_crank +#define yydebug nasm_parser_debug +#define yydef nasm_parser_def +#define yyerrflag nasm_parser_errflag +#define yyerror nasm_parser_error +#define yyestate nasm_parser_estate +#define yyexca nasm_parser_exca +#define yyextra nasm_parser_extra +#define yyfnd nasm_parser_fnd +#define yyin nasm_parser_in +#define yyinput nasm_parser_input +#define yyleng nasm_parser_leng +#define yylex nasm_parser_lex +#define yylineno nasm_parser_lineno +#define yylook nasm_parser_look +#define yylsp nasm_parser_lsp +#define yylstate nasm_parser_lstate +#define yylval nasm_parser_lval +#define yymatch nasm_parser_match +#define yymorfg nasm_parser_morfg +#define yynerrs nasm_parser_nerrs +#define yyolsp nasm_parser_olsp +#define yyout nasm_parser_out +#define yyoutput nasm_parser_output +#define yypact nasm_parser_pact +#define yyparse nasm_parser_parse +#define yypgo nasm_parser_pgo +#define yyprevious nasm_parser_previous +#define yyps nasm_parser_ps +#define yypv nasm_parser_pv +#define yyr1 nasm_parser_r1 +#define yyr2 nasm_parser_r2 +#define yyreds nasm_parser_reds +#define yyrestart nasm_parser_restart +#define yys nasm_parser_s +#define yysbuf nasm_parser_sbuf +#define yysptr nasm_parser_sptr +#define yystate nasm_parser_state +#define yysvec nasm_parser_svec +#define yytchar nasm_parser_tchar +#define yytext nasm_parser_text +#define yytmp nasm_parser_tmp +#define yytoks nasm_parser_toks +#define yytop nasm_parser_top +#define yyunput nasm_parser_unput +#define yyv nasm_parser_v +#define yyval nasm_parser_val +#define yyvstop nasm_parser_vstop +/*#define yywrap nasm_parser_wrap*/ diff --git a/src/parsers/nasm/nasm-parser.c b/src/parsers/nasm/nasm-parser.c index 0b896f94..0911ce75 100644 --- a/src/parsers/nasm/nasm-parser.c +++ b/src/parsers/nasm/nasm-parser.c @@ -35,7 +35,7 @@ extern int nasm_parser_debug; extern int nasm_parser_parse(void); -size_t (*nasm_parser_yyinput) (char *buf, size_t max_size); +size_t (*nasm_parser_input) (char *buf, size_t max_size); sectionhead nasm_parser_sections; /*@dependent@*/ section *nasm_parser_cur_section; @@ -48,7 +48,7 @@ nasm_parser_do_parse(parser *p, FILE *f) { p->current_pp->initialize(f); nasm_parser_in = f; - nasm_parser_yyinput = p->current_pp->input; + nasm_parser_input = p->current_pp->input; /* Initialize section list */ nasm_parser_cur_section = sections_initialize(&nasm_parser_sections); diff --git a/src/parsers/nasm/token.l.in b/src/parsers/nasm/token.l.in index 70b14b76..b0b160c4 100644 --- a/src/parsers/nasm/token.l.in +++ b/src/parsers/nasm/token.l.in @@ -35,18 +35,17 @@ RCSID("$IdPath$"); #include "arch.h" +#include "src/parsers/nasm/nasm-defs.h" #include "nasm-bison.h" #define YY_NEVER_INTERACTIVE 1 -#define yylval nasm_parser_lval - int nasm_parser_lex(void); -extern size_t (*nasm_parser_yyinput) (char *buf, size_t max_size); +extern size_t (*nasm_parser_input) (char *buf, size_t max_size); #undef YY_INPUT -#define YY_INPUT(b, r, ms) (r = nasm_parser_yyinput(b, ms)) +#define YY_INPUT(b, r, ms) (r = nasm_parser_input(b, ms)) /* starting size of string buffer */ #define STRBUF_ALLOC_SIZE 128 @@ -66,6 +65,9 @@ static int linechg_numcount; %option noyywrap %option nounput %option case-insensitive +%option never-interactive +%option prefix="nasm_parser_" +%option outfile="lex.yy.c" %x DIRECTIVE LINECHG LINECHG2 %s DIRECTIVE2