diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-27 17:06:30 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-27 17:06:30 +0100 |
| commit | 2f7c48ef9172ba48fa177600a12ab0d51cb9e566 (patch) | |
| tree | 96841cb24ca8756b1bc30ea50f9664245a3479fb | |
| parent | b340547eb2d6db9eddd8bdbf0e473f9fe993bec4 (diff) | |
Kernel: Fix ABI for MP-CC, rename FilesystemIndexer to
IndexableProperty.
Public/ZipKit: Add impl for deflate/inflate.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | MailMap | 2 | ||||
| -rw-r--r-- | Private/FSKit/IndexableProperty.hxx (renamed from Private/FSKit/FilesystemIndexer.hxx) | 0 | ||||
| -rw-r--r-- | Private/FSKit/NewFS.hxx | 2 | ||||
| -rw-r--r-- | Private/FSKit/NewFSIndexer.hxx | 2 | ||||
| -rw-r--r-- | Private/KernelKit/Device.hpp | 9 | ||||
| -rw-r--r-- | Private/Source/CxxAbi.cxx | 45 | ||||
| -rw-r--r-- | Private/Source/IndexableProperty.cxx | 2 | ||||
| -rw-r--r-- | Public/SDK/ZipKit/Defines.hpp | 2 | ||||
| -rw-r--r-- | Public/SDK/ZipKit/NewFS-Addon.hpp | 2 | ||||
| -rw-r--r-- | Public/SDK/ZipKit/Zip.cpp | 32 | ||||
| -rw-r--r-- | Public/SDK/ZipKit/Zip.hpp | 49 |
11 files changed, 100 insertions, 47 deletions
@@ -1 +1 @@ -amllx - amlalelmahrouss@icloud.com, amlal@mahrouss.com +33 6 58 57 30 14 +amlel - amlalelmahrouss@icloud.com, amlal@mahrouss.com +33 6 58 57 30 14 diff --git a/Private/FSKit/FilesystemIndexer.hxx b/Private/FSKit/IndexableProperty.hxx index 4ba68056..4ba68056 100644 --- a/Private/FSKit/FilesystemIndexer.hxx +++ b/Private/FSKit/IndexableProperty.hxx diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index f9725e22..0e935cd5 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -175,7 +175,7 @@ namespace hCore virtual bool WriteCatalog(NewCatalog& catalog, voidPtr data) = 0; virtual bool RemoveCatalog(NewCatalog& catalog) = 0; - void FormatDrive(DriveTraits& drive); + virtual bool Format(DriveTraits& drive) = 0; }; diff --git a/Private/FSKit/NewFSIndexer.hxx b/Private/FSKit/NewFSIndexer.hxx index fd22e4bd..c5f63059 100644 --- a/Private/FSKit/NewFSIndexer.hxx +++ b/Private/FSKit/NewFSIndexer.hxx @@ -9,7 +9,7 @@ #pragma once -#include <FSKit/FilesystemIndexer.hxx> +#include <FSKit/IndexableProperty.hxx> #include <NewKit/MutableArray.hpp> namespace hCore diff --git a/Private/KernelKit/Device.hpp b/Private/KernelKit/Device.hpp index b117cf7f..4ae968c2 100644 --- a/Private/KernelKit/Device.hpp +++ b/Private/KernelKit/Device.hpp @@ -35,22 +35,19 @@ namespace hCore DeviceInterface(const DeviceInterface<T> &) = default; public: - DeviceInterface<T> &operator<<(T Data) + DeviceInterface<T>& operator<<(T Data) { m_Out(Data); return *this; } - DeviceInterface<T> &operator>>(T Data) + DeviceInterface<T>& operator>>(T Data) { m_In(Data); return *this; } - virtual const char* Name() const - { - return ("DeviceInterface"); - } + virtual const char* Name() const { return "DeviceInterface"; } operator bool() { return m_Out && m_In; } bool operator!() { return !m_Out && !m_In; } diff --git a/Private/Source/CxxAbi.cxx b/Private/Source/CxxAbi.cxx index 324c878d..4984c81a 100644 --- a/Private/Source/CxxAbi.cxx +++ b/Private/Source/CxxAbi.cxx @@ -29,7 +29,8 @@ extern "C" void __stack_chk_fail() hCore::panic(RUNTIME_CHECK_POINTER); } -extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) { +extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) +{ if (__atexit_func_count >= DSO_MAX_OBJECTS) return -1; @@ -42,11 +43,15 @@ extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) { return 0; } -extern "C" void __cxa_finalize(void *f) { +extern "C" void __cxa_finalize(void *f) +{ uarch_t i = __atexit_func_count; - if (!f) { - while (i--) { - if (__atexit_funcs[i].destructor_func) { + if (!f) + { + while (i--) + { + if (__atexit_funcs[i].destructor_func) + { (*__atexit_funcs[i].destructor_func)(__atexit_funcs[i].obj_ptr); }; } @@ -54,26 +59,32 @@ extern "C" void __cxa_finalize(void *f) { return; } - while (i--) { - if (__atexit_funcs[i].destructor_func) { + while (i--) + { + if (__atexit_funcs[i].destructor_func) + { (*__atexit_funcs[i].destructor_func)(__atexit_funcs[i].obj_ptr); __atexit_funcs[i].destructor_func = 0; }; } } -namespace cxxabiv1 { - extern "C" int __cxa_guard_acquire(__guard *g) { +namespace cxxabiv1 +{ + extern "C" int __cxa_guard_acquire(__guard *g) + { (void) g; return 0; } - extern "C" int __cxa_guard_release(__guard *g) { + extern "C" int __cxa_guard_release(__guard *g) + { *(char *) g = 1; return 0; } - extern "C" void __cxa_guard_abort(__guard *g) { + extern "C" void __cxa_guard_abort(__guard *g) + { (void) g; } } // namespace cxxabiv1 @@ -87,6 +98,18 @@ namespace cxxkit for (int i = 0; i < cnt; ++i) (finis[i])(); } + + extern "C" void __init_local(void(**init)(void), int cnt) + { + for (int i = 0; i < cnt; ++i) + (init[i])(); + } + + extern "C" void __fini_local(void(**finis)(void), int cnt) + { + for (int i = 0; i < cnt; ++i) + (finis[i])(); + } } #endif diff --git a/Private/Source/IndexableProperty.cxx b/Private/Source/IndexableProperty.cxx index bb1393b5..5b49d6c1 100644 --- a/Private/Source/IndexableProperty.cxx +++ b/Private/Source/IndexableProperty.cxx @@ -9,7 +9,7 @@ //! @brief hCore NewFS Indexer. -#include <FSKit/FilesystemIndexer.hxx> +#include <FSKit/IndexableProperty.hxx> #include <CompilerKit/Compiler.hpp> #include <NewKit/MutableArray.hpp> #include <NewKit/Utils.hpp> diff --git a/Public/SDK/ZipKit/Defines.hpp b/Public/SDK/ZipKit/Defines.hpp index 8f15dc6b..8c3790c6 100644 --- a/Public/SDK/ZipKit/Defines.hpp +++ b/Public/SDK/ZipKit/Defines.hpp @@ -11,4 +11,4 @@ #include <SystemKit/Defines.hpp> -#define ZIPKIT_VERSION "1.0.0"
\ No newline at end of file +#define ZIPKIT_VERSION "1.0.1" diff --git a/Public/SDK/ZipKit/NewFS-Addon.hpp b/Public/SDK/ZipKit/NewFS-Addon.hpp index 07e41f64..4bc0c4c1 100644 --- a/Public/SDK/ZipKit/NewFS-Addon.hpp +++ b/Public/SDK/ZipKit/NewFS-Addon.hpp @@ -9,7 +9,7 @@ #pragma once -// TODO: integrate MeFS compression. +// TODO: integrate NewFS compression. // MeFS catalog is compressed. #define kCatalogFlagZip 255 diff --git a/Public/SDK/ZipKit/Zip.cpp b/Public/SDK/ZipKit/Zip.cpp index e6ff73ad..a7b3e0f4 100644 --- a/Public/SDK/ZipKit/Zip.cpp +++ b/Public/SDK/ZipKit/Zip.cpp @@ -45,12 +45,42 @@ namespace ZipKit void* ZipStream::Deflate(const char* name) { + z_stream deflate_stream{ 0 }; - return nullptr; + deflate_stream.zalloc = Z_NULL; + deflate_stream.zfree = Z_NULL; + deflate_stream.opaque = Z_NULL; + + // setup "b" as the input and "c" as the compressed output + deflate_stream.avail_in = (uInt)this->fSharedSz+1; // size of input, string + terminator + deflate_stream.next_in = (Bytef *)this->fSharedData; // input char array + deflate_stream.avail_out = (uInt)this->fSharedSz; // size of output + deflate_stream.next_out = (Bytef *)this->fSharedData; // output char array + + deflateInit(deflate_stream); + deflate(&deflate_stream, Z_NO_FLUSH); + deflateEnd(&deflate_stream); + + return this->fSharedData; } void ZipStream::Inflate(const char* name, void* data) { + z_stream inflate_stream{ 0 }; + + inflate_stream.zalloc = Z_NULL; + inflate_stream.zfree = Z_NULL; + inflate_stream.opaque = Z_NULL; + + // setup "b" as the input and "c" as the compressed output + inflate_stream.avail_in = (uInt)((char*)inflate_stream.next_out - b); // size of input + + inflate_stream.next_in = (Bytef *)this->fSharedData; // input char array + inflate_stream.avail_out = (uInt)this->fSharedSz; // size of output + inflate_stream.next_out = (Bytef *)this->fSharedData; // output char array + inflateInit(inflate_stream); + inflate(&inflate_stream, Z_NO_FLUSH); + inflateEnd(&inflate_stream); } }
\ No newline at end of file diff --git a/Public/SDK/ZipKit/Zip.hpp b/Public/SDK/ZipKit/Zip.hpp index be7062f2..72105bc1 100644 --- a/Public/SDK/ZipKit/Zip.hpp +++ b/Public/SDK/ZipKit/Zip.hpp @@ -1,11 +1,11 @@ /* - * ======================================================== - * - * h-core - * Copyright Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ +* ======================================================== +* +* h-core +* Copyright 2024 Mahrouss Logic, all rights reserved. +* +* ======================================================== +*/ #pragma once @@ -18,25 +18,28 @@ namespace ZipKit { - class ZipStream; +class ZipStream; - class ZipStream final - { - public: - explicit ZipStream(); - ~ZipStream() noexcept; +class ZipStream final +{ + public: + explicit ZipStream(); + ~ZipStream() noexcept; + + public: + HCORE_COPY_DEFAULT(ZipStream); - public: - HCORE_COPY_DEFAULT(ZipStream); + public: + MeFilePtr FlushToFile(const char* name); + void* Deflate(const char* name); + void Inflate(const char* name, void* data); - public: - MeFilePtr FlushToFile(const char* name); - void* Deflate(const char* name); - void Inflate(const char* name, void* data); + private: + VoidStar fSharedData{ nullptr }; + SizeT fSharedSz{ 0 }; - private: - void* fSharedData{ nullptr }; - SizeT fSharedSz{ 0 }; + private: + z_stream fStream; - }; +}; } |
