⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gs_init.ps

📁 遗传算法工具箱 希望高手指点 GATOOLS
💻 PS
📖 第 1 页 / 共 3 页
字号:
% installed or have their parameters changed.  For this reason,
% the value in the dictionary is actually a 2-element writable array,
% to allow us to create a default instance of the prototype on demand.

	% Loop until the .getdevice gets a rangecheck.
errordict /rangecheck 2 copy get
errordict /rangecheck { pop stop } put	% pop the command
  0 { {dup .getdevice exch 1 add} loop} null .stopped pop
  1 add dict  /devicedict 1 index def
  begin			% 2nd copy of count is on stack
   { dup .devicename exch
     dup wcheck { dup } { null } ifelse 2 array astore def
   } repeat
  end
put		% errordict /rangecheck
.clearerror
/devicenames devicedict { pop } forall devicedict length packedarray def

% Determine the default device.
/defaultdevice DISPLAYING
 { systemdict /DEVICE .knownget
    { devicedict 1 index known not
       { (Unknown device: ) print =
	 flush /defaultdevice cvx 1 .quit
       }
      if
    }
    { 0 .getdevice .devicename
    }
   ifelse
 }
 { /nullpage
 }
ifelse
/.defaultdevicename 1 index def
finddevice	% make a copy
def
devicedict /Default devicedict .defaultdevicename get put

(END DEVS) VMDEBUG

% Define statusdict, for the benefit of programs
% that think they are running on a LaserWriter or similar printer.
%% Replace 1 (gs_statd.ps)
(gs_statd.ps) runlibfile

(END STATD) VMDEBUG

% Load the standard font environment.
%% Replace 1 (gs_fonts.ps)
(gs_fonts.ps) runlibfile

(END GS_FONTS) VMDEBUG

% Load the initialization files for optional features.
%% Replace 4 INITFILES
systemdict /INITFILES known
 { INITFILES { dup runlibfile VMDEBUG } forall
 }
if

% If Level 2 functionality is implemented, enable it now.
/.setlanguagelevel where
 { pop 2 .setlanguagelevel
 } if

(END INITFILES) VMDEBUG

% Create a null font.  This is the initial font.
8 dict dup begin
  /FontMatrix [ 1 0 0 1 0 0 ] readonly def
  /FontType 3 def
  /FontName () def
  /Encoding StandardEncoding def
  /FontBBox { 0 0 0 0 } readonly def % executable is bogus, but customary ...
  /BuildChar { pop pop 0 0 setcharwidth } bind def
  /PaintType 0 def		% shouldn't be needed!
end
/NullFont exch definefont setfont

% Define NullFont as the font.
/NullFont currentfont def

% Load initial fonts from FONTPATH directories, Fontmap file,
% and/or .getccfont as appropriate.
.loadinitialfonts

% Remove NullFont from FontDirectory, so it can't be accessed by mistake.
FontDirectory /NullFont .undef

(END FONTS) VMDEBUG

% Restore the real definition of runlibfile.
/runlibfile /.runlibfile load def
currentdict /.runlibfile .undef

% Bind all the operators defined as procedures.
/.bindoperators		% binds operators in currentdict
 { % Temporarily disable the typecheck error.
   errordict /typecheck 2 copy get
   errordict /typecheck { pop } put	% pop the command
   currentdict
    { dup type /operatortype eq
       { % This might be a real operator, so bind might cause a typecheck,
	 % but we've made the error a no-op temporarily.
	 .bind		% do a real bind even if NOBIND is set
       }
      if pop pop
    } forall
   put
 } def
NOBIND DELAYBIND or not { .bindoperators } if

% Establish a default environment.

