-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.h
65 lines (40 loc) · 1.03 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
/*Marwan Mostafa mam024 11305332*/
/* Addison McAuley, amm637, 11295940
* Ghanim Jamil, ghj729, 11298913
*/
#ifndef __LIST_H__
#define __LIST_H__
#define ERROR_EXIT -1
#define SUCCESS_EXIT 0
typedef struct _node {
void* item;
void* next;
void* prev;
} NODE;
typedef struct _list {
NODE* head;
NODE* tail;
NODE* curr;
int count;
void* next;
void* prev;
} LIST;
typedef void (*itemFree) (void*);
typedef int (*Comparator) (void*, void*);
LIST* ListCreate();
int ListCount(LIST* list);
void* ListFirst(LIST* list);
void* ListLast(LIST* list);
void* ListNext(LIST* list);
void* ListPrev(LIST* list);
void* ListCurr(LIST* list);
int ListAdd(LIST* list, void* item);
int ListInsert(LIST* list, void* item);
int ListAppend(LIST* list, void* item);
int ListPrepend(LIST* list, void* item);
void* ListRemove(LIST* list);
void ListConcat(LIST* list_1, LIST* list_2);
void ListFree(LIST* list, itemFree item_to_be_freed);
void* ListTrim(LIST* list);
void* ListSearch(LIST* list, Comparator comp, void* comparison_arg);
#endif