5#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS)
9# include <machine/stdarg.h>
14#if HAVE_ADDRESSABLE_VA_LIST
15# define VA_LIST_REF_T va_list *
16# define VA_LIST_DEREF(val) (*(val))
17# define VA_LIST_REF(val) (&(val))
19# define VA_LIST_REF_T va_list
20# define VA_LIST_DEREF(val) (val)
21# define VA_LIST_REF(val) (val)
26# define ERRH_SENTINEL __attribute__((sentinel))
121 e_warning_annotated[],
160 return the_default_handler;
172 return the_silent_handler;
186 void debug(
const char *fmt, ...);
188 void message(
const char *fmt, ...);
193 int warning(
const char *fmt, ...);
196 int error(
const char *fmt, ...);
201 int fatal(
const char *fmt, ...);
204 void ldebug(
const String &landmark,
const char *fmt, ...);
210 int lerror(
const String &landmark,
const char *fmt, ...);
212 int lfatal(
const String &landmark,
const char *fmt, ...);
265 const char *fmt, va_list val) {
349 static String xformat(
int default_flags,
const char *fmt, ...);
351 static String vxformat(
int default_flags,
const char *fmt, va_list val);
424 virtual void *
emit(
const String &str,
void *user_data,
bool more);
517 const char *begin,
const char *end, ...) ERRH_SENTINEL;
527 static const
char *
skip_anno(const
char *begin, const
char *end) {
529 const char *x = begin;
544 if (x && x[0] ==
'{')
564 typedef String (*ConversionFunction)(
int flags, VA_LIST_REF_T);
577 static Conversion *add_conversion(
const String &name, ConversionFunction func);
578 static int remove_conversion(Conversion *conversion);
588 const char *begin,
const char *end,
631 void *
emit(
const String &str,
void *user_data,
bool more);
641#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS)
655 void set_default_flags(
int default_flags) {
656 _default_flags = default_flags;
660 void *
emit(
const String &str,
void *user_data,
bool more);
749 return _context_printed;
754 _context_printed = x;
790 bool _context_printed;
860#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS)
A stackable ErrorHandler that exits when errors occur.
Definition error.hh:866
void account(int level)
Account for an error message at level level.
Definition error.cc:1240
A stackable ErrorHandler that prints context lines.
Definition error.hh:737
void set_context(const String &str)
Set the context string to str.
Definition error.hh:758
void set_context_landmark(const String &str)
Set the context landmark to str.
Definition error.hh:779
void set_context_printed(bool x)
Set whether the context has been printed.
Definition error.hh:753
void set_indent(const String &str)
Set the indent string to str.
Definition error.hh:767
String decorate(const String &str)
Decorate an error message.
Definition error.cc:1168
bool context_printed() const
Return true iff the context has already been printed.
Definition error.hh:748
Error reporting class.
Definition error.hh:90
int xmessage(const String &anno, const char *fmt, va_list val)
Format and print an error message, adding annotations.
Definition error.hh:241
static String xformat(int default_flags, const char *fmt,...)
Format an error string.
Definition error.cc:764
ConversionFlags
Definition error.hh:565
@ cf_signed
Set for conversions of signed numbers.
Definition error.hh:573
@ cf_alternate_form
Set for conversions using the '#' flag.
Definition error.hh:570
@ cf_space_positive
Set for conversions using the ' ' flag.
Definition error.hh:568
@ cf_utf8
Set to use UTF-8 characters on output.
Definition error.hh:575
@ cf_negative
Set for conversions of negative numbers.
Definition error.hh:574
@ cf_uppercase
Set for 'X' conversions (not 'x').
Definition error.hh:572
@ cf_zero_pad
Set for conversions using the '0' flag.
Definition error.hh:566
@ cf_left_just
Set for conversions using the '-' flag.
Definition error.hh:569
@ cf_plus_positive
Set for conversions using the '+' flag.
Definition error.hh:567
@ cf_singlequote
Set for conversions using the '\'' flag.
Definition error.hh:571
static void static_cleanup()
Tear down the ErrorHandler implementation.
Definition error.cc:1091
virtual String decorate(const String &str)
Decorate an error message.
Definition error.cc:927
int error(const char *fmt,...)
Print an error message (level el_error).
Definition error.cc:825
virtual void clear()
Clear accumulated error state.
Definition error.hh:446
static String make_anno(const char *name, const String &value)
Create an error annotation.
Definition error.cc:98
static ErrorHandler * silent_handler()
Return the global silent ErrorHandler.
Definition error.hh:171
static const char * skip_anno(const char *begin, const char *end)
Skip a string's error annotations.
Definition error.hh:527
Level
Error level constants.
Definition error.hh:98
@ el_error
Error level for normal error conditions.
Definition error.hh:105
@ el_abort
Error level that triggers abort().
Definition error.hh:99
@ el_alert
Alert error level: action must be taken.
Definition error.hh:103
@ el_fatal
Definition error.hh:100
@ el_emergency
Emergency error level: system is unusable.
Definition error.hh:102
@ el_debug
Error level for debug messages.
Definition error.hh:110
@ el_critical
Error level for critical conditions.
Definition error.hh:104
@ el_info
Error level for informational messages.
Definition error.hh:109
@ el_warning
Error level for warning conditions.
Definition error.hh:106
@ el_notice
Definition error.hh:107
int nerrors() const
Return the number of errors reported via this handler.
Definition error.hh:286
int xmessage(const String &str)
Print an annotated error message.
Definition error.cc:898
virtual void * emit(const String &str, void *user_data, bool more)
Output an error message line.
Definition error.cc:933
int xmessage(const String &landmark, const String &anno, const String &str)
Print an error message, adding landmark and other annotations.
Definition error.hh:251
static const char e_abort[]
Error level indicators.
Definition error.hh:114
static ErrorHandler * static_initialize(ErrorHandler *errh)
Initialize the ErrorHandler implementation.
Definition error.cc:1074
virtual void account(int level)
Account for an error message at level level.
Definition error.hh:438
virtual String vformat(const char *fmt, va_list val)
Format an error string.
Definition error.cc:921
int fatal(const char *fmt,...)
Print a fatal error message (level el_fatal).
Definition error.cc:835
ErrorHandler()
Construct an ErrorHandler.
Definition error.hh:127
static const int ok_result
Definition error.hh:176
int warning(const char *fmt,...)
Print a warning message (level el_warning).
Definition error.cc:815
static String make_landmark_anno(const String &x)
Return a landmark annotation equal to x.
Definition error.hh:543
void message(const char *fmt,...)
Print an informational message (level el_info).
Definition error.cc:806
int xmessage(const String &landmark, const String &anno, const char *fmt, va_list val)
Format and print an error message, adding landmark and other annotations.
Definition error.hh:264
int xmessage(const String &anno, const String &str)
Print an error message, adding annotations.
Definition error.hh:232
static const char * parse_anno(const String &str, const char *begin, const char *end,...) ERRH_SENTINEL
Parse error annotations from a string.
Definition error.cc:200
static String vxformat(const char *fmt, va_list val)
Definition error.hh:355
static String combine_anno(const String &str, const String &anno)
Apply annotations from anno to every line in str.
Definition error.cc:238
static ErrorHandler * default_handler()
Return the default ErrorHandler.
Definition error.hh:159
void lmessage(const String &landmark, const char *fmt,...)
Print an informational message with a landmark annotation.
Definition error.cc:855
void ldebug(const String &landmark, const char *fmt,...)
Print a debug message with a landmark annotation.
Definition error.cc:845
static void set_default_handler(ErrorHandler *errh)
Set the default ErrorHandler to errh.
Definition error.cc:1104
static String vxformat(int default_flags, const char *fmt, va_list val)
Definition error.cc:385
static String clean_landmark(const String &landmark, bool colon=false)
Clean the landmark.
Definition error.cc:301
static const int error_result
Definition error.hh:178
int lerror(const String &landmark, const char *fmt,...)
Print an error message with a landmark annotation.
Definition error.cc:876
int lfatal(const String &landmark, const char *fmt,...)
Print a fatal error message with a landmark annotation.
Definition error.cc:887
int lwarning(const String &landmark, const char *fmt,...)
Print a warning message with a landmark annotation.
Definition error.cc:865
void debug(const char *fmt,...)
Print a debug message (level el_debug).
Definition error.cc:797
String format(const char *fmt,...)
Format an error string.
Definition error.cc:784
Base class for ErrorHandlers that forward messages.
Definition error.hh:618
void account(int level)
Account for an error message at level level.
Definition error.cc:1142
String decorate(const String &str)
Decorate an error message.
Definition error.cc:1124
ErrorVeneer(ErrorHandler *errh)
Construct an ErrorVeneer.
Definition error.hh:625
String vformat(const char *fmt, va_list val)
Format an error string.
Definition error.cc:1115
void * emit(const String &str, void *user_data, bool more)
Output an error message line.
Definition error.cc:1133
An ErrorHandler that prints error messages to a given file.
Definition error.hh:648
void * emit(const String &str, void *user_data, bool more)
Output an error message line.
Definition error.cc:962
void account(int level)
Account for an error message at level level.
Definition error.cc:975
String vformat(const char *fmt, va_list val)
Format an error string.
Definition error.cc:956
A stackable ErrorHandler that adds a default landmark to error messages.
Definition error.hh:839
String decorate(const String &str)
Decorate an error message.
Definition error.cc:1222
void set_landmark(const String &landmark)
Set the default landmark applied to error messages.
Definition error.hh:847
A convenience stackable ErrorHandler.
Definition error.hh:687
LocalErrorHandler(ErrorHandler *errh)
Construct a LocalErrorHandler.
Definition error.hh:690
A stackable ErrorHandler that adds a prefix to error messages.
Definition error.hh:808
String decorate(const String &str)
Decorate an error message.
Definition error.cc:1206
An ErrorHandler that does not report messages.
Definition error.hh:600
A string of characters.
Definition string.hh:22