Doxygen Generated Documentation of Ben-Jose Trainable SAT Solver Library
dbg_prt.h
1 
2 
3 /*************************************************************
4 
5 This file is part of ben-jose.
6 
7 ben-jose is free software: you can redistribute it and/or modify
8 it under the terms of the version 3 of the GNU General Public
9 License as published by the Free Software Foundation.
10 
11 ben-jose is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with ben-jose. If not, see <http://www.gnu.org/licenses/>.
18 
19 ------------------------------------------------------------
20 
21 Copyright (C) 2007-2012, 2014-2016. QUIROGA BELTRAN, Jose Luis.
22 Id (cedula): 79523732 de Bogota - Colombia.
23 See https://github.com/joseluisquiroga/ben-jose
24 
25 ben-jose is free software thanks to The Glory of Our Lord
26  Yashua Melej Hamashiaj.
27 Our Resurrected and Living, both in Body and Spirit,
28  Prince of Peace.
29 
30 ------------------------------------------------------------
31 
32 dbg_print.h
33 
34 funcs to print debug info.
35 
36 --------------------------------------------------------------*/
37 
38 #ifndef DBG_PRINT_H
39 #define DBG_PRINT_H
40 
41 #include "tools.h"
42 
43 class brain;
44 
45 void dbg_prt_all_cho(brain& brn);
46 
47 bool dbg_check_lev(solver* slv, long lev);
48 bj_ostream& dbg_get_out_stm(solver* slv);
49 
50 
51 //=================================================================
52 // release dbg defs
53 
54 // use with NULL_BRN_PT when brn is not reachable
55 
56 #define REL_PRT(pt_brn, comms1)
57 
58 /*define REL_PRT(pt_brn, comms1) \
59  { \
60  bj_ostream& os = bj_dbg; \
61  if(pt_brn != NULL_PT){ pt_brn->dbg_prt_margin(os); } \
62  comms1; \
63  os << bj_eol; \
64  os.flush(); \
65  } \
66 
67 //--end_of_def
68 */
69 
70 
71 //=================================================================
72 // debug defs
73 
74 #define DBG_ALL_LVS -1
75 #define INVALID_DBG_LV -123
76 
77 #define DBG_BR_COND(pt_slv, lev, cond) (dbg_check_lev(pt_slv, lev) && (cond))
78 
79 #define DBG_COND(lev, cond) DBG_BR_COND(get_dbg_slv(), lev, cond)
80 
81 #define DBG_COMMAND(lev, comm) \
82  DBG( \
83  if(DBG_COND(lev, true)){ \
84  comm; \
85  } \
86  ) \
87 
88 //--end_of_def
89 
90 #define DBG_COMM_WITH(lev, obj, comm) \
91  DBG( \
92  if(DBG_BR_COND((obj).get_dbg_slv(), lev, true)){ \
93  comm; \
94  } \
95  ) \
96 
97 //--end_of_def
98 
99 void dbg_print_left_margin(solver* pt_slv, bj_ostream& os, long dbg_lv);
100 
101 // bool is_htm_1 = (&bj_dbg != &os);
102 
103 
104 #define DBG_PRT_SLV(pt_slv, o_stm, lev, cond, comm) \
105  DBG( \
106  if(DBG_BR_COND(pt_slv, lev, cond)){ \
107  bj_ostream& os = dbg_get_out_stm(pt_slv); \
108  bool is_htm_1 = false; \
109  if(is_htm_1){ os << bj_eol << "<pre>"; } \
110  dbg_print_left_margin(pt_slv, os, lev); \
111  comm; \
112  if(is_htm_1){ os << "</pre>" << bj_eol; } \
113  os << bj_eol; \
114  os.flush(); \
115  } \
116  ) \
117 
118 //--end_of_def
119 
120 #define DBG_PRT_COND(lev, cond, comm) \
121  DBG_PRT_SLV(get_dbg_slv(), bj_dbg, lev, cond, comm)
122 
123 #define DBG_PRT_COND_WITH(lev, obj, cond, comm) \
124  DBG_PRT_SLV((obj).get_dbg_slv(), bj_dbg, lev, cond, comm)
125 
126 #define DBG_PRT_WITH(lev, obj, comm) \
127  DBG_PRT_SLV((obj).get_dbg_slv(), bj_dbg, lev, true, comm)
128 
129 #define DBG_PRT(lev, comm) DBG_PRT_COND(lev, true, comm)
130 
131 #define DBG_BJ_LIB_CK(prm) DBG_CK(prm)
132 
133 #define DBG_SLOW(prm)
134 //define DBG_SLOW(prm) DBG(prm)
135 
136 #define DBG_PRT_ABORT(brn) \
137  os << "\n________________\n ABORT_DATA\n"; \
138  brn.dbg_prt_margin(os); \
139 
140 //--end_of_def
141 
142 #ifdef FULL_DEBUG
143  ch_string get_cy_dir(brain& brn);
144 #endif
145 
146 void dbg_prt_open(ch_string& path, bj_ofstream& stm, bool append = false);
147 
148 
149 #endif // DBG_PRINT_H
150 
151 
Class that holds all data used to solve a particular CNF instance.
Definition: brain.h:3085