From da70596895d8135e08f8caac6978117697b4c021 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 18 Aug 2024 21:39:29 +0200 Subject: [REFACTOR] Improved project structure. Signed-off-by: Amlal El Mahrouss --- dev/SCIKit/Hint.hxx | 23 ------ dev/SCIKit/ReadMe.md | 3 - dev/SCIKit/SCIBase.cxx | 7 -- dev/SCIKit/SCIBase.hxx | 185 ------------------------------------------- dev/SCIKit/SCIErr.cxx | 9 --- dev/SCIKit/SCIErr.hxx | 49 ------------ dev/SCIKit/SCM.drawio | 28 ------- dev/SCIKit/build.json | 10 --- dev/SCIKit/compile_flags.txt | 4 - dev/SCIKit/makefile | 12 --- dev/SCIKit/scm.idlparser.inl | 21 ----- dev/SCIKit/scm.internal.inl | 84 -------------------- dev/SCIKit/source_deploy.xml | 7 -- 13 files changed, 442 deletions(-) delete mode 100644 dev/SCIKit/Hint.hxx delete mode 100644 dev/SCIKit/ReadMe.md delete mode 100644 dev/SCIKit/SCIBase.cxx delete mode 100644 dev/SCIKit/SCIBase.hxx delete mode 100644 dev/SCIKit/SCIErr.cxx delete mode 100644 dev/SCIKit/SCIErr.hxx delete mode 100644 dev/SCIKit/SCM.drawio delete mode 100644 dev/SCIKit/build.json delete mode 100644 dev/SCIKit/compile_flags.txt delete mode 100644 dev/SCIKit/makefile delete mode 100644 dev/SCIKit/scm.idlparser.inl delete mode 100644 dev/SCIKit/scm.internal.inl delete mode 100644 dev/SCIKit/source_deploy.xml (limited to 'dev/SCIKit') diff --git a/dev/SCIKit/Hint.hxx b/dev/SCIKit/Hint.hxx deleted file mode 100644 index c785f953..00000000 --- a/dev/SCIKit/Hint.hxx +++ /dev/null @@ -1,23 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#ifndef __SCI_HINT_HXX__ -#define __SCI_HINT_HXX__ - -#pragma compiler(hint_manifest) - -#define _Input -#define _Output - -#define _Optional - -#define _StrictCheckInput -#define _StrictCheckOutput - -#define _InOut -#define _StrictInOut - -#endif // ifndef __SCI_HINT_HXX__ diff --git a/dev/SCIKit/ReadMe.md b/dev/SCIKit/ReadMe.md deleted file mode 100644 index b5f76a9f..00000000 --- a/dev/SCIKit/ReadMe.md +++ /dev/null @@ -1,3 +0,0 @@ -# Official SCM implementation for New OS - -Read the specs for + information... \ No newline at end of file diff --git a/dev/SCIKit/SCIBase.cxx b/dev/SCIKit/SCIBase.cxx deleted file mode 100644 index 628bfd67..00000000 --- a/dev/SCIKit/SCIBase.cxx +++ /dev/null @@ -1,7 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include \ No newline at end of file diff --git a/dev/SCIKit/SCIBase.hxx b/dev/SCIKit/SCIBase.hxx deleted file mode 100644 index b902b5fa..00000000 --- a/dev/SCIKit/SCIBase.hxx +++ /dev/null @@ -1,185 +0,0 @@ -/* ------------------------------------------- - -Copyright ZKA Technologies. - -File: SCIBase.hxx -Purpose: SCI/M core header file (C++) - -------------------------------------------- */ - -#ifndef __SCI_BASE_HXX__ -#define __SCI_BASE_HXX__ - -#ifdef __cplusplus - -#include - -#define IMPORT_CXX extern "C++" -#define IMPORT_C extern "C" - -#define OBJECT_PATH "::\\" - -typedef bool Bool; -typedef void UInt0; - -typedef __UINT64_TYPE__ UInt64; -typedef __UINT32_TYPE__ UInt32; -typedef __UINT16_TYPE__ UInt16; -typedef __UINT8_TYPE__ UInt8; - -typedef __SIZE_TYPE__ SizeT; - -typedef __INT64_TYPE__ SInt64; -typedef __INT32_TYPE__ SInt32; -typedef __INT16_TYPE__ SInt16; -typedef __INT8_TYPE__ SInt8; - -typedef void* VoidPtr; -typedef __UINTPTR_TYPE__ UIntPtr; -typedef char Char; - -#ifdef __SCI_IMPL__ -#include -#else -class UnknownInterface; // Refrenced from an IDB entry. -class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID. -class UUID; - -/// @brief Allocate new SCM class. -/// @tparam TCLS -/// @tparam UCLSID -/// @param uclsidOfCls -/// @return -template -TCLS* RtlQueryInterface(UCLSID uclsidOfCls, Args... args); - -/// @brief Release SCM class. -/// @tparam TCLS -/// @param cls -/// @return -template -SInt32 RtlReleaseClass(TCLS* cls); - -class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) UnknownInterface -{ -public: - explicit UnknownInterface() = default; - virtual ~UnknownInterface() = default; - - UnknownInterface& operator=(const UnknownInterface&) = default; - UnknownInterface(const UnknownInterface&) = default; - - virtual SInt32 Release() = 0; - virtual void RemoveRef() = 0; - virtual UnknownInterface* AddRef() = 0; - virtual VoidPtr QueryInterface(UUID* p_uuid) = 0; -}; - -template -class EventListenerInterface final : public ClsID -{ -public: - explicit EventListenerInterface() = default; - virtual ~EventListenerInterface() = default; - - EventListenerInterface& operator=(const EventListenerInterface&) = default; - EventListenerInterface(const EventListenerInterface&) = default; - - virtual EventListenerInterface& operator +=(FnSign arg) = 0; -}; -#endif - -// ------------------------------------------------------------------------------------------ // -/// @note Handle types. -// ------------------------------------------------------------------------------------------ // - -typedef VoidPtr NEW_OBJECT; - -typedef NEW_OBJECT DLL_OBJECT; -typedef NEW_OBJECT IO_OBJECT; -typedef NEW_OBJECT COMP_OBJECT; - -// ------------------------------------------------------------------------------------------ // - -// ------------------------------------------------------------------------------------------ // -/// @note Part of NK loader API. -// ------------------------------------------------------------------------------------------ // - - -/// @brief Get function which is part of the DLL. -/// @param symbol the symbol to look for -/// @param dll_handle the DLL handle. -/// @return the proc pointer. -IMPORT_C VoidPtr RtlGetDLLProc(_Input const Char* symbol, _Input NEW_OBJECT dll_handle); - -/// @brief Open DLL handle. -/// @param path -/// @param drv -/// @return -IMPORT_C NEW_OBJECT RtlOpenDLL(_Input const Char* path, _Input const Char* drive_letter); - -/// @brief Close DLL handle -/// @param dll_handle -/// @return -IMPORT_C UInt0 RtlCloseDLL(_Input NEW_OBJECT dll_handle); - -/// @note Part of NK file API. - -/// @brief Opens a file from a drive. -/// @param fs_path the filesystem path. -/// @param drive_letter drive name, use NULL to use default one. -/// @return the file descriptor of the file. -IMPORT_C NEW_OBJECT RtlOpenFile(const Char* fs_path, const Char* drive_letter); - -/// @brief Closes a file and flushes its content. -/// @param file_desc the file descriptor. -/// @return -IMPORT_C UInt0 RtlCloseFile(_Input NEW_OBJECT file_desc); - -/// @brief Installs the TIB and GIB inside the current process. -/// @param none -/// @return > 0 error ocurred or already present, = 0 success. -IMPORT_C UInt32 RtlInstallInfoBlocks(UInt0); - -/// @brief Allocate new SCM object. -/// @tparam TCLS the class type. -/// @tparam UCLSID UCLS factory class type. -/// @param uclsidOfCls UCLS factory class -/// @return TCLS interface -template -TCLS* ScmQueryInterface(_Input UCLSID* uclsidOfCls, _Input Args&&... args); - -/// @brief Release SCM object. -/// @tparam TCLS the class type. -/// @param cls the class to release. -/// @return status code. -template -SInt32 ScmReleaseClass(_Input TCLS* cls); - -/// @brief Creates an SCM instance in the process. -/// @param handle_instance the SCM handle. -/// @param flags the SCM flags. -SInt32 ScmCreateInstance(_Input UInt32 flags, _Output VoidPtr* handle_instance); - -/// @brief Destroys an SCM instance of the process. -/// @param handle_instance the SCM handle. -UInt0 ScmDestroyInstance(_Input VoidPtr handle_instance); - -/// @brief Creates a new heap from the process's address space. -/// @param len the length of it. -/// @param flags the flags of it. -/// @return heap pointer. -VoidPtr RtlCreateHeap(_Input SizeT len, _Input UInt32 flags); - -/// @brief Destroys the pointer -/// @param heap the heap itself. -/// @return void. -UInt0 RtlDestroyHeap(_Input VoidPtr heap); - -#else - -#include - -#endif // ifdef __cplusplus - -#endif // ifndef __SCI_BASE_HXX__ \ No newline at end of file diff --git a/dev/SCIKit/SCIErr.cxx b/dev/SCIKit/SCIErr.cxx deleted file mode 100644 index b0766944..00000000 --- a/dev/SCIKit/SCIErr.cxx +++ /dev/null @@ -1,9 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include - -NEW_ERROR_TYPE kLastError = 0; \ No newline at end of file diff --git a/dev/SCIKit/SCIErr.hxx b/dev/SCIKit/SCIErr.hxx deleted file mode 100644 index aa3e72e4..00000000 --- a/dev/SCIKit/SCIErr.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#pragma once - -#include - -#define ErrLocalIsOk() (kLastError == kErrorSuccess) -#define ErrLocalFailed() (kLastError != kErrorSuccess) -#define ErrLocal() (kLastError) - -typedef SInt32 NEW_ERROR_TYPE; - -inline constexpr NEW_ERROR_TYPE kErrorSuccess = 0; -inline constexpr NEW_ERROR_TYPE kErrorExecutable = 33; -inline constexpr NEW_ERROR_TYPE kErrorExecutableLib = 34; -inline constexpr NEW_ERROR_TYPE kErrorFileNotFound = 35; -inline constexpr NEW_ERROR_TYPE kErrorDirectoryNotFound = 36; -inline constexpr NEW_ERROR_TYPE kErrorDiskReadOnly = 37; -inline constexpr NEW_ERROR_TYPE kErrorDiskIsFull = 38; -inline constexpr NEW_ERROR_TYPE kErrorProcessFault = 39; -inline constexpr NEW_ERROR_TYPE kErrorSocketHangUp = 40; -inline constexpr NEW_ERROR_TYPE kErrorThreadLocalStorage = 41; -inline constexpr NEW_ERROR_TYPE kErrorMath = 42; -inline constexpr NEW_ERROR_TYPE kErrorNoNetwork = 43; -inline constexpr NEW_ERROR_TYPE kErrorHeapOutOfMemory = 44; -inline constexpr NEW_ERROR_TYPE kErrorNoSuchDisk = 45; -inline constexpr NEW_ERROR_TYPE kErrorFileExists = 46; -inline constexpr NEW_ERROR_TYPE kErrorFormatFailed = 47; -inline constexpr NEW_ERROR_TYPE kErrorNetworkTimeout = 48; -inline constexpr NEW_ERROR_TYPE kErrorInternal = 49; -inline constexpr NEW_ERROR_TYPE kErrorForkAlreadyExists = 50; -inline constexpr NEW_ERROR_TYPE kErrorOutOfTeamSlot = 51; -inline constexpr NEW_ERROR_TYPE kErrorHeapNotPresent = 52; -inline constexpr NEW_ERROR_TYPE kErrorNoEntrypoint = 53; -inline constexpr NEW_ERROR_TYPE kErrorDiskIsCorrupted = 54; -inline constexpr NEW_ERROR_TYPE kErrorDisk = 55; -inline constexpr NEW_ERROR_TYPE kErrorInvalidData = 56; -inline constexpr NEW_ERROR_TYPE kErrorAsync = 57; -inline constexpr NEW_ERROR_TYPE kErrorNonBlocking = 58; -inline constexpr NEW_ERROR_TYPE kErrorIPC = 59; -inline constexpr NEW_ERROR_TYPE kErrorSign = 60; -inline constexpr NEW_ERROR_TYPE kErrorInvalidCreds = 61; -inline constexpr NEW_ERROR_TYPE kErrorUnimplemented = 0; - -IMPORT_C NEW_ERROR_TYPE kLastError; diff --git a/dev/SCIKit/SCM.drawio b/dev/SCIKit/SCM.drawio deleted file mode 100644 index 403d6642..00000000 --- a/dev/SCIKit/SCM.drawio +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dev/SCIKit/build.json b/dev/SCIKit/build.json deleted file mode 100644 index 9bc72bfa..00000000 --- a/dev/SCIKit/build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compiler_path": "x86_64-w64-mingw32-g++.exe", - "compiler_std": "c++20", - "headers_path": ["../"], - "sources_path": ["*.cxx"], - "output_name": "sci.dll", - "compiler_flags": ["-fPIC", "-ffreestanding", "-shared", "-fno-rtti", "-fno-exceptions", "-Wl,--subsystem=17"], - "cpp_macros": ["__SCI_IMPL__", "cSCIVersion=0x0100", "cSCIVersionHighest=0x0100", "cSCIVersionLowest=0x0100"] - } - \ No newline at end of file diff --git a/dev/SCIKit/compile_flags.txt b/dev/SCIKit/compile_flags.txt deleted file mode 100644 index 509e3eed..00000000 --- a/dev/SCIKit/compile_flags.txt +++ /dev/null @@ -1,4 +0,0 @@ --I./ --I../Kernel --I../ --std=c++20 diff --git a/dev/SCIKit/makefile b/dev/SCIKit/makefile deleted file mode 100644 index 63753422..00000000 --- a/dev/SCIKit/makefile +++ /dev/null @@ -1,12 +0,0 @@ -###################### -# (C) ZKA -# SCM/SCI kit makefile. -###################### - -CC=g++ -FLAGS=-I../ -shared -fPIC -D__NEWOS_SYMS__ -OUTPUT=sci.dll - -.PHONY: build-sci -build-sci: - $(CC) $(wildcard *.cxx) $(FLAGS) -o $(OUTPUT) \ No newline at end of file diff --git a/dev/SCIKit/scm.idlparser.inl b/dev/SCIKit/scm.idlparser.inl deleted file mode 100644 index 6189eab6..00000000 --- a/dev/SCIKit/scm.idlparser.inl +++ /dev/null @@ -1,21 +0,0 @@ -/* ------------------------------------------- - -Copyright ZKA Technologies. - -File: rt.internal.inl -Purpose: Base code of SCM. - -------------------------------------------- */ - -/// @internal - -#ifndef __NDK__ -#define object class -#define protocol class -#define clsid(X) __attribute__((uuid(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 diff --git a/dev/SCIKit/scm.internal.inl b/dev/SCIKit/scm.internal.inl deleted file mode 100644 index 8a5a85fa..00000000 --- a/dev/SCIKit/scm.internal.inl +++ /dev/null @@ -1,84 +0,0 @@ -/* ------------------------------------------- - -Copyright ZKA Technologies. - -File: rt.internal.inl -Purpose: Base code of SCM. - -------------------------------------------- */ - -/// @internal - -#ifndef __NDK__ -#define object class -#define protocol class -#define clsid(X) __attribute__((uuid(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__ - -// 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. -object UUID; - -protocol clsid("d7c144b6-0792-44b8-b06b-02b227b547df") UnknownInterface -{ -public: - explicit UnknownInterface() = default; - virtual ~UnknownInterface() = default; - - UnknownInterface& operator=(const UnknownInterface&) = default; - UnknownInterface(const UnknownInterface&) = default; - - virtual SInt32 Release() = 0; - virtual void RemoveRef() = 0; - virtual UnknownInterface* AddRef() = 0; - virtual VoidPtr QueryInterface(UUID* p_uuid) = 0; -}; - -/// @brief Allocate new SCM object. -/// @tparam TCLS the class type. -/// @tparam UCLSID UCLS factory class type. -/// @param uclsidOfCls UCLS factory class -/// @return TCLS interface -template -inline TCLS* ScmQueryInterface(UCLSID* uclsidOfCls, Args&&... args) -{ - return uclsidOfCls->QueryInterfaceWithArgs(args...); -} - -/// @brief Release SCM object. -/// @tparam TCLS the class type. -/// @param cls the class to release. -/// @return status code. -template -inline SInt32 ScmReleaseClass(TCLS* cls) -{ - if (!cls) - return -1; - - cls->DecrementRef(); - cls->Release(); - - return 0; -} - -template -protocol EventListenerInterface final : public ClsID -{ -public: - explicit EventListenerInterface() = default; - virtual ~EventListenerInterface() = default; - - EventListenerInterface& operator=(const EventListenerInterface&) = default; - EventListenerInterface(const EventListenerInterface&) = default; - - virtual EventListenerInterface& operator +=(FnSign arg) - { - this->AddEventListener(arg); - return *this; - } -}; diff --git a/dev/SCIKit/source_deploy.xml b/dev/SCIKit/source_deploy.xml deleted file mode 100644 index 7873c49f..00000000 --- a/dev/SCIKit/source_deploy.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - *.cxx - *.drawio - *.internal.inl - - -- cgit v1.2.3