-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathList.h
44 lines (36 loc) · 857 Bytes
/
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
#ifndef GENERICS
#define GENERICS
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
typedef int bool;
enum { false, true };
typedef bool (*listIterator)(void*);
typedef struct listNode ListNode;
struct listNode {
void *data;
ListNode *next;
ListNode *prev;
};
typedef struct {
ListNode *head;
ListNode *tail;
int length;
int elementSize;
} List;
void ListInit(List*,int);
void ListDestroy(List*);
int ListGetSize(List*);
void ListAddFront(List*, void*);
void ListInsert(List*, void*, int);
void ListAdd(List*, void*);
void ListRemoveFront(List*);
void ListRemoveLast(List*);
void ListRemoveAt(List*,int);
void ListPeekFront(List*, void*);
void ListPeekLast(List*, void*);
void ListPeekAt(List *, void *, int);
void ListForEach(List*, listIterator);
void ListReplace(List*, void*, int);
#endif