2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
15 * logging.h - methods for logging warnings, errors and trace info
18 #ifndef angel_logging_h
19 #define angel_logging_h
26 * Provides a standard method of generating run-time system
27 * warnings. The actual action taken by this code can be board or
28 * target application specific, e.g. internal logging, debug message,
31 extern void __rt_warning(char *format
, ...);
33 /*---------------------------------------------------------------------------*/
38 * Raise an internal Angel error. The parameters are passed directly
39 * to "__rt_warning" for display, and the code then raises a debugger
40 * event and stops the target processing.
42 extern void __rt_error(char *format
, ...);
45 * Some macros for debugging and warning messages
48 typedef enum WarnLevel
{
54 void va_warn(WarnLevel level
, char *format
, va_list args
);
57 /* stupidity in MSVC <wingdi.h> (in <windows.h> in <winsock.h>) */
62 # define ERROR_FORMAT "Error \"%s\" in %s at line %d\n"
63 # define ERROR(e) __rt_error(ERROR_FORMAT, (e), __FILE__, __LINE__)
67 # ifdef ASSERTIONS_ENABLED
68 # define ASSERT(x, y) ((x) ? (void)(0) : ERROR((y)))
70 # define ASSERT(x, y) ((void)(0))
75 # ifdef ASSERTIONS_ENABLED
76 # define WARN_FORMAT "Warning \"%s\" in %s at line %d\n"
77 # define WARN(w) __rt_warning(WARN_FORMAT, (w), __FILE__, __LINE__)
79 # define WARN(w) ((void)(0))
84 #ifdef NO_INFO_MESSAGES
85 # define __rt_info (void)
90 # define __rt_info __rt_warning
93 # define INFO(w) __rt_warning("%s\n", (w))
95 # define INFO(w) ((void)(0))
101 #if defined(DEBUG) && !defined(NO_IDLE_CHITCHAT)
103 # define DO_TRACE (1)
108 extern void __rt_trace(char *format
, ...);
113 # define TRACE(w) __rt_trace("%s ", (w))
115 # define TRACE(w) ((void)(0))
119 #endif /* ndef angel_logging_h */