LinkList: Add Lth_ListForEach and Lth_ListFor
This uses some extensions David JUST implemented into GDCC.master
parent
a0e68bab91
commit
d9929aadd3
|
@ -46,6 +46,11 @@ Lth_X(SIGUPDATE , update, void, struct Lth_Context *, struct Lth_Control *)
|
||||||
(name).data[cbIter - 1](__VA_ARGS__); \
|
(name).data[cbIter - 1](__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
|
#define Lth_ControlCall(ctrl, name, ...) \
|
||||||
|
Lth_ListForEach(Lth_Control *owner, ctrl->descendants) \
|
||||||
|
Lth_Call(owner->cb.name, __VA_ARGS__); \
|
||||||
|
\
|
||||||
|
Lth_Call(ctrl->cb.name, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------|
|
//----------------------------------------------------------------------------|
|
||||||
|
|
|
@ -17,6 +17,14 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define Lth_ListForEach(tmpv, lst) \
|
||||||
|
for(Lth_LinkList *list = (lst); list; list = list->next) \
|
||||||
|
__with(tmpv = list->owner;)
|
||||||
|
#define Lth_ListFor(tmpv, lst) \
|
||||||
|
for(Lth_LinkList *list = (lst); list;) \
|
||||||
|
__with(Lth_LinkList *next = list->next, **prev = list->prev; \
|
||||||
|
tmpv = list->owner;)
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------|
|
//----------------------------------------------------------------------------|
|
||||||
// Type Definitions |
|
// Type Definitions |
|
||||||
|
|
Loading…
Reference in New Issue