X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=jam.h;h=33626040cc3ed58bd70349406f3a0480e7b1d0d9;hb=298d65bac130d6aa4c925c70f3342eb8e68a4b97;hp=b70041b4e2e9a11cab68108532c9aba5cbf1b609;hpb=a4b921dcbcc63c6ac28949d16be531f2f4465eab;p=paperjam.git diff --git a/jam.h b/jam.h index b70041b..3362604 100644 --- a/jam.h +++ b/jam.h @@ -1,7 +1,7 @@ /* * PaperJam -- Common declarations * - * (c) 2018 Martin Mares + * (c) 2018--2022 Martin Mares */ #include @@ -27,6 +27,13 @@ static inline bool is_equal(double x, double y) return is_zero(x-y); } +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; + #include "pdf-tools.h" /*** Representation of commands ***/ @@ -48,6 +55,7 @@ enum arg_type { struct arg_def { const char *name; uint type; + const char *help; }; class arg_val { @@ -78,6 +86,7 @@ struct page { double height; BBox image_box; // Bounds useful contents virtual void render(out_context *out UNUSED, pdf_matrix xform UNUSED) { abort(); } + virtual void debug_dump() = 0; page(double _w=0, double _h=0) : index(0), width(_w), height(_h), image_box() { } page(page *p) { @@ -90,6 +99,7 @@ struct page { struct empty_page : public page { void render(out_context *out UNUSED, pdf_matrix xform UNUSED) { } + void debug_dump() { debug("Empty page"); } empty_page(double _w=0, double _h=0) : page(_w, _h) { }; }; @@ -102,6 +112,7 @@ struct cmd_def { const arg_def *arg_defs; bool has_pipeline; cmd_exec *(*constructor)(cmd *cmd); + const char *help; }; struct cmd { @@ -139,15 +150,9 @@ 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; +extern bool no_auto_transforms; class paperjam_error : public exception { string message; @@ -171,3 +176,13 @@ void debug_pages(vector &pages); void process(list &cmds); vector run_command_list(list &cmds, vector &pages); vector gs_bboxes(const char *in); + +class xform_page : public page { + page *orig_page; + pdf_matrix xform; + const char *description; +public: + void render(out_context *out, pdf_matrix xform) override; + void debug_dump() override; + xform_page(page *p, const char *desc, pdf_matrix xf); +};