Pointers


 

The Pointer Data Definition Label holds a memory address and may be used in normal PL/B instructions in a transparent fashion. Once assigned to a valid data, object, or file definition of the same type, a Pointer may be used interchangeably with it, making Pointers particularly useful for the emulation of parameterized calls within a program. They use the following format:

 

(1)

[label]

DIM

^[,{var}]

(2)

[label]

FORM

^[.][,{var}]

(3)

[label]

INTEGER

^[,{var}]

(4)

[label]

FILE

^[,{var}]

(5)

[label]

IFILE

^[,{var}]

(6)

[label]

AFILE

^[,{var}]

(7)

[label]

PFILE

^[,{var}]

(8)

[label]

BFILE

^[,{var}]

(9)

[label]

VARLIST

^

(10)

[label]

LIST

^

(11)

[label]

(object)

^

(12)

[label]

DIM

^({arraysize},...)

(13)

[label]

FORM

^[.]({arraysize},...)

(14)

[label]

INTEGER

^({arraysize},...)

 

Where:

label

Optional. A Program Execution Label.

^

Optional. Denotes the item as a POINTER.

var

Required. The name of a previously defined variable or object of the same type.

arraysize

Optional. An integer decimal constant, CONST variable or EQUATEd value indicating the number of array items or the name of a previously defined array of the same type.

Flags Affected: NONE

Note the following:

  1. A Pointer must reference a Label or another Pointer of the same type (i.e., DIM to DIM, FORM to FORM, FILE to FILE, BUTTON to BUTTON, etc.).

  2. Formats (1) - (11) that do not have the optional {label} defined must be initialized by the target of a parameterized call instruction or an SMAKE, MOVEADDR, or MOVEPTR instruction before use. Failure to do so results in a Format Error (F04 or F02). An undefined Pointer in a variable list may generate indeterminate results since the instruction processes the list of variables up to the Pointer.

  3. Formats (1) - (8) that specify the optional {label} are initialized at compile time to the address of {label}.

  4. Pointers become invalid after a ROLLOUT or in the child process of a FORK. They must be re-initialized if used again.

  5. Pointers may not be declared as Common Data Items and are null after a CHAIN.

  6. The optional dot [.] in formats (2) and (13) indicate the field points to a variable containing a decimal point. When present, fractional temporary fields are used for CALC and MOVE statements.

  7. (OBJECT) pointers may be defined for any valid object type.

 

 

See Also: Data Definitions, MOVEADDR, ROUTINE, SMAKE

 



PL/B Language Reference Arrays Character String Variables