Bug 690289 - add warning if GenericResourceDir is missing
Summary: add warning if GenericResourceDir is missing
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Interpreter (show other bugs)
Version: master
Hardware: Macintosh MacOS X
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-13 14:42 UTC by Henry Stiles
Modified: 2009-02-20 11:16 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
patch (659 bytes, patch)
2009-02-17 21:19 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Stiles 2009-02-13 14:42:03 UTC
We'd (Ray, Ralph and Henry) like to add an error message if the
GenericResourceDir does not exist.  This caused all sorts of problems for me,
that naively thought if the system could find fonts in Resource/Fonts it should
also find Resource/Decoding and other resources.  If the resource directory does
not exist it will find the fonts but no other resources like encoding or
decoding.  This results in a mysterious undefinedresource in the findfont operator.
Comment 1 Alex Cherepanov 2009-02-17 21:19:34 UTC
Created attachment 4800 [details]
patch

Check that gs_init.ps can be found at
$(GenericResourceDir)/Init/gs_init.ps
Issue a warning if this file cannot be found.

The execution is not terminated because the initial value of GenericResourceDir

may be wrong but corrected later by setsystemparams operator.

I cannot het the status of $(GenericResourceDir) because it doesn't exist on
the fl;at file system such as %rom% .

Concatenation of multiple strings can be done more efficiently than calling
concatstrings repeatedly. I'm not sure whether it's worth the trouble.
Here's a procedure that concatenates N strings.

/concatNstrings {  % (a) (b) ... (z) N --> (ab...z) 
  dup 1 add copy
  0 exch { exch length add } repeat
  dup string		% (a) (b) ... (z) N len (____) 
  3 -1 roll		% (a) (b) ... (z) len (____) N
  {  dup		% (a) (b) ... (z) len (____) (____)
     4 2 roll		% (a) (b) ... (____) (____) (z) len
     1 index length sub % (a) (b) ... (____) (____) (z) len-zlen
     dup		% (a) (b) ... (____) (____) (z) len-zlen len-zlen
     5 1 roll		% (a) (b) ... len-zlen (____) (____) (z) len-zlen
     exch putinterval	% (a) (b) ... len-zlen (___z) 
  } repeat
  exch pop
} bind def
Comment 2 Ray Johnston 2009-02-19 08:32:10 UTC
The approach in the patch is OK, but I think the message could be more
helpful:

(\n*** Warning: GenericResourceDir doesn't point to a valid resource directory.
***) =
(             the -sGenericResourceDir=... option can be used to set this.\n) =

I'll let Alex decide whether to accept this suggestion or not, but I think we
might as well give a hint to users as to how to fix the problem. If the explicit
message about -sGenericResourceDir= is not desired, then just referring the
user to doc/Use.htm#Resource_related_parameters would be OK as well.
Comment 3 Alex Cherepanov 2009-02-20 11:16:14 UTC
A modified patch that includes a hint about -sGenericResourceDir= has been
committed as a rev. 9495.

Regression testing shows no differences.