gi_event.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __GI_EVENT_H
00018 #define __GI_EVENT_H
00019
00020
00021
00031
00032
00033 #include <sys/types.h>
00034
00035
00036
00037
00038
00039 #define GI_MSEC (1)
00040 #define GI_SECONDS (1000*GI_MSEC)
00041 #define GI_MINUTES (60*GI_SECONDS)
00042
00043
00044 #define GI_ESECONDS (1)
00045 #define GI_EMINUTES (60*GI_ESECONDS)
00046 #define GI_EHOURS (60*GI_EMINUTES)
00047 #define GI_EDAYS (24*GI_EHOURS)
00048
00049
00050
00051 typedef int gi_input_t;
00052 typedef int gi_timer_t;
00054
00055
00060 typedef void (*GiInputCallback) (int fd, gi_input_t id, void *udata);
00061 #define GI_INPUT_CB(cbfn) ((GiInputCallback)(cbfn))
00062
00066 typedef enum
00067 {
00068 GI_INPUT_READ = 0x01,
00069 GI_INPUT_WRITE = 0x02,
00070 GI_INPUT_ERROR = 0x04
00071 } gi_inputset_t;
00072
00073
00074
00085 typedef void (*GiTimerCallback) (gi_timer_t id, void *udata);
00086 #define GI_TIMER_CB(cbfn) ((GiTimerCallback)(cbfn))
00087
00088
00089
00090 EXTERN_C_BEGIN
00091
00092
00093
00098 LIBGIFT_EXPORT
00099 void gi_event_init (void);
00100
00109 LIBGIFT_EXPORT
00110 void gi_event_quit (int sig);
00111
00116 LIBGIFT_EXPORT
00117 void gi_event_poll (int iterations);
00118
00123 LIBGIFT_EXPORT
00124 void gi_event_loop (void);
00125
00126
00127
00150 LIBGIFT_EXPORT
00151 gi_input_t gi_input_add (int fd, const void *udata, gi_inputset_t state,
00152 GiInputCallback callback);
00153
00159 LIBGIFT_EXPORT
00160 gi_input_t gi_input_addt (int fd, const void *udata, gi_inputset_t state,
00161 GiInputCallback callback, time_t timeout);
00162
00166 LIBGIFT_EXPORT
00167 void gi_input_remove (gi_input_t id);
00168
00172 LIBGIFT_EXPORT
00173 void gi_input_removen (gi_input_t *id);
00174
00182 LIBGIFT_EXPORT
00183 void gi_input_remove_all (int fd);
00184
00190 LIBGIFT_EXPORT
00191 void gi_input_suspend_all (int fd);
00192
00193 #if 0
00194
00197 LIBGIFT_EXPORT
00198 int gi_input_suspended_all (int fd);
00199 #endif
00200
00204 LIBGIFT_EXPORT
00205 void gi_input_resume_all (int fd);
00206
00207
00208
00226 LIBGIFT_EXPORT
00227 gi_timer_t gi_timer_add (time_t interval, GiTimerCallback callback,
00228 const void *udata);
00229
00234 LIBGIFT_EXPORT
00235 void gi_timer_reset (gi_timer_t id);
00236
00241 LIBGIFT_EXPORT
00242 void gi_timer_remove (gi_timer_t id);
00243
00248 LIBGIFT_EXPORT
00249 void gi_timer_removen (gi_timer_t *id);
00250
00251
00252
00253 EXTERN_C_END
00254
00255
00256
00257 #endif
Generated on Sun Aug 22 07:56:40 2004 by
1.3.7