- for (;;) {
- debug_flush();
- fprintf(debug,"| x=%d",x);
- if (x>w) break;
- Pixcol cv= cols[x];
- fprintf(debug," cv=%"PSPIXCOL(PRIx),x);
- for (i=0; i<current->nlinks; i++)
- if (current->links[i].col == cv)
- goto found;
- /* not found */
- fprintf(debug," ?");
- break;
+ DatabaseNode *uniquematch= 0;
+ int uniquematch_rx=-1;
+
+ fprintf(debug,"OCR lx=%d ctxmap=%x ",lx,ctxmap);
+
+ for (ctxi=0; ctxi<NCONTEXTS; ctxi++) {
+ DatabaseNode *current= &rd->contexts[ctxi];;
+ DatabaseNode *bestmatch= 0;
+ int bestmatch_rx=-1;
+
+ x= lx;
+ if (!(ctxmap & (1u << ctxi))) continue;
+ fprintf(debug," || %s",context_names[ctxi]);
+
+ for (;;) {
+ debug_flush();
+ fprintf(debug," | x=%d",x);
+ if (x>w) break;
+ Pixcol cv= cols[x];
+ fprintf(debug," cv=%"PSPIXCOL(PRIx),cv);
+ for (i=0; i<current->nlinks; i++)
+ if (current->links[i].col == cv)
+ goto found;
+ /* not found */
+ fprintf(debug," ?");
+ break;
+
+ found:
+ current= current->links[i].then;
+ if (current->s[0]) {
+ fprintf(debug," \"%s\"",current->s);
+ bestmatch= current;
+ bestmatch_rx= x;
+ } else {
+ fprintf(debug," ...");
+ }