widl: Change the prefix on bison-generated names to avoid the name-prefix directive.

This commit is contained in:
Alexandre Julliard 2006-09-12 09:05:07 +02:00
parent 2d778c5eea
commit 86bb809e5b
8 changed files with 35 additions and 37 deletions

View file

@ -716,7 +716,7 @@ static void write_method_proto(const type_t *iface)
fprintf(header, ");\n");
}
else {
yywarning("invalid call_as attribute (%s -> %s)\n", get_name(def), cas->name);
parser_warning("invalid call_as attribute (%s -> %s)\n", get_name(def), cas->name);
}
}
@ -802,7 +802,7 @@ static void write_coclass_guid(type_t *cocl)
static void write_com_interface(type_t *iface)
{
if (!iface->funcs && !iface->ref) {
yywarning("%s has no methods", iface->name);
parser_warning("%s has no methods", iface->name);
return;
}

View file

@ -21,14 +21,14 @@
#ifndef __WIDL_PARSER_H
#define __WIDL_PARSER_H
int yyparse(void);
int parser_parse(void);
extern FILE *yyin;
extern char *yytext;
extern int yydebug;
extern FILE *parser_in;
extern char *parser_text;
extern int parser_debug;
extern int yy_flex_debug;
int yylex(void);
int parser_lex(void);
extern int import_stack_ptr;
int do_import(char *fname);

View file

@ -20,7 +20,7 @@
%option stack
%option nounput noyy_top_state
%option 8bit never-interactive
%option 8bit never-interactive prefix="parser_"
nl \r?\n
ws [ \f\t\r]
@ -110,14 +110,14 @@ static UUID* parse_uuid(const char*u)
yy_pop_state();
lineno = (int)strtol(yytext, &cptr, 10);
if(!lineno)
yyerror("Malformed '#...' line-directive; invalid linenumber");
parser_error("Malformed '#...' line-directive; invalid linenumber");
fname = strchr(cptr, '"');
if(!fname)
yyerror("Malformed '#...' line-directive; missing filename");
parser_error("Malformed '#...' line-directive; missing filename");
fname++;
cptr = strchr(fname, '"');
if(!cptr)
yyerror("Malformed '#...' line-directive; missing terminating \"");
parser_error("Malformed '#...' line-directive; missing terminating \"");
*cptr = '\0';
line_number = lineno - 1; /* We didn't read the newline */
free( input_name );
@ -126,7 +126,7 @@ static UUID* parse_uuid(const char*u)
\" yy_push_state(QUOTE); cbufidx = 0;
<QUOTE>\" {
yy_pop_state();
yylval.str = get_buffered_cstring();
parser_lval.str = get_buffered_cstring();
return aSTRING;
}
<QUOTE>\\\\ |
@ -134,15 +134,15 @@ static UUID* parse_uuid(const char*u)
<QUOTE>\\. addcchar('\\'); addcchar(yytext[1]);
<QUOTE>. addcchar(yytext[0]);
{uuid} {
yylval.uuid = parse_uuid(yytext);
parser_lval.uuid = parse_uuid(yytext);
return aUUID;
}
{hex} {
yylval.num = strtoul(yytext, NULL, 0);
parser_lval.num = strtoul(yytext, NULL, 0);
return aHEXNUM;
}
{int} {
yylval.num = strtoul(yytext, NULL, 0);
parser_lval.num = strtoul(yytext, NULL, 0);
return aNUM;
}
SAFEARRAY{ws}*/\( return tSAFEARRAY;
@ -161,8 +161,8 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
}
%%
#ifndef yywrap
int yywrap(void)
#ifndef parser_wrap
int parser_wrap(void)
{
return 1;
}
@ -338,10 +338,10 @@ static int kw_token(const char *kw)
}
#endif
if (kwp) {
yylval.str = (char*)kwp->kw;
parser_lval.str = (char*)kwp->kw;
return kwp->token;
}
yylval.str = xstrdup(kw);
parser_lval.str = xstrdup(kw);
return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
}
@ -352,7 +352,7 @@ static void addcchar(char c)
cbufalloc += 1024;
cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
if(cbufalloc > 65536)
yywarning("Reallocating string buffer larger than 64kB");
parser_warning("Reallocating string buffer larger than 64kB");
}
cbuffer[cbufidx++] = c;
}
@ -414,7 +414,7 @@ int do_import(char *fname)
first_import = import;
if (!(path = wpp_find_include( fname, input_name )))
yyerror("Unable to open include file %s", fname);
parser_error("Unable to open include file %s", fname);
import_stack[ptr].temp_name = temp_name;
import_stack[ptr].input_name = input_name;
@ -427,7 +427,7 @@ int do_import(char *fname)
if (ret) exit(1);
if((f = fopen(temp_name, "r")) == NULL)
yyerror("Unable to open %s", temp_name);
parser_error("Unable to open %s", temp_name);
import_stack[ptr].state = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));

View file

@ -126,8 +126,6 @@ static void check_arg(var_t *arg);
unsigned int num;
}
%name-prefix="yy"
%token <str> aIDENTIFIER
%token <str> aKNOWNTYPE
%token <num> aNUM aHEXNUM

View file

@ -936,7 +936,7 @@ static void write_proxy(type_t *iface)
gen_proxy(iface, cur, idx);
gen_stub(iface, cur, cname);
if (midx == -1) midx = idx;
else if (midx != idx) yyerror("method index mismatch in write_proxy");
else if (midx != idx) parser_error("method index mismatch in write_proxy");
midx++;
}
cur = PREV_LINK(cur);

View file

@ -68,21 +68,21 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
}
int yyerror(const char *s, ...)
int parser_error(const char *s, ...)
{
va_list ap;
va_start(ap, s);
generic_msg(s, "Error", yytext, ap);
generic_msg(s, "Error", parser_text, ap);
va_end(ap);
exit(1);
return 1;
}
int yywarning(const char *s, ...)
int parser_warning(const char *s, ...)
{
va_list ap;
va_start(ap, s);
generic_msg(s, "Warning", yytext, ap);
generic_msg(s, "Warning", parser_text, ap);
va_end(ap);
return 0;
}

View file

@ -33,8 +33,8 @@ char *xstrdup(const char *str);
#define __attribute__(X)
#endif
int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2)));
int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));

View file

@ -84,7 +84,7 @@ static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSIO
int win32 = 1;
int debuglevel = DEBUGLEVEL_NONE;
int yydebug, yy_flex_debug;
int parser_debug, yy_flex_debug;
int pedantic = 0;
static int do_everything = 1;
@ -271,7 +271,7 @@ int main(int argc,char *argv[])
setbuf(stderr,0);
}
yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0,
@ -330,13 +330,13 @@ int main(int argc,char *argv[])
if(ret) exit(1);
if(preprocess_only) exit(0);
if(!(yyin = fopen(temp_name, "r"))) {
if(!(parser_in = fopen(temp_name, "r"))) {
fprintf(stderr, "Could not open %s for input\n", temp_name);
return 1;
}
}
else {
if(!(yyin = fopen(input_name, "r"))) {
if(!(parser_in = fopen(input_name, "r"))) {
fprintf(stderr, "Could not open %s for input\n", input_name);
return 1;
}
@ -380,7 +380,7 @@ int main(int argc,char *argv[])
}
init_types();
ret = yyparse();
ret = parser_parse();
if(do_header) {
fprintf(header, "/* Begin additional prototypes for all interfaces */\n");
@ -405,7 +405,7 @@ int main(int argc,char *argv[])
fclose(idfile);
}
fclose(yyin);
fclose(parser_in);
if(ret) {
exit(1);