summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_init.ps')
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_init.ps199
1 files changed, 152 insertions, 47 deletions
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] <<dict from which to undef>> .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 { % <device> <y> <string> copyscanlines <substr>
@@ -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 % <command> <errorname> .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 % <command> <errorname> .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 :-)