diff options
author | Reinhard Kotucha <reinhard.kotucha@web.de> | 2019-05-10 23:51:26 +0000 |
---|---|---|
committer | Reinhard Kotucha <reinhard.kotucha@web.de> | 2019-05-10 23:51:26 +0000 |
commit | e92598acb3a0a20ac8ff31928d84188de2360b7f (patch) | |
tree | efb05c3dd914979fc62f92be27b52b7d54ef3e9b /Master/tlpkg/tlgs/Resource/Init/gs_res.ps | |
parent | a0dbdd61992f743553c4c357edf3af0cfc3cd0b9 (diff) |
Upgrade gs-9.26 -> gs-9.27
git-svn-id: svn://tug.org/texlive/trunk@51079 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_res.ps')
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_res.ps | 171 |
1 files changed, 103 insertions, 68 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_res.ps b/Master/tlpkg/tlgs/Resource/Init/gs_res.ps index 8eb8bb0e582..0f8cb8f6cd1 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_res.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_res.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2018 Artifex Software, Inc. +% Copyright (C) 2001-2019 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or @@ -41,10 +41,10 @@ level2dict begin % However, Ed Taft of Adobe says their interpreters don't implement this % either, so we aren't going to worry about it for a while. -currentglobal //false setglobal systemdict begin - /localinstancedict 5 dict - .forcedef % localinstancedict is local, systemdict is global -end //true setglobal +currentglobal //false setglobal + systemdict /localinstancedict 5 dict + .forceput % localinstancedict is local, systemdict is global +//true setglobal /.emptydict 0 dict readonly def setglobal @@ -149,10 +149,10 @@ setglobal dup [ exch 0 -1 ] exch .Instances 4 2 roll put % Make the Category dictionary read-only. We will have to - % use .forceput / .forcedef later to replace the dummy, + % use .forceput / .forceput later to replace the dummy, % empty .Instances dictionary with the real one later. readonly - } { + }{ /defineresource cvx /typecheck signaloperror } ifelse } bind executeonly odef @@ -196,8 +196,8 @@ setglobal % can use it without entering another level of pseudo-operator. /.findresource { % <key> <category> findresource <instance> 2 copy dup /Category eq - { pop //Category 0 get begin } { .findcategory } ifelse - /FindResource .resourceexec exch pop exch pop + { pop //Category 0 get begin } { //.findcategory exec } ifelse + /FindResource //.resourceexec exec exch pop exch pop } bind end % .Instances of Category def @@ -216,14 +216,14 @@ def 2 .argindex 2 index 2 index % catch stackunderflow % See above re .errorexec. /defineresource cvx { - .findcategory + //.findcategory exec currentdict /InstanceType known { dup type InstanceType ne { dup type /packedarraytype eq InstanceType /arraytype eq and not { /defineresource cvx /typecheck signaloperror } if } if } if - /DefineResource .resourceexec + /DefineResource //.resourceexec exec 4 1 roll pop pop pop } .errorexec } bind executeonly odef @@ -235,7 +235,7 @@ def % calls, so stack protection doesn't apply to the very last token of an % operator procedure. /resourceforall1 { % <template> <proc> <scratch> <category> resourceforall1 - - dup .findcategory + dup //.findcategory exec /ResourceForAll load % Stack: <template> <proc> <scratch> <category> proc exch pop % pop the category @@ -252,7 +252,7 @@ def % without the check. /resourcestatus cvx /typecheck signalerror } if - 2 copy .findcategory /ResourceStatus .resourceexec + 2 copy //.findcategory exec /ResourceStatus //.resourceexec exec { 4 2 roll pop pop //true } { pop pop //false } ifelse } stopped { % Although resourcestatus is an operator, Adobe uses executable name @@ -266,7 +266,7 @@ def } if 1 .argindex 1 index % catch stackunderflow - { .findcategory /UndefineResource .resourceexec pop pop + { //.findcategory exec /UndefineResource //.resourceexec exec pop pop } stopped { % Although undefineresource is an operator, Adobe uses executable name % here but uses operator for the errors above. CET 23-33 @@ -304,7 +304,8 @@ systemdict begin dup () ne { .file_name_directory_separator concatstrings } if - 2 index exch //false .file_name_combine not { + 2 index exch //false + .file_name_combine not { (Error: .default_resource_dir returned ) print exch print ( that can't combine with ) print = /.default_resource_dir cvx /configurationerror signalerror } if @@ -315,16 +316,16 @@ currentdict /pssystemparams known not { /pssystemparams 10 dict readonly def } if pssystemparams begin - .default_resource_dir - /FontResourceDir (Font) .resource_dir_name - readonly .forcedef % pssys'params is r-o - /GenericResourceDir () .resource_dir_name - readonly .forcedef % pssys'params is r-o + //.default_resource_dir exec + /FontResourceDir (Font) //.resource_dir_name exec + readonly currentdict 3 1 roll .forceput % pssys'params is r-o + /GenericResourceDir () //.resource_dir_name exec + readonly currentdict 3 1 roll .forceput % pssys'params is r-o pop % .default_resource_dir /GenericResourcePathSep - .file_name_separator readonly .forcedef % pssys'params is r-o - (%diskFontResourceDir) cvn (/Resource/Font/) readonly .forcedef % pssys'params is r-o - (%diskGenericResourceDir) cvn (/Resource/) readonly .forcedef % pssys'params is r-o + .file_name_separator readonly currentdict 3 1 roll .forceput % pssys'params is r-o + currentdict (%diskFontResourceDir) cvn (/Resource/Font/) readonly .forceput % pssys'params is r-o + currentdict (%diskGenericResourceDir) cvn (/Resource/) readonly .forceput % pssys'params is r-o end end @@ -387,13 +388,13 @@ status { } bind def /.localresourceforall { % <key> <value> <args> .localr'forall - exch pop - 2 copy 0 get .stringmatch { .enumerateresource } { pop pop } ifelse + 2 copy 0 get .stringmatch { //.enumerateresource exec } { pop pop } ifelse } bind def /.globalresourceforall { % <key> <value> <args> .globalr'forall - exch pop 2 copy 0 get .stringmatch { dup 3 get begin .LocalInstances end 2 index known not { - .enumerateresource + //.enumerateresource exec } { pop pop } ifelse @@ -408,7 +409,7 @@ status { 3 index known { pop pop pop } { - 2 index known { pop pop } { .enumerateresource } ifelse + 2 index known { pop pop } { //.enumerateresource exec } ifelse } ifelse } bind def @@ -422,10 +423,10 @@ status { .Instances dup //.emptydict eq { pop 3 dict % As noted above, Category dictionaries are read-only, - % so we have to use .forcedef here. - /.Instances 1 index .forcedef % Category dict is read-only - } if - } + % so we have to use .forceput here. + currentdict /.Instances 2 index .forceput % Category dict is read-only + } executeonly if + } executeonly { .LocalInstances dup //.emptydict eq { pop 3 dict localinstancedict Category 2 index put } @@ -435,13 +436,13 @@ status { % Stack: key value instance instancedict 3 index 2 index .growput % Now make the resource value read-only. - 0 2 copy get { readonly } .internalstopped pop + 0 2 copy get { readonly } //.internalstopped exec pop dup 4 1 roll put exch pop exch pop - } + } executeonly { /defineresource cvx /typecheck signaloperror } ifelse -} .bind executeonly .makeoperator % executeonly to prevent access to .forcedef +} .bind executeonly .makeoperator % executeonly to prevent access to .forceput /UndefineResource { { dup 2 index .knownget { dup 1 get 1 ge @@ -468,19 +469,19 @@ status { % .knownget doesn't fail on null /findresource cvx /typecheck signaloperror } if - dup .getvminstance { + dup //.getvminstance exec { exch pop 0 get } { dup ResourceStatus { pop 1 gt { - .DoLoadResource .getvminstance not { - /findresource cvx .undefinedresource + .DoLoadResource //.getvminstance exec not { + /findresource cvx //.undefinedresource exec } if 0 get } { .GetInstance pop 0 get } ifelse } { - /findresource cvx .undefinedresource + /findresource cvx //.undefinedresource exec } ifelse } ifelse } bind executeonly @@ -621,20 +622,20 @@ status { .currentglobal not .setglobal vmstatus pop exch pop add } repeat -} bind def +} bind executeonly odef /.DoLoadResource { % .LoadResource may push entries on the operand stack. % It is an undocumented feature of Adobe implementations, % which we must match for the sake of some badly written % font downloading code, that such entries are popped % automatically. - count 1 index cvlit .vmused + count 1 index cvlit //.vmused % Stack: key count litkey memused {.LoadResource} 4 1 roll 4 .execn % Stack: ... count key memused - .vmused exch sub - 1 index .getvminstance not { - pop dup .undefinedresource % didn't load + //.vmused exch sub + 1 index //.getvminstance exec not { + pop dup //.undefinedresource exec % didn't load } if dup 1 1 put 2 3 -1 roll put @@ -644,11 +645,11 @@ status { /.LoadResource { dup .ResourceFile { exch pop currentglobal - { .runresource } - { //true setglobal { .runresource } stopped //false setglobal { stop } if } + { //.runresource exec } + { //true setglobal { //.runresource exec } stopped //false setglobal { stop } if } ifelse } - { dup .undefinedresource + { dup //.undefinedresource exec } ifelse } bind @@ -667,10 +668,10 @@ status { } { pop currentdict /ResourceFileName known { - mark 1 index //.rfnstring { ResourceFileName } .internalstopped { + mark 1 index //.rfnstring { ResourceFileName } //.internalstopped exec { cleartomark //false } { - (r) { file } .internalstopped { + (r) { file } //.internalstopped exec { cleartomark //false } { exch pop exch pop //true @@ -703,7 +704,7 @@ mark /ColorSpaceFamily { } % These must be deferred, because optional features may add some. /Emulator - mark EMULATORS { <00> search { exch pop cvn exch }{ cvn exit } ifelse } .bind loop .packtomark + mark EMULATORS { <00> search { exch pop cvn exch }{ cvn exit } ifelse } .bind loop //.packtomark exec /Filter { } % These must be deferred, because optional features may add some. /IODevice @@ -712,10 +713,10 @@ mark errordict /rangecheck { pop stop } put % pop the command mark 0 { { dup .getiodevice dup //null eq { pop } { exch } ifelse 1 add - } loop} .internalstopped - pop pop pop .packtomark + } loop} //.internalstopped exec + pop pop pop //.packtomark exec 4 1 roll put - .clearerror + //.clearerror exec % Type categories listed in the Red Book. /ColorRenderingType { } % These must be deferred, because optional features may add some. @@ -758,13 +759,13 @@ counttomark 2 idiv /FindResource { .Instances 1 index .knownget { exch pop } - { /findresource cvx .undefinedresource } + { /findresource cvx //.undefinedresource exec } ifelse } bind executeonly /ResourceStatus { .Instances exch known { 0 0 //true } { //false } ifelse } bind executeonly /ResourceForAll - /Generic .findcategory /ResourceForAll load end + /Generic //.findcategory exec /ResourceForAll load end % Additional entries @@ -826,7 +827,7 @@ counttomark 2 idiv 0 { {dup .getdevice .devicename cvn 1 dict dup /PageSize [1 1 14400 14400] put [exch readonly 0 -1] 3 -1 roll 1 add} loop -} .internalstopped pop +} //.internalstopped exec pop %% Remove the count, and the duplicate, from the stack pop pop .dicttomark @@ -862,7 +863,7 @@ userdict /.localcsdefaults //false put 2 copy /Generic /Category findresource /DefineResource get exec exch pop exch //.defaultcsnames exch .knownget { - 1 index .definedefaultcs + 1 index //.definedefaultcs exec currentglobal not { .userdict /.localcsdefaults //true put } if } if } bind executeonly @@ -872,13 +873,13 @@ userdict /.localcsdefaults //false put //.defaultcsnames 1 index .knownget { % Stack: resname index currentglobal { - .undefinedefaultcs pop + //.undefinedefaultcs exec pop } { % We removed the local definition, but there might be a global one. exch .GetInstance { - 0 get .definedefaultcs + 0 get //.definedefaultcs exec } { - .undefinedefaultcs + //.undefinedefaultcs exec } ifelse % Recompute .localcsdefaults by scanning. This is rarely needed. .userdict /.localcsdefaults //false //.defaultcsnames { @@ -945,6 +946,7 @@ userdict /.localcsdefaults //false put dup type /nametype eq { .fontstatus { pop //null exit } if } { + dup type /dicttype eq {/Path .knownget pop} if dup type /stringtype eq { findlibfile { closefile pop //null exit } if pop } { @@ -961,7 +963,7 @@ userdict /.localcsdefaults //false put dup type /nametype eq { .namestring } if dup type /stringtype ne { //false exit } if % Check the resource directory. - dup .fonttempstring /FontResourceDir getsystemparam .genericrfn + dup //.fonttempstring /FontResourceDir getsystemparam .genericrfn status { pop pop pop pop //true exit } if @@ -969,7 +971,7 @@ userdict /.localcsdefaults //false put % as the font. findlibfile { closefile //true exit } if % Scan a FONTPATH directory and try again. - .scannextfontdir not { //false exit } if + //.scannextfontdir exec not { //false exit } if } loop } bind def @@ -981,7 +983,7 @@ userdict /.localcsdefaults //false put { //.fontstatusaux exec } { //false } ifelse } ifelse -} bind def +} bind executeonly def currentdict /.fontstatusaux .undef /Font mark @@ -997,7 +999,7 @@ currentdict /.fontstatusaux .undef /Generic /Category findresource /UndefineResource get exec } bind executeonly /FindResource { - dup .getvminstance { + dup //.getvminstance exec { exch pop 0 get } { dup ResourceStatus { @@ -1008,7 +1010,7 @@ currentdict /.fontstatusaux .undef } ifelse } bind executeonly /ResourceForAll { - { .scannextfontdir not { exit } if } loop + { //.scannextfontdir exec not { exit } if } loop /Generic /Category findresource /ResourceForAll get exec } bind executeonly /.ResourceFileStatus { @@ -1016,15 +1018,15 @@ currentdict /.fontstatusaux .undef } bind executeonly /.loadfontresource { - dup .vmused exch + dup //.vmused exch % Hack: rebind .currentresourcefile so that all calls of % definefont will know these are built-in fonts. currentfile {pop //findfont exec} .execasresource % (findfont is a procedure) - exch .vmused exch sub + exch //.vmused exch sub % stack: name font vmused % findfont has the prerogative of not calling definefont % in certain obscure cases of font substitution. - 2 index .getvminstance { + 2 index //.getvminstance exec { dup 1 1 put 2 3 -1 roll put } { @@ -1054,7 +1056,9 @@ currentdict /.fontstatusaux .undef % Make sure the old definitions are still in systemdict so that % they will get bound properly. -systemdict begin +% NOTE: Mystery code... I can't just delete this, but don't understand why. +% Instead we will undef these three operators in gs_init.ps after all the initialization is done. + systemdict begin /.origdefinefont /definefont load def /.origundefinefont /undefinefont load def /.origfindfont /findfont load def @@ -1120,7 +1124,15 @@ end % level2dict /sGrayICC exch /ColorSpace defineresource pop systemdict /CIEsGRAYICC undef } if - % ColorSpaceFamily resources + systemdict /CIEesRGBICC .knownget { + /esRGBICC exch /ColorSpace defineresource pop + systemdict /CIEesRGBICC undef + } if + systemdict /CIErommRGBICC .knownget { + /rommRGBICC exch /ColorSpace defineresource pop + systemdict /CIErommRGBICC undef + } if + % ColorSpaceFamily resources colorspacedict { pop dup /ColorSpaceFamily defineresource pop } forall % Filter resources filterdict { pop dup /Filter defineresource pop } forall @@ -1159,3 +1171,26 @@ end % level2dict %% Replace 1 (gs_resmp.ps) (gs_resmp.ps) dup runlibfile VMDEBUG + +[ + /.default_resource_dir + /.resource_dir_name + /.fonttempstring /.scannextfontdir % from gs_fonts.ps +] +{systemdict exch .forceundef} forall + +[ + /.definedefaultcs + /.undefinedefaultcs + /.defaultcsnames + /.enumerateresource + /.externalresourceforall + /.getvminstance + /.globalresourceforall + /.localresourceforall + /resourceforall1 + /.resourceexec + /.undefinedresource + /.vmused +] +{level2dict exch .forceundef} forall |