Doubly-Linked Lists

G-Golf Glib Doubly-Linked Lists low level API.
Doubly-Linked Lists — linked lists that can be iterated over in both directions

Procedures

g-list-data
g-list-next
g-list-prev
g-list-free
g-list-length
g-list-nth-data

Description

The GList structure and its associated functions provide a standard doubly-linked list data structure.

Each element in the list contains a piece of data, together with pointers which link to the previous and next elements in the list. Using these pointers it is possible to move through the list in both directions (unlike the singly-linked GSList, which only allows movement through the list in the forward direction).

Please read the Doubly-Linked-Lists section from the Glib reference manual for a complete description.

Procedures

Procedure: g-list-data g-list

Returns a pointer.

Obtains and returns a pointer to the data in g-list, or any integer value, in which case, it is the responsibility of the caller to apply the appropriate type conversion procedure.

Procedure: g-list-next g-list

Returns a pointer or #f.

Obtains and returns the next element in g-list, or #f if there are no more elements.

Procedure: g-list-prev g-list

Returns a pointer or #f.

Obtains and returns the previous element in g-list, or #f if there are no previous element.

Procedure: g-list-free g-list

Returns nothing.

Frees all of the memory used by g-list.

Procedure: g-list-length g-list

Returns an integer.

Obtains and returns the number of elements in g-list. This function iterates over the whole list to count its elements.

Procedure: g-list-nth-data g-list n

Returns a pointer or #f.

Obtains and returns a pointer to the data of the n-th element of g-list. This iterates over the list until it reaches the n-th position. If n is off the end of g-list, it returns #f.