home *** CD-ROM | disk | FTP | other *** search
Wrap
% InterpreterInit.ps % % This file initializes the interpreter to its startup state. % On entry, systemdict and userdict are both writable and on the dict stack. % systemdict has all built-in operators defined, and userdict is empty. % % AUTHOR % Sam L. Weiss % % MODIFICATION HISTORY % 02/15/96 Sam Weiss Release 1.0 % initialize systemdict systemdict begin /version (47.0) def /revision cvx 0 def /=string {userdict /=string known not {userdict /=string 128 string put} if userdict /=string get} bind def /=print {dup type /stringtype ne {=string cvs} if print} bind def /= {//=print exec (\n) print} bind def /stack {0 1 count 3 sub {index =} for} bind def /pstack {0 1 count 3 sub {index ==} for} bind def /prompt {(PS>) print flush} bind def /Run {dup == flush run} bind def % create and initialize $error dictionary 20 dict dup begin /newerror false def /errorname null def /command null def /errorinfo null def /ostack null def /estack null def /dstack null def /recordstacks false def /binary false def /ostackarray null def /estackarray null def /dstackarray null def /initializing true def /inerror false def end /$error exch def % define .error procedure, which is referenced by each default error handler /.error { //$error /setshared known {false setshared} if //$error /inerror get {pop pop stop} if % disallow re-entry //$error /inerror true put % guard against re-entry //$error exch /errorname exch put % load error name //$error exch /command exch put % load offending command //$error /newerror true put % flag new error % if the offending command is a string with length > 128 % then cap the length //$error /command get type /stringtype eq { % is command a string? //$error /command get length 128 gt { % is the string length > 128 //$error /command get % get string 0 128 getinterval % get subinterval //$error exch /command exch put % store it back in $error } if } if % if recording stacks and this isn't a VM error... //$error /recordstacks get //$error /errorname get /VMerror ne and { //$error /ostackarray get null eq { % if there is no snapshot of operand stack //$error /estackarray 250 array put % allocate a snapshot of exec stack //$error /ostackarray 500 array put % allocate a snapshot of operand stack //$error /dstackarray 20 array put % allocate a snapshot of dictionary stack } if count % count operand stack //$error /ostackarray get exch 0 exch getinterval % get subinterval big enough for operand stack snapshot //$error exch /ostack exch put % store subinterval in $error named ostack % copy operand stack into ostack array count 1 sub -1 0 { % for (i = count - 1; i >= 0; --i) //$error /ostack get exch 2 index put count 1 roll } for % copy dictionary stack into dstackarray and associate with dstack in //$error //$error /dstack //$error /dstackarray get dictstack put % copy execution stack into estackarray and associate with estack in $error % we don't copy the top element on the execution stack (since it is this % error handler itself) //$error /estack //$error /estackarray get execstack dup length 2 sub 0 exch getinterval put } if % recording stacks and not a VM error % if the interpreter encouters an error while initializing, % the server loop may not yet be running, so we invoke handleerror ourselves //$error /initializing get {handleerror} if //$error /inerror false put stop } bind def % create and initalize errordict 32 dict dup begin /configurationerr {/configurationerr //.error exec} bind def /dictfull {/dictfull //.error exec} bind def /dictstackoverflow {/dictstackoverflow //.error exec} bind def /dictstackunderflow {/dictstackunderflow //.error exec} bind def /execstackoverflow {/execstackoverflow //.error exec} bind def /interrupt {/interrupt /interrupt //.error exec} bind def /invalidaccess {/invalidaccess //.error exec} bind def /invalidcontext {/invalidcontext //.error exec} bind def /invalidexit {/invalidexit //.error exec} bind def /invalidfileaccess {/invalidfileaccess //.error exec} bind def /invalidfont {/invalidfont //.error exec} bind def /invalidid {/invalidid //.error exec} bind def /invalidrestore {/invalidrestore //.error exec} bind def /ioerror {/ioerror //.error exec} bind def /limitcheck {/limitcheck //.error exec} bind def /nocurrentpoint {/nocurrentpoint //.error exec} bind def /rangecheck {/rangecheck //.error exec} bind def /stackoverflow {/stackoverflow //.error exec} bind def /stackunderflow {/stackunderflow //.error exec} bind def /syntaxerror {/syntaxerror //.error exec} bind def /timeout {/timeout /timeout //.error exec} bind def /typecheck {/typecheck //.error exec} bind def /undefined {/undefined //.error exec} bind def /undefinedfilename {/undefinedfilename //.error exec} bind def /undefinedresource {/undefinedresource //.error exec} bind def /undefinedresult {/undefinedresult //.error exec} bind def /unmatchedmark {/unmatchedmark //.error exec} bind def /unregistered {/unregistered //.error exec} bind def /VMerror {/VMerror //.error exec} bind def /handleerror { //$error begin /inerror false def newerror { /newerror false def (%%[ Error: ) print errorname //=print exec (; OffendingCommand: ) print /command load //=print exec //$error /errorinfo known { errorinfo type /arraytype eq { (; ErrorInfo:) print 0 1 errorinfo length dup 2 gt {pop 2} if 1 sub {( ) print errorinfo exch get //=print exec} for /errorinfo //null def } if } if ( ]%%\n) print flush } if end } bind def end /errordict exch def % define systemdict version of handleerror /handleerror {//errordict /handleerror get exec} bind def % create and initalize statusdict 25 dict dup begin /pagecount {1} def /setpagestackorder {pop} def /pagestackorder {false} def /setprintername {pop} bind def /printername {product exch copy} bind def /setdostartpage {pop} bind def /dostartpage {false} def /setmargins {pop pop} bind def /margins {0 0} def /setdefaulttimeouts {pop pop pop} bind def /defaulttimeouts {0 60 30} def /setjobtimeout {pop} def /jobtimeout {0} def /manualfeedtimeout 60 def /waittimeout cvx 300 def /manualfeed false def /jobstate () def /jobname cvx () def /product cvx (Nessie) readonly def /revision cvx 0 def /processcolors {4} def /lettertray {} def /legaltray {} def /a4tray {} def /b5tray {} def /papertray {0} def /setpapertray {pop} bind def /defaultpapertray {0} def /setdefaultpapertray {pop} bind def /papersize {/lettertray true} def end /statusdict exch def % initalize serverdict 10 dict dup /serverdict exch def begin /stdin null def /stdout null def /inserver true def /settimeouts {} def /execjob { //statusdict begin /jobstate (idle) def /jobname () def end //$error /doclose true put //systemdict /execdict get /quitflag false put clear cleardictstack //serverdict /enableinterrupt get exec //serverdict /stdin get stopped //serverdict /disableinterrupt get exec % if error executing stdin... { { //$error newerror get { //errordict /handlerror get exec } if //serverdict begin stdin status doclose and { (%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%) = flush stdin flushfile } if end % serverdict } stopped { //serverdict /stdin get resetfile //serverdict /stdout get resetfile //$error /doclose true put } if % stopped } if % stopped //$error /doclose get { {//serverdict /stdout get closefile} stopped {//serverdict /stdin get closefile} stopped } if clear cleardictstack initgraphics erasepage } bind executeonly def /server { { //serverdict begin save /serverstate exch def {jobavailable {exit} if} loop beginjob /stdin (%stdin) (r) file cvx def /stdout (%stdout) (w) file def execjob //serverdict endjob get exec //serverdict /serverstate get restore } loop } bind executeonly def /exitserver { clear cleardictstack initgraphics erasepage } bind executeonly def currentdict readonly pop % make serverdict read-only end % create and initalize execdict 10 dict dup begin /execdepth 0 def /binary false def /quitflag false def /stmtfile 0 def /setstreams {} def /idleproc {/idleproc {} def //serverdict begin 0 0 settimeouts end} bind def /copyright (Copyright (c) 1984-1995 Adobe Systems Incorporated.\nTypefaces Copyright (c) 1981 Linotype AG and/or its subsidiaries.\nAll Rights Reserved.) def /banner {//currentdict begin (PostScript(r) Version ) print version print (\n) print copyright print end} bind def /nestprompt {(PS) print execdepth {(>) print} repeat flush} bind def /checkquit {quitflag {exit} if} bind def end /execdict exch def % create and initalize FontDirectory /FontDirectory 40 dict readonly def % define findfont procedure /findfont { //systemdict /FontDirectory get exch 2 copy known {get} { exch pop {platformfindfont} stopped {pop //$error /command /findfont put stop} if } ifelse } bind def % define start procedure /start { //serverdict begin disableinterrupt setstreams //$error begin /initializing false def /binary false def /recordstacks true def end % //productinit cleardictstack //serverdict /server get exec } bind def % define StandardEncoding /StandardEncoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /exclamdown /cent /sterling /fraction /yen /florin /section /currency /quotesingle /quotedblleft /guillemotleft /guilsinglleft /guilsinglright /fi /fl /.notdef /endash /dagger /daggerdbl /periodcentered /.notdef /paragraph /bullet /quotesinglbase /quotedblbase /quotedblright /guillemotright /ellipsis /perthousand /.notdef /questiondown /.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef /Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef /.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef /lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef ] readonly def % define ISOLatin1Encoding /ISOLatin1Encoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ] readonly def % define Symbol font [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /universal /numbersign /existential /percent /ampersand /suchthat /parenleft /parenright /asteriskmath /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /congruent /Alpha /Beta /Chi /Delta /Epsilon /Phi /Gamma /Eta /Iota /theta1 /Kappa /Lambda /Mu /Nu /Omicron /Pi /Theta /Rho /Sigma /Tau /Upsilon /sigma1 /Omega /Xi /Psi /Zeta /bracketleft /therefore /bracketright /perpendicular /underscore /radicalex /alpha /beta /chi /delta /epsilon /phi /gamma /eta /iota /phi1 /kappa /lambda /mu /nu /omicron /pi /theta /rho /sigma /tau /upsilon /omega1 /omega /xi /psi /zeta /braceleft /bar /braceright /similar /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /Upsilon1 /minute /lessequal /fraction /infinity /florin /club /diamond /heart /spade /arrowboth /arrowleft /arrowup /arrowright /arrowdown /degree /plusminus /second /greaterequal /multiply /proportional /partialdiff /bullet /divide /notequal /equivalence /approxequal /ellipsis /arrowvertex /arrowhorizex /carriagereturn /aleph /Ifraktur /Rfraktur /weierstrass /circlemultiply /circleplus /emptyset /intersection /union /propersuperset /reflexsuperset /notsubset /propersubset /reflexsubset /element /notelement /angle /gradient /registerserif /copyrightserif /trademarkserif /product /radical /dotmath /logicalnot /logicaland /logicalor /arrowdblboth /arrowdblleft /arrowdblup /arrowdblright /arrowdbldown /lozenge /angleleft /registersans /copyrightsans /trademarksans /summation /parenlefttp /parenleftex /parenleftbt /bracketlefttp /bracketleftex /bracketleftbt /bracelefttp /braceleftmid /braceleftbt /braceex /apple /angleright /integral /integraltp /integralex /integralbt /parenrighttp /parenrightex /parenrightbt /bracketrighttp /bracketrightex /bracketrightbt /bracerighttp /bracerightmid /bracerightbt /.notdef ] readonly 9 dict begin /Encoding exch def /FontType 1 def /FontMatrix [.001 0 0 .001 0 0] def /FontBBox {0 0 1000 1000} def /FontInfo 2 dict dup begin /UnderlinePosition -100 def /UnderlineThickness 50 def end def /FontName /Symbol def /PaintType 0 def /Private 5 dict noaccess def /CharStrings 256 dict dup begin Encoding {() def} forall end def FontName currentdict definefont pop end % define == procedure 20 dict begin /==dict currentdict def /supplws false def /cp 5 def /rmargin 68 def /cprint {dup length cp add /cp exch def print} bind def /bprint {dup length cp add rmargin gt {(\n) print /cp 0 def /supplws false def} {supplws {/supplws false def} {( ) cprint} ifelse} ifelse} bind def /tprint {bprint cprint} bind def /typeprint {type =string cvs (type) search pop bprint (-) cprint cprint (-) cprint pop pop} bind def /typeexec {dup type dup currentdict exch known {exec} {pop typeprint} ifelse} def /substrprint {{{(\() (\)) (\\)} {search {substrprint (\\) cprint cprint true exit} if} forall dup type /stringtype eq {cprint exit} if pop} loop} bind def /booleantype {=string cvs tprint} bind def /integertype //booleantype def /realtype //booleantype def /arraytype {dup rcheck {( ) bprint pop /supplws true def dup xcheck {({) cprint {typeexec} forall (}) cprint} {([) cprint {typeexec} forall (]) cprint} ifelse /supplws false def} {typeprint} ifelse} bind def /packedarraytype //arraytype def /operatortype {=string cvs bprint (--) cprint cprint (--) cprint} bind def /stringtype {dup rcheck {dup length 200 gt exch 1 index {0 200 getinterval} if bprint (\() cprint substrprint {(...) cprint} if (\)) cprint} {typeprint} ifelse} bind def /nametype {bprint dup xcheck not {(/) cprint} if =string cvs cprint} bind def systemdict /== {//==dict begin mark {1 index /cp 0 def /supplws true def typeexec (\n) print} stopped {cleartomark end //$error /command /== put stop} if pop pop end} bind put end % ==dict currentdict readonly pop % make systemdict read-only end % systemdict % initialize userdict /#copies 1 def /letter {} def /note {} def /legal {} def /a4 {} def /b5 {} def /lettersmall {} def /a4small {} def /quit {//execdict /quitflag true put stop} bind def /Courier findfont 9 scalefont setfont $error /initializing false put /cshow where { pop } { /cshow { [0 0 5 -1 roll aload pop] cvx bind forall } bind def } ifelse