Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
afw_common.h File Reference

Adaptive Framework Common Header. More...

#include "afw_doxygen.h"
#include <apr_general.h>
#include <apr_tables.h>
#include <apr_strings.h>
#include <apr_time.h>
#include <apr_hash.h>
#include <apr_buckets.h>
#include <apr_atomic.h>
#include <apr_thread_proc.h>
#include <apr_thread_rwlock.h>
#include <assert.h>
#include <limits.h>
#include <setjmp.h>
#include <string.h>
#include <stdint.h>
#include <stdarg.h>
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
#include "afw_common_opaques.h"
#include "afw_interface_opaques.h"
#include "afw_declare_helpers.h"
#include "afw_associative_array_template.h"

Go to the source code of this file.

Data Structures

struct  afw_memory_s
 Struct for memory pointer and size. More...
 
struct  afw_utf8_s
 NFC normalized UTF-8 string. More...
 
union  afw_utf8_utf8_z_s
 NFC normalized UTF-8 string accessible as afw_utf8_t or afw_utf8_z_t. More...
 
struct  afw_utf8_array_s
 Array of strings. More...
 
struct  afw_stack_s
 Struct for afw_stack_t typedef. More...
 
struct  afw_name_value_s
 Typedef for name/value pair. More...
 
struct  afw_key_string_s
 Typedef for key/string pair. More...
 
struct  afw_key_z_string_z_s
 Typedef for key/string pair that have both utf8 and utf8_z. More...
 
struct  afw_object_meta_s
 Typedef for meta variable in afw_object interface. More...
 
struct  afw_environment_s
 Struct for typedef afw_environment_t defined in afw_common.h. More...
 
union  afw_c_types_u
 Typedef for union of all cType. More...
 
struct  afw_time_with_offset_s
 Time with offset (old) More...
 
struct  afw_yearMonthDuration_s
 yearMonth duration More...
 
struct  afw_dayTimeDuration_s
 dayTime duration More...
 
struct  afw_time_duration_s
 Time duration. More...
 
struct  afw_time_zone_s
 time zone More...
 
struct  afw_date_no_time_zone_s
 date with no time zone. More...
 
struct  afw_date_s
 date with time zone. More...
 
struct  afw_time_no_time_zone_s
 time with no time zone. More...
 
struct  afw_time_s
 time with time zone. More...
 
struct  afw_dateTime_s
 date, time, and time zone. More...
 

Macros

#define AFW_POSSIBLY_UNUSED_VARIABLE
 Macro to avoid unused variable warning. More...
 
#define AFW_ASSERT(e)   assert(e)
 
#define offsetof(type, member)   __builtin_offsetof (type, member)
 
#define AFW_ADAPTOR_ID   "afw"
 
#define AFW_STRINGIFY(x)   AFW_STRINGIFY_x(x)
 Evaluate x and quote the results.
 
#define AFW_STRINGIFY_x(x)   #x
 
#define AFW__FILE_LINE__   __FILE__ ":" AFW_STRINGIFY(__LINE__)
 file:line
 
#define AFW_INT32_MIN   -2147483647 - 1
 Min int32.
 
#define AFW_INT32_MAX   2147483647
 Max int32.
 
#define AFW_UINT16_MAX   65536
 Max uint32.
 
#define AFW_UINT32_MAX   4294967296
 Max uint32.
 
#define AFW_UTF8_Z_LEN   -1
 String is NUL (0) terminate. More...
 
#define AFW_INTEGER_MAX_BUFFER   21
 this is the maximum number of digits that can be produced by afw_integer_t plus negative sign plus null terminator. Largest negative 64 bit int is -9223372036854775808 Largest positive 64 bit int is 9223372036854775807
 
#define AFW_INTEGER_MAX   APR_INT64_MAX
 largest afw_integer_t
 
#define AFW_INTEGER_Q_MAX   "9223372036854775807"
 largest afw_integer_t quoted
 
#define AFW_INTEGER_MIN   APR_INT64_MIN
 smallest afw_integer_t
 
#define AFW_INTEGER_Q_MIN   "-9223372036854775808"
 smallest afw_integer_t quoted
 
#define AFW_INTEGER_MAX_SAFE_DOUBLE   9007199254740991
 largest afw_integer_t value that a double can hold.
 
#define AFW_INTEGER_MIN_SAFE_DOUBLE   -9007199254740991
 smallest afw_integer_t value that a double can hold.
 
#define AFW_INTEGER_IS_SAFE_DOUBLE(integer)
 Tests integer to be safely held in a double. More...
 
#define AFW_INTEGER_FMT   APR_INT64_T_FMT
 Format string specifier used for afw_integer_t.
 
#define AFW_INTEGER_MAX_DIGITS   19
 afw_integer_t max digits.
 
#define AFW_Q_INTEGER_MAX_DIGITS   "19"
 afw_integer_t max digits in quotes.
 
#define AFW_SIZE_T_FMT   APR_SIZE_T_FMT
 Format string specifier used for afw_size_t.
 
#define AFW_SIZE_T_MAX   APR_SIZE_MAX
 afw_size_t max.
 
#define AFW_SIZE_T_MAX_DIGITS   19
 afw_size_t max digits.
 
#define AFW_Q_SIZE_T_MAX_DIGITS   "19"
 afw_size_t max digits in quotes.
 
#define AFW_SIZE_T_MAX_BUFFER   AFW_SIZE_T_MAX_DIGITS + 1
 this is the maximum number of digits that can be produced by afw_size_t plus null terminator.
 
#define AFW_TRUE   true
 
#define AFW_FALSE   false
 
#define AFW_CRLF   "\x0d\x0a"
 
#define AFW_CRLF_STRLEN   2
 
#define AFW_COMPILE_TYPE_MAP(XX)
 Compile Type Map. More...
 
#define XX(name, data_type, compile_function, description)    afw_compile_type_ ## name,
 
#define AFW_UTF8_LITERAL(A_STRING)   {A_STRING, sizeof(A_STRING) - 1}
 String literal initializer. More...
 
#define AFW_UTF8_FMT   ".*s"
 Format string specifier used for afw_utf8_t.
 
#define AFW_UTF8_CONTEXTUAL_LABEL_FMT_SEP   "> "
 Format string used for source location separator.
 
#define AFW_UTF8_CONTEXTUAL_LABEL_FMT   AFW_UTF8_FMT AFW_UTF8_CONTEXTUAL_LABEL_FMT_SEP
 Format string used for source location.
 
#define AFW_UTF8_FMT_ARG(A_STRING)    (int)(A_STRING)->len, (const char *)(A_STRING)->s
 Convenience Macro for use with AFW_UTF8_FMT to specify arg. More...
 
#define AFW_UTF8_FMT_OPTIONAL_ARG(A_STRING)
 Convenience Macro for use with AFW_UTF8_FMT to specify optional arg. More...
 
#define AFW_UTF8_FMT_OPTIONAL_UNDEFINED_ARG(A_STRING)
 Convenience Macro for use with AFW_UTF8_FMT to specify optional arg. More...
 
#define AFW_MESSAGE_PREFIX   __FILE__ ":" AFW_STRINGIFY(__LINE__) " "
 Macro to produce prefix for AFW messages.
 
#define AFW_UTF8_ENCODING   "UTF-8"
 UTF-8 encoding.
 
#define AFW_STACK_STRUCT(struct_name, entry_type)
 Define a struct for a stack with the specified entry type. More...
 
#define AFW_ERROR_CODE_MAP(XX)
 Error code map. IMPORTANT>>> Do not change the order of these entries. The order must match the order of the error codes in afw_error_code_t as originally released since the internal number will be externally compile in. More...
 
#define XX(id, error_allow_in_response, http_response_code, description)    afw_error_code_ ## id,
 
#define AFW_SERVICE_STARTUP_MAP(XX)
 Map used for afw_service_startup_t enum. More...
 
#define XX(id, desc)   afw_service_startup_ ## id,
 
#define AFW_SERVICE_STATUS_MAP(XX)
 Map used for afw_service_status_t enum. More...
 
