1: #ifndef LINKED_LIST_H
2: #define LINKED_LIST_H
3:
4: #include <stdlib.h>
5: #include <stdio.h>
6:
7: #include "bool.h"
8:
9: #include "research.h"
10:
11: #ifndef TRUE
12: #define TRUE 1
13: #endif
14:
15: #ifndef FALSE
16: #define FALSE 0
17: #endif
18:
19: typedef struct
20: {
21: coord location; /*absolute pixel location for starting point*/
22: int code;
23: }chain;
24:
25: typedef chain el_t;
26:
27: typedef struct linked_list* node_pointer;
28: typedef struct linked_list
29: {
30: node_pointer prev;
31: el_t data;
32: node_pointer next;
33: }list;
34:
35: typedef struct
36: {
37: list* head;
38: list* tail;
39: list* cur;
40: }list_info;
41:
42: /*********prototypes**************************************************/
43:
44:
45: void InitList(list_info* list_pointers);
46:
47: void FreeList(list_info* list_pointers);
48:
49: bool ListIsEmpty(list_info* list_pointers);
50:
51: int Length(list_info* list_pointers);
52:
53: bool ListIsFull();
54:
55: bool CurIsEmpty(list_info* list_pointers);
56:
57: struct linked_list* ToFirst(list_info* list_pointers);
58:
59: struct linked_list* ToEnd(list_info* list_pointers);
60:
61: bool AtFirst(list_info* list_pointers);
62:
63: bool AtEnd(list_info* list_pointers);
64:
65: void Advance(list_info* list_pointers);
66:
67: void Retreat(list_info* list_pointers);
68:
69: void InsertAfter(el_t e, list_info* list_pointers);
70:
71: void Insert(el_t e, list_info* list_pointers);
72:
73: void Delete(list_info* list_pointers);
74:
75: void StoreInfo(el_t e, list_info* list_pointers);
76:
77: el_t RetrieveInfo(list_info* list_pointers);
78:
79: el_t RetrievePrevInfo(list_info* list_pointers);
80:
81: list_info RetrievePrevNode(list_info* list_pointers);
82:
83: list_info RetrieveNextNode(list_info* list_pointers);
84:
85: el_t RetrieveNextInfo(list_info* list_pointers);
86:
87: node_pointer MakeNode(el_t e);
88:
89: void DestroyNode(node_pointer p);
90:
91: void NodeReferenceError();
92:
93: #endif