1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
1999-12-13 22:28:37 +00:00
|
|
|
*
|
2011-05-26 20:05:39 +00:00
|
|
|
* Copyright (C) 1998-2011, 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
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC 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);
|
2004-05-19 04:01:34 +00:00
|
|
|
fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber);
|
2001-07-11 20:31:32 +00:00
|
|
|
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
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void setShowWarning(UBool val)
|
2001-10-10 18:32:06 +00:00
|
|
|
{
|
|
|
|
gShowWarning = val;
|
|
|
|
}
|
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC UBool getShowWarning(){
|
2001-11-03 02:54:08 +00:00
|
|
|
return gShowWarning;
|
|
|
|
}
|
|
|
|
|
2002-11-08 23:16:10 +00:00
|
|
|
static UBool gStrict =FALSE;
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC UBool isStrict(){
|
2002-11-08 23:16:10 +00:00
|
|
|
return gStrict;
|
|
|
|
}
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void setStrict(UBool val){
|
2002-11-08 23:16:10 +00:00
|
|
|
gStrict = val;
|
|
|
|
}
|
|
|
|
static UBool gVerbose =FALSE;
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC UBool isVerbose(){
|
2002-11-08 23:16:10 +00:00
|
|
|
return gVerbose;
|
|
|
|
}
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void setVerbose(UBool val){
|
2002-11-08 23:16:10 +00:00
|
|
|
gVerbose = val;
|
|
|
|
}
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC 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);
|
2004-05-19 04:01:34 +00:00
|
|
|
fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber);
|
2001-10-10 18:32:06 +00:00
|
|
|
vfprintf(stderr, msg, va);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
va_end(va);
|
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|