27#ifdef USE_BOOST_MULTITHREADING
28#include "boost/thread/mutex.hpp"
41#define mfunname(string) \
42 static const char* FunNameIIII = string; \
43 FunNameWatch funnw(FunNameIIII)
45#define mfunname(string)
49#define mfunnamep(string) \
50 static const char* FunNameIIII = string; \
51 FunNameWatch funnw(FunNameIIII)
59#define check_econd1(condition, a1, stream) \
62 stream << '\n' << #condition << '\n'; \
63 stream << #a1 << '=' << (a1) << '\n'; \
66#define check_wcond1(condition, a1, stream) \
69 stream << '\n' << #condition << '\n'; \
70 stream << #a1 << '=' << (a1) << '\n'; \
73#define check_econd11(a, signb, stream) \
76 stream << '\n' << #a << #signb << '\n'; \
77 stream << #a << '=' << (a) << '\n'; \
81#define check_econd12(a, sign, b, stream) \
84 stream << '\n' << #a << #sign << #b << '\n'; \
85 stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
90#define check_econd11a(a, signb, add, stream) \
93 stream << '\n' << #a << #signb << '\n'; \
94 stream << #a << '=' << (a) << '\n'; \
99#define check_econd12a(a, sign, b, add, stream) \
101 funnw.ehdr(stream); \
102 stream << '\n' << #a << #sign << #b << '\n'; \
103 stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
109#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream) \
110 if (a sign1_b1_sign0 a sign2_b2) { \
111 funnw.ehdr(stream); \
112 stream << '\n' << #a << #sign1_b1_sign0 << #a << #sign2_b2 << '\n'; \
113 stream << #a << '=' << (a) << '\n'; \
118#define check_econd23(a, sign1, b1, sign0, sign2, b2, stream) \
119 if (a sign1 b1 sign0 a sign2 b2) { \
120 funnw.ehdr(stream); \
121 stream << '\n' << #a << #sign1 << #b1 << #sign0 << #a << #sign2 << #b2 \
123 stream << #a << '=' << (a) << ' ' << #b1 << '=' << (b1) << ' ' << #b2 \
124 << '=' << (b2) << '\n'; \
129#define check_econd24(a1, sign1, b1, sign0, a2, sign2, b2, stream) \
130 if (a1 sign1 b1 sign0 a2 sign2 b2) { \
131 funnw.ehdr(stream); \
132 stream << '\n' << #a1 << #sign1 << #b1 << #sign0 << #a2 << #sign2 << #b2 \
134 stream << #a1 << '=' << (a1) << ' ' << #b1 << '=' << (b1) << '\n'; \
135 stream << #a2 << '=' << (a2) << ' ' << #b2 << '=' << (b2) << '\n'; \
141#define check_econd1(condition, a1, stream) \
143 stream << "ERROR:\n"; \
144 stream << '\n' << #condition << '\n'; \
145 stream << #a1 << '=' << (a1) << '\n'; \
148#define check_wcond1(condition, a1, stream) \
150 stream << "WARNING:\n"; \
151 stream << '\n' << #condition << '\n'; \
152 stream << #a1 << '=' << (a1) << '\n'; \
155#define check_econd11(a, signb, stream) \
157 stream << "ERROR:\n"; \
158 stream << '\n' << #a << #signb << '\n'; \
159 stream << #a << '=' << (a) << '\n'; \
163#define check_econd12(a, sign, b, stream) \
165 stream << "ERROR:\n"; \
166 stream << '\n' << #a << #sign << #b << '\n'; \
167 stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
172#define check_econd11a(a, signb, add, stream) \
174 stream << "ERROR:\n"; \
175 stream << '\n' << #a << #signb << '\n'; \
176 stream << #a << '=' << (a) << '\n'; \
181#define check_econd12a(a, sign, b, add, stream) \
183 stream << "ERROR:\n"; \
184 stream << '\n' << #a << #sign << #b << '\n'; \
185 stream << #a << '=' << (a) << ' ' << #b << '=' << (b) << '\n'; \
191#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream) \
192 if (a sign1_b1_sign0 a sign2_b2) { \
193 stream << "ERROR:\n"; \
194 stream << '\n' << #a << #sign1_b1_sign0 << #a << #sign2_b2 << '\n'; \
195 stream << #a << '=' << (a) << '\n'; \
200#define check_econd23(a, sign1, b1, sign0, sign2, b2, stream) \
201 if (a sign1 b1 sign0 a sign2 b2) { \
202 stream << "ERROR:\n"; \
203 stream << '\n' << #a << #sign1 << #b1 << #sign0 << #a << #sign2 << #b2 \
205 stream << #a << '=' << (a) << ' ' << #b1 << '=' << (b1) << ' ' << #b2 \
206 << '=' << (b2) << '\n'; \
211#define check_econd24(a1, sign1, b1, sign0, a2, sign2, b2, stream) \
212 if (a1 sign1 b1 sign0 a2 sign2 b2) { \
213 stream << "ERROR:\n"; \
214 stream << '\n' << #a1 << #sign1 << #b1 << #sign0 << #a2 << #sign2 << #b2 \
216 stream << #a1 << '=' << (a1) << ' ' << #b1 << '=' << (b1) << '\n'; \
217 stream << #a2 << '=' << (a2) << ' ' << #b2 << '=' << (b2) << '\n'; \
225#define check_econd1(condition, a1, stream)
226#define check_wcond1(condition, a1, stream)
228#define check_econd11(a, signb, stream)
229#define check_econd12(a, sign, b, stream)
230#define check_econd11a(a, signb, add, stream)
231#define check_econd12a(a, sign, b, add, stream)
233#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
235#define check_econd23(a, sign1, b1, sign0, sign2, b2, stream)
237#define check_econd24(a1, sign1, b1, sign0, a2, sign2, b2, stream)
256#define spexit(stream) \
258 stream << FunNameStack::instance(); \
259 stream << "File is " << __FILE__ << " , line number is " << __LINE__ \
261 spexit_action(stream); \
269#ifdef USE_BOOST_MULTITHREADING
280 static const int pqname = 1000;
293 NameStack(
void) : qname(0), id(0), nmode(0) {
294 for (
int n = 0; n < pqname; n++) name[n] = NULL;
296 NameStack(
const NameStack& f) : qname(0), id(0), nmode(0) { *
this = f; }
298 NameStack& operator=(
const NameStack& f);
302 for (
int n = 0; n < qname; n++)
delete name[n];
322#ifdef USE_BOOST_MULTITHREADING
325 NameStack* get_thread_stack(
void)
const;
326 NameStack* get_thread_stack_q(
long& nthread,
long& qthread)
const;
329 void remove_thread_stack(
void);
331#ifdef USE_BOOST_MULTITHREADING
332 std::list<NameStack>* namestack;
337 static const int pqname = 1000;
362#ifdef USE_BOOST_MULTITHREADING
363 std::ostream& printname(std::ostream& file, NameStack* ns,
int n);
365 std::ostream& printname(std::ostream& file,
int n);
372 void printput(std::ostream& file);
374 void printdel(std::ostream& file);
376 inline int put(
const char* fname);
377 inline void del(
int nname);
397 std::ostream&
hdr(std::ostream& file)
const {
398 file << name <<
": ";
402 std::ostream&
whdr(std::ostream& file)
const {
403 file << name <<
": WARNING:\n";
407 std::ostream&
ehdr(std::ostream& file)
const {
408 file << name <<
": ERROR:\n";
412std::ostream&
operator<<(std::ostream& file,
const FunNameWatch& f);
414#include "wcpplib/util/FunNameStack.ic"
friend std::ostream & operator<<(std::ostream &file, const FunNameStack &f)
static FunNameStack & instance()
FunNameStack & operator=(const FunNameStack &f)
void replace(const char *fname)
void set_parameters(int fs_act=1, int fs_print=0)
int put(const char *fname)
std::ostream & ehdr(std::ostream &file) const
std::ostream & whdr(std::ostream &file) const
FunNameWatch(const char *fname)
std::ostream & hdr(std::ostream &file) const
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
void spexit_action(std::ostream &file)
int s_throw_exception_in_spexit