]> git.saurik.com Git - apple/icu.git/blame - icuSources/tools/genrb/errmsg.c
ICU-66108.tar.gz
[apple/icu.git] / icuSources / tools / genrb / errmsg.c
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/*
4*******************************************************************************
5*
4388f060 6* Copyright (C) 1998-2011, International Business Machines
b75a7d8f
A
7* Corporation and others. All Rights Reserved.
8*
9*******************************************************************************
10*
11* File error.c
12*
13* Modification History:
14*
15* Date Name Description
16* 05/28/99 stephen Creation.
17*******************************************************************************
18*/
19
20#include <stdarg.h>
21#include <stdio.h>
22#include "cstring.h"
23#include "errmsg.h"
24
4388f060 25U_CFUNC void error(uint32_t linenumber, const char *msg, ...)
b75a7d8f
A
26{
27 va_list va;
28
29 va_start(va, msg);
374ca955 30 fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber);
b75a7d8f
A
31 vfprintf(stderr, msg, va);
32 fprintf(stderr, "\n");
33 va_end(va);
34}
35
36static UBool gShowWarning = TRUE;
37
4388f060 38U_CFUNC void setShowWarning(UBool val)
b75a7d8f
A
39{
40 gShowWarning = val;
41}
42
4388f060 43U_CFUNC UBool getShowWarning(){
b75a7d8f
A
44 return gShowWarning;
45}
46
47static UBool gStrict =FALSE;
4388f060 48U_CFUNC UBool isStrict(){
b75a7d8f
A
49 return gStrict;
50}
4388f060 51U_CFUNC void setStrict(UBool val){
b75a7d8f
A
52 gStrict = val;
53}
54static UBool gVerbose =FALSE;
4388f060 55U_CFUNC UBool isVerbose(){
b75a7d8f
A
56 return gVerbose;
57}
4388f060 58U_CFUNC void setVerbose(UBool val){
b75a7d8f
A
59 gVerbose = val;
60}
4388f060 61U_CFUNC void warning(uint32_t linenumber, const char *msg, ...)
b75a7d8f
A
62{
63 if (gShowWarning)
64 {
65 va_list va;
66
67 va_start(va, msg);
374ca955 68 fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber);
b75a7d8f
A
69 vfprintf(stderr, msg, va);
70 fprintf(stderr, "\n");
71 va_end(va);
72 }
73}