Commit 42418fbb authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 4f0fa260
......@@ -327,7 +327,7 @@ static int convert_bitmap(char *data, int size)
type |= FL_SIZEBE | FL_OS2;
}
else
yyerror("Invalid bitmap format, bih->biSize = %ld", bih->biSize);
parser_error("Invalid bitmap format, bih->biSize = %ld", bih->biSize);
switch(type)
{
......@@ -336,12 +336,12 @@ static int convert_bitmap(char *data, int size)
case FL_SIZEBE:
case FL_SIZEBE | FL_V4:
case FL_SIZEBE | FL_OS2:
yywarning("Bitmap v%c signature little-endian, but size big-endian", type & FL_V4 ? '4' : '3');
parser_warning("Bitmap v%c signature little-endian, but size big-endian", type & FL_V4 ? '4' : '3');
break;
case FL_SIGBE:
case FL_SIGBE | FL_V4:
case FL_SIGBE | FL_OS2:
yywarning("Bitmap v%c signature big-endian, but size little-endian", type & FL_V4 ? '4' : '3');
parser_warning("Bitmap v%c signature big-endian, but size little-endian", type & FL_V4 ? '4' : '3');
break;
}
......@@ -461,7 +461,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico)
else if(BYTESWAP_WORD(ih->type) == 1)
swap = 1;
else
yyerror("Icon resource data has invalid type id %d", ih->type);
parser_error("Icon resource data has invalid type id %d", ih->type);
cnt = swap ? BYTESWAP_WORD(ih->count) : ih->count;
for(i = 0; i < cnt; i++)
......@@ -481,7 +481,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico)
}
if(ide.offset > rd->size
|| ide.offset + ide.ressize > rd->size)
yyerror("Icon resource data corrupt");
parser_error("Icon resource data corrupt");
ico->width = ide.width;
ico->height = ide.height;
ico->nclr = ide.nclr;
......@@ -556,7 +556,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
else if(BYTESWAP_WORD(ch->type) == 2)
swap = 1;
else
yyerror("Cursor resource data has invalid type id %d", ch->type);
parser_error("Cursor resource data has invalid type id %d", ch->type);
cnt = swap ? BYTESWAP_WORD(ch->count) : ch->count;
for(i = 0; i < cnt; i++)
{
......@@ -575,7 +575,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
}
if(cde.offset > rd->size
|| cde.offset + cde.ressize > rd->size)
yyerror("Cursor resource data corrupt");
parser_error("Cursor resource data corrupt");
cur->width = cde.width;
cur->height = cde.height;
cur->nclr = cde.nclr;
......@@ -598,7 +598,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
cur->bits = info.biBitCount;
}
if(!win32 && (cur->planes != 1 || cur->bits != 1))
yywarning("Win16 cursor contains colors");
parser_warning("Win16 cursor contains colors");
cur->xhot = swap ? BYTESWAP_WORD(cde.xhot) : cde.xhot;
cur->yhot = swap ? BYTESWAP_WORD(cde.yhot) : cde.yhot;
cur->data = new_raw_data();
......@@ -745,21 +745,21 @@ static void handle_ani_icon(riff_tag_t *rtp, enum res_e type, int isswapped)
if(type == res_anicur && ctype != 2 && !once)
{
yywarning("Animated cursor contains invalid \"icon\" tag cursor-file (%d->%s)",
parser_warning("Animated cursor contains invalid \"icon\" tag cursor-file (%d->%s)",
ctype,
ctype == 1 ? "icontype" : "?");
once++;
}
else if(type == res_aniico && ctype != 1 && !once)
{
yywarning("Animated icon contains invalid \"icon\" tag icon-file (%d->%s)",
parser_warning("Animated icon contains invalid \"icon\" tag icon-file (%d->%s)",
ctype,
ctype == 2 ? "cursortype" : "?");
once++;
}
else if(ctype != 1 && ctype != 2 && !once)
{
yywarning("Animated %s contains invalid \"icon\" tag file-type (%d; neither icon nor cursor)", anistr, ctype);
parser_warning("Animated %s contains invalid \"icon\" tag file-type (%d; neither icon nor cursor)", anistr, ctype);
once++;
}
......@@ -768,7 +768,7 @@ static void handle_ani_icon(riff_tag_t *rtp, enum res_e type, int isswapped)
DWORD ofs = isswapped ? BYTESWAP_DWORD(cdp[i].offset) : cdp[i].offset;
DWORD sze = isswapped ? BYTESWAP_DWORD(cdp[i].ressize) : cdp[i].ressize;
if(ofs > rtp->size || ofs+sze > rtp->size)
yyerror("Animated %s's data corrupt", anistr);
parser_error("Animated %s's data corrupt", anistr);
convert_bitmap((char *)chp + ofs, 0);
cdp[i].xhot = BYTESWAP_WORD(cdp->xhot);
cdp[i].yhot = BYTESWAP_WORD(cdp->yhot);
......@@ -840,7 +840,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
else if(rtp->size + 2*sizeof(DWORD) == rd->size)
isswapped = 0;
else
yyerror("Animated %s has an invalid RIFF length", anistr);
parser_error("Animated %s has an invalid RIFF length", anistr);
switch(byteorder)
{
......@@ -933,7 +933,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
/* We must end correctly here */
if((char *)rtp != (char *)rd->data + rd->size)
yyerror("Animated %s contains invalid field size(s)", anistr);
parser_error("Animated %s contains invalid field size(s)", anistr);
}
ani->data = rd;
......@@ -1002,7 +1002,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
msg->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
if(rd->size < sizeof(DWORD))
yyerror("Invalid messagetable, size too small");
parser_error("Invalid messagetable, size too small");
nblk = *(DWORD *)rd->data;
lo = WRC_LOWORD(nblk);
......@@ -1019,7 +1019,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
if(hi && lo)
internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian");
if(!hi && !lo)
yyerror("Invalid messagetable block count 0");
parser_error("Invalid messagetable block count 0");
if(!hi && lo) /* Messagetable byteorder == native byteorder */
{
......@@ -1032,7 +1032,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mbp = (msgtab_block_t *)&(((DWORD *)rd->data)[1]);
if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp)))
yyerror("Messagetable's blocks are outside of defined data");
parser_error("Messagetable's blocks are outside of defined data");
for(i = 0; i < nblk; i++)
{
msgtab_entry_t *mep, *next_mep;
......@@ -1043,7 +1043,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
for(id = mbp[i].idlo; id <= mbp[i].idhi; id++)
{
if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length))
yyerror("Messagetable's data for block %d, ID 0x%08lx is outside of defined data", (int)i, id);
parser_error("Messagetable's data for block %d, ID 0x%08lx is outside of defined data", (int)i, id);
if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */
{
WORD *wp = (WORD *)&mep[1];
......@@ -1051,7 +1051,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
int n;
if(mep->length & 1)
yyerror("Message 0x%08lx is unicode (block %d), but has odd length (%d)", id, (int)i, mep->length);
parser_error("Message 0x%08lx is unicode (block %d), but has odd length (%d)", id, (int)i, mep->length);
for(n = 0; n < l; n++)
wp[n] = BYTESWAP_WORD(wp[n]);
......@@ -1079,7 +1079,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mbp = (msgtab_block_t *)&(((DWORD *)rd->data)[1]);
nblk = BYTESWAP_DWORD(nblk);
if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp)))
yyerror("Messagetable's blocks are outside of defined data");
parser_error("Messagetable's blocks are outside of defined data");
for(i = 0; i < nblk; i++)
{
msgtab_entry_t *mep;
......@@ -1096,7 +1096,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mep->flags = BYTESWAP_WORD(mep->flags);
if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length))
yyerror("Messagetable's data for block %d, ID 0x%08lx is outside of defined data", (int)i, id);
parser_error("Messagetable's data for block %d, ID 0x%08lx is outside of defined data", (int)i, id);
if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */
{
WORD *wp = (WORD *)&mep[1];
......@@ -1104,7 +1104,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
int n;
if(mep->length & 1)
yyerror("Message 0x%08lx is unicode (block %d), but has odd length (%d)", id, (int)i, mep->length);
parser_error("Message 0x%08lx is unicode (block %d), but has odd length (%d)", id, (int)i, mep->length);
for(n = 0; n < l; n++)
wp[n] = BYTESWAP_WORD(wp[n]);
......
......@@ -22,18 +22,18 @@
#define __WRC_PARSER_H
/* From parser.y */
extern int yydebug;
extern int parser_debug;
extern int want_nl; /* Set when getting line-numers */
extern int want_id; /* Set when getting the resource name */
int yyparse(void);
int parser_parse(void);
/* From parser.l */
extern FILE *yyin;
extern char *yytext;
extern FILE *parser_in;
extern char *parser_text;
extern int yy_flex_debug;
int yylex(void);
int parser_lex(void);
#endif
......@@ -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;
}
......
......@@ -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), noreturn));
void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
......
......@@ -166,7 +166,7 @@ int char_number = 1; /* The current char pos within the line */
char *cmdline; /* The entire commandline */
time_t now; /* The time of start of wrc */
int yydebug, yy_flex_debug;
int parser_debug, yy_flex_debug;
resource_t *resource_top; /* The top of the parsed resources */
......@@ -424,7 +424,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,
......@@ -486,12 +486,12 @@ int main(int argc,char *argv[])
/* Go from .rc to .res */
chat("Starting parse");
if(!(yyin = fopen(input_name, "rb")))
if(!(parser_in = fopen(input_name, "rb")))
error("Could not open %s for input\n", input_name);
ret = yyparse();
ret = parser_parse();
if(input_name) fclose(yyin);
if(input_name) fclose(parser_in);
if(ret) exit(1); /* Error during parse */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment