Enlightenment CVS committal Author : doursse Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore Modified Files: Ecore.h ecore.c ecore_exe.c ecore_main.c ecore_plugin.c ecore_private.h ecore_signal.c ecore_time.c Log Message: add windows support to ecore. ecore_evas is ported too (directdraw and direct3d. No opengl yet). It needs to be tested a lot, though. Remove some trailing spaces here and there. Replace WIN32 with _WIN32 =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -3 -r1.53 -r1.54 --- Ecore.h 15 Mar 2007 22:21:26 -0000 1.53 +++ Ecore.h 26 Aug 2007 11:17:20 -0000 1.54 @@ -74,7 +74,7 @@ EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */ EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */ -#ifndef _ECORE_PRIVATE_H +#ifndef _ECORE_PRIVATE_H enum _Ecore_Fd_Handler_Flags { ECORE_FD_READ = 1, /**< Fd Read mask */ @@ -82,7 +82,7 @@ ECORE_FD_ERROR = 4 /**< Fd Error mask */ }; typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags; - + enum _Ecore_Exe_Flags /* flags for executing a child with its stdin and/or stdout piped back */ { @@ -96,8 +96,8 @@ ECORE_EXE_USE_SH = 128 /**< Use /bin/sh to run the command. */ }; typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags; - -#ifndef WIN32 + +#ifndef _WIN32 typedef void Ecore_Exe; /**< A handle for spawned processes */ #endif typedef void Ecore_Timer; /**< A handle for timers */ @@ -120,7 +120,7 @@ typedef struct _Ecore_Exe_Event_Data_Line Ecore_Exe_Event_Data_Line; /**< Lines from a child process */ typedef struct _Ecore_Exe_Event_Data Ecore_Exe_Event_Data; /**< Data from a child process */ -#ifndef WIN32 +#ifndef _WIN32 #endif struct _Ecore_Event_Signal_User /** User signal event */ @@ -128,20 +128,20 @@ int number; /**< The signal number. Either 1 or 2 */ void *ext_data; /**< Extension data - not used */ -#ifndef WIN32 +#ifndef _WIN32 siginfo_t data; /**< Signal info */ #endif }; - + struct _Ecore_Event_Signal_Hup /** Hup signal event */ { void *ext_data; /**< Extension data - not used */ -#ifndef WIN32 +#ifndef _WIN32 siginfo_t data; /**< Signal info */ #endif }; - + struct _Ecore_Event_Signal_Exit /** Exit request event */ { int interrupt : 1; /**< Set if the exit request was an interrupt signal*/ @@ -149,7 +149,7 @@ int terminate : 1; /**< Set if the exit request was a terminate singal */ void *ext_data; /**< Extension data - not used */ -#ifndef WIN32 +#ifndef _WIN32 siginfo_t data; /**< Signal info */ #endif }; @@ -158,7 +158,7 @@ { void *ext_data; /**< Extension data - not used */ -#ifndef WIN32 +#ifndef _WIN32 siginfo_t data; /**< Signal info */ #endif }; @@ -167,12 +167,12 @@ { int num; /**< The realtime signal's number */ -#ifndef WIN32 +#ifndef _WIN32 siginfo_t data; /**< Signal info */ #endif }; -#ifndef WIN32 +#ifndef _WIN32 struct _Ecore_Exe_Event_Add /** Process add event */ { Ecore_Exe *exe; /**< The handle to the added process */ @@ -205,10 +205,10 @@ Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */ }; #endif - + EAPI int ecore_init(void); EAPI int ecore_shutdown(void); - + EAPI void ecore_app_args_set(int argc, const char **argv); EAPI void ecore_app_args_get(int *argc, char ***argv); EAPI void ecore_app_restart(void); @@ -222,9 +222,9 @@ EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef); EAPI int ecore_event_current_type_get(void); EAPI void *ecore_event_current_event_get(void); - - -#ifndef WIN32 + + +#ifndef _WIN32 EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data); EAPI Ecore_Exe *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data); EAPI int ecore_exe_send(Ecore_Exe *exe, void *data, int size); @@ -245,10 +245,10 @@ EAPI void ecore_exe_signal(Ecore_Exe *exe, int num); EAPI void ecore_exe_hup(Ecore_Exe *exe); #endif - + EAPI Ecore_Idler *ecore_idler_add(int (*func) (void *data), const void *data); EAPI void *ecore_idler_del(Ecore_Idler *idler); - + EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(int (*func) (void *data), const void *data); EAPI void *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer); @@ -264,18 +264,18 @@ EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler); EAPI int ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); - + EAPI double ecore_time_get(void); - + EAPI Ecore_Timer *ecore_timer_add(double in, int (*func) (void *data), const void *data); EAPI void *ecore_timer_del(Ecore_Timer *timer); EAPI void ecore_timer_interval_set(Ecore_Timer *timer, double in); - + EAPI Ecore_Animator *ecore_animator_add(int (*func) (void *data), const void *data); EAPI void *ecore_animator_del(Ecore_Animator *animator); EAPI void ecore_animator_frametime_set(double frametime); EAPI double ecore_animator_frametime_get(void); - + #ifdef __cplusplus } #endif =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- ecore.c 18 Aug 2007 14:26:49 -0000 1.18 +++ ecore.c 26 Aug 2007 11:17:20 -0000 1.19 @@ -1,14 +1,14 @@ #include <locale.h> -#ifndef WIN32 -#include <langinfo.h> -#endif /* WIN32 */ +#ifndef _WIN32 +# include <langinfo.h> +#endif /* _WIN32 */ #include "ecore_private.h" #include "Ecore.h" static const char *_ecore_magic_string_get(Ecore_Magic m); static int _ecore_init_count = 0; -#ifndef WIN32 +#ifndef _WIN32 int _ecore_fps_debug = 0; #endif @@ -17,23 +17,23 @@ */ #ifndef CODESET -#define CODESET "INVALID" +# define CODESET "INVALID" #endif /** * Set up connections, signal handlers, sockets etc. * @return 1 or greater on success, 0 otherwise - * + * * This function sets up all singal handlers and the basic event loop. If it * succeeds, 1 will be returned, otherwise 0 will be returned. - * + * * @code * #include <Ecore.h> - * + * * int main(int argc, char **argv) * { * if (!ecore_init()) - * { + * { * printf("ERROR: Cannot init Ecore!\n"); * return -1; * } @@ -53,8 +53,8 @@ { printf("WARNING: not a utf8 locale!\n"); } - */ -#ifndef WIN32 + */ +#ifndef _WIN32 if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1; if (_ecore_fps_debug) _ecore_fps_debug_init(); _ecore_signal_init(); @@ -67,11 +67,11 @@ /** * Shut down connections, signal handlers sockets etc. - * + * * This function shuts down all things set up in ecore_init() and cleans up all * event queues, handlers, filters, timers, idlers, idle enterers/exiters * etc. set up after ecore_init() was called. - * + * * Do not call this function from any callback that may be called from the main * loop, as the main loop will then fall over and not function properly. */ @@ -81,11 +81,11 @@ if (--_ecore_init_count) return _ecore_init_count; -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_fps_debug) _ecore_fps_debug_shutdown(); #endif _ecore_animator_shutdown(); -#ifndef WIN32 +#ifndef _WIN32 _ecore_exe_shutdown(); #endif _ecore_idle_enterer_shutdown(); @@ -94,7 +94,7 @@ _ecore_timer_shutdown(); _ecore_event_shutdown(); _ecore_main_shutdown(); -#ifndef WIN32 +#ifndef _WIN32 _ecore_signal_shutdown(); #endif @@ -104,7 +104,7 @@ EAPI void _ecore_magic_fail(void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname) { - fprintf(stderr, + fprintf(stderr, "\n" "*** ECORE ERROR: Ecore Magic Check Failed!!!\n" "*** IN FUNCTION: %s()\n", fname); @@ -118,7 +118,7 @@ " Supplied: %08x - %s\n", (unsigned int)req_m, _ecore_magic_string_get(req_m), (unsigned int)m, _ecore_magic_string_get(m)); - fprintf(stderr, + fprintf(stderr, "*** NAUGHTY PROGRAMMER!!!\n" "*** SPANK SPANK SPANK!!!\n" "*** Now go fix your code. Tut tut tut!\n" @@ -164,7 +164,7 @@ return "<UNKNOWN>"; } -#ifndef WIN32 +#ifndef _WIN32 /* fps debug calls - for debugging how much time your app actually spends */ /* "running" (and the inverse being time spent running)... this does not */ /* account for other apps and multitasking... */ @@ -177,7 +177,7 @@ _ecore_fps_debug_init(void) { char buf[4096]; - + _ecore_fps_debug_init_count++; if (_ecore_fps_debug_init_count > 1) return; snprintf(buf, sizeof(buf), "/tmp/.ecore_fps_debug-%i", (int)getpid()); @@ -190,7 +190,7 @@ if (_ecore_fps_debug_fd >= 0) { unsigned int zero = 0; - + write(_ecore_fps_debug_fd, &zero, sizeof(unsigned int)); _ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int), PROT_READ | PROT_WRITE, @@ -207,7 +207,7 @@ if (_ecore_fps_debug_fd >= 0) { char buf[4096]; - + snprintf(buf, sizeof(buf), "/tmp/.ecore_fps_debug-%i", (int)getpid()); unlink(buf); if (_ecore_fps_runtime_mmap) @@ -223,11 +223,11 @@ void _ecore_fps_debug_runtime_add(double t) { - if ((_ecore_fps_debug_fd >= 0) && + if ((_ecore_fps_debug_fd >= 0) && (_ecore_fps_runtime_mmap)) { unsigned int tm; - + tm = (unsigned int)(t * 1000000.0); /* i know its not 100% theoretically guaranteed, but i'd say a write */ /* of an int could be considered atomic for all practical purposes */ =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_exe.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -3 -r1.68 -r1.69 --- ecore_exe.c 5 Jul 2007 09:51:09 -0000 1.68 +++ ecore_exe.c 26 Aug 2007 11:17:20 -0000 1.69 @@ -1,11 +1,11 @@ #include <errno.h> #ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> +# include <sys/wait.h> #endif /* HAVE_SYS_WAIT_H */ #include "ecore_private.h" #include "Ecore.h" -#ifndef WIN32 +#ifndef _WIN32 /* TODO: Something to let people build a command line and does auto escaping - * @@ -15,7 +15,7 @@ * * cmd = ecore_exe_comand_parameter_append(cmd, "firefox"); * cmd = ecore_exe_comand_parameter_append(cmd, "http://www.foo.com/bar.html?baz=yes"); - * each parameter appended is one argument, and it gets escaped, quoted, and + * each parameter appended is one argument, and it gets escaped, quoted, and * appended with a preceeding space. The first is the command off course. */ @@ -262,12 +262,12 @@ * This function does the same thing as ecore_exe_run(), but also makes the * standard in and/or out as wel las stderr from the child process available * for reading or writing. To write use ecore_exe_send(). To read listen to - * ECORE_EXE_EVENT_DATA or ECORE_EXE_EVENT_ERROR events (set up handlers). - * Ecore may buffer read and error data until a newline character if asked - * for with the @p flags. All data will be included in the events (newlines - * will be replaced with NULLS if line buffered). ECORE_EXE_EVENT_DATA events - * will only happen if the process is run with ECORE_EXE_PIPE_READ enabled - * in the flags. The same with the error version. Writing will only be + * ECORE_EXE_EVENT_DATA or ECORE_EXE_EVENT_ERROR events (set up handlers). + * Ecore may buffer read and error data until a newline character if asked + * for with the @p flags. All data will be included in the events (newlines + * will be replaced with NULLS if line buffered). ECORE_EXE_EVENT_DATA events + * will only happen if the process is run with ECORE_EXE_PIPE_READ enabled + * in the flags. The same with the error version. Writing will only be * allowed with ECORE_EXE_PIPE_WRITE enabled in the flags. * * @param exe_cmd The command to run with @c /bin/sh. @@ -532,11 +532,11 @@ /** * Sends data to the given child process which it recieves on stdin. - * + * * This function writes to a child processes standard in, with unlimited * buffering. This call will never block. It may fail if the system runs out * of memory. - * + * * @param exe The child process to send to * @param data The data to send * @param size The size of the data to send, in bytes @@ -564,7 +564,7 @@ /** * The stdin of the given child process will close when the write buffer is empty. - * + * * @param exe The child process * @ingroup Ecore_Exe_Basic_Group */ @@ -608,17 +608,17 @@ * * capture stderr & stdout internally * - * raster and onefang keep moving the goal posts on this one. It started out as + * raster and onefang keep moving the goal posts on this one. It started out as * "show users the error output if an exe fails" and is rapidly approaching * "alternative method of getting the data, poll vs event driven". Some serious * thinking needs to be applied to this. Do we really want to go that far? If * so, we should change the names. The basic design will probably remain the * same which ever way we go. The constant goal post moving is probably due to * generic design methods leading to feature creep as we inspired each other to - * more generic designs. It does seem like the closer we get to poll driven, + * more generic designs. It does seem like the closer we get to poll driven, * the more issues and corner cases there are. * - * Instead of doing the usual register an event handler thing, we are ecore_exe, + * Instead of doing the usual register an event handler thing, we are ecore_exe, * we can take some short cuts. Don't send the events, just leave the exe buffers * as is until the user asks for them, then return the event. * @@ -648,7 +648,7 @@ * Gets the auto pipe data for the given process handle * * @param exe The given process handle. - * @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR? + * @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR? * @ingroup Ecore_Exe_Basic_Group */ EAPI Ecore_Exe_Event_Data * @@ -801,7 +801,7 @@ * free it as it just returns the internal pointer value. This value is only * valid as long as the @p exe is valid or until the tag is set to something * else on this @p exe. - * + * * @param exe The given process handle. * @return The string attached to @p exe. * @ingroup Ecore_Exe_Basic_Group @@ -846,7 +846,7 @@ if (exe->doomsday_clock) { struct _ecore_exe_dead_exe *dead; - + ecore_timer_del(exe->doomsday_clock); exe->doomsday_clock = NULL; dead = exe->doomsday_clock_dead; @@ -876,7 +876,7 @@ IF_FREE(exe->read_data_buf); IF_FREE(exe->error_data_buf); IF_FREE(exe->cmd); - + exes = _ecore_list2_remove(exes, exe); ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE); IF_FREE(exe->tag); @@ -1090,22 +1090,22 @@ { Ecore_Exe *exe = NULL; - /* FIXME: There is no nice, safe, OS independant way to tell if a + /* FIXME: There is no nice, safe, OS independant way to tell if a * particular PID is still alive. I have written code to do so - * for my urunlevel busybox applet (http://urunlevel.sourceforge.net/), + * for my urunlevel busybox applet (http://urunlevel.sourceforge.net/), * but it's for linux only, and still not guaranteed. * - * So for now, we just check that a valid Ecore_Exe structure + * So for now, we just check that a valid Ecore_Exe structure * exists for it. Even that is not a guarantee, as the structure * can be freed without killing the process. * * I think we can safely put exe's into two categories, those users * that care about the life of the exe, and the run and forget type. - * The run and forget type starts up the exe, then free's the - * Ecore_Exe structure straight away. They can never call any of + * The run and forget type starts up the exe, then free's the + * Ecore_Exe structure straight away. They can never call any of * the functions that can call this, so we don't worry about them. * - * Those user's that care about the life of exe's will keep the + * Those user's that care about the life of exe's will keep the * Ecore_Exe structure around, terminate them eventually, or * register for exit events. For these ones the assumption * that valid Ecore_Exe struct == live exe is almost valid. @@ -1259,7 +1259,7 @@ if (!(buf = strdup(exe_cmd))) return; - + token = strtok(buf, " \t\n\v"); use_sh = 0; if (!(args = (char **)calloc(num_tokens + 1, sizeof(char *)))) @@ -1276,7 +1276,7 @@ args[num_tokens] = NULL; } } - + setsid(); if ((flags & ECORE_EXE_USE_SH)) { @@ -1423,8 +1423,8 @@ ("There are %d bytes left unsent from the dead exe %s.\n", exe->error_data_size, exe->cmd); } - /* Thought about this a bit. If the exe has actually - * died, this won't do any harm as it must have died + /* Thought about this a bit. If the exe has actually + * died, this won't do any harm as it must have died * recently and the pid has not had a chance to recycle. * It is also a paranoid catchall, coz the usual ecore_signal * mechenism should kick in. But let's give it a good =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_main.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- ecore_main.c 10 Jan 2006 16:46:07 -0000 1.26 +++ ecore_main.c 26 Aug 2007 11:17:20 -0000 1.27 @@ -1,5 +1,5 @@ -#ifdef WIN32 -#include <winsock.h> +#ifdef _WIN32 +#include <windows.h> #endif #include <math.h> @@ -8,7 +8,7 @@ #include <unistd.h> #include <errno.h> -#define FIX_HZ 1 +#define FIX_HZ 1 #ifdef FIX_HZ #include <sys/param.h> @@ -46,7 +46,7 @@ * concurrency. A properly written, event-driven program using this * kind of programming does not need threads. It makes the program very * robust and easy to follow. - * + * * Here is an example of simple program and its basic event loop flow: * @image html prog_flow.png * @@ -104,9 +104,9 @@ * @p func will be called during the execution of @ref ecore_main_loop_begin * when the file descriptor is available for reading, or writing, or both. * - * Normally the return value from the @p func is "zero means this handler is + * Normally the return value from the @p func is "zero means this handler is * finished and can be deleted" as is usual for handler callbacks. However, - * if the @p buf_func is supplied, then the return value from the @p func is "non + * if the @p buf_func is supplied, then the return value from the @p func is "non * zero means the handler should be called again in a tight loop". * * @p buf_func is called during event loop handling to check if data that has @@ -166,7 +166,7 @@ { if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) { - ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, "ecore_main_fd_handler_del"); return NULL; } @@ -180,7 +180,7 @@ { if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) { - ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, "ecore_main_fd_handler_prepare_callback_set"); return; } @@ -199,7 +199,7 @@ { if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) { - ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, "ecore_main_fd_handler_fd_get"); return -1; } @@ -219,10 +219,10 @@ ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) { int ret; - + if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) { - ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, "ecore_main_fd_handler_active_get"); return 0; } @@ -265,7 +265,7 @@ while (fd_handlers) { Ecore_Fd_Handler *fdh; - + fdh = fd_handlers; fd_handlers = _ecore_list2_remove(fd_handlers, fdh); ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); @@ -298,10 +298,10 @@ timeout += (0.5 / HZ); sec = (int)timeout; usec = (int)((timeout - (double)sec) * 1000000); -#else +#else sec = (int)timeout; usec = (int)((timeout - (double)sec) * 1000000); -#endif +#endif tv.tv_sec = sec; tv.tv_usec = usec; t = &tv; @@ -315,7 +315,7 @@ for (l = (Ecore_List2 *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me && fdh->prep_func) @@ -324,7 +324,7 @@ for (l = (Ecore_List2 *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - + fdh = (Ecore_Fd_Handler *)l; if (fdh->flags & ECORE_FD_READ) { @@ -342,7 +342,7 @@ if (fdh->fd > max_fd) max_fd = fdh->fd; } } -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_signal_count_get()) return -1; #endif ret = select(max_fd + 1, &rfds, &wfds, &exfds, t); @@ -355,7 +355,7 @@ for (l = (Ecore_List2 *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me) { @@ -368,7 +368,7 @@ } } _ecore_main_fd_handlers_cleanup(); - return 1; + return 1; } return 0; } @@ -377,12 +377,12 @@ _ecore_main_fd_handlers_cleanup(void) { Ecore_List2 *l; - + if (!fd_handlers_delete_me) return; for (l = (Ecore_List2 *)fd_handlers; l;) { Ecore_Fd_Handler *fdh; - + fdh = (Ecore_Fd_Handler *)l; l = l->next; if (fdh->delete_me) @@ -399,16 +399,16 @@ _ecore_main_fd_handlers_call(void) { Ecore_List2 *l; - + for (l = (Ecore_List2 *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me) { - if ((fdh->read_active) || - (fdh->write_active) || + if ((fdh->read_active) || + (fdh->write_active) || (fdh->error_active)) { if (!fdh->func(fdh->data, fdh)) @@ -429,12 +429,12 @@ { Ecore_List2 *l; int ret; - + ret = 0; for (l = (Ecore_List2 *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me) { @@ -454,29 +454,32 @@ static void _ecore_main_loop_iterate_internal(int once_only) { +#ifdef _WIN32 + MSG msg; +#endif double next_time; int have_event = 0; int have_signal; - + in_main_loop++; /* expire any timers */ { double now; - + now = ecore_time_get(); while (_ecore_timer_call(now)); _ecore_timer_cleanup(); } /* any timers re-added as a result of these are allowed to go */ _ecore_timer_enable_new(); -#ifndef WIN32 +#ifndef _WIN32 /* process signals into events .... */ while (_ecore_signal_count_get()) _ecore_signal_call(); #endif if (_ecore_event_exist()) { int ret; - + have_event = 1; have_signal = 1; ret = _ecore_main_select(0); @@ -493,7 +496,7 @@ ret = _ecore_main_select(0); if (ret > 0) have_event = 1; -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; #endif @@ -507,7 +510,7 @@ if (_ecore_event_exist()) { int ret; - + have_event = 1; have_signal = 1; ret = _ecore_main_select(0); @@ -519,8 +522,8 @@ in_main_loop--; return; } - -#ifndef WIN32 + +#ifndef _WIN32 if (_ecore_fps_debug) { t2 = ecore_time_get(); @@ -529,7 +532,7 @@ } #endif start_loop: - if (do_quit) + if (do_quit) { in_main_loop--; return; @@ -538,7 +541,7 @@ { /* init flags */ have_event = have_signal = 0; - next_time = _ecore_timer_next_get(); + next_time = _ecore_timer_next_get(); /* no timers */ if (next_time < 0) { @@ -546,10 +549,10 @@ if (!_ecore_idler_exist()) { int ret; - + ret = _ecore_main_select(-1); if (ret > 0) have_event = 1; -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; #endif } @@ -559,12 +562,12 @@ for (;;) { int ret; - + if (!_ecore_idler_call()) goto start_loop; if (_ecore_event_exist()) break; ret = _ecore_main_select(0); if (ret > 0) have_event = 1; -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; #endif if (have_event || have_signal) break; @@ -581,10 +584,10 @@ if (!_ecore_idler_exist()) { int ret; - + ret = _ecore_main_select(next_time); if (ret > 0) have_event = 1; -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; #endif } @@ -595,12 +598,12 @@ { double cur_time, t; int ret; - + if (!_ecore_idler_call()) goto start_loop; if (_ecore_event_exist()) break; ret = _ecore_main_select(0); if (ret > 0) have_event = 1; -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; #endif if ((have_event) || (have_signal)) break; @@ -614,7 +617,7 @@ } } } -#ifndef WIN32 +#ifndef _WIN32 if (_ecore_fps_debug) { t1 = ecore_time_get(); @@ -630,16 +633,23 @@ if (have_event) _ecore_main_fd_handlers_call(); do { -#ifndef WIN32 +#ifndef _WIN32 /* process signals into events .... */ while (_ecore_signal_count_get()) _ecore_signal_call(); #endif - + /* handle events ... */ - _ecore_event_call(); + _ecore_event_call(); _ecore_main_fd_handlers_cleanup(); } while (_ecore_main_fd_handlers_buf_call()); +#ifdef _WIN32 + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +#endif if (once_only) _ecore_idle_enterer_call(); in_main_loop--; } =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_plugin.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ecore_plugin.c 25 Jul 2007 17:00:54 -0000 1.12 +++ ecore_plugin.c 26 Aug 2007 11:17:21 -0000 1.13 @@ -1,4 +1,4 @@ -#ifndef WIN32 +#ifndef _WIN32 # include <dlfcn.h> # include "ecore_private.h" # include "Ecore_Data.h" =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_private.h,v retrieving revision 1.43 retrieving revision 1.44 diff -u -3 -r1.43 -r1.44 --- ecore_private.h 5 Jul 2007 09:51:09 -0000 1.43 +++ ecore_private.h 26 Aug 2007 11:17:21 -0000 1.44 @@ -13,16 +13,16 @@ #include <limits.h> #include <dirent.h> -#ifndef WIN32 -#include <sys/mman.h> +#ifndef _WIN32 +# include <sys/mman.h> #endif #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif #ifdef EAPI -#undef EAPI +# undef EAPI #endif #ifdef _MSC_VER # ifdef BUILDING_DLL @@ -50,29 +50,29 @@ #endif #if HAVE___ATTRIBUTE__ -#define __UNUSED__ __attribute__((unused)) +# define __UNUSED__ __attribute__((unused)) #else -#define __UNUSED__ +# define __UNUSED__ #endif #ifndef PATH_MAX -#define PATH_MAX 4096 +# define PATH_MAX 4096 #endif #ifndef MIN -#define MIN(x, y) (((x) > (y)) ? (y) : (x)) +# define MIN(x, y) (((x) > (y)) ? (y) : (x)) #endif #ifndef MAX -#define MAX(x, y) (((x) > (y)) ? (x) : (y)) +# define MAX(x, y) (((x) > (y)) ? (x) : (y)) #endif #ifndef ABS -#define ABS(x) ((x) < 0 ? -(x) : (x)) +# define ABS(x) ((x) < 0 ? -(x) : (x)) #endif #ifndef CLAMP -#define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x))) +# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x))) #endif #define READBUFSIZ 65536 @@ -115,7 +115,7 @@ ecore_print_warning(__FUNCTION__, sparam); \ return ret; \ } - + #undef CHECK_PARAM_POINTER #define CHECK_PARAM_POINTER(sparam, param) \ if (!(param)) \ @@ -168,14 +168,14 @@ * * Document that the exe must be respawnable, in other words, there is no * state that it cannot regenerate by just killing it and starting it again. - * This includes state that the user code knows about, as the respawn is - * transparent to that code. On the other hand, maybe a respawn event might - * be useful, or maybe resend the currently non existant add event. For + * This includes state that the user code knows about, as the respawn is + * transparent to that code. On the other hand, maybe a respawn event might + * be useful, or maybe resend the currently non existant add event. For * consistancy with ecore_con, an add event is good anyway. * * The Ecore_exe structure is reused for respawning, so that the (opaque) * pointer held by the user remains valid. This means that the Ecore_Exe - * init and del functions may need to be split into two parts each to avoid + * init and del functions may need to be split into two parts each to avoid * duplicating code - common code part, and the rest. This implies that * the unchanging members mentioned next should NEVER change. * @@ -212,17 +212,17 @@ * close_write - state that must be regenerated, zap it * * There is the problem that an exe that fell over and needs respawning - * might keep falling over, keep needing to be respawned, and tie up system - * resources with the constant respawning. An exponentially increasing + * might keep falling over, keep needing to be respawned, and tie up system + * resources with the constant respawning. An exponentially increasing * timeout (with maximum timeout) between respawns should take care of that. - * Although this is not a "contention for a resource" problem, the exe falling - * over may be, so a random element added to the timeout may help, and won't - * hurt. The user code may need to be informed that a timeout is in progress. + * Although this is not a "contention for a resource" problem, the exe falling + * over may be, so a random element added to the timeout may help, and won't + * hurt. The user code may need to be informed that a timeout is in progress. */ }; typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags; -#ifndef WIN32 +#ifndef _WIN32 typedef struct _Ecore_Exe Ecore_Exe; #endif typedef struct _Ecore_Timer Ecore_Timer; @@ -235,7 +235,7 @@ typedef struct _Ecore_Event Ecore_Event; typedef struct _Ecore_Animator Ecore_Animator; -#ifndef WIN32 +#ifndef _WIN32 struct _Ecore_Exe { Ecore_List2 __list_data; @@ -248,8 +248,8 @@ Ecore_Fd_Handler *write_fd_handler; /* the fd_handler to handle write to child - if this was used, or NULL if not */ Ecore_Fd_Handler *read_fd_handler; /* the fd_handler to handle read from child - if this was used, or NULL if not */ Ecore_Fd_Handler *error_fd_handler; /* the fd_handler to handle errors from child - if this was used, or NULL if not */ - void *write_data_buf; /* a data buffer for data to write to the child - - * realloced as needed for more data and flushed when the fd handler says writes are possible + void *write_data_buf; /* a data buffer for data to write to the child - + * realloced as needed for more data and flushed when the fd handler says writes are possible */ int write_data_size; /* the size in bytes of the data buffer */ int write_data_offset; /* the offset in bytes in the data buffer */ @@ -289,7 +289,7 @@ Ecore_List2 __list_data; ECORE_MAGIC; int delete_me : 1; - int (*func) (void *data); + int (*func) (void *data); void *data; }; @@ -298,7 +298,7 @@ Ecore_List2 __list_data; ECORE_MAGIC; int delete_me : 1; - int (*func) (void *data); + int (*func) (void *data); void *data; }; @@ -307,7 +307,7 @@ Ecore_List2 __list_data; ECORE_MAGIC; int delete_me : 1; - int (*func) (void *data); + int (*func) (void *data); void *data; }; @@ -376,7 +376,7 @@ EAPI void _ecore_magic_fail(void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname); void _ecore_timer_shutdown(void); -void _ecore_timer_cleanup(void); +void _ecore_timer_cleanup(void); void _ecore_timer_enable_new(void); double _ecore_timer_next_get(void); int _ecore_timer_call(double when); @@ -394,7 +394,7 @@ int _ecore_idle_exiter_exist(void); void _ecore_event_shutdown(void); -int _ecore_event_exist(void); +int _ecore_event_exist(void); Ecore_Event *_ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data); void *_ecore_event_del(Ecore_Event *event); void _ecore_event_call(void); @@ -406,13 +406,13 @@ void *_ecore_event_signal_realtime_new(void); void _ecore_main_shutdown(void); - + void _ecore_signal_shutdown(void); void _ecore_signal_init(void); int _ecore_signal_count_get(void); void _ecore_signal_call(void); -#ifndef WIN32 +#ifndef _WIN32 void _ecore_exe_init(void); void _ecore_exe_shutdown(void); Ecore_Exe *_ecore_exe_find(pid_t pid); @@ -421,7 +421,7 @@ #endif void _ecore_animator_shutdown(void); - + EAPI void *_ecore_list2_append (void *in_list, void *in_item); EAPI void *_ecore_list2_prepend (void *in_list, void *in_item); =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_signal.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- ecore_signal.c 4 Feb 2006 02:21:43 -0000 1.34 +++ ecore_signal.c 26 Aug 2007 11:17:21 -0000 1.35 @@ -1,4 +1,4 @@ -#ifndef WIN32 +#ifndef _WIN32 #include <sys/types.h> #include <sys/wait.h> #include <signal.h> @@ -14,7 +14,7 @@ typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo); -static void _ecore_signal_callback_set(int sig, Signal_Handler func); +static void _ecore_signal_callback_set(int sig, Signal_Handler func); static void _ecore_signal_callback_ignore(int sig, siginfo_t *si, void *foo); static void _ecore_signal_callback_sigchld(int sig, siginfo_t *si, void *foo); static void _ecore_signal_callback_sigusr1(int sig, siginfo_t *si, void *foo); @@ -66,7 +66,7 @@ #ifdef SIGRTMIN int i, num = SIGRTMAX - SIGRTMIN; #endif - + _ecore_signal_callback_set(SIGPIPE, (Signal_Handler) SIG_DFL); _ecore_signal_callback_set(SIGALRM, (Signal_Handler) SIG_DFL); _ecore_signal_callback_set(SIGCHLD, (Signal_Handler) SIG_DFL); @@ -136,7 +136,7 @@ sigrt_info = calloc(1, sizeof(siginfo_t) * num); assert(sigrt_info); - + for (i = 0; i < num; i++) _ecore_signal_callback_set(SIGRTMIN + i, _ecore_signal_callback_sigrt); #endif @@ -154,18 +154,18 @@ #ifdef SIGRTMIN int i, num = SIGRTMAX - SIGRTMIN; #endif - + while (sigchld_count > 0) { pid_t pid; int status; - + while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { Ecore_Exe_Event_Del *e; - + /* FIXME: If this process is set respawn, respawn with a suitable backoff - * period for those that need too much respawning. + * period for those that need too much respawning. */ e = _ecore_exe_event_del_new(); if (e) @@ -182,10 +182,10 @@ } e->pid = pid; e->exe = _ecore_exe_find(pid); - + if (sigchld_info.si_signo) e->data = sigchld_info; /* No need to clone this. */ - + if ((e->exe) && (e->exe->flags & (ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR))) { /* We want to report the Last Words of the exe, so delay this event. @@ -196,17 +196,17 @@ * 3 There are Last Words, they are ready to be read. * * For 1 we don't want to delay, for 3 we want to delay. - * 2 is the problem. If we check for data now and there + * 2 is the problem. If we check for data now and there * is none, then there is no way to differentiate 1 and 2. - * If we don't delay, we may loose data, but if we do delay, + * If we don't delay, we may loose data, but if we do delay, * there may not be data and the exit event never gets sent. - * - * Any way you look at it, there has to be some time passed + * + * Any way you look at it, there has to be some time passed * before the exit event gets sent. So the strategy here is * to setup a timer event that will send the exit event after * an arbitrary, but brief, time. * - * This is probably paranoid, for the less paraniod, we could + * This is probably paranoid, for the less paraniod, we could * check to see for Last Words, and only delay if there are any. * This has it's own set of problems. */ @@ -215,7 +215,7 @@ } else { - _ecore_event_add(ECORE_EXE_EVENT_DEL, e, + _ecore_event_add(ECORE_EXE_EVENT_DEL, e, _ecore_exe_event_del_free, NULL); } } @@ -226,15 +226,15 @@ while (sigusr1_count > 0) { Ecore_Event_Signal_User *e; - + e = _ecore_event_signal_user_new(); if (e) { e->number = 1; if (sigusr1_info.si_signo) - e->data = sigusr1_info; - + e->data = sigusr1_info; + ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL); } sigusr1_count--; @@ -243,15 +243,15 @@ while (sigusr2_count > 0) { Ecore_Event_Signal_User *e; - + e = _ecore_event_signal_user_new(); if (e) { e->number = 2; - + if (sigusr2_info.si_signo) - e->data = sigusr2_info; - + e->data = sigusr2_info; + ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL); } sigusr2_count--; @@ -260,13 +260,13 @@ while (sighup_count > 0) { Ecore_Event_Signal_Hup *e; - + e = _ecore_event_signal_hup_new(); if (e) { if (sighup_info.si_signo) e->data = sighup_info; - + ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, NULL, NULL); } sighup_count--; @@ -275,7 +275,7 @@ while (sigquit_count > 0) { Ecore_Event_Signal_Exit *e; - + e = _ecore_event_signal_exit_new(); if (e) { @@ -283,7 +283,7 @@ if (sigquit_info.si_signo) e->data = sigquit_info; - + ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL); } sigquit_count--; @@ -292,15 +292,15 @@ while (sigint_count > 0) { Ecore_Event_Signal_Exit *e; - + e = _ecore_event_signal_exit_new(); if (e) { e->interrupt = 1; - + if (sigint_info.si_signo) e->data = sigint_info; - + ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL); } sigint_count--; @@ -309,15 +309,15 @@ while (sigterm_count > 0) { Ecore_Event_Signal_Exit *e; - + e = _ecore_event_signal_exit_new(); if (e) { e->terminate = 1; - + if (sigterm_info.si_signo) e->data = sigterm_info; - + ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL); } sigterm_count--; @@ -327,13 +327,13 @@ while (sigpwr_count > 0) { Ecore_Event_Signal_Power *e; - + e = _ecore_event_signal_power_new(); if (e) { if (sigpwr_info.si_signo) e->data = sigpwr_info; - + ecore_event_add(ECORE_EVENT_SIGNAL_POWER, e, NULL, NULL); } sigpwr_count--; @@ -347,17 +347,17 @@ while (sigrt_count[i] > 0) { Ecore_Event_Signal_Realtime *e; - + if ((e = _ecore_event_signal_realtime_new())) { e->num = i; - + if (sigrt_info[i].si_signo) e->data = sigrt_info[i]; - + ecore_event_add(ECORE_EVENT_SIGNAL_REALTIME, e, NULL, NULL); } - + sigrt_count[i]--; sig_count--; } @@ -373,7 +373,7 @@ sa.sa_sigaction = func; sa.sa_flags = SA_RESTART | SA_SIGINFO; sigemptyset(&sa.sa_mask); - sigaction(sig, &sa, NULL); + sigaction(sig, &sa, NULL); } static void @@ -388,7 +388,7 @@ sigchld_info = *si; else sigchld_info.si_signo = 0; - + sigchld_count++; sig_count++; } @@ -400,7 +400,7 @@ sigusr1_info = *si; else sigusr1_info.si_signo = 0; - + sigusr1_count++; sig_count++; } @@ -412,7 +412,7 @@ sigusr2_info = *si; else sigusr2_info.si_signo = 0; - + sigusr2_count++; sig_count++; } @@ -424,7 +424,7 @@ sighup_info = *si; else sighup_info.si_signo = 0; - + sighup_count++; sig_count++; } @@ -473,7 +473,7 @@ sigpwr_info = *si; else sigpwr_info.si_signo = 0; - + sigpwr_count++; sig_count++; } @@ -487,7 +487,7 @@ sigrt_info[sig - SIGRTMIN] = *si; else sigrt_info[sig - SIGRTMIN].si_signo = 0; - + sigrt_count[sig - SIGRTMIN]++; sig_count++; } @@ -497,12 +497,12 @@ _ecore_signal_exe_exit_delay(void *data) { Ecore_Exe_Event_Del *e; - + e = data; if (e) { e->exe->doomsday_clock = NULL; - _ecore_event_add(ECORE_EXE_EVENT_DEL, e, + _ecore_event_add(ECORE_EXE_EVENT_DEL, e, _ecore_exe_event_del_free, NULL); } return 0; =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_time.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ecore_time.c 6 Jan 2006 17:58:12 -0000 1.7 +++ ecore_time.c 26 Aug 2007 11:17:21 -0000 1.8 @@ -1,31 +1,9 @@ -#include <sys/time.h> -#ifdef WIN32 -#include <sys/timeb.h> -#endif -#include "ecore_private.h" -#include "Ecore.h" - -#ifndef HAVE_GETTIMEOFDAY -#ifdef WIN32 - -static int -gettimeofday(struct timeval *tv, void *unused) -{ - struct _timeb t; - - if (!tv) return -1; - - _ftime (&t); - - tv->tv_sec = t.time; - tv->tv_usec = t.millitm * 1000; - - return 0; -} +#ifdef _WIN32 +# include <windows.h> #else -# error "Your platform isn't supported yet" -#endif +# include <sys/time.h> #endif +#include "Ecore.h" /** * Retrieves the current system time as a floating point value in seconds. @@ -35,8 +13,16 @@ EAPI double ecore_time_get(void) { +#ifdef _WIN32 + return (double)GetTickCount() / 1000.0; +#else +# ifdef HAVE_GETTIMEOFDAY struct timeval timev; gettimeofday(&timev, NULL); return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); +# else +# error "Your platform isn't supported yet" +# endif +#endif /* _WIN32 */ } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs