hrp@BORING.CRAY.COM (Hal Peterson) (10/13/89)
I am using Ghostscript 1.4 on Sun-3/280s and Sun-3/50s under SunOS 3.5 and X11R4alpha, compiled with GCC 1.36, and I've improved the library handling by modifying the supporting code for "run" to use LIB as a string to use as a directory name or an array of strings to use as directory names. It always first checks the current directory. Strings in LIB must end with the directory delimiter, "/" on UNIX. Now I can put this line at the beginning of ghost.ps: /LIB [ (/usr/contrib/lib/ghostscript) (/usr/local/lib/ps) ] def and (a) I can start Ghostscript without being in the directory with ghost.ps and (b) whenever I do a "run" it will search my system PostScript libraries. LIB existed in 1.4 as distributed, but it was either a string---a single directory name---or nonexistent; and it had to be in systemdict. To use this, replace .findfile in ghost.ps with the following three functions. I welcome suggestions for improving the style or substance of this stuff (I don't like the indention, but it's consistent with the rest of ghost.ps). /.findafile % helper for .findfile, % name -> file true OR name false {{(r) file} stopped {pop false} {true} ifelse} bind def /.findcfile % helper for .findfile, % name directory -> file true OR name false {exch dup 3 1 roll concatstrings .findafile {exch pop true} {pop false} ifelse} bind def /.findfile % find file for run, % name -> file true or name false {.findafile {true} {/LIB where {/LIB get dup type dup /stringtype eq {pop .findcfile} {/arraytype eq {{{.findcfile {stop} if} forall} stopped} {pop false} ifelse} ifelse} {false} ifelse} ifelse} bind def -- Hal Peterson Domain: hrp@cray.com Cray Research Old style: hrp%cray.com@uc.msc.umn.edu 1440 Northland Dr. UUCP: uunet!cray!hrp Mendota Hts, MN 55120 USA Telephone: +1 612 681 3145