Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Data Structures | Macros | Functions | Variables

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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_value_as_utf8_z (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
 
const afw_value_tafw_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_tafw_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_tafw_value_as_utf8 (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
 
const afw_utf8_tafw_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_tafw_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_tafw_value_annotation_allocate (const afw_pool_t *p, afw_xctx_t *xctx)
 Allocate function for annotation value. More...
 
const afw_value_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_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_tafw_value_create_string_from_u8z (const afw_utf8_z_t *string_z, const afw_pool_t *p, afw_xctx_t *xctx)
 
const afw_value_tafw_value_string_from_internal (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
 
const afw_value_tafw_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_tafw_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_tafw_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)
 

Variables

 afw_value_annotated_inf
 Value annotated inf.
 
 afw_value_assignment_target_inf
 Value annotated inf.
 
 afw_value_block_inf
 Value block inf.
 
 afw_value_call_inf
 Value call inf.
 
 afw_value_call_built_in_function_inf
 Value call inf.
 
 afw_value_compiled_value_inf
 Value call inf.
 
 afw_value_expression_definition_inf
 Value expression inf.
 
 afw_value_function_definition_inf
 Value function inf.
 
 afw_value_function_thunk_inf
 Value function thunk inf.
 
 afw_value_script_function_definition_inf
 Value lambda inf.
 
 afw_value_list_expression_inf
 Value list expression inf.
 
 afw_value_object_expression_inf
 Value object expression inf.
 
 afw_value_qualified_variable_reference_inf
 Value qualified_variable_reference inf.
 
 afw_value_reference_by_key_inf
 Value evaluation_reference_by_key inf.
 
 afw_value_template_definition_inf
 Value template inf.
 
 afw_value_variable_reference_inf
 Value variable_reference inf.
 
 afw_value_null
 Adaptive value null. More...
 
 afw_value_undefined_as_string
 Adaptive value containing <undefined> string.
 
 afw_value_empty_string
 Adaptive value empty string.
 
 afw_value_true
 Adaptive value true.
 
 afw_value_false
 Adaptive value false.
 

Detailed Description

Adaptive Framework Value

Macro Definition Documentation

◆ AFW_VALUE_ASSERT_DATA_TYPES_EQUAL

#define AFW_VALUE_ASSERT_DATA_TYPES_EQUAL (   value1,
  value2,
  xctx 
)
Value:
if (!AFW_VALUE_DATA_TYPES_EQUAL(value1, value2, xctx)) \
{ \
AFW_THROW_ERROR_Z(cast_error, "Type safe exception.", xctx); \
}
#define AFW_VALUE_DATA_TYPES_EQUAL(value1, value2, xctx)
Assert that the data type of two adaptive values is the same.
Definition: afw_value.h:867

Assert that the data type of two adaptive values is the same.

Parameters
value1is an adaptive value.
value2is an adaptive value.
xctxof caller

Definition at line 879 of file afw_value.h.

◆ AFW_VALUE_ASSERT_IS

#define AFW_VALUE_ASSERT_IS (   A_VALUE,
  A_TYPE_ID,
  A_SCOPE 
)
Value:
if (!A_VALUE || (A_VALUE)->inf != &afw_value_ ## A_TYPE_ID ## _inf) \
AFW_THROW_ERROR_Z(cast_error, "Expecting " #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.

◆ AFW_VALUE_ASSERT_IS_ANYURI_OR_STRING

#define AFW_VALUE_ASSERT_IS_ANYURI_OR_STRING (   A_VALUE,
  A_SCOPE 
)
Value:
do { \
if (!AFW_VALUE_IS_DATA_TYPE(A_VALUE, anyURI) && \
!AFW_VALUE_IS_DATA_TYPE(A_VALUE, string) ) \
AFW_THROW_ERROR_Z(cast_error, "Type safe exception.", A_SCOPE); \
} while (0)
#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: afw_value.h:759

Throw and error if A_VALUE is not anyURI or string.

Definition at line 777 of file afw_value.h.

◆ AFW_VALUE_ASSERT_IS_DATA_TYPE

#define AFW_VALUE_ASSERT_IS_DATA_TYPE (   A_VALUE,
  A_DATA_TYPE,
  A_SCOPE 
)
Value:
do { \
if (!AFW_VALUE_IS_DATA_TYPE(A_VALUE, A_DATA_TYPE)) \
AFW_THROW_ERROR_Z(cast_error, "Type safe exception.", A_SCOPE); \
} while (0)

Throw and error if A_VALUE is not evaluated data type A_DATA_TYPE.

Definition at line 768 of file afw_value.h.

◆ AFW_VALUE_DATA_TYPES_EQUAL

#define AFW_VALUE_DATA_TYPES_EQUAL (   value1,
  value2,
  xctx 
)
Value:
(afw_value_get_data_type(value1, xctx) != \
afw_value_get_data_type(value2, xctx))
#define afw_value_get_data_type(instance, xctx)
Call method get_data_type of interface afw_value.

Assert that the data type of two adaptive values is the same.

Parameters
value1is an adaptive value.
value2is an adaptive value.
xctxof caller

Definition at line 867 of file afw_value.h.

◆ afw_value_evaluate

#define afw_value_evaluate (   value,
  p,
  xctx 
)
Value:
(((value) && (value)->inf->optional_evaluate) \
? (value)->inf->optional_evaluate(value, p, xctx) \
: value)

Evaluate value if needed using specific pool.

Parameters
valueto evaluate.
pto use.
xctxof caller.
Returns
evaluated value.

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.

◆ afw_value_for_boolean

#define afw_value_for_boolean (   variable)
Value:
(variable) \
afw_value_false
Adaptive value false.
Definition: afw_value.h:354
afw_value_true
Adaptive value true.
Definition: afw_value.h:348

Value for boolean variable.

Parameters
variable
Returns
afw_value_true or afw_value_false

Definition at line 363 of file afw_value.h.

◆ afw_value_function_thunk_create

#define afw_value_function_thunk_create (   name,
  like_function_value,
  execute,
  ctx,
  p,
  xctx 
)
Value:
name, like_function_value, execute, ctx, AFW__FILE_LINE__, p, xctx)
#define AFW__FILE_LINE__
file:line
Definition: afw_common.h:148
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.

Create a function thunk value.

Parameters
nameto be associated with thunk.
like_function_valuefor thunk.
executeis function to call.
ctxto pass to execute.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 1338 of file afw_value.h.

◆ afw_value_get_quick_data_type_id

#define afw_value_get_quick_data_type_id (   A_VALUE)
Value:
(((A_VALUE) && (A_VALUE)->inf->data_type) \
? &((A_VALUE)->inf->data_type->data_type_id) \
: &afw_s_unknown )

Get the easily accessible data type id for a value.

Parameters
valueThis 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.

◆ AFW_VALUE_INTERNAL

#define AFW_VALUE_INTERNAL (   _VALUE_)    ((void *)(&((afw_value_evaluated_t *)(_VALUE_))->internal))

Macro to get const void * of the internal of a value.

Parameters
valueinternal must align with afw_value_evaluated_t *.
Returns
const void * of internal.

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.

◆ afw_value_is_annotated

#define afw_value_is_annotated (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_annotated_inf \
)
afw_value_annotated_inf
Value annotated inf.
Definition: afw_value.h:219

Macro to determine if value is an annotated.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 468 of file afw_value.h.

◆ afw_value_is_any_call

#define afw_value_is_any_call (   A_VALUE)
Value:
( \
(A_VALUE) && \
( \
(A_VALUE)->inf == &afw_value_call_inf || \
) \
)
afw_value_call_built_in_function_inf
Value call inf.
Definition: afw_value.h:243
afw_value_call_inf
Value call inf.
Definition: afw_value.h:237

Macro to determine if value is a call.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 572 of file afw_value.h.

◆ afw_value_is_assignment_target

#define afw_value_is_assignment_target (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_assignment_target_inf \
)
afw_value_assignment_target_inf
Value annotated inf.
Definition: afw_value.h:225

Macro to determine if value is an assignment target.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 520 of file afw_value.h.

◆ afw_value_is_block

#define afw_value_is_block (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_block_inf \
)
afw_value_block_inf
Value block inf.
Definition: afw_value.h:231

Macro to determine if value is a block.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 533 of file afw_value.h.

◆ afw_value_is_call

#define afw_value_is_call (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_call_inf \
)

Macro to determine if value is a call.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 546 of file afw_value.h.

◆ afw_value_is_call_built_in_function

#define afw_value_is_call_built_in_function (   A_VALUE)
Value:
( \
(A_VALUE) && \
)

Macro to determine if value is a call_built_in_function.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 559 of file afw_value.h.

◆ afw_value_is_compiled_value

