Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Reid G.C.Thinking in PostScript.1990.pdf
Скачиваний:
17
Добавлен:
23.08.2013
Размер:
846.44 Кб
Скачать

Figure 5.5: Last Object In is the First Out

0.5 2 100 200 500 400 graybox

/graybox { %def

400 /upperY exch def

500 /upperX exch def

200 /lowerY exch def

100 /lowerX exch def

2 /linewidth exch def

0.5 /gray exch def

%...

}bind def

COMPOSITE OBJECTS

The values associated with composite objects do not exist on the operand stack. There is an object on the stack that represents the composite object data, and it behaves, for the most part, as though the whole object were on the stack. The only time it is confusing is during copying and manipulation of the internal structure of a composite object, when you have to realize that you really have a pointer to the object, not a selfcontained object. For example, if you dup a string object and then change one of the letters in the copied object, the original string changes, too, since there really is only one string and you have only copied the pointer to it, not the string itself.

Figure 5.6: Duplicating a Composite Object

(PostScript) dup

% code to be executed

 

 

 

somewhere in memory

 

 

 

string object

 

 

 

 

 

 

 

PostScript

length: 10

 

 

 

 

 

 

 

string object

 

 

 

length: 10

 

 

 

 

 

 

 

 

 

 

 

Chapter 5: UNDERSTANDING THE STACK

61