summaryrefslogtreecommitdiff
path: root/components/rtgui_win/include/rtgui/list.h
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-03-24 14:00:19 +0000
committer[email protected] <[email protected]>2011-03-24 14:00:19 +0000
commit0e93e6809c7beac4597148edc1dc09bcdf9a2ab3 (patch)
tree113765e7f8351d84226a3de04f13daf86ddd82f9 /components/rtgui_win/include/rtgui/list.h
parent96c53b49571adadd957df804f4f5e6698c14e3b3 (diff)
add rtgui_win subfield,Highlight the ease of use
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1345 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui_win/include/rtgui/list.h')
-rw-r--r--components/rtgui_win/include/rtgui/list.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/components/rtgui_win/include/rtgui/list.h b/components/rtgui_win/include/rtgui/list.h
new file mode 100644
index 0000000000..eb8afb62ea
--- /dev/null
+++ b/components/rtgui_win/include/rtgui/list.h
@@ -0,0 +1,66 @@
+/*
+ * File : list.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2009-10-16 Bernard first version
+ */
+#ifndef __RTGUI_LIST_H__
+#define __RTGUI_LIST_H__
+
+#include <rtgui/rtgui.h>
+
+typedef struct rtgui_list_node rtgui_list_t;/* (template),ע����CCList������ */
+
+struct rtgui_list_node
+{
+ rtgui_list_t* next;
+};
+rt_inline void rtgui_list_init(rtgui_list_t *l)
+{
+ l->next = (rtgui_list_t *)0;
+}
+
+rt_inline void rtgui_list_append(rtgui_list_t *l, rtgui_list_t *n)
+{
+ rtgui_list_t* node;
+
+ node = l;
+ while(node->next) node = node->next;
+
+ /* append the node to the tail */
+ node->next = n;
+ n->next = (rtgui_list_t*) 0;
+}
+
+rt_inline void list_insert(rtgui_list_t *l, rtgui_list_t *n)
+{
+ n->next = l->next;
+ l->next = n;
+}
+
+rt_inline rtgui_list_t* rtgui_list_remove(rtgui_list_t *l, rtgui_list_t *n)
+{
+ /* remove slist head */
+ rtgui_list_t* node = l;
+ while(node->next && node->next != n) node = node->next;
+
+ /* remove node */
+ if(node->next != (rtgui_list_t *)0) node->next = node->next->next;
+
+ return l;
+}
+
+#define rtgui_list_entry(node, type, member) \
+ ((type *)((char*)(node)-(unsigned long)(&((type *)0)->member)))
+
+#define rtgui_list_foreach(node, list) \
+ for((node) = (list)->next; (node) != RT_NULL; (node) = (node)->next)
+
+#endif