wmc: 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:15 +02:00
parent 86bb809e5b
commit 4f0fa2608a
6 changed files with 24 additions and 26 deletions

View File

@ -302,7 +302,7 @@ try_again:
if(!n) if(!n)
{ {
yywarning("Re-read line (input was or converted to zilch)"); mcy_warning("Re-read line (input was or converted to zilch)");
goto try_again; /* Should not happen, but could be due to stdin reading and a signal */ goto try_again; /* Should not happen, but could be due to stdin reading and a signal */
} }
@ -490,7 +490,7 @@ static int scan_number(int ch)
else else
{ {
unget_unichar(ch); unget_unichar(ch);
yylval.num = 0; mcy_lval.num = 0;
return tNUMBER; return tNUMBER;
} }
break; break;
@ -535,7 +535,7 @@ static int scan_number(int ch)
finish: finish:
unget_unichar(ch); unget_unichar(ch);
push_char(0); push_char(0);
yylval.num = strtoul(get_char_stack(), NULL, base); mcy_lval.num = strtoul(get_char_stack(), NULL, base);
return tNUMBER; return tNUMBER;
} }
@ -586,7 +586,7 @@ void get_tokentable(token_t **tab, int *len)
* The scanner * The scanner
* *
*/ */
int yylex(void) int mcy_lex(void)
{ {
static const WCHAR ustr_dot1[] = { '.', '\n', 0 }; static const WCHAR ustr_dot1[] = { '.', '\n', 0 };
static const WCHAR ustr_dot2[] = { '.', '\r', '\n', 0 }; static const WCHAR ustr_dot2[] = { '.', '\r', '\n', 0 };
@ -639,7 +639,7 @@ int yylex(void)
set_codepage(WMC_DEFAULT_CODEPAGE); set_codepage(WMC_DEFAULT_CODEPAGE);
return tMSGEND; return tMSGEND;
} }
yylval.str = xunistrdup(get_unichar_stack()); mcy_lval.str = xunistrdup(get_unichar_stack());
return tLINE; return tLINE;
} }
@ -677,7 +677,7 @@ int yylex(void)
unget_unichar(ch); unget_unichar(ch);
push_unichar(0); push_unichar(0);
want_file = 0; want_file = 0;
yylval.str = xunistrdup(get_unichar_stack()); mcy_lval.str = xunistrdup(get_unichar_stack());
return tFILE; return tFILE;
} }
@ -693,7 +693,7 @@ int yylex(void)
push_unichar(0); push_unichar(0);
if(!(tok = lookup_token(get_unichar_stack()))) if(!(tok = lookup_token(get_unichar_stack())))
{ {
yylval.str = xunistrdup(get_unichar_stack()); mcy_lval.str = xunistrdup(get_unichar_stack());
return tIDENT; return tIDENT;
} }
switch(tok->type) switch(tok->type)
@ -706,7 +706,7 @@ int yylex(void)
/* Fall through */ /* Fall through */
case tok_severity: case tok_severity:
case tok_facility: case tok_facility:
yylval.tok = tok; mcy_lval.tok = tok;
return tTOKEN; return tTOKEN;
default: default:
@ -738,7 +738,7 @@ int yylex(void)
newline(); newline();
push_unichar(ch); /* Include the newline */ push_unichar(ch); /* Include the newline */
push_unichar(0); push_unichar(0);
yylval.str = xunistrdup(get_unichar_stack()); mcy_lval.str = xunistrdup(get_unichar_stack());
return tCOMMENT; return tCOMMENT;
default: default:
xyyerror("Invalid character '%c' (0x%04x)", isisochar(ch) && isprint(ch) ? ch : '.', ch); xyyerror("Invalid character '%c' (0x%04x)", isisochar(ch) && isprint(ch) ? ch : '.', ch);

View File

