X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Focr.h;h=5b5f697dbd88603a37dd8f518f91308c39192dfb;hb=451e1b1ed16a7a53395c030598a83031e266f973;hp=60234a8e91e6028ea8f028a912f0a53d8eafbc7d;hpb=0826bbc65e59d47c270f05af419f24fdfc3c349c;p=ypp-sc-tools.main.git diff --git a/pctb/ocr.h b/pctb/ocr.h index 60234a8..5b5f697 100644 --- a/pctb/ocr.h +++ b/pctb/ocr.h @@ -7,10 +7,6 @@ #define OCR_H -// #define DEBUG_RECTANGLES -// #define DEBUG_OCR - - #define _GNU_SOURCE #include @@ -58,6 +54,28 @@ OcrResultGlyph *ocr(OcrReader *rd, OcrCellType, int w, Pixcol cols[]); /*----- debugging arrangements, rather contingent -----*/ +#define DEBUG_FLAG_LIST \ + DF(findypp) \ + DF(pages) \ + DF(rect) \ + DF(ocr) \ + DF(callout) + +enum { +#define DF(f) dbg__shift_##f, + DEBUG_FLAG_LIST +#undef DF +}; +enum { +#define DF(f) dbg_##f = 1 << dbg__shift_##f, + DEBUG_FLAG_LIST +#undef DF +}; + +unsigned debug_flags; + +#define DEBUGP(f) (!!(debug_flags & dbg_##f)) + void debug_flush(void); #define eassert assert @@ -65,4 +83,15 @@ void debug_flush(void); const char *get_vardir(void); +#define DEBUG_DEFINE_SOME_DEBUGF(fl,funcf) \ + static void v##funcf(const char *fmt, va_list al) { \ + if (DEBUGP(fl)) \ + vfprintf(debug,fmt,al); \ + } \ + static void funcf(const char *fmt, ...) { \ + va_list al; va_start(al,fmt); v##funcf(fmt,al); va_end(al); \ + } + +#define DEBUG_DEFINE_DEBUGF(fl) DEBUG_DEFINE_SOME_DEBUGF(fl,debugf) + #endif /*OCR_H*/