diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-04 16:23:57 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-04 16:23:57 +0200 |
| commit | 0495962407af7f89b72e41c8b099cfba51d68e08 (patch) | |
| tree | 249b0eadef2c6e972acd9750c822cfad50cde479 /Sources | |
| parent | 12f3049c5eda64c8ced549e23ac1a22f04bc702f (diff) | |
MHR-36: Finishing C++ compiler
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Sources')
| -rw-r--r-- | Sources/64x0-cc.cc | 4 | ||||
| -rw-r--r-- | Sources/String.cc | 16 | ||||
| -rw-r--r-- | Sources/ppcasm.cc | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/Sources/64x0-cc.cc b/Sources/64x0-cc.cc index 4be1292..9c32953 100644 --- a/Sources/64x0-cc.cc +++ b/Sources/64x0-cc.cc @@ -23,8 +23,6 @@ #include <utility> #include <vector> -#define kOk 0 - /* C driver */ /* This is part of MPCC C SDK. */ /* (c) Zeta Electronics Corporation */ @@ -41,6 +39,8 @@ ///////////////////// +#define kOk (0) + #define kBlank "\e[0;30m" #define kRed "\e[0;31m" #define kWhite "\e[0;97m" diff --git a/Sources/String.cc b/Sources/String.cc index 5a8f3ed..c7185ca 100644 --- a/Sources/String.cc +++ b/Sources/String.cc @@ -19,7 +19,6 @@ */ #include <Comm/StdKit/String.hpp> -#include <utility> namespace CompilerKit { CharType *StringView::Data() { return m_Data; } @@ -80,10 +79,13 @@ StringView StringBuilder::Construct(const CharType *data) { const char *StringBuilder::FromInt(const char *fmt, int i) { if (!fmt) return ("-1"); - char *ret = new char[8 + string_length(fmt)]; + auto ret_len = 8 + string_length(fmt); + char *ret = new char[ret_len]; if (!ret) return ("-1"); + memset(ret, 0, ret_len); + CharType result[8]; if (!to_str(result, sizeof(int), i)) { delete[] ret; @@ -150,18 +152,18 @@ bool StringBuilder::Equals(const char *lhs, const char *rhs) { return true; } -const char *StringBuilder::Format(const char *fmt, const char *fmt2) { - if (!fmt || !fmt2) return ("?"); +const char *StringBuilder::Format(const char *fmt, const char *fmtRight) { + if (!fmt || !fmtRight) return ("?"); - char *ret = new char[string_length(fmt2) + string_length(fmt2)]; + char *ret = new char[string_length(fmtRight) + string_length(fmtRight)]; if (!ret) return ("?"); for (SizeType idx = 0; idx < string_length(fmt); ++idx) { if (fmt[idx] == '%') { SizeType result_cnt = idx; - for (SizeType y_idx = 0; y_idx < string_length(fmt2); ++y_idx) { - ret[result_cnt] = fmt2[y_idx]; + for (SizeType y_idx = 0; y_idx < string_length(fmtRight); ++y_idx) { + ret[result_cnt] = fmtRight[y_idx]; ++result_cnt; } diff --git a/Sources/ppcasm.cc b/Sources/ppcasm.cc index 8d5f088..f8e47d7 100644 --- a/Sources/ppcasm.cc +++ b/Sources/ppcasm.cc @@ -43,11 +43,11 @@ #define kStdOut (std::cout << kWhite) #define kStdErr (std::cout << kRed) +constexpr auto cPowerIPAlignment = 0x4U; + static CharType kOutputArch = CompilerKit::kPefArchPowerPC; static Boolean kOutputAsBinary = false; -constexpr auto cPowerIPAlignment = 0x4U; - static UInt32 kErrorLimit = 10; static UInt32 kAcceptableErrors = 0; |
