-typedef struct {
- int x, y;
-} Point;
-
-typedef struct { /* both inclusive */
- Point tl;
- Point br;
-} Rect;
-
-static inline char get(int x, int y) { return cim->d[y * cim->w + x]; }
-static inline char get_p(Point p) { return get(p.x,p.y); }
-
-
-#define START_MAIN {200,200}
-#define MIN_COLUMNS 6
-#define INTERESTING_COLUMNS 6
-#define TEXT_COLUMNS 2
-#define MAX_COLUMNS 7
-
-static Rect mainr = { START_MAIN,START_MAIN };
-static int commbasey, comminty;
-static int colrightx[INTERESTING_COLUMNS];
-static int text_h;
-static OcrReader *rd;
-
-const CanonColourInfo canoncolourinfos[]= {
- { 0x475A5E, '*' }, /* edge */
- { 0x2C5F7A, '*' }, /* edge just under box heading shadow */
- { 0x7D9094, '+' }, /* interbox */
-
- { 0xBDC5BF, ' ' }, /* background - pale Sugar cane, etc. */
- { 0xADB5AF, ' ' }, /* background - dark */
- { 0xC7E1C3, ' ' }, /* background - pale Swill, etc. */
- { 0xB5CFB1, ' ' }, /* background - dark */
- { 0xD6CEB0, ' ' }, /* background - pale Madder, etc. */
- { 0xC8C0A2, ' ' }, /* background - dark */
- { 0xE0E1D3, ' ' }, /* background - pale Lorandite, etc. */
- { 0xD0D1C3, ' ' }, /* background - dark */
- { 0xE5E6C1, ' ' }, /* background - pale Cloth */
- { 0xD7D8B3, ' ' }, /* background - dark */
- { 0xEDDED9, ' ' }, /* background - pale Dye */
- { 0xDACBC6, ' ' }, /* background - dark */
- { 0xD3DEDF, ' ' }, /* background - pale Paint */
- { 0xC5D0D1, ' ' }, /* background - dark */
- { 0xDCD1CF, ' ' }, /* background - pale Enamel */
- { 0xCEC3C1, ' ' }, /* background - dark */
- { 0xF3F6F5, ' ' }, /* background - pale fruit */
- { 0xE2E7E5, ' ' }, /* background - dark */
-
- { 0x000000, 'o' }, /* foreground */
- { 0xD4B356, ' ' }, /* background (cursor) */
- { 0xFFFFFF, 'o' }, /* foreground (cursor) */
-
- { 0x5B93BF, '_' }, /* selector dropdown background */
- { 0xD7C94F, 'X' }, /* selector dropdown foreground */
- { 0,0 }
-};
-
-static void require_rectangle(int tlx, int tly, int brx, int bry,
- const char *ok) {
- int x,y;
- for (x=tlx; x<=brx; x++)
- for (y=tly; y<=bry; y++) {
- int c= get(x,y);
- assert(strchr(ok,c));
- }
+const char *get_vardir(void) { return "."; }
+
+static enum {
+ mf_findwindow= 0001,
+ mf_screenshot= 0010,
+ mf_readscreenshot= 0020,
+ mf_analyse= 0100,
+
+ mode_findwindow= 0001,
+ mode_screenshot= 0011,
+ mode_analyse= 0120,
+
+ mode_all= 0111,
+} o_mode= mode_all;
+
+static char *o_screenshot_fn;
+static int o_single_page, o_quiet;
+static const char *o_outputmode= "upload";
+
+const char *o_resolver;
+FILE *screenshot_file;
+
+
+static void vbadusage(const char *fmt, va_list) FMT(1,0) NORET;
+static void vbadusage(const char *fmt, va_list al) {
+ fputs("bad usage: ",stderr);
+ vfprintf(stderr,fmt,al);
+ fputc('\n',stderr);
+ exit(12);