summaryrefslogtreecommitdiff
path: root/Resource/Init/gs_setpd.ps
diff options
context:
space:
mode:
authorNancy Durgin <nancy.durgin@artifex.com>2019-01-03 09:40:01 -0800
committerRobin Watts <robin.watts@artifex.com>2019-01-04 15:43:49 +0000
commit4759b642f0f85f61949df18a43179d9cc5c9a91a (patch)
treea657a6e0510d64900e1b8b9f4e8d442cb5694ca4 /Resource/Init/gs_setpd.ps
parent7fe04b119618b476586e5f5b85c46d72ff05ebfc (diff)
downloadghostpdl-4759b642f0f85f61949df18a43179d9cc5c9a91a.tar.gz
Undef internal setpagedevice operators
Had to delay and undef in ps_init.ps: /.execinstall Could undefine locally: /.postinstall /.copytree /.defaultdeviceparams /.makecurrentpagedevice
Diffstat (limited to 'Resource/Init/gs_setpd.ps')
-rw-r--r--Resource/Init/gs_setpd.ps79
1 files changed, 42 insertions, 37 deletions
diff --git a/Resource/Init/gs_setpd.ps b/Resource/Init/gs_setpd.ps
index e52fe4ee7..97f9ee530 100644
--- a/Resource/Init/gs_setpd.ps
+++ b/Resource/Init/gs_setpd.ps
@@ -403,10 +403,18 @@ SETPDDEBUG { (Result of putting.) = pstack flush } if
.writeonlykeys {2 index exch undef pop} forall
dup .setpagedevice
} bind def
+
+% Copy a dictionary recursively.
+/.copytree { % <dict> .copytree <dict'>
+ dup length dict exch {
+ dup type /dicttype eq { .copytree } if 2 index 3 1 roll put
+ } forall
+} bind def
+
/currentpagedevice {
.currentpagedevice {
dup length 0 eq {
- pop .makecurrentpagedevice
+ pop //.makecurrentpagedevice exec
} {
% If any of the dynamic keys have changed,
% we must update the page device dictionary.
@@ -455,7 +463,7 @@ SETPDDEBUG { (Result of putting.) = pstack flush } if
3 -1 roll dup length dict .copydict
3 1 roll
} if
- .copytree 2 index 3 1 roll put
+ //.copytree exec 2 index 3 1 roll put
} {
pop pop
} ifelse
@@ -474,13 +482,6 @@ SETPDDEBUG { (Result of putting.) = pstack flush } if
} if
} bind odef
-% Copy a dictionary recursively.
-/.copytree { % <dict> .copytree <dict'>
- dup length dict exch {
- dup type /dicttype eq { .copytree } if 2 index 3 1 roll put
- } forall
-} bind def
-
% The implementation of setpagedevice is quite complex. Currently,
% everything but the media matching algorithm is implemented here.
@@ -741,6 +742,30 @@ currentdict /7Policy undef
} bind def
+/.postinstall { % mark ... <failed> <merged> .postinstall -
+ matrix currentmatrix .setdefaultmatrix
+ % Erase and initialize the page.
+ initgraphics
+ currentoverprint //false setoverprint 1 setcolor
+ .fillpage
+ 0 setcolor setoverprint
+ .beginpage
+
+ % Clean up, calling PolicyReport if needed.
+ % Stack: mark ... <failed> <merged>
+SETPDDEBUG { (Finishing.) = pstack flush } if
+
+ exch dup length 0 ne
+ { 1 index /Policies get /PolicyReport get
+ counttomark 1 add 2 roll cleartomark
+ exec
+ }
+ { cleartomark
+ }
+ ifelse pop
+
+} def
+
% ---------------- setpagedevice itself ---------------- %
/setpagedevice
@@ -817,7 +842,7 @@ SETPDDEBUG { (Checking.) = pstack flush } if
dup //null eq
{ pop
}
- { exch pop .defaultdeviceparams
+ { exch pop //.defaultdeviceparams exec
% In case of duplicate keys, .dicttomark takes the entry
% lower on the stack, so we can just append the defaults here.
.requiredattrs { exec } forall .dicttomark
@@ -1014,12 +1039,12 @@ SETPDDEBUG { (Installing.) = pstack flush } if
exch 4 2 roll exch 4 2 roll .applypolicies exch 4 2 roll exch 4 2 roll
% Now execute the old Install -- failures after this are not handled
dup /Install .knownget { { .execinstall } stopped { pop } if } if
- .postinstall stop
+ //.postinstall exec stop
} {
- .postinstall
+ //.postinstall exec
} ifelse
} {
- .postinstall
+ //.postinstall exec
} ifelse
setglobal % return to original VM allocation mode
} bind executeonly odef
@@ -1042,36 +1067,16 @@ SETPDDEBUG { (Installing.) = pstack flush } if
pop % See above.
} odef
-/.postinstall { % mark ... <failed> <merged> .postinstall -
- matrix currentmatrix .setdefaultmatrix
- % Erase and initialize the page.
- initgraphics
- currentoverprint //false setoverprint 1 setcolor
- .fillpage
- 0 setcolor setoverprint
- .beginpage
-
- % Clean up, calling PolicyReport if needed.
- % Stack: mark ... <failed> <merged>
-SETPDDEBUG { (Finishing.) = pstack flush } if
-
- exch dup length 0 ne
- { 1 index /Policies get /PolicyReport get
- counttomark 1 add 2 roll cleartomark
- exec
- }
- { cleartomark
- }
- ifelse pop
-
-} odef
-
[
/.computemediasize
/.prepareparams
/.selectmedia
/.trysetparams
/.installpagedevice
+ /.postinstall
+ /.copytree
+ /.defaultdeviceparams
+ /.makecurrentpagedevice
% /.uninstallpagedevice % (called from C code)
]
{currentdict exch .forceundef} forall