From 5ab8bb9c497f673a81da693e9aacc78210718000 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 26 Mar 2024 20:00:41 +0100 Subject: Kernel: Implement more API calls. Signed-off-by: Amlal El Mahrouss --- Public/Developer/System.Core/Headers/Defines.hxx | 11 ++--------- Public/Developer/System.Core/Headers/Dialog.hxx | 7 +++++++ Public/Developer/System.Core/Headers/Heap.hxx | 10 +++++----- Public/Developer/System.Core/Headers/Thread.hxx | 15 +++++++++++++++ Public/Developer/System.Core/Headers/TrueType.hxx | 12 ++++++++++++ Public/Developer/System.Core/Headers/Window.hxx | 4 ++++ 6 files changed, 45 insertions(+), 14 deletions(-) (limited to 'Public/Developer/System.Core/Headers') diff --git a/Public/Developer/System.Core/Headers/Defines.hxx b/Public/Developer/System.Core/Headers/Defines.hxx index 55810d9d..9932298e 100644 --- a/Public/Developer/System.Core/Headers/Defines.hxx +++ b/Public/Developer/System.Core/Headers/Defines.hxx @@ -117,7 +117,7 @@ typedef CharacterTypeUTF8 BooleanType; #define CA_CONSTEXPR #endif // __cplusplus -enum HcProcessCall { +enum RtProcessCall { kProcessCallAllocPtr = 1, kProcessCallFreePtr, kProcessCallSizePtr, @@ -181,15 +181,8 @@ using StrType = CharacterTypeUTF8[N]; #endif // ifdef C++ -CA_EXTERN_C ObjectRef HcGetAppObject(VoidType); +CA_EXTERN_C ObjectRef RtGetAppObject(VoidType); CA_INLINE ObjectRef kApplicationObject; typedef CharacterTypeUTF8 Str255Type[255]; - -/// @brief Shows an message box with a formatting. -/// @param title the message box title -/// @param format the format -/// @param va_list the va args, that goes along with it. -/// @return void -CA_EXTERN_C VoidType MsgBox(CharacterTypeUTF8* title, CharacterTypeUTF8* format, ...); diff --git a/Public/Developer/System.Core/Headers/Dialog.hxx b/Public/Developer/System.Core/Headers/Dialog.hxx index 0fc4e738..1cc97a6e 100644 --- a/Public/Developer/System.Core/Headers/Dialog.hxx +++ b/Public/Developer/System.Core/Headers/Dialog.hxx @@ -7,3 +7,10 @@ #pragma once #include + +/// @brief Shows an message box with a formatting. +/// @param title the message box title +/// @param format the format +/// @param va_list the va args, that goes along with it. +/// @return void +CA_EXTERN_C VoidType MsgBox(CharacterTypeUTF8* title, CharacterTypeUTF8* format, ...); diff --git a/Public/Developer/System.Core/Headers/Heap.hxx b/Public/Developer/System.Core/Headers/Heap.hxx index 98ee5bd2..c6252c04 100644 --- a/Public/Developer/System.Core/Headers/Heap.hxx +++ b/Public/Developer/System.Core/Headers/Heap.hxx @@ -10,7 +10,7 @@ #define kAllocationTypes 2 -enum HcAllocationKind { +enum RtAllocationKind { kStandardAllocation = 0xC, kArrayAllocation = 0xD, }; @@ -20,13 +20,13 @@ enum HcAllocationKind { /// @param sz /// @param flags /// @return -CA_EXTERN_C PtrVoidType HcAllocateProcessHeap(ObjectRef refObj, QWordType sz, +CA_EXTERN_C PtrVoidType RtAllocateProcessHeap(ObjectRef refObj, QWordType sz, DWordType flags); /// @brief Check if pointer exists. /// @param refObj /// @param ptr /// @return -CA_EXTERN_C BooleanType HcProcessHeapExists(ObjectRef refObj, PtrVoidType ptr); -CA_EXTERN_C QWordType HcProcessHeapSize(ObjectRef refObj, PtrVoidType ptr); -CA_EXTERN_C VoidType HcFreeProcessHeap(ObjectRef refObj, PtrVoidType ptr); +CA_EXTERN_C BooleanType RtProcessHeapExists(ObjectRef refObj, PtrVoidType ptr); +CA_EXTERN_C QWordType RtProcessHeapSize(ObjectRef refObj, PtrVoidType ptr); +CA_EXTERN_C VoidType RtFreeProcessHeap(ObjectRef refObj, PtrVoidType ptr); diff --git a/Public/Developer/System.Core/Headers/Thread.hxx b/Public/Developer/System.Core/Headers/Thread.hxx index df803860..a441041d 100644 --- a/Public/Developer/System.Core/Headers/Thread.hxx +++ b/Public/Developer/System.Core/Headers/Thread.hxx @@ -13,6 +13,8 @@ #include +#define kThreadErrorExit -33 + /// @brief Thread Information Block, which holds information about the running /// thread. typedef QWordType ThreadRef; @@ -20,4 +22,17 @@ 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 CreateThread(const CharacterTypeUTF8* threadName, ThreadEntrypointKind threadStart); + +/// @brief Dispoes the thread, and exits with code kThreadErrorExit +/// @param ref +/// @return +CA_EXTERN_C VoidType DisposeThread(ThreadRef ref); + #endif // __THREAD_API__ diff --git a/Public/Developer/System.Core/Headers/TrueType.hxx b/Public/Developer/System.Core/Headers/TrueType.hxx index 14a85823..001d986e 100644 --- a/Public/Developer/System.Core/Headers/TrueType.hxx +++ b/Public/Developer/System.Core/Headers/TrueType.hxx @@ -17,3 +17,15 @@ * 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 CreateFont(const char* name); + +/// @brief Dispose an allocated font. +/// @param fon +/// @return +CA_EXTERN_C VoidType DisposeFont(TTFFontRef fon); \ No newline at end of file diff --git a/Public/Developer/System.Core/Headers/Window.hxx b/Public/Developer/System.Core/Headers/Window.hxx index 02be0681..b7671661 100644 --- a/Public/Developer/System.Core/Headers/Window.hxx +++ b/Public/Developer/System.Core/Headers/Window.hxx @@ -21,7 +21,11 @@ struct _GraphicsPoint; struct _GraphicsPort; +#ifdef __SINGLE_PRECISION__ typedef float PositionType; +#else +typedef double PositionType; +#endif /// @brief A point, can represent the size, position of a window. typedef struct _GraphicsPoint { -- cgit v1.2.3