DownloadDebug.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // DownloadDebug.h
  19. #ifndef __DOWNLOADDEBUG_H_
  20. #define __DOWNLOADDEBUG_H_
  21. // BGC 3/27/03 - added this for disabling debug logging for "release" worldbuilder.
  22. // uncomment this line to remove logging from game spy code.
  23. //#define DISABLE_DEBUG_LOGGING
  24. #if defined(NDEBUG) || defined(DISABLE_DEBUG_LOGGING)
  25. #define DEBUG_LOG(exp) ((void)0)
  26. #else
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include <stdarg.h>
  31. extern void DebugCrash( const char *fmt, ... );
  32. extern void DebugLog( const char *fmt, ... );
  33. /*
  34. Yeah, it's a sleazy global, since we can't reasonably add
  35. any args to DebugCrash due to the varargs nature of it.
  36. We'll just let it slide in this case...
  37. */
  38. extern char* TheCurrentIgnoreCrashPtr;
  39. #define DEBUG_CRASH(m) \
  40. do { \
  41. { \
  42. static char ignoreCrash = 0; \
  43. if (!ignoreCrash) { \
  44. TheCurrentIgnoreCrashPtr = &ignoreCrash; \
  45. DebugCrash m ; \
  46. TheCurrentIgnoreCrashPtr = NULL; \
  47. } \
  48. } \
  49. } while (0)
  50. #define DEBUG_LOG(x) do { DebugLog x; } while (0)
  51. #define DEBUG_ASSERTCRASH(c, m) do { { if (!(c)) DEBUG_CRASH(m); } } while (0)
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif // NDEBUG
  56. #endif //__DOWNLOADDEBUG_H_