wmc: Modify the error and warning 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:57 +02:00 committed by Alexandre Julliard
parent dc3feef055
commit 22076e09ca
4 changed files with 49 additions and 53 deletions

View File

@ -156,7 +156,7 @@ void set_codepage(int cp)
codepage = cp;
codepage_def = find_codepage(codepage);
if(!codepage_def)
xyyerror("Codepage %d not found; cannot process", codepage);
xyyerror("Codepage %d not found; cannot process\n", codepage);
}
/*
@ -203,7 +203,7 @@ try_again:
assert(codepage_def != NULL);
n = wine_cp_mbstowcs(codepage_def, 0, xlatebuffer, strlen(xlatebuffer)+1, inputbuffer, INPUTBUFFER_SIZE);
if(n < 0)
internal_error(__FILE__, __LINE__, "Could not translate to unicode (%d)", n);
internal_error(__FILE__, __LINE__, "Could not translate to unicode (%d)\n", n);
if(n <= 1)
goto try_again; /* Should not hapen */
n--; /* Strip added conversion '\0' from input length */
@ -224,7 +224,7 @@ try_again:
if(!n && ferror(yyin))
xyyerror(err_fatalread);
else
xyyerror("Fatal: file to short to determine byteorder (should never happen)");
xyyerror("Fatal: file to short to determine byteorder (should never happen)\n");
}
if(isisochar(inputbuffer[0]) &&
isisochar(inputbuffer[1]) &&
@ -249,7 +249,7 @@ try_again:
#endif
}
else
xyyerror("Fatal: cannot determine file's byteorder");
xyyerror("Fatal: cannot determine file's byteorder\n");
/* FIXME:
* Determine the file-endian with the leader-bytes
* "FF FE..."; can't remember the exact sequence.
@ -302,7 +302,7 @@ try_again:
if(!n)
{
mcy_warning("Re-read line (input was or converted to zilch)");
mcy_warning("Re-read line (input was or converted to zilch)\n");
goto try_again; /* Should not happen, but could be due to stdin reading and a signal */
}
@ -458,7 +458,7 @@ static int scan_number(int ch)
while(1)
{
if(!isisochar(ch))
xyyerror("Invalid digit");
xyyerror("Invalid digit\n");
switch(state)
{
@ -472,7 +472,7 @@ static int scan_number(int ch)
state = 4;
}
else
internal_error(__FILE__, __LINE__, "Non-digit in first number-scanner state");
internal_error(__FILE__, __LINE__, "Non-digit in first number-scanner state\n");
break;
case 1:
if(ch == 'x' || ch == 'X')
@ -486,7 +486,7 @@ static int scan_number(int ch)
state = 3;
}
else if(isalpha(ch) || ch == '_')
xyyerror("Invalid number digit");
xyyerror("Invalid number digit\n");
else
{
unget_unichar(ch);
@ -498,7 +498,7 @@ static int scan_number(int ch)
if(isxdigit(ch))
push_char(ch);
else if(isalpha(ch) || ch == '_' || !isxdigit(tos_char_stack()))
xyyerror("Invalid hex digit");
xyyerror("Invalid hex digit\n");
else
{
base = 16;
@ -509,7 +509,7 @@ static int scan_number(int ch)
if(ch >= '0' && ch <= '7')
push_char(ch);
else if(isalnum(ch) || ch == '_')
xyyerror("Invalid octal digit");
xyyerror("Invalid octal digit\n");
else
{
base = 8;
@ -520,7 +520,7 @@ static int scan_number(int ch)
if(isdigit(ch))
push_char(ch);
else if(isalnum(ch) || ch == '_')
xyyerror("Invalid decimal digit");
xyyerror("Invalid decimal digit\n");
else
{
base = 10;
@ -528,7 +528,7 @@ static int scan_number(int ch)
}
break;
default:
internal_error(__FILE__, __LINE__, "Invalid state in number-scanner");
internal_error(__FILE__, __LINE__, "Invalid state in number-scanner\n");
}
ch = get_unichar();
}
@ -626,7 +626,7 @@ int mcy_lex(void)
while((ch = get_unichar()) != '\n')
{
if(ch == EOF)
xyyerror("Unexpected EOF");
xyyerror("Unexpected EOF\n");
push_unichar(ch);
}
newline();
@ -710,7 +710,7 @@ int mcy_lex(void)
return tTOKEN;
default:
internal_error(__FILE__, __LINE__, "Invalid token type encountered");
internal_error(__FILE__, __LINE__, "Invalid token type encountered\n");
}
}
@ -741,7 +741,7 @@ int mcy_lex(void)
mcy_lval.str = xunistrdup(get_unichar_stack());
return tCOMMENT;
default:
xyyerror("Invalid character '%c' (0x%04x)", isisochar(ch) && isprint(ch) ? ch : '.', ch);
xyyerror("Invalid character '%c' (0x%04x)\n", isisochar(ch) && isprint(ch) ? ch : '.', ch);
}
}
}

