mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2025-01-22 07:11:07 +00:00
28 lines
416 B
C
28 lines
416 B
C
#include "c.h"
|
|
|
|
|
|
struct entry {
|
|
Apply func;
|
|
void *cl;
|
|
};
|
|
|
|
Events events;
|
|
void attach(Apply func, void *cl, List *list) {
|
|
struct entry *p;
|
|
|
|
NEW(p, PERM);
|
|
p->func = func;
|
|
p->cl = cl;
|
|
*list = append(p, *list);
|
|
}
|
|
void apply(List event, void *arg1, void *arg2) {
|
|
if (event) {
|
|
List lp = event;
|
|
do {
|
|
struct entry *p = lp->x;
|
|
(*p->func)(p->cl, arg1, arg2);
|
|
lp = lp->link;
|
|
} while (lp != event);
|
|
}
|
|
}
|
|
|