/*
- * 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
#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 <fnmatch.h>
+#include <pcre.h>
#include <pam.h>
#include <time.h>
#include <limits.h>
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);
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,
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,
};
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);
extern const char *ocean, *pirate;
extern char *archipelago, *island;
-
#endif /*CONVERT_H*/