|
libFirm 1.20
|
Implementation if a double ended queue datastructure for generic pointers. More...
Defines | |
| #define | new_waitq() new_pdeq() |
| Creates a new pointer wait queue (fifo). | |
| #define | del_waitq(wq) del_pdeq(wq) |
| Delete a wait queue (fifo) | |
| #define | waitq_get(wq) pdeq_getl(wq) |
| Retrieve a pointer from the wait queue (fifo). | |
| #define | waitq_put(wq, x) pdeq_putr((wq), (x)) |
| Add a pointer to the wait queue (fifo). | |
| #define | waitq_empty(wq) pdeq_empty(wq) |
| Checks if a wait queue is empty. | |
| #define | new_stack() new_pdeq() |
| Creates a new pointer stack (lifo). | |
| #define | stack_pop(st) pdeq_getr(st) |
| Pop a pointer from the stack (lifo). | |
| #define | stack_push(st, x) pdeq_putr((st), (x)) |
| Push a pointer to the stack (lifo). | |
| #define | stack_empty(st) pdeq_empty(wq) |
| Checks if a stack is empty. | |
Typedefs | |
| typedef int(* | cmp_fun )(const void *elem, const void *key) |
| The type of the pointer compare function. | |
| typedef struct pdeq | pdeq |
| The pointer double ended queue (list). | |
| typedef pdeq | waitq |
| The pdeq is often used as a wait queue. | |
| typedef pdeq | stack |
| The pdeq can be used as a stack. | |
Functions | |
| pdeq * | new_pdeq (void) |
| Creates a new double ended pointer list. | |
| pdeq * | new_pdeq1 (const void *x) |
| Creates a new double ended pointer list and puts an initial pointer element in. | |
| void | del_pdeq (pdeq *dq) |
| Delete a double ended pointer list. | |
| size_t | pdeq_len (pdeq *dq) |
| Returns the length of a double ended pointer list. | |
| int | pdeq_empty (pdeq *dq) |
| Checks if a list is empty. | |
| int | pdeq_contains (pdeq *dq, const void *x) |
| Returns non-zero if a double ended pointer list contains a pointer x. | |
| void * | pdeq_search (pdeq *qp, cmp_fun cmp, const void *key) |
| Search a key in a double ended pointer list, the search is controlled by a compare function. | |
| void ** | pdeq_copyl (pdeq *qp, const void **dst) |
| Convert the double ended pointer list into a linear array beginning from left, the first element in the linear array will be the left one. | |
| void ** | pdeq_copyr (pdeq *qp, const void **dst) |
| Convert the double ended pointer list into a linear array beginning from right, the first element in the linear array will be the right one. | |
| pdeq * | pdeq_putl (pdeq *dq, const void *x) |
| Add a pointer to the left side of a double ended pointer list. | |
| pdeq * | pdeq_putr (pdeq *dq, const void *x) |
| Add a pointer to the right side of a double ended pointer list. | |
| void * | pdeq_getl (pdeq *dq) |
| Retrieve (and remove) a pointer from the left site of a double ended pointer list. | |
| void * | pdeq_getr (pdeq *dq) |
| Retrieve (and remove) a pointer from the right site of a double ended pointer list. | |
Implementation if a double ended queue datastructure for generic pointers.
| #define del_waitq | ( | wq | ) | del_pdeq(wq) |
| #define new_stack | ( | ) | new_pdeq() |
| #define new_waitq | ( | ) | new_pdeq() |
| #define stack_empty | ( | st | ) | pdeq_empty(wq) |
| #define stack_pop | ( | st | ) | pdeq_getr(st) |
| #define stack_push | ( | st, | |
| x | |||
| ) | pdeq_putr((st), (x)) |
| #define waitq_empty | ( | wq | ) | pdeq_empty(wq) |
| #define waitq_get | ( | wq | ) | pdeq_getl(wq) |
| #define waitq_put | ( | wq, | |
| x | |||
| ) | pdeq_putr((wq), (x)) |
| typedef int(* cmp_fun)(const void *elem, const void *key) |
| void del_pdeq | ( | pdeq * | dq | ) |
Delete a double ended pointer list.
| dq | The list to be deleted. |
| pdeq* new_pdeq | ( | void | ) |
Creates a new double ended pointer list.
| pdeq* new_pdeq1 | ( | const void * | x | ) |
Creates a new double ended pointer list and puts an initial pointer element in.
| x | The pointer element to put in. |
| int pdeq_contains | ( | pdeq * | dq, |
| const void * | x | ||
| ) |
Returns non-zero if a double ended pointer list contains a pointer x.
| dq | The list. |
| x | The pointer to be searched for. |
| void** pdeq_copyl | ( | pdeq * | qp, |
| const void ** | dst | ||
| ) |
Convert the double ended pointer list into a linear array beginning from left, the first element in the linear array will be the left one.
| qp | The list. |
| dst | A pointer to a pointer array with must be at least pdeq_len(dq) * sizeof(void *) |
| void** pdeq_copyr | ( | pdeq * | qp, |
| const void ** | dst | ||
| ) |
Convert the double ended pointer list into a linear array beginning from right, the first element in the linear array will be the right one.
| qp | The list. |
| dst | A pointer to a pointer array with must be at least pdeq_len(dq) * sizeof(void *) |
| int pdeq_empty | ( | pdeq * | dq | ) |
Checks if a list is empty.
| dq | The list. |
| void* pdeq_getl | ( | pdeq * | dq | ) |
Retrieve (and remove) a pointer from the left site of a double ended pointer list.
| dq | The list |
| void* pdeq_getr | ( | pdeq * | dq | ) |
Retrieve (and remove) a pointer from the right site of a double ended pointer list.
| dq | The list |
| size_t pdeq_len | ( | pdeq * | dq | ) |
Returns the length of a double ended pointer list.
| dq | The list. |
Add a pointer to the left side of a double ended pointer list.
| dq | The list to add a pointer to. |
| x | The pointer element to be added |
Add a pointer to the right side of a double ended pointer list.
| dq | The list to add a pointer to. |
| x | The pointer element to be added |
Search a key in a double ended pointer list, the search is controlled by a compare function.
An element is found, if the compare function returns 0. The search is started from the left site of the list.
| qp | The list. |
| cmp | The compare function. |
| key | The search key. |