Occasionally, it may be necessary to convert data passed into a generic routine in a generic variable into another data type. A general set of conversion functions was originally provided within GENERIC to make this possible. However, new code requiring such conversions should invoke the PRIMDAT library of functions. PRIMDAT also provides many other instrinsic functions that are amenable to inclusion in generic code. This section remains only to interpret legacy code that still calls DCV routines.
A naming convention is used so that the function
<T1>TO<T2> converts data type
The functions which can be are defined using Fortran statement functions in a file which may be included in a program by
which should come after any data type definitions, but before any DATA initialisation or executable code. In the standard prologue of SGP/16, it should go in the ``Internal References'' section.
Conversions which cannot be defined as statement functions are provided as external functions in an object library (/star/lib/dcv.a on a Starlink system). Programs requiring these functions should be compiled
% f77 prog.f -L/star/lib `dcv_link`
The types of these functions can be declared in a program by including
(in the ``External References'' section of the standard prologue).
NOTE: Statement functions are considerably faster than external functions, so programs which use the common conversions defined in `DCV_FUN' will execute a lot faster.
Only numeric conversions are supported at present, and
there are no DCV_ functions for conversions involving CHARACTER and
LOGICAL data types.
A full list of the functions, the conversion performed, and their
location and restrictions, is given in
GENERIC --- A Utility for Preprocessing Generic Fortran and C Subroutines