forked from arminbiere/kissat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging.h
364 lines (306 loc) · 8.24 KB
/
logging.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#ifndef _logging_h_INCLUDED
#define _logging_h_INCLUDED
#if defined(LOGGING) && !defined(QUIET)
#include "attribute.h"
#include "extend.h"
#include "reference.h"
#include "watch.h"
// clang-format off
const char * kissat_log_lit (kissat *, unsigned lit);
const char * kissat_log_var (kissat *, unsigned idx);
void kissat_log_msg (kissat *, const char*, const char *fmt, ...)
ATTRIBUTE_FORMAT (3, 4);
void kissat_log_clause (kissat *, const char*, const clause *, const char *, ...)
ATTRIBUTE_FORMAT (4, 5);
void kissat_log_counted_clause (kissat *, const char*, const clause *,
const unsigned *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_binary (kissat *, const char*,
unsigned, unsigned, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_unary (kissat *, const char*, unsigned, const char *, ...)
ATTRIBUTE_FORMAT (4, 5);
void kissat_log_lits (kissat *, const char*,
size_t, const unsigned *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_litset (kissat *, const char*,
size_t, const unsigned *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_litpart (kissat *, const char*,
size_t, const unsigned *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_counted_lits (kissat *, const char*,
size_t, const unsigned *,
const unsigned * counts, const char *, ...)
ATTRIBUTE_FORMAT (6, 7);
void kissat_log_unsigneds (kissat *, const char*,
size_t, const unsigned *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_ints (kissat *, const char*,
size_t, const int *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_extensions (kissat *, const char *,
size_t, const extension *, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
void kissat_log_xor (struct kissat *, const char*, unsigned lit,
unsigned size, const unsigned *lits, const char *fmt, ...)
ATTRIBUTE_FORMAT (6, 7);
void kissat_log_ref (kissat *, const char*, reference, const char *, ...)
ATTRIBUTE_FORMAT (4, 5);
void kissat_log_resolvent (kissat *, const char*, const char *, ...)
ATTRIBUTE_FORMAT (3, 4);
void kissat_log_watch (kissat *, const char*,
unsigned, watch, const char *, ...)
ATTRIBUTE_FORMAT (5, 6);
// clang-format on
#ifndef LOGPREFIX
#define LOGPREFIX "LOG"
#endif
#define LOG(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_msg (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOG2(...) \
do { \
if (solver && GET_OPTION (log) > 1) \
kissat_log_msg (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOG3(...) \
do { \
if (solver && GET_OPTION (log) > 2) \
kissat_log_msg (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOG4(...) \
do { \
if (solver && GET_OPTION (log) > 3) \
kissat_log_msg (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOG5(...) \
do { \
if (solver && GET_OPTION (log) > 4) \
kissat_log_msg (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGLITS(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_lits (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGLITSET(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_litset (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGLITPART(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_litpart (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGCOUNTEDLITS(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_counted_lits (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGLITS3(...) \
do { \
if (GET_OPTION (log) > 2) \
kissat_log_lits (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGRES(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_resolvent (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGRES2(...) \
do { \
if (solver && GET_OPTION (log) > 1) \
kissat_log_resolvent (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGEXT(...) \
do { \
if (GET_OPTION (log)) \
kissat_log_extensions (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGEXT2(...) \
do { \
if (GET_OPTION (log) > 1) \
kissat_log_extensions (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGINTS(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_ints (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGINTS3(...) \
do { \
if (GET_OPTION (log) > 2) \
kissat_log_ints (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGUNSIGNEDS3(...) \
do { \
if (GET_OPTION (log) > 2) \
kissat_log_unsigneds (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGCLS(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_clause (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGCOUNTEDCLS(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_counted_clause (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGLINE(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_line (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGCLS2(...) \
do { \
if (GET_OPTION (log) > 1) \
kissat_log_clause (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGCLS3(...) \
do { \
if (GET_OPTION (log) > 2) \
kissat_log_clause (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGREF(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_ref (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGREF2(...) \
do { \
if (solver && GET_OPTION (log) > 1) \
kissat_log_ref (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGBINARY(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_binary (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGBINARY2(...) \
do { \
if (GET_OPTION (log) > 1) \
kissat_log_binary (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGBINARY3(...) \
do { \
if (GET_OPTION (log) > 2) \
kissat_log_binary (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGUNARY(...) \
do { \
if (solver && GET_OPTION (log)) \
kissat_log_unary (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGLIT(LIT) kissat_log_lit (solver, (LIT))
#define LOGVAR(IDX) kissat_log_var (solver, (IDX))
#define LOGWATCH(...) \
do { \
if (GET_OPTION (log)) \
kissat_log_watch (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#define LOGXOR(...) \
do { \
if (GET_OPTION (log)) \
kissat_log_xor (solver, LOGPREFIX, __VA_ARGS__); \
} while (0)
#else
#define LOG(...) \
do { \
} while (0)
#define LOG2(...) \
do { \
} while (0)
#define LOG3(...) \
do { \
} while (0)
#define LOG4(...) \
do { \
} while (0)
#define LOG5(...) \
do { \
} while (0)
#define LOGRES(...) \
do { \
} while (0)
#define LOGRES2(...) \
do { \
} while (0)
#define LOGLITS(...) \
do { \
} while (0)
#define LOGLITSET(...) \
do { \
} while (0)
#define LOGLITPART(...) \
do { \
} while (0)
#define LOGLITS3(...) \
do { \
} while (0)
#define LOGCOUNTEDLITS(...) \
do { \
} while (0)
#define LOGEXT(...) \
do { \
} while (0)
#define LOGEXT2(...) \
do { \
} while (0)
#define LOGINTS(...) \
do { \
} while (0)
#define LOGINTS3(...) \
do { \
} while (0)
#define LOGUNSIGNEDS3(...) \
do { \
} while (0)
#define LOGCLS(...) \
do { \
} while (0)
#define LOGCLS2(...) \
do { \
} while (0)
#define LOGCLS3(...) \
do { \
} while (0)
#define LOGCOUNTEDCLS(...) \
do { \
} while (0)
#define LOGLINE(...) \
do { \
} while (0)
#define LOGREF(...) \
do { \
} while (0)
#define LOGREF2(...) \
do { \
} while (0)
#define LOGBINARY(...) \
do { \
} while (0)
#define LOGBINARY2(...) \
do { \
} while (0)
#define LOGBINARY3(...) \
do { \
} while (0)
#define LOGUNARY(...) \
do { \
} while (0)
#define LOGWATCH(...) \
do { \
} while (0)
#define LOGXOR(...) \
do { \
} while (0)
#endif
#define LOGTMP(...) \
LOGLITS (SIZE_STACK (solver->clause), BEGIN_STACK (solver->clause), \
__VA_ARGS__)
#endif