Adaptive Framework
0.9.0
|
Files | |
file | afw_compile.h |
Header file for Adaptive Framework Compile. | |
Data Structures | |
struct | afw_compile_type_info_s |
Struc for afw_compile_type_info_t. More... | |
Macros | |
#define | afw_compile_and_evaluate_type(compile_type, string, source_location, p, xctx) |
Convience macro to call afw_compile_and_evaluate() with compile_type. More... | |
#define | afw_compile_to_value(string, source_location, compile_type, parent, shared, p, xctx) |
Compile string to adaptive value. More... | |
#define | afw_compile_expression(string, source_location, parent, shared, p, xctx) |
Compile expression. More... | |
#define | afw_compile_hybrid_source(string, source_location, parent, shared, p, xctx) |
Compile hybrid. More... | |
#define | afw_compile_template(string, source_location, parent, shared, p, xctx) |
Compile template. More... | |
Typedefs | |
typedef enum afw_compile_residual_check_e | afw_compile_residual_check_t |
Residual checking options. | |
Enumerations | |
enum | afw_compile_residual_check_e { afw_compile_residual_check_none , afw_compile_residual_check_to_newline , afw_compile_residual_check_to_full } |
Residual checking options. | |
Functions | |
const afw_compile_type_info_t * | afw_compile_type_get_info_by_pneumonic (const afw_utf8_t *pneumonic, const afw_xctx_t *xctx) |
Return compile type info for a pneumonic. More... | |
const afw_compile_type_info_t * | afw_compile_type_get_info (afw_compile_type_t compile_type, const afw_xctx_t *xctx) |
Return info for a afw_compile_type_t. More... | |
const afw_compile_shared_t * | afw_compile_shared_create (const afw_pool_t *p, afw_xctx_t *xctx) |
Created a struct for sharing resources by multiple compiles. More... | |
const afw_value_t * | afw_compile_and_evaluate (const afw_utf8_t *string, 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 string. More... | |
const afw_value_t * | 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. More... | |
const afw_value_t * | afw_compile_hybrid (const afw_value_t *value, const afw_utf8_t *source_location, const afw_value_compiled_value_t *parent, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx) |
Compile hybrid. More... | |
const afw_object_t * | afw_compile_to_object (const afw_utf8_t *string, const afw_utf8_t *source_location, const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_boolean_t cede_p, const afw_pool_t *p, afw_xctx_t *xctx) |
Compile string to adaptive object. More... | |
void | afw_compile_expressions_templates_and_hybrids (const afw_object_t *object, const afw_utf8_t *source_location, afw_boolean_t recursive, const afw_compile_shared_t *shared, afw_xctx_t *xctx) |
Compile object's expressions, templates, and hybrids. More... | |
const afw_object_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. More... | |
void | afw_compile_split_qualified_name (const afw_utf8_t *qualified_name, afw_utf8_t *qualifier, afw_utf8_t *name, afw_xctx_t *xctx) |
Split name with optional qualifier. More... | |
const afw_utf8_t * | afw_compile_source_location_of_value (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx) |
Return the source location of a value. More... | |
Adaptive Framework Compile AFW syntax.
#define afw_compile_and_evaluate_type | ( | compile_type, | |
string, | |||
source_location, | |||
p, | |||
xctx | |||
) |
Convience macro to call afw_compile_and_evaluate() with compile_type.
compile_type | appended to "afw_compile_type_" for option. |
string | to compile and evaluate. |
source_location | to associate with compiled string or NULL. |
p | to use for result. |
xctx | of caller. |
Definition at line 118 of file afw_compile.h.
#define afw_compile_expression | ( | string, | |
source_location, | |||
parent, | |||
shared, | |||
p, | |||
xctx | |||
) |
Compile expression.
string | containing expression to compile. |
source_location | to associate with compiled string or NULL. |
parent | compiled value for contextual and shared resource or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
Either shared, parent, or p must be specified. The p used by the parser is shared->p, parent->p, or p as available in that order.
Definition at line 210 of file afw_compile.h.
#define afw_compile_hybrid_source | ( | string, | |
source_location, | |||
parent, | |||
shared, | |||
p, | |||
xctx | |||
) |
Compile hybrid.
string | containing hybrid source to compile. |
source_location | to associate with compiled string or NULL. |
parent | compiled value for contextual and shared resource or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
Either shared, parent, or p must be specified. The p used by the parser is shared->p, parent->p, or p as available in that order.
Definition at line 256 of file afw_compile.h.
#define afw_compile_template | ( | string, | |
source_location, | |||
parent, | |||
shared, | |||
p, | |||
xctx | |||
) |
Compile template.
string | containing template to compile. |
source_location | to associate with compiled string or NULL. |
parent | compiled value for contextual and shared resource or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
Either shared, parent, or p must be specified. The p used by the parser is shared->p, parent->p, or p as available in that order.
Definition at line 278 of file afw_compile.h.
#define afw_compile_to_value | ( | string, | |
source_location, | |||
compile_type, | |||
parent, | |||
shared, | |||
p, | |||
xctx | |||
) |
Compile string to adaptive value.
string | to compile. |
source_location | to associate with compiled string or NULL. |
compile_type | Compile type. |
parent | compiled value for contextual and shared resource or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
Either shared, parent, or p must be specified. The p used by the parser is shared->p, parent->p, or p as available in that order.
This function can be used for callbacks of type afw_utf8_to_value_t.
If source_location is NULL and path is specified, the path will be used as the source location.
The meta.path and meta.parentPaths of any compiled object is always used to set the corresponding values in the new object.
Definition at line 189 of file afw_compile.h.
const afw_value_t* afw_compile_and_evaluate | ( | const afw_utf8_t * | string, |
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 string.
string | to compile and evaluate. |
source_location | to associate with compiled string or NULL. |
compile_type | Compile type. |
p | to use for result. |
xctx | of caller. |
Definition at line 66 of file afw_compile.c.
void afw_compile_expressions_templates_and_hybrids | ( | const afw_object_t * | object, |
const afw_utf8_t * | source_location, | ||
afw_boolean_t | recursive, | ||
const afw_compile_shared_t * | shared, | ||
afw_xctx_t * | xctx | ||
) |
Compile object's expressions, templates, and hybrids.
object | to process. |
source_location | to associate with compiled string or NULL. |
recursive | indicates object should be processed recursively. |
shared | struct for shared compile resources or NULL. |
xctx | of caller. |
The object must be mutable. The p of the object will be used.
Embedded objects are processed as well.
Property source_location defaults to the object path.
" property " followed by the property name will be appended to the source_location when appropriate.
All single data type expression, template, and hybrid values in object will be replaced with the their compiled value.
The compiled value will be evaluated each time the property in the object is accessed in the context of that access.
This function is called for each conf and map object.
Definition at line 411 of file afw_compile.c.
const afw_value_t* afw_compile_hybrid | ( | const afw_value_t * | value, |
const afw_utf8_t * | source_location, | ||
const afw_value_compiled_value_t * | parent, | ||
const afw_compile_shared_t * | shared, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Compile hybrid.
value | containing hybrid to compile. |
source_location | to associate with compiled string or NULL. |
parent | compiled value for contextual and shared resource or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
Either shared, parent, or p must be specified. The p used by the parser is shared->p, parent->p, or p as available in that order.
Definition at line 385 of file afw_compile.c.
const afw_object_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.
object | to process. |
source_location | to associate with compiled string or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
This was originally written to process a qualifier object which is just an object where all properties are hybrids. The resulting object contains properties representing variables and their evaluated values. See afw_xctx_push_qualifier_object().
Definition at line 499 of file afw_compile.c.
const afw_compile_shared_t* afw_compile_shared_create | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx | ||
) |
Created a struct for sharing resources by multiple compiles.
string | to compile or NULL. |
p | to use for result. |
xctx | of caller. |
The purpose of this struct is to allow multiple compiles that have a p with the same lifetime to share strings, literals, etc.
Definition at line 2168 of file afw_compile_lexical.c.
const afw_utf8_t* afw_compile_source_location_of_value | ( | const afw_value_t * | value, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Return the source location of a value.
value | |
p | to use for result or NULL. |
xctx | of caller |
Definition at line 578 of file afw_compile.c.
void afw_compile_split_qualified_name | ( | const afw_utf8_t * | qualified_name, |
afw_utf8_t * | qualifier, | ||
afw_utf8_t * | name, | ||
afw_xctx_t * | xctx | ||
) |
Split name with optional qualifier.
qualified_name | (qualifier:: optional) |
qualifier | is preallocated place to return qualifier. |
name | is preallocated place to return name. |
xctx | of caller. |
Definition at line 548 of file afw_compile.c.
const afw_object_t* afw_compile_to_object | ( | const afw_utf8_t * | string, |
const afw_utf8_t * | source_location, | ||
const afw_utf8_t * | adaptor_id, | ||
const afw_utf8_t * | object_type_id, | ||
const afw_utf8_t * | object_id, | ||
afw_boolean_t | cede_p, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Compile string to adaptive object.
string | to compile. |
source_location | to associate with compiled string or NULL. |
adaptor_id | to use for created object or NULL. |
object_type_id | to use for created object or NULL. |
object_id | to use for created object or NULL. |
cede_p | if true, cede control of p to the created object. |
p | to use for result or NULL. |
xctx | of caller. |
If source_location is NULL and path is specified, adaptor_id, object_type_id, and object_id will be used to produce a path that will be used as the source location.
If adaptor_id is NULL, object_type_id and object_id must be NULL. If they're NULL, the object's meta will not be set.
Definition at line 313 of file afw_compile.c.
const afw_value_t* 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.
string | to compile or NULL. |
callback | to get an octet or NULL. |
callback_data | to pass to callback function or NULL. |
source_location | to associate with compiled string or NULL. |
compile_type | Compile type. |
residual_check | option. |
parent | compiled value for contextual and shared resource or NULL. |
shared | struct for shared compile resources or NULL. |
p | to use for result or NULL. |
xctx | of caller. |
Either shared, parent, or p must be specified. The p used by the parser is shared->p, parent->p, or p as available in that order.
Either string or callback must be non-NULL. If both are non-NULL, the string will be processed first.
If source_location is NULL and path is specified, the path will be used as the source location.
The meta.path and meta.parentPaths of any compiled object is always used to set the corresponding values in the new object.
Definition at line 140 of file afw_compile.c.
const afw_compile_type_info_t* afw_compile_type_get_info | ( | afw_compile_type_t | compile_type, |
const afw_xctx_t * | xctx | ||
) |
Return info for a afw_compile_type_t.
compile_type. |
Definition at line 120 of file afw_compile.c.
const afw_compile_type_info_t* afw_compile_type_get_info_by_pneumonic | ( | const afw_utf8_t * | pneumonic, |
const afw_xctx_t * | xctx | ||
) |
Return compile type info for a pneumonic.
pneumonic | of a compile type. |
Definition at line 97 of file afw_compile.c.