1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
1999-12-13 22:28:37 +00:00
|
|
|
*
|
2001-03-21 23:22:16 +00:00
|
|
|
* Copyright (C) 1998-2000, International Business Machines
|
1999-12-13 22:28:37 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
1999-08-16 21:50:52 +00:00
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* File error.c
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 05/28/99 stephen Creation.
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
2001-07-11 20:31:32 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
2000-05-22 21:24:12 +00:00
|
|
|
#include "cstring.h"
|
2002-04-23 22:25:44 +00:00
|
|
|
#include "errmsg.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-07-11 20:31:32 +00:00
|
|
|
void error(uint32_t linenumber, const char *msg, ...)
|
2000-05-22 21:24:12 +00:00
|
|
|
{
|
2001-07-11 20:31:32 +00:00
|
|
|
va_list va;
|
|
|
|
|
|
|
|
va_start(va, msg);
|
|
|
|
fprintf(stderr, "%s:%d: ", gCurrentFileName, linenumber);
|
|
|
|
vfprintf(stderr, msg, va);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
va_end(va);
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
2001-10-11 21:27:48 +00:00
|
|
|
static UBool gShowWarning = TRUE;
|
2001-10-10 18:32:06 +00:00
|
|
|
|
|
|
|
void setShowWarning(UBool val)
|
|
|
|
{
|
|
|
|
gShowWarning = val;
|
|
|
|
}
|
|
|
|
|
2001-11-03 02:54:08 +00:00
|
|
|
UBool getShowWarning(){
|
|
|
|
return gShowWarning;
|
|
|
|
}
|
|
|
|
|
2002-11-08 23:16:10 +00:00
|
|
|
static UBool gStrict =FALSE;
|
|
|
|
UBool isStrict(){
|
|
|
|
return gStrict;
|
|
|
|
}
|
|
|
|
void setStrict(UBool val){
|
|
|
|
gStrict = val;
|
|
|
|
}
|
|
|
|
static UBool gVerbose =FALSE;
|
|
|
|
UBool isVerbose(){
|
|
|
|
return gVerbose;
|
|
|
|
}
|
|
|
|
void setVerbose(UBool val){
|
|
|
|
gVerbose = val;
|
|
|
|
}
|
2001-07-11 20:31:32 +00:00
|
|
|
void warning(uint32_t linenumber, const char *msg, ...)
|
1999-08-16 21:50:52 +00:00
|
|
|
{
|
2001-10-10 18:32:06 +00:00
|
|
|
if (gShowWarning)
|
|
|
|
{
|
|
|
|
va_list va;
|
2001-07-11 20:31:32 +00:00
|
|
|
|
2001-10-10 18:32:06 +00:00
|
|
|
va_start(va, msg);
|
|
|
|
fprintf(stderr, "%s:%d: warning: ", gCurrentFileName, linenumber);
|
|
|
|
vfprintf(stderr, msg, va);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
va_end(va);
|
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
2001-07-11 20:31:32 +00:00
|
|
|
|