pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-13
Determining Address Types
Procedures, Procedure Pointers, and Procedure Entry
Points (PROCADDR Address Types)
The address type of procedures, procedure pointers (PROCPTRs), and procedure
entry points is PROCADDR:
PROCADDR pa;
PROCPTR q( j );
INT j;
END PROCPTR;
PROC p( j );
INT j;
BEGIN
ENTRY p1;
...
p1:
pa := @q; ! Address type of q is PROCADDR
pa := @p; ! Address type of p is PROCADDR
pa := @p1; ! Address type of p1 is PROCADDR
END;
Subprocedures, Subprocedure Entry Points, Labels, and
Read-Only Arrays (CBADDR and CWADDR Address Types)
The address type of a pointer to code in a user code segment—that is, a read-only
array—is CWADDR if the pointer is type INT, and is CBADDR if the pointer is type
STRING. The address type of subprocedures, subprocedure entry points, and all
labels—in both procedures and subprocedures—is CWADDR:
INT sa = 'P' := [1,2,3,4]; ! Address type of sa is CWADDR
STRING sb = 'P' := ["ABCD"]; ! Address type of sb is CBADDR
PROC p;
BEGIN
LABEL lab1;
SUBPROC subp1;
BEGIN
CWADDR cw;
CBADDR cb;
ENTRY ent1;
ent1:
lab2:
cw := @subp1; ! Address type of @subp1 is CWADDR
cw := @lab1; ! Address type of @lab1 is CWADDR
cw := @lab2; ! Address type of @lab2 is CWADDR
cw := @ent1; ! Address type of @ent1 is CWADDR
cw := @sa; ! Address type of @sa is CWADDR
cb := @sb; ! Address type of @sb is CBADDR
END;
lab1:
END;