diff options
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/SCI/sci_base.hxx | 21 | ||||
| -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.xml | 4 |
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<div>Is a web browser, it uses an HTML parser component.</div>" 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="<h1 style="margin-top: 0px;">System Component/Call Model/Interface</h1><p>SCM is a standardized way of sharing code within DLLs in NewOS.</p><p>All classes are based upon&nbsp;<span style="color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px;">UnknownInterface</span></p><p>It is also used to register and call code using&nbsp;<span style="color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px;">EventListenerInterface</span></p>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1"> + <mxCell id="eRehIIeIVOPW1y23kRkx-10" value="<h1 style="margin-top: 0px;">System Component/Call Model/Interface</h1><p>SCM is a standardized way of sharing code within DLLs in NewOS.</p><p>All classes are based upon&nbsp;<span style="color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px;">IUnknown</span></p><p>It is also used to register and call code using&nbsp;<span style="color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px;">EventListenerInterface</span></p>" 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>
|
