diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-28 18:12:17 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-28 18:12:17 +0200 |
| commit | d37f1a7381825d414e4b71c487eea509325f24c3 (patch) | |
| tree | b8df54b1da6a152e6f9a61b91b8feac90bdef4b9 | |
| parent | 26b2f0395db53b0bbb1915cd27ac2b99a4dbb0a2 (diff) | |
refactor: Refactor toolchain source code.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | dev/LibCompiler/AE.h | 14 | ||||
| -rw-r--r-- | dev/LibCompiler/BasicString.h | 16 | ||||
| -rw-r--r-- | dev/LibCompiler/CodeGen.h | 8 | ||||
| -rw-r--r-- | dev/LibCompiler/Defines.h | 4 | ||||
| -rw-r--r-- | dev/LibCompiler/PEF.h | 4 | ||||
| -rw-r--r-- | dev/LibCompiler/Util/DylibHelpers.h | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Backend/AssemblerARM64.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Backend/AssemblerPowerPC.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/BasicString.cc | 14 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Linkers/DynamicLinkerPEF.cc | 6 | ||||
| -rw-r--r-- | tools/cxxdrv.cc | 2 | ||||
| -rw-r--r-- | tools/dbg.cc | 4 | ||||
| -rw-r--r-- | tools/kdbg.cc | 4 |
13 files changed, 41 insertions, 41 deletions
diff --git a/dev/LibCompiler/AE.h b/dev/LibCompiler/AE.h index fcc37a5..8c05c3a 100644 --- a/dev/LibCompiler/AE.h +++ b/dev/LibCompiler/AE.h @@ -28,14 +28,14 @@ namespace LibCompiler { // One thing to keep in mind. // This object format, is reloctable. typedef struct AEHeader final { - CharType fMagic[kAEMagLen]; - CharType fArch; - CharType fSubArch; + Char fMagic[kAEMagLen]; + Char fArch; + Char fSubArch; SizeType fCount; - CharType fSize; + Char fSize; SizeType fStartCode; SizeType fCodeSize; - CharType fPad[kAEPad]; + Char fPad[kAEPad]; } PACKED AEHeader, *AEHeaderPtr; // @brief Advanced Executable Record. @@ -43,12 +43,12 @@ typedef struct AEHeader final { // fKind must be filled with PEF fields. typedef struct AERecordHeader final { - CharType fName[kAESymbolLen]; + Char fName[kAESymbolLen]; SizeType fKind; SizeType fSize; SizeType fFlags; UIntPtr fOffset; - CharType fPad[kAEPad]; + Char fPad[kAEPad]; } PACKED AERecordHeader, *AERecordHeaderPtr; enum { diff --git a/dev/LibCompiler/BasicString.h b/dev/LibCompiler/BasicString.h index 53b21d3..5af9da9 100644 --- a/dev/LibCompiler/BasicString.h +++ b/dev/LibCompiler/BasicString.h @@ -26,7 +26,7 @@ class BasicString final { explicit BasicString() = delete; explicit BasicString(SizeType Sz) noexcept : m_Sz(Sz) { - m_Data = new CharType[Sz]; + m_Data = new Char[Sz]; assert(m_Data); } @@ -41,17 +41,17 @@ class BasicString final { LIBCOMPILER_COPY_DEFAULT(BasicString); - CharType* Data(); - const CharType* CData() const; + Char* Data(); + const Char* CData() const; SizeType Length() const; - bool operator==(const CharType* rhs) const; - bool operator!=(const CharType* rhs) const; + bool operator==(const Char* rhs) const; + bool operator!=(const Char* rhs) const; bool operator==(const BasicString& rhs) const; bool operator!=(const BasicString& rhs) const; - BasicString& operator+=(const CharType* rhs); + BasicString& operator+=(const Char* rhs); BasicString& operator+=(const BasicString& rhs); operator bool() { return m_Data && m_Data[0] != 0; } @@ -59,7 +59,7 @@ class BasicString final { bool operator!() { return !m_Data || m_Data[0] == 0; } private: - CharType* m_Data{nullptr}; + Char* m_Data{nullptr}; SizeType m_Sz{0}; SizeType m_Cur{0}; @@ -71,7 +71,7 @@ class BasicString final { * @note These results shall call be delete[] after they're used. */ struct StringBuilder final { - static BasicString Construct(const CharType* data); + static BasicString Construct(const Char* data); static const char* FromInt(const char* fmt, int n); static const char* FromBool(const char* fmt, bool n); static const char* Format(const char* fmt, const char* from); diff --git a/dev/LibCompiler/CodeGen.h b/dev/LibCompiler/CodeGen.h index a189b93..b932cdf 100644 --- a/dev/LibCompiler/CodeGen.h +++ b/dev/LibCompiler/CodeGen.h @@ -74,7 +74,7 @@ union NumberCast64 final { ~NumberCast64() { raw = 0; } - CharType number[8]; + Char number[8]; UInt64 raw; }; @@ -84,7 +84,7 @@ union NumberCast32 final { ~NumberCast32() { raw = 0; } - CharType number[4]; + Char number[4]; UInt32 raw; }; @@ -94,7 +94,7 @@ union NumberCast16 final { ~NumberCast16() { raw = 0; } - CharType number[2]; + Char number[2]; UInt16 raw; }; @@ -104,7 +104,7 @@ union NumberCast8 final { ~NumberCast8() { raw = 0; } - CharType number; + Char number; UInt8 raw; }; diff --git a/dev/LibCompiler/Defines.h b/dev/LibCompiler/Defines.h index 24d9a96..1e1d4d9 100644 --- a/dev/LibCompiler/Defines.h +++ b/dev/LibCompiler/Defines.h @@ -48,7 +48,7 @@ #define Int8 int8_t #define UInt8 uint8_t -#define CharType char +#define Char char #define Boolean bool #include <cassert> @@ -118,7 +118,7 @@ inline STLString current_date() noexcept { return fmt; } -inline bool to_str(CharType* str, Int32 limit, Int32 base) noexcept { +inline bool to_str(Char* str, Int32 limit, Int32 base) noexcept { if (limit == 0) return false; Int32 copy_limit = limit; diff --git a/dev/LibCompiler/PEF.h b/dev/LibCompiler/PEF.h index f2662c8..3f5a2b1 100644 --- a/dev/LibCompiler/PEF.h +++ b/dev/LibCompiler/PEF.h @@ -71,7 +71,7 @@ enum { /* PEF container */ typedef struct PEFContainer final { - CharType Magic[kPefMagicLen]; + Char Magic[kPefMagicLen]; UInt32 Linker; /* Linker used to link executable */ UInt32 Version; UInt32 Kind; @@ -90,7 +90,7 @@ typedef struct PEFContainer final { /* PEF executable section and commands. */ typedef struct PEFCommandHeader final { - CharType Name[kPefNameLen]; /* container name */ + Char Name[kPefNameLen]; /* container name */ UInt32 Cpu; /* container cpu */ UInt32 SubCpu; /* container sub-cpu */ UInt32 Flags; /* container flags */ diff --git a/dev/LibCompiler/Util/DylibHelpers.h b/dev/LibCompiler/Util/DylibHelpers.h index e61cf9c..be8119f 100644 --- a/dev/LibCompiler/Util/DylibHelpers.h +++ b/dev/LibCompiler/Util/DylibHelpers.h @@ -9,5 +9,5 @@ #include <LibCompiler/Defines.h> #include <dlfcn.h> -typedef Int32 (*LibCompilerEntrypoint)(Int32 argc, CharType const* argv[]); +typedef Int32 (*LibCompilerEntrypoint)(Int32 argc, Char const* argv[]); typedef VoidPtr DylibHandle; diff --git a/dev/LibCompiler/src/Backend/AssemblerARM64.cc b/dev/LibCompiler/src/Backend/AssemblerARM64.cc index 142dcc7..a1cc6dc 100644 --- a/dev/LibCompiler/src/Backend/AssemblerARM64.cc +++ b/dev/LibCompiler/src/Backend/AssemblerARM64.cc @@ -45,7 +45,7 @@ constexpr auto cPowerIPAlignment = 0x1U; -static CharType kOutputArch = LibCompiler::kPefArchARM64; +static Char kOutputArch = LibCompiler::kPefArchARM64; static std::size_t kCounter = 1UL; diff --git a/dev/LibCompiler/src/Backend/AssemblerPowerPC.cc b/dev/LibCompiler/src/Backend/AssemblerPowerPC.cc index 3134748..b979f64 100644 --- a/dev/LibCompiler/src/Backend/AssemblerPowerPC.cc +++ b/dev/LibCompiler/src/Backend/AssemblerPowerPC.cc @@ -45,7 +45,7 @@ constexpr auto cPowerIPAlignment = 0x4U; -static CharType kOutputArch = LibCompiler::kPefArchPowerPC; +static Char kOutputArch = LibCompiler::kPefArchPowerPC; static std::size_t kCounter = 1UL; diff --git a/dev/LibCompiler/src/BasicString.cc b/dev/LibCompiler/src/BasicString.cc index 78bfcaa..41989fe 100644 --- a/dev/LibCompiler/src/BasicString.cc +++ b/dev/LibCompiler/src/BasicString.cc @@ -21,11 +21,11 @@ #include <LibCompiler/BasicString.h> namespace LibCompiler { -CharType* BasicString::Data() { +Char* BasicString::Data() { return m_Data; } -const CharType* BasicString::CData() const { +const Char* BasicString::CData() const { return m_Data; } @@ -43,7 +43,7 @@ bool BasicString::operator==(const BasicString& rhs) const { return true; } -bool BasicString::operator==(const CharType* rhs) const { +bool BasicString::operator==(const Char* rhs) const { if (string_length(rhs) != Length()) return false; for (SizeType index = 0; index < string_length(rhs); ++index) { @@ -63,7 +63,7 @@ bool BasicString::operator!=(const BasicString& rhs) const { return true; } -bool BasicString::operator!=(const CharType* rhs) const { +bool BasicString::operator!=(const Char* rhs) const { if (string_length(rhs) != Length()) return false; for (SizeType index = 0; index < string_length(rhs); ++index) { @@ -73,7 +73,7 @@ bool BasicString::operator!=(const CharType* rhs) const { return true; } -BasicString StringBuilder::Construct(const CharType* data) { +BasicString StringBuilder::Construct(const Char* data) { if (!data || *data == 0) return BasicString(0); BasicString view(strlen(data)); @@ -92,7 +92,7 @@ const char* StringBuilder::FromInt(const char* fmt, int i) { memset(ret, 0, ret_len); - CharType result[sizeof(int64_t)]; + Char result[sizeof(int64_t)]; if (!to_str(result, sizeof(int64_t), i)) { delete[] ret; @@ -183,7 +183,7 @@ const char* StringBuilder::Format(const char* fmt, const char* fmtRight) { return ret; } -BasicString& BasicString::operator+=(const CharType* rhs) { +BasicString& BasicString::operator+=(const Char* rhs) { if (strlen(rhs) > this->m_Sz) { throw std::runtime_error("out_of_bounds: BasicString"); } diff --git a/dev/LibCompiler/src/Linkers/DynamicLinkerPEF.cc b/dev/LibCompiler/src/Linkers/DynamicLinkerPEF.cc index 820b06d..b58c786 100644 --- a/dev/LibCompiler/src/Linkers/DynamicLinkerPEF.cc +++ b/dev/LibCompiler/src/Linkers/DynamicLinkerPEF.cc @@ -68,7 +68,7 @@ namespace Detail { struct DynamicLinkerBlob final { - std::vector<CharType> mBlob{}; // PEF code/bss/data blob. + std::vector<Char> mBlob{}; // PEF code/bss/data blob. UIntPtr mOffset{0UL}; // the offset of the PEF container header... }; } // namespace Detail @@ -89,8 +89,8 @@ static Bool kStartFound = false; static Bool kDuplicateSymbols = false; /* ld64 is to be found, mld is to be found at runtime. */ -static const CharType* kLdDefineSymbol = ":UndefinedSymbol:"; -static const CharType* kLdDynamicSym = ":RuntimeSymbol:"; +static const Char* kLdDefineSymbol = ":UndefinedSymbol:"; +static const Char* kLdDynamicSym = ":RuntimeSymbol:"; /* object code and list. */ static std::vector<LibCompiler::STLString> kObjectList; diff --git a/tools/cxxdrv.cc b/tools/cxxdrv.cc index bc790ff..99696aa 100644 --- a/tools/cxxdrv.cc +++ b/tools/cxxdrv.cc @@ -15,7 +15,7 @@ static auto kPath = "/usr/local/lib/libCompiler.dylib"; -Int32 main(Int32 argc, CharType const* argv[]) { +Int32 main(Int32 argc, Char const* argv[]) { DylibHandle handler = dlopen(kPath, RTLD_LAZY | RTLD_GLOBAL); if (!handler) { diff --git a/tools/dbg.cc b/tools/dbg.cc index 1d89c21..35b0702 100644 --- a/tools/dbg.cc +++ b/tools/dbg.cc @@ -9,10 +9,10 @@ /// @file dbg.cxx /// @brief NE debugger. -LC_IMPORT_C int DebuggerMachPOSIX(int argc, char const* argv[]); +LC_IMPORT_C Int32 DebuggerMachPOSIX(Int32 argc, Char const* argv[]); /// @brief Debugger entrypoint. /// @return Status code of debugger. -int main(int argc, char const* argv[]) { +Int32 main(Int32 argc, Char const* argv[]) { return DebuggerMachPOSIX(argc, argv); } diff --git a/tools/kdbg.cc b/tools/kdbg.cc index 08a0465..7616abe 100644 --- a/tools/kdbg.cc +++ b/tools/kdbg.cc @@ -9,10 +9,10 @@ /// @file kdbg.cxx /// @brief NeKernel debugger. -LC_IMPORT_C int DebuggerNeKernel(int argc, char const* argv[]); +LC_IMPORT_C Int32 DebuggerNeKernel(Int32 argc, Char const* argv[]); /// @brief Debugger entrypoint. /// @return Status code of debugger. -int main(int argc, char const* argv[]) { +Int32 main(Int32 argc, Char const* argv[]) { return DebuggerNeKernel(argc, argv); } |
