summaryrefslogtreecommitdiffhomepage
path: root/SDK/Library/CoreSystem/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'SDK/Library/CoreSystem/Sources')
-rw-r--r--SDK/Library/CoreSystem/Sources/CRTStartup.c12
-rw-r--r--SDK/Library/CoreSystem/Sources/File.c27
-rw-r--r--SDK/Library/CoreSystem/Sources/Heap.c9
3 files changed, 37 insertions, 11 deletions
diff --git a/SDK/Library/CoreSystem/Sources/CRTStartup.c b/SDK/Library/CoreSystem/Sources/CRTStartup.c
new file mode 100644
index 00000000..1cfad65d
--- /dev/null
+++ b/SDK/Library/CoreSystem/Sources/CRTStartup.c
@@ -0,0 +1,12 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#include <Headers/Defines.h>
+
+VoidType __DllMainCRTStartup(VoidType)
+{
+ kSharedApplication = RtGetAppPointer();
+} \ No newline at end of file
diff --git a/SDK/Library/CoreSystem/Sources/File.c b/SDK/Library/CoreSystem/Sources/File.c
index 485500ab..7547e7f2 100644
--- a/SDK/Library/CoreSystem/Sources/File.c
+++ b/SDK/Library/CoreSystem/Sources/File.c
@@ -20,11 +20,11 @@ enum FileOp
/// @param path where to find it.
/// @param rest the restrict (rw, rwe, r+, w+, r, w)
/// @return FSRef the file.
-CS_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path,
+CS_EXTERN_C FSRef CSOpenFile(const CharacterTypeUTF8* path,
const CharacterTypeUTF8* rest)
{
CS_MUST_PASS(kSharedApplication);
- CS_MUST_PASS(path && FsIsValidPath(path) == Yes);
+ CS_MUST_PASS(path && CSIsValidPath(path) == Yes);
CS_MUST_PASS(rest);
return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path,
@@ -32,12 +32,27 @@ CS_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path,
}
/// @brief Closes the file and flushes it to the said file.
-/// @param refFs the filesystem reference.
+/// @param refCS the filesystem reference.
/// @return
-CS_EXTERN_C VoidType FsCloseFile(FSRef refFs)
+CS_EXTERN_C VoidType CSCloseFile(FSRef refCS)
{
CS_MUST_PASS(kSharedApplication);
- kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile);
- kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs);
+ kSharedApplication->Invoke(kSharedApplication, refCS, kFlushFile);
+ kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refCS);
}
+
+/// @brief Check if filesystem path is valid.
+/// @param path
+/// @return
+CS_EXTERN_C BooleanType CSIsValidPath(const CharacterTypeUTF8* path)
+{
+ CS_MUST_PASS(kSharedApplication);
+ CS_MUST_PASS(path);
+
+ return kSharedApplication->Invoke(kSharedApplication, kCallFileExists, path) ||
+ kSharedApplication->Invoke(kSharedApplication, kCallDirectoryExists, path) ||
+ kSharedApplication->Invoke(kSharedApplication, kCallSymlinkExists, path) ||
+ kSharedApplication->Invoke(kSharedApplication, kCallDriveExists, path) ||
+ kSharedApplication->Invoke(kSharedApplication, kCallDeviceExists, path);
+} \ No newline at end of file
diff --git a/SDK/Library/CoreSystem/Sources/Heap.c b/SDK/Library/CoreSystem/Sources/Heap.c
index e359aded..e7a77ba5 100644
--- a/SDK/Library/CoreSystem/Sources/Heap.c
+++ b/SDK/Library/CoreSystem/Sources/Heap.c
@@ -11,7 +11,7 @@
/// @param sz size of object.
/// @param flags flags.
/// @return
-CS_EXTERN_C PtrVoidType RtHeapAllocate(QWordType sz, DWordType flags)
+CS_EXTERN_C PtrVoidType CSAllocateHeap(QWordType sz, DWordType flags)
{
CS_MUST_PASS(kSharedApplication);
CS_MUST_PASS(sz);
@@ -23,7 +23,7 @@ CS_EXTERN_C PtrVoidType RtHeapAllocate(QWordType sz, DWordType flags)
/// @brief Free pointer from the user's heap.
/// @param ptr the pointer to free.
-CS_EXTERN_C VoidType RtHeapFree(PtrVoidType ptr)
+CS_EXTERN_C VoidType CSFreeHeap(PtrVoidType ptr)
{
CS_MUST_PASS(kSharedApplication);
CS_MUST_PASS(ptr);
@@ -35,7 +35,7 @@ CS_EXTERN_C VoidType RtHeapFree(PtrVoidType ptr)
/// @brief Get pointer size.
/// @param ptr the pointer to find.
/// @return the size.
-CS_EXTERN_C QWordType RtHeapGetSize(PtrVoidType ptr)
+CS_EXTERN_C QWordType CSGetHeapSize(PtrVoidType ptr)
{
CS_MUST_PASS(kSharedApplication);
@@ -46,10 +46,9 @@ CS_EXTERN_C QWordType RtHeapGetSize(PtrVoidType ptr)
/// @brief Check if the pointer exists.
/// @param ptr the pointer to check.
/// @return if it exists
-CS_EXTERN_C BooleanType RtHeapPtrExists(PtrVoidType ptr)
+CS_EXTERN_C BooleanType CSIsHeapValid(PtrVoidType ptr)
{
CS_MUST_PASS(kSharedApplication);
-
CS_MUST_PASS(ptr);
return kSharedApplication->Invoke(kSharedApplication, kCallCheckPtr, ptr);
}