diff options
-rw-r--r-- | Resource/Init/gs_lev2.ps | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps index 429feb294..2851385af 100644 --- a/Resource/Init/gs_lev2.ps +++ b/Resource/Init/gs_lev2.ps | |||
@@ -948,7 +948,33 @@ mark | |||
948 | %% We don't, so copy the form dictionary | 948 | %% We don't, so copy the form dictionary |
949 | 1 index 4 1 roll | 949 | 1 index 4 1 roll |
950 | %% tell devices we're starting a form, run the PaintProc, and then tell the devices we've finished | 950 | %% tell devices we're starting a form, run the PaintProc, and then tell the devices we've finished |
951 | 3 -1 roll 2 index .beginform exec .endform | 951 | 3 -1 roll 2 index |
952 | .beginform exec | ||
953 | |||
954 | %% This is all horrible code to deal with illegal forms which leave junk on the operand stack | ||
955 | %% Starting from 1 (not 0, we don't want to look at the loop count) and going up to the | ||
956 | %% number of objects on the stack, check each object to see if its the Form dict (it is | ||
957 | %% *supposed* to be the top object after executing the PaintProc). I don't currently check to see if | ||
958 | %% the PaintProc ate the dict, but if there are extra objects, remove them and tell | ||
959 | %% the user. | ||
960 | %% | ||
961 | count 1 1 3 -1 roll { | ||
962 | dup index | ||
963 | dup type /dicttype eq { | ||
964 | /Implementation known { | ||
965 | 2 sub 0 1 3 -1 roll { | ||
966 | QUIET not { | ||
967 | (\n WARNING - Form PaintProc left operands on the stack after execution.\n This is technically illegal and these have been removed, \n if output is incorrect run again with -dUNROLLFORMS.\n) = | ||
968 | } if | ||
969 | pop pop | ||
970 | } for | ||
971 | }if | ||
972 | } { | ||
973 | pop pop | ||
974 | }ifelse | ||
975 | } for | ||
976 | |||
977 | .endform | ||
952 | %% Ask devices if they have cached the form, and what ID to use if so | 978 | %% Ask devices if they have cached the form, and what ID to use if so |
953 | %% returning -1 means 'no ID' | 979 | %% returning -1 means 'no ID' |
954 | .get_form_id dup -1 eq | 980 | .get_form_id dup -1 eq |