5. Language Programming Interfaces

  1. 5.1. The DRA C LPI
  2. 5.2. The DRA C++ LPI
  3. 5.3. The Etnoteam Fortran LPI

A Language Programming Interface (LPI) is here defined to mean a set of tokens, usually specific to a particular producer, which will encapsulate language features at a higher level than basic TDF constructs, more convenient for the producer to produce.

Responsibility for the specification of individual LPIs lies with the appropriate producer itself. Before an application can be installed on some target platform, the appropriate LPI token definitions must have been built for that platform. In this sense, the LPI can be considered as a primitive API, which is discussed in §6.

The process by which the LPI token definition library or capsule is generated for any specific platform will vary according to the LPI, and responsibility for defining that process will also lie with the appropriate producer. Some LPIs, such as that associated with DRA's C producer, can be fully defined by architecture neutral TDF, using the tokens specified in §2 and §3 to encapsulate any target dependencies. When that is the case, the generation process can be fully automated. For other LPIs the process may be much less automated. In some cases where the source language implies a complex run-time system, this might even require a small amount of new code to be written for each platform.

Generally, the individual LPI tokens do not need to be specified in the token registry, provided they follow a registered naming scheme to ensure uniqueness (see §1). In exceptional circumstances it may be necessary for some TDF tool to recognise individual LPI tokens explicitly by name. This will be the case when experimenting with potential extensions to TDF, in the field of parallelism for example. In other cases a TDF installer or other tool may recognise an LPI token by name rather than its definition by choice, for some unspecified advantage. We make a pragmatic choice in such cases whether to include such token specifications in the token registry. For widely used producers, we can assume availability of the LPI token specifcations, or standard definitions, separately from the token register, but we should expect any such tokens to be specified within the register for all cases where significant advantage could be taken by an installer only if it recognises the token by name.

5.1. The DRA C LPI

DRA's C producer LPI is defined by an architecture neutral token definition capsule provided with the producer. Target specific detail is included only by use of the target dependency tokens and C mapping tokens specified in §2 and §3.1 respectively. Target specific versions of this capsule are obtained by transformation, using the preprocessing action of the TDF tool tnc, with definitions of the target dependency and C mapping tokens that are provided with the target installer. No special treatment is required for any of the C LPI tokens, though translation time can be slightly improved in a few cases if the names are recognised and standard token definition exercised explicitly within some installers.

The DRA C LPI does not include standard library features, for which the C language requires header files. The standard C library is one example of an API, discussed in §6.

5.2. The DRA C++ LPI

The DRA C++ LPI extends the DRA C LPI adding tokens for target specific C++ features not found in C. Again, standard library features are treated as an API.

5.3. The Etnoteam Fortran LPI

The details in this subsection are provisional, subject to confirmation of argument and result SORTs, and development of model token definitions.

The following tokens are named here in case any installers may be able to produce better code than could be achieved by normal token expansion. In particular, some installers may be able to inline standard function calls.

.Et~SQRTsquare root
.Et~EXPexponential (e ** x)
.Et~LOG(natural) logarithm
.Et~LOG_10base 10 logarithm
.Et~LOG_2base 2 logarithm
.Et~SINsine
.Et~COScosine
.Et~TANtangent
.Et~ASINinverse sine
.Et~ACOSinverse cosine
.Et~ATANinverse (one argument) tangent
.Et~ATAN2inverse (two arguments) tangent, excluding complex
.Et~SINHhyperbolic sine
.Et~COSHhyperbolic cosine
.Et~TANHhyperbolic tangent
.Et~ASINHinverse hyperbolic sine
.Et~ACOSHinverse hyperbolic cosine
.Et~ATANHinverse hyperbolic tangent
.Et~MODfloating point remainder, excluding complex

These tokens apply to any floating variety. This includes complex, unless otherwise stated.