X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Fconvert.h;h=893008735889d94d0f345c138e8401c154bb1fc5;hp=11f534bb1c8824fd5b8de4f72adfc206554993af;hb=8512d7420a8e9563eeb22e796f418ebe91cdadab;hpb=c68fb80a6bbf7acbcac4b2cb2143f5fea745cd2b diff --git a/yarrg/convert.h b/yarrg/convert.h index 11f534b..8930087 100644 --- a/yarrg/convert.h +++ b/yarrg/convert.h @@ -1,5 +1,5 @@ /* - * general header file for ypp-commodities + * general header file for yarrg */ /* * This is part of ypp-sc-tools, a set of third-party tools for assisting @@ -28,9 +28,24 @@ #ifndef CONVERT_H #define CONVERT_H +#define DEBUG_FLAG_LIST \ + DF(findypp) \ + DF(pages) \ + DF(keymap) \ + DF(rect) \ + DF(pixmap) \ + DF(struct) \ + DF(ocr) \ + DF(rsync) \ + DF(structcolon) \ + DF(callout) + + #include "common.h" #include "ocr.h" +#include +#include #include #include #include @@ -76,6 +91,7 @@ void store_current_page(CanonImage *ci /*pointer saved*/, void adjust_colours(CanonImage *ci, const RgbImage *rgb); void select_page(int page); +void check_pager_motion(int first, int stop); Rect find_sunshine_widget(void); @@ -92,18 +108,6 @@ extern FILE *screenshot_file; void fetch_with_rsync(const char *stem); void fetch_with_rsync_gz(const char *stem); -void vwarning(const char *fmt, va_list) FMT(1,0); -void warning(const char *fmt, ...) FMT(1,2); - -void vprogress(const char *fmt, va_list) FMT(1,0); -void progress(const char *fmt, ...) FMT(1,2); - -void vprogress_log(const char *fmt, va_list) FMT(1,0); -void progress_log(const char *fmt, ...) FMT(1,2); - -void vprogress_spinner(const char *fmt, va_list) FMT(1,0); -void progress_spinner(const char *fmt, ...) FMT(1,2); - enum flags { ff_singlepage= 000002, ff_testservers= 000004, @@ -121,22 +125,28 @@ enum flags { ff_needisland= 001000, ff_printisland= 002000, ff_upload= 004000, + + ff_use_yarrg= 010000, + ff_use_pctb= 020000, + ffm_use= 070000, + ffs_printisland= 003000, ffs_upload= 005000, }; extern enum flags o_flags; enum mode { - mf_findwindow= 00001, - mf_screenshot= 00010, - mf_readscreenshot= 00020, - mf_analyse= 00100, - mfm_special= 07000, + mf_findwindow= 00001, + mf_screenshot= 00010, + mf_readscreenshot= 00020, + mf_analyse= 00100, + mf_printoceanpirate= 00200, + mfm_special= 07000, - mode_findwindow= 00001, - mode_screenshot= 00011, - mode_analyse= 00120, - mode_showcharset= 01000, + mode_findwindow= 00201, + mode_screenshot= 00011, + mode_analyse= 00120, + mode_showcharset= 01000, mode_all= 00111, }; @@ -145,6 +155,39 @@ extern enum mode o_mode; extern const char *o_ocean, *o_pirate; extern int o_quiet; + +#define dbassert(x) ((x) ? (void)0 : dbfile_assertfail(__FILE__,__LINE__,#x)) +void dbfile_assertfail(const char *file, int line, const char *m) NORET; + +FILE *dbfile; +void dbfile_getsline(char *lbuf, size_t lbufsz, const char *file, int line); +int dbfile_open(const char *tpath); /* 0: ENOENT; 1: worked */ +int dbfile_gzopen(const char *tpath); /* 0: ENOENT; 1: worked */ +void dbfile_close(void); /* idempotent */ + +int dbfile_scanf(const char *fmt, ...) SCANFMT(1,2); +int dbfile_vscanf(const char *fmt, va_list al) SCANFMT(1,0); + +int gzopen(const char *zpath, int oflags, FILE **f_r, pid_t *pid_r, + const char *gziplevel /* 0 for read; may be 0, or "-1" etc. */); + /* returns errno value from open */ +void gzclose(FILE **f, pid_t *p, const char *what); + /* also OK with f==0, or p==-1 */ + + +const char *get_vardir(void); +const char *get_libdir(void); + + +#define EXECLP_HELPER(helper, ...) do{ \ + char *helper_path= masprintf("%s/%s",get_libdir(),helper); \ + execlp(helper_path,helper, __VA_ARGS__); \ + sysassert(errno==ENOENT); \ + fatal("Failed to find helper program %s.\n" \ + "(Are you in the correct directory?)", helper); \ + }while(0) + + /*----- from pages.c -----*/ void screenshot_startup(void); @@ -162,5 +205,4 @@ extern int npages; extern const char *ocean, *pirate; extern char *archipelago, *island; - #endif /*CONVERT_H*/