pTAL Reference Manual (H06.03+)

Pointers
HP pTAL Reference Manual523746-005
10-19
Initializing Structure Pointers
Example 10-17. Declaring and Initializing a Local Structure Pointer
PROC my_proc MAIN;
BEGIN
STRUCT my_struct[0:2];
BEGIN
INT array[0:7];
END;
INT .struct_ptr (my_struct) := @my_struct[1];
! Structure pointer contains address of my_struct[1]
END;
Example 10-18. Declaring and Initializing a Local STRING Structure Pointer
STRUCT name_def(
*
);
BEGIN
STRING first[0:3];
STRING last[0:3];
END;
STRUCT .record;
BEGIN
STRUCT name (name_def); ! Declare substructure
INT age;
END;
STRING .my_name (name_def) := @record.name; ! Structure pointer
! contains address
! of substructure
my_name ':=' ["Sue Law"];
Example 10-19. Declaring and Initializing a Local STRING Structure Pointer
BEGIN
INT array[0:7];
STRUCT a_struct (
*
);
BEGIN
INT var;
INT buffer1[0:3];
STRING buffer2[0:4];
END;
INT .struct_ptr (a_struct) := @array; ! Structure pointer
END; ! contains address of
! array