% Copyright (C) 2001-2018 Artifex Software, Inc. % 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. % % Refer to licensing information at http://www.artifex.com or contact % Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, % CA 94945, U.S.A., +1(415)492-9861, for further information. % % Initialization file for %disk device modifications % When this is run, systemdict is still writable, systemdict begin % Collect the list of searchable IODevices in SearchOrder % Efficiency here doesn't matter since we run this at the end % of gs_init and convert it to a static array. /.getsearchabledevs { % - .getsearchabledevs [ list_of_strings ] //systemdict /.searchabledevs .knownget not { .currentglobal //true .setglobal mark (*) { dup length string copy dup currentdevparams /Searchable .knownget { not { pop } if } { pop } ifelse } 8192 string /IODevice resourceforall ] % now process the array into correct SearchOrder 0 1 2 { mark exch 2 index { dup currentdevparams /SearchOrder get 2 index eq { exch } { pop } ifelse } forall % devices on the old list pop % make the array and sort it by name ] { lt } bind .sort exch } for % collect all devices with SearchOrder > 2 mark 2 index { dup currentdevparams /SearchOrder get 2 gt { exch } { pop } ifelse } forall ] exch pop % We now have 4 arrays on the stack, SO=0 SO=1 SO=2 SO>2 % make them into a single array mark 5 1 roll ] mark exch { { } forall } forall ] //systemdict /.searchabledevs 2 index .forceput exch .setglobal } executeonly if } .bind executeonly odef % must be bound and hidden for .forceput % Modify .putdevparams to force regeneration of .searchabledevs list /.putdevparams { % We could be smarter and check for %disk* device, but this % doesn't get run enough to justify the complication //.putdevparams //systemdict /.searchabledevs .forceundef } .bind executeonly odef % must be bound and hidden for .forceundef % ------ extend filenameforall to handle wildcards in %dev% part of pattern -------% /filenameforall { count 3 ge { 2 index (%) search { pop pop } { % no device specified, so search them all pop (*%) 3 index concatstrings % we need to suppress the device when we return the string % in order to match Adobe's behaviour with %disk devices. 4 -2 roll % the callers procedure [ { (%) search { pop pop (%) search { pop pop } if } if } /exec load 4 -1 roll % the callers procedure /exec load ] cvx 4 2 roll % put the modified procedure where it belongs } ifelse % extract device portion (up to end of string or next %) (%) search { exch pop } if % stack: opat proc scratch npat device dup (*) search { pop pop pop //true } { pop //false } ifelse 1 index (?) search { pop pop pop //true } { pop //false } ifelse or not { pop pop //filenameforall % device with no wildcard } { (%) concatstrings (%) exch concatstrings .getsearchabledevs % find all matching devices and add the rest of the search string mark exch { dup counttomark 1 add index .stringmatch { counttomark 2 add index concatstrings } { pop } ifelse } forall ] 3 1 roll pop pop 4 -1 roll pop % now we need to invoke filenameforall for each of the strings % in the array. We do this by building a procedure that is like % an unrolled 'forall' loop. We do this to get the parameters % for each filenameforall, since each execution will pop its % parameters, but we can't use the operand stack for storage % since each invocation must have the same operand stack. mark exch { counttomark dup 3 add index exch 2 add index /filenameforall load } forall ] cvx 3 1 roll pop pop exec % run our unrolled loop } ifelse } { //filenameforall % not enough parameters -- just let it fail } ifelse } odef % redefine file to search all devices in order /file { dup 0 get (r) 0 get eq dup { pop //false % success code 2 index 0 get 37 eq { [ () ] } { .getsearchabledevs } ifelse { 3 index concatstrings % prepend the device { 2 index //file } .internalstopped not { 4 1 roll pop pop pop //true exit % exit with success } { pop pop } ifelse } forall } if not { % just let standard file operator handle things //file } if } bind odef % redefine deletefile to search all devices in order /deletefile { //false % success code 1 index 0 get 37 eq { [ () ] } { .getsearchabledevs } ifelse { 2 index concatstrings % prepend the device { //deletefile } .internalstopped exch pop not { pop //true exit % exit with success } if } forall not { $error /errorname get /deletefile .systemvar exch signalerror } if } bind odef % redefine status to search all devices in order /status { dup type /stringtype eq { //false % success code 1 index 0 get 37 eq { [ () ] } { .getsearchabledevs } ifelse { 2 index concatstrings % prepend the device { //status } .internalstopped not { { //true 7 -2 roll pop pop //true exit } % exit with success if } if } forall % If we made it this far, no devices were found to status the file % clean up to return 'false' exch pop } { //status } ifelse } bind odef % Also redefine renamefile to search all devices in order /renamefile { //false % success code 2 index 0 get 37 eq { [ () ] } { .getsearchabledevs } ifelse { dup 4 index concatstrings % prepend the device { (r) //file } .internalstopped not { closefile exch pop //true exit % exit with success } { pop pop } ifelse } forall not { $error /errorname get /renamefile .systemvar exch signalerror } if 3 -1 roll concatstrings exch //renamefile } bind odef % redefine devforall to process devices in numeric order % Spec's for 'devforall' are unclear, but font downloaders may expect this /devforall { % <proc> <scratch> devforall - [ { dup length string copy } 2 index //devforall ] % stack: proc scratch array_of_device_names { lt } .sort % We don't really invoke the procedure with the scratch string % but rather with the strings from our array exch pop exch forall } odef end % systemdict
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
FAPIcidfmap | File | 1.45 KB | 0644 |
|
FAPIconfig | File | 815 B | 0644 |
|
FAPIfontmap | File | 1.43 KB | 0644 |
|
FCOfontmap-PCLPS2 | File | 2.79 KB | 0644 |
|
Fontmap | File | 109 B | 0644 |
|
Fontmap.GS | File | 11.79 KB | 0644 |
|
cidfmap | File | 2.11 KB | 0644 |
|
gs_agl.ps | File | 212.91 KB | 0644 |
|
gs_btokn.ps | File | 11.9 KB | 0644 |
|
gs_cet.ps | File | 3.4 KB | 0644 |
|
gs_cff.ps | File | 6.71 KB | 0644 |
|
gs_cidcm.ps | File | 16.43 KB | 0644 |
|
gs_ciddc.ps | File | 8.31 KB | 0644 |
|
gs_cidfm.ps | File | 7.14 KB | 0644 |
|
gs_cidfn.ps | File | 13.22 KB | 0644 |
|
gs_cidtt.ps | File | 5.7 KB | 0644 |
|
gs_cmap.ps | File | 17.94 KB | 0644 |
|
gs_cspace.ps | File | 5.84 KB | 0644 |
|
gs_dbt_e.ps | File | 2.08 KB | 0644 |
|
gs_diskn.ps | File | 6.68 KB | 0644 |
|
gs_dpnxt.ps | File | 4.74 KB | 0644 |
|
gs_dps.ps | File | 8.15 KB | 0644 |
|
gs_dps1.ps | File | 4.57 KB | 0644 |
|
gs_dps2.ps | File | 8.28 KB | 0644 |
|
gs_dscp.ps | File | 3.85 KB | 0644 |
|
gs_epsf.ps | File | 8.62 KB | 0644 |
|
gs_fapi.ps | File | 15.13 KB | 0644 |
|
gs_fntem.ps | File | 11.04 KB | 0644 |
|
gs_fonts.ps | File | 44.83 KB | 0644 |
|
gs_frsd.ps | File | 3.07 KB | 0644 |
|
gs_icc.ps | File | 2.99 KB | 0644 |
|
gs_il1_e.ps | File | 2.66 KB | 0644 |
|
gs_img.ps | File | 24.28 KB | 0644 |
|
gs_init.ps | File | 89.73 KB | 0644 |
|
gs_l2img.ps | File | 5.74 KB | 0644 |
|
gs_lev2.ps | File | 43.65 KB | 0644 |
|
gs_ll3.ps | File | 18.51 KB | 0644 |
|
gs_mex_e.ps | File | 3.75 KB | 0644 |
|
gs_mgl_e.ps | File | 2.13 KB | 0644 |
|
gs_mro_e.ps | File | 2.45 KB | 0644 |
|
gs_pdf_e.ps | File | 1.52 KB | 0644 |
|
gs_pdfwr.ps | File | 31.68 KB | 0644 |
|
gs_res.ps | File | 40.08 KB | 0644 |
|
gs_resmp.ps | File | 21.94 KB | 0644 |
|
gs_setpd.ps | File | 38.25 KB | 0644 |
|
gs_statd.ps | File | 13.6 KB | 0644 |
|
gs_std_e.ps | File | 3.07 KB | 0644 |
|
gs_sym_e.ps | File | 3.03 KB | 0644 |
|
gs_trap.ps | File | 2.85 KB | 0644 |
|
gs_ttf.ps | File | 61.82 KB | 0644 |
|
gs_typ32.ps | File | 4.45 KB | 0644 |
|
gs_typ42.ps | File | 1.98 KB | 0644 |
|
gs_type1.ps | File | 12.12 KB | 0644 |
|
gs_wan_e.ps | File | 1.53 KB | 0644 |
|
pdf_base.ps | File | 50.68 KB | 0644 |
|
pdf_draw.ps | File | 166.95 KB | 0644 |
|
pdf_font.ps | File | 88.77 KB | 0644 |
|
pdf_main.ps | File | 120.23 KB | 0644 |
|
pdf_ops.ps | File | 71.77 KB | 0644 |
|
pdf_rbld.ps | File | 18.96 KB | 0644 |
|
pdf_sec.ps | File | 24.15 KB | 0644 |
|
xlatmap | File | 1.73 KB | 0644 |
|