🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #8574

Re: PostScript question (help needed)

#8574
From: Woodrow Baker
Date: Mon, 18 Dec 1989 01:14
31 lines
2144 bytes
When you create a dictionary with  /exampledict 100 dect def you
essentially set aside enough memory to hold 100 keys (names) and definitions.
A dictionary is like any other composite object.  It can be accessed like an
array.  It stays around like other composite objects.  When you do a 
exampledict begin, what happens is that a pointer to the dictionary is put
on the dict stack (essentially anyway, but it might be implemented diffrently)
All unknown tokens are searched for in the dictionaries that are active on the
stack.  Upon doing an exit, the pointer (if you will) is popped off the stack
and the dictionary stays around in memory.  It is like the stdlib in 'C' in
a perverse sort of way, but can also be thought of (a bit more accuratly)
as a 'C' function, that does a caseswitch on the keyword passed to it, and
then calls a routine to do that function.  Think of them as a collection
of proceedures like a library.  You simply activate and deactivate the 
library.  You can replace things in the library, just make it active, and
PUT or STORE them there.  Doing a DEF creates an entry.  Apparently, each
dictionary entry occupies 20 or so bytes, (create a 100 element dictionary)
and look at the vm before and after, to see how much.

Hope this helps, and if any of this is wrong, I appologize, but it's the
way I view dictionaries.

I may have a detail or two wrong.  Dictionaries were the muddiest sort
of things, until I started working on emulators, and them I came to  understand
them.  My favorite way of thinking about them is a file or library that
can be "opened" with begin, and "closed" with end.

Hope this helps.

Cheers
Woody
Technical Details
Message-ID: <17460@rpp386.cactus.org>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!execu!sequoia!rpp386!woody
References: <314@vidiot.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!execu!sequoia!rpp386!woody
From: woody@rpp386.cactus.org (Woodrow Baker)
Newsgroups: comp.lang.postscript
Subject: Re: PostScript question (help needed)
Summary: dictionaries
Message-ID: <17460@rpp386.cactus.org>
Date: 18 Dec 89 01:14:26 GMT
References: <314@vidiot.UUCP>
Organization: River Parishes Programming, Plano, TX
Lines: 31