diff options
Diffstat (limited to 'Public/Developer/SystemLib/Sources')
| -rw-r--r-- | Public/Developer/SystemLib/Sources/Application.c | 6 | ||||
| -rw-r--r-- | Public/Developer/SystemLib/Sources/ApplicationStart.c | 2 | ||||
| -rw-r--r-- | Public/Developer/SystemLib/Sources/File.c | 38 | ||||
| -rw-r--r-- | Public/Developer/SystemLib/Sources/Heap.c | 10 |
4 files changed, 48 insertions, 8 deletions
diff --git a/Public/Developer/SystemLib/Sources/Application.c b/Public/Developer/SystemLib/Sources/Application.c index d7a83d3e..f1391975 100644 --- a/Public/Developer/SystemLib/Sources/Application.c +++ b/Public/Developer/SystemLib/Sources/Application.c @@ -6,7 +6,7 @@ #include <Headers/Defines.h> -/// @brief Main Application object, retrieved from the RtGetAppObject symbol. +/// @brief Main Application object, retrieved from the RtGetApp symbol. ApplicationRef kSharedApplication = NullPtr; /// @brief Gets the app arguments count. @@ -19,7 +19,7 @@ CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType) { /// @brief Gets the app arguments pointer. /// @param void no arguments. /// @return -CA_EXTERN_C CharacterTypeUTF8* RtGetAppArgumentsPtr(VoidType) { - return (CharacterTypeUTF8*)kSharedApplication->Invoke(kSharedApplication, +CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType) { + return (CharacterTypeUTF8**)kSharedApplication->Invoke(kSharedApplication, kCallGetArgsPtr); }
\ No newline at end of file diff --git a/Public/Developer/SystemLib/Sources/ApplicationStart.c b/Public/Developer/SystemLib/Sources/ApplicationStart.c index 5b91ba18..0960388e 100644 --- a/Public/Developer/SystemLib/Sources/ApplicationStart.c +++ b/Public/Developer/SystemLib/Sources/ApplicationStart.c @@ -9,6 +9,6 @@ /// @brief Inits the system library. /// @return if it was succesful or not. CA_EXTERN_C VoidType __start(VoidType) { - kSharedApplication = RtGetAppObject(); + kSharedApplication = RtGetApp(); CA_MUST_PASS(kSharedApplication); } diff --git a/Public/Developer/SystemLib/Sources/File.c b/Public/Developer/SystemLib/Sources/File.c new file mode 100644 index 00000000..1432e7e0 --- /dev/null +++ b/Public/Developer/SystemLib/Sources/File.c @@ -0,0 +1,38 @@ +/* ------------------------------------------- + + 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 r the restrict (rw, rwe, r+, w+, r, w) +/// @return +CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r) { + CA_MUST_PASS(kSharedApplication); + CA_MUST_PASS(path); + CA_MUST_PASS(r); + + return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path, 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) { + CA_MUST_PASS(kSharedApplication); + + kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile); + kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs); +}
\ No newline at end of file diff --git a/Public/Developer/SystemLib/Sources/Heap.c b/Public/Developer/SystemLib/Sources/Heap.c index c866ef5d..041c5764 100644 --- a/Public/Developer/SystemLib/Sources/Heap.c +++ b/Public/Developer/SystemLib/Sources/Heap.c @@ -4,25 +4,27 @@ ------------------------------------------- */ +#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_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz, DWordType flags) { CA_MUST_PASS(sz); CA_MUST_PASS(flags); - return (PtrVoidType)kSharedApplication->Invoke(kSharedApplication, kCallAllocPtr, sz, 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(ptr); - CA_UNREFERENCED_PARAMETER(kSharedApplication->Invoke(kSharedApplication, kCallFreePtr, ptr)); + CA_UNREFERENCED_PARAMETER( + kSharedApplication->Invoke(kSharedApplication, kCallFreePtr, ptr)); } /// @brief Get pointer size. |
