Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
debug_vs.h
Go to the documentation of this file.
1 #ifndef _DEBUG_VS_H_
2 #define _DEBUG_VS_H_
3 
4 //#define VS_DEBUG
5 //#define VS_DEBUG1
6 //#define VS_DEBUG2
7 //#define VS_DEBUG3
8 
9 #ifndef VS_DEBUG
10 inline void VS_DEBUG_ERROR() {}
11 #define VSCONSTRUCT1( a )
12 #define VSDESTRUCT1
13 #define VSCONSTRUCT2( a )
14 #define VSDESTRUCT2
15 #define VSCONSTRUCT3( a )
16 #define VSDESTRUCT3
17 
18 #else
19 void VS_DEBUG_ERROR();
20 
21 #error
22 #include "hashtable.h"
23 extern Hashtable< long, char, 65535 >constructed;
24 extern Hashtable< long, char, 65535 >destructed;
25 #define VSCONST( a ) \
26  do { \
27  if (constructed.Get( (long) this ) != NULL) VS_DEBUG_ERROR(); \
28  if (destructed.Get( (long) this ) != NULL) destructed.Delete( (long) this ); \
29  if (destructed.Get( (long) this ) != NULL) VS_DEBUG_ERROR(); \
30  constructed.Put( (long) this, (char*) a ); \
31  } \
32  while (0)
33 
34 #define VSDEST \
35  do { \
36  if (constructed.Get( (long) this ) == NULL) VS_DEBUG_ERROR(); \
37  else constructed.Delete( (long) this ); \
38  if (constructed.Get( (long) this ) != NULL) VS_DEBUG_ERROR(); \
39  if (destructed.Get( (long) this ) != NULL) VS_DEBUG_ERROR(); \
40  destructed.Put( (long) this, (char*) this ); \
41  } \
42  while (0)
43 
44 #define VSCONSTRUCT1( a ) VSCONST( a )
45 #define VSDESTRUCT1 VSDEST
46 
47 #ifdef VS_DEBUG2
48 #define VSCONSTRUCT2( a ) VSCONST( a )
49 #define VSDESTRUCT2 VSDEST
50 #ifdef VS_DEBUG3
51 #define VSCONSTRUCT3( a ) VSCONST( a )
52 #define VSDESTRUCT3 VSDEST
53 
54 #else
55 #define VSCONSTRUCT2( a )
56 #define VSDESTRUCT2
57 #define VSCONSTRUCT3( a )
58 #define VSDESTRUCT3
59 #endif
60 #else
61 #define VSCONSTRUCT1( a )
62 #define VSDESCRUCT1
63 #define VSCONSTRUCT2( a )
64 #define VSDESCRUCT2
65 #define VSCONSTRUCT3( a )
66 #define VSDESCRUCT3
67 
68 #endif
69 #endif
70 #endif
71