[gs-cvs] rev 7618 - trunk/gs/lib
lpd at ghostscript.com
lpd at ghostscript.com
Thu Jan 18 20:09:50 PST 2007
Author: lpd
Date: 2007-01-18 20:09:50 -0800 (Thu, 18 Jan 2007)
New Revision: 7618
Modified:
trunk/gs/lib/pdf_base.ps
trunk/gs/lib/pdf_rbld.ps
Log:
Updates the PDF interpreter for the change in the 'token' operator (r7616),
which now may or may not pop its operand if an error occurs.
Modified: trunk/gs/lib/pdf_base.ps
===================================================================
--- trunk/gs/lib/pdf_base.ps 2007-01-18 20:25:30 UTC (rev 7617)
+++ trunk/gs/lib/pdf_base.ps 2007-01-19 04:09:50 UTC (rev 7618)
@@ -232,6 +232,23 @@
count pdfemptycount sub
} bind def
+% Read a token, but simply return false (no token read) in the case of an
+% error. This is messy because 'token' either may or may not pop its operand
+% if an error occurs, and because the return values are different depending
+% on whether the source is a file or a string.
+/token_nofail { % <file|string> token_nofail false
+ % <file> token_nofail <token> true
+ % <string> token_nofail <post> <token> true
+ null 1 index % stack: source null source
+ { token } .internalstopped { % stack: source null [source]
+ null ne { pop } if pop false
+ } { % stack: source null ([post] token true | false)
+ { 1 index null eq { 3 1 } { 4 2 } ifelse roll pop pop true }
+ { pop pop false }
+ ifelse
+ } ifelse
+} bind def
+
% ================================ Objects ================================ %
% Since we may have more than 64K objects, we have to use a 2-D array to
@@ -753,11 +770,7 @@
} if
1 index exch /File exch put
} ifelse
- PDFsource {token} stopped {
- pop null
- } {
- not { null } if
- } ifelse
+ PDFsource token_nofail not { null } if
dup /endobj eq {
% Another case that Acrobat Reader handles -- 'endobj' without 'endstream'.
( **** Warning: stream missing 'endstream'.\n) pdfformaterror
Modified: trunk/gs/lib/pdf_rbld.ps
===================================================================
--- trunk/gs/lib/pdf_rbld.ps 2007-01-18 20:25:30 UTC (rev 7617)
+++ trunk/gs/lib/pdf_rbld.ps 2007-01-19 04:09:50 UTC (rev 7618)
@@ -29,7 +29,7 @@
% if true --> we have an object with duplicate object and generation numbers.
/dup_obj_gen_num false def
-% Note: This routine is also used by non-rebuild code.
+% Note: This procedure is also used by non-rebuild code.
% Store a line in the xref array (Actually Objects and Generations arrays)
% <obj num> (strm num> <obj loc> <gen num> setxrefentry <obj num> strm num>
% <obj loc> <gen num>
@@ -90,14 +90,6 @@
flush
} bind def
-% This is the same as the postscript token operator except that
-% errors are ignored.
-/token_nofail
-{
- { token } .internalstopped
- { pop false } if
-} bind odef
-
% Get token from string and check its type
% <string> <type> typed_token <false> % no token or not match
% <string> <type> typed_token <obj> <last> <true> % matching token type
More information about the gs-cvs
mailing list