C Configuration Space and Tuning Library (CCS)
Loading...
Searching...
No Matches
expression.h
Go to the documentation of this file.
1#ifndef _CCS_CONDITION_H
2#define _CCS_CONDITION_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
67
72
88extern const int ccs_expression_precedence[];
89
105
110
125
150extern const char *ccs_expression_symbols[];
151
166extern const int ccs_expression_arity[];
167
191
196
203extern const int ccs_terminal_precedence[];
204
216extern const char *ccs_terminal_regexp[];
217
228extern const char *ccs_terminal_symbols[];
229
254extern ccs_result_t
257 size_t num_nodes,
258 ccs_datum_t *nodes,
259 ccs_expression_t *expression_ret);
260
285extern ccs_result_t
288 ccs_datum_t node_left,
289 ccs_datum_t node_right,
290 ccs_expression_t *expression_ret);
291
314extern ccs_result_t
317 ccs_datum_t node,
318 ccs_expression_t *expression_ret);
319
336extern ccs_result_t
338
353extern ccs_result_t
355
366
371 ccs_expression_t expression,
372 size_t num_values,
373 ccs_datum_t *values,
374 ccs_datum_t *value_ret);
375
380 ccs_expression_t expression,
381 size_t sate_size,
382 void *state,
383 size_t *state_size_ret);
384
389 size_t state_size,
390 const void *state,
391 void **expression_data_ret);
392};
393
399
427extern ccs_result_t
429 const char *name,
430 size_t num_nodes,
431 ccs_datum_t *nodes,
433 void *expression_data,
434 ccs_expression_t *expression_ret);
435
448extern ccs_result_t
450 ccs_expression_t expression,
451 ccs_expression_type_t *type_ret);
452
471extern ccs_result_t
473 ccs_expression_t expression,
474 size_t num_nodes,
475 ccs_expression_t *nodes,
476 size_t *num_nodes_ret);
477
492extern ccs_result_t
494
509extern ccs_result_t
511 ccs_expression_t expression,
512 ccs_parameter_t *parameter_ret);
513
528extern ccs_result_t
530 ccs_expression_t expression,
531 const char **name_ret);
532
546extern ccs_result_t
548 ccs_expression_t expression,
549 void **expression_data_ret);
550
574extern ccs_result_t
576 ccs_expression_t expression,
577 size_t num_bindings,
578 ccs_binding_t *bindings,
579 ccs_datum_t *result_ret);
580
610extern ccs_result_t
612 ccs_expression_t expression,
613 size_t num_bindings,
614 ccs_binding_t *bindings,
615 size_t index,
616 ccs_datum_t *result_ret);
617
640extern ccs_result_t
642 ccs_expression_t expression,
643 size_t num_parameters,
644 ccs_parameter_t *parameters,
645 size_t *num_parameters_ret);
646
666extern ccs_result_t
668 ccs_expression_t expression,
669 size_t num_contexts,
670 ccs_context_t *contexts);
671#ifdef __cplusplus
672}
673#endif
674
675#endif //_CCS_CONDITION_H
struct _ccs_expression_s * ccs_expression_t
An opaque type defining a CCS expression.
Definition base.h:99
struct _ccs_binding_s * ccs_binding_t
An opaque type defining a CCS binding.
Definition base.h:119
struct _ccs_parameter_s * ccs_parameter_t
An opaque type defining a CCS parameter.
Definition base.h:95
struct _ccs_context_s * ccs_context_t
An opaque type defining a CCS context.
Definition base.h:103
enum ccs_result_e ccs_result_t
A commodity type to represent CCS errors and returned by most functions.
Definition base.h:247
ccs_result_t ccs_expression_list_eval_node(ccs_expression_t expression, size_t num_bindings, ccs_binding_t *bindings, size_t index, ccs_datum_t *result_ret)
Evaluate the entry of a list at a given index, in a given context, provided a list of values for the ...
ccs_result_t ccs_literal_get_value(ccs_expression_t expression, ccs_datum_t *value_ret)
Get the value of a literal expression.
ccs_result_t ccs_create_binary_expression(ccs_expression_type_t type, ccs_datum_t node_left, ccs_datum_t node_right, ccs_expression_t *expression_ret)
Create a new binary expression.
const int ccs_expression_arity[]
An array of arity of CCS operators.
ccs_result_t ccs_expression_get_type(ccs_expression_t expression, ccs_expression_type_t *type_ret)
Get the type of an expression.
enum ccs_terminal_type_e ccs_terminal_type_t
A commodity type to represend CCS terminal types.
Definition expression.h:195
ccs_result_t ccs_expression_get_nodes(ccs_expression_t expression, size_t num_nodes, ccs_expression_t *nodes, size_t *num_nodes_ret)
Get the child nodes of an expression.
const char * ccs_expression_symbols[]
An array of suggested symbols (NULL terminated strings) for CCS operators.
ccs_result_t ccs_expression_get_parameters(ccs_expression_t expression, size_t num_parameters, ccs_parameter_t *parameters, size_t *num_parameters_ret)
Get the parameters used in an expression.
ccs_result_t ccs_create_expression(ccs_expression_type_t type, size_t num_nodes, ccs_datum_t *nodes, ccs_expression_t *expression_ret)
Create a new expression.
enum ccs_associativity_type_e ccs_associativity_type_t
A commodity type to represent an associativity.
Definition expression.h:109
ccs_result_t ccs_create_variable(ccs_parameter_t parameter, ccs_expression_t *expression_ret)
Create a new variable expression.
const char * ccs_terminal_regexp[]
An array of regexp that define terminals:
ccs_result_t ccs_create_unary_expression(ccs_expression_type_t type, ccs_datum_t node, ccs_expression_t *expression_ret)
Create a new unary expression.
ccs_result_t ccs_variable_get_parameter(ccs_expression_t expression, ccs_parameter_t *parameter_ret)
Get the parameter of a variable expression.
ccs_result_t ccs_expression_eval(ccs_expression_t expression, size_t num_bindings, ccs_binding_t *bindings, ccs_datum_t *result_ret)
Get the value of an expression, in a given list of bindings.
const char * ccs_terminal_symbols[]
An array of symbols (NULL terminated strings) for terminals that define them:
ccs_result_t ccs_create_literal(ccs_datum_t value, ccs_expression_t *expression_ret)
Create a new literal expression.
const int ccs_expression_precedence[]
An array of precedence of operators as defined by CCS grammar:
ccs_expression_type_e
Supported expression types.
Definition expression.h:19
@ CCS_EXPRESSION_TYPE_LESS_OR_EQUAL
Lesser than or equal comparison operator.
Definition expression.h:33
@ CCS_EXPRESSION_FORCE_32BIT
Try forcing 32 bits value for bindings.
Definition expression.h:65
@ CCS_EXPRESSION_TYPE_NOT
Not boolean operator.
Definition expression.h:51
@ CCS_EXPRESSION_TYPE_MODULO
Modulo operator.
Definition expression.h:45
@ CCS_EXPRESSION_TYPE_MAX
Guard.
Definition expression.h:63
@ CCS_EXPRESSION_TYPE_NEGATIVE
Unary minus operator.
Definition expression.h:49
@ CCS_EXPRESSION_TYPE_EQUAL
Equality test operator.
Definition expression.h:25
@ CCS_EXPRESSION_TYPE_LITERAL
Literal constant.
Definition expression.h:57
@ CCS_EXPRESSION_TYPE_DIVIDE
Division operator.
Definition expression.h:43
@ CCS_EXPRESSION_TYPE_NOT_EQUAL
Inequality test operator.
Definition expression.h:27
@ CCS_EXPRESSION_TYPE_MULTIPLY
Multiplication operator.
Definition expression.h:41
@ CCS_EXPRESSION_TYPE_IN
List inclusion test operator.
Definition expression.h:53
@ CCS_EXPRESSION_TYPE_GREATER_OR_EQUAL
Greater than or equal comparison operator.
Definition expression.h:35
@ CCS_EXPRESSION_TYPE_AND
And boolean operator.
Definition expression.h:23
@ CCS_EXPRESSION_TYPE_OR
Or boolean operator.
Definition expression.h:21
@ CCS_EXPRESSION_TYPE_ADD
Addition operator.
Definition expression.h:37
@ CCS_EXPRESSION_TYPE_POSITIVE
Unary plus operator.
Definition expression.h:47
@ CCS_EXPRESSION_TYPE_LESS
Lesser than comparison operator.
Definition expression.h:29
@ CCS_EXPRESSION_TYPE_SUBSTRACT
Substraction operator.
Definition expression.h:39
@ CCS_EXPRESSION_TYPE_VARIABLE
Variable.
Definition expression.h:59
@ CCS_EXPRESSION_TYPE_GREATER
Greater than comparison operator.
Definition expression.h:31
@ CCS_EXPRESSION_TYPE_LIST
List.
Definition expression.h:55
@ CCS_EXPRESSION_TYPE_USER_DEFINED
User defined.
Definition expression.h:61
ccs_associativity_type_e
Associativity of CCS operators:
Definition expression.h:93
@ CCS_ASSOCIATIVITY_TYPE_LEFT_TO_RIGHT
left to right associativity
Definition expression.h:97
@ CCS_ASSOCIATIVITY_TYPE_NONE
No associativity.
Definition expression.h:95
@ CCS_ASSOCIATIVITY_TYPE_MAX
Guard.
Definition expression.h:101
@ CCS_ASSOCIATIVITY_TYPE_RIGHT_TO_LEFT
right to left associativity
Definition expression.h:99
@ CCS_ASSOCIATIVITY_TYPE_FORCE_32BIT
Try forcing 32 bits value for bindings.
Definition expression.h:103
ccs_result_t ccs_user_defined_expression_get_name(ccs_expression_t expression, const char **name_ret)
Get the name of a user defined expression.
const int ccs_terminal_precedence[]
An array of integers defining terminal precedence in order to disambiguate NONE, TRUE and FALSE from ...
ccs_result_t ccs_user_defined_expression_get_expression_data(ccs_expression_t expression, void **expression_data_ret)
Get the user defined expression internal data pointer.
enum ccs_expression_type_e ccs_expression_type_t
A commodity type to represent an expression type.
Definition expression.h:71
ccs_result_t ccs_expression_check_contexts(ccs_expression_t expression, size_t num_contexts, ccs_context_t *contexts)
Validate that an expression can be evaluated in the given context.
const ccs_associativity_type_t ccs_expression_associativity[]
An array of associativity of operators as defined by CCS grammar:
ccs_terminal_type_e
The different terminal types of ccs expressions.
Definition expression.h:171
@ CCS_TERMINAL_TYPE_IDENTIFIER
An identifer (name of a parameter)
Definition expression.h:181
@ CCS_TERMINAL_TYPE_TRUE
The CCS_TRUE_VAL value.
Definition expression.h:175
@ CCS_TERMINAL_TYPE_STRING
A CCS_DATA_TYPE_STRING value.
Definition expression.h:179
@ CCS_TERMINAL_TYPE_NONE
The CCS_NONE_VAL value.
Definition expression.h:173
@ CCS_TERMINAL_TYPE_MAX
Guard.
Definition expression.h:187
@ CCS_TERMINAL_TYPE_FALSE
The CCS_FALSE_VAL value.
Definition expression.h:177
@ CCS_TERMINAL_TYPE_FLOAT
A CCS_DATA_TYPE_FLOAT value.
Definition expression.h:185
@ CCS_TERMINAL_TYPE_INTEGER
A CCS_DATA_TYPE_INT value.
Definition expression.h:183
@ CCS_TERMINAL_FORCE_32BIT
Try forcing 32 bits value for bindings.
Definition expression.h:189
ccs_result_t ccs_create_user_defined_expression(const char *name, size_t num_nodes, ccs_datum_t *nodes, ccs_user_defined_expression_vector_t *vector, void *expression_data, ccs_expression_t *expression_ret)
Create a new user defined expression.
A Structure containing a CCS datum.
Definition base.h:494
A structure that define the callbacks the user must provide to create a user defined expression.
Definition expression.h:360
ccs_result_t(* eval)(ccs_expression_t expression, size_t num_values, ccs_datum_t *values, ccs_datum_t *value_ret)
The expression evaluation interface.
Definition expression.h:370
ccs_result_t(* serialize_user_state)(ccs_expression_t expression, size_t sate_size, void *state, size_t *state_size_ret)
The expression serialization interface, can be NULL.
Definition expression.h:379
ccs_result_t(* deserialize_state)(size_t state_size, const void *state, void **expression_data_ret)
The expression deserialization interface, can be NULL.
Definition expression.h:388
ccs_result_t(* del)(ccs_expression_t expression)
The deletion callback that will be called once the reference count of the expression reaches 0.
Definition expression.h:365