diff options
Diffstat (limited to '')
-rw-r--r-- | linked_list.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/linked_list.h b/linked_list.h index 6136d35f..c46304cf 100644 --- a/linked_list.h +++ b/linked_list.h @@ -25,7 +25,9 @@ typedef struct { } LLIST(TYPE); #define FIRST(lst) (lst)->head->after +#define FIRST_V(lst) (lst)->head->after->value #define LAST(lst) (lst)->tail->before +#define LAST_V(lst) (lst)->tail->before->value INIT_F ( LLIST(TYPE) ); @@ -53,16 +55,20 @@ int APPEND(LLIST(TYPE)) ( LLIST(TYPE)* dest, LLIST(TYPE)* new ); int SIZE(LLIST(TYPE)) ( LLIST(TYPE)* llist ); int EMPTY(LLIST(TYPE)) ( LLIST(TYPE)* llist ); +int RESET(LLIST(TYPE)) ( LLIST(TYPE)* llist ); + +LLIST(TYPE)* RESOLVE(LLIST(TYPE)) (LLIST(TYPE)* dest, LLIST(TYPE)* new); + /* Iterator */ // #define __BEG_LLIST(v, set) v = (set)->head -#define __BEG_LLIST(v, set) v = FIRST(set) +#define __BEG_LLIST(l, set) l = FIRST(set) #define BEG_LLIST(T) LINK(T)* __BEG_LLIST -#define __END_LLIST(var, set) var == (set)->tail +#define __END_LLIST(l, set) l != (set)->tail #define END_LLIST(T) __END_LLIST -#define __NXT_LLIST(var, set) var = var->after +#define __NXT_LLIST(l, set) l = l->after #define NXT_LLIST(T) __NXT_LLIST #endif /* TYPE */ |