wrc: Modify the error, warning and tracing functions to behave like all the other Wine tracing methods, that is to not append a '\n' to the message.

This commit is contained in:
Francois Gouget 2007-10-18 17:11:52 +02:00 committed by Alexandre Julliard
parent 22076e09ca
commit 7e92283678
8 changed files with 132 additions and 137 deletions

View File

@ -272,7 +272,7 @@ static void string_to_upper(string_t *str)
}
else
{
internal_error(__FILE__, __LINE__, "Invalid string type %d", str->type);
internal_error(__FILE__, __LINE__, "Invalid string type %d\n", str->type);
}
}
@ -313,7 +313,7 @@ static void put_string(res_t *res, const string_t *str, enum str_e type, int ist
{
if (!check_unicode_conversion( str, newstr, codepage ))
error( "String %s does not convert identically to Unicode and back in codepage %d. "
"Try using a Unicode string instead.", str->str.cstr, codepage );
"Try using a Unicode string instead\n", str->str.cstr, codepage );
}
if (!isterm) put_word(res, newstr->size);
for(cnt = 0; cnt < newstr->size; cnt++)
@ -366,7 +366,7 @@ static void put_name_id(res_t *res, name_id_t *nid, int upcase, const language_t
}
else
{
internal_error(__FILE__, __LINE__, "Invalid name_id type %d", nid->type);
internal_error(__FILE__, __LINE__, "Invalid name_id type %d\n", nid->type);
}
}
@ -597,7 +597,7 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg)
if(ctrl->ctlclass)
put_name_id(res, ctrl->ctlclass, TRUE, dlg->lvc.language);
else
internal_error(__FILE__, __LINE__, "Control has no control-class");
internal_error(__FILE__, __LINE__, "Control has no control-class\n");
if(ctrl->title)
put_name_id(res, ctrl->title, FALSE, dlg->lvc.language);
else
@ -665,10 +665,10 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg)
else if(ctrl->ctlclass->type == name_str)
put_name_id(res, ctrl->ctlclass, FALSE, NULL);
else
error("Unknown control-class %04x", ctrl->ctlclass->name.i_name);
error("Unknown control-class %04x\n", ctrl->ctlclass->name.i_name);
}
else
internal_error(__FILE__, __LINE__, "Control has no control-class");
internal_error(__FILE__, __LINE__, "Control has no control-class\n");
if(ctrl->title)
put_name_id(res, ctrl->title, FALSE, NULL);
else
@ -772,7 +772,7 @@ static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex)
if(ctrl->ctlclass)
put_name_id(res, ctrl->ctlclass, TRUE, dlgex->lvc.language);
else
internal_error(__FILE__, __LINE__, "Control has no control-class");
internal_error(__FILE__, __LINE__, "Control has no control-class\n");
if(ctrl->title)
put_name_id(res, ctrl->title, FALSE, dlgex->lvc.language);
else
@ -1454,7 +1454,7 @@ static res_t *stringtable2res(stringtable_t *stt)
{
if(!stt->nentries)
{
warning("Empty internal stringtable");
warning("Empty internal stringtable\n");
continue;
}
name.type = name_ord;
@ -1591,7 +1591,7 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang
}
else
{
internal_error(__FILE__, __LINE__, "Invalid value indicator %d in VERSIONINFO", val->type);
internal_error(__FILE__, __LINE__, "Invalid value indicator %d in VERSIONINFO\n", val->type);
}
}
@ -1794,7 +1794,7 @@ char *prep_nid_for_label(const name_id_t *nid)
if((unsigned)*sptr < 0x80 && isprint(*sptr & 0xff))
buf[i] = *sptr++;
else
warning("Resourcename (str_unicode) contain unprintable characters or invalid translation, ignored");
warning("Resourcename (str_unicode) contain unprintable characters or invalid translation, ignored\n");
}
buf[i] = '\0';
}
@ -1809,7 +1809,7 @@ char *prep_nid_for_label(const name_id_t *nid)
if((unsigned)*cptr < 0x80 && isprint(*cptr & 0xff))
buf[i] = *cptr++;
else
warning("Resourcename (str_char) contain unprintable characters, ignored");
warning("Resourcename (str_char) contain unprintable characters, ignored\n");
}
buf[i] = '\0';
}
@ -1819,7 +1819,7 @@ char *prep_nid_for_label(const name_id_t *nid)
}
else
{
internal_error(__FILE__, __LINE__, "Resource name_id with invalid type %d", nid->type);
internal_error(__FILE__, __LINE__, "Resource name_id with invalid type %d\n", nid->type);
}
return buf;
}
@ -2000,7 +2000,7 @@ void resources2res(resource_t *top)
top->binres = anicurico2res(top->name, top->res.ani, top->type);
break;
default:
internal_error(__FILE__, __LINE__, "Unknown resource type encountered %d in binary res generation", top->type);
internal_error(__FILE__, __LINE__, "Unknown resource type encountered %d in binary res generation\n", top->type);
}
top->c_name = make_c_name(get_c_typename(top->type), top->name, top->lan);
top = top->next;

