Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_event.h

00001 /* 00002 * $Id: gi_event.h,v 1.1.2.12 2004/05/05 10:22:01 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 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 /* time specifications useful for gi_timer_add calls, which are specified in 00038 * millisecond units */ 00039 #define GI_MSEC (1) 00040 #define GI_SECONDS (1000*GI_MSEC) 00041 #define GI_MINUTES (60*GI_SECONDS) 00042 00043 /* time specs useful for comparing seconds since the epoch */ 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 /* __EVENT_H */

Generated on Sun Aug 22 07:56:40 2004 by doxygen 1.3.7