C Configuration Space and Tuning Library (CCS)
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions | Variables
expression.h File Reference

An expression in CCS is a combination of constants, variables (parameters), and operators. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ccs_user_defined_expression_vector_s
 A structure that define the callbacks the user must provide to create a user defined expression. More...
 

Typedefs

typedef enum ccs_expression_type_e ccs_expression_type_t
 A commodity type to represent an expression type.
 
typedef enum ccs_associativity_type_e ccs_associativity_type_t
 A commodity type to represent an associativity.
 
typedef enum ccs_terminal_type_e ccs_terminal_type_t
 A commodity type to represend CCS terminal types.
 
typedef struct ccs_user_defined_expression_vector_s ccs_user_defined_expression_vector_t
 a commodity type to represent a user defined expression callback vector.
 

Enumerations

enum  ccs_expression_type_e {
  CCS_EXPRESSION_TYPE_OR = 0 , CCS_EXPRESSION_TYPE_AND , CCS_EXPRESSION_TYPE_EQUAL , CCS_EXPRESSION_TYPE_NOT_EQUAL ,
  CCS_EXPRESSION_TYPE_LESS , CCS_EXPRESSION_TYPE_GREATER , CCS_EXPRESSION_TYPE_LESS_OR_EQUAL , CCS_EXPRESSION_TYPE_GREATER_OR_EQUAL ,
  CCS_EXPRESSION_TYPE_ADD , CCS_EXPRESSION_TYPE_SUBSTRACT , CCS_EXPRESSION_TYPE_MULTIPLY , CCS_EXPRESSION_TYPE_DIVIDE ,
  CCS_EXPRESSION_TYPE_MODULO , CCS_EXPRESSION_TYPE_POSITIVE , CCS_EXPRESSION_TYPE_NEGATIVE , CCS_EXPRESSION_TYPE_NOT ,
  CCS_EXPRESSION_TYPE_IN , CCS_EXPRESSION_TYPE_LIST , CCS_EXPRESSION_TYPE_LITERAL , CCS_EXPRESSION_TYPE_VARIABLE ,
  CCS_EXPRESSION_TYPE_USER_DEFINED , CCS_EXPRESSION_TYPE_MAX , CCS_EXPRESSION_FORCE_32BIT = INT32_MAX
}
 Supported expression types. More...
 
enum  ccs_associativity_type_e {
  CCS_ASSOCIATIVITY_TYPE_NONE = 0 , CCS_ASSOCIATIVITY_TYPE_LEFT_TO_RIGHT , CCS_ASSOCIATIVITY_TYPE_RIGHT_TO_LEFT , CCS_ASSOCIATIVITY_TYPE_MAX ,
  CCS_ASSOCIATIVITY_TYPE_FORCE_32BIT = INT32_MAX
}
 Associativity of CCS operators: More...
 
enum  ccs_terminal_type_e {
  CCS_TERMINAL_TYPE_NONE = 0 , CCS_TERMINAL_TYPE_TRUE , CCS_TERMINAL_TYPE_FALSE , CCS_TERMINAL_TYPE_STRING ,
  CCS_TERMINAL_TYPE_IDENTIFIER , CCS_TERMINAL_TYPE_INTEGER , CCS_TERMINAL_TYPE_FLOAT , CCS_TERMINAL_TYPE_MAX ,
  CCS_TERMINAL_FORCE_32BIT = INT32_MAX
}
 The different terminal types of ccs expressions. More...
 

Functions

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.
 
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.
 
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_create_literal (ccs_datum_t value, ccs_expression_t *expression_ret)
 Create a new literal expression.
 
ccs_result_t ccs_create_variable (ccs_parameter_t parameter, ccs_expression_t *expression_ret)
 Create a new variable expression.
 
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.
 
ccs_result_t ccs_expression_get_type (ccs_expression_t expression, ccs_expression_type_t *type_ret)
 Get the type of an expression.
 
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.
 
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_variable_get_parameter (ccs_expression_t expression, ccs_parameter_t *parameter_ret)
 Get the parameter of a variable expression.
 
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.
 
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.
 
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.
 
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 context parameters.
 
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_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.
 

Variables

const int ccs_expression_precedence []
 An array of precedence of operators as defined by CCS grammar:
 
const ccs_associativity_type_t ccs_expression_associativity []
 An array of associativity of operators as defined by CCS grammar:
 
const char * ccs_expression_symbols []
 An array of suggested symbols (NULL terminated strings) for CCS operators.
 
const int ccs_expression_arity []
 An array of arity of CCS operators.
 
const int ccs_terminal_precedence []
 An array of integers defining terminal precedence in order to disambiguate NONE, TRUE and FALSE from identifiers:
 
const char * ccs_terminal_regexp []
 An array of regexp that define terminals:
 
const char * ccs_terminal_symbols []
 An array of symbols (NULL terminated strings) for terminals that define them:
 

Detailed Description

An expression in CCS is a combination of constants, variables (parameters), and operators.

Expressions are usually evaluated in the context of a binding where parameters are associated values. For convinience CCS suggests a grammar that can be used to create an expression parser.

Enumeration Type Documentation

◆ ccs_associativity_type_e

Associativity of CCS operators:

Enumerator
CCS_ASSOCIATIVITY_TYPE_NONE 

No associativity.

CCS_ASSOCIATIVITY_TYPE_LEFT_TO_RIGHT 

left to right associativity

CCS_ASSOCIATIVITY_TYPE_RIGHT_TO_LEFT 

right to left associativity

CCS_ASSOCIATIVITY_TYPE_MAX 

Guard.

CCS_ASSOCIATIVITY_TYPE_FORCE_32BIT 

Try forcing 32 bits value for bindings.

◆ ccs_expression_type_e

Supported expression types.

Enumerator
CCS_EXPRESSION_TYPE_OR 

Or boolean operator.

CCS_EXPRESSION_TYPE_AND 

And boolean operator.

CCS_EXPRESSION_TYPE_EQUAL 

Equality test operator.

CCS_EXPRESSION_TYPE_NOT_EQUAL 

Inequality test operator.

CCS_EXPRESSION_TYPE_LESS 

Lesser than comparison operator.

CCS_EXPRESSION_TYPE_GREATER 

Greater than comparison operator.

CCS_EXPRESSION_TYPE_LESS_OR_EQUAL 

Lesser than or equal comparison operator.

CCS_EXPRESSION_TYPE_GREATER_OR_EQUAL 

Greater than or equal comparison operator.

CCS_EXPRESSION_TYPE_ADD 

Addition operator.

CCS_EXPRESSION_TYPE_SUBSTRACT 

Substraction operator.

CCS_EXPRESSION_TYPE_MULTIPLY 

Multiplication operator.

CCS_EXPRESSION_TYPE_DIVIDE 

Division operator.

CCS_EXPRESSION_TYPE_MODULO 

Modulo operator.

CCS_EXPRESSION_TYPE_POSITIVE 

Unary plus operator.

CCS_EXPRESSION_TYPE_NEGATIVE 

Unary minus operator.

CCS_EXPRESSION_TYPE_NOT 

Not boolean operator.

CCS_EXPRESSION_TYPE_IN 

List inclusion test operator.

CCS_EXPRESSION_TYPE_LIST 

List.

CCS_EXPRESSION_TYPE_LITERAL 

Literal constant.

CCS_EXPRESSION_TYPE_VARIABLE 

Variable.

CCS_EXPRESSION_TYPE_USER_DEFINED 

User defined.

CCS_EXPRESSION_TYPE_MAX 

Guard.

CCS_EXPRESSION_FORCE_32BIT 

Try forcing 32 bits value for bindings.

◆ ccs_terminal_type_e

The different terminal types of ccs expressions.

Enumerator
CCS_TERMINAL_TYPE_NONE 

The CCS_NONE_VAL value.

CCS_TERMINAL_TYPE_TRUE 

The CCS_TRUE_VAL value.

CCS_TERMINAL_TYPE_FALSE 

The CCS_FALSE_VAL value.

CCS_TERMINAL_TYPE_STRING 

A CCS_DATA_TYPE_STRING value.

CCS_TERMINAL_TYPE_IDENTIFIER 

An identifer (name of a parameter)

CCS_TERMINAL_TYPE_INTEGER 

A CCS_DATA_TYPE_INT value.

CCS_TERMINAL_TYPE_FLOAT 

A CCS_DATA_TYPE_FLOAT value.

CCS_TERMINAL_TYPE_MAX 

Guard.

CCS_TERMINAL_FORCE_32BIT 

Try forcing 32 bits value for bindings.

Function Documentation

◆ ccs_create_binary_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 
)
extern

Create a new binary expression.

Convenience wrapper around ccs_create_expression for binary operators.

Parameters
[in]typethe type of the expression
[in]node_leftleft child node
[in]node_rightright child node
[out]expression_reta pointer to the variable that will hold the newly created expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if type is not a valid CCS expression type; or if type arity is not 2; or if node_left or node_right are of type CCS_DATA_TYPE_OBJECT but are neither a CCS_OBJECT_TYPE_PARAMETER nor a CCS_OBJECT_TYPE_EXPRESSION; or if node_left or node_right are not of type CCS_DATA_TYPE_OBJECT, CCS_DATA_TYPE_NONE, CCS_DATA_TYPE_INT, CCS_DATA_TYPE_FLOAT, CCS_DATA_TYPE_BOOL, or CCS_DATA_TYPE_STRING; or if expression_ret is NULL
CCS_RESULT_ERROR_INVALID_OBJECT if node_left or node_right are of type CCS_DATA_TYPE_OBJECT but the object is not a valid CCS object
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was a lack of memory to allocate the new expression
Remarks
This function is thread-safe

◆ ccs_create_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 
)
extern

Create a new expression.

Parameters
[in]typethe type of the expression
[in]num_nodesthe number of the expression children nodes. Must be compatible with the arity of the expression
[in]nodesan array of num_nodes expressions
[out]expression_reta pointer to the variable that will hold the newly created expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if type is not a valid CCS expression type; or if num_nodes is not compatible with the arity of type; or if one the nodes given is of type CCS_DATA_TYPE_OBJECT but is neither a CCS_OBJECT_TYPE_PARAMETER nor a CCS_OBJECT_TYPE_EXPRESSION; or if one the nodes given node is not a type CCS_DATA_TYPE_OBJECT, CCS_DATA_TYPE_NONE, CCS_DATA_TYPE_INT, CCS_DATA_TYPE_FLOAT, CCS_DATA_TYPE_BOOL, or CCS_DATA_TYPE_STRING; or if expression_ret is NULL
CCS_RESULT_ERROR_INVALID_OBJECT if one the nodes given is of type CCS_DATA_TYPE_OBJECT but the object is not a valid CCS object
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was a lack of memory to allocate the new expression
Remarks
This function is thread-safe

◆ ccs_create_literal()

ccs_result_t ccs_create_literal ( ccs_datum_t  value,
ccs_expression_t expression_ret 
)
extern

Create a new literal expression.

Parameters
[in]valuethe value of the literal
[out]expression_reta pointer to the variable that will hold the newly created expression. If value is of type CCS_DATA_TYPE_STRING, the string value is memoized
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if value is not of type CCS_DATA_TYPE_NONE, CCS_DATA_TYPE_INT, CCS_DATA_TYPE_FLOAT, CCS_DATA_TYPE_BOOL, or CCS_DATA_TYPE_STRING; or if expression_ret is NULL
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was a lack of memory to allocate the new expression
Remarks
This function is thread-safe

◆ ccs_create_unary_expression()

ccs_result_t ccs_create_unary_expression ( ccs_expression_type_t  type,
ccs_datum_t  node,
ccs_expression_t expression_ret 
)
extern

Create a new unary expression.

Convenience wrapper around ccs_create_expression for unary expressions.

Parameters
[in]typethe type of the expression
[in]nodechild node
[out]expression_reta pointer to the variable that will hold the newly created expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if type is not a valid CCS expression type; or if type arity is not 1; or if node is of type CCS_DATA_TYPE_OBJECT but is neither a CCS_OBJECT_TYPE_PARAMETER nor a CCS_OBJECT_TYPE_EXPRESSION; or if node is not of type CCS_DATA_TYPE_OBJECT, CCS_DATA_TYPE_NONE, CCS_DATA_TYPE_INT, CCS_DATA_TYPE_FLOAT, CCS_DATA_TYPE_BOOL, or CCS_DATA_TYPE_STRING; or if expression_ret is NULL
CCS_RESULT_ERROR_INVALID_OBJECT if node is of type CCS_DATA_TYPE_OBJECT but the object is not a valid CCS object
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was a lack of memory to allocate the new expression
Remarks
This function is thread-safe

◆ ccs_create_user_defined_expression()

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 
)
extern

Create a new user defined expression.

Parameters
[in]namethe name of the expression
[in]num_nodesthe number of the expression children nodes. Must be compatible with the arity of the expression
[in]nodesan array of num_nodes expressions
[in]vectorthe vector of callbacks implementing the expression interface
[in]expression_dataa pointer to the expression internal data structures. Can be NULL
[out]expression_reta pointer to the variable that will hold the newly created expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if one the nodes given is of type CCS_DATA_TYPE_OBJECT but the object is not a valid CCS object
CCS_RESULT_ERROR_INVALID_VALUE if name is NULL; or if one the nodes given is of type CCS_DATA_TYPE_OBJECT but is neither a CCS_OBJECT_TYPE_PARAMETER nor a CCS_OBJECT_TYPE_EXPRESSION; or if one the nodes given node is not a type CCS_DATA_TYPE_OBJECT, CCS_DATA_TYPE_NONE, CCS_DATA_TYPE_INT, CCS_DATA_TYPE_FLOAT, CCS_DATA_TYPE_BOOL, or CCS_DATA_TYPE_STRING; or if expression_ret is NULL; or if vector is NULL; or if any non optional interface pointer is NULL
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was not enough memory to allocate the new expression instance
Remarks
This function is thread-safe

◆ ccs_create_variable()

ccs_result_t ccs_create_variable ( ccs_parameter_t  parameter,
ccs_expression_t expression_ret 
)
extern

Create a new variable expression.

Parameters
[in]parameterparameter to use as a variable
[out]expression_reta pointer to the variable that will hold the newly created expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if expression_ret is NULL
CCS_RESULT_ERROR_INVALID_OBJECT if parameter is not a valid CCS parameter
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was a lack of memory to allocate the new expression
Remarks
This function is thread-safe

◆ ccs_expression_check_contexts()

ccs_result_t ccs_expression_check_contexts ( ccs_expression_t  expression,
size_t  num_contexts,
ccs_context_t contexts 
)
extern

Validate that an expression can be evaluated in the given context.

Parameters
[in]expression
[in]num_contextsthe number of contexts in contexts
[in]contextsan array of num_contexts contexts
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression; or if one of the provided contexts in contexts is not a valid CCS context
CCS_RESULT_ERROR_INVALID_VALUE if the expression depends on a parameter and contexts is NULL
CCS_RESULT_ERROR_INVALID_PARAMETER if one of the parameters referenced by the expression cannot be found in at least one the contexts in contexts
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was not enough memory to allocate temporary storage
Remarks
This function is thread-safe

◆ ccs_expression_eval()

ccs_result_t ccs_expression_eval ( ccs_expression_t  expression,
size_t  num_bindings,
ccs_binding_t bindings,
ccs_datum_t result_ret 
)
extern

Get the value of an expression, in a given list of bindings.

Parameters
[in]expression
[in]num_bindingsthe number of bindings in bindings
[in]bindingsan array of num_bindings bindings
[out]result_reta pointer to a variable that will contain the result of the evaluation of the expression. Result can be ccs_inactive when the result depend on an inactive parameter
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS variable expression; of if one of the provided bindings is not a valid CCS binding; or if no binding is provided and expression must evaluate a variable
CCS_RESULT_ERROR_INVALID_PARAMETER if a parameter was not found in the provided bindings
CCS_RESULT_ERROR_INVALID_VALUE if result_ret is NULL; or if num_bindings is greater than 0 and bindings is NULL; or if an illegal arithmetic or comparison operation would have occurred; or if a non boolean value is used in a boolean operation
Remarks
This function is thread-safe

◆ ccs_expression_get_nodes()

ccs_result_t ccs_expression_get_nodes ( ccs_expression_t  expression,
size_t  num_nodes,
ccs_expression_t nodes,
size_t *  num_nodes_ret 
)
extern

Get the child nodes of an expression.

Parameters
[in]expression
[in]num_nodesthe size of the nodes array
[out]nodesan array of size num_nodes to hold the returned values or NULL. If the array is too big, extra values are set NULL
[out]num_nodes_reta pointer to a variable that will contain the number of nodes that are or would be returned. Can be NULL
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
CCS_RESULT_ERROR_INVALID_VALUE if nodes is NULL and num_nodes is greater than 0; or if nodes is NULL and num_nodes_ret is NULL; or if num_values is less than the number of values that would be returned
Remarks
This function is thread-safe

