From 09dd11ddf800898c00ecb04a65fb5cd10fb481fa Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 8 May 2024 12:32:41 +0200 Subject: MHR-23: :boom: changes, reworked project tree. Signed-off-by: Amlal El Mahrouss --- Public/Developer/SystemLib/Headers/Alert.h | 21 --- Public/Developer/SystemLib/Headers/Defines.h | 230 --------------------------- Public/Developer/SystemLib/Headers/File.h | 52 ------ Public/Developer/SystemLib/Headers/Heap.h | 39 ----- Public/Developer/SystemLib/Headers/Hint.h | 20 --- Public/Developer/SystemLib/Headers/Intl.h | 24 --- Public/Developer/SystemLib/Headers/Math.h | 27 ---- Public/Developer/SystemLib/Headers/Rsrc.h | 9 -- Public/Developer/SystemLib/Headers/Thread.h | 47 ------ 9 files changed, 469 deletions(-) delete mode 100644 Public/Developer/SystemLib/Headers/Alert.h delete mode 100644 Public/Developer/SystemLib/Headers/Defines.h delete mode 100644 Public/Developer/SystemLib/Headers/File.h delete mode 100644 Public/Developer/SystemLib/Headers/Heap.h delete mode 100644 Public/Developer/SystemLib/Headers/Hint.h delete mode 100644 Public/Developer/SystemLib/Headers/Intl.h delete mode 100644 Public/Developer/SystemLib/Headers/Math.h delete mode 100644 Public/Developer/SystemLib/Headers/Rsrc.h delete mode 100644 Public/Developer/SystemLib/Headers/Thread.h (limited to 'Public/Developer/SystemLib/Headers') diff --git a/Public/Developer/SystemLib/Headers/Alert.h b/Public/Developer/SystemLib/Headers/Alert.h deleted file mode 100644 index 443b6829..00000000 --- a/Public/Developer/SystemLib/Headers/Alert.h +++ /dev/null @@ -1,21 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -/************************************************************* - * - * File: Alert.h - * Purpose: New OS alert dialog. - * Date: 3/26/24 - * - * Copyright Mahrouss Logic, all rights reserved. - * - *************************************************************/ - -#pragma once - -#include - -CA_EXTERN_C VoidType Alert(const CharacterTypeUTF8* fmt, ...); diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h deleted file mode 100644 index 07e0cfeb..00000000 --- a/Public/Developer/SystemLib/Headers/Defines.h +++ /dev/null @@ -1,230 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#ifdef CA_MUST_PASS -#undef CA_MUST_PASS -#endif - -#ifdef _DEBUG -#define CA_MUST_PASS(e) \ - { \ - if (!e) \ - { \ - Alert("Sorry, an assertion failed.\nFile: %s\nLine: %i", __FILE__, __LINE__) RtAssertTriggerInterrupt() \ - } \ - } -#else -#define CA_MUST_PASS(e) CA_UNREFERENCED_PARAMETER(e) -#endif - -#ifdef __cplusplus - -#define CA_EXTERN_C extern "C" - -#else - -#define CA_EXTERN_C extern - -#endif - -struct ApplicationInterface; -struct GUID; - -CA_EXTERN_C void RtAssertTriggerInterrupt(void); - -#define CA_STDCALL __attribute__((stdcall)) -#define CA_CDECL __attribute__((cdecl)) -#define CA_MSCALL __attribute__((ms_abi)) - -#define PACKED __attribute__((packed)) - -#define CA_PASCAL CA_STDCALL - -#include - -typedef __UINT8_TYPE__ ByteType; -typedef __UINT16_TYPE__ WordType; -typedef __UINT32_TYPE__ DWordType; -typedef __UINT64_TYPE__ QWordType; -typedef __SIZE_TYPE__ SizeType; - -typedef char CharacterTypeUTF8; -typedef CharacterTypeUTF8* PtrCharacterType; - -typedef void* PtrVoidType; -typedef void VoidType; - -#ifdef __SINGLE_PRECISION__ -typedef float FloatType; -typedef float PositionType; -#else -typedef double FloatType; -typedef double PositionType; -#endif - -typedef __UINTPTR_TYPE__ UIntPtrType; -typedef __INTPTR_TYPE__ IntPtrType; -typedef __UINT64_TYPE__ UInt64Type; -typedef __INT64_TYPE__ Int64Type; -typedef __UINT32_TYPE__ UInt32Type; -typedef __INT32_TYPE__ Int32Type; - -typedef CharacterTypeUTF8 BooleanType; - -#define Yes 1 -#define No 0 - -#define CA_PTR * - -#define CA_UNREFERENCED_PARAMETER(e) ((VoidType)(e)) - -#ifdef __x86_64__ - -#define CA_FAR __far -#define CA_NEAR __near - -#define _M_AMD64 2 -#else - -#define CA_FAR -#define CA_NEAR - -#endif - -#ifdef __aarch64__ -#define _M_AARCH64 3 -#endif - -#ifdef __powerpc64__ -#define _M_PPC64 4 -#endif - -#ifdef __64x0__ -#define _M_64000 5 -#endif - -#ifdef __riscv__ -#define _M_RISCV 6 -#endif - -#define CA_STATIC static -#define CA_INLINE inline -#define CA_CONST const - -#ifdef __cplusplus -#define CA_CONSTEXPR constexpr -#else -#define CA_CONSTEXPR -#endif // __cplusplus - -enum RtProcessCall -{ - kCallAllocPtr = 1, - kCallFreePtr, - kCallSizePtr, - kCallCheckPtr, - kCallAllocStack, - /// @brief Open a specific handle - /// (can be used as sel to call methods related to it.) - kCallOpenFile, - kCallCloseFile, - kCallOpenDir, - kCallCloseDir, - kCallOpenDevice, - kCallCloseDevice, - kCallCreateWindow, - kCallCloseWindow, - kCallCreateMenu, - kCallCloseMenu, - kCallRandomNumberGenerator, - kCallGetArgsCount, - kCallGetArgsPtr, - /// @brief Number of process calls. - kCallsCount, -}; - -/** - * @brief GUID type, something you can also find in CFKit. - * @author Amlal El Mahrouss - */ -typedef struct GUID -{ - DWordType Data1; - WordType Data2; - WordType Data3; - ByteType Data4[8]; -} GUIDType, *PtrGUIDType; - -/// \brief Application Interface. -/// \author Amlal El Mahrouss -typedef struct ApplicationInterface -{ - VoidType (*Release)(struct ApplicationInterface* Self, DWordType ExitCode); - IntPtrType (*Invoke)(struct ApplicationInterface* Self, DWordType Sel, ...); - VoidType (*Query)(struct ApplicationInterface* Self, PtrVoidType* Dst, SizeType SzDst, struct GUID* GuidOf); -} ApplicationInterface, *ApplicationInterfaceRef; - -#ifdef __cplusplus - -#define CA_COPY_DELETE(KLASS) \ - KLASS& operator=(const KLASS&) = delete; \ - KLASS(const KLASS&) = delete; - -#define CA_COPY_DEFAULT(KLASS) \ - KLASS& operator=(const KLASS&) = default; \ - KLASS(const KLASS&) = default; - -#define CA_MOVE_DELETE(KLASS) \ - KLASS& operator=(KLASS&&) = delete; \ - KLASS(KLASS&&) = delete; - -#define CA_MOVE_DEFAULT(KLASS) \ - KLASS& operator=(KLASS&&) = default; \ - KLASS(KLASS&&) = default; - -#define app_cast reinterpret_cast - -template -using StrType = CharacterTypeUTF8[N]; - -#else - -#define app_cast (ApplicationInterfaceRef) - -#endif // ifdef C++ - -/// @brief Get app singleton. -/// @param -/// @return -CA_EXTERN_C ApplicationInterfaceRef RtGetAppPointer(VoidType); - -/// @brief Get argument count -/// @param -/// @return -CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType); - -/// @brief Get argument pointer. -/// @param -/// @return -CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType); - -CA_EXTERN_C ApplicationInterfaceRef kSharedApplication; - -typedef CharacterTypeUTF8 StrType255[255]; - -#define True 1 -#define False 0 -#define Bool BooleanType - -#define NullPtr ((PtrVoidType)0) - -#ifndef kInvalidRef -#define kInvalidRef 0 -#endif - -#include diff --git a/Public/Developer/SystemLib/Headers/File.h b/Public/Developer/SystemLib/Headers/File.h deleted file mode 100644 index 6b0bb29b..00000000 --- a/Public/Developer/SystemLib/Headers/File.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include - -/// @brief Filesystem wrapper. - -typedef QWordType FSRef; - -/// @brief Opens a new file. -/// @param path where to find it. -/// @param rest the restrict (rw, rwe, r+, w+, r, w) -/// @return FSRef the file. -CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r); - -/// @brief Closes the file and flushes it to the said file. -/// @param refFs the filesystem reference. -/// @return -CA_EXTERN_C VoidType FsCloseFile(FSRef refFs); - -#define kMaxForkNameLength 256 /* long fork names. */ - -/// @brief A fork information header. -typedef struct _Fork -{ - PtrVoidType forkData; - SizeType forkSize; - Int32Type forkFlags; - Int32Type forkKind; - CharacterTypeUTF8 forkName[kMaxForkNameLength]; -} ForkType; - -typedef ForkType* FSForkRef; - -/// @brief Gets the fork inside a file. -/// @param refFs the filesystem ref -/// @param forkName the fork's name -/// @return the fork data. -CA_EXTERN_C FSForkRef FsGetFork(FSRef refFs, const CharacterTypeUTF8* forkName); - -/// @brief Check if the filesystem path is valid. -/// @return if not return false, or true. -CA_EXTERN_C BooleanType FsIsValidPath(const CharacterTypeUTF8* path); - -/// @note not only limited to, there is code forks, icon forks... -#define FsGetDataFork(refFs) FsGetFork(refFs, "data") -#define FsGetRsrcFork(refFs) FsGetFork(refFs, "rsrc") diff --git a/Public/Developer/SystemLib/Headers/Heap.h b/Public/Developer/SystemLib/Headers/Heap.h deleted file mode 100644 index 511eaa1b..00000000 --- a/Public/Developer/SystemLib/Headers/Heap.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include - -#define kAllocationTypes 2 - -enum RtAllocationKind -{ - kStandardAllocation = 0xC, - kArrayAllocation = 0xD, -}; - -/// @brief Allocates a new pointer from process pool. -/// @param sz the size -/// @param flags the allocation flags. -/// @return -CA_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz, - DWordType flags); - -/// @brief Check if the pointer exists. -/// @param ptr the pointer to free. -/// @return -CA_EXTERN_C BooleanType RtTlsPtrExists(PtrVoidType ptr); - -/// @brief Gets the size of the process' pointer. -/// @param ptr the pointer to free. -/// @return -CA_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr); - -/// @brief Frees the process pointer. -/// @param ptr the pointer to free. -/// @return -CA_EXTERN_C VoidType RtTlsFree(PtrVoidType ptr); diff --git a/Public/Developer/SystemLib/Headers/Hint.h b/Public/Developer/SystemLib/Headers/Hint.h deleted file mode 100644 index 843407e0..00000000 --- a/Public/Developer/SystemLib/Headers/Hint.h +++ /dev/null @@ -1,20 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#pragma compiler(hint_manifest) - -#define _Input -#define _Output - -#define _Optional - -#define _StrictCheckInput -#define _StrictCheckOutput - -#define _InOut -#define _StrictInOut diff --git a/Public/Developer/SystemLib/Headers/Intl.h b/Public/Developer/SystemLib/Headers/Intl.h deleted file mode 100644 index 2e91812e..00000000 --- a/Public/Developer/SystemLib/Headers/Intl.h +++ /dev/null @@ -1,24 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -/// @brief Intlization primitives. - -#include - -typedef UInt64Type IntlRef; - -/// @brief locale getter and setters. - -IntlRef IntlGetLocale(const char* name); -BooleanType IntlSetLocale(const IntlRef intl); - -/// @brief locale helpers. - -/// @brief translate a string from a locale. -const CharacterTypeUTF8* Intl(const CharacterTypeUTF8* input, - const IntlRef locale); diff --git a/Public/Developer/SystemLib/Headers/Math.h b/Public/Developer/SystemLib/Headers/Math.h deleted file mode 100644 index 4f54563b..00000000 --- a/Public/Developer/SystemLib/Headers/Math.h +++ /dev/null @@ -1,27 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include - -/////////////////////////////////////////////////////////////////////// -/// Random functions /// -/////////////////////////////////////////////////////////////////////// - -/// @brief Number generator helper. -/// @return Random generated number. -CA_EXTERN_C SizeType MathRand(VoidType); - -/////////////////////////////////////////////////////////////////////// -/// Mathematical functions /// -/////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C FloatType Sqrt(FloatType number); - -CA_EXTERN_C FloatType Cosine(FloatType number); -CA_EXTERN_C FloatType Sine(FloatType number); -CA_EXTERN_C FloatType Tangent(FloatType number); \ No newline at end of file diff --git a/Public/Developer/SystemLib/Headers/Rsrc.h b/Public/Developer/SystemLib/Headers/Rsrc.h deleted file mode 100644 index 1ff71332..00000000 --- a/Public/Developer/SystemLib/Headers/Rsrc.h +++ /dev/null @@ -1,9 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include diff --git a/Public/Developer/SystemLib/Headers/Thread.h b/Public/Developer/SystemLib/Headers/Thread.h deleted file mode 100644 index 9562003e..00000000 --- a/Public/Developer/SystemLib/Headers/Thread.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -// -// Created by Amlal on 3/18/24 -// - -#ifndef __THREAD__ -#define __THREAD__ - -#include - -#define kThreadErrorExit (-33) - -/// @brief Thread reference. -typedef QWordType ThreadRef; - -/// @brief Main application thread. -CA_EXTERN_C ThreadRef kMainThread; - -typedef VoidType (*ThreadEntrypointKind)(VoidType); - -/// @brief Creates a new thread, and runs the code. -/// @param threadName the thread's name. -/// @param threadStart where to start. -/// @return -CA_EXTERN_C ThreadRef CTCreate(const CharacterTypeUTF8* threadName, ThreadEntrypointKind threadStart); - -/// @brief Dispoes the thread, and exits with code kThreadErrorExit -/// @param ref the thread reference. -/// @return nothing. -CA_EXTERN_C VoidType CTRelease(ThreadRef ref); - -/// @brief Waits for the thread to complete. -/// @param ref the thread reference. -/// @return nothing. -CA_EXTERN_C VoidType CTJoin(ThreadRef ref); - -/// @brief Yields the current thread. -/// @param ref the thead reference. -/// @return -CA_EXTERN_C VoidType CTYield(ThreadRef ref); - -#endif // __THREAD__ -- cgit v1.2.3