chiark / gitweb /
factor out DEBUG_DEFINE_DEBUGF
[ypp-sc-tools.db-live.git] / pctb / ocr.c
index 7eb871a68844acc1d802747e67346aed760b3729..f5826dfe84a01e14b8ba1032aba301595eef367c 100644 (file)
@@ -24,7 +24,7 @@ static const char *context_names[]= {
 
 #define NCONTEXTS (sizeof(context_names)/sizeof(context_names[0]))
 
-#define SPACE_SPACES 3
+#define SPACE_SPACES 4
 
 struct OcrReader {
   int h;
@@ -37,6 +37,8 @@ static FILE *resolver;
 static pid_t resolver_pid;
 static int resolver_done;
 
+DEBUG_DEFINE_DEBUGF(ocr)
+
 static void fgetsline(FILE *f, char *lbuf, size_t lbufsz) {
   char *s= fgets(lbuf,lbufsz,f);
   eassert(s);
@@ -185,7 +187,9 @@ static void callout_unknown(OcrReader *rd, int w, Pixcol cols[],
        * so we aren't in any danger of overwriting some other fd 4: */
       r= dup2(donepipe[1],4); eassert(r==4);
       execlp("./show-thing.tcl", "./show-thing.tcl",
-            "--automatic","1",(char*)0);
+            DEBUGP(callout) ? "--debug" : "--noop-arg",
+            "--automatic-1",
+            (char*)0);
       eassert(!"execlp failed");
     }
     r= close(jobpipe[0]); eassert(!r);
@@ -286,15 +290,6 @@ const struct OcrCellTypeInfo ocr_celltype_text= {
   .midword=1 /* Lower only */
 };
 
-static void vdebugf(const char *fmt, va_list al) {
-#ifdef DEBUG_OCR
-  vfprintf(debug,fmt,al);
-#endif
-}
-static void debugf(const char *fmt, ...) {
-  va_list al;  va_start(al,fmt);  vdebugf(fmt,al);  va_end(al);
-}
-
 OcrResultGlyph *ocr(OcrReader *rd, OcrCellType ct, int w, Pixcol cols[]) {
   int nspaces;
   unsigned ctxmap;