~ubuntu-branches/ubuntu/precise/openarena/precise

« back to all changes in this revision

Viewing changes to code/tools/lcc/src/event.c

  • Committer: Bazaar Package Importer
  • Author(s): Bruno "Fuddl" Kleinert
  • Date: 2007-01-20 12:28:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070120122809-2yza5ojt7nqiyiam
Tags: upstream-0.6.0
ImportĀ upstreamĀ versionĀ 0.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "c.h"
 
2
 
 
3
 
 
4
struct entry {
 
5
        Apply func;
 
6
        void *cl;
 
7
};
 
8
 
 
9
Events events;
 
10
void attach(Apply func, void *cl, List *list) {
 
11
        struct entry *p;
 
12
 
 
13
        NEW(p, PERM);
 
14
        p->func = func;
 
15
        p->cl = cl;
 
16
        *list = append(p, *list);
 
17
}
 
18
void apply(List event, void *arg1, void *arg2) {
 
19
        if (event) {
 
20
                List lp = event;
 
21
                do {
 
22
                        struct entry *p = lp->x;
 
23
                        (*p->func)(p->cl, arg1, arg2);
 
24
                        lp = lp->link;
 
25
                } while (lp != event);
 
26
        }
 
27
}
 
28