View File

@ -122,7 +122,7 @@ static cp_xlat_t *find_cpxlat(int lan);
%%
file : items {
if(!check_languages(nodehead))
xyyerror("No messages defined");
xyyerror("No messages defined\n");
lanblockhead = block_messages(nodehead);
}
;
@ -165,7 +165,7 @@ global : tSEVNAMES '=' '(' smaps ')'
base = $3;
break;
default:
xyyerror("Numberbase must be 8, 10 or 16");
xyyerror("Numberbase must be 8, 10 or 16\n");
}
}
| tBASE '=' error { xyyerror(err_number); }
@ -184,7 +184,7 @@ smap : token '=' tNUMBER alias {
$1->token = $3;
$1->alias = $4;
if($3 & (~0x3))
xyyerror("Severity value out of range (0x%08x > 0x3)", $3);
xyyerror("Severity value out of range (0x%08x > 0x3)\n", $3);
do_add_token(tok_severity, $1, "severity");
}
| token '=' error { xyyerror(err_number); }
@ -203,7 +203,7 @@ fmap : token '=' tNUMBER alias {
$1->token = $3;
$1->alias = $4;
if($3 & (~0xfff))
xyyerror("Facility value out of range (0x%08x > 0xfff)", $3);
xyyerror("Facility value out of range (0x%08x > 0xfff)\n", $3);
do_add_token(tok_facility, $1, "facility");
}
| token '=' error { xyyerror(err_number); }
@ -229,9 +229,9 @@ lmap : token '=' tNUMBER setfile ':' tFILE optcp {
$1->codepage = $7;
do_add_token(tok_language, $1, "language");
if(!find_language($3) && !find_cpxlat($3))
mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", $3, WMC_DEFAULT_CODEPAGE);
mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override\n", $3, WMC_DEFAULT_CODEPAGE);
}
| token '=' tNUMBER setfile ':' error { xyyerror("Filename expected"); }
| token '=' tNUMBER setfile ':' error { xyyerror("Filename expected\n"); }
| token '=' tNUMBER error { xyyerror(err_colon); }
| token '=' error { xyyerror(err_number); }
| token error { xyyerror(err_assign); }
@ -239,7 +239,7 @@ lmap : token '=' tNUMBER setfile ':' tFILE optcp {
optcp : /* Empty */ { $$ = 0; }
| ':' tNUMBER { $$ = $2; }
| ':' error { xyyerror("Codepage-number expected"); }
| ':' error { xyyerror("Codepage-number expected\n"); }
;
/*----------------------------------------------------------------------
@ -253,7 +253,7 @@ cmaps : cmap
cmap : clan '=' tNUMBER ':' tNUMBER {
static const char err_nocp[] = "Codepage %d not builtin; cannot convert";
if(find_cpxlat($1))
xyyerror("Codepage translation already defined for language 0x%x", $1);
xyyerror("Codepage translation already defined for language 0x%x\n", $1);
if($3 && !find_codepage($3))
xyyerror(err_nocp, $3);
if($5 && !find_codepage($5))
@ -269,7 +269,7 @@ cmap : clan '=' tNUMBER ':' tNUMBER {
clan : tNUMBER { $$ = $1; }
| tTOKEN {
if($1->type != tok_language)
xyyerror("Language name or code expected");
xyyerror("Language name or code expected\n");
$$ = $1->token;
}
;
@ -282,7 +282,7 @@ msg : msgid sevfacsym { test_id($1); } bodies { $$ = complete_msg($4, $1); }
msgid : tMSGID '=' id {
if($3 & (~0xffff))
xyyerror("Message ID value out of range (0x%08x > 0xffff)", $3);
xyyerror("Message ID value out of range (0x%08x > 0xffff)\n", $3);
$$ = $3;
}
| tMSGID error { xyyerror(err_assign); }
@ -295,9 +295,9 @@ id : /* Empty */ { $$ = ++last_id; }
;
sevfacsym: /* Empty */ { have_sev = have_fac = have_sym = 0; }
| sevfacsym sev { if(have_sev) xyyerror("Severity already defined"); have_sev = 1; }
| sevfacsym fac { if(have_fac) xyyerror("Facility already defined"); have_fac = 1; }
| sevfacsym sym { if(have_sym) xyyerror("Symbolname already defined"); have_sym = 1; }
| sevfacsym sev { if(have_sev) xyyerror("Severity already defined\n"); have_sev = 1; }
| sevfacsym fac { if(have_fac) xyyerror("Facility already defined\n"); have_fac = 1; }
| sevfacsym sym { if(have_sym) xyyerror("Symbolname already defined\n"); have_sym = 1; }
;
sym : tSYMNAME '=' tIDENT { last_sym = $3; }
@ -308,9 +308,9 @@ sym : tSYMNAME '=' tIDENT { last_sym = $3; }
sev : tSEVERITY '=' token {
token_t *tok = lookup_token($3->name);
if(!tok)
xyyerror("Undefined severityname");
xyyerror("Undefined severityname\n");
if(tok->type != tok_severity)
xyyerror("Identifier is not of class 'severity'");
xyyerror("Identifier is not of class 'severity'\n");
last_sev = tok->token;
}
| tSEVERITY '=' error { xyyerror(err_ident); }
@ -320,9 +320,9 @@ sev : tSEVERITY '=' token {
fac : tFACILITY '=' token {
token_t *tok = lookup_token($3->name);
if(!tok)
xyyerror("Undefined facilityname");
xyyerror("Undefined facilityname\n");
if(tok->type != tok_facility)
xyyerror("Identifier is not of class 'facility'");
xyyerror("Identifier is not of class 'facility'\n");
last_fac = tok->token;
}
| tFACILITY '=' error { xyyerror(err_ident); }
@ -334,7 +334,7 @@ fac : tFACILITY '=' token {
*/
bodies : body { $$ = add_lanmsg(NULL, $1); }
| bodies body { $$ = add_lanmsg($1, $2); }
| error { xyyerror("'Language=...' (start of message text-definition) expected"); }
| error { xyyerror("'Language=...' (start of message text-definition) expected\n"); }
;
body : lang setline lines tMSGEND { $$ = new_lanmsg(&$1, $3); }
@ -349,9 +349,9 @@ lang : tLANGUAGE setnl '=' token tNL {
token_t *tok = lookup_token($4->name);
cp_xlat_t *cpx;
if(!tok)
xyyerror("Undefined language");
xyyerror("Undefined language\n");
if(tok->type != tok_language)
xyyerror("Identifier is not of class 'language'");
xyyerror("Identifier is not of class 'language'\n");
if((cpx = find_cpxlat(tok->token)))
{
set_codepage($$.codepage = cpx->cpin);
@ -374,7 +374,7 @@ lang : tLANGUAGE setnl '=' token tNL {
set_codepage($$.codepage = tok->codepage);
$$.language = tok->token;
}
| tLANGUAGE setnl '=' token error { xyyerror("Missing newline"); }
| tLANGUAGE setnl '=' token error { xyyerror("Missing newline\n"); }
| tLANGUAGE setnl '=' error { xyyerror(err_ident); }
| tLANGUAGE error { xyyerror(err_assign); }
;
@ -419,12 +419,12 @@ static void do_add_token(tok_e type, token_t *tok, const char *code)
if(tp)
{
if(tok->type != type)
mcy_warning("Type change in token");
mcy_warning("Type change in token\n");
if(tp != tok)
xyyerror("Overlapping token not the same");
xyyerror("Overlapping token not the same\n");
/* else its already defined and changed */
if(tok->fixed)
xyyerror("Redefinition of %s", code);
xyyerror("Redefinition of %s\n", code);
tok->fixed = 1;
}
else
@ -442,7 +442,7 @@ static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg)
lmp->msg = msg;
lmp->len = unistrlen(msg) + 1; /* Include termination */
if(lmp->len > 4096)
mcy_warning("Message exceptionally long; might be a missing termination");
mcy_warning("Message exceptionally long; might be a missing termination\n");
return lmp;
}
@ -460,7 +460,7 @@ static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg)
for(i = 0; i < msg->nmsgs-1; i++)
{
if(msg->msgs[i]->lan == lanmsg->lan)
xyyerror("Message for language 0x%x already defined", lanmsg->lan);
xyyerror("Message for language 0x%x already defined\n", lanmsg->lan);
}
return msg;
}
@ -477,7 +477,7 @@ static msg_t *complete_msg(msg_t *mp, int id)
if(have_sym)
mp->sym = last_sym;
else
xyyerror("No symbolic name defined for message id %d", id);
xyyerror("No symbolic name defined for message id %d\n", id);
mp->sev = last_sev;
mp->fac = last_fac;
qsort(mp->msgs, mp->nmsgs, sizeof(*(mp->msgs)), sort_lanmsg);
@ -516,7 +516,7 @@ static void test_id(int id)
if(ndp->type != nd_msg)
continue;
if(ndp->u.msg->id == id && ndp->u.msg->sev == last_sev && ndp->u.msg->fac == last_fac)
xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined", id, last_fac, last_sev);
xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined\n", id, last_fac, last_sev);
}
}

