summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-07 17:42:32 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-07 17:43:56 +0200
commitca83108fd138cc0398f900e6a6c0a53ad51aee31 (patch)
tree66146e07671517ab1867663081ec39e348205731
parent636a6034a613f98f13848bf4bf1143bf5966dbce (diff)
MHR-23: Rework graphics stack, moving to another repository.
- Alongside patches on the FileManager. - And code improvements on the System API. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--Doxyfile2
-rw-r--r--Private/CRT/__mpcc_exception.hxx3
-rw-r--r--Private/HALKit/POWER/HalHart.cxx2
-rw-r--r--Private/HALKit/POWER/HalThread.cxx2
-rw-r--r--Private/KernelKit/FileManager.hpp6
-rw-r--r--Private/KernelKit/PEF.hpp2
-rw-r--r--Private/NewKit/Defines.hpp1
-rw-r--r--Private/Source/ErrorOr.cxx4
-rw-r--r--Private/Source/FileManager.cxx74
-rw-r--r--Private/Source/LockDelegate.cxx1
-rw-r--r--Private/Source/ProcessTeam.cxx6
-rw-r--r--Public/Developer/SystemLib/Headers/Intl.h2
-rw-r--r--Public/Developer/SystemLib/Headers/Thread.h16
13 files changed, 81 insertions, 40 deletions
diff --git a/Doxyfile b/Doxyfile
index 7fd58842..15b300b9 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -1690,7 +1690,7 @@ DISABLE_INDEX = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
diff --git a/Private/CRT/__mpcc_exception.hxx b/Private/CRT/__mpcc_exception.hxx
index 44e341d3..fdecbcec 100644
--- a/Private/CRT/__mpcc_exception.hxx
+++ b/Private/CRT/__mpcc_exception.hxx
@@ -6,10 +6,9 @@
#pragma once
-/// This file is an implementation of __throw* family of functions.
-
#include <KernelKit/DebugOutput.hpp>
+/// @brief Standard C++ namespace
namespace std
{
#ifdef __x86_64__
diff --git a/Private/HALKit/POWER/HalHart.cxx b/Private/HALKit/POWER/HalHart.cxx
index 88f5132b..7a33d2d0 100644
--- a/Private/HALKit/POWER/HalHart.cxx
+++ b/Private/HALKit/POWER/HalHart.cxx
@@ -14,10 +14,12 @@ using namespace NewOS;
/// wakes up thread from hang.
void rt_wakeup_thread(HAL::StackFramePtr stack)
{
+ NEWOS_UNUSED(stack);
}
/// @brief makes thread sleep.
/// hooks and hangs thread to prevent code from executing.
void rt_hang_thread(HAL::StackFramePtr stack)
{
+ NEWOS_UNUSED(stack);
}
diff --git a/Private/HALKit/POWER/HalThread.cxx b/Private/HALKit/POWER/HalThread.cxx
index 592ab6bd..7bb95b4f 100644
--- a/Private/HALKit/POWER/HalThread.cxx
+++ b/Private/HALKit/POWER/HalThread.cxx
@@ -7,7 +7,7 @@
#include <HALKit/POWER/Processor.hpp>
#include <KernelKit/DebugOutput.hpp>
-extern "C" NewOS::HAL::StackFramePtr rt_get_current_context()
+EXTERN_C NewOS::HAL::StackFramePtr rt_get_current_context()
{
return nullptr;
}
diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp
index 7da08cbb..c92c7409 100644
--- a/Private/KernelKit/FileManager.hpp
+++ b/Private/KernelKit/FileManager.hpp
@@ -129,9 +129,15 @@ namespace NewOS
SizeT Tell(NodePtr node) override;
bool Rewind(NodePtr node) override;
+ public:
+ void SetResourceFork(const char* forkName);
+ void SetDataFork(const char* forkName);
+
NewFSParser* GetImpl() noexcept;
private:
+ Char fDataFork[kNewFSForkNameLen] = {0};
+ Char fRsrcFork[kNewFSForkNameLen] = {0};
NewFSParser* fImpl{nullptr};
};
diff --git a/Private/KernelKit/PEF.hpp b/Private/KernelKit/PEF.hpp
index 6c3cc5fe..9a097727 100644
--- a/Private/KernelKit/PEF.hpp
+++ b/Private/KernelKit/PEF.hpp
@@ -26,8 +26,6 @@
#define kPefVersion 1
#define kPefNameLen 255
-/// @brief Preferred Executable Format.
-
namespace NewOS
{
enum
diff --git a/Private/NewKit/Defines.hpp b/Private/NewKit/Defines.hpp
index fb7d84bb..81c0be9b 100644
--- a/Private/NewKit/Defines.hpp
+++ b/Private/NewKit/Defines.hpp
@@ -22,6 +22,7 @@
#endif
#endif
+/// @brief NewOS namespace.
namespace NewOS
{
using voidPtr = void*;
diff --git a/Private/Source/ErrorOr.cxx b/Private/Source/ErrorOr.cxx
index 14941eba..2eac8d2f 100644
--- a/Private/Source/ErrorOr.cxx
+++ b/Private/Source/ErrorOr.cxx
@@ -7,6 +7,6 @@
#include <NewKit/ErrorOr.hpp>
/***********************************************************************************/
-/// @file ErrorOr.cxx
-/// @brief Error Or Value class.
+/// @file ErrorOr.cxx ///
+/// @brief Error Or Value class. ///
/***********************************************************************************/
diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx
index 5f6ed174..23305fa8 100644
--- a/Private/Source/FileManager.cxx
+++ b/Private/Source/FileManager.cxx
@@ -74,33 +74,45 @@ namespace NewOS
return node_cast(catalog);
}
- /// @brief Writes to a catalog
- /// @param node
- /// @param data
- /// @param flags
+ /// @brief Writes to a catalog's fork.
+ /// @param node the node ptr.
+ /// @param data the data.
+ /// @param flags the size.
/// @return
Void NewFilesystemManager::Write(NodePtr node, VoidPtr data, Int32 flags, SizeT size)
{
- constexpr const char* cReadAllFork = kNewFSDataFork;
+ if (!size ||
+ size > kNewFSForkSize)
+ return;
+
+ if (!data)
+ return;
+
+ NEWOS_UNUSED(flags);
+
+ const char* cReadAllFork = fDataFork;
if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile)
fImpl->WriteCatalog(reinterpret_cast<NewCatalog*>(node), data, size,
cReadAllFork);
}
- /**
- * NOTE: Write and Read are implemented using a custom NodePtr, retrieved
- * using OpenFork.
- */
-
- /// @brief Reads from filesystem.
- /// @param node
- /// @param flags
- /// @param sz
+ /// @brief Read from filesystem fork.
+ /// @param node the catalog node.
+ /// @param flags the flags with it.
+ /// @param sz the size to read.
/// @return
VoidPtr NewFilesystemManager::Read(NodePtr node, Int32 flags, SizeT sz)
{
- constexpr const char* cReadAllFork = kNewFSDataFork;
+ if (sz > kNewFSForkSize)
+ return nullptr;
+
+ if (!sz)
+ return nullptr;
+
+ NEWOS_UNUSED(flags);
+
+ const char* cReadAllFork = fDataFork;
if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile)
return fImpl->ReadCatalog(reinterpret_cast<NewCatalog*>(node), sz,
@@ -112,7 +124,9 @@ namespace NewOS
/// @brief Seek from Catalog.
/// @param node
/// @param off
- /// @return
+ /// @retval true always returns false, this is unimplemented.
+ /// @retval false always returns this, it is unimplemented.
+
bool NewFilesystemManager::Seek(NodePtr node, SizeT off)
{
if (!node || off == 0)
@@ -121,9 +135,11 @@ namespace NewOS
return fImpl->Seek(reinterpret_cast<NewCatalog*>(node), off);
}
- /// @brief Tell where the catalog is/
+ /// @brief Tell where the catalog is.
/// @param node
- /// @return
+ /// @retval true always returns false, this is unimplemented.
+ /// @retval false always returns this, it is unimplemented.
+
SizeT NewFilesystemManager::Tell(NodePtr node)
{
if (!node)
@@ -132,9 +148,11 @@ namespace NewOS
return fImpl->Tell(reinterpret_cast<NewCatalog*>(node));
}
- /// @brief Rewind the catalog.
+ /// @brief Rewinds the catalog.
/// @param node
- /// @return
+ /// @retval true always returns false, this is unimplemented.
+ /// @retval false always returns this, it is unimplemented.
+
bool NewFilesystemManager::Rewind(NodePtr node)
{
if (!node)
@@ -143,11 +161,23 @@ namespace NewOS
return this->Seek(node, 0);
}
- /// @brief The filesystem implementation.
- /// @return
+ /// @brief Returns the filesystem parser.
+ /// @return the Filesystem parser class.
NewFSParser* NewFilesystemManager::GetImpl() noexcept
{
return fImpl;
}
+
+ void NewFilesystemManager::SetResourceFork(const char* forkName)
+ {
+ if (!forkName) return;
+ rt_copy_memory((VoidPtr)forkName, (VoidPtr)fRsrcFork, rt_string_len(forkName));
+ }
+
+ void NewFilesystemManager::SetDataFork(const char* forkName)
+ {
+ if (!forkName) return;
+ rt_copy_memory((VoidPtr)forkName, (VoidPtr)fDataFork, rt_string_len(forkName));
+ }
#endif // __FSKIT_NEWFS__
} // namespace NewOS
diff --git a/Private/Source/LockDelegate.cxx b/Private/Source/LockDelegate.cxx
index 863c2fcf..b8920bcc 100644
--- a/Private/Source/LockDelegate.cxx
+++ b/Private/Source/LockDelegate.cxx
@@ -8,4 +8,5 @@
namespace NewOS
{
+ /// Leave it empty for now.
} // namespace NewOS \ No newline at end of file
diff --git a/Private/Source/ProcessTeam.cxx b/Private/Source/ProcessTeam.cxx
index 81edca14..d9711ad9 100644
--- a/Private/Source/ProcessTeam.cxx
+++ b/Private/Source/ProcessTeam.cxx
@@ -6,7 +6,7 @@
/***********************************************************************************/
/// @file ProcessTeam.cxx
-/// @brief Process teams.
+/// @brief Process teams implementation.
/***********************************************************************************/
#include <KernelKit/ProcessScheduler.hpp>
@@ -14,14 +14,14 @@
namespace NewOS
{
/// @brief Process list array getter.
- /// @return
+ /// @return The list of process to schedule.
MutableArray<Ref<ProcessHeader>>& ProcessTeam::AsArray()
{
return mProcessList;
}
/// @brief Current process getter.
- /// @return
+ /// @return The current process header.
Ref<ProcessHeader>& ProcessTeam::AsRef()
{
return mCurrentProcess;
diff --git a/Public/Developer/SystemLib/Headers/Intl.h b/Public/Developer/SystemLib/Headers/Intl.h
index 1cd5ea64..2e91812e 100644
--- a/Public/Developer/SystemLib/Headers/Intl.h
+++ b/Public/Developer/SystemLib/Headers/Intl.h
@@ -20,5 +20,5 @@ BooleanType IntlSetLocale(const IntlRef intl);
/// @brief locale helpers.
/// @brief translate a string from a locale.
-const CharacterTypeUTF8* IntlTranslate(const CharacterTypeUTF8* input,
+const CharacterTypeUTF8* Intl(const CharacterTypeUTF8* input,
const IntlRef locale);
diff --git a/Public/Developer/SystemLib/Headers/Thread.h b/Public/Developer/SystemLib/Headers/Thread.h
index 2bcebdcd..9562003e 100644
--- a/Public/Developer/SystemLib/Headers/Thread.h
+++ b/Public/Developer/SystemLib/Headers/Thread.h
@@ -13,10 +13,9 @@
#include <Headers/Defines.h>
-#define kThreadErrorExit -33
+#define kThreadErrorExit (-33)
-/// @brief Thread Information Block, which holds information about the running
-/// thread.
+/// @brief Thread reference.
typedef QWordType ThreadRef;
/// @brief Main application thread.
@@ -28,16 +27,21 @@ typedef VoidType (*ThreadEntrypointKind)(VoidType);
/// @param threadName the thread's name.
/// @param threadStart where to start.
/// @return
-CA_EXTERN_C ThreadRef TmCreateThread(const CharacterTypeUTF8* threadName, ThreadEntrypointKind threadStart);
+CA_EXTERN_C ThreadRef CTCreate(const CharacterTypeUTF8* threadName, ThreadEntrypointKind threadStart);
/// @brief Dispoes the thread, and exits with code kThreadErrorExit
/// @param ref the thread reference.
/// @return nothing.
-CA_EXTERN_C VoidType TmDisposeThread(ThreadRef ref);
+CA_EXTERN_C VoidType CTRelease(ThreadRef ref);
/// @brief Waits for the thread to complete.
/// @param ref the thread reference.
/// @return nothing.
-CA_EXTERN_C VoidType TmWaitForCompletion(ThreadRef ref);
+CA_EXTERN_C VoidType CTJoin(ThreadRef ref);
+
+/// @brief Yields the current thread.
+/// @param ref the thead reference.
+/// @return
+CA_EXTERN_C VoidType CTYield(ThreadRef ref);
#endif // __THREAD__