home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 July & August / PCWorld_2003-07-08_cd.bin / Software / Vyzkuste / mysql / data1.cab / Development / include / dbug.h < prev    next >
C/C++ Source or Header  |  2003-05-17  |  3KB  |  94 lines

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