gtpp2m0iProgramming Standards

Contents of C/C++ Source Files

The following table describes how to name the C/C++ item that is in a C or C++ source file; these are the actual contents, not the external source file name. These conventions are in place to avoid clashing with namespaces of customers:


Table 2. Naming Conventions for C/C++ Source Code (Contents of File)

Item in C/C++ Source File Standard and Ported C/C++ Code TPF - Interface Protected (Interface Guaranteed) TPF - Implementation Specific (Interface Not Guaranteed) BAL Equivalent Exists
identifiers
  • functions1
  • data

macro (#define)

typedef

enumeration

  • tag
  • value

tags5

  • structure6
  • union

exported

  • functions
  • data
As is2 One of the following3:
  • tpf_
  • TPF_
  • tpfxxx_
  • TPFxxx_ where xxx is a package or feature code that will allow the names to be grouped together in documentation and also self-document to which package they belong.
Anything One of the following:4
  • TPF_name
  • TPF_name_xxx
  • tpf_name
  • tpf_name_xxx
names coded with the #pragma map directive or assembler external symbols
Note:
Names beginning with @@LM are reserved for TPF link map support for C load modules.
@@xxxxxx, where x is any alphanumeric character.

Note:
xxxxxx is variable in length and can be from 1-6 characters.
@@xxxxxx, where x is any alphanumeric character.

Note:
xxxxxx is variable in length and can be from 1-6 characters.
@@xxxxxx, where x is any alphanumeric character.

Note:
xxxxxx is variable in length and can be from 1-6 characters.
@@xxxxxx, where x is any alphanumeric character.

Note:
xxxxxx is variable in length and can be from 1-6 characters.

Table Notes:

  1. For external function names, the name in the header file must map as @@nnnnnn for a library function and Cnnn for a dynamic load module (DLM). For example:
                  Name in Header File
                  -------------------
                                     pragma maps
        library   tpf_sort()           -------->  @@SORT
                                          to
     
                                     pragma maps
        DLM       tpf_cima_sort()      -------->  CIMA
                                          to
    

    See "Mapping Library Names and LONGNAME Support" for information about LONGNAME support.

  2. If you are porting a standard package but find that you need to write TPF-unique function that will still be considered part of the standard package, use the naming convention of that package and add a suffix of _tpf. Following is an example with a standard package of standpkg and a function of newfunc:
         standpkg_portedfunc   /* Part of the package and ported as is   */
         standpkg_newfunc_tpf  /* Part of the package but written by TPF */
    

  3. TO2_ functions are exceptions to this naming convention. They will not be renamed.

  4. All existing TPF DSECTs will not be renamed and are exceptions.

  5. Global Tags and System Equates Migrated from Assembler to ISO-C:

  6. If a C or C++ header is created for an existing BAL DSECT, prefix the C or C++ structure name with TPF_ or tpf_. If there is an existing BAL DSECT, member names in the C or C++ structure are the same as in the corresponding BAL DSECT.