chiark / gitweb /
Much better error handling.
[ypp-sc-tools.main.git] / pctb / ocr.h
1 /*
2  * ocr.c forms a mostly-self-contained bit
3  * so we put its declarations in this separate file
4  */
5
6 #ifndef OCR_H
7 #define OCR_H
8
9 #include "common.h"
10
11 #include <string.h>
12 #include <stdio.h>
13 #include <errno.h>
14 #include <assert.h>
15 #include <stdint.h>
16 #include <stdlib.h>
17 #include <unistd.h>
18 #include <inttypes.h>
19
20 #include <sys/wait.h>
21
22
23 typedef uint32_t Pixcol;
24 #define PSPIXCOL(priscan) priscan##32
25
26 typedef struct {
27   const char *s; /* valid until next call to ocr() */
28   int l,r; /* column numbers */
29   unsigned ctxmap; /* match context index */
30 } OcrResultGlyph;
31
32
33 typedef const struct OcrCellTypeInfo *OcrCellType;
34 extern const struct OcrCellTypeInfo ocr_celltype_text;
35 extern const struct OcrCellTypeInfo ocr_celltype_number;
36 const char *ocr_celltype_name(OcrCellType ct);
37
38
39 typedef struct OcrReader OcrReader;
40 OcrReader *ocr_init(int h);
41
42 OcrResultGlyph *ocr(OcrReader *rd, OcrCellType, int w, Pixcol cols[]);
43   /* return value is array terminated by {0,-1,-1}
44    * array is valid until next call to ocr()
45    */
46
47
48 #endif /*OCR_H*/