wrc: parser_error must append a newline.

This commit is contained in:
Alexandre Julliard 2008-03-21 21:12:15 +01:00
parent 247754fba2
commit 0a16b6b81f
4 changed files with 58 additions and 57 deletions

View File

@ -327,7 +327,7 @@ static int convert_bitmap(char *data, int size)
type |= FL_SIZEBE | FL_OS2; type |= FL_SIZEBE | FL_OS2;
} }
else else
parser_error("Invalid bitmap format, bih->biSize = %d\n", bih->biSize); parser_error("Invalid bitmap format, bih->biSize = %d", bih->biSize);
switch(type) switch(type)
{ {
@ -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) else if(BYTESWAP_WORD(ih->type) == 1)
swap = 1; swap = 1;
else else
parser_error("Icon resource data has invalid type id %d\n", ih->type); parser_error("Icon resource data has invalid type id %d", ih->type);
cnt = swap ? BYTESWAP_WORD(ih->count) : ih->count; cnt = swap ? BYTESWAP_WORD(ih->count) : ih->count;
for(i = 0; i < cnt; i++) 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 if(ide.offset > rd->size
|| ide.offset + ide.ressize > rd->size) || ide.offset + ide.ressize > rd->size)
parser_error("Icon resource data corrupt\n"); parser_error("Icon resource data corrupt");
ico->width = ide.width; ico->width = ide.width;
ico->height = ide.height; ico->height = ide.height;
ico->nclr = ide.nclr; 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) else if(BYTESWAP_WORD(ch->type) == 2)
swap = 1; swap = 1;
else else
parser_error("Cursor resource data has invalid type id %d\n", ch->type); parser_error("Cursor resource data has invalid type id %d", ch->type);
cnt = swap ? BYTESWAP_WORD(ch->count) : ch->count; cnt = swap ? BYTESWAP_WORD(ch->count) : ch->count;
for(i = 0; i < cnt; i++) 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 if(cde.offset > rd->size
|| cde.offset + cde.ressize > rd->size) || cde.offset + cde.ressize > rd->size)
parser_error("Cursor resource data corrupt\n"); parser_error("Cursor resource data corrupt");
cur->width = cde.width; cur->width = cde.width;
cur->height = cde.height; cur->height = cde.height;
cur->nclr = cde.nclr; cur->nclr = cde.nclr;
@ -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) else if(rtp->size + 2*sizeof(DWORD) == rd->size)
isswapped = 0; isswapped = 0;
else else
parser_error("Animated %s has an invalid RIFF length\n", anistr); parser_error("Animated %s has an invalid RIFF length", anistr);
switch(byteorder) switch(byteorder)
{ {
@ -1002,7 +1002,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
msg->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE; msg->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
if(rd->size < sizeof(DWORD)) if(rd->size < sizeof(DWORD))
parser_error("Invalid messagetable, size too small\n"); parser_error("Invalid messagetable, size too small");
nblk = *(DWORD *)rd->data; nblk = *(DWORD *)rd->data;
lo = WRC_LOWORD(nblk); lo = WRC_LOWORD(nblk);
@ -1019,7 +1019,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
if(hi && lo) if(hi && lo)
internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian\n"); internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian\n");
if(!hi && !lo) if(!hi && !lo)
parser_error("Invalid messagetable block count 0\n"); parser_error("Invalid messagetable block count 0");
if(!hi && lo) /* Messagetable byteorder == native byteorder */ 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]); mbp = (msgtab_block_t *)&(((DWORD *)rd->data)[1]);
if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp))) if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp)))
parser_error("Messagetable's blocks are outside of defined data\n"); parser_error("Messagetable's blocks are outside of defined data");
for(i = 0; i < nblk; i++) for(i = 0; i < nblk; i++)
{ {
msgtab_entry_t *mep, *next_mep; 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++) for(id = mbp[i].idlo; id <= mbp[i].idhi; id++)
{ {
if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length)) if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length))
parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data\n", i, id); parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data", i, id);
if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */ if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */
{ {
WORD *wp = (WORD *)&mep[1]; WORD *wp = (WORD *)&mep[1];
@ -1051,7 +1051,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
int n; int n;
if(mep->length & 1) if(mep->length & 1)
parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)\n", id, i, mep->length); parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)", id, i, mep->length);
for(n = 0; n < l; n++) for(n = 0; n < l; n++)
wp[n] = BYTESWAP_WORD(wp[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]); mbp = (msgtab_block_t *)&(((DWORD *)rd->data)[1]);
nblk = BYTESWAP_DWORD(nblk); nblk = BYTESWAP_DWORD(nblk);
if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp))) if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp)))
parser_error("Messagetable's blocks are outside of defined data\n"); parser_error("Messagetable's blocks are outside of defined data");
for(i = 0; i < nblk; i++) for(i = 0; i < nblk; i++)
{ {
msgtab_entry_t *mep; msgtab_entry_t *mep;
@ -1096,7 +1096,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mep->flags = BYTESWAP_WORD(mep->flags); mep->flags = BYTESWAP_WORD(mep->flags);
if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length)) if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length))
parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data\n", i, id); parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data", i, id);
if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */ if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */
{ {
WORD *wp = (WORD *)&mep[1]; WORD *wp = (WORD *)&mep[1];
@ -1104,7 +1104,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
int n; int n;
if(mep->length & 1) if(mep->length & 1)
parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)\n", id, i, mep->length); parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)", id, i, mep->length);
for(n = 0; n < l; n++) for(n = 0; n < l; n++)
wp[n] = BYTESWAP_WORD(wp[n]); wp[n] = BYTESWAP_WORD(wp[n]);

