OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [rdi-share/] [logging.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*
2
 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
3
 *
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
6
 * software.
7
 */
8
 
9
/* -*-C-*-
10
 *
11
 * $Revision: 1.1.1.1 $
12
 *     $Date: 2001-05-18 11:16:45 $
13
 *
14
 *
15
 * logging.h - methods for logging warnings, errors and trace info
16
 */
17
 
18
#ifndef angel_logging_h
19
#define angel_logging_h
20
 
21
#include <stdarg.h>
22
 
23
/*
24
 * __rt_warning
25
 * ------------
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,
29
 * etc.
30
 */
31
extern void __rt_warning(char *format, ...);
32
 
33
/*---------------------------------------------------------------------------*/
34
 
35
/*
36
 * __rt_error
37
 * ----------
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.
41
 */
42
extern void __rt_error(char *format, ...);
43
 
44
/*
45
 * Some macros for debugging and warning messages
46
 */
47
 
48
typedef enum WarnLevel {
49
    WL_TRACE,
50
    WL_WARN,
51
    WL_ERROR
52
} WarnLevel;
53
 
54
void va_warn(WarnLevel level, char *format, va_list args);
55
 
56
#ifdef _WINGDI_
57
/* stupidity in MSVC <wingdi.h> (in <windows.h> in <winsock.h>) */
58
# undef ERROR
59
#endif
60
 
61
#ifndef ERROR
62
# define ERROR_FORMAT "Error \"%s\" in %s at line %d\n"
63
# define ERROR(e) __rt_error(ERROR_FORMAT, (e), __FILE__, __LINE__)
64
#endif
65
 
66
#ifndef ASSERT
67
# ifdef ASSERTIONS_ENABLED
68
#   define ASSERT(x, y) ((x) ? (void)(0) : ERROR((y)))
69
# else
70
#   define ASSERT(x, y) ((void)(0))
71
# endif
72
#endif
73
 
74
#ifndef WARN
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__)
78
# else
79
#   define WARN(w) ((void)(0))
80
# endif
81
#endif
82
 
83
 
84
#ifdef NO_INFO_MESSAGES
85
# define __rt_info (void)
86
# ifndef INFO
87
#   define INFO(w)
88
# endif
89
#else
90
# define __rt_info __rt_warning
91
# ifndef INFO
92
#  ifdef DEBUG
93
#   define INFO(w) __rt_warning("%s\n", (w))
94
#  else
95
#   define INFO(w) ((void)(0))
96
#  endif
97
# endif
98
#endif
99
 
100
 
101
#if defined(DEBUG) && !defined(NO_IDLE_CHITCHAT)
102
# ifndef DO_TRACE
103
#   define DO_TRACE (1)
104
# endif
105
#endif
106
 
107
#ifdef DO_TRACE
108
extern void __rt_trace(char *format, ...);
109
#endif
110
 
111
#ifndef TRACE
112
# ifdef DO_TRACE
113
#   define TRACE(w) __rt_trace("%s ", (w))
114
# else
115
#   define TRACE(w) ((void)(0))
116
# endif
117
#endif
118
 
119
#endif /* ndef angel_logging_h */
120
 
121
/* EOF logging.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.