* Moved lcc and q3asm into code/tools
This commit is contained in:
parent
b1cef6352e
commit
ad118b9baf
452 changed files with 0 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