The u.func.func
member of struct calib_genrep
must be a
genrep having op
that is one of the following:
CALIB_GENREP_OP_VAR
represents a general function name
as a variable / string.
CALIB_GENREP_OP_SI
containing an index representing one
of the CALIB “builtin” functions.
The CALIB builtin functions are as follows:
exp log abs sqrt sin cos tan cot sec csc asin acos atan acot asec acsc sinh cosh tanh coth sech csch asinh acosh atanh acoth asech acsch atan2 integrate
For each function foo
in this list, calib provides a corresponding
#define
for the function index of the form
CALIB_GENREP_FUNC_FOO
, and a corresponding function
calib_genrep_foo(x)
that returns a genrep representing
foo(x)
.
(This function takes one, two or more arguments as appropriate for the
particular function. For example calib_genrep_atan2 (y, x)
takes two args.)
CALIB does not currently guarantee these builtin function indices to
have permanent and stable values with respect to the CALIB ABI.
It is therefore recommended that the functions be used; using the
#define
symbols may require recompilation with new CALIB
releases.
CALIB provides two functions for translating between builtin function names and their indices:
calib_genrep_builtin_func_name_to_index
:
calib_si_t calib_genrep_builtin_func_name_to_index (const char * fname);
Return the “builtin function index” corresponding to the given
fname
, or -1 if no such builtin function exists.
calib_genrep_builtin_func_index_to_name
:
const char * calib_genrep_builtin_func_index_to_name (calib_si_t fidx);
Return the name of the builtin function having “builtin function
index” fidx
, or NULL
if the given fidx
is invalid.
CALIB provides the following additional functions for manipulating
CALIB_GENREP_OP_FUNC
genrep nodes:
struct calib_genrep * calib_genrep_func (struct calib_genrep * f, struct calib_genrep_list * args);
Return a dynamically-allocated CALIB_GENREP_OP_FUNC
node
having function f
and arguments args
.
struct calib_genrep * calib_genrep_func_si_1 (calib_si_t fidx, struct calib_genrep * op);
Return a dynamically-allocated CALIB_GENREP_OP_FUNC
node
having builtin function index fidx
and argument op
.
struct calib_genrep * calib_genrep_func_si_2 (calib_si_t fidx, struct calib_genrep * arg1, struct calib_genrep * arg2);
Return a dynamically-allocated CALIB_GENREP_OP_FUNC
node
having builtin function index fidx
and two argument:
arg1
and arg2
.
struct calib_genrep * calib_genrep_func_str (const char * fname, struct calib_genrep_list * args);
Return a new dynamically-allocated CALIB_GENREP_OP_FUNC
node
having function named fname
and arguments args
.