emu_list.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
Go to the source code of this file.
Classes |
| struct | emu_list_item |
Defines |
| #define | xalloc malloc |
| #define | xfree(ptr, size) free(ptr) |
| #define | list__magic(ptr, t_src, src_field, t_dst, dst_field) |
| #define | header_list_types(root_tag, elem_tag, link_tag) |
| #define | header_list_typedefs(t_root, t_elem, t_link) |
| #define | header_list_functions(name, t_root, t_elem, link) |
| #define | source_list_functions(name, t_root, t_elem, link) |
| | Define a list's operations.
|
Functions |
| | header_list_typedefs (emu_list_root, emu_list_item, emu_list_link) |
| | header_list_functions (emu_list, emu_list_root, emu_list_item, link) |
| struct emu_list_item * | emu_list_item_create (void) |
Define Documentation
| #define header_list_functions |
( |
name, |
|
|
t_root, |
|
|
t_elem, |
|
|
link |
|
) |
|
| #define header_list_typedefs |
( |
t_root, |
|
|
t_elem, |
|
|
t_link |
|
) |
|
Value:\
header_list_types(t_root, t_elem, t_link); \
\
typedef struct t_root t_root; \
typedef struct t_elem t_elem; \
typedef struct t_link t_link; \
\
struct list__hack
| #define header_list_types |
( |
root_tag, |
|
|
elem_tag, |
|
|
link_tag |
|
) |
|
Value:\
struct link_tag { struct elem_tag *next, *prev; }; \
struct root_tag { struct link_tag head, tail; }; \
\
struct list__hack
| #define list__magic |
( |
ptr, |
|
|
t_src, |
|
|
src_field, |
|
|
t_dst, |
|
|
dst_field |
|
) |
|
Value:((t_dst *)( (char *)(ptr) \
+ offsetof(t_src, src_field) \
- offsetof(t_dst, dst_field) ))
| #define source_list_functions |
( |
name, |
|
|
t_root, |
|
|
t_elem, |
|
|
link |
|
) |
|
Define a list's operations.
- Parameters:
-
| name | The name of the list (written NAME in the function documentation). |
| t_root | The name of the type of the list's root. |
| t_elem | The name of the type of the list's elements. |
| link | The name of the link structure in each element. |
| #define xfree |
( |
ptr, |
|
|
size |
|
) |
free(ptr) |
Function Documentation
| header_list_functions |
( |
emu_list |
, |
|
|
emu_list_root |
, |
|
|
emu_list_item |
, |
|
|
link |
| |
|
) |
| | |
| header_list_typedefs |
( |
emu_list_root |
, |
|
|
emu_list_item |
, |
|
|
emu_list_link |
| |
|
) |
| | |