dbug.h
Upload User: jxpjxmjjw
Upload Date: 2009-12-07
Package Size: 5877k
Code Size: 3k
Development Platform:

Visual C++

  1. /* Copyright (C) 2000 MySQL AB
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 2 of the License, or
  5.    (at your option) any later version.
  6.    This program is distributed in the hope that it will be useful,
  7.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  8.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9.    GNU General Public License for more details.
  10.    You should have received a copy of the GNU General Public License
  11.    along with this program; if not, write to the Free Software
  12.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  13. #ifndef _dbug_h
  14. #define _dbug_h
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #if !defined(DBUG_OFF) && !defined(_lint)
  19. extern int _db_on_,_no_db_;
  20. extern FILE *_db_fp_;
  21. extern char *_db_process_;
  22. extern int _db_keyword_(const char *keyword);
  23. extern void _db_setjmp_(void);
  24. extern void _db_longjmp_(void);
  25. extern void _db_push_(const char *control);
  26. extern void _db_pop_(void);
  27. extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
  28. const char **_sfunc_,const char **_sfile_,
  29. uint *_slevel_, char ***);
  30. extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
  31.  uint *_slevel_);
  32. extern void _db_pargs_(uint _line_,const char *keyword);
  33. extern void _db_doprnt_ _VARARGS((const char *format,...));
  34. extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
  35.        uint length);
  36. extern void _db_lock_file();
  37. extern void _db_unlock_file();
  38. #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; 
  39. char **_db_framep_; 
  40. _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, 
  41.     &_db_framep_)
  42. #define DBUG_LEAVE 
  43. (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
  44. #define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
  45. #define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
  46. #define DBUG_EXECUTE(keyword,a1) 
  47. {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
  48. #define DBUG_PRINT(keyword,arglist) 
  49. {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
  50. #define DBUG_PUSH(a1) _db_push_ (a1)
  51. #define DBUG_POP() _db_pop_ ()
  52. #define DBUG_PROCESS(a1) (_db_process_ = a1)
  53. #define DBUG_FILE (_db_fp_)
  54. #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
  55. #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
  56. #define DBUG_DUMP(keyword,a1,a2)
  57. {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
  58. #define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
  59. #define DEBUGGER_OFF _no_db_=1;_db_on_=0;
  60. #define DEBUGGER_ON  _no_db_=0
  61. #define DBUG_LOCK_FILE { _db_lock_file(); }
  62. #define DBUG_UNLOCK_FILE { _db_unlock_file(); }
  63. #define DBUG_ASSERT(A) assert(A)
  64. #else /* No debugger */
  65. #define DBUG_ENTER(a1)
  66. #define DBUG_RETURN(a1) return(a1)
  67. #define DBUG_VOID_RETURN return
  68. #define DBUG_EXECUTE(keyword,a1) {}
  69. #define DBUG_PRINT(keyword,arglist) {}
  70. #define DBUG_PUSH(a1) {}
  71. #define DBUG_POP() {}
  72. #define DBUG_PROCESS(a1) {}
  73. #define DBUG_FILE (stderr)
  74. #define DBUG_SETJMP setjmp
  75. #define DBUG_LONGJMP longjmp
  76. #define DBUG_DUMP(keyword,a1,a2) {}
  77. #define DBUG_IN_USE 0
  78. #define DEBUGGER_OFF
  79. #define DEBUGGER_ON
  80. #define DBUG_LOCK_FILE
  81. #define DBUG_UNLOCK_FILE
  82. #define DBUG_ASSERT(A) {}
  83. #endif
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif