diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:13:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:15:17 +0100 |
| commit | a13e1c0911c0627184bc38f18c7fdda64447b3ad (patch) | |
| tree | 073a62c09bf216e85a3f310376640fa1805147f9 /public | |
| parent | 149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff) | |
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'public')
| -rw-r--r-- | public/apps/.keepme | 0 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/Array.h | 71 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/Atom.h | 47 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/Foundation.h | 78 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/Object.h | 26 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/Property.h | 53 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/Ref.h | 110 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/headers/String.h | 20 | ||||
| -rw-r--r-- | public/frameworks/CoreFoundation.fwrk/src/Foundation.cc | 48 | ||||
| -rw-r--r-- | public/frameworks/DiskImage.fwrk/DiskImage.json | 4 | ||||
| -rw-r--r-- | public/frameworks/DiskImage.fwrk/headers/DiskImage.h | 2 | ||||
| -rw-r--r-- | public/tools/cc/src/CommandLine.cc | 4 | ||||
| -rw-r--r-- | public/tools/diutil/diutil.json | 2 | ||||
| -rw-r--r-- | public/tools/ld/src/CommandLine.cc | 4 | ||||
| -rw-r--r-- | public/tools/make_app/Common.h | 4 | ||||
| -rw-r--r-- | public/tools/make_app/src/CommandLine.cc | 17 | ||||
| -rw-r--r-- | public/tools/open/src/CommandLine.cc | 8 |
17 files changed, 473 insertions, 25 deletions
diff --git a/public/apps/.keepme b/public/apps/.keepme deleted file mode 100644 index e69de29b..00000000 --- a/public/apps/.keepme +++ /dev/null diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Array.h b/public/frameworks/CoreFoundation.fwrk/headers/Array.h new file mode 100644 index 00000000..b70d8503 --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/Array.h @@ -0,0 +1,71 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include <SCIKit/SCI.h> + +namespace LibCF +{ + template <typename T, SizeT N> + class CFArray final + { + public: + explicit CFArray() = default; + ~CFArray() = default; + + CFArray& operator=(const CFArray&) = default; + CFArray(const CFArray&) = default; + + T& operator[](const SizeT& at) + { + MUST_PASS(at < this->Count()); + return fArray[at]; + } + + Bool Empty() + { + return this->Count() > 0; + } + + const SizeT Capacity() + { + return N; + } + + const SizeT Count() + { + auto cnt = 0UL; + + for (auto i = 0; i < N; ++i) + { + if (fArray[i]) + ++cnt; + } + + return cnt; + } + + const T* CData() + { + return fArray; + } + + operator bool() + { + return !Empty(); + } + + private: + T fArray[N] = {nullptr}; + }; + + template <typename ValueType> + auto make_array(ValueType val) + { + return CFArray<ValueType, ARRAY_SIZE(val)>{val}; + } +} // namespace LibCF diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Atom.h b/public/frameworks/CoreFoundation.fwrk/headers/Atom.h new file mode 100644 index 00000000..d3152fd2 --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/Atom.h @@ -0,0 +1,47 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ +#pragma once + +#include <CoreFoundation.fwrk/headers/Foundation.h> + +namespace LibCF +{ + template <typename T> + class CFAtom final + { + public: + explicit CFAtom() = default; + ~CFAtom() = default; + + public: + CFAtom& operator=(const CFAtom&) = delete; + CFAtom(const CFAtom&) = delete; + + public: + T operator[](SizeT bit) + { + return (fArrayOfAtoms & (1 << bit)); + } + + void operator|(SizeT bit) + { + fArrayOfAtoms |= (1 << bit); + } + + friend Boolean operator==(CFAtom<T>& atomic, const T& idx) + { + return atomic[idx] == idx; + } + + friend Boolean operator!=(CFAtom<T>& atomic, const T& idx) + { + return atomic[idx] == idx; + } + + private: + T fArrayOfAtoms; + }; +} // namespace LibCF diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h new file mode 100644 index 00000000..6de3df0b --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h @@ -0,0 +1,78 @@ + +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + + FILE: Foundation.h + PURPOSE: Foundation header of the CF framework. + +------------------------------------------- */ + +#pragma once + +#include <SCIKit/SCI.h> + +namespace LibCF +{ + class CFString; + class CFGUID; + class CFProperty; + class CFObject; + template <typename T> + class CFRef; + class CFFont; + struct CFPoint; + struct CFRect; + struct CFColor; + +#ifndef __LP64__ + typedef SInt32 CFInteger; + typedef float CFReal; +#else + typedef SInt64 CFInteger; + typedef double CFReal; +#endif + + typedef SInt32 CFInteger32; + typedef SInt64 CFInteger64; + + typedef char CFChar8; + typedef char16_t CFChar16; + + struct CFPoint + { + CFInteger64 x_1{0UL}; + CFInteger64 y_1{0UL}; + + CFInteger64 x_2{0UL}; + CFInteger64 y_2{0UL}; + CFReal ang{0UL}; + + operator bool(); + + /// @brief Check if point is within the current CFPoint. + /// @param point the current point to check. + /// @retval true if point is within this point. + /// @retval validations failed. + bool IsWithin(CFPoint& point); + }; + + struct CFColor final + { + CFInteger64 r, g, b, a{0}; + }; + + struct CFRect final + { + CFInteger64 x{0UL}; + CFInteger64 y{0UL}; + + CFInteger64 width{0UL}; + CFInteger64 height{0UL}; + + operator bool(); + + BOOL SizeMatches(CFRect& rect) noexcept; + BOOL PositionMatches(CFRect& rect) noexcept; + }; +} // namespace LibCF
\ No newline at end of file diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Object.h b/public/frameworks/CoreFoundation.fwrk/headers/Object.h new file mode 100644 index 00000000..7b8f3777 --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/Object.h @@ -0,0 +1,26 @@ + +/* ------------------------------------------- + + Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include <CoreFoundation.fwrk/headers/Foundation.h> + +#define CF_OBJECT : public LibCF::CFObject + +namespace LibCF +{ + class CFObject; + + class CFObject + { + public: + explicit CFObject() = default; + virtual ~CFObject() = default; + + SCI_COPY_DEFAULT(CFObject); + }; +} // namespace LibCF
\ No newline at end of file diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Property.h b/public/frameworks/CoreFoundation.fwrk/headers/Property.h new file mode 100644 index 00000000..f1a5c24e --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/Property.h @@ -0,0 +1,53 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef _PROPS_H +#define _PROPS_H + +#include <SCIKit/SCI.h> +#include <CoreFoundation.fwrk/headers/Ref.h> + +#define kMaxPropLen (256U) + +namespace LibCF +{ + class CFString; + class CFProperty; + class CFGUID; + + template <typename Cls, SizeT N> + class CFArray; + + /// @brief handle to anything (number, ptr, string...) + using CFPropertyId = UIntPtr; + + /// @brief User property class. + /// @example /prop/foo or /prop/bar + class CFProperty final CF_OBJECT + { + public: + CFProperty(); + virtual ~CFProperty(); + + public: + CFProperty& operator=(const CFProperty&) = default; + CFProperty(const CFProperty&) = default; + + Bool StringEquals(CFString& name); + CFPropertyId& GetValue(); + CFString& GetKey(); + + private: + CFString* fName{nullptr}; + CFPropertyId fValue{0UL}; + Ref<CFGUID> fGUID{}; + }; + + template <SizeT N> + using CFPropertyArray = CFArray<CFProperty, N>; +} // namespace LibCF + +#endif // !CFKIT_PROPS_H diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Ref.h b/public/frameworks/CoreFoundation.fwrk/headers/Ref.h new file mode 100644 index 00000000..074b5086 --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/Ref.h @@ -0,0 +1,110 @@ + +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef _REF_H_ +#define _REF_H_ + +#include <SCIKit/SCI.h> +#include <CoreFoundation.fwrk/headers/Object.h> + +namespace LibCF +{ + template <typename T> + class CFRef; + + template <typename T> + class CFRef final CF_OBJECT + { + public: + CFRef() = default; + + ~CFRef() + { + if (MmGetHeapFlags(fClass) != -1) + delete fClass; + } + + public: + CFRef(T* cls) + : fClass(cls) + { + } + + CFRef(T cls) + : fClass(&cls) + { + } + + CFRef& operator=(T ref) + { + if (!fClass) + return *this; + + fClass = &ref; + return *this; + } + + public: + T operator->() const + { + MUST_PASS(*fClass); + return *fClass; + } + + T& Leak() noexcept + { + return *fClass; + } + + T& TryLeak() const noexcept + { + MUST_PASS(*fClass); + return *fClass; + } + + T operator*() + { + return *fClass; + } + + operator bool() noexcept + { + return fClass; + } + + private: + T* fClass{nullptr}; + }; + + template <typename T> + class CFNonNullRef final + { + public: + CFNonNullRef() = delete; + CFNonNullRef(nullPtr) = delete; + + CFNonNullRef(T* ref) + : fRef(ref) + { + MUST_PASS(ref); + } + + CFRef<T>& operator->() + { + MUST_PASS(fRef); + return fRef; + } + + CFNonNullRef& operator=(const CFNonNullRef<T>& ref) = delete; + CFNonNullRef(const CFNonNullRef<T>& ref) = default; + + private: + CFRef<T> fRef{nullptr}; + }; +} // namespace LibCF + +#endif // ifndef _NEWKIT_REF_H_ diff --git a/public/frameworks/CoreFoundation.fwrk/headers/String.h b/public/frameworks/CoreFoundation.fwrk/headers/String.h new file mode 100644 index 00000000..10ce01a9 --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/headers/String.h @@ -0,0 +1,20 @@ + +/* ------------------------------------------- + + Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include <CoreFoundation.fwrk/headers/Object.h> + +namespace LibCF +{ + class CFString; + + class CFString final CF_OBJECT + { + public: + }; +} // namespace LibCF
\ No newline at end of file diff --git a/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc b/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc new file mode 100644 index 00000000..219c3bfb --- /dev/null +++ b/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc @@ -0,0 +1,48 @@ +/* ------------------------------------------- + + Copyright (C) 2024 Amlal El Mahrouss, all rights reserved + +------------------------------------------- */ + +#include <CoreFoundation.fwrk/headers/Foundation.h> + +LibCF::CFRect::operator bool() +{ + return width > 0 && height > 0; +} + +/***********************************************************************************/ +/// @brief returns true if size matches. +/***********************************************************************************/ +BOOL LibCF::CFRect::SizeMatches(LibCF::CFRect& rect) noexcept +{ + return rect.height == height && rect.width == width; +} + +/***********************************************************************************/ +/// @brief returns true if position matches. +/***********************************************************************************/ +BOOL LibCF::CFRect::PositionMatches(LibCF::CFRect& rect) noexcept +{ + return rect.y == y && rect.x == x; +} + +/***********************************************************************************/ +/// @brief Check if point is within the current MLPoint. +/// @param point the current point to check. +/// @retval true if point is within this point. +/// @retval the validations have failed, false otherwise true. +/***********************************************************************************/ +BOOL LibCF::CFPoint::IsWithin(LibCF::CFPoint& withinOf) +{ + return x_1 >= withinOf.x_1 && x_2 <= (withinOf.x_2) && + y_1 >= withinOf.y_1 && y_2 <= (withinOf.y_2); +} + +/***********************************************************************************/ +/// @brief if Point object is correctly set up. +/***********************************************************************************/ +LibCF::CFPoint::operator bool() +{ + return x_1 > x_2 && y_1 > y_2; +}
\ No newline at end of file diff --git a/public/frameworks/DiskImage.fwrk/DiskImage.json b/public/frameworks/DiskImage.fwrk/DiskImage.json index 184d877e..0b97dafb 100644 --- a/public/frameworks/DiskImage.fwrk/DiskImage.json +++ b/public/frameworks/DiskImage.fwrk/DiskImage.json @@ -1,9 +1,9 @@ { "compiler_path": "x86_64-w64-mingw32-g++", "compiler_std": "c++20", - "headers_path": ["../", "./", "../../../dev", "../../../dev/Kernel"], + "headers_path": ["../", "./", "../../../dev", "../../../dev/kernel"], "sources_path": ["src/*.cc"], - "output_name": "libDiskImage.dylib", + "output_name": "./dist/libDiskImage.dylib", "compiler_flags": [ "-fPIC", "-ffreestanding", diff --git a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h index fb05154d..a029b43a 100644 --- a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h +++ b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h @@ -9,7 +9,7 @@ #pragma once -#include <LibSCI/SCI.h> +#include <SCIKit/SCI.h> #define kDISectorSz (512) #define kDIMinDiskSz (1024 * 1024 * 1024) diff --git a/public/tools/cc/src/CommandLine.cc b/public/tools/cc/src/CommandLine.cc index 3efa5301..226554cc 100644 --- a/public/tools/cc/src/CommandLine.cc +++ b/public/tools/cc/src/CommandLine.cc @@ -4,12 +4,12 @@ * Copyright (c) 2024 Amlal EL Mahrouss */ -#include <LibSCI/SCI.h> +#include <SCIKit/SCI.h> /// @brief This program loads a program for NeOS. SInt32 main(SInt32 argc, Char* argv[]) { - ConOut(nullptr, "LD: OpenCC or GCC for Ne needs to be installed.\rLD: This program is present as a placeholder."); + PrintOut(nullptr, "cc: A C++ compiler to be installed.\rcc: This program is present as a placeholder."); return EXIT_FAILURE; } diff --git a/public/tools/diutil/diutil.json b/public/tools/diutil/diutil.json index bdbec529..fce2166e 100644 --- a/public/tools/diutil/diutil.json +++ b/public/tools/diutil/diutil.json @@ -1,7 +1,7 @@ { "compiler_path": "g++", "compiler_std": "c++20", - "headers_path": ["./", "../../../dev/Kernel", "../../../dev/", "./"], + "headers_path": ["./", "../../../dev/kernel", "../../../dev/", "./"], "sources_path": ["CommandLine.cc"], "output_name": "./dist/diutil", "cpp_macros": [ diff --git a/public/tools/ld/src/CommandLine.cc b/public/tools/ld/src/CommandLine.cc index 3efa5301..a6f98ee1 100644 --- a/public/tools/ld/src/CommandLine.cc +++ b/public/tools/ld/src/CommandLine.cc @@ -4,12 +4,12 @@ * Copyright (c) 2024 Amlal EL Mahrouss */ -#include <LibSCI/SCI.h> +#include <SCIKit/SCI.h> /// @brief This program loads a program for NeOS. SInt32 main(SInt32 argc, Char* argv[]) { - ConOut(nullptr, "LD: OpenCC or GCC for Ne needs to be installed.\rLD: This program is present as a placeholder."); + PrintOut(nullptr, "ld: A linker to be installed.\rld: This program is present as a placeholder."); return EXIT_FAILURE; } diff --git a/public/tools/make_app/Common.h b/public/tools/make_app/Common.h index a49f0cda..860cdd48 100644 --- a/public/tools/make_app/Common.h +++ b/public/tools/make_app/Common.h @@ -6,7 +6,7 @@ #ifndef APPS_COMMON_H #define APPS_COMMON_H -#include <LibSCI/SCI.h> -#include <LibCF/Foundation.h> +#include <SCIKit/SCI.h> +#include <CoreFoundation.fwrk/headers/Foundation.h> #endif // APPS_COMMON_H diff --git a/public/tools/make_app/src/CommandLine.cc b/public/tools/make_app/src/CommandLine.cc index 49be4795..0cc40106 100644 --- a/public/tools/make_app/src/CommandLine.cc +++ b/public/tools/make_app/src/CommandLine.cc @@ -7,7 +7,7 @@ #include <Framework.h> #include <Steps.h> -#include <LibCF/Array.h> +#include <CoreFoundation.fwrk/headers/Array.h> /// @brief This program makes a framework directory for NeKernel OS. @@ -21,17 +21,12 @@ int main(int argc, char* argv[]) { if (MmStrCmp(argv[i], "-h") == 0) { - MsgAlloc(kWarnMsg); + PrintOut(nullptr, "%s", "make_app: Framework/Application Creation Tool.\n"); + PrintOut(nullptr, "%s", "make_app: © Amlal EL Mahrouss, All rights reserved.\n"); - MsgSend(kWarnMsg, "%s", "make_app: Framework/Application Creation Tool.\n"); - MsgSend(kWarnMsg, "%s", "make_app: © Amlal EL Mahrouss, All rights reserved.\n"); - - MsgSend(kWarnMsg, "%s", "make_app: -a: Application format.\n"); - MsgSend(kWarnMsg, "%s", "make_app: -s: Steps (Setup pages) format.\n"); - MsgSend(kWarnMsg, "%s", "make_app: -f: Framework format.\n"); - - MsgShow(kWarnMsg); - MsgFree(kWarnMsg); + PrintOut(nullptr, "%s", "make_app: -a: Application format.\n"); + PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) format.\n"); + PrintOut(nullptr, "%s", "make_app: -f: Framework format.\n"); return EXIT_SUCCESS; } diff --git a/public/tools/open/src/CommandLine.cc b/public/tools/open/src/CommandLine.cc index a2439e40..746622fa 100644 --- a/public/tools/open/src/CommandLine.cc +++ b/public/tools/open/src/CommandLine.cc @@ -4,7 +4,7 @@ * Copyright (c) 2024 Amlal EL Mahrouss */ -#include <LibSCI/SCI.h> +#include <SCIKit/SCI.h> /// @brief This program opens an application from **OPEN_APP_BASE_PATH** @@ -21,10 +21,10 @@ int main(int argc, char* argv[]) { if (MmStrCmp(argv[i], OPEN_APP_HELP_FLAG) == 0) { - ConOut(nullptr, "open: Open Tool.\n"); - ConOut(nullptr, "open: © Amlal EL Mahrouss, All rights reserved.\n"); + PrintOut(nullptr, "open: Open Tool.\n"); + PrintOut(nullptr, "open: © Amlal EL Mahrouss, All rights reserved.\n"); - ConOut(nullptr, "open: %s: Application is taken as input (opens a PEF/PE32+/ELF program depending on architecture).\n", OPEN_APP_APP_FLAG); + PrintOut(nullptr, "open: %s: Application is taken as input (opens a PEF/PE32+/ELF program depending on architecture).\n", OPEN_APP_APP_FLAG); return EXIT_SUCCESS; } |
