gtpa2m38Application Programming

User Expansion Area

The TPF system provides support for internal static variables defined with file or block scope. You may want to write library functions that provide their own static variable support, using the stack. There are two advantages to this: performance can be improved, and less storage is used. The user expansion area is provided in the first stack frame for this purpose.

There are 2 stack frame formats. The first stack frame of the first stack block is different from all the other stack frames that are eventually chained to it, which we will call subsequent stack blocks. The ICS0TK data macro maps the stack frames for TARGET(TPF) and the IDSDSA data macro maps the stack frames for ISO-C. (For more information about ICS0TK and IDSDSA, see their code listings.)

Figure 38. Stack Frame Formats




We talked about adding additional space to subsequent stack frames in C Language Support Prologs.

The area at the end of the first stack frame is known as the user expansion area. In ISO-C, the user expansion area is accessed through the LWS (DSECT IDSLWS) and in TARGET(TPF) it is accessed by the ICS0TK DSECT.

This area is available to application programs and is added during coding a user exit. A user exit allows TPF system users to add user-unique processing at various points in TPF programs.

The C stack exception routine user exit can be used to extend the first stack frame to include a user work area at the end. The name of the exit point is CENV in ISO-C and CSK in TARGET(TPF). The area itself is accessed with pointer CSTKUEXP in TARGET(TPF) and ILWSUEXP in ISO-C. It appears at the beginning of the library function work area.

See TPF System Installation Support Reference for more information about this particular exit and TPF user exits in general.