-
Notifications
You must be signed in to change notification settings - Fork 9
/
double_list.h
executable file
·53 lines (36 loc) · 1.47 KB
/
double_list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __DOUBLE_LIST__H__
#define __DOUBLE_LIST__H__
#include "syn_primitive.h"
typedef struct tag_d_list
{
void *data;
unsigned int data_len;
struct tag_d_list *pre;
struct tag_d_list *next;
}d_list_node_t;
typedef struct
{
unsigned int node_count;
d_list_node_t *head;
d_list_node_t *tail;
d_list_node_t *cur_idx;
}d_list_t;
typedef int (*compare_func)(void *usr_data, unsigned int udata_len, void *list_data, unsigned int ldata_len);
BOOL is_empty_d_list(d_list_t *list);
unsigned int get_d_list_node_count(d_list_t *list);
d_list_t *create_d_list(void);
void destroy_d_list(d_list_t *list);
BOOL insert_d_list_head(d_list_t *list, void *data, unsigned int data_len);
BOOL insert_d_list_tail(d_list_t *list, void *data, unsigned int data_len);
BOOL insert_d_list_head_node(d_list_t *list, d_list_node_t *node);
BOOL insert_d_list_tail_node(d_list_t *list, d_list_node_t *node);
BOOL delete_d_list_head(d_list_t *list);
BOOL delete_d_list_tail(d_list_t *list);
BOOL delete_d_list_node_all(d_list_t *list);
BOOL remove_d_list_node(d_list_t *list, d_list_node_t *node);
d_list_node_t *remove_d_list_head_node(d_list_t *list);
d_list_node_t *remove_d_list_tail_node(d_list_t *list);
d_list_node_t *find_d_list_node(d_list_t *list, void *user_data, unsigned int data_len, compare_func func);
d_list_node_t *get_d_list_node(d_list_t *list, int idx);
d_list_node_t *get_next_node(d_list_t *list);
#endif //__DOUBLE_LIST__H__