[comp.sys.next] postscript question

rdd@wuphys.wustl.edu (Rakhal D. Dave) (05/17/91)

In my thesis I am including 100s of small feynman like diagrams which I
generate first using YAP and then include in my TeX thesis using the 
epsf macro. The postscript files I generate are ofcourse in EPS format. 
The point is that I have written a large postscript macro of definitions
like a prologue which i have to include in every eps file defining a given
diagram. This is fine but is not efficient on memory since the macro is
repeated in each of the 100s of diagram files. What I am looking for is
some way to include material in a postscript file in a similar fashion as
the \input command in TeX so that the macro has not to be repeated every
time. Any suggestions. Rakhal.

dwatola@NEXTASY2.EECS.WSU.EDU (David Watola) (06/12/91)

here's one for the postscript gurus:

the fall 1990 next software and peripherals catalog, page 229, shows
that displaytalk has a dictionary stack browser.  the browser column on the 
right shows the dictionary stack with a list of dictionaries...

is there an easy way of doing this?  how is it possible to find the names
of all the dictionaries on the dictionary stack.  i can think of one way, but
it is such a horrible brute force method that i wouldn't dare code it.
i have looked through the adobe red (well, orange and white) book to no avail.
have i missed something simple?

i know that there is sufficient postscript expertise on comp.sys.next
to answer this one...  but if not, i'll toss it over to comp.lang.postscript.

dave watola
dwatola@nextasy2.eecs.wsu.edu
dwatola@yoda.eecs.wsu.edu
 

glenn@heaven.woodside.ca.us (Glenn Reid) (06/13/91)

David Watola writes
> 
> 
> here's one for the postscript gurus:
> 
> the fall 1990 next software and peripherals catalog, page 229, shows
> that displaytalk has a dictionary stack browser.  the browser column on the 
> right shows the dictionary stack with a list of dictionaries...
> 
> is there an easy way of doing this?  how is it possible to find the names
> of all the dictionaries on the dictionary stack.  i can think of one way, but
> it is such a horrible brute force method that i wouldn't dare code it.
> i have looked through the adobe red (well, orange and white) book to no  
avail.
> have i missed something simple?

No, you haven't missed anything.  The only way to get the "name" of a
dictionary on the dictionary stack is to use brute force, and that might
not even work.  A dictionary doesn't have to have a name in order to be
on the dictionary stack, and for that matter, it can have any number of
names, because a "name" in this sense is just another dictionary entry
that has a dictionary as its value.

Consider the following bits of code, all of which will confound attempts
to list the "names" of dictionaries on the dictstack:

% example one
100 dict begin

% example two
/name1 40 dict def  /name2 name1 def  /name3 name1 def
name1 begin

% example three
20 dict dup { 10 pop } exch def begin

I don't know what DisplayTalk does if it can't find the name, but it
probably gets lucky most of the time, because people most often give
names to dictionaries.

The only way to find these names is to do a "forall" on all of the
dictionaries you can find and compare the values to the dictionary
that you're interested in.  Brute force, to say the least, and if you
try to recursively examine other dictionaries you find during your
"forall", you run the risk of getting into an infinite loop.

But it sure is handy when it does tell you something :-)

--
 Glenn Reid				RightBrain Software
 glenn@heaven.woodside.ca.us		NeXT/PostScript developers
 ..{adobe,next}!heaven!glenn		415-326-2974 (NeXTfax 326-2977)