Inspect Manual

Using Inspect With Pascal
Inspect Manual429164-006
12-11
Record Types
VAR
record_structure : tmprec;
Inspect accesses records of this type as follows:
-PASOBJ-DISPLAY record_structure
RECORD_STRUCTURE =
VAR1 = value of var1
VAR2 = value of var2
-PASOBJ-DISPLAY record_structure.var1
RECORD_STRUCTURE.VAR1 = value of var1
Examples Using a Variant Record
This example shows implicit and explicit qualification of a variant record, assuming this
Pascal program fragment:
TYPE
sidetype = (offense,defense);
positiontype = (line,back);
team = RECORD
CASE side : sidetype OF
offense:
(CASE o_position : positiontype OF
line: (o_lineman : (TE,SE,Guard,Tackle,Center));
back:(o_back : (Quarterback,Halfback,Fullback))
);
defense:
(CASE d_position : positiontype OF
line : (d_lineman : (End,Tackle,Nosetackle) );
back : (d_back : (Linebacker,Safety,Cornerback))
)
END;
VAR football : team;
BEGIN
football.side := offense;
football.o_position := back;
football.o_back := Quarterback;
...
This example shows implicit qualification. Inspect determines which path to take by
evaluating variant indicator fields as it processes the variant record:
-PASOBJ-DISPLAY football
FOOTBALL =
SIDE = OFFENSE
O_POSITION = BACK
O_BACK = QUARTERBACK