Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1767

How to pass parameter in resource files?

From Wolfgang Büchel <wolfgang.buechel@gmx.de>
Newsgroups comp.lang.postscript
Subject How to pass parameter in resource files?
Date 2014-01-05 11:18 +0100
Organization gvp
Message-ID <op.w87llwynhytalj@zenon.fritz.box> (permalink)

Show all headers | View raw


I have some postscript resource files for drawing objects (flags) in any  
postscript file
(inspired by Terry Burton's postscriptbarcode,  
https://code.google.com/p/postscriptbarcode/).

The files for drawing the flags are in subfolder Flags (without extension  
.ps), together with some helper files, especially sethexcolor, defining a  
function sethexcolor, to set RGB color from a hexstring.

I have a file sample.ps above the subfolder Flags with code:

     100 600 moveto
     100 /square /Flags findresource exec   % draw a square of size 100
     showpage

File square has code:

     1 dict
     dup /sethexcolor dup /Flags findresource put
     begin
     /square {
         /size exch def
         currentpoint translate
         /red (ff0000) def
         red sethexcolor
         % 1 0 0 setrgbcolor
     } bind def
     /square dup load /Flags defineresource pop
     end

I'm working in Windows 7 with ghostscript 9.10, ghostview 5.0. Ghostscript  
is called with command line parameter -P to search files in current folder  
first. (Search path can be seen with gswin32c [-P] -h in command shell).  
Normally this works fine (e.g. with postscriptbarcode, see above).

But here it doesn't work: Starting sample.ps, I get an error message:

     Error: /undefined in sethexcolor
     Operand stack:
        (ff0000)

(After setting RGB color with 1 0 0 setrgbcolor, it works.)

If I change red sethexcolor to red /sethexcolor or //sethexcolor, there's  
no error message, and a square is drawn - but in black, not in red.

What's wrong with this postscript code?

Wolfgang

Back to comp.lang.postscript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How to pass parameter in resource files? Wolfgang Büchel <wolfgang.buechel@gmx.de> - 2014-01-05 11:18 +0100
  Re: How to pass parameter in resource files? luser- -droog <mijoryx@yahoo.com> - 2014-01-05 03:55 -0800

csiph-web