aboutsummaryrefslogtreecommitdiff
path: root/src/lib/q.h
blob: 51ff1a1ab794d1b930f6a35a5675074a5e3f879b (plain)
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
#ifndef LIB_Q_H
#define LIB_Q_H

struct Q_base {
	struct Q* next;
	struct Q* last;
};

struct Q {
	struct Q* next;
	void* data;
};

struct Q_base* newq();
void pushq(struct Q_base* qb, void* val);
void popq(struct Q_base* qb);

#define showq(QQ, TYPE) { \
	if (QQ->next != 0) { \
		struct Q* t = QQ->next; \
		while (t->next != 0) { \
			uart_hex(*(TYPE*)t->data); \
			t = t->next; \
			uart_char(' '); \
		} \
		uart_hex(*(TYPE*)t->data); \
	} \
}

#endif