home *** CD-ROM | disk | FTP | other *** search
- % Copyright (C) 1989, 1996 Aladdin Enterprises. All rights reserved.
- %
- % This software is provided AS-IS with no warranty, either express or
- % implied.
- %
- % This software is distributed under license and may not be copied,
- % modified or distributed except as expressly authorized under the terms
- % of the license contained in the file LICENSE in this distribution.
- %
- % For more information about licensing, please refer to
- % http://www.ghostscript.com/licensing/. For information on
- % commercial licensing, go to http://www.artifex.com/licensing/ or
- % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
- % San Rafael, CA 94903, U.S.A., +1(415)492-9861.
-
- % $Id: gs_epsf.ps,v 1.2.6.1 2002/02/22 19:45:55 ray 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 <C5D0D3C6> 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
-