UserDict.ps
Doug Wyatt, June 1, 1987 2:07:58 pm PDT
userdict { exch =print (: ) print dup type = ( ) print == } forall
execdict: dicttype
6 -dict-
serverdict: dicttype
50 -dict-
cleardictstack: packedarraytype
{ countdictstack 2 sub { end } repeat }
prompt: packedarraytype
{ (PS) print execdepth { (>) print } repeat flush }
quit: packedarraytype
{ -dict- /quitflag true put interrupt }
pstack: packedarraytype
{ count dup 1 add copy { == } repeat pop }
start: packedarraytype
{
disableinterrupt
execdict /execdepth 0 put
ReadIdleFonts
serverdict begin
/saveswitch switchsetting def
setstreams initprinter dostartpage {
userdict save /svlv exch put
printerstatus -1 ne {
statusdict /jobstate (printing test page) put
1 setblink
statusdict /printererror /stop load put
setrealdevice
{
/wtimeout usertime 180000 add def
userdict begin startpage end
{ warmedup usertime wtimeout gt or } UseIdleTime
usertime wtimeout le { showpage printerclose } if
} stopped pop
disableinterrupt
} if
clear cleardictstack svlv restore
} if
cleardictstack
$error /initializing false put
{
-dict- /server get exec
-dict- begin setstreams setnulldevice /execjob load end
exec
} loop
}
executive: packedarraytype
{ -dict- begin clearinterrupt disableinterrupt /execdepth execdepth 1 add def (\nPostScript(tm) Version ) print version print (\nCopyright (c) 1985 Adobe Systems Incorporated.\n) print { /quitflag false def -dict- /newerror false put /prompt load stopped { handleerror (Error during prompt execution\n) print exit } if { mark idleproc clearinterrupt /stmtfile (%statementedit) (r) file def disableinterrupt } stopped { disableinterrupt cleartomark -dict- /newerror get { -dict- /errorname get /undefinedfilename ne { handleerror } if -dict- /newerror false put exit } if } { pop stmtfile end { clearinterrupt cvx exec disableinterrupt } stopped -dict- begin { disableinterrupt handleerror stmtfile closefile } if } ifelse checkquit } loop /quitflag false def /execdepth execdepth 1 sub def end -dict- /doclose false put interrupt }
#copies: integertype
1
$idleTimeDict: dicttype
15 -dict-
$printerdict: dicttype
20 -dict-
ReadIdleFonts: packedarraytype
{
$idleTimeDict begin
idlefonts counttomark /idleI exch def
idleI 0 gt idleI 5 mod 0 eq and {
/idleArry idleI array def
{
idleI 0 le { exit } if
bmpI ascii94 boundsCheck ascii94 0 eeinfo getinterval put
bmpI eeinfo 5 mul put
bmpI eeinfo 10 div put
bmpI eeinfo 10 div put
bmpI ROMnames boundsCheck ROMnames eeinfo get put
} loop
} if
cleartomark
end
statusdict /setidlefonts { setidlefonts ReadIdleFonts } put
}
UseIdleTime: packedarraytype
{
$idleTimeDict begin
/stopPred exch def
/idleI 999 def
/idleStrI 0 def
/idleStr 0 string def
gsave
{
stopPred { exit } if
idleStrI idleStr length ge
{
idleI idleArry length ge { /idleI 0 def } if
idleI idleArry length lt {
0 idlA FontDirectory exch known {
grestore gsave
FontDirectory 0 idlA get setfont
1 idlA 2 idlA scale 3 idlA rotate
/idleStr 4 idlA def
/idleStrI 0 def
} if
} if
/idleI idleI 5 add def }
{
idleStr idleStrI 1 getinterval stringwidth pop pop
/idleStrI idleStrI 1 add def
}
ifelse
} loop
grestore
end
}
note: packedarraytype
{ -dict- /printerstatus get exec 126 and 1 add dup -dict- exch known not { pop 9 } if -dict- exch get exec }
b5: packedarraytype
{ 258 2928 11 12 { 82 512 { -dict- begin /jobstate (printing) def 0 setblink margins exch 4 -1 roll add 3 1 roll add 16 div round 2 mul cvi manualfeed { manualfeedtimeout } { 0 } ifelse #copies frametoprinter /jobstate (busy) def 1 setblink end } exec } { -dict- begin /proc exch def /yoffset exch def /xoffset exch def /height exch def /width exch def 300 72 div 0 0 -300 72 div xoffset neg height yoffset add mtx astore width height mul framelimit gt { /height framelimit width idiv def } if width height /proc load framedevice 60 45 { dup mul exch dup mul add 1.0 exch sub } setscreen { } settransfer initgraphics erasepage end } exec }
letter: packedarraytype
{ 300 3236 75 32 { 102 176 { -dict- begin /jobstate (printing) def 0 setblink margins exch 4 -1 roll add 3 1 roll add 16 div round 2 mul cvi manualfeed { manualfeedtimeout } { 0 } ifelse #copies frametoprinter /jobstate (busy) def 1 setblink end } exec } { -dict- begin /proc exch def /yoffset exch def /xoffset exch def /height exch def /width exch def 300 72 div 0 0 -300 72 div xoffset neg height yoffset add mtx astore width height mul framelimit gt { /height framelimit width idiv def } if width height /proc load framedevice 60 45 { dup mul exch dup mul add 1.0 exch sub } setscreen { } settransfer initgraphics erasepage end } exec }
a4small: packedarraytype
{ 280 3255 120 126 { 196 304 { -dict- begin /jobstate (printing) def 0 setblink margins exch 4 -1 roll add 3 1 roll add 16 div round 2 mul cvi manualfeed { manualfeedtimeout } { 0 } ifelse #copies frametoprinter /jobstate (busy) def 1 setblink end } exec } { -dict- begin /proc exch def /yoffset exch def /xoffset exch def /height exch def /width exch def 300 72 div 0 0 -300 72 div xoffset neg height yoffset add mtx astore width height mul framelimit gt { /height framelimit width idiv def } if width height /proc load framedevice 60 45 { dup mul exch dup mul add 1.0 exch sub } setscreen { } settransfer initgraphics erasepage end } exec }
lettersmall: packedarraytype
{ 288 3048 123 126 { 196 224 { -dict- begin /jobstate (printing) def 0 setblink margins exch 4 -1 roll add 3 1 roll add 16 div round 2 mul cvi manualfeed { manualfeedtimeout } { 0 } ifelse #copies frametoprinter /jobstate (busy) def 1 setblink end } exec } { -dict- begin /proc exch def /yoffset exch def /xoffset exch def /height exch def /width exch def 300 72 div 0 0 -300 72 div xoffset neg height yoffset add mtx astore width height mul framelimit gt { /height framelimit width idiv def } if width height /proc load framedevice 60 45 { dup mul exch dup mul add 1.0 exch sub } setscreen { } settransfer initgraphics erasepage end } exec }
legal: packedarraytype
{ 252 3852 267 174 { 244 368 { -dict- begin /jobstate (printing) def 0 setblink margins exch 4 -1 roll add 3 1 roll add 16 div round 2 mul cvi manualfeed { manualfeedtimeout } { 0 } ifelse #copies frametoprinter /jobstate (busy) def 1 setblink end } exec } { -dict- begin /proc exch def /yoffset exch def /xoffset exch def /height exch def /width exch def 300 72 div 0 0 -300 72 div xoffset neg height yoffset add mtx astore width height mul framelimit gt { /height framelimit width idiv def } if width height /proc load framedevice 60 45 { dup mul exch dup mul add 1.0 exch sub } setscreen { } settransfer initgraphics erasepage end } exec }
a4: packedarraytype
{ 292 3325 72 91 { 161 256 { -dict- begin /jobstate (printing) def 0 setblink margins exch 4 -1 roll add 3 1 roll add 16 div round 2 mul cvi manualfeed { manualfeedtimeout } { 0 } ifelse #copies frametoprinter /jobstate (busy) def 1 setblink end } exec } { -dict- begin /proc exch def /yoffset exch def /xoffset exch def /height exch def /width exch def 300 72 div 0 0 -300 72 div xoffset neg height yoffset add mtx astore width height mul framelimit gt { /height framelimit width idiv def } if width height /proc load framedevice 60 45 { dup mul exch dup mul add 1.0 exch sub } setscreen { } settransfer initgraphics erasepage end } exec }