Mesa (master): glsl: Add C API for exec_node.
Matt Turner
mattst88 at kemper.freedesktop.org
Tue Jun 10 20:08:07 UTC 2014
Module: Mesa
Branch: master
Commit: 47a77ba8398be708a6c69289fe2b060c78639537
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=47a77ba8398be708a6c69289fe2b060c78639537
Author: Matt Turner <mattst88 at gmail.com>
Date: Tue Jun 10 00:14:24 2014 -0700
glsl: Add C API for exec_node.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/list.h | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 205dc91..ce7f81f 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -129,6 +129,88 @@ struct exec_node {
#endif
};
+static inline const struct exec_node *
+exec_node_get_next_const(const struct exec_node *n)
+{
+ return n->next;
+}
+
+static inline struct exec_node *
+exec_node_get_next(struct exec_node *n)
+{
+ return n->next;
+}
+
+static inline const struct exec_node *
+exec_node_get_prev_const(const struct exec_node *n)
+{
+ return n->prev;
+}
+
+static inline struct exec_node *
+exec_node_get_prev(struct exec_node *n)
+{
+ return n->prev;
+}
+
+static inline void
+exec_node_remove(struct exec_node *n)
+{
+ n->next->prev = n->prev;
+ n->prev->next = n->next;
+ n->next = NULL;
+ n->prev = NULL;
+}
+
+static inline void
+exec_node_self_link(struct exec_node *n)
+{
+ n->next = n;
+ n->prev = n;
+}
+
+static inline void
+exec_node_insert_after(struct exec_node *n, struct exec_node *after)
+{
+ after->next = n->next;
+ after->prev = n;
+
+ n->next->prev = after;
+ n->next = after;
+}
+
+static inline void
+exec_node_insert_node_before(struct exec_node *n, struct exec_node *before)
+{
+ before->next = n;
+ before->prev = n->prev;
+
+ n->prev->next = before;
+ n->prev = before;
+}
+
+static inline void
+exec_node_replace_with(struct exec_node *n, struct exec_node *replacement)
+{
+ replacement->prev = n->prev;
+ replacement->next = n->next;
+
+ n->prev->next = replacement;
+ n->next->prev = replacement;
+}
+
+static inline bool
+exec_node_is_tail_sentinel(const struct exec_node *n)
+{
+ return n->next == NULL;
+}
+
+static inline bool
+exec_node_is_head_sentinel(const struct exec_node *n)
+{
+ return n->prev == NULL;
+}
+
#ifdef __cplusplus
inline const exec_node *exec_node::get_next() const
{
More information about the mesa-commit
mailing list