chiark / gitweb /
a03f1f508dfc5e350f589a9a458c8b138a1783e7
[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 <sys/types.h>
14 #include <sys/wait.h>
15
16 typedef uint32_t Pixcol;
17 #define PSPIXCOL(priscan) priscan##32
18
19 typedef struct {
20   const char *s; /* valid until next call to ocr() */
21   int l,r; /* column numbers */
22   unsigned ctxmap; /* match context index */
23 } OcrResultGlyph;
24
25 typedef const struct OcrCellTypeInfo *OcrCellType;
26 extern const struct OcrCellTypeInfo ocr_celltype_text;
27 extern const struct OcrCellTypeInfo ocr_celltype_number;
28
29 typedef struct OcrReader OcrReader;
30 OcrReader *ocr_init(int h);
31
32 OcrResultGlyph *ocr(OcrReader *rd, OcrCellType, int w, Pixcol cols[]);
33   /* return value is array terminated by {0,-1,-1}
34    * array is valid until next call to ocr()
35    */
36
37 void debug_flush(void);
38
39 #define eassert assert
40 #define debug stdout
41
42 const char *get_vardir(void);
43
44 #endif /*OCR_H*/