00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __itassert_h
00026 #define __itassert_h
00027
00028 #include <iostream>
00029 #include <string>
00030 #include "spucconfig.h"
00031 namespace SPUC {
00032
00052
00053
00055 void it_assert_f(string ass, string msg, string file, int line);
00057 void it_error_f(string msg, string file, int line);
00059 void it_warning_f(string msg, string file, int line);
00060
00062 void it_enable_exceptions(bool on);
00064 void it_enable_warnings();
00066 void it_disable_warnings();
00068 void it_redirect_warnings(ostream *warn_stream);
00069
00070 #if ASSERT_LEVEL==0 // No tests
00071 # define it_assert0(t,s) ((void)0)
00072 # define it_assert1(t,s) ((void)0)
00073 #elif ASSERT_LEVEL==1 // Only some tests
00074 # define it_assert0(t,s) ((void)0)
00075 # define it_assert1(t,s) (void)((t) || (it_assert_f(#t,s,__FILE__,__LINE__),0))
00076 #else // Full tests
00077
00078 # define it_assert0(t,s) (void)((t) || (it_assert_f(#t,s,__FILE__,__LINE__),0))
00079
00080 # define it_assert1(t,s) (void)((t) || (it_assert_f(#t,s,__FILE__,__LINE__),0))
00081 #endif // ASSERT_LEVEL
00082
00084 #define it_assert(t,s) (void)((t) || (it_assert_f(#t,s,__FILE__,__LINE__),0))
00085
00086 #define it_error_if(t,s) (void)((!(t)) || (it_error_f(s,__FILE__,__LINE__),0))
00087
00088 #define it_error(s) it_error_f(s,__FILE__,__LINE__)
00089
00090 #define it_warning(s) it_warning_f(s,__FILE__,__LINE__)
00091
00093 }
00094 #endif // __itassert_h