summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2018-11-21 22:02:45 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2018-11-21 22:02:45 +0000
commitb0f40fd0c9d80ae023fb484dfb5fab3d60042df6 (patch)
tree2ac5cf9ea63cc0e7ac2b082c388160d5f0fdb6fa /Master/tlpkg/tlgs/Resource/Init/gs_init.ps
parent0bf954671cb18df5e45fd2eb81155bd10c596f11 (diff)
Upgrade gs-9.25 -> gs-9.26
git-svn-id: svn://tug.org/texlive/trunk@49215 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_init.ps')
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_init.ps173
1 files changed, 108 insertions, 65 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
index bec307d1b13..d733124b96d 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
@@ -20,6 +20,11 @@
% %% Replace <n> <file(s)>
% indicate places where the next <n> lines should be replaced by
% the contents of <file(s)>, when creating a single merged init file.
+%
+% For reasons not clear to me, some cases of %% are being treated as
+% DSC comments when (and only when) the resource files are disk based
+% This can kill DSC parsing for pdfwrite at least, so avoid using
+% double % comments in this file.
% The interpreter can call out to PostScript code. All procedures
% called in this way, and no other procedures defined in these
@@ -29,7 +34,7 @@
% Interpreter library version number
% NOTE: the interpreter code requires that the first non-comment token
% in this file be an integer, and that it match the compiled-in version!
-925
+926
% Check the interpreter revision.
dup revision ne
@@ -136,12 +141,12 @@ currentdict /PDFNOCIDFALLBACK known /PDFNOCIDFALLBACK exch def
ifelse
.bind def
-%% This was a debugging switch removed in 9.22, no other software
-%% should have had any regard for it, and even if testing its value
-%% should have checked its existence first. However pstotext, an
-%% ancient and no longer maintained piece of softare, did check
-%% its value unconditionally. So we retain this key in the dictionary
-%% purely for backward compatibility.
+% This was a debugging switch removed in 9.22, no other software
+% should have had any regard for it, and even if testing its value
+% should have checked its existence first. However pstotext, an
+% ancient and no longer maintained piece of softare, did check
+% its value unconditionally. So we retain this key in the dictionary
+% purely for backward compatibility.
/NOBIND false def
currentdict /BATCH known /BATCH exch def
@@ -188,6 +193,16 @@ currentdict /DELAYSAFER known { /DELAYSAFER //true def /NOSAFER //true def } if
currentdict /PARANOIDSAFER known or % PARANOIDSAFER is equivalent
}
ifelse def
+
+/SAFERERRORS
+currentdict /NOSAFERERRORS known
+{
+ //false
+}
+{
+ currentdict /SAFERERRORS known
+} ifelse def
+
currentdict /SHORTERRORS known /SHORTERRORS exch def
currentdict /TTYPAUSE known /TTYPAUSE exch def
currentdict /WRITESYSTEMDICT known /WRITESYSTEMDICT exch def
@@ -831,12 +846,26 @@ userdict /.currentresourcefile //null put
/.runstring {
0 0 .systemvmstring .systemvmSFD cvx { .runexec } execute0
} bind def
+
% Define the procedure that the C code uses to set up for executing
% a string that may be received in pieces.
+%
+% Immediate evaluation doesn't work on operators (like .needinput)
+% so calling .runstringbegin will throw an undefined error if we
+% undefined .needinput so it cannot be accessed outside the init
+% code. But, we can store the operator in an array, use immediate
+% evaluation on the array to get the operator, then undefined the
+% array (and because they are both of the same name, the operator
+% get undefined too).
+% This prevents random Postscript from erroneously calling .needinput
+% and forcing the interpreter into an invalid state.
+/.needinput
+1 .systemvmarray dup 0 /.needinput load put
+def
/.runstringbegin {
- 1 .systemvmarray dup 0 /.needinput load put cvx % { .needinput } in systemvm
+ 1 .systemvmarray dup 0 //.needinput 0 get put cvx % { .needinput } in systemvm
0 0 .systemvmstring .systemvmSFD cvx .runexec
-} bind def
+} bind executeonly def
% Define a special version of runlibfile that aborts on errors.
/runlibfile0
@@ -1110,8 +1139,7 @@ end
.setglobal
} bind def
ErrorNames
- { dup .registererror /VMerror eq {exit} if
- } forall
+ { .registererror} forall
errordict begin
% The handlers for interrupt and timeout are special; there is no
% 'current object', so they push their own name.
@@ -1123,12 +1151,29 @@ errordict begin
} bind def
end % errordict
-% Put all the default handlers in gserrordict
-gserrordict
-errordict {2 index 3 1 roll put} forall
-noaccess pop
-% remove the non-standard errors from errordict
+gserrordict /unknownerror errordict /unknownerror get put
errordict /unknownerror .undef
+
+/.SAFERERRORLIST ErrorNames def
+/.setsafererrors
+{
+% Put all the requested handlers in gserrordict
+ gserrordict
+ //.SAFERERRORLIST
+ {
+ dup /unknownerror eq
+ {pop}
+ {
+ dup errordict exch get 2 index 3 1 roll put
+ }ifelse
+ }forall
+ noaccess pop
+ systemdict /.setsafeerrors .forceundef
+ systemdict /.SAFERERRORLIST .forceundef
+} bind executeonly odef
+
+SAFERERRORS {.setsafererrors} if
+
% Define a stable private copy of handleerror that we will always use under
% JOBSERVER mode.
/.GShandleerror errordict /handleerror get def
@@ -1760,18 +1805,15 @@ currentdict /.runlibfile .undef
% Bind all the operators defined as procedures.
/.bindoperators % binds operators in currentdict
- { % Temporarily disable the typecheck error.
- errordict /typecheck 2 copy get
- errordict /typecheck { pop } put % pop the command
+ {
currentdict
{ dup type /operatortype eq
- { % This might be a real operator, so bind might cause a typecheck,
- % but we've made the error a no-op temporarily.
- .bind
+ {
+ % This might be a real operator, so bind might cause a typecheck
+ {.bind} .internalstopped pop
}
if pop pop
} forall
- put
} def
DELAYBIND not { .bindoperators } if
@@ -2083,12 +2125,12 @@ currentdict /tempfilepaths undef
//SAFETY /safe //true .forceput % overrides readonly
} .bind executeonly odef
-%% This is only used during startup. Its required so that
-%% we can detect in setpagdevice that we are in fact in startup
-%% and allocate a *global* instead of local VM. We need it to be
-%% global to satisfy Display PostScript (see start of /setpagdevice
-%% in gs_setpd.ps)
-%%
+% This is only used during startup. Its required so that
+% we can detect in setpagdevice that we are in fact in startup
+% and allocate a *global* instead of local VM. We need it to be
+% global to satisfy Display PostScript (see start of /setpagdevice
+% in gs_setpd.ps)
+%
/.locksafeglobal {
.locksafe_userparams
systemdict /getenv {pop //false} put
@@ -2117,8 +2159,8 @@ currentdict /tempfilepaths undef
.locksafe
} .bind executeonly odef
-%% See /.locksafeglobal above.
-%%
+% See /.locksafeglobal above.
+%
/.setsafeglobal {
SAFETY /safe get not {
<<
@@ -2156,39 +2198,39 @@ SAFER { .setsafeglobal } if
/UndefinePostScriptOperators {
- %% This list is of Display PostScript operators. We believe that Display PostScript
- %% was never fully implemented and the only known user, GNUStep, is no longer
- %% using it. So lets remove it.
+ % This list is of Display PostScript operators. We believe that Display PostScript
+ % was never fully implemented and the only known user, GNUStep, is no longer
+ % using it. So lets remove it.
[
/condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify
/wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip
/viewclip /viewclippath /defineusername
- %% NeXT DPS extensions
+ % NeXT DPS extensions
/currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams
]
{systemdict exch .forceundef} forall
- %% This list is of operators which no longer appear to be used, and which we do not believe
- %% to have any real use. For now we will undefine the operstors so they cannot easily be used
- %% but can be easily restored (just delete the name from the list in the array). In future
- %% we may remove the operator and the code implementation entirely.
+ % This list is of operators which no longer appear to be used, and which we do not believe
+ % to have any real use. For now we will undefine the operstors so they cannot easily be used
+ % but can be easily restored (just delete the name from the list in the array). In future
+ % we may remove the operator and the code implementation entirely.
[
- /.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter
+ /.bitadd /.charboxpath /.cond /.runandhide /.popdevicefilter
/.execfile /.filenamesplit /.file_name_parent
/.setdefaultmatrix /.isprocfilter /.unread /.psstringencode
/.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength
/.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
/.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
- %% Used by our own test suite files
- %%/.setdotlength % Bug687720.ps
+ % Used by our own test suite files
+ %/.setdotlength % Bug687720.ps
]
{systemdict exch .forceundef} forall
- %% This list of operators are used internally by various parts of the Ghostscript startup code.
- %% Since each operator is a potential security vulnerability, and any operator listed here
- %% is not required once the initialisation is complete and functions are bound, we undefine
- %% the ones that aren't needed at runtime.
+ % This list of operators are used internally by various parts of the Ghostscript startup code.
+ % Since each operator is a potential security vulnerability, and any operator listed here
+ % is not required once the initialisation is complete and functions are bound, we undefine
+ % the ones that aren't needed at runtime.
[
/.callinstall /.callbeginpage /.callendpage
/.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox
@@ -2211,7 +2253,8 @@ SAFER { .setsafeglobal } if
/.shfill /.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring
/.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile
/.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams
- /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath
+ /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath /.currentoutputdevice
+ /.type /.writecvs /.setSMask /.currentSMask /.needinput /.countexecstack /.execstack /.applypolicies
% Used by a free user in the Library of Congress. Apparently this is used to
% draw a partial page, which is then filled in by the results of a barcode
@@ -2230,9 +2273,9 @@ SAFER { .setsafeglobal } if
% test files/utilities, or engineers expressed a desire to keep them visible.
%
%/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11
- %/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors
+ %/.buildfont32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors
%/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget
- %/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9
+ %/.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9
%/.tempfile /.numicc_components /.set_outputintent /.max /.min /.vmreclaim /.getpath /.setglobal
%/.setdebug /.mementolistnewblocks /getenv
]
@@ -2242,12 +2285,12 @@ SAFER { .setsafeglobal } if
} .bind executeonly def % must be bound and hidden for .forceundef
/UndefinePDFOperators {
- %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
- %% Since each operator is a potential security vulnerability, and any operator listed here
- %% is not required once the initislisation is complete and functions are bound, we undefine
- %% the ones that aren't needed at runtime.
- %% This function is only called if DELAYBIND is true. It is a copy of the code at the end of pdf_main.ps
- %% and must be maintained in parallel with it.
+ % This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
+ % Since each operator is a potential security vulnerability, and any operator listed here
+ % is not required once the initislisation is complete and functions are bound, we undefine
+ % the ones that aren't needed at runtime.
+ % This function is only called if DELAYBIND is true. It is a copy of the code at the end of pdf_main.ps
+ % and must be maintained in parallel with it.
[
/.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp
/.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
@@ -2356,13 +2399,13 @@ $error /.nosetlocal //false put
(END GLOBAL) VMDEBUG
-%% .savelocalstate is part of Display PostScript (if included). Part of the function of
-%% the .savelocalstate routine is to store the 'initial saved gstate' (savedinitialgstate)
-%% in systemdict. The code in dps1.c, gstate_check_space, disallows writing or creating
-%% gstates in global VM in certain conditions. If we execute setpagedevice before we
-%% reach this point, we must ensure that we do so using /..StartupGlobal so that
-%% the dictionary is defined in global VM, because the gstate contains a pointer to the
-%% device dictionary, and if that is allocated in local VM we will fail the gstate check.
+% .savelocalstate is part of Display PostScript (if included). Part of the function of
+% the .savelocalstate routine is to store the 'initial saved gstate' (savedinitialgstate)
+% in systemdict. The code in dps1.c, gstate_check_space, disallows writing or creating
+% gstates in global VM in certain conditions. If we execute setpagedevice before we
+% reach this point, we must ensure that we do so using /..StartupGlobal so that
+% the dictionary is defined in global VM, because the gstate contains a pointer to the
+% device dictionary, and if that is allocated in local VM we will fail the gstate check.
/.savelocalstate where {
% If we might create new contexts, save away copies of all dictionaries
% referenced from systemdict that are stored in local VM,
@@ -2397,8 +2440,8 @@ currentdict /.shadingtypes .undef
currentdict /.wheredict .undef
currentdict /.renderingintentdict .undef
-%% If we are using DELAYBIND we have to defer the undefinition
-%% until .bindnow.
+% If we are using DELAYBIND we have to defer the undefinition
+% until .bindnow.
DELAYBIND not {
SAFER {
//systemdict /SAFERUndefinePostScriptOperators get exec
@@ -2426,7 +2469,7 @@ systemdict /superexec .knownget {
systemdict /superexec .undef
} if
-%% Can't remove this one until the last minute :-)
+% Can't remove this one until the last minute :-)
DELAYBIND not {
systemdict /.undef .undef
} if