--- cvsroot/EV/EV.xs 2007/11/08 00:44:17 1.59 +++ cvsroot/EV/EV.xs 2007/11/12 00:31:08 1.64 @@ -11,13 +11,17 @@ #undef signal #undef sigaction -#define EV_SELECT_USE_WIN32_HANDLES 0 -#define EV_SELECT_USE_FD_SET 0 +#define EV_SELECT_IS_WINSOCKET 0 +#ifdef _WIN32 +# define EV_SELECT_USE_FD_SET 0 +# define NFDBITS PERL_NFDBITS +# define fd_mask Perl_fd_mask +#endif /* due to bugs in OS X we have to use libev/ explicitly here */ #include "libev/ev.c" #include "event.c" -#ifndef WIN32 +#ifndef _WIN32 #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 #if !defined (WIN32) && !defined(__CYGWIN__) # define HAVE_STRUCT_IN6_ADDR 1 @@ -25,10 +29,11 @@ #undef HAVE_STRTOK_R #undef strtok_r #define strtok_r fake_strtok_r +#include "evdns.h" #include "evdns.c" #endif -#ifndef WIN32 +#ifndef _WIN32 # include #endif @@ -102,8 +107,9 @@ w = (struct ev_watcher *)SvPVX (self); - ev_watcher_init (w, e_cb); + ev_init (w, e_cb); + w->data = 0; w->fh = 0; w->cb_sv = newSVsv (cb_sv); w->self = self; @@ -118,6 +124,7 @@ SvREFCNT_dec (w->fh ); w->fh = 0; SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; + SvREFCNT_dec (w->data ); w->data = 0; } static SV * @@ -227,7 +234,7 @@ ///////////////////////////////////////////////////////////////////////////// // DNS -#ifndef WIN32 +#ifndef _WIN32 static void dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) { @@ -375,7 +382,7 @@ sv_setiv (sv, (IV)&evapi); SvREADONLY_on (sv); } -#ifndef WIN32 +#ifndef _WIN32 pthread_atfork (0, 0, ev_default_fork); #endif } @@ -429,7 +436,7 @@ { struct ev_periodic *w; w = e_new (sizeof (struct ev_periodic), cb); - w->fh = SvOK (reschedule_cb) ? newSVsv (reschedule_cb) : 0; + w->fh = SvTRUE (reschedule_cb) ? newSVsv (reschedule_cb) : 0; ev_periodic_set (w, at, interval, w->fh ? e_periodic_cb : 0); RETVAL = e_bless ((struct ev_watcher *)w, stash_periodic); if (!ix) ev_periodic_start (w); @@ -505,6 +512,14 @@ OUTPUT: RETVAL +SV *data (struct ev_watcher *w, SV *new_data = 0) + CODE: +{ + RETVAL = w->data ? newSVsv (w->data) : &PL_sv_undef; +} + OUTPUT: + RETVAL + void trigger (struct ev_watcher *w, int revents = EV_NONE) CODE: w->cb (w, revents); @@ -788,7 +803,7 @@ OUTPUT: RETVAL -#ifndef WIN32 +#ifndef _WIN32 MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ @@ -869,7 +884,7 @@ int evdns_resolv_conf_parse (int flags, const char *filename) -#ifdef MS_WINDOWS +#ifdef _WIN32 int evdns_config_windows_nameservers ()