View File

@ -38,7 +38,6 @@ static void generic_msg(const char *s, const char *t, va_list ap)
{
fprintf(stderr, "%s:%d:%d: %s: ", input_name ? input_name : "stdin", line_number, char_number, t);
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
}
/*
@ -85,7 +84,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);
}
@ -96,7 +94,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);
}
@ -107,7 +104,6 @@ void warning(const char *s, ...)
va_start(ap, s);
fprintf(stderr, "Warning: ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
}

View File

@ -101,11 +101,11 @@ static char *dup_u2c(int cp, const WCHAR *uc)
char *cptr;
const union cptable *cpdef = find_codepage(cp);
if(!cpdef)
internal_error(__FILE__, __LINE__, "Codepage %d not found (vanished?)", cp);
internal_error(__FILE__, __LINE__, "Codepage %d not found (vanished?)\n", cp);
len = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, NULL, 0, NULL, NULL);
cptr = xmalloc(len);
if((len = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, cptr, len, NULL, NULL)) < 0)
internal_error(__FILE__, __LINE__, "Buffer overflow? code %d.", len);
internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", len);
return cptr;
}
@ -271,13 +271,13 @@ void write_h_file(const char *fname)
fprintf(fp, "#define %s\t0x%08xL\n\n", cptr, ndp->u.msg->realid);
break;
default:
internal_error(__FILE__, __LINE__, "Invalid base for number print");
internal_error(__FILE__, __LINE__, "Invalid base for number print\n");
}
free(cptr);
free(cast);
break;
default:
internal_error(__FILE__, __LINE__, "Invalid node type %d", ndp->type);
internal_error(__FILE__, __LINE__, "Invalid node type %d\n", ndp->type);
}
}
fprintf(fp, "\n#endif\n");
@ -307,7 +307,7 @@ static void write_rcbin(FILE *fp)
}
}
if(!cptr)
internal_error(__FILE__, __LINE__, "Filename vanished for language 0x%0x", lbp->lan);
internal_error(__FILE__, __LINE__, "Filename vanished for language 0x%0x\n", lbp->lan);
fprintf(fp, "1 MESSAGETABLE \"%s.bin\"\n", cptr);
free(cptr);
}
@ -389,7 +389,7 @@ static char *make_string(WCHAR *uc, int len, int codepage)
mlen = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, NULL, 0, NULL, NULL);
cc = tmp = xmalloc(mlen);
if((i = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, tmp, mlen, NULL, NULL)) < 0)
internal_error(__FILE__, __LINE__, "Buffer overflow? code %d.", i);
internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", i);
*cptr++ = ' ';
*cptr++ = '"';
for(i = b = 0; i < len; i++, cc++)