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

debug.h 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
  3. *
  4. * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
  5. * Michael Clark <michael@metaparadigm.com>
  6. *
  7. * This library is free software; you can redistribute it and/or modify
  8. * it under the terms of the MIT license. See COPYING for details.
  9. *
  10. */
  11. #ifndef _DEBUG_H_
  12. #define _DEBUG_H_
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. extern void mc_set_debug(int debug);
  17. extern int mc_get_debug(void);
  18. extern void mc_set_syslog(int syslog);
  19. extern void mc_abort(const char *msg, ...);
  20. extern void mc_debug(const char *msg, ...);
  21. extern void mc_error(const char *msg, ...);
  22. extern void mc_info(const char *msg, ...);
  23. #ifdef MC_MAINTAINER_MODE
  24. #define MC_SET_DEBUG(x) mc_set_debug(x)
  25. #define MC_GET_DEBUG() mc_get_debug()
  26. #define MC_SET_SYSLOG(x) mc_set_syslog(x)
  27. #define MC_ABORT(x, ...) mc_abort(x, ##__VA_ARGS__)
  28. #define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__)
  29. #define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__)
  30. #define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__)
  31. #else
  32. #define MC_SET_DEBUG(x) if (0) mc_set_debug(x)
  33. #define MC_GET_DEBUG() (0)
  34. #define MC_SET_SYSLOG(x) if (0) mc_set_syslog(x)
  35. #define MC_ABORT(x, ...) if (0) mc_abort(x, ##__VA_ARGS__)
  36. #define MC_DEBUG(x, ...) if (0) mc_debug(x, ##__VA_ARGS__)
  37. #define MC_ERROR(x, ...) if (0) mc_error(x, ##__VA_ARGS__)
  38. #define MC_INFO(x, ...) if (0) mc_info(x, ##__VA_ARGS__)
  39. #endif
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif