diff options
| author | Amlal <amlal@nekernel.org> | 2025-04-25 19:21:22 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-04-25 19:21:51 +0200 |
| commit | f6b400b80efc64b918c03352e93ec9de4e2369a1 (patch) | |
| tree | 251a82ee3653568ef33ffdc48c83b7f54e370bc1 /dev/LibCompiler/src/Detail | |
| parent | 20042235d1f53ae428aa154e64afdbae5d8d91ad (diff) | |
dev, general: codebase needed refactors and tweaks, for NeKernel's 0.0.2 release.
details:
- things needed to be cleared off, short sighted decisions fixed.
- the inconsistency of certain files have been fixed too.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/src/Detail')
| -rw-r--r-- | dev/LibCompiler/src/Detail/AsmUtils.h | 96 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Detail/ClUtils.h | 18 |
2 files changed, 0 insertions, 114 deletions
diff --git a/dev/LibCompiler/src/Detail/AsmUtils.h b/dev/LibCompiler/src/Detail/AsmUtils.h deleted file mode 100644 index 358700a..0000000 --- a/dev/LibCompiler/src/Detail/AsmUtils.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved - -------------------------------------------- */ - -#pragma once - -#include <LibCompiler/AssemblyInterface.h> -#include <LibCompiler/Parser.h> - -using namespace LibCompiler; - -namespace Detail { -extern void print_error(std::string reason, std::string file) noexcept; -extern void print_warning(std::string reason, std::string file) noexcept; -} // namespace Detail - -/// @brief Get Number from lineBuffer. -/// @param lineBuffer the lineBuffer to fetch from. -/// @param numberKey where to seek that number. -/// @return -static NumberCast32 GetNumber32(std::string lineBuffer, std::string numberKey) { - auto pos = lineBuffer.find(numberKey) + numberKey.size(); - - while (lineBuffer[pos] == ' ') { - ++pos; - } - - switch (lineBuffer[pos + 1]) { - case 'x': { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 16); !res) { - if (errno != 0) { - Detail::print_error("invalid hex number: " + lineBuffer, "LibCompiler"); - throw std::runtime_error("invalid_hex"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 16)); - - if (kVerbose) { - kStdOut << "asm: found a base 16 number here: " << lineBuffer.substr(pos) << "\n"; - } - - return numOffset; - } - case 'b': { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 2); !res) { - if (errno != 0) { - Detail::print_error("invalid binary number:" + lineBuffer, "LibCompiler"); - throw std::runtime_error("invalid_bin"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 2)); - - if (kVerbose) { - kStdOut << "asm: found a base 2 number here:" << lineBuffer.substr(pos) << "\n"; - } - - return numOffset; - } - case 'o': { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 7); !res) { - if (errno != 0) { - Detail::print_error("invalid octal number: " + lineBuffer, "LibCompiler"); - throw std::runtime_error("invalid_octal"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 7)); - - if (kVerbose) { - kStdOut << "asm: found a base 8 number here:" << lineBuffer.substr(pos) << "\n"; - } - - return numOffset; - } - default: { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 10); !res) { - if (errno != 0) { - Detail::print_error("invalid hex number: " + lineBuffer, "LibCompiler"); - throw std::runtime_error("invalid_hex"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 10)); - - if (kVerbose) { - kStdOut << "asm: found a base 10 number here:" << lineBuffer.substr(pos) << "\n"; - } - - return numOffset; - } - } -} diff --git a/dev/LibCompiler/src/Detail/ClUtils.h b/dev/LibCompiler/src/Detail/ClUtils.h deleted file mode 100644 index 024d0d2..0000000 --- a/dev/LibCompiler/src/Detail/ClUtils.h +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved - -------------------------------------------- */ - -#pragma once - -#include <LibCompiler/AssemblyInterface.h> -#include <LibCompiler/Parser.h> - -#define kZero64Section ".zero64" -#define kCode64Section ".code64" -#define kData64Section ".data64" - -#define kZero128Section ".zero128" -#define kCode128Section ".code128" -#define kData128Section ".data128" |
