embedded-software
reusable software modules for embedded systems
|
#include <list.h>
Data Fields | |
list_link_t * | first |
first More... | |
list_link_t * | last |
last More... | |
uint16_t | length |
length More... | |
uint16_t | array_length |
array_length More... | |
list_link_t * | links |
links More... | |
uint16_t * | item_array |
item_array More... | |
uint16_t | item_size |
item_size More... | |
list_sort_fn_t | sort_fn |
sort_fn More... | |
list_identify_fn_t | identify_fn |
identify_fn More... | |
list_link_t * | working [2] |
working More... | |
list_link_t * | unlinked [2] |
unlinked More... | |
uint16_t | unlinked_count |
count of unlinked list items More... | |
The struct list_t is for a doubly-linked list of generic items. Elements of type list_link_t are used, each containing an item pointer, and pointers to next and previous links. first and last list_link_t elements are used to keep track of the ends of the list. length and array_length are used for the current length and maximum declared length of the list, equal to the maximum number of elements. The links list_link_t pointer points to an array of link elements. item_array points to an item array of size item_size. sort_fn and identify_fn function pointers are included, so the user can specify a sorting function and identification function, so that sorting can be performed. working[2], unlinked[2], and unused[2] arrays of link pointers are not strictly necessary, but provide faster operation for interrupt optimization. Working refers to the last elements modified while unlinked can refer to new elements not yet inserted into the list, and unused contains pointers to elements which can be overwritten immediately.
uint16_t array_length |
array_length
list_link_t* first |
first
list_identify_fn_t identify_fn |
identify_fn
uint16_t* item_array |
item_array
uint16_t item_size |
item_size
list_link_t* last |
last
uint16_t length |
length
list_link_t* links |
links
list_sort_fn_t sort_fn |
sort_fn
list_link_t* unlinked[2] |
unlinked
uint16_t unlinked_count |
count of unlinked list items
list_link_t* working[2] |
working