View File

@ -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", bih->biSize);
parser_error("Invalid bitmap format, bih->biSize = %d\n", 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:
parser_warning("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\n", type & FL_V4 ? '4' : '3');
break;
case FL_SIGBE:
case FL_SIGBE | FL_V4:
case FL_SIGBE | FL_OS2:
parser_warning("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\n", 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
parser_error("Icon resource data has invalid type id %d", ih->type);
parser_error("Icon resource data has invalid type id %d\n", 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");
parser_error("Icon resource data corrupt\n");
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", ch->type);
parser_error("Cursor resource data has invalid type id %d\n", 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");
parser_error("Cursor resource data corrupt\n");
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))
parser_warning("Win16 cursor contains colors");
parser_warning("Win16 cursor contains colors\n");
cur->xhot = swap ? BYTESWAP_WORD(cde.xhot) : cde.xhot;
cur->yhot = swap ? BYTESWAP_WORD(cde.yhot) : cde.yhot;
cur->data = new_raw_data();
@ -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", anistr);
parser_error("Animated %s has an invalid RIFF length\n", 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");
parser_error("Invalid messagetable, size too small\n");
nblk = *(DWORD *)rd->data;
lo = WRC_LOWORD(nblk);
@ -1017,9 +1017,9 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
* the ID, offset and length (and flag) fields to be very sure.
*/
if(hi && lo)
internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian");
internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian\n");
if(!hi && !lo)
parser_error("Invalid messagetable block count 0");
parser_error("Invalid messagetable block count 0\n");
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");
parser_error("Messagetable's blocks are outside of defined data\n");
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", i, id);
parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data\n", 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)", id, i, mep->length);
parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)\n", 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");
parser_error("Messagetable's blocks are outside of defined data\n");
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", i, id);
parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data\n", 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)", id, i, mep->length);
parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)\n", id, i, mep->length);
for(n = 0; n < l; n++)
wp[n] = BYTESWAP_WORD(wp[n]);

View File

