Line | |
---|
1 | /************************************************************************ |
---|
2 | Doubly linked list stuff (implementation similar to AmigaOS lists) |
---|
3 | Written by Chris Hodges <hodges@in.tum.de>. |
---|
4 | Last change: 06.05.03 |
---|
5 | ************************************************************************/ |
---|
6 | |
---|
7 | #ifndef DLIST_H |
---|
8 | #define DLIST_H |
---|
9 | |
---|
10 | #include "types.h" |
---|
11 | |
---|
12 | /* Simple doubly linked list node */ |
---|
13 | struct Node |
---|
14 | { |
---|
15 | struct Node *ln_Succ; /* Pointer to next (successor) */ |
---|
16 | struct Node *ln_Pred; /* Pointer to previous (predecessor) */ |
---|
17 | /*LONG ln_Type;*/ |
---|
18 | LLONG ln_Pri; /* priority or key */ |
---|
19 | }; |
---|
20 | |
---|
21 | /* List header, empty list must be initialized with NewList() */ |
---|
22 | struct List |
---|
23 | { |
---|
24 | struct Node *lh_Head; |
---|
25 | struct Node *lh_Tail; |
---|
26 | struct Node *lh_TailPred; |
---|
27 | }; |
---|
28 | |
---|
29 | struct BinTree |
---|
30 | { |
---|
31 | struct BinTree *bt_Child[2]; /* children */ |
---|
32 | struct Node *bt_Leaf[2]; /* data leaf pointer */ |
---|
33 | ULONG bt_Key; /* link for left/right */ |
---|
34 | }; |
---|
35 | |
---|
36 | /* prototypes */ |
---|
37 | |
---|
38 | void NewList(struct List *lh); |
---|
39 | void AddHead(struct List *lh, struct Node *nd); |
---|
40 | void AddTail(struct List *lh, struct Node *nd); |
---|
41 | void Remove(struct Node *nd); |
---|
42 | |
---|
43 | #endif /* DLIST_H */ |
---|
44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.