From 5495dccfe2922c9db6a88df19c1ae41f9c3f363d Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Wed, 16 Oct 2019 20:19:46 +0000 Subject: Upgrade gs-9.27 -> gs-9.50 git-svn-id: svn://tug.org/texlive/trunk@52405 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/tlgs/README.TEXLIVE | 9 +- Master/tlpkg/tlgs/Resource/Init/gs_btokn.ps | 4 +- Master/tlpkg/tlgs/Resource/Init/gs_cet.ps | 4 +- Master/tlpkg/tlgs/Resource/Init/gs_cff.ps | 6 +- Master/tlpkg/tlgs/Resource/Init/gs_cidfm.ps | 53 ++- Master/tlpkg/tlgs/Resource/Init/gs_cidfn.ps | 2 +- Master/tlpkg/tlgs/Resource/Init/gs_dps2.ps | 6 +- Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps | 3 +- Master/tlpkg/tlgs/Resource/Init/gs_fapi.ps | 10 +- Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps | 5 +- Master/tlpkg/tlgs/Resource/Init/gs_fonts.ps | 75 +++- Master/tlpkg/tlgs/Resource/Init/gs_img.ps | 3 +- Master/tlpkg/tlgs/Resource/Init/gs_init.ps | 199 ++++++++--- Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps | 10 +- Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps | 4 +- Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps | 10 +- Master/tlpkg/tlgs/Resource/Init/gs_res.ps | 27 +- Master/tlpkg/tlgs/Resource/Init/gs_resmp.ps | 8 +- Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps | 13 +- Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps | 150 ++++---- Master/tlpkg/tlgs/Resource/Init/gs_type1.ps | 14 +- Master/tlpkg/tlgs/Resource/Init/pdf_base.ps | 4 +- Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps | 524 ++++++++++++++-------------- Master/tlpkg/tlgs/Resource/Init/pdf_font.ps | 296 +++++++++++----- Master/tlpkg/tlgs/Resource/Init/pdf_main.ps | 49 ++- Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps | 256 +++++++++----- Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps | 23 +- Master/tlpkg/tlgs/bin/gsdll32.dll | Bin 8219648 -> 8298496 bytes Master/tlpkg/tlgs/bin/gsdll32.lib | Bin 8946 -> 10464 bytes Master/tlpkg/tlgs/bin/gswin32.exe | Bin 141312 -> 143360 bytes Master/tlpkg/tlgs/bin/gswin32c.exe | Bin 132608 -> 134656 bytes Master/tlpkg/tlgs/lib/PDFA_def.ps | 71 +++- Master/tlpkg/tlgs/lib/PDFX_def.ps | 84 ++++- 33 files changed, 1219 insertions(+), 703 deletions(-) (limited to 'Master/tlpkg') diff --git a/Master/tlpkg/tlgs/README.TEXLIVE b/Master/tlpkg/tlgs/README.TEXLIVE index 68350e53b3c..df8945569b6 100644 --- a/Master/tlpkg/tlgs/README.TEXLIVE +++ b/Master/tlpkg/tlgs/README.TEXLIVE @@ -1,5 +1,5 @@ -This directory contains a subset of the Ghostscript 9.27 distribution +This directory contains a subset of the Ghostscript 9.50 distribution for Windows. The only purpose of this package is to support programs shipped with TeX Live. It's not intended for general use. @@ -26,13 +26,6 @@ Changes: * Binaries compiled by Akira Kakuto with --disable-compile-inits. - * A patch - commit 06c920713e11bce9bd541bbf9bf294b2ba16aee8 - Author: Chris Liddell - Date: Wed Apr 10 14:23:39 2019 +0100 - for base/fapi_ft.c - which fixes problems in pdfcrop etc., is applied. - This version of Ghostscript will not be installed on your system and will not interfere with other versions of Ghostscript which might be installed already. diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_btokn.ps b/Master/tlpkg/tlgs/Resource/Init/gs_btokn.ps index 3d6de33eb76..b9add38368a 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_btokn.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_btokn.ps @@ -338,5 +338,5 @@ end /.cntobj /.writeobject /.writeobjects -] -{level2dict exch .forceundef} forall +] dup level2dict .undefinternalnames +systemdict .undefinternalnames diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps b/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps index 54f17c645d6..c168165eb1f 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps @@ -90,7 +90,7 @@ dup 7 -1 put { ofile } ifelse -} bind //.odef exec +} .bind //.odef exec currentdict /ofile undef % One QL job (23-12B.PS) effectively does: @@ -113,7 +113,7 @@ currentdict /ofile undef { osetfileposition } ifelse -} bind //.odef exec +} .bind //.odef exec currentdict /osetfileposition undef setglobal diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_cff.ps b/Master/tlpkg/tlgs/Resource/Init/gs_cff.ps index 125906132b7..99d214a64b6 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_cff.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_cff.ps @@ -26,9 +26,9 @@ % Augment the FONTPATH machinery so it recognizes OpenType CFF font sets. /.scanfontheaders where { - pop /.scanfontheaders [ - .scanfontheaders aload pop (OTTO*) - ] def + /.scanfontheaders [ + /.scanfontheaders .systemvar aload pop (OTTO*) + ] put } if % Load a font file that might be an OpenType CFF font set. diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_cidfm.ps b/Master/tlpkg/tlgs/Resource/Init/gs_cidfm.ps index c0237283cd8..5eb25f0042f 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_cidfm.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_cidfm.ps @@ -133,9 +133,39 @@ currentdict end def } if >> def +% .basename +/.splitdirname { + (/) rsearch { //true } { (\\) rsearch } ifelse + {3 -2 roll pop pop //true}{//false} ifelse +} bind def + +% .addcidfmappath - +/.addcidfmpermitpath +{ + .filename + { + //.splitdirname exec + {dup def} if + } if +} bind def + /VerifyMap % VerifyMap - { + % This is where we insert the default fallback into the map + % checking first to see if there is a user specified alternative + dup /CIDFallBack known not{ + //DefaultCIDFallBack dup /Path get status + { + pop pop pop pop + /CIDFallBack exch 2 index 3 1 roll put + } + { + pop + }ifelse + } if + % Remove any mappings for which we cannot find the font file + dup length dict begin dup { % if we have a name1->name2 mapping, follow the "trail", @@ -163,11 +193,12 @@ currentdict end def /Path .knownget { .libfile - {closefile pop} + { + dup //.addcidfmpermitpath exec closefile pop} { {(r) file} //.internalstopped exec {pop pop 2 index exch .undef} - {closefile pop} ifelse + {dup //.addcidfmpermitpath exec closefile pop} ifelse } ifelse } {2 index exch .undef} @@ -177,19 +208,8 @@ currentdict end def } ifelse } loop } forall - - % This is where we insert the default fallback into the map - % checking first to see if there is a user specified alternative - dup /CIDFallBack known not{ - //DefaultCIDFallBack dup /Path get status - { - pop pop pop pop - /CIDFallBack exch 2 index 3 1 roll put - } - { - pop - }ifelse - } if + currentdict end + {exch pop (/) concatstrings /PermitFileReading exch .addcontrolpath} forall % Checks for vicious substitution cycles. dup length dict copy % <> @@ -233,6 +253,9 @@ currentdict end def pop pop } bind def +currentdict /.splitdirname undef +currentdict /.addcidfmpermitpath undef + /PreprocessRecord % PreprocessRecord { //IsMyRecord exec { diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_cidfn.ps b/Master/tlpkg/tlgs/Resource/Init/gs_cidfn.ps index 80b8008cf30..ca2a5a7ca20 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_cidfn.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_cidfn.ps @@ -423,4 +423,4 @@ dup /.CheckResource { /.checkfonttype /.loadcidfontresource /.readglyphdata -] {systemdict exch .forceundef} forall +] systemdict .undefinternalnames diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_dps2.ps b/Master/tlpkg/tlgs/Resource/Init/gs_dps2.ps index fe3ca27dd5b..619984f2fe1 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_dps2.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_dps2.ps @@ -220,21 +220,21 @@ currentdict /.fixcurrenthalftonescreen undef .UserObjects 3 .argindex 1 add 10 .max .localvmarray put } ifelse .UserObjects get 2 .argindex 2 index put pop pop -} bind odef +} .bind odef /execuserobject { % execuserobject - dup type /integertype ne { % Adobe validates the argument before accessing UserObjects - CET 31-03 /execuserobject .systemvar /typecheck signalerror } if .UserObjects get 1 .argindex get exch pop exec -} bind odef +} .bind odef /undefineuserobject { % undefineuserobject - dup type /integertype ne { % Adobe validates the argument before accessing UserObjects - CET 31-11 /undefineuserobject .systemvar /typecheck signalerror } if .UserObjects get 1 .argindex //null put pop -} bind odef +} .bind odef currentdict /.UserObjects undef % ------ Cache control ------ % diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps b/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps index b337f42856f..b28f742ef88 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps @@ -312,5 +312,4 @@ end /EPSBoundingBoxParse /EPSBoundingBoxProcess /ProcessEPSComment -] -{currentdict exch .forceundef} forall +] currentdict .undefinternalnames diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_fapi.ps b/Master/tlpkg/tlgs/Resource/Init/gs_fapi.ps index 53b744604fa..1ca3dff7b52 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_fapi.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_fapi.ps @@ -372,7 +372,7 @@ bind def { (\nFAPIhook ) print 1 index = flush } //FAPI_hook_debug exec dup /FAPI known { { //PrintFontRef exec ( is mapped to FAPI=) print dup /FAPI get = flush } //FAPI_hook_debug exec - //true //.FAPIrebuildfont //ChooseDecoding exec + //true .FAPIrebuildfont //ChooseDecoding exec } { dup /PathLoad known dup { { (PathLoad known for the font ) print //PrintFontRef exec (.\n) print flush} //FAPI_hook_debug exec @@ -403,9 +403,9 @@ bind def } ifelse { { (Trying to render the font ) print //PrintFontRef exec ( with FAPI...\n) print flush } //FAPI_hook_debug exec - //.FAPIpassfont { + .FAPIpassfont { { //PrintFontRef exec ( is being rendered with FAPI=) print dup /FAPI get = flush } //FAPI_hook_debug exec - //false //.FAPIrebuildfont //ChooseDecoding exec + //false .FAPIrebuildfont //ChooseDecoding exec } { { (Can't render ) print //PrintFontRef exec ( with FAPI, will do with native GS renderer.\n) print flush } //FAPI_hook_warn exec } ifelse @@ -429,7 +429,7 @@ bind def % ------------------ Redefine .buildfont* with FAPI : ----------------------- /.buildfont1 -{ //.buildfont1 exec exec //FAPIhook exec +{ //.buildfont1 exec //FAPIhook exec } bind % 'odef' is below. /.buildfont2 @@ -456,7 +456,7 @@ end % the temporary dictionary for local binding. odef odef odef odef odef odef % Undef these, not needed outside this file -[ /.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont ] {systemdict exch .forceundef} forall +[ /.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont ] systemdict .undefinternalnames .setlanguagelevel diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps b/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps index 196c8641418..66432e11e93 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps @@ -270,7 +270,8 @@ currentdict end def .dicttomark def /ChooseDecoding % ChooseDecoding -{ { % A loop for 'exit' context. +{ + { % A loop for 'exit' context. dup /Decoding .knownget { dup type /nametype eq { 1 index /CIDFontType known { /CIDDecoding } { /Decoding } ifelse @@ -305,6 +306,7 @@ currentdict end def { % unknown encoding, or an encoding for which we don't have a % predefined decoding, convert it to decoding : + currentglobal 3 1 roll 2 index gcheck setglobal dup length dict begin /.notdef 0 def 0 1 currentdict length 1 sub @@ -317,6 +319,7 @@ currentdict end def } for pop currentdict end + 3 -1 roll setglobal 1 index exch /Decoding exch put } if } ifelse diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_fonts.ps b/Master/tlpkg/tlgs/Resource/Init/gs_fonts.ps index c47f6e57767..8e361552bc8 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_fonts.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_fonts.ps @@ -36,7 +36,6 @@ end def .setlanguagelevel - % ------ End of editable parameters ------ % % Define the UniqueIDs and organization XUID assigned to Artifex. @@ -67,6 +66,36 @@ end def loop } bind def +% .basename +/.splitdirname { + (/) rsearch { //true } { (\\) rsearch } ifelse + {3 -2 roll pop pop //true}{//false} ifelse +} bind def + +% .addfontmappermitpaths +% As fontmap can contain a *lot* of individual entries +% we split off the filenames, and add directories to the +% allowed paths. +% We accumulate the paths in a dictionary, then iterate +% the dictionary adding the paths to the PermitReading +% list. This leverages the efficiency of dictionaries +% handling duplicate keys. +/.addfontmappermitpaths +{ + dup length dict begin + { + exch pop dup type /stringtype eq + {//.splitdirname exec {dup def} {pop} ifelse} + {pop} + ifelse + } forall + currentdict end + {exch pop /PermitFileReading exch .addcontrolpath}forall +} bind def + +defaultfontmap_content length 0 gt +{defaultfontmap_content .addfontmappermitpaths} if + % Load a font name -> font file name map. userdict /Fontmap .FontDirectory maxlength dict put userdict /.nativeFontmap .FontDirectory maxlength dict put @@ -76,7 +105,8 @@ userdict /.nativeFontmap .FontDirectory maxlength dict put % specification that makes later entries override earlier % ones within the same file. 50 dict exch .readFontmap - { .definefontmap } forall + dup //.addfontmappermitpaths exec + { .definefontmap } forall } bind def /.readFontmap { % .readFontmap { dup token not { closefile exit } if @@ -232,6 +262,11 @@ ifelse FONTPATH length 0 eq { (%END FONTPATH) .skipeof } if /FONTPATH [ FONTPATH .pathlist ] def +FONTPATH +{ + /PermitFileReading exch .addcontrolpath +} forall + % Scan directories looking for plausible fonts. "Plausible" means that % the file begins with %!PS-AdobeFont or %!FontType1, or with \200\001 % followed by four arbitrary bytes and then either of these strings. @@ -309,7 +344,7 @@ FONTPATH length 0 eq { (%END FONTPATH) .skipeof } if /.scan1fontstring 8192 string def % BeginFont: is not per Adobe documentation, but a few fonts have it. /.scanfontheaders [(%!PS-Adobe*) (%!FontType*) (%%BeginFont:*)] def -0 //.scanfontheaders { length .max } forall 6 add % extra for PFB header +0 /.scanfontheaders .systemvar { length .max } forall 6 add % extra for PFB header /.scan1fontfirst exch string def /.scanfontdir % .scanfontdir - { currentglobal exch //true setglobal @@ -349,7 +384,7 @@ FONTPATH length 0 eq { (%END FONTPATH) .skipeof } if { dup length 6 sub 6 exch getinterval } if % Check for font file headers. - //false //.scanfontheaders + //false /.scanfontheaders .systemvar { 2 index exch .stringmatch or } forall exch pop @@ -1003,13 +1038,25 @@ $error /SubstituteFont { } put % check { findlibfile not - } { + } + { + //true + } ifelse + + + % if findlibfile didn't work, try just opening the file direcly. + { dup (r) { file } stopped { pop pop //true } { //false } ifelse - } ifelse { + } + { + //false + }ifelse + + { QUIET not { (Can't find \(or can't open\) font file ) print dup print (.) = flush @@ -1101,7 +1148,7 @@ $error /SubstituteFont { } put } loop % end of loop - } bind executeonly odef % must be bound and hidden for .putgstringcopy + } bind executeonly def % must be bound and hidden for .putgstringcopy % Attempt to load a font from a file. /.tryloadfont { % .tryloadfont true @@ -1111,14 +1158,14 @@ $error /SubstituteFont { } put /.genericrfn where { pop pop dup //.fonttempstring /FontResourceDir getsystemparam .genericrfn - {//false .loadfontloop} //.internalstopped exec {//false} if { + {//false //.loadfontloop exec} //.internalstopped exec {//false} if { //true } { dup //.nametostring exec - {//true .loadfontloop} //.internalstopped exec {//false} if + {//true //.loadfontloop exec} //.internalstopped exec {//false} if } ifelse } { - {//true .loadfontloop} //.internalstopped exec {//false} if + {//true //.loadfontloop exec} //.internalstopped exec {//false} if } ifelse } bind def @@ -1138,7 +1185,7 @@ $error /SubstituteFont { } put { exch pop //true //false } { % if we can't load by name check the native font map - dup .nativeFontmap exch .knownget + .nativeFontmap exch .knownget { //true //true } { //false //false } ifelse } ifelse @@ -1185,7 +1232,7 @@ $error /SubstituteFont { } put { 1 dict begin } ifelse - //true .loadfontloop + //true //.loadfontloop exec end { //true exit } if } @@ -1292,5 +1339,5 @@ FAKEFONTS { exch } if pop def % don't bind, .current/setglobal get redefined /.nametostring /.fontnamestring /.checkalias /.fontknownget /.stdsubstfont /.putgstringcopy /.definenativefontmap - /.findfontname -] {systemdict exch .forceundef} forall + /.findfontname /.addfontmappermitpaths /.splitdirname +] systemdict .undefinternalnames diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_img.ps b/Master/tlpkg/tlgs/Resource/Init/gs_img.ps index be1dc8fd298..00d79df34ac 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_img.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_img.ps @@ -734,8 +734,7 @@ if /img_check_ary /img_unbuild_ary /.is_low_resolution -] -{currentdict exch .undef} forall +] currentdict .undefinternalnames end % systemdict diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps index 55a785eceed..722b57c1e80 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps @@ -34,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! -927 +950 % Check the interpreter revision. dup revision ne @@ -182,11 +182,12 @@ currentdict /DELAYSAFER known { /DELAYSAFER //true def /NOSAFER //true def } if /SAFER currentdict /NOSAFER known { //false } { - currentdict /SAFER known - currentdict /PARANOIDSAFER known or % PARANOIDSAFER is equivalent + //true } ifelse def +/OLDSAFER currentdict /OLDSAFER known def + /SAFERERRORS currentdict /NOSAFERERRORS known { @@ -333,6 +334,59 @@ DELAYBIND } .bind def } executeonly if +.currentglobal //true .setglobal +/.undefinternalnameslist 10 dict def +.setglobal + +% Under normal operation .undefinternalnames simply removes +% the keys in the array parameter from the dictionary parameter. +% Under DELAYBIND operation, we accumulate the names in dictionaries, +% stored in .undefinternalnameslist, and then .bindow calls +% .applyundefinternalnames once all binds have been applied. +% The .undefinternalnameslist dictionary is a little odd in that it +% uses the dictionary from which the keys should be undefined as the +% 'key' and then the value is a dictionary whose key/value pairs are +% both the names to be undefined. +% +% [array of names] <> .undefinternalnames - +/.undefinternalnames +{ + DELAYBIND + { + .currentglobal //true .setglobal 3 1 roll + dup //.undefinternalnameslist exch .knownget not + { + 128 dict dup 3 1 roll + //.undefinternalnameslist 3 1 roll put + }{exch pop} ifelse + exch + { + dup 2 index 3 1 roll put + } forall + pop + .setglobal + } + { + exch + { + 1 index exch .forceundef + } executeonly forall + pop + } executeonly ifelse +} .bind executeonly def + +/.applyundefinternalnames +{ + //.undefinternalnameslist + { + { + pop + 1 index exch .forceundef + } executeonly forall + pop + } executeonly forall +} .bind executeonly def + %**************** BACKWARD COMPATIBILITY **************** /hwsizedict mark /HWSize //null .dicttomark readonly def /copyscanlines { % copyscanlines @@ -550,7 +604,7 @@ currentdict /.execute .undef % We run the handleerror procedure using .internalstopped so that broken error handlers % won't cause nested errors (Unexpected Error conditions). /handleerror - JOBSERVER { + //systemdict /JOBSERVER get{ { /.GShandleerror .systemvar //.internalstopped exec pop } bind % always use .GShandleerror. } { { /errordict .systemvar /handleerror get //.internalstopped exec pop } bind % PLRM standard errorhandling @@ -570,7 +624,7 @@ currentdict /.execute .undef count 0 ne { (<) print count =only } if (>) print flush } bind def -/prompt { flush flushpage NOPROMPT not { //.promptmsg exec} if } bind def +/prompt { flush flushpage //systemdict /NOPROMPT get not { //.promptmsg exec} if } bind def currentdict /.promptmsg .undef /pstack { 0 1 count 3 sub { index == } for } bind def @@ -654,7 +708,7 @@ odef } odef /.confirmread { - TTYPAUSE { + //systemdict /TTYPAUSE get { (/dev/tty) (r) file dup read pop pop closefile } { .echo.mode //false echo @@ -667,11 +721,11 @@ odef } bind executeonly def /.confirm { - DISPLAYING NOPAUSE not TTYPAUSE or and { + //systemdict /DISPLAYING get //systemdict /NOPAUSE get not //systemdict /TTYPAUSE get or and { % Print a message (unless NOPAGEPROMPT or NOPROMPT is true) % and wait for the user to type something. % If the user just types a newline, flush it. - NOPAGEPROMPT NOPROMPT or { pop } { print flush } ifelse + //systemdict /NOPAGEPROMPT get //systemdict /NOPROMPT get or { pop } { print flush } ifelse //.confirmread exec } { pop @@ -711,7 +765,7 @@ odef % Code output by Adobe Illustrator relies on the fact that % `stack' is a procedure, not an operator!!! /stack { 0 1 count 3 sub { index = } for } bind def -/start { BATCH { //null 0 .quit } { executive } ifelse } def +/start { //systemdict /BATCH get { //null 0 .quit } { executive } ifelse } def /store { % Don't alter operands before completing. 1 .argindex where { 2 index 2 index put pop pop } { def } ifelse } odef @@ -941,7 +995,7 @@ currentdict /runlibfile0 .undef /.unstoppederrorhandler % .unstoppederrorhandler - { % This is the handler that gets used for recursive errors, % or errors outside the scope of a 'stopped'. - 2 copy SHORTERRORS + 2 copy //systemdict /SHORTERRORS get { (%%[ Error: ) print =only flush (; OffendingCommand: ) print =only ( ]%%) = } @@ -963,7 +1017,6 @@ currentdict /runlibfile0 .undef /.errorhandler % .errorhandler - { % Detect an internal 'stopped'. 1 .instopped { //null eq { pop pop stop } if } if - (I) //false .setdebug $error /.inerror get 1 .instopped { pop } { pop //true } ifelse { //.unstoppederrorhandler exec } if % detect error recursion @@ -1090,7 +1143,7 @@ currentdict /.unstoppederrorhandler .undef /.printerror { $error begin newerror { - /command load errorname SHORTERRORS + /command load errorname //systemdict /SHORTERRORS get { (%%[ Error: ) print =only flush (; OffendingCommand: ) print =only errorinfo dup //null eq { @@ -1409,8 +1462,8 @@ put % errordict /rangecheck /devicenames devicedict { pop } forall devicedict length packedarray def % Determine the default device. -/defaultdevice DISPLAYING - { systemdict /DEVICE .knownget +/defaultdevice //systemdict /DISPLAYING get + { //systemdict /DEVICE .knownget { devicedict 1 index known not { (Unknown device: ) print = flush /defaultdevice cvx 1 .quit @@ -1505,7 +1558,7 @@ setpacking % between 200 and 400 DPI, so we use it for lower resolutions. % Imagesetters need even higher frequency screens. //systemdict /DITHERPPI known - { DITHERPPI + { //systemdict /DITHERPPI get } { dup cvi 100 idiv 15 .min {//null 46 46 60 60 60 106 106 106 106 133 133 133 133 133 150} @@ -1546,7 +1599,7 @@ setpacking 4 -1 roll 150 ge { /setcolorscreen where { pop //systemdict /COLORSCREEN known - { COLORSCREEN } + { //systemdict /COLORSCREEN get} { 3 index } ifelse dup //false ne @@ -2162,6 +2215,43 @@ readonly def } if ] def +/.lockfileaccess { + .currentpathcontrolstate + { + //QUIET not + { + (\n **** WARNING: .lockfileaccess or .setsafe called ****\n) print + ( **** when file access controls are already active ****\n) print flush + } if + } + { + [ + //tempfilepaths (*) .generate_dir_list_templates + /FONTPATH .systemvar (*) .generate_dir_list_templates + /level2dict where { + pop + % Default resources : + [ currentsystemparams /GenericResourceDir get] (*) .generate_dir_list_templates + } if + /LIBPATH .systemvar (*) .generate_dir_list_templates + currentuserparams /ICCProfilesDir known { + [currentuserparams /ICCProfilesDir get] (*) + .generate_dir_list_templates + } if + ] {/PermitFileReading exch .addcontrolpath} forall + + [ + //tempfilepaths (*) .generate_dir_list_templates + ] {/PermitFileWriting exch .addcontrolpath} forall + + [ + //tempfilepaths (*) .generate_dir_list_templates + ] {/PermitFileControl exch .addcontrolpath} forall + + .activatepathcontrol + } ifelse +} bind def + /.locksafe_userparams { SAFETY /safe get not { << @@ -2219,15 +2309,24 @@ currentdict /tempfilepaths undef /.setsafe { - SAFETY /safe get not { - << - /PermitFileReading [ ] - /PermitFileWriting [ ] - /PermitFileControl [ ] - >> setuserparams + OLDSAFER { + SAFETY /safe get not { + << + /PermitFileReading [ ] + /PermitFileWriting [ ] + /PermitFileControl [ ] + >> setuserparams + } + if + .locksafe } - if - .locksafe + { + //.lockfileaccess exec + DELAYBIND not { + //systemdict /SAFERUndefinePostScriptOperators .knownget {exec} if + } if + } + ifelse } .bind executeonly odef %% --- End documented extensions --- @@ -2255,16 +2354,26 @@ currentdict /tempfilepaths undef % See /.locksafeglobal above. % /.setsafeglobal { - SAFETY /safe get not { - << - /PermitFileReading [ ] - /PermitFileWriting [ ] - /PermitFileControl [ ] - >> setuserparams + OLDSAFER + { + SAFETY /safe get not { + << + /PermitFileReading [ ] + /PermitFileWriting [ ] + /PermitFileControl [ ] + >> setuserparams + } + if + //.locksafeglobal exec } - if - //.locksafeglobal exec -} .bind def + { + //.lockfileaccess exec + DELAYBIND not { + //systemdict /SAFERUndefinePostScriptOperators .knownget {exec} if + } if + } + ifelse +} .bind executeonly odef % If we are running in SAFER mode, lock things down SAFER { .setsafeglobal } if @@ -2338,7 +2447,7 @@ SAFER { /.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 /.currentoutputdevice - /.type /.writecvs /.setSMask /.currentSMask /.needinput /.countexecstack /.execstack /.applypolicies + /.type /.writecvs /.setSMask /.currentSMask /.needinput /.countexecstack /.execstack /filterdict /.cidfonttypes /.colorrenderingtypes /.formtypes /.halftonetypes /.imagetypes /.imagemasktypes /.patterntypes /.shadingtypes /.wheredict /.renderingintentdict @@ -2435,15 +2544,6 @@ SAFER { //systemdict /UndefinePostScriptOperators .forceundef } .bind executeonly def % must be bound and hidden for .forceundef -% Undefine operators that are used by PDF internally. -% This list is maintained in pdf_main.ps -/UndefinePDFOperators { - .PDF_UNDEF_OPLIST - {//systemdict exch .forceundef} forall - //systemdict /.PDF_UNDEF_OPLIST .forceundef - //systemdict /UndefinePDFOperators .forceundef -} .bind def - % If we delayed binding, make it possible to do it later. /.bindnow { currentuserparams /IdiomRecognition .knownget { @@ -2456,21 +2556,24 @@ SAFER { 0 1 .delaycount 1 sub { .delaybind exch get .bind pop } for //systemdict /.delaybind {} .forceput % reclaim the space //systemdict /.bindnow .forceundef % ditto + .applyundefinternalnames put SAFER { //systemdict /SAFERUndefinePostScriptOperators get exec } if //systemdict /UndefinePostScriptOperators get exec - //systemdict /UndefinePDFOperators get exec //systemdict /.forcecopynew .forceundef % remove temptation //systemdict /.forceput .forceundef % ditto //systemdict /.undef .forceundef % ditto //systemdict /.bindoperators .forceundef //systemdict /.forceundef .forceundef % ditto + //systemdict /.undefinternalnames .forceundef + //systemdict /.applyundefinternalnames .forceundef + //systemdict /.undefinternalnameslist .forceundef currentuserparams /IdiomRecognition known { 1 dict dup /IdiomRecognition 4 -1 roll put setuserparams } if -} .bind odef +} .bind def % Turn off array packing, since some PostScript code assumes that % procedures are writable. @@ -2549,13 +2652,12 @@ DELAYBIND not { //systemdict /SAFERUndefinePostScriptOperators get exec } if //systemdict /UndefinePostScriptOperators get exec - //systemdict /UndefinePDFOperators .forceundef } if end % Clean up VM, and enable GC. Use .vmreclaim to force the GC. /vmreclaim where - { pop NOGC not { 2 .vmreclaim 0 vmreclaim } if + { pop //systemdict /NOGC get not { 2 .vmreclaim 0 vmreclaim } if } if systemdict /.vmreclaim .undef level2dict /.vmreclaim .undef @@ -2574,6 +2676,9 @@ DELAYBIND not { systemdict /.forcecopynew .undef % remove temptation systemdict /.forceput .undef % ditto systemdict /.forceundef .undef % ditto + systemdict /.undefinternalnames .undef + systemdict /.applyundefinternalnames .undef + systemdict /.undefinternalnameslist .undef } if % Can't remove this one until the last minute :-) diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps b/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps index 98d55fe7425..0fd4164650a 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps @@ -158,7 +158,7 @@ end { pop pop } ifelse - } forall + } executeonly forall % A context switch might have occurred during the above loop, % causing the interpreter-level parameters to be reset. % Set them again to the new values. From here on, we are safe, @@ -229,9 +229,9 @@ end { pop pop } ifelse - } + } executeonly forall pop -} .bind odef +} .bind executeonly odef % Initialize the passwords. % NOTE: the names StartJobPassword and SystemParamsPassword are known to @@ -1241,5 +1241,5 @@ end % level2dict /.setcolorrendering1 /.checkparamtype /.checksetparams -] -{level2dict exch .forceundef} forall +] dup level2dict .undefinternalnames +systemdict .undefinternalnames diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps b/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps index 359579f3e72..6caa93f8047 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps @@ -554,7 +554,7 @@ pssystemparams /MaxDisplayAndSourceList 160000 .forceput /.makehalftone7 /.sethalftone6 /.sethalftone10 /.sethalftone16 /.readbytestring /.bigstring ] -dup {currentdict exch .forceundef} forall -{systemdict exch .forceundef} forall +dup currentdict .undefinternalnames +systemdict .undefinternalnames end % ll3dict diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps b/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps index 00c19faf3c4..422e66e1a6c 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps @@ -282,6 +282,12 @@ languagelevel 2 .setlanguagelevel % The ps2pdf* scripts invoke this. /.setpdfwrite { % - .setpdfwrite - % Set a large VM threshold to reduce garbage collection. + (\n**** WARNING: The .setpdfwrite operator has been deprecated and will be removed entirely\n) print + ( in the next release of Ghostscript. The functionality of this operator has\n) print + ( been reduced to increasing the size of the VM threshold. If you believe you\n) print + ( have a real need for this then you should replace your call to .setpdfwrite\n) print + ( with:\n\n) print + ( 3000000 setvmthreshold\n\n) print currentuserparams /VMThreshold get 3000000 .max setvmthreshold } bind def @@ -652,11 +658,11 @@ currentdict /.pdfmarkparams .undef systemdict /.pdf_hooked_DSC_Creator //true .forceput } executeonly if pop - } if + } executeonly if } { pop } ifelse - } + } executeonly { pop } ifelse diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_res.ps b/Master/tlpkg/tlgs/Resource/Init/gs_res.ps index 0f8cb8f6cd1..068514bf21f 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_res.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_res.ps @@ -240,10 +240,10 @@ def % Stack: