intl/icu/source/tools/genrb/errmsg.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/tools/genrb/errmsg.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 1998-2011, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*
    1.12 +* File error.c
    1.13 +*
    1.14 +* Modification History:
    1.15 +*
    1.16 +*   Date        Name        Description
    1.17 +*   05/28/99    stephen     Creation.
    1.18 +*******************************************************************************
    1.19 +*/
    1.20 +
    1.21 +#include <stdarg.h>
    1.22 +#include <stdio.h>
    1.23 +#include "cstring.h"
    1.24 +#include "errmsg.h"
    1.25 +
    1.26 +U_CFUNC void error(uint32_t linenumber, const char *msg, ...)
    1.27 +{
    1.28 +    va_list va;
    1.29 +
    1.30 +    va_start(va, msg);
    1.31 +    fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber);
    1.32 +    vfprintf(stderr, msg, va);
    1.33 +    fprintf(stderr, "\n");
    1.34 +    va_end(va);
    1.35 +}
    1.36 +
    1.37 +static UBool gShowWarning = TRUE;
    1.38 +
    1.39 +U_CFUNC void setShowWarning(UBool val)
    1.40 +{
    1.41 +    gShowWarning = val;
    1.42 +}
    1.43 +
    1.44 +U_CFUNC UBool getShowWarning(){
    1.45 +    return gShowWarning;
    1.46 +}
    1.47 +
    1.48 +static UBool gStrict =FALSE;
    1.49 +U_CFUNC UBool isStrict(){
    1.50 +    return gStrict;
    1.51 +}
    1.52 +U_CFUNC void setStrict(UBool val){
    1.53 +    gStrict = val;
    1.54 +}
    1.55 +static UBool gVerbose =FALSE;
    1.56 +U_CFUNC UBool isVerbose(){
    1.57 +    return gVerbose;
    1.58 +}
    1.59 +U_CFUNC void setVerbose(UBool val){
    1.60 +    gVerbose = val;
    1.61 +}
    1.62 +U_CFUNC void warning(uint32_t linenumber, const char *msg, ...)
    1.63 +{
    1.64 +    if (gShowWarning)
    1.65 +    {
    1.66 +        va_list va;
    1.67 +
    1.68 +        va_start(va, msg);
    1.69 +        fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber);
    1.70 +        vfprintf(stderr, msg, va);
    1.71 +        fprintf(stderr, "\n");
    1.72 +        va_end(va);
    1.73 +    }
    1.74 +}

mercurial