defaultdevice
DISPLAYING not { setdevice (%END DISPLAYING) .skipeof } if
systemdict /DEVICEWIDTH known
systemdict /DEVICEHEIGHT known or
systemdict /DEVICEWIDTHPOINTS known or
systemdict /DEVICEHEIGHTPOINTS known or
systemdict /DEVICEXRESOLUTION known or
systemdict /DEVICEYRESOLUTION known or
systemdict /PAPERSIZE known or
not { (%END DEVICE) .skipeof } if
% Let DEVICE{WIDTH,HEIGHT}[POINTS] override PAPERSIZE.
systemdict /PAPERSIZE known
systemdict /DEVICEWIDTH known not and
systemdict /DEVICEHEIGHT known not and
systemdict /DEVICEWIDTHPOINTS known not and
systemdict /DEVICEHEIGHTPOINTS known not and
 {	% Convert the paper size to device dimensions.
   true statusdict /.pagetypenames get
    { PAPERSIZE eq
       { PAPERSIZE load
         dup 0 get /DEVICEWIDTHPOINTS exch def
         1 get /DEVICEHEIGHTPOINTS exch def
         pop false exit
       }
      if
    }
   forall
    { (Unknown paper size: ) print PAPERSIZE ==only (.\n) print
    }
   if
 }
if
% Adjust the device parameters per the command line.
% It is possible to specify resolution, pixel size, and page size;
% since any two of these determine the third, conflicts are possible.
% We simply pass them to .setdeviceparams and let it sort things out.
   mark /HWResolution null /HWSize null /PageSize null .dicttomark
   .getdeviceparams .dicttomark begin
   mark
	% Check for resolution.
   /DEVICEXRESOLUTION where dup
    { exch pop HWResolution 0 DEVICEXRESOLUTION put }
   if
   /DEVICEYRESOLUTION where dup
    { exch pop HWResolution 1 DEVICEYRESOLUTION put }
   if
   or { /HWResolution HWResolution } if
	% Check for device sizes specified in pixels.
   /DEVICEWIDTH where dup
    { exch pop HWSize 0 DEVICEWIDTH put }
   if
   /DEVICEHEIGHT where dup
    { exch pop HWSize 1 DEVICEHEIGHT put }
   if
   or { /HWSize HWSize } if
	% Check for device sizes specified in points.
   /DEVICEWIDTHPOINTS where dup
    { exch pop PageSize 0 DEVICEWIDTHPOINTS put }
   if
   /DEVICEHEIGHTPOINTS where dup
    { exch pop PageSize 1 DEVICEHEIGHTPOINTS put }
   if
   or { /PageSize PageSize } if
	% Check whether any parameters were set.
   dup mark eq { pop } { defaultdevice putdeviceprops } ifelse
   end
%END DEVICE
% Set any device properties defined on the command line.
% If BufferSpace is defined but not MaxBitmap, set MaxBitmap to BufferSpace.
systemdict /BufferSpace known
systemdict /MaxBitmap known not and
 { systemdict /MaxBitmap BufferSpace put
 } if
dup getdeviceprops
counttomark 2 idiv
 { systemdict 2 index known
    { pop dup load counttomark 2 roll }
    { pop pop }
   ifelse
 } repeat
counttomark dup 0 ne
 { 2 add -1 roll putdeviceprops }
 { pop pop }
ifelse
setdevice		% does an erasepage
% If the media size is fixed, update the current page device dictionary.
FIXEDMEDIA
dup { pop systemdict /.currentpagedevice known } if
dup { pop .currentpagedevice exch pop } if
not { (%END MEDIA) .skipeof } if
currentpagedevice dup length dict .copydict
dup /InputAttributes
2 copy get dup length dict .copydict
	% Stack: <pagedevice> <pagedevice> /InputAttributes <inputattrs>
dup length dict .copydict dup
0 2 copy get dup length dict .copydict
	% Stack: <pagedevice> <pagedevice> /InputAttributes
	%   <inputattrs> <inputattrs> 0 <attrs0>
dup /PageSize 7 index /PageSize get
put				% PageSize in 0
put				% 0 in InputAttributes
put				% InputAttributes in pagedevice
.setpagedevice		
%END MEDIA
%END DISPLAYING

(END DEVICE) VMDEBUG

