00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MUXEVENT_H
00016 #define MUXEVENT_H
00017
00018 #include <event.h>
00019
00020
00021
00022
00023
00024
00025
00026 #define FLAG_FREE_DATA 1
00027 #define FLAG_FREE_DATA2 2
00028 #define FLAG_ZOMBIE 4
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 typedef struct my_event_type {
00046 char flags;
00047 void (*function) (struct my_event_type *);
00048 void *data;
00049 void *data2;
00050 int tick;
00051 char type;
00052 struct my_event_type *next;
00053 struct my_event_type *next_in_main;
00054 struct my_event_type *prev_in_main;
00055 struct my_event_type *prev_in_type;
00056 struct my_event_type *next_in_type;
00057 struct event ev;
00058 } MUXEVENT;
00059
00060
00061 extern int muxevent_tick;
00062 extern int events_scheduled;
00063 extern int events_executed;
00064 extern int events_zombies;
00065
00066 #include "p.event.h"
00067
00068
00069
00070
00071 #define muxevent_add_simple_arg(time,func,data) muxevent_add(time,0,0,func,data, NULL)
00072 #define muxevent_add_simple_noarg(time,func) muxevent_add(time,0,0,func,NULL, NULL)
00073
00074
00075
00076
00077
00078
00079 #define REMOVE_FROM_LIST(a,c,b) if (a == b ) a = b->c; else { MUXEVENT *t; \
00080 for (t=a;t->c != b;t=t->c); t->c = b->c; }
00081 #define REMOVE_FROM_BIDIR_LIST(a,c,d,b) if (b->c) b->c->d = b->d; \
00082 if (b->d) b->d->c = b->c; if (a==b) { a=b->d; if (a) a->c=NULL; }
00083
00084 #define ADD_TO_LIST_HEAD(a,c,b) b->c = a ; a = b
00085 #define ADD_TO_BIDIR_LIST_HEAD(a,c,d,b) b->d=a ; if (a) a->c = b ; a=b ; \
00086 b->c=NULL
00087
00088
00089 void muxevent_add(int time, int flags, int type, void (*func) (MUXEVENT *),
00090 void *data, void *data2);
00091 void muxevent_gothru_type_data(int type, void *data, void (*func) (MUXEVENT *));
00092 void event_gothru_type(int type, void (*func) (MUXEVENT *));
00093
00094
00095
00096
00097
00098 #endif