comparison debug.h @ 0:435ac1cdb64e

create task dandy directry.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Sat, 11 Dec 2010 21:25:28 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:435ac1cdb64e
1 #ifndef __debug_h
2 #define __debug_h
3
4 #if 0
5 extern code(*abort_ptr) ();
6 #define SET_ABORT(x) code (*abort_ptr)()=(x)
7
8 extern code dbg_abort(int errcode);
9 // #define DEBUG_ABORT(errcode) {goto dbg_abort(errcode);}
10
11 extern void print_profile();
12
13 #ifndef ALLOC_STACK
14 #include"stack.h"
15 #endif
16
17 extern Stack current_sp;
18 extern Stack stack_peak;
19
20 #undef ALLOC_STACK
21 #define ALLOC_STACK(sp,size) {\
22 (sp)-=(size);\
23 current_sp=(sp);\
24 if(sp<stack_peak){\
25 stack_peak=sp;\
26 }\
27 if((sp)<general_stack){\
28 goto dbg_abort(2);\
29 }\
30 }
31 #undef FREE_STACK
32 #define FREE_STACK(sp,size) {\
33 (sp)+=(size);\
34 current_sp=(sp);\
35 if((sp)>Stacklast){\
36 goto dbg_abort(3);\
37 }\
38 }
39 #endif
40
41 extern void dbg_init(const char *);
42 extern int dbg_printf(const char *, ...);
43
44 #ifdef USE_MYRAND
45 extern int myrand(void);
46 extern int myrand_open_file(char *);
47 #define rand myrand
48 #else
49 #define myrand_open_file(f) (0)
50 #endif
51 #endif // __debug_h