chiark / gitweb /
Show whether shm is on
[ypp-sc-tools.main.git] / pctb / convert.h
1 /*
2  * general header file for ypp-commodities
3  */
4 /*
5  *  This is part of ypp-sc-tools, a set of third-party tools for assisting
6  *  players of Yohoho Puzzle Pirates.
7  * 
8  *  Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
9  * 
10  *  This program is free software: you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation, either version 3 of the License, or
13  *  (at your option) any later version.
14  * 
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  * 
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  * 
23  *  Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
24  *  are used without permission.  This program is not endorsed or
25  *  sponsored by Three Rings.
26  */
27
28 #ifndef CONVERT_H
29 #define CONVERT_H
30
31 #include "common.h"
32 #include "ocr.h"
33
34 #include <pam.h>
35 #include <time.h>
36 #include <limits.h>
37
38 #include <sys/time.h>
39
40
41 /*----- from rgbimage.c -----*/
42
43 #define MAXIMGIDENT 100
44
45 typedef struct RgbImage {
46   int w, h;
47   unsigned char data[];
48   /* red   = data[ y*w*3 + x*3 + 0 ] = RI_PIXEL(ri,x,y)[0]
49    * green = data[ y*w*3 + x*3 + 1 ] = RI_PIXEL(ri,x,y)[1]
50    * blue  = data[ y*w*3 + x*3 + 2 ] = RI_PIXEL(ri,x,y)[2]
51    */
52 } RgbImage;
53
54 void identify_rgbimage(const RgbImage *base, Rect portion,
55                        char result[MAXIMGIDENT], const char *what);
56 RgbImage *alloc_rgb_image(int w, int h);
57
58 #define RI_PIXEL(ri,x,y) ((ri)->data + ((y)*(ri)->w + (x)) * 3)
59
60 /*----- from structure.c -----*/
61
62 void find_structure(const CanonImage *im, int *max_relevant_y_r);
63 Rect find_sunshine_widget(void);
64
65 void find_islandname(RgbImage *ri);
66 void check_correct_commodities(void);
67 void read_screenshots(void);
68 void read_one_screenshot(void);
69 void analyse(FILE *tsv_output);
70
71 /*----- from convert.c -----*/
72
73 extern FILE *screenshot_file;
74 extern void fetch_with_rsync(const char *stem);
75
76 void vwarning(const char *fmt, va_list) FMT(1,0);
77 void warning(const char *fmt, ...)      FMT(1,2);
78
79 void vprogress(const char *fmt, va_list) FMT(1,0);
80 void progress(const char *fmt, ...)      FMT(1,2);
81
82 void vprogress_log(const char *fmt, va_list) FMT(1,0);
83 void progress_log(const char *fmt, ...)      FMT(1,2);
84
85 void vprogress_spinner(const char *fmt, va_list) FMT(1,0);
86 void progress_spinner(const char *fmt, ...)      FMT(1,2);
87
88 enum flags {
89   ff_editcharset=     00001,
90   ff_singlepage=      00002,
91   ff_testservers=     00004,
92   
93   ff_dict_fetch=      00010,
94   ff_dict_submit=     00020,
95   ff_dict_pirate=     00040,
96   ffs_dict=           00070,
97
98   ff_needisland=      00100,
99   ff_printisland=     00200,
100   ff_upload=          00400,
101   ffs_printisland=    00300,
102   ffs_upload=         00500,
103 };
104 extern enum flags o_flags;
105
106 extern const char *o_ocean, *o_pirate;
107 extern int o_quiet;
108
109 /*----- from pages.c -----*/
110
111 void screenshot_startup(void);
112 void set_yppclient_window(unsigned long wul);
113 void find_yppclient_window(void);
114 void take_screenshots(void);
115 void take_one_screenshot(void);
116
117 #define MAX_PAGES 100
118 extern CanonImage *page_images[MAX_PAGES];
119 extern int npages;
120 RgbImage *page0_rgbimage;
121
122 extern const char *ocean, *pirate;
123 extern char *archipelago, *island;
124
125
126 #endif /*CONVERT_H*/