gtpc2m1uC/C++ Language Support User's Guide

entdc, __ENTDC-Enter a Program and Drop Previous Programs

This function transfers control to a TPF segment without return, clearing all program nesting levels.

Format

#include   <tpfapi.h>
void       entdc(void (*segname)(), struct TPF_regs *regs);
void       __ENTDC(const char *segname, struct TPF_regs (regs);

segname
For entdc, a pointer to the external macro to be called. For __ENTDC, a pointer to the name of the segment to be called. segname must map to a BAL segment name, a TARGET(TPF) segment name (or transfer vector), or a TPF ISO-C DLM name.
Migration to ISO-C consideration

The TARGET(TPF) entdc function can handle segment names that are #pragma mapped. The ISO-C entdc macro only handles #pragma mapped names if the first 4 characters are the same as the program name.

TARGET(TPF) restriction

Only calls to certain TPF API functions permit the use of function pointers. Pointers to functions are not supported in TARGET(TPF); their use will normally result in a compiler error.

regs
Treated as a pointer to struct TPF_regs (defined in <tpfregs.h>) that contains 8 signed long integer members, r0-r7. These members are used to load general registers R0-R7 before passing control. If this argument is coded as NULL, no registers are loaded.

Normal Return

Not applicable.

Error Return

Not applicable.

Programming Considerations

Examples

The following example initializes the R1 slot in the TPF_regs structure with the address of a message block and initializes the R2 slot with the address in the CBRW on level D8. The entdc macro then transfers control to program FMSG without return, passing the values in the indicated registers.

#include <tpfapi.h>
void FMSG();
struct TPF_regs *regs = (struct TPF_regs *)&(ecbptr()->ebx000);
char *msg_text;

  ·
  ·
  ·
regs->r1 = (long int)msg_text; regs->r2 = (long int)ecbptr()->ce1cr8; entdc(FMSG, regs);

Related Information