|
nuXmv API 126f6942
API for nuXmv
|
Functions for handling Expressions. More...
Macros | |
| #define | NUXMV_MAKE_INVALID_EXPR() ((nuxmv_expr){.repr = NULL}) |
| #define | NUXMV_VALID_EXPR(expr) ((expr).repr != NULL) |
| Valid expression. | |
Functions | |
| nuxmv_expr | nuxmv_make_identifier (nuxmv_env env, nuxmv_symbol symbol, nuxmv_expr_type type) |
| Create a new identifier for a symbol. | |
| nuxmv_expr | nuxmv_make_value (nuxmv_env env, nuxmv_symbol val, nuxmv_expr_type type) |
| Create a new value for a symbol. | |
| nuxmv_expr | nuxmv_make_op (nuxmv_env env, nuxmv_op_tag op, const nuxmv_expr *args, size_t arg_num) |
| Create a structured expression for an operator. | |
| nuxmv_expr | nuxmv_make_parametric_op (nuxmv_env env, nuxmv_op_tag op, const nuxmv_expr *args, size_t arg_num, const int *params, size_t param_num) |
| Create a structured parametric expression for an operator. | |
| nuxmv_expr | nuxmv_make_un_op (nuxmv_env env, nuxmv_op_tag op, nuxmv_expr arg) |
| Create a structured expression for a unary operator. | |
| nuxmv_expr | nuxmv_make_bin_op (nuxmv_env env, nuxmv_op_tag op, nuxmv_expr arg1, nuxmv_expr arg2) |
| Create a structured expression for a binary operator. | |
| nuxmv_expr | nuxmv_make_expr_from_string (nuxmv_env env, const char *data, nuxmv_module scope) |
| Make an expression from a string. | |
| nuxmv_expr_type | nuxmv_expr_get_type (nuxmv_env env, nuxmv_expr expr) |
| Get the type of an expression. | |
| nuxmv_symbol | nuxmv_expr_get_symbol (nuxmv_env env, nuxmv_expr identifier) |
| Get the symbol associated to an identifier. | |
| size_t | nuxmv_expr_get_id (nuxmv_env env, nuxmv_expr expr) |
| Get the ID of a type. | |
| int | nuxmv_serialize_expr_to_string (nuxmv_env env, nuxmv_expr expr, nuxmv_serialized_chunk_callback callback, void *user_data, char *data, size_t data_size) |
| Serialize a expr to a string. | |
| int | nuxmv_expr_contains_temporal_operators (nuxmv_env env, nuxmv_expr expr) |
| Test whether an expression contains temporal operators. | |
| int | nuxmv_expr_is_identifier (nuxmv_env env, nuxmv_expr expr) |
| Test whether an expression corresponds to an identifier. | |
| int | nuxmv_expr_is_value (nuxmv_env env, nuxmv_expr expr) |
| Test whether an expression corresponds to a value. | |
| int | nuxmv_expr_is_op (nuxmv_env env, nuxmv_expr expr) |
| Test whether an expression corresponds to an operator. | |
| nuxmv_op_tag | nuxmv_expr_get_op_tag (nuxmv_env env, nuxmv_expr expr) |
| Get the tag of an operator. | |
| int | nuxmv_expr_get_argument_num (nuxmv_env env, nuxmv_expr expr) |
| Get the number of arguments in an expression. | |
| nuxmv_expr | nuxmv_expr_get_argument (nuxmv_env env, nuxmv_expr expr, int arg_idx) |
| Get the i-th argument of a structured expression. | |
| int | nuxmv_expr_is_parametric (nuxmv_env env, nuxmv_expr expr) |
| Test whether an expression is parametric. | |
| int | nuxmv_expr_get_parameter_num (nuxmv_env env, nuxmv_expr expr) |
| Get the number of parameters in a parametric expression. | |
| int | nuxmv_expr_get_parameter (nuxmv_env env, nuxmv_expr expr, int param_idx) |
| Get the i-th parameter value of a structured parametric expression. | |
| int | nuxmv_visit_expr (nuxmv_env env, nuxmv_expr expr, nuxmv_expr_visit_callback callback, nuxmv_expr_visit_order order, void *user_data) |
| Visit an expression. | |
| nuxmv_expr | nuxmv_simplify_expr (nuxmv_env env, nuxmv_expr expr) |
| Simplify an expression. | |
Functions for handling Expressions.
| #define NUXMV_MAKE_INVALID_EXPR | ( | ) | ((nuxmv_expr){.repr = NULL}) |
Make an invalid expression object
This macro is useful where a function argument requires an optional expression object.
| #define NUXMV_VALID_EXPR | ( | expr | ) | ((expr).repr != NULL) |
Valid expression.
This macro checks whether expr is a valid nuxmv_expr.
| [in] | expr | The expression to inspect. |
true if the option is valid, false otherwise. | int nuxmv_expr_contains_temporal_operators | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Test whether an expression contains temporal operators.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to inspect. |
1 when the expression contains at least one temporal operator, 0 if not, -1 in case of error.Requirements: 03.001.02
| nuxmv_expr nuxmv_expr_get_argument | ( | nuxmv_env | env, |
| nuxmv_expr | expr, | ||
| int | arg_idx | ||
| ) |
Get the i-th argument of a structured expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The structured expression to inspect. |
| [in] | arg_idx | The index of the argument counting from 0. |
false.Requirements: 03.001.02
| int nuxmv_expr_get_argument_num | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Get the number of arguments in an expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to extract the argument number from. |
-1 in case of error.Requirements: 03.001.02
| size_t nuxmv_expr_get_id | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Get the ID of a type.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to extract the ID from. |
| nuxmv_op_tag nuxmv_expr_get_op_tag | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Get the tag of an operator.
| [in] | env | The environment to inspect. |
| [in] | expr | The structured expression to inspect. |
Requirements: 03.001.04
| int nuxmv_expr_get_parameter | ( | nuxmv_env | env, |
| nuxmv_expr | expr, | ||
| int | param_idx | ||
| ) |
Get the i-th parameter value of a structured parametric expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The structured parametric expression to inspect. |
| [in] | param_idx | The index of the parameter counting from 0. |
-1 in case of error.Requirements: 03.001.01
| int nuxmv_expr_get_parameter_num | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Get the number of parameters in a parametric expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to extract the parameter number from. |
-1 in case of error.Requirements: 03.001.01
| nuxmv_symbol nuxmv_expr_get_symbol | ( | nuxmv_env | env, |
| nuxmv_expr | identifier | ||
| ) |
Get the symbol associated to an identifier.
| [in] | env | The environment to inspect. |
| [in] | identifier | The identifier to inspect. |
false.Requirements: 03.001.02
| nuxmv_expr_type nuxmv_expr_get_type | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Get the type of an expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to inspect. |
false.Requirements: 03.001.02
| int nuxmv_expr_is_identifier | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Test whether an expression corresponds to an identifier.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to inspect. |
1 when the expression is an identifier for a symbol, 0 if not, -1 in case of error.Requirements: 03.001.02
| int nuxmv_expr_is_op | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Test whether an expression corresponds to an operator.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to inspect. |
1 when the expression is strctured, 0 if not, -1 in case of error.Requirements: 03.001.02
| int nuxmv_expr_is_parametric | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Test whether an expression is parametric.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to inspect. |
1 when the expression is strctured and parametric, 0 if not, -1 in case of error.Requirements: 03.001.01
| int nuxmv_expr_is_value | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Test whether an expression corresponds to a value.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to inspect. |
1 when the expression is a value for a symbol, 0 if not, -1 in case of error.Requirements: 03.001.02
| nuxmv_expr nuxmv_make_bin_op | ( | nuxmv_env | env, |
| nuxmv_op_tag | op, | ||
| nuxmv_expr | arg1, | ||
| nuxmv_expr | arg2 | ||
| ) |
Create a structured expression for a binary operator.
| [in] | env | The environment to modify. |
| [in] | op | The operation computed by the expression. |
| [in] | arg1 | The first argument of the operator. |
| [in] | arg2 | The second argument of the operator. |
false.Requirements: 03.001.01
| nuxmv_expr nuxmv_make_expr_from_string | ( | nuxmv_env | env, |
| const char * | data, | ||
| nuxmv_module | scope | ||
| ) |
Make an expression from a string.
| [in] | env | The environment to modify. |
| [in] | data | A null-terminated string containing the expression data. |
| [in] | scope | A context the expression belongs to, or an invalid module if no context is required. |
false.Requirements: 03.005
| nuxmv_expr nuxmv_make_identifier | ( | nuxmv_env | env, |
| nuxmv_symbol | symbol, | ||
| nuxmv_expr_type | type | ||
| ) |
Create a new identifier for a symbol.
| [in] | env | The environment to modify. |
| [in] | symbol | A symbol to identify. |
| [in] | type | The type for the identifier. |
false.Requirements: 03.001.01
| nuxmv_expr nuxmv_make_op | ( | nuxmv_env | env, |
| nuxmv_op_tag | op, | ||
| const nuxmv_expr * | args, | ||
| size_t | arg_num | ||
| ) |
Create a structured expression for an operator.
| [in] | env | The environment to modify. |
| [in] | op | The operation computed by the expression. |
| [in] | args | A list of arguments the operator requires as inputs. If no list shall be used (for example with operator NUXMV_OP_PI) it is safe to use NULL or the result of malloc(0), provided that arg_num=0. |
| [in] | arg_num | The number of arguments in the list. If no list shall be passed, use 0 as actual value of arg_num. |
false.Requirements: 03.001.01
| nuxmv_expr nuxmv_make_parametric_op | ( | nuxmv_env | env, |
| nuxmv_op_tag | op, | ||
| const nuxmv_expr * | args, | ||
| size_t | arg_num, | ||
| const int * | params, | ||
| size_t | param_num | ||
| ) |
Create a structured parametric expression for an operator.
This function shall be used when one of the following operations is needed. Each operation takes one expression in args and a fixed number of parameters as params in the described order:
msb (≥ 0): the most significant bit (inclusive) of the selectionlsb (≤ msb): the least significant bit (inclusive) of the selectionwidth (> 0) of the result word expressionamount (≥ 0) of the extensionwidth (> 0) of the result word expressionFor all other operators, refer to nuxmv_make_op().
| [in] | env | The environment to modify. |
| [in] | op | The operation computed by the expression. |
| [in] | args | A list of arguments the operator requires as inputs. |
| [in] | arg_num | The number of arguments in the list. |
| [in] | params | A list of parameters the operator requires as inputs. |
| [in] | param_num | The number of parameters in the list. |
false.Requirements: 03.001.01
| nuxmv_expr nuxmv_make_un_op | ( | nuxmv_env | env, |
| nuxmv_op_tag | op, | ||
| nuxmv_expr | arg | ||
| ) |
Create a structured expression for a unary operator.
| [in] | env | The environment to modify. |
| [in] | op | The operation computed by the expression. |
| [in] | arg | The argument of the operator. |
false.Requirements: 03.001.01
| nuxmv_expr nuxmv_make_value | ( | nuxmv_env | env, |
| nuxmv_symbol | val, | ||
| nuxmv_expr_type | type | ||
| ) |
Create a new value for a symbol.
| [in] | env | The environment to modify. |
| [in] | val | The value for the symbol. |
| [in] | type | The type of the value. |
false.Requirements: 03.001.01
| int nuxmv_serialize_expr_to_string | ( | nuxmv_env | env, |
| nuxmv_expr | expr, | ||
| nuxmv_serialized_chunk_callback | callback, | ||
| void * | user_data, | ||
| char * | data, | ||
| size_t | data_size | ||
| ) |
Serialize a expr to a string.
The output is written to the provided buffer. When the serialization process fills up the buffer:
data_size is returned;The callback is responsible for handling the data chunk (e.g., copying it elsewhere). If the callback returns false, the process is aborted and the function returns the number of bytes written up to that point.
When the serialization process is completed successfully, the output buffer contains a null-terminated string and the callback is called, if any.
| [in] | env | The environment to inspect. |
| [in] | expr | The expr to serialize. |
| [in] | callback | Optional callback function invoked whenever the buffer is full or the serialization process is completed. |
| [in] | user_data | User-defined context passed to the callback. |
| [out] | data | The buffer where the serialized expr will be stored. |
| [in] | data_size | The size of the data buffer. |
data_size, if no callback is provided and the serialized expression was truncated;callback, if the callback eventually requests to stop;-1 in case of error.Requirements: 03.002
| nuxmv_expr nuxmv_simplify_expr | ( | nuxmv_env | env, |
| nuxmv_expr | expr | ||
| ) |
Simplify an expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to simplify. |
false.TODO: useful?? we need to understand if when building nuxmv expressions we are implicitly performing some simplifications (e.g. a conjunction containing a TRUE is stored as TRUE) See also issue #16.
Requirements: 03.001
| int nuxmv_visit_expr | ( | nuxmv_env | env, |
| nuxmv_expr | expr, | ||
| nuxmv_expr_visit_callback | callback, | ||
| nuxmv_expr_visit_order | order, | ||
| void * | user_data | ||
| ) |
Visit an expression.
| [in] | env | The environment to inspect. |
| [in] | expr | The expression to visit. |
| [in] | callback | A user-defined function which is called for each node that composes the given expression. |
| [in] | order | The order which the expression's nodes are traversed. |
| [in] | user_data | Any user-defined context data passed to the callback function as-is. |
1 if expression was visited completely, 0 if not, -1 in case of error.Requirements: 03.001