zeroSquitto – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /*************************************************************************/ |
2 | /* Circular queue structure definition. */ |
||
3 | /*************************************************************************/ |
||
4 | typedef struct { |
||
5 | int size; |
||
6 | char **store; |
||
7 | int head, tail; |
||
8 | } CircularQueue; |
||
9 | |||
10 | /*************************************************************************/ |
||
11 | /* Queue operations. */ |
||
12 | /*************************************************************************/ |
||
13 | extern CircularQueue *queueCreate(int size); |
||
14 | extern void queueEnqueue(CircularQueue *q, char *e); |
||
15 | extern char *queueDequeue(CircularQueue *q); |
||
16 | extern CircularQueue *queueClear(CircularQueue *q); |
||
17 | extern void queuePrint(CircularQueue *q); |
||
18 | |||
19 | /*************************************************************************/ |
||
20 | /* Queue macros. */ |
||
21 | /*************************************************************************/ |
||
22 | /* Determines if the queue is empty. */ |
||
23 | #define queueIsEmpty(q) (q->tail == q->head) |
||
24 | /* Returns the size of the allocated queue. */ |
||
25 | #define queueSize(q) q->size |
||
26 | /* Returns the number of items in the queue. */ |
||
27 | #define queueCount(q) q->tail - q->head |