From 866a6ca0e749f4446b7fdc7579a6d553df85ec10 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Wed, 5 Jan 2022 14:27:09 -0800 Subject: Moved includes to its own directory --- include/lib/q.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/lib/q.h (limited to 'include/lib/q.h') diff --git a/include/lib/q.h b/include/lib/q.h new file mode 100644 index 0000000..cf75c6d --- /dev/null +++ b/include/lib/q.h @@ -0,0 +1,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* new_q(); +void push_q(struct Q_base* qb, void* val); +void pop_q(struct Q_base* qb); + +#define show_q(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 -- cgit v1.2.1