15 #include <libxml/xmlregexp.h>
26 const void *entry_internal;
31 "impl_is_in_list() called with NULL data_type",
35 for (iterator = NULL;;) {
37 &entry_data_type, &entry_internal, xctx);
38 if (!entry_internal) {
41 if (data_type != entry_data_type) {
45 internal, entry_internal, xctx) == 0)
64 for (iterator = NULL;;) {
66 &data_type, &
internal, xctx);
70 if (!impl_is_in_list(data_type,
internal, list2, xctx)) {
79 impl_add_nondups_to_list(
88 for (iterator = NULL;;) {
90 NULL, &
internal, xctx);
94 if (!impl_is_in_list(data_type,
internal, to, xctx)) {
147 const void *
internal;
152 for (iterator = NULL;;) {
154 &data_type, &
internal, x->
xctx);
158 if (impl_is_in_list(data_type,
internal, list2->internal, x->
xctx)) {
216 for (i = 1; i <= x->
argc; i++) {
369 source, &afw_s_a_empty_string, x->
p, x->
xctx);
371 listing = afw_function_evaluate_whitespace_parameter(x, 2);
438 a1->internal.len >= a2->internal.len &&
439 memcmp(a1->internal.s + (a1->internal.len - a2->internal.len),
440 a2->internal.s, a2->internal.len) == 0
532 if (arg1_data_type != arg2_data_type) {
623 if (arg1_data_type != arg2_data_type) {
705 if (arg1_data_type != arg2_data_type) {
786 if (arg1_data_type != arg2_data_type) {
862 len = a1->internal.len;
865 start = abs((
int)position->internal) % a1->internal.len;
867 if (position->internal < 0 && start != 0) {
868 start = a1->internal.len - start;
875 for ( ; a2->internal.len <= len; c++, len--) {
876 if (memcmp(c, a2->internal.s, a2->internal.len) == 0) {
951 for (offset = 0; offset < index; ) {
953 value->internal.len, x->
xctx) < 0)
961 if (offset + subString->internal.len > value->internal.len) {
965 if (memcmp(value->internal.s + offset,
966 subString->internal.s, subString->internal.len) == 0)
975 value->internal.len, x->
xctx) < 0)
1032 const void *
internal;
1043 "list1 and list2 must have a data type of the same type",
1048 for (iterator = NULL;;) {
1050 &
internal, x->
xctx);
1054 if (impl_is_in_list(data_type,
internal, list2->internal, x->
xctx)) {
1055 if (!impl_is_in_list(data_type,
internal, list, x->
xctx)) {
1118 "list must be list of value's data type",
1123 list->internal, x->
xctx)
1198 if (arg1_data_type != arg2_data_type) {
1266 for (length = 0, offset = 0;
1345 if (arg1_data_type != arg2_data_type) {
1403 for (i = 2; i <= x->
argc; i++) {
1464 for (i = 2; i <= x->
argc; i++) {
1563 if (arg1_data_type != arg2_data_type) {
1656 if (arg1_data_type != arg2_data_type) {
1715 const void *
internal;
1721 "arg must have exactly one value", x->
xctx);
1726 &iterator, &data_type, &
internal, x->
xctx);
1773 xmlRegexpPtr rx = NULL;
1776 const xmlChar * s_z;
1777 const xmlChar * regexp_z;
1789 rx = xmlRegexpCompile(regexp_z);
1791 err = xmlGetLastError();
1795 xmlRegFreeRegexp(rx);
1803 xmlRegFreeRegexp(rx);
1861 if (times->internal <= 0) {
1866 if (times->internal > 1000) {
1871 result->internal.len = (
afw_size_t)times->internal * value->internal.len;
1873 result->internal.len, x->
xctx);
1874 for (count = times->internal; count > 0; count--) {
1875 memcpy(s, value->internal.s, value->internal.len);
1876 s += value->internal.len;
1950 limit_value, 4, integer);
1951 limit = (limit_value->internal < 0 ||
1964 if (remaining.len == 0) {
1967 for (count = 0; count < limit && remaining.len > match->internal.len; )
1970 remaining.len >= match->internal.len;
1971 remaining.s++, remaining.len--)
1973 if (memcmp(remaining.s, match->internal.s, match->internal.len)
1976 remaining.s += match->internal.len;
1977 remaining.len -= match->internal.len;
1991 len = remaining.len - (count * match->internal.len) +
1992 (count * replacement->internal.len);
1995 result->internal.len = len;
1996 result->internal.s = s;
1999 for (; count > 0; count--) {
2001 if (memcmp(remaining.s, match->internal.s, match->internal.len) == 0)
2003 memcpy(s, replacement->internal.s, replacement->internal.len);
2004 s += replacement->internal.len;
2005 remaining.s += match->internal.len;
2006 remaining.len -= match->internal.len;
2010 *s++ = *remaining.s++;
2015 if (remaining.len > 0) {
2016 memcpy(s, remaining.s, remaining.len);
2074 if (!data_type_1 || data_type_1 != data_type_2) {
2076 "list1 and list2 must have a data type that matches", x->
xctx);
2079 return (impl_is_subset_list(list1->internal, list2->internal, x->
xctx) &&
2080 impl_is_subset_list(list2->internal, list1->internal, x->
xctx))
2150 separator = &separator_value->internal;
2151 if (separator->len == 0) {
2160 limit = limit_value->internal;
2169 for (count = 0; count < limit && remaining.len > 0; count++) {
2170 for (split.s = remaining.s, split.len = remaining.len;
2172 remaining.s++, remaining.len--)
2174 if (remaining.len < separator->len) {
2178 if (memcmp(remaining.s, separator->s, separator->len) == 0) {
2179 split.len = remaining.s - split.s;
2180 remaining.s += separator->len;
2181 remaining.len -= separator->len;
2186 (
const void *)&split, x->
xctx);
2191 for (count = 0; count < limit && remaining.len > 0; count++) {
2192 split.s = remaining.s;
2197 (
const void *)&split, x->
xctx);
2261 a1->internal.len >= a2->internal.len &&
2262 memcmp(a1->internal.s, a2->internal.s, a2->internal.len) == 0
2321 if (!data_type_1 || data_type_1 != data_type_2) {
2323 "list1 and list2 must have a data type that matches", x->
xctx);
2326 return impl_is_subset_list(list1->internal, list2->internal, x->
xctx)
2399 if (startIndex->internal < 0) {
2409 if (endIndex->internal < -1 ||
2410 (endIndex->internal != -1 &&
2411 startIndex->internal >= endIndex->internal))
2420 for (offset = 0, pos = 0; pos < start; pos++)
2424 "startIndex is out of bounds", x->
xctx);
2427 substring.s = s->s + offset;
2431 substring.len = s->s + s->len - substring.s;
2434 for (; pos < end; pos++)
2438 "startIndex and/or endIndex is out of bounds", x->
xctx);
2441 substring.len = s->s + offset - substring.s;
2502 "all lists must have the same data type",
2507 impl_add_nondups_to_list(data_type, list1->internal, list, x->
xctx);
2508 for (i = 2; i <= x->
argc; i++) {
2512 "all lists must have the same data type",
2515 impl_add_nondups_to_list(data_type, listn->internal, list, x->
xctx);
2589 for (offset = 0; offset < index; ) {
2591 value->internal.len, x->
xctx) < 0)
2599 if (offset + subString->internal.len > value->internal.len) {
2603 if (memcmp(value->internal.s + offset,
2604 subString->internal.s, subString->internal.len) == 0)
2612 value->internal.len, x->
xctx) < 0)
2817 result->internal.ptr = (
const afw_octet_t *)value->internal.s;
2818 result->internal.size = value->internal.len;
2869 result->internal.ptr = (
const afw_octet_t *)value->internal.s;
2870 result->internal.size = value->internal.len;
const afw_value_t * afw_function_execute_compile(afw_function_execute_t *x)
Adaptive Framework Core Internal.
afw_value_allocate_base64Binary(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type base64Binary value.
#define afw_value_is_double(A_VALUE)
Macro to determine if value is evaluated double.
afw_value_allocate_hexBinary(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type hexBinary value.
afw_value_create_integer(afw_integer_t internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type integer 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.
#define afw_value_is_null(A_VALUE)
Macro to determine if value is evaluated null.
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_value_allocate_string(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type string value.
afw_data_type_string
Data type struct for string.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
#define AFW_UTF8_Z_LEN
String is NUL (0) terminate.
#define AFW_SIZE_T_MAX
afw_size_t max.
struct afw_iterator_s afw_iterator_t
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
apr_size_t afw_size_t
size_t.
unsigned char afw_octet_t
8 bits (unsigned).
#define AFW_INTEGER_MAX
largest afw_integer_t
apr_int64_t afw_integer_t
typedef for big signed int.
#define afw_data_type_compare_internal(instance, internal1, internal2, xctx)
Call method compare_internal of interface afw_data_type.
#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_FUNCTION_EVALUATE_DATA_TYPE_PARAMETER(A_RESULT, A_N, A_TYPE)
Evaluate an arg for a particular data type.
afw_function_evaluate_required_parameter(afw_function_execute_t *x, afw_size_t parameter_number, const afw_data_type_t *data_type)
Evaluate an required parameter and convert if necessary.
#define AFW_FUNCTION_EVALUATE_REQUIRED_DATA_TYPE_PARAMETER(A_RESULT, A_N, A_TYPE)
Evaluate an arg for a particular data type.
#define AFW_FUNCTION_ASSERT_VALUE_IS_UTF8(A_VALUE)
Assert that a value is at data type with cType of afw_utf8_t.
#define AFW_FUNCTION_PARAMETER_IS_PRESENT(A_N)
Determine if a specific parameter value is present.
#define AFW_FUNCTION_EVALUATE_PARAMETER(A_RESULT, A_N)
Evaluate a parameter.
#define AFW_FUNCTION_EVALUATE_REQUIRED_PARAMETER(A_RESULT, A_N)
Evaluate an required parameter.
const afw_value_t * afw_function_execute_split(afw_function_execute_t *x)
Function implementation function afw_function_execute_split.
const afw_value_t * afw_function_execute_starts_with(afw_function_execute_t *x)
Function implementation function afw_function_execute_starts_with.
const afw_value_t * afw_function_execute_nex(afw_function_execute_t *x)
Function implementation function afw_function_execute_nex.
const afw_value_t * afw_function_execute_substring(afw_function_execute_t *x)
Function implementation function afw_function_execute_substring.
const afw_value_t * afw_function_execute_regexp_index_of(afw_function_execute_t *x)
Function implementation function afw_function_execute_regexp_index_of.
const afw_value_t * afw_function_execute_ge(afw_function_execute_t *x)
Function implementation function afw_function_execute_ge.
const afw_value_t * afw_function_execute_is_in(afw_function_execute_t *x)
Function implementation function afw_function_execute_is_in.
const afw_value_t * afw_function_execute_bag(afw_function_execute_t *x)
Function implementation function afw_function_execute_bag.
const afw_value_t * afw_function_execute_includes(afw_function_execute_t *x)
Function implementation function afw_function_execute_includes.
const afw_value_t * afw_function_execute_max(afw_function_execute_t *x)
Function implementation function afw_function_execute_max.
const afw_value_t * afw_function_execute_index_of(afw_function_execute_t *x)
Function implementation function afw_function_execute_index_of.
const afw_value_t * afw_function_execute_eq(afw_function_execute_t *x)
Function implementation function afw_function_execute_eq.
const afw_value_t * afw_function_execute_min(afw_function_execute_t *x)
Function implementation function afw_function_execute_min.
const afw_value_t * afw_function_execute_ends_with(afw_function_execute_t *x)
Function implementation function afw_function_execute_ends_with.
const afw_value_t * afw_function_execute_is(afw_function_execute_t *x)
Function implementation function afw_function_execute_is.
const afw_value_t * afw_function_execute_subset(afw_function_execute_t *x)
Function implementation function afw_function_execute_subset.
const afw_value_t * afw_function_execute_intersection(afw_function_execute_t *x)
Function implementation function afw_function_execute_intersection.
const afw_value_t * afw_function_execute_regexp_match(afw_function_execute_t *x)
Function implementation function afw_function_execute_regexp_match.
const afw_value_t * afw_function_execute_replace(afw_function_execute_t *x)
Function implementation function afw_function_execute_replace.
const afw_value_t * afw_function_execute_clone(afw_function_execute_t *x)
Function implementation function afw_function_execute_clone.
const afw_value_t * afw_function_execute_eqx(afw_function_execute_t *x)
Function implementation function afw_function_execute_eqx.
const afw_value_t * afw_function_execute_regexp_replace(afw_function_execute_t *x)
Function implementation function afw_function_execute_regexp_replace.
const afw_value_t * afw_function_execute_last_index_of(afw_function_execute_t *x)
Function implementation function afw_function_execute_last_index_of.
const afw_value_t * afw_function_execute_length(afw_function_execute_t *x)
Function implementation function afw_function_execute_length.
const afw_value_t * afw_function_execute_at_least_one_member_of(afw_function_execute_t *x)
Function implementation function AFW_FUNCTION_EXECUTE_STANDARD_POLYMORPHIC_FUNCTION_HANDLING.
const afw_value_t * afw_function_execute_le(afw_function_execute_t *x)
Function implementation function afw_function_execute_le.
const afw_value_t * afw_function_execute_one_and_only(afw_function_execute_t *x)
Function implementation function afw_function_execute_one_and_only.
const afw_value_t * afw_function_execute_encode_as_hexBinary(afw_function_execute_t *x)
Function implementation function afw_function_execute_encode_as_hexBinary.
const afw_value_t * afw_function_execute_union(afw_function_execute_t *x)
Function implementation function afw_function_execute_union.
const afw_value_t * afw_function_execute_encode_as_base64Binary(afw_function_execute_t *x)
Function implementation function afw_function_execute_encode_as_base64Binary.
const afw_value_t * afw_function_execute_set_equals(afw_function_execute_t *x)
Function implementation function afw_function_execute_set_equals.
const afw_value_t * afw_function_execute_bag_size(afw_function_execute_t *x)
Function implementation function afw_function_execute_bag_size.
const afw_value_t * afw_function_execute_ne(afw_function_execute_t *x)
Function implementation function afw_function_execute_ne.
const afw_value_t * afw_function_execute_gt(afw_function_execute_t *x)
Function implementation function afw_function_execute_gt.
const afw_value_t * afw_function_execute_lt(afw_function_execute_t *x)
Function implementation function afw_function_execute_lt.
const afw_value_t * afw_function_execute_repeat(afw_function_execute_t *x)
Function implementation function afw_function_execute_repeat.
const afw_value_t * afw_function_execute_url_encode(afw_function_execute_t *x)
Function implementation function afw_function_execute_url_encode.
#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_data_type(instance, xctx)
Call method get_data_type of interface afw_list.
#define afw_list_get_count(instance, xctx)
Call method get_count of interface afw_list.
afw_list_add_internal(const afw_list_t *instance, const afw_data_type_t *data_type, const void *internal, afw_xctx_t *xctx)
Call method add of interface afw_list_setter.
const afw_list_t * afw_list_create_with_options(int options, const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx)
Create an list in memory with options.
#define afw_list_of_create(data_type, p, xctx)
Create an list of a specific data type in memory.
#define afw_memory_copy(to, from)
Copy to preallocated memory of same type.
afw_boolean_t afw_number_is_NaN(double d)
Determine if double is not a number.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
afw_integer_t afw_safe_cast_size_to_integer(afw_size_t size, afw_xctx_t *xctx)
Safely cast afw_size_t to afw_integer_t.
afw_size_t afw_safe_cast_integer_to_size(afw_integer_t integer, afw_xctx_t *xctx)
Safely cast afw_integer_t to afw_size_t.
#define AFW_URI_OCTET_ENCODE_URI
encode except A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #
afw_uri_encode(const afw_utf8_t *string, afw_uri_octet_type_t mask, const afw_pool_t *p, afw_xctx_t *xctx)
URI encode a string.
#define afw_utf8_create_copy(s, len, p, xctx)
Make a utf-8 sting from chars in pool specified.
const afw_utf8_z_t * afw_utf8_to_utf8_z(const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx)
Convert utf8 to utf8_z in specified pool.
afw_utf8_next_code_point(const afw_utf8_octet_t *s, afw_size_t *offset, afw_size_t len, afw_xctx_t *xctx)
Get next codepoint in utf-8.
#define afw_value_get_data_type(instance, xctx)
Call method get_data_type of interface afw_value.
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.
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_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_false
Adaptive value false.
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.
afw_value_empty_string
Adaptive value empty string.
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.
#define AFW_VALUE_INTERNAL(_VALUE_)
Macro to get const void * of the internal of a value.
afw_value_true
Adaptive value true.
Interface afw_data_type public struct.
Function execute parameter.
afw_xctx_t * xctx
The execution context (xctx) of caller.
const afw_pool_t * p
Pool for result.
const afw_data_type_t * data_type
This is the <dataType> for data type functions or NULL.
afw_size_t argc
This is the argv count not counting argv[0].
Interface afw_list public struct.
NFC normalized UTF-8 string.
struct for data type anyURI values.
struct for data type base64Binary values.
struct for data type double values.
struct for data type hexBinary values.
struct for data type integer values.
struct for data type list values.
Interface afw_value public struct.
struct for data type string values.
Interface afw_xctx public struct.