#define XX(id, desc)   afw_service_status_ ## id,
 
#define afw_thread_mutex_t   apr_thread_mutex_t
 Uses apr_thread_mutex_t asis. See afw_thread.h.
 
#define afw_thread_mutex_create   apr_thread_mutex_create
 Uses apr_thread_mutex_t asis.
 
#define afw_thread_mutex_lock   apr_thread_mutex_lock
 Uses apr_thread_mutex_t asis.
 
#define afw_thread_mutex_trylock   apr_thread_mutex_trylock
 Uses apr_thread_mutex_trylock asis.
 
#define afw_thread_mutex_unlock   apr_thread_mutex_unlock
 Uses apr_thread_mutex_unlock asis.
 
#define afw_thread_mutex_destroy   apr_thread_mutex_destroy
 Uses apr_thread_mutex_destroy asis.
 
#define AFW_THREAD_FUNCTION   APR_THREAD_FUNC
 Uses APR_THREAD_FUNC as AFW_THREAD_FUNCTION.
 
#define AFW_ENVIRONMENT_DEFAULT_EVALUATION_STACK_INITIAL_COUNT   100
 Default for afw_environment_t evaluation_stack_initial_count.
 
#define AFW_ENVIRONMENT_DEFAULT_EVALUATION_STACK_MAXIMUM_COUNT   200
 Default for afw_environment_t evaluation_stack_maximum_count.
 

Typedefs

typedef apr_size_t afw_size_t
 size_t.
 
typedef apr_off_t afw_off_t
 off_t.
 
typedef int8_t afw_int8_t
 8-bit signed integer.
 
typedef apr_int16_t afw_int16_t
 16-bit signed integer.
 
typedef apr_int32_t afw_int32_t
 32-bit signed integer.
 
typedef apr_int64_t afw_int64_t
 64-bit signed integer.
 
typedef uint8_t afw_uint8_t
 8-bit unsigned integer.
 
typedef apr_uint16_t afw_uint16_t
 16-bit unsigned integer.
 
typedef apr_uint32_t afw_uint32_t
 32-bit unsigned integer.
 
typedef apr_uint64_t afw_uint64_t
 64-bit unsigned integer.
 
typedef float afw_float32_t
 32-bit float.
 
typedef double afw_float64_t
 64-bit float.
 
typedef double afw_float_t
 Normal float.
 
typedef double afw_double_t
 Normal AFW number is double.
 
typedef afw_int32_t afw_code_point_t
 Unicode code point.
 
typedef unsigned char afw_byte_t
 A byte of memory (unsigned). More...
 
typedef unsigned char afw_octet_t
 8 bits (unsigned). More...
 
typedef char afw_utf8_octet_t
 8 bits of utf-8 codepoint. More...
 
typedef afw_code_point_t(* afw_code_point_get_cb_t) (void *data, afw_xctx_t *xctx)
 Get Unicode code point callback. More...
 
typedef int(* afw_utf8_octet_get_cb_t) (afw_utf8_octet_t *octet, void *data, afw_xctx_t *xctx)
 Get an utf-8 octet (8 bits). More...
 
typedef apr_int64_t afw_integer_t
 typedef for big signed int.
 
typedef apr_uint64_t afw_unsigned_integer_t
 typedef for big unsigned int.
 
typedef _Bool afw_boolean_t
 
typedef enum afw_compile_type_e afw_compile_type_t
 Compile type enum.
 
typedef struct afw_memory_s afw_memory_t
 Struct for memory pointer and size. More...
 
typedef afw_utf8_octet_t afw_utf8_z_t
 NFC normalized UTF-8 null terminated string. More...
 
typedef struct afw_utf8_s afw_utf8_t
 NFC normalized UTF-8 string. More...
 
typedef union afw_utf8_utf8_z_s afw_utf8_utf8_z_t
 NFC normalized UTF-8 string accessible as afw_utf8_t or afw_utf8_z_t.
 
typedef struct afw_utf8_array_s afw_utf8_array_t
 Array of strings.
 
typedef uint32_t afw_u_cp_t
 A Unicode codepoint. Range is 0 to 0x10ffff. Other values are illegal Unicode codepoints.
 
