csnip
0.1
|
Macros | |
#define | csnip_slist_Init(head, tail, mnext) |
Initialize an slist. More... | |
#define | csnip_slist_PushHead(head, tail, mnext, el) |
Push an element to the head of an slist. | |
#define | csnip_slist_PopHead(head, tail, mnext) |
Pop the head of an slist. More... | |
#define | csnip_slist_PushTail(head, tail, mnext, el) |
Push an element to the tail of an slist. | |
#define | csnip_slist_InsertAfter(head, tail, mnext, loc, el) |
Insert an element after the end of the given location. More... | |
#define | CSNIP_SLIST_DECL_FUNCS(scope, prefix, entry_ptr_type, gen_args) |
Declare slist functions. More... | |
#define | CSNIP_SLIST_DEF_FUNCS(scope, prefix, entry_ptr_type, gen_args, phead, ptail, mnext) |
Define a set of slist functions. More... | |
#define CSNIP_SLIST_DECL_FUNCS | ( | scope, | |
prefix, | |||
entry_ptr_type, | |||
gen_args | |||
) |
This macro declares a set of slist functions that wrap the csnip_slist_* macros; the functions can be defined with CSNIP_SLIST_DEF_FUNCS(). For a description of the macro arguments, see CSNIP_SLIST_DEF_FUNCS().
#define CSNIP_SLIST_DEF_FUNCS | ( | scope, | |
prefix, | |||
entry_ptr_type, | |||
gen_args, | |||
phead, | |||
ptail, | |||
mnext | |||
) |
scope | the scope of the function declaration. |
prefix | the prefix for the function names. |
entry_ptr_type | pointer type to a list entry. |
gen_args | generic arguments to specify the list, of the form args(...) or noargs(). |
phead | lvalue pointer to the list head, can be expressed in terms of the gen_args arguements |
ptail | Like phead, but for the list tail. |
mnext | The struct entry name for pointers to the next entry. |
The list functions defined, are (without the prefix):
#define csnip_slist_Init | ( | head, | |
tail, | |||
mnext | |||
) |
#define csnip_slist_InsertAfter | ( | head, | |
tail, | |||
mnext, | |||
loc, | |||
el | |||
) |
head,tail,mnext | list description. |
loc | point after which to insert (pointer to a list element). |
el | element to insert. |
#define csnip_slist_PopHead | ( | head, | |
tail, | |||
mnext | |||
) |
Underflowing the list results in an assertion failure; therefore, only pop the list if it's known that the list is non-empty.