ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
logging.hpp
Go to the documentation of this file.
1#ifndef _logging_hpp_INCLUDED
2#define _logging_hpp_INCLUDED
3
4#include "global.h"
5
6/*------------------------------------------------------------------------*/
7#ifdef LOGGING
8/*------------------------------------------------------------------------*/
9
10#include <cstdint>
11#include <vector>
12
14
15namespace CaDiCaL {
16
17// For debugging purposes and to help understanding what the solver is doing
18// there is a logging facility which is compiled in by './configure -l'. It
19// still has to be enabled at run-time though (again using the '-l' option
20// in the stand-alone solver). It produces quite a bit of information.
21
22using namespace std;
23
24struct Clause;
25struct Gate;
26struct Internal;
27
28struct Logger {
29
30 static void print_log_prefix (Internal *);
31
32 // Simple logging of a C-style format string.
33 //
34 static void log (Internal *, const char *fmt, ...)
36
37 // Prints the format string (with its argument) and then the clause. The
38 // clause can also be a zero pointer and then is interpreted as a decision
39 // (current decision level > 0) or unit clause (zero decision level) and
40 // printed accordingly.
41 //
42 static void log (Internal *, const Clause *, const char *fmt, ...)
44
45 // Same as before, except that this is meant for the global 'clause' stack
46 // used for new clauses (and not for reasons).
47 //
48 static void log (Internal *, const vector<int> &, const char *fmt, ...)
50
51 // Another variant, to avoid copying (without logging).
52 //
53 static void log (Internal *, const vector<int>::const_iterator &begin,
54 const vector<int>::const_iterator &end, const char *fmt,
55 ...) CADICAL_ATTRIBUTE_FORMAT (4, 5);
56
57 // used for logging LRAT proof chains
58 //
59 static void log (Internal *, const vector<int64_t> &, const char *fmt,
60 ...) CADICAL_ATTRIBUTE_FORMAT (3, 4);
61
62 static void log (Internal *, const int *, const unsigned, const char *fmt,
63 ...) CADICAL_ATTRIBUTE_FORMAT (4, 5);
64
65 static void log_empty_line (Internal *);
66
67 static void log (Internal *, const Gate *, const char *fmt, ...)
69
70 static string loglit (Internal *, int lit);
71};
72
73} // namespace CaDiCaL
74
75/*------------------------------------------------------------------------*/
76
77// Make sure that 'logging' code is really not included (second case of the
78// '#ifdef') if logging code is not included.
79
80#define LOG(...) \
81 do { \
82 if (!internal->opts.log) \
83 break; \
84 Logger::log (internal, __VA_ARGS__); \
85 } while (0)
86
87#define LOGLIT(lit) Logger::loglit (internal, lit).c_str ()
88
90
91/*------------------------------------------------------------------------*/
92#else // end of 'then' part of 'ifdef LOGGING'
93/*------------------------------------------------------------------------*/
94
95#define LOG(...) \
96 do { \
97 } while (0)
98
99#define LOGLIT(...)
100
101/*------------------------------------------------------------------------*/
102#endif // end of 'else' part of 'ifdef LOGGING'
103/*------------------------------------------------------------------------*/
104#endif
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
#define CADICAL_ATTRIBUTE_FORMAT(FORMAT_POSITION, VARIADIC_ARGUMENT_POSITION)
Definition cadical.hpp:1105
int lit
Definition satVec.h:130
struct vector vector
Definition vector.h:24
#define const
Definition zconf.h:196