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"); fprintf(header, ");\n");
} }
else { 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) static void write_com_interface(type_t *iface)
{ {
if (!iface->funcs && !iface->ref) { if (!iface->funcs && !iface->ref) {
yywarning("%s has no methods", iface->name); parser_warning("%s has no methods", iface->name);
return; return;
} }

View File

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

View File

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

View File

@ -936,7 +936,7 @@ static void write_proxy(type_t *iface)
gen_proxy(iface, cur, idx); gen_proxy(iface, cur, idx);
gen_stub(iface, cur, cname); gen_stub(iface, cur, cname);
if (midx == -1) midx = idx; 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++; midx++;
} }
cur = PREV_LINK(cur); 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_list ap;
va_start(ap, s); va_start(ap, s);
generic_msg(s, "Error", yytext, ap); generic_msg(s, "Error", parser_text, ap);
va_end(ap); va_end(ap);
exit(1); exit(1);
return 1; return 1;
} }
int yywarning(const char *s, ...) int parser_warning(const char *s, ...)
{ {
va_list ap; va_list ap;
va_start(ap, s); va_start(ap, s);
generic_msg(s, "Warning", yytext, ap); generic_msg(s, "Warning", parser_text, ap);
va_end(ap); va_end(ap);
return 0; return 0;
} }

View File

@ -33,8 +33,8 @@ char *xstrdup(const char *str);
#define __attribute__(X) #define __attribute__(X)
#endif #endif
int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2))); int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
int yywarning(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 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 error(const char *s, ...) __attribute__((format (printf, 1, 2)));
void warning(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 win32 = 1;
int debuglevel = DEBUGLEVEL_NONE; int debuglevel = DEBUGLEVEL_NONE;
int yydebug, yy_flex_debug; int parser_debug, yy_flex_debug;
int pedantic = 0; int pedantic = 0;
static int do_everything = 1; static int do_everything = 1;
@ -271,7 +271,7 @@ int main(int argc,char *argv[])
setbuf(stderr,0); setbuf(stderr,0);
} }
yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0; parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0; yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0, wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0,
@ -330,13 +330,13 @@ int main(int argc,char *argv[])
if(ret) exit(1); if(ret) exit(1);
if(preprocess_only) exit(0); 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); fprintf(stderr, "Could not open %s for input\n", temp_name);
return 1; return 1;
} }
} }
else { 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); fprintf(stderr, "Could not open %s for input\n", input_name);
return 1; return 1;
} }
@ -380,7 +380,7 @@ int main(int argc,char *argv[])
} }
init_types(); init_types();
ret = yyparse(); ret = parser_parse();
if(do_header) { if(do_header) {
fprintf(header, "/* Begin additional prototypes for all interfaces */\n"); fprintf(header, "/* Begin additional prototypes for all interfaces */\n");
@ -405,7 +405,7 @@ int main(int argc,char *argv[])
fclose(idfile); fclose(idfile);
} }
fclose(yyin); fclose(parser_in);
if(ret) { if(ret) {
exit(1); exit(1);