summaryrefslogtreecommitdiff
path: root/dviware/psprint/vms/two.ps
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/psprint/vms/two.ps
Initial commit
Diffstat (limited to 'dviware/psprint/vms/two.ps')
-rw-r--r--dviware/psprint/vms/two.ps111
1 files changed, 111 insertions, 0 deletions
diff --git a/dviware/psprint/vms/two.ps b/dviware/psprint/vms/two.ps
new file mode 100644
index 0000000000..e2c57cf397
--- /dev/null
+++ b/dviware/psprint/vms/two.ps
@@ -0,0 +1,111 @@
+% Prologue for a /two job.
+% It assumes *_print.com has defined fspec and dev.
+% The following definitions produce two logical pages (80 cols by 60 lines)
+% on a single landscaped sheet of A4 paper.
+% Both pages have a headline showing fspec and page #.
+% Every character after this file (until ^D) will be treated as a printing
+% character (or control character) instead of being interpreted as PostScript.
+
+/maxlines 60 def % maximum lines per logical page
+/maxchar 80 def % maximum chars per line
+/interline -8 def % baseline skip
+/Courier findfont % Courier font (fixed-width chars)
+7 scalefont setfont % at 7pt
+/inch { 72 mul } def % convert inches to big points
+/topline { 7.3 inch } def % vertical location of top line (not headline)
+
+/page1pos
+{ 0 11.7 inch translate % shift origin up 11.7 inch (= A4 width)
+ -90 rotate % rotate axes 90deg clockwise
+ 1 inch 0 translate % 1 inch left margin for 1st logical page
+ 0 topline moveto % start of first line
+ /line 0 def % initialize line counter
+ /char 0 def % initialize chars/line counter
+} bind def
+
+/page2pos
+{ 5.1 inch 0 translate % set up left margin for 2nd logical page
+ 0 topline moveto % start of first line
+ /line maxlines def % in case formfeed occurred in 1st logical page
+} bind def
+
+/pagenum 0 def % initialize logical page number
+
+/headline
+{ gsave % save current pos and font
+ /Courier-Bold findfont 10 scalefont setfont % use Courier-Bold at 10pt
+ 0 topline moveto % move to top left corner
+ 0 interline 3 mul neg rmoveto % move up 3 lines
+ fspec show
+ % increment page number and show it right justified
+ /pagenum pagenum 1 add def
+ /pagestr pagenum 10 string cvs def
+ charwidth maxchar mul topline moveto % move to top right corner
+ (p.) stringwidth pop
+ pagestr stringwidth pop add neg % move left by page # width
+ interline 3 mul neg % move up 3 lines
+ rmoveto
+ (p.) show pagestr show
+ grestore % restore pos and font
+} bind def
+
+/formfeed % start next logical page unless already there
+{ line 0 gt
+ { line maxlines lt
+ { headline page2pos } % 0 < line < maxlines
+ { line maxlines gt
+ line maxlines 2 mul lt and
+ { headline showpage page1pos } if % maxlines < line < 2 * maxlines
+ } ifelse
+ } if
+} bind def
+
+/linefeed
+{ /char 0 def % reset chars/line counter
+ /line line 1 add def % increment line counter
+ line maxlines eq % if end of 1st page
+ { headline % show 1st headline
+ page2pos } % and start 2nd page
+ { line maxlines 2 mul eq % elsif end of 2nd page
+ { headline % then show 2nd headline
+ showpage page1pos } % and show both pages
+ { currentpoint pop neg interline rmoveto % else start next line
+ } ifelse
+ } ifelse
+} bind def
+
+/showchar
+{ currentchar 0 thischar put % put thischar into 1-char string
+ /char char 1 add def % increment chars/line counter
+ char maxchar le { currentchar show } if % ignore chars > maxchar
+} bind def
+
+/eachchar
+{ infile read not {exit} if % get next char
+ /thischar exch def % save it in thischar
+ thischar 32 ge % thischar >= space?
+ { showchar } % if so, show it
+ { thischar 10 eq % or does thischar = linefeed?
+ { linefeed }
+ { thischar 12 eq % or does thischar = formfeed?
+ { formfeed }
+ { % ignore any other control char
+ } ifelse
+ } ifelse
+ } ifelse
+} bind def
+
+(%stdin) (r) file /infile exch def
+/currentchar 1 string def
+/charwidth ( ) stringwidth pop def % assume fixed-width font
+page1pos % start 1st page
+
+/charloop
+{ {eachchar} loop
+ line 0 gt
+ { headline showpage } % flush last sheet with only 1st logical page
+ if
+ dev (LW) eq { @bannerpage } if % print banner page if LaserWriter
+} def
+
+charloop