+ unsigned match:1, defined:1, endsword:1;
+ DatabaseLink *links;
+} DatabaseNode;
+
+static const char *context_names[]= {
+ "Lower",
+ "Upper",
+ "Digit"
+};
+struct OcrCellTypeInfo {
+ /* bitmaps of indices into context_names: */
+ unsigned initial, nextword, midword;
+ int space_spaces;
+ const char *name;
+};
+const struct OcrCellTypeInfo ocr_celltype_number= {
+ 4,4,4,
+ .space_spaces= 5,
+ .name= "number"
+};
+const struct OcrCellTypeInfo ocr_celltype_text= {
+ .initial=2, /* Uppercase */
+ .nextword=3, /* Either */
+ .midword=1, /* Lower only */
+ .space_spaces= 4,
+ .name= "text"
+};
+
+
+#define NCONTEXTS (sizeof(context_names)/sizeof(context_names[0]))
+
+struct OcrReader {
+ int h;
+ DatabaseNode contexts[NCONTEXTS];
+ OcrResultGlyph *results;
+ int aresults, nresults;
+};
+
+DEBUG_DEFINE_DEBUGF(ocr)
+
+#define FGETSLINE (dbfile_getsline(lbuf,sizeof(lbuf),__FILE__,__LINE__))
+
+static void cleardb_node(DatabaseNode *n) {
+ int i;
+ free(n->str); n->str=0;
+ n->defined=n->match=n->endsword= 0;
+ for (i=0; i<n->nlinks; i++)
+ cleardb_node(n->links[i].then);
+}