Adaptive Framework
0.9.0
|
Files | |
file | afw_stack.h |
Adaptive Framework stack support. | |
Macros | |
#define | afw_stack_create(typedef_name, initial_count, maximum_count, create_subpool_pool, p, xctx) |
Create a stack for the specified typedef. More... | |
#define | afw_stack_release(instance, xctx) afw_stack_release_impl( &((instance)->pub), xctx) |
Release stack implementation. More... | |
#define | afw_stack_copy(instance, count, ptr, p, xctx) afw_stack_copy_impl( &((instance)->pub), count, ptr, p, xctx) |
Copy stack. More... | |
#define | afw_stack_copy_and_release(instance, count, ptr, p, xctx) |
Copy and release stack. More... | |
#define | afw_stack_is_empty(instance) ((instance)->top < (instance)->first) |
Determine is a stack is empty. More... | |
#define | afw_stack_pop(instance, xctx) |
Decrement stack->top to location of previous entry. More... | |
#define | afw_stack_count(instance, xctx) ((instance)->top + 1 - (instance)->first)) |
Number of entries in stack. More... | |
#define | afw_stack_push(instance, xctx) |
Increment stack->top to location of next entry and returns *top. More... | |
#define | afw_stack_push_direct(instance, xctx) |
Increment stack->top to location of next entry and returns top. More... | |
#define | afw_stack_push_and_get_entry(instance, entry, xctx) |
Increment stack->top to location of next entry and get entry. More... | |
#define | afw_stack_set_empty(instance) (instance)->top = ((instance)->first) - 1 |
Increment stack->top to location of next entry. More... | |
Functions | |
afw_stack_t * | afw_stack_create_impl (afw_size_t entry_size, afw_size_t initial_count, afw_size_t maximum_count, afw_boolean_t create_subpool_pool, const afw_pool_t *p, afw_xctx_t *xctx) |
Create a stack implementation. More... | |
void | afw_stack_release_impl (afw_stack_t *instance, afw_xctx_t *xctx) |
Release stack implementation. More... | |
void | afw_stack_copy_impl (afw_stack_t *instance, afw_size_t *count, const void ***ptr, const afw_pool_t *p, afw_xctx_t *xctx) |
Copy stack implementation. More... | |
void | afw_stack_extend_impl (afw_stack_t *instance, afw_xctx_t *xctx) |
Extend stack implementation. More... | |
afw_stack_internal_set_qualifier_stack (afw_xctx_t *xctx) | |
afw_stack_internal_set_evaluation_stack (afw_xctx_t *xctx) | |
Adaptive Framework Stack.
#define afw_stack_copy | ( | instance, | |
count, | |||
ptr, | |||
p, | |||
xctx | |||
) | afw_stack_copy_impl( &((instance)->pub), count, ptr, p, xctx) |
Copy stack.
instance | of AFW_STACK_STRUCT(). |
count | is place to return count. |
ptr | is place to return pointer to copy. |
p | to use for result. |
xctx | of caller. |
Definition at line 100 of file afw_stack.h.
#define afw_stack_copy_and_release | ( | instance, | |
count, | |||
ptr, | |||
p, | |||
xctx | |||
) |
Copy and release stack.
instance | of AFW_STACK_STRUCT(). |
count | is place to return count or NULL. |
ptr | is place to return pointer to copy. |
p | to use for result. |
xctx | of caller. |
Definition at line 131 of file afw_stack.h.
#define afw_stack_count | ( | instance, | |
xctx | |||
) | ((instance)->top + 1 - (instance)->first)) |
Number of entries in stack.
instance. | |
xctx | of caller. |
Definition at line 181 of file afw_stack.h.
#define afw_stack_create | ( | typedef_name, | |
initial_count, | |||
maximum_count, | |||
create_subpool_pool, | |||
p, | |||
xctx | |||
) |
Create a stack for the specified typedef.
typedef_name | (See AFW_STACK_STRUCT macro in afw_common.h) |
initial_count | |
maximum_count | or 0 if no limit |
create_subpool_pool | if true. |
p | for stack |
xctx | of caller |
Definition at line 40 of file afw_stack.h.
#define afw_stack_is_empty | ( | instance | ) | ((instance)->top < (instance)->first) |
Determine is a stack is empty.
instance. | stack->top will point to uninitialize storage. If needed the stack's extend will be called, so stack first and end may change after afw_stack_push*(). |
Definition at line 157 of file afw_stack.h.
#define afw_stack_pop | ( | instance, | |
xctx | |||
) |
Decrement stack->top to location of previous entry.
instance. | |
xctx | of caller. |
An error will be thrown on underflow.
Definition at line 168 of file afw_stack.h.
#define afw_stack_push | ( | instance, | |
xctx | |||
) |
Increment stack->top to location of next entry and returns *top.
instance | of AFW_STACK_STRUCT(). |
xctx | of caller. |
stack->top will point to uninitialize storage. If needed the stack's extend will be called, so stack first and end may change after afw_stack_push*().
Definition at line 195 of file afw_stack.h.
#define afw_stack_push_and_get_entry | ( | instance, | |
entry, | |||
xctx | |||
) |
Increment stack->top to location of next entry and get entry.
instance | of AFW_STACK_STRUCT(). |
xctx | of caller. |
stack->top will point to uninitialize storage. If needed the stack's extend will be called, so stack first and end may change after afw_stack_push*().
Definition at line 230 of file afw_stack.h.
#define afw_stack_push_direct | ( | instance, | |
xctx | |||
) |
Increment stack->top to location of next entry and returns top.
instance | of AFW_STACK_STRUCT(). |
xctx | of caller. |
stack->top will point to uninitialize storage. If needed the stack's extend will be called, so stack first and end may change after afw_stack_push*().
Definition at line 213 of file afw_stack.h.
#define afw_stack_release | ( | instance, | |
xctx | |||
) | afw_stack_release_impl( &((instance)->pub), xctx) |
Release stack implementation.
instance | of AFW_STACK_STRUCT(). |
xctx | of caller. |
Definition at line 75 of file afw_stack.h.
#define afw_stack_set_empty | ( | instance | ) | (instance)->top = ((instance)->first) - 1 |
Increment stack->top to location of next entry.
instance. | stack->top will point to uninitialize storage. If needed the stack's extend will be called, so stack first and end may change after afw_stack_push*(). |
Definition at line 243 of file afw_stack.h.
void afw_stack_copy_impl | ( | afw_stack_t * | instance, |
afw_size_t * | count, | ||
const void *** | ptr, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Copy stack implementation.
instance | |
count | is place to return count or NULL. |
ptr | is place to return pointer to copy. |
p | to use for result. |
xctx | of caller. |
This is normally called by macro afw_stack_copy().
Definition at line 148 of file afw_stack.c.
afw_stack_t* afw_stack_create_impl | ( | afw_size_t | entry_size, |
afw_size_t | initial_count, | ||
afw_size_t | maximum_count, | ||
afw_boolean_t | create_subpool_pool, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a stack implementation.
entry_size | |
initial_count | |
maximum_count | or 0 for no limit. |
create_subpool_pool | if true. |
p | for stack. |
xctx | of caller. |
This is normally called by macro afw_stack_create().
Definition at line 99 of file afw_stack.c.
void afw_stack_extend_impl | ( | afw_stack_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Extend stack implementation.
instance | |
xctx | of caller. |
This is normally called by a afw_stack_push*() macro.
Definition at line 176 of file afw_stack.c.
afw_stack_internal_set_qualifier_stack | ( | afw_xctx_t * | xctx | ) |
self->maximum_count should be able to be 0, but the entries are the full struct. When an expand happens, all of these structs are copied to another area so they have different addresses.
To allow this, all code must access these entries indirectly by using an index.
Definition at line 31 of file afw_stack.c.
void afw_stack_release_impl | ( | afw_stack_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Release stack implementation.
instance | |
xctx | of caller. |
This is normally called by macro afw_stack_release().
Definition at line 131 of file afw_stack.c.