00001 /* Copyright (C) 2000 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 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 struct _db_code_state_; 00025 extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword); 00026 extern int _db_strict_keyword_(const char *keyword); 00027 extern int _db_explain_(struct _db_code_state_ *cs, char *buf, int len); 00028 extern int _db_explain_init_(char *buf, int len); 00029 extern void _db_setjmp_(void); 00030 extern void _db_longjmp_(void); 00031 extern void _db_process_(const char *name); 00032 extern void _db_push_(const char *control); 00033 extern void _db_pop_(void); 00034 extern void _db_set_(struct _db_code_state_ *cs, const char *control); 00035 extern void _db_set_init_(const char *control); 00036 extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, 00037 const char **_sfunc_,const char **_sfile_, 00038 uint *_slevel_, char ***); 00039 extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, 00040 uint *_slevel_); 00041 extern void _db_pargs_(uint _line_,const char *keyword); 00042 extern void _db_doprnt_ _VARARGS((const char *format,...)); 00043 extern void _db_dump_(uint _line_,const char *keyword,const char *memory, 00044 uint length); 00045 extern void _db_end_(void); 00046 extern void _db_lock_file_(void); 00047 extern void _db_unlock_file_(void); 00048 extern FILE *_db_fp_(void); 00049 00050 #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ 00051 char **_db_framep_; \ 00052 _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ 00053 &_db_framep_) 00054 #define DBUG_LEAVE \ 00055 _db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_) 00056 #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) 00057 #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) 00058 #define DBUG_EXECUTE(keyword,a1) \ 00059 do {if (_db_keyword_(0, (keyword))) { a1 }} while(0) 00060 #define DBUG_EXECUTE_IF(keyword,a1) \ 00061 do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0) 00062 #define DBUG_EVALUATE(keyword,a1,a2) \ 00063 (_db_keyword_(0,(keyword)) ? (a1) : (a2)) 00064 #define DBUG_EVALUATE_IF(keyword,a1,a2) \ 00065 (_db_strict_keyword_((keyword)) ? (a1) : (a2)) 00066 #define DBUG_PRINT(keyword,arglist) \ 00067 do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0) 00068 #define DBUG_PUSH(a1) _db_push_ (a1) 00069 #define DBUG_POP() _db_pop_ () 00070 #define DBUG_SET(a1) _db_set_ (0, (a1)) 00071 #define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) 00072 #define DBUG_PROCESS(a1) _db_process_(a1) 00073 #define DBUG_FILE _db_fp_() 00074 #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) 00075 #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) 00076 #define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) 00077 #define DBUG_END() _db_end_ () 00078 #define DBUG_LOCK_FILE _db_lock_file_() 00079 #define DBUG_UNLOCK_FILE _db_unlock_file_() 00080 #define DBUG_ASSERT(A) assert(A) 00081 #define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) 00082 #define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) 00083 #else /* No debugger */ 00084 00085 #define DBUG_ENTER(a1) 00086 #define DBUG_LEAVE 00087 #define DBUG_RETURN(a1) do { return(a1); } while(0) 00088 #define DBUG_VOID_RETURN do { return; } while(0) 00089 #define DBUG_EXECUTE(keyword,a1) do { } while(0) 00090 #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) 00091 #define DBUG_EVALUATE(keyword,a1,a2) (a2) 00092 #define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) 00093 #define DBUG_PRINT(keyword,arglist) do { } while(0) 00094 #define DBUG_PUSH(a1) 00095 #define DBUG_SET(a1) 00096 #define DBUG_SET_INITIAL(a1) 00097 #define DBUG_POP() 00098 #define DBUG_PROCESS(a1) (a1) 00099 #define DBUG_SETJMP(a1) setjmp(a1) 00100 #define DBUG_LONGJMP(a1) longjmp(a1) 00101 #define DBUG_DUMP(keyword,a1,a2) 00102 #define DBUG_END() 00103 #define DBUG_ASSERT(A) 00104 #define DBUG_LOCK_FILE 00105 #define DBUG_FILE (stderr) 00106 #define DBUG_UNLOCK_FILE 00107 #define DBUG_EXPLAIN(buf,len) 00108 #define DBUG_EXPLAIN_INITIAL(buf,len) 00109 #endif 00110 #ifdef __cplusplus 00111 } 00112 #endif 00113 #endif
1.4.7

