chiark / gitweb /
rationalise debugging output
[ypp-sc-tools.db-test.git] / pctb / ocr.h
1 #ifndef OCR_H
2 #define OCR_H
3
4 #define _GNU_SOURCE
5
6 #include <pam.h>
7 #include <stdint.h>
8 #include <inttypes.h>
9 #include <assert.h>
10 #include <string.h>
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <stdarg.h>
14 #include <sys/types.h>
15 #include <sys/wait.h>
16
17 typedef uint32_t Pixcol;
18 #define PSPIXCOL(priscan) priscan##32
19
20 typedef struct {
21   const char *s; /* valid until next call to ocr() */
22   int l,r; /* column numbers */
23   unsigned ctxmap; /* match context index */
24 } OcrResultGlyph;
25
26 typedef const struct OcrCellTypeInfo *OcrCellType;
27 extern const struct OcrCellTypeInfo ocr_celltype_text;
28 extern const struct OcrCellTypeInfo ocr_celltype_number;
29
30 typedef struct OcrReader OcrReader;
31 OcrReader *ocr_init(int h);
32
33 OcrResultGlyph *ocr(OcrReader *rd, OcrCellType, int w, Pixcol cols[]);
34   /* return value is array terminated by {0,-1,-1}
35    * array is valid until next call to ocr()
36    */
37
38 void debug_flush(void);
39
40 #define eassert assert
41 #define debug stdout
42
43 const char *get_vardir(void);
44
45
46 /* #define DEBUG_RECTANGLES */
47 /* #define DEBUG_OCR */
48
49 #endif /*OCR_H*/