diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-15 18:09:00 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-15 20:03:45 +0100 |
commit | 05b5d8547f5f98ca4b907bf6a21564e2384740a6 (patch) | |
tree | d1a5c0a856f938721b92076e328ef22647fcaddb /linked_list.h | |
parent | Add toggle for node data output. (diff) | |
download | calp-05b5d8547f5f98ca4b907bf6a21564e2384740a6.tar.gz calp-05b5d8547f5f98ca4b907bf6a21564e2384740a6.tar.xz |
Improve FOR macro.
Diffstat (limited to '')
-rw-r--r-- | linked_list.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/linked_list.h b/linked_list.h index 8c09d5e0..909a38a8 100644 --- a/linked_list.h +++ b/linked_list.h @@ -69,14 +69,20 @@ FMT_F(LLIST(TYPE)); /* Iterator */ +#define __PRE_LLIST(T, l, set) \ + T* l; LINK(T)* __INTER(l); + +#define PRE_FOR_LLIST(T) __PRE_LLIST + // #define __BEG_LLIST(v, set) v = (set)->head -#define __BEG_LLIST(l, set) l = FIRST(set) -#define BEG_LLIST(T) LINK(T)* __BEG_LLIST +#define __BEG_LLIST(T, l, set) __INTER(l) = FIRST(set), l = L(__INTER(l)) +#define BEG_LLIST(T) __BEG_LLIST -#define __END_LLIST(l, set) l != (set)->tail +#define __END_LLIST(T, l, set) __INTER(l) != (set)->tail #define END_LLIST(T) __END_LLIST -#define __NXT_LLIST(l, set) l = l->after +#define __NXT_LLIST(T, l, set) __INTER(l) = __INTER(l)->after, l = L(__INTER(l)) +// #define __NXT_LLIST(T, l, set) l = L(__INTER(l) = __INTER(l)->after) #define NXT_LLIST(T) __NXT_LLIST #endif /* TYPE */ |