Commit 0a16b6b8 authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: parser_error must append a newline.

parent 247754fb
......@@ -327,7 +327,7 @@ static int convert_bitmap(char *data, int size)
type |= FL_SIZEBE | FL_OS2;
}
else
parser_error("Invalid bitmap format, bih->biSize = %d\n", bih->biSize);
parser_error("Invalid bitmap format, bih->biSize = %d", bih->biSize);
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)
swap = 1;
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;
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)
parser_error("Icon resource data corrupt\n");
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
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;
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)
parser_error("Cursor resource data corrupt\n");
parser_error("Cursor resource data corrupt");
cur->width = cde.width;
cur->height = cde.height;
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)
isswapped = 0;
else
parser_error("Animated %s has an invalid RIFF length\n", anistr);
parser_error("Animated %s has an invalid RIFF length", anistr);
switch(byteorder)
{
......@@ -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))
parser_error("Invalid messagetable, size too small\n");
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\n");
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 */
{
......@@ -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)))
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++)
{
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))
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 */
{
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)
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++)
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)))
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++)
{
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))
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 */
{
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)
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++)
wp[n] = BYTESWAP_WORD(wp[n]);
......
......@@ -330,10 +330,10 @@ static struct keyword *iskeyword(char *kw)
yy_pop_state();
lineno = (int)strtol(yytext, &cptr, 10);
if(!lineno)
parser_error("Malformed '#...' line-directive; invalid linenumber\n");
parser_error("Malformed '#...' line-directive; invalid linenumber");
fname = strchr(cptr, '"');
if(!fname)
parser_error("Malformed '#...' line-directive; missing filename\n");
parser_error("Malformed '#...' line-directive; missing filename");
fname++;
cptr = strchr(fname, '"');
if(!cptr)
......@@ -361,11 +361,11 @@ static struct keyword *iskeyword(char *kw)
current_codepage = strtol( p, NULL, 10 );
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;
}
}
<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
......@@ -429,7 +429,7 @@ L\" {
unsigned int result;
result = strtoul(yytext+1, 0, 8);
if ( result > 0xffff )
parser_error("Character constant out of range\n");
parser_error("Character constant out of range");
addwchar((WCHAR)result);
}
<tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */
......@@ -437,9 +437,9 @@ L\" {
result = strtoul(yytext+2, 0, 16);
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>\\a addwchar('\a');
<tklstr>\\b addwchar('\b');
......@@ -458,7 +458,7 @@ L\" {
while(*yptr) /* FIXME: codepage translation */
addwchar(*yptr++ & 0xff);
}
<tklstr>\n parser_error("Unterminated string\n");
<tklstr>\n parser_error("Unterminated string");
/*
* Normal string scanning
......@@ -474,7 +474,7 @@ L\" {
int result;
result = strtol(yytext+1, 0, 8);
if ( result > 0xff )
parser_error("Character constant out of range\n");
parser_error("Character constant out of range");
addcchar((char)result);
}
<tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
......@@ -482,9 +482,9 @@ L\" {
result = strtol(yytext+2, 0, 16);
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>\\a addcchar('\a');
<tkstr>\\b addcchar('\b');
......@@ -503,7 +503,7 @@ L\" {
<tkstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
<tkstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
<tkstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
<tkstr>\n parser_error("Unterminated string\n");
<tkstr>\n parser_error("Unterminated string");
/*
* Raw data scanning
......@@ -524,7 +524,7 @@ L\" {
}
<tkrcd>{ws}+ ; /* Ignore space */
<tkrcd>\n line_number++; char_number = 1;
<tkrcd>. parser_error("Malformed data-line\n");
<tkrcd>. parser_error("Malformed data-line");
/*
* 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) 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;
}
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 );
if (!check_unicode_conversion( str, str_w, current_codepage ))
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 );
return str_w;
}
......
......@@ -419,7 +419,7 @@ resources
&& rsc->lan->sub == head->lan->sub
&& !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;
}
......@@ -476,7 +476,7 @@ resource
if($$)
{
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->type = name_ord;
$$->name->name.i_name = $1;
......@@ -533,7 +533,7 @@ resource
parser_warning("LANGUAGE not supported in 16-bit mode\n");
free(currentlanguage);
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);
$$ = NULL;
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 {
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();
$$->type = name_ord;
$$->name.i_name = $1;
......@@ -776,7 +776,7 @@ accelerators
$$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
}
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);
if($3)
{
......@@ -1224,7 +1224,7 @@ opt_expr: /* Empty */ { $$ = NULL; }
/* ------------------------------ Menu ------------------------------ */
menu : tMENU loadmemopts opt_lvc menu_body {
if(!$4)
parser_error("Menu must contain items\n");
yyerror("Menu must contain items");
$$ = new_menu();
if($2)
{
......@@ -1298,7 +1298,7 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body {
if(!win32)
parser_warning("MENUEX not supported in 16-bit mode\n");
if(!$4)
parser_error("MenuEx must contain items\n");
yyerror("MenuEx must contain items");
$$ = new_menuex();
if($2)
{
......@@ -1432,7 +1432,7 @@ stringtable
: stt_head tBEGIN strings tEND {
if(!$3)
{
parser_error("Stringtable must have at least one entry\n");
yyerror("Stringtable must have at least one entry");
}
else
{
......@@ -1482,12 +1482,12 @@ strings : /* Empty */ { $$ = NULL; }
int i;
assert(tagstt != NULL);
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 */
for(i = 0; i < tagstt->nentries; i++)
{
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 */
tagstt->nentries++;
......@@ -1504,9 +1504,9 @@ strings : /* Empty */ { $$ = NULL; }
if(pedantic && !$4->size)
parser_warning("Zero length strings make no sense\n");
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? */
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;
}
;
......@@ -1537,7 +1537,7 @@ fix_version
: /* Empty */ { $$ = new_versioninfo(); }
| fix_version tFILEVERSION expr ',' expr ',' expr ',' expr {
if($1->gotit.fv)
parser_error("FILEVERSION already defined\n");
yyerror("FILEVERSION already defined");
$$ = $1;
$$->filever_maj1 = $3;
$$->filever_maj2 = $5;
......@@ -1547,7 +1547,7 @@ fix_version
}
| fix_version tPRODUCTVERSION expr ',' expr ',' expr ',' expr {
if($1->gotit.pv)
parser_error("PRODUCTVERSION already defined\n");
yyerror("PRODUCTVERSION already defined");
$$ = $1;
$$->prodver_maj1 = $3;
$$->prodver_maj2 = $5;
......@@ -1557,35 +1557,35 @@ fix_version
}
| fix_version tFILEFLAGS expr {
if($1->gotit.ff)
parser_error("FILEFLAGS already defined\n");
yyerror("FILEFLAGS already defined");
$$ = $1;
$$->fileflags = $3;
$$->gotit.ff = 1;
}
| fix_version tFILEFLAGSMASK expr {
if($1->gotit.ffm)
parser_error("FILEFLAGSMASK already defined\n");
yyerror("FILEFLAGSMASK already defined");
$$ = $1;
$$->fileflagsmask = $3;
$$->gotit.ffm = 1;
}
| fix_version tFILEOS expr {
if($1->gotit.fo)
parser_error("FILEOS already defined\n");
yyerror("FILEOS already defined");
$$ = $1;
$$->fileos = $3;
$$->gotit.fo = 1;
}
| fix_version tFILETYPE expr {
if($1->gotit.ft)
parser_error("FILETYPE already defined\n");
yyerror("FILETYPE already defined");
$$ = $1;
$$->filetype = $3;
$$->gotit.ft = 1;
}
| fix_version tFILESUBTYPE expr {
if($1->gotit.fst)
parser_error("FILESUBTYPE already defined\n");
yyerror("FILESUBTYPE already defined");
$$ = $1;
$$->filesubtype = $3;
$$->gotit.fst = 1;
......@@ -1730,7 +1730,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
if(!win32)
parser_warning("LANGUAGE not supported in 16-bit mode\n");
if($1->language)
parser_error("Language already defined\n");
yyerror("Language already defined");
$$ = $1;
$1->language = $2;
}
......@@ -1738,7 +1738,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
if(!win32)
parser_warning("CHARACTERISTICS not supported in 16-bit mode\n");
if($1->characts)
parser_error("Characteristics already defined\n");
yyerror("Characteristics already defined");
$$ = $1;
$1->characts = $2;
}
......@@ -1746,7 +1746,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
if(!win32)
parser_warning("VERSION not supported in 16-bit mode\n");
if($1->version)
parser_error("Version already defined\n");
yyerror("Version already defined");
$$ = $1;
$1->version = $2;
}
......@@ -1762,7 +1762,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
opt_language
: tLANGUAGE expr ',' expr { $$ = new_language($2, $4);
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);
if(dlg->title)
parser_error("Caption already defined\n");
yyerror("Caption already defined");
dlg->title = s;
return dlg;
}
......@@ -1903,7 +1903,7 @@ static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg)
{
assert(dlg != NULL);
if(dlg->font)
parser_error("Font already defined\n");
yyerror("Font already defined");
dlg->font = f;
return dlg;
}
......@@ -1912,7 +1912,7 @@ static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg)
{
assert(dlg != NULL);
if(dlg->dlgclass)
parser_error("Class already defined\n");
yyerror("Class already defined");
dlg->dlgclass = n;
return dlg;
}
......
......@@ -71,6 +71,7 @@ int parser_error(const char *s, ...)
va_list ap;
va_start(ap, s);
generic_msg(s, "Error", parser_text, ap);
fputc( '\n', stderr );
va_end(ap);
exit(1);
return 1;
......@@ -241,7 +242,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage)
int res;
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))
{
......@@ -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,
ret->str.wstr, ret->size );
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 );
ret->str.wstr[ret->size] = 0;
}
......
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