View File

@ -330,10 +330,10 @@ static struct keyword *iskeyword(char *kw)
yy_pop_state(); yy_pop_state();
lineno = (int)strtol(yytext, &cptr, 10); lineno = (int)strtol(yytext, &cptr, 10);
if(!lineno) if(!lineno)
parser_error("Malformed '#...' line-directive; invalid linenumber\n"); parser_error("Malformed '#...' line-directive; invalid linenumber");
fname = strchr(cptr, '"'); fname = strchr(cptr, '"');
if(!fname) if(!fname)
parser_error("Malformed '#...' line-directive; missing filename\n"); parser_error("Malformed '#...' line-directive; missing filename");
fname++; fname++;
cptr = strchr(fname, '"'); cptr = strchr(fname, '"');
if(!cptr) if(!cptr)
@ -361,11 +361,11 @@ static struct keyword *iskeyword(char *kw)
current_codepage = strtol( p, NULL, 10 ); current_codepage = strtol( p, NULL, 10 );
if (current_codepage && current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage )) if (current_codepage && current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage ))
{ {
parser_error("Codepage %d not supported\n", current_codepage); parser_error("Codepage %d not supported", current_codepage);
current_codepage = 0; current_codepage = 0;
} }
} }
<pp_code_page>[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive\n"); <pp_code_page>[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive");
/* /*
* Strip everything until a ';' taking * Strip everything until a ';' taking
@ -429,7 +429,7 @@ L\" {
unsigned int result; unsigned int result;
result = strtoul(yytext+1, 0, 8); result = strtoul(yytext+1, 0, 8);
if ( result > 0xffff ) if ( result > 0xffff )
parser_error("Character constant out of range\n"); parser_error("Character constant out of range");
addwchar((WCHAR)result); addwchar((WCHAR)result);
} }
<tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */ <tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */
@ -437,9 +437,9 @@ L\" {
result = strtoul(yytext+2, 0, 16); result = strtoul(yytext+2, 0, 16);
addwchar((WCHAR)result); addwchar((WCHAR)result);
} }
<tklstr>\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'\n", yytext); } <tklstr>\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'", yytext); }
<tklstr>\\[0-9]+ parser_error("Bad escape sequence\n"); <tklstr>\\[0-9]+ parser_error("Bad escape sequence");
<tklstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ <tklstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */
<tklstr>\\a addwchar('\a'); <tklstr>\\a addwchar('\a');
<tklstr>\\b addwchar('\b'); <tklstr>\\b addwchar('\b');
@ -458,7 +458,7 @@ L\" {
while(*yptr) /* FIXME: codepage translation */ while(*yptr) /* FIXME: codepage translation */
addwchar(*yptr++ & 0xff); addwchar(*yptr++ & 0xff);
} }
<tklstr>\n parser_error("Unterminated string\n"); <tklstr>\n parser_error("Unterminated string");
/* /*
* Normal string scanning * Normal string scanning
@ -474,7 +474,7 @@ L\" {
int result; int result;
result = strtol(yytext+1, 0, 8); result = strtol(yytext+1, 0, 8);
if ( result > 0xff ) if ( result > 0xff )
parser_error("Character constant out of range\n"); parser_error("Character constant out of range");
addcchar((char)result); addcchar((char)result);
} }
<tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */ <tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
@ -482,9 +482,9 @@ L\" {
result = strtol(yytext+2, 0, 16); result = strtol(yytext+2, 0, 16);
addcchar((char)result); addcchar((char)result);
} }
<tkstr>\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'\n", yytext); } <tkstr>\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'", yytext); }
<tkstr>\\[0-9]+ parser_error("Bad escape sequence\n"); <tkstr>\\[0-9]+ parser_error("Bad escape sequence");
<tkstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ <tkstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */
<tkstr>\\a addcchar('\a'); <tkstr>\\a addcchar('\a');
<tkstr>\\b addcchar('\b'); <tkstr>\\b addcchar('\b');
@ -503,7 +503,7 @@ L\" {
<tkstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ <tkstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
<tkstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ <tkstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
<tkstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */ <tkstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
<tkstr>\n parser_error("Unterminated string\n"); <tkstr>\n parser_error("Unterminated string");
/* /*
* Raw data scanning * Raw data scanning
@ -524,7 +524,7 @@ L\" {
} }
<tkrcd>{ws}+ ; /* Ignore space */ <tkrcd>{ws}+ ; /* Ignore space */
<tkrcd>\n line_number++; char_number = 1; <tkrcd>\n line_number++; char_number = 1;
<tkrcd>. parser_error("Malformed data-line\n"); <tkrcd>. parser_error("Malformed data-line");
/* /*
* Comment stripping * Comment stripping
@ -610,7 +610,7 @@ static string_t *get_buffered_cstring(void)
if (!current_codepage || current_codepage == -1 || !win32) /* store as ANSI string */ if (!current_codepage || current_codepage == -1 || !win32) /* store as ANSI string */
{ {
if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here\n"); if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here");
return str; return str;
} }
else /* convert to Unicode before storing */ else /* convert to Unicode before storing */
@ -618,7 +618,7 @@ static string_t *get_buffered_cstring(void)
string_t *str_w = convert_string( str, str_unicode, current_codepage ); string_t *str_w = convert_string( str, str_unicode, current_codepage );
if (!check_unicode_conversion( str, str_w, current_codepage )) if (!check_unicode_conversion( str, str_w, current_codepage ))
parser_error("String %s does not convert identically to Unicode and back in codepage %d. " parser_error("String %s does not convert identically to Unicode and back in codepage %d. "
"Try using a Unicode string instead\n", str->str.cstr, current_codepage ); "Try using a Unicode string instead", str->str.cstr, current_codepage );
free_string( str ); free_string( str );
return str_w; return str_w;
} }

