Added llvmgcc version to allow tests to be xfailed by frontend version.
[llvm-complete.git] / utils / Burg / queue.c
blob5fa8af5d7991dee636dc48a7d2bba420bf4fb714
1 char rcsid_queue[] = "$Id$";
3 #include "b.h"
4 #include <stdio.h>
6 Queue globalQ;
8 Queue
9 newQ()
11 Queue q;
13 q = (Queue) zalloc(sizeof(struct queue));
14 assert(q);
15 q->head = 0;
16 q->tail = 0;
18 return q;
21 void
22 addQ(q, ts) Queue q; Item_Set ts;
24 List qe;
26 assert(q);
27 assert(ts);
29 qe = newList(ts, 0);
30 if (q->head) {
31 assert(q->tail);
32 q->tail->next = qe;
33 q->tail = qe;
34 } else {
35 q->head = q->tail = qe;
39 Item_Set
40 popQ(q) Queue q;
42 List qe;
43 Item_Set ts;
45 assert(q);
47 if (q->head) {
48 qe = q->head;
49 q->head = q->head->next;
50 ts = (Item_Set) qe->x;
51 zfree(qe);
52 return ts;
53 } else {
54 return 0;
58 void
59 dumpQ(q) Queue q;
61 printf("Begin Queue\n");
62 foreachList((ListFn)dumpItem_Set, q->head);
63 printf("End Queue\n");