@ -95,8 +95,6 @@ static cp_xlat_t *find_cpxlat(int lan);
%} %}
%name-prefix="yy"
%union { %union {
WCHAR *str; WCHAR *str;
unsigned num; unsigned num;
@ -231,7 +229,7 @@ lmap : token '=' tNUMBER setfile ':' tFILE optcp {
$1->codepage = $7; $1->codepage = $7;
do_add_token(tok_language, $1, "language"); do_add_token(tok_language, $1, "language");
if(!find_language($3) && !find_cpxlat($3)) if(!find_language($3) && !find_cpxlat($3))
yywarning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", $3, WMC_DEFAULT_CODEPAGE); mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", $3, WMC_DEFAULT_CODEPAGE);
} }
| token '=' tNUMBER setfile ':' error { xyyerror("Filename expected"); } | token '=' tNUMBER setfile ':' error { xyyerror("Filename expected"); }
| token '=' tNUMBER error { xyyerror(err_colon); } | token '=' tNUMBER error { xyyerror(err_colon); }
@ -421,7 +419,7 @@ static void do_add_token(tok_e type, token_t *tok, const char *code)
if(tp) if(tp)
{ {
if(tok->type != type) if(tok->type != type)
yywarning("Type change in token"); mcy_warning("Type change in token");
if(tp != tok) if(tp != tok)
xyyerror("Overlapping token not the same"); xyyerror("Overlapping token not the same");
/* else its already defined and changed */ /* else its already defined and changed */
@ -444,7 +442,7 @@ static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg)
lmp->msg = msg; lmp->msg = msg;
lmp->len = unistrlen(msg) + 1; /* Include termination */ lmp->len = unistrlen(msg) + 1; /* Include termination */
if(lmp->len > 4096) if(lmp->len > 4096)
yywarning("Message exceptionally long; might be a missing termination"); mcy_warning("Message exceptionally long; might be a missing termination");
return lmp; return lmp;
} }

View File

@ -49,7 +49,7 @@ static void generic_msg(const char *s, const char *t, va_list ap)
* The extra routine 'xyyerror' is used to exit after giving a real * The extra routine 'xyyerror' is used to exit after giving a real
* message. * message.
*/ */
int yyerror(const char *s, ...) int mcy_error(const char *s, ...)
{ {
#ifndef SUPPRESS_YACC_ERROR_MESSAGE #ifndef SUPPRESS_YACC_ERROR_MESSAGE
va_list ap; va_list ap;
@ -70,7 +70,7 @@ int xyyerror(const char *s, ...)
return 1; return 1;
} }
int yywarning(const char *s, ...) int mcy_warning(const char *s, ...)
{ {
va_list ap; va_list ap;
va_start(ap, s); va_start(ap, s);
@ -215,7 +215,7 @@ int unistricmp(const WCHAR *s1, const WCHAR *s2)
if(!once) if(!once)
{ {
once++; once++;
yywarning(warn); mcy_warning(warn);
} }
i = *s1++ - *s2++; i = *s1++ - *s2++;
} }
@ -228,7 +228,7 @@ int unistricmp(const WCHAR *s1, const WCHAR *s2)
if((*s1 & 0xffff) > 0x7f || (*s2 & 0xffff) > 0x7f) if((*s1 & 0xffff) > 0x7f || (*s2 & 0xffff) > 0x7f)
{ {
if(!once) if(!once)
yywarning(warn); mcy_warning(warn);
return *s1 - *s2; return *s1 - *s2;
} }
else else

View File

@ -33,9 +33,9 @@ char *xstrdup(const char *str);
#define __attribute__(X) #define __attribute__(X)
#endif #endif
int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2))); int mcy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
int xyyerror(const char *s, ...) __attribute__((format (printf, 1, 2))); int xyyerror(const char *s, ...) __attribute__((format (printf, 1, 2)));
int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2))); int mcy_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

@ -113,7 +113,7 @@ int char_number = 1; /* The current char pos within the line */
char *cmdline; /* The entire commandline */ char *cmdline; /* The entire commandline */
time_t now; /* The time of start of wmc */ time_t now; /* The time of start of wmc */
int yydebug; int mcy_debug;
int getopt (int argc, char *const *argv, const char *optstring); int getopt (int argc, char *const *argv, const char *optstring);
static void segvhandler(int sig); static void segvhandler(int sig);
@ -239,7 +239,7 @@ int main(int argc,char *argv[])
return 1; return 1;
} }
yydebug = dodebug; mcy_debug = dodebug;
if(dodebug) if(dodebug)
{ {
setbuf(stdout, 0); setbuf(stdout, 0);
@ -273,7 +273,7 @@ int main(int argc,char *argv[])
else else
yyin = stdin; yyin = stdin;
ret = yyparse(); ret = mcy_parse();
if(input_name) if(input_name)
fclose(yyin); fclose(yyin);

View File

@ -56,15 +56,15 @@ extern time_t now;
extern int line_number; extern int line_number;
extern int char_number; extern int char_number;
int yyparse(void); int mcy_parse(void);
extern int yydebug; extern int mcy_debug;
extern int want_nl; extern int want_nl;
extern int want_line; extern int want_line;
extern int want_file; extern int want_file;
extern node_t *nodehead; extern node_t *nodehead;
extern lan_blk_t *lanblockhead; extern lan_blk_t *lanblockhead;
int yylex(void); int mcy_lex(void);
FILE *yyin; FILE *yyin;
void set_codepage(int cp); void set_codepage(int cp);