Quantum Fog  0.9.3
ANSI_UDebugging.h
1 //Mac CodeWarrior PowerPlant users can replace this by UDebugging.h
2 //to increase functionality.
3 #pragma once
4 #include <iostream.h>
5 
6 //********************Throw Debugging
7 #define Throw_Err(err) throw (ExceptionCode)(err)
8  #ifdef Debug_Throw
9  #define SetDebugThrow_(inAction) //do nothing
10  #define Throw_(err) \
11  do { \
12  cerr<<"Exception Thrown"<<endl; \
13  if(err=='nilP'){ \
14  cerr<<" Reason: Nil Pointer"<<endl; \
15  }else if(err=='asrt'){ \
16  cerr<<" Reason: Assertion Failed"<<endl; \
17  } \
18  cerr<<" File: "<<__FILE__<<endl; \
19  cerr<<" Line: "<<__LINE__<<endl; \
20  Throw_Err(err); \
21  } while (false)
22 
23 #else
24  #define SetDebugThrow_(inAction) //do nothing
25  #define Throw_(err) Throw_Err(err)
26 #endif // Debug_Throw
27 //********************Signal Debugging
28 #ifdef Debug_Signal
29  #define SetDebugSignal_(inAction) //do nothing
30  #define SignalCStr_(cstr) \
31  do { \
32  cerr<<"Signal Raised"<<endl; \
33  cerr<<" Message: "<<cstr<<endl; \
34  cerr<<" File: "<<__FILE__<<endl; \
35  cerr<<" Line: "<<__LINE__<<endl; \
36  } while (false)
37 
38  #define SignalIf_(test) \
39  do { \
40  if (test) SignalCStr_(#test); \
41  } while (false)
42 #else
43  #define SetDebugSignal_(inAction) //do nothing
44  #define SignalCStr_(cstr) //do nothing
45  #define SignalIf_(test) //do nothing
46 #endif // Debug_Signal