gtpa2m44 | Application Programming |
You need to customize the TPF system to be able to take full advantage of C language support. This section includes a description of required and optional customizations.
TPF globals are a unique phenomenon.
Most operating systems provide a means for application programs to access and modify variables in common storage. The structure of the TPF global areas, and the fact that they are not link-edited with the application load module, ensure that TPF application programs that manipulate the global areas will never be fully portable to other operating systems. However, there is a way for TPF application programs written in C to access the global areas.
This section describes the special concerns that arise when creating a C language interface to TPF globals, and the customization that you need to do before you can create application programs written in C that access TPF global fields and records. See the earlier section on globals for architecture and terminology.
For example, consider assembler global tag @MAXCL, which defines the maximum CRT line count. This item has displacement into the global 1 area of X'44A', a length of 2 bytes, can be synchronized, and is a subsystem-unique global field. The following #define statement would appear in c$globz.h for this global:
#define _maxcl 0x044a0241
The displacement is shown in bits 4-15 (X'44A'), the length in bits 16-23 (X'02'), attributes in bits 24-28 (B'01000'), and the global area where the item resides in bits 29-31 (B'001').
TPF provides 2 sample utilities, GENTAG.C (for use with Assembler H) and GNTAGH.C (for use with HLASM), which demonstrate a means of automating the creation of c$globz.h. These programs can be run whenever changes have been made to the allocation of global fields or records. For more information about GENTAG and GNTAGH, see TPF System Installation Support Reference.
For a description of the TPF API functions that make use of the tag names to access or modify individual global fields or records, see the TPF C/C++ Language Support User's Guide.
The 6 ISO-C glob functions (glob_keypoint, glob_modify, glob_lock, glob_update, glob_sync, and glob_unlock) have several, similar requirements:
For details on these functions see their individual sections in the TPF C/C++ Language Support User's Guide.