% Copyright (C) 2000 artofcode LLC. All rights reserved. % % This software is provided AS-IS with no warranty, either express or % implied. % % This software is distributed under license and may not be copied, % modified or distributed except as expressly authorized under the terms % of the license contained in the file LICENSE in this distribution. % % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. % $Id: gs_resst.ps,v 1.3 2003/08/08 18:45:05 ray Exp $ % Redefine generic category with static resource table. languagelevel 2 .setlanguagelevel 15 dict begin % a temporary dictionary for local binding. /sep (/) def % The %static% device uses platform independent paths. /tempstring 8192 string def /IsMyRecord % IsMyRecord bool { dup type /dicttype eq { dup /StaticFilePos known } { false } ifelse } bind def /append_string % append_string { dup length 3 index 3 index 2 index getinterval % (scratch) index (string) l (scr_substr) 3 2 roll exch copy pop add % (scratch) index' } bind def /StaticResourceRecordVirtualMethods 4 dict begin /GetFilePath % GetFilePath { pop exch % /Name (scratch) (%static%) dup length exch 2 index copy pop % /Name (scratch) l //sep //append_string exec % /Name (scratch) l Category //tempstring cvs //append_string exec % /Name (scratch) l //sep //append_string exec % /Name (scratch) l 3 2 roll //tempstring cvs % (scratch) l (Name) //append_string exec % (scratch) l 0 exch getinterval % (path) } bind def /MakeInstance % MakeInstance { begin STRESDEBUG { (Loading a static resource ) print dup = } if 8192 string 2 index 2 index //GetFilePath exec (r) file run STRESDEBUG { (Completed loading the static resource ) print dup = } if StaticFileEnd StaticFilePos sub end 1 index Category findresource exch } bind def /GetSize % GetSize { % WARNING : this retrives file sise rather than VM size begin pop StaticFileEnd StaticFilePos sub end } bind def /IsActive % IsActive { pop true } bind def currentdict end def mark /MappedCategoryRedefiner /ProcSet findresource begin /.StaticResourcesBeg % .StaticResourcesBeg % Puts .map dictionary to dstack. { STRESDEBUG { (Starting static resources for category ) print dup = } if dup /Category resourcestatus { pop pop exch dict begin exch pop } { STRESDEBUG { (Skipping the resources because the category isn't defined.) = } if pop pop .skipeof } ifelse } bind /.StaticResourcesEnd % .StaticResourcesEnd - % Removes .map dictionary from dstack. { STRESDEBUG { (Completting static resources for category ) print dup = } if currentdict end dup % /CatName systemdict /.io_static_root .knownget not { 10 dict % /CatName % Save it for garbager and for debug purpose : dup systemdict exch /.io_static_root exch put % /CatName dup .setup_io_static % /CatName } if % /CatName exch 3 index exch put % /CatName 14 dict begin /.map exch def % /CatName /CategoryName exch def % /IsMapFileOptional true def /VerifyMap { pop } bind def /PreprocessRecord % PreprocessRecord { //IsMyRecord exec dup { pop dup /RecordVirtualMethods //StaticResourceRecordVirtualMethods put true } if } bind def currentdict end //Redefine exec } bind end % MappedCategoryRedefiner end % the temporary dictionary for local binding. /.BeginResource % BeginResource % Puts a record dictionary to dstack. { STRESDEBUG { (Static resource ) print dup =string cvs print } if currentfile fileposition currentfile =string readline pop dup length 0 exch 10 .min getinterval (%% Replace) ne { % We are in COMPILE_INITS=1 . 4 dict begin /StaticFilePos exch def } { % We are in COMPILE_INITS=0 . pop } ifelse (%END_RESOURCE) .skipeof } bind /.EndResource % EndResource - % Removes a record dictionary from dstack. { currentdict /StaticFilePos known { /StaticFileEnd currentfile fileposition (.EndResource) length sub def STRESDEBUG { ( from position ) print StaticFilePos =string cvs print ( to position ) print StaticFileEnd = } if currentdict end def } { pop STRESDEBUG { ( ignored with COMPILE_INITS=0. ) = } if } ifelse } bind .dicttomark /StaticCategoryRedefiner exch /ProcSet defineresource pop .setlanguagelevel