From ccde7ed2605c61b83fb305360342039e9723a2db Mon Sep 17 00:00:00 2001 From: Amlal Date: Mon, 30 Sep 2024 22:29:33 +0200 Subject: IMP: Update SCI and XPCOM specs, as well as GZip specs. Signed-off-by: Amlal --- dev/sci/sci_base.hxx | 48 ++++++++++++++++++++---------------------------- dev/sci/xpcom_core.hxx | 25 ++++++++++++++++--------- 2 files changed, 36 insertions(+), 37 deletions(-) (limited to 'dev/sci') diff --git a/dev/sci/sci_base.hxx b/dev/sci/sci_base.hxx index 0bdbb2eb..92a959a7 100644 --- a/dev/sci/sci_base.hxx +++ b/dev/sci/sci_base.hxx @@ -12,12 +12,16 @@ Purpose: sci/M core header file (C++) #include +#define ATTRIBUTE(X) __attribute__((X)) + #define IMPORT_CXX extern "C++" #define IMPORT_C extern "C" typedef bool Bool; typedef void UInt0; +typedef UInt0 Void; + typedef __UINT64_TYPE__ UInt64; typedef __UINT32_TYPE__ UInt32; typedef __UINT16_TYPE__ UInt16; @@ -39,29 +43,11 @@ typedef char Char; #ifdef __SCI_IMPL__ #include #else -class IUnknown; // Refrenced from an IDB entry. -class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID. +class IUnknown; // Refrenced from an IDB entry. +class ICLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID. class UUID; -/// @brief Allocate new XPCOM class. -/// @tparam TCLS -/// @tparam UCLSID -/// @param uclsidOfCls -/// @return -template -TCLS* XPCOMQueryInterface(UCLSID uclsidOfCls, Args... args); - -template -SInt32 XPCOMReleaseClass(TCLS** cls); - -/// @brief Release XPCOM class. -/// @tparam TCLS -/// @param cls -/// @return -template -SInt32 RtlReleaseClass(TCLS* cls); - -class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) IUnknown +class ATTRIBUTE(uuid("d7c144b6-0792-44b8-b06b-02b227b547df")) IUnknown { public: explicit IUnknown() = default; @@ -70,22 +56,24 @@ public: IUnknown& operator=(const IUnknown&) = default; IUnknown(const IUnknown&) = default; - virtual SInt32 Release() = 0; - virtual void RemoveRef() = 0; - virtual IUnknown* AddRef() = 0; - virtual VoidPtr QueryInterface(UUID* p_uuid) = 0; + virtual SInt32 Release() = 0; + virtual void RemoveRef() = 0; + virtual IUnknown* AddRef() = 0; + virtual VoidPtr QueryClass(UUID* p_uuid) = 0; }; template class IEventListener : public ClsID { -public: + friend ClsID; + explicit IEventListener() = default; virtual ~IEventListener() = default; IEventListener& operator=(const IEventListener&) = default; IEventListener(const IEventListener&) = default; + virtual IEventListener& operator-=(const Char* event_name); virtual IEventListener& operator+=(FnSign arg) = 0; }; #endif @@ -157,7 +145,9 @@ IMPORT_C UInt64 IoSeekFile(_Input ZKAObject file_desc, UInt64 file_offset); /// @brief Installs the Thread Information Block and Global Information Block inside the current process. /// @param void. /// @return > 0 error ocurred or already present, = 0 success. -IMPORT_C UInt32 TlsInstall(UInt0); +IMPORT_C UInt32 RtlTlsInstall(Void); + +#ifndef __SCI_IMPL__ // ------------------------------------------------------------------------ // XPCOM API. @@ -169,7 +159,7 @@ IMPORT_C UInt32 TlsInstall(UInt0); /// @param uclsidOfCls UCLS factory class /// @return TCLS interface template -TCLS* XPCOMQueryInterface(_Input UCLSID* uclsidOfCls, _Input Args&&... args); +TCLS* XPCOMQueryClass(_Input UCLSID* uclsidOfCls, _Input Args&&... args); /// @brief Release XPCOM object. /// @tparam TCLS the class type. @@ -187,6 +177,8 @@ IMPORT_C SInt32 XPCOMCreateInstance(_Input UInt32 flags, _Output ZKAObject* hand /// @param handle_instance the XPCOM handle. IMPORT_C UInt0 XPCOMDestroyInstance(_Input ZKAObject handle_instance); +#endif // !__SCI_IMPL__ + // ------------------------------------------------------------------------ // Memory Management API. // ------------------------------------------------------------------------ diff --git a/dev/sci/xpcom_core.hxx b/dev/sci/xpcom_core.hxx index 63bcf403..2b2754e6 100644 --- a/dev/sci/xpcom_core.hxx +++ b/dev/sci/xpcom_core.hxx @@ -7,18 +7,18 @@ Purpose: Base code of XPCOM. ------------------------------------------- */ -/// @internal +/// @internal Reserved for internal definitions only. #ifndef __NDK__ #define object class #define protocol class #define clsid(X) -#warning ! You may be using the clang version of the ZKAKit, please be cautious that some features mayn't be present. ! +#warning ! You may be using the clang compiler, please be cautious that some features mayn't be present. ! #endif // !__NDK__ -protocol IUnknown; // Refrenced from an IDB entry. -protocol UnknownUCLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID. +protocol IUnknown; // Refrenced from an IDB entry. +protocol ICLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID. object UUID; /// @brief Unknown XPCOM interface @@ -31,10 +31,10 @@ public: IUnknown& operator=(const IUnknown&) = default; IUnknown(const IUnknown&) = default; - virtual SInt32 Release() = 0; - virtual void RemoveRef() = 0; - virtual IUnknown* AddRef() = 0; - virtual VoidPtr QueryInterface(UUID * p_uuid) = 0; + virtual SInt32 Release() = 0; + virtual Void RemoveRef() = 0; + virtual IUnknown* AddRef() = 0; + virtual VoidPtr QueryClass(UUID * p_uuid) = 0; }; /// @brief Allocate new XPCOM object. @@ -70,13 +70,20 @@ inline SInt32 XPCOMReleaseClass(TCLS** cls) template protocol IEventListener : public ClsID { -public: + friend ClsID; + explicit IEventListener() = default; virtual ~IEventListener() = default; IEventListener& operator=(const IEventListener&) = default; IEventListener(const IEventListener&) = default; + virtual IEventListener& operator-=(const Char* event_name) + { + this->RemoveEventListener(event_name); + return *this; + } + virtual IEventListener& operator+=(FnSign arg) { this->AddEventListener(arg); -- cgit v1.2.3