Userdict – AMT Datasouth PAL User Manual
Page 199

193
userdict
userdict
Description
Pushes the standard user dictionary, userdict, onto the top of the operand stack.
Usage
userdict
UserDict
UserDict
Dictionary. Standard user dictionary, userdict, from dictionary stack.
Comments
During initialization, PAL automatically creates three dictionaries -- systemdict, globaldict, and
userdict. It then pushes these three dictionaries onto the dictionary stack in the listed order.
Therefore, the dictionary stack contains systemdict at the bottom, globaldict in the middle, and
userdict on the top.
PAL creates both userdict and globaldict as empty dictionaries. systemdict contains entries for
all the names implicit to PAL. For example, the names of operators such as add, show, etc.
When PAL encounters an executable name object, it searches the dictionaries on the dictionary
stack to locate the name. PAL starts with the dictionary on the top of the dictionary stack and
proceeds down the stack until it finds an entry for the name. If PAL cannot locate the name in any
dictionary on the stack, PAL generates an undefined error.
Normally userdict and globaldict do not contain names which match the names of PAL operators.
Therefore, PAL does not find entries for the operator names in those dictionaries as PAL
progresses down the dictionary stack. The interpreter does not find these operator names until it
reaches the bottom of the dictionary stack. It then locates the operator name in systemdict. The
systemdict entry for the operator name contains the intrinsic operator object which tells PAL
which action to actually perform.
When the programmer uses the def operator, the programmer instructs PAL to add an entry to the
user dictionary, userdict. Later, the programmer can instruct PAL to recall the information from
userdict simply by supplying the name specified with the def operator. When PAL encounters the
name, the interpreter searches the dictionary stack in the same manner as when PAL encounters the
name of an operator. Since the dictionary stack contains userdict at the top, PAL immediately
locates the programmer's entry in userdict.
When the programmer no longer requires an entry in userdict, the programmer should instruct
PAL to remove the entry. PAL provides the undef operator for this purpose. However, the undef
operator will work with any dictionary. This means the programmer must specify the dictionary
upon which undef will operate. userdict provides the mechanism by which the programmer can
undef entries created by def in userdict.