gtpc2m19C/C++ Language Support User's Guide

crosc_entrc-Cross-Subsystem to Enter a Program and then Return

This function provides the ability to enter a program and then return to the calling program.

Format

#include   <sysapi.h>
long int crosc_entrc(const char *segment, int idloc,
    struct TPF_regs *regs, ...);

segment
A pointer to the 4-character name of the segment to be entered by crosc_entrc. (It does not need to end with \0.)

idloc
Specifies the subsystem in which the segment is entered. Three values are defined for this parameter: CROSC_BSS, CROSC_DBI, and CROSC_PBI. These values correspond to the assembler macro parameters BSS, DBI, and PBI. You can also code the 2-byte subsystem ID for this parameter; for example. X'FF00'.

regs
Points to a TPF_regs structure or is NULL.
TARGET(TPF) only

If regs is not null, the enter linkage works the same as if the segment had been called with #pragma linkage(name,TPF,N);. If regs is null, #pragma linkage(name,TPF,C) enter linkage is run with the optional parameter list passed to the called segment.

ISO-C only

If regs is not NULL, the parameter list (regs) is passed along to the called segment. If regs is NULL, the optional parameter list is passed to the called segment. When regs is NULL and the called segment is a TPF BAL program, an additional NULL should be coded as the first and only optional parameter to indicate no TPF_regs to enter/back.

...
Is the parameter list that is passed to the cross-subsystem entered segment if regs is null. The called function (if prototyped) takes only integral (char, short, int, long, and enums), pointer, and double parameters. A function call cannot be one of the parameters. The optional parameters must match the types of the corresponding prototyped parameters.

Normal Return

The crosc_entrc function returns the value that was returned by the cross-entered function, cast to a (long int). Only integral and pointer values can be returned.

Error Return

Not applicable.

Programming Considerations

Examples

The following example executes the C language program CDEF in subsystem 0xF00F and then executes assembly language program WXYZ in the BSS.

#include <tpfeq.h>
#include <sysapi.h>
 
#pragma linkage(WXYZ,TPF,N)
#pragma linkage(CDEF,TPF,C)
 
extern void WXYZ(struct TPF_regs *regs);
extern char *CDEF(int, double, char *);
 

  ·
  ·
  ·
/* */ /* call type C segment with 3 parameters: 1, 2.0 and "ABC" */ /* */ char *c = (char *)crosc_entrc("CDEF", 0xF00F, NULL,1, 2.0, "ABC"); struct TPF_regs reg = { 0 }; reg.r1 = 4; crosc_entrc("WXYZ", CROSC_BSS, &reg);
  ·
  ·
  ·

Related Information