TAL Programmer's Guide

TAL and C Guidelines
Mixed-Language Programming
17–30 096254 Tandem Computers Incorporated
TAL Routines as Parameters to C
You can call C routines and pass TAL routines as parameters. You can pass any TAL
routine except EXTENSIBLE or VARIABLE routines as parameters.
A passed TAL routine can access the routine’s local variables and global TAL
variables. The passed routine can contain subprocedures, but they cannot be passed as
parameters.
If you call a large-memory-module C routine, the EXTERNAL procedure declaration
for the C routine must specify the PROC(32) parameter type in the parameter
declaration. When you pass the PROC(32) parameter to the C routine, the compiler
passes a 32-bit address that contains PEP and map information in the high-order word
and a zero in the low-order word.
If you call a small-memory-module C routine, the EXTERNAL procedure declaration
for the C routine must specify the PROC parameter type in the parameter declaration.
When you pass the PROC parameter to the C routine, the compiler passes a 16-bit
address that contains PEP and map information.
In the following example, a large-memory-model C module contains C_FUNC, which
expects a TAL procedure as a parameter. The TAL module contains:
An EXTERNAL procedure declaration for C_FUNC
TAL_PARAM_PROC, a routine to be passed as a parameter to C_FUNC
TAL_CALLER, a routine that calls C_FUNC and passes TAL_PARAM_PROC as a
parameter