2 * ocr.c forms a mostly-self-contained bit
3 * so we put its declarations in this separate file
22 #include <sys/types.h>
31 typedef uint32_t Pixcol;
32 #define PSPIXCOL(priscan) priscan##32
35 const char *s; /* valid until next call to ocr() */
36 int l,r; /* column numbers */
37 unsigned ctxmap; /* match context index */
41 typedef const struct OcrCellTypeInfo *OcrCellType;
42 extern const struct OcrCellTypeInfo ocr_celltype_text;
43 extern const struct OcrCellTypeInfo ocr_celltype_number;
46 typedef struct OcrReader OcrReader;
47 OcrReader *ocr_init(int h);
49 OcrResultGlyph *ocr(OcrReader *rd, OcrCellType, int w, Pixcol cols[]);
50 /* return value is array terminated by {0,-1,-1}
51 * array is valid until next call to ocr()
55 /*----- debugging arrangements, rather contingent -----*/
57 #define DEBUG_FLAG_LIST \
65 #define DF(f) dbg__shift_##f,
70 #define DF(f) dbg_##f = 1 << dbg__shift_##f,
77 #define DEBUGP(f) (!!(debug_flags & dbg_##f))
79 void debug_flush(void);
81 #define eassert assert
84 const char *get_vardir(void);
86 #define DEFINE_VWRAPPERF(decls, funcf) \
87 decls void funcf(const char *fmt, ...) { \
88 va_list al; va_start(al,fmt); v##funcf(fmt,al); va_end(al); \
91 #define DEBUG_DEFINE_SOME_DEBUGF(fl,funcf) \
92 static void v##funcf(const char *fmt, va_list al) { \
94 vfprintf(debug,fmt,al); \
96 DEFINE_VWRAPPERF(static, funcf)
98 #define DEBUG_DEFINE_DEBUGF(fl) DEBUG_DEFINE_SOME_DEBUGF(fl,debugf)