View File

@ -419,7 +419,7 @@ resources
&& rsc->lan->sub == head->lan->sub && rsc->lan->sub == head->lan->sub
&& !compare_name_id(rsc->name, head->name)) && !compare_name_id(rsc->name, head->name))
{ {
parser_error("Duplicate resource name '%s'\n", get_nameid_str(rsc->name)); yyerror("Duplicate resource name '%s'", get_nameid_str(rsc->name));
} }
rsc = rsc->prev; rsc = rsc->prev;
} }
@ -476,7 +476,7 @@ resource
if($$) if($$)
{ {
if($1 > 65535 || $1 < -32768) if($1 > 65535 || $1 < -32768)
parser_error("Resource's ID out of range (%d)\n", $1); yyerror("Resource's ID out of range (%d)", $1);
$$->name = new_name_id(); $$->name = new_name_id();
$$->name->type = name_ord; $$->name->type = name_ord;
$$->name->name.i_name = $1; $$->name->name.i_name = $1;
@ -533,7 +533,7 @@ resource
parser_warning("LANGUAGE not supported in 16-bit mode\n"); parser_warning("LANGUAGE not supported in 16-bit mode\n");
free(currentlanguage); free(currentlanguage);
if (get_language_codepage($3, $5) == -1) if (get_language_codepage($3, $5) == -1)
parser_error( "Language %04x is not supported\n", ($5<<10) + $3); yyerror( "Language %04x is not supported", ($5<<10) + $3);
currentlanguage = new_language($3, $5); currentlanguage = new_language($3, $5);
$$ = NULL; $$ = NULL;
chat("Got LANGUAGE %d,%d (0x%04x)\n", $3, $5, ($5<<10) + $3); chat("Got LANGUAGE %d,%d (0x%04x)\n", $3, $5, ($5<<10) + $3);
@ -552,7 +552,7 @@ usrcvt : /* Empty */ { yychar = rsrcid_to_token(yychar); }
*/ */
nameid : expr { nameid : expr {
if($1 > 65535 || $1 < -32768) if($1 > 65535 || $1 < -32768)
parser_error("Resource's ID out of range (%d)\n", $1); yyerror("Resource's ID out of range (%d)", $1);
$$ = new_name_id(); $$ = new_name_id();
$$->type = name_ord; $$->type = name_ord;
$$->name.i_name = $1; $$->name.i_name = $1;
@ -776,7 +776,7 @@ accelerators
$$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE; $$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
} }
if(!$5) if(!$5)
parser_error("Accelerator table must have at least one entry\n"); yyerror("Accelerator table must have at least one entry");
$$->events = get_event_head($5); $$->events = get_event_head($5);
if($3) if($3)
{ {
@ -1224,7 +1224,7 @@ opt_expr: /* Empty */ { $$ = NULL; }
/* ------------------------------ Menu ------------------------------ */ /* ------------------------------ Menu ------------------------------ */
menu : tMENU loadmemopts opt_lvc menu_body { menu : tMENU loadmemopts opt_lvc menu_body {
if(!$4) if(!$4)
parser_error("Menu must contain items\n"); yyerror("Menu must contain items");
$$ = new_menu(); $$ = new_menu();
if($2) if($2)
{ {
@ -1298,7 +1298,7 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body {
if(!win32) if(!win32)
parser_warning("MENUEX not supported in 16-bit mode\n"); parser_warning("MENUEX not supported in 16-bit mode\n");
if(!$4) if(!$4)
parser_error("MenuEx must contain items\n"); yyerror("MenuEx must contain items");
$$ = new_menuex(); $$ = new_menuex();
if($2) if($2)
{ {
@ -1432,7 +1432,7 @@ stringtable
: stt_head tBEGIN strings tEND { : stt_head tBEGIN strings tEND {
if(!$3) if(!$3)
{ {
parser_error("Stringtable must have at least one entry\n"); yyerror("Stringtable must have at least one entry");
} }
else else
{ {
@ -1482,12 +1482,12 @@ strings : /* Empty */ { $$ = NULL; }
int i; int i;
assert(tagstt != NULL); assert(tagstt != NULL);
if($2 > 65535 || $2 < -32768) if($2 > 65535 || $2 < -32768)
parser_error("Stringtable entry's ID out of range (%d)\n", $2); yyerror("Stringtable entry's ID out of range (%d)", $2);
/* Search for the ID */ /* Search for the ID */
for(i = 0; i < tagstt->nentries; i++) for(i = 0; i < tagstt->nentries; i++)
{ {
if(tagstt->entries[i].id == $2) if(tagstt->entries[i].id == $2)
parser_error("Stringtable ID %d already in use\n", $2); yyerror("Stringtable ID %d already in use", $2);
} }
/* If we get here, then we have a new unique entry */ /* If we get here, then we have a new unique entry */
tagstt->nentries++; tagstt->nentries++;
@ -1504,9 +1504,9 @@ strings : /* Empty */ { $$ = NULL; }
if(pedantic && !$4->size) if(pedantic && !$4->size)
parser_warning("Zero length strings make no sense\n"); parser_warning("Zero length strings make no sense\n");
if(!win32 && $4->size > 254) if(!win32 && $4->size > 254)
parser_error("Stringtable entry more than 254 characters\n"); yyerror("Stringtable entry more than 254 characters");
if(win32 && $4->size > 65534) /* Hmm..., does this happen? */ if(win32 && $4->size > 65534) /* Hmm..., does this happen? */
parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)\n"); yyerror("Stringtable entry more than 65534 characters (probably something else that went wrong)");
$$ = tagstt; $$ = tagstt;
} }
; ;
@ -1537,7 +1537,7 @@ fix_version
: /* Empty */ { $$ = new_versioninfo(); } : /* Empty */ { $$ = new_versioninfo(); }
| fix_version tFILEVERSION expr ',' expr ',' expr ',' expr { | fix_version tFILEVERSION expr ',' expr ',' expr ',' expr {
if($1->gotit.fv) if($1->gotit.fv)
parser_error("FILEVERSION already defined\n"); yyerror("FILEVERSION already defined");
$$ = $1; $$ = $1;
$$->filever_maj1 = $3; $$->filever_maj1 = $3;
$$->filever_maj2 = $5; $$->filever_maj2 = $5;
@ -1547,7 +1547,7 @@ fix_version
} }
| fix_version tPRODUCTVERSION expr ',' expr ',' expr ',' expr { | fix_version tPRODUCTVERSION expr ',' expr ',' expr ',' expr {
if($1->gotit.pv) if($1->gotit.pv)
parser_error("PRODUCTVERSION already defined\n"); yyerror("PRODUCTVERSION already defined");
$$ = $1; $$ = $1;
$$->prodver_maj1 = $3; $$->prodver_maj1 = $3;
$$->prodver_maj2 = $5; $$->prodver_maj2 = $5;
@ -1557,35 +1557,35 @@ fix_version
} }
| fix_version tFILEFLAGS expr { | fix_version tFILEFLAGS expr {
if($1->gotit.ff) if($1->gotit.ff)
parser_error("FILEFLAGS already defined\n"); yyerror("FILEFLAGS already defined");
$$ = $1; $$ = $1;
$$->fileflags = $3; $$->fileflags = $3;
$$->gotit.ff = 1; $$->gotit.ff = 1;
} }
| fix_version tFILEFLAGSMASK expr { | fix_version tFILEFLAGSMASK expr {
if($1->gotit.ffm) if($1->gotit.ffm)
parser_error("FILEFLAGSMASK already defined\n"); yyerror("FILEFLAGSMASK already defined");
$$ = $1; $$ = $1;
$$->fileflagsmask = $3; $$->fileflagsmask = $3;
$$->gotit.ffm = 1; $$->gotit.ffm = 1;
} }
| fix_version tFILEOS expr { | fix_version tFILEOS expr {
if($1->gotit.fo) if($1->gotit.fo)
parser_error("FILEOS already defined\n"); yyerror("FILEOS already defined");
$$ = $1; $$ = $1;
$$->fileos = $3; $$->fileos = $3;
$$->gotit.fo = 1; $$->gotit.fo = 1;
} }
| fix_version tFILETYPE expr { | fix_version tFILETYPE expr {
if($1->gotit.ft) if($1->gotit.ft)
parser_error("FILETYPE already defined\n"); yyerror("FILETYPE already defined");
$$ = $1; $$ = $1;
$$->filetype = $3; $$->filetype = $3;
$$->gotit.ft = 1; $$->gotit.ft = 1;
} }
| fix_version tFILESUBTYPE expr { | fix_version tFILESUBTYPE expr {
if($1->gotit.fst) if($1->gotit.fst)
parser_error("FILESUBTYPE already defined\n"); yyerror("FILESUBTYPE already defined");
$$ = $1; $$ = $1;
$$->filesubtype = $3; $$->filesubtype = $3;
$$->gotit.fst = 1; $$->gotit.fst = 1;
@ -1730,7 +1730,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
if(!win32) if(!win32)
parser_warning("LANGUAGE not supported in 16-bit mode\n"); parser_warning("LANGUAGE not supported in 16-bit mode\n");
if($1->language) if($1->language)
parser_error("Language already defined\n"); yyerror("Language already defined");
$$ = $1; $$ = $1;
$1->language = $2; $1->language = $2;
} }
@ -1738,7 +1738,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
if(!win32) if(!win32)
parser_warning("CHARACTERISTICS not supported in 16-bit mode\n"); parser_warning("CHARACTERISTICS not supported in 16-bit mode\n");
if($1->characts) if($1->characts)
parser_error("Characteristics already defined\n"); yyerror("Characteristics already defined");
$$ = $1; $$ = $1;
$1->characts = $2; $1->characts = $2;
} }
@ -1746,7 +1746,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
if(!win32) if(!win32)
parser_warning("VERSION not supported in 16-bit mode\n"); parser_warning("VERSION not supported in 16-bit mode\n");
if($1->version) if($1->version)
parser_error("Version already defined\n"); yyerror("Version already defined");
$$ = $1; $$ = $1;
$1->version = $2; $1->version = $2;
} }
@ -1762,7 +1762,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
opt_language opt_language
: tLANGUAGE expr ',' expr { $$ = new_language($2, $4); : tLANGUAGE expr ',' expr { $$ = new_language($2, $4);
if (get_language_codepage($2, $4) == -1) if (get_language_codepage($2, $4) == -1)
parser_error( "Language %04x is not supported\n", ($4<<10) + $2); yyerror( "Language %04x is not supported", ($4<<10) + $2);
} }
; ;
@ -1894,7 +1894,7 @@ static dialog_t *dialog_caption(string_t *s, dialog_t *dlg)
{ {
assert(dlg != NULL); assert(dlg != NULL);
if(dlg->title) if(dlg->title)
parser_error("Caption already defined\n"); yyerror("Caption already defined");
dlg->title = s; dlg->title = s;
return dlg; return dlg;
} }
@ -1903,7 +1903,7 @@ static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg)
{ {
assert(dlg != NULL); assert(dlg != NULL);
if(dlg->font) if(dlg->font)
parser_error("Font already defined\n"); yyerror("Font already defined");
dlg->font = f; dlg->font = f;
return dlg; return dlg;
} }
@ -1912,7 +1912,7 @@ static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg)
{ {
assert(dlg != NULL); assert(dlg != NULL);
if(dlg->dlgclass) if(dlg->dlgclass)
parser_error("Class already defined\n"); yyerror("Class already defined");
dlg->dlgclass = n; dlg->dlgclass = n;
return dlg; return dlg;
} }

View File

@ -71,6 +71,7 @@ int parser_error(const char *s, ...)
va_list ap; va_list ap;
va_start(ap, s); va_start(ap, s);
generic_msg(s, "Error", parser_text, ap); generic_msg(s, "Error", parser_text, ap);
fputc( '\n', stderr );
va_end(ap); va_end(ap);
exit(1); exit(1);
return 1; return 1;
@ -241,7 +242,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage)
int res; int res;
if (!codepage && str->type != type) if (!codepage && str->type != type)
parser_error( "Current language is Unicode only, cannot convert string\n" ); parser_error( "Current language is Unicode only, cannot convert string" );
if((str->type == str_char) && (type == str_unicode)) if((str->type == str_char) && (type == str_unicode))
{ {
@ -256,7 +257,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage)
res = wine_utf8_mbstowcs( MB_ERR_INVALID_CHARS, str->str.cstr, str->size, res = wine_utf8_mbstowcs( MB_ERR_INVALID_CHARS, str->str.cstr, str->size,
ret->str.wstr, ret->size ); ret->str.wstr, ret->size );
if (res == -2) if (res == -2)
parser_error( "Invalid character in string '%.*s' for codepage %u\n", parser_error( "Invalid character in string '%.*s' for codepage %u",
str->size, str->str.cstr, codepage ); str->size, str->str.cstr, codepage );
ret->str.wstr[ret->size] = 0; ret->str.wstr[ret->size] = 0;
} }