22 #if UT_ASSERT_LEVEL > 0
26 #if defined(_WIN32) && defined(_DEBUG) && defined(CRT_DEBUG)
27 #define _CRTDBG_MAP_ALLOC
38 { myState = (
getenv(name) != 0); }
39 bool on()
const {
return myState; }
40 bool off()
const {
return !myState; }
41 void setDebugFile(
const char *)
const;
42 void output(
const char *fmt, ...)
const;
53 bool on()
const {
return false; }
54 bool off()
const {
return true; }
55 void setDebugFile(
const char *)
const;
56 void output(
const char *, ...)
const;
65 #define UT_IFELSE(t, f) t
71 #define UT_IFELSE(t, f) f
77 UT_API void UTdbgout(
const char *file,
int lineno,
const char *text);
93 #if UT_ASSERT_LEVEL > 0
95 #define UTdebugFormat(...) do { \
96 UT_WorkBuffer dbostr; \
97 dbostr.format(__VA_ARGS__); \
98 UTdbgout(__FILE__, __LINE__, dbostr.buffer()); \
101 #define UTdebugFormatCd(color, ...) do { \
102 UT_WorkBuffer dbostr, cdstr; \
103 dbostr.format(__VA_ARGS__); \
104 if (strcmp(#color, "none") == 0) \
107 cdstr.sprintf("%s%s%s", UTconsoleColorString(#color), dbostr.buffer(), UTconsoleColorString("none")); \
108 UTdbgout(__FILE__, __LINE__, cdstr.buffer()); \
111 #define UTdebugPrint(...) do { \
112 UT_WorkBuffer dbostr; \
113 dbostr.format(nullptr, __VA_ARGS__); \
114 UTdbgout(__FILE__, __LINE__, dbostr.buffer()); \
117 #define UTdebugPrintCd(color, ...) do { \
118 UT_WorkBuffer dbostr, cdstr; \
119 dbostr.format(nullptr, __VA_ARGS__); \
120 if (strcmp(#color, "none") == 0) \
123 cdstr.sprintf("%s%s%s", UTconsoleColorString(#color), dbostr.buffer(), UTconsoleColorString("none")); \
124 UTdbgout(__FILE__, __LINE__, cdstr.buffer()); \
127 #define UT_DBGOUT(ZZ) do { \
128 UT_WorkBuffer dbostr; \
129 dbostr.sprintf ZZ ; \
130 UTdbgout(__FILE__, __LINE__, dbostr.buffer()); \
133 #define UT_DBGOS(ZZ) do { \
134 std::stringstream os; \
136 UTdbgout(__FILE__,__LINE__,os.str().c_str()); \
139 #define UT_DBGPRINTF(ZZ) printf ZZ
141 #define UT_DBG_CHECKMEMORY UTdebugCheckMemory()
142 #define UT_DBG_CHECKPOINTER(PTR) UTdebugCheckPointer(PTR)
144 #define UTdebugFormat(...) ((void)0)
145 #define UTdebugFormatCd(...) ((void)0)
146 #define UTdebugPrint(...) ((void)0)
147 #define UTdebugPrintCd(...) ((void)0)
148 #define UT_DBGOUT(ZZ) ((void)0)
149 #define UT_DBGOS(ZZ) ((void)0)
150 #define UT_DBGPRINTF(ZZ) ((void)0)
151 #define UT_DBG_CHECKMEMORY ((void)0)
152 #define UT_DBG_CHECKPOINTER(PTR) ((void)0)
UT_API bool UTdebugCheckPointer(const void *ptr)
UT_API const char * UTconsoleColorString(const char *colorname)
UT_API void UTdbgout(const char *file, int lineno, const char *text)
GLuint const GLchar * name
UT_API int UTdebugCheckMemory()
OIIO_API string_view getenv(string_view name, string_view defaultval)
UT_API int UTgetSESIlogFlag(int env_control)
UT_API int UTisSESImachine()