+ progress("Processing page %d...",page);
+
+ const char *tab= "";
+
+ FOR_COMMODITY_CELL({
+ tab= "";
+ },{
+ fputs(tab, tsv_output);
+ ocr_rectangle(cell,
+ colno<TEXT_COLUMNS
+ ? &ocr_celltype_text
+ : &ocr_celltype_number,
+ tsv_output);
+ tab= "\t";
+ },{
+ fputs("\n", tsv_output);
+ sysassert(!ferror(tsv_output));
+ sysassert(!fflush(tsv_output));
+ })
+ }
+ progress("Commodity table scan complete.");
+}
+
+//static Rect islandnamer;
+
+DEBUG_DEFINE_SOME_DEBUGF(structcolon,colondebugf)
+
+Rect find_sunshine_widget(void) {
+ Rect sunshiner;
+
+ sunshiner.tl.x= cim->w - 1034 + 885;
+ sunshiner.br.x= cim->w - 1034 + 1020;
+ sunshiner.tl.y= 227;
+ sunshiner.br.y= 228;
+
+ ADJUST_BOX(sunshiner,"o*",>=,30, 100,MUST, tl,y,-1);
+ ADJUST_BOX(sunshiner,"o*",>=,30, 100,MUST, br,y,+1);
+ debug_rect("sunshiner",0, sunshiner);
+
+ MUST(sunshiner.br.y - sunshiner.tl.y > 20, MR(sunshiner));
+ sunshiner.br.y--;
+
+ ADJUST_BOX(sunshiner,"o",>=,20, (cim->w - 1034 + 700), MUST, tl,x,-1);
+ ADJUST_BOX(sunshiner,"o",>=,20, cim->w, MUST, br,x,+1);
+ debug_rect("sunshiner",1, sunshiner);
+ return sunshiner;
+}
+
+void find_islandname(void) {
+ const RgbImage *rgbsrc= page0_rgbimage;
+ select_page(0);
+
+ RgbImage *ri= alloc_rgb_image(rgbsrc->w, rgbsrc->h);
+ memcpy(ri->data, rgbsrc->data, ri->w * ri->h * 3);
+
+ Rect sunshiner= find_sunshine_widget();
+ char sunshine[MAXIMGIDENT], archisland[MAXIMGIDENT];
+
+ const Rgb *srcp;
+ Rgb *destp, *endp;
+ for (srcp= rgbsrc->data, destp=ri->data,
+ endp= ri->data + ri->w * ri->h;
+ destp < endp;
+ srcp++, destp++) {
+ Rgb new= *srcp & 0xf0f0f0;
+ *destp= new | (new>>4);
+ }
+
+ identify_rgbimage(ri, sunshiner, sunshine, "sunshine widget");
+
+ if (!memcmp(sunshine,"Vessel ",5)) {
+ Rect islandnamer;
+
+ islandnamer.tl.x= cim->w - 1034 + 885;
+ islandnamer.br.x= cim->w - 1034 + 1020;
+ islandnamer.tl.y= 128;
+ islandnamer.br.y= 156;
+
+ ADJUST_BOX(islandnamer,"o",>=,5, 0, MUST, tl,y,+1);
+ ADJUST_BOX(islandnamer,"o",>=,5, cim->h, MUST, br,y,-1);
+
+ ADJUST_BOX(islandnamer,"o",>=,1, 0, MUST, tl,x,+1);
+ ADJUST_BOX(islandnamer,"o",>=,1, cim->w, MUST, br,x,-1);
+
+ debug_rect("islandnamer",0, islandnamer);
+// int larger_islandnamebry= islandnamer.tl.y + 25;
+// MUST(islandnamer.br.y < larger_islandnamebry,
+// MR(islandnamer);MI(larger_islandnamebry));
+// islandnamer.br.y = larger_islandnamebry;
+ debug_rect("islandnamer",1, islandnamer);
+
+ int x,y;
+ for (x=islandnamer.tl.x; x<=islandnamer.br.x; x++)
+ for (y=islandnamer.tl.y; y<=islandnamer.br.y; y++) {
+ if ((ri_rgb(ri,x,y) & 0xff) < 0x40) {
+ *RI_PIXEL32(ri,x,y)= 0;
+ }