michael@0: /* michael@0: ******************************************************************************* michael@0: * michael@0: * Copyright (C) 1998-2011, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************* michael@0: * michael@0: * File error.c michael@0: * michael@0: * Modification History: michael@0: * michael@0: * Date Name Description michael@0: * 05/28/99 stephen Creation. michael@0: ******************************************************************************* michael@0: */ michael@0: michael@0: #include michael@0: #include michael@0: #include "cstring.h" michael@0: #include "errmsg.h" michael@0: michael@0: U_CFUNC void error(uint32_t linenumber, const char *msg, ...) michael@0: { michael@0: va_list va; michael@0: michael@0: va_start(va, msg); michael@0: fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber); michael@0: vfprintf(stderr, msg, va); michael@0: fprintf(stderr, "\n"); michael@0: va_end(va); michael@0: } michael@0: michael@0: static UBool gShowWarning = TRUE; michael@0: michael@0: U_CFUNC void setShowWarning(UBool val) michael@0: { michael@0: gShowWarning = val; michael@0: } michael@0: michael@0: U_CFUNC UBool getShowWarning(){ michael@0: return gShowWarning; michael@0: } michael@0: michael@0: static UBool gStrict =FALSE; michael@0: U_CFUNC UBool isStrict(){ michael@0: return gStrict; michael@0: } michael@0: U_CFUNC void setStrict(UBool val){ michael@0: gStrict = val; michael@0: } michael@0: static UBool gVerbose =FALSE; michael@0: U_CFUNC UBool isVerbose(){ michael@0: return gVerbose; michael@0: } michael@0: U_CFUNC void setVerbose(UBool val){ michael@0: gVerbose = val; michael@0: } michael@0: U_CFUNC void warning(uint32_t linenumber, const char *msg, ...) michael@0: { michael@0: if (gShowWarning) michael@0: { michael@0: va_list va; michael@0: michael@0: va_start(va, msg); michael@0: fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber); michael@0: vfprintf(stderr, msg, va); michael@0: fprintf(stderr, "\n"); michael@0: va_end(va); michael@0: } michael@0: }