-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
executable file
·83 lines (62 loc) · 1.74 KB
/
Copy pathqueue.h
File metadata and controls
executable file
·83 lines (62 loc) · 1.74 KB
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
/*
* $Revision: 1.1 $
* $Id: queue.h,v 1.1 2000/02/23 00:51:25 bobby Exp bobby $
*/
#ifndef _QUEUE_H
#define _QUEUE_H
#define getmem malloc
/* Generic doubly linked, circular queue --------------------------------*/
typedef struct GenericDStruct {
struct GenericDStruct * next ;
struct GenericDStruct * prev ;
} GenericDList ; /* Generic List
* used for list manipulation functions.
* All lists should
* have 'next' as their first field
*/
/**** Some list manipulation macros. Next, Insert, Delete ****/
#define InitDQ(head,type) { \
head = (type *) getmem(sizeof(type)) ;\
head->next = head->prev = head ;\
}
#define NextDQ(ptr)(ptr->next)
#define InsertDQ(pos, element){ \
element->next = pos->next; \
pos->next->prev = element; \
pos->next = element ; \
element->prev = pos ;\
}
/* DOESN'T FREE */
#define DelNextDQ(pos){\
pos->next->next->prev = pos;\
pos->next = pos->next->next;\
}
#define EmptyDQ(h)(h->next==h)
#define DelDQ(pos){ \
pos->prev->next = pos->next;\
pos->next->prev = pos->prev;\
}
/* Generic singly linked (non circular) queue ----------------------------*/
typedef struct GenericStruct {
struct GenericStruct * next ;
} GenericList ; /* Generic List
* used for list manipulation functions.
* All lists should
* have 'next' as their first field
*/
/**** Some list manipulation macros. Next, Insert, Delete ****/
#define InitQ(head,type) { \
head = (type *) getmem(sizeof(type)) ;\
head->next = NULL ;\
}
#define NextQ(ptr)(ptr->next)
#define InsertQ(pos, element){ \
element->next = pos->next; \
pos->next = element ; \
}
/* DOESN'T FREE */
#define DelNextQ(pos){\
pos->next = pos->next->next;\
}
#define EmptyQ(h)(h->next==NULL)
#endif