How to make an existing library conformant to APRON ?
We briefly describe here how to connect an existing library to the
First, the library has to expose an interface which conforms to the
level 0 of the interface (module
abstract0). All the functions
described in this module should be defined. If a function is not
really implemented, at least it shoulld contain the code raising the
EXC_NOT_IMPLEMENTED. The implementor may use any
functions of the files `ap_coeff.h', `ap_linexpr0.h',
`ap_lincons0.h', `ap_generator0.h' and `ap_manager.h'
to help the job of converting datatypes of the interface to internal
datatypes used inside the library.
Second and last, the library should expose an initialization
function that allocates and initializes properly an object of type
manager_t. For this purpose, the module
manager offers the
manager_alloc. As an example, we give the
definition of the function allocating a manager as implemented in
That's all for the implementor side.
- Header of the function:
bool strict /* specific parameter: do we allow strict constaints ? */
- Allocation and initialisation of global data specific to NewPolka:
pk_internal_t* pk = pk_internal_alloc(strict); /* allocation */
/* initialization of specific functions
(not offered in the common interface) */
- Allocation of the manager itself:
We provide resp. name, version, internal specific manager, and the
function to free it.
manager_t* man = ap_manager_alloc("polka","2.0",
pk, (void (*)(void*))pk_internal_free);
manager_alloc sets the options of the
common interface to their default value (see documentation).
- Initialization of the "virtual" table: we need to connect
the generic functions of the interface (eg,
\ldots) to the actual functions of the library.
funptr = man->funptr;
funptr[fun_minimize] = &poly_minimize;
funptr[fun_canonicalize] = &poly_canonicalize;
funptr[fun_hash] = &poly_hash;
funptr[fun_approximate] = &poly_approximate;
funptr[fun_fprint] = &poly_fprint;
funptr[fun_fprintdiff] = &poly_fprintdiff;
funptr[fun_fdump] = &poly_fdump;
- Last, we return the allocated manager:
This document was generated
on September, 10 2009