00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _dbug_h
00018 #define _dbug_h
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 #if !defined(DBUG_OFF) && !defined(_lint)
00024 extern int _db_on_,_no_db_;
00025 extern FILE *_db_fp_;
00026 extern char *_db_process_;
00027 extern int _db_keyword_(const char *keyword);
00028 extern void _db_setjmp_(void);
00029 extern void _db_longjmp_(void);
00030 extern void _db_push_(const char *control);
00031 extern void _db_pop_(void);
00032 extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
00033 const char **_sfunc_,const char **_sfile_,
00034 uint *_slevel_, char ***);
00035 extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
00036 uint *_slevel_);
00037 extern void _db_pargs_(uint _line_,const char *keyword);
00038 extern void _db_doprnt_ _VARARGS((const char *format,...));
00039 extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
00040 uint length);
00041 extern void _db_output_();
00042 extern void _db_lock_file();
00043 extern void _db_unlock_file();
00044
00045 #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
00046 char **_db_framep_; \
00047 _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
00048 &_db_framep_)
00049 #define DBUG_LEAVE \
00050 (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
00051 #define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
00052 #define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
00053 #define DBUG_EXECUTE(keyword,a1) \
00054 {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
00055 #define DBUG_PRINT(keyword,arglist) \
00056 {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
00057 #define DBUG_PUSH(a1) _db_push_ (a1)
00058 #define DBUG_POP() _db_pop_ ()
00059 #define DBUG_PROCESS(a1) (_db_process_ = a1)
00060 #define DBUG_FILE (_db_fp_)
00061 #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
00062 #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
00063 #define DBUG_DUMP(keyword,a1,a2)\
00064 {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
00065 #define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
00066 #define DEBUGGER_OFF _no_db_=1;_db_on_=0;
00067 #define DEBUGGER_ON _no_db_=0
00068 #define DBUG_LOCK_FILE { _db_lock_file(); }
00069 #define DBUG_UNLOCK_FILE { _db_unlock_file(); }
00070 #define DBUG_OUTPUT(A) { _db_output_(A); }
00071 #define DBUG_ASSERT(A) assert(A)
00072 #else
00073
00074 #define DBUG_ENTER(a1)
00075 #define DBUG_RETURN(a1) return(a1)
00076 #define DBUG_VOID_RETURN return
00077 #define DBUG_EXECUTE(keyword,a1) {}
00078 #define DBUG_PRINT(keyword,arglist) {}
00079 #define DBUG_PUSH(a1) {}
00080 #define DBUG_POP() {}
00081 #define DBUG_PROCESS(a1) {}
00082 #define DBUG_FILE (stderr)
00083 #define DBUG_SETJMP setjmp
00084 #define DBUG_LONGJMP longjmp
00085 #define DBUG_DUMP(keyword,a1,a2) {}
00086 #define DBUG_IN_USE 0
00087 #define DEBUGGER_OFF
00088 #define DEBUGGER_ON
00089 #define DBUG_LOCK_FILE
00090 #define DBUG_UNLOCK_FILE
00091 #define DBUG_OUTPUT(A)
00092 #define DBUG_ASSERT(A) {}
00093 #endif
00094 #ifdef __cplusplus
00095 }
00096 #endif
00097 #endif