OLD | NEW |
(Empty) | |
| 1 /* |
| 2 ******************************************************************************* |
| 3 * |
| 4 * Copyright (C) 1998-2004, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. |
| 6 * |
| 7 ******************************************************************************* |
| 8 * |
| 9 * File error.c |
| 10 * |
| 11 * Modification History: |
| 12 * |
| 13 * Date Name Description |
| 14 * 05/28/99 stephen Creation. |
| 15 ******************************************************************************* |
| 16 */ |
| 17 |
| 18 #include <stdarg.h> |
| 19 #include <stdio.h> |
| 20 #include "cstring.h" |
| 21 #include "errmsg.h" |
| 22 |
| 23 void error(uint32_t linenumber, const char *msg, ...) |
| 24 { |
| 25 va_list va; |
| 26 |
| 27 va_start(va, msg); |
| 28 fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber); |
| 29 vfprintf(stderr, msg, va); |
| 30 fprintf(stderr, "\n"); |
| 31 va_end(va); |
| 32 } |
| 33 |
| 34 static UBool gShowWarning = TRUE; |
| 35 |
| 36 void setShowWarning(UBool val) |
| 37 { |
| 38 gShowWarning = val; |
| 39 } |
| 40 |
| 41 UBool getShowWarning(){ |
| 42 return gShowWarning; |
| 43 } |
| 44 |
| 45 static UBool gStrict =FALSE; |
| 46 UBool isStrict(){ |
| 47 return gStrict; |
| 48 } |
| 49 void setStrict(UBool val){ |
| 50 gStrict = val; |
| 51 } |
| 52 static UBool gVerbose =FALSE; |
| 53 UBool isVerbose(){ |
| 54 return gVerbose; |
| 55 } |
| 56 void setVerbose(UBool val){ |
| 57 gVerbose = val; |
| 58 } |
| 59 void warning(uint32_t linenumber, const char *msg, ...) |
| 60 { |
| 61 if (gShowWarning) |
| 62 { |
| 63 va_list va; |
| 64 |
| 65 va_start(va, msg); |
| 66 fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber); |
| 67 vfprintf(stderr, msg, va); |
| 68 fprintf(stderr, "\n"); |
| 69 va_end(va); |
| 70 } |
| 71 } |
| 72 |
OLD | NEW |