Sat, 31 Dec 2011 18:18:03 +0100
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 |
1.1 --- a/ucx/Makefile Sat Dec 31 18:04:28 2011 +0100 1.2 +++ b/ucx/Makefile Sat Dec 31 18:18:03 2011 +0100 1.3 @@ -29,7 +29,7 @@ 1.4 include ../$(CONF).mk 1.5 1.6 # list of source files 1.7 -SRC = list.c map.c 1.8 +SRC = list.c dlist.c map.c 1.9 1.10 OBJ = $(SRC:%.c=../build/%.$(OBJ_EXT)) 1.11
2.1 --- a/ucx/dlist.c Sat Dec 31 18:04:28 2011 +0100 2.2 +++ b/ucx/dlist.c Sat Dec 31 18:18:03 2011 +0100 2.3 @@ -1,2 +1,49 @@ 2.4 #include "dlist.h" 2.5 2.6 +UcxDlist *ucx_dlist_append(UcxDlist *l, void *data) { 2.7 + 2.8 +} 2.9 + 2.10 +UcxDlist *ucx_dlist_prepend(UcxDlist *l, void *data) { 2.11 + 2.12 +} 2.13 + 2.14 +UcxDlist *ucx_dlist_concat(UcxDlist *l1, UcxDlist *l2) { 2.15 + 2.16 +} 2.17 + 2.18 +UcxDlist *ucx_dlist_last(UcxDlist *l) { 2.19 + if (l == NULL) return NULL; 2.20 + 2.21 + UcxDlist *e = l; 2.22 + while (e->next != NULL) { 2.23 + e = e->next; 2.24 + } 2.25 + return e; 2.26 +} 2.27 + 2.28 +UcxDlist *ucx_dlist_get(UcxDlist *l, int index) { 2.29 + 2.30 +} 2.31 + 2.32 +size_t ucx_dlist_size(UcxDlist *l) { 2.33 + if (l == NULL) return 0; 2.34 + 2.35 + UcxDlist *e = l; 2.36 + size_t s = 1; 2.37 + while (e->next != NULL) { 2.38 + e = e->next; 2.39 + s++; 2.40 + } 2.41 + 2.42 + return s; 2.43 +} 2.44 + 2.45 +void ucx_dlist_foreach(UcxDlist *l, ucx_callback fnc, void* data) { 2.46 + 2.47 +} 2.48 + 2.49 +/* dlist specific functions */ 2.50 +UcxDlist *ucx_dlist_first(UcxDlist *l) { 2.51 + 2.52 +} 2.53 \ No newline at end of file
3.1 --- a/ucx/dlist.h Sat Dec 31 18:04:28 2011 +0100 3.2 +++ b/ucx/dlist.h Sat Dec 31 18:18:03 2011 +0100 3.3 @@ -2,11 +2,12 @@ 3.4 * 3.5 */ 3.6 3.7 -#include <stddef.h> 3.8 - 3.9 #ifndef DLIST_H 3.10 #define DLIST_H 3.11 3.12 +#include "ucx.h" 3.13 +#include <stddef.h> 3.14 + 3.15 #ifdef __cplusplus 3.16 extern "C" { 3.17 #endif 3.18 @@ -23,7 +24,8 @@ 3.19 UcxDlist *ucx_dlist_concat(UcxDlist *l1, UcxDlist *l2); 3.20 UcxDlist *ucx_dlist_last(UcxDlist *l); 3.21 UcxDlist *ucx_dlist_get(UcxDlist *l, int index); 3.22 -size_t *ucx_dlist_size(UcxDlist *l); 3.23 +size_t ucx_dlist_size(UcxDlist *l); 3.24 +void ucx_dlist_foreach(UcxDlist *l, ucx_callback fnc, void* data); 3.25 3.26 /* dlist specific functions */ 3.27 UcxDlist *ucx_dlist_first(UcxDlist *l);