Adaptive Framework
0.9.0
|
Adaptive Framework header for adaptive values. More...
#include "afw_interface.h"
Go to the source code of this file.
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 header for adaptive values.
This is the main header for adaptive values.
An adaptive value is a structure that consists of an inf pointer followed by internal memory specific to an afw_value implementation. There are implementations of afw_value to represent values for all of the adaptive data types as well as implementations that can be evaluated at runtime such as "compiled_value", "block", and "variable_reference".
Adaptive source, such as adaptive expressions, json, and adaptive scripts, can be compiled to produce an adaptive value. Adaptive values can also be produced by calling their corresponding type's afw_value_allocate_* or afw_value_create_* function.
The afw_value_evaluate() macro can be called to evaluate any adaptive value. For example, afw_value_evaluate() can be called for an adaptive value returned from the adaptive compiler used to compile an adaptive script to "run" the adaptive script and return its adaptive value result.
Definition in file afw_value.h.