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
23void 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
34static UBool gShowWarning = TRUE;
35
36void setShowWarning(UBool val)
37{
38    gShowWarning = val;
39}
40
41UBool getShowWarning(){
42    return gShowWarning;
43}
44
45static UBool gStrict =FALSE;
46UBool isStrict(){
47    return gStrict;
48}
49void setStrict(UBool val){
50    gStrict = val;
51}
52static UBool gVerbose =FALSE;
53UBool isVerbose(){
54    return gVerbose;
55}
56void setVerbose(UBool val){
57    gVerbose = val;
58}
59void 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
73