dmd.backend.dlist

Interface to the C linked list type.

List is a complete package of functions to deal with singly linked lists of pointers or integers. Features: 1. Uses mem package. 2. Has loop-back tests. 3. Each item in the list can have multiple predecessors, enabling different lists to 'share' a common tail.

Members

Functions

list_append
list_t list_append(list_t* plist, void* ptr)

Append ptr to *plist.

list_appenddata
void list_appenddata(list_t* plist, int d)

Append integer item to list.

list_apply
void list_apply(list_t* plist, void function(void*) @(nogc) nothrow fp)

Apply a function fp to each member of a list.

list_build
list_t list_build(void* p, ...)

Build a list out of the null-terminated argument list.

list_cat
list_t list_cat(list_t* pl1, list_t l2)

Concatenate two lists (l2 appended to l1). Output: *pl1 updated to be start of concatenated list.

list_cmp
int list_cmp(list_t list1, list_t list2, int function(void*, void*) @(nogc) nothrow fp)

Compare two lists using the comparison function fp. The comparison function is the same as used for qsort().

list_copy
list_t list_copy(list_t list)

Copy a list and return it.

list_copyinto
void list_copyinto(list_t l, void* pa)

Copy list of pointers into an array of pointers.

list_data
int list_data(list_t list)
list_equal
int list_equal(list_t list1, list_t list2)

Compare two lists.

list_free
void list_free(list_t* plist, list_free_fp freeptr)

Free list.

list_init
void list_init()

Initialize list package. Output: list_inited = 1

list_inlist
list_t list_inlist(list_t list, void* ptr)

Search for ptr in list.

list_insert
list_t list_insert(list_t* pl, void* ptr, int n)

Insert item into list at nth position.

list_last
list_t list_last(list_t list)
list_link
list_t list_link(list_t list)

Create link to existing list, that is, share the list with somebody else.

list_next
list_t list_next(list_t list)
list_nitems
int list_nitems(list_t list)

Count up and return number of items in list.

list_nth
list_t list_nth(list_t list, int n)
list_pop
void* list_pop(list_t* plist)

Remove first element in list pointed to by *plist.

list_prepend
list_t list_prepend(list_t* plist, void* ptr)

Prepend ptr to *plist.

list_prependdata
void list_prependdata(list_t* plist, int d)

Prepend integer item to list.

list_prev
list_t list_prev(list_t start, list_t list)
list_ptr
inout(void)* list_ptr(list_t list)
list_reverse
list_t list_reverse(list_t l)

Reverse a list in place.

list_subtract
void* list_subtract(list_t* plist, void* ptr)

Remove ptr from the list pointed to by *plist. Output: *plist is updated to be the start of the new list

list_term
void list_term()

Terminate list package. Output: list_inited = 0

Structs

ListRange
struct ListRange

Range for Lists.

Meta