]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ******************************************************************************* | |
3 | * | |
4388f060 | 4 | * Copyright (C) 1998-2011, International Business Machines |
b75a7d8f A |
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 | ||
4388f060 | 23 | U_CFUNC void error(uint32_t linenumber, const char *msg, ...) |
b75a7d8f A |
24 | { |
25 | va_list va; | |
26 | ||
27 | va_start(va, msg); | |
374ca955 | 28 | fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber); |
b75a7d8f A |
29 | vfprintf(stderr, msg, va); |
30 | fprintf(stderr, "\n"); | |
31 | va_end(va); | |
32 | } | |
33 | ||
34 | static UBool gShowWarning = TRUE; | |
35 | ||
4388f060 | 36 | U_CFUNC void setShowWarning(UBool val) |
b75a7d8f A |
37 | { |
38 | gShowWarning = val; | |
39 | } | |
40 | ||
4388f060 | 41 | U_CFUNC UBool getShowWarning(){ |
b75a7d8f A |
42 | return gShowWarning; |
43 | } | |
44 | ||
45 | static UBool gStrict =FALSE; | |
4388f060 | 46 | U_CFUNC UBool isStrict(){ |
b75a7d8f A |
47 | return gStrict; |
48 | } | |
4388f060 | 49 | U_CFUNC void setStrict(UBool val){ |
b75a7d8f A |
50 | gStrict = val; |
51 | } | |
52 | static UBool gVerbose =FALSE; | |
4388f060 | 53 | U_CFUNC UBool isVerbose(){ |
b75a7d8f A |
54 | return gVerbose; |
55 | } | |
4388f060 | 56 | U_CFUNC void setVerbose(UBool val){ |
b75a7d8f A |
57 | gVerbose = val; |
58 | } | |
4388f060 | 59 | U_CFUNC void warning(uint32_t linenumber, const char *msg, ...) |
b75a7d8f A |
60 | { |
61 | if (gShowWarning) | |
62 | { | |
63 | va_list va; | |
64 | ||
65 | va_start(va, msg); | |
374ca955 | 66 | fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber); |
b75a7d8f A |
67 | vfprintf(stderr, msg, va); |
68 | fprintf(stderr, "\n"); | |
69 | va_end(va); | |
70 | } | |
71 | } |