TAL Programmer's Guide

TAL and C Guidelines
Mixed-Language Programming
096254 Tandem Computers Incorporated 17–31
C Module
/* C function that accepts TAL routine as a parameter */
void C_FUNC (short (*F) (short n))
{
short j;
j = (*F)(2);
/* lots of code */
}
TAL Module
PROC c_func (x) LANGUAGE C; !EXTERNAL procedure declaration
! for C routine to be called
INT PROC(32) x; !Parameter declaration
EXTERNAL;
INT PROC tal_param_proc (f); !Procedure to be passed as a
INT f; ! parameter to C_FUNC
BEGIN
RETURN f;
END;
PROC tal_caller; !Procedure that calls C_FUNC
BEGIN ! and passes TAL_PARAM_PROC
!Lots of code
CALL c_func (tal_param_proc);
!Lots of code
END;
PROC m MAIN;
BEGIN
CALL tal_caller;
END;