summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2008-10-28 15:15:18 +0000
committerjoerg <joerg@pkgsrc.org>2008-10-28 15:15:18 +0000
commit83613e330d299c01ff87ed486abd6e733ea46284 (patch)
treede0cb1f1b93d2b5dd70f8b0015e162e606ae6fce /pkgtools/libnbcompat
parentf766025472f8b93f4e334faeb039c79ccf21130f (diff)
downloadpkgsrc-83613e330d299c01ff87ed486abd6e733ea46284.tar.gz
Add circleq support. Bump to 20081028. Should fix IRIX build from
PR 39797.
Diffstat (limited to 'pkgtools/libnbcompat')
-rw-r--r--pkgtools/libnbcompat/Makefile4
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/queue.h133
2 files changed, 134 insertions, 3 deletions
diff --git a/pkgtools/libnbcompat/Makefile b/pkgtools/libnbcompat/Makefile
index 103073c308e..cc0fb5548d4 100644
--- a/pkgtools/libnbcompat/Makefile
+++ b/pkgtools/libnbcompat/Makefile
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.65 2008/10/10 00:21:43 joerg Exp $
+# $NetBSD: Makefile,v 1.66 2008/10/28 15:15:18 joerg Exp $
#
# NOTE: If you update this package, it is *mandatory* that you update
# pkgsrc/pkgtools/libnbcompat/files/README to reflect the actual
# list of tested and supported platforms.
#
-DISTNAME= libnbcompat-20081010
+DISTNAME= libnbcompat-20081028
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/libnbcompat/files/nbcompat/queue.h b/pkgtools/libnbcompat/files/nbcompat/queue.h
index 0ae242836b3..a8f6762572f 100644
--- a/pkgtools/libnbcompat/files/nbcompat/queue.h
+++ b/pkgtools/libnbcompat/files/nbcompat/queue.h
@@ -1,4 +1,4 @@
-/* $NetBSD: queue.h,v 1.4 2007/06/26 22:10:46 dmcmahill Exp $ */
+/* $NetBSD: queue.h,v 1.5 2008/10/28 15:15:18 joerg Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -316,4 +316,135 @@ struct { \
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#endif
+#define CIRCLEQ_HEAD(name, type) \
+struct name { \
+ struct type *cqh_first; /* first element */ \
+ struct type *cqh_last; /* last element */ \
+}
+
+#define CIRCLEQ_HEAD_INITIALIZER(head) \
+ { (void *)&head, (void *)&head }
+
+#define CIRCLEQ_ENTRY(type) \
+struct { \
+ struct type *cqe_next; /* next element */ \
+ struct type *cqe_prev; /* previous element */ \
+}
+
+/*
+ * Circular queue functions.
+ */
+#ifndef CIRCLEQ_INIT
+#define CIRCLEQ_INIT(head) do { \
+ (head)->cqh_first = (void *)(head); \
+ (head)->cqh_last = (void *)(head); \
+} while (/*CONSTCOND*/0)
+#endif
+
+#ifndef CIRCLEQ_INSERT_AFTER
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \
+ (elm)->field.cqe_prev = (listelm); \
+ if ((listelm)->field.cqe_next == (void *)(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \
+ (listelm)->field.cqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+#endif
+
+#ifndef CIRCLEQ_INSERT_BEFORE
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm); \
+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
+ if ((listelm)->field.cqe_prev == (void *)(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \
+ (listelm)->field.cqe_prev = (elm); \
+} while (/*CONSTCOND*/0)
+#endif
+
+#ifndef CIRCLEQ_INSERT_HEAD
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.cqe_next = (head)->cqh_first; \
+ (elm)->field.cqe_prev = (void *)(head); \
+ if ((head)->cqh_last == (void *)(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (head)->cqh_first->field.cqe_prev = (elm); \
+ (head)->cqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+#endif
+
+#ifndef CIRCLEQ_INSERT_TAIL
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.cqe_next = (void *)(head); \
+ (elm)->field.cqe_prev = (head)->cqh_last; \
+ if ((head)->cqh_first == (void *)(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (head)->cqh_last->field.cqe_next = (elm); \
+ (head)->cqh_last = (elm); \
+} while (/*CONSTCOND*/0)
+#endif
+
+#ifndef CIRCLEQ_REMOVE
+#define CIRCLEQ_REMOVE(head, elm, field) do { \
+ if ((elm)->field.cqe_next == (void *)(head)) \
+ (head)->cqh_last = (elm)->field.cqe_prev; \
+ else \
+ (elm)->field.cqe_next->field.cqe_prev = \
+ (elm)->field.cqe_prev; \
+ if ((elm)->field.cqe_prev == (void *)(head)) \
+ (head)->cqh_first = (elm)->field.cqe_next; \
+ else \
+ (elm)->field.cqe_prev->field.cqe_next = \
+ (elm)->field.cqe_next; \
+} while (/*CONSTCOND*/0)
+#endif
+
+#ifndef CIRCLEQ_FOREACH
+#define CIRCLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->cqh_first); \
+ (var) != (const void *)(head); \
+ (var) = ((var)->field.cqe_next))
+#endif
+
+#ifndef CIRCLEQ_FOREACH_REVERSE
+#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
+ for ((var) = ((head)->cqh_last); \
+ (var) != (const void *)(head); \
+ (var) = ((var)->field.cqe_prev))
+#endif
+
+#ifndef CIRCLEQ_EMPTY
+#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
+#endif
+#ifndef CIRCLEQ_FIRST
+#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
+#endif
+#ifndef CIRCLEQ_LAST
+#define CIRCLEQ_LAST(head) ((head)->cqh_last)
+#endif
+#ifndef CIRCLEQ_NEXT
+#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
+#endif
+#ifndef CIRCLEQ_PREV
+#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
+#endif
+
+#ifndef CIRCLEQ_LOOP_NEXT
+#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
+ (((elm)->field.cqe_next == (void *)(head)) \
+ ? ((head)->cqh_first) \
+ : (elm->field.cqe_next))
+#endif
+#ifndef CIRCLEQ_LOOP_PREV
+#define CIRCLEQ_LOOP_PREV(head, elm, field) \
+ (((elm)->field.cqe_prev == (void *)(head)) \
+ ? ((head)->cqh_last) \
+ : (elm->field.cqe_prev))
+#endif
+
#endif /* !_NBCOMPAT_QUEUE_H */