% Copyright (C) 1989, 1996 Aladdin Enterprises. All rights reserved. % % This file is part of AFPL Ghostscript. % % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or % distributor accepts any responsibility for the consequences of using it, or % for whether it serves any particular purpose or works at all, unless he or % she says so in writing. Refer to the Aladdin Free Public License (the % "License") for full details. % % Every copy of AFPL Ghostscript must include a copy of the License, normally % in a plain ASCII text file named PUBLIC. The License grants you the right % to copy, modify and redistribute AFPL Ghostscript, but only under certain % conditions described in the License. Among other things, the License % requires that the copyright notice and this notice be preserved on all % copies. % $Id: gs_epsf.ps,v 1.2 2000/09/19 18:29:11 lpd Exp $ % Allow the interpreter to recognize MS-DOS EPSF file headers, and skip to % the PostScript section of the file. /.runnoepsf /run load def /.epsfheader def /run { dup type /filetype ne { (r) file } if % Check for MS-DOS EPSF file (see Red Book p. 729). true exch 0 1 3 { % Stack: true file index 1 index read dup { pop dup .epsfheader 3 index get eq } if { pop pop } % if matched, don't need the character { % unread characters (wasn't EPSF) 2 index exch unread % unread mismatch character dup { % loop unreading backwards in .epsfheader 1 sub dup .epsfheader exch get 2 index exch unread } repeat pop exch not exch exit % change true to false } ifelse } for exch % Stack: file true/false { % This block is executed if the file is MS-DOS EPSF. % Build up the little-endian byte offset and length. 2 { 1 0 4 { 2 index read not { pop exit } if % if EOF, let error happen 2 index mul add exch 256 mul exch } repeat exch pop exch } repeat % Stack: offset length file % Use flushfile to skip quickly to the start of the % PostScript section. dup 4 -1 roll 12 sub () /SubFileDecode filter flushfile % Now interpret the PostScript. exch () /SubFileDecode filter cvx .runexec } { .runnoepsf } ifelse } odef