return;
}
if (aw->given() != ah->given() || aname->given() == aw->given())
- die("Either paper format name or width and height must be given");
+ err("Either paper format name or width and height must be given");
if (aname->given())
{
const char *name = aname->as_string("").c_str();
const paper *pap = paperinfo(name);
if (!pap)
- die("No paper called %s is known", name);
+ err("No paper called \"%s\" is known", name);
w = paperpswidth(pap);
h = paperpsheight(pap);
}
pos_spec(string s)
{
if (s.size() != 2)
- die("Value of pos must have two characters");
+ err("Value of pos must have two characters");
if (s[0] == 't')
v = 1;
else if (s[0] == 'c')
else if (s[0] == 'b')
v = -1;
else
- die("First character of pos must be t/c/b");
+ err("First character of pos must be t/c/b");
if (s[1] == 'l')
h = -1;
else if (s[1] == 'c')
else if (s[1] == 'r')
h = 1;
else
- die("Second character of pos must be l/c/r");
+ err("Second character of pos must be l/c/r");
}
pos_spec(cmd *c) : pos_spec(c->arg("pos")->as_string("cc")) { }
pdf_matrix place(BBox &inner, BBox &outer)
bb->y_min += b;
bb->y_max -= t;
if (bb->x_min >= bb->x_max || bb->y_min >= bb->y_max)
- die("Margins cannot be larger than the whole page");
+ err("Margins cannot be larger than the whole page");
}
void expand_box(BBox *bb)
{
color_spec(string s)
{
if (s.length() != 6)
- die("Invalid color specification \"%s\": expecting 6 hex digits", s.c_str());
+ err("Invalid color specification \"%s\": expecting 6 hex digits", s.c_str());
for (int i=0; i<3; i++)
{
int x = 0;
else if (t == "bg")
type = MARK_BG;
else
- die("Invalid cropmark type %s", t.c_str());
+ err("Invalid cropmark type %s", t.c_str());
pen_width = c->arg(prefix + "pen")->as_double(0.2);
arm_length = c->arg(prefix + "len")->as_double(5*mm);
if (deg < 0)
deg += 360;
if (deg % 90)
- die("Rotate requires a multiple of 90 degrees");
+ err("The angle must be a multiple of 90 degrees");
}
page *process_page(page *p) override
{
horizontal = c->arg("h")->as_int(0);
vertical = c->arg("v")->as_int(0);
if (!horizontal && !vertical)
- die("Flip has no direction specified");
+ err("No direction specified");
}
page *process_page(page *p) override
{
return idx - 1;
if (idx <= -1 && idx >= (int) -pages.size())
return idx + pages.size();
- die("Page index %d out of range", idx);
+ err("Page index %d out of range", idx);
}
vector<page *> select_cmd::process(vector<page *> &pages)
{
n = c->arg("n")->as_int(0);
if (n <= 0)
- die("Modulo must have n > 0");
+ err("Modulo must have n > 0");
half = c->arg("half")->as_int(0);
pipe = c->pipe;
}
else if (i < 0 && i >= -n)
j = (tuples-1-tuple)*n + (-i) - 1;
else
- die("Modulo: invalid index %d", i);
+ err("Invalid index %d", i);
if (j < (int) pages.size())
tmp.push_back(pages[j]);
else
else
{
if (!is_equal(width, p->width) || !is_equal(height, p->height))
- die("All pages participating in a merge must have the same dimensions");
+ err("All pages must have the same dimensions");
image_box.join(p->image_box);
}
}
q->width = p->width + marg.l + marg.r;
q->height = p->height + marg.t + marg.b;
if (q->width < 0.001 || q->height < 0.001)
- die("Expansion must result in positive page dimensions");
+ err("Expansion must result in positive page dimensions");
return q;
}
};
q->width = p->image_box.width() + marg.l + marg.r;
q->height = p->image_box.height() + marg.t + marg.b;
if (q->width < 0.001 || q->height < 0.001)
- die("Margins must result in positive page dimensions");
+ err("Margins must result in positive page dimensions");
return q;
}
};
{
n = c->arg("n")->as_int(0);
if (n % 4)
- die("Number of pages per signature must be divisible by 4");
+ err("Number of pages per signature must be divisible by 4");
}
vector<page *> process(vector<page *> &pages) override;
};
else if (grid_n > 0 && !grid_m)
num_tiles = grid_n;
else
- die("Grid size must be at least 1x1");
+ err("Grid size must be at least 1x1");
const string by = c->arg("by")->as_string("rows");
if (by == "rows" || by == "row" || by == "r")
else if (by == "tile" || by == "t")
fill_by = BY_TILE;
else
- die("Parameter \"by\" must be rows/cols/tile");
+ err("Parameter \"by\" must be rows/cols/tile");
crop = c->arg("crop")->as_int(0);
mixed = c->arg("mixed")->as_int(0);
vspace = c->arg("vspace")->as_double(space);
if (!is_zero(scale) && (!is_zero(paper.w) || rotate >= 0))
- die("When nup is used with explicit scaling, paper size nor rotation may be given");
+ err("When used with explicit scaling, paper size nor rotation may be given");
if (!is_zero(scale) && !grid_m)
- die("When nup is used with explicit scaling, both grid sizes must be given");
+ err("When used with explicit scaling, both grid sizes must be given");
}
vector<page *> process(vector<page *> &pages) override;
}
if (!found_solution)
- die("Nup did not find a feasible solution");
+ err("No feasible solution found");
debug("Best: %dx%d on %.3f x %.3f", best.cols, best.rows, best.paper_w, best.paper_h);
debug_indent -= 4;
}
template<typename T> cmd_exec *ctor(cmd *c) { return new T(c); }
const cmd_def cmd_table[] = {
- { "null", no_args, 0, &ctor<null_cmd> },
- { "move", move_args, 0, &ctor<move_cmd> },
- { "scale", scale_args, 0, &ctor<scale_cmd> },
- { "rotate", rotate_args, 0, &ctor<rotate_cmd> },
- { "flip", flip_args, 0, &ctor<flip_cmd> },
- { "select", no_args, 1, &ctor<select_cmd> },
+ { "add-blank",add_blank_args, 0, &ctor<add_blank_cmd> },
{ "apply", no_args, 1, &ctor<apply_cmd> },
- { "modulo", modulo_args, 1, &ctor<modulo_cmd> },
+ { "book", book_args, 0, &ctor<book_cmd> },
+ { "clip", clip_args, 0, &ctor<clip_cmd> },
+ { "cropmarks",cropmarks_args, 0, &ctor<cropmarks_cmd> },
{ "debug", no_args, 0, &ctor<debug_cmd> },
- { "merge", no_args, 0, &ctor<merge_cmd> },
- { "paper", paper_args, 0, &ctor<paper_cmd> },
- { "scaleto", scaleto_args, 0, &ctor<scaleto_cmd> },
- { "fit", fit_args, 0, &ctor<fit_cmd> },
{ "expand", expand_args, 0, &ctor<expand_cmd> },
+ { "fit", fit_args, 0, &ctor<fit_cmd> },
+ { "flip", flip_args, 0, &ctor<flip_cmd> },
{ "margins", margins_args, 0, &ctor<margins_cmd> },
- { "add-blank",add_blank_args, 0, &ctor<add_blank_cmd> },
- { "book", book_args, 0, &ctor<book_cmd> },
+ { "merge", no_args, 0, &ctor<merge_cmd> },
+ { "modulo", modulo_args, 1, &ctor<modulo_cmd> },
+ { "move", move_args, 0, &ctor<move_cmd> },
+ { "null", no_args, 0, &ctor<null_cmd> },
{ "nup", nup_args, 0, &ctor<nup_cmd> },
- { "cropmarks",cropmarks_args, 0, &ctor<cropmarks_cmd> },
- { "clip", clip_args, 0, &ctor<clip_cmd> },
+ { "paper", paper_args, 0, &ctor<paper_cmd> },
+ { "rotate", rotate_args, 0, &ctor<rotate_cmd> },
+ { "scale", scale_args, 0, &ctor<scale_cmd> },
+ { "scaleto", scaleto_args, 0, &ctor<scaleto_cmd> },
+ { "select", no_args, 1, &ctor<select_cmd> },
{ NULL, NULL, 0, NULL }
};