view debug.h @ 70:cee55c8365e9 default tip

fix
author Kazuma
date Thu, 19 May 2016 18:52:26 +0900
parents 435ac1cdb64e
children
line wrap: on
line source

#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