URL
https://opencores.org/ocsvn/eco32/eco32/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 4 |
Rev 21 |
#include "c.h"
|
#include "c.h"
|
|
|
static char rcsid[] = "$Id: event.c,v 1.1 2002/08/28 23:12:43 drh Exp $";
|
static char rcsid[] = "$Id: event.c,v 1.1 2002/08/28 23:12:43 drh Exp $";
|
|
|
struct entry {
|
struct entry {
|
Apply func;
|
Apply func;
|
void *cl;
|
void *cl;
|
};
|
};
|
|
|
Events events;
|
Events events;
|
void attach(Apply func, void *cl, List *list) {
|
void attach(Apply func, void *cl, List *list) {
|
struct entry *p;
|
struct entry *p;
|
|
|
NEW(p, PERM);
|
NEW(p, PERM);
|
p->func = func;
|
p->func = func;
|
p->cl = cl;
|
p->cl = cl;
|
*list = append(p, *list);
|
*list = append(p, *list);
|
}
|
}
|
void apply(List event, void *arg1, void *arg2) {
|
void apply(List event, void *arg1, void *arg2) {
|
if (event) {
|
if (event) {
|
List lp = event;
|
List lp = event;
|
do {
|
do {
|
struct entry *p = lp->x;
|
struct entry *p = lp->x;
|
(*p->func)(p->cl, arg1, arg2);
|
(*p->func)(p->cl, arg1, arg2);
|
lp = lp->link;
|
lp = lp->link;
|
} while (lp != event);
|
} while (lp != event);
|
}
|
}
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.