X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=jam.h;h=5ee7620d050cd28163062943431bc127b3bda4ad;hb=ab39b9756aa4c34811cd0d2a33298596951921ed;hp=0653c2506904286e94449c5ed8c64ab8857f69d2;hpb=8c3a7baee6b265d8c73df1d709793f032880dbb6;p=paperjam.git diff --git a/jam.h b/jam.h index 0653c25..5ee7620 100644 --- a/jam.h +++ b/jam.h @@ -48,6 +48,7 @@ enum arg_type { struct arg_def { const char *name; uint type; + const char *help; }; class arg_val { @@ -62,8 +63,10 @@ public: extern arg_val null_arg; struct out_context { + QPDF *pdf; QPDFObjectHandle resources; QPDFObjectHandle xobjects; + QPDFObjectHandle egstates; string contents; int res_cnt; string new_resource(const string type); @@ -71,18 +74,18 @@ struct out_context { }; struct page { - int index; + int index; // Position in the source PDF, 0 for synthesized pages double width; // Physical dimensions of media double height; - BBox bbox; // Bounds useful contents + BBox image_box; // Bounds useful contents virtual void render(out_context *out UNUSED, pdf_matrix xform UNUSED) { abort(); } - page(double _w=0, double _h=0) : index(0), width(_w), height(_h), bbox() { } + page(double _w=0, double _h=0) : index(0), width(_w), height(_h), image_box() { } page(page *p) { index = p->index; width = p->width; height = p->height; - bbox = p->bbox; + image_box = p->image_box; } }; @@ -100,6 +103,7 @@ struct cmd_def { const arg_def *arg_defs; bool has_pipeline; cmd_exec *(*constructor)(cmd *cmd); + const char *help; }; struct cmd { @@ -137,13 +141,23 @@ struct pipeline { extern const char *in_name, *out_name; extern bool recalc_bbox; -extern int debug_mode; +extern int debug_level; extern int debug_indent; void debug(const char *msg, ...) FORMAT_CHECK(printf, 1, 2); void warn(const char *msg, ...) FORMAT_CHECK(printf, 1, 2); void die(const char *msg, ...) FORMAT_CHECK(printf, 1, 2) NONRET; +// This one is called during execution of commands and propagated as an exception +void err(const char *msg, ...) FORMAT_CHECK(printf, 1, 2) NONRET; + +class paperjam_error : public exception { + string message; +public: + paperjam_error(string m) : message(m) { } + const char *what() const noexcept override { return message.c_str(); } +}; + // parse.cc void parse(const char *in, list &cmds);