Jo Engine
2024.04.28
Jo Sega Saturn Engine
|
Jo Engine Linked list helper. More...
Go to the source code of this file.
Data Structures | |
union | jo_list_data |
Node data (4 bytes) More... | |
struct | __jo_node |
Node struct. More... | |
struct | jo_list |
List struct. More... | |
struct | jo_list_data.coord |
Typedefs | |
typedef struct __jo_node | jo_node |
Node type. More... | |
typedef void(* | jo_node_callback) (jo_node *node) |
Callback for jo_list_foreach() More... | |
typedef bool(* | jo_node_any_callback) (jo_node *node, void *extra) |
Callback for jo_list_any() More... | |
Functions | |
void | jo_list_init (jo_list *const list) |
Init a list. More... | |
jo_node * | jo_list_insert_at (jo_list *const list, const jo_list_data data, const int index) |
Insert an item on the list at specific index. More... | |
jo_node * | jo_list_add (jo_list *const list, const jo_list_data data) |
Add an item on the list. More... | |
static __jo_force_inline jo_node * | jo_list_add_ptr (jo_list *const list, void *ptr) |
Add a pointer on the list. More... | |
void | jo_list_remove (jo_list *const list, const jo_node *const node_to_delete) |
Remove an item on the list. More... | |
static __jo_force_inline jo_node * | jo_list_at (jo_list *const list, int index) |
Get node at index. More... | |
static __jo_force_inline void | jo_list_remove_at (jo_list *const list, const int index) |
Remove an item on the list from index. More... | |
static __jo_force_inline void | jo_list_free_and_remove (jo_list *const list, const jo_node *const node_to_delete) |
Free node pointer and remove the item from the list. More... | |
static __jo_force_inline void | jo_list_free_and_clear (jo_list *const list) |
Free node pointers and remove all item. More... | |
static __jo_force_inline void | jo_list_free_and_remove_last (jo_list *const list) |
Free and remove the last item from the list. More... | |
static __jo_force_inline void | jo_list_remove_last (jo_list *const list) |
Free and remove the last item from the list. More... | |
static __jo_force_inline void | jo_list_free_and_remove_first (jo_list *const list) |
Free and remove the first item from the list. More... | |
static __jo_force_inline void | jo_list_remove_first (jo_list *const list) |
Free and remove the first item from the list. More... | |
static __jo_force_inline void | jo_list_clear (jo_list *const list) |
Remove all item. More... | |
static __jo_force_inline jo_node * | jo_list_first (jo_list *const list) |
Get first item. More... | |
static __jo_force_inline jo_node * | jo_list_last (jo_list *const list) |
Get last item. More... | |
static __jo_force_inline void | jo_list_foreach (jo_list *const list, jo_node_callback callback) |
Iterate on the list. More... | |
static __jo_force_inline bool | jo_list_any (jo_list *const list, jo_node_any_callback callback, void *extra) |
Find if any element of the list satisfy the condition (callback) More... | |
static __jo_force_inline void | jo_list_set_allocation_behaviour (jo_list *const list, jo_malloc_behaviour behaviour) |
Set list memory allocation behaviour. More... | |
static __jo_force_inline bool | jo_list_remove_first_value (jo_list *const list, jo_list_data data) |
Remove the first item on the list that match DATA. More... | |
static __jo_force_inline void | jo_list_remove_all_value (jo_list *const list, jo_list_data data) |
Remove all items on the list that match DATA. More... | |
static __jo_force_inline void | jo_list_append (const jo_list *const list, jo_list *const output) |
Append all items on the list to output list. More... | |
Jo Engine Linked list helper.
union jo_list_data |
Node data (4 bytes)
Data Fields | ||
---|---|---|
bool | booleans[4] | |
char | c | |
char * | ch_arr | |
struct jo_list_data | coord | |
int | integer | |
void * | ptr | |
char | str[4] | |
unsigned char | uc |
struct __jo_node |
Node struct.
Data Fields | ||
---|---|---|
jo_list_data | data | |
jo_node * | next | |
jo_node * | prev |
struct jo_list |
List struct.
Data Fields | ||
---|---|---|
jo_malloc_behaviour | allocation_behaviour | |
int | count | |
jo_node * | first | |
jo_node * | last |
typedef bool(* jo_node_any_callback) (jo_node *node, void *extra) |
Callback for jo_list_any()
typedef void(* jo_node_callback) (jo_node *node) |
Callback for jo_list_foreach()
jo_node* jo_list_add | ( | jo_list *const | list, |
const jo_list_data | data | ||
) |
Add an item on the list.
list | List |
data | item to add |
|
static |
Add a pointer on the list.
list | List |
ptr | Pointer to add <=> jo_list_data:ptr |
|
static |
Find if any element of the list satisfy the condition (callback)
list | List |
extra | Extra data passed to the callback |
callback | callback for each node |
|
static |
Append all items on the list to output list.
list | List |
output | Output list |
|
static |
Get node at index.
list | List |
index | Node index |
|
static |
Remove all item.
list | List |
|
static |
Get first item.
list | List |
|
static |
Iterate on the list.
list | List |
callback | callback for each node |
|
static |
Free node pointers and remove all item.
list | List |
|
static |
Free node pointer and remove the item from the list.
list | List |
node_to_delete | Node to remove |
|
static |
Free and remove the first item from the list.
list | List |
|
static |
Free and remove the last item from the list.
list | List |
void jo_list_init | ( | jo_list *const | list | ) |
Init a list.
list | List pointer |
jo_node* jo_list_insert_at | ( | jo_list *const | list, |
const jo_list_data | data, | ||
const int | index | ||
) |
Insert an item on the list at specific index.
list | List |
data | Item to insert |
index | Node index |
|
static |
Get last item.
list | List |
Remove an item on the list.
list | List |
node_to_delete | Node to remove |
|
static |
Remove all items on the list that match DATA.
list | List |
data | Node DATA |
|
static |
Remove an item on the list from index.
list | List |
index | Node index |
|
static |
Free and remove the first item from the list.
list | List |
|
static |
Remove the first item on the list that match DATA.
list | List |
data | Node DATA |
|
static |
Free and remove the last item from the list.
list | List |
|
static |
Set list memory allocation behaviour.
list | List pointer |
behaviour | Allocation behaviour |