+#define MASK_SIGNAL() \
+{ \
+ void (*old_handler)(int); \
+ \
+ old_handler = signal(SIGPIPE, SIG_IGN);
+
+#define UNMASK_SIGNAL() \
+ signal(SIGPIPE, old_handler); \
+}
+
+
+#ifndef __GSOCKET_STANDALONE__
+# include "wx/unix/gsockunx.h"
+# include "wx/gsocket.h"
+#else
+# include "gsockunx.h"
+# include "gsocket.h"
+#endif /* __GSOCKET_STANDALONE__ */
+
+/* debugging helpers */
+#ifdef __GSOCKET_DEBUG__
+# define GSocket_Debug(args) printf args
+#else
+# define GSocket_Debug(args)
+#endif /* __GSOCKET_DEBUG__ */
+
+/* Table of GUI-related functions. We must call them indirectly because
+ * of wxBase and GUI separation: */
+
+static struct GSocketGUIFunctionsTable *gs_gui_functions;
+
+#define USE_GUI() (gs_gui_functions != NULL)
+
+/* Define macros to simplify indirection: */
+#define _GSocket_GUI_Init() \
+ if (gs_gui_functions) gs_gui_functions->GUI_Init()
+#define _GSocket_GUI_Cleanup() \
+ if (gs_gui_functions) gs_gui_functions->GUI_Cleanup()
+#define _GSocket_GUI_Init_Socket(socket) \
+ (gs_gui_functions ? gs_gui_functions->GUI_Init_Socket(socket) : 1)
+#define _GSocket_GUI_Destroy_Socket(socket) \
+ if (gs_gui_functions) gs_gui_functions->GUI_Destroy_Socket(socket)
+#define _GSocket_Enable_Events(socket) \
+ if (gs_gui_functions) gs_gui_functions->Enable_Events(socket)
+#define _GSocket_Disable_Events(socket) \
+ if (gs_gui_functions) gs_gui_functions->Disable_Events(socket)
+#define _GSocket_Install_Callback(socket, event) \
+ if (gs_gui_functions) gs_gui_functions->Install_Callback(socket, event)
+#define _GSocket_Uninstall_Callback(socket, event) \
+ if (gs_gui_functions) gs_gui_functions->Uninstall_Callback(socket, event)
+
+static struct GSocketBaseFunctionsTable gs_base_functions =
+{
+ _GSocket_Detected_Read,
+ _GSocket_Detected_Write
+};
+