home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
PRINTING
/
GS23A.ZIP
/
GHOST.PS
< prev
next >
Wrap
Text File
|
1991-01-15
|
22KB
|
632 lines
% Copyright (C) 1989, 1990, 1991 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.
% When this is run, systemdict is still writable.
% Acquire the debugging flags.
currentdict /DEBUG known /DEBUG exch def
/VMDEBUG
DEBUG {{vmstatus pop ( ) cvs print pop ( ) print
systemdict length ( ) cvs print (\n) print flush}}
{{}} ifelse
def
currentdict /NODISPLAY known not /DISPLAYING exch def
currentdict /NOBIND known { /bind { } def } if
currentdict /NOCACHE known /NOCACHE exch def
currentdict /QUIET known /QUIET exch def
%************************** Disable save and restore
/save {gsave null} bind def
/restore {pop grestore} bind def
% Acquire systemdict and userdict.
% Note that the dictionary stack only has 1 element at this point!
/systemdict currentdict def
/userdict 200 dict def
userdict begin % 2 elements now
systemdict begin
VMDEBUG
% Define true and false.
/true 0 0 eq def
/false 0 1 eq def
% Define predefined procedures substituting for operators,
% in alphabetical order.
/[ /mark load def
/] {counttomark array astore exch pop} bind def
/abs {dup 0 lt {neg} if} bind def
/cleardictstack
{countdictstack 2 sub {end} repeat} bind def
/.copypage /copypage load def
/copypage
{.copypage
(>>copypage, press <return> to continue<<\n) .confirm} bind def
/defaultmatrix
{currentdevice exch deviceparams pop pop
counttomark 1 add 1 roll cleartomark} bind def
/.echo /echo load def
/.echo.mode true def
/echo {dup /.echo.mode exch def .echo} bind def
/eexec {55665 exch type1decryptfile
% eexec sections have 4 garbage characters at the beginning.
% We should detect binary vs. hex encoding here.
4 {dup read pop pop} repeat
cvx systemdict begin stopped end
$error /newerror get and {handleerror} if} bind def
/executive
{{prompt (%statementedit) (r) file
dup bytesavailable 0 lt
{(%stdin) (r) file bytesavailable 0 lt {closefile exit} if}
if cvx execute} loop} bind def
/framedevice % dummy definition
{(Warning: framedevice is not implemented.\n) print flush
pop pop pop setmatrix initclip} 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 {flush flushpage
(GS) print count 0 ne
{(<) print count =only}
if (>) print flush} bind def
/pstack {0 1 count 3 sub {index ==} for} bind def
/run {dup type /filetype eq { true } { findlibfile } ifelse
{cvx execute}
{(r) file} % let the error happen
ifelse} bind def
%.setgray is the same as setgray without the transfer function.
/setgray
{currenttransfer exec .setgray} bind def
/showpage
{.copypage (>>showpage, press <return> to continue<<\n) .confirm
erasepage initgraphics} bind def
/stack {0 1 count 3 sub {index =} for} bind def
/start { QUIET not
{(Ghostscript ) print version print
( Copyright (C) 1990 Aladdin Enterprises,\n) print
( Menlo Park, CA. All rights reserved.\n) print
(Distributed by Free Software Foundation, Inc.\n) print
(Ghostscript comes with NO WARRANTY: see the file COPYING for details.\n) print
flush
} if
executive
} def
%.typenumber is a non-standard operator.
/type {.typenumber
{arraytype booleantype dicttype filetype fonttype
integertype marktype nametype nulltype operatortype
packedarraytype realtype savetype stringtype
colortype devicetype}
exch get} def
/version
(2.1.1) def
% Provide semi-fake but usable definitions for
% the color PostScript extensions (except for colorimage,
% which is actually implemented as an operator).
/setcmykcolor {
1 exch sub dup dup % C, M, Y, S, S, S
6 -1 roll 1 exch sub mul % M, Y, S, S, red
exch 5 -1 roll 1 exch sub mul % Y, S, red, green
4 -2 roll exch 1 exch sub mul % red, green, blue
setrgbcolor
} bind def
/currentcmykcolor {
currentrgbcolor 0
} bind def
/setcolortransfer {
settransfer pop pop pop
} bind def
/currentcolortransfer {
{} dup dup currenttransfer
} bind def
/setblackgeneration {
pop
} bind def
/currentblackgeneration {
{}
} bind def
/setundercolorremoval {
pop
} bind def
/currentundercolorremoval {
{}
} bind def
/setcolorscreen {
setscreen 9 {pop} repeat
} bind def
/currentcolorscreen {
currentscreen 3 copy 6 copy
} bind def
% Define some additional built-in procedures (beyond the ones defined by
% the PostScript Language Reference Manual).
/concatprocs
{ exch cvlit exch cvlit % proc1 proc2
dup length 2 index length add array % proc1 proc2 newproc
dup 0 4 index putinterval
dup 3 index length 3 index putinterval
exch pop exch pop cvx
} bind def
/concatstrings
{ 1 index length 1 index length add string
2 index 1 index copy pop
dup 3 index length 3 index length getinterval
2 index exch copy pop
exch pop exch pop
} bind def
/copystring
{ dup length string copy } bind def
/defaultdevice
{ 0 getdevice } bind def
/finddevice
{ systemdict /devicedict get exch get } bind def
/rgbcolor
{ gsave setrgbcolor currentgscolor grestore } bind def
%.setdevice does all of setdevice except initclip and initmatrix.
/setdevice
{ .setdevice initclip initmatrix } bind def
% Define auxiliary procedures needed for the above.
/.confirm
{DISPLAYING
{% Print a message and wait for the user to type something.
% If the user just types a newline, flush it.
print flush
.echo.mode false echo
(%stdin) (r) file dup read
{dup (\n) 0 get eq {pop pop} {unread} ifelse} {pop} ifelse
echo}
{pop} ifelse} bind def
/.identmatrix % a read-only identity matrix
matrix readonly def
/.tempmatrix % a temporary matrix
matrix def
% If the interpreter includes the Level 2 functions,
% load the initialization file for them.
systemdict /uappend known % pick any one
{ (ghost2.ps) run }
if
% 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
% Create the error handling machinery.
% The interpreter knows the name ErrorNames.
{/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 2 add dict % ErrorNames, handleerror
/errordict exch def
errordict begin
/ErrorNames exch def
{ $error /.inerror get { = flush quit } if % detect error recursion
$error /.inerror true put
countdictstack array dictstack
$error begin
/newerror true def
/dstack exch def
/errorname exch def
/command exch def
countexecstack array execstack /estack exch def
count array astore /ostack exch def
ostack aload pop
end
$error /.inerror false put
stop
} bind
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 7 dict def % newerror, .inerror, errorname, command,
% 3 stacks
$error begin
/newerror false def
/.inerror false def
end
% Define the =[only] procedures. Also define =print, which is used
% by LaserPrep even though it isn't documented anywhere.
/= {=only (\n) print} bind def
/=print {=} bind def
/.dict 16 dict dup
begin def
/.buf 128 string def
/.cvp {.buf cvs .p} bind def
/.print
{dup type .dict exch known
{dup type exec} {.buf cvs print} ifelse
} bind def
/stringtype
{dup rcheck not {pop (--nostringval--)} if print} bind def
/nametype
{dup length .buf length gt
{dup length string}
{.buf}
ifelse cvs print} bind def
{0 begin .print end} bind dup 0 .dict put
end
/=only exch def
% Define the [write]==[only] procedures.
/== {==only (\n) print} bind def
/==only {(%stdout) (w) file exch write==only} bind def
/write==
{2 copy write==only pop (\n) writestring} bind def
/.dict 17 dict dup
begin def
/.buf 128 string def
/.cvp {.buf cvs .p} bind def
% /.f {the_output_file} def
/.nop {(-) .p type .cvp (-) .p} bind def
/.p {.f exch writestring} bind def
/.p1 {.f exch write} bind def
/.print
{dup type .dict exch known
{dup type exec} {.nop} ifelse
} bind def
/integertype /.cvp load def
/realtype /.cvp load def
/booleantype /.cvp load def
/nametype
{dup xcheck not {(/) .p} if
dup length .buf length gt
{dup length string}
{.buf}
ifelse cvs .p} bind def
/arraytype
{dup rcheck
{dup xcheck {(})({)} {(])([)} ifelse .p
exch () exch
{exch .p .print ( )} forall pop .p}
{.nop}
ifelse} bind def
/operatortype
{(--) .p .cvp (--) .p} bind def
/packedarraytype /arraytype load def
/stringtype
{dup rcheck
{(\() .p
{/.ch exch def
.ch 32 lt .ch 127 ge or
{(\\) .p .ch 8#1000 add 8 .buf cvrs 1 3 getinterval .p}
{.ch 40 eq .ch 41 eq or .ch 92 eq or
{(\\) .p} if
.ch .p1}
ifelse}
forall (\)) .p}
{.nop}
ifelse} bind def
{0 begin exch /.f exch def .print end} bind dup 0 .dict put
end
/write==only exch def
VMDEBUG
% Define the font directory.
% Make it big to leave room for transformed fonts.
/FontDirectory 100 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
/guilsinglleft /guilsinglright /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
% Define the ISO Latin-1 encoding vector.
% The first half is the same as the standard encoding.
/ISOLatin1Encoding
StandardEncoding 256 array copy
dup 128 128 getinterval
%****** NOTE: the following are missing in the Adobe documentation,
%****** but appear in the displayed table:
%****** macron at 225, dieresis at 230, cedilla at 233, space at 240.
% \20x
/.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
% \24x
/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
% \30x
/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
% \34x
/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
129 -1 roll astore pop readonly def
% Define the Symbol encoding vector.
/SymbolEncoding {
% \000
/.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
% \040
/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
% \100
/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
% \140
/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
% \200
/.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
% \240
/.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
% \300
/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
% \340
/lozenge /angleleft /registersans /copyrightsans
/trademarksans /summation /parenlefttp /parenleftex
/parenleftbt /bracketlefttp /bracketleftex /bracketleftbt
/bracelefttp /braceleftmid /braceleftbt /braceex
/.notdef /angleright /integral /integraltp
/integralex /integralbt /parenrighttp /parenrightex
/parenrightbt /bracketrighttp /bracketrightex /bracketrightbt
/bracerighttp /bracerightmid /bracerightbt /.notdef
} cvlit readonly def
% Construct a dictionary of all available devices.
mark
% Loop until the getdevice gets a rangecheck.
0 { {dup getdevice exch 1 add} loop} stopped pop
pop 1 add dict /devicedict exch def
devicedict begin
counttomark {dup devicename cvn exch def} repeat
end
pop % pop the mark
$error /newerror false put % remove error indication
% Define statusdict, for the benefit of programs
% that think they are running on a LaserWriter or similar printer.
(statusd.ps) run
% Establish a default upper limit in the character cache,
% namely, 10 times the average expected character size.
mark
cachestatus 5 index 10 mul 2 index 1 max idiv % bmax, cmax
mark exch dup 10 idiv exch setcacheparams
cleartomark
% Conditionally disable the character cache.
NOCACHE { 1 setcachelimit } if
VMDEBUG
% Create a null font. This is the initial font.
8 dict dup begin
/FontMatrix [ 1 0 0 1 0 0 ] def
/PaintType 0 def
/FontType 3 def
/FontName () def
/Encoding StandardEncoding def
/FontBBox { 0 0 0 0 } def
/BuildChar { pop pop 0 0 setcharwidth } bind def
end
/NullFont exch definefont setfont
% Load the standard font environment.
(gfonts.ps) run
% Close up systemdict.
end
% We should make systemdict readonly; however, statusd.ps adds new entries
% to systemdict. Maybe dictionaries should have an "add-only" mode....
%%%%%% systemdict readonly pop
% Establish a default environment.
DISPLAYING
{ defaultdevice
systemdict /DEVICEWIDTH known systemdict /DEVICEHEIGHT known or
{ matrix deviceparams
exch /DEVICEWIDTH where
{ pop pop DEVICEWIDTH }
if
exch /DEVICEHEIGHT where
{ pop pop DEVICEHEIGHT
% Replace the Y translation if the Y axis is inverted
2 index 5 get 0 gt
{ 2 index 5 2 index put
}
if
}
if
defaultdevice 4 1 roll makedevice
counttomark 1 add 1 roll cleartomark
}
if setdevice
}
{ nulldevice
}
ifelse
1 setflat % initgraphics doesn't set this
{ } settransfer % ditto
% The following 'ordered dither' spot function was contributed by
% Gregg Townsend. Thanks, Gregg!
72 72 dtransform abs exch abs min % min(|dpi x|,|dpi y|)
16.001 div 0 % not 16: avoids rounding problems
{ 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add <
0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4
CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64
3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94
FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54
01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB
C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B
31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B
F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B
0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7
CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67
3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97
FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57
02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8
C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68
32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98
F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58
> exch get 256 div } bind setscreen
initgraphics
DISPLAYING
{ erasepage
} if
VMDEBUG
% The interpreter will run the initial procedure (start).