beautypg.com

Internal objects, Intrinsic operator objects – AMT Datasouth PAL User Manual

Page 24

background image

18

PAL Language Reference

PAL also allows nested procedure definitions. This means that one procedure definition, enclosed
in the "{" and "}" operators, can contain another procedure, enclosed in its own set of "{" and "}"
operators.

While PAL records the operators and objects contained within the "{" and "}" operators, PAL does
not perform any of the operations for the operators it encounters. One exception to this rule exists.
PAL does continue to substitute immediately evaluated names with their associated objects.

Once PAL encounters the closing "}" operator and stops recording the procedure, PAL places the
procedure object on the top of the operand stack. PAL does not attempt to execute the procedure at
that time.

The programmer can treat a procedure object in many of the same ways as the programmer can
treat array or dictionary objects. This includes the ability to store procedure objects within other
composite objects. Except for allowing the programmer to execute the procedure when desired,
PAL treats procedures as any other data objects.

As an example of this flexibility, consider a case where the programmer wishes to print thermal
labels for various different parts within a company's inventory. Each part requires a label with
different information and a different overall layout.

The programmer could create, within the printer's memory, a dictionary containing all the part
numbers for each of the parts in the company's inventory. The programmer could then associated a
procedure with each of these part numbers within the dictionary.

When the programmer wishes to print a label for a particular part, the programmer need only tell
PAL which dictionary and part number to use and PAL will recall the procedure for printing that
label from the dictionary.

If the process requires additional information about the part, the dictionary could contain array
objects associated with each part number rather than procedures. These arrays could contain all the
information related to the part as well as the procedure for printing the part's label.

3.3.

Internal Objects

Certain operations cause PAL to mix internal object types with the objects created by the pro-
grammer. The internal classification of object types includes the following.

Intrinsic Operator
File
Font

3.3.1.

Intrinsic Operator Objects

Intrinsic operator objects actually instruct the PAL interpreter to perform one of the numerous
operations supported by PAL. The PAL interpreter contains a special dictionary, called
systemdict, which associates name objects with intrinsic operator objects.

When PAL encounters an executable name, PAL searches for the name in systemdict. When PAL
locates the name, it recovers the object associated with the name in the dictionary. In most cases,
PAL will find an intrinsic operator object associated with the name. PAL then performs the action
indicated by the instrinsic operator.