[gs-cvs] rev 7487 - trunk/gs/lib

stefan at ghostscript.com stefan at ghostscript.com
Sun Dec 10 12:25:51 PST 2006


Author: stefan
Date: 2006-12-10 12:25:51 -0800 (Sun, 10 Dec 2006)
New Revision: 7487

Modified:
   trunk/gs/lib/gs_cidcm.ps
   trunk/gs/lib/gs_res.ps
   trunk/gs/lib/gs_resmp.ps
Log:
This is a reversion to r7448
The 7449 commit created a regression where the 
language switch build wouldn't initialize. 


Modified: trunk/gs/lib/gs_cidcm.ps
===================================================================
--- trunk/gs/lib/gs_cidcm.ps	2006-12-10 19:50:24 UTC (rev 7486)
+++ trunk/gs/lib/gs_cidcm.ps	2006-12-10 20:25:51 UTC (rev 7487)
@@ -355,28 +355,19 @@
   } ifelse
 } bind def
 
-% Define a local-VM equivalent of ].  It should be called
-% .localvmarraytomark, but we're going to be using it a lot....
-/.la2mark {
-    counttomark .localvmarray astore exch pop
-} bind def
-
 /ResourceForAll { % <template> <proc> <scratch> ResourceForAll - 
 
   % We suppose that the resourceforall procedure does not 
   % define or install new fonts, CMaps, and/or CIDFonts.
 
-  % Note that all temporary objects that might reference fonts, CMaps,
-  % or CIDFonts must be created in local VM, since these objects might be
-  % in local VM themselves.
-
   % First we create 3 temporary dictionaries to store temporary data
   % about fonts, CMaps and CIDFonts.
   % These dictionaries must be created dynamically, to allow for a possible 
   % recursive call to resourceforall from the resourceforall procedure.
+  currentglobal false setglobal
+  20 dict 20 dict 20 dict
 
-  20 .localvmdict 20 .localvmdict 20 .localvmdict
-			% (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
+  4 -1 roll setglobal                     % (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
 
   % Store resource identifiers into local dictionaries
   % A resource instance can have a key that is not a name or a string. In this
@@ -389,15 +380,13 @@
 
   { /.DisableResourceOrdering pop % gs_resmp accesses this through execstack - don't remove !
 
-    5 index [
-	2 index {exch //null put} aload pop
-    .la2mark cvx bind 5 index //ResourceForAll exec
+    5 index [ 2 index {exch //null put} aload pop ] cvx bind 5 index //ResourceForAll exec
 
     (*) [ 3 index {exch dup type /stringtype eq { cvn dup put } { pop pop } ifelse } aload pop
-        .la2mark cvx bind 5 index /CMap resourceforall
+        ] cvx bind 5 index /CMap resourceforall
 
     (*) [ 4 index {exch dup type /stringtype eq { cvn dup put } { pop pop } ifelse } aload pop
-        .la2mark cvx bind 5 index /CIDFont resourceforall
+        ] cvx bind 5 index /CIDFont resourceforall
 
     exit
   } loop % This loop is a pattern for execstack_lookup - don't remove !

Modified: trunk/gs/lib/gs_res.ps
===================================================================
--- trunk/gs/lib/gs_res.ps	2006-12-10 19:50:24 UTC (rev 7486)
+++ trunk/gs/lib/gs_res.ps	2006-12-10 20:25:51 UTC (rev 7487)
@@ -336,6 +336,12 @@
  { 3 -1 roll //.rfnstring cvs concatstrings exch copy
  } bind def
 
+% Define a procedure for making a packed array in local VM.
+/.localpackedarray {	% <obj1> ... <objn> <n> .localpackedarray <packedarray>
+  .currentglobal false .setglobal 1 index 2 add 1 roll
+  packedarray exch .setglobal
+} bind def
+
 % Define the Generic category.
 
 /Generic mark
@@ -472,19 +478,19 @@
 		% Construct a new procedure to hold the arguments.
 		% All objects constructed here must be in local VM to avoid
 		% a possible invalidaccess.
-	currentdict 4 .localvmpackedarray	% [template proc scratch resdict]
+	currentdict 4 .localpackedarray	% [template proc scratch resdict]
 		% We must pop the resource dictionary off the dict stack
 		% when doing the actual iteration, and restore it afterwards.
 	.currentglobal not {
 	  .LocalInstances length 0 ne {
 		% We must do local instances, and do them first.
-	    //.localresourceforall {exec} 0 get 3 .localvmpackedarray cvx
+	    //.localresourceforall {exec} 0 get 3 .localpackedarray cvx
 	    .LocalInstances exch {forall} 0 get 1 index 0 get
 	    currentdict end 3 .execn begin
 	  } if
 	} if
 		% Do global instances next.
-	//.globalresourceforall {exec} 0 get 3 .localvmpackedarray cvx
+	//.globalresourceforall {exec} 0 get 3 .localpackedarray cvx
 	.Instances exch cvx {forall} 0 get 1 index 0 get
 	currentdict end 3 .execn begin
         mark                                             % args [
@@ -492,7 +498,7 @@
         2 index 0 get                                    % args [ (c/) (t)
         dup length 3 1 roll                              % args [ l (c/) (t)
         concatstrings                                    % args [ l (c/t)
-	[
+	[ 
 	  true /LIBPATH .systemvar 3 index
 	  .generate_dir_list_templates_with_length       % args (t) [ l [(pt) Lp ...]
 	    % also add on the Resources as specified by the GenericResourceDir
@@ -502,8 +508,7 @@
           true [ currentsystemparams /GenericResourceDir get]
 	  counttomark 1 add index .file_name_separator (*)
           concatstrings concatstrings .generate_dir_list_templates_with_length
-        % Do the equivalent of .localvm].
-        counttomark .localvmarray astore exch pop exch pop
+	  ] exch pop
 	dup length 1 sub 0 exch 2 exch {                 % args [ l [] i
 	  2 copy get                                     % args [ l [] i (pt)
 	  exch 2 index exch 1 add get                    % args [ l [] (pt) Lp
@@ -519,17 +524,13 @@
 	  pop                                            % args [ /n1 /n1 ... /nN /nN l []
 	} for                                            % args [ /n1 /n1 ... /nN /nN l []
 	pop pop
-	% Do the equivalent of .localvmdicttomark.
-	counttomark 2 idiv .localvmdict
-	dup maxlength {
-	    dup 4 -2 roll put
-	} repeat exch pop % An easy way to exclude duplicates. % args <</n/n>>
+	.dicttomark % An easy way to exclude duplicates. % args <</n/n>>
 	  % {
 	  { pop } 0 get
           2 index 2 get { cvs 0 } aload pop 5 index
           //.externalresourceforall {exec} 0 get
           % }
-        7 .localvmpackedarray cvx
+        7 .localpackedarray cvx
         3 2 roll pop % args
 	{ forall } 0 get
   	currentdict end 2 .execn begin
@@ -1011,35 +1012,18 @@
   /.origfindfont /findfont load def
 end
 /definefont {
-  { 1 index pop    % Unlike other operators, check the stack depth first.
-    dup /CIDFontType known { /CIDFont } { /Font } ifelse
-    defineresource
-  } stopped {
-    /definefont cvx $error /errorname get signalerror
+  { /Font defineresource } stopped {
+      /definefont cvx $error /errorname get signalerror
   } if
 } bind odef
 /undefinefont {
-  { dup /Font resourcestatus {
-       pop pop /Font
-    } {
-       dup /CIDFont resourcestatus { pop pop /CIDFont } { /Font } ifelse
-    } ifelse
-    undefineresource
-  } stopped {
-    /undefinefont $error /errorname get signalerror
-  } if
+  /Font undefineresource
 } bind odef
 % The Red Book requires that findfont be a procedure, not an operator,
 % but it still needs to restore the stacks reliably if it fails.
 /.findfontop {
-  { dup /Font resourcestatus {
-      pop pop /Font
-    } {
-      dup /CIDFont resourcestatus { pop pop /CIDFont } { /Font } ifelse
-    } ifelse
-    findresource
-  } stopped {
-    /findfont $error /errorname get signalerror
+  { /Font findresource } stopped {
+    pop /findfont $error /errorname get signalerror
   } if
 } bind odef
 /findfont {

Modified: trunk/gs/lib/gs_resmp.ps
===================================================================
--- trunk/gs/lib/gs_resmp.ps	2006-12-10 19:50:24 UTC (rev 7486)
+++ trunk/gs/lib/gs_resmp.ps	2006-12-10 20:25:51 UTC (rev 7487)
@@ -44,11 +44,6 @@
 languagelevel 2 .setlanguagelevel
 currentglobal true setglobal
 
-% See BindWithCurrentdict for the explanation of .bwcdarray.
-% We can't use /array load, because we don't want this to be bound,
-% and we can't make it executable, because bind would make it readonly.
-/.bwcdarray [/array load] def
-
 /MappedCategoryRedefiner 10 dict begin % The procset.
 
 currentpacking false setpacking
@@ -102,13 +97,8 @@
   %            bound recursively.
   % Caution2 : this code don't bind packedarrays. This was done
   %            intentionally for a termination of the procedure tree.
-  % Note that we must create the copy in local VM, because some of the
-  % values in currentdict might be in local VM.  However, during
-  % initialization we must create the copy in current (global) VM.
-  % We handle this by changing the definition of .bwcdarray after
-  % initialization.
 
-  dup length //.bwcdarray cvx exec copy
+  dup length array copy
   dup length 1 sub -1 0 {                      
     2 copy get                            % {precopy} i {elem}
     dup dup type /arraytype eq exch xcheck and {
@@ -144,11 +134,9 @@
   % To work around this, we create a copy of the enumeration procedure and
   % bind it dynamically with a temporary dictionary, which contains
   % local variables for the currently executing instance of resourceforall.
-  % Note that this dictionary must be in local VM, since some of its
-  % values may be in local VM.
 
   currentdict                    % Category
-  6 .localvmdict begin % the temporary dictionary
+  6 dict begin % the temporary dictionary
     /Category exch def           %
     /InstancesStatus exch def
     /scr exch def
@@ -394,7 +382,7 @@
 
 /Redefine     % <OptionsDict> Redefine -
 { % Before calling this proc, the OptionsDict must specify options for
-  % the category to be redefined :
+  % the catregory to be redefined :
   % CategoryName - a name of category to redefine;
   % MapFileName - a string for the resource map file name;
   % VerifyMap - a procedure :
@@ -429,6 +417,7 @@
   % the scanning until all redefinitions are done, but it requires
   % to implement a queue of "refinish" methods and execute it
   % at very end of the prelude.
+
   begin % OptionsDict
   CategoryName /Category findresource /OldCategory exch def
   OldCategory /.IsRedefinedWithMap known {
@@ -514,8 +503,6 @@
     //MethodsToRedefine {
       //BindWithCurrentdict exec NewCategory 3 1 roll put  
     } forall
-    % Switch BindWithCurrentdict to local VM for actual use.
-    //.bwcdarray 0 /.localvmarray load put
     CategoryName /CIDFont ne {
       NewCategory /GetCIDSystemInfoFromMap undef
       % This is some ugly, sorry.



More information about the gs-cvs mailing list