summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-01-27 02:11:12 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-01-27 02:11:12 +0100
commit2fd3475239d4258ca4407ffb2c0720d90d711d6c (patch)
treef56bbe4a03196ff41d197a617c263dbb13658ef4 /dev
parent2b2ac6e8c5dd2b3234b74d38833066dcd483267b (diff)
ADD: `dbg` C++ debugger program.
META: Ran format command with correct C++ extensions. Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev')
-rw-r--r--dev/LibCompiler/src/Assembler64x0.cc20
-rw-r--r--dev/LibCompiler/src/AssemblerAMD64.cc38
-rw-r--r--dev/LibCompiler/src/AssemblerARM64.cc17
-rw-r--r--dev/LibCompiler/src/AssemblerPower.cc16
-rw-r--r--dev/LibCompiler/src/CCompiler64x0.cc30
-rw-r--r--dev/LibCompiler/src/CCompilerARM64.cc32
-rw-r--r--dev/LibCompiler/src/CCompilerPower64.cc10
-rw-r--r--dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc35
-rw-r--r--dev/LibCompiler/src/DynamicLinkerELF.cc32
-rw-r--r--dev/LibCompiler/src/DynamicLinkerPEF.cc82
-rw-r--r--dev/LibIDE/TerminalEmulator.h1
11 files changed, 155 insertions, 158 deletions
diff --git a/dev/LibCompiler/src/Assembler64x0.cc b/dev/LibCompiler/src/Assembler64x0.cc
index f297c41..d7f4349 100644
--- a/dev/LibCompiler/src/Assembler64x0.cc
+++ b/dev/LibCompiler/src/Assembler64x0.cc
@@ -64,7 +64,7 @@ static LibCompiler::AERecordHeader kCurrentRecord{
.fName = "", .fKind = LibCompiler::kPefCode, .fSize = 0, .fOffset = 0};
static std::vector<LibCompiler::AERecordHeader> kRecords;
-static std::vector<std::string> kUndefinedSymbols;
+static std::vector<std::string> kUndefinedSymbols;
static const std::string kUndefinedSymbol = ":UndefinedSymbol:";
static const std::string kRelocSymbol = ":RuntimeSymbol:";
@@ -81,7 +81,7 @@ namespace Detail
kStdErr << kRed << "[ TQC++ ] " << kWhite
<< ((file == "LibCompiler") ? "InternalErrorException: "
- : ("FileException{ " + file + " }: "))
+ : ("FileException{ " + file + " }: "))
<< kBlank << std::endl;
kStdErr << kRed << "[ TQC++ ] " << kWhite << reason << kBlank << std::endl;
@@ -348,7 +348,7 @@ static bool asm_read_attributes(std::string& line)
if (kOutputAsBinary)
{
Detail::print_error("Invalid extern_segment directive in flat binary mode.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("invalid_extern_segment_bin");
}
@@ -421,7 +421,7 @@ static bool asm_read_attributes(std::string& line)
if (kOutputAsBinary)
{
Detail::print_error("Invalid public_segment directive in flat binary mode.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("invalid_public_segment_bin");
}
@@ -517,7 +517,7 @@ namespace Detail::algorithm
/////////////////////////////////////////////////////////////////////////////////////////
std::string LibCompiler::Encoder64x0::CheckLine(std::string& line,
- const std::string& file)
+ const std::string& file)
{
std::string err_str;
@@ -651,7 +651,7 @@ std::string LibCompiler::Encoder64x0::CheckLine(std::string& line,
}
bool LibCompiler::Encoder64x0::WriteNumber(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -777,7 +777,7 @@ bool LibCompiler::Encoder64x0::WriteNumber(const std::size_t& pos,
/////////////////////////////////////////////////////////////////////////////////////////
bool LibCompiler::Encoder64x0::WriteLine(std::string& line,
- const std::string& file)
+ const std::string& file)
{
if (LibCompiler::find_word(line, "public_segment "))
return true;
@@ -844,7 +844,7 @@ bool LibCompiler::Encoder64x0::WriteLine(std::string& line,
if (reg_index > kAsmRegisterLimit)
{
Detail::print_error("invalid register index, r" + reg_str,
- file);
+ file);
throw std::runtime_error("invalid_register_index");
}
@@ -986,7 +986,7 @@ bool LibCompiler::Encoder64x0::WriteLine(std::string& line,
cpy_jump_label.find("extern_segment ") != std::string::npos)
{
Detail::print_error("invalid usage extern_segment on 'sta', here: " + line,
- file);
+ file);
throw std::runtime_error("invalid_sta_usage");
}
}
@@ -1008,7 +1008,7 @@ bool LibCompiler::Encoder64x0::WriteLine(std::string& line,
if (name == "sta")
{
Detail::print_error("extern_segment is not allowed on a sta operation.",
- file);
+ file);
throw std::runtime_error("extern_segment_sta_op");
}
else
diff --git a/dev/LibCompiler/src/AssemblerAMD64.cc b/dev/LibCompiler/src/AssemblerAMD64.cc
index ffe5749..58dc985 100644
--- a/dev/LibCompiler/src/AssemblerAMD64.cc
+++ b/dev/LibCompiler/src/AssemblerAMD64.cc
@@ -75,8 +75,8 @@ static LibCompiler::AERecordHeader kCurrentRecord{
.fName = "", .fKind = LibCompiler::kPefCode, .fSize = 0, .fOffset = 0};
static std::vector<LibCompiler::AERecordHeader> kRecords;
-static std::vector<std::string> kDefinedSymbols;
-static std::vector<std::string> kUndefinedSymbols;
+static std::vector<std::string> kDefinedSymbols;
+static std::vector<std::string> kUndefinedSymbols;
static const std::string kUndefinedSymbol = ":UndefinedSymbol:";
@@ -549,10 +549,10 @@ namespace Detail::algorithm
static inline bool is_not_valid(char c)
{
if ((isalpha(c) || isdigit(c)) || ((c == ' ') || (c == '\t') ||
- (c == ',') || (c == '(') || (c == ')') || (c == '"') || (c == '*') ||
- (c == '\'') || (c == '[') || (c == ']') || (c == '+') ||
- (c == '_') || (c == ':') || (c == '@') || (c == '.') || (c == '#') || (c == ';')))
- return false;
+ (c == ',') || (c == '(') || (c == ')') || (c == '"') || (c == '*') ||
+ (c == '\'') || (c == '[') || (c == ']') || (c == '+') ||
+ (c == '_') || (c == ':') || (c == '@') || (c == '.') || (c == '#') || (c == ';')))
+ return false;
return true;
}
@@ -570,7 +570,7 @@ namespace Detail::algorithm
/////////////////////////////////////////////////////////////////////////////////////////
std::string LibCompiler::EncoderAMD64::CheckLine(std::string& line,
- const std::string& file)
+ const std::string& file)
{
std::string err_str;
@@ -653,7 +653,7 @@ std::string LibCompiler::EncoderAMD64::CheckLine(std::string& line,
}
bool LibCompiler::EncoderAMD64::WriteNumber(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -785,7 +785,7 @@ bool LibCompiler::EncoderAMD64::WriteNumber(const std::size_t& pos,
}
bool LibCompiler::EncoderAMD64::WriteNumber32(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -906,7 +906,7 @@ bool LibCompiler::EncoderAMD64::WriteNumber32(const std::size_t& pos,
}
bool LibCompiler::EncoderAMD64::WriteNumber16(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -1038,7 +1038,7 @@ bool LibCompiler::EncoderAMD64::WriteNumber16(const std::size_t& pos,
}
bool LibCompiler::EncoderAMD64::WriteNumber8(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -1152,7 +1152,7 @@ bool LibCompiler::EncoderAMD64::WriteNumber8(const std::size_t& pos,
/////////////////////////////////////////////////////////////////////////////////////////
bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
- const std::string& file)
+ const std::string& file)
{
if (LibCompiler::find_word(line, "public_segment "))
return true;
@@ -1301,7 +1301,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
{
auto num = GetNumber32(line, ",");
- for (auto& num_idx: num.number)
+ for (auto& num_idx : num.number)
{
if (num_idx == 0)
num_idx = 0xFF;
@@ -1324,7 +1324,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
currentRegList[0].fName[0] == 'e')
{
Detail::print_error("Invalid combination of operands and registers.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("comb_op_reg");
}
@@ -1332,7 +1332,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
currentRegList[1].fName[0] == 'e')
{
Detail::print_error("Invalid combination of operands and registers.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("comb_op_reg");
}
@@ -1342,7 +1342,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
currentRegList[0].fName[0] == 'e')
{
Detail::print_error("Invalid combination of operands and registers.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("comb_op_reg");
}
@@ -1350,7 +1350,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
currentRegList[1].fName[0] == 'e')
{
Detail::print_error("Invalid combination of operands and registers.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("comb_op_reg");
}
}
@@ -1360,7 +1360,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
currentRegList[0].fName[0] == 'e')
{
Detail::print_error("Invalid combination of operands and registers.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("comb_op_reg");
}
@@ -1368,7 +1368,7 @@ bool LibCompiler::EncoderAMD64::WriteLine(std::string& line,
currentRegList[1].fName[0] == 'e')
{
Detail::print_error("Invalid combination of operands and registers.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("comb_op_reg");
}
}
diff --git a/dev/LibCompiler/src/AssemblerARM64.cc b/dev/LibCompiler/src/AssemblerARM64.cc
index 6dfb8e5..637bbdf 100644
--- a/dev/LibCompiler/src/AssemblerARM64.cc
+++ b/dev/LibCompiler/src/AssemblerARM64.cc
@@ -64,7 +64,7 @@ static LibCompiler::AERecordHeader kCurrentRecord{
.fName = "", .fKind = LibCompiler::kPefCode, .fSize = 0, .fOffset = 0};
static std::vector<LibCompiler::AERecordHeader> kRecords;
-static std::vector<std::string> kUndefinedSymbols;
+static std::vector<std::string> kUndefinedSymbols;
static const std::string kUndefinedSymbol = ":UndefinedSymbol:";
static const std::string kRelocSymbol = ":RuntimeSymbol:";
@@ -318,7 +318,7 @@ static bool asm_read_attributes(std::string& line)
if (kOutputAsBinary)
{
Detail::print_error("Invalid extern_segment directive in flat binary mode.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("invalid_extern_segment_bin");
}
@@ -390,7 +390,7 @@ static bool asm_read_attributes(std::string& line)
if (kOutputAsBinary)
{
Detail::print_error("Invalid public_segment directive in flat binary mode.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("invalid_public_segment_bin");
}
@@ -485,8 +485,8 @@ namespace Detail::algorithm
/////////////////////////////////////////////////////////////////////////////////////////
-std::string LibCompiler::EncoderARM64::CheckLine(std::string& line,
- const std::string& file)
+std::string LibCompiler::EncoderARM64::CheckLine(std::string& line,
+ const std::string& file)
{
std::string err_str;
@@ -571,7 +571,7 @@ std::string LibCompiler::EncoderARM64::CheckLine(std::string& line,
}
bool LibCompiler::EncoderARM64::WriteNumber(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -696,8 +696,8 @@ bool LibCompiler::EncoderARM64::WriteNumber(const std::size_t& pos,
/////////////////////////////////////////////////////////////////////////////////////////
-bool LibCompiler::EncoderARM64::WriteLine(std::string& line,
- const std::string& file)
+bool LibCompiler::EncoderARM64::WriteLine(std::string& line,
+ const std::string& file)
{
if (LibCompiler::find_word(line, "public_segment"))
return false;
@@ -705,7 +705,6 @@ bool LibCompiler::EncoderARM64::WriteLine(std::string& line,
if (!Detail::algorithm::is_valid_arm64(line))
return false;
-
return true;
}
diff --git a/dev/LibCompiler/src/AssemblerPower.cc b/dev/LibCompiler/src/AssemblerPower.cc
index 1e45b19..9f11ae1 100644
--- a/dev/LibCompiler/src/AssemblerPower.cc
+++ b/dev/LibCompiler/src/AssemblerPower.cc
@@ -64,7 +64,7 @@ static LibCompiler::AERecordHeader kCurrentRecord{
.fName = "", .fKind = LibCompiler::kPefCode, .fSize = 0, .fOffset = 0};
static std::vector<LibCompiler::AERecordHeader> kRecords;
-static std::vector<std::string> kUndefinedSymbols;
+static std::vector<std::string> kUndefinedSymbols;
static const std::string kUndefinedSymbol = ":UndefinedSymbol:";
static const std::string kRelocSymbol = ":RuntimeSymbol:";
@@ -318,7 +318,7 @@ static bool asm_read_attributes(std::string& line)
if (kOutputAsBinary)
{
Detail::print_error("Invalid extern_segment directive in flat binary mode.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("invalid_extern_segment_bin");
}
@@ -390,7 +390,7 @@ static bool asm_read_attributes(std::string& line)
if (kOutputAsBinary)
{
Detail::print_error("Invalid public_segment directive in flat binary mode.",
- "LibCompiler");
+ "LibCompiler");
throw std::runtime_error("invalid_public_segment_bin");
}
@@ -486,7 +486,7 @@ namespace Detail::algorithm
/////////////////////////////////////////////////////////////////////////////////////////
std::string LibCompiler::EncoderPowerPC::CheckLine(std::string& line,
- const std::string& file)
+ const std::string& file)
{
std::string err_str;
@@ -617,7 +617,7 @@ std::string LibCompiler::EncoderPowerPC::CheckLine(std::string& line,
}
bool LibCompiler::EncoderPowerPC::WriteNumber(const std::size_t& pos,
- std::string& jump_label)
+ std::string& jump_label)
{
if (!isdigit(jump_label[pos]))
return false;
@@ -743,7 +743,7 @@ bool LibCompiler::EncoderPowerPC::WriteNumber(const std::size_t& pos,
/////////////////////////////////////////////////////////////////////////////////////////
bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
- const std::string& file)
+ const std::string& file)
{
if (LibCompiler::find_word(line, "public_segment"))
return false;
@@ -833,7 +833,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (reg_index > kAsmRegisterLimit)
{
Detail::print_error("invalid register index, r" + reg_str,
- file);
+ file);
throw std::runtime_error("invalid_register_index");
}
@@ -859,7 +859,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (num.number[i] > 0)
{
Detail::print_warning("number overflow on li operation.",
- file);
+ file);
break;
}
}
diff --git a/dev/LibCompiler/src/CCompiler64x0.cc b/dev/LibCompiler/src/CCompiler64x0.cc
index e224fbb..61e862f 100644
--- a/dev/LibCompiler/src/CCompiler64x0.cc
+++ b/dev/LibCompiler/src/CCompiler64x0.cc
@@ -79,13 +79,13 @@ namespace Detail
struct CompilerState final
{
std::vector<LibCompiler::SyntaxLeafList> fSyntaxTreeList;
- std::vector<CompilerRegisterMap> kStackFrame;
- std::vector<CompilerStructMap> kStructMap;
+ std::vector<CompilerRegisterMap> kStackFrame;
+ std::vector<CompilerStructMap> kStructMap;
LibCompiler::SyntaxLeafList* fSyntaxTree{nullptr};
- std::unique_ptr<std::ofstream> fOutputAssembly;
- std::string fLastFile;
- std::string fLastError;
- bool fVerbose;
+ std::unique_ptr<std::ofstream> fOutputAssembly;
+ std::string fLastFile;
+ std::string fLastError;
+ bool fVerbose;
};
} // namespace Detail
@@ -131,14 +131,14 @@ static std::string kRegisterPrefix = kAsmRegisterPrefix;
/////////////////////////////////////////
-static std::vector<std::string> kFileList;
-static LibCompiler::AssemblyFactory kFactory;
-static bool kInStruct = false;
-static bool kOnWhileLoop = false;
-static bool kOnForLoop = false;
-static bool kInBraces = false;
-static bool kIfFound = false;
-static size_t kBracesCount = 0UL;
+static std::vector<std::string> kFileList;
+static LibCompiler::AssemblyFactory kFactory;
+static bool kInStruct = false;
+static bool kOnWhileLoop = false;
+static bool kOnForLoop = false;
+static bool kInBraces = false;
+static bool kIfFound = false;
+static size_t kBracesCount = 0UL;
/* @brief C compiler backend for C */
class CompilerFrontend64x0 final : public LibCompiler::ICompilerFrontend
@@ -403,7 +403,7 @@ bool CompilerFrontend64x0::Compile(std::string text_, const std::string file)
if (text[text_index] == '=' && kInStruct)
{
Detail::print_error("assignement of value in struct " + text,
- file);
+ file);
continue;
}
diff --git a/dev/LibCompiler/src/CCompilerARM64.cc b/dev/LibCompiler/src/CCompilerARM64.cc
index d5b26be..af77a78 100644
--- a/dev/LibCompiler/src/CCompilerARM64.cc
+++ b/dev/LibCompiler/src/CCompilerARM64.cc
@@ -79,13 +79,13 @@ namespace Detail
struct CompilerState final
{
std::vector<LibCompiler::SyntaxLeafList> fSyntaxTreeList;
- std::vector<CompilerRegisterMap> kStackFrame;
- std::vector<CompilerStructMap> kStructMap;
+ std::vector<CompilerRegisterMap> kStackFrame;
+ std::vector<CompilerStructMap> kStructMap;
LibCompiler::SyntaxLeafList* fSyntaxTree{nullptr};
- std::unique_ptr<std::ofstream> fOutputAssembly;
- std::string fLastFile;
- std::string fLastError;
- bool fVerbose;
+ std::unique_ptr<std::ofstream> fOutputAssembly;
+ std::string fLastFile;
+ std::string fLastError;
+ bool fVerbose;
};
} // namespace Detail
@@ -131,20 +131,20 @@ static std::string kRegisterPrefix = kAsmRegisterPrefix;
/////////////////////////////////////////
-static std::vector<std::string> kFileList;
-static LibCompiler::AssemblyFactory kFactory;
-static bool kInStruct = false;
-static bool kOnWhileLoop = false;
-static bool kOnForLoop = false;
-static bool kInBraces = false;
-static bool kIfFound = false;
-static size_t kBracesCount = 0UL;
+static std::vector<std::string> kFileList;
+static LibCompiler::AssemblyFactory kFactory;
+static bool kInStruct = false;
+static bool kOnWhileLoop = false;
+static bool kOnForLoop = false;
+static bool kInBraces = false;
+static bool kIfFound = false;
+static size_t kBracesCount = 0UL;
/* @brief C compiler backend for C */
class CompilerFrontendARM64 final : public LibCompiler::ICompilerFrontend
{
public:
- explicit CompilerFrontendARM64() = default;
+ explicit CompilerFrontendARM64() = default;
~CompilerFrontendARM64() override = default;
LIBCOMPILER_COPY_DEFAULT(CompilerFrontendARM64);
@@ -401,7 +401,7 @@ bool CompilerFrontendARM64::Compile(std::string text, const std::string file)
if (text[text_index] == '=' && kInStruct)
{
Detail::print_error("assignement of value in struct " + text,
- file);
+ file);
continue;
}
diff --git a/dev/LibCompiler/src/CCompilerPower64.cc b/dev/LibCompiler/src/CCompilerPower64.cc
index 36fd771..119fcaa 100644
--- a/dev/LibCompiler/src/CCompilerPower64.cc
+++ b/dev/LibCompiler/src/CCompilerPower64.cc
@@ -81,9 +81,9 @@ namespace Detail
} // namespace Detail
static Detail::CompilerState kState;
-static SizeType kErrorLimit = 100;
-static std::string kIfFunction = "";
-static Int32 kAcceptableErrors = 0;
+static SizeType kErrorLimit = 100;
+static std::string kIfFunction = "";
+static Int32 kAcceptableErrors = 0;
namespace Detail
{
@@ -149,9 +149,9 @@ public:
}
};
-static CompilerFrontendPower64* kCompilerFrontend = nullptr;
+static CompilerFrontendPower64* kCompilerFrontend = nullptr;
static std::vector<Detail::CompilerType> kCompilerVariables;
-static std::vector<std::string> kCompilerFunctions;
+static std::vector<std::string> kCompilerFunctions;
static std::vector<Detail::CompilerType> kCompilerTypes;
namespace Detail
diff --git a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
index 19cf470..29de94c 100644
--- a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
+++ b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
@@ -11,7 +11,7 @@
#define kPrintF printf
-#define kExitOK (EXIT_SUCCESS)
+#define kExitOK (EXIT_SUCCESS)
#define kExitNO (EXIT_FAILURE)
#define kSplashCxx() \
@@ -136,10 +136,10 @@ static int kMachine = LibCompiler::AssemblyFactory::kArchAMD64;
/////////////////////////////////////////
-static size_t kRegisterCnt = kAsmRegisterLimit;
-static size_t kStartUsable = 8;
-static size_t kUsableLimit = 15;
-static size_t kRegisterCounter = kStartUsable;
+static size_t kRegisterCnt = kAsmRegisterLimit;
+static size_t kStartUsable = 8;
+static size_t kUsableLimit = 15;
+static size_t kRegisterCounter = kStartUsable;
static std::vector<LibCompiler::CompilerKeyword> kKeywords;
/////////////////////////////////////////
@@ -148,13 +148,13 @@ static std::vector<LibCompiler::CompilerKeyword> kKeywords;
/////////////////////////////////////////
-static std::vector<std::string> kFileList;
+static std::vector<std::string> kFileList;
static LibCompiler::AssemblyFactory kFactory;
-static bool kInStruct = false;
-static bool kOnWhileLoop = false;
-static bool kOnForLoop = false;
-static bool kInBraces = false;
-static size_t kBracesCount = 0UL;
+static bool kInStruct = false;
+static bool kOnWhileLoop = false;
+static bool kOnForLoop = false;
+static bool kInBraces = false;
+static size_t kBracesCount = 0UL;
/* @brief C++ compiler backend for the ZKA C++ driver */
class CompilerFrontendCPlusPlus final : public LibCompiler::ICompilerFrontend
@@ -226,7 +226,7 @@ bool CompilerFrontendCPlusPlus::Compile(const std::string text,
if (text.empty())
return false;
- std::size_t index = 0UL;
+ std::size_t index = 0UL;
std::vector<std::pair<LibCompiler::CompilerKeyword, std::size_t>> keywords_list;
bool found = false;
@@ -393,8 +393,8 @@ bool CompilerFrontendCPlusPlus::Compile(const std::string text,
return false;
accept:
- std::string fnName = text;
- size_t indexFnName = 0;
+ std::string fnName = text;
+ size_t indexFnName = 0;
// this one is for the type.
for (auto& ch : text)
@@ -424,7 +424,7 @@ bool CompilerFrontendCPlusPlus::Compile(const std::string text,
{
if (fnName[indexFnName - 1] != ')')
Detail::print_error("Invalid function name: " + fnName, file);
-
+
if ((indexFnName + 1) != fnName.size())
Detail::print_error("Extra characters after function name: " + fnName, file);
}
@@ -437,7 +437,7 @@ bool CompilerFrontendCPlusPlus::Compile(const std::string text,
break;
-tk_write_assembly:
+ tk_write_assembly:
syntax_tree.fUserValue = "jmp __LIBCOMPILER_" + fnName + "\n";
}
case LibCompiler::KeywordKind::kKeywordKindFunctionEnd: {
@@ -779,8 +779,7 @@ tk_write_assembly:
syntax_tree.fUserValue = "ret\n";
}
}
- default:
- {
+ default: {
break;
}
}
diff --git a/dev/LibCompiler/src/DynamicLinkerELF.cc b/dev/LibCompiler/src/DynamicLinkerELF.cc
index 2e52928..870b5f3 100644
--- a/dev/LibCompiler/src/DynamicLinkerELF.cc
+++ b/dev/LibCompiler/src/DynamicLinkerELF.cc
@@ -35,12 +35,12 @@
#define kLinkerVersionStr "TQ 64-Bit Linker (ELF) %s, (c) Amlal EL Mahrouss. 2024, all rights reserved.\n"
#define MemoryCopy(DST, SRC, SZ) memcpy(DST, SRC, SZ)
-#define StringCompare(DST, SRC) strcmp(DST, SRC)
+#define StringCompare(DST, SRC) strcmp(DST, SRC)
#define kPefNoCpu 0U
#define kPefNoSubCpu 0U
-#define kWhite "\e[0;97m"
+#define kWhite "\e[0;97m"
#define kStdOut (std::cout << kWhite << "ld64: ")
@@ -53,24 +53,24 @@
namespace Detail
{
-struct DynamicLinkerBlob final
-{
- std::vector<CharType> mBlob{}; // PEF code/bss/data blob.
- UIntPtr mObjOffset{0UL}; // the offset of the PEF container header..
-};
-}
-
-static Bool kFatBinaryEnable = false;
-static Bool kStartFound = false;
-static Bool kDuplicateSymbols = false;
-static Bool kVerbose = false;
+ struct DynamicLinkerBlob final
+ {
+ std::vector<CharType> mBlob{}; // PEF code/bss/data blob.
+ UIntPtr mObjOffset{0UL}; // the offset of the PEF container header..
+ };
+} // namespace Detail
+
+static Bool kFatBinaryEnable = false;
+static Bool kStartFound = false;
+static Bool kDuplicateSymbols = false;
+static Bool kVerbose = false;
/* object code and list. */
-static std::vector<LibCompiler::String> kObjectList;
+static std::vector<LibCompiler::String> kObjectList;
static std::vector<Detail::DynamicLinkerBlob> kObjectBytes;
-static uintptr_t kMIBCount = 8;
-static uintptr_t kByteCount = 1024;
+static uintptr_t kMIBCount = 8;
+static uintptr_t kByteCount = 1024;
#define kPrintF printf
#define kLinkerSplash() kPrintF(kWhite kLinkerVersionStr, kDistVersion)
diff --git a/dev/LibCompiler/src/DynamicLinkerPEF.cc b/dev/LibCompiler/src/DynamicLinkerPEF.cc
index ce014bd..cdcd0e3 100644
--- a/dev/LibCompiler/src/DynamicLinkerPEF.cc
+++ b/dev/LibCompiler/src/DynamicLinkerPEF.cc
@@ -35,12 +35,12 @@
#define kLinkerVersionStr "TQ 64-Bit Linker (Preferred Executable) %s, (c) Amlal EL Mahrouss. 2024, all rights reserved.\n"
#define MemoryCopy(DST, SRC, SZ) memcpy(DST, SRC, SZ)
-#define StringCompare(DST, SRC) strcmp(DST, SRC)
+#define StringCompare(DST, SRC) strcmp(DST, SRC)
#define kPefNoCpu 0U
#define kPefNoSubCpu 0U
-#define kWhite "\e[0;97m"
+#define kWhite "\e[0;97m"
#define kStdOut (std::cout << kWhite << "ld64: ")
@@ -51,41 +51,41 @@
/// @brief PEF stack size symbol.
#define kLinkerStackSizeSymbol "SizeOfReserveStack"
-namespace Detail
+namespace Detail
{
-struct DynamicLinkerBlob final
-{
- std::vector<CharType> mBlob{}; // PEF code/bss/data blob.
- UIntPtr mObjOffset{0UL}; // the offset of the PEF container header..
-};
-}
+ struct DynamicLinkerBlob final
+ {
+ std::vector<CharType> mBlob{}; // PEF code/bss/data blob.
+ UIntPtr mObjOffset{0UL}; // the offset of the PEF container header..
+ };
+} // namespace Detail
enum
{
kABITypeStart = 0x1010, /* Invalid ABI start of ABI list. */
- kABITypeZKA = 0x5046, /* PF (ZKA PEF ABI) */
+ kABITypeZKA = 0x5046, /* PF (ZKA PEF ABI) */
kABITypeInvalid = 0xFFFF,
};
-static LibCompiler::String kOutput = "";
-static Int32 kAbi = kABITypeZKA;
-static Int32 kSubArch = kPefNoSubCpu;
-static Int32 kArch = LibCompiler::kPefArchInvalid;
-static Bool kFatBinaryEnable = false;
-static Bool kStartFound = false;
-static Bool kDuplicateSymbols = false;
-static Bool kVerbose = false;
+static LibCompiler::String kOutput = "";
+static Int32 kAbi = kABITypeZKA;
+static Int32 kSubArch = kPefNoSubCpu;
+static Int32 kArch = LibCompiler::kPefArchInvalid;
+static Bool kFatBinaryEnable = false;
+static Bool kStartFound = false;
+static Bool kDuplicateSymbols = false;
+static Bool kVerbose = false;
/* ld64 is to be found, mld is to be found at runtime. */
static const char* kLdDefineSymbol = ":UndefinedSymbol:";
static const char* kLdDynamicSym = ":RuntimeSymbol:";
/* object code and list. */
-static std::vector<LibCompiler::String> kObjectList;
+static std::vector<LibCompiler::String> kObjectList;
static std::vector<Detail::DynamicLinkerBlob> kObjectBytes;
-static uintptr_t kMIBCount = 8;
-static uintptr_t kByteCount = 1024;
+static uintptr_t kMIBCount = 8;
+static uintptr_t kByteCount = 1024;
#define kPrintF printf
#define kLinkerSplash() kPrintF(kWhite kLinkerVersionStr, kDistVersion)
@@ -99,7 +99,7 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
/**
* @brief parse flags and trigger options.
*/
- for (size_t linker_arg = 1; linker_arg < argc; ++linker_arg)
+ for (size_t linker_arg = 1; linker_arg < argc; ++linker_arg)
{
if (StringCompare(argv[linker_arg], "--ld64:help") == 0)
{
@@ -343,10 +343,10 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
++ae_record_index)
{
LibCompiler::PEFCommandHeader command_header{0};
- std::size_t offset_of_obj = ae_records[ae_record_index].fOffset;
+ std::size_t offset_of_obj = ae_records[ae_record_index].fOffset;
MemoryCopy(command_header.Name, ae_records[ae_record_index].fName,
- kPefNameLen);
+ kPefNameLen);
LibCompiler::String cmd_hdr_name(command_header.Name);
@@ -412,7 +412,7 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
for (auto& byte : bytes)
{
- kObjectBytes.push_back({ .mBlob = bytes, .mObjOffset = ae_header.fStartCode });
+ kObjectBytes.push_back({.mBlob = bytes, .mObjOffset = ae_header.fStartCode});
}
reader_protocol.FP.close();
@@ -468,7 +468,7 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
++not_found_idx)
{
if (const auto it = std::find(not_found.begin(), not_found.end(),
- LibCompiler::String(command_headers[not_found_idx].Name));
+ LibCompiler::String(command_headers[not_found_idx].Name));
it != not_found.end())
{
LibCompiler::String symbol_imp = *it;
@@ -494,7 +494,7 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
LibCompiler::String::npos)
{
LibCompiler::String undefined_symbol = command_hdr.Name;
- auto result_of_sym =
+ auto result_of_sym =
undefined_symbol.substr(undefined_symbol.find(symbol_imp));
for (int i = 0; result_of_sym[i] != 0; ++i)
@@ -524,7 +524,7 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
if (kVerbose)
kStdOut
<< "undefined entrypoint: " << kPefStart << ", you may have forget to ld64 "
- "against your compiler's runtime library.\n";
+ "against your compiler's runtime library.\n";
kStdOut << "undefined entrypoint " << kPefStart
<< " for executable: " << kOutput << "\n";
@@ -541,10 +541,10 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
strncpy(date_cmd_hdr.Name, timeStampStr.c_str(), timeStampStr.size());
- date_cmd_hdr.Flags = 0;
- date_cmd_hdr.Kind = LibCompiler::kPefZero;
+ date_cmd_hdr.Flags = 0;
+ date_cmd_hdr.Kind = LibCompiler::kPefZero;
date_cmd_hdr.Offset = output_fc.tellp();
- date_cmd_hdr.Size = timeStampStr.size();
+ date_cmd_hdr.Size = timeStampStr.size();
command_headers.push_back(date_cmd_hdr);
@@ -575,18 +575,18 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
MemoryCopy(abi_cmd_hdr.Name, abi.c_str(), abi.size());
- abi_cmd_hdr.Size = abi.size();
+ abi_cmd_hdr.Size = abi.size();
abi_cmd_hdr.Offset = output_fc.tellp();
- abi_cmd_hdr.Flags = 0;
- abi_cmd_hdr.Kind = LibCompiler::kPefLinkerID;
+ abi_cmd_hdr.Flags = 0;
+ abi_cmd_hdr.Kind = LibCompiler::kPefLinkerID;
command_headers.push_back(abi_cmd_hdr);
LibCompiler::PEFCommandHeader stack_cmd_hdr{0};
- stack_cmd_hdr.Cpu = kArch;
- stack_cmd_hdr.Flags = 0;
- stack_cmd_hdr.Size = sizeof(uintptr_t);
+ stack_cmd_hdr.Cpu = kArch;
+ stack_cmd_hdr.Flags = 0;
+ stack_cmd_hdr.Size = sizeof(uintptr_t);
stack_cmd_hdr.Offset = 0;
MemoryCopy(stack_cmd_hdr.Name, kLinkerStackSizeSymbol, strlen(kLinkerStackSizeSymbol));
@@ -608,12 +608,12 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
MemoryCopy(uuid_cmd_hdr.Name, "Container:GUID:4:", strlen("Container:GUID:4:"));
MemoryCopy(uuid_cmd_hdr.Name + strlen("Container:GUID:4:"), uuidStr.c_str(),
- uuidStr.size());
+ uuidStr.size());
- uuid_cmd_hdr.Size = strlen(uuid_cmd_hdr.Name);
+ uuid_cmd_hdr.Size = strlen(uuid_cmd_hdr.Name);
uuid_cmd_hdr.Offset = output_fc.tellp();
- uuid_cmd_hdr.Flags = LibCompiler::kPefLinkerID;
- uuid_cmd_hdr.Kind = LibCompiler::kPefZero;
+ uuid_cmd_hdr.Flags = LibCompiler::kPefLinkerID;
+ uuid_cmd_hdr.Kind = LibCompiler::kPefZero;
command_headers.push_back(uuid_cmd_hdr);
diff --git a/dev/LibIDE/TerminalEmulator.h b/dev/LibIDE/TerminalEmulator.h
index 39ae671..a155e53 100644
--- a/dev/LibIDE/TerminalEmulator.h
+++ b/dev/LibIDE/TerminalEmulator.h
@@ -8,4 +8,3 @@
class ITerminalEmulator;
class iTerminalEscapeCode;
-