home *** CD-ROM | disk | FTP | other *** search
- % Copyright (C) 1989 Aladdin Enterprises. All rights reserved.
- % Distributed by Free Software Foundation, Inc.
- %
- % This file is part of Ghostscript.
- %
- % Ghostscript is distributed in the hope that it will be useful, but
- % WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
- % to anyone for the consequences of using it or for whether it serves any
- % particular purpose or works at all, unless he says so in writing. Refer
- % to the Ghostscript General Public License for full details.
- %
- % Everyone is granted permission to copy, modify and redistribute
- % Ghostscript, but only under the conditions described in the Ghostscript
- % General Public License. A copy of this license is supposed to have been
- % given to you along with Ghostscript so you can know your rights and
- % responsibilities. It should be in a file named COPYING. Among other
- % things, the copyright notice and this notice must be preserved on all
- % copies.
-
- % Initialization file for GhostScript, version 1.2.
- % When this is run, systemdict is still writable.
-
- % Define the device size and aspect ratio.
- %%% FOLLOWING IS FOR X WINDOWS
- %{ /.device.width 8.5 72 mul cvi def
- % /.device.height 11 72 mul def
- % /.pixel.size 1 def % pixel width in points
- % /.aspect.ratio 1 def % pixel height/width
- %} pop
- %%% FOLLOWING IS FOR EGA
- %{ /.device.width 640 def
- % /.device.height 350 def
- % /.pixel.size 1 def
- % /.aspect.ratio 14 11 div def
- %} pop
- %%% FOLLOWING IS FOR AMIGA
- %{ /.device.width 704 def
- % /.device.height 470 def
- % /.pixel.size 0.5 def
- % /.aspect.ratio 11 10 div def
- %} exec
- % FOLLOWING IS FOR AMIGA
- %{ /.device.width 2448 def
- % /.device.height 3204 def
- % /.pixel.size 1 def
- % /.aspect.ratio 1 def
- %} exec
-
- % Acquire the debugging flags.
- currentdict /DEBUG known /DEBUG exch def
- currentdict /NODISPLAY known not /DISPLAYING exch def
-
- %%%%%%
- DEBUG {vmstatus pop exch pop ( ) cvs print (\n) print flush} if
- %%%%%%
-
- % Acquire systemdict and userdict.
- % Note that the dictionary stack only has 1 element at this point!
- /systemdict currentdict def
- /userdict 100 dict def
- /statusdict 20 dict def
- userdict begin % 2 elements now
- systemdict begin
-
- % Define true and false.
- /true 0 0 eq def
- /false 0 1 eq def
-
- % Define the predefined procedures, in alphabetical order.
- /[ /mark load def
- /] {counttomark array astore exch pop} bind def
- /= {=only (\n) print} bind def
- /abs {dup 0 lt {neg} if} bind def
- /defaultmatrix
- {currentdevice pop pop pop} bind def
- %.framedevice does all of framedevice except initclip and initmatrix.
- /framedevice
- {.framedevice initclip initmatrix} bind def
- /handleerror
- {errordict /handleerror get exec} bind def
- /identmatrix
- {{1.0 0.0 0.0 1.0 0.0 0.0} cvlit exch copy} bind def
- /initgraphics
- {initmatrix newpath initclip 1 setlinewidth 0 setlinecap 0 setlinejoin
- {} 0 setdash 0 setgray 10 setmiterlimit} bind def
- /initmatrix
- {.tempmatrix defaultmatrix setmatrix} bind def
- %.nulldevice does all of nulldevice except initclip and initmatrix.
- /nulldevice
- {.nulldevice initclip initmatrix} bind def
- /matrix {6 array identmatrix} bind def
- /prompt {(GS>) print flush} def
- /pstack {0 1 count 3 sub {index ==} for} bind def
- /run {(r) file cvx execute} bind def %%%%%% TEMPORARY %%%%%%
- %.setgray is the same as setgray without the transfer function.
- /setgray
- {currenttransfer exec .setgray} bind def
- /stack {0 1 count 3 sub {index =} for} bind def
- /start { (Ghostscript ) print version print (\n) print flush } def
- %.typenumber is a non-standard operator.
- /type {.typenumber
- {arraytype booleantype dicttype filetype fonttype
- integertype marktype nametype nulltype operatortype
- packedarraytype realtype savetype stringtype colortype}
- exch get} def
- /version
- (1.2) def
- % Define auxiliary procedures needed for the above.
- /=only {dup type /stringtype ne
- {( ) cvs} if print} bind def
- /.identmatrix % a read-only identity matrix
- matrix readonly def
- /.tempmatrix % a temporary matrix
- matrix def
-
- % Define the procedure used by the C executive for executing user input,
- % and also by the run operator.
- % This is called with a procedure or file on the operand stack.
- /execute
- {stopped $error /newerror get and {handleerror} if} bind def
-
- %%%%%%
- DEBUG {vmstatus pop = pop flush} if
- %%%%%%
-
- % Create the error handling machinery.
- % The interpreter knows the names ErrorNames and ErrorObject.
- {/unknown /dictfull /dictstackoverflow /dictstackunderflow
- /execstackoverflow /interrupt /invalidaccess /invalidexit
- /invalidfileaccess /invalidfont /invalidrestore /ioerror
- /limitcheck /nocurrentpoint /rangecheck /stackoverflow
- /stackunderflow /syntaxerror /timeout /typecheck
- /undefined /undefinedfilename /undefinedresult /unmatchedmark
- /VMerror
- } cvlit readonly
- dup length 3 add dict % ErrorNames, ErrorObject, handleerror
- /errordict exch def
- errordict begin
- /ErrorNames exch def
- { $error /newerror get { = flush quit } if
- countdictstack array dictstack
- $error begin
- /newerror true def
- /dstack exch def
- /errorname exch def
- countexecstack array execstack /estack exch def
- count array astore /ostack exch def
- errordict /ErrorObject get /command exch def
- end
- stop
- }
- ErrorNames
- { [ 1 index 3 index /exec load ] cvx def
- } forall
- pop
- /handleerror
- { (Error: ) print
- $error begin
- errorname ==only
- ( in ) print
- /command load ==
- ( ostack:) print
- ostack {( ) print =only} forall
- (\n estack: ) print
- estack {( ) print =only} forall
- (\n dstack:) print
- dstack {dup ( ) print length =only (/) print maxlength =only} forall
- (\n) print
- /newerror false def
- flush
- end
- } bind def
- end
- /$error 6 dict def % newerror, errorname, command, 3 stacks
- $error begin
- /newerror false def
- end
-
- % Define the == procedure.
- /== {==only (\n) print} bind def
- /.dict 12 dict dup
- begin def
- /.buf 128 string def
- /.cvp {.buf cvs print} bind def
- /.print
- {dup type .dict exch known
- {dup type exec} {(-) print type .cvp (-) print} ifelse}
- bind def
- /integertype /.cvp load def
- /realtype /.cvp load def
- /booleantype /.cvp load def
- /nametype {dup xcheck not {(/) print} if .cvp} bind def
- /arraytype
- {dup xcheck {(})({)} {(])([)} ifelse print exch () exch
- {exch print .print ( )} forall pop print} bind def
- /operatortype
- {systemdict
- {2 index eq {exch pop exit} {pop} ifelse}
- forall =only} bind def
- /stringtype
- {(\() print
- {/.ch exch def
- .ch 32 lt .ch 127 ge or .ch 40 eq or .ch 41 eq or
- {(\\) print .ch 8#1000 add 8 .buf cvrs 1 3 getinterval print}
- {( ) dup 0 .ch put print}
- ifelse}
- forall (\)) print} bind def
- {0 begin .print end} bind dup 0 .dict put
- end
- /==only exch def
-
- %%%%%%
- DEBUG {vmstatus pop = pop flush} if
- %%%%%%
-
- % Define the font directory.
- /FontDirectory 20 dict def
-
- % Define the standard encoding vector.
- /StandardEncoding {
- % \00x
- /.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
- % \04x
- /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
- % \10x
- /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
- % \14x
- /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
- % \20x
- /.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
- % \24x
- /.notdef /exclamdown /cent /sterling /fraction /yen /florin /section
- /currency /quotesingle /quotedblleft /guillemotleft /guilsingleft /guilsingright /fi /fl
- /.notdef /endash /dagger /daggerdbl /periodcentered /.notdef /paragraph /bullet
- /quotesinglbase /quotedblbase /quotedblright /guillemotright /ellipsis /perthousand /.notdef /questiondown
- % \30x
- /.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
- % \34x
- /.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
- } cvlit readonly def
-
- % Close up systemdict.
- end
- systemdict readonly pop
-
- % Establish a default upper limit in the character cache,
- % namely, 10 times the average expected character size.
- cachestatus 5 index 10 mul 2 index 1 max idiv % bmax, cmax
- mark exch dup 10 idiv exch setcacheparams
- 7 {pop} repeat
-
- %%%%%%
- DEBUG {vmstatus pop = pop flush} if
- %%%%%%
-
- % Load the standard font.
- (gfonts.ps) run
-
- % Establish a default environment.
- % Map the screen height to an 11" page.
- % This is not necessarily the best compromise.
- DISPLAYING
- { .device.height 72 11 mul div
- [1 index .aspect.ratio mul 0 0 4 index neg 0 .device.height]
- .device.width 8 idiv .device.height { } framedevice pop
- }
- { nulldevice
- } ifelse
- 1 setflat
- 10 45 {dup mul exch dup mul add 1 exch sub} bind setscreen
- { } settransfer
- initgraphics
- DISPLAYING
- { erasepage
- } if
-
- %%%%%%
- DEBUG {vmstatus pop = pop systemdict length = flush} if
- %%%%%%
-
- % The interpreter will run the initial procedure (start).
-
- %
- % Personal likes by tom
- %
- /save {gsave 9999} bind def
- /restore {pop grestore} bind def
- /clear {gsave 1 setgray clippath fill grestore} bind def
- /! {gsave clear run grestore} bind def
-