* -------------------------------------------------------------------------
*/
+/*
+ * TODO: for WinCE we need to replace WSAAsyncSelect
+ * (Windows message-based notification of network events for a socket)
+ * with another mechanism.
+ * We may need to have a separate thread that polls for socket events
+ * using select() and sends a message to the main thread.
+ */
+
/*
* PLEASE don't put C++ comments here - this is a C source file.
*/
# pragma warning(disable:4115) /* named type definition in parentheses */
#endif
+/* This needs to be before the wx/defs/h inclusion
+ * for some reason
+ */
+
+#ifdef __WXWINCE__
+#include <windows.h>
+#endif
+
#ifndef __GSOCKET_STANDALONE__
#include "wx/defs.h"
#include "wx/setup.h"
#include "wx/msw/gsockmsw.h"
#include "wx/gsocket.h"
+HINSTANCE wxGetInstance(void);
#define INSTANCE wxGetInstance()
#else
#endif /* __GSOCKET_STANDALONE__ */
+#ifndef __WXWINCE__
#include <assert.h>
+#else
+#define assert(x)
+#include <winsock.h>
+#include "wx/msw/wince/net.h"
+#endif
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
# pragma warning(default:4115) /* named type definition in parentheses */
#endif
-#define CLASSNAME "_GSocket_Internal_Window_Class"
-#define WINDOWNAME "_GSocket_Internal_Window_Name"
+#define CLASSNAME TEXT("_GSocket_Internal_Window_Class")
+#define WINDOWNAME TEXT("_GSocket_Internal_Window_Name")
/* Maximum number of different GSocket objects at a given time.
* This value can be modified at will, but it CANNOT be greater
/* Global initializers */
-int GSocket_Init(void)
+int _GSocket_GUI_Init(void)
{
- WSADATA wsaData;
WNDCLASS winClass;
int i;
}
firstAvailable = 0;
- /* Initialize WinSocket */
- return (WSAStartup((1 << 8) | 1, &wsaData) == 0);
+ return 1;
}
-void GSocket_Cleanup(void)
+void _GSocket_GUI_Cleanup(void)
{
/* Destroy internal window */
DestroyWindow(hWin);
/* Delete critical section */
DeleteCriticalSection(&critical);
-
- /* Cleanup WinSocket */
- WSACleanup();
}
/* Per-socket GUI initialization / cleanup */
-int _GSocket_GUI_Init(GSocket *socket)
+int _GSocket_GUI_Init_Socket(GSocket *socket)
{
int i;
return TRUE;
}
-void _GSocket_GUI_Destroy(GSocket *socket)
+void _GSocket_GUI_Destroy_Socket(GSocket *socket)
{
/* Remove the socket from the list */
EnterCriticalSection(&critical);
{
EnterCriticalSection(&critical);
socket = socketList[(uMsg - WM_USER)];
- event = -1;
+ event = (GSocketEvent) -1;
cback = NULL;
data = NULL;