summaryrefslogtreecommitdiff
path: root/src/queue.h
diff options
context:
space:
mode:
authorKlaus Kaempf <kkaempf@suse.de>2007-10-02 12:40:07 +0000
committerKlaus Kaempf <kkaempf@suse.de>2007-10-02 12:40:07 +0000
commit8f8a9ed5192a6737d63364029cb05d91f1d0e399 (patch)
tree287434efe18f662976f8dad334d489dd60ff6e88 /src/queue.h
downloadlibsolv-8f8a9ed5192a6737d63364029cb05d91f1d0e399.tar.gz
libsolv-8f8a9ed5192a6737d63364029cb05d91f1d0e399.tar.bz2
libsolv-8f8a9ed5192a6737d63364029cb05d91f1d0e399.zip
current state of 'sat-solver'
Diffstat (limited to 'src/queue.h')
-rw-r--r--src/queue.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/queue.h b/src/queue.h
new file mode 100644
index 0000000..dd70443
--- /dev/null
+++ b/src/queue.h
@@ -0,0 +1,30 @@
+/*
+ * queue.h
+ *
+ */
+
+#ifndef QUEUE_H
+#define QUEUE_H
+
+#include "pooltypes.h"
+
+typedef struct _Queue {
+ Id *elements; // current elements
+ int count; // current number of elements (minimal size for elements pointer)
+ Id *alloc; // this is whats actually allocated, elements > alloc if shifted
+ int left; // space left in alloc *after* elements+count
+} Queue;
+
+// clear queue
+
+#define QUEUEEMPTY(q) ((q)->alloc ? ((q)->left += ((q)->elements - (q)->alloc) + (q)->count, (q)->elements = (q)->alloc, (q)->count = 0) : ((q)->left += (q)->count, (q)->count = 0))
+
+extern void clonequeue(Queue *t, Queue *s);
+extern void queueinit(Queue *q);
+extern void queueinit_buffer(Queue *q, Id *buf, int size);
+extern void queuefree(Queue *q);
+extern Id queueshift(Queue *q);
+extern void queuepush(Queue *q, Id id);
+extern void queuepushunique(Queue *q, Id id);
+
+#endif /* QUEUE_H */