Sturk 1.0.2
Publish-subscribe C implementation.
|
Singly linked list. More...
#include "vx/graph.h"
Go to the source code of this file.
Macros | |
#define | VX_LIST(name, type) VX_GRAPH(name, 1, type) |
Define the list. | |
#define | vx_list_foreach(type, i, listp) vx_graph_foredge (type, i, listp, 0) |
Traverse a list. | |
#define | vx_list_ins(list, ...) VX__LIST_INS((list), __VA_ARGS__, 0, ) |
Insert, at a given position, an entry into a list. | |
#define | vx_list_rem(...) VX__LIST_REM(__VA_ARGS__, 0, ) |
Remove, at a given position, an entry from a list. | |
Singly linked list.
This header file provides data types, functions and macros that define and operate on singly linked lists.
#define VX_LIST | ( | name, | |
type | |||
) | VX_GRAPH(name, 1, type) |
Define the list.
[in] | name | The name of the type used for the list. |
[in] | type | The type of the data held by name. |
This macro will define a compound type (must be struct or union) name, a type for a list entry that holds the data of the type type.
#define vx_list_foreach | ( | type, | |
i, | |||
listp | |||
) | vx_graph_foredge (type, i, listp, 0) |
Traverse a list.
Traverse the list of type type referenced by listp in the forward direcion, assigning every entry in turn to i.
#define vx_list_ins | ( | list, | |
... | |||
) | VX__LIST_INS((list), __VA_ARGS__, 0, ) |
Insert, at a given position, an entry into a list.
A call vx_list_ins(list, entry, pos) will insert the entry into the list at the pos. To insert at the head use 0 for the pos and to insert at the tail use -1 for the pos. The argument pos is optional and by default it equals 0.
#define vx_list_rem | ( | ... | ) | VX__LIST_REM(__VA_ARGS__, 0, ) |
Remove, at a given position, an entry from a list.
A call vx_list_rem(listp, pos) will remove an entry from the listp at the pos and will return the removed entry. To remove from the head use 0 for the pos and to remove from the tail use -1 for the pos. The argument pos is optional and by default it equals 0.