summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfcolin2004-03-12 09:37:05 +0000
committerfcolin2004-03-12 09:37:05 +0000
commitb64640f991932bda111e97dd1eb28553e5202b9e (patch)
tree1960b7e4e064014c3e259cebe61a2c72820f5cc3 /src
parentd552172d149566e974bccf75dff2bc15bad69602 (diff)
downloadivy-c-b64640f991932bda111e97dd1eb28553e5202b9e.zip
ivy-c-b64640f991932bda111e97dd1eb28553e5202b9e.tar.gz
ivy-c-b64640f991932bda111e97dd1eb28553e5202b9e.tar.bz2
ivy-c-b64640f991932bda111e97dd1eb28553e5202b9e.tar.xz
compile avec MINGW sous WIN32
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Test.tcl2
-rw-r--r--src/ivyloop.c1
-rw-r--r--src/ivyprobe.c7
-rw-r--r--src/ivysocket.c3
-rwxr-xr-xsrc/ivytcl.c41
5 files changed, 40 insertions, 14 deletions
diff --git a/src/Test.tcl b/src/Test.tcl
index aad5cd4..052b3bb 100755
--- a/src/Test.tcl
+++ b/src/Test.tcl
@@ -9,7 +9,7 @@ proc msgCB {str} {
puts "TCL:Message:$str"
}
Ivy::init TESTTCL "TESTTCL Ready" conCB discCB
-Ivy::start 143.196.53.255:2011
+Ivy::start ""
Ivy::bind "(.*)" msgCB
Ivy::applist
Ivy::send test
diff --git a/src/ivyloop.c b/src/ivyloop.c
index 2ba0608..c3022ab 100644
--- a/src/ivyloop.c
+++ b/src/ivyloop.c
@@ -179,6 +179,7 @@ void IvyMainLoop(void(*hook)(void))
exset = open_fds;
ready = select(64, &rdset, 0, &exset, TimerGetSmallestTimeout());
if (ready < 0 && (errno != EINTR)) {
+ fprintf (stderr, "select error %d\n",errno);
perror("select");
return;
}
diff --git a/src/ivyprobe.c b/src/ivyprobe.c
index 99cb5cc..a5a477b 100644
--- a/src/ivyprobe.c
+++ b/src/ivyprobe.c
@@ -33,6 +33,10 @@
#include <string.h>
#ifdef WIN32
#include <windows.h>
+#ifdef __MINGW32__
+#include <regex.h>
+#include <getopt.h>
+#endif
#else
#include <sys/time.h>
#include <unistd.h>
@@ -309,8 +313,11 @@ int main(int argc, char *argv[])
IvyGlutChannelSetUp (0, NULL, NULL, HandleStdin);
#endif
#ifdef IVYMAINLOOP
+#ifndef WIN32
+/* Stdin not compatible with select , select only accept socket */
IvyChannelSetUp (0, NULL, NULL, HandleStdin);
#endif
+#endif
IvyStart (bus);
diff --git a/src/ivysocket.c b/src/ivysocket.c
index 409a66f..234f4c9 100644
--- a/src/ivysocket.c
+++ b/src/ivysocket.c
@@ -214,6 +214,9 @@ Server SocketServer(unsigned short port,
if (setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(char*)&one,sizeof(one)) < 0)
{
+#ifdef WIN32
+ fprintf(stderr," setsockopt %d\n",WSAGetLastError());
+#endif
perror ("*** set socket option SO_REUSEADDR ***");
exit(0);
}
diff --git a/src/ivytcl.c b/src/ivytcl.c
index bdb2a55..68f02f4 100755
--- a/src/ivytcl.c
+++ b/src/ivytcl.c
@@ -31,7 +31,8 @@
struct _channel {
HANDLE fd;
void *data;
- ChannelHandleDelete handle_delete;
+ Tcl_Channel tcl_channel;
+ ChannelHandleDelete handle_delete;
ChannelHandleRead handle_read;
};
@@ -43,28 +44,30 @@ ChannelInit channel_init = IvyTclChannelInit;
ChannelSetUp channel_setup = IvyTclChannelSetUp;
ChannelClose channel_close = IvyTclChannelClose;
+#ifdef WIN32
+WSADATA WsaData;
+#endif
+
void IvyTclChannelInit(void)
{
-
+#ifdef WIN32
+ int error;
+#endif
if ( channel_initialized ) return;
/* pour eviter les plantages quand les autres applis font core-dump */
#ifndef WIN32
signal( SIGPIPE, SIG_IGN);
#endif
+#ifdef WIN32
+ error = WSAStartup (0x0101, &WsaData);
+ if (error == SOCKET_ERROR) {
+ printf ("WSAStartup failed.\n");
+ }
+#endif
channel_initialized = 1;
}
-
-void IvyTclChannelClose( Channel channel )
-{
-
- if ( channel->handle_delete )
- (*channel->handle_delete)( channel->data );
- Tcl_DeleteFileHandler(channel->fd);
- ckfree((char *) channel);
-}
-
static void
IvyHandleFd(ClientData cd,
int mask)
@@ -79,6 +82,17 @@ IvyHandleFd(ClientData cd,
(*channel->handle_delete)(channel->data);
}
}
+
+void IvyTclChannelClose( Channel channel )
+{
+
+ if ( channel->handle_delete )
+ (*channel->handle_delete)( channel->data );
+ Tcl_DeleteChannelHandler(channel->tcl_channel, IvyHandleFd, (ClientData) channel);
+ ckfree((char *) channel);
+}
+
+
Channel IvyTclChannelSetUp(HANDLE fd, void *data,
ChannelHandleDelete handle_delete,
ChannelHandleRead handle_read
@@ -99,7 +113,8 @@ Channel IvyTclChannelSetUp(HANDLE fd, void *data,
channel->fd = fd;
/*printf("Create handle fd %d\n", fd);*/
- Tcl_CreateFileHandler(fd, TCL_READABLE|TCL_EXCEPTION, IvyHandleFd, (ClientData) channel);
+ channel->tcl_channel = Tcl_MakeTcpClientChannel((void*)fd);
+ Tcl_CreateChannelHandler(channel->tcl_channel, TCL_READABLE|TCL_EXCEPTION, IvyHandleFd, (ClientData) channel);
return channel;
}