[gs-cvs] gs/lib
Igor Melichev
igor at ghostscript.com
Tue Apr 5 04:29:18 PDT 2005
Update of /cvs/ghostscript/gs/lib
In directory casper2:/tmp/cvs-serv24712/gs/lib
Modified Files:
ps2write.bat opdfread.ps
Log Message:
ps2write : Implementing a viewer's resource memory control, part 2.
DETAILS :
1. opdfread.ps :
Defined the new procedure CleanAllResources and called it after each page,
which defines /.ClearResources /All.
Currently it cleans all objects and all non-standard fonts.
Daemons, if they are stored in the Registry, are not cleaned.
(BTW, daemons may contain a reference to an object,
but we believe that currently unresolved daemons never appear
in Registry when ClearAllResources is being called).
2. ps2write.bat : Updated to involve the resource memory control.
See the log message of the previous patch for more information.
EXPECTED DIFFERENCES :
None.
Index: ps2write.bat
===================================================================
RCS file: /cvs/ghostscript/gs/lib/ps2write.bat,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ps2write.bat 4 Apr 2005 20:33:39 -0000 1.11
+++ ps2write.bat 5 Apr 2005 11:29:16 -0000 1.12
@@ -1,5 +1,5 @@
@rem $Id$
@rem Converting Postscript 3 or PDF to PostScript 2.
-%GSC% -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=temp.pdf %more_param% -c mark /ForOPDFRead true /CompressPages false /CompressFonts false /ASCII85EncodePages true .dicttomark setpagedevice -f %1
+%GSC% -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=temp.pdf %more_param% -c mark /ForOPDFRead true /MaxViewerMemorySize 8000000 /CompressPages false /CompressFonts false /ASCII85EncodePages true .dicttomark setpagedevice -f %1
copy /b %GS_LIBPATH%opdfread.ps+%GS_LIBPATH%gs_agl.ps+%GS_LIBPATH%gs_mro_e.ps+%GS_LIBPATH%gs_mgl_e.ps+temp.pdf+%GS_LIBPATH%EndOfTask.ps %2
Index: opdfread.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/opdfread.ps,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- opdfread.ps 4 Apr 2005 10:11:51 -0000 1.60
+++ opdfread.ps 5 Apr 2005 11:29:16 -0000 1.61
@@ -306,6 +306,65 @@
} ifelse
} bind def
+/StandardFontNames <<
+ /Times-Roman true
+ /Helvetica true
+ /Courier true
+ /Symbol true
+ /Times-Bold true
+ /Helvetica-Bold true
+ /Courier-Bold true
+ /ZapfDingbats true
+ /Times-Italic true
+ /Helvetica-Oblique true
+ /Courier-Oblique true
+ /Times-BoldItalic true
+ /Helvetica-BoldOblique true
+ /Courier-BoldOblique true
+>> def
+
+/CleanAllResources % - CleanAllResources -
+{ //PDFR_DEBUG {
+ (CleanAllResources beg) =
+ } if
+ //PDFReader /ObjectRegistry get
+ dup length 0 exch 1 exch 1 sub { % R i
+ 2 copy get dup xcheck {
+ % Don't clean a daemon.
+ pop pop
+ } {
+ null eq {
+ pop
+ } {
+ //PDFR_DEBUG {
+ (Dropping ) print dup =
+ } if
+ 1 index exch /DroppedObject put
+ } ifelse
+ } ifelse
+ } for
+ pop
+ FontDirectory length dict begin
+ FontDirectory {
+ pop
+ dup //StandardFontNames exch known not {
+ dup null def
+ } if
+ pop
+ } forall
+ currentdict
+ end {
+ pop
+ //PDFR_DEBUG {
+ (Undefining font ) print dup =
+ } if
+ undefinefont
+ } forall
+ //PDFR_DEBUG {
+ (CleanAllResources end) =
+ } if
+} bind def
+
/PrintReference % <array> PrintReference <array>
{
//PDFR_DEBUG {
@@ -357,10 +416,17 @@
/endobj % <id> <obj> endobj -
{
//PDFR_DEBUG {
- (Storing ) print 1 index =
+ (endobj ) =
} if
- //RunTypeDaemon exec
- //DoNothing 3 1 roll //Register exec
+ dup type /dicttype eq { dup /ImmediateExec known } { false } ifelse {
+ pop pop
+ } {
+ //PDFR_DEBUG {
+ (Storing ) print 1 index =
+ } if
+ //RunTypeDaemon exec
+ //DoNothing 3 1 roll //Register exec
+ } ifelse
} bind def
/StoreBlock % <buf> StoreBlock -
@@ -578,6 +644,11 @@
} {
//StoreStream exec
} ifelse
+ dup /.CleanResources //knownget exec {
+ /All eq {
+ //CleanAllResources exec
+ } if
+ } if
} bind def
/endstream % <id> <obj> endstream <id> <obj>
@@ -2092,7 +2163,9 @@
/ReadSamples % <dimensions> ReadSamples -
{ % The reader in on the dictionary stack.
- (ReadSamples beg ) print count =
+ //PDFR_DEBUG {
+ (ReadSamples beg ) print count =
+ } if
dup 1 eq {
pop
0 1 Size 0 get 1 sub {
@@ -2118,7 +2191,9 @@
//ReadSamplesRec exec
} forall
} ifelse
- (ReadSamples end ) print count =
+ //PDFR_DEBUG {
+ (ReadSamples end ) print count =
+ } if
} bind def
//ReadSamplesRec 0 //ReadSamples put
More information about the gs-cvs
mailing list