|
tesseract 3.04.01
|
#include "params.h"Go to the source code of this file.
Defines | |
| #define | tprintf(...) tprintf_internal(__VA_ARGS__) |
Functions | |
| TESS_API void | tprintf_internal (const char *format,...) |
Variables | |
| DLLSYM char * | debug_file = "" |
| DLLSYM bool | debug_window_on = TRUE |
| TESS_API void tprintf_internal | ( | const char * | format, |
| ... | |||
| ) |
Definition at line 39 of file tprintf.cpp.
{
tesseract::tprintfMutex.Lock();
va_list args; // variable args
static FILE *debugfp = NULL; // debug file
// debug window
inT32 offset = 0; // into message
static char msg[MAX_MSG_LEN + 1];
va_start(args, format); // variable list
// Format into msg
#ifdef _WIN32
offset += _vsnprintf(msg + offset, MAX_MSG_LEN - offset, format, args);
if (strcmp(debug_file.string(), "/dev/null") == 0)
debug_file.set_value("nul");
#else
offset += vsnprintf(msg + offset, MAX_MSG_LEN - offset, format, args);
#endif
va_end(args);
if (debugfp == NULL && strlen(debug_file.string()) > 0) {
debugfp = fopen(debug_file.string(), "wb");
} else if (debugfp != NULL && strlen(debug_file.string()) == 0) {
fclose(debugfp);
debugfp = NULL;
}
if (debugfp != NULL)
fprintf(debugfp, "%s", msg);
else
fprintf(stderr, "%s", msg);
tesseract::tprintfMutex.Unlock();
}
| DLLSYM char* debug_file = "" |
"File to send tprintf output to"
Definition at line 36 of file tprintf.cpp.
| DLLSYM bool debug_window_on = TRUE |
"Send tprintf to window unless file set"