Mercurial > libpst
comparison src/define.h @ 63:cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 23 Feb 2008 14:36:17 -0800 |
parents | 7d5c637aaafb |
children | 3cb02cb1e6cd |
comparison
equal
deleted
inserted
replaced
62:ee4e0d00bc94 | 63:cfd6175f9334 |
---|---|
1 /*** | 1 /*** |
2 * define.h | 2 * define.h |
3 * Part of the LibPST project | 3 * Part of the LibPST project |
4 * Written by David Smith | 4 * Written by David Smith |
5 * dave.s@earthcorp.com | 5 * dave.s@earthcorp.com |
6 */ | 6 */ |
7 | 7 |
8 #ifdef HAVE_CONFIG_H | 8 #ifdef HAVE_CONFIG_H |
9 #include "config.h" | 9 #include "config.h" |
10 #endif | 10 #endif |
11 #include "version.h" | 11 #include "version.h" |
12 | 12 |
13 #ifndef DEFINEH_H | 13 #ifndef DEFINEH_H |
14 #define DEFINEH_H | 14 #define DEFINEH_H |
26 #define DEBUG_MODE_FUNC | 26 #define DEBUG_MODE_FUNC |
27 | 27 |
28 //number of items to save in memory between writes | 28 //number of items to save in memory between writes |
29 #define DEBUG_MAX_ITEMS 0 | 29 #define DEBUG_MAX_ITEMS 0 |
30 | 30 |
31 #define DEBUG_FILE_NO 1 | 31 #define DEBUG_FILE_NO 1 |
32 #define DEBUG_INDEX_NO 2 | 32 #define DEBUG_INDEX_NO 2 |
33 #define DEBUG_EMAIL_NO 3 | 33 #define DEBUG_EMAIL_NO 3 |
34 #define DEBUG_WARN_NO 4 | 34 #define DEBUG_WARN_NO 4 |
35 #define DEBUG_READ_NO 5 | 35 #define DEBUG_READ_NO 5 |
36 #define DEBUG_INFO_NO 6 | 36 #define DEBUG_INFO_NO 6 |
37 #define DEBUG_MAIN_NO 7 | 37 #define DEBUG_MAIN_NO 7 |
38 #define DEBUG_DECRYPT_NO 8 | 38 #define DEBUG_DECRYPT_NO 8 |
39 #define DEBUG_FUNCENT_NO 9 | 39 #define DEBUG_FUNCENT_NO 9 |
40 #define DEBUG_FUNCRET_NO 10 | 40 #define DEBUG_FUNCRET_NO 10 |
41 #define DEBUG_HEXDUMP_NO 11 | 41 #define DEBUG_HEXDUMP_NO 11 |
42 | 42 |
94 void pst_debug_write(); | 94 void pst_debug_write(); |
95 | 95 |
96 void * xmalloc(size_t size); | 96 void * xmalloc(size_t size); |
97 | 97 |
98 #define MESSAGEPRINT(x,y) {pst_debug_msg_info(__LINE__,__FILE__,y);\ | 98 #define MESSAGEPRINT(x,y) {pst_debug_msg_info(__LINE__,__FILE__,y);\ |
99 pst_debug_msg_text x;} | 99 pst_debug_msg_text x;} |
100 | 100 |
101 #define LOGSTOP() {MESSAGESTOP();DEBUGSTOP();} | 101 #define LOGSTOP() {MESSAGESTOP();DEBUGSTOP();} |
102 | 102 |
103 #define DIE(x) {\ | 103 #define DIE(x) {\ |
104 MESSAGEPRINT(x, 0);\ | 104 MESSAGEPRINT(x, 0);\ |
129 #endif | 129 #endif |
130 | 130 |
131 #ifdef DEBUG_MODE_EMAIL | 131 #ifdef DEBUG_MODE_EMAIL |
132 #define DEBUG_EMAIL(x) MESSAGEPRINT(x, DEBUG_EMAIL_NO); | 132 #define DEBUG_EMAIL(x) MESSAGEPRINT(x, DEBUG_EMAIL_NO); |
133 #define DEBUG_EMAIL_HEXPRINT(x,y) {pst_debug_msg_info(__LINE__, __FILE__, 11);\ | 133 #define DEBUG_EMAIL_HEXPRINT(x,y) {pst_debug_msg_info(__LINE__, __FILE__, 11);\ |
134 pst_debug_hexdump(x, y, 0x10, 0);} | 134 pst_debug_hexdump(x, y, 0x10, 0);} |
135 #else | 135 #else |
136 #define DEBUG_EMAIL(x) {} | 136 #define DEBUG_EMAIL(x) {} |
137 #define DEBUG_EMAIL_HEXPRINT(x,y) {} | 137 #define DEBUG_EMAIL_HEXPRINT(x,y) {} |
138 #endif | 138 #endif |
139 | 139 |
184 #define DEBUG_HEXDUMP(x, s) {} | 184 #define DEBUG_HEXDUMP(x, s) {} |
185 #define DEBUG_HEXDUMPC(x, s, c) {} | 185 #define DEBUG_HEXDUMPC(x, s, c) {} |
186 #endif | 186 #endif |
187 | 187 |
188 #define DEBUG_FILE(x) {pst_debug_msg_info(__LINE__, __FILE__, DEBUG_FILE_NO);\ | 188 #define DEBUG_FILE(x) {pst_debug_msg_info(__LINE__, __FILE__, DEBUG_FILE_NO);\ |
189 pst_debug_msg_text x;} | 189 pst_debug_msg_text x;} |
190 | 190 |
191 #ifdef DEBUG_MODE_FUNC | 191 #ifdef DEBUG_MODE_FUNC |
192 # define DEBUG_ENT(x) \ | 192 # define DEBUG_ENT(x) \ |
193 { \ | 193 { \ |
194 pst_debug_func(x); \ | 194 pst_debug_func(x); \ |
195 MESSAGEPRINT(("Entering function\n"),DEBUG_FUNCENT_NO); \ | 195 MESSAGEPRINT(("Entering function %s\n",x),DEBUG_FUNCENT_NO); \ |
196 } | 196 } |
197 # define DEBUG_RET() \ | 197 # define DEBUG_RET() \ |
198 { \ | 198 { \ |
199 MESSAGEPRINT(("Leaving function\n"),DEBUG_FUNCRET_NO); \ | 199 MESSAGEPRINT(("Leaving function\n"),DEBUG_FUNCRET_NO); \ |
200 pst_debug_func_ret(); \ | 200 pst_debug_func_ret(); \ |
201 } | 201 } |
202 #else | 202 #else |
203 # define DEBUG_ENT(x) {} | 203 # define DEBUG_ENT(x) {} |
204 # define DEBUG_RET() {} | 204 # define DEBUG_RET() {} |
205 #endif | 205 #endif |
206 | 206 |
207 #define DEBUG_INIT(fname) {pst_debug_init(fname);} | 207 #define DEBUG_INIT(fname) {pst_debug_init(fname);} |
208 #define DEBUG_CLOSE() {pst_debug_close();} | 208 #define DEBUG_CLOSE() {pst_debug_close();} |
209 #define DEBUG_REGISTER_CLOSE() {if(atexit(pst_debug_close)!=0) fprintf(stderr, "Error registering atexit function\n");} | 209 #define DEBUG_REGISTER_CLOSE() {if(atexit(pst_debug_close)!=0) fprintf(stderr, "Error registering atexit function\n");} |
210 | 210 |
211 #define RET_DERROR(res, ret_val, x)\ | 211 #define RET_DERROR(res, ret_val, x)\ |
212 if (res) { DIE(x);} | 212 if (res) { DIE(x);} |
213 | 213 |
214 #define RET_ERROR(res, ret_val)\ | 214 #define RET_ERROR(res, ret_val)\ |
215 if (res) {return ret_val;} | 215 if (res) {return ret_val;} |
216 | 216 |
217 #define DEBUG_VERSION 1 | 217 #define DEBUG_VERSION 1 |
218 struct pst_debug_file_rec_m { | 218 struct pst_debug_file_rec_m { |
219 unsigned short int funcname; | 219 unsigned short int funcname; |
220 unsigned short int filename; | 220 unsigned short int filename; |
221 unsigned short int text; | 221 unsigned short int text; |
222 unsigned short int end; | 222 unsigned short int end; |
223 unsigned int line; | 223 unsigned int line; |
224 unsigned int type; | 224 unsigned int type; |
225 }; | 225 }; |
226 | 226 |
227 struct pst_debug_file_rec_l { | 227 struct pst_debug_file_rec_l { |
228 unsigned int funcname; | 228 unsigned int funcname; |
229 unsigned int filename; | 229 unsigned int filename; |
230 unsigned int text; | 230 unsigned int text; |
231 unsigned int end; | 231 unsigned int end; |
232 unsigned int line; | 232 unsigned int line; |
233 unsigned int type; | 233 unsigned int type; |
234 }; | 234 }; |
235 | 235 |
236 #endif //DEFINEH_H | 236 #endif //DEFINEH_H |