olaf neophyte and de.po updates, valgrind tweaks, delete green lady, inkscape dpi=96
[goodguy/history.git] / cinelerra-5.1 / guicast / bctrace.inc
1 #ifndef __BCTRACE_INC__
2 #define __BCTRACE_INC__
3
4 //#define ENABLE_TRACE
5 #define TRACE_LOCKS
6 //#define TRACE_MEMORY
7 #define TRACE_THREADS
8 #define TRACE_LOCKS
9
10 class BC_Trace;
11 class trace_item;
12 class execution_item;
13 class lock_item;
14 class memory_item;
15 class file_item;
16 class bc_trace_t;
17 class bc_trace_spin;
18 class bc_trace_mutex;
19
20 class TheLock;
21 class TheLocker;
22 class TheDbg;
23 class TheList;
24 class TheChk;
25
26 class trace_info {
27 public:
28         void *trace;
29         trace_info() { trace = 0; }
30         ~trace_info() {}
31 };
32
33 #ifdef NO_GUICAST
34
35 #undef ENABLE_TRACE
36 #undef TRACE_LOCKS
37 #undef TRACE_MEMORY
38 #undef TRACE_THREADS
39
40 #endif
41
42
43 #ifdef ENABLE_TRACE
44 // Add a trace
45 #define TRACE(text) BC_Trace::new_trace(text);
46 #define SET_TRACE BC_Trace::new_trace(__FILE__, __FUNCTION__, __LINE__);
47 #define PRINT_TRACE { printf("%s: %d\n", __FILE__, __LINE__); fflush(stdout); }
48 // Delete all traces
49 #define UNTRACE BC_Trace::delete_traces();
50
51 #else
52
53 #define TRACE(text) ;
54 #define UNTRACE ;
55 #define PRINT_TRACE { printf("%s: %d\n", __FILE__, __LINE__); fflush(stdout); }
56 //#define PRINT_TRACE ;
57 #define SET_TRACE ;
58
59 #endif
60
61
62 #ifdef TRACE_LOCKS
63 // Before user acquires
64 #define SET_LOCK(info, title, location) \
65  int table_id = BC_Trace::set_lock(title, location, info);
66 // After successful acquisition of a mutex, the table is flagged
67 #define SET_LOCK2 BC_Trace::set_lock2(table_id, this);
68 // After successful acquisition of a condition, the table is removed because
69 // the user never unlocks a condition after locking it.
70 // Release current lock table after failing to acquire
71 #define UNSET_LOCK2 BC_Trace::unset_lock2(table_id, this);
72
73 // Release current owner of lock
74 #define UNSET_LOCK(info) BC_Trace::unset_lock(info);
75 // Delete a lock
76 #define UNSET_ALL_LOCKS(info) BC_Trace::unset_all_locks(info);
77
78 #define LOCK_LOCKS(s) BC_Trace::lock_locks(s);
79 #define UNLOCK_LOCKS BC_Trace::unlock_locks();
80 #define CLEAR_LOCKS_TID(tid) BC_Trace::clear_locks_tid(tid);
81
82 #else
83
84 #define SET_LOCK(title, location) ;
85 #define SET_LOCK2 ;
86 #define SET_LOCK2_CONDITION ;
87 #define UNSET_LOCK(info) ;
88 #define UNSET_LOCK2 ;
89 #define UNSET_ALL_LOCKS(info) ;
90
91 #define LOCK_LOCKS(s) ;
92 #define UNLOCK_LOCKS ;
93 #define CLEAR_LOCKS_TID(tid) ;
94 #endif
95
96
97 #ifdef TRACE_MEMORY
98
99 #define ENABLE_BUFFER BC_Trace::enable_memory();
100 #define DISABLE_BUFFER BC_Trace::disable_memory();
101 // Note the size, pointer, and location of an allocation
102 #define BUFFER(size, ptr, location) BC_Trace::set_buffer(size, ptr, location);
103 // Note the pointer and location of an allocation
104 #define BUFFER2(ptr, location) BC_Trace::set_buffer(0, ptr, location);
105 // Remove a pointer from the allocation table
106 #define UNBUFFER(ptr) BC_Trace::unset_buffer(ptr);
107
108 #else
109
110 #define ENABLE_BUFFER ;
111 #define DISABLE_BUFFER ;
112 #define BUFFER(size, ptr, location);
113 #define UNBUFFER(ptr);
114
115 #endif
116
117 // Handling of temporary files in crash
118 #define SET_TEMP BC_Trace::set_temp
119 #define UNSET_TEMP BC_Trace::unset_temp
120
121 #endif