% Establish a default upper limit in the character cache,
% namely, enough room for a 18-point character at the resolution
% of the default device, or for a character consuming 1% of the
% maximum cache size, whichever is larger.
mark
	% Compute limit based on character size.
  18 dup dtransform
  exch abs cvi 31 add 32 idiv 4 mul	% X raster
  exch abs cvi mul		% Y
	% Compute limit based on allocated space.
  cachestatus pop pop pop pop pop exch pop 0.01 mul cvi
  .max dup 10 idiv exch
setcacheparams
% Conditionally disable the character cache.
NOCACHE { 0 setcachelimit } if

(END CONFIG) VMDEBUG

% Establish an appropriate halftone screen.
% We make this a procedure so we can call it again when switching devices.

% Use an ordered dither for low-resolution devices.
/.setloresscreen	% <dpi> .setloresscreen -
 {	% The following 'ordered dither' spot function was contributed by
	% Gregg Townsend.  Thanks, Gregg!
   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
		% Use correct, per-plane screens for CMYK devices only.
   //systemdict /setcolorscreen known processcolors 4 eq and
    { 3 copy 6 copy setcolorscreen }
    { setscreen }
   ifelse
   0 array cvx settransfer	% Genoa CET won't accept a packed array!
   /setstrokeadjust where { pop true setstrokeadjust } if
 } bind def
% Use a 45-degree spot screen for high-resolution devices.
/.sethiresscreen	% <dpi> .sethiresscreen -
 {	% According to information published by Hewlett-Packard,
	% they use a 60 line screen on 300 DPI printers and
	% an 85 line screen on 600 DPI printers.
	% 46 was suggested as a good frequency value for printers
	% between 200 and 400 DPI, so we use it for lower resolutions.
   //systemdict /DITHERPPI known
    { DITHERPPI }
    { dup cvi 100 idiv 6 .min {null 46 46 60 60 60 85} exch get }
   ifelse
   1 index 4.01 div .min	% at least a 4x4 cell
   45
	% The following screen algorithm is used by permission of the author.
    { 1 add 180 mul cos 1 0.08 add mul exch 2 add 180 mul cos 
      1 0.08 sub mul add 2 div % (C) 1989 Berthold K.P. Horn
    }
   bind
	% Determine whether we have lots of process colors.
	% If so, don't bother with color screening or gamma correction.
   currentdevice mark
     /RedValues 0 /GreenValues 0 /BlueValues 0 /GrayValues 0
   .dicttomark .getdeviceparams
   counttomark 2 idiv 1 sub { exch pop min } repeat
   exch pop exch pop 32 lt 5 1 roll
	% Stack: doscreen dpi freq angle proc
	% Ghostscript currently doesn't use correct, per-plane halftones
	% unless setcolorscreen has been executed.  Since these are
	% computationally much more expensive than binary halftones,
	% we check to make sure they are really warranted, i.e., we have
	% a high-resolution CMYK device (i.e., not a display) with
	% fewer than 5 bits per plane (i.e., not a true-color device).
   4 -1 roll 150 ge
    { /setcolorscreen where
       { pop //systemdict /COLORSCREEN known
	  { COLORSCREEN }
	  { 3 index }
	 ifelse
	 dup false ne
	  { 4 1 roll 3 copy 6 copy 13 -1 roll
	% For really high-quality screening on printers, we need to
	% give each plane its own screen angle.  Unfortunately,
	% this currently has very large space and time costs.
	    true eq		% true => different angles,
				% 0 => same angles
	     { { 45 90 15 75 } { 3 1 roll exch pop 12 3 roll } forall
	     }
	    if setcolorscreen
	  }
	  { pop setscreen	% false => single binary screen
	  }
	 ifelse
       }
       { setscreen		% setcolorscreen not known
       }
      ifelse
    }
    { setscreen			% not high resolution
    }
   ifelse
			% Stack: doscreen
    {	% Set the transfer function to lighten up the grays.
	% We correct at the high end so that very light grays
	% don't disappear completely if they darken <1 screen pixel.
	% Parameter values closer to 1 are better for devices with
	% less dot spreading; lower values are better with more spreading.
	% The value 0.8 is a compromise that will probably please no one!
      { 0.8 exp dup dup 0.9375 gt exch 0.999 lt and	% > 15/16
	 { .currentscreenlevels 1 sub	% tweak to avoid boundary
	   1 exch div 1 exch sub .min
	 }
	if
      }
    }
    {	% Set the transfer function to the identity.
      0 array cvx		% Genoa CET won't accept a packed array!
    }
   ifelse settransfer
   /setstrokeadjust where { pop false setstrokeadjust } if
	% Increase fill adjustment so that we effectively use Adobe's
	% any-part-of-pixel rule.
   0.5 .setfilladjust
 } bind def
% Set the default screen based on the device resolution.
/.setdefaultscreen
 {	% Compute min(|dpi x|,|dpi y|) as the definition of the resolution.
   72 72 matrix defaultmatrix dtransform abs exch abs .min
   dup 150 lt //systemdict /DITHERPPI known not and
    { .setloresscreen } { .sethiresscreen }
   ifelse
 } bind def
.setdefaultscreen
initgraphics
% The interpreter relies on there being at least 2 entries
% on the graphics stack.  Establish the second one now.
gsave

% Define some control sequences as no-ops.
% This is a hack to get around problems
% in some common PostScript-generating applications.
% Note that <04> and <1a> are self-delimiting characters, like [.
<04> cvn { } def		% Apple job separator
%<0404> cvn { } def		% two of the same
<1b> cvn { } def		% MS Windows LaserJet 4 prologue
%<041b> cvn { } def		% MS Windows LaserJet 4 epilogue
(\001M) cvn			% TBCP initiator
 { currentfile /TBCPDecode filter cvx exec
 } bind def
/@PJL				% H-P job control
 { currentfile //=string readline { pop } if
 } bind def

% If we want a "safer" system, disable some obvious ways to cause havoc.
SAFER not { (%END SAFER) .skipeof } if
/file
 { dup (r) eq 2 index (%pipe*) .stringmatch not and
    { file }
    { /invalidfileaccess signalerror }
   ifelse
 } .bind odef
/renamefile { /invalidfileaccess signalerror } odef
/deletefile { /invalidfileaccess signalerror } odef
/putdeviceprops
 { counttomark
   dup 2 mod 0 eq { pop /rangecheck signalerror } if
   3 2 3 2 roll
    { dup index /OutputFile eq  
       { -2 roll 
         dup () ne { /putdeviceprops load /invalidfileaccess signalerror } if
         3 -1 roll
       }
       { pop
       }
      ifelse
    } for
   putdeviceprops
 } .bind odef

%END SAFER

% If we delayed binding, make it possible to do it later.
/.bindnow
 { //systemdict begin .bindoperators end
   % Temporarily disable the typecheck error.
   errordict /typecheck 2 copy get
   errordict /typecheck { pop } put	% pop the command
   0 1 .delaycount 1 sub { .delaybind exch get .bind pop } for
   userdict /.delaybind .undef		% reclaim the space
   userdict /.delaycount .undef
   put
 } .bind def

% Turn off array packing, since some PostScript code assumes that
% procedures are writable.
false setpacking

% Close up systemdict.
currentdict /.forceput .undef		% remove temptation
currentdict /filterdict .undef		% bound in where needed
end
WRITESYSTEMDICT not { systemdict readonly pop } if

(END INIT) VMDEBUG

% Establish local VM as the default.
false /setglobal where { pop setglobal } { .setglobal } ifelse
$error /.nosetlocal false put

% Clean up VM, and enable GC.
/vmreclaim where
 { pop NOGC not { 2 vmreclaim 0 vmreclaim } if
 } if

(END GC) VMDEBUG

% The interpreter will run the initial procedure (start).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -