User`s guide

4-150
Guide to Printers and Printing
%d POP –> ASCII String –> OUTPUT
The calculation of wK begins by pushing the value of _Q, the paper size override for the
input paper source, onto the stack. The value of _Q is defined as %IwQ. At this point in the
calculation of Wk, we are exactly where we were in the calculation of wJ, that is, trying to
determine a value for wQ and Wu. Within the context of a single job submission command,
the final values of wQ and Wu are not going to change just because a final value was
requested from a different attribute calculation. Thus we’ll use the previously calculated
values of 1 for wQ and 1 for Wu.
The 1 returned to the in–progress calculation of wK is the value of _Q, and is pushed onto
the stack. It is immediately popped back off the stack and stored in the internal variable q.
Wu, already determined to be 1, is again pushed onto the stack. %{3} pushes a 3 onto the
stack, then the %< pops the top two values (a 3 and a 1) off the stack and checks to see if
the second value popped is less than the first value popped. 1 is less than 3 today, so a 1 is
pushed onto stack. The %t find the 1 and so enters the if–then–else–then–else–then–else...
sequence looking for an integer to pair with the paper size value calculated for _Q.
The %gq fetches the stored value of _Q from the internal variable q, and pushes it onto the
stack. The %{1} pushes a 1 onto the stack. The %= pops the top two values (two 1s) off the
stack and, checking them for equality, succeeds; a 1 is pushed onto the stack. The %t finds
the 1 and so evaluates the %{3200}, which pushes a 3200 onto the stack. The calculation of
wK then falls through all but the last line of the remaining printer colon file escape
sequences defining wK. The last escape sequence, %d, pops the top value, 3200, off the
stack and returns it, in ASCII format, to the in–progress calculation of wX.
The 3200 returned to the in–progress calculation of wX is the value of wK, and is pushed
onto the stack. The %GwJ in the else clause is skipped and the %; terminates the
if–then–else sequence. At this point in the calculation of wJ, the remainder of the attribute
definition dealt with factors that affected page length (in lines), such as vertical line density.
In the calculation of page width, however, we will be interested in pitch and in whether or not
double–wide printing was selected.
The next escape sequence evaluated is %G_p. This fetches the value of the _p attribute,
which defines the pitch in characters per inch for this queue. The default value for this
queue is 10 but the command line being used in this example specified a pitch of 12 (–p12),
so a 12 is pushed onto the stack. The %{17} pushes a 17 onto the stack. The %= pops the
top two values (a 17 and a 12) off the stack and, checking them for equality, fails; a 0 is
pushed onto the stack. The %t finds the 0 (a false value) and the following else clause is
evalutated. %G_p again pushes a 12 onto the stack. The %{10} pushes a 10 onto the stack.
The %* pops the top two values (a 12 and a 10) off the stack and multiplies them together;
the resulting 120 is pushed onto the stack. The %; terminates this if–then–else sequence.
The following %* pops the top two values (a 120 and a 3200) off the stack and multiplies
them together; the resulting 384000 is pushed onto the stack. The %G_W fetches the value
of _W and pushes it onto the stack; _W is a yes (1) or no (0) question concering whether or
not double–wide printing is needed. The default value is 0 and we did not override it on the
command line, so a 0 is pushed onto the stack. The %t finds the 0 and so executes the else
clause. The %{3000} pushes a 3000 onto the stack. The %; terminates this if–then–else
sequence. The following %/ pops the top two values (a 3000 and a 384000) off the stack
and divides the second value popped by the first value popped; the resulting 128 is pushed
onto the stack. The %d pops the top value, 128, off the stack and returns it, in ASCII format,
to the in–progress calculation of wW.
The 128 returned to the in–progress calculation of wW is the value of _w. The value of wW
was originally referenced in the determination of the value of the ia attribute, the input
datastream pipeline for ASCII jobs. The number 128 replaces the %IwW in that
determination, so the value of the –! flag to pioformat becomes
/usr/lib/lpd/pio/fmtrs/piof5202 –l48 –w128. The –w128 can be seen in the
original diagnostic message from piobe that was the basis of this discussion; it is part of the
PIPELINE OF FILTERS section of the mail sent by the qdaemon on behalf of piobe.