15 #include <libxml/xmlregexp.h>
32 impl_value_undefined_string = {
39 { (
const afw_value_t *)&impl_value_undefined_string };
42 impl_value_empty_string = {
87 if (!data_type || data_type->compile_type == afw_compile_type_error)
94 source_location, data_type->compile_type,
95 afw_compile_residual_check_to_full, \
98 return compiled_value;
120 if (!data_type || data_type->compile_type != compile_type )
123 "Value data type does not match compile_type", xctx);
133 source_location, compile_type,
134 afw_compile_residual_check_to_full, \
135 NULL, NULL, p, xctx);
137 return compiled_value;
201 if (!value)
return false;
211 return value->inf == inf;
235 for (iterator = NULL;;) {
238 &iterator, &property_name, xctx);
251 for (iterator = NULL;;) {
254 &iterator, xctx->p, xctx);
276 return (data_type) ? data_type->scalar :
false;
296 (
void *)&evaluated->internal,
304 "Can only clone an evaluated value", xctx);
358 for (n = 0, len = 3 ; s[n]; n++) {
363 len += s[n]->len + 6 + data_type->data_type_id.len;
370 memcpy(c,
"bag(", 4);
373 for (n = 0; s[n]; n++) {
378 memcpy(c, data_type->data_type_id.s,
379 data_type->data_type_id.len);
380 c += data_type->data_type_id.len;
383 memcpy(c, s[n]->s, s[n]->len);
394 &data_type->data_type_id,
395 &afw_s_a_open_parenthesis, &impl_s_a_quote,
397 &impl_s_a_quote, &afw_s_a_close_parenthesis,
415 if (!value)
return NULL;
463 if (!value)
return NULL;
488 single->internal.s = s;
507 single->internal.s = (single->internal.len > 0)
547 if (untrusted_qualified_variables) {
556 &iterator, &property_name, xctx)))
559 object, NULL, NULL, p, xctx);
595 const void *
internal;
602 for (evaluate_count = 0;
606 if (evaluate_count >= 20) {
608 "afw_value_convert() value required > %d evaluations",
629 if (v_data_type != to_data_type) {
635 v_data_type, 1, p, xctx);
646 "Can't down convert a list with more than one entry",
651 &iterator, &data_type, &
internal, xctx);
653 if (data_type == to_data_type) {
697 if (allow_undefined) {
761 impl_value_as_array_of_values(
796 for (iterator = NULL; ; e++) {
820 return impl_value_as_array_of_values(value, p, xctx);
837 result = (
const afw_utf8_t **)impl_value_as_array_of_values(value,
839 for (e = result; *e; e++) {
857 if (value1 == value2)
862 else if (!value1 || !value2)
867 else if (value1->inf->fully_evaluated_data_type)
869 if (value1->inf->fully_evaluated_data_type ==
870 value2->inf->fully_evaluated_data_type)
875 value1->inf->fully_evaluated_data_type, i1, i2, xctx) == 0;
920 "afw_value_compare() only supports evaluated values",
944 if (!value_data_type ||
948 "value must have a data type with cType of afw_utf8_t",
953 if (!substring_data_type ||
957 "substring must have a data type with cType of afw_utf8_t",
964 for (result =
false, i = 0; v->len - i >= ss->len; i++) {
965 if (memcmp(v->s + i, ss->s, ss->len) == 0) {
977 afw_value_register_core_value_infs(
afw_xctx_t *xctx)
AFW_DEFINE(const afw_object_t *)
#define AFW_DEFINE_CONST_DATA(type)
Define a public afw variable.
Adaptive Framework Core Internal.
afw_data_type_any
Data type struct for any.
afw_value_evaluated_boolean_inf
Unmanaged evaluated value inf for data type boolean.
afw_value_create_dateTime(const afw_dateTime_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type dateTime value.
afw_value_create_list(const afw_list_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type list value.
#define afw_value_is_list(A_VALUE)
Macro to determine if value is evaluated list.
afw_data_type_list
Data type struct for list.
afw_value_evaluated_null_inf
Unmanaged evaluated value inf for data type null.
#define afw_value_is_object(A_VALUE)
Macro to determine if value is evaluated object.
#define afw_object_old_get_next_property_as_object(object, iterator, property_name, xctx)
Get next property function for data type object value.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
afw_data_type_string
Data type struct for string.
afw_value_evaluated_string_inf
Unmanaged evaluated value inf for data type string.
#define afw_data_type_is_string(A_DATA_TYPE)
Macro to determine if data type is string.
#define afw_value_is_string(A_VALUE)
Macro to determine if value is evaluated string.
#define AFW_UTF8_Z_LEN
String is NUL (0) terminate.
#define AFW_UTF8_LITERAL(A_STRING)
String literal initializer.
struct afw_iterator_s afw_iterator_t
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
enum afw_compile_type_e afw_compile_type_t
Compile type enum.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
apr_size_t afw_size_t
size_t.
afw_compile_object_all_hybrid_properties(const afw_object_t *object, const afw_utf8_t *source_location, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Compile an object with all hybrid properties.
afw_compile_to_value_with_callback(const afw_utf8_t *string, afw_utf8_octet_get_cb_t callback, void *callback_data, const afw_utf8_t *source_location, afw_compile_type_t compile_type, afw_compile_residual_check_t residual_check, const afw_value_compiled_value_t *parent, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Compile string to adaptive value with callback.
#define afw_data_type_clone_internal(instance, to_internal, from_internal, p, xctx)
Call method clone_internal of interface afw_data_type.
#define afw_data_type_compare_internal(instance, internal1, internal2, xctx)
Call method compare_internal of interface afw_data_type.
#define afw_data_type_convert_internal(instance, to_internal, from_internal, to_data_type, p, xctx)
Call method convert_internal of interface afw_data_type.
#define afw_data_type_internal_to_utf8(instance, from_internal, p, xctx)
Call method internal_to_utf8 of interface afw_data_type.
void afw_environment_register_value_inf(const afw_utf8_t *value_inf_id, const afw_value_inf_t *value_inf, afw_xctx_t *xctx)
Register a value inf.
#define AFW_FINALLY
Always executed regardless of error.
#define AFW_ENDTRY
Ends an AFW try block.
#define AFW_TRY
Begin an AFW TRY block.
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
#define afw_list_get_next_internal(instance, iterator, data_type, internal, xctx)
Call method get_next_internal of interface afw_list.
#define afw_list_get_next_value(instance, iterator, p, xctx)
Call method get_next_value of interface afw_list.
#define afw_list_get_count(instance, xctx)
Call method get_count of interface afw_list.
afw_list_create_wrapper_for_array(const void *array, afw_boolean_t indirect, const afw_data_type_t *data_type, afw_size_t count, const afw_pool_t *p, afw_xctx_t *xctx)
Create a immutable list wrapper for an array.
void * afw_memory_dup(const void *from, apr_size_t size, const afw_pool_t *p, afw_xctx_t *xctx)
Duplicate a block of memory into specified pool.
#define afw_object_get_next_property(instance, iterator, property_name, xctx)
Call method get_next_property of interface afw_object.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
#define afw_pool_calloc(instance, size, xctx)
Call method calloc of interface afw_pool.
#define afw_pool_malloc_type(instance, type, xctx)
Macro to allocate uncleared memory to hold type in pool.
afw_dateTime_set_now(afw_dateTime_t *dateTime_local, afw_dateTime_t *dateTime_utc, afw_xctx_t *xctx)
Set local and/or utc dateTime to now.
const afw_utf8_t * afw_utf8_concat(const afw_pool_t *p, afw_xctx_t *xctx,...)
Concatenate strings with result in specifed pool.
afw_boolean_t afw_utf8_equal(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string equals another string.
afw_utf8_z_create(const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx)
Create a NFC Normalized zero terminated UTF-8 string in specified pool.
#define afw_utf8_create(s, len, p, xctx)
Create utf-8 string without copy unless necessary in pool specified.
#define afw_value_get_data_type(instance, xctx)
Call method get_data_type of interface afw_value.
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.
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.
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.
afw_value_assignment_target_inf
Value annotated inf.
#define AFW_VALUE_UNDECORATE(a_value)
Undecorated value in place.
afw_value_undecorate(const afw_value_t *value)
Return undecorated value.
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.
#define afw_value_quick_data_type(A_VALUE)
Get the easily accessible data type for a value.
#define afw_value_evaluate(value, p, xctx)
Evaluate value if needed using specific pool.
afw_value_equal(const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx)
Test whether two values are equal.
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.
afw_value_undefined_as_string
Adaptive value containing <undefined> string.
afw_value_reference_by_key_inf
Value evaluation_reference_by_key inf.
afw_value_clone(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Clone a value to specified pool.
afw_value_annotated_inf
Value annotated inf.
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.
afw_value_as_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
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.
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.
afw_value_expression_definition_inf
Value expression inf.
afw_value_false
Adaptive value false.
afw_value_object_expression_inf
Value object expression inf.
afw_value_as_utf8_z(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
afw_value_call_inf
Value call inf.
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.
afw_value_function_definition_inf
Value function inf.
#define afw_value_is_defined_and_evaluated(A_VALUE)
Macro to determine if value is defined and evaluated.
afw_value_create_dateTime_now_local(const afw_pool_t *p, afw_xctx_t *xctx)
Create a dateTime value with current local time.
afw_value_empty_string
Adaptive value empty string.
afw_value_create_dateTime_now_utc(const afw_pool_t *p, afw_xctx_t *xctx)
Create a dateTime value with current time.
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.
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.
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.
afw_value_make_string_copy(const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx)
afw_value_script_function_definition_inf
Value lambda inf.
#define AFW_VALUE_INTERNAL(_VALUE_)
Macro to get const void * of the internal of a value.
afw_value_compare(const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx)
Compare two evaluated values.
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.
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.
afw_value_list_expression_inf
Value list expression inf.
afw_value_is_scalar(const afw_value_t *value, afw_xctx_t *xctx)
Determine if value is scalar.
afw_value_qualified_variable_reference_inf
Value qualified_variable_reference inf.
#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.
afw_value_null
Adaptive value null.
afw_value_template_definition_inf
Value template inf.
afw_value_make_single_string(const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx)
afw_value_string_from_internal(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
afw_value_compiled_value_inf
Value call inf.
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.
afw_value_true
Adaptive value true.
afw_value_create_string_from_u8z(const afw_utf8_z_t *string_z, const afw_pool_t *p, afw_xctx_t *xctx)
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.
afw_xctx_get_qualifier_stack_top(afw_xctx_t *xctx)
Get qualifier stack top.
afw_xctx_push_qualifier_object(const afw_utf8_t *qualifier_name, const afw_object_t *qualifier_object, afw_boolean_t secure, const afw_pool_t *p, afw_xctx_t *xctx)
Push qualifier object on to stack.
afw_xctx_set_qualifier_stack_top(int top, afw_xctx_t *xctx)
Set stack top index.
Interface afw_data_type public struct.
date, time, and time zone.
Interface afw_list public struct.
Interface afw_object public struct.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Struct for annotated value.
struct for data type boolean values.
Struct to access internal of all evaluated values.
Interface afw_value_inf_s struct.
Struct for compiled value value.
struct for data type list values.
struct for data type null values.
struct for data type object values.
Interface afw_value public struct.
struct for data type string values.
Interface afw_xctx public struct.