Defintion of all dynamic operations, including arithmetic, logical, relational, and bit-operations.
More...
|
trilean | dyn_op_neg (dyn_c *dyn) |
| Negate dynamic value in param dyn. More...
|
|
trilean | dyn_op_add (dyn_c *dyn1, dyn_c *dyn2) |
| Add dyn2 to dyn1. More...
|
|
trilean | dyn_op_sub (dyn_c *dyn1, dyn_c *dyn2) |
| Subtract dyn2 from dyn1. More...
|
|
trilean | dyn_op_mul (dyn_c *dyn1, dyn_c *dyn2) |
| Multiply dyn1 with dyn2. More...
|
|
trilean | dyn_op_div (dyn_c *dyn1, dyn_c *dyn2) |
| Divide dyn1 by dyn2. More...
|
|
trilean | dyn_op_mod (dyn_c *dyn1, dyn_c *dyn2) |
| dyn1 Modulo dyn2 More...
|
|
trilean | dyn_op_pow (dyn_c *dyn1, dyn_c *dyn2) |
| dyn1 to the power of dyn2 More...
|
|
trilean | dyn_op_and (dyn_c *dyn1, dyn_c *dyn2) |
| Logical (trinary) AND operation. More...
|
|
trilean | dyn_op_or (dyn_c *dyn1, dyn_c *dyn2) |
| Logical (trinary) OR operation. More...
|
|
trilean | dyn_op_xor (dyn_c *dyn1, dyn_c *dyn2) |
| Logical (trinary) XOR operation. More...
|
|
trilean | dyn_op_not (dyn_c *dyn) |
| Logical (trinary) Negation. More...
|
|
trilean | dyn_op_id (dyn_c *dyn1, dyn_c *dyn2) |
| Type and Value Equality. More...
|
|
trilean | dyn_op_eq (dyn_c *dyn1, dyn_c *dyn2) |
| Relational Equality. More...
|
|
trilean | dyn_op_ne (dyn_c *dyn1, dyn_c *dyn2) |
| Relational Not Equal. More...
|
|
trilean | dyn_op_lt (dyn_c *dyn1, dyn_c *dyn2) |
| Relational Less Than. More...
|
|
trilean | dyn_op_le (dyn_c *dyn1, dyn_c *dyn2) |
| Relational Less Than or Equal. More...
|
|
trilean | dyn_op_gt (dyn_c *dyn1, dyn_c *dyn2) |
| Relational Greater Than. More...
|
|
trilean | dyn_op_ge (dyn_c *dyn1, dyn_c *dyn2) |
| Relational Greater Than or Equal. More...
|
|
trilean | dyn_op_in (dyn_c *element, dyn_c *container) |
| Check if dyn2 is element of dyn1. More...
|
|
trilean | dyn_op_b_not (dyn_c *dyn) |
| Binary complement.
|
|
trilean | dyn_op_b_and (dyn_c *dyn1, dyn_c *dyn2) |
| Binary AND.
|
|
trilean | dyn_op_b_or (dyn_c *dyn1, dyn_c *dyn2) |
| Binary OR.
|
|
trilean | dyn_op_b_xor (dyn_c *dyn1, dyn_c *dyn2) |
| Binary XOR.
|
|
trilean | dyn_op_b_shift_l (dyn_c *dyn1, dyn_c *dyn2) |
| Binary shift left.
|
|
trilean | dyn_op_b_shift_r (dyn_c *dyn1, dyn_c *dyn2) |
| Binary shift right.
|
|
Defintion of all dynamic operations, including arithmetic, logical, relational, and bit-operations.
These functions cover all basic operations, which are common for most programming languages. In principle most operations known from Python are offered with a similar behavior, but with two differences. Dynamic operations evaluate a result based on the data type with the highes priority and not on the basis of left-hand and right-hand parameters. That means, for dynple (see the defintion of every function):
dyn_op_add([1,2,3],
"test string") == [1,2,3,
"test string"]
dyn_op_add(
"test string", [1,2,3]) == [
"test string",1,2,3]
dyn_op_div(9, 3.0) == 3.0
The result is always stored and returned within the first parameter passed to an operator function. If this parameter is a dynamic reference of TYPE REFERENCE or REFERENCE2, then a new element is created, the original element remains. If the operation was performed without any error, then DYN_TRUE is returned by every function of that module, otherwise DYN_FALSE.
A second characteristic of the operations applied is that a trinary logical system is applied to simplify error-handling amongst other benefits. Trinary means that next to the two boolean values DYN_TRUE and DYN_FALSE, the NONE type is used to represent another unknown or undefined state. The benefit is, that comparing two distinct dynamic types such as a list and a string with less than or greater than results in that unknown/undefined state and not in an error. This trinary logical system is also perfect for applying logical operations, see therefor the corresponding logical functions.
- See also
- https://en.wikipedia.org/wiki/Three-valued_logic
◆ dyn_op_add()
Add dyn2 to dyn1.
The add operation shows generates different results according to the input data types. The resulting type is defined by the highest type, see the following list for allowed operations:
dyn_1 | dyn_2 | result type |
BOOL | BOOL | BOOL |
INTEGER | BOOL | INTEGER |
BOOL | INTEGER | INTEGER |
INTEGER | INTEGER | INTEGER |
FLOAT | BOOL | FLOAT |
BOOL | FLOAT | FLOAT |
FLOAT | INTEGER | FLOAT |
INTEGER | FLOAT | FLOAT |
FLOAT | FLOAT | FLOAT |
STRING | (NUMERIC) | STRING (concatenaited) "abc123" |
(NUMERIC) | STRING | STRING (concatenaited) "123abc" |
STRING | STRING | STRING (concatenaited) "abcabc" |
LIST | ... | LIST [, ...] |
... | LIST | LIST [... ,] |
SET | ... | SET {, ...} (unique elements only) |
... | SET | SET {, ...} (unique elements only) |
DICT | DICT | DICT {with all elements} |
- Parameters
-
[in,out] | dyn1 | in- and output parameter |
[in] | dyn2 | input parameter |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data type |
DYN_FALSE | otherwise |
Definition at line 124 of file dynamic_op.c.
126 CHECK_REFERENCE(dyn1, dyn2)
132 switch (max_type(dyn1, dyn2)) {
148 tmp.data.
str[0]=
'\0';
dyn_float dyn_get_float(const dyn_c *dyn)
Return float value of a dynamic element.
dictionary of type dyn_dict
dyn_ushort dyn_strlen(dyn_const_str str)
Returns the length of an string.
dyn_c * dyn_dict_insert(dyn_c *dict, dyn_const_str key, dyn_c *value)
Insert a new key-value pair into the dictionary.
trilean dyn_list_insert(dyn_c *list, dyn_c *element, const dyn_ushort i)
Insert a new element at the ith position into a list.
#define DYN_LIST_LEN(dyn)
Return list length.
dyn_int dyn_get_int(const dyn_c *dyn)
Return integer value of a dynamic element.
trilean dyn_set_insert(dyn_c *set, dyn_c *element)
Insert new element into set, if and only if it is not included yet.
trilean dyn_copy(const dyn_c *dyn, dyn_c *copy)
Deep copy dynamic element.
#define DYN_INIT(dyn)
Mandatory initialization for dynamic elements (NONE)
#define DYN_LIST_GET_REF(dyn, i)
Return the reference to the ith element within a dynamic list.
Boolean 0==False, 1==True.
#define DYN_DICT_GET_I_REF(dyn, i)
Return a reference to the ith element stored within a dictionary.
#define DYN_DICT_GET_I_KEY(dyn, i)
Return a reference to the ith key stored within a dictionary.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
#define DYN_DICT_LEN(dyn)
Return number of elements within a dictionary.
uint16_t dyn_ushort
16bit unsigned integer
void dyn_string_add(const dyn_c *dyn, dyn_str string)
Add string representation of dynamic element to string.
void dyn_move(dyn_c *from, dyn_c *to)
Move dynamic element to new reference, from is of type NONE afterwards.
void dyn_set_float(dyn_c *dyn, const dyn_float v)
Set dynamic element to FLOAT.
dyn_ushort dyn_string_len(const dyn_c *dyn)
Calculate length of string representation of dynamic element.
dyn_c * dyn_list_push(dyn_c *list, const dyn_c *element)
Push new element to the end of a list.
void dyn_free(dyn_c *dyn)
free allocated memory
char * dyn_str
Standard dynamic C string.
void dyn_set_int(dyn_c *dyn, const dyn_int v)
Set dynamic element to INTEGER.
dyn_str str
pointer to character-array
Basic container for dynamic data types.
◆ dyn_op_and()
Logical (trinary) AND operation.
As depicted in the truth table below, this function performes the standard boolean AND operation, the extention with the None boolean type does not affect this operation. The truth value of every dynamic element is generated with the help of function dyn_get_bool_3.
AND | True | False | None |
True | True | False | None |
False | False | False | False |
None | None | False | None |
The result of this operation is stored within the first parameter dyn1, if this value is a reference, then a new value is created, otherwise the original value gets overwritten.
- See also
- dyn_get_bool_3
-
dyn_get_bool
- Parameters
-
[out] | dyn1 | in- and output dynamic element |
[in] | dyn2 | second operand |
- Returns
- DYN_TRUE, operation can be applied on every combination of dynamic data types
Definition at line 542 of file dynamic_op.c.
represents a third unknown state, which is not true or false
char dyn_char
Basic 8bit signed integer.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
trilean dyn_get_bool_3(const dyn_c *dyn)
Returns the trinary truth value (DYN_TRUE|DYN_FALSE|DYN_NONE) of an element.
void dyn_free(dyn_c *dyn)
free allocated memory
◆ dyn_op_div()
Divide dyn1 by dyn2.
Dividing is only performed onto NUMERIC values, for all other values DYN_FALSE gets returned.
- Parameters
-
[in,out] | dyn1 | in- and output parameter |
[in] | dyn2 | input parameter |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data types |
DYN_FALSE | otherwise |
Definition at line 356 of file dynamic_op.c.
358 CHECK_REFERENCE(dyn1, dyn2)
361 switch (max_type(dyn1, dyn2)) {
dyn_float dyn_get_float(const dyn_c *dyn)
Return float value of a dynamic element.
dyn_int dyn_get_int(const dyn_c *dyn)
Return integer value of a dynamic element.
Boolean 0==False, 1==True.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
void dyn_set_float(dyn_c *dyn, const dyn_float v)
Set dynamic element to FLOAT.
void dyn_free(dyn_c *dyn)
free allocated memory
void dyn_set_int(dyn_c *dyn, const dyn_int v)
Set dynamic element to INTEGER.
◆ dyn_op_eq()
Relational Equality.
- Parameters
-
[in,out] | dyn1 | in and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 850 of file dynamic_op.c.
Referenced by dyn_op_id().
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
dyn_char dyn_op_cmp(dyn_c *dyn1, dyn_c *dyn2)
Common compare function for dynamic elements.
◆ dyn_op_ge()
Relational Greater Than or Equal.
- Parameters
-
[in,out] | dyn1 | in and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 898 of file dynamic_op.c.
trilean dyn_op_not(dyn_c *dyn)
Logical (trinary) Negation.
trilean dyn_op_lt(dyn_c *dyn1, dyn_c *dyn2)
Relational Less Than.
◆ dyn_op_gt()
Relational Greater Than.
- Parameters
-
[in,out] | dyn1 | in and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 912 of file dynamic_op.c.
Referenced by dyn_op_le().
char dyn_char
Basic 8bit signed integer.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
void dyn_free(dyn_c *dyn)
free allocated memory
dyn_char dyn_op_cmp(dyn_c *dyn1, dyn_c *dyn2)
Common compare function for dynamic elements.
◆ dyn_op_id()
Type and Value Equality.
- Parameters
-
[in,out] | dyn1 | in and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 834 of file dynamic_op.c.
dyn_c * ref
reference pointer to dynamic elements
#define DYN_IS_REFERENCE(dyn)
Check if dynamic element is of type REFERENCE.
trilean dyn_op_eq(dyn_c *dyn1, dyn_c *dyn2)
Relational Equality.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
◆ dyn_op_in()
Check if dyn2 is element of dyn1.
Can only be applied if the container is of type LIST, SET, or DICT.
- Parameters
-
[in,out] | in | and output parameter |
[in] | dyn2 | exponent value |
- Return values
-
DYN_TRUE | if the operation could be applied |
DYN_FALSE | otherwise |
Definition at line 949 of file dynamic_op.c.
Referenced by dyn_set_insert().
954 container = container->data.
ref;
dyn_c * ref
reference pointer to dynamic elements
dictionary of type dyn_dict
#define DYN_IS_REFERENCE(dyn)
Check if dynamic element is of type REFERENCE.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
void dyn_free(dyn_c *dyn)
free allocated memory
Basic container for dynamic data types.
◆ dyn_op_le()
Relational Less Than or Equal.
- Parameters
-
[in,out] | dyn1 | in- and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 932 of file dynamic_op.c.
trilean dyn_op_not(dyn_c *dyn)
Logical (trinary) Negation.
trilean dyn_op_gt(dyn_c *dyn1, dyn_c *dyn2)
Relational Greater Than.
◆ dyn_op_lt()
Relational Less Than.
- Parameters
-
[in,out] | dyn1 | in and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 878 of file dynamic_op.c.
Referenced by dyn_op_ge().
char dyn_char
Basic 8bit signed integer.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
void dyn_free(dyn_c *dyn)
free allocated memory
dyn_char dyn_op_cmp(dyn_c *dyn1, dyn_c *dyn2)
Common compare function for dynamic elements.
◆ dyn_op_mod()
dyn1 Modulo dyn2
Modulo can only be performed onto NUMERIC values, if these are of type FLOAT then they are casted to INTEGER, such that the result is always of type INTEGER.
- Parameters
-
[in,out] | dyn1 | in- and output(INTEGER) parameter |
[in] | dyn2 | input parameter |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data types |
DYN_FALSE | otherwise |
Definition at line 388 of file dynamic_op.c.
390 CHECK_REFERENCE(dyn1, dyn2)
395 if ( (t1 && t2) && t1 <=
FLOAT && t2 <=
FLOAT ) {
dyn_int dyn_get_int(const dyn_c *dyn)
Return integer value of a dynamic element.
char dyn_char
Basic 8bit signed integer.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
void dyn_free(dyn_c *dyn)
free allocated memory
void dyn_set_int(dyn_c *dyn, const dyn_int v)
Set dynamic element to INTEGER.
◆ dyn_op_mul()
Multiply dyn1 with dyn2.
Multiplication generates different results according to the input data types. For NUMERIC and NUMERIC data types the common arithmetic multiplication gets applied and for the combination of: (LIST|STRING) * NUMERIC or NUMERIC * (LIST|STRING) results in a repeated string or repeated list, multiplication with ZERO generates an empty LIST or STRING, negative values are not allowed.
- Parameters
-
[in,out] | dyn1 | in- and output parameter |
[in] | dyn2 | input parameter |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data types or values |
DYN_FALSE | otherwise |
Definition at line 271 of file dynamic_op.c.
273 CHECK_REFERENCE(dyn1, dyn2)
276 switch (max_type(dyn1, dyn2)) {
296 dyn1->data.
str = (
dyn_str) realloc(dyn1->data.
str, len * i + 1);
301 for(j=0; j<len; ++j) {
302 *c++ = dyn1->data.
str[j];
328 for (m=1; m<
i; ++m) {
329 for (n=0; n<len; n++)
dyn_float dyn_get_float(const dyn_c *dyn)
Return float value of a dynamic element.
dyn_ushort dyn_strlen(dyn_const_str str)
Returns the length of an string.
#define DYN_LIST_LEN(dyn)
Return list length.
dyn_int dyn_get_int(const dyn_c *dyn)
Return integer value of a dynamic element.
trilean dyn_set_string(dyn_c *dyn, dyn_const_str v)
Set dynamic element to STRING.
trilean dyn_copy(const dyn_c *dyn, dyn_c *copy)
Deep copy dynamic element.
#define DYN_LIST_GET_REF(dyn, i)
Return the reference to the ith element within a dynamic list.
Boolean 0==False, 1==True.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
uint16_t dyn_ushort
16bit unsigned integer
void dyn_set_float(dyn_c *dyn, const dyn_float v)
Set dynamic element to FLOAT.
dyn_c * dyn_list_push(dyn_c *list, const dyn_c *element)
Push new element to the end of a list.
void dyn_free(dyn_c *dyn)
free allocated memory
trilean dyn_list_resize(dyn_c *list, const dyn_ushort size)
Change the maximal space of a list.
char * dyn_str
Standard dynamic C string.
void dyn_set_int(dyn_c *dyn, const dyn_int v)
Set dynamic element to INTEGER.
trilean dyn_set_list_len(dyn_c *dyn, dyn_ushort len)
Set dynamic element to list with maximal length.
dyn_str str
pointer to character-array
◆ dyn_op_ne()
Relational Not Equal.
- Parameters
-
[in,out] | dyn1 | in and output parameter |
[in] | dyn2 | exponent value |
- Returns
- DYN_TRUE, can be performed onto any combination of types
Definition at line 864 of file dynamic_op.c.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
dyn_char dyn_op_cmp(dyn_c *dyn1, dyn_c *dyn2)
Common compare function for dynamic elements.
◆ dyn_op_neg()
Negate dynamic value in param dyn.
The negation operation is only be applied onto numeric or boolean/trilean data types. For all other types the result of dyn is set to type NONE.
- Parameters
-
dyn | in- and output dynamic element |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data type |
DYN_FALSE | otherwise |
Definition at line 72 of file dynamic_op.c.
74 CHECK_COPY_REFERENCE(dyn)
77 case NONE:
goto LABEL_OK;
78 case BOOL: dyn->data.
b = !dyn->data.
b;
82 case FLOAT: dyn->data.
f = -dyn->data.
f;
Boolean 0==False, 1==True.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
None type without any value.
void dyn_free(dyn_c *dyn)
free allocated memory
◆ dyn_op_not()
Logical (trinary) Negation.
As depicted in the truth table below, this function performes the standard boolean NOT operation, the extention with the None boolean type does not affect this operation. The truth value of every dynamic element is generated with the help of function dyn_get_bool_3.
NOT | True | False | None |
NOT | False | True | None |
The result of this operation is stored within the first parameter dyn1, if this value is a reference, then a new value is created, otherwise the original value gets overwritten.
- See also
- dyn_get_bool_3
-
dyn_get_bool
- Parameters
-
[out] | dyn | in- and output dynamic element |
- Returns
- DYN_TRUE, operation can be applied on every combination of dynamic data types
Definition at line 658 of file dynamic_op.c.
Referenced by dyn_op_ge(), and dyn_op_le().
660 CHECK_COPY_REFERENCE(dyn)
#define DYN_NOT_NONE(dyn)
Check if dynamic element is not of type NONE.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
trilean dyn_get_bool_3(const dyn_c *dyn)
Returns the trinary truth value (DYN_TRUE|DYN_FALSE|DYN_NONE) of an element.
◆ dyn_op_or()
Logical (trinary) OR operation.
As depicted in the truth table below, this function performes the standard boolean OR operation, the extention with the None boolean type does not affect this operation. The truth value of every dynamic element is generated with the help of function dyn_get_bool_3.
OR | True | False | None |
True | True | True | True |
False | True | False | None |
None | True | None | None |
The result of this operation is stored within the first parameter dyn1, if this value is a reference, then a new value is created, otherwise the original value gets overwritten.
- See also
- dyn_get_bool_3
-
dyn_get_bool
- Parameters
-
[out] | dyn1 | in- and output dynamic element |
[in] | dyn2 | second operand |
- Returns
- DYN_TRUE, operation can be applied on every combination of dynamic data types
Definition at line 582 of file dynamic_op.c.
represents a third unknown state, which is not true or false
char dyn_char
Basic 8bit signed integer.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
trilean dyn_get_bool_3(const dyn_c *dyn)
Returns the trinary truth value (DYN_TRUE|DYN_FALSE|DYN_NONE) of an element.
void dyn_free(dyn_c *dyn)
free allocated memory
◆ dyn_op_pow()
dyn1 to the power of dyn2
Power function is only applied onto NUMERIC values less than FLOAT, in case of a FLOAT value the system pow function gets applied or in case of the usage of an embedded system, fast_approx_pow algorithm is applied.
- Parameters
-
[in,out] | dyn1 | base value and result value |
[in] | dyn2 | exponent value |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data types |
DYN_FALSE | otherwise |
Definition at line 453 of file dynamic_op.c.
455 CHECK_REFERENCE(dyn1, dyn2)
475 dyn1->data.
i *= base;
480 dyn1->data.
f /= base;
487 dyn1->data.
f *= base;
491 dyn1->data.
f /= base;
int32_t dyn_int
32bit signed integer, standard Integer type.
dyn_float dyn_get_float(const dyn_c *dyn)
Return float value of a dynamic element.
dyn_int dyn_get_int(const dyn_c *dyn)
Return integer value of a dynamic element.
#define DYN_IS_NONE(dyn)
Check if dynamic element is of type NONE.
float fast_approx_pow(float x, float p)
Power function approximation x^y.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
void dyn_set_float(dyn_c *dyn, const dyn_float v)
Set dynamic element to FLOAT.
float dyn_float
basic float definition (32 bit)
void dyn_free(dyn_c *dyn)
free allocated memory
◆ dyn_op_sub()
Subtract dyn2 from dyn1.
The subtract operation shows generates different results according to the input data types. Subtraction is allowed on numeric values and onto sets, where the second parameter defines the element/set that shoult be subtracted from the other set.
- Parameters
-
[in,out] | dyn1 | in- and output parameter |
[in] | dyn2 | input parameter |
- Return values
-
DYN_TRUE | if operation could be applied onto the input data types |
DYN_FALSE | otherwise |
Definition at line 211 of file dynamic_op.c.
213 CHECK_REFERENCE(dyn1, dyn2)
216 switch (max_type(dyn1, dyn2)) {
232 pos = search(dyn1, dyn2);
240 pos = search(dyn1, &tmp);
dyn_float dyn_get_float(const dyn_c *dyn)
Return float value of a dynamic element.
trilean dyn_list_remove(dyn_c *list, dyn_ushort i)
Delete the ith element from a list.
#define DYN_LIST_LEN(dyn)
Return list length.
dyn_int dyn_get_int(const dyn_c *dyn)
Return integer value of a dynamic element.
trilean dyn_copy(const dyn_c *dyn, dyn_c *copy)
Deep copy dynamic element.
#define DYN_INIT(dyn)
Mandatory initialization for dynamic elements (NONE)
#define DYN_LIST_GET_REF(dyn, i)
Return the reference to the ith element within a dynamic list.
Boolean 0==False, 1==True.
#define DYN_TYPE(dyn)
Return type value of a dynamic element.
uint16_t dyn_ushort
16bit unsigned integer
void dyn_move(dyn_c *from, dyn_c *to)
Move dynamic element to new reference, from is of type NONE afterwards.
void dyn_set_float(dyn_c *dyn, const dyn_float v)
Set dynamic element to FLOAT.
void dyn_free(dyn_c *dyn)
free allocated memory
void dyn_set_int(dyn_c *dyn, const dyn_int v)
Set dynamic element to INTEGER.
Basic container for dynamic data types.
◆ dyn_op_xor()
Logical (trinary) XOR operation.
As depicted in the truth table below, this function performes the standard boolean XOR operation, the extention with the None boolean type does not affect this operation. The truth value of every dynamic element is generated with the help of function dyn_get_bool_3.
XOR | True | False | None |
True | False | True | None |
False | True | False | None |
None | None | None | None |
The result of this operation is stored within the first parameter dyn1, if this value is a reference, then a new value is created, otherwise the original value gets overwritten.
- See also
- dyn_get_bool_3
-
dyn_get_bool
- Parameters
-
[out] | dyn1 | in- and output dynamic element |
[in] | dyn2 | second operand |
- Returns
- DYN_TRUE, operation can be applied on every combination of dynamic data types
Definition at line 623 of file dynamic_op.c.
represents a third unknown state, which is not true or false
char dyn_char
Basic 8bit signed integer.
void dyn_set_bool(dyn_c *dyn, const dyn_char v)
Set dynamic element to BOOL (DYN_TRUE or DYN_FALSE)
trilean dyn_get_bool_3(const dyn_c *dyn)
Returns the trinary truth value (DYN_TRUE|DYN_FALSE|DYN_NONE) of an element.
void dyn_free(dyn_c *dyn)
free allocated memory