summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/System.Core/Headers
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-28 20:54:33 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-28 20:54:33 +0100
commitb2c7b8604ed3a4c209a15a9ffd718a43163dd9b4 (patch)
tree851d79e3a9b1c676b48ec8dfcd2b989f4da45c9b /Public/Developer/System.Core/Headers
parent215518ae55a54973a1ae18f572ca5bf0ac2a499e (diff)
NewKernel: Add PowerPC partition type inside EPM, add Leak() FileStream method. and documentation.
SystemLib: Start implementing the API. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/System.Core/Headers')
-rw-r--r--Public/Developer/System.Core/Headers/Defines.h27
-rw-r--r--Public/Developer/System.Core/Headers/File.h33
-rw-r--r--Public/Developer/System.Core/Headers/Heap.h28
-rw-r--r--Public/Developer/System.Core/Headers/TrueType.h2
-rw-r--r--Public/Developer/System.Core/Headers/Window.h54
5 files changed, 99 insertions, 45 deletions
diff --git a/Public/Developer/System.Core/Headers/Defines.h b/Public/Developer/System.Core/Headers/Defines.h
index cf8cbde6..36884786 100644
--- a/Public/Developer/System.Core/Headers/Defines.h
+++ b/Public/Developer/System.Core/Headers/Defines.h
@@ -82,7 +82,7 @@ typedef CharacterTypeUTF8 BooleanType;
#define CA_PTR *
-#define CA_UNREFERENCED_PARAMETER(e) ((VoidType)e)
+#define CA_UNREFERENCED_PARAMETER(e) ((VoidType)(e))
#ifdef __x86_64__
@@ -124,16 +124,22 @@ typedef CharacterTypeUTF8 BooleanType;
#endif // __cplusplus
enum RtProcessCall {
- kProcessCallAllocPtr = 1,
- kProcessCallFreePtr,
- kProcessCallSizePtr,
- kProcessCallCheckPtr,
- kProcessCallAllocStack,
+ kCallAllocPtr = 1,
+ kCallFreePtr,
+ kCallSizePtr,
+ kCallCheckPtr,
+ kCallAllocStack,
/// @brief Open a specific handle (can be used as sel to call methods related to it.)
- kProcessCallOpenHandle,
- kProcessCallCloseHandle,
+ kCallOpenFile,
+ kCallCloseFile,
+ kCallCreateWindow,
+ kCallCloseWindow,
+ kCallCreateMenu,
+ kCallCloseMenu,
+ kCallGetArgsCount,
+ kCallGetArgsPtr,
/// @brief Number of process calls.
- kProcessCallsCount = 7,
+ kCallsCount,
};
#include <System.Core/Headers/Hint.h>
@@ -193,3 +199,6 @@ CA_EXTERN_C CharacterTypeUTF8* RtGetAppArgumentsPtr(VoidType);
CA_INLINE ObjectRef kApplicationObject;
typedef CharacterTypeUTF8 Str255Type[255];
+
+#define True 1
+#define False 0
diff --git a/Public/Developer/System.Core/Headers/File.h b/Public/Developer/System.Core/Headers/File.h
index bd1d8d3f..13bc7a00 100644
--- a/Public/Developer/System.Core/Headers/File.h
+++ b/Public/Developer/System.Core/Headers/File.h
@@ -9,3 +9,36 @@
#include <System.Core/Headers/Defines.h>
/// @brief Filesystem wrapper.
+
+typedef QWordTyp FSRef;
+
+/// @brief Opens a new file.
+/// @param path where to find it.
+/// @param r the restrict (rw, rwe, r+, w+, r, w)
+/// @return
+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);
+
+typedef QWordTyp FSForkRef;
+
+/// @brief A fork information header.
+typedef struct _Fork {
+ PtrVoidType forkData;
+ SizeType forkSize;
+ Int32Type forkFlags;
+ Int32Type forkKind;
+ CharacterTypeUTF8 forkName[256];
+} ForkType;
+
+/// @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);
+
+#define FsGetDataFork(refFs) FsGetFork(refFs, "data")
+#define FsGetRsrcFork(refFs) FsGetFork(refFs, "rsrc")
diff --git a/Public/Developer/System.Core/Headers/Heap.h b/Public/Developer/System.Core/Headers/Heap.h
index 90f15aa5..9f3215db 100644
--- a/Public/Developer/System.Core/Headers/Heap.h
+++ b/Public/Developer/System.Core/Headers/Heap.h
@@ -15,18 +15,24 @@ enum RtAllocationKind {
kArrayAllocation = 0xD,
};
-/// @brief Allocates a new heap from process pool.
-/// @param refObj
-/// @param sz
-/// @param flags
+/// @brief Allocates a new pointer from process pool.
+/// @param sz the size
+/// @param flags the allocation flags.
/// @return
-CA_EXTERN_C PtrVoidType RtAllocateProcessHeap(ObjectRef refObj, QWordType sz,
+CA_EXTERN_C PtrVoidType RtAllocateProcessPtr(QWordType sz,
DWordType flags);
-/// @brief Check if pointer exists.
-/// @param refObj
-/// @param ptr
+/// @brief Check if the pointer exists.
+/// @param ptr the pointer to free.
/// @return
-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);
+CA_EXTERN_C BooleanType RtProcessPtrExists(PtrVoidType ptr);
+
+/// @brief Gets the size of the process' pointer.
+/// @param ptr the pointer to free.
+/// @return
+CA_EXTERN_C QWordType RtProcessPtrSize(PtrVoidType ptr);
+
+/// @brief Frees the process pointer.
+/// @param ptr the pointer to free.
+/// @return
+CA_EXTERN_C VoidType RtFreeProcessPtr(PtrVoidType ptr);
diff --git a/Public/Developer/System.Core/Headers/TrueType.h b/Public/Developer/System.Core/Headers/TrueType.h
index 3859148f..2e8f4142 100644
--- a/Public/Developer/System.Core/Headers/TrueType.h
+++ b/Public/Developer/System.Core/Headers/TrueType.h
@@ -23,7 +23,7 @@ typedef QWordType TTFFontRef;
/// @brief Loads a new font into app's memory.
/// @param name
/// @return
-CA_EXTERN_C TTFFontRef FnCreateFont(const char* name);
+CA_EXTERN_C TTFFontRef FnCreateFont(const CharacterTypeUTF8* name);
/// @brief Dispose an allocated font.
/// @param fon
diff --git a/Public/Developer/System.Core/Headers/Window.h b/Public/Developer/System.Core/Headers/Window.h
index 831c87bb..714ef7de 100644
--- a/Public/Developer/System.Core/Headers/Window.h
+++ b/Public/Developer/System.Core/Headers/Window.h
@@ -48,11 +48,19 @@ typedef struct _WindowPort {
WmPoint windowSize;
BooleanType windowInvalidate;
DWordType windowClearColor;
- WordType menuPort;
- WordType parentPort;
- DCRef windowDeviceContext;
+ struct _WindowPort* menuPort;
+ struct _WindowPort* parentPort;
} WindowPort;
+typedef struct _ControlPort {
+ WordType controlPort;
+ WordType controlKind;
+ BooleanType controlVisible;
+ BooleanType controlMoving;
+ WmPoint controlPosition;
+ WindowPort* parentPort;
+} ControlPort;
+
typedef UInt32Type ColorRef;
/***********************************************************************************/
@@ -69,59 +77,57 @@ const ColorRef kRgbWhite = 0xFFFFFFFF;
/// Color macro.
/***********************************************************************************/
-#define RGB32(R, G, B) (ColorRef)(0x##R##G##B)
-
-#define kGraphicsKindWindow 0
-#define kGraphicsKindDialog 1
-#define kGraphicsKindMenu 2
-#define kGraphicsKindButton 3
-#define kGraphicsKindLabel 4
-#define kGraphicsKindDropdown 5
-#define kGraphicsKindIcon 6
-#define kGraphicsKindRadio 7
-#define kGraphicsKindCheck 7
+#define WmMakeColorRef(R, G, B) (ColorRef)(0x##R##G##B)
-typedef QWordType ControlRef;
+#define kControlKindWindow 0
+#define kControlKindDialog 1
+#define kControlKindMenu 2
+#define kControlKindButton 3
+#define kControlKindLabel 4
+#define kControlKindDropdown 5
+#define kControlKindIcon 6
+#define kControlKindRadio 7
+#define kControlKindCheck 7
/// @brief Creates a new control
/// @param id the control rsrc fork.
/// @return
-CA_EXTERN_C ControlRef WmCreateControl(const DWordType id);
+CA_EXTERN_C ControlPort* WmCreateControl(DWordType id);
/// @brief Releases the control
/// @param id the control ref.
/// @return
-CA_EXTERN_C VoidType WmReleaseControl(const ControlRef id);
+CA_EXTERN_C VoidType WmReleaseControl(ControlPort* id);
-/// @brief Moves a control inside a WindowPort.
+/// @brief Moves a control inside a ControlPort.
/// @param id the control ref.
/// @param where where to move at.
/// @return
-CA_EXTERN_C Int32Type WmSetControlPosition(const ControlRef id, WmPoint where);
+CA_EXTERN_C Int32Type WmSetControlPosition(ControlPort* id, WmPoint where);
/// @brief Enable control.
/// @param id
/// @param enabled
/// @return
-CA_EXTERN_C Int32Type WmSetControlEnabled(const ControlRef id, BooleanType enabled);
+CA_EXTERN_C Int32Type WmSetControlEnabled(ControlPort* id, BooleanType enabled);
/// @brief Make control visible.
/// @param id
/// @param visible
/// @return
-CA_EXTERN_C Int32Type WmMakeControlVisible(const ControlRef id, BooleanType visible);
+CA_EXTERN_C Int32Type WmMakeControlVisible(ControlPort* id, BooleanType visible);
/// @brief Creates a new window.
/// @param name the window name
/// @param rsrcId the window fork rsrc id.
/// @return the window graphics port.
-CA_EXTERN_C WindowPort* WmCreateWindow(const char* name, const DWordType rsrcId);
+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 id.
/// @return the menu graphics port.
-CA_EXTERN_C WindowPort* WmCreateMenu(const char* name, const DWordType rsrcId);
+CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, const DWordType rsrcId);
/// @brief Releases the window.
/// @param port the window port.
@@ -137,7 +143,7 @@ CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* port);
/// @param id the gfx port.
/// @param where to move.
/// @return error code.
-CA_EXTERN_C Int32Type WmMoveWindow(const WindowPort* id, WmPoint where);
+CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* id, WmPoint where);
enum {
kWmErrIncompatible = 0x74,