From f6b400b80efc64b918c03352e93ec9de4e2369a1 Mon Sep 17 00:00:00 2001 From: Amlal Date: Fri, 25 Apr 2025 19:21:22 +0200 Subject: 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 --- dev/LibCompiler/src/Detail/AsmUtils.h | 96 ----------------------------------- dev/LibCompiler/src/Detail/ClUtils.h | 18 ------- 2 files changed, 114 deletions(-) delete mode 100644 dev/LibCompiler/src/Detail/AsmUtils.h delete mode 100644 dev/LibCompiler/src/Detail/ClUtils.h (limited to 'dev/LibCompiler/src/Detail') 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 -#include - -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 -#include - -#define kZero64Section ".zero64" -#define kCode64Section ".code64" -#define kData64Section ".data64" - -#define kZero128Section ".zero128" -#define kCode128Section ".code128" -#define kData128Section ".data128" -- cgit v1.2.3