X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fdebug.h;h=f0a1215a8adec4db4b5cd69b29bbda1a3ed81fdc;hb=38cb4182e11e57fc426bede3825e825e9d61433b;hp=59d0ed8edceb9c83179ee22a74f26d85f45af784;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/debug.h b/cinelerra-5.1/guicast/debug.h index 59d0ed8e..f0a1215a 100644 --- a/cinelerra-5.1/guicast/debug.h +++ b/cinelerra-5.1/guicast/debug.h @@ -8,12 +8,12 @@ #include #include -/* Debug macros turned on/off using the environment variable DEBUG. +/* Debug macros turned on/off using the environment variable DEBUG. Set this from the command line as 'DEBUG=foo,bar cinelerra'. Examples: DEBUG=file.C -> all debug statements in file.C DEBUG=func -> all in functions named 'func' - DEBUG=func* -> all in functions (or files) starting with 'func' - DEBUG=file* -> all in files (or functions) starting with 'file' + DEBUG=func* -> all in functions (or files) starting with 'func' + DEBUG=file* -> all in files (or functions) starting with 'file' DEBUG=func1,func2 -> either in func1 or in func2 DEBUG="func, file.C" -> starting with func or in file.C DEBUG=* -> just print all debug statements @@ -22,19 +22,19 @@ Printing can also be controlled at compile time using DEBUG_PRINT_ON/OFF. Code for debug statements is only compiled "#ifdef DEBUG" at compile. */ - + // NOTE: gcc drops '~' from destructors in __func__, so ~FOO becomes FOO static int debug_print_all = 0; -static int debug_should_print(const char *file, - const char *func) +static int debug_should_print(const char *file, + const char *func) { if (debug_print_all) return 1; char *debug = getenv("DEBUG"); if (! debug) return 0; - + char *next = debug; for (char *test = debug; next != NULL; test = next + 1) { next = strchr(test, ','); @@ -54,14 +54,14 @@ static int debug_should_print(const char *file, return 0; } - + #define DEBUG_PRINT_ON() debug_print_all = 1 #define DEBUG_PRINT_OFF() debug_print_all = 0 #define DEBUG_PRINT(format, args...) \ printf("%s:%d %s(): " format "\n", __FILE__, __LINE__, __func__, ## args) -// assert debug warning if test fails +// assert debug warning if test fails #define ADEBUG(test, args...) \ if (debug_should_print(__FILE__, __func__)) { \ if (! test) DEBUG_PRINT("ASSERT FAILED (" #test ") " args) \ @@ -78,7 +78,7 @@ static int debug_should_print(const char *file, if (debug_should_print(__FILE__, __func__)) { \ DEBUG_PRINT(format, ## args); \ } - + // this debug statement (PDEBUG including %p this) #define TDEBUG(format, args...) \ if (debug_should_print(__FILE__, __func__)) { \ @@ -95,5 +95,5 @@ static int debug_should_print(const char *file, #define TDEBUG(format, args...) #endif /* DEBUG */ - + #endif /* DEBUG_H */