typedef char * afw_uri_t
 this implementation uses UTF-8.
 
typedef int afw_log_priority_mask_t
 
typedef int afw_rc_t
 
typedef struct afw_name_value_s afw_name_value_t
 Typedef for name/value pair.
 
typedef struct afw_key_string_s afw_key_string_t
 Typedef for key/string pair.
 
typedef struct afw_key_z_string_z_s afw_key_z_string_z_t
 Typedef for key/string pair that have both utf8 and utf8_z.
 
typedef struct afw_object_meta_s afw_object_meta_t
 Typedef for meta variable in afw_object interface. More...
 
typedef enum afw_error_code_e afw_error_code_t
 
typedef void(* afw_pool_cleanup_function_p_t) (void *data, void *data2, const afw_pool_t *p, afw_xctx_t *xctx)
 Typedef for pool cleanup functions. More...
 
typedef const afw_value_t *(* afw_xctx_get_variable_t) (const afw_xctx_qualifier_stack_entry_t *entry, const afw_utf8_t *name, afw_xctx_t *xctx)
 Typedef for function to get a qualified variable. More...
 
typedef enum afw_log_priority_e afw_log_priority_t
 Log levels. See afw_log.h for more information.
 
typedef enum afw_adaptor_journal_option_e afw_adaptor_journal_option_t
 Typedef for afw_adaptor_journal get_entry options enum. More...
 
typedef afw_boolean_t(* afw_object_cb_t) (const afw_object_t *object, void *context, afw_xctx_t *xctx)
 Typedef for afw_adaptor_session_object callback. More...
 
typedef afw_boolean_t(* afw_value_cb_t) (const void *value, void *context, afw_xctx_t *xctx)
 Typedef for value callback. More...
 
typedef afw_size_t(* afw_read_cb_t) (void *context, const void *buffer, afw_size_t size, afw_boolean_t *more_to_read, const afw_pool_t *p, afw_xctx_t *xctx)
 Typedef for read callback function. More...
 
typedef afw_size_t(* afw_write_cb_t) (void *context, const void *buffer, afw_size_t size, const afw_pool_t *p, afw_xctx_t *xctx)
 Typedef for write callback function. More...
 
typedef const afw_value_t *(* afw_runtime_value_accessor_t) (const afw_runtime_object_map_property_t *property, const void *internal, const afw_pool_t *p, afw_xctx_t *xctx)
 
typedef const afw_value_t *(* afw_function_execute_cb_t) (afw_function_execute_t *x)
 Typedef for function execute functions. More...
 
typedef const afw_value_t *(* afw_function_thunk_execute_t) (const afw_value_function_thunk_t *function, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx)
 Typedef for function thunk execute functions. More...
 
typedef const afw_utf8_t *(* afw_function_arg_check_t) (afw_function_execute_t *x, afw_size_t argc, const afw_value_t *argv[], const afw_pool_t *p, afw_xctx_t *xctx)
 Typedef for function arg check functions. More...
 
typedef enum afw_service_startup_e afw_service_startup_t
 Typedef for service startup type enum. More...
 
typedef enum afw_service_status_e afw_service_status_t
 Typedef for service status enum. More...
 
typedef void *(AFW_THREAD_FUNCTIONafw_thread_function_t) (const afw_thread_t *thread, void *arg)
 Typedef for thread start function.
 
typedef struct afw_thread_attr_s afw_thread_attr_t
 Typedef for afw_thread_attr.
 
typedef union afw_c_types_u afw_c_types_t
 Typedef for union of all cType.
 
typedef struct afw_time_with_offset_s afw_time_with_offset_t
 Time with offset (old) More...
 
typedef struct afw_yearMonthDuration_s afw_yearMonthDuration_t
 yearMonth duration More...
 
typedef struct afw_dayTimeDuration_s afw_dayTimeDuration_t
 dayTime duration More...
 
typedef struct afw_time_duration_s afw_time_duration_t
 Time duration.
 
typedef struct afw_time_zone_s afw_time_zone_t
 time zone
 
typedef struct afw_date_no_time_zone_s afw_date_no_time_zone_t
 date with no time zone.
 
typedef struct afw_date_s afw_date_t
 date with time zone.
 
typedef struct afw_time_no_time_zone_s afw_time_no_time_zone_t
 time with no time zone.
 
typedef struct afw_time_s afw_time_t
 time with time zone.
 
typedef struct afw_dateTime_s afw_dateTime_t
 date, time, and time zone.
 
typedef void(* afw_service_wrapper_start_cb) (void *data, afw_xctx_t *xctx)
 Typedef for service wrapper start call back. More...
 
typedef void(* afw_service_wrapper_stop_cb) (void *data, afw_xctx_t *xctx)
 Typedef for service wrapper stop call back. More...
 

Enumerations

enum  afw_compile_type_e { afw_compile_type_count }
 Compile type enum.
 
enum  afw_error_code_e { afw_error_code_is_not_specified = 0 , afw_error_code_highest_afw = 1000 }
 
enum  afw_log_priority_e {
  afw_log_priority_invalid = -1 , afw_log_priority_min = 0 , afw_log_priority_emerg = 0 , afw_log_priority_alert = 1 ,
  afw_log_priority_crit = 2 , afw_log_priority_err = 3 , afw_log_priority_warning = 4 , afw_log_priority_notice = 5 ,
  afw_log_priority_info = 6 , afw_log_priority_debug = 7 , afw_log_priority_max = 7 , afw_log_priority_trace_min = 8 ,
  afw_log_priority_trace1 = 8 , afw_log_priority_trace2 = 9 , afw_log_priority_trace3 = 10 , afw_log_priority_trace4 = 11 ,
  afw_log_priority_trace5 = 12 , afw_log_priority_trace6 = 13 , afw_log_priority_trace7 = 14 , afw_log_priority_trace8 = 15 ,
  afw_log_priority_trace_max = 15
}
 Log levels. See afw_log.h for more information. More...
 
enum  afw_adaptor_journal_option_e {
  afw_adaptor_journal_option_get_first , afw_adaptor_journal_option_get_by_cursor , afw_adaptor_journal_option_get_next_after_cursor , afw_adaptor_journal_option_get_next_for_consumer ,
  afw_adaptor_journal_option_get_next_for_consumer_after_cursor , afw_adaptor_journal_option_advance_cursor_for_consumer
}
 Typedef for afw_adaptor_journal get_entry options enum. More...
 
enum  afw_service_startup_e { afw_service_startup_invalid }
 Typedef for service startup type enum. More...
 
enum  afw_service_status_e { afw_service_status_invalid }
 Typedef for service status enum. More...
 

Functions

 AFW_STACK_STRUCT (afw_utf8_stack_s, afw_utf8_t)
 afw_utf8_t stack struct.
 
 AFW_STACK_STRUCT (afw_const_utf8_a_stack_s, const afw_utf8_t *)
 const afw_utf8_t * stack struct.
 
 AFW_STACK_STRUCT (afw_name_value_stack_s, afw_name_value_t)
 const afw_utf8_t * stack struct.
 

Detailed Description

Adaptive Framework Common Header.

This header contains #includes for common headers that do not have other Adaptive Framework dependencies, typedefs required by afw_interface.h, as well as other #defines and typedefs that are common to all Adaptive Framework applications.

This header is included by afw_interface.h, afw_minimal.h, and afw.h, there is no need to include it directly.

The major Adaptive Framework headers are arranged as follows:

Major AFW header description
afw_common.h This header. Included by afw_interface.h, afw_minimal.h, and afw.h.
afw_common_opaques.h Contains common opaque typedefs. Included by afw_common.h.
afw_interface.h Generated AFW interface header. Can be included in all headers other than opaque only ones.
afw_interface_opaques.h Generated AFW interface opaques. Included by afw_common.h.
afw_minimal.h Contains #includes for some core headers that only #include afw_interface.h. Can be included in headers that are not included by afw_minimal.h.
afw.h Contains #includes for most core headers and will generally be included in all Adaptive Framework .c files.

Definition in file afw_common.h.