Usermode/libaxwin4 - Handle demarshal failure
[tpg/acess2.git] / Usermode / Applications / axwin3_src / libaxwin3.so_src / main.c
index d8f6a61..ab764d2 100644 (file)
 #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;       
 
-               _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 );
 }
 

UCC git Repository :: git.ucc.asn.au