summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2018-11-29 19:12:18 +0000
committerChris Liddell <chris.liddell@artifex.com>2019-03-25 07:08:07 +0000
commitb67bffb8ed17f8f8444a5f30643abd7b7cd2a4c2 (patch)
tree9be87323caa49e535ca865722a8d7dd76067381d
parent45328b19218a1d97e1149f958a5dc0714f2c1b0a (diff)
downloadghostpdl-gpdl-shared-device.tar.gz
GPDL: Run the pdfwrite setup each time we start a PS/PDF job.gpdl-shared-device
Re-run the "scheduled inits" procs after installing the device into the gstate - for the benefit of pdfwrite. For neatness, move the scheduled inits list dictionary, and the proc to run them into internaldict, so the don't contaminate the "normal" name space in systemdict. (Whatever git might say, the cleverness here is due to Chris).
-rw-r--r--Resource/Init/gs_init.ps32
-rw-r--r--psi/imain.c4
2 files changed, 26 insertions, 10 deletions
diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps
index 16211823c..124a65960 100644
--- a/Resource/Init/gs_init.ps
+++ b/Resource/Init/gs_init.ps
@@ -1239,33 +1239,46 @@ end
/=== { ===only (\n) print } bind def
% Create the initialization queue.
-
-/.delayed_init_queue 10 dict def
+1183615869 internaldict dup
+/.delayed_init_queue 10 dict put
/.schedule_init % <priority> <proc> .schedule_init -
{
- //.delayed_init_queue 2 index known {
+ 1183615869 internaldict begin
+ .delayed_init_queue 2 index known {
+ end
(.delayed_init_queue priority conflict with ) print 1 index =
/.schedule_init cvx /configurationerror signalerror
} if
- //.delayed_init_queue 3 1 roll .growput
+ .delayed_init_queue 3 1 roll .growput
+ end
} bind def
+begin
/.execute_scheduled_inits % - .execute_scheduled_inits -
{
- { 0 //null //.delayed_init_queue { % maxp {} p {}
+ 2 dict begin
+ /.newdelayed_init_queue
+ mark
+ 1183615869 internaldict /.delayed_init_queue get {} forall
+ .dicttomark def
+ {
+ 0 //null .newdelayed_init_queue { % maxp {} p {}
3 index 2 index lt {
4 2 roll
} if
pop pop
} forall
- exch //.delayed_init_queue exch undef
+ exch .newdelayed_init_queue exch undef
dup //null eq {
pop exit
} if
exec
} loop
+ currentdict /.newdelayed_init_queue undef
+ end
} bind def
+end
(END PROCS) VMDEBUG
@@ -2467,9 +2480,10 @@ $error /.nosetlocal //false put
} ifelse
% Execute scheduled inits :
-//.execute_scheduled_inits exec
-currentdict /.execute_scheduled_inits undef
-currentdict /.delayed_init_queue undef
+1183615869 internaldict /.execute_scheduled_inits get exec
+currentdict /.schedule_init undef
+%currentdict /.execute_scheduled_inits undef
+%currentdict /.delayed_init_queue undef
% Make global and local FontDirectory read-only.
FontDirectory readonly pop
diff --git a/psi/imain.c b/psi/imain.c
index 754207e20..1b84604a9 100644
--- a/psi/imain.c
+++ b/psi/imain.c
@@ -728,8 +728,10 @@ gs_main_set_device(gs_main_instance * minst, gx_device *pdev)
"currentpagedevice pop "
/* Setup the halftone */
".setdefaultscreen "
+ /* Re-run the scheduled initialisation procs, in case we've just set pdfwrite */
+ "1183615869 internaldict /.execute_scheduled_inits get exec "
/* Re-enter job encapsulation */
- "false 0 startjob pop"
+ "false 0 startjob pop "
, 0, &code, &error_object);
if (code < 0) goto done;
}