pTAL Reference Manual (H06.03+)
RETURN, RETURNSCC, and C/C++ on TNS/E
HP pTAL Reference Manual—523746-005
D-2
Example D-1. C Procedure Extracting Two pTAL Return Values from a 64-Bit
Value (Works Only on TNS/R Systems—Not Recommended)
pTAL procedure with two return values:
int proc p (i, j, k) returnscc;
int(16) i;
int(32) .ext j;
int(64) k;
begin
...
return i, j < k; ! Traditional function value is the value of i.
! Expression j < k sets condition code.
end;
C/C++ prototype for accessing pTAL procedure:
_tal _alias ("P") long long some_name (short i, int* j, long long k);
C/C++ code that captures the 64-bit value:
typedef union val_cc_combo
{
long long combo;
struct
{
long value;
long condition_code;
} parts
} val_cc_combo
...
val_cc_combo.combo = some_name ();
C/C++ code that extracts the condition code from the 64-bit value:
(short)val_cc_combo.parts.value /* For 16-bit return value */
val_cc_combo.parts.value /* For 32-bit return value */
C/C++ code that extracts the two return values from the 64-bit value:
(short)val_cc_combo.parts.condition_code /* Always 16-bits */










