diff options
Diffstat (limited to 'Public/Developer/SystemLib')
25 files changed, 0 insertions, 1005 deletions
diff --git a/Public/Developer/SystemLib/.gitkeep b/Public/Developer/SystemLib/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Public/Developer/SystemLib/.gitkeep +++ /dev/null diff --git a/Public/Developer/SystemLib/AMD64/CoreAssembly.s b/Public/Developer/SystemLib/AMD64/CoreAssembly.s deleted file mode 100644 index 58fa3c28..00000000 --- a/Public/Developer/SystemLib/AMD64/CoreAssembly.s +++ /dev/null @@ -1,28 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - Purpose: AMD64 low level I/O - -------------------------------------------- */ - -.text - -.globl RtGetAppPointer -.globl RtAssertTriggerInterrupt - -/* @brief Application getter */ -/* @throws: ApptError: appartement error. */ -RtGetAppPointer: - mov $0x10, %rcx /* sysGetProcessObject */ - int $0x32 - - /* rax gets saved and returned. */ - ret - -RtAssertTriggerInterrupt: - mov $0x11, %rcx /* sysTerminateCurrentProcess */ - int $0x32 - - ret - diff --git a/Public/Developer/SystemLib/ARM64/.gitkeep b/Public/Developer/SystemLib/ARM64/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Public/Developer/SystemLib/ARM64/.gitkeep +++ /dev/null diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h deleted file mode 100644 index 57bfffdf..00000000 --- a/Public/Developer/SystemLib/Headers/Defines.h +++ /dev/null @@ -1,222 +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) { DlgMsgBox("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 Application; -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 - -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, - kCallGetArgsCount, - kCallGetArgsPtr, - /// @brief Number of process calls. - kCallsCount, -}; - -#include <Headers/Hint.h> -#include <Headers/Dialog.h> - -/** - * @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 Application { - VoidType(*Release)(struct Application* Self, DWordType ExitCode); - IntPtrType(*Invoke)(struct Application* Self, DWordType Sel, ...); - VoidType(*Query)(struct Application* Self, PtrVoidType* Dst, SizeType SzDst, struct GUID* GuidOf); -} Application, *ApplicationRef; - -#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<ApplicationRef> - -template <SizeType N> -using StrType = CharacterTypeUTF8[N]; - -#else - -#define app_cast (ApplicationRef) - -#endif // ifdef C++ - -/// @brief Get app singleton. -/// @param -/// @return -CA_EXTERN_C ApplicationRef 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 ApplicationRef kSharedApplication; - -typedef CharacterTypeUTF8 StrType255[255]; - -#define True 1 -#define False 0 -#define Bool BooleanType - -#define NullPtr ((PtrVoidType)0) - -#ifndef kInvalidRef -#define kInvalidRef 0 -#endif diff --git a/Public/Developer/SystemLib/Headers/Dialog.h b/Public/Developer/SystemLib/Headers/Dialog.h deleted file mode 100644 index 823b3366..00000000 --- a/Public/Developer/SystemLib/Headers/Dialog.h +++ /dev/null @@ -1,44 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Wm.h> - -struct _DialogPort; -struct _DialogPoint; - -/// @brief Dialog procedure type. -typedef VoidType(*WmDialogFn)(struct _DialogPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam); - -/// @brief A point, can represent the size, position of a window. -typedef struct _DialogPoint { - PositionType X, Y; -} DialogPoint; - -typedef struct _DialogPort { - WordType dlgPort; - WordType dlgKind; - BooleanType dlgVisible : 1; - BooleanType dlgMoving : 1; - DialogPoint dlgPosition; - WmDialogFn dlgProc; - struct _WmGFX* dlgGfx; - struct _WmWindowPort* parentPort; -} DialogPort; - -/// @brief Creates a new dialog from a rsrc fork id. -/// @param rsrcId the resource id. -/// @return the dialog port. -CA_EXTERN_C DialogPort* DlgCreateFromRsrc(QWordType rsrcId); - -/// @brief Shows an message box according to format. -/// @param title the message box title -/// @param format the format -/// @param va_list the va args, that goes along with it. -/// @return 0: the user clicked Ok -/// @return > 0: User clicked on specific button. -CA_EXTERN_C Int32Type DlgMsgBox(const CharacterTypeUTF8* title, const CharacterTypeUTF8* format, ...); diff --git a/Public/Developer/SystemLib/Headers/Draw.h b/Public/Developer/SystemLib/Headers/Draw.h deleted file mode 100644 index 38f99e7d..00000000 --- a/Public/Developer/SystemLib/Headers/Draw.h +++ /dev/null @@ -1,20 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Wm.h> - -/************************************************************* - * - * File: Draw.h - * Purpose: Draw Manager API for NewOS. - * Date: 3/26/24 - * - * Copyright Mahrouss Logic, all rights reserved. - * - *************************************************************/ - diff --git a/Public/Developer/SystemLib/Headers/File.h b/Public/Developer/SystemLib/Headers/File.h deleted file mode 100644 index 234c33da..00000000 --- a/Public/Developer/SystemLib/Headers/File.h +++ /dev/null @@ -1,51 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Defines.h> - -/// @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 1c8873bd..00000000 --- a/Public/Developer/SystemLib/Headers/Heap.h +++ /dev/null @@ -1,38 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Defines.h> - -#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 86faf455..00000000 --- a/Public/Developer/SystemLib/Headers/Hint.h +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#define _Input -#define _Output - -#define _Optional - -#define _StrictCheckInput -#define _StrictCheckOutput - -#define _InOut -#define _StrictInOut diff --git a/Public/Developer/SystemLib/Headers/Math.h b/Public/Developer/SystemLib/Headers/Math.h deleted file mode 100644 index 34738cd1..00000000 --- a/Public/Developer/SystemLib/Headers/Math.h +++ /dev/null @@ -1,12 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Defines.h> - -/// @brief Random nubmer generator. -CA_EXTERN_C SizeType MathRand(VoidType); 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 <Headers/Defines.h> diff --git a/Public/Developer/SystemLib/Headers/Thread.h b/Public/Developer/SystemLib/Headers/Thread.h deleted file mode 100644 index 4a54d841..00000000 --- a/Public/Developer/SystemLib/Headers/Thread.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -// -// Created by Amlal on 3/18/24 -// - -#ifndef __THREAD__ -#define __THREAD__ - -#include <Headers/Defines.h> - -#define kThreadErrorExit -33 - -/// @brief Thread Information Block, which holds information about the running -/// thread. -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 TmCreateThread(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 TmDisposeThread(ThreadRef ref); - -/// @brief Waits for the thread to complete. -/// @param ref the thread reference. -/// @return nothing. -CA_EXTERN_C VoidType TmWaitForCompletion(ThreadRef ref); - -#endif // __THREAD__ diff --git a/Public/Developer/SystemLib/Headers/TrueType.h b/Public/Developer/SystemLib/Headers/TrueType.h deleted file mode 100644 index 6387e58f..00000000 --- a/Public/Developer/SystemLib/Headers/TrueType.h +++ /dev/null @@ -1,38 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Wm.h> - -/************************************************************* - * - * File: TrueType.h - * Purpose: TrueType font implementation for NewOS. - * Date: 3/26/24 - * - * Copyright Mahrouss Logic, all rights reserved. - * - *************************************************************/ - -typedef QWordType TTFFontRef; - -/// @brief Loads a new font into app's memory. -/// @param name -/// @return -CA_EXTERN_C TTFFontRef FnCreateFont(const CharacterTypeUTF8* name); - -/// @brief Dispose an allocated font. -/// @param fon -/// @return -CA_EXTERN_C VoidType FnDisposeFont(TTFFontRef fon); - -/// @brief Gets the font gylph for character. -/// @param fon -/// @return -CA_EXTERN_C PtrVoidType FnGetGlyph(TTFFontRef fon, UInt32Type utfCh); - -/// TODO: Get font metadata.
\ No newline at end of file diff --git a/Public/Developer/SystemLib/Headers/Wm.h b/Public/Developer/SystemLib/Headers/Wm.h deleted file mode 100644 index 609e89ac..00000000 --- a/Public/Developer/SystemLib/Headers/Wm.h +++ /dev/null @@ -1,167 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <Headers/Defines.h> -#include "Headers/Dialog.h" - -/************************************************************* - * - * File: Wm.h - * Purpose: Window Manager API for NewOS. - * Date: 3/26/24 - * - * Copyright Mahrouss Logic, all rights reserved. - * - *************************************************************/ - -struct _WmPoint; -struct _WmWindowPort; -struct _WmGFX; -struct _WmControlPort; -struct _WmPoint; - -/// @brief Window Graphics type. -typedef struct _WmGFX { - UInt32Type Depth; - UInt32Type* DataFrame; - SizeType DataFrameWidth; - SizeType DataFrameHeight; -} WmGFX, *WmGFXRef; - -/// @brief Window procedure type. -typedef VoidType(*WmWindowFn)(struct _WmWindowPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam); - -/// @brief A point, can represent the size, position of a window. -typedef struct _WmPoint { - PositionType X, Y; -} WmPoint; - - -/// @brief Window port type, can be used to control the window. -typedef struct _WmWindowPort { - WordType windowPort; - WordType windowKind; - BooleanType windowVisible : 1; - BooleanType windowMaximized : 1; - BooleanType windowMinimized : 1; - BooleanType windowMoving : 1; - BooleanType windowDisableClose : 1; - BooleanType windowDisableMinimize : 1; - BooleanType windowInvalidate : 1; - WmPoint windowPosition; - WmPoint windowSize; - WmGFXRef windowGfx; - WmWindowFn windowProc; - struct _WmWindowPort* windowMenuPort; ///! Attached menu to it. - struct _WmWindowPort* windowParentPort; -} WindowPort; - -/// @brief Control port type. -typedef struct _WmControlPort { - WordType controlPort; - WordType controlKind; - BooleanType controlVisible : 1; - BooleanType controlMoving : 1; - WmPoint controlPosition; - WmWindowFn controlProc; - WmGFXRef controlGfx; - WindowPort* parentPort; -} WmControlPort; - -enum { - kWmErrIncompatible = 0x74, - kWmErrOutOfMemory, - kWmErrInvalidArg, - kWmErrNotImplemented, -}; - -/// @brief Color reference. -typedef UInt32Type ColorRef; - -/***********************************************************************************/ -/// Color utils. -/***********************************************************************************/ - -CA_EXTERN_C const ColorRef kRgbRed; -CA_EXTERN_C const ColorRef kRgbGreen; -CA_EXTERN_C const ColorRef kRgbBlue; -CA_EXTERN_C const ColorRef kRgbBlack; -CA_EXTERN_C const ColorRef kRgbWhite; - -/***********************************************************************************/ -/// Color macro. -/***********************************************************************************/ - -#define WmMakeColorRef(R, G, B) (ColorRef)(0x##R##G##B) - -#define kControlKindWindow 0 -#define kControlKindDialog 1 -#define kControlKindMenu 2 -#define kControlKindButton 3 -#define kControlKindLabel 4 -#define kControlKindDropdownMenu 5 -#define kControlKindIcon 6 -#define kControlKindRadioBox 7 -#define kControlKindCheckBox 8 -#define kControlKindUserDefined 9 - -/// @brief Creates a new control -/// @param id the control rsrc fork. -/// @return -CA_EXTERN_C WmControlPort* WmCreateControl(DWordType id); - -/// @brief Releases the control -/// @param ctrlPort the control ref. -/// @return -CA_EXTERN_C VoidType WmReleaseControl(WmControlPort* ctrlPort); - -/// @brief Moves a control inside a WmControlPort. -/// @param ctrlPort the control ref. -/// @param where where to move at. -/// @return -CA_EXTERN_C Int32Type WmSetControlPosition(WmControlPort* ctrlPort, WmPoint where); - -/// @brief Enable control. -/// @param ctrlPort -/// @param enabled -/// @return -CA_EXTERN_C Int32Type WmSetControlEnabled(WmControlPort* ctrlPort, BooleanType enabled); - -/// @brief Make control visible. -/// @param ctrlPort -/// @param visible -/// @return -CA_EXTERN_C Int32Type WmSetControlVisible(WmControlPort* ctrlPort, BooleanType visible); - -/// @brief Creates a new window. -/// @param name the window name -/// @param rsrcId the window fork rsrc ctrlPort. -/// @return the window graphics port. -CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, const DWordType rsrcId); - -/// @brief Creates a new menu -/// @param name the menu's name -/// @param rsrcId the menu fork rsrc ctrlPort. -/// @return the menu graphics port. -CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, const DWordType rsrcId); - -/// @brief Releases the window. -/// @param port the window port. -/// @return void -CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* port); - -/// @brief Releases the menu -/// @param port the menu port. -/// @return void -CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* port); - -/// @brief Moves a window on the desktop. (menu arent movable, will return kErrIncompatible if menu is provided.) -/// @param wndPort the gfx port. -/// @param where to move. -/// @return error code. -CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where); diff --git a/Public/Developer/SystemLib/POWER/CoreAssembly.s b/Public/Developer/SystemLib/POWER/CoreAssembly.s deleted file mode 100644 index 99605870..00000000 --- a/Public/Developer/SystemLib/POWER/CoreAssembly.s +++ /dev/null @@ -1,23 +0,0 @@ -; /* ------------------------------------------- -; -; Copyright Mahrouss Logic -; -; Purpose: POWER low level I/O -; -; ------------------------------------------- */ - -/* @brief Application getter */ -/* @throws: ApptError: appartement error. */ -export .code64 RtGetAppPointer: - mflr r3 - stw 0x10, 0(r3) /* sysGetProcessObject */ - sc - - blr - -export .code64 RtAssertTriggerInterrupt: - mflr r3 - stw 0x11, 0(r3) /* sysTerminateCurrentProcess */ - sc - - blr diff --git a/Public/Developer/SystemLib/RISCV/.gitkeep b/Public/Developer/SystemLib/RISCV/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Public/Developer/SystemLib/RISCV/.gitkeep +++ /dev/null diff --git a/Public/Developer/SystemLib/ReadMe.md b/Public/Developer/SystemLib/ReadMe.md deleted file mode 100644 index ff89e847..00000000 --- a/Public/Developer/SystemLib/ReadMe.md +++ /dev/null @@ -1,14 +0,0 @@ -# SystemLib -## System API. - -Currently contains: -- Heap API. -- File API. -- Window Manager API. -- Dialogs API. -- Data types. -- Threading API. - -Needs: -- Device API -- Drive API.
\ No newline at end of file diff --git a/Public/Developer/SystemLib/Sources/App.c b/Public/Developer/SystemLib/Sources/App.c deleted file mode 100644 index 36e53c7e..00000000 --- a/Public/Developer/SystemLib/Sources/App.c +++ /dev/null @@ -1,29 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Defines.h> - -/// @brief Main Application object, retrieved from the RtGetAppPointer symbol. -ApplicationRef kSharedApplication = NullPtr; - -/// @brief Gets the app arguments count. -/// @param void no arguments. -/// @return The number of arguments given to the application. -CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType) { - CA_MUST_PASS(kSharedApplication); - - return kSharedApplication->Invoke(kSharedApplication, kCallGetArgsCount); -} - -/// @brief Gets the app arguments pointer. -/// @param void no arguments. -/// @return -CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType) { - CA_MUST_PASS(kSharedApplication); - - return (CharacterTypeUTF8**)kSharedApplication->Invoke(kSharedApplication, - kCallGetArgsPtr); -} diff --git a/Public/Developer/SystemLib/Sources/File.c b/Public/Developer/SystemLib/Sources/File.c deleted file mode 100644 index 6e4a7440..00000000 --- a/Public/Developer/SystemLib/Sources/File.c +++ /dev/null @@ -1,40 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Defines.h> -#include <Headers/File.h> - -enum FileOp { - kFlushFile, - kReadFork, - kWriteFork, - kOpenFork, - kCloseFork, -}; - -/// @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* rest) { - CA_MUST_PASS(kSharedApplication); - CA_MUST_PASS(path && FsIsValidPath(path) == Yes); - CA_MUST_PASS(rest); - - return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path, - rest); -} - -/// @brief Closes the file and flushes it to the said file. -/// @param refFs the filesystem reference. -/// @return -CA_EXTERN_C VoidType FsCloseFile(FSRef refFs) { - CA_MUST_PASS(kSharedApplication); - - kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile); - kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs); -} diff --git a/Public/Developer/SystemLib/Sources/Heap.c b/Public/Developer/SystemLib/Sources/Heap.c deleted file mode 100644 index 3db7a374..00000000 --- a/Public/Developer/SystemLib/Sources/Heap.c +++ /dev/null @@ -1,51 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Defines.h> -#include <Headers/Heap.h> - -/// @brief Allocate from the user's heap. -/// @param sz size of object. -/// @param flags flags. -/// @return -CA_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz, DWordType flags) { - CA_MUST_PASS(kSharedApplication); - CA_MUST_PASS(sz); - CA_MUST_PASS(flags); - - return (PtrVoidType)kSharedApplication->Invoke(kSharedApplication, - kCallAllocPtr, sz, flags); -} - -/// @brief Free pointer from the user's heap. -/// @param ptr the pointer to free. -CA_EXTERN_C VoidType RtTlsFree(PtrVoidType ptr) { - CA_MUST_PASS(kSharedApplication); - CA_MUST_PASS(ptr); - - CA_UNREFERENCED_PARAMETER( - kSharedApplication->Invoke(kSharedApplication, kCallFreePtr, ptr)); -} - -/// @brief Get pointer size. -/// @param ptr the pointer to find. -/// @return the size. -CA_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr) { - CA_MUST_PASS(kSharedApplication); - - CA_MUST_PASS(ptr); - return kSharedApplication->Invoke(kSharedApplication, kCallSizePtr, ptr); -} - -/// @brief Check if the pointer exists. -/// @param ptr the pointer to check. -/// @return if it exists -CA_EXTERN_C BooleanType RtTlsPtrExists(PtrVoidType ptr) { - CA_MUST_PASS(kSharedApplication); - - CA_MUST_PASS(ptr); - return kSharedApplication->Invoke(kSharedApplication, kCallCheckPtr, ptr); -} diff --git a/Public/Developer/SystemLib/Sources/Math.c b/Public/Developer/SystemLib/Sources/Math.c deleted file mode 100644 index 20919711..00000000 --- a/Public/Developer/SystemLib/Sources/Math.c +++ /dev/null @@ -1,7 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Math.h> diff --git a/Public/Developer/SystemLib/Sources/TrueType.c b/Public/Developer/SystemLib/Sources/TrueType.c deleted file mode 100644 index d23ce4f9..00000000 --- a/Public/Developer/SystemLib/Sources/TrueType.c +++ /dev/null @@ -1,39 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Defines.h> -#include <Headers/TrueType.h> -#include <Headers/File.h> -#include <Headers/Heap.h> - -#define kTTFFork "fon " /* TrueType */ - -/// @brief TrueType container reader -typedef struct TTFReader { - FSForkRef fFork; - FSRef fFile; - PtrVoidType fBlob; // cached blob - SizeType fBlobSize; // cached blob size - VoidType(*__fReadBytes)(SizeType count); - VoidType(*__fSkipBytes)(SizeType count); -} TTFReader; - -/// @brief Grab a TTF reader reference. -/// @param fs filesystem reference. -/// @return TTFReader* the new TTFReader type. -CA_STATIC TTFReader* GrabTTFReader(FSRef fs) { - FSForkRef forkRef = FsGetFork(fs, kTTFFork); - - if (forkRef = kInvalidRef) return NullPtr; - - TTFReader* reader = RtTlsAllocate(sizeof(TTFReader), kStandardAllocation); - - reader->fFile = fs; - reader->fFork = forkRef; - - return reader; -} -/// EOF. diff --git a/Public/Developer/SystemLib/Sources/Wm.c b/Public/Developer/SystemLib/Sources/Wm.c deleted file mode 100644 index a1f4d051..00000000 --- a/Public/Developer/SystemLib/Sources/Wm.c +++ /dev/null @@ -1,86 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <Headers/Wm.h> -#include <Headers/Math.h> - -/// invalid resource handle, they always start from 1. -#define kInvalidRsrc (0U) - -/// @brief Color refs. - -const ColorRef kRgbRed = 0x000000FF; -const ColorRef kRgbGreen = 0x0000FF00; -const ColorRef kRgbBlue = 0x00FF0000; -const ColorRef kRgbBlack = 0x00000000; -const ColorRef kRgbWhite = 0xFFFFFFFF; - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, - const DWordType rsrcId) { - CA_MUST_PASS(name); - CA_MUST_PASS(rsrcId != kInvalidRsrc); - - if (!name) return NullPtr; - if (rsrcId == kInvalidRsrc) return NullPtr; - - return (WindowPort*)kSharedApplication->Invoke( - kSharedApplication, kCallCreateWindow, name, rsrcId); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* winPort) { - CA_MUST_PASS(winPort); - if (!winPort) return; - - kSharedApplication->Invoke(kSharedApplication, kCallCloseWindow, winPort); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, - const DWordType rsrcId) { - CA_MUST_PASS(name); - CA_MUST_PASS(rsrcId != kInvalidRsrc); - - if (!name) return NullPtr; - if (rsrcId == kInvalidRsrc) return NullPtr; - - return (WindowPort*)kSharedApplication->Invoke(kSharedApplication, - kCallCreateMenu, name, rsrcId); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* winPort) { - CA_MUST_PASS(winPort); - - if (!winPort) return; - kSharedApplication->Invoke(kSharedApplication, kCallCloseMenu, winPort); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where) { - if (!wndPort) return kWmErrInvalidArg; - - wndPort->windowPosition.X = where.X; - wndPort->windowPosition.Y = where.Y; - wndPort->windowMoving = True; - - return 0; -} - -/// @brief Causes the window to invalidate and redraw. -/// @param wndPort The Window port. -/// @return nothing. -CA_EXTERN_C VoidType WmInvalidateGfx(WindowPort* wndPort) { - if (wndPort) { - wndPort->windowInvalidate = Yes; - } -} diff --git a/Public/Developer/SystemLib/amd64.mk b/Public/Developer/SystemLib/amd64.mk deleted file mode 100644 index a753ccc8..00000000 --- a/Public/Developer/SystemLib/amd64.mk +++ /dev/null @@ -1,22 +0,0 @@ -################################################## -# (C) Mahrouss Logic, all rights reserved. -# This is the SystemLib Makefile. -################################################## - -CC=x86_64-w64-mingw32-gcc -AR=x86_64-w64-mingw32-ar -CCINC=-I./ -CCFLAGS=-D__SINGLE_PRECISION__ -nostdlib -std=c17 -ffreestanding -Xlinker --subsystem=17 -shared -OUTPUT=SystemLib.lib - -.PHONY: all -all: build-core-amd64 - @echo "[SystemLib.lib] Build done." - -.PHONY: build-core-amd64 -build-core-amd64: - $(CC) $(CCINC) $(CCFLAGS) $(wildcard Sources/*.c) $(wildcard AMD64/*.s) -o $(OUTPUT) - -.PHONY: clean -clean: - rm -f $(wildcard *.lib) diff --git a/Public/Developer/SystemLib/compile_flags.txt b/Public/Developer/SystemLib/compile_flags.txt deleted file mode 100644 index 3be985d1..00000000 --- a/Public/Developer/SystemLib/compile_flags.txt +++ /dev/null @@ -1,4 +0,0 @@ --I./ --I../ --I../../../Private --std=c17 |
