Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
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.Authors:
License:
Source backend/dlist.d
- nothrow @nogc list_t
list_link(list_tlist); - Create link to existing list, that is, share the list with somebody else.Returns:pointer to that list entry.
- nothrow @nogc list_t
list_next(list_tlist); - Returns:pointer to next entry in list.
- nothrow @nogc inout(void)*
list_ptr(inout list_tlist); - Returns:ptr from list entry.
- nothrow @nogc int
list_data(list_tlist); - Returns:integer item from list entry.
- nothrow @nogc void
list_appenddata(list_t*plist, intd); - Append integer item to list.
- nothrow @nogc void
list_prependdata(list_t*plist, intd); - Prepend integer item to list.
- nothrow @nogc void
list_init(); - Initialize list package.
Output list_inited = 1
- nothrow @nogc void
list_term(); - Terminate list package.
Output list_inited = 0
- nothrow @nogc void
list_free(list_t*plist, list_free_fpfreeptr); - Free list.Parameters:
list_t* plistPointer to list to free list_free_fp freeptrPointer to freeing function for the data pointer (use FPNULL if none) Output *plist is null
- nothrow @nogc 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
Returns:null if *plist is null otherwise ptr - nothrow @nogc void*
list_pop(list_t*plist); - Remove first element in list pointed to by *plist.Returns:First element, null if *plist is null
- nothrow @nogc list_t
list_append(list_t*plist, void*ptr); - Append ptr to *plist.Returns:pointer to list item created. null if out of memory
- nothrow @nogc list_t
list_prepend(list_t*plist, void*ptr); - Prepend ptr to *plist.Returns:pointer to list item created (which is also the start of the list). null if out of memory
- nothrow @nogc int
list_nitems(list_tlist); - Count up and return number of items in list.Returns:# of entries in list
- nothrow @nogc list_t
list_nth(list_tlist, intn); - Returns:nth list entry in list.
- nothrow @nogc list_t
list_last(list_tlist); - Returns:last list entry in list.
- nothrow @nogc list_t
list_prev(list_tstart, list_tlist); - Returns:pointer to previous item in list.
- nothrow @nogc list_t
list_copy(list_tlist); - Copy a list and return it.
- nothrow @nogc int
list_equal(list_tlist1, list_tlist2); - Compare two lists.Returns:If they have the same ptrs, return 1 else 0.
- nothrow @nogc int
list_cmp(list_tlist1, list_tlist2, int function(void*, void*) nothrow @nogcfp); - Compare two lists using the comparison function fp. The comparison function is the same as used for qsort().Returns:If they compare equal, return 0 else value returned by fp.
- nothrow @nogc list_t
list_inlist(list_tlist, void*ptr); - Search for ptr in list.Returns:If found, return list entry that it is, else null.
- nothrow @nogc list_t
list_cat(list_t*pl1, list_tl2); - Concatenate two lists (l2 appended to l1).
Output *pl1 updated to be start of concatenated list.
Returns:*pl1 - nothrow @nogc void
list_apply(list_t*plist, void function(void*) nothrow @nogcfp); - Apply a function fp to each member of a list.
- nothrow @nogc list_t
list_reverse(list_tl); - Reverse a list in place.
- nothrow @nogc void
list_copyinto(list_tl, void*pa); - Copy list of pointers into an array of pointers.
- nothrow @nogc list_t
list_insert(list_t*pl, void*ptr, intn); - Insert item into list at nth position.
- struct
ListRange; - Range for Lists.
- nothrow list_t
list_build(void*p, ...); - Build a list out of the null-terminated argument list.Returns:generated list
Copyright © 1999-2019 by the D Language Foundation | Page generated by
Ddoc on Sun Sep 1 19:48:59 2019