BAM
Abstract Machine for Bottom-Up Evaluation with the Push Method
Main Page
Related Pages
Classes
Files
File List
File Members
base
check.h
Go to the documentation of this file.
1
// ============================================================================
2
// Project: Deductive Database
3
// Filename: check.h
4
// Purpose: Runtime Assertion Check
5
// Last Change: 04.08.2017
6
// Language: C++
7
// EMail: brass@informatik.uni-halle.de
8
// WWW: http://www.informatik.uni-halle.de/~brass/
9
// Address: Feldschloesschen 15, D-06120 Halle (Saale), GERMANY
10
// Copyright: (c) 1997-2017 by Stefan Brass
11
// License: See file "LICENSE" for copying conditions.
12
// Note: There is no warranty at all - this code may contain bugs.
13
// ============================================================================
14
15
22
//=============================================================================
23
// Include File Frame:
24
//=============================================================================
25
26
#ifndef CHECK_INCLUDED
27
#define CHECK_INCLUDED
28
29
//=============================================================================
30
// Used Types and Macros:
31
//=============================================================================
32
33
#ifndef VER_INCLUDED
34
#include "../base/ver.h"
35
#endif
36
37
#ifndef STR_INCLUDED
38
#include "../base/str.h"
39
#endif
40
41
42
//=============================================================================
43
// Exported Functions:
44
//=============================================================================
45
46
//-----------------------------------------------------------------------------
47
// check_init:
48
//-----------------------------------------------------------------------------
49
54
void
check_init
();
55
56
//-----------------------------------------------------------------------------
57
// CHECK:
58
//-----------------------------------------------------------------------------
59
64
#if VER_DEBUG
65
#define CHECK(EX, MSG) \
66
(void)((EX) || (check_failed(__FILE__, __LINE__, MSG), 0))
67
68
#else
69
#define CHECK(EX, MSG) \
70
((void)0)
71
#endif
72
73
//-----------------------------------------------------------------------------
74
// CHECK_VALID:
75
//-----------------------------------------------------------------------------
76
81
#if VER_DEBUG
82
#define CHECK_VALID(PLACE) \
83
check_emsg(__FILE__, __LINE__, PLACE, (this==0)?"this is null":check())
84
#else
85
#define CHECK_VALID(EX) \
86
((void)0)
87
#endif
88
89
//-----------------------------------------------------------------------------
90
// CHECK_PAR:
91
//-----------------------------------------------------------------------------
92
97
#if VER_DEBUG
98
#define CHECK_PAR(PAR, PLACE) \
99
check_emsg(__FILE__, __LINE__, PLACE, \
100
((PAR)==0) ? "parameter is null": (PAR)->check())
101
#else
102
#define CHECK_PAR(PAR, PLACE) \
103
((void)0)
104
#endif
105
106
//-----------------------------------------------------------------------------
107
// CHECK_PAR_NULLOK:
108
//-----------------------------------------------------------------------------
109
114
#if VER_DEBUG
115
#define CHECK_PAR_NULLOK(PAR, PLACE) \
116
check_emsg(__FILE__, __LINE__, PLACE, \
117
((PAR)==0) ? STR_NULL: (PAR)->check())
118
#else
119
#define CHECK_PAR_NULLOK(PAR, PLACE) \
120
((void)0)
121
#endif
122
123
//-----------------------------------------------------------------------------
124
// CHECK_SUBOBJ:
125
//-----------------------------------------------------------------------------
126
131
#if VER_DEBUG
132
#define CHECK_SUBOBJ(OBJ, PLACE) \
133
check_emsg(__FILE__, __LINE__, PLACE, (OBJ).check())
134
#else
135
#define CHECK_SUBOBJ(OBJ, PLACE) \
136
((void)0)
137
#endif
138
139
//-----------------------------------------------------------------------------
140
// CHECK_IMPOSSIBLE:
141
//-----------------------------------------------------------------------------
142
147
#if VER_DEBUG
148
#define CHECK_IMPOSSIBLE(MSG) \
149
check_failed(__FILE__, __LINE__, MSG)
150
#else
151
#define CHECK_IMPOSSIBLE(MSG) \
152
((void)0)
153
#endif
154
155
//-----------------------------------------------------------------------------
156
// CHECK_CODE:
157
//-----------------------------------------------------------------------------
158
163
#if VER_DEBUG
164
#define CHECK_CODE(CODE) \
165
CODE
166
#else
167
#define CHECK_CODE(CODE)
168
#endif
169
170
//-----------------------------------------------------------------------------
171
// CHECK_ERR:
172
//-----------------------------------------------------------------------------
173
178
#if VER_DEBUG
179
#define CHECK_ERR(MSG) \
180
return (dump(), (MSG))
181
#else
182
#define CHECK_ERR(MSG) \
183
return (MSG)
184
#endif
185
186
187
//=============================================================================
188
// Local Functions (only used for implementation):
189
//=============================================================================
190
191
192
//-----------------------------------------------------------------------------
193
// check_failed:
194
//-----------------------------------------------------------------------------
195
196
#if VER_DEBUG
197
202
void
check_failed(
str_t
file,
int
line,
str_t
msg);
203
204
#endif
205
206
//-----------------------------------------------------------------------------
207
// check_emsg:
208
//-----------------------------------------------------------------------------
209
210
#if VER_DEBUG
211
216
void
check_emsg(
str_t
file,
int
line,
str_t
place,
str_t
msg);
217
218
#endif
219
220
//-----------------------------------------------------------------------------
221
// check_on_exit:
222
//-----------------------------------------------------------------------------
223
224
#if VER_DEBUG
225
230
void
check_on_exit(
void
(*f)());
231
232
#endif
233
234
//=============================================================================
235
// End of File:
236
//=============================================================================
237
238
#endif
239
str_t
const char * str_t
Definition:
str.h:41
check_init
void check_init()
Generated by
1.8.10