🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #8567

PostScript question (help needed)

#8567
From: Vidiot
Date: Fri, 15 Dec 1989 21:10
109 lines
3931 bytes
I have the three PostScript books, but that still doesn't help me in figuring
out why this works.

As I understand the books, when one opens up a dictionary and starts putting
things in it, the current dictionary is pushed down on the dictionary stack.
All good and dandy.  But, when an end is done, the current dictionary that
was being used is popped from the dictionary stack and its information is lost
forever.  Well, it seems like forever is not true.  I will use as an example
the Adobe prolog for psdit:  (portions thereof)


%!PS-Adobe-1.0
%%Creator: tester
%%Title: stdin (ditroff)
%%CreationDate: Fri Dec 15 13:46:27 1989
%%EndComments
% Start of psdit.pro -- prolog for ditroff translator
% Copyright (c) 1985,1987 Adobe Systems Incorporated. All Rights Reserved. 
% GOVERNMENT END USERS: See Notice file in TranScript library directory
% -- probably /usr/lib/ps/Notice
% RCS: $Header: psdit.pro,v 2.2 87/11/17 16:40:42 byron Rel $

Here is the dictionary in question....

/$DITroff 140 dict def $DITroff begin
/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def
/xi {0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto
  /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F
  /pagesave save def}def
.
many macro definitions created
.
   /Ybi Ycont Bcontrol i 3 add get 2 div add def
   /Xcont Xcont Bcontrol i 2 add get add def
   /Ycont Ycont Bcontrol i 3 add get add def
   Xbi currentpoint pop sub Ybi currentpoint exch pop sub rcurveto
  }for dstroke}if}def
end

OK, all of these macros were created and then thrown away as nothing was done
inside of $DITroff except creation of definitions.

Then a definition is created for ditstart that does another dictionary for
$DITroff.  This time there isn't an end, so far so good.

/ditstart{$DITroff begin
 /nfonts 60 def			% NFONTS makedev/ditroff dependent!
 /fonts[nfonts{0}repeat]def
 /fontnames[nfonts{()}repeat]def
/docsave save def
}def

.
more dictionaries and macro definitions
.

OK, now to the heart of the document.  The procedure ditstart is called, which
starts the $DITroff dictionary again.

ditstart
(psc)xT
576 1 1 xr
1(NewCenturySchlbk-Roman)xf 1 f
2(NewCenturySchlbk-Italic)xf 2 f
3(NewCenturySchlbk-Bold)xf 3 f
4(NewCenturySchlbk-BoldItalic)xf 4 f
5(Helvetica)xf 5 f
6(Helvetica-Bold)xf 6 f
7(Courier)xf 7 f
8(Courier-Bold)xf 8 f
9(Symbol)xf 9 f
10(DIThacks)xf 10 f
10 s
1 f
xi
%%EndProlog

%%Page: 1 1
10 s 0 xH 0 xS 1 f

body of PostScript pages goes here

%%Trailer
xt

This procedure does the end for the dictionary.

xs



What is my problem you ask?  How can all of the definitions that were created
the first time $DITroff was done be available the second time it is started in
ditstart?  The book say that an end closes the dictionary and the info is popped
from the dictionary stack.  The books even give an example of defining the same
thing inside of a dictionary and how it returns to the old value when the new
dictionary is ended.  Unfortunately, I can't find where/how ended dictionary
information is again available in the future.

Can someone please explain this paradox, and/or point to a page/section in
one of the manuals that does explain this completely?

Thanks in advance.
-- 
                harvard\     att!nicmad\
Vidiot            ucbvax!uwvax..........!astroatc!vidiot!brown
                rutgers/  decvax!nicmad/
        ARPA/INTERNET: <@spool.cs.wisc.edu,@astroatc:brown@vidiot>
Technical Details
Message-ID: <314@vidiot.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!tank!uwvax!astroatc!vidiot!brown

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!tank!uwvax!astroatc!vidiot!brown
From: brown@vidiot.UUCP (Vidiot)
Newsgroups: comp.lang.postscript
Subject: PostScript question (help needed)
Message-ID: <314@vidiot.UUCP>
Date: 15 Dec 89 21:10:14 GMT
Reply-To: brown@vidiot.UUCP (Vidiot)
Organization: Vidiot's Hangout
Lines: 109