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

📄 gslp.ps

📁 遗传算法工具箱 希望高手指点 GATOOLS
💻 PS
📖 第 1 页 / 共 2 页
字号:
 { /lpline exch def
   /lpfile exch def
   /save 0 true lpexec

% Initialize the device and fonts.
   /BFont
     BodyFont null eq { defaultBodyFont } { BodyFont } ifelse def
   /BFont BFont outfont
   Headers Footers or
    { /HFont
	HeadingFont null eq { defaultHeadingFont } { HeadingFont } ifelse def
      /HFont HFont outfont
    }
   if

% Get the layout parameters.
   clippath
   Landscape { 90 /rotate 1 true lpexec } if
   BFont setfont ( ) stringwidth pop /cwx exch def
     cwx Tab mul /tabwx exch def
   BFont fontheight /fheight exch def /fascent exch def
   Headers Footers or { HFont fontheight } { 0 0 } ifelse
     /hheight exch def /hascent exch def
     /hdescent hheight hascent sub def
   fheight Spacing mul /lheight exch def
   Headers { hheight lheight add } { 0 } ifelse
     /topskip exch def
   Footers { hheight lheight add } { 0 } ifelse
     /botskip exch def
   /pskip topskip botskip add def
	% Translate the page so that (0,0) corresponds to
	% the top of the topmost body line.
   pathbbox
     2 index sub MarginBottom MarginTop add sub /plength exch def
     2 index sub MarginLeft MarginRight add sub /pwidth exch def
     pwidth Columns div /cowidth exch def
     exch MarginLeft add
     exch MarginBottom add plength add topskip sub
     /translate 2 true lpexec
   plength pskip sub lheight div cvi MaxLines min
     dup /colines exch def
     Columns mul /llength exch def
   OutFile null ne { nulldevice } if

% Print layout
   Noisy
    { (Page height = ) eprint llength e==
      (.\n) eprint flush
    } if

% Disable stack recording so we can use stopped with readline.
   $error /recordstacks false put

% Initialize for the first page.
   /lbuf 1000 string def
   /pindex 1 def
   beginpage

% Iterate through the file.
   lpline
    { dup length /pos exch def
      lbuf exch 0 exch putinterval
       { lpfile lbuf pos lbuf length pos sub getinterval readline } stopped
       {	% Filled the line before a CR or EOF.
         exch pop showline
       }
       {	% Reached CR and/or EOF first.
         exch length pos add lbuf exch 0 exch getinterval
	 1 index { showline } if		% omit final empty line
	  { dup length 0 eq Truncate or { pop () exit } if
	    showline
	  }
	 loop
	 exch not { exit } if
       }
      ifelse
    } loop
   pop

% Wrap up.
   endpage
   /restore 0 true lpexec

 } def

end

% Usage: <file> lp
%   prints <file> using the current parameter settings.
% Usage: [ <arg1> ... <argn> ] lpcommand
%   interprets args like a command line.

/lp { save   lpdict begin () lp end   restore } def

lpdict begin

/splitfn		% (FontNNN) -> <font>
 { dup /arg exch def length
    { dup 0 le { exit } if
      dup 1 sub arg exch get dup 48 ge exch 59 le and not { exit } if
      1 sub
    } loop
   arg exch 0 exch getinterval dup cvn find-latin-font
   exch arg exch anchorsearch pop pop cvr scalefont
 } def

% Parse the command line switches.

/doswitch	% argn ... arg1 (-?) restofswitch ->
 { exch dup cvn lpdict exch known
    { cvn load exec }
    { exch pop (Unknown switch: ) eprint eprint (\n) eprint }
   ifelse
 } def

/more		% argn ... arg1 restofswitch ->
 { dup length 0 ne
    { (- ) dup 1 3 index 0 get put
      exch dup length 1 sub 1 exch getinterval
      doswitch
    }
    { pop
    }
   ifelse
 } def

/-- { (--) exch concatstrings
      dup cvn lpdict exch known
       { cvn load exec }
       { (Unknown switch: ) eprint eprint (\n) eprint }
      ifelse
    } def
/--columns { cvi 1 max /Columns exch def } def
/--detect { /DetectFileType true def } def
/--first-page { cvi /PageFirst exch def } def
/--footing-center { /FootingCenter exch def   /Footers true def } def
/--footing-left { /FootingLeft exch def   /Footers true def } def
/--footing-right { /FootingRight exch def   /Footers true def} def
/--heading-center { /HeadingCenter exch def   /Headers true def } def
/--heading-left { /HeadingLeft exch def   /Headers true def } def
/--heading-right { /HeadingRight exch def   /Headers true def } def
/--margin-bottom { cvr 72.0 mul /MarginBottom exch def } def
/--margin-left { cvr 72.0 mul /MarginLeft exch def } def
/--margin-right { cvr 72.0 mul /MarginRight exch def } def
/--margin-top { cvr 72.0 mul /MarginTop exch def } def
/--last-page { cvi /PageLast exch def } def
/--spacing { cvr /Spacing exch def } def

/-# { pop } def		% ignore
/-+ { -- } def
(-1)cvn { /Columns 1 def   more } def
(-2)cvn { /Columns 2 def   more } def
/-b { /HeadingLeft exch def   /HeadingCenter () def   /HeadingRight PageNumberString def
      /Headers true def
      /break true def
    } def
/-B { /HeadingLeft () def   /HeadingCenter () def   /HeadingRight () def
      /Headers false def
      /FootingLeft () def   /FootingCenter () def   /FootingRight () def
      /Footers false def
      /break true def
      more
    } def
/-C { pop } def		% ignore
/-c { /Truncate true def   more } def
/-d { pop } def		% ignore
/-f { splitfn /BodyFont exch def } def
/-F { splitfn /HeadingFont exch def } def
/-G { more } def	% ignore
/-g { more } def	% ignore
/-h { more } def	% ignore
/-J { pop } def		% ignore
/-K { more } def	% ignore
/-k { more } def	% ignore
/-l { 66 -L -B } def
/-L { cvi /MaxLines exch def } def
/-m { more } def	% ignore
/-n { pop } def		% ignore
/-o { more } def	% ignore
/-p { (w) file /OutFile exch def   OutFile (%!\n) writestring } def
/-P { pop } def		% ignore
/-q { /Noisy false def   more } def
/-r { /Landscape true def   more } def
/-R { /Landscape false def   more } def
/-S { pop } def		% ignore
/-s { pop } def		% ignore
/-T { cvi /Tab exch def } def
/-v { pop } def		% ignore
/-w { more } def	% ignore

/lp1		% filename ->
 { break not { dup /HeadingLeft exch def } if
   Noisy
    { (Printing ) eprint dup eprint (\n) eprint 
    } if
   (r) file
		% If requested, check for a PostScript file.
   DetectFileType
    { dup 2 string readstring pop dup (%!) eq
       {	% Yes, it's a PostScript file.
         pop dup 80 string readline pop pop cvx exec
       }
       { lp
       }
      ifelse
    }
    { () lp
    }
   ifelse
 } bind def

/lpcstring 100 string def

end

/lpcommand		% [arg1 ... argn] -> -
 {	% Push the commands on the stack in reverse order
   mark exch
   dup length 1 sub -1 0 { 1 index exch get exch } for pop
   lpdict begin
   /break false def
    { dup mark eq { pop exit } if
      dup length 2 ge { dup 0 get (-) 0 get eq } { false } ifelse
       { dup 0 2 getinterval
         exch dup length 2 sub 2 exch getinterval
	 doswitch
       }
       { dup  /matched false def
          { /matched true def	lp1 } lpcstring filenameforall
	 matched { pop } { lp1 } ifelse		% let the error happen
       }
      ifelse
    } loop
   OutFile null ne
    { OutFile (%stdout) (w) file ne { OutFile closefile } if
      /OutFile null def
    } if
   end
 } def

[ shellarguments
 { ] dup length 0 ne
    { lpcommand
    }
    { (Usage: gslp [-12BclqRr] [-b<header] [-f<font>] [-F<hfont>]\n) eprint
      (		[-L<lines>] [-p<outfile>] [-T<tabwidth>] [--columns <n>]\n) eprint
      (		[--detect] [--first-page <page#>] [--last-page <page#>]\n) eprint
      (		[--(heading|footing)-(left|right|center) <string>]\n) eprint
      (		[--margin-(top|bottom|left|right) <inches>]\n) eprint
      (		[--spacing <n>] file1 ... filen\n) eprint
    }
   ifelse
 }
 { pop }
ifelse

⌨️ 快捷键说明

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