◆ ccs_expression_get_parameters()

ccs_result_t ccs_expression_get_parameters ( ccs_expression_t  expression,
size_t  num_parameters,
ccs_parameter_t parameters,
size_t *  num_parameters_ret 
)
extern

Get the parameters used in an expression.

Parameters
[in]expression
[in]num_parametersthe size of the parameters array
[in]parametersan array of size num_parameters to hold the returned values, or NULL. If the array is too big, extra values are set to NULL
[out]num_parameters_reta pointer to a variable that will contain the number of parameters that are or would be returned. Can be NULL
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
CCS_RESULT_ERROR_INVALID_VALUE if parameters is NULL and num_parameters is greater than 0; or if parameters is NULL and num_parameters_ret is NULL; or if num_parameters is less than the number of parameters that would be returned
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was not enough memory to allocate temporary storage
Remarks
This function is thread-safe

◆ ccs_expression_get_type()

ccs_result_t ccs_expression_get_type ( ccs_expression_t  expression,
ccs_expression_type_t type_ret 
)
extern

Get the type of an expression.

Parameters
[in]expression
[out]type_reta pointer to the variable that will contain the type of the expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if type_ret is NULL
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
Remarks
This function is thread-safe

◆ ccs_expression_list_eval_node()

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 
)
extern

Evaluate the entry of a list at a given index, in a given context, provided a list of values for the context parameters.

Parameters
[in]expression
[in]num_bindingsthe number of bindings in bindings
[in]bindingsan array of num_bindings bindings
[in]indexindex of the child node to evaluate
[out]result_reta pointer to a variable that will contain the result of the evaluation of the expression. Result can be ccs_inactive when the result depend on an inactive parameter
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS variable expression; of if one of the provided bindings is not a valid CCS binding; or if no binding is provided and expression must evaluate a variable
CCS_RESULT_ERROR_INVALID_EXPRESSION if expression is not a CCS_EXPRESSION_TYPE_LIST
CCS_RESULT_ERROR_OUT_OF_BOUNDS if index is greater than the number of child nodes in the list
CCS_RESULT_ERROR_INVALID_PARAMETER if a parameter was not found in the provided bindings
CCS_RESULT_ERROR_INVALID_VALUE if result_ret is NULL; or if num_bindings is greater than 0 and bindings is NULL; or if an illegal arithmetic or comparison operation would have occurred; or if a non boolean value is used in a boolean operation
Remarks
This function is thread-safe

◆ ccs_literal_get_value()

ccs_result_t ccs_literal_get_value ( ccs_expression_t  expression,
ccs_datum_t value_ret 
)
extern

Get the value of a literal expression.

Parameters
[in]expression
[out]value_reta pointer to a variable that will contain the value of the literal
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
CCS_RESULT_ERROR_INVALID_EXPRESSION if expression is not a CCS_EXPRESSION_TYPE_LITERAL
CCS_RESULT_ERROR_INVALID_VALUE if value_ret is NULL
Remarks
This function is thread-safe

◆ ccs_user_defined_expression_get_expression_data()

ccs_result_t ccs_user_defined_expression_get_expression_data ( ccs_expression_t  expression,
void **  expression_data_ret 
)
extern

Get the user defined expression internal data pointer.

Parameters
[in]expression
[out]expression_data_ret
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
CCS_RESULT_ERROR_INVALID_EXPRESSION if expression is not a user defined expression
CCS_RESULT_ERROR_INVALID_VALUE if expression_data_ret is NULL
Remarks
This function is thread-safe

◆ ccs_user_defined_expression_get_name()

ccs_result_t ccs_user_defined_expression_get_name ( ccs_expression_t  expression,
const char **  name_ret 
)
extern

Get the name of a user defined expression.

Parameters
[in]expression
[out]name_reta pointer to the variable that will contain a pointer to the name of the expression
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_VALUE if name_ret is NULL
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
CCS_RESULT_ERROR_INVALID_EXPRESSION if expression is not a user defined expression
Remarks
This function is thread-safe

◆ ccs_variable_get_parameter()

ccs_result_t ccs_variable_get_parameter ( ccs_expression_t  expression,
ccs_parameter_t parameter_ret 
)
extern

Get the parameter of a variable expression.

Parameters
[in]expression
[out]parameter_reta pointer to a variable that will contain the parameter
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if expression is not a valid CCS expression
CCS_RESULT_ERROR_INVALID_EXPRESSION if expression is not a CCS_EXPRESSION_TYPE_VARIABLE
CCS_RESULT_ERROR_INVALID_VALUE if parameter_ret is NULL
Remarks
This function is thread-safe

Variable Documentation

◆ ccs_expression_arity

const int ccs_expression_arity[]
extern

An array of arity of CCS operators.

  • 2: OR
  • 2: AND
  • 2: EQUAL, NOT_EQUAL
  • 2: LESS, GREATER, LESS_OR_EQUAL, GREATER_OR_EQUAL
  • 2: ADD, SUBSTRACT
  • 2: MULTIPLY, DIVIDE, MODULO
  • 1: POSITIVE, NEGATIVE, NOT
  • 2: IN
  • -1: LIST
  • 0: LITERAL, VARIABLE
  • -1: USER_DEFINED

◆ ccs_expression_associativity

const ccs_associativity_type_t ccs_expression_associativity[]
extern

An array of associativity of operators as defined by CCS grammar:

  • left: OR
  • left: AND
  • left: EQUAL, NOT_EQUAL
  • left: LESS, GREATER, LESS_OR_EQUAL, GREATER_OR_EQUAL
  • left: ADD, SUBSTRACT
  • left: MULTIPLY, DIVIDE, MODULO
  • right: POSITIVE, NEGATIVE, NOT
  • left: IN
  • left: LIST
  • none: LITERAL, VARIABLE, USER_DEFINED

◆ ccs_expression_precedence

const int ccs_expression_precedence[]
extern

An array of precedence of operators as defined by CCS grammar:

  • 0 : OR
  • 1 : AND
  • 2 : EQUAL, NOT_EQUAL
  • 3 : LESS, GREATER, LESS_OR_EQUAL, GREATER_OR_EQUAL
  • 4 : ADD, SUBSTRACT
  • 5 : MULTIPLY, DIVIDE, MODULO
  • 6 : POSITIVE, NEGATIVE, NOT
  • 7 : IN
  • max - 1: LIST
  • max : LITERAL, VARIABLE, USER_DEFINED

Those are similar to C's precedence

◆ ccs_expression_symbols

const char* ccs_expression_symbols[]
extern

An array of suggested symbols (NULL terminated strings) for CCS operators.

  • OR: ||
  • AND: &&
  • EQUAL: ==
  • NOT_EQUAL: !=
  • LESS: <
  • GREATER: >
  • LESS_OR_EQUAL: <=
  • GREATER_OR_EQUAL: >=
  • ADD: +
  • SUBSTRACT: -
  • MULTIPLY: *
  • DIVIDE: /
  • MODULO: %
  • POSITIVE: +
  • NEGATIVE: -
  • NOT: !
  • IN: #
  • LIST: NULL
  • LITERAL: NULL
  • VARIABLE: NULL
  • USER_DEFINED: NULL

◆ ccs_terminal_precedence

const int ccs_terminal_precedence[]
extern

An array of integers defining terminal precedence in order to disambiguate NONE, TRUE and FALSE from identifiers:

  • 0: STRING, IDENTIFIER, INTEGER, FLOAT
  • 1: NONE, TRUE, FALSE

◆ ccs_terminal_regexp

const char* ccs_terminal_regexp[]
extern

An array of regexp that define terminals:

  • NONE: /none/
  • TRUE: /true/
  • FALSE: /false/
  • STRING: /"([^\0\t\n\r\f"\\]|\\[0tnrf"\\])+"|'([^\0\t\n\r\f'\\]|\\[0tnrf'\\])+'/
  • IDENTIFIER: /[a-zA-Z_][a-zA-Z_0-9]/
  • INTEGER: /-?[0-9]+/
  • FLOAT: /-?[0-9]+([eE][+-]?[0-9]+|\.[0-9]+([eE][+-]?[0-9]+)?)/

◆ ccs_terminal_symbols

const char* ccs_terminal_symbols[]
extern

An array of symbols (NULL terminated strings) for terminals that define them:

  • NONE: "none"
  • TRUE: "true"
  • FALSE: "false"
  • STRING: NULL
  • IDENTIFIER: NULL
  • INTEGER: NULL
  • FLOAT: NULL