Mercurial > hg > Members > koba > t_dandy
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debug.h Sat Dec 11 21:25:28 2010 +0900 @@ -0,0 +1,51 @@ +#ifndef __debug_h +#define __debug_h + +#if 0 +extern code(*abort_ptr) (); +#define SET_ABORT(x) code (*abort_ptr)()=(x) + +extern code dbg_abort(int errcode); +// #define DEBUG_ABORT(errcode) {goto dbg_abort(errcode);} + +extern void print_profile(); + +#ifndef ALLOC_STACK +#include"stack.h" +#endif + +extern Stack current_sp; +extern Stack stack_peak; + +#undef ALLOC_STACK +#define ALLOC_STACK(sp,size) {\ + (sp)-=(size);\ + current_sp=(sp);\ + if(sp<stack_peak){\ + stack_peak=sp;\ + }\ + if((sp)<general_stack){\ + goto dbg_abort(2);\ + }\ +} +#undef FREE_STACK +#define FREE_STACK(sp,size) {\ + (sp)+=(size);\ + current_sp=(sp);\ + if((sp)>Stacklast){\ + goto dbg_abort(3);\ + }\ +} +#endif + +extern void dbg_init(const char *); +extern int dbg_printf(const char *, ...); + +#ifdef USE_MYRAND +extern int myrand(void); +extern int myrand_open_file(char *); +#define rand myrand +#else +#define myrand_open_file(f) (0) +#endif +#endif // __debug_h