Usermode/libaxwin4 - Handle demarshal failure
[tpg/acess2.git] / Usermode / Applications / axwin3_src / libaxwin3.so_src / main.c
1 /*
2  * AxWin3 Interface Library
3  * - By John Hodge (thePowersGang)
4  *
5  * main.c
6  * - Entrypoint and setup
7  */
8 #include <axwin3/axwin.h>
9 #include "include/internal.h"
10 #include "include/ipc.h"
11 #include <stdlib.h>
12
13 // === GLOBALS ===
14 int     giAxWin3_MainLoopExit;
15
16 // === CODE ===
17 int SoMain(void *Base, int argc, const char *argv[], const char **envp)
18 {
19         // TODO: Parse the environment for the AXWIN3_SERVER variable
20         //gsAxWin3_int_ServerDesc = getenv("AXWIN3_SERVER");
21         gsAxWin3_int_ServerDesc = "pipe:/Devices/ipcpipe/axwin";
22         return 0;
23 }
24
25 int AxWin3_MainLoop(void)
26 {
27         tAxWin_IPCMessage       *msg;
28
29         giAxWin3_MainLoopExit = 0;      
30
31         while(!giAxWin3_MainLoopExit)
32         {
33                 msg = AxWin3_int_GetIPCMessage(0, NULL);
34                 if(!msg)        continue;       
35
36                 _SysDebug("AxWin3_MainLoop - Message (Type=%i, Window=%i, Len=%i)",
37                         msg->ID, msg->Window, msg->Size);
38
39                 AxWin3_int_HandleMessage( msg );
40         }
41         return giAxWin3_MainLoopExit;
42 }
43
44 void AxWin3_StopMainLoop(int Reason)
45 {
46         giAxWin3_MainLoopExit = Reason;
47 }
48
49 void AxWin3_MessageSelect(int nFD, fd_set *FDs)
50 {
51         tAxWin_IPCMessage *msg;
52         msg = AxWin3_int_GetIPCMessage(nFD, FDs);
53         if( msg )
54                 AxWin3_int_HandleMessage( msg );
55 }
56

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