mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-09 12:08:12 +03:00
Hard reset
This commit is contained in:
commit
09bed43f97
1594 changed files with 892326 additions and 0 deletions
28
code/tools/lcc/src/event.c
Normal file
28
code/tools/lcc/src/event.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
#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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue