-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
105 lines (86 loc) · 2.13 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
////////////////////////////////////////////////////////////////////////////////
//
// list.h
//
// Created by Austin Cherry on 9/17/15.
// Copyright (c) 2015 Vluxe. All rights reserved.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef __AMP__List__
#define __AMP__List__
#include <stdlib.h>
struct Node;
typedef struct Node {
struct Node *next;
struct Node *prev;
void *value;
} Node;
typedef struct List {
int count;
Node *head;
Node *tail;
} List;
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
List *newList();
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
Node *llfront(List *l);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
Node *llback(List *l);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
void *llremove(List *l, Node *n);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
Node *llpushFront(List *l, void *value);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
Node *llpushBack(List *l, void *value);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
void *llpopFront(List *l);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
void *llpopBack(List *l);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
Node *llinsertAfter(List *l, void *value, Node *mark);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
Node *llinsertBefore(List *l, void *value, Node *mark);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
void llclear(List *l);
/**
The websocket connected to its host.
@param socket is the current socket object.
*/
void freeList(List *l);
#define LIST_ITERATE(list, current) \
Node *current = NULL; \
for(current = list->head; current != NULL; current = current->next)
#endif /* defined(__AMP__List__) */