added dlist to makefile, implemented first functions, discarded some fails

Sat, 31 Dec 2011 18:18:03 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 31 Dec 2011 18:18:03 +0100
changeset 7
68091406d1cf
parent 6
50b5fe7c577f
child 8
9cd2b2460db0

added dlist to makefile, implemented first functions, discarded some fails

ucx/Makefile file | annotate | diff | comparison | revisions
ucx/dlist.c file | annotate | diff | comparison | revisions
ucx/dlist.h file | annotate | diff | comparison | revisions
--- a/ucx/Makefile	Sat Dec 31 18:04:28 2011 +0100
+++ b/ucx/Makefile	Sat Dec 31 18:18:03 2011 +0100
@@ -29,7 +29,7 @@
 include ../$(CONF).mk
 
 # list of source files
-SRC = list.c map.c
+SRC = list.c dlist.c map.c
 
 OBJ = $(SRC:%.c=../build/%.$(OBJ_EXT))
 
--- a/ucx/dlist.c	Sat Dec 31 18:04:28 2011 +0100
+++ b/ucx/dlist.c	Sat Dec 31 18:18:03 2011 +0100
@@ -1,2 +1,49 @@
 #include "dlist.h"
 
+UcxDlist *ucx_dlist_append(UcxDlist *l, void *data)  {
+    
+}
+
+UcxDlist *ucx_dlist_prepend(UcxDlist *l, void *data) {
+    
+}
+
+UcxDlist *ucx_dlist_concat(UcxDlist *l1, UcxDlist *l2) {
+    
+}
+
+UcxDlist *ucx_dlist_last(UcxDlist *l) {
+    if (l == NULL) return NULL;
+    
+    UcxDlist *e = l;
+    while (e->next != NULL) {
+        e = e->next;
+    }
+    return e;
+}
+
+UcxDlist *ucx_dlist_get(UcxDlist *l, int index) {
+    
+}
+
+size_t ucx_dlist_size(UcxDlist *l) {
+    if (l == NULL) return 0;
+    
+    UcxDlist *e = l;
+    size_t s = 1;
+    while (e->next != NULL) {
+        e = e->next;
+        s++;
+    }
+
+    return s;
+}
+
+void ucx_dlist_foreach(UcxDlist *l, ucx_callback fnc, void* data) {
+    
+}
+
+/* dlist specific functions */
+UcxDlist *ucx_dlist_first(UcxDlist *l) {
+    
+}
\ No newline at end of file
--- a/ucx/dlist.h	Sat Dec 31 18:04:28 2011 +0100
+++ b/ucx/dlist.h	Sat Dec 31 18:18:03 2011 +0100
@@ -2,11 +2,12 @@
  * 
  */
 
-#include <stddef.h>
-
 #ifndef DLIST_H
 #define	DLIST_H
 
+#include "ucx.h"
+#include <stddef.h>
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -23,7 +24,8 @@
 UcxDlist *ucx_dlist_concat(UcxDlist *l1, UcxDlist *l2);
 UcxDlist *ucx_dlist_last(UcxDlist *l);
 UcxDlist *ucx_dlist_get(UcxDlist *l, int index);
-size_t *ucx_dlist_size(UcxDlist *l);
+size_t ucx_dlist_size(UcxDlist *l);
+void ucx_dlist_foreach(UcxDlist *l, ucx_callback fnc, void* data);
 
 /* dlist specific functions */
 UcxDlist *ucx_dlist_first(UcxDlist *l);

mercurial