Article View: comp.lang.postscript
Article #1352Re: Blue book #19 confustion
From: Woodrow Baker
Date: Fri, 17 Nov 1989 13:47
Date: Fri, 17 Nov 1989 13:47
34 lines
1898 bytes
1898 bytes
In article <932@mtk.UUCP>, marmar@mtk.UUCP (Mark Martino) writes:
> I was studying example #19 in the blue book today and I came across a
> line that I don't understand. The program runs so it must make sense to
> the interpreter, but it doesn't make sense to me.
>
> When creating a new font dictionary, this example uses this line:
>
> { exch newfont 3 1 roll put }
Recall that the put operator installs an item into an array, dictionary, string
etc. newfont is indeed a new dictionary. Also recall that there is a font
dictionary on the stack just before this, so we have
1
3
newfont dict
old font dict
Now, the roll operator changes the order of the stack such that the
put operator takes the old font dict, and sticks it into the new font dict.
It simply is making a copy of the old font dict, and the new font dict
has had a bit of space added to it such that we have a spot to put a new
id etc in.
cheers, Woody
>
> "newfont" appears to be a new empty dictionary. I don't understand how
> newfont is being accessed and used here. If one enters a string without
> the "/", the interpreter trys to find it in the dictionaries. Shouldn't this
> return some kind of "can't find" error? It seems to do this if you set
> this up and try to run it by itself.
>
> I really need to understand this so I can create some new fonts for
> myself. Would someone please explain in more detail what is going on
> here? Thanks for the reality.
Technical Details
Message-ID:
<17319@rpp386.cactus.org>Path:
arc1-ca.pugleaf.net!utzoo!attcan!ncrcan!becker!geac!jtsv16!uunet!cs.utexas.edu!execu!sequoia!rpp386!woodyReferences:
<932@mtk.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!ncrcan!becker!geac!jtsv16!uunet!cs.utexas.edu!execu!sequoia!rpp386!woody From: woody@rpp386.cactus.org (Woodrow Baker) Newsgroups: comp.lang.postscript Subject: Re: Blue book #19 confustion Summary: number 19 Message-ID: <17319@rpp386.cactus.org> Date: 17 Nov 89 13:47:07 GMT References: <932@mtk.UUCP> Distribution: usa Organization: River Parishes Programming, Plano, TX Lines: 34