|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 18411 (0x47eb)
Types: TextFile
Names: »pstex.prc«
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12
└─⟦af5ba6c8e⟧ »unix3.0/DVIWARE.tar.Z«
└─⟦ca79c7339⟧
└─⟦this⟧ »DVIware/laser-setters/mctex/postscript/pstex.prc«
% $Header: /usr/src/local/tex/local/mctex/postscript/RCS/pstex.prc,v 3.9 89/11/27 16:47:33 chris Exp $
% dvi-postscript prologue file for dvi to postscript translator by
% Louis A. Mamakos, then hacked by Torek, including changes received
% from Joe Pallas at Stanford, as determined by Glenn Trewitt, also
% at Stanford. The original file seems to have been written by Neal
% Holtz at Carleton University, and subsequently hacked by Van Jacobson
% at LBL and with additions from Trevor Darrel and Ned Batchelder,
% then at University of Pennsylvania. Exactly what is owed to whom
% is now quite muddled.
%
% Comments in this file will be stripped from the version
% installed in the library directory, so use as many as you like.
%
% NB: multiple spaces in literal strings (contained in parentheses)
% will be squished down to single spaces by the sed script.
% If you need strings with spaces you must write (\040\040), etc.
% The sequence ( /) will also be mangled.
% shorthand
/bd { bind def } def
% If this is a later PostScript version, enable packing for all of the
% definitions.
systemdict /currentpacking known
{ /packingstat currentpacking def true setpacking } if
% `Canclobber' controls whether the page selection operators are used.
% On many printers, these clear the frame buffer and set up the graphics
% state. On others, they may do something different. In any case, it
% is fairly likely you will not want them here. The previous system used
% them, though, and you may want them to work as before.
/canclobber true def % allow paper-mode commands
% Set default resolution. We always reset it later, but just in case....
/Resolution 300 def % pixels per inch
/Inch { 72 mul } bd
% There are three transform matrices carried about:
%
% - DefaultMatrix holds the usual device matrix.
% - SpecialMatrix holds an `extra' transform to be applied to specials.
% - Mtrx holds a matrix used to obtain TeX coordinate space.
%
% The normal (non-landscape) TeX coordinate system has (0,0) at the
% top left corner of the page, and x and y values become more positive
% as one moves rightwards and down respectively. The landscaped system
% has (0,0) at the lower left corner of the page, and positive x and y
% are upwards and rightwards respectively. All values are in pixels
% (from the device resolution in Resolution).
%
% Thus, the TeX transform would normally be either [1 0 0 1 0 0]
% (standard pages) or [0 -1 1 0 0 paperheight] (landscaped), but alas,
% things are not quite so simple. For instance, the LaserWriter that
% Torek had in his office while editing this sentence had an initial
% matrix of [300/72 0 0 300/72 300(-1/4) 300(11-.04)], corresponding
% to a normal 8.5 inch by 11 inch page, except that the translations, which
% one would expect to be 0 and paperheight, are offset. This is because
% that particular LaserWriter printed about 1/4 inch to the right, and .04
% inches down, from where it should. We have to make sure that this
% offset is included in our TeX transform.
%
% The device default is assumed to be set up at the beginning of each page,
% and so DefaultMatrix is simply salted away at each BOP.
%
% Although the width does not figure into the calculation above, the
% code below takes it, in case someone has to do something different
% on some other printer.
/DefaultMatrix matrix def % create it now, to be set later, per page
/@Im matrix def % identity matrix, shared by those who need it
/@Rm [0 1 -1 0 0 0] def % rotation (90 degree) matrix, likewise
% Little functions to set paper size (in inches) and the landscape flag.
/set@width { /paperwidth exch def } bd
/set@height { /paperheight exch def } bd
/set@wh { set@height set@width } bd
/set@landscape { /landscape exch def } bd
% @setmode modename @setmode -
%
% Sets the mode, if canclobber allows this. Otherwise it does nothing.
% It does nothing anyway, if the name is not known in any dictionary.
/@setmode {
dup where { pop canclobber { load exec } if } { pop } ifelse
} bd
% @setup - @setup -
%
% This routine creates the TeX matrices. The modename parameter sets
% the mode if canclobber allows it; otherwise, it is ignored. Then the
% paper size and landscape flag are used to define the matrices.
/@setup {
landscape {
/SpecialMatrix @Rm def % rotate 90 degrees
/Mtrx [0 72 Resolution div dup 0 0 0] def
% [(r/72) 0 0 -(r/72) a b] [Mtrx] = [0 -1 1 0 a b]
} {
/SpecialMatrix @Im def % identity
/Mtrx [72 Resolution div 0 0 2 index neg
0 paperheight 72 mul] def
% [(r/72) 0 0 -(r/72) a b] [Mtrx] = [1 0 0 1 a b-(h*r)]
} ifelse
} bd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document options (must be in opt[] table in postscript.c).
% All are argumentless. A few appear later in this file.
% Here is a full list:
% letter note legal a4size legalsize lettersize manualfeed draft
% these do nothing different from their counterparts below if canclobber
% is false
/@a4 { /letter @setmode @a4size } def
/@letter { /letter @setmode @lettersize } def
/@note { /note @setup @lettersize } def
/@legal { /legal @setmode @legalsize } def
/@a4size { 8.5 11.5 set@wh @setup } def
/@legalsize { 8.5 14 set@wh @setup } def
/@lettersize { 8.5 11 set@wh @setup } def
/@notesize { @lettersize } def % for completeness
/@landscape { true set@landscape @setup } def
/@manualfeed {statusdict /manualfeed true put} def
% n @copies - set number of copies
/@copies {/#copies exch def} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts.
% We see fonts of the form `/fnt%d @newfont'; we turn these into
% bitmapped fonts built with the character defined here.
%
% Our character builder looks up the char data in the font's CharData
% array, and paints that character (which is never empty; empty characters
% are skipped by the C code). Each CharData element is an array of
% length 6, of which the various slots are:
/ch-image {ch-data 0 get} bd % bitmap image
/ch-width {ch-data 1 get} bd % # pixels across
/ch-height {ch-data 2 get} bd % # pixels tall
/ch-xoff {ch-data 3 get} bd % # pixels right to reach origin
/ch-yoff {ch-data 4 get} bd % # pixels down to reach origin
/ch-tfmw {ch-data 5 get} bd % spacing to next character
% ch-xoff is usually negative (the origin being to the left of the
% character bits), and ch-yoff is usually one less than ch-height
% (the y origin being on the base line).
% the following is not correct by the Red Book, but seems to work
/@FBB [0 0 1 1] def % Font bounding box
% @newfont: id @newfont -
/@newfont {
dup 7 dict def % first define it as a dictionary ...
dup load % put the dictionary itself on the stack
dup begin % and enter it (leaving it on the stack:
% stack is now <id> <dict>; once we
% make <dict> a proper font dictionary,
% by defining FontType et al., the
% stack is all set for `definefont').
/FontType 3 def
/FontMatrix @Im def
/FontBBox @FBB def
/CharData 256 array def % size should be dynamic XXX
% This procedure is invoked with the font dictionary and character
% to be built on the stack.
/BuildChar {
% avoid losing space on [1 0 0 1 ch-xoff...] below
save 3 1 roll
exch /CharData get exch get /ch-data exch def
% setcachedevice parameters:
ch-tfmw 0 % width (x and y)
ch-xoff neg ch-yoff neg % lower left corner
ch-width ch-xoff sub ch-height ch-yoff sub % u.r. corner
setcachedevice
% Now paint it, ones=black and zeros=white.
% The transformation matrix for the image is 1:1,
% but moves it right and down by (xoff+.5,yoff+.5).
% The extra .5 makes the pixels round properly,
% preventing bouncing baselines.
ch-width ch-height true
[1 0 0 1 ch-xoff .5 add ch-yoff .5 add ]
{ch-image} imagemask
restore
} def
% TeX never actually uses the encoding vector, preferring to
% talk about characters by number, but PostScript demands it
% exist and have unique entries for each encoded character.
% (I tried to eliminate this, and got all `7's as output....)
/Encoding 256 array def
0 1 127 {Encoding exch /.notdef put} for
end % exit font dictionary, stack = <id> <dict>
definefont pop % define it and throw away the result
} bd
% Set font:
% @sf fontname @sf -
/@sf {setfont} bd
% Define a character in some font:
% @dc data ch font @dc -
/@dc {
dup /Encoding get % data ch font Encoding
exch /CharData get % data ch Encoding CharData
4 2 roll % Encoding CharData data ch
dup 4 1 roll % Encoding ch CharData data ch
exch put % Encoding ch
dup (XXX) cvs cvn put % make up a unique name for Encoding-sub-ch
} bd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% State saving across \special s
%
% @save@state defines `@reset@state' so that, when executed, it
% restores the graphics state to whatever it was when @save@state
% was executed, rather like gsave/grestore, but with a name.
%
% This seems like overkill---I think I really only need to set
% the transform matrix---but all the other PostScript profiles do
% similar stuff, so here it is.
/@save@state {
/@reset@state [
[/DefaultMatrix /setmatrix /SpecialMatrix /concat
currentlinewidth /setlinewidth
currentlinecap /setlinecap
currentlinejoin /setlinejoin
currentdash /setdash
currentflat /setflat
currentgray /setgray % should be currenthsbcolor /sethsbcolor?
currentmiterlimit /setmiterlimit]
% reach into the array above and change all the /foo's to
% foo's, now that we have the values of currentlinewidth, etc.
{ dup type /nametype eq {cvx} if } forall ] cvx
def
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin page, version for pass 0 and pass 1, and end page.
% The pass 0 and 1 versions are called with an array containing the
% ten count values and the absolute page number (in that order).
% called from bop1 to set everything up
/@@bop {
DefaultMatrix currentmatrix pop % save it away
/@bop@save save def % ready to reclaim VM
@save@state % save graphics state for \specials
Mtrx concat % enter TeX coordinates
0 0 moveto % start us off
} bd
/@BOP0 {pop} bd
/@BOP1 {pop @@bop} bd
/@EOP {
showpage
@bop@save restore % put everything back
} bd
% @DRAFTF and @DRAFTM put the word `draft' in stippled grey
% angled across the front of a page (@DRAFTF) or at the top
% (@DRAFTM) of each page. These are used by the @draft document
% option.
/@DRAFTF {
gsave newpath
/Helvetica-Bold findfont setfont
(Draft) dup stringwidth pop 8.875 exch div dup 72 mul dup scale
52.3 rotate 2.5 exch div -.35 translate
0.95 setgray
0 0 moveto show
grestore
} bd
/@DRAFTM {
gsave newpath
/Helvetica-Bold findfont 72 scalefont setfont
0.95 setgray
576 702 moveto
(Draft) stringwidth exch neg exch neg rmoveto
(Draft) show
grestore
} bd
% @draft document option redefines BOP1:
/@draft {
/@BOP1 { % page-vector @BOP1
0 get 1 le {@DRAFTF} {@DRAFTM} ifelse
@@bop
} def
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Procedures invoked by TeX code
% move to absolute position:
% p x y p -
/p {moveto} bd
% move backward 1 unit XXX compatibility
% B B -
/B {-1 0 rmoveto} bd
% move x relative to current point
% h: deltax h -
/h {0 rmoveto} bd
% show string
% S: string s -
/S {show} bd
% show string and move. s..z move -4..+4; D..G move by saved delta;
% d..g set delta and move.
/s {show -4 0 rmoveto} bd
/t {show -3 0 rmoveto} bd
/u {show -2 0 rmoveto} bd
/v {show -1 0 rmoveto} bd
/w {show 1 0 rmoveto} bd
/x {show 2 0 rmoveto} bd
/y {show 3 0 rmoveto} bd
/z {show 4 0 rmoveto} bd
/D {show @D 0 rmoveto} bd /d {/@D exch def D} bd
/E {show @E 0 rmoveto} bd /e {/@E exch def E} bd
/F {show @F 0 rmoveto} bd /f {/@F exch def F} bd
/G {show @G 0 rmoveto} bd /g {/@G exch def G} bd
% Plot a rule.
% The rule should extend up and left from the current point.
%
% PostScript fills the path, including the `fence', so we have to
% subtract 1 from the width and height values. The C code does this
% for us.
%
% R: width height R -
/R {
currentpoint 4 2 roll % save current point above w,h
currentpoint newpath moveto % start a new path at current point
dup 3 1 roll % x y h w h
0 exch neg rlineto % move up, now x y h w
0 rlineto % move left, now x y h
0 exch rlineto % move down, now x y
closepath fill % plot the rule
moveto % back to where we were
} bd
% resolution from -r switch
% @resolution: dpi @resolution -
/@resolution { % dpi @resolution -
/Resolution exch def
} bd
% start-of-job processing
% @RUN: version @RUN -
/@RUN {
pop % drop version string
% set default values for matrices
false set@landscape @lettersize @setup
} def
% end-of-job
% @FIN: @FIN -
/@FIN {end} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \specials
%
% Aside from psfig \specials, the usual format is:
% @beginspecial
% @hsize, @hoffset, @hscale, etc; all optional
% @setspecial
% raw postscript code
% @endspecial
% The @beginspecial command recognizes whether the Macintosh Laserprep
% has been loaded or not, and redefines some Mac commands if so.
% The @setspecial handles the users shifting, scaling, clipping commands
/@spcl@dict userdict maxlength dict def
% `@enter@special' changes the coordinate system so that (0,0) is
% wherever we were in TeX coordinates, but everything else is
% exactly as it was when saved with `@save@state'.
/@enter@special {
/@spcl@save save def
currentpoint transform @reset@state itransform translate
@spcl@dict begin
} bd
% `@exit@special' gets us back out.
/@exit@special {
end @spcl@save restore
} bd
/MacDrwgs false def % we think we are safe from Mac Laserprep, so far
% reset defaults
/@SpecialDefaults {
/hs 8.5 Inch def
/vs 11 Inch def
/ho 0 def
/vo 0 def
/hsc 1 def
/vsc 1 def
/CLIP false def
} bd
% set clipping dimension, offset, or scale
% all called as value @foo -
/@hsize {/hs exch def /CLIP true def} bd
/@vsize {/vs exch def /CLIP true def} bd
/@hoffset {/ho exch def} bd
/@voffset {/vo exch def} bd
/@hscale {/hsc exch def} bd
/@vscale {/vsc exch def} bd
/@setclipper {
hsc vsc scale
CLIP {
newpath
0 0 moveto
hs 0 rlineto
0 vs rlineto
hs neg 0 rlineto
closepath
clip
} if
} bd
% Set up for a \special
/@beginspecial {
@enter@special % save state & switch coordinates
/showpage {} def % disable showpage; restore will fix it
@SpecialDefaults % set defaults
@MacSetUp % fix up Mac stuff
} bd
% all set: do clipping, etc., as appropriate
/@setspecial {
MacDrwgs {
md begin /pxt ho def /pyt vo neg def end
} {
ho vo translate @setclipper
} ifelse
} bd
% fix up after \special
/@endspecial {
@exit@special
} bd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mac Laserprep stuff.
/@MacSetUp {
userdict /md known % Only if md is defined and is a dictionary
{userdict /md get type /dicttype eq} {false} ifelse
{
/MacDrwgs true def % oops, we were wrong before.
md begin % redefine some stuff
/letter {} def
/note {} def
/legal {} def
/od {
txpose
1 0 mtx defaultmatrix dtransform exch atan /pa exch def
newpath clippath mark
{transform {itransform moveto}}
{transform {itransform lineto}}
{ 6 -2 roll transform
6 -2 roll transform
6 -2 roll transform
{ itransform 6 2 roll
itransform 6 2 roll
itransform 6 2 roll
curveto
}
}
{{closepath}} pathforall
newpath counttomark array astore /gc xdf
pop ct 39 0 put
10 fz 0 fs 2 F/|______Courier fnt invertflag {PaintBlack} if
} def
/txpose {
pxs pys scale ppr aload pop
por {
noflips {
pop exch neg exch translate pop 1 -1 scale
} if
xflip yflip and {
pop exch neg exch translate 180 rotate 1 -1 scale
ppr 3 get ppr 1 get neg sub neg ppr 2 get
ppr 0 get neg sub neg translate
} if
xflip yflip not and {
pop exch neg exch translate pop 180 rotate
ppr 3 get ppr 1 get neg sub neg 0 translate
} if
yflip xflip not and {
ppr 1 get neg ppr 0 get neg translate
} if
}
{
noflips {
translate pop pop 270 rotate 1 -1 scale
} if
xflip yflip and {
translate pop pop 90 rotate 1 -1 scale
ppr 3 get ppr 1 get neg sub neg ppr 2 get
ppr 0 get neg sub neg translate
} if
xflip yflip not and {
translate pop pop 90 rotate ppr 3 get
ppr 1 get neg sub neg 0 translate
} if
yflip xflip not and {
translate pop pop 270 rotate ppr 2 get
ppr 0 get neg sub neg 0 exch translate
} if
} ifelse
scaleby96 {
ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy
translate .96 dup scale neg exch neg exch translate
} if
} def
/cp {pop pop showpage pm restore} def
end
} if
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% psfig stuff. This part is copyrighted. Apparently it has been
% hacked by Van Jacobson as well.
%
% All software, documentation, and related files in this distribution of
% psfig/tex are Copyright (c) 1987 Trevor J. Darrell
%
% Permission is granted for use and non-profit distribution of psfig/tex
% providing that this notice be clearly maintained, but the right to
% distribute any portion of psfig/tex for profit or as part of any commercial
% product is specifically reserved for the author.
%
%
% psfigTeX PostScript Prolog
% Header: tex.ps,v 1.15 88/01/21 23:44:40 van Exp
%
/psf$TeXscale { 65536 div } def
% x y bb-llx bb-lly bb-urx bb-ury startFig -
/startTexFig {
@enter@special
/psf$ury exch psf$TeXscale def
/psf$urx exch psf$TeXscale def
/psf$lly exch psf$TeXscale def
/psf$llx exch psf$TeXscale def
/psf$y exch psf$TeXscale def
/psf$x exch psf$TeXscale def
currentpoint /psf$cy exch def /psf$cx exch def
/psf$sx psf$x psf$urx psf$llx sub div def % scaling for x
/psf$sy psf$y psf$ury psf$lly sub div def % scaling for y
psf$sx psf$sy scale % scale by (sx,sy)
psf$cx psf$sx div psf$llx sub
psf$cy psf$sy div psf$ury sub translate
/DefFigCTM matrix currentmatrix def
/initmatrix { DefFigCTM setmatrix } def
/defaultmatrix { DefFigCTM exch copy } def
/initgraphics { @reset@state DefFigCTM setmatrix } def
/showpage { initgraphics } def
/erasepage {} def
/copypage { initgraphics } def
@MacSetUp
} bd
% llx lly urx ury doclip - (args in figure coordinates)
/doclip {
currentpoint 6 2 roll
newpath 4 copy
4 2 roll moveto
6 -1 roll exch lineto
exch lineto
exch lineto
closepath clip
newpath
moveto
} bd
% - endTexFig -
/endTexFig { @exit@special } bd
%%%%%%%%% end of psfig copyright
% restore packing
systemdict /currentpacking known {packingstat setpacking} if