@ -324,10 +324,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");
parser_error("Malformed '#...' line-directive; invalid linenumber\n");
fname = strchr(cptr, '"');
if(!fname)
parser_error("Malformed '#...' line-directive; missing filename");
parser_error("Malformed '#...' line-directive; missing filename\n");
fname++;
cptr = strchr(fname, '"');
if(!cptr)
@ -344,7 +344,7 @@ static struct keyword *iskeyword(char *kw)
}
<pp_pragma>code_page[^\n]* yyless(9); yy_pop_state(); yy_push_state(pp_code_page);
<pp_pragma>[^\n]* yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'",yytext);
<pp_pragma>[^\n]* yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'\n",yytext);
<pp_code_page>\({ws}*default{ws}*\)[^\n]* current_codepage = -1; yy_pop_state();
<pp_code_page>\({ws}*utf8{ws}*\)[^\n]* current_codepage = CP_UTF8; yy_pop_state();
@ -355,11 +355,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", current_codepage);
parser_error("Codepage %d not supported\n", current_codepage);
current_codepage = 0;
}
}
<pp_code_page>[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive");
<pp_code_page>[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive\n");
/*
* Strip everything until a ';' taking
@ -423,7 +423,7 @@ L\" {
unsigned int result;
result = strtoul(yytext+1, 0, 8);
if ( result > 0xffff )
parser_error("Character constant out of range");
parser_error("Character constant out of range\n");
addwchar((WCHAR)result);
}
<tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */
@ -431,9 +431,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'", yytext); }
<tklstr>\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'\n", yytext); }
<tklstr>\\[0-9]+ parser_error("Bad escape sequence");
<tklstr>\\[0-9]+ parser_error("Bad escape sequence\n");
<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');
@ -452,7 +452,7 @@ L\" {
while(*yptr) /* FIXME: codepage translation */
addwchar(*yptr++ & 0xff);
}
<tklstr>\n parser_error("Unterminated string");
<tklstr>\n parser_error("Unterminated string\n");
/*
* Normal string scanning
@ -468,7 +468,7 @@ L\" {
int result;
result = strtol(yytext+1, 0, 8);
if ( result > 0xff )
parser_error("Character constant out of range");
parser_error("Character constant out of range\n");
addcchar((char)result);
}
<tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
@ -476,9 +476,9 @@ L\" {
result = strtol(yytext+2, 0, 16);
addcchar((char)result);
}
<tkstr>\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'", yytext); }
<tkstr>\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'\n", yytext); }
<tkstr>\\[0-9]+ parser_error("Bad escape sequence");
<tkstr>\\[0-9]+ parser_error("Bad escape sequence\n");
<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');
@ -497,7 +497,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");
<tkstr>\n parser_error("Unterminated string\n");
/*
* Raw data scanning
@ -518,7 +518,7 @@ L\" {
}
<tkrcd>{ws}+ ; /* Ignore space */
<tkrcd>\n line_number++; char_number = 1;
<tkrcd>. parser_error("Malformed data-line");
<tkrcd>. parser_error("Malformed data-line\n");
/*
* Comment stripping
@ -528,7 +528,7 @@ L\" {
yy_push_state(comment);
save_wanted_id = wanted_id;
if(!no_preprocess)
parser_warning("Found comments after preprocessing, please report");
parser_warning("Found comments after preprocessing, please report\n");
}
<comment>[^*\n]* ;
<comment>"*"+[^*/\n]* ;
@ -536,7 +536,7 @@ L\" {
<comment>"*"+"/" yy_pop_state(); want_id = save_wanted_id;
;[^\n]* want_id = wanted_id; /* not really comment, but left-over c-junk */
"//"[^\n]* want_id = wanted_id; if(!no_preprocess) parser_warning("Found comments after preprocessing, please report");
"//"[^\n]* want_id = wanted_id; if(!no_preprocess) parser_warning("Found comments after preprocessing, please report\n");
\n {
want_id = wanted_id;
@ -559,7 +559,7 @@ L\" {
line_number++;
char_number = 1;
}
parser_warning("Unmatched text '%c' (0x%02x) YY_START=%d",
parser_warning("Unmatched text '%c' (0x%02x) YY_START=%d\n",
isprint(*yytext & 0xff) ? *yytext : '.', *yytext, YY_START);
}
@ -575,7 +575,7 @@ static void addcchar(char c)
cbufalloc += 1024;
cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
if(cbufalloc > 65536)
parser_warning("Reallocating string buffer larger than 64kB");
parser_warning("Reallocating string buffer larger than 64kB\n");
}
cbuffer[cbufidx++] = c;
}
@ -587,7 +587,7 @@ static void addwchar(WCHAR s)
wbufalloc += 1024;
wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0]));
if(wbufalloc > 65536)
parser_warning("Reallocating wide string buffer larger than 64kB");
parser_warning("Reallocating wide string buffer larger than 64kB\n");
}
wbuffer[wbufidx++] = s;
}
@ -604,7 +604,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");
if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here\n");
return str;
}
else /* convert to Unicode before storing */
@ -612,7 +612,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.", str->str.cstr, current_codepage );
"Try using a Unicode string instead\n", str->str.cstr, current_codepage );
free_string( str );
return str_w;
}

View File

@ -419,7 +419,7 @@ resources
&& rsc->lan->sub == head->lan->sub
&& !compare_name_id(rsc->name, head->name))
{
parser_error("Duplicate resource name '%s'", get_nameid_str(rsc->name));
parser_error("Duplicate resource name '%s'\n", get_nameid_str(rsc->name));
}
rsc = rsc->prev;
}
@ -476,11 +476,11 @@ resource
if($$)
{
if($1 > 65535 || $1 < -32768)
parser_error("Resource's ID out of range (%d)", $1);
parser_error("Resource's ID out of range (%d)\n", $1);
$$->name = new_name_id();
$$->name->type = name_ord;
$$->name->name.i_name = $1;
chat("Got %s (%d)", get_typename($3), $$->name->name.i_name);
chat("Got %s (%d)\n", get_typename($3), $$->name->name.i_name);
}
}
| tIDENT usrcvt resource_definition {
@ -490,7 +490,7 @@ resource
$$->name = new_name_id();
$$->name->type = name_str;
$$->name->name.s_name = $1;
chat("Got %s (%s)", get_typename($3), $$->name->name.s_name->str.cstr);
chat("Got %s (%s)\n", get_typename($3), $$->name->name.s_name->str.cstr);
}
}
| stringtable {
@ -499,7 +499,7 @@ resource
* the final rule of the parser is reduced (see above)
*/
$$ = NULL;
chat("Got STRINGTABLE");
chat("Got STRINGTABLE\n");
}
| tLANGUAGE {want_nl = 1; } expr ',' expr {
/* We *NEED* the newline to delimit the expression.
@ -525,18 +525,18 @@ resource
yychar = YYEMPTY; /* Could use 'yyclearin', but we already need the*/
/* direct access to yychar in rule 'usrcvt' below. */
else if(yychar == tIDENT)
parser_warning("LANGUAGE statement not delimited with newline; next identifier might be wrong");
parser_warning("LANGUAGE statement not delimited with newline; next identifier might be wrong\n");
want_nl = 0; /* We don't want it anymore if we didn't get it */
if(!win32)
parser_warning("LANGUAGE not supported in 16-bit mode");
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", ($5<<10) + $3);
parser_error( "Language %04x is not supported\n", ($5<<10) + $3);
currentlanguage = new_language($3, $5);
$$ = NULL;
chat("Got LANGUAGE %d,%d (0x%04x)", $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 {
if($1 > 65535 || $1 < -32768)
parser_error("Resource's ID out of range (%d)", $1);
parser_error("Resource's ID out of range (%d)\n", $1);
$$ = new_name_id();
$$->type = name_ord;
$$->name.i_name = $1;
@ -600,7 +600,7 @@ resource_definition
}
}
else
internal_error(__FILE__, __LINE__, "Invalid top-level type %d in cursor resource", $1->type);
internal_error(__FILE__, __LINE__, "Invalid top-level type %d in cursor resource\n", $1->type);
free($1);
}
| dialog { $$ = new_resource(res_dlg, $1, $1->memopt, $1->lvc.language); }
@ -634,7 +634,7 @@ resource_definition
}
}
else
internal_error(__FILE__, __LINE__, "Invalid top-level type %d in icon resource", $1->type);
internal_error(__FILE__, __LINE__, "Invalid top-level type %d in icon resource\n", $1->type);
free($1);
}
| menu { $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language); }
@ -721,7 +721,7 @@ fontdir : tFONTDIR loadmemopts file_raw { $$ = new_fontdir($3, $2); }
messagetable
: tMESSAGETABLE loadmemopts file_raw {
if(!win32)
parser_warning("MESSAGETABLE not supported in 16-bit mode");
parser_warning("MESSAGETABLE not supported in 16-bit mode\n");
$$ = new_messagetable($3, $2);
}
;
@ -745,7 +745,7 @@ userres : usertype loadmemopts file_raw {
#else
if(pedantic && byteorder == WRC_BO_BIG)
#endif
parser_warning("Byteordering is not little-endian and type cannot be interpreted");
parser_warning("Byteordering is not little-endian and type cannot be interpreted\n");
$$ = new_user($1, $3, $2);
}
;
@ -776,7 +776,7 @@ accelerators
$$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
}
if(!$5)
parser_error("Accelerator table must have at least one entry");
parser_error("Accelerator table must have at least one entry\n");
$$->events = get_event_head($5);
if($3)
{
@ -1027,7 +1027,7 @@ ctlclass
dialogex: tDIALOGEX loadmemopts expr ',' expr ',' expr ',' expr helpid dlgex_attribs
tBEGIN exctrls tEND {
if(!win32)
parser_warning("DIALOGEX not supported in 16-bit mode");
parser_warning("DIALOGEX not supported in 16-bit mode\n");
if($2)
{
$11->memopt = *($2);
@ -1224,7 +1224,7 @@ opt_expr: /* Empty */ { $$ = NULL; }
/* ------------------------------ Menu ------------------------------ */
menu : tMENU loadmemopts opt_lvc menu_body {
if(!$4)
parser_error("Menu must contain items");
parser_error("Menu must contain items\n");
$$ = new_menu();
if($2)
{
@ -1296,9 +1296,9 @@ item_options
/* ------------------------------ MenuEx ------------------------------ */
menuex : tMENUEX loadmemopts opt_lvc menuex_body {
if(!win32)
parser_warning("MENUEX not supported in 16-bit mode");
parser_warning("MENUEX not supported in 16-bit mode\n");
if(!$4)
parser_error("MenuEx must contain items");
parser_error("MenuEx must contain items\n");
$$ = 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");
parser_error("Stringtable must have at least one entry\n");
}
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)", $2);
parser_error("Stringtable entry's ID out of range (%d)\n", $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", $2);
parser_error("Stringtable ID %d already in use\n", $2);
}
/* If we get here, then we have a new unique entry */
tagstt->nentries++;
@ -1502,11 +1502,11 @@ strings : /* Empty */ { $$ = NULL; }
tagstt->entries[tagstt->nentries-1].characts = tagstt_characts;
if(pedantic && !$4->size)
parser_warning("Zero length strings make no sense");
parser_warning("Zero length strings make no sense\n");
if(!win32 && $4->size > 254)
parser_error("Stringtable entry more than 254 characters");
parser_error("Stringtable entry more than 254 characters\n");
if(win32 && $4->size > 65534) /* Hmm..., does this happen? */
parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)");
parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)\n");
$$ = 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");
parser_error("FILEVERSION already defined\n");
$$ = $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");
parser_error("PRODUCTVERSION already defined\n");
$$ = $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");
parser_error("FILEFLAGS already defined\n");
$$ = $1;
$$->fileflags = $3;
$$->gotit.ff = 1;
}
| fix_version tFILEFLAGSMASK expr {
if($1->gotit.ffm)
parser_error("FILEFLAGSMASK already defined");
parser_error("FILEFLAGSMASK already defined\n");
$$ = $1;
$$->fileflagsmask = $3;
$$->gotit.ffm = 1;
}
| fix_version tFILEOS expr {
if($1->gotit.fo)
parser_error("FILEOS already defined");
parser_error("FILEOS already defined\n");
$$ = $1;
$$->fileos = $3;
$$->gotit.fo = 1;
}
| fix_version tFILETYPE expr {
if($1->gotit.ft)
parser_error("FILETYPE already defined");
parser_error("FILETYPE already defined\n");
$$ = $1;
$$->filetype = $3;
$$->gotit.ft = 1;
}
| fix_version tFILESUBTYPE expr {
if($1->gotit.fst)
parser_error("FILESUBTYPE already defined");
parser_error("FILESUBTYPE already defined\n");
$$ = $1;
$$->filesubtype = $3;
$$->gotit.fst = 1;
@ -1728,25 +1728,25 @@ lama : tLOADONCALL { $$ = new_int(~WRC_MO_PRELOAD); }
opt_lvc : /* Empty */ { $$ = new_lvc(); }
| opt_lvc opt_language {
if(!win32)
parser_warning("LANGUAGE not supported in 16-bit mode");
parser_warning("LANGUAGE not supported in 16-bit mode\n");
if($1->language)
parser_error("Language already defined");
parser_error("Language already defined\n");
$$ = $1;
$1->language = $2;
}
| opt_lvc opt_characts {
if(!win32)
parser_warning("CHARACTERISTICS not supported in 16-bit mode");
parser_warning("CHARACTERISTICS not supported in 16-bit mode\n");
if($1->characts)
parser_error("Characteristics already defined");
parser_error("Characteristics already defined\n");
$$ = $1;
$1->characts = $2;
}
| opt_lvc opt_version {
if(!win32)
parser_warning("VERSION not supported in 16-bit mode");
parser_warning("VERSION not supported in 16-bit mode\n");
if($1->version)
parser_error("Version already defined");
parser_error("Version already defined\n");
$$ = $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", ($4<<10) + $2);
parser_error( "Language %04x is not supported\n", ($4<<10) + $2);
}
;
@ -1852,7 +1852,7 @@ static dialog_t *dialog_style(style_t * st, dialog_t *dlg)
if(dlg->gotstyle)
{
parser_warning("Style already defined, or-ing together");
parser_warning("Style already defined, or-ing together\n");
}
else
{
@ -1876,7 +1876,7 @@ static dialog_t *dialog_exstyle(style_t *st, dialog_t *dlg)
if(dlg->gotexstyle)
{
parser_warning("ExStyle already defined, or-ing together");
parser_warning("ExStyle already defined, or-ing together\n");
}
else
{
@ -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");
parser_error("Caption already defined\n");
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");
parser_error("Font already defined\n");
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");
parser_error("Class already defined\n");
dlg->dlgclass = n;
return dlg;
}
@ -2024,7 +2024,7 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control
defaultstyle |= WS_TABSTOP;
break;
default:
parser_warning("Unknown default button control-style 0x%08x", special_style);
parser_warning("Unknown default button control-style 0x%08x\n", special_style);
case BS_GROUPBOX:
case BS_RADIOBUTTON:
break;
@ -2042,7 +2042,7 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control
case SS_ICON: /* Special case */
break;
default:
parser_warning("Unknown default static control-style 0x%08x", special_style);
parser_warning("Unknown default static control-style 0x%08x\n", special_style);
break;
}
break;
@ -2127,7 +2127,7 @@ static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg)
if(dlg->gotstyle)
{
parser_warning("Style already defined, or-ing together");
parser_warning("Style already defined, or-ing together\n");
}
else
{
@ -2151,7 +2151,7 @@ static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg)
if(dlg->gotexstyle)
{
parser_warning("ExStyle already defined, or-ing together");
parser_warning("ExStyle already defined, or-ing together\n");
}
else
{
@ -2422,7 +2422,7 @@ static raw_data_t *str2raw_data(string_t *str)
}
}
else
internal_error(__FILE__, __LINE__, "Invalid stringtype");
internal_error(__FILE__, __LINE__, "Invalid stringtype\n");
return rd;
}
@ -2547,12 +2547,12 @@ static stringtable_t *find_stringtable(lvc_t *lvc)
if((stt->lvc.version && lvc->version && *(stt->lvc.version) != *(lvc->version))
|| (!stt->lvc.version && lvc->version)
|| (stt->lvc.version && !lvc->version))
parser_warning("Stringtable's versions are not the same, using first definition");
parser_warning("Stringtable's versions are not the same, using first definition\n");
if((stt->lvc.characts && lvc->characts && *(stt->lvc.characts) != *(lvc->characts))
|| (!stt->lvc.characts && lvc->characts)
|| (stt->lvc.characts && !lvc->characts))
parser_warning("Stringtable's characteristics are not the same, using first definition");
parser_warning("Stringtable's characteristics are not the same, using first definition\n");
*/
return stt;
}
@ -2629,7 +2629,7 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
}
if(andsum != orsum)
{
warning("Stringtable's memory options are not equal (idbase: %d)", newstt->idbase);
warning("Stringtable's memory options are not equal (idbase: %d)\n", newstt->idbase);
}
/* Check version and characteristics */
for(j = 0; j < 16; j++)
@ -2637,11 +2637,11 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
if(characts
&& newstt->entries[j].characts
&& *newstt->entries[j].characts != *characts)
warning("Stringtable's characteristics are not the same (idbase: %d)", newstt->idbase);
warning("Stringtable's characteristics are not the same (idbase: %d)\n", newstt->idbase);
if(version
&& newstt->entries[j].version
&& *newstt->entries[j].version != *version)
warning("Stringtable's versions are not the same (idbase: %d)", newstt->idbase);
warning("Stringtable's versions are not the same (idbase: %d)\n", newstt->idbase);
}
rsc = new_resource(res_stt, newstt, newstt->memopt, newstt->lvc.language);
rsc->name = new_name_id();
@ -2755,7 +2755,7 @@ static resource_t *build_fontdir(resource_t **fnt, int nfnt)
static int once = 0;
if(!once)
{
warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)", fnt, nfnt);
warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)\n", fnt, nfnt);
once++;
}
return NULL;
@ -2804,7 +2804,7 @@ static resource_t *build_fontdirs(resource_t *tail)
{
if(compare_name_id(&nid, fnd[i]->name))
{
warning("User supplied FONTDIR entry has an invalid name '%s', ignored",
warning("User supplied FONTDIR entry has an invalid name '%s', ignored\n",
get_nameid_str(fnd[i]->name));
fnd[i] = NULL;
}
@ -2814,7 +2814,7 @@ static resource_t *build_fontdirs(resource_t *tail)
if(nfnt == 0)
{
if(nfnd != 0)
warning("Found %d FONTDIR entries without any fonts present", nfnd);
warning("Found %d FONTDIR entries without any fonts present\n", nfnd);
goto clean;
}
@ -2849,7 +2849,7 @@ static resource_t *build_fontdirs(resource_t *tail)
else if(nlanfnt == BYTESWAP_WORD(cnt))
isswapped = 1;
else
error("FONTDIR for language %d,%d has wrong count (%d, expected %d)",
error("FONTDIR for language %d,%d has wrong count (%d, expected %d)\n",
fnd[i]->lan->id, fnd[i]->lan->sub, cnt, nlanfnt);
#ifdef WORDS_BIGENDIAN
if((byteorder == WRC_BO_LITTLE && !isswapped) || (byteorder != WRC_BO_LITTLE && isswapped))
@ -2857,7 +2857,7 @@ static resource_t *build_fontdirs(resource_t *tail)
if((byteorder == WRC_BO_BIG && !isswapped) || (byteorder != WRC_BO_BIG && isswapped))
#endif
{
internal_error(__FILE__, __LINE__, "User supplied FONTDIR needs byteswapping");
internal_error(__FILE__, __LINE__, "User supplied FONTDIR needs byteswapping\n");
}
}
@ -3020,13 +3020,13 @@ static int rsrcid_to_token(int lookahead)
case WRC_RT_ANIICON:
case WRC_RT_GROUP_CURSOR:
case WRC_RT_GROUP_ICON:
parser_warning("Usertype uses reserved type ID %d, which is auto-generated", yylval.num);
parser_warning("Usertype uses reserved type ID %d, which is auto-generated\n", yylval.num);
return lookahead;
case WRC_RT_DLGINCLUDE:
case WRC_RT_PLUGPLAY:
case WRC_RT_VXD:
parser_warning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num);
parser_warning("Usertype uses reserved type ID %d, which is not supported by wrc yet\n", yylval.num);
default:
return lookahead;
}

View File

@ -106,7 +106,7 @@ static enum res_e res_type_from_id(const name_id_t *nid)
return res_usr;
if(nid->type != name_ord)
internal_error(__FILE__, __LINE__, "Invalid name_id descriptor %d", nid->type);
internal_error(__FILE__, __LINE__, "Invalid name_id descriptor %d\n", nid->type);
switch(nid->name.i_name)
{
@ -132,7 +132,7 @@ static enum res_e res_type_from_id(const name_id_t *nid)
case WRC_RT_VXD:
case WRC_RT_ANICURSOR:
case WRC_RT_ANIICON:
warning("Cannot be sure of resource type, using usertype settings");
warning("Cannot be sure of resource type, using usertype settings\n");
return res_usr;
}
}
@ -185,7 +185,7 @@ static resource_t *read_res32(FILE *fp)
totsize = hdrsize;
if(hdrsize & 3)
{
warning("Hu? .res header needed alignment (anything can happen now)");
warning("Hu? .res header needed alignment (anything can happen now)\n");
totsize += 4 - (hdrsize & 3);
}
totsize += ressize;
@ -217,7 +217,7 @@ static resource_t *read_res32(FILE *fp)
}
else if(get_word(idx) == 0)
{
error("ResType name has zero length (32 bit)");
error("ResType name has zero length (32 bit)\n");
}
else
{
@ -251,7 +251,7 @@ static resource_t *read_res32(FILE *fp)
}
else if(get_word(idx) == 0)
{
error("ResName name has zero length (32 bit)");
error("ResName name has zero length (32 bit)\n");
}
else
{
@ -328,7 +328,7 @@ static resource_t *read_res32(FILE *fp)
*/
static resource_t *read_res16(FILE *fp)
{
internal_error(__FILE__, __LINE__, "Can't yet read 16 bit .res files");
internal_error(__FILE__, __LINE__, "Can't yet read 16 bit .res files\n");
return NULL;
}
@ -351,7 +351,7 @@ resource_t *read_resfile(char *inname)
fp = fopen(inname, "rb");
if(!fp)
error("Could not open inputfile %s", inname);
error("Could not open inputfile %s\n", inname);
/* Determine 16 or 32 bit .res file */
if(fread(&rh, 1, sizeof(rh), fp) != sizeof(rh))
@ -361,16 +361,16 @@ resource_t *read_resfile(char *inname)
if(!memcmp(&emptyheader, &rh, sizeof(rh)))
is32bit = 1;
else if(!memcmp(&emptyheaderSWAPPED, &rh, sizeof(rh)))
error("Binary .res-file has its byteorder swapped");
error("Binary .res-file has its byteorder swapped\n");
else
is32bit = 0;
}
if(is32bit && !win32)
error("Cannot convert 32-bit .res-file into 16-bit resources (and will, hopefully never, implement it)");
error("Cannot convert 32-bit .res-file into 16-bit resources (and will, hopefully never, implement it)\n");
if(!is32bit && win32)
error("Cannot (yet) convert 16-bit .res-file into 32-bit resources");
error("Cannot (yet) convert 16-bit .res-file into 32-bit resources\n");
if(!is32bit)
{

View File

@ -64,7 +64,6 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
}
}
#endif
fprintf(stderr, "\n");
}
@ -93,7 +92,6 @@ void internal_error(const char *file, int line, const char *s, ...)
va_start(ap, s);
fprintf(stderr, "Internal error (please report) %s %d: ", file, line);
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
exit(3);
}
@ -104,7 +102,6 @@ void error(const char *s, ...)
va_start(ap, s);
fprintf(stderr, "Error: ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
exit(2);
}
@ -115,7 +112,6 @@ void warning(const char *s, ...)
va_start(ap, s);
fprintf(stderr, "Warning: ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
}
@ -127,7 +123,6 @@ void chat(const char *s, ...)
va_start(ap, s);
fprintf(stderr, "FYI: ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
}
}
@ -226,7 +221,7 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2)
}
else
{
internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type");
internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type\n");
}
}
else if(n1->type == name_ord && n2->type == name_str)
@ -234,7 +229,7 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2)
else if(n1->type == name_str && n2->type == name_ord)
return -1;
else
internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)",
internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)\n",
n1->type, n2->type);
return 0; /* Keep the compiler happy */
@ -247,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" );
parser_error( "Current language is Unicode only, cannot convert string\n" );
if((str->type == str_char) && (type == str_unicode))
{

View File

@ -451,7 +451,7 @@ int main(int argc,char *argv[])
* no output was given.
*/
chat("Starting preprocess");
chat("Starting preprocess\n");
if (!preprocess_only)
{
@ -484,7 +484,7 @@ int main(int argc,char *argv[])
}
/* Go from .rc to .res */
chat("Starting parse");
chat("Starting parse\n");
if(!(parser_in = fopen(input_name, "rb")))
error("Could not open %s for input\n", input_name);
@ -507,7 +507,7 @@ int main(int argc,char *argv[])
/* Convert the internal lists to binary data */
resources2res(resource_top);
chat("Writing .res-file");
chat("Writing .res-file\n");
write_resfile(output_name, resource_top);
output_name = NULL;

View File

@ -75,7 +75,7 @@ void write_resfile(char *outname, resource_t *top)
if(ret != res->size)
{
fclose(fo);
error("Error writing %s", outname);
error("Error writing %s\n", outname);
}
free(res);
}
@ -89,7 +89,7 @@ void write_resfile(char *outname, resource_t *top)
if(ret != top->binres->size)
{
fclose(fo);
error("Error writing %s", outname);
error("Error writing %s\n", outname);
}
if(win32 && (top->binres->size & 0x03))
{
@ -98,7 +98,7 @@ void write_resfile(char *outname, resource_t *top)
if(ret != 4 - (top->binres->size & 0x03))
{
fclose(fo);
error("Error writing %s", outname);
error("Error writing %s\n", outname);
}
}
}