-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.h
45 lines (36 loc) · 770 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
45
/*
* File: list.h
* Author: Jayson Rhynas, 20299211
* Created: January 14, 2011
*
* Declares doubly-linked lists for the various objects.
*/
#ifndef _LIST_H_
#define _LIST_H_
#include <assert.h>
typedef enum {
ENEMY,
DEFENSE,
BULLET,
BUTTON
} IType;
typedef struct node {
IType type;
void *item;
struct node *next;
struct node *prev;
} Node;
typedef struct {
IType type;
int size;
struct node* first;
struct node* last;
} List;
List* listCreate (IType type);
void listAppend (List *list, void *item);
void listRemove (List *list, Node *node);
void listClear (List *list);
void listDelete (List *list);
void listForEach (List *list, void(*func)(void*));
void listPrint(List *list);
#endif /* _LIST_H_ */