trace.h 856 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Squeezelite for esp32
  3. *
  4. * (c) Sebastien 2019
  5. * Philippe G. 2019, philippe_44@outlook.com
  6. *
  7. * This software is released under the MIT License.
  8. * https://opensource.org/licenses/MIT
  9. *
  10. */
  11. #pragma once
  12. #ifndef QUOTE
  13. #define QUOTE(name) #name
  14. #endif
  15. #ifndef STR
  16. #define STR(macro) QUOTE(macro)
  17. #endif
  18. #define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)
  19. #ifndef STR_OR_ALT
  20. #define STR_OR_ALT(str,alt) (str?str:alt)
  21. #endif
  22. #define ENUM_TO_STRING(g) \
  23. case g: \
  24. return STR(g); \
  25. break;
  26. extern const char unknown_string_placeholder[];
  27. extern const char * str_or_unknown(const char * str);
  28. extern const char * str_or_null(const char * str);
  29. #ifndef FREE_AND_NULL
  30. #define FREE_AND_NULL(x) if(x) { free(x); x=NULL; }
  31. #endif
  32. #ifndef CASE_TO_STR
  33. #define CASE_TO_STR(x) case x: return STR(x); break;
  34. #endif