You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
866 lines
31 KiB
866 lines
31 KiB
From 95aa78beae9489d5c9f898fe2032aa23f860867d Mon Sep 17 00:00:00 2001 |
|
From: Ray Johnston <ray.johnston@artifex.com> |
|
Date: Fri, 21 Sep 2018 11:16:18 -0700 |
|
Subject: [PATCH 1/6] Catch errors in setpagesize, .setpagesize and |
|
setpagedevice and cleanup |
|
|
|
Bug 699794 showed that attempt to change page size in SAFER mode when the |
|
nulldevice was the currentdevice would leave 'false' on the stack. Run |
|
.setdevice in stopped and clean up, and also clean up .setpagesize |
|
--- |
|
Resource/Init/gs_lev2.ps | 9 ++++++++- |
|
Resource/Init/gs_setpd.ps | 9 +++++++-- |
|
Resource/Init/gs_statd.ps | 22 ++++++++++++++++++---- |
|
3 files changed, 33 insertions(+), 7 deletions(-) |
|
|
|
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps |
|
index b69303d..ab0c32e 100644 |
|
--- a/Resource/Init/gs_lev2.ps |
|
+++ b/Resource/Init/gs_lev2.ps |
|
@@ -616,7 +616,14 @@ currentuserparams /WaitTimeout known |
|
.dicttomark setpagedevice |
|
/WaitTimeout exch mark /JobTimeout 5 2 roll .dicttomark setsystemparams |
|
} bind def |
|
-/.setpagesize { 2 array astore /PageSize .dict1 setpagedevice } bind def |
|
+/.setpagesize |
|
+ { 2 copy 2 array astore /PageSize .dict1 { setpagedevice } stopped { |
|
+ pop % the setpagedevice dict |
|
+ /setpagesize $error /errorname get signalerror |
|
+ } { |
|
+ pop pop % success -- pop the arguments |
|
+ } ifelse |
|
+ } bind def |
|
/setduplexmode { /Duplex .dict1 setpagedevice } bind def |
|
/setmargins |
|
{ exch 2 array astore /Margins .dict1 setpagedevice |
|
diff --git a/Resource/Init/gs_setpd.ps b/Resource/Init/gs_setpd.ps |
|
index 46e5810..7875d1f 100644 |
|
--- a/Resource/Init/gs_setpd.ps |
|
+++ b/Resource/Init/gs_setpd.ps |
|
@@ -932,10 +932,15 @@ SETPDDEBUG { (Recovering.) = pstack flush } if |
|
% Stack: mark ... <merged> <failed> <device> <eraseflag> |
|
SETPDDEBUG { (Installing.) = pstack flush } if |
|
|
|
- pop |
|
+ pop |
|
% .setdevice clears the current page device! |
|
.currentpagedevice pop exch |
|
- .setdevice pop |
|
+ { .setdevice } stopped { |
|
+ cleartomark exch pop |
|
+ /setpagedevice $error /errorname get |
|
+ signalerror |
|
+ } if |
|
+ pop |
|
.setpagedevice |
|
|
|
% Implement UseCIEColor directly if this is a LL3 system. |
|
diff --git a/Resource/Init/gs_statd.ps b/Resource/Init/gs_statd.ps |
|
index 64c6463..34b759c 100644 |
|
--- a/Resource/Init/gs_statd.ps |
|
+++ b/Resource/Init/gs_statd.ps |
|
@@ -39,7 +39,13 @@ statusdict begin |
|
% These procedures are also accessed as data structures during initialization, |
|
% so the page dimensions must be the first two elements of the procedure. |
|
|
|
-/.setpagesize { /statusdict .systemvar begin .setpagesize end } bind def |
|
+/.setpagesize { |
|
+ /statusdict .systemvar begin |
|
+ { .setpagesize } stopped { |
|
+ /setpagesize $error /errorname get signalerror |
|
+ } if |
|
+ end |
|
+} bind def |
|
|
|
% Page sizes defined by Adobe documentation |
|
% Note: these executable arrays should all begin with two |
|
@@ -261,9 +267,17 @@ readonly def |
|
% The Adobe documentation only defines setpagetype |
|
% (a Level 1 operator) as accepting the values 0 and 1, |
|
% so we do too. |
|
- {/letter /note} 1 index get |
|
- //systemdict /userdict get exch get cvx exec |
|
- /pagetype exch def |
|
+ dup type /integertype ne { |
|
+ /setpage /typecheck signalerror |
|
+ } { |
|
+ dup 0 ne 1 index 1 ne or { |
|
+ /setpage /rangecheck signalerror |
|
+ } { |
|
+ {/letter /note} 1 index get |
|
+ //systemdict /userdict get exch get cvx exec |
|
+ } ifelse |
|
+ /pagetype exch def |
|
+ } ifelse |
|
end |
|
} bind def |
|
|
|
-- |
|
2.20.1 |
|
|
|
|
|
From c29ec2fff76e45bbf9cd767ff541556c5d064be4 Mon Sep 17 00:00:00 2001 |
|
From: Ray Johnston <ray.johnston@artifex.com> |
|
Date: Fri, 21 Sep 2018 12:00:50 -0700 |
|
Subject: [PATCH 2/6] Add parameter checking in setresolution |
|
|
|
Found in sequence for bug 699794 |
|
--- |
|
Resource/Init/gs_lev2.ps | 9 ++++++++- |
|
1 file changed, 8 insertions(+), 1 deletion(-) |
|
|
|
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps |
|
index ab0c32e..0f0d573 100644 |
|
--- a/Resource/Init/gs_lev2.ps |
|
+++ b/Resource/Init/gs_lev2.ps |
|
@@ -637,7 +637,14 @@ currentuserparams /WaitTimeout known |
|
.dicttomark setpagedevice |
|
} bind def |
|
/setresolution |
|
- { dup 2 array astore /HWResolution .dict1 setpagedevice |
|
+ { count 1 lt { /setresolution /stackunderflow signalerror } if |
|
+ dup type dup /integertype eq exch /realtype eq or not |
|
+ { |
|
+ /setresolution /typecheck signalerror |
|
+ } if |
|
+ dup 2 array astore /HWResolution .dict1 { setpagedevice } stopped { |
|
+ pop /setresolution $error /errorname get signalerror |
|
+ } if |
|
} bind def |
|
%END PAGEDEVICE |
|
|
|
-- |
|
2.20.1 |
|
|
|
|
|
From fe4c47d8e25d6366ecbb5ff487348148b908a89e Mon Sep 17 00:00:00 2001 |
|
From: Nancy Durgin <nancy.durgin@artifex.com> |
|
Date: Tue, 13 Nov 2018 14:23:41 -0800 |
|
Subject: [PATCH 3/6] Undefine some level2-related operators |
|
|
|
These are only a partial set. Undefine them in both the level2dict and |
|
systemdict. They are undef'd in gs_init.ps because they are used outside |
|
the scope of just gs_lev2.ps |
|
|
|
/.execform1 |
|
/.getdevparams |
|
/.setuserparams2 |
|
/.startjob |
|
/.checkFilePermitparams |
|
/.checksetparams |
|
/.copyparam |
|
/.setpagesize |
|
|
|
Rename .dict1 to .pair2dict and use immediate reference. |
|
|
|
Undef these at end of gs_lev2.ps (should never make it into systemdict): |
|
/.pair2dict |
|
/.checkprocesscomment |
|
--- |
|
Resource/Init/gs_init.ps | 18 ++++++++++++++++++ |
|
Resource/Init/gs_lev2.ps | 34 +++++++++++++++++++++------------- |
|
2 files changed, 39 insertions(+), 13 deletions(-) |
|
|
|
diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps |
|
index 48bb96d..e915f11 100644 |
|
--- a/Resource/Init/gs_init.ps |
|
+++ b/Resource/Init/gs_init.ps |
|
@@ -2271,6 +2271,24 @@ SAFER { .setsafeglobal } if |
|
] |
|
{systemdict exch .forceundef} forall |
|
|
|
+ % level 2 operators, undefine from both systemdict and level2dict |
|
+ [ |
|
+ /.execform1 |
|
+ /.getdevparams |
|
+ /.setuserparams2 |
|
+ /.startjob |
|
+ /.checkFilePermitparams |
|
+ /.checksetparams |
|
+ /.copyparam |
|
+ /.setpagesize |
|
+ |
|
+% Couldn't figure out how to do these yet |
|
+% /.checkparamtype |
|
+% /.startnewjob |
|
+ ] |
|
+ dup {level2dict exch .forceundef} forall |
|
+ {systemdict exch .forceundef} forall |
|
+ |
|
//systemdict /UndefinePostScriptOperators .forceundef |
|
} .bind executeonly def % must be bound and hidden for .forceundef |
|
|
|
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps |
|
index 0f0d573..e6f0645 100644 |
|
--- a/Resource/Init/gs_lev2.ps |
|
+++ b/Resource/Init/gs_lev2.ps |
|
@@ -64,7 +64,7 @@ level2dict begin |
|
pop |
|
} ifelse pop pop |
|
} forall pop pop |
|
-} .bind def % not odef, shouldn't reset stacks |
|
+} .bind odef |
|
|
|
% currentuser/systemparams creates and returns a dictionary in the |
|
% current VM. The easiest way to make this work is to copy any composite |
|
@@ -101,7 +101,7 @@ level2dict begin |
|
1 index length string exch .setglobal |
|
copy exch not { readonly } if |
|
} if |
|
-} .bind def |
|
+} .bind odef |
|
|
|
% Some user parameters are managed entirely at the PostScript level. |
|
% We take care of that here. |
|
@@ -345,13 +345,13 @@ end |
|
} ifelse |
|
} .bind def |
|
/ProcessComment //null .definepsuserparam |
|
-psuserparams /ProcessComment {.checkprocesscomment} put |
|
+psuserparams /ProcessComment {//.checkprocesscomment exec} put |
|
(%ProcessComment) cvn { |
|
/ProcessComment getuserparam |
|
dup //null eq { pop pop pop } { exec } ifelse |
|
} bind def |
|
/ProcessDSCComment //null .definepsuserparam |
|
-psuserparams /ProcessDSCComment {.checkprocesscomment} put |
|
+psuserparams /ProcessDSCComment {//.checkprocesscomment exec} put |
|
/.loadingfont //false def |
|
(%ProcessDSCComment) cvn { |
|
/ProcessDSCComment getuserparam |
|
@@ -556,7 +556,8 @@ end % serverdict |
|
% Note that statusdict must be allocated in local VM. |
|
% We don't bother with many of these yet. |
|
|
|
-/.dict1 { exch mark 3 1 roll .dicttomark } bind def |
|
+% convenience function to make a dictionary from an object and a key |
|
+/.pair2dict { exch mark 3 1 roll .dicttomark } bind def |
|
|
|
currentglobal //false setglobal 25 dict exch setglobal begin |
|
currentsystemparams |
|
@@ -569,11 +570,11 @@ systemdict /buildtime dup load put |
|
/checkpassword { .checkpassword 0 gt } bind def |
|
dup /DoStartPage known |
|
{ /dostartpage { /DoStartPage getsystemparam } bind def |
|
- /setdostartpage { /DoStartPage .dict1 setsystemparams } bind def |
|
+ /setdostartpage { /DoStartPage //.pair2dict exec setsystemparams } bind def |
|
} if |
|
dup /StartupMode known |
|
{ /dosysstart { /StartupMode getsystemparam 0 ne } bind def |
|
- /setdosysstart { { 1 } { 0 } ifelse /StartupMode .dict1 setsystemparams } bind def |
|
+ /setdosysstart { { 1 } { 0 } ifelse /StartupMode //.pair2dict exec setsystemparams } bind def |
|
} if |
|
%****** Setting jobname is supposed to set userparams.JobName, too. |
|
/jobname { /JobName getuserparam } bind def |
|
@@ -581,7 +582,7 @@ dup /StartupMode known |
|
/ramsize { /RamSize getsystemparam } bind def |
|
/realformat 1 index /RealFormat get def |
|
dup /PrinterName known |
|
- { /setprintername { /PrinterName .dict1 setsystemparams } bind def |
|
+ { /setprintername { /PrinterName //.pair2dict exec setsystemparams } bind def |
|
} if |
|
/printername |
|
{ currentsystemparams /PrinterName .knownget not { () } if exch copy |
|
@@ -617,18 +618,18 @@ currentuserparams /WaitTimeout known |
|
/WaitTimeout exch mark /JobTimeout 5 2 roll .dicttomark setsystemparams |
|
} bind def |
|
/.setpagesize |
|
- { 2 copy 2 array astore /PageSize .dict1 { setpagedevice } stopped { |
|
+ { 2 copy 2 array astore /PageSize //.pair2dict exec { setpagedevice } stopped { |
|
pop % the setpagedevice dict |
|
/setpagesize $error /errorname get signalerror |
|
} { |
|
pop pop % success -- pop the arguments |
|
} ifelse |
|
} bind def |
|
-/setduplexmode { /Duplex .dict1 setpagedevice } bind def |
|
+/setduplexmode { /Duplex //.pair2dict exec setpagedevice } bind def |
|
/setmargins |
|
- { exch 2 array astore /Margins .dict1 setpagedevice |
|
+ { exch 2 array astore /Margins //.pair2dict exec setpagedevice |
|
} bind def |
|
-/setpagemargin { 0 2 array astore /PageOffset .dict1 setpagedevice } bind def |
|
+/setpagemargin { 0 2 array astore /PageOffset //.pair2dict exec setpagedevice } bind def |
|
/setpageparams |
|
{ mark /PageSize 6 -2 roll |
|
4 index 1 and ORIENT1 { 1 } { 0 } ifelse ne { exch } if 2 array astore |
|
@@ -642,7 +643,7 @@ currentuserparams /WaitTimeout known |
|
{ |
|
/setresolution /typecheck signalerror |
|
} if |
|
- dup 2 array astore /HWResolution .dict1 { setpagedevice } stopped { |
|
+ dup 2 array astore /HWResolution //.pair2dict exec { setpagedevice } stopped { |
|
pop /setresolution $error /errorname get signalerror |
|
} if |
|
} bind def |
|
@@ -1254,3 +1255,10 @@ def |
|
%END TN 5044 psuedo-ops |
|
|
|
end % level2dict |
|
+ |
|
+% undefine things defined in this file and not referenced elsewhere |
|
+[ |
|
+ /.checkprocesscomment |
|
+ /.pair2dict |
|
+] |
|
+{level2dict exch .forceundef} forall |
|
-- |
|
2.20.1 |
|
|
|
|
|
From 932f4106a00e99e4ee32dcc02e57d3636f383ea1 Mon Sep 17 00:00:00 2001 |
|
From: Nancy Durgin <nancy.durgin@artifex.com> |
|
Date: Wed, 28 Nov 2018 10:09:01 -0800 |
|
Subject: [PATCH 4/6] Undef internal functions from level2dict |
|
|
|
--- |
|
Resource/Init/gs_lev2.ps | 6 ++++-- |
|
1 file changed, 4 insertions(+), 2 deletions(-) |
|
|
|
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps |
|
index e6f0645..7638f2a 100644 |
|
--- a/Resource/Init/gs_lev2.ps |
|
+++ b/Resource/Init/gs_lev2.ps |
|
@@ -117,7 +117,7 @@ counttomark 2 idiv { |
|
} repeat pop |
|
/.definepsuserparam { % <name> <value> .definepsuserparam - |
|
psuserparams 3 copy pop |
|
- type cvlit /.checkparamtype cvx 2 packedarray cvx put |
|
+ type cvlit //.checkparamtype /exec load 3 packedarray cvx put |
|
userparams 3 1 roll put |
|
} .bind def |
|
end |
|
@@ -211,7 +211,7 @@ end |
|
} forall |
|
} if |
|
/setsystemparams //pssystemparams mark exch { |
|
- type cvlit /.checkparamtype cvx 2 packedarray cvx |
|
+ type cvlit //.checkparamtype /exec load 3 packedarray cvx |
|
} forall .dicttomark .checksetparams |
|
% Set the C-level system params. If this succeeds, we know that |
|
% the password check succeeded. |
|
@@ -1260,5 +1260,7 @@ end % level2dict |
|
[ |
|
/.checkprocesscomment |
|
/.pair2dict |
|
+ /.setcolorrendering1 |
|
+ /.checkparamtype |
|
] |
|
{level2dict exch .forceundef} forall |
|
-- |
|
2.20.1 |
|
|
|
|
|
From e7ff64cf9b756278f19c87d295ee0fd95c955c05 Mon Sep 17 00:00:00 2001 |
|
From: Nancy Durgin <nancy.durgin@artifex.com> |
|
Date: Wed, 23 Jan 2019 12:00:30 -0800 |
|
Subject: [PATCH 5/6] Fixed bug caused by the way .checksetparams was undef'd |
|
|
|
Previously, had undef'd it by making it an operator. |
|
Now just use an immediate reference and undef it in the gs_lev2.ps file. |
|
|
|
This fixes bug introduced in commit fe4c47d8e25d6366ecbb5ff487348148b908a89e. |
|
|
|
Undef'ing .checksetparams by making it an operator doesn't work right because |
|
errors report .checksetparams as the offending function instead of |
|
the operator that uses it (setsystemparams in this case). |
|
|
|
This caused an error in file /tests_private/ps/ps3cet/27-09.PS on page 3, |
|
where it reports the offending function of some error-handling tests. |
|
Reporting function should be 'setsystemparams', not '.checksetparams' on |
|
this page. |
|
--- |
|
Resource/Init/gs_init.ps | 1 - |
|
Resource/Init/gs_lev2.ps | 7 ++++--- |
|
2 files changed, 4 insertions(+), 4 deletions(-) |
|
|
|
diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps |
|
index e915f11..a2503f1 100644 |
|
--- a/Resource/Init/gs_init.ps |
|
+++ b/Resource/Init/gs_init.ps |
|
@@ -2278,7 +2278,6 @@ SAFER { .setsafeglobal } if |
|
/.setuserparams2 |
|
/.startjob |
|
/.checkFilePermitparams |
|
- /.checksetparams |
|
/.copyparam |
|
/.setpagesize |
|
|
|
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps |
|
index 7638f2a..de1cc94 100644 |
|
--- a/Resource/Init/gs_lev2.ps |
|
+++ b/Resource/Init/gs_lev2.ps |
|
@@ -64,7 +64,7 @@ level2dict begin |
|
pop |
|
} ifelse pop pop |
|
} forall pop pop |
|
-} .bind odef |
|
+} .bind def |
|
|
|
% currentuser/systemparams creates and returns a dictionary in the |
|
% current VM. The easiest way to make this work is to copy any composite |
|
@@ -129,7 +129,7 @@ end |
|
/.setuserparams2 { |
|
% Check that we will be able to set the PostScript-level |
|
% user parameters. |
|
- /setuserparams /psuserparams .systemvar .checksetparams |
|
+ /setuserparams /psuserparams .systemvar //.checksetparams exec |
|
% Set the C-level user params. If this succeeds, we know that |
|
% the password check succeeded. |
|
dup .setuserparams |
|
@@ -212,7 +212,7 @@ end |
|
} if |
|
/setsystemparams //pssystemparams mark exch { |
|
type cvlit //.checkparamtype /exec load 3 packedarray cvx |
|
- } forall .dicttomark .checksetparams |
|
+ } forall .dicttomark //.checksetparams exec |
|
% Set the C-level system params. If this succeeds, we know that |
|
% the password check succeeded. |
|
dup .setsystemparams |
|
@@ -1262,5 +1262,6 @@ end % level2dict |
|
/.pair2dict |
|
/.setcolorrendering1 |
|
/.checkparamtype |
|
+ /.checksetparams |
|
] |
|
{level2dict exch .forceundef} forall |
|
-- |
|
2.20.1 |
|
|
|
|
|
From 4ec9ca74bed49f2a82acb4bf430eae0d8b3b75c9 Mon Sep 17 00:00:00 2001 |
|
From: Ray Johnston <ray.johnston@artifex.com> |
|
Date: Thu, 31 Jan 2019 11:31:30 -0800 |
|
Subject: [PATCH 6/6] Hide pdfdict and GS_PDF_ProcSet (internal stuff for the |
|
PDF interp). |
|
|
|
We now keep GS_PDF_ProcSet in pdfdict, and immediately bind pdfdict |
|
where needed so we can undef it after the last PDF interp file has |
|
run (pdf_sec.ps). |
|
--- |
|
Resource/Init/pdf_base.ps | 11 ++++---- |
|
Resource/Init/pdf_draw.ps | 59 +++++++++++++++++++-------------------- |
|
Resource/Init/pdf_font.ps | 9 +++--- |
|
Resource/Init/pdf_main.ps | 25 +++++++++-------- |
|
Resource/Init/pdf_ops.ps | 11 ++++---- |
|
Resource/Init/pdf_sec.ps | 4 ++- |
|
6 files changed, 60 insertions(+), 59 deletions(-) |
|
|
|
diff --git a/Resource/Init/pdf_base.ps b/Resource/Init/pdf_base.ps |
|
index c62ac0e..d3c3a5f 100644 |
|
--- a/Resource/Init/pdf_base.ps |
|
+++ b/Resource/Init/pdf_base.ps |
|
@@ -23,7 +23,6 @@ |
|
|
|
/.setlanguagelevel where { pop 2 .setlanguagelevel } if |
|
.currentglobal //true .setglobal |
|
-/pdfdict where { pop } { /pdfdict 100 dict def } ifelse |
|
pdfdict begin |
|
|
|
% Define the name interpretation dictionary for reading values. |
|
@@ -130,11 +129,11 @@ currentdict /num-chars-dict .undef |
|
|
|
/.pdfexectoken { % <count> <opdict> <exectoken> .pdfexectoken ? |
|
PDFDEBUG { |
|
- pdfdict /PDFSTEPcount known not { pdfdict /PDFSTEPcount 1 .forceput } executeonly if |
|
+ //pdfdict /PDFSTEPcount known not { //pdfdict /PDFSTEPcount 1 .forceput } executeonly if |
|
PDFSTEP { |
|
- pdfdict /PDFtokencount 2 copy .knownget { 1 add } { 1 } ifelse .forceput |
|
+ //pdfdict /PDFtokencount 2 copy .knownget { 1 add } { 1 } ifelse .forceput |
|
PDFSTEPcount 1 gt { |
|
- pdfdict /PDFSTEPcount PDFSTEPcount 1 sub .forceput |
|
+ //pdfdict /PDFSTEPcount PDFSTEPcount 1 sub .forceput |
|
} executeonly |
|
{ |
|
dup ==only |
|
@@ -142,10 +141,10 @@ currentdict /num-chars-dict .undef |
|
( ? ) print flush 1 //false .outputpage |
|
(%stdin) (r) file 255 string readline { |
|
token { |
|
- exch pop pdfdict /PDFSTEPcount 3 -1 roll .forceput |
|
+ exch pop //pdfdict /PDFSTEPcount 3 -1 roll .forceput |
|
} executeonly |
|
{ |
|
- pdfdict /PDFSTEPcount 1 .forceput |
|
+ //pdfdict /PDFSTEPcount 1 .forceput |
|
} executeonly ifelse % token |
|
} { |
|
pop /PDFSTEP //false def % EOF on stdin |
|
diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps |
|
index d743ae1..1add3f7 100644 |
|
--- a/Resource/Init/pdf_draw.ps |
|
+++ b/Resource/Init/pdf_draw.ps |
|
@@ -18,8 +18,7 @@ |
|
|
|
/.setlanguagelevel where { pop 2 .setlanguagelevel } if |
|
.currentglobal //true .setglobal |
|
-/pdfdict where { pop } { /pdfdict 100 dict def } ifelse |
|
-GS_PDF_ProcSet begin |
|
+/GS_PDF_ProcSet load begin |
|
pdfdict begin |
|
|
|
% For simplicity, we use a single interpretation dictionary for all |
|
@@ -113,7 +112,7 @@ pdfdict begin |
|
|
|
/resolvefunction { % <fndict> resolvefunction <function> |
|
.resolvefn |
|
- PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Function: ) print dup === flush } if } if |
|
+ PDFDEBUG { //pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Function: ) print dup === flush } if } if |
|
} bind executeonly def |
|
|
|
/resolvefnproc { % <fndict> resolvefnproc <proc> |
|
@@ -1073,7 +1072,7 @@ currentdict end readonly def |
|
%% finished running the PaintProc. |
|
|
|
/.actual_pdfpaintproc { % <patdict> <resdict> .pdfpaintproc - |
|
- PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Begin PaintProc) print dup === flush } if } if |
|
+ PDFDEBUG { //pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Begin PaintProc) print dup === flush } if } if |
|
PDFfile fileposition 3 1 roll |
|
q |
|
1 index /PaintType oget 1 eq { |
|
@@ -1108,21 +1107,21 @@ currentdict end readonly def |
|
Q |
|
}{ |
|
(\n **** Error: File has unbalanced q/Q operators \(too many Q's\)\n Output may be incorrect.\n) |
|
- pdfdict /.Qqwarning_issued .knownget |
|
+ //pdfdict /.Qqwarning_issued .knownget |
|
{ |
|
{ |
|
pop |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
@@ -1131,21 +1130,21 @@ currentdict end readonly def |
|
} loop |
|
{ |
|
(\n **** Error: File has unbalanced q/Q operators \(too many q's\)\n Output may be incorrect.\n) |
|
- pdfdict /.Qqwarning_issued .knownget |
|
+ //pdfdict /.Qqwarning_issued .knownget |
|
{ |
|
{ |
|
pop |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
@@ -1156,7 +1155,7 @@ currentdict end readonly def |
|
/pdfemptycount exch def |
|
|
|
Q |
|
- PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%End PaintProc) print dup === flush } if } if |
|
+ PDFDEBUG { //pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%End PaintProc) print dup === flush } if } if |
|
PDFfile exch setfileposition |
|
} bind executeonly odef |
|
|
|
@@ -1227,7 +1226,7 @@ currentdict end readonly def |
|
] cvx put |
|
dup /BBox 2 copy knownoget { normrect FixPatternBBox put } { pop pop } ifelse |
|
dup /.pattern_uses_transparency 1 index patternusestransparency put |
|
- PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Pattern: ) print dup === flush } if } if |
|
+ PDFDEBUG { //pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Pattern: ) print dup === flush } if } if |
|
} bind executeonly def |
|
|
|
/ignore_color_op ( **** Error: Ignoring a color operation in a cached context.\n Output may be incorrect.\n) readonly def |
|
@@ -2348,16 +2347,16 @@ currentdict /last-ditch-bpc-csp undef |
|
} bind executeonly def |
|
|
|
/IncrementAppearanceNumber { |
|
- pdfdict /AppearanceNumber .knownget { |
|
- 1 add pdfdict /AppearanceNumber 3 -1 roll .forceput |
|
+ //pdfdict /AppearanceNumber .knownget { |
|
+ 1 add //pdfdict /AppearanceNumber 3 -1 roll .forceput |
|
} executeonly |
|
{ |
|
- pdfdict /AppearanceNumber 0 .forceput |
|
+ //pdfdict /AppearanceNumber 0 .forceput |
|
} executeonly ifelse |
|
}bind executeonly odef |
|
|
|
/MakeAppearanceName { |
|
- pdfdict /AppearanceNumber get |
|
+ //pdfdict /AppearanceNumber get |
|
10 string cvs |
|
dup length 10 add string dup 0 (\{FormName) putinterval |
|
dup 3 -1 roll |
|
@@ -2378,17 +2377,17 @@ currentdict /last-ditch-bpc-csp undef |
|
gsave initclip |
|
MakeNewAppearanceName |
|
.pdfFormName |
|
- pdfdict /.PreservePDFForm known {pdfdict /.PreservePDFForm get} {//false}ifelse exch |
|
- pdfdict /.PreservePDFForm true .forceput |
|
+ //pdfdict /.PreservePDFForm known {//pdfdict /.PreservePDFForm get} {//false}ifelse exch |
|
+ //pdfdict /.PreservePDFForm true .forceput |
|
DoForm |
|
- pdfdict /.PreservePDFForm 3 -1 roll .forceput |
|
+ //pdfdict /.PreservePDFForm 3 -1 roll .forceput |
|
grestore |
|
} bind executeonly odef |
|
|
|
/DoForm { |
|
%% save the current value, if its true we will set it to false later, in order |
|
%% to prevent us preserving Forms which are used *from* an annotation /Appearance. |
|
- pdfdict /.PreservePDFForm known {pdfdict /.PreservePDFForm get} {//false}ifelse exch |
|
+ //pdfdict /.PreservePDFForm known {//pdfdict /.PreservePDFForm get} {//false}ifelse exch |
|
|
|
%% We may alter the Default* colour spaces, if the Resources |
|
%% ColorSpace entry contains one of them. But we don't want that |
|
@@ -2503,13 +2502,13 @@ currentdict /last-ditch-bpc-csp undef |
|
pdfemptycount countdictstack 3 -1 roll |
|
/pdfemptycount count 4 sub store |
|
|
|
- pdfdict /.PreservePDFForm known {pdfdict /.PreservePDFForm get}{//false} ifelse |
|
+ //pdfdict /.PreservePDFForm known {//pdfdict /.PreservePDFForm get}{//false} ifelse |
|
{ |
|
%% We must *not* preserve any subsidiary forms (curently at least) as PDF |
|
%% form preservation doesn't really work. This is used just for Annotation |
|
%% Appearances currently, and if they should happen to use a form, we do not |
|
%% want to preserve it. |
|
- pdfdict /.PreservePDFForm false .forceput |
|
+ //pdfdict /.PreservePDFForm false .forceput |
|
/q cvx /execform cvx 5 -2 roll |
|
} executeonly |
|
{ |
|
@@ -2542,7 +2541,7 @@ currentdict /last-ditch-bpc-csp undef |
|
saved_DCMYK /DefaultCMYK exch /ColorSpace defineresource pop |
|
end |
|
} if |
|
- pdfdict /.PreservePDFForm 3 -1 roll .forceput |
|
+ //pdfdict /.PreservePDFForm 3 -1 roll .forceput |
|
} bind executeonly odef |
|
|
|
/_dops_save 1 array def |
|
@@ -2701,13 +2700,13 @@ drawopdict begin |
|
% Start by getting the object number for a Form XObject |
|
dup Page /XObject obj_get dup 0 eq not { |
|
% Now get the recording dictionary and see if that object number has been seen |
|
- pdfdict /Recursive_XObject_D get 1 index known { |
|
+ //pdfdict /Recursive_XObject_D get 1 index known { |
|
( **** Error: Recursive XObject detected, ignoring ") print 1 index 256 string cvs print (", object number ) print 256 string cvs print (\n) print |
|
( Output may be incorrect.\n) pdfformaterror |
|
//false |
|
}{ |
|
% We haven't seen it yet, so record it. |
|
- pdfdict /Recursive_XObject_D get 1 index null put |
|
+ //pdfdict /Recursive_XObject_D get 1 index null put |
|
3 1 roll |
|
//true |
|
}ifelse |
|
@@ -2745,7 +2744,7 @@ drawopdict begin |
|
( Output may be incorrect.\n) pdfformaterror |
|
} ifelse |
|
PDFfile exch setfileposition |
|
- pdfdict /Recursive_XObject_D get exch undef |
|
+ //pdfdict /Recursive_XObject_D get exch undef |
|
}{ |
|
% Otherwise ignore it and tidy up the stacks |
|
pop pop |
|
diff --git a/Resource/Init/pdf_font.ps b/Resource/Init/pdf_font.ps |
|
index 46408f9..275b659 100644 |
|
--- a/Resource/Init/pdf_font.ps |
|
+++ b/Resource/Init/pdf_font.ps |
|
@@ -37,8 +37,7 @@ |
|
|
|
/.setlanguagelevel where { pop 2 .setlanguagelevel } if |
|
.currentglobal //true .setglobal |
|
-/pdfdict where { pop } { /pdfdict 100 dict def } ifelse |
|
-GS_PDF_ProcSet begin |
|
+/GS_PDF_ProcSet load begin % from userdict at this point |
|
pdfdict begin |
|
|
|
% We cache the PostScript font in an additional element of the |
|
@@ -1219,11 +1218,11 @@ currentdict /eexec_pdf_param_dict .undef |
|
.pdfruncontext |
|
countdictstack BuildCharDictDepth sub |
|
{ |
|
- pdfdict /.Qqwarning_issued .knownget {not}{//true} ifelse |
|
+ //pdfdict /.Qqwarning_issued .knownget {not}{//true} ifelse |
|
{ |
|
(\n **** Warning: Type 3 glyph has unbalanced q/Q operators \(too many q's\)\n Output may be incorrect.\n) |
|
pdfformatwarning |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
} executeonly if |
|
Q |
|
} repeat |
|
@@ -2334,7 +2333,7 @@ currentdict /bndef undef |
|
dup //null eq |
|
{pop} |
|
{ |
|
- pdfdict /InputPDFFileName .knownget {.CRCHashFilenameAndObject} if |
|
+ //pdfdict /InputPDFFileName .knownget {.CRCHashFilenameAndObject} if |
|
exch dup /.OrigUniqueIDXUID .knownget not |
|
{ |
|
dup /XUID .knownget not |
|
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps |
|
index dd1480b..e44288e 100644 |
|
--- a/Resource/Init/pdf_main.ps |
|
+++ b/Resource/Init/pdf_main.ps |
|
@@ -18,8 +18,9 @@ |
|
|
|
/.setlanguagelevel where { pop 2 .setlanguagelevel } if |
|
.currentglobal //true .setglobal |
|
-/pdfdict where { pop } { /pdfdict 100 dict def } ifelse |
|
pdfdict begin |
|
+/GS_PDF_ProcSet dup load def % keep in pdfdict to hide it |
|
+userdict /GS_PDF_ProcSet undef |
|
|
|
% Patch in an obsolete variable used by some third-party software. |
|
/#? //false def |
|
@@ -304,8 +305,8 @@ currentdict /runpdfstring .undef |
|
/Page //null def |
|
/DSCPageCount 0 def |
|
/PDFSave //null def |
|
- GS_PDF_ProcSet begin |
|
- pdfdict begin |
|
+ //pdfdict /GS_PDF_ProcSet get begin |
|
+ //pdfdict begin |
|
pdfopen begin |
|
/CumulativePageCount currentpagedevice /PageCount get def |
|
} bind executeonly def |
|
@@ -624,7 +625,7 @@ currentdict /runpdfstring .undef |
|
%% copied to a temporary file) and store it in pdfdict. We will use this for |
|
%% hashing fonts to detect if fonts with the same name are from different files. |
|
%% |
|
- dup currentglobal exch true setglobal .getfilename exch setglobal /InputPDFFileName exch pdfdict 3 1 roll .forceput |
|
+ dup currentglobal exch true setglobal .getfilename exch setglobal /InputPDFFileName exch //pdfdict 3 1 roll .forceput |
|
|
|
//runpdfbegin exec |
|
//pdf_collection_files exec |
|
@@ -1390,7 +1391,7 @@ currentdict /xref-char-dict undef |
|
} bind executeonly def |
|
|
|
/pdfopenfile { % <file> pdfopenfile <dict> |
|
- pdfdict readonly pop % can't do it any earlier than this |
|
+ //pdfdict readonly pop % can't do it any earlier than this |
|
32 dict begin |
|
/LocalResources 0 dict def |
|
/DefaultQstate //null def % establish binding |
|
@@ -2684,21 +2685,21 @@ currentdict /PDF2PS_matrix_key undef |
|
StreamRunAborted not { |
|
(\n **** Error: File has unbalanced q/Q operators \(too many q's\)\n Output may be incorrect.\n) |
|
|
|
- pdfdict /.Qqwarning_issued .knownget |
|
+ //pdfdict /.Qqwarning_issued .knownget |
|
{ |
|
{ |
|
pop |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
@@ -2710,8 +2711,8 @@ currentdict /PDF2PS_matrix_key undef |
|
Repaired % pass Repaired state around the restore |
|
RepairedAnError |
|
PDFSave restore |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //false .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //false .forceput |
|
.setglobal |
|
/RepairedAnError exch def |
|
/Repaired exch def |
|
diff --git a/Resource/Init/pdf_ops.ps b/Resource/Init/pdf_ops.ps |
|
index aa09641..c2e7461 100644 |
|
--- a/Resource/Init/pdf_ops.ps |
|
+++ b/Resource/Init/pdf_ops.ps |
|
@@ -24,6 +24,7 @@ |
|
systemdict /pdfmark known not |
|
{ userdict /pdfmark { cleartomark } bind executeonly put } if |
|
|
|
+systemdict /pdfdict where { pop } { /pdfdict 100 dict put } ifelse |
|
userdict /GS_PDF_ProcSet 256 dict dup begin |
|
|
|
% ---------------- Abbreviations ---------------- % |
|
@@ -174,21 +175,21 @@ currentdict /gput_always_allow .undef |
|
{ |
|
(\n **** Error: File has unbalanced q/Q operators \(too many Q's\)\n Output may be incorrect.\n) |
|
|
|
- pdfdict /.Qqwarning_issued .knownget |
|
+ //pdfdict /.Qqwarning_issued .knownget |
|
{ |
|
{ |
|
pop |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
} |
|
{ |
|
- currentglobal pdfdict gcheck .setglobal |
|
- pdfdict /.Qqwarning_issued //true .forceput |
|
+ currentglobal //pdfdict gcheck .setglobal |
|
+ //pdfdict /.Qqwarning_issued //true .forceput |
|
.setglobal |
|
pdfformaterror |
|
} executeonly ifelse |
|
diff --git a/Resource/Init/pdf_sec.ps b/Resource/Init/pdf_sec.ps |
|
index 143efb7..a8e3d2e 100644 |
|
--- a/Resource/Init/pdf_sec.ps |
|
+++ b/Resource/Init/pdf_sec.ps |
|
@@ -39,7 +39,6 @@ |
|
|
|
/.setlanguagelevel where { pop 2 .setlanguagelevel } if |
|
.currentglobal //true .setglobal |
|
-/pdfdict where { pop } { /pdfdict 100 dict def } ifelse |
|
pdfdict begin |
|
|
|
% Older ghostscript versions do not have .pdftoken, so we use 'token' instead. |
|
@@ -748,4 +747,7 @@ currentdict /PDFScanRules_null undef |
|
} bind executeonly def |
|
|
|
end % pdfdict |
|
+ |
|
+systemdict /pdfdict .forceundef % hide pdfdict |
|
+ |
|
.setglobal |
|
-- |
|
2.20.1 |
|
|
|
|