summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/src/AssemblerPower.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-01-09 13:12:48 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-01-09 13:12:48 +0100
commitac2debcd00dd78ad77f58d0c448862b76619ea61 (patch)
tree7a3b4201b7c60febcd08cdb99e97aa426302535c /dev/LibCompiler/src/AssemblerPower.cc
parent4b0be5c40cab48a256f68c1e41b6af3d93512c61 (diff)
ADD: Minor improvements and refactors.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/LibCompiler/src/AssemblerPower.cc')
-rw-r--r--dev/LibCompiler/src/AssemblerPower.cc44
1 files changed, 22 insertions, 22 deletions
diff --git a/dev/LibCompiler/src/AssemblerPower.cc b/dev/LibCompiler/src/AssemblerPower.cc
index a98e3e8..e2bc76d 100644
--- a/dev/LibCompiler/src/AssemblerPower.cc
+++ b/dev/LibCompiler/src/AssemblerPower.cc
@@ -171,7 +171,7 @@ LIBCOMPILER_MODULE(AssemblerMainPower64)
{
if (auto ln = asm64.CheckLine(line, argv[i]); !ln.empty())
{
- Details::print_error(ln, argv[i]);
+ Detail::print_error(ln, argv[i]);
continue;
}
@@ -185,7 +185,7 @@ LIBCOMPILER_MODULE(AssemblerMainPower64)
if (kVerbose)
{
std::string what = e.what();
- Details::print_warning("exit because of: " + what, "LibCompiler");
+ Detail::print_warning("exit because of: " + what, "LibCompiler");
}
std::filesystem::remove(object_output);
@@ -317,7 +317,7 @@ static bool asm_read_attributes(std::string& line)
{
if (kOutputAsBinary)
{
- Details::print_error("Invalid extern_segment directive in flat binary mode.",
+ Detail::print_error("Invalid extern_segment directive in flat binary mode.",
"LibCompiler");
throw std::runtime_error("invalid_extern_segment_bin");
}
@@ -326,7 +326,7 @@ static bool asm_read_attributes(std::string& line)
if (name.size() == 0)
{
- Details::print_error("Invalid extern_segment", "LibCompiler");
+ Detail::print_error("Invalid extern_segment", "LibCompiler");
throw std::runtime_error("invalid_extern_segment");
}
@@ -389,7 +389,7 @@ static bool asm_read_attributes(std::string& line)
{
if (kOutputAsBinary)
{
- Details::print_error("Invalid public_segment directive in flat binary mode.",
+ Detail::print_error("Invalid public_segment directive in flat binary mode.",
"LibCompiler");
throw std::runtime_error("invalid_public_segment_bin");
}
@@ -462,7 +462,7 @@ static bool asm_read_attributes(std::string& line)
// \brief algorithms and helpers.
-namespace Details::algorithm
+namespace Detail::algorithm
{
// \brief authorize a brief set of characters.
static inline bool is_not_alnum_space(char c)
@@ -477,7 +477,7 @@ namespace Details::algorithm
{
return std::find_if(str.begin(), str.end(), is_not_alnum_space) == str.end();
}
-} // namespace Details::algorithm
+} // namespace Detail::algorithm
/////////////////////////////////////////////////////////////////////////////////////////
@@ -505,7 +505,7 @@ std::string LibCompiler::EncoderPowerPC::CheckLine(std::string& line,
else
{
/// does the line contains valid input?
- if (!Details::algorithm::is_valid_power64(line))
+ if (!Detail::algorithm::is_valid_power64(line))
{
err_str = "Line contains non alphanumeric characters.\nhere -> ";
err_str += line;
@@ -515,7 +515,7 @@ std::string LibCompiler::EncoderPowerPC::CheckLine(std::string& line,
return err_str;
}
- if (!Details::algorithm::is_valid_power64(line))
+ if (!Detail::algorithm::is_valid_power64(line))
{
err_str = "Line contains non alphanumeric characters.\nhere -> ";
err_str += line;
@@ -630,7 +630,7 @@ bool LibCompiler::EncoderPowerPC::WriteNumber(const std::size_t& pos,
{
if (errno != 0)
{
- Details::print_error("invalid hex number: " + jump_label, "LibCompiler");
+ Detail::print_error("invalid hex number: " + jump_label, "LibCompiler");
throw std::runtime_error("invalid_hex");
}
}
@@ -657,7 +657,7 @@ bool LibCompiler::EncoderPowerPC::WriteNumber(const std::size_t& pos,
{
if (errno != 0)
{
- Details::print_error("invalid binary number: " + jump_label, "LibCompiler");
+ Detail::print_error("invalid binary number: " + jump_label, "LibCompiler");
throw std::runtime_error("invalid_bin");
}
}
@@ -684,7 +684,7 @@ bool LibCompiler::EncoderPowerPC::WriteNumber(const std::size_t& pos,
{
if (errno != 0)
{
- Details::print_error("invalid octal number: " + jump_label, "LibCompiler");
+ Detail::print_error("invalid octal number: " + jump_label, "LibCompiler");
throw std::runtime_error("invalid_octal");
}
}
@@ -747,7 +747,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
{
if (LibCompiler::find_word(line, "public_segment"))
return false;
- if (!Details::algorithm::is_valid_power64(line))
+ if (!Detail::algorithm::is_valid_power64(line))
return false;
for (auto& opcode_risc : kOpcodesPowerPC)
@@ -820,7 +820,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
isdigit(line[line_index + 2]))
{
reg_str += line[line_index + 3];
- Details::print_error(
+ Detail::print_error(
"invalid register index, r" + reg_str +
"\nnote: The POWER accepts registers from r0 to r32.",
file);
@@ -832,7 +832,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (reg_index > kAsmRegisterLimit)
{
- Details::print_error("invalid register index, r" + reg_str,
+ Detail::print_error("invalid register index, r" + reg_str,
file);
throw std::runtime_error("invalid_register_index");
}
@@ -858,7 +858,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
{
if (num.number[i] > 0)
{
- Details::print_warning("number overflow on li operation.",
+ Detail::print_warning("number overflow on li operation.",
file);
break;
}
@@ -948,7 +948,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (found_some_count > 3)
{
- Details::print_error("Too much registers. -> " + line, file);
+ Detail::print_error("Too much registers. -> " + line, file);
throw std::runtime_error("too_much_regs");
}
}
@@ -959,7 +959,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (found_some_count > 3)
{
- Details::print_error("Too much registers. -> " + line, file);
+ Detail::print_error("Too much registers. -> " + line, file);
throw std::runtime_error("too_much_regs");
}
}
@@ -980,7 +980,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (found_some_count > 1)
{
- Details::print_error("Too much registers. -> " + line, file);
+ Detail::print_error("Too much registers. -> " + line, file);
throw std::runtime_error("too_much_regs");
}
@@ -1052,7 +1052,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
{
if (register_count == 1)
{
- Details::print_error("Too few registers. -> " + line, file);
+ Detail::print_error("Too few registers. -> " + line, file);
throw std::runtime_error("too_few_registers");
}
}
@@ -1063,7 +1063,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
// remember! register to register!
if (found_some_count == 1)
{
- Details::print_error(
+ Detail::print_error(
"Unrecognized register found.\ntip: each AssemblerPower register "
"starts with 'r'.\nline: " +
line,
@@ -1075,7 +1075,7 @@ bool LibCompiler::EncoderPowerPC::WriteLine(std::string& line,
if (found_some_count < 1 && name[0] != 'l' && name[0] != 's')
{
- Details::print_error(
+ Detail::print_error(
"invalid combination of opcode and registers.\nline: " + line,
file);
throw std::runtime_error("invalid_comb_op_reg");