summaryrefslogtreecommitdiffhomepage
path: root/dev/SCI
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-27 22:27:57 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-27 22:28:16 +0200
commitcdaf8e9379f1756a9416f455ff5552fb8871c16d (patch)
treed2dfb4010931f2ba9df359d4826245906fffd13c /dev/SCI
parentc9e0e4b6058f833f39c2193e217dc38f4edd8b82 (diff)
[IMP] Updated SCM API, add XPCOM interface.
+ XPCOM is a product of ZKA's which helps developers make portable code. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/SCI')
-rw-r--r--dev/SCI/sci_base.hxx21
-rw-r--r--dev/SCI/scm-design.drawio (renamed from dev/SCI/SCM.drawio)4
-rw-r--r--dev/SCI/scm_core.hxx (renamed from dev/SCI/scm.internal.inl)25
-rw-r--r--dev/SCI/scm_xpcom.inl (renamed from dev/SCI/scm.idlparser.inl)15
-rw-r--r--dev/SCI/source_deploy.xml4
5 files changed, 43 insertions, 26 deletions
diff --git a/dev/SCI/sci_base.hxx b/dev/SCI/sci_base.hxx
index 1d69a56b..a6719500 100644
--- a/dev/SCI/sci_base.hxx
+++ b/dev/SCI/sci_base.hxx
@@ -37,9 +37,9 @@ typedef char Char;
#include <SCI/sci_err.hxx>
#ifdef __SCI_IMPL__
-#include <SCI/scm.internal.inl>
+#include <SCI/scm_core.hxx>
#else
-class UnknownInterface; // Refrenced from an IDB entry.
+class IUnknown; // Refrenced from an IDB entry.
class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID.
class UUID;
@@ -49,7 +49,10 @@ class UUID;
/// @param uclsidOfCls
/// @return
template <typename TCLS, typename UCLSID, typename... Args>
-TCLS* RtlQueryInterface(UCLSID uclsidOfCls, Args... args);
+TCLS* ScmQueryInterface(UCLSID uclsidOfCls, Args... args);
+
+template <typename TCLS>
+SInt32 ScmReleaseClass(TCLS** cls);
/// @brief Release SCM class.
/// @tparam TCLS
@@ -58,18 +61,18 @@ TCLS* RtlQueryInterface(UCLSID uclsidOfCls, Args... args);
template <typename TCLS>
SInt32 RtlReleaseClass(TCLS* cls);
-class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) UnknownInterface
+class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) IUnknown
{
public:
- explicit UnknownInterface() = default;
- virtual ~UnknownInterface() = default;
+ explicit IUnknown() = default;
+ virtual ~IUnknown() = default;
- UnknownInterface& operator=(const UnknownInterface&) = default;
- UnknownInterface(const UnknownInterface&) = default;
+ IUnknown& operator=(const IUnknown&) = default;
+ IUnknown(const IUnknown&) = default;
virtual SInt32 Release() = 0;
virtual void RemoveRef() = 0;
- virtual UnknownInterface* AddRef() = 0;
+ virtual IUnknown* AddRef() = 0;
virtual VoidPtr QueryInterface(UUID* p_uuid) = 0;
};
diff --git a/dev/SCI/SCM.drawio b/dev/SCI/scm-design.drawio
index 403d6642..a8abf083 100644
--- a/dev/SCI/SCM.drawio
+++ b/dev/SCI/scm-design.drawio
@@ -19,10 +19,10 @@
<mxCell id="eRehIIeIVOPW1y23kRkx-8" value="Program #2&lt;div&gt;Is a web browser, it uses an HTML parser component.&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="253" y="570" width="120" height="60" as="geometry"/>
</mxCell>
- <mxCell id="eRehIIeIVOPW1y23kRkx-10" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;System Component/Call Model/Interface&lt;/h1&gt;&lt;p&gt;SCM is a standardized way of sharing code within DLLs in NewOS.&lt;/p&gt;&lt;p&gt;All classes are based upon&amp;nbsp;&lt;span style=&quot;color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px;&quot;&gt;UnknownInterface&lt;/span&gt;&lt;/p&gt;&lt;p&gt;It is also used to register and call code using&amp;nbsp;&lt;span style=&quot;color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px;&quot;&gt;EventListenerInterface&lt;/span&gt;&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
+ <mxCell id="eRehIIeIVOPW1y23kRkx-10" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;System Component/Call Model/Interface&lt;/h1&gt;&lt;p&gt;SCM is a standardized way of sharing code within DLLs in NewOS.&lt;/p&gt;&lt;p&gt;All classes are based upon&amp;nbsp;&lt;span style=&quot;color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px;&quot;&gt;IUnknown&lt;/span&gt;&lt;/p&gt;&lt;p&gt;It is also used to register and call code using&amp;nbsp;&lt;span style=&quot;color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px;&quot;&gt;EventListenerInterface&lt;/span&gt;&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
<mxGeometry x="450" y="240" width="320" height="240" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
-</mxfile> \ No newline at end of file
+</mxfile>
diff --git a/dev/SCI/scm.internal.inl b/dev/SCI/scm_core.hxx
index af87230d..5b4c26f4 100644
--- a/dev/SCI/scm.internal.inl
+++ b/dev/SCI/scm_core.hxx
@@ -12,7 +12,7 @@ Purpose: Base code of SCM.
#ifndef __NDK__
#define object class
#define protocol class
-#define clsid(X) __attribute__((uuid(X)))
+#define clsid(X)
#warning ! you may be using the clang version of the newos kit, please be cautious that some thing mayn't be present. !
#endif // !__NDK__
@@ -20,22 +20,22 @@ Purpose: Base code of SCM.
// Interfaces are divided between classes.
// So that they aren't too big.
-protocol UnknownInterface; // Refrenced from an IDB entry.
-class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID.
+protocol IUnknown; // Refrenced from an IDB entry.
+protocol UnknownUCLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID.
object UUID;
-protocol clsid("d7c144b6-0792-44b8-b06b-02b227b547df") UnknownInterface
+protocol clsid("d7c144b6-0792-44b8-b06b-02b227b547df") IUnknown
{
public:
- explicit UnknownInterface() = default;
- virtual ~UnknownInterface() = default;
+ explicit IUnknown() = default;
+ virtual ~IUnknown() = default;
- UnknownInterface& operator=(const UnknownInterface&) = default;
- UnknownInterface(const UnknownInterface&) = default;
+ IUnknown& operator=(const IUnknown&) = default;
+ IUnknown(const IUnknown&) = default;
virtual SInt32 Release() = 0;
virtual void RemoveRef() = 0;
- virtual UnknownInterface* AddRef() = 0;
+ virtual IUnknown* AddRef() = 0;
virtual VoidPtr QueryInterface(UUID* p_uuid) = 0;
};
@@ -47,6 +47,7 @@ public:
template <typename TCLS, typename UCLSID, typename... Args>
inline TCLS* ScmQueryInterface(UCLSID* uclsidOfCls, Args&&... args)
{
+ uclsidOfCls->AddRef();
return uclsidOfCls->QueryInterfaceWithArgs(args...);
}
@@ -55,14 +56,16 @@ inline TCLS* ScmQueryInterface(UCLSID* uclsidOfCls, Args&&... args)
/// @param cls the class to release.
/// @return status code.
template <typename TCLS>
-inline SInt32 ScmReleaseClass(TCLS* cls)
+inline SInt32 ScmReleaseClass(TCLS** cls)
{
if (!cls)
return -1;
- cls->DecrementRef();
+ cls->RemoveRef();
cls->Release();
+ cls = nullptr;
+
return 0;
}
diff --git a/dev/SCI/scm.idlparser.inl b/dev/SCI/scm_xpcom.inl
index 6189eab6..9c63f041 100644
--- a/dev/SCI/scm.idlparser.inl
+++ b/dev/SCI/scm_xpcom.inl
@@ -12,10 +12,19 @@ Purpose: Base code of SCM.
#ifndef __NDK__
#define object class
#define protocol class
-#define clsid(X) __attribute__((uuid(X)))
+#define interface private
+#define method
+#define clsid(X)
#warning ! you may be using the clang version of the newos kit, please be cautious that some thing mayn't be present. !
#endif // !__NDK__
-protocol IDLParserInterface;
-protocol IDLInterface; \ No newline at end of file
+protocol IPXCOMSocket;
+
+clsid("0943A614-0201-4107-8F8D-E909DF7F53C9")
+protocol IPXCOMSocket
+{
+interface:
+ method SInt32 SendMessage(const Char* bytes, SizeT bytes_size);
+ method SInt32 RecvMessage(_Output const Char** bytes_in, _Input SizeT bytes_size);
+};
diff --git a/dev/SCI/source_deploy.xml b/dev/SCI/source_deploy.xml
index 5c8090f1..128ec570 100644
--- a/dev/SCI/source_deploy.xml
+++ b/dev/SCI/source_deploy.xml
@@ -2,6 +2,8 @@
<HiddenFiles>
<SourceFile>Sources/*.cxx</SourceFile>
<SourceFile>*.drawio</SourceFile>
- <SourceFile>*.internal.inl</SourceFile>
+ <SourceFile>*.hxx</SourceFile>
+ <SourceFile>*.inl</SourceFile>
+ <SourceFile>*.idl</SourceFile>
</HiddenFiles>
</SourceDeploy>