#define afw_value_is_compiled_value (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_compiled_value_inf \
)
afw_value_compiled_value_inf
Value call inf.
Definition: afw_value.h:249

Macro to determine if value is a compiled value.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 588 of file afw_value.h.

◆ AFW_VALUE_IS_DATA_TYPE

#define AFW_VALUE_IS_DATA_TYPE (   A_VALUE,
  A_DATA_TYPE 
)
Value:
( \
(A_VALUE) && (A_VALUE)->inf->fully_evaluated_data_type && \
(A_VALUE)->inf->fully_evaluated_data_type == afw_data_type_ ## 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.

◆ afw_value_is_defined_and_evaluated

#define afw_value_is_defined_and_evaluated (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf->fully_evaluated_data_type \
)

Macro to determine if value is defined and evaluated.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 481 of file afw_value.h.

◆ afw_value_is_expression_definition

#define afw_value_is_expression_definition (   A_VALUE)
Value:
( \
(A_VALUE) && \
)
afw_value_expression_definition_inf
Value expression inf.
Definition: afw_value.h:255

Macro to determine if value is an expression definition.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 601 of file afw_value.h.

◆ afw_value_is_function_definition

#define afw_value_is_function_definition (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_function_definition_inf \
)
afw_value_function_definition_inf
Value function inf.
Definition: afw_value.h:261

Macro to determine if value is a function definition.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 614 of file afw_value.h.

◆ afw_value_is_function_thunk

#define afw_value_is_function_thunk (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_function_thunk_inf \
)
afw_value_function_thunk_inf
Value function thunk inf.
Definition: afw_value.h:267

Macro to determine if value is a function thunk.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 627 of file afw_value.h.

◆ afw_value_is_list_expression

#define afw_value_is_list_expression (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_list_expression_inf \
)
afw_value_list_expression_inf
Value list expression inf.
Definition: afw_value.h:279

Macro to determine if value is a list expression.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 640 of file afw_value.h.

◆ afw_value_is_nullish

#define afw_value_is_nullish (   A_VALUE)
Value:
( \
(!A_VALUE) || \
(A_VALUE)->inf->fully_evaluated_data_type == afw_data_type_null \
)
afw_data_type_null
Data type struct for null.

Determine if value is undefined or null.

Parameters
valueto test.
xctxof caller.
Returns
boolean result.

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.

◆ afw_value_is_object_expression

#define afw_value_is_object_expression (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_object_expression_inf \
)
afw_value_object_expression_inf
Value object expression inf.
Definition: afw_value.h:285

Macro to determine if value is an object expression.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 653 of file afw_value.h.

◆ afw_value_is_qualified_variable_reference

#define afw_value_is_qualified_variable_reference (   A_VALUE)
Value:
( \
(A_VALUE) && \
)
afw_value_qualified_variable_reference_inf
Value qualified_variable_reference inf.
Definition: afw_value.h:291

Macro to determine if value is a qualified variable reference.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 679 of file afw_value.h.

◆ afw_value_is_reference_by_key

#define afw_value_is_reference_by_key (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_reference_by_key_inf \
)
afw_value_reference_by_key_inf
Value evaluation_reference_by_key inf.
Definition: afw_value.h:297

Macro to determine if value is a access property by index.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 692 of file afw_value.h.

◆ afw_value_is_script_function

#define afw_value_is_script_function (   A_VALUE)
Value:
( \
(A_VALUE) && \
)
afw_value_script_function_definition_inf
Value lambda inf.
Definition: afw_value.h:273

Macro to determine if value is lambda definition.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 666 of file afw_value.h.

◆ afw_value_is_template_definition

#define afw_value_is_template_definition (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_template_definition_inf \
)
afw_value_template_definition_inf
Value template inf.
Definition: afw_value.h:303

Macro to determine if value is a template definition.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 705 of file afw_value.h.

◆ afw_value_is_true

#define afw_value_is_true (   A_VALUE)
Value:
( \
AFW_VALUE_IS_DATA_TYPE(A_VALUE, boolean) && \
((const afw_value_boolean_t *)(A_VALUE))->internal \
)
struct for data type boolean values.

Determine if value is boolean true.

Parameters
valueto test.
xctxof caller.
Returns
true if value is an evaluated boolean true value.

Definition at line 893 of file afw_value.h.

◆ afw_value_is_undefined

#define afw_value_is_undefined (   A_VALUE)    (!A_VALUE)

Determine if value is undefined.

Parameters
valueto test.
xctxof caller.
Returns
boolean result.

NOTE: Undefined values are represented by c NULL.

Definition at line 438 of file afw_value.h.

◆ afw_value_is_undefined_or_evaluated

#define afw_value_is_undefined_or_evaluated (   A_VALUE)
Value:
( \
(!A_VALUE) || \
(A_VALUE)->inf->fully_evaluated_data_type \
)

Macro to determine if value is undefined or evaluated.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 494 of file afw_value.h.

◆ afw_value_is_variable_reference

#define afw_value_is_variable_reference (   A_VALUE)
Value:
( \
(A_VALUE) && \
(A_VALUE)->inf == &afw_value_variable_reference_inf \
)
afw_value_variable_reference_inf
Value variable_reference inf.
Definition: afw_value.h:309

Macro to determine if value is a variable reference.

Parameters
A_VALUEto test.
Returns
boolean result.

Definition at line 718 of file afw_value.h.

◆ afw_value_quick_data_type

#define afw_value_quick_data_type (   A_VALUE)    ((A_VALUE)->inf->data_type)

Get the easily accessible data type for a value.

Parameters
value
Returns
data_type or NULL.

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.

◆ AFW_VALUE_TYPE_ID

#define AFW_VALUE_TYPE_ID (   A_VALUE)    &(A_VALUE)->inf->rti.implementation_id

Macro to return value implementation id of a value.

Parameters
A_VALUEto test.
Returns
value inf implementation id.

Definition at line 458 of file afw_value.h.

◆ AFW_VALUE_UNDECORATE

#define AFW_VALUE_UNDECORATE (   a_value)
Value:
if (a_value) { \
if ((a_value)->inf == &afw_value_compiled_value_inf) { \
a_value = ((const afw_value_compiled_value_t *)a_value)->root_value; \
} \
if ((a_value)->inf == &afw_value_annotated_inf) { \
a_value = ((const afw_value_annotated_t *)a_value)->value; \
} \
}
Struct for annotated value.
Struct for compiled value value.

Undecorated value in place.

Parameters
valueto undecorate.

A value "decoration" is annotation and compile_unit values.

Definition at line 375 of file afw_value.h.

◆ afw_value_undefined

#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.

Function Documentation

◆ afw_value_annotated_create()

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.

Parameters
contextualinformation for annotation.
value(afw_value_t *).
annotationobject.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 51 of file afw_value_annotated.c.

◆ afw_value_annotation_allocate()

afw_value_annotated_t* afw_value_annotation_allocate ( const afw_pool_t p,
afw_xctx_t xctx 
)

Allocate function for annotation value.

Parameters
ppool used for value.
xctxof caller.
Returns
Allocated afw_value_annotated_t.

Definition at line 35 of file afw_value_annotated.c.

◆ afw_value_as_array_of_utf8()

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.

Parameters
value.
pto use for returned value.
xctxof caller.
Returns
NULL terminated list of strings or undefined if value is undefined.

Definition at line 827 of file afw_value.c.

◆ afw_value_as_array_of_values()

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.

Parameters
value.
pto use for returned value.
xctxof caller.
Returns
NULL terminated list of values or undefined if value is undefined.

Definition at line 817 of file afw_value.c.

◆ afw_value_as_casted_utf8()

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.

Parameters
valueto convert.
pis pool to use for result.
xctxof 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 ")".

Todo:
FIXME: change from bag to list when tests are modified.

Definition at line 334 of file afw_value.c.

◆ afw_value_as_utf8()

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.

◆ afw_value_as_utf8_z()

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.

◆ afw_value_assignment_target_create()

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.

Parameters
contextualinformation for assignment target.
assignment_target(see afw_compile_internal.h).
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 51 of file afw_value_assignment_target.c.

◆ afw_value_block_allocated_and_link()

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.

Parameters
compiled_valueto link block in.
block_countaddress to increment.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.
Todo:
FIXME: Remove this code. Saving for now in case error is wrong. block = compiled_value->top_block; compiled_value->current_block = block; return (const afw_value_block_t *)block;

Definition at line 969 of file afw_value_block.c.

◆ afw_value_block_finalize()

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.

Parameters
blockvalue to set statements in.
argcis number of statements.
argvis array of statements.
xctxof caller.
Returns
Finalized block value.

Definition at line 1023 of file afw_value_block.c.

◆ afw_value_call_built_in_function_create()

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.

