Utilities.ps
Doug Wyatt, July 8, 1987 11:40:58 am PDT
/kdir { { pop = } forall } def
/dir { { exch =print (: ) print == } forall } def
/== load 0 get begin
/rmargin 72 def
/NL (\n) def
/tprint { print } def
/typeprint { dup type exec ( ) tprint } def
/cvsprint { =string cvs tprint } def
/arraytype { dup rcheck { dup xcheck { ({ ) tprint { typeprint } forall (}) tprint }{([ ) tprint { typeprint } forall (]) tprint } ifelse } { pop (-array-) tprint } ifelse } def
/packedarraytype { dup rcheck { dup xcheck { ({ ) tprint { typeprint } forall (}) tprint }{([ ) tprint { typeprint } forall (]) tprint } ifelse } { pop (-packedarray-) tprint } ifelse } def
/booleantype { cvsprint } def
/dicttype { pop (-dict-) tprint } def
/filetype { pop (-file-) tprint } def
/fonttype { pop (-font-) tprint } def
/integertype { cvsprint } def
/marktype { pop (-mark-) tprint } def
/nametype { dup xcheck not { (/) tprint } if cvsprint } def
/nulltype { pop (-null-) tprint } def
/operatortype { =string cvs tprint (^) tprint } def
/realtype { cvsprint } def
/savetype { pop (-save-) tprint } def
/stringtype { dup rcheck { (\() tprint tprint (\)) tprint } { pop (-string-) tprint } ifelse } def
end
/estackarray 100 array def
/pestack {
/estack estackarray execstack def
estack length 2 sub -1 19 { (! ) print estack exch get == } for
} def
/pnum { =print ( ) print } def
/pvec { exch pnum pnum } def
/pmove { pvec (moveto) = } def
/pline { pvec (lineto) = } def
/pcurve { 6 4 roll pvec 4 2 roll pvec pvec (curveto) = } def
/pclose { (closepath) = } def
/ppath {
/pmove load /pline load /pcurve load /pclose load pathforall
} def
/fshow {
dup findfont 9 scalefont setfont
0 11 moveto (This font is ) show =string cvs show (...) show
11 0 moveto (ABCDEFGHIJKLMNOPQRSTUVWXYZ) show (abcdefghijklmnopqrstuvwxyz) show
} def
/fshowall {
gsave
72 10 translate
FontDirectory { pop fshow 0 25 translate } forall
grestore
} def
/miters {
0 0 moveto 100 15 lineto 0 30 lineto stroke
0 40 moveto 100 50 lineto 0 60 lineto stroke
0 70 moveto 100 75 lineto 0 80 lineto stroke
} def
/mitertest {
3 setlinewidth
gsave 100 100 translate miters grestore
gsave 100 200 translate 1 0.5 scale miters grestore
gsave 100 300 translate 2 1 scale miters grestore
gsave 100 400 translate 1 2 scale miters grestore
} def