debug.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * debug.h
  3. * contains utilitary functions for debugging
  4. *
  5. * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
  6. * Copyright (c) 2010 Martin S. All Rights Reserved.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef __DEBUG_H
  23. #define __DEBUG_H
  24. #include <plist/plist.h>
  25. #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE)
  26. #define debug_info(...) debug_info_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
  27. #define debug_plist(a) debug_plist_real (__func__, __FILE__, __LINE__, a)
  28. #elif defined(__GNUC__) && __GNUC__ >= 3 && !defined(STRIP_DEBUG_CODE)
  29. #define debug_info(...) debug_info_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
  30. #define debug_plist(a) debug_plist_real (__FUNCTION__, __FILE__, __LINE__, a)
  31. #else
  32. #define debug_info(...)
  33. #define debug_plist(a)
  34. #endif
  35. void debug_info_real(const char *func,
  36. const char *file,
  37. int line,
  38. const char *format, ...);
  39. void debug_buffer(const char *data, const int length);
  40. void debug_buffer_to_file(const char *file, const char *data, const int length);
  41. void debug_plist_real(const char *func,
  42. const char *file,
  43. int line,
  44. plist_t plist);
  45. void internal_set_debug_level(int level);
  46. #endif