本文整理汇总了C++中ps_output::put_number方法的典型用法代码示例。如果您正苦于以下问题:C++ ps_output::put_number方法的具体用法?C++ ps_output::put_number怎么用?C++ ps_output::put_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ps_output
的用法示例。
在下文中一共展示了ps_output::put_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_import
void ps_printer::do_import(char *arg, const environment *env)
{
while (*arg == ' ' || *arg == '\n')
arg++;
char *p;
for (p = arg; *p != '\0' && *p != ' ' && *p != '\n'; p++)
;
if (*p != '\0')
*p++ = '\0';
int parms[6];
int nparms = 0;
while (nparms < 6) {
char *end;
long n = strtol(p, &end, 10);
if (n == 0 && end == p)
break;
parms[nparms++] = int(n);
p = end;
}
if (csalpha(*p) && (p[1] == '\0' || p[1] == ' ' || p[1] == '\n')) {
error("scaling indicators not allowed in arguments for X import command");
return;
}
while (*p == ' ' || *p == '\n')
p++;
if (nparms < 5) {
if (*p == '\0')
error("too few arguments for X import command");
else
error("invalid argument `%1' for X import command", p);
return;
}
if (*p != '\0') {
error("superfluous argument `%1' for X import command", p);
return;
}
int llx = parms[0];
int lly = parms[1];
int urx = parms[2];
int ury = parms[3];
int desired_width = parms[4];
int desired_height = parms[5];
if (desired_width <= 0) {
error("bad width argument `%1' for X import command: must be > 0",
desired_width);
return;
}
if (nparms == 6 && desired_height <= 0) {
error("bad height argument `%1' for X import command: must be > 0",
desired_height);
return;
}
if (llx == urx) {
error("llx and urx arguments for X import command must not be equal");
return;
}
if (lly == ury) {
error("lly and ury arguments for X import command must not be equal");
return;
}
if (nparms == 5) {
int old_wid = urx - llx;
int old_ht = ury - lly;
if (old_wid < 0)
old_wid = -old_wid;
if (old_ht < 0)
old_ht = -old_ht;
desired_height = int(desired_width*(double(old_ht)/double(old_wid)) + .5);
}
if (env->vpos - desired_height < 0)
warning("top of imported graphic is above the top of the page");
out.put_number(llx)
.put_number(lly)
.put_fix_number(desired_width)
.put_number(urx - llx)
.put_fix_number(-desired_height)
.put_number(ury - lly)
.put_fix_number(env->hpos)
.put_fix_number(env->vpos)
.put_symbol("PBEGIN");
rm.import_file(arg, out);
// do this here just in case application defines PEND
out.put_symbol("end")
.put_symbol("PEND");
}