Parameters
contextualinformation for function call.
argcnumber of arguments (does not include argv[0]).
argvlist of argument value pointers. argv[0] must be function definition value.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

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.

◆ afw_value_call_create()

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.

Parameters
contextualinformation for function call.
argcnumber of arguments (does not include argv[0]).
argvlist of argument value pointers. argv[0] must be function value.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

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.

◆ afw_value_clone()

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.

Parameters
valueto clone.
ppool used for clone.
xctxof caller.
Returns
cloned value.

Only evaluated values are supported.

Definition at line 282 of file afw_value.c.

◆ afw_value_compare()

int afw_value_compare ( const afw_value_t value1,
const afw_value_t value2,
afw_xctx_t xctx 
)

Compare two evaluated values.

Parameters
value1
value2
xctxof caller.
Returns
0 if equal, < 0 if value1 < value2, > 0 if value1 > value2.

Values must be evaluated and the same data type or an error is thrown.

Definition at line 893 of file afw_value.c.

◆ afw_value_compile()

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.

Parameters
valuemust be a type that can be compiled
source_locationto associate with compiled value or NULL.
pto use for result.
xctxof caller.
Returns
result of compiling the value.

Definition at line 74 of file afw_value.c.

◆ afw_value_compile_and_evaluate()

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.

Parameters
valuemust be a type that can be compiled
source_locationto associate with compiled string or NULL.
compile_type.
pto use for result.
xctxof caller.
Returns
result of compiling and evaluating the value.

Definition at line 145 of file afw_value.c.

◆ afw_value_compile_and_evaluate_as()

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.

Parameters
valuecan be type appropriate for compile_type or string.
source_locationto associate with compiled string or NULL.
compile_type.
pto use for result.
xctxof caller.
Returns
result of compiling and evaluating the value.

Definition at line 165 of file afw_value.c.

◆ afw_value_compile_as()

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.

Parameters
valuecan be type appropriate for compile_type or string.
source_locationto associate with compiled value or NULL.
compile_type(set afw_compile_type_t)
pto use for result.
xctxof caller.
Returns
result of compiling the value.

Definition at line 104 of file afw_value.c.

◆ afw_value_compiler_listing_to_string()

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.

Parameters
valueto decompile.
tabif not NULL, adds
and the tab string for readability.
pfor result.
xctxof caller.
Returns
decompiled string.

Definition at line 594 of file afw_value_compiler_listing.c.

◆ afw_value_contains()

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.

Parameters
valueto check.
substringto check.
xctxof caller.
Returns
true if value contains substring.

Value must be an evaluated value that has a cType of afw_utf8_t.

Definition at line 931 of file afw_value.c.

◆ afw_value_convert()

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.

Parameters
valueto evaluate and convert, if needed.
to_data_type.
requiredif false returns NULL if value is NULL.
pto hold converted value.
xctxof caller.
Returns
converted value. If not conversion needed, value passed.

An undefined error is thrown if value is NULL and required is true.

Todo:
FIXME: make parameter

Definition at line 584 of file afw_value.c.

◆ afw_value_convert_to_string()

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.

Parameters
valueto evaluate and convert, if needed.
allow_undefinedif true returns '<undefined>" if value is NULL.
pto hold converted value.
xctxof caller.
Returns
converted value. If not conversion needed, value passed.

An undefined error is thrown if result will be NULL and allow_undefined is false.

Definition at line 688 of file afw_value.c.

◆ afw_value_create_dateTime_now_local()

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.

Parameters
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 749 of file afw_value.c.

◆ afw_value_create_dateTime_now_utc()

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.

Parameters
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 736 of file afw_value.c.

◆ afw_value_create_list_expression()

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.

Parameters
contextualinformation for lambda.
internalvalue that will evaluate to a list or NULL.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.
Todo:
Add contextual to decompile, etc.

Definition at line 38 of file afw_value_list_expression.c.

◆ afw_value_create_object_expression()

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.

Parameters
contextualinformation for lambda.
internalobject.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.
Todo:
Add contextual to decompile, etc.

Definition at line 39 of file afw_value_object_expression.c.

◆ afw_value_create_string_from_u8z()

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

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.

Parameters
writer.
argsto decompile.
xctxof caller.

Definition at line 50 of file afw_value_decompile.c.

◆ afw_value_decompile_to_string()

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.

Parameters
valueto decompile.
tabif not NULL, adds
and the tab string for readability.
pfor result.
xctxof caller.
Returns
decompiled string.

Definition at line 20 of file afw_value_decompile.c.

◆ afw_value_decompile_value()

afw_value_decompile_value ( const afw_value_t instance,
const afw_writer_t writer,
afw_xctx_t xctx 
)

Decompile Value::.

Parameters
instanceto decompile.
writer.
xctxof 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_value_equal()

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.

Parameters
value1
value2
xctxof caller.
Returns
boolean result of test.

Definition at line 851 of file afw_value.c.

◆ afw_value_evaluate_with_additional_untrusted_qualified_variables()

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.

Parameters
valueto evaluate.
untrusted_qualified_variablesis an object value of type AdaptiveContextType.
pPool
xctxof caller.
Returns
value or undefined if there is an error.

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_allocate()

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.

Parameters
data_typeof value.
ppool used for value.
xctxof caller.
Returns
Allocated afw_value_evaluated_t.

Definition at line 20 of file afw_value_evaluated.c.

◆ afw_value_evaluated_create()

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.

Parameters
valueto copy.
data_typeof value.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 37 of file afw_value_evaluated.c.

◆ afw_value_expression_definition_create()

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.

Parameters
contextualinformation for expression.
assignmentsNULL or NULL terminated list of assignments.
valueevaluated for expression result.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 45 of file afw_value_expression_definition.c.

◆ afw_value_function_thunk_create_impl()

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.

Parameters
nameto be associated with thunk.
like_function_valuefor thunk.
executeis function to call.
ctxto pass to execute.
source_zwhere thunk created.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 46 of file afw_value_function_thunk.c.

◆ afw_value_is_fully_evaluated()

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.

Parameters
valueto test.
xctxof caller.
Returns
boolean result.

Definition at line 218 of file afw_value.c.

◆ afw_value_is_scalar()

afw_boolean_t afw_value_is_scalar ( const afw_value_t value,
afw_xctx_t xctx 
)

Determine if value is scalar.

Parameters
valueto test.
xctxof caller.
Returns
boolean result.

Definition at line 271 of file afw_value.c.

◆ afw_value_make_single_string()

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.

◆ afw_value_make_string_copy()

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.

◆ afw_value_one_and_only()

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.

Parameters
valuelist or single value.
pPool for result.
xctxof caller.
Returns
value or undefined.

Definition at line 407 of file afw_value.c.

◆ afw_value_one_and_only_as_utf8()

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.

Parameters
valuelist or single value.
pPool for result.
xctxof caller.
Returns
string representation of value or undefined.

Definition at line 441 of file afw_value.c.

◆ afw_value_qualified_variable_reference_create()

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.

Parameters
contextualinformation for variable.
qualifierof variable or NULL.
nameof variable.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 35 of file afw_value_qualified_variable_reference.c.

◆ afw_value_reference_by_key_create()

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.

Parameters
contextualinformation for property by index or NULL.
aggregate_valuemust be an evaluated object or list value.
keyused to access value in aggregate_value.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.
Todo:
FIXME: Should have list entry by index too.

Definition at line 37 of file afw_value_reference_by_key.c.

◆ afw_value_script_function_definition_create()

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.

Parameters
contextualinformation for lambda.
returnsstruct for lambda function.
countnumber of parameters.
parameters
bodyof lambda function (expression).
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.
Todo:
FIXME: Work about in all creates if copy needed.

Definition at line 44 of file afw_value_script_function.c.

◆ afw_value_string_from_internal()

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.

◆ afw_value_template_definition_create()

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.

Parameters
contextualinformation for template.
countof values.
valueslist of value pointers.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

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.

◆ afw_value_undecorate()

const afw_value_t* afw_value_undecorate ( const afw_value_t value)

Return undecorated value.

Parameters
valueto undecorate.
Returns
undecorated value.

A value "decoration" is annotation and compile_unit values.

Definition at line 186 of file afw_value.c.

◆ afw_value_undecorated_inf_is()

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.

Parameters
value
inf
Returns
true if undecorated value's inf is the supplied on.

A value "decoration" is annotation and compile_unit values.

Definition at line 197 of file afw_value.c.

◆ afw_value_variable_reference_create()

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.

Parameters
contextualinformation for variable.
symbolfor variable.
ppool used for value.
xctxof caller.
Returns
Created afw_value_t.

Definition at line 36 of file afw_value_variable_reference.c.

Variable Documentation

◆ afw_value_null

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.