#include "include/ipc.h"
#include <stdlib.h>
+// === GLOBALS ===
+int giAxWin3_MainLoopExit;
+
// === CODE ===
int SoMain(void *Base, int argc, const char *argv[], const char **envp)
{
// TODO: Parse the environment for the AXWIN3_SERVER variable
- gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
+ //gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
+ gsAxWin3_int_ServerDesc = "pipe:/Devices/ipcpipe/axwin";
return 0;
}
-void AxWin3_MainLoop(void)
+int AxWin3_MainLoop(void)
{
tAxWin_IPCMessage *msg;
- int bExit = 0;
- while(!bExit)
+ giAxWin3_MainLoopExit = 0;
+
+ while(!giAxWin3_MainLoopExit)
{
- msg = AxWin3_int_GetIPCMessage();
+ msg = AxWin3_int_GetIPCMessage(0, NULL);
if(!msg) continue;
- // TODO: Handle message
- _SysDebug("oh look, a message (Type=%i, Window=%i, Len=%i)",
+ _SysDebug("AxWin3_MainLoop - Message (Type=%i, Window=%i, Len=%i)",
msg->ID, msg->Window, msg->Size);
AxWin3_int_HandleMessage( msg );
-
- free(msg);
}
+ return giAxWin3_MainLoopExit;
+}
+
+void AxWin3_StopMainLoop(int Reason)
+{
+ giAxWin3_MainLoopExit = Reason;
+}
+
+void AxWin3_MessageSelect(int nFD, fd_set *FDs)
+{
+ tAxWin_IPCMessage *msg;
+ msg = AxWin3_int_GetIPCMessage(nFD, FDs);
+ if( msg )
+ AxWin3_int_HandleMessage( msg );
}