home *** CD-ROM | disk | FTP | other *** search
/ Total Destruction / Total_Destruction.iso / addons / Lccwin32.exe / Lccwin32 / lccpub / src / event.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-11  |  437 b   |  30 lines

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