![]() |
Files | |
file | array.h |
Simple fixed C array helpers & iterators. | |
file | dg/array.h |
Declare vector container/patterns Everything in the ve. | |
file | vector.h |
Declare vector container/patterns. | |
file | ll.h |
"Invasive" Linked List C templates | |
file | fifo.c |
Unit tests for fifo/lifo stacks. | |
file | fifo.h |
Simple first-in, first-out stacks. | |
file | imultiset.h |
"Invasive" set of ordered, non-unique data | |
file | iset.h |
"Invasive" set of ordered, unique data | |
file | ll.c |
"Invasive" Linked List unit tests | |
file | ll.h |
"Invasive" Linked List C templates | |
file | tree.c |
Tree basic implementation. | |
file | tree.h |
Tree Base Class templates. | |
file | tree.temp.h |
Tree template functions. | |
Modules | |
Singly Linked Lists | |
First-in-first-out stacks | |
Defines | |
#define | countof(a) (sizeof (a)/sizeof (*a)) |
Determine number of members within an array. | |
#define | indexof(a, p) ((p)-(a)) |
Determine index of pointer 'p' in array 'a'. | |
#define | inbounds(a, i) ( (size_t)(i) < countof(a) ) |
See if index 'i' is in bounds for fully typed simple array 'a'. | |
#define | memberof(a, p) ( inbounds((a),indexof((a),(p))) && ((void*)((a)+indexof((a),(p))) == (void*)(p)) ) |
See if 'p' is a valid pointer to a member of 'a'. | |
#define | array_bsort(atype, array, count, compare) |
Bubble sort an array Wins over qsort for small, or nearly sorted arrays Usually wins over qsort in 2D animation. | |
#define | array_qsort(atype, array, count, compare) qsort((array),(count),sizeof(atype),(int (*)(const void *, const void *))(compare)) |
Quicker sort an array Wins over bsort for most unsorted cases Usually wins over qsort in 2D animation. | |
#define | array_lsearch(atype, array, count, compare, key) lsearch( (key), (array), (count), sizeof(atype), (compare) ) |
Linear search a sorted array for a particular key. | |
#define | array_bsearch(atype, array, count, compare, key) bsearch( (key), (array), (count), sizeof(atype), (compare) ) |
Binary search a sorted array for a particular key. | |
#define | array_fill(type, dst, count, value) |
Fill memory with a value, by type. | |
#define | ctl_declare_array(label, type, size) |
Declare a fixed array type Similar to 'vector.h' in every way except it doesn't allocate or grow. | |
#define | ctl_array_foreach_const(label, instance, iterator) |
Iterate each member of a array. | |
#define | ctl_array_foreach_const_reverse(label, instance, iterator) |
Iterate each member of a array, backwards. | |
#define | ctl_array_foreach(label, instance, iterator) |
Iterate each member of a array. | |
#define | ctl_array_foreach_reverse(label, instance, iterator) |
Iterate each member of a array, backwards. | |
#define | ctl_array_foreach_mutable(label, instance, iterator) |
Iterate each member of a array. | |
#define | ctl_array_foreach_mutable_reverse(label, instance, iterator) |
Iterate each member of a array backwards. | |
#define | ctl_implement_array(label, type, rawcook) |
Make array functions and data from template. | |
#define | ctl_declare_list(label, type) |
Declare a doubly-linked list Like stl std::list, allocates objects by list membership, and frees them when removed from list. | |
#define | ctl_list_foreach(label, instance, iterator) |
Iterate each member of a linked list. | |
#define | ctl_list_foreach_reverse(label, instance, iterator) |
Iterate each member of a linked list backwards. | |
#define | ctl_list_foreach_const(label, instance, iterator) |
Iterate each member of a linked list. | |
#define | ctl_list_foreach_const_reverse(label, instance, iterator) |
Iterate each member of a linked list backwards. | |
#define | ctl_list_foreach_mutable(label, instance, iterator) |
Iterate each member of a linked list, and the currently iterated member can be deleted. | |
#define | ctl_list_foreach_mutable_reverse(label, instance, iterator) |
Iterate each member of a linked list backwards, and the currently iterated member can be deleted. | |
#define | CTL_POOL_DELTA 16 |
Define how fast memory pool lists grow This can be predefined/redefined to grow pools by larger/smaller segments when allocating nodes for non-invasive containers. | |
#define | ctl_implement_list(label, type) |
Implement a linked list. | |
#define | ctl_declare_map(label, keytype, type) ctl_declare_map_base(label,keytype,type,ctlt_unique) |
Declare a map (a container of sorted, unique objects, sorted/accessed by a key) Like stl std::map, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree. | |
#define | ctl_implement_map(label, keytype, type) ctl_implement_map_base(label,keytype,type,ctlt_unique) |
Implement a map (a container of sorted, unique objects) Like stl std::map, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree. | |
#define | ctl_map_foreach(label, instance, iterator) |
map iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code | |
#define | ctl_map_foreach_const(label, instance, iterator) |
Constant fixed C map iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_map_foreach_reverse(label, instance, iterator) |
Backward C map iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_map_foreach_const_reverse(label, instance, iterator) |
Backward, constant C map iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_map_from(label, instance, key, iterator) |
Iterators for avl data; key some point in tree to the end in a given direction. | |
#define | ctl_map_from_const(label, instance, key, iterator) |
Const data variant. | |
#define | ctl_map_from_reverse(label, instance, key, iterator) |
Iterate backwards variant. | |
#define | ctl_map_from_const_reverse(label, instance, key, iterator) |
Const data variant of reverse variant. | |
#define | ctl_map_from_to(label, instance, keyfrom, keyto, iterator) |
From->to iterators for avl data. | |
#define | ctl_map_from_to_const(label, instance, keyfrom, keyto, iterator) |
Const data variant. | |
#define | ctl_map_from_to_reverse(label, instance, keyfrom, keyto, iterator) |
Iterate backwards variant. | |
#define | ctl_map_from_to_const_reverse(label, instance, keyfrom, keyto, iterator) |
Const data variant of reverse variant. | |
#define | ctl_declare_multimap(label, keytype, type) ctl_declare_map_base(label,keytype,type,ctlt_multiple) |
Declare a multimap (a container of sorted, NON-unique objects, sorted/accessed by a key) Like stl std::multimap, allocates objects by container membership, and frees them when removed from container. | |
#define | ctl_implement_multimap(label, keytype, type) ctl_implement_map_base(label,keytype,type,ctlt_multiple) |
Implement a multimap (a container of sorted, NON-unique objects, sorted/accessed by a key) Like stl std::multimap, allocates objects by container membership, and frees them when removed from container. | |
#define | ctl_multimap_foreach(label, instance, iterator) |
multimap iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code | |
#define | ctl_multimap_foreach_const(label, instance, iterator) |
Constant fixed C multimap iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_multimap_foreach_reverse(label, instance, iterator) |
Backward C multimap iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_multimap_foreach_const_reverse(label, instance, iterator) |
Backward, constant C multimap iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_multimap_from(label, instance, key, iterator) |
Iterators for avl data; key some point in tree to the end in a given direction. | |
#define | ctl_multimap_from_const(label, instance, key, iterator) |
Const data variant. | |
#define | ctl_multimap_from_reverse(label, instance, key, iterator) |
Iterate backwards variant. | |
#define | ctl_multimap_from_const_reverse(label, instance, key, iterator) |
Const data variant of reverse variant. | |
#define | ctl_multimap_from_to(label, instance, keyfrom, keyto, iterator) |
From->to iterators for avl data. | |
#define | ctl_multimap_from_to_const(label, instance, keyfrom, keyto, iterator) |
Const data variant. | |
#define | ctl_multimap_from_to_reverse(label, instance, keyfrom, keyto, iterator) |
Iterate backwards variant. | |
#define | ctl_multimap_from_to_const_reverse(label, instance, keyfrom, keyto, iterator) |
Const data variant of reverse variant. | |
#define | CTL_POOL_DELTA 16 |
Define how fast memory pool lists grow This can be predefined/redefined to grow pools by larger/smaller segments when allocating nodes for non-invasive containers. | |
#define | ctl_declare_set(label, type) ctl_declare_set_base(label,type,ctlt_unique) |
Declare a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree. | |
#define | ctl_declare_set(label, type) ctl_declare_set_base(label,type,ctlt_unique) |
Declare a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree. | |
#define | ctl_implement_set(label, type) ctl_implement_set_base(label,type,ctlt_unique) |
Implement a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree. | |
#define | ctl_implement_set(label, type) ctl_implement_set_base(label,type,ctlt_unique) |
Implement a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree. | |
#define | ctl_set_foreach(label, instance, iterator) |
set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code | |
#define | ctl_set_foreach_const(label, instance, iterator) |
Constant fixed C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_set_foreach_reverse(label, instance, iterator) |
Backward C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_set_foreach_const_reverse(label, instance, iterator) |
Backward, constant C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_set_from(label, instance, key, iterator) |
Iterators for avl data; key some point in tree to the end in a given direction. | |
#define | ctl_set_from_const(label, instance, key, iterator) |
Const data variant. | |
#define | ctl_set_from_reverse(label, instance, key, iterator) |
Iterate backwards variant. | |
#define | ctl_set_from_const_reverse(label, instance, key, iterator) |
Const data variant of reverse variant. | |
#define | ctl_set_from_to(label, instance, keyfrom, keyto, iterator) |
From->to iterators for avl data. | |
#define | ctl_set_from_to_const(label, instance, keyfrom, keyto, iterator) |
Const data variant. | |
#define | ctl_set_from_to_reverse(label, instance, keyfrom, keyto, iterator) |
Iterate backwards variant. | |
#define | ctl_set_from_to_const_reverse(label, instance, keyfrom, keyto, iterator) |
Const data variant of reverse variant. | |
#define | ctl_declare_multiset(label, type) ctl_declare_set_base(label,type,ctlt_multiple) |
Declare a multiset (a container of sorted, NON-unique objects) Like stl std::multiset, allocates objects by container membership, and frees them when removed from container. | |
#define | ctl_implement_multiset(label, type) ctl_implement_set_base(label,type,ctlt_multiple) |
Implement a multiset (a container of sorted, NON-unique objects) Like stl std::multiset, allocates objects by container membership, and frees them when removed from container. | |
#define | ctl_multiset_foreach(label, instance, iterator) |
set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code | |
#define | ctl_multiset_foreach_const(label, instance, iterator) |
Constant fixed C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_multiset_foreach_reverse(label, instance, iterator) |
Backward C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_multiset_foreach_const_reverse(label, instance, iterator) |
Backward, constant C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_multiset_from(label, instance, key, iterator) |
Iterators for avl data; key some point in tree to the end in a given direction. | |
#define | ctl_multiset_from_const(label, instance, key, iterator) |
Const data variant. | |
#define | ctl_multiset_from_reverse(label, instance, key, iterator) |
Iterate backwards variant. | |
#define | ctl_multiset_from_const_reverse(label, instance, key, iterator) |
Const data variant of reverse variant. | |
#define | ctl_multiset_from_to(label, instance, keyfrom, keyto, iterator) |
From->to iterators for avl data. | |
#define | ctl_multiset_from_to_const(label, instance, keyfrom, keyto, iterator) |
Const data variant. | |
#define | ctl_multiset_from_to_reverse(label, instance, keyfrom, keyto, iterator) |
Iterate backwards variant. | |
#define | ctl_multiset_from_to_const_reverse(label, instance, keyfrom, keyto, iterator) |
Const data variant of reverse variant. | |
#define | CTL_POOL_DELTA 16 |
Define how fast memory pool lists grow This can be predefined/redefined to grow pools by larger/smaller segments when allocating nodes for non-invasive containers. | |
#define | ctl_declare_vector(label, type) |
Declare a vector (a dynamically grown/shrunk array of items). | |
#define | ctl_vector_foreach_const(label, instance, iterator) |
Iterate each member of a vector. | |
#define | ctl_vector_foreach_const_reverse(label, instance, iterator) |
Iterate each member of a vector, backwards. | |
#define | ctl_vector_foreach(label, instance, iterator) |
Iterate each member of a vector. | |
#define | ctl_vector_foreach_reverse(label, instance, iterator) |
Iterate each member of a vector, backwards. | |
#define | ctl_vector_foreach_mutable(label, instance, iterator) |
Iterate each member of a vector. | |
#define | ctl_vector_foreach_mutable_reverse(label, instance, iterator) |
Iterate each member of a vector backwards. | |
#define | ctl_implement_vector(label, type, rawcook) |
Make vector functions and data from template. | |
#define | ctl_imultiset(type, mlabel, compare) ctl_tree(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple) |
Get the class name of the 'multiset'; a tree that can contain multiple instances of data. | |
#define | ctl_imultiset_decllink(type, mlabel) ctlt_node_type(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple) mlabel |
Declare a tree link member. | |
#define | ctl_imultiset_initlink(type, mlabel, curr) ctl_tree_node_init(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, &curr->mlabel) |
Initialize a link. | |
#define | ctl_imultiset_auto(type, mlabel, compare, ilabel) ctl_tree_auto(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, compare, ilabel ) |
Make a tree from auto variables for stack or global use Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_imultiset_init(type, mlabel, compare, ilabel) ctl_tree_init(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, compare, ilabel ) |
Make a tree initially empty. | |
#define | ctl_imultiset_size(type, mlabel, ilabel) ctl_tree_size(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, ilabel ) |
Get size of tree. | |
#define | ctl_imultiset_insert(type, mlabel, ilabel, data) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, insert)( (ilabel), (data) ) |
Insert a new member (MUST NOT BE IN ANY OTHER TREE). | |
#define | ctl_imultiset_find(type, mlabel, ilabel, value) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, find)( (ilabel), (value) ) |
Find a member, given a template member as a value. | |
#define | ctl_imultiset_remove(type, mlabel, ilabel, value) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, remove)( (ilabel), (value) ) |
Remove a member. | |
#define | ctl_imultiset_unlink(type, mlabel, ilabel, data) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, unlink)( (ilabel), (data) ) |
Remove a member. | |
#define | ctl_imultiset_reset(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, reset)( ilabel ) |
Remove a all tree members member. | |
#define | ctl_imultiset_front(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, front)( ilabel ) |
Get first member of set. | |
#define | ctl_imultiset_back(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, back)( ilabel ) |
Get last member of set. | |
#define | ctl_imultiset_pop_front(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, pop_front)( ilabel ) |
Get and remove the first member of the set. | |
#define | ctl_imultiset_pop_back(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, pop_back)( ilabel ) |
Get and remove the last member of the set. | |
#define | ctl_imultiset_foreach(type, mlabel, ilabel, label) |
set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code | |
#define | ctl_imultiset_foreach_const(type, mlabel, ilabel, label) |
Constant fixed C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_imultiset_foreach_reverse(type, mlabel, ilabel, label) |
Backward C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_imultiset_foreach_reverse_const(type, mlabel, ilabel, label) |
Backward, constant C set iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_imultiset_from(type, mlabel, ilabel, from, label) |
Iterators for avl data; from some point in tree to the end in a given direction. | |
#define | ctl_imultiset_from_const(type, mlabel, ilabel, from, label) |
Const data variant. | |
#define | ctl_imultiset_from_reverse(type, mlabel, ilabel, from, label) |
Iterate backwards variant. | |
#define | ctl_imultiset_from_reverse_const(type, mlabel, ilabel, from, label) |
Const data variant of reverse variant. | |
#define | ctl_imultiset_from_to(type, mlabel, ilabel, from, to, label) |
From->to iterators for avl data. | |
#define | ctl_imultiset_from_to_const(type, mlabel, ilabel, from, to, label) |
Const data variant. | |
#define | ctl_imultiset_from_to_reverse(type, mlabel, ilabel, from, to, label) |
Iterate backwards variant. | |
#define | ctl_imultiset_from_to_reverse_const(type, mlabel, ilabel, from, to, label) |
Const data variant of reverse variant. | |
#define | ctl_iset(type, mlabel, compare) ctl_tree(ctlt_relative(offsetof(type,mlabel)),ctlt_unique) |
Get the class name of the 'set'; unique-instance tree. | |
#define | ctl_iset_decllink(type, mlabel) ctlt_node_type(ctlt_relative(offsetof(type,mlabel)),ctlt_unique) mlabel |
Declare a tree link member. | |
#define | ctl_iset_initlink(type, mlabel, curr) ctl_tree_node_init(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, &curr->mlabel) |
Initialize a link. | |
#define | ctl_iset_auto(type, mlabel, compare, ilabel) ctl_tree_auto(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, compare, ilabel ) |
Make a tree from auto variables for stack or global use Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_iset_init(type, mlabel, compare, ilabel) ctl_tree_init(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, compare, ilabel ) |
Make a tree initially empty. | |
#define | ctl_iset_size(type, mlabel, ilabel) ctl_tree_size(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, ilabel ) |
Get size of tree. | |
#define | ctl_iset_insert(type, mlabel, ilabel, data) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, insert)( (ilabel), (data) ) |
Insert a new member (MUST NOT BE IN ANY OTHER TREE). | |
#define | ctl_iset_find(type, mlabel, ilabel, value) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, find)( (ilabel), (value) ) |
Find a member, given a template member as a value. | |
#define | ctl_iset_remove(type, mlabel, ilabel, value) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, remove)( (ilabel), (value) ) |
Remove a member. | |
#define | ctl_iset_unlink(type, mlabel, ilabel, data) (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, unlink)( (ilabel), (data) ) |
Remove a member. | |
#define | ctl_iset_reset(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, reset)( ilabel ) |
Remove a all tree members member. | |
#define | ctl_iset_front(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, front)( ilabel ) |
Get first member of set. | |
#define | ctl_iset_back(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, back)( ilabel ) |
Get last member of set. | |
#define | ctl_iset_pop_front(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, pop_front)( ilabel ) |
Get and remove the first member of the set. | |
#define | ctl_iset_pop_back(type, mlabel, ilabel) ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, pop_back)( ilabel ) |
Get and remove the last member of the set. | |
#define | ctl_iset_foreach(type, mlabel, ilabel, label) |
iset iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code | |
#define | ctl_iset_foreach_const(type, mlabel, ilabel, label) |
Constant fixed C iset iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_iset_foreach_reverse(type, mlabel, ilabel, label) |
Backward C iset iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_iset_foreach_reverse_const(type, mlabel, ilabel, label) |
Backward, constant C iset iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | ctl_iset_from(type, mlabel, ilabel, from, label) |
Iterators for avl data; from some point in tree to the end in a given direction. | |
#define | ctl_iset_from_const(type, mlabel, ilabel, from, label) |
Const data variant. | |
#define | ctl_iset_from_reverse(type, mlabel, ilabel, from, label) |
Iterate backwards variant. | |
#define | ctl_iset_from_reverse_const(type, mlabel, ilabel, from, label) |
Const data variant of reverse variant. | |
#define | ctl_iset_from_to(type, mlabel, ilabel, from, to, label) |
From->to iterators for avl data. | |
#define | ctl_iset_from_to_const(type, mlabel, ilabel, from, to, label) |
Const data variant. | |
#define | ctl_iset_from_to_reverse(type, mlabel, ilabel, from, to, label) |
Iterate backwards variant. | |
#define | ctl_iset_from_to_reverse_const(type, mlabel, ilabel, from, to, label) |
Const data variant of reverse variant. | |
#define | ctl_tree(offset, multiple) ppConcat4(ctl_tree_,ctlt_offset_name(offset),_,ctlt_multi_name(multiple)) |
Build template naming from offset,multiple. | |
#define | ctl_tree_(offset, multiple, label) ppConcat3(ctl_tree(offset,multiple),_,label) |
Build template function/data naming. | |
#define | ctl_tree_node_to_data(offset, multiple, tree, node) ppConcat(ctl_tree_node_data_,offset)(offset,multiple, tree, node ) |
Get data from node. | |
#define | ctl_tree_data_to_node(offset, multiple, tree, data) ppConcat(ctl_tree_data_node_,offset)(offset,multiple, tree, data ) |
Get node from from data. | |
#define | ctl_tree_node_init(offset, multiple, node) { (node)->left = (node)->right = NULL; (node)->balance = 0; } |
Initialize a node to a clear state. | |
#define | ctl_tree_auto(offset, multiple, comparator, label) |
Initialize a tree on stack or as global Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_tree_init(offset, multiple, comparator, tree) { (tree)->found = (tree)->root = NULL; (tree)->compare = (tree_compare)(comparator); (tree)->size = 0; ctlt_offset_for_relative(offset, (tree)->data_offset = ctlt_getoffset(offset,multiple);) } |
Initialize a tree tree. | |
#define | ctl_tree_size(offset, multiple,tree) ((tree)->size) |
Get the count of members in this tree. |
#define array_bsearch | ( | atype, | |||
array, | |||||
count, | |||||
compare, | |||||
key | ) | bsearch( (key), (array), (count), sizeof(atype), (compare) ) |
Binary search a sorted array for a particular key.
atype | Type of array elements | |
array | Instance of array | |
count | Count of elements to sort | |
compare | Function that returns ((p1)-(p2)), like qsort wants from memcmp,strcmp,etc. | |
key | Pointer to thing we're looking for in array |
#define array_bsort | ( | atype, | |||
array, | |||||
count, | |||||
compare | ) |
Value:
{\ atype* aStart = (array);\ atype* aEnd = aStart + (count);\ int bSorted;\ do {\ atype* aCurr = aStart;\ aEnd--;\ bSorted = 0;\ while( aCurr < aEnd )\ {\ if( compare( *aCurr, *(aCurr+1) ) > 0 )\ {\ atype tmp = *aCurr;\ *aCurr = *(aCurr+1);\ *(aCurr+1) = tmp;\ bSorted = 1;\ }\ aCurr++;\ }\ } while( bSorted );\ }
atype | Type of array elements | |
array | Instance of array | |
count | Count of elements to sort | |
compare | Function or macro that returns ((p1)-(p2)), like qsort wants from memcmp,strcmp,etc. |
#define array_fill | ( | type, | |||
dst, | |||||
count, | |||||
value | ) |
Value:
{\
type* ppScr2(fill,begin) = (dst);\
type* ppScr2(fill,curr) = ppScr2(fill,begin)+(count);\
type ppScr2(fill,val) = (value);\
while( ppScr2(fill,curr)-- > ppScr2(fill,begin) )\
*ppScr2(fill,curr) = ppScr2(fill,val);\
}
type | What type is the collection | |
dst | Where to do the fill | |
count | Count of items to fill with value | |
value | Value to fill those items with |
#define array_lsearch | ( | atype, | |||
array, | |||||
count, | |||||
compare, | |||||
key | ) | lsearch( (key), (array), (count), sizeof(atype), (compare) ) |
Linear search a sorted array for a particular key.
atype | Type of array elements | |
array | Instance of array | |
count | Count of elements to sort | |
compare | Function that returns ((p1)-(p2)), like qsort wants from memcmp,strcmp,etc. | |
key | Pointer to thing we're looking for in array |
#define array_qsort | ( | atype, | |||
array, | |||||
count, | |||||
compare | ) | qsort((array),(count),sizeof(atype),(int (*)(const void *, const void *))(compare)) |
Quicker sort an array Wins over bsort for most unsorted cases Usually wins over qsort in 2D animation.
atype | Type of array elements | |
array | Instance of array | |
count | Count of elements to sort | |
compare | Function that returns ((p1)-(p2)), like qsort wants from memcmp,strcmp,etc. |
Definition at line 99 of file array.h.
Referenced by BMI_Clut_Make(), and GUI_BlibInit().
#define countof | ( | a | ) | (sizeof (a)/sizeof (*a)) |
Determine number of members within an array.
a | Array we're checking; must be a fully qualified C array, with known length. |
Definition at line 20 of file array.h.
Referenced by BMI_Clut_Make(), ctl_profiles_dump(), ctl_profiles_dump_averages_sheet(), Socket_Create(), Socket_Create_Client(), Socket_Create_Listener(), Socket_Create_Login(), Socket_Create_Raw(), and Socket_Create_User().
#define ctl_array_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator = (instance)->array;\ const ppConcat(label,_type)* ppConcat(end_,iterator) = iterator + (instance)->count;\ for( ; iterator < ppConcat(end_,iterator); iterator++ )
label | Label given to array type | |
instance | Pointer to array instance | |
iterator | What the user wants to call the iterated pointer |
Definition at line 114 of file dg/array.h.
#define ctl_array_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
const ppConcat(label,_type)* iterator = (instance)->array;\ const ppConcat(label,_type)* ppConcat(end_,iterator) = iterator + (instance)->count;\ for( ; iterator < ppConcat(end_,iterator); iterator++ )
label | Label given to array type | |
instance | Pointer to array instance | |
iterator | What the user wants to call the iterated pointer |
Definition at line 83 of file dg/array.h.
#define ctl_array_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
const ppConcat(label,_type)* ppConcat(end_,iterator) = (instance)->array;\ const ppConcat(label,_type)* iterator = ppConcat(end_,iterator) + (instance)->count;\ while( iterator-- > ppConcat(end_,iterator) )
label | Label given to array type | |
instance | Pointer to array instance | |
iterator | What the user wants to call the iterated pointer |
Definition at line 98 of file dg/array.h.
#define ctl_array_foreach_mutable | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ int ppConcat(index_,iterator);\ label* ppConcat(instance_,iterator) = (instance);\ for( ppConcat(index_,iterator) = 0; ppConcat(index_,iterator) < (int)ppConcat(instance_,iterator)->count && intentional_assignment(iterator=ppConcat(instance_,iterator)->array + ppConcat(index_,iterator)); ppConcat(index_,iterator)++ )
label | Label given to array type | |
instance | Pointer to array instance | |
iterator | What the user wants to call the iterated pointer |
Definition at line 144 of file dg/array.h.
#define ctl_array_foreach_mutable_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ int ppConcat(index_,iterator);\ label* ppConcat(instance_,iterator) = (instance);\ for( ppConcat(index_,iterator) = (int)ppConcat(instance_,iterator)->count; ppConcat(index_,iterator) > 0 && intentional_assignment(iterator=ppConcat(instance_,iterator)->array + ppConcat(index_,iterator)-1); ppConcat(index_,iterator) = min(ppConcat(index_,iterator)-1,(int)ppConcat(instance_,iterator)->count) )
label | Label given to array type | |
instance | Pointer to array instance | |
iterator | What the user wants to call the iterated pointer |
Definition at line 159 of file dg/array.h.
#define ctl_array_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* ppConcat(end_,iterator) = (instance)->array;\ const ppConcat(label,_type)* iterator = ppConcat(end_,iterator) + (instance)->count;\ while( iterator-- > ppConcat(end_,iterator) )
label | Label given to array type | |
instance | Pointer to array instance | |
iterator | What the user wants to call the iterated pointer |
Definition at line 130 of file dg/array.h.
#define ctl_declare_array | ( | label, | |||
type, | |||||
size | ) |
Declare a fixed array type Similar to 'vector.h' in every way except it doesn't allocate or grow.
label | What to call the member | |
type | Type for vector contents | |
size | Maximum length this can ever be |
Definition at line 25 of file dg/array.h.
#define ctl_declare_list | ( | label, | |||
type | ) |
#define ctl_declare_map | ( | label, | |||
keytype, | |||||
type | ) | ctl_declare_map_base(label,keytype,type,ctlt_unique) |
Declare a map (a container of sorted, unique objects, sorted/accessed by a key) Like stl std::map, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree.
label | What to call the member | |
keytype | Type used to look up map contents | |
type | Type for map contents |
#define ctl_declare_multimap | ( | label, | |||
keytype, | |||||
type | ) | ctl_declare_map_base(label,keytype,type,ctlt_multiple) |
Declare a multimap (a container of sorted, NON-unique objects, sorted/accessed by a key) Like stl std::multimap, allocates objects by container membership, and frees them when removed from container.
label | What to call the member | |
keytype | Type used to look up map contents | |
type | Type for map contents |
#define ctl_declare_multiset | ( | label, | |||
type | ) | ctl_declare_set_base(label,type,ctlt_multiple) |
#define ctl_declare_set | ( | label, | |||
type | ) | ctl_declare_set_base(label,type,ctlt_unique) |
Declare a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree.
label | What to call the member | |
type | Type for set contents |
#define ctl_declare_set | ( | label, | |||
type | ) | ctl_declare_set_base(label,type,ctlt_unique) |
Declare a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree.
label | What to call the member | |
type | Type for set contents |
#define ctl_declare_vector | ( | label, | |||
type | ) |
Declare a vector (a dynamically grown/shrunk array of items).
label | What to call the member | |
type | Type for vector contents |
To use as a 'bag' (don't care about order), use label_bag_erase to remove members instead of label_erase or label_erase_range
Don't put objects that are pointed at by other things in a vector - they might move when the vector is modified.
You are MUCH better off using vector for scalars and smallish compounds containing mainly scalars. Though this supports full-blown records, using this for complex/large records will cost you dearly.
A vector of scalars, or a vector of coordinate sets is (generally) a more appropriate use for a vector than a vector of compounds containing compounds and containers.
Use a 'set' or 'multiset' with an 'index' member if you want to do fast lookups on complicated things.
Use a 'list' if you just want a queue of things you'll search linearly and insert randomly to, or as a fifo.
#define ctl_implement_array | ( | label, | |||
type, | |||||
rawcook | ) |
Make array functions and data from template.
label | What to call the member | |
type | Type for array contents | |
rawcook | 'ctl_cooked' for compounds with initializations 'ctl_raw' for data (like scalars) that doesn't need any particular value |
Definition at line 186 of file dg/array.h.
#define ctl_implement_list | ( | label, | |||
type | ) |
#define ctl_implement_map | ( | label, | |||
keytype, | |||||
type | ) | ctl_implement_map_base(label,keytype,type,ctlt_unique) |
Implement a map (a container of sorted, unique objects) Like stl std::map, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree.
label | What to call the member | |
keytype | Type used to look up map contents | |
type | Type for map contents |
#define ctl_implement_multimap | ( | label, | |||
keytype, | |||||
type | ) | ctl_implement_map_base(label,keytype,type,ctlt_multiple) |
Implement a multimap (a container of sorted, NON-unique objects, sorted/accessed by a key) Like stl std::multimap, allocates objects by container membership, and frees them when removed from container.
label | What to call the member | |
keytype | Type used to look up map contents | |
type | Type for map contents |
#define ctl_implement_multiset | ( | label, | |||
type | ) | ctl_implement_set_base(label,type,ctlt_multiple) |
#define ctl_implement_set | ( | label, | |||
type | ) | ctl_implement_set_base(label,type,ctlt_unique) |
Implement a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree.
label | What to call the member | |
type | Type for set contents |
#define ctl_implement_set | ( | label, | |||
type | ) | ctl_implement_set_base(label,type,ctlt_unique) |
Implement a set (a container of sorted, unique objects) Like stl std::set, allocates objects by container membership, and frees them when removed from container. Use 'label_set_order' to set the sort order before adding things to the tree.
label | What to call the member | |
type | Type for set contents |
#define ctl_implement_vector | ( | label, | |||
type, | |||||
rawcook | ) |
#define ctl_imultiset | ( | type, | |||
mlabel, | |||||
compare | ) | ctl_tree(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple) |
Get the class name of the 'multiset'; a tree that can contain multiple instances of data.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
compare | Template: Comparison of types for tree search/placement |
Definition at line 26 of file imultiset.h.
#define ctl_imultiset_auto | ( | type, | |||
mlabel, | |||||
compare, | |||||
ilabel | ) | ctl_tree_auto(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, compare, ilabel ) |
Make a tree from auto variables for stack or global use Uses non-standard ANSI extension: non-const initializers.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
compare | Template: Comparison of types for tree search/placement | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 55 of file imultiset.h.
#define ctl_imultiset_back | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, back)( ilabel ) |
Get last member of set.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 147 of file imultiset.h.
#define ctl_imultiset_decllink | ( | type, | |||
mlabel | ) | ctlt_node_type(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple) mlabel |
Declare a tree link member.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link |
Definition at line 34 of file imultiset.h.
#define ctl_imultiset_find | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
value | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, find)( (ilabel), (value) ) |
Find a member, given a template member as a value.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl | |
value | Pointer a node we manufactured to compare with |
Definition at line 98 of file imultiset.h.
#define ctl_imultiset_foreach | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_begin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl | |
label | What to call the iterator (i.e. curr) |
Definition at line 176 of file imultiset.h.
#define ctl_imultiset_foreach_const | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator ) ppConcat(stack_,label);\ const type* label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_begin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
label | What to call the iterator (i.e. curr) |
Definition at line 190 of file imultiset.h.
#define ctl_imultiset_foreach_reverse | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_rbegin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_prev)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
label | What to call the iterator (i.e. curr) |
Definition at line 204 of file imultiset.h.
#define ctl_imultiset_foreach_reverse_const | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator ) ppConcat(stack_,label);\ const type* label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_rbegin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_prev)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
label | What to call the iterator (i.e. curr) |
Definition at line 218 of file imultiset.h.
#define ctl_imultiset_from | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
from, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_begin_from)( &ppConcat(stack_,label), (ilabel), (from) );\ for ( ; label; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
from | Starting value as an ilabel-based type | |
label | What to call the iterator (i.e. curr) |
Definition at line 232 of file imultiset.h.
#define ctl_imultiset_from_to | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
from, | |||||
to, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_begin_from)( &ppConcat(stack_,label), (ilabel), (from) );\ for( ; label && (ilabel)->compare(label,(to)) < 0; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
from | Starting value as an ilabel-based type | |
to | Ending value as an ilabel-based type; | |
label | What to call the iterator (i.e. curr) 'to' value is not invlusive. If it encounters a value >= 'to' (<= for reverse), iteration stops. This behavior better supports floats or values where it's just easier to specify the next higher than the maximum of current. |
Definition at line 270 of file imultiset.h.
#define ctl_imultiset_front | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, front)( ilabel ) |
Get first member of set.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 138 of file imultiset.h.
#define ctl_imultiset_init | ( | type, | |||
mlabel, | |||||
compare, | |||||
ilabel | ) | ctl_tree_init(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, compare, ilabel ) |
Make a tree initially empty.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
compare | Template: Comparison of types for tree search/placement | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 66 of file imultiset.h.
#define ctl_imultiset_initlink | ( | type, | |||
mlabel, | |||||
curr | ) | ctl_tree_node_init(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, &curr->mlabel) |
Initialize a link.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
curr | Instance of link we are initializing |
Definition at line 44 of file imultiset.h.
#define ctl_imultiset_insert | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
data | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, insert)( (ilabel), (data) ) |
Insert a new member (MUST NOT BE IN ANY OTHER TREE).
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl | |
data | Pointer to new member we're adding |
Definition at line 87 of file imultiset.h.
#define ctl_imultiset_pop_back | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, pop_back)( ilabel ) |
Get and remove the last member of the set.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 165 of file imultiset.h.
#define ctl_imultiset_pop_front | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, pop_front)( ilabel ) |
Get and remove the first member of the set.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 156 of file imultiset.h.
#define ctl_imultiset_remove | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
value | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, remove)( (ilabel), (value) ) |
Remove a member.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl | |
value | Pointer a node we manufactured to compare with |
Definition at line 109 of file imultiset.h.
#define ctl_imultiset_reset | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, reset)( ilabel ) |
Remove a all tree members member.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 129 of file imultiset.h.
#define ctl_imultiset_size | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_size(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, ilabel ) |
Get size of tree.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl |
Definition at line 76 of file imultiset.h.
#define ctl_imultiset_unlink | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
data | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_multiple, unlink)( (ilabel), (data) ) |
Remove a member.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_imultiset_decl | |
data | Pointer to what is known to be the actual value from the tree |
Definition at line 120 of file imultiset.h.
#define ctl_iset | ( | type, | |||
mlabel, | |||||
compare | ) | ctl_tree(ctlt_relative(offsetof(type,mlabel)),ctlt_unique) |
#define ctl_iset_auto | ( | type, | |||
mlabel, | |||||
compare, | |||||
ilabel | ) | ctl_tree_auto(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, compare, ilabel ) |
Make a tree from auto variables for stack or global use Uses non-standard ANSI extension: non-const initializers.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
compare | Template: Comparison of types for tree search/placement | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl |
#define ctl_iset_back | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, back)( ilabel ) |
#define ctl_iset_decllink | ( | type, | |||
mlabel | ) | ctlt_node_type(ctlt_relative(offsetof(type,mlabel)),ctlt_unique) mlabel |
#define ctl_iset_find | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
value | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, find)( (ilabel), (value) ) |
Find a member, given a template member as a value.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl | |
value | Pointer a node we manufactured to compare with |
#define ctl_iset_foreach | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_begin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl | |
label | What to call the iterator (i.e. curr) |
#define ctl_iset_foreach_const | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator ) ppConcat(stack_,label);\ const type* label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_begin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
label | What to call the iterator (i.e. curr) |
#define ctl_iset_foreach_reverse | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_rbegin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_prev)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
label | What to call the iterator (i.e. curr) |
#define ctl_iset_foreach_reverse_const | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator ) ppConcat(stack_,label);\ const type* label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_rbegin)( &ppConcat(stack_,label), (ilabel) );\ for ( ; label; label = (const type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_prev)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
label | What to call the iterator (i.e. curr) |
#define ctl_iset_from | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
from, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_begin_from)( &ppConcat(stack_,label), (ilabel), (from) );\ for ( ; label; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
from | Starting value as an ilabel-based type | |
label | What to call the iterator (i.e. curr) |
#define ctl_iset_from_to | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
from, | |||||
to, | |||||
label | ) |
Value:
ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator ) ppConcat(stack_,label);\ type* label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_begin_from)( &ppConcat(stack_,label), (ilabel), (from) );\ for( ; label && (ilabel)->compare(label,(to)) < 0; label = (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, iterator_next)( &ppConcat(stack_,label) ) )
type | What type is the collection | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Pointer to instance of the ctl_rtree we're iterating | |
from | Starting value as an ilabel-based type | |
to | Ending value as an ilabel-based type; | |
label | What to call the iterator (i.e. curr) 'to' value is not invlusive. If it encounters a value >= 'to' (<= for reverse), iteration stops. This behavior better supports floats or values where it's just easier to specify the next higher than the maximum of current. |
#define ctl_iset_front | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, front)( ilabel ) |
#define ctl_iset_init | ( | type, | |||
mlabel, | |||||
compare, | |||||
ilabel | ) | ctl_tree_init(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, compare, ilabel ) |
Make a tree initially empty.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
compare | Template: Comparison of types for tree search/placement | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl |
#define ctl_iset_initlink | ( | type, | |||
mlabel, | |||||
curr | ) | ctl_tree_node_init(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, &curr->mlabel) |
#define ctl_iset_insert | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
data | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, insert)( (ilabel), (data) ) |
Insert a new member (MUST NOT BE IN ANY OTHER TREE).
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl | |
data | Pointer to new member we're adding |
#define ctl_iset_pop_back | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, pop_back)( ilabel ) |
#define ctl_iset_pop_front | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, pop_front)( ilabel ) |
#define ctl_iset_remove | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
value | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, remove)( (ilabel), (value) ) |
Remove a member.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl | |
value | Pointer a node we manufactured to compare with |
#define ctl_iset_reset | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, reset)( ilabel ) |
#define ctl_iset_size | ( | type, | |||
mlabel, | |||||
ilabel | ) | ctl_tree_size(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, ilabel ) |
#define ctl_iset_unlink | ( | type, | |||
mlabel, | |||||
ilabel, | |||||
data | ) | (type*)ctl_tree_(ctlt_relative(offsetof(type,mlabel)),ctlt_unique, unlink)( (ilabel), (data) ) |
Remove a member.
type | Template: Structure type this link belongs to. | |
mlabel | Template: A unique label for this sort of link | |
ilabel | Template/param: Whatever dereferencing is required + the base ilabel from ctl_iset_decl | |
data | Pointer to what is known to be the actual value from the tree |
#define ctl_list_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ ppConcat(label,_node)* ppConcat(_,iterator) = (instance)->_dllfront(list);\ for( ; NULL != ppConcat(_,iterator) && intentional_assignment(iterator = &ppConcat(_,iterator)->obj); ppConcat(_,iterator) = ppConcat(_,iterator)->_dllnext(link) )
label | Label given to linked list type | |
instance | Pointer to linked list instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_list_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
const ppConcat(label,_type)* iterator;\ const ppConcat(label,_node)* ppConcat(_,iterator) = (instance)->_dllfront(list);\ for( ; NULL != ppConcat(_,iterator) && intentional_assignment(iterator = &ppConcat(_,iterator)->obj); ppConcat(_,iterator) = ppConcat(_,iterator)->_dllnext(link) )
label | Label given to linked list type | |
instance | Pointer to linked list instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_list_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
const ppConcat(label,_type)* iterator;\ const ppConcat(label,_node)* ppConcat(_,iterator) = (instance)->_dllback(list);\ for( ; NULL != ppConcat(_,iterator) && intentional_assignment(iterator = &ppConcat(_,iterator)->obj); ppConcat(_,iterator) = ppConcat(_,iterator)->_dllprev(link) )
label | Label given to linked list type | |
instance | Pointer to linked list instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_list_foreach_mutable | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ ppConcat(label,_node)* ppConcat(_,iterator) = (instance)->_dllback(list);\ ppConcat(label,_node)* ppConcat3(_,iterator,_next) = ppConcat(_,iterator)?ppConcat(_,iterator)->_dllnext(link):NULL; \ for ( ; NULL != ppConcat(_,iterator) && intentional_assignment(iterator = &ppConcat(_,iterator)->obj); (void)(intentional_assignment(ppConcat(_,iterator) = ppConcat3(_,iterator,_next) ) && intentional_assignment(ppConcat3(_,iterator,_next) = ppConcat3(_,iterator,_next)->_dllnext(link))) )
label | Label given to linked list type | |
instance | Pointer to linked list instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_list_foreach_mutable_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ ppConcat(label,_node)* ppConcat(_,iterator) = (instance)->_dllfront(list);\ ppConcat(label,_node)* ppConcat3(_,iterator,_prev) = ppConcat(_,iterator)?ppConcat(_,iterator)->_dllprev(link):NULL; \ for ( ; NULL != ppConcat(_,iterator) && intentional_assignment(iterator = &ppConcat(_,iterator)->obj); (void)(intentional_assignment(ppConcat(_,iterator) = ppConcat3(_,iterator,_prev)) && intentional_assignment(ppConcat3(_,iterator,_prev) = ppConcat3(_,iterator,_prev)->_dllprev(link))) )
label | Label given to linked list type | |
instance | Pointer to linked list instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_list_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ ppConcat(label,_node)* ppConcat(_,iterator) = (instance)->_dllback(list);\ for( ; NULL != ppConcat(_,iterator) && intentional_assignment(iterator = &ppConcat(_,iterator)->obj); ppConcat(_,iterator) = ppConcat(_,iterator)->_dllprev(link) )
label | Label given to linked list type | |
instance | Pointer to linked list instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_map_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of map | |
instance | Pointer to map instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_map_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ const ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of map | |
instance | Pointer to map instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_map_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ const ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)(ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_prev)( &ppConcat(stack_,iterator) ), iterator=ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of map | |
instance | Pointer to map instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_map_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)(ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_prev)( &ppConcat(stack_,iterator) ), iterator=ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of map | |
instance | Pointer to map instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_map_from | ( | label, | |||
instance, | |||||
key, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (key) );\ ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label key declaration of map | |
instance | Pointer to map instance | |
iterator | What to call the iterator (i.e. curr) | |
key | Pointer to starting key value |
#define ctl_map_from_to | ( | label, | |||
instance, | |||||
keyfrom, | |||||
keyto, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (keyfrom) );\ const ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for( ; ppConcat(iterator,_key) && (instance)->compare(ppConcat(iterator,_key),(keyto)) < 0; ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of map | |
instance | Pointer to map instance | |
iterator | What to call the iterator (i.e. curr and curr_key) | |
keyfrom | Starting key value | |
keyto | Ending key value 'keyto' value is not invlusive. If it encounters a value >= 'keyto' (<= for reverse), iteration stops. This behavior better supports floats or values where it's just easier keyto specify the next higher than the maximum of current. |
#define ctl_multimap_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of multimap | |
instance | Pointer to multimap instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multimap_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ const ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of multimap | |
instance | Pointer to multimap instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multimap_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ const ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)(ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_prev)( &ppConcat(stack_,iterator) ), iterator=ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of multimap | |
instance | Pointer to multimap instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multimap_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)(ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_prev)( &ppConcat(stack_,iterator) ), iterator=ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of multimap | |
instance | Pointer to multimap instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multimap_from | ( | label, | |||
instance, | |||||
key, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (key) );\ ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for ( ; ppConcat(iterator,_key); ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label key declaration of multimap | |
instance | Pointer to multimap instance | |
iterator | What to call the iterator (i.e. curr) | |
key | Pointer to starting key value |
#define ctl_multimap_from_to | ( | label, | |||
instance, | |||||
keyfrom, | |||||
keyto, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_keytype)* ppConcat(iterator,_key) = (const ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (keyfrom) );\ const ppConcat(label,_type)* iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) );\ for( ; ppConcat(iterator,_key) && (instance)->compare(ppConcat(iterator,_key),(keyto)) < 0; ppConcat(iterator,_key) = (ppConcat(label,_keytype)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ), iterator = ppConcat(label,_obj_from_key)( ppConcat(iterator,_key) ) )
label | Label from declaration of multimap | |
instance | Pointer to multimap instance | |
iterator | What to call the iterator (i.e. curr and curr_key) | |
keyfrom | Starting key value | |
keyto | Ending key value 'keyto' value is not invlusive. If it encounters a value >= 'keyto' (<= for reverse), iteration stops. This behavior better supports floats or values where it's just easier keyto specify the next higher than the maximum of current. |
#define ctl_multiset_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of multiset | |
instance | Pointer to multiset instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multiset_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_type)* iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of multiset | |
instance | Pointer to multiset instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multiset_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_type)* iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple,iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_prev)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of multiset | |
instance | Pointer to multiset instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multiset_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple,iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_prev)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of multiset | |
instance | Pointer to multiset instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_multiset_from | ( | label, | |||
instance, | |||||
key, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (key) );\ for ( ; iterator; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label key declaration of multiset | |
instance | Pointer to multiset instance | |
iterator | What to call the iterator (i.e. curr) | |
key | Pointer to starting key value |
#define ctl_multiset_from_to | ( | label, | |||
instance, | |||||
keyfrom, | |||||
keyto, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (keyfrom) );\ for( ; iterator && (instance)->compare(iterator,(keyto)) < 0; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_multiple, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of multiset | |
instance | Pointer to multiset instance | |
iterator | What to call the iterator (i.e. curr ) | |
keyfrom | Starting key value | |
keyto | Ending key value 'keyto' value is not invlusive. If it encounters a value >= 'keyto' (<= for reverse), iteration stops. This behavior better supports floats or values where it's just easier keyto specify the next higher than the maximum of current. |
#define ctl_set_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of set | |
instance | Pointer to set instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_set_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_type)* iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique,iterator_begin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of set | |
instance | Pointer to set instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_set_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ const ppConcat(label,_type)* iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique,iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (const ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_prev)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of set | |
instance | Pointer to set instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_set_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique,iterator_rbegin)( &ppConcat(stack_,iterator), (instance) );\ for ( ; iterator; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_prev)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of set | |
instance | Pointer to set instance | |
iterator | What to call the iterator (i.e. curr) |
#define ctl_set_from | ( | label, | |||
instance, | |||||
key, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (key) );\ for ( ; iterator; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label key declaration of set | |
instance | Pointer to set instance | |
iterator | What to call the iterator (i.e. curr) | |
key | Pointer to starting key value |
#define ctl_set_from_to | ( | label, | |||
instance, | |||||
keyfrom, | |||||
keyto, | |||||
iterator | ) |
Value:
ppConcat(label,_iterator) ppConcat(stack_,iterator);\ ppConcat(label,_type)* iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_begin_from)( &ppConcat(stack_,iterator), (instance), (keyfrom) );\ for( ; iterator && (instance)->compare(iterator,(keyto)) < 0; iterator = (ppConcat(label,_type)*)ctl_tree_(ctlt_after,ctlt_unique, iterator_next)( &ppConcat(stack_,iterator) ) )
label | Label from declaration of set | |
instance | Pointer to set instance | |
iterator | What to call the iterator (i.e. curr ) | |
keyfrom | Starting key value | |
keyto | Ending key value 'keyto' value is not invlusive. If it encounters a value >= 'keyto' (<= for reverse), iteration stops. This behavior better supports floats or values where it's just easier keyto specify the next higher than the maximum of current. |
#define ctl_tree | ( | offset, | |||
multiple | ) | ppConcat4(ctl_tree_,ctlt_offset_name(offset),_,ctlt_multi_name(multiple)) |
#define ctl_tree_ | ( | offset, | |||
multiple, | |||||
label | ) | ppConcat3(ctl_tree(offset,multiple),_,label) |
#define ctl_tree_auto | ( | offset, | |||
multiple, | |||||
comparator, | |||||
label | ) |
Value:
ctl_tree(offset,multiple) label = \ { NULL, (tree_compare)(comparator), 0, NULL, ctlt_offset_for_relative(offset, ctlt_getoffset(offset,multiple)) }
offset | Template: How to find node from data, data from node | |
multiple | Template: Whether tree wants unique, or multiple copies of members | |
comparator | ctl_tree_comparator to order tree | |
label | What to call the tree |
#define ctl_tree_data_to_node | ( | offset, | |||
multiple, | |||||
tree, | |||||
data | ) | ppConcat(ctl_tree_data_node_,offset)(offset,multiple, tree, data ) |
Get node from from data.
offset | Template: How to find node from data, data from node | |
multiple | Template: Whether tree wants unique, or multiple copies of members | |
tree | Pointer to ctl_tree | |
data | Data pointer node to translate |
#define ctl_tree_init | ( | offset, | |||
multiple, | |||||
comparator, | |||||
tree | ) | { (tree)->found = (tree)->root = NULL; (tree)->compare = (tree_compare)(comparator); (tree)->size = 0; ctlt_offset_for_relative(offset, (tree)->data_offset = ctlt_getoffset(offset,multiple);) } |
#define ctl_tree_node_init | ( | offset, | |||
multiple, | |||||
node | ) | { (node)->left = (node)->right = NULL; (node)->balance = 0; } |
#define ctl_tree_node_to_data | ( | offset, | |||
multiple, | |||||
tree, | |||||
node | ) | ppConcat(ctl_tree_node_data_,offset)(offset,multiple, tree, node ) |
#define ctl_tree_size | ( | offset, | |||
multiple, | |||||
tree | ) | ((tree)->size) |
#define ctl_vector_foreach | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator = (instance)->array;\ const ppConcat(label,_type)* ppConcat(end_,iterator) = iterator + (instance)->count;\ for( ; iterator < ppConcat(end_,iterator); iterator++ )
label | Label given to vector type | |
instance | Pointer to vector instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_vector_foreach_const | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
const ppConcat(label,_type)* iterator = (instance)->array;\ const ppConcat(label,_type)* ppConcat(end_,iterator) = iterator + (instance)->count;\ for( ; iterator < ppConcat(end_,iterator); iterator++ )
label | Label given to vector type | |
instance | Pointer to vector instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_vector_foreach_const_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
const ppConcat(label,_type)* ppConcat(end_,iterator) = (instance)->array;\ const ppConcat(label,_type)* iterator = ppConcat(end_,iterator) + (instance)->count;\ while( iterator-- > ppConcat(end_,iterator) )
label | Label given to vector type | |
instance | Pointer to vector instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_vector_foreach_mutable | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ int ppConcat(index_,iterator);\ label* ppConcat(instance_,iterator) = (instance);\ for( ppConcat(index_,iterator) = 0; ppConcat(index_,iterator) < (int)ppConcat(instance_,iterator)->count && intentional_assignment(iterator=ppConcat(instance_,iterator)->array + ppConcat(index_,iterator)); ppConcat(index_,iterator)++ )
label | Label given to vector type | |
instance | Pointer to vector instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_vector_foreach_mutable_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* iterator;\ int ppConcat(index_,iterator);\ label* ppConcat(instance_,iterator) = (instance);\ for( ppConcat(index_,iterator) = (int)ppConcat(instance_,iterator)->count; ppConcat(index_,iterator) > 0 && intentional_assignment(iterator=ppConcat(instance_,iterator)->array + ppConcat(index_,iterator)-1); ppConcat(index_,iterator) = min(ppConcat(index_,iterator)-1,(int)ppConcat(instance_,iterator)->count) )
label | Label given to vector type | |
instance | Pointer to vector instance | |
iterator | What the user wants to call the iterated pointer |
#define ctl_vector_foreach_reverse | ( | label, | |||
instance, | |||||
iterator | ) |
Value:
ppConcat(label,_type)* ppConcat(end_,iterator) = (instance)->array;\ const ppConcat(label,_type)* iterator = ppConcat(end_,iterator) + (instance)->count;\ while( iterator-- > ppConcat(end_,iterator) )
label | Label given to vector type | |
instance | Pointer to vector instance | |
iterator | What the user wants to call the iterated pointer |
#define inbounds | ( | a, | |||
i | ) | ( (size_t)(i) < countof(a) ) |
#define indexof | ( | a, | |||
p | ) | ((p)-(a)) |
#define memberof | ( | a, | |||
p | ) | ( inbounds((a),indexof((a),(p))) && ((void*)((a)+indexof((a),(p))) == (void*)(p)) ) |