mingw portability

SVN revision: 11926
This commit is contained in:
tsauerbeck 2004-10-20 17:51:29 +00:00 committed by tsauerbeck
parent 7fac198907
commit f83c81433d
17 changed files with 135 additions and 6 deletions

View File

@ -92,6 +92,18 @@ if test "x$GCC" = "xyes"; then
fi
changequote([,])dnl
AC_CHECK_FUNCS(gettimeofday)
AC_CHECK_HEADERS(netinet/in.h)
case "$host_os" in
mingw|mingw32)
winsock_libs="-lwsock32"
;;
esac
AC_SUBST(winsock_libs)
AC_MSG_CHECKING(whether ecore_txt module is to be built)
iconv_cflags=""

View File

@ -29,7 +29,6 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
@ -80,7 +79,9 @@ extern "C" {
};
typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
#ifndef WIN32
typedef void Ecore_Exe; /**< A handle for spawned processes */
#endif
typedef void Ecore_Timer; /**< A handle for timers */
typedef void Ecore_Idler; /**< A handle for idlers */
typedef void Ecore_Idle_Enterer; /**< A handle for idle enterers */
@ -98,6 +99,7 @@ extern "C" {
typedef struct _Ecore_Event_Signal_Power Ecore_Event_Signal_Power; /**< Power signal event */
typedef struct _Ecore_Event_Signal_Realtime Ecore_Event_Signal_Realtime; /**< Realtime signal event */
#ifndef WIN32
struct _Ecore_Event_Exe_Exit /** Process exit event */
{
pid_t pid; /**< The process ID of the process that exited */
@ -109,18 +111,25 @@ extern "C" {
void *ext_data; /**< Extension data - not used */
siginfo_t data; /**< Signal info */
};
#endif
struct _Ecore_Event_Signal_User /** User signal event */
{
int number; /**< The signal number. Either 1 or 2 */
void *ext_data; /**< Extension data - not used */
#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
siginfo_t data; /**< Signal info */
#endif
};
struct _Ecore_Event_Signal_Exit /** Exit request event */
@ -129,19 +138,28 @@ extern "C" {
int quit : 1; /**< set if the exit request was a quit signal */
int terminate : 1; /**< Set if the exit request was a terminate singal */
void *ext_data; /**< Extension data - not used */
#ifndef WIN32
siginfo_t data; /**< Signal info */
#endif
};
struct _Ecore_Event_Signal_Power /** Power event */
{
void *ext_data; /**< Extension data - not used */
#ifndef WIN32
siginfo_t data; /**< Signal info */
#endif
};
struct _Ecore_Event_Signal_Realtime /** Realtime event */
{
int num; /**< The realtime signal's number */
#ifndef WIN32
siginfo_t data; /**< Signal info */
#endif
};
int ecore_init(void);
@ -162,7 +180,7 @@ extern "C" {
void *ecore_event_current_event_get(void);
#ifndef WIN32
Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
void *ecore_exe_free(Ecore_Exe *exe);
pid_t ecore_exe_pid_get(Ecore_Exe *exe);
@ -173,6 +191,7 @@ extern "C" {
void ecore_exe_kill(Ecore_Exe *exe);
void ecore_exe_signal(Ecore_Exe *exe, int num);
void ecore_exe_hup(Ecore_Exe *exe);
#endif
Ecore_Idler *ecore_idler_add(int (*func) (void *data), const void *data);
void *ecore_idler_del(Ecore_Idler *idler);

View File

@ -30,5 +30,5 @@ ecore_tree.c \
ecore_value.c \
ecore_private.h
libecore_la_LIBADD = -lm @dlopen_libs@
libecore_la_LIBADD = -lm @dlopen_libs@ @winsock_libs@
libecore_la_LDFLAGS = -version-info 1:0:0

View File

@ -4,7 +4,9 @@
static const char *_ecore_magic_string_get(Ecore_Magic m);
static int _ecore_init_count = 0;
#ifndef WIN32
int _ecore_fps_debug = 0;
#endif
/**
* Set up connections, signal handlers, sockets etc.
@ -33,9 +35,11 @@ ecore_init(void)
{
if (++_ecore_init_count == 1)
{
#ifndef WIN32
if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
if (_ecore_fps_debug) _ecore_fps_debug_init();
_ecore_signal_init();
#endif
}
return _ecore_init_count;
@ -57,16 +61,22 @@ ecore_shutdown(void)
if (--_ecore_init_count)
return _ecore_init_count;
#ifndef WIN32
if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
#endif
_ecore_animator_shutdown();
#ifndef WIN32
_ecore_exe_shutdown();
#endif
_ecore_idle_enterer_shutdown();
_ecore_idle_exiter_shutdown();
_ecore_idler_shutdown();
_ecore_timer_shutdown();
_ecore_event_shutdown();
_ecore_main_shutdown();
#ifndef WIN32
_ecore_signal_shutdown();
#endif
return _ecore_init_count;
}
@ -134,6 +144,7 @@ _ecore_magic_string_get(Ecore_Magic m)
return "<UNKNOWN>";
}
#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... */
@ -207,3 +218,4 @@ _ecore_fps_debug_runtime_add(double t)
*(_ecore_fps_runtime_mmap) += tm;
}
}
#endif

View File

@ -417,6 +417,7 @@ _ecore_event_call(void)
event_handlers_delete_me = 0;
}
#ifndef WIN32
void *
_ecore_event_exe_exit_new(void)
{
@ -435,6 +436,7 @@ _ecore_event_exe_exit_free(void *data, void *ev)
if (e->exe) _ecore_exe_free(e->exe);
free(e);
}
#endif
void *
_ecore_event_signal_user_new(void)

View File

@ -5,6 +5,7 @@
#include <signal.h>
#include <unistd.h>
#ifndef WIN32
static Ecore_Exe *exes = NULL;
/**
@ -259,3 +260,4 @@ _ecore_exe_free(Ecore_Exe *exe)
free(exe);
return data;
}
#endif

View File

@ -1,6 +1,10 @@
#include "ecore_private.h"
#include "Ecore.h"
#ifdef WIN32
#include <winsock.h>
#endif
#define FIX_HZ 1
#include <sys/time.h>
@ -304,7 +308,9 @@ _ecore_main_select(double timeout)
if (fdh->fd > max_fd) max_fd = fdh->fd;
}
}
#ifndef WIN32
if (_ecore_signal_count_get()) return -1;
#endif
ret = select(max_fd + 1, &rfds, &wfds, &exfds, t);
if (ret < 0)
{
@ -429,8 +435,10 @@ _ecore_main_loop_iterate_internal(int once_only)
}
/* any timers re-added as a result of these are allowed to go */
_ecore_timer_enable_new();
#ifndef WIN32
/* process signals into events .... */
while (_ecore_signal_count_get()) _ecore_signal_call();
#endif
if (_ecore_event_exist())
{
int ret;
@ -451,7 +459,9 @@ _ecore_main_loop_iterate_internal(int once_only)
ret = _ecore_main_select(0);
if (ret > 0) have_event = 1;
#ifndef WIN32
if (_ecore_signal_count_get() > 0) have_signal = 1;
#endif
if (have_signal || have_event)
goto process_events;
@ -476,12 +486,14 @@ _ecore_main_loop_iterate_internal(int once_only)
return;
}
#ifndef WIN32
if (_ecore_fps_debug)
{
t2 = ecore_time_get();
if ((t1 > 0.0) && (t2 > 0.0))
_ecore_fps_debug_runtime_add(t2 - t1);
}
#endif
start_loop:
if (do_quit)
{
@ -501,7 +513,9 @@ _ecore_main_loop_iterate_internal(int once_only)
ret = _ecore_main_select(-1);
if (ret > 0) have_event = 1;
#ifndef WIN32
if (_ecore_signal_count_get() > 0) have_signal = 1;
#endif
}
/* idlers */
else
@ -514,7 +528,9 @@ _ecore_main_loop_iterate_internal(int once_only)
if (_ecore_event_exist()) break;
ret = _ecore_main_select(0);
if (ret > 0) have_event = 1;
#ifndef WIN32
if (_ecore_signal_count_get() > 0) have_signal = 1;
#endif
if (have_event || have_signal) break;
next_time = _ecore_timer_next_get();
if (next_time >= 0) goto start_loop;
@ -532,7 +548,9 @@ _ecore_main_loop_iterate_internal(int once_only)
ret = _ecore_main_select(next_time);
if (ret > 0) have_event = 1;
#ifndef WIN32
if (_ecore_signal_count_get() > 0) have_signal = 1;
#endif
}
/* idlers */
else
@ -546,7 +564,9 @@ _ecore_main_loop_iterate_internal(int once_only)
if (_ecore_event_exist()) break;
ret = _ecore_main_select(0);
if (ret > 0) have_event = 1;
#ifndef WIN32
if (_ecore_signal_count_get() > 0) have_signal = 1;
#endif
if ((have_event) || (have_signal)) break;
cur_time = ecore_time_get();
t = ecore_time_get() - cur_time;
@ -557,10 +577,12 @@ _ecore_main_loop_iterate_internal(int once_only)
}
}
}
#ifndef WIN32
if (_ecore_fps_debug)
{
t1 = ecore_time_get();
}
#endif
/* we came out of our "wait state" so idle has exited */
if (!once_only)
_ecore_idle_exiter_call();
@ -571,8 +593,10 @@ _ecore_main_loop_iterate_internal(int once_only)
if (have_event) _ecore_main_fd_handlers_call();
do
{
#ifndef WIN32
/* process signals into events .... */
while (_ecore_signal_count_get()) _ecore_signal_call();
#endif
/* handle events ... */
_ecore_event_call();

View File

@ -1,5 +1,8 @@
#include <Ecore.h>
#ifndef WIN32
#include <dlfcn.h>
static Ecore_List *loaded_plugins = NULL;
/**
@ -103,3 +106,4 @@ ecore_plugin_call(Ecore_Plugin * plugin, char *symbol_name)
return ret;
}
#endif

View File

@ -9,8 +9,14 @@
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#ifndef WIN32
#include <sys/mman.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define ECORE_MAGIC_NONE 0x1234fedc
#define ECORE_MAGIC_EXE 0xf7e812f5
@ -49,7 +55,9 @@ enum _Ecore_Fd_Handler_Flags
};
typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
#ifndef WIN32
typedef struct _Ecore_Exe Ecore_Exe;
#endif
typedef struct _Ecore_Timer Ecore_Timer;
typedef struct _Ecore_Idler Ecore_Idler;
typedef struct _Ecore_Idle_Enterer Ecore_Idle_Enterer;
@ -60,6 +68,7 @@ typedef struct _Ecore_Event_Filter Ecore_Event_Filter;
typedef struct _Ecore_Event Ecore_Event;
typedef struct _Ecore_Animator Ecore_Animator;
#ifndef WIN32
struct _Ecore_Exe
{
Ecore_Oldlist __list_data;
@ -67,6 +76,7 @@ struct _Ecore_Exe
pid_t pid;
void *data;
};
#endif
struct _Ecore_Timer
{
@ -193,8 +203,10 @@ Ecore_Event *_ecore_event_add(int type, void *ev, void (*func_free) (void *data
void *_ecore_event_del(Ecore_Event *event);
void _ecore_event_call(void);
#ifndef WIN32
void *_ecore_event_exe_exit_new(void);
void _ecore_event_exe_exit_free(void *data, void *ev);
#endif
void *_ecore_event_signal_user_new(void);
void *_ecore_event_signal_hup_new(void);
void *_ecore_event_signal_exit_new(void);
@ -208,9 +220,11 @@ void _ecore_signal_init(void);
int _ecore_signal_count_get(void);
void _ecore_signal_call(void);
#ifndef WIN32
void _ecore_exe_shutdown(void);
Ecore_Exe *_ecore_exe_find(pid_t pid);
void *_ecore_exe_free(Ecore_Exe *exe);
#endif
void _ecore_animator_shutdown(void);

View File

@ -1,6 +1,8 @@
#include "ecore_private.h"
#include "Ecore.h"
#ifndef WIN32
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
@ -445,3 +447,4 @@ _ecore_signal_callback_sigrt(int sig, siginfo_t *si, void *foo)
sig_count++;
}
#endif
#endif

View File

@ -3,6 +3,29 @@
#include <sys/time.h>
#ifndef HAVE_GETTIMEOFDAY
#ifdef WIN32
#include <sys/timeb.h>
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;
}
#else
#error "Your platform isn't supported yet"
#endif
#endif
/**
* Retrieves the current system time as a floating point value in seconds.
* @return The number of seconds since 12.00AM 1st January 1970.

View File

@ -22,7 +22,7 @@ ecore_con_private.h
libecore_con_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
@SSL_LIBS@
@SSL_LIBS@ @winsock_libs@
libecore_con_la_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la

View File

@ -8,7 +8,12 @@
#include "ecore_con_private.h"
#include "Ecore_Con.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#elif WIN32
#include <winsock.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <arpa/inet.h>

View File

@ -1476,6 +1476,7 @@ ecore_evas_sticky_get(Ecore_Evas *ee)
return ee->prop.sticky ? 1:0;
}
#ifndef WIN32
/* fps debug calls - for debugging how much time your app actually spends */
/* rendering graphics... :) */
@ -1548,3 +1549,4 @@ _ecore_evas_fps_debug_rendertime_add(double t)
*(_ecore_evas_fps_rendertime_mmap) += tm;
}
}
#endif

View File

@ -4,7 +4,10 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef WIN32
#include <sys/mman.h>
#endif
#include <Evas.h>

View File

@ -26,7 +26,7 @@ ecore_ipc_private.h
libecore_ipc_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la \
@SSL_LIBS@
@SSL_LIBS@ @winsock_libs@
libecore_ipc_la_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \

View File

@ -5,7 +5,11 @@
#include "ecore_ipc_private.h"
#include "Ecore_Ipc.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#elif WIN32
#include <winsock.h>
#endif
#define DLT_ZERO 0
#define DLT_ONE 1