Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mrao.cam.ac.uk/~bn204/mk2/technotes/encode.ps.txt
Дата изменения: Wed Nov 25 23:58:29 2009
Дата индексирования: Tue Oct 2 10:34:10 2012
Кодировка:
%!
% encode.ps - compress and encode PS file to reduce upload time.
% This won't work if the file contains multiple jobs separated by ^D
%
/stderr (%stderr)(w) file def
/error { stderr exch writestring } bind def
/closetarget <> readonly def
%
/openfile % fname mode -> file
{ { file } stopped
{ exch (Cannot open file: ) error error (w) eq { (for writing\n) } { (for reading\n) } ifelse error
flush quit
}
if
} bind def
%
/main % - -> -
{ mark shellarguments
{ counttomark 2 le
{ counttomark
{ { (%stdin)(r) file (%stdout)(w) file }
{ (r) openfile (%stdout)(w) file }
{ (w) openfile exch (r) openfile exch }
}
exch get exec dup % input output output
//systemdict /ASCII .knownget dup { true eq and } if
{ //closetarget /ASCII85Encode filter
(/ASCII85Decode filter)
}
{ ()
}
ifelse
exch % input output () output
//systemdict /LEVEL3 .knownget dup { true eq and } if
{ //closetarget /FlateEncode filter exch
(/FlateDecode filter)
}
{ //closetarget /LZWEncode filter exch
(/LZWDecode filter)
}
ifelse
concatstrings % input output output ()
2 index (%!\ncurrentfile) writestring
2 index exch writestring
exch ( cvx exec\n) writestring
exch 61440 string % output input buf
{ 3 copy readstring pop % output input buf output buf
dup () eq { pop pop exit } if
writestring
}
loop
pop closefile closefile false
}
{ (Incorrect number of file name arguments.\n) error true
}
ifelse
}
{ (Missing '--' preceding encode.ps\n) error true
}
ifelse
{ (Usage: gs -q -dASCII -dLEVEL3 -- encode.ps INFILE OUTFILE\n) error flush
}
if
} bind def
%
main clear quit