source: git/factory/libfac/factor/debug.h @ 6ce030f

spielwiese
Last change on this file since 6ce030f was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 1.9 KB
Line 
1////////////////////////////////////////////////////////////
2////////////////////////////////////////////////////////////
3// It is possible to include this file multiple times for different
4// settings of FACDEBUG and/or DEBUGOUTPUT
5
6#undef ASSERT
7#undef __ASSERT
8#undef STICKYASSERT
9#undef DEBOUT
10#undef DEBOUTLN
11#undef DEBINCLEVEL
12#undef DEBDECLEVEL
13#undef DEBOUTSL
14#undef DEBOUTMSG
15#undef DEBOUTNL
16
17#include <stdio.h>
18#include <stdlib.h>
19
20#ifdef NDEBUG
21#define ASSERT(ignore1,ignore2)((void)0)
22#else
23#define ASSERT(expression,message) \
24((void)((expression) ? 0 : __ASSERT(#expression, message, __FILE__, __LINE__)))
25#endif
26
27#define STICKYASSERT(expression,message) \
28((void)((expression) ? 0 : __ASSERT(#expression, message, __FILE__, __LINE__)))
29
30#define __ASSERT(expression, message, file, line)  \
31(fprintf( stderr, "error: %s\n%s:%u: failed assertion `%s'\n", \
32 message, file, line, expression ), abort(), 0 )
33
34#ifdef DEBUGOUTPUT
35void deb_inc_level(); // use this helper routines from factory
36void deb_dec_level(); // use this helper routines from factory
37extern char * deb_level_msg; // from factory
38#define DEBINCLEVEL(stream,msg) \
39(stream << "\n" << deb_level_msg << "entering << " << msg << " >>" << "\n", deb_inc_level())
40#define DEBDECLEVEL(stream,msg) \
41(deb_dec_level(), stream << deb_level_msg << "leaving << " << msg << " >>" << "\n")
42#define DEBOUTSL(stream) \
43(stream << deb_level_msg, stream.flush())
44#define DEBOUT(stream,msg,object) \
45(stream << deb_level_msg << msg << object, stream.flush())
46#define DEBOUTLN(stream,msg,object) \
47(stream << deb_level_msg << msg << object << "\n")
48#define DEBOUTMSG(stream,msg) \
49(stream << deb_level_msg << msg << "\n")
50#define DEBOUTNL(stream) \
51(stream << "\n")
52#else
53#define DEBINCLEVEL(stream,msg)
54#define DEBDECLEVEL(stream,msg)
55#define DEBOUTSL(stream)
56#define DEBOUT(stream,msg,object)
57#define DEBOUTLN(stream,msg,object)
58#define DEBOUTMSG(stream,msg)
59#define DEBOUTNL(stream)
60#endif
61
Note: See TracBrowser for help on using the repository browser.