Adaptive Framework
0.9.0
|
Files | |
file | afw_value.h |
Adaptive Framework header for adaptive values. | |
Data Structures | |
struct | afw_value_info_s |
Filled in by afw_value get_info method. More... | |
struct | afw_value_evaluated_s |
Struct to access internal of all evaluated values. More... | |
struct | afw_value_function_parameter_s |
Struct for adaptive function parameter. More... | |
struct | afw_value_function_definition_s |
Struct for function value. More... | |
Macros | |
#define | afw_value_undefined NULL |
An undefined value is represented by c NULL. More... | |
#define | afw_value_for_boolean(variable) |
Value for boolean variable. More... | |
#define | AFW_VALUE_UNDECORATE(a_value) |
Undecorated value in place. More... | |
#define | afw_value_is_nullish(A_VALUE) |
Determine if value is undefined or null. More... | |
#define | afw_value_is_undefined(A_VALUE) (!A_VALUE) |
Determine if value is undefined. More... | |
#define | AFW_VALUE_TYPE_ID(A_VALUE) &(A_VALUE)->inf->rti.implementation_id |
Macro to return value implementation id of a value. More... | |
#define | afw_value_is_annotated(A_VALUE) |
Macro to determine if value is an annotated. More... | |
#define | afw_value_is_defined_and_evaluated(A_VALUE) |
Macro to determine if value is defined and evaluated. More... | |
#define | afw_value_is_undefined_or_evaluated(A_VALUE) |
Macro to determine if value is undefined or evaluated. More... | |
#define | afw_value_is_assignment_target(A_VALUE) |
Macro to determine if value is an assignment target. More... | |
#define | afw_value_is_block(A_VALUE) |
Macro to determine if value is a block. More... | |
#define | afw_value_is_call(A_VALUE) |
Macro to determine if value is a call. More... | |
#define | afw_value_is_call_built_in_function(A_VALUE) |
Macro to determine if value is a call_built_in_function. More... | |
#define | afw_value_is_any_call(A_VALUE) |
Macro to determine if value is a call. More... | |
#define | afw_value_is_compiled_value(A_VALUE) |
Macro to determine if value is a compiled value. More... | |
#define | afw_value_is_expression_definition(A_VALUE) |
Macro to determine if value is an expression definition. More... | |
#define | afw_value_is_function_definition(A_VALUE) |
Macro to determine if value is a function definition. More... | |
#define | afw_value_is_function_thunk(A_VALUE) |
Macro to determine if value is a function thunk. More... | |
#define | afw_value_is_list_expression(A_VALUE) |
Macro to determine if value is a list expression. More... | |
#define | afw_value_is_object_expression(A_VALUE) |
Macro to determine if value is an object expression. More... | |
#define | afw_value_is_script_function(A_VALUE) |
Macro to determine if value is lambda definition. More... | |
#define | afw_value_is_qualified_variable_reference(A_VALUE) |
Macro to determine if value is a qualified variable reference. More... | |
#define | afw_value_is_reference_by_key(A_VALUE) |
Macro to determine if value is a access property by index. More... | |
#define | afw_value_is_template_definition(A_VALUE) |
Macro to determine if value is a template definition. More... | |
#define | afw_value_is_variable_reference(A_VALUE) |
Macro to determine if value is a variable reference. More... | |
#define | AFW_VALUE_ASSERT_IS(A_VALUE, A_TYPE_ID, A_SCOPE) |
Throw and error if A_VALUE is not value inf id. More... | |
#define | afw_value_quick_data_type(A_VALUE) ((A_VALUE)->inf->data_type) |
Get the easily accessible data type for a value. More... | |
#define | afw_value_get_quick_data_type_id(A_VALUE) |
Get the easily accessible data type id for a value. More... | |
#define | AFW_VALUE_IS_DATA_TYPE(A_VALUE, A_DATA_TYPE) |
Test that the value in A_VALUE is an evaluated data type A_DATA_TYPE. More... | |
#define | AFW_VALUE_ASSERT_IS_DATA_TYPE(A_VALUE, A_DATA_TYPE, A_SCOPE) |
Throw and error if A_VALUE is not evaluated data type A_DATA_TYPE. More... | |
#define | AFW_VALUE_ASSERT_IS_ANYURI_OR_STRING(A_VALUE, A_SCOPE) |
Throw and error if A_VALUE is not anyURI or string. More... | |
#define | afw_value_evaluate(value, p, xctx) |
Evaluate value if needed using specific pool. More... | |
#define | AFW_VALUE_INTERNAL(_VALUE_) ((void *)(&((afw_value_evaluated_t *)(_VALUE_))->internal)) |
Macro to get const void * of the internal of a value. More... | |
#define | AFW_VALUE_DATA_TYPES_EQUAL(value1, value2, xctx) |
Assert that the data type of two adaptive values is the same. More... | |
#define | AFW_VALUE_ASSERT_DATA_TYPES_EQUAL(value1, value2, xctx) |
Assert that the data type of two adaptive values is the same. More... | |
#define | afw_value_is_true(A_VALUE) |
Determine if value is boolean true. More... | |
#define | afw_value_function_thunk_create(name, like_function_value, execute, ctx, p, xctx) |
Create a function thunk value. More... | |
Functions | |
const afw_value_t * | afw_value_undecorate (const afw_value_t *value) |
Return undecorated value. More... | |
afw_boolean_t | afw_value_undecorated_inf_is (const afw_value_t *value, const afw_value_inf_t *inf) |
Determine if value's undecorated inf is the supplied one. More... | |
afw_boolean_t | afw_value_is_scalar (const afw_value_t *value, afw_xctx_t *xctx) |
Determine if value is scalar. More... | |
afw_boolean_t | afw_value_is_fully_evaluated (const afw_value_t *value, afw_xctx_t *xctx) |
Determine if value and all of it contained values are evaluated. More... | |
afw_boolean_t | afw_value_equal (const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx) |
Test whether two values are equal. More... | |
int | afw_value_compare (const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx) |
Compare two evaluated values. More... | |
afw_boolean_t | afw_value_contains (const afw_value_t *value, const afw_value_t *substring, afw_xctx_t *xctx) |
Check to see if a value contains a substring. More... | |
const afw_value_t * | afw_value_compile (const afw_value_t *value, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx) |
Compile a value. More... | |
const afw_value_t * | afw_value_compile_as (const afw_value_t *value, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx) |
Compile a value using specified compile type. More... | |
const afw_value_t * | afw_value_compile_and_evaluate (const afw_value_t *value, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx) |
Compile and evaluate a value. More... | |
const afw_value_t * | afw_value_compile_and_evaluate_as (const afw_value_t *value, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx) |
Compile and evaluate a value using specified compile type. More... | |
const afw_value_t * | afw_value_evaluate_with_additional_untrusted_qualified_variables (const afw_value_t *value, const afw_value_t *untrusted_qualified_variables, const afw_pool_t *p, afw_xctx_t *xctx) |
Evaluate a value with additional insecure context. More... | |
const afw_value_t * | afw_value_convert (const afw_value_t *value, const afw_data_type_t *to_data_type, afw_boolean_t required, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert a value to a value/data type. More... | |
const afw_value_t * | afw_value_convert_to_string (const afw_value_t *value, afw_boolean_t allow_undefined, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert a value to a string value. More... | |
const afw_utf8_z_t * | afw_value_as_utf8_z (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_value_t * | afw_value_one_and_only (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Return value from one entry list or single value. More... | |
const afw_utf8_t * | afw_value_one_and_only_as_utf8 (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Return result of afw_value_one_and_only() as utf8. More... | |
const afw_utf8_t * | afw_value_as_utf8 (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_utf8_t * | afw_value_as_casted_utf8 (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert value to casted utf8 in specified pool. More... | |
const afw_value_t * | afw_value_clone (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Clone a value to specified pool. More... | |
afw_value_annotated_t * | afw_value_annotation_allocate (const afw_pool_t *p, afw_xctx_t *xctx) |
Allocate function for annotation value. More... | |
const afw_value_t * | afw_value_annotated_create (const afw_compile_value_contextual_t *contextual, const afw_value_t *value, const afw_object_t *annotation, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for annotated value. More... | |
const afw_value_t * | afw_value_assignment_target_create (const afw_compile_value_contextual_t *contextual, const afw_compile_assignment_target_t *assignment_target, const afw_pool_t *p, afw_xctx_t *xctx) |
Create assignment target value. More... | |
const afw_value_block_t * | afw_value_block_allocated_and_link (const afw_compile_value_contextual_t *contextual, afw_value_compiled_value_t *compiled_value, afw_size_t *block_count, const afw_pool_t *p, afw_xctx_t *xctx) |
Create and link a new block. More... | |
const afw_value_t * | afw_value_block_finalize (const afw_value_block_t *block, afw_size_t argc, const afw_value_t *const *argv, afw_xctx_t *xctx) |
Create and link a new block. More... | |
afw_value_evaluated_t * | afw_value_evaluated_allocate (const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx) |
Allocate function for an evaluated data type value. More... | |
const afw_value_t * | afw_value_evaluated_create (const void *value, const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for an evaluated data type value. More... | |
const afw_value_t * | afw_value_call_create (const afw_compile_value_contextual_t *contextual, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for call value. More... | |
const afw_value_t * | afw_value_call_built_in_function_create (const afw_compile_value_contextual_t *contextual, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for call_built_in_function value. More... | |
const afw_value_t * | afw_value_expression_definition_create (const afw_compile_value_contextual_t *contextual, const afw_value_assignment_t *const *assignments, const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for expression definition value. More... | |
const afw_value_t * | afw_value_function_thunk_create_impl (const afw_utf8_t *name, const afw_value_t *like_function_value, afw_function_thunk_execute_t execute, void *ctx, const afw_utf8_z_t *source_z, const afw_pool_t *p, afw_xctx_t *xctx) |
Create a function thunk value. More... | |
const afw_value_t * | afw_value_script_function_definition_create (const afw_compile_value_contextual_t *contextual, const afw_value_type_t *returns, afw_size_t count, const afw_value_script_function_parameter_t **parameters, const afw_value_t *body, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for lambda definition value. More... | |
afw_value_create_list_expression (const afw_compile_value_contextual_t *contextual, const afw_value_t *internal, const afw_pool_t *p, afw_xctx_t *xctx) | |
Create function for list expression value. More... | |
afw_value_create_object_expression (const afw_compile_value_contextual_t *contextual, const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx) | |
Create function for object expression value. More... | |
const afw_value_t * | afw_value_qualified_variable_reference_create (const afw_compile_value_contextual_t *contextual, const afw_utf8_t *qualifier, const afw_utf8_t *name, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for variable reference value. More... | |
const afw_value_t * | afw_value_reference_by_key_create (const afw_compile_value_contextual_t *contextual, const afw_value_t *aggregate_value, const afw_value_t *key, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for reference_by_key value. More... | |
const afw_value_t * | afw_value_template_definition_create (const afw_compile_value_contextual_t *contextual, afw_size_t count, const afw_value_t *const *values, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for template definition value. More... | |
const afw_value_t * | afw_value_variable_reference_create (const afw_compile_value_contextual_t *contextual, const afw_value_block_symbol_t *symbol, const afw_pool_t *p, afw_xctx_t *xctx) |
Create function for variable reference value. More... | |
const afw_value_t * | afw_value_make_single_string (const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_value_t * | afw_value_make_string_copy (const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_value_t * | afw_value_create_string_from_u8z (const afw_utf8_z_t *string_z, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_value_t * | afw_value_string_from_internal (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_value_t * | afw_value_create_dateTime_now_utc (const afw_pool_t *p, afw_xctx_t *xctx) |
Create a dateTime value with current time. More... | |
const afw_value_t * | afw_value_create_dateTime_now_local (const afw_pool_t *p, afw_xctx_t *xctx) |
Create a dateTime value with current local time. More... | |
const afw_value_t *const * | afw_value_as_array_of_values (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Return a NULL terminated list of values in a specified pool. More... | |
const afw_utf8_t *const * | afw_value_as_array_of_utf8 (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Return a NULL terminated list of utf8 in a specified pool. More... | |
afw_value_compiler_listing_to_string (const afw_value_t *value, const afw_utf8_t *tab, const afw_pool_t *p, afw_xctx_t *xctx) | |
Decompile a value to a compiler listing string. More... | |
const afw_utf8_t * | afw_value_decompile_to_string (const afw_value_t *value, const afw_utf8_t *tab, const afw_pool_t *p, afw_xctx_t *xctx) |
Decompile a value to a string. More... | |
afw_value_decompile_call_args (const afw_writer_t *writer, afw_size_t first_arg, const afw_value_call_args_t *args, afw_xctx_t *xctx) | |
Decompile call args. More... | |
afw_value_decompile_value (const afw_value_t *instance, const afw_writer_t *writer, afw_xctx_t *xctx) | |
Decompile Value::. More... | |
void | afw_value_register_core_value_infs (afw_xctx_t *xctx) |
Adaptive Framework Value
#define AFW_VALUE_ASSERT_DATA_TYPES_EQUAL | ( | value1, | |
value2, | |||
xctx | |||
) |
Assert that the data type of two adaptive values is the same.
value1 | is an adaptive value. |
value2 | is an adaptive value. |
xctx | of caller |
Definition at line 879 of file afw_value.h.
#define AFW_VALUE_ASSERT_IS | ( | A_VALUE, | |
A_TYPE_ID, | |||
A_SCOPE | |||
) |
Throw and error if A_VALUE is not value inf id.
Definition at line 726 of file afw_value.h.
#define AFW_VALUE_ASSERT_IS_ANYURI_OR_STRING | ( | A_VALUE, | |
A_SCOPE | |||
) |
Throw and error if A_VALUE is not anyURI or string.
Definition at line 777 of file afw_value.h.
#define AFW_VALUE_ASSERT_IS_DATA_TYPE | ( | A_VALUE, | |
A_DATA_TYPE, | |||
A_SCOPE | |||
) |
Throw and error if A_VALUE is not evaluated data type A_DATA_TYPE.
Definition at line 768 of file afw_value.h.
#define AFW_VALUE_DATA_TYPES_EQUAL | ( | value1, | |
value2, | |||
xctx | |||
) |
Assert that the data type of two adaptive values is the same.
value1 | is an adaptive value. |
value2 | is an adaptive value. |
xctx | of caller |
Definition at line 867 of file afw_value.h.
#define afw_value_evaluate | ( | value, | |
p, | |||
xctx | |||
) |
Evaluate value if needed using specific pool.
value | to evaluate. |
p | to use. |
xctx | of caller. |
If value is undefined or there is not a optional_evaluate(), the value passed returned asis.
Definition at line 841 of file afw_value.h.
#define afw_value_for_boolean | ( | variable | ) |
Value for boolean variable.
variable |
Definition at line 363 of file afw_value.h.
#define afw_value_function_thunk_create | ( | name, | |
like_function_value, | |||
execute, | |||
ctx, | |||
p, | |||
xctx | |||
) |
Create a function thunk value.
name | to be associated with thunk. |
like_function_value | for thunk. |
execute | is function to call. |
ctx | to pass to execute. |
p | pool used for value. |
xctx | of caller. |
Definition at line 1338 of file afw_value.h.
#define afw_value_get_quick_data_type_id | ( | A_VALUE | ) |
Get the easily accessible data type id for a value.
value | This will return the data type id of value if inf->data_type is not NULL. This will be available for all evaluated values and some other values. If the data type id is not available, "unknown" is returned. |
Definition at line 751 of file afw_value.h.
#define AFW_VALUE_INTERNAL | ( | _VALUE_ | ) | ((void *)(&((afw_value_evaluated_t *)(_VALUE_))->internal)) |
Macro to get const void * of the internal of a value.
value | internal must align with afw_value_evaluated_t *. |
This should be used with extreme care. The intended is to access internal of an evaluated value.
Definition at line 856 of file afw_value.h.
#define afw_value_is_annotated | ( | A_VALUE | ) |
Macro to determine if value is an annotated.
A_VALUE | to test. |
Definition at line 468 of file afw_value.h.
#define afw_value_is_any_call | ( | A_VALUE | ) |
Macro to determine if value is a call.
A_VALUE | to test. |
Definition at line 572 of file afw_value.h.
#define afw_value_is_assignment_target | ( | A_VALUE | ) |
Macro to determine if value is an assignment target.
A_VALUE | to test. |
Definition at line 520 of file afw_value.h.
#define afw_value_is_block | ( | A_VALUE | ) |
Macro to determine if value is a block.
A_VALUE | to test. |
Definition at line 533 of file afw_value.h.
#define afw_value_is_call | ( | A_VALUE | ) |
Macro to determine if value is a call.
A_VALUE | to test. |
Definition at line 546 of file afw_value.h.
#define afw_value_is_call_built_in_function | ( | A_VALUE | ) |
Macro to determine if value is a call_built_in_function.
A_VALUE | to test. |
Definition at line 559 of file afw_value.h.
#define afw_value_is_compiled_value | ( | A_VALUE | ) |
Macro to determine if value is a compiled value.
A_VALUE | to test. |
Definition at line 588 of file afw_value.h.
#define AFW_VALUE_IS_DATA_TYPE | ( | A_VALUE, | |
A_DATA_TYPE | |||
) |
Test that the value in A_VALUE is an evaluated data type A_DATA_TYPE.
Definition at line 759 of file afw_value.h.
#define afw_value_is_defined_and_evaluated | ( | A_VALUE | ) |
Macro to determine if value is defined and evaluated.
A_VALUE | to test. |
Definition at line 481 of file afw_value.h.
#define afw_value_is_expression_definition | ( | A_VALUE | ) |
Macro to determine if value is an expression definition.
A_VALUE | to test. |
Definition at line 601 of file afw_value.h.
#define afw_value_is_function_definition | ( | A_VALUE | ) |
Macro to determine if value is a function definition.
A_VALUE | to test. |
Definition at line 614 of file afw_value.h.
#define afw_value_is_function_thunk | ( | A_VALUE | ) |
Macro to determine if value is a function thunk.
A_VALUE | to test. |
Definition at line 627 of file afw_value.h.
#define afw_value_is_list_expression | ( | A_VALUE | ) |
Macro to determine if value is a list expression.
A_VALUE | to test. |
Definition at line 640 of file afw_value.h.
#define afw_value_is_nullish | ( | A_VALUE | ) |
Determine if value is undefined or null.
value | to test. |
xctx | of caller. |
NOTE: Undefined values are represented by c NULL which is different from an adaptive null value.
Definition at line 422 of file afw_value.h.
#define afw_value_is_object_expression | ( | A_VALUE | ) |
Macro to determine if value is an object expression.
A_VALUE | to test. |
Definition at line 653 of file afw_value.h.
#define afw_value_is_qualified_variable_reference | ( | A_VALUE | ) |
Macro to determine if value is a qualified variable reference.
A_VALUE | to test. |
Definition at line 679 of file afw_value.h.
#define afw_value_is_reference_by_key | ( | A_VALUE | ) |
Macro to determine if value is a access property by index.
A_VALUE | to test. |
Definition at line 692 of file afw_value.h.
#define afw_value_is_script_function | ( | A_VALUE | ) |
Macro to determine if value is lambda definition.
A_VALUE | to test. |
Definition at line 666 of file afw_value.h.
#define afw_value_is_template_definition | ( | A_VALUE | ) |
Macro to determine if value is a template definition.
A_VALUE | to test. |
Definition at line 705 of file afw_value.h.
#define afw_value_is_true | ( | A_VALUE | ) |
Determine if value is boolean true.
value | to test. |
xctx | of caller. |
Definition at line 893 of file afw_value.h.
#define afw_value_is_undefined | ( | A_VALUE | ) | (!A_VALUE) |
Determine if value is undefined.
value | to test. |
xctx | of caller. |
NOTE: Undefined values are represented by c NULL.
Definition at line 438 of file afw_value.h.
#define afw_value_is_undefined_or_evaluated | ( | A_VALUE | ) |
Macro to determine if value is undefined or evaluated.
A_VALUE | to test. |
Definition at line 494 of file afw_value.h.
#define afw_value_is_variable_reference | ( | A_VALUE | ) |
Macro to determine if value is a variable reference.
A_VALUE | to test. |
Definition at line 718 of file afw_value.h.
#define afw_value_quick_data_type | ( | A_VALUE | ) | ((A_VALUE)->inf->data_type) |
Get the easily accessible data type for a value.
value |
This will return the data type of value if inf->data_type is not NULL. This will be available for all evaluated values and some other values.
Definition at line 739 of file afw_value.h.
#define AFW_VALUE_TYPE_ID | ( | A_VALUE | ) | &(A_VALUE)->inf->rti.implementation_id |
Macro to return value implementation id of a value.
A_VALUE | to test. |
Definition at line 458 of file afw_value.h.
#define AFW_VALUE_UNDECORATE | ( | a_value | ) |
Undecorated value in place.
value | to undecorate. |
A value "decoration" is annotation and compile_unit values.
Definition at line 375 of file afw_value.h.
#define afw_value_undefined NULL |
An undefined value is represented by c NULL.
Undefined values are represented by c NULL. Throughout source NULL and undefined are used interchangeably.
Definition at line 330 of file afw_value.h.
const afw_value_t* afw_value_annotated_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_value_t * | value, | ||
const afw_object_t * | annotation, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for annotated value.
contextual | information for annotation. |
value | (afw_value_t *). |
annotation | object. |
p | pool used for value. |
xctx | of caller. |
Definition at line 51 of file afw_value_annotated.c.
afw_value_annotated_t* afw_value_annotation_allocate | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx | ||
) |
Allocate function for annotation value.
p | pool used for value. |
xctx | of caller. |
Definition at line 35 of file afw_value_annotated.c.
const afw_utf8_t* const* afw_value_as_array_of_utf8 | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Return a NULL terminated list of utf8 in a specified pool.
value. | |
p | to use for returned value. |
xctx | of caller. |
Definition at line 827 of file afw_value.c.
const afw_value_t* const* afw_value_as_array_of_values | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Return a NULL terminated list of values in a specified pool.
value. | |
p | to use for returned value. |
xctx | of caller. |
Definition at line 817 of file afw_value.c.
const afw_utf8_t* afw_value_as_casted_utf8 | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert value to casted utf8 in specified pool.
value | to convert. |
p | is pool to use for result. |
xctx | of caller. |
Convert value to a utf8 string that is of the form:
<datatype>("<string>")
Where <datatype>
is the data type of value and <string>
is the quoted string representation of the value.
For list values the result if "list(" followed by comma separated result of recursively calling this function, followed by ")".
Definition at line 334 of file afw_value.c.
const afw_utf8_t* afw_value_as_utf8 | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert value->value to afw_utf8_t *. Must be an evaluated value or list with exactly one entry
Pool p will be used for result.
Definition at line 456 of file afw_value.c.
const afw_utf8_z_t* afw_value_as_utf8_z | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert value->value to afw_utf8_z_t *. Must be evaluated list with exactly one entry or single value. Value can not contain x'00' bytes.
Pool p will be used for result.
Definition at line 315 of file afw_value.c.
const afw_value_t* afw_value_assignment_target_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_compile_assignment_target_t * | assignment_target, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create assignment target value.
contextual | information for assignment target. |
assignment_target | (see afw_compile_internal.h). |
p | pool used for value. |
xctx | of caller. |
Definition at line 51 of file afw_value_assignment_target.c.
const afw_value_block_t* afw_value_block_allocated_and_link | ( | const afw_compile_value_contextual_t * | contextual, |
afw_value_compiled_value_t * | compiled_value, | ||
afw_size_t * | block_count, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create and link a new block.
compiled_value | to link block in. |
block_count | address to increment. |
p | pool used for value. |
xctx | of caller. |
Definition at line 969 of file afw_value_block.c.
const afw_value_t* afw_value_block_finalize | ( | const afw_value_block_t * | block, |
afw_size_t | argc, | ||
const afw_value_t *const * | argv, | ||
afw_xctx_t * | xctx | ||
) |
Create and link a new block.
block | value to set statements in. |
argc | is number of statements. |
argv | is array of statements. |
xctx | of caller. |
Definition at line 1023 of file afw_value_block.c.
const afw_value_t* afw_value_call_built_in_function_create | ( | const afw_compile_value_contextual_t * | contextual, |
afw_size_t | argc, | ||
const afw_value_t *const * | argv, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for call_built_in_function value.
contextual | information for function call. |
argc | number of arguments (does not include argv[0]). |
argv | list of argument value pointers. argv[0] must be function definition value. |
p | pool used for value. |
xctx | of caller. |
Call this function instead of afw_value_call_create() when it's know that argv[0] is a function definition to save a small amount of evaluation time.
Definition at line 39 of file afw_value_call_built_in_function.c.
const afw_value_t* afw_value_call_create | ( | const afw_compile_value_contextual_t * | contextual, |
afw_size_t | argc, | ||
const afw_value_t *const * | argv, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for call value.
contextual | information for function call. |
argc | number of arguments (does not include argv[0]). |
argv | list of argument value pointers. argv[0] must be function value. |
p | pool used for value. |
xctx | of caller. |
The value can be a lambda definition (afw_value_script_function_definition_t *), built-in function definition (afw_value_function_definition_t *) or function thunk (afw_value_function_thunk_t *)
Definition at line 172 of file afw_value_call.c.
const afw_value_t* afw_value_clone | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Clone a value to specified pool.
value | to clone. |
p | pool used for clone. |
xctx | of caller. |
Only evaluated values are supported.
Definition at line 282 of file afw_value.c.
int afw_value_compare | ( | const afw_value_t * | value1, |
const afw_value_t * | value2, | ||
afw_xctx_t * | xctx | ||
) |
Compare two evaluated values.
value1 | |
value2 | |
xctx | of caller. |
Values must be evaluated and the same data type or an error is thrown.
Definition at line 893 of file afw_value.c.
const afw_value_t* afw_value_compile | ( | const afw_value_t * | value, |
const afw_utf8_t * | source_location, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Compile a value.
value | must be a type that can be compiled |
source_location | to associate with compiled value or NULL. |
p | to use for result. |
xctx | of caller. |
Definition at line 74 of file afw_value.c.
const afw_value_t* afw_value_compile_and_evaluate | ( | const afw_value_t * | value, |
const afw_utf8_t * | source_location, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Compile and evaluate a value.
value | must be a type that can be compiled |
source_location | to associate with compiled string or NULL. |
compile_type. | |
p | to use for result. |
xctx | of caller. |
Definition at line 145 of file afw_value.c.
const afw_value_t* afw_value_compile_and_evaluate_as | ( | const afw_value_t * | value, |
const afw_utf8_t * | source_location, | ||
afw_compile_type_t | compile_type, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Compile and evaluate a value using specified compile type.
value | can be type appropriate for compile_type or string. |
source_location | to associate with compiled string or NULL. |
compile_type. | |
p | to use for result. |
xctx | of caller. |
Definition at line 165 of file afw_value.c.
const afw_value_t* afw_value_compile_as | ( | const afw_value_t * | value, |
const afw_utf8_t * | source_location, | ||
afw_compile_type_t | compile_type, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Compile a value using specified compile type.
value | can be type appropriate for compile_type or string. |
source_location | to associate with compiled value or NULL. |
compile_type | (set afw_compile_type_t) |
p | to use for result. |
xctx | of caller. |
Definition at line 104 of file afw_value.c.
afw_value_compiler_listing_to_string | ( | const afw_value_t * | value, |
const afw_utf8_t * | tab, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Decompile a value to a compiler listing string.
value | to decompile. |
tab | if not NULL, adds and the tab string for readability. |
p | for result. |
xctx | of caller. |
Definition at line 594 of file afw_value_compiler_listing.c.
afw_boolean_t afw_value_contains | ( | const afw_value_t * | value, |
const afw_value_t * | substring, | ||
afw_xctx_t * | xctx | ||
) |
Check to see if a value contains a substring.
value | to check. |
substring | to check. |
xctx | of caller. |
Value must be an evaluated value that has a cType of afw_utf8_t.
Definition at line 931 of file afw_value.c.
const afw_value_t* afw_value_convert | ( | const afw_value_t * | value, |
const afw_data_type_t * | to_data_type, | ||
afw_boolean_t | required, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert a value to a value/data type.
value | to evaluate and convert, if needed. |
to_data_type. | |
required | if false returns NULL if value is NULL. |
p | to hold converted value. |
xctx | of caller. |
An undefined error is thrown if value is NULL and required is true.
Definition at line 584 of file afw_value.c.
const afw_value_t* afw_value_convert_to_string | ( | const afw_value_t * | value, |
afw_boolean_t | allow_undefined, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert a value to a string value.
value | to evaluate and convert, if needed. |
allow_undefined | if true returns '<undefined>" if value is NULL. |
p | to hold converted value. |
xctx | of caller. |
An undefined error is thrown if result will be NULL and allow_undefined is false.
Definition at line 688 of file afw_value.c.
const afw_value_t* afw_value_create_dateTime_now_local | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx | ||
) |
Create a dateTime value with current local time.
p | pool used for value. |
xctx | of caller. |
Definition at line 749 of file afw_value.c.
const afw_value_t* afw_value_create_dateTime_now_utc | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx | ||
) |
Create a dateTime value with current time.
p | pool used for value. |
xctx | of caller. |
Definition at line 736 of file afw_value.c.
afw_value_create_list_expression | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_value_t * | internal, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for list expression value.
contextual | information for lambda. |
internal | value that will evaluate to a list or NULL. |
p | pool used for value. |
xctx | of caller. |
Definition at line 38 of file afw_value_list_expression.c.
afw_value_create_object_expression | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_object_t * | internal, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for object expression value.
contextual | information for lambda. |
internal | object. |
p | pool used for value. |
xctx | of caller. |
Definition at line 39 of file afw_value_object_expression.c.
const afw_value_t* afw_value_create_string_from_u8z | ( | const afw_utf8_z_t * | string_z, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Make an afw_value_string_t from utf8_z in specified pool.
Definition at line 519 of file afw_value.c.
afw_value_decompile_call_args | ( | const afw_writer_t * | writer, |
afw_size_t | first_arg, | ||
const afw_value_call_args_t * | args, | ||
afw_xctx_t * | xctx | ||
) |
Decompile call args.
writer. | |
args | to decompile. |
xctx | of caller. |
Definition at line 50 of file afw_value_decompile.c.
const afw_utf8_t* afw_value_decompile_to_string | ( | const afw_value_t * | value, |
const afw_utf8_t * | tab, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Decompile a value to a string.
value | to decompile. |
tab | if not NULL, adds and the tab string for readability. |
p | for result. |
xctx | of caller. |
Definition at line 20 of file afw_value_decompile.c.
afw_value_decompile_value | ( | const afw_value_t * | instance, |
const afw_writer_t * | writer, | ||
afw_xctx_t * | xctx | ||
) |
Decompile Value::.
instance | to decompile. |
writer. | |
xctx | of caller. |
Value ::= Json | Lambda | Evaluation | ParenthesizedExpression
This function will put parentheses around decompiled instance if instance is an expression. Call this in decompiles of productions that contain Value.
Definition at line 83 of file afw_value_decompile.c.
afw_boolean_t afw_value_equal | ( | const afw_value_t * | value1, |
const afw_value_t * | value2, | ||
afw_xctx_t * | xctx | ||
) |
Test whether two values are equal.
value1 | |
value2 | |
xctx | of caller. |
Definition at line 851 of file afw_value.c.
const afw_value_t* afw_value_evaluate_with_additional_untrusted_qualified_variables | ( | const afw_value_t * | value, |
const afw_value_t * | untrusted_qualified_variables, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Evaluate a value with additional insecure context.
value | to evaluate. |
untrusted_qualified_variables | is an object value of type AdaptiveContextType. |
p | Pool |
xctx | of caller. |
The untrusted_qualified_variables supplied is checked before checking the xctx's context while evaluating value. This untrusted_qualified_variables is ignored for all secure evaluations that happen in the process such as authorization checking.
Definition at line 534 of file afw_value.c.
afw_value_evaluated_t* afw_value_evaluated_allocate | ( | const afw_data_type_t * | data_type, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Allocate function for an evaluated data type value.
data_type | of value. |
p | pool used for value. |
xctx | of caller. |
Definition at line 20 of file afw_value_evaluated.c.
const afw_value_t* afw_value_evaluated_create | ( | const void * | value, |
const afw_data_type_t * | data_type, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for an evaluated data type value.
value | to copy. |
data_type | of value. |
p | pool used for value. |
xctx | of caller. |
Definition at line 37 of file afw_value_evaluated.c.
const afw_value_t* afw_value_expression_definition_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_value_assignment_t *const * | assignments, | ||
const afw_value_t * | value, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for expression definition value.
contextual | information for expression. |
assignments | NULL or NULL terminated list of assignments. |
value | evaluated for expression result. |
p | pool used for value. |
xctx | of caller. |
Definition at line 45 of file afw_value_expression_definition.c.
const afw_value_t* afw_value_function_thunk_create_impl | ( | const afw_utf8_t * | name, |
const afw_value_t * | like_function_value, | ||
afw_function_thunk_execute_t | execute, | ||
void * | ctx, | ||
const afw_utf8_z_t * | source_z, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a function thunk value.
name | to be associated with thunk. |
like_function_value | for thunk. |
execute | is function to call. |
ctx | to pass to execute. |
source_z | where thunk created. |
p | pool used for value. |
xctx | of caller. |
Definition at line 46 of file afw_value_function_thunk.c.
afw_boolean_t afw_value_is_fully_evaluated | ( | const afw_value_t * | value, |
afw_xctx_t * | xctx | ||
) |
Determine if value and all of it contained values are evaluated.
value | to test. |
xctx | of caller. |
Definition at line 218 of file afw_value.c.
afw_boolean_t afw_value_is_scalar | ( | const afw_value_t * | value, |
afw_xctx_t * | xctx | ||
) |
Determine if value is scalar.
value | to test. |
xctx | of caller. |
Definition at line 271 of file afw_value.c.
const afw_value_t* afw_value_make_single_string | ( | const afw_utf8_octet_t * | s, |
afw_size_t | len, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Make an afw_value_evaluated_t String using string in specified pool.
Definition at line 478 of file afw_value.c.
const afw_value_t* afw_value_make_string_copy | ( | const afw_utf8_octet_t * | s, |
afw_size_t | len, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Make an afw_value_evaluated_t String using copy of string in specified pool.
Definition at line 496 of file afw_value.c.
const afw_value_t* afw_value_one_and_only | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Return value from one entry list or single value.
value | list or single value. |
p | Pool for result. |
xctx | of caller. |
Definition at line 407 of file afw_value.c.
const afw_utf8_t* afw_value_one_and_only_as_utf8 | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Return result of afw_value_one_and_only() as utf8.
value | list or single value. |
p | Pool for result. |
xctx | of caller. |
Definition at line 441 of file afw_value.c.
const afw_value_t* afw_value_qualified_variable_reference_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_utf8_t * | qualifier, | ||
const afw_utf8_t * | name, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for variable reference value.
contextual | information for variable. |
qualifier | of variable or NULL. |
name | of variable. |
p | pool used for value. |
xctx | of caller. |
Definition at line 35 of file afw_value_qualified_variable_reference.c.
const afw_value_t* afw_value_reference_by_key_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_value_t * | aggregate_value, | ||
const afw_value_t * | key, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for reference_by_key value.
contextual | information for property by index or NULL. |
aggregate_value | must be an evaluated object or list value. |
key | used to access value in aggregate_value. |
p | pool used for value. |
xctx | of caller. |
Definition at line 37 of file afw_value_reference_by_key.c.
const afw_value_t* afw_value_script_function_definition_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_value_type_t * | returns, | ||
afw_size_t | count, | ||
const afw_value_script_function_parameter_t ** | parameters, | ||
const afw_value_t * | body, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for lambda definition value.
contextual | information for lambda. |
returns | struct for lambda function. |
count | number of parameters. |
parameters | |
body | of lambda function (expression). |
p | pool used for value. |
xctx | of caller. |
Definition at line 44 of file afw_value_script_function.c.
const afw_value_t* afw_value_string_from_internal | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert internal value to string value.
Convert internal value to single_string value.
Definition at line 710 of file afw_value.c.
const afw_value_t* afw_value_template_definition_create | ( | const afw_compile_value_contextual_t * | contextual, |
afw_size_t | count, | ||
const afw_value_t *const * | values, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for template definition value.
contextual | information for template. |
count | of values. |
values | list of value pointers. |
p | pool used for value. |
xctx | of caller. |
When an template is evaluated, the list of values is evaluated and concatenated. If there is only one value in list, the data type of the result is the data type of the value. If multiple values are supplied, the result is a concatenation of the string values of all the values with a data type is string.
Definition at line 45 of file afw_value_template_definition.c.
const afw_value_t* afw_value_undecorate | ( | const afw_value_t * | value | ) |
Return undecorated value.
value | to undecorate. |
A value "decoration" is annotation and compile_unit values.
Definition at line 186 of file afw_value.c.
afw_boolean_t afw_value_undecorated_inf_is | ( | const afw_value_t * | value, |
const afw_value_inf_t * | inf | ||
) |
Determine if value's undecorated inf is the supplied one.
value | |
inf |
A value "decoration" is annotation and compile_unit values.
Definition at line 197 of file afw_value.c.
const afw_value_t* afw_value_variable_reference_create | ( | const afw_compile_value_contextual_t * | contextual, |
const afw_value_block_symbol_t * | symbol, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create function for variable reference value.
contextual | information for variable. |
symbol | for variable. |
p | pool used for value. |
xctx | of caller. |
Definition at line 36 of file afw_value_variable_reference.c.
afw_value_null |
Adaptive value null.
Note: this is different from c NULL which is represented by undefined. See afw_value_undefined.
Definition at line 320 of file afw_value.h.