summaryrefslogtreecommitdiffhomepage
path: root/Public
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-05 21:10:18 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-05 21:10:18 +0200
commitf95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch)
treebf8186f1a0521a64983bb0bca4f7b54883542195 /Public
parent5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff)
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Public')
-rw-r--r--Public/Developer/CxxLib/Sources/New+Delete.cxx24
-rw-r--r--Public/Developer/FragLib/Sources/ImageStart.c9
-rw-r--r--Public/Developer/SystemLib/Headers/2D.h (renamed from Public/Developer/SystemLib/Headers/Draw.h)11
-rw-r--r--Public/Developer/SystemLib/Headers/Defines.h149
-rw-r--r--Public/Developer/SystemLib/Headers/Dialog.h26
-rw-r--r--Public/Developer/SystemLib/Headers/File.h15
-rw-r--r--Public/Developer/SystemLib/Headers/Heap.h17
-rw-r--r--Public/Developer/SystemLib/Headers/Thread.h6
-rw-r--r--Public/Developer/SystemLib/Headers/TrueType.h12
-rw-r--r--Public/Developer/SystemLib/Headers/Wm.h120
-rw-r--r--Public/Developer/SystemLib/Headers/l18n.h4
-rw-r--r--Public/Developer/SystemLib/Sources/App.c16
-rw-r--r--Public/Developer/SystemLib/Sources/File.c37
-rw-r--r--Public/Developer/SystemLib/Sources/Heap.c48
-rw-r--r--Public/Developer/SystemLib/Sources/TrueType.c25
-rw-r--r--Public/Developer/SystemLib/Sources/Wm.c90
16 files changed, 327 insertions, 282 deletions
diff --git a/Public/Developer/CxxLib/Sources/New+Delete.cxx b/Public/Developer/CxxLib/Sources/New+Delete.cxx
index e065e1ed..5ff3612f 100644
--- a/Public/Developer/CxxLib/Sources/New+Delete.cxx
+++ b/Public/Developer/CxxLib/Sources/New+Delete.cxx
@@ -8,20 +8,26 @@
typedef SizeType size_t;
-void* operator new[](size_t sz) {
- if (sz == 0) ++sz;
+void* operator new[](size_t sz)
+{
+ if (sz == 0)
+ ++sz;
- return RtTlsAllocate(sz, kStandardAllocation);
+ return RtTlsAllocate(sz, kStandardAllocation);
}
-void* operator new(size_t sz) {
- if (sz == 0) ++sz;
+void* operator new(size_t sz)
+{
+ if (sz == 0)
+ ++sz;
- return RtTlsAllocate(sz, kArrayAllocation);
+ return RtTlsAllocate(sz, kArrayAllocation);
}
-void operator delete[](void* ptr) {
- if (ptr == nullptr) return;
+void operator delete[](void* ptr)
+{
+ if (ptr == nullptr)
+ return;
- RtTlsFree(ptr);
+ RtTlsFree(ptr);
} \ No newline at end of file
diff --git a/Public/Developer/FragLib/Sources/ImageStart.c b/Public/Developer/FragLib/Sources/ImageStart.c
index 3fbac042..31b0d7bd 100644
--- a/Public/Developer/FragLib/Sources/ImageStart.c
+++ b/Public/Developer/FragLib/Sources/ImageStart.c
@@ -14,9 +14,10 @@ CA_EXTERN_C VoidType AppMain(VoidType);
/// @brief Process entrypoint.
/// @param void
/// @return void
-CA_EXTERN_C VoidType __ImageStart(VoidType) {
- kSharedApplication = RtGetAppPointer();
- CA_MUST_PASS(kSharedApplication);
+CA_EXTERN_C VoidType __ImageStart(VoidType)
+{
+ kSharedApplication = RtGetAppPointer();
+ CA_MUST_PASS(kSharedApplication);
- AppMain();
+ AppMain();
}
diff --git a/Public/Developer/SystemLib/Headers/Draw.h b/Public/Developer/SystemLib/Headers/2D.h
index 38f99e7d..ad7ba9fe 100644
--- a/Public/Developer/SystemLib/Headers/Draw.h
+++ b/Public/Developer/SystemLib/Headers/2D.h
@@ -9,12 +9,11 @@
#include <Headers/Wm.h>
/*************************************************************
- *
- * File: Draw.h
- * Purpose: Draw Manager API for NewOS.
+ *
+ * File: Draw.h
+ * Purpose: Xtrem Composer API for NewOS.
* Date: 3/26/24
- *
+ *
* Copyright Mahrouss Logic, all rights reserved.
- *
+ *
*************************************************************/
-
diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h
index 57bfffdf..380fb0ac 100644
--- a/Public/Developer/SystemLib/Headers/Defines.h
+++ b/Public/Developer/SystemLib/Headers/Defines.h
@@ -11,7 +11,13 @@
#endif
#ifdef _DEBUG
-#define CA_MUST_PASS(e) { if (!e) { DlgMsgBox("Sorry, an assertion failed.\nFile: %s\nLine: %i", __FILE__, __LINE__) RtAssertTriggerInterrupt() } }
+#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
@@ -32,24 +38,24 @@ 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 CA_CDECL __attribute__((cdecl))
+#define CA_MSCALL __attribute__((ms_abi))
#define PACKED __attribute__((packed))
#define CA_PASCAL CA_STDCALL
-typedef __UINT8_TYPE__ ByteType;
+typedef __UINT8_TYPE__ ByteType;
typedef __UINT16_TYPE__ WordType;
typedef __UINT32_TYPE__ DWordType;
typedef __UINT64_TYPE__ QWordType;
-typedef __SIZE_TYPE__ SizeType;
+typedef __SIZE_TYPE__ SizeType;
-typedef char CharacterTypeUTF8;
+typedef char CharacterTypeUTF8;
typedef CharacterTypeUTF8* PtrCharacterType;
typedef void* PtrVoidType;
-typedef void VoidType;
+typedef void VoidType;
#ifdef __SINGLE_PRECISION__
typedef float FloatType;
@@ -60,16 +66,16 @@ 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 __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 No 0
#define CA_PTR *
@@ -77,36 +83,36 @@ typedef CharacterTypeUTF8 BooleanType;
#ifdef __x86_64__
-# define CA_FAR __far
-# define CA_NEAR __near
+#define CA_FAR __far
+#define CA_NEAR __near
-# define _M_AMD64 2
+#define _M_AMD64 2
#else
-# define CA_FAR
-# define CA_NEAR
+#define CA_FAR
+#define CA_NEAR
#endif
#ifdef __aarch64__
-# define _M_AARCH64 3
+#define _M_AARCH64 3
#endif
#ifdef __powerpc64__
-# define _M_PPC64 4
+#define _M_PPC64 4
#endif
#ifdef __64x0__
-# define _M_64000 5
+#define _M_64000 5
#endif
#ifdef __riscv__
-# define _M_RISCV 6
+#define _M_RISCV 6
#endif
#define CA_STATIC static
#define CA_INLINE inline
-#define CA_CONST const
+#define CA_CONST const
#ifdef __cplusplus
#define CA_CONSTEXPR constexpr
@@ -114,27 +120,28 @@ typedef CharacterTypeUTF8 BooleanType;
#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,
+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>
@@ -144,42 +151,40 @@ enum RtProcessCall {
* @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];
+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);
+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_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_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 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>
@@ -195,12 +200,12 @@ using StrType = CharacterTypeUTF8[N];
/// @brief Get app singleton.
/// @param
/// @return
-CA_EXTERN_C ApplicationRef RtGetAppPointer(VoidType);
+CA_EXTERN_C ApplicationRef RtGetAppPointer(VoidType);
/// @brief Get argument count
/// @param
/// @return
-CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType);
+CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType);
/// @brief Get argument pointer.
/// @param
@@ -213,7 +218,7 @@ typedef CharacterTypeUTF8 StrType255[255];
#define True 1
#define False 0
-#define Bool BooleanType
+#define Bool BooleanType
#define NullPtr ((PtrVoidType)0)
diff --git a/Public/Developer/SystemLib/Headers/Dialog.h b/Public/Developer/SystemLib/Headers/Dialog.h
index 823b3366..14e3d3a7 100644
--- a/Public/Developer/SystemLib/Headers/Dialog.h
+++ b/Public/Developer/SystemLib/Headers/Dialog.h
@@ -12,22 +12,24 @@ struct _DialogPort;
struct _DialogPoint;
/// @brief Dialog procedure type.
-typedef VoidType(*WmDialogFn)(struct _DialogPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam);
+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;
+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;
+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.
diff --git a/Public/Developer/SystemLib/Headers/File.h b/Public/Developer/SystemLib/Headers/File.h
index 234c33da..6b0bb29b 100644
--- a/Public/Developer/SystemLib/Headers/File.h
+++ b/Public/Developer/SystemLib/Headers/File.h
@@ -20,18 +20,19 @@ CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeU
/// @brief Closes the file and flushes it to the said file.
/// @param refFs the filesystem reference.
-/// @return
+/// @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];
+typedef struct _Fork
+{
+ PtrVoidType forkData;
+ SizeType forkSize;
+ Int32Type forkFlags;
+ Int32Type forkKind;
+ CharacterTypeUTF8 forkName[kMaxForkNameLength];
} ForkType;
typedef ForkType* FSForkRef;
diff --git a/Public/Developer/SystemLib/Headers/Heap.h b/Public/Developer/SystemLib/Headers/Heap.h
index 1c8873bd..511eaa1b 100644
--- a/Public/Developer/SystemLib/Headers/Heap.h
+++ b/Public/Developer/SystemLib/Headers/Heap.h
@@ -10,29 +10,30 @@
#define kAllocationTypes 2
-enum RtAllocationKind {
- kStandardAllocation = 0xC,
- kArrayAllocation = 0xD,
+enum RtAllocationKind
+{
+ kStandardAllocation = 0xC,
+ kArrayAllocation = 0xD,
};
/// @brief Allocates a new pointer from process pool.
/// @param sz the size
/// @param flags the allocation flags.
-/// @return
+/// @return
CA_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz,
- DWordType flags);
+ DWordType flags);
/// @brief Check if the pointer exists.
/// @param ptr the pointer to free.
-/// @return
+/// @return
CA_EXTERN_C BooleanType RtTlsPtrExists(PtrVoidType ptr);
/// @brief Gets the size of the process' pointer.
/// @param ptr the pointer to free.
-/// @return
+/// @return
CA_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr);
/// @brief Frees the process pointer.
/// @param ptr the pointer to free.
-/// @return
+/// @return
CA_EXTERN_C VoidType RtTlsFree(PtrVoidType ptr);
diff --git a/Public/Developer/SystemLib/Headers/Thread.h b/Public/Developer/SystemLib/Headers/Thread.h
index 4a54d841..2bcebdcd 100644
--- a/Public/Developer/SystemLib/Headers/Thread.h
+++ b/Public/Developer/SystemLib/Headers/Thread.h
@@ -22,12 +22,12 @@ typedef QWordType ThreadRef;
/// @brief Main application thread.
CA_EXTERN_C ThreadRef kMainThread;
-typedef VoidType(*ThreadEntrypointKind)(VoidType);
+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
+/// @return
CA_EXTERN_C ThreadRef TmCreateThread(const CharacterTypeUTF8* threadName, ThreadEntrypointKind threadStart);
/// @brief Dispoes the thread, and exits with code kThreadErrorExit
@@ -40,4 +40,4 @@ CA_EXTERN_C VoidType TmDisposeThread(ThreadRef ref);
/// @return nothing.
CA_EXTERN_C VoidType TmWaitForCompletion(ThreadRef ref);
-#endif // __THREAD__
+#endif // __THREAD__
diff --git a/Public/Developer/SystemLib/Headers/TrueType.h b/Public/Developer/SystemLib/Headers/TrueType.h
index 6387e58f..49b111cc 100644
--- a/Public/Developer/SystemLib/Headers/TrueType.h
+++ b/Public/Developer/SystemLib/Headers/TrueType.h
@@ -21,18 +21,18 @@
typedef QWordType TTFFontRef;
/// @brief Loads a new font into app's memory.
-/// @param name
-/// @return
+/// @param name
+/// @return
CA_EXTERN_C TTFFontRef FnCreateFont(const CharacterTypeUTF8* name);
/// @brief Dispose an allocated font.
-/// @param fon
-/// @return
+/// @param fon
+/// @return
CA_EXTERN_C VoidType FnDisposeFont(TTFFontRef fon);
/// @brief Gets the font gylph for character.
-/// @param fon
-/// @return
+/// @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
index 6226475d..e0333310 100644
--- a/Public/Developer/SystemLib/Headers/Wm.h
+++ b/Public/Developer/SystemLib/Headers/Wm.h
@@ -26,58 +26,62 @@ struct _WmControlPort;
struct _WmPoint;
/// @brief Window Graphics type.
-typedef struct _WmGFX {
- UInt32Type Depth;
- UInt32Type* DataFrame;
- SizeType DataFrameWidth;
- SizeType DataFrameHeight;
+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);
+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;
+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;
+typedef struct _WmWindowPort
+{
+ WordType windowPort;
+ WordType windowKind;
+ BooleanType windowVisible : 1;
+ BooleanType windowMaximized : 1;
+ BooleanType windowMinimized : 1;
+ BooleanType windowMoving : 1; // Set if the window is moving.
+ BooleanType windowDisableClose : 1; // Set if user or app request a close action.
+ BooleanType windowDisableMinimize : 1; // Set if user request a minimize action.
+ BooleanType windowInvalidate : 1; // Set if invalidation action is done.
+ 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;
+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,
+enum
+{
+ kWmErrIncompatible = 0x74,
+ kWmErrOutOfMemory,
+ kWmErrInvalidArg,
+ kWmErrNotImplemented,
};
/// @brief Color reference.
@@ -99,69 +103,69 @@ CA_EXTERN_C const ColorRef kRgbWhite;
#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 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
+#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);
+CA_EXTERN_C WmControlPort* WmCreateControl(DWordType id);
/// @brief Releases the control
/// @param ctrlPort the control ref.
/// @return
-CA_EXTERN_C VoidType WmReleaseControl(WmControlPort* ctrlPort);
+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);
+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);
+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);
+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);
+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);
+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);
+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);
+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);
+CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where);
diff --git a/Public/Developer/SystemLib/Headers/l18n.h b/Public/Developer/SystemLib/Headers/l18n.h
index eb876770..1cd5ea64 100644
--- a/Public/Developer/SystemLib/Headers/l18n.h
+++ b/Public/Developer/SystemLib/Headers/l18n.h
@@ -14,11 +14,11 @@ typedef UInt64Type IntlRef;
/// @brief locale getter and setters.
-IntlRef IntlGetLocale(const char* name);
+IntlRef IntlGetLocale(const char* name);
BooleanType IntlSetLocale(const IntlRef intl);
/// @brief locale helpers.
/// @brief translate a string from a locale.
const CharacterTypeUTF8* IntlTranslate(const CharacterTypeUTF8* input,
- const IntlRef locale);
+ const IntlRef locale);
diff --git a/Public/Developer/SystemLib/Sources/App.c b/Public/Developer/SystemLib/Sources/App.c
index 36e53c7e..c85b2dd8 100644
--- a/Public/Developer/SystemLib/Sources/App.c
+++ b/Public/Developer/SystemLib/Sources/App.c
@@ -12,18 +12,20 @@ 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);
+CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType)
+{
+ CA_MUST_PASS(kSharedApplication);
- return kSharedApplication->Invoke(kSharedApplication, kCallGetArgsCount);
+ 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);
+CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType)
+{
+ CA_MUST_PASS(kSharedApplication);
- return (CharacterTypeUTF8**)kSharedApplication->Invoke(kSharedApplication,
- kCallGetArgsPtr);
+ return (CharacterTypeUTF8**)kSharedApplication->Invoke(kSharedApplication,
+ kCallGetArgsPtr);
}
diff --git a/Public/Developer/SystemLib/Sources/File.c b/Public/Developer/SystemLib/Sources/File.c
index 6e4a7440..40cbd515 100644
--- a/Public/Developer/SystemLib/Sources/File.c
+++ b/Public/Developer/SystemLib/Sources/File.c
@@ -7,12 +7,13 @@
#include <Headers/Defines.h>
#include <Headers/File.h>
-enum FileOp {
- kFlushFile,
- kReadFork,
- kWriteFork,
- kOpenFork,
- kCloseFork,
+enum FileOp
+{
+ kFlushFile,
+ kReadFork,
+ kWriteFork,
+ kOpenFork,
+ kCloseFork,
};
/// @brief Opens a new file.
@@ -20,21 +21,23 @@ enum FileOp {
/// @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);
+ 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);
+CA_EXTERN_C VoidType FsCloseFile(FSRef refFs)
+{
+ CA_MUST_PASS(kSharedApplication);
- kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile);
- kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs);
+ 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
index 3db7a374..6c5e381e 100644
--- a/Public/Developer/SystemLib/Sources/Heap.c
+++ b/Public/Developer/SystemLib/Sources/Heap.c
@@ -11,41 +11,45 @@
/// @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);
+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));
+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_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr)
+{
+ CA_MUST_PASS(kSharedApplication);
- CA_MUST_PASS(ptr);
- return kSharedApplication->Invoke(kSharedApplication, kCallSizePtr, ptr);
+ 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);
+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/TrueType.c b/Public/Developer/SystemLib/Sources/TrueType.c
index d23ce4f9..49b1c2e8 100644
--- a/Public/Developer/SystemLib/Sources/TrueType.c
+++ b/Public/Developer/SystemLib/Sources/TrueType.c
@@ -12,25 +12,28 @@
#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);
+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) {
+CA_STATIC TTFReader* GrabTTFReader(FSRef fs)
+{
FSForkRef forkRef = FsGetFork(fs, kTTFFork);
-
- if (forkRef = kInvalidRef) return NullPtr;
+
+ if (forkRef = kInvalidRef)
+ return NullPtr;
TTFReader* reader = RtTlsAllocate(sizeof(TTFReader), kStandardAllocation);
-
+
reader->fFile = fs;
reader->fFork = forkRef;
diff --git a/Public/Developer/SystemLib/Sources/Wm.c b/Public/Developer/SystemLib/Sources/Wm.c
index a1f4d051..607e7dcf 100644
--- a/Public/Developer/SystemLib/Sources/Wm.c
+++ b/Public/Developer/SystemLib/Sources/Wm.c
@@ -12,75 +12,89 @@
/// @brief Color refs.
-const ColorRef kRgbRed = 0x000000FF;
+const ColorRef kRgbRed = 0x000000FF;
const ColorRef kRgbGreen = 0x0000FF00;
-const ColorRef kRgbBlue = 0x00FF0000;
+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);
+ 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;
+CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* winPort)
+{
+ CA_MUST_PASS(winPort);
+ if (!winPort)
+ return;
- kSharedApplication->Invoke(kSharedApplication, kCallCloseWindow, winPort);
+ 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);
+ 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);
+CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* winPort)
+{
+ CA_MUST_PASS(winPort);
- if (!winPort) return;
- kSharedApplication->Invoke(kSharedApplication, kCallCloseMenu, winPort);
+ if (!winPort)
+ return;
+ kSharedApplication->Invoke(kSharedApplication, kCallCloseMenu, winPort);
}
/////////////////////////////////////////////////////////////////////////
-CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where) {
- if (!wndPort) return kWmErrInvalidArg;
+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;
+ wndPort->windowPosition.X = where.X;
+ wndPort->windowPosition.Y = where.Y;
+ wndPort->windowMoving = True;
- return 0;
+ 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;
- }
+CA_EXTERN_C VoidType WmInvalidateGfx(WindowPort* wndPort)
+{
+ if (wndPort)
+ {
+ wndPort->windowInvalidate = Yes;
+ }
}