(.js)
laraImport("antarex.precision.CustomPrecision");
(.lara)
import antarex.precision.CustomPrecision;
It parametrizes the application for a type (vtype).
It calls CustomPrecisionForExcept(vtype, []), ie without no preserved types.
It parametrizes the application by
- replacing the reference to a type (vtype) by a new symbol,
except the types declared in ArrayOfPreservedTypes
- replacing the formats used in the IO instructions by new symbols.
- replacing the references to math functions (sin, sinh, ...) by new symbols.
The parametrization creates some files in which the parameters are stored:
- INRIA_PRECISION_DEFS_[vtype].h that defines the parameters with the original values
for each new created symbols.
- INRIA_PRECISION_DEFS_XX_template.h in which the definition of the symbols must
be updated by the user, where XX denotes the new symbol assigned to to the customized type.
A type such that MYTYPE defined by
typedef double MYTYPE;
may be preserved by calling
CustomPrecisionForExcept('double', ['MYTYPE']). In this case the typedef is not modified.
Note: genParametersFor aspect can be called for float/double types to have definitions of the symbols.
Generate a include file INRIA_PRECISION_DEFS_[vtype].h that contains the
definitions of the type parametrization for vtype, restricted to float/double
(i.e. it is an instance of INRIA_PRECISION_DEFS_XX_template.h for vtype).
Global Initialization of the component: it must be called once at the end of a type precision session.
Global Initialization of the component: it must be called once at the beginning
of a type precision session.
Add to each file (source, headers except the added files) the declaration of the include that defines the
typed parameters.
It calls extractStatementWithFormat aspect for each IO of C language that references format
with the index of the format in the instruction.
int scanf(const char *format, ...);
int fscanf(FILE *stream, const char *format, ...);
int sscanf(const char *str, const char *format, ...);
int vscanf(const char *format, va_list ap);
int vsscanf(const char *str, const char *format, va_list ap);
int vfscanf(FILE *stream, const char *format, va_list ap);
At the end, the global associative table statementsWithFormatOriVersion constains elements such that
statementsWithFormatOriVersion[_INRIA_IO_FORMAT_XX] = FORMAT, where _INRIA_IO_FORMAT_XX is a new symbol
and FORMAT is a format that references float/double codification (%f, %lf,...)
Restiction to double/float types.
Store in the global table statementsWithFormatOriVersion the formats used in IO instructions (C language).
Each string (S) that references float/double format is replaced by a new name (NAME) and
statementsWithFormatOriVersion[NAME] = S.
Restiction to double/float types.
Replace the calls to pname by nname, @return in referenced the value 'true' if
pname is referenced in the application, 'false' otherwise.
Extract the math functions if the source type is float or double.
The global mathLibReferenced array contains the referenced math functions.
Extract some predefined functions such that stod, stof,...
The global predefinedFuncsReferenced array contains these referenced functions.