You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
4.4 KiB

26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
  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. struct _db_code_state_;
  20. extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword);
  21. extern int _db_strict_keyword_(const char *keyword);
  22. extern int _db_explain_(struct _db_code_state_ *cs, char *buf, int len);
  23. extern int _db_explain_init_(char *buf, int len);
  24. extern void _db_setjmp_(void);
  25. extern void _db_longjmp_(void);
  26. extern void _db_process_(const char *name);
  27. extern void _db_push_(const char *control);
  28. extern void _db_pop_(void);
  29. extern void _db_set_(struct _db_code_state_ *cs, const char *control);
  30. extern void _db_set_init_(const char *control);
  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_end_(void);
  41. extern void _db_lock_file_(void);
  42. extern void _db_unlock_file_(void);
  43. extern FILE *_db_fp_(void);
  44. #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
  45. char **_db_framep_; \
  46. _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
  47. &_db_framep_)
  48. #define DBUG_LEAVE \
  49. _db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
  50. #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
  51. #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
  52. #define DBUG_EXECUTE(keyword,a1) \
  53. do {if (_db_keyword_(0, (keyword))) { a1 }} while(0)
  54. #define DBUG_EXECUTE_IF(keyword,a1) \
  55. do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0)
  56. #define DBUG_EVALUATE(keyword,a1,a2) \
  57. (_db_keyword_(0,(keyword)) ? (a1) : (a2))
  58. #define DBUG_EVALUATE_IF(keyword,a1,a2) \
  59. (_db_strict_keyword_((keyword)) ? (a1) : (a2))
  60. #define DBUG_PRINT(keyword,arglist) \
  61. do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0)
  62. #define DBUG_PUSH(a1) _db_push_ (a1)
  63. #define DBUG_POP() _db_pop_ ()
  64. #define DBUG_SET(a1) _db_set_ (0, (a1))
  65. #define DBUG_SET_INITIAL(a1) _db_set_init_ (a1)
  66. #define DBUG_PROCESS(a1) _db_process_(a1)
  67. #define DBUG_FILE _db_fp_()
  68. #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
  69. #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
  70. #define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2)
  71. #define DBUG_END() _db_end_ ()
  72. #define DBUG_LOCK_FILE _db_lock_file_()
  73. #define DBUG_UNLOCK_FILE _db_unlock_file_()
  74. #define DBUG_ASSERT(A) assert(A)
  75. #define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
  76. #define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
  77. #else /* No debugger */
  78. #define DBUG_ENTER(a1)
  79. #define DBUG_LEAVE
  80. #define DBUG_RETURN(a1) do { return(a1); } while(0)
  81. #define DBUG_VOID_RETURN do { return; } while(0)
  82. #define DBUG_EXECUTE(keyword,a1) do { } while(0)
  83. #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
  84. #define DBUG_EVALUATE(keyword,a1,a2) (a2)
  85. #define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
  86. #define DBUG_PRINT(keyword,arglist) do { } while(0)
  87. #define DBUG_PUSH(a1)
  88. #define DBUG_SET(a1)
  89. #define DBUG_SET_INITIAL(a1)
  90. #define DBUG_POP()
  91. #define DBUG_PROCESS(a1) (a1)
  92. #define DBUG_SETJMP(a1) setjmp(a1)
  93. #define DBUG_LONGJMP(a1) longjmp(a1)
  94. #define DBUG_DUMP(keyword,a1,a2)
  95. #define DBUG_END()
  96. #define DBUG_ASSERT(A)
  97. #define DBUG_LOCK_FILE
  98. #define DBUG_FILE (stderr)
  99. #define DBUG_UNLOCK_FILE
  100. #define DBUG_EXPLAIN(buf,len)
  101. #define DBUG_EXPLAIN_INITIAL(buf,len)
  102. #endif
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #endif