Commit 7e922836 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

wrc: Modify the error, warning and tracing functions to behave like all the…

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.
parent 22076e09
...@@ -272,7 +272,7 @@ static void string_to_upper(string_t *str) ...@@ -272,7 +272,7 @@ static void string_to_upper(string_t *str)
} }
else 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 ...@@ -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 )) if (!check_unicode_conversion( str, newstr, codepage ))
error( "String %s does not convert identically to Unicode and back in codepage %d. " 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); if (!isterm) put_word(res, newstr->size);
for(cnt = 0; cnt < newstr->size; cnt++) 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 ...@@ -366,7 +366,7 @@ static void put_name_id(res_t *res, name_id_t *nid, int upcase, const language_t
} }
else 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) ...@@ -597,7 +597,7 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg)
if(ctrl->ctlclass) if(ctrl->ctlclass)
put_name_id(res, ctrl->ctlclass, TRUE, dlg->lvc.language); put_name_id(res, ctrl->ctlclass, TRUE, dlg->lvc.language);
else else
internal_error(__FILE__, __LINE__, "Control has no control-class"); internal_error(__FILE__, __LINE__, "Control has no control-class\n");
if(ctrl->title) if(ctrl->title)
put_name_id(res, ctrl->title, FALSE, dlg->lvc.language); put_name_id(res, ctrl->title, FALSE, dlg->lvc.language);
else else
...@@ -665,10 +665,10 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg) ...@@ -665,10 +665,10 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg)
else if(ctrl->ctlclass->type == name_str) else if(ctrl->ctlclass->type == name_str)
put_name_id(res, ctrl->ctlclass, FALSE, NULL); put_name_id(res, ctrl->ctlclass, FALSE, NULL);
else else
error("Unknown control-class %04x", ctrl->ctlclass->name.i_name); error("Unknown control-class %04x\n", ctrl->ctlclass->name.i_name);
} }
else else
internal_error(__FILE__, __LINE__, "Control has no control-class"); internal_error(__FILE__, __LINE__, "Control has no control-class\n");
if(ctrl->title) if(ctrl->title)
put_name_id(res, ctrl->title, FALSE, NULL); put_name_id(res, ctrl->title, FALSE, NULL);
else else
...@@ -772,7 +772,7 @@ static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) ...@@ -772,7 +772,7 @@ static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex)
if(ctrl->ctlclass) if(ctrl->ctlclass)
put_name_id(res, ctrl->ctlclass, TRUE, dlgex->lvc.language); put_name_id(res, ctrl->ctlclass, TRUE, dlgex->lvc.language);
else else
internal_error(__FILE__, __LINE__, "Control has no control-class"); internal_error(__FILE__, __LINE__, "Control has no control-class\n");
if(ctrl->title) if(ctrl->title)
put_name_id(res, ctrl->title, FALSE, dlgex->lvc.language); put_name_id(res, ctrl->title, FALSE, dlgex->lvc.language);
else else
...@@ -1454,7 +1454,7 @@ static res_t *stringtable2res(stringtable_t *stt) ...@@ -1454,7 +1454,7 @@ static res_t *stringtable2res(stringtable_t *stt)
{ {
if(!stt->nentries) if(!stt->nentries)
{ {
warning("Empty internal stringtable"); warning("Empty internal stringtable\n");
continue; continue;
} }
name.type = name_ord; name.type = name_ord;
...@@ -1591,7 +1591,7 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang ...@@ -1591,7 +1591,7 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang
} }
else 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) ...@@ -1794,7 +1794,7 @@ char *prep_nid_for_label(const name_id_t *nid)
if((unsigned)*sptr < 0x80 && isprint(*sptr & 0xff)) if((unsigned)*sptr < 0x80 && isprint(*sptr & 0xff))
buf[i] = *sptr++; buf[i] = *sptr++;
else 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'; buf[i] = '\0';
} }
...@@ -1809,7 +1809,7 @@ char *prep_nid_for_label(const name_id_t *nid) ...@@ -1809,7 +1809,7 @@ char *prep_nid_for_label(const name_id_t *nid)
if((unsigned)*cptr < 0x80 && isprint(*cptr & 0xff)) if((unsigned)*cptr < 0x80 && isprint(*cptr & 0xff))
buf[i] = *cptr++; buf[i] = *cptr++;
else else
warning("Resourcename (str_char) contain unprintable characters, ignored"); warning("Resourcename (str_char) contain unprintable characters, ignored\n");
} }
buf[i] = '\0'; buf[i] = '\0';
} }
...@@ -1819,7 +1819,7 @@ char *prep_nid_for_label(const name_id_t *nid) ...@@ -1819,7 +1819,7 @@ char *prep_nid_for_label(const name_id_t *nid)
} }
else 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; return buf;
} }
...@@ -2000,7 +2000,7 @@ void resources2res(resource_t *top) ...@@ -2000,7 +2000,7 @@ void resources2res(resource_t *top)
top->binres = anicurico2res(top->name, top->res.ani, top->type); top->binres = anicurico2res(top->name, top->res.ani, top->type);
break; break;
default: 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->c_name = make_c_name(get_c_typename(top->type), top->name, top->lan);
top = top->next; top = top->next;
......
...@@ -327,7 +327,7 @@ static int convert_bitmap(char *data, int size) ...@@ -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", bih->biSize); parser_error("Invalid bitmap format, bih->biSize = %d\n", bih->biSize);
switch(type) switch(type)
{ {
...@@ -336,12 +336,12 @@ static int convert_bitmap(char *data, int size) ...@@ -336,12 +336,12 @@ static int convert_bitmap(char *data, int size)
case FL_SIZEBE: case FL_SIZEBE:
case FL_SIZEBE | FL_V4: case FL_SIZEBE | FL_V4:
case FL_SIZEBE | FL_OS2: 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; break;
case FL_SIGBE: case FL_SIGBE:
case FL_SIGBE | FL_V4: case FL_SIGBE | FL_V4:
case FL_SIGBE | FL_OS2: 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; break;
} }
...@@ -461,7 +461,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico) ...@@ -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", ih->type); parser_error("Icon resource data has invalid type id %d\n", 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) ...@@ -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"); parser_error("Icon resource data corrupt\n");
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) ...@@ -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", ch->type); parser_error("Cursor resource data has invalid type id %d\n", 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) ...@@ -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"); parser_error("Cursor resource data corrupt\n");
cur->width = cde.width; cur->width = cde.width;
cur->height = cde.height; cur->height = cde.height;
cur->nclr = cde.nclr; cur->nclr = cde.nclr;
...@@ -598,7 +598,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur) ...@@ -598,7 +598,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
cur->bits = info.biBitCount; cur->bits = info.biBitCount;
} }
if(!win32 && (cur->planes != 1 || cur->bits != 1)) 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->xhot = swap ? BYTESWAP_WORD(cde.xhot) : cde.xhot;
cur->yhot = swap ? BYTESWAP_WORD(cde.yhot) : cde.yhot; cur->yhot = swap ? BYTESWAP_WORD(cde.yhot) : cde.yhot;
cur->data = new_raw_data(); 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) ...@@ -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", anistr); parser_error("Animated %s has an invalid RIFF length\n", anistr);
switch(byteorder) switch(byteorder)
{ {
...@@ -1002,7 +1002,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) ...@@ -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"); parser_error("Invalid messagetable, size too small\n");
nblk = *(DWORD *)rd->data; nblk = *(DWORD *)rd->data;
lo = WRC_LOWORD(nblk); lo = WRC_LOWORD(nblk);
...@@ -1017,9 +1017,9 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) ...@@ -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. * the ID, offset and length (and flag) fields to be very sure.
*/ */
if(hi && lo) 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) 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 */ if(!hi && lo) /* Messagetable byteorder == native byteorder */
{ {
...@@ -1032,7 +1032,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) ...@@ -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"); parser_error("Messagetable's blocks are outside of defined data\n");
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) ...@@ -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", 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 */ 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) ...@@ -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)", 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++) 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) ...@@ -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"); parser_error("Messagetable's blocks are outside of defined data\n");
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) ...@@ -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", 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 */ 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) ...@@ -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)", 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++) for(n = 0; n < l; n++)
wp[n] = BYTESWAP_WORD(wp[n]); wp[n] = BYTESWAP_WORD(wp[n]);
......
...@@ -324,10 +324,10 @@ static struct keyword *iskeyword(char *kw) ...@@ -324,10 +324,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"); parser_error("Malformed '#...' line-directive; invalid linenumber\n");
fname = strchr(cptr, '"'); fname = strchr(cptr, '"');
if(!fname) if(!fname)
parser_error("Malformed '#...' line-directive; missing filename"); parser_error("Malformed '#...' line-directive; missing filename\n");
fname++; fname++;
cptr = strchr(fname, '"'); cptr = strchr(fname, '"');
if(!cptr) if(!cptr)
...@@ -344,7 +344,7 @@ static struct keyword *iskeyword(char *kw) ...@@ -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>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}*default{ws}*\)[^\n]* current_codepage = -1; yy_pop_state();
<pp_code_page>\({ws}*utf8{ws}*\)[^\n]* current_codepage = CP_UTF8; 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) ...@@ -355,11 +355,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", current_codepage); parser_error("Codepage %d not supported\n", current_codepage);
current_codepage = 0; 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 * Strip everything until a ';' taking
...@@ -423,7 +423,7 @@ L\" { ...@@ -423,7 +423,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"); parser_error("Character constant out of range\n");
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 */
...@@ -431,9 +431,9 @@ L\" { ...@@ -431,9 +431,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'", 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>\\\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');
...@@ -452,7 +452,7 @@ L\" { ...@@ -452,7 +452,7 @@ L\" {
while(*yptr) /* FIXME: codepage translation */ while(*yptr) /* FIXME: codepage translation */
addwchar(*yptr++ & 0xff); addwchar(*yptr++ & 0xff);
} }
<tklstr>\n parser_error("Unterminated string"); <tklstr>\n parser_error("Unterminated string\n");
/* /*
* Normal string scanning * Normal string scanning
...@@ -468,7 +468,7 @@ L\" { ...@@ -468,7 +468,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"); parser_error("Character constant out of range\n");
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 */
...@@ -476,9 +476,9 @@ L\" { ...@@ -476,9 +476,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'", 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>\\\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');
...@@ -497,7 +497,7 @@ L\" { ...@@ -497,7 +497,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"); <tkstr>\n parser_error("Unterminated string\n");
/* /*
* Raw data scanning * Raw data scanning
...@@ -518,7 +518,7 @@ L\" { ...@@ -518,7 +518,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"); <tkrcd>. parser_error("Malformed data-line\n");
/* /*
* Comment stripping * Comment stripping
...@@ -528,7 +528,7 @@ L\" { ...@@ -528,7 +528,7 @@ L\" {
yy_push_state(comment); yy_push_state(comment);
save_wanted_id = wanted_id; save_wanted_id = wanted_id;
if(!no_preprocess) if(!no_preprocess)
parser_warning("Found comments after preprocessing, please report"); parser_warning("Found comments after preprocessing, please report\n");
} }
<comment>[^*\n]* ; <comment>[^*\n]* ;
<comment>"*"+[^*/\n]* ; <comment>"*"+[^*/\n]* ;
...@@ -536,7 +536,7 @@ L\" { ...@@ -536,7 +536,7 @@ L\" {
<comment>"*"+"/" yy_pop_state(); want_id = save_wanted_id; <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; /* 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 { \n {
want_id = wanted_id; want_id = wanted_id;
...@@ -559,7 +559,7 @@ L\" { ...@@ -559,7 +559,7 @@ L\" {
line_number++; line_number++;
char_number = 1; 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); isprint(*yytext & 0xff) ? *yytext : '.', *yytext, YY_START);
} }
...@@ -575,7 +575,7 @@ static void addcchar(char c) ...@@ -575,7 +575,7 @@ static void addcchar(char c)
cbufalloc += 1024; cbufalloc += 1024;
cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0])); cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
if(cbufalloc > 65536) if(cbufalloc > 65536)
parser_warning("Reallocating string buffer larger than 64kB"); parser_warning("Reallocating string buffer larger than 64kB\n");
} }
cbuffer[cbufidx++] = c; cbuffer[cbufidx++] = c;
} }
...@@ -587,7 +587,7 @@ static void addwchar(WCHAR s) ...@@ -587,7 +587,7 @@ static void addwchar(WCHAR s)
wbufalloc += 1024; wbufalloc += 1024;
wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0])); wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0]));
if(wbufalloc > 65536) 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; wbuffer[wbufidx++] = s;
} }
...@@ -604,7 +604,7 @@ static string_t *get_buffered_cstring(void) ...@@ -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 || 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; return str;
} }
else /* convert to Unicode before storing */ else /* convert to Unicode before storing */
...@@ -612,7 +612,7 @@ static string_t *get_buffered_cstring(void) ...@@ -612,7 +612,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.", str->str.cstr, current_codepage ); "Try using a Unicode string instead\n", str->str.cstr, current_codepage );
free_string( str ); free_string( str );
return str_w; return str_w;
} }
......
...@@ -106,7 +106,7 @@ static enum res_e res_type_from_id(const name_id_t *nid) ...@@ -106,7 +106,7 @@ static enum res_e res_type_from_id(const name_id_t *nid)
return res_usr; return res_usr;
if(nid->type != name_ord) 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) switch(nid->name.i_name)
{ {
...@@ -132,7 +132,7 @@ static enum res_e res_type_from_id(const name_id_t *nid) ...@@ -132,7 +132,7 @@ static enum res_e res_type_from_id(const name_id_t *nid)
case WRC_RT_VXD: case WRC_RT_VXD:
case WRC_RT_ANICURSOR: case WRC_RT_ANICURSOR:
case WRC_RT_ANIICON: 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; return res_usr;
} }
} }
...@@ -185,7 +185,7 @@ static resource_t *read_res32(FILE *fp) ...@@ -185,7 +185,7 @@ static resource_t *read_res32(FILE *fp)
totsize = hdrsize; totsize = hdrsize;
if(hdrsize & 3) 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 += 4 - (hdrsize & 3);
} }
totsize += ressize; totsize += ressize;
...@@ -217,7 +217,7 @@ static resource_t *read_res32(FILE *fp) ...@@ -217,7 +217,7 @@ static resource_t *read_res32(FILE *fp)
} }
else if(get_word(idx) == 0) else if(get_word(idx) == 0)
{ {
error("ResType name has zero length (32 bit)"); error("ResType name has zero length (32 bit)\n");
} }
else else
{ {
...@@ -251,7 +251,7 @@ static resource_t *read_res32(FILE *fp) ...@@ -251,7 +251,7 @@ static resource_t *read_res32(FILE *fp)
} }
else if(get_word(idx) == 0) else if(get_word(idx) == 0)
{ {
error("ResName name has zero length (32 bit)"); error("ResName name has zero length (32 bit)\n");
} }
else else
{ {
...@@ -328,7 +328,7 @@ static resource_t *read_res32(FILE *fp) ...@@ -328,7 +328,7 @@ static resource_t *read_res32(FILE *fp)
*/ */
static resource_t *read_res16(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; return NULL;
} }
...@@ -351,7 +351,7 @@ resource_t *read_resfile(char *inname) ...@@ -351,7 +351,7 @@ resource_t *read_resfile(char *inname)
fp = fopen(inname, "rb"); fp = fopen(inname, "rb");
if(!fp) if(!fp)
error("Could not open inputfile %s", inname); error("Could not open inputfile %s\n", inname);
/* Determine 16 or 32 bit .res file */ /* Determine 16 or 32 bit .res file */
if(fread(&rh, 1, sizeof(rh), fp) != sizeof(rh)) if(fread(&rh, 1, sizeof(rh), fp) != sizeof(rh))
...@@ -361,16 +361,16 @@ resource_t *read_resfile(char *inname) ...@@ -361,16 +361,16 @@ resource_t *read_resfile(char *inname)
if(!memcmp(&emptyheader, &rh, sizeof(rh))) if(!memcmp(&emptyheader, &rh, sizeof(rh)))
is32bit = 1; is32bit = 1;
else if(!memcmp(&emptyheaderSWAPPED, &rh, sizeof(rh))) 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 else
is32bit = 0; is32bit = 0;
} }
if(is32bit && !win32) 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) 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) if(!is32bit)
{ {
......
...@@ -64,7 +64,6 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap) ...@@ -64,7 +64,6 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
} }
} }
#endif #endif
fprintf(stderr, "\n");
} }
...@@ -93,7 +92,6 @@ void internal_error(const char *file, int line, const char *s, ...) ...@@ -93,7 +92,6 @@ void internal_error(const char *file, int line, const char *s, ...)
va_start(ap, s); va_start(ap, s);
fprintf(stderr, "Internal error (please report) %s %d: ", file, line); fprintf(stderr, "Internal error (please report) %s %d: ", file, line);
vfprintf(stderr, s, ap); vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap); va_end(ap);
exit(3); exit(3);
} }
...@@ -104,7 +102,6 @@ void error(const char *s, ...) ...@@ -104,7 +102,6 @@ void error(const char *s, ...)
va_start(ap, s); va_start(ap, s);
fprintf(stderr, "Error: "); fprintf(stderr, "Error: ");
vfprintf(stderr, s, ap); vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap); va_end(ap);
exit(2); exit(2);
} }
...@@ -115,7 +112,6 @@ void warning(const char *s, ...) ...@@ -115,7 +112,6 @@ void warning(const char *s, ...)
va_start(ap, s); va_start(ap, s);
fprintf(stderr, "Warning: "); fprintf(stderr, "Warning: ");
vfprintf(stderr, s, ap); vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap); va_end(ap);
} }
...@@ -127,7 +123,6 @@ void chat(const char *s, ...) ...@@ -127,7 +123,6 @@ void chat(const char *s, ...)
va_start(ap, s); va_start(ap, s);
fprintf(stderr, "FYI: "); fprintf(stderr, "FYI: ");
vfprintf(stderr, s, ap); vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap); va_end(ap);
} }
} }
...@@ -226,7 +221,7 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2) ...@@ -226,7 +221,7 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2)
} }
else 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) 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) ...@@ -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) else if(n1->type == name_str && n2->type == name_ord)
return -1; return -1;
else 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); n1->type, n2->type);
return 0; /* Keep the compiler happy */ return 0; /* Keep the compiler happy */
...@@ -247,7 +242,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage) ...@@ -247,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" ); parser_error( "Current language is Unicode only, cannot convert string\n" );
if((str->type == str_char) && (type == str_unicode)) if((str->type == str_char) && (type == str_unicode))
{ {
......
...@@ -451,7 +451,7 @@ int main(int argc,char *argv[]) ...@@ -451,7 +451,7 @@ int main(int argc,char *argv[])
* no output was given. * no output was given.
*/ */
chat("Starting preprocess"); chat("Starting preprocess\n");
if (!preprocess_only) if (!preprocess_only)
{ {
...@@ -484,7 +484,7 @@ int main(int argc,char *argv[]) ...@@ -484,7 +484,7 @@ int main(int argc,char *argv[])
} }
/* Go from .rc to .res */ /* Go from .rc to .res */
chat("Starting parse"); chat("Starting parse\n");
if(!(parser_in = fopen(input_name, "rb"))) if(!(parser_in = fopen(input_name, "rb")))
error("Could not open %s for input\n", input_name); error("Could not open %s for input\n", input_name);
...@@ -507,7 +507,7 @@ int main(int argc,char *argv[]) ...@@ -507,7 +507,7 @@ int main(int argc,char *argv[])
/* Convert the internal lists to binary data */ /* Convert the internal lists to binary data */
resources2res(resource_top); resources2res(resource_top);
chat("Writing .res-file"); chat("Writing .res-file\n");
write_resfile(output_name, resource_top); write_resfile(output_name, resource_top);
output_name = NULL; output_name = NULL;
......
...@@ -75,7 +75,7 @@ void write_resfile(char *outname, resource_t *top) ...@@ -75,7 +75,7 @@ void write_resfile(char *outname, resource_t *top)
if(ret != res->size) if(ret != res->size)
{ {
fclose(fo); fclose(fo);
error("Error writing %s", outname); error("Error writing %s\n", outname);
} }
free(res); free(res);
} }
...@@ -89,7 +89,7 @@ void write_resfile(char *outname, resource_t *top) ...@@ -89,7 +89,7 @@ void write_resfile(char *outname, resource_t *top)
if(ret != top->binres->size) if(ret != top->binres->size)
{ {
fclose(fo); fclose(fo);
error("Error writing %s", outname); error("Error writing %s\n", outname);
} }
if(win32 && (top->binres->size & 0x03)) if(win32 && (top->binres->size & 0x03))
{ {
...@@ -98,7 +98,7 @@ void write_resfile(char *outname, resource_t *top) ...@@ -98,7 +98,7 @@ void write_resfile(char *outname, resource_t *top)
if(ret != 4 - (top->binres->size & 0x03)) if(ret != 4 - (top->binres->size & 0x03))
{ {
fclose(fo); fclose(fo);
error("Error writing %s", outname); error("Error writing %s\n", outname);
} }
} }
} }
......
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