aboutsummaryrefslogtreecommitdiff
path: root/include/lib/q.h
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-05 14:27:09 -0800
committerChristian Cunningham <cc@localhost>2022-01-05 14:27:09 -0800
commit866a6ca0e749f4446b7fdc7579a6d553df85ec10 (patch)
treed259223d85c224d649c6c38675e99b155d50cf48 /include/lib/q.h
parent3a8ed19bf83f11ff00c4904fab2cc083b7e33478 (diff)
Moved includes to its own directory
Diffstat (limited to 'include/lib/q.h')
-rw-r--r--include/lib/q.h30
1 files changed, 30 insertions, 0 deletions
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