Usermode/AxWin4 - Starting work on client-side library
authorJohn Hodge <[email protected]>
Sat, 24 May 2014 15:12:50 +0000 (23:12 +0800)
committerJohn Hodge <[email protected]>
Sat, 24 May 2014 15:12:50 +0000 (23:12 +0800)
18 files changed:
Usermode/Applications/axwin4_src/Common/include/ipc_proto.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Common/include/serialisation.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Common/serialisation.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/Makefile
Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp [deleted file]
Usermode/Applications/axwin4_src/Server/include/serialisation.hpp [deleted file]
Usermode/Applications/axwin4_src/Server/serialisation.cpp [deleted file]
Usermode/Libraries/Makefile.cfg
Usermode/Libraries/Makefile.tpl
Usermode/Libraries/libaxwin4.so_src/Makefile [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/include/CIPCChannel_AcessIPCPipe.hpp [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/include/IIPCChannel.hpp [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/include/common.hpp [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/include_exp/axwin4/axwin.h [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/ipc.cpp [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/main.c [new file with mode: 0644]
Usermode/Libraries/libaxwin4.so_src/wm.cpp [new file with mode: 0644]

diff --git a/Usermode/Applications/axwin4_src/Common/include/ipc_proto.hpp b/Usermode/Applications/axwin4_src/Common/include/ipc_proto.hpp
new file mode 100644 (file)
index 0000000..7018a62
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * ipc_proto.hpp
+ * - IPC Protocol Header
+ */
+#ifndef _IPC_PROTO_H_
+#define _IPC_PROTO_H_
+
+namespace AxWin {
+
+enum
+{
+       IPCMSG_NULL,
+       IPCMSG_REPLY,
+       IPCMSG_PING,
+       IPCMSG_GETGLOBAL,
+       IPCMSG_SETGLOBAL,
+
+       IPCMSG_CREATEWIN,
+       IPCMSG_CLOSEWIN,
+       IPCMSG_SETWINATTR,
+       IPCMSG_GETWINATTR,
+       IPCMSG_SENDIPC,
+       IPCMSG_GETWINBUF,       // get a handle to the window's buffer
+       
+       // - Window drawing commands
+       //IPCMSG_DRAWGROUP,     // (u16 win, u16 group_id) - (hint) Switch to this group
+       //IPCMSG_CLEAR, // (u16 win) - (hint) Clear current drawing group
+       IPCMSG_PUSHDATA,        // (u16 win, u16 x, u16 y, u16 w, u16 h, void data)
+       IPCMSG_BLIT,    // (win, sx, sy, dx, dy, w, h) - Blit locally
+       IPCMSG_DRAWCTL, // (win, x, y, w, h, ctlid) - Draw
+       IPCMSG_DRAWTEXT,        // (win, x, y, fontid, text) - Draw text using an internal font
+};
+
+enum eIPC_GlobalAttrs
+{
+       IPC_GLOBATTR_SCREENDIMS,        // Screen dimensions - Readonly
+       IPC_GLOBATTR_MAXAREA,   // Maximum window area for screen (hint only, not enforced)
+};
+
+enum eIPC_WinAttrs
+{
+       IPC_WINATTR_SHOW,       // u8   - Window shown
+       IPC_WINATTR_FLAGS,      // u32  - Decoration enabled, always-on-top
+       IPC_WINATTR_POSITION,   // s16, s16
+       IPC_WINATTR_DIMENSIONS, // u16, u16
+       IPC_WINATTR_TITLE,      // string
+};
+
+};
+
+#endif
+
diff --git a/Usermode/Applications/axwin4_src/Common/include/serialisation.hpp b/Usermode/Applications/axwin4_src/Common/include/serialisation.hpp
new file mode 100644 (file)
index 0000000..32ba465
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * serialisation.hpp
+ * - Generic (de)serialisation code
+ */
+#ifndef _SERIALISATION_H_
+#define _SERIALISATION_H_
+
+#include <cstdint>
+#include <cstddef>
+#include <exception>
+#include <string>
+#include <vector>
+
+namespace AxWin {
+
+class CDeserialiseException:
+       public ::std::exception
+{
+};
+
+class CDeserialiser
+{
+       const size_t    m_length;
+       const uint8_t*  m_data;
+       size_t  m_offset;
+public:
+       CDeserialiser(size_t Length, const uint8_t *Buffer);
+       ::uint8_t       ReadU8();
+       ::uint16_t      ReadU16();
+       ::int16_t       ReadS16();
+       ::std::string   ReadString();
+};
+
+class CSerialiser
+{
+       ::std::vector<uint8_t>  m_data;
+public:
+       CSerialiser();
+       void WriteU8(::uint8_t val);
+       void WriteU16(::uint16_t val);
+       void WriteS16(::int16_t val);
+       void WriteString(const char* val, size_t n);
+       void WriteString(const char* val) {
+               WriteString(val, ::std::char_traits<char>::length(val));
+       }
+       void WriteString(const ::std::string& val) {
+               WriteString(val.data(), val.size());
+       }
+       void WriteSub(const CSerialiser& val);
+};
+
+};
+
+#endif
+
diff --git a/Usermode/Applications/axwin4_src/Common/serialisation.cpp b/Usermode/Applications/axwin4_src/Common/serialisation.cpp
new file mode 100644 (file)
index 0000000..4388eab
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang) 
+ *
+ * serialisation.cpp
+ * - IPC Serialisation
+ */
+#include <serialisation.hpp>
+#include <cstddef>
+
+namespace AxWin {
+
+CDeserialiser::CDeserialiser(size_t Length, const uint8_t *Buffer):
+       m_length(Length),
+       m_data(Buffer),
+       m_offset(0)
+{
+}
+
+::uint8_t CDeserialiser::ReadU8()
+{
+       return 0;
+}
+
+::uint16_t CDeserialiser::ReadU16()
+{
+       return 0;
+}
+
+::int16_t CDeserialiser::ReadS16()
+{
+       return 0;
+}
+
+::std::string CDeserialiser::ReadString()
+{
+       return "";
+}
+
+CSerialiser::CSerialiser()
+{
+}
+
+void CSerialiser::WriteU8(::uint8_t Value)
+{
+       m_data.push_back(Value);
+}
+
+void CSerialiser::WriteU16(::uint16_t Value)
+{
+       m_data.push_back(Value & 0xFF);
+       m_data.push_back(Value >> 8);
+}
+
+void CSerialiser::WriteS16(::int16_t Value)
+{
+       if( Value < 0 )
+       {
+               ::uint16_t rawval = 0x10000 - (::int32_t)Value;
+               WriteU16(rawval);
+       }
+       else
+       {
+               WriteU16(Value);
+       }
+}
+
+void CSerialiser::WriteString(const char* val, size_t n)
+{
+       //if( n >= 256 )
+       //      throw ::std::out_of_range("CSerialiser::WriteString");
+       WriteU8(n);
+       for( size_t i = 0; i < n; i ++ )
+               WriteU8(val[i]);
+}
+
+void CSerialiser::WriteSub(const CSerialiser& val)
+{
+       m_data.reserve( m_data.size() + val.m_data.size() );
+       for( auto byte : val.m_data )
+               m_data.push_back( byte );
+}
+
+};     // namespace AxWin
+
index 2c7a74e..6f88f14 100644 (file)
@@ -1,10 +1,11 @@
 
 include ../../Makefile.cfg
 
-CPPFLAGS += -Iinclude/
+CPPFLAGS += -Iinclude/ -I../Common/include/
 OBJ := main.o ipc.o CConfig.o video.o input.o timing.o
 OBJ += compositor.o CWindow.o
-OBJ += serialisation.o CClient.o
+OBJ += Common__serialisation.o
+OBJ += CClient.o
 OBJ += CIPCChannel_AcessIPCPipe.o
 OBJ += CRect.o CSurface.o
 BIN := AxWinServer
@@ -12,3 +13,9 @@ BIN := AxWinServer
 LDFLAGS += -lc++
 
 include ../../Makefile.tpl
+
+$(_OBJPREFIX)Common__%.o: ../Common/%.cpp
+       @echo [CXX] -o $@
+       @mkdir -p $(dir $@)
+       $V$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ -MQ $@ -MP -MD -MF $(@:%.o=%.dep)
+
diff --git a/Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp b/Usermode/Applications/axwin4_src/Server/include/ipc_proto.hpp
deleted file mode 100644 (file)
index a346424..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Acess2 GUI v4
- * - By John Hodge (thePowersGang) 
- *
- * ipc_proto.hpp
- * - IPC Protocol Header
- */
-#ifndef _IPC_PROTO_H_
-#define _IPC_PROTO_H_
-
-namespace AxWin {
-
-enum
-{
-       IPCMSG_NULL,
-       IPCMSG_REPLY,
-       IPCMSG_PING,
-       IPCMSG_GETGLOBAL,
-       IPCMSG_SETGLOBAL,
-
-       IPCMSG_CREATEWIN,
-       IPCMSG_CLOSEWIN,
-       IPCMSG_SETWINATTR,
-       IPCMSG_GETWINATTR,
-       IPCMSG_SENDIPC,
-       IPCMSG_GETWINBUF,       // get a handle to the window's buffer
-       
-       // - Window drawing commands
-       //IPCMSG_DRAWGROUP,     // (u16 win, u16 group_id) - (hint) Switch to this group
-       //IPCMSG_CLEAR, // (u16 win) - (hint) Clear current drawing group
-       IPCMSG_PUSHDATA,        // (u16 win, u16 x, u16 y, u16 w, u16 h, void data)
-       IPCMSG_BLIT,    // (win, sx, sy, dx, dy, w, h) - Blit locally
-       IPCMSG_DRAWCTL, // (win, x, y, w, h, ctlid) - Draw
-       IPCMSG_DRAWTEXT,        // (win, x, y, fontid, text) - Draw text using an internal font
-};
-
-enum eIPC_GlobalAttrs
-{
-       IPC_GLOBATTR_SCREENDIMS,        // Screen dimensions - Readonly
-       IPC_GLOBATTR_MAXAREA,   // Maximum window area for screen (hint, not enforced)
-};
-
-enum eIPC_WinAttrs
-{
-       IPC_WINATTR_SHOW,
-       IPC_WINATTR_FLAGS,      // Decoration enabled, always-on-top
-       IPC_WINATTR_POSITION,
-       IPC_WINATTR_DIMENSIONS,
-};
-
-};
-
-#endif
-
diff --git a/Usermode/Applications/axwin4_src/Server/include/serialisation.hpp b/Usermode/Applications/axwin4_src/Server/include/serialisation.hpp
deleted file mode 100644 (file)
index ca397b4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Acess2 GUI v4
- * - By John Hodge (thePowersGang) 
- *
- * serialisation.hpp
- * - Generic (de)serialisation code
- */
-#ifndef _SERIALISATION_H_
-#define _SERIALISATION_H_
-
-#include <cstdint>
-#include <cstddef>
-#include <exception>
-#include <string>
-
-namespace AxWin {
-
-class CDeserialiseException:
-       public ::std::exception
-{
-};
-
-class CDeserialiser
-{
-public:
-       CDeserialiser(size_t Length, const void *Buffer);
-       ::uint8_t       ReadU8();
-       ::uint16_t      ReadU16();
-       ::int16_t       ReadS16();
-       ::std::string   ReadString();
-};
-
-class CSerialiser
-{
-public:
-       CSerialiser();
-       void    WriteU8(::uint8_t val);
-       void    WriteU16(::uint16_t val);
-};
-
-};
-
-#endif
-
diff --git a/Usermode/Applications/axwin4_src/Server/serialisation.cpp b/Usermode/Applications/axwin4_src/Server/serialisation.cpp
deleted file mode 100644 (file)
index 7d60587..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Acess2 GUI v4
- * - By John Hodge (thePowersGang) 
- *
- * serialisation.cpp
- * - IPC Serialisation
- */
-#include <serialisation.hpp>
-#include <cstddef>
-
-namespace AxWin {
-
-CDeserialiser::CDeserialiser(size_t Length, const void *Buffer)
-{
-}
-
-::uint8_t CDeserialiser::ReadU8()
-{
-       return 0;
-}
-
-::uint16_t CDeserialiser::ReadU16()
-{
-       return 0;
-}
-
-::int16_t CDeserialiser::ReadS16()
-{
-       return 0;
-}
-
-::std::string CDeserialiser::ReadString()
-{
-       return "";
-}
-
-CSerialiser::CSerialiser()
-{
-}
-
-void CSerialiser::WriteU8(::uint8_t Value)
-{
-}
-
-void CSerialiser::WriteU16(::uint16_t Value)
-{
-}
-
-};     // namespace AxWin
-
index 16f423d..113e65c 100644 (file)
@@ -32,7 +32,7 @@ else
  CXXFLAGS   := -fno-stack-protector -fPIC
  LDFLAGS  := -I/Acess/Libs/ld-acess.so -lld-acess `$(CC) -print-libgcc-file-name`
 endif
-LDFLAGS += -g -nostdlib -shared -eSoMain -x --no-undefined -L$(OUTPUTDIR)Libs/
+LDFLAGS += -g -nostdlib -shared -eSoMain -x --no-undefined -L$(OUTPUTDIR)Libs/ --defsym __dso_handle=SoMain
 CXXFLAGS += -std=gnu++11
 
 -include $(_libsdir)../common_settings.mk
index d04a6ff..27de5f6 100644 (file)
@@ -100,6 +100,11 @@ $(_OBJPREFIX)%.o: %.cc
        @mkdir -p $(dir $@)
        $V$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $< -MMD -MP -MT $@ -MF [email protected]
 
+$(_OBJPREFIX)%.o: %.cpp
+       @echo [CXX] -o $@
+       @mkdir -p $(dir $@)
+       $V$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $< -MMD -MP -MT $@ -MF [email protected]
+
 $(_OBJPREFIX)%.ao: %.$(ASSUFFIX)
        @echo [AS] -o $@
        @mkdir -p $(dir $@)
diff --git a/Usermode/Libraries/libaxwin4.so_src/Makefile b/Usermode/Libraries/libaxwin4.so_src/Makefile
new file mode 100644 (file)
index 0000000..3162667
--- /dev/null
@@ -0,0 +1,28 @@
+# Acess2 AxWin4 Library
+# Makefile
+
+-include ../Makefile.cfg
+
+AXWIN4DIR := ../../Applications/axwin4_src/
+
+CPPFLAGS += -I$(AXWIN4DIR)Common/include/
+CFLAGS   += -Wextra
+CXXFLAGS +=
+ASFLAGS  +=
+LDFLAGS  += -soname libaxwin4.so -Map map.txt -lc -lc++
+
+OBJ  = main.o ipc.o ipc_acessipcpipe.o
+OBJ += wm.o
+OBJ += Common__serialisation.o
+DEPFILES := $(OBJ:%.o=%.d)
+BIN = libaxwin4.so
+
+include ../Makefile.tpl
+
+$(_OBJPREFIX)Common__%.o: $(AXWIN4DIR)/Common/%.cpp
+       @echo [CXX] -o $@
+       @mkdir -p $(dir $@)
+       $V$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ -MQ $@ -MP -MD -MF $(@:%.o=%.dep)
+
+
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/include/CIPCChannel_AcessIPCPipe.hpp b/Usermode/Libraries/libaxwin4.so_src/include/CIPCChannel_AcessIPCPipe.hpp
new file mode 100644 (file)
index 0000000..d04d052
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Acess2 GUIv4 Library
+ * - By John Hodge (thePowersGang)
+ *
+ * CIPCChannel_AcessIPCPipe.h
+ * - Acess IPC Datagram pipe
+ */
+#ifndef _LIBAXWIN4_CIPCCHANNEL_ACESSIPCPIPE_H_
+#define _LIBAXWIN4_CIPCCHANNEL_ACESSIPCPIPE_H_
+
+#include "IIPCChannel.hpp"
+
+namespace AxWin {
+
+class CIPCChannel_AcessIPCPipe:
+       public IIPCChannel
+{
+        int    m_fd;
+public:
+       CIPCChannel_AcessIPCPipe(const char *Path);
+       virtual ~CIPCChannel_AcessIPCPipe();
+       virtual int     FillSelect(fd_set& fds);
+       virtual bool    HandleSelect(const fd_set& fds);
+       virtual void    Send(CSerialiser& message);
+};
+
+};     // namespace AxWin
+
+#endif
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/include/IIPCChannel.hpp b/Usermode/Libraries/libaxwin4.so_src/include/IIPCChannel.hpp
new file mode 100644 (file)
index 0000000..c4a514f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Acess2 GUIv4 Library
+ * - By John Hodge (thePowersGang)
+ *
+ * IIPCChannel.h
+ * - IPC Channel interface
+ */
+#ifndef _LIBAXWIN4_IIPCCHANNEL_H_
+#define _LIBAXWIN4_IIPCCHANNEL_H_
+
+#include <serialisation.hpp>
+
+#include <acess/sys.h>
+
+namespace AxWin {
+
+class IIPCChannel
+{
+public:
+       virtual ~IIPCChannel();
+       virtual int     FillSelect(fd_set& fds) = 0;
+       /**
+        * \return False if the connection has dropped/errored
+        */
+       virtual bool    HandleSelect(const fd_set& fds) = 0;
+       
+       virtual void    Send(CSerialiser& message) = 0;
+};
+
+};     // namespace AxWin
+
+#endif
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/include/common.hpp b/Usermode/Libraries/libaxwin4.so_src/include/common.hpp
new file mode 100644 (file)
index 0000000..431fce5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Acess2 GUIv4 Library
+ * - By John Hodge (thePowersGang)
+ *
+ * common.h
+ * - Library internal header
+ */
+#ifndef _LIBAXWIN4_COMMON_H_
+#define _LIBAXWIN4_COMMON_H_
+
+#include <serialisation.hpp>
+
+namespace AxWin {
+
+extern void    SendMessage(CSerialiser& message);
+
+};
+
+struct sAxWin4_Window
+{
+       unsigned int    m_id;
+};
+
+#endif
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/include_exp/axwin4/axwin.h b/Usermode/Libraries/libaxwin4.so_src/include_exp/axwin4/axwin.h
new file mode 100644 (file)
index 0000000..fd54581
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ */
+#ifndef _LIBAXWIN4_AXWIN4_AXWIN_H_
+#define _LIBAXWIN4_AXWIN4_AXWIN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <acess/sys.h>
+
+typedef struct sAxWin4_Window  tAxWin4_Window;
+
+// - Abstractions of core IPC methods
+extern bool    AxWin4_Connect(const char *URI);
+
+extern bool    AxWin4_WaitEventQueue(uint64_t Timeout);        
+extern bool    AxWin4_WaitEventQueueSelect(int nFDs, fd_set *rfds, fd_set *wfds, fd_set *efds, uint64_t Timeout);
+
+extern tAxWin4_Window  *AxWin4_CreateWindow(const char *Name);
+extern void    AxWin4_ShowWindow(tAxWin4_Window *Window);
+extern void    AxWin4_SetTitle(tAxWin4_Window *Window, const char *Title);
+extern void    AxWin4_DrawBitmap(tAxWin4_Window *Window, int X, int Y, unsigned int W, unsigned int H, void *Data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/ipc.cpp b/Usermode/Libraries/libaxwin4.so_src/ipc.cpp
new file mode 100644 (file)
index 0000000..c7a2455
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * AxWin4 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * ipc.c
+ * - IPC Abstraction
+ */
+#include <axwin4/axwin.h>
+#include "include/common.hpp"
+#include "include/IIPCChannel.hpp"
+#include "include/CIPCChannel_AcessIPCPipe.hpp"
+#include <algorithm>
+
+#include <cstring>
+#include <cstdio>
+
+namespace AxWin {
+
+IIPCChannel*   gIPCChannel;
+
+extern "C" bool AxWin4_Connect(const char *URI)
+{
+       if( gIPCChannel ) {
+               return false;
+       }
+       try {
+               if( strncmp(URI, "ipcpipe://", 3+4+3) == 0 )
+               {
+                       gIPCChannel = new CIPCChannel_AcessIPCPipe(URI);
+               }
+               else
+               {
+                       return false;
+               }
+       }
+       catch( const ::std::exception& e )
+       {
+               fprintf(stderr, "AxWin4_Connect: %s\n", e.what());
+               return false;
+       }
+       return true;
+}
+
+extern "C" bool AxWin4_PeekEventQueue(void)
+{
+       return false;
+}
+
+extern "C" bool AxWin4_WaitEventQueue(uint64_t Timeout)
+{
+       AxWin4_WaitEventQueueSelect(0, NULL, NULL, NULL, Timeout);
+}
+
+extern "C" bool AxWin4_WaitEventQueueSelect(int nFDs, fd_set *rfds, fd_set *wfds, fd_set *efds, uint64_t Timeout)
+{
+       fd_set  local_rfds;
+       if( !rfds )
+               rfds = &local_rfds;
+       
+       int64_t select_timeout = Timeout;
+       int64_t *select_timeout_p = (Timeout ? &select_timeout : 0);
+       
+       nFDs = ::std::max(nFDs, gIPCChannel->FillSelect(*rfds));
+       _SysSelect(nFDs, rfds, wfds, efds, select_timeout_p, 0);
+       return gIPCChannel->HandleSelect(*rfds);
+}
+
+void SendMessage(CSerialiser& message)
+{
+       gIPCChannel->Send(message);
+}
+
+IIPCChannel::~IIPCChannel()
+{
+}
+
+};     // namespace AxWin
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp b/Usermode/Libraries/libaxwin4.so_src/ipc_acessipcpipe.cpp
new file mode 100644 (file)
index 0000000..b7a509c
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * AxWin4 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * ipc_acessipcpipe.c
+ * - Acess2 /Devices/ipcpipe/ IPC Channel
+ */
+#include "include/CIPCChannel_AcessIPCPipe.hpp"
+#include <system_error>
+#include <cerrno>
+
+namespace AxWin {
+
+CIPCChannel_AcessIPCPipe::CIPCChannel_AcessIPCPipe(const char *Path)
+{
+       m_fd = _SysOpen(Path, OPENFLAG_READ|OPENFLAG_WRITE);
+       if( m_fd == -1 ) {
+               throw ::std::system_error(errno, ::std::system_category());
+       }
+}
+
+CIPCChannel_AcessIPCPipe::~CIPCChannel_AcessIPCPipe()
+{
+}
+
+int CIPCChannel_AcessIPCPipe::FillSelect(fd_set& fds)
+{
+       FD_SET(m_fd, &fds);
+       return m_fd+1;
+}
+
+bool CIPCChannel_AcessIPCPipe::HandleSelect(const fd_set& fds)
+{
+       if( FD_ISSET(m_fd, &fds) )
+       {
+       }
+       return true;
+}
+
+void CIPCChannel_AcessIPCPipe::Send(CSerialiser& message)
+{
+       // TODO:
+}
+
+
+};     // namespace AxWin
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/main.c b/Usermode/Libraries/libaxwin4.so_src/main.c
new file mode 100644 (file)
index 0000000..5d55582
--- /dev/null
@@ -0,0 +1,8 @@
+/*
+ */
+// === CODE ===
+int SoMain(void)
+{
+       return 0;
+}
+
diff --git a/Usermode/Libraries/libaxwin4.so_src/wm.cpp b/Usermode/Libraries/libaxwin4.so_src/wm.cpp
new file mode 100644 (file)
index 0000000..12c02c5
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * AxWin4 Interface Library
+ * - By John Hodge (thePowersGang)
+ *
+ * wm.cpp
+ * - Window Management
+ */
+#include <axwin4/axwin.h>
+#include "include/common.hpp"
+#include <ipc_proto.hpp>
+
+namespace AxWin {
+
+extern "C" tAxWin4_Window *AxWin4_CreateWindow(const char *Name)
+{
+       // Allocate a window ID
+       // Create window structure locally
+       // Request creation of window
+}
+
+extern "C" void AxWin4_ShowWindow(tAxWin4_Window *Window)
+{
+       CSerialiser     message;
+       message.WriteU16(Window->m_id);
+       message.WriteU16(IPC_WINATTR_SHOW);
+       message.WriteU8(1);
+       ::AxWin::SendMessage(message);
+}
+
+extern "C" void AxWin4_SetTitle(tAxWin4_Window *Window, const char *Title)
+{
+       CSerialiser     message;
+       message.WriteU16(Window->m_id);
+       message.WriteU16(IPC_WINATTR_TITLE);
+       message.WriteString(Title);
+       ::AxWin::SendMessage(message);
+}
+
+};     // namespace AxWin
+

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