Enlightenment CVS committal Author : doursse Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore Modified Files: ecore_main.c ecore_path.c ecore_plugin.c ecore_time.c Log Message: * port ecore_plugin to windows * add comments after some #endif * speed up the compilation on windows * remove some trailing spaces in ecore_path.c =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_main.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ecore_main.c 26 Aug 2007 11:17:20 -0000 1.27 +++ ecore_main.c 30 Sep 2007 15:24:51 -0000 1.28 @@ -1,6 +1,10 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + #ifdef _WIN32 -#include <windows.h> -#endif +# include <winsock2.h> +#endif /* _WIN32 */ #include <math.h> #include <sys/time.h> @@ -11,10 +15,10 @@ #define FIX_HZ 1 #ifdef FIX_HZ -#include <sys/param.h> -#ifndef HZ -#define HZ 100 -#endif +# include <sys/param.h> +# ifndef HZ +# define HZ 100 +# endif #endif #include "ecore_private.h" @@ -344,7 +348,7 @@ } #ifndef _WIN32 if (_ecore_signal_count_get()) return -1; -#endif +#endif /* _WIN32 */ ret = select(max_fd + 1, &rfds, &wfds, &exfds, t); if (ret < 0) { @@ -456,7 +460,7 @@ { #ifdef _WIN32 MSG msg; -#endif +#endif /* _WIN32 */ double next_time; int have_event = 0; int have_signal; @@ -475,7 +479,7 @@ #ifndef _WIN32 /* process signals into events .... */ while (_ecore_signal_count_get()) _ecore_signal_call(); -#endif +#endif /* _WIN32 */ if (_ecore_event_exist()) { int ret; @@ -498,7 +502,7 @@ if (ret > 0) have_event = 1; #ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; -#endif +#endif /* _WIN32 */ if (have_signal || have_event) goto process_events; @@ -530,7 +534,7 @@ if ((t1 > 0.0) && (t2 > 0.0)) _ecore_fps_debug_runtime_add(t2 - t1); } -#endif +#endif /* _WIN32 */ start_loop: if (do_quit) { @@ -554,7 +558,7 @@ if (ret > 0) have_event = 1; #ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; -#endif +#endif /* _WIN32 */ } /* idlers */ else @@ -569,7 +573,7 @@ if (ret > 0) have_event = 1; #ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; -#endif +#endif /* _WIN32 */ if (have_event || have_signal) break; next_time = _ecore_timer_next_get(); if (next_time >= 0) goto start_loop; @@ -589,7 +593,7 @@ if (ret > 0) have_event = 1; #ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; -#endif +#endif /* _WIN32 */ } /* idlers */ else @@ -605,7 +609,7 @@ if (ret > 0) have_event = 1; #ifndef _WIN32 if (_ecore_signal_count_get() > 0) have_signal = 1; -#endif +#endif /* _WIN32 */ if ((have_event) || (have_signal)) break; cur_time = ecore_time_get(); t = ecore_time_get() - cur_time; @@ -622,7 +626,7 @@ { t1 = ecore_time_get(); } -#endif +#endif /* _WIN32 */ /* we came out of our "wait state" so idle has exited */ if (!once_only) _ecore_idle_exiter_call(); @@ -636,7 +640,7 @@ #ifndef _WIN32 /* process signals into events .... */ while (_ecore_signal_count_get()) _ecore_signal_call(); -#endif +#endif /* _WIN32 */ /* handle events ... */ _ecore_event_call(); @@ -649,7 +653,7 @@ TranslateMessage(&msg); DispatchMessage(&msg); } -#endif +#endif /* _WIN32 */ if (once_only) _ecore_idle_enterer_call(); in_main_loop--; } =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- ecore_path.c 28 Sep 2007 15:27:44 -0000 1.19 +++ ecore_path.c 30 Sep 2007 15:24:51 -0000 1.20 @@ -272,7 +272,7 @@ /** * Retrieves a list of all available plugins in the given path. * @param group_id The identifier for the given path. - * @return A pointer to a newly allocated list of all plugins found in the + * @return A pointer to a newly allocated list of all plugins found in the * paths identified by @p group_id. @c NULL otherwise. * @ingroup Ecore_Plugin */ @@ -313,7 +313,7 @@ { char ppath[PATH_MAX]; char *ext; - + if (*d->d_name == '.') continue; @@ -330,7 +330,7 @@ ecore_strlcpy(ppath, d->d_name, sizeof(ppath)); ext = strrchr(ppath, '.'); *ext = '\0'; - + if (!ecore_hash_get(plugins, ppath)) { char *key; =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_plugin.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ecore_plugin.c 4 Sep 2007 18:23:47 -0000 1.14 +++ ecore_plugin.c 30 Sep 2007 15:24:51 -0000 1.15 @@ -1,10 +1,93 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ + #ifndef _WIN32 # include <dlfcn.h> -# include "ecore_private.h" -# include "Ecore_Data.h" +#else +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# undef WIN32_LEAN_AND_MEAN +# include <stdlib.h> +# include <stdio.h> +#endif /* _WIN32 */ + +#include "ecore_private.h" +#include "Ecore_Data.h" + +/* FIXME: that hack is a temporary one. That code will be in MinGW soon */ +#ifdef _WIN32 + +# define RTLD_LAZY 1 /* lazy function call binding */ +# define RTLD_NOW 2 /* immediate function call binding */ +# define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible + to other dlopen'ed objs */ + +static char *dlerr_ptr; +static char dlerr_data[80]; + +void *dlopen (const char *file, int mode) +{ + HMODULE hmodule; + + hmodule = LoadLibrary(file); + if (hmodule == NULL) + { + int error; + + error = GetLastError(); + sprintf(dlerr_data, "LoadLibraryEx returned %d.", error); + dlerr_ptr = dlerr_data; + } + return hmodule; +} + +int dlclose (void *handle) +{ + if (FreeLibrary(handle)) + { + return 0; + } + else + { + int error; + + error = GetLastError(); + sprintf(dlerr_data, "FreeLibrary returned %d.", error); + dlerr_ptr = dlerr_data; + return -1; + } +} + +void *dlsym (void *handle, const char *name) +{ + FARPROC fp; + + fp = GetProcAddress(handle, name); + if (fp == NULL) + { + int error; + + error = GetLastError(); + sprintf(dlerr_data, "GetProcAddress returned %d.", error); + dlerr_ptr = dlerr_data; + } + return fp; +} + +char *dlerror (void) +{ + if (dlerr_ptr != NULL) + { + dlerr_ptr = NULL; + return dlerr_data; + } + else + return NULL; +} + +#endif /* _WIN32 */ + static Ecore_List *loaded_plugins = NULL; @@ -35,19 +118,29 @@ CHECK_PARAM_POINTER_RETURN("plugin_name", plugin_name, NULL); +#ifndef _WIN32 if (!version || *version == '\0') snprintf(temp, sizeof(temp), "%s.so", plugin_name); else snprintf(temp, sizeof(temp), "%s.so.%s", plugin_name, version); +#else + if (!version || *version == '\0') + snprintf(temp, sizeof(temp), "%s.dll", plugin_name); + else + snprintf(temp, sizeof(temp), "%s-%s.dll", plugin_name, version); +#endif /* _WIN32 */ path = ecore_path_group_find(group_id, temp); + +#ifndef _WIN32 if (!path && version) { /* if this file doesn't exist try a different order */ snprintf(temp, sizeof(temp), "%s.%s.so", plugin_name, version); path = ecore_path_group_find(group_id, temp); } - +#endif /* _WIN32 */ + if (!path) return NULL; @@ -134,4 +227,3 @@ return ret; } -#endif =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_time.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ecore_time.c 17 Sep 2007 23:13:59 -0000 1.11 +++ ecore_time.c 30 Sep 2007 15:24:51 -0000 1.12 @@ -1,5 +1,11 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + #ifdef _WIN32 +# define WIN32_LEAN_AND_MEAN # include <windows.h> +# undef WIN32_LEAN_AND_MEAN #else # include <sys/time.h> #endif ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs