diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:13:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:15:17 +0100 |
| commit | a13e1c0911c0627184bc38f18c7fdda64447b3ad (patch) | |
| tree | 073a62c09bf216e85a3f310376640fa1805147f9 /dev/Boot/src/BootTextWriter.cc | |
| parent | 149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff) | |
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Boot/src/BootTextWriter.cc')
| -rw-r--r-- | dev/Boot/src/BootTextWriter.cc | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/dev/Boot/src/BootTextWriter.cc b/dev/Boot/src/BootTextWriter.cc deleted file mode 100644 index b58d3429..00000000 --- a/dev/Boot/src/BootTextWriter.cc +++ /dev/null @@ -1,169 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. - - File: BootTextWriter.cc - Purpose: BootZ string library - - Revision History: - - - -------------------------------------------- */ - -#include <FirmwareKit/EFI/API.h> -#include <BootKit/Platform.h> -#include <BootKit/Protocol.h> -#include <BootKit/BootKit.h> - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -/// BUGS: 0 /// -///////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** -@brief puts wrapper over EFI ConOut. -*/ -Boot::BootTextWriter& Boot::BootTextWriter::Write(const CharacterTypeUTF16* str) -{ -#ifdef __DEBUG__ - if (!str || *str == 0) - return *this; - - CharacterTypeUTF16 strTmp[2]; - strTmp[1] = 0; - - for (size_t i = 0; str[i] != 0; i++) - { - if (str[i] == '\r') - { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); - - strTmp[0] = '\n'; - ST->ConOut->OutputString(ST->ConOut, strTmp); - } - else - { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); - } - } -#endif // ifdef __DEBUG__ - - return *this; -} - -/// @brief UTF-8 equivalent of Write (UTF-16). -/// @param str the input string. -Boot::BootTextWriter& Boot::BootTextWriter::Write(const Char* str) -{ -#ifdef __DEBUG__ - if (!str || *str == 0) - return *this; - - CharacterTypeUTF16 strTmp[2]; - strTmp[1] = 0; - - for (size_t i = 0; str[i] != 0; i++) - { - if (str[i] == '\r') - { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); - - strTmp[0] = '\n'; - ST->ConOut->OutputString(ST->ConOut, strTmp); - } - else - { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); - } - } -#endif // ifdef __DEBUG__ - - return *this; -} - -Boot::BootTextWriter& Boot::BootTextWriter::Write(const UChar* str) -{ -#ifdef __DEBUG__ - if (!str || *str == 0) - return *this; - - CharacterTypeUTF16 strTmp[2]; - strTmp[1] = 0; - - for (size_t i = 0; str[i] != 0; i++) - { - if (str[i] == '\r') - { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); - - strTmp[0] = '\n'; - ST->ConOut->OutputString(ST->ConOut, strTmp); - } - else - { - strTmp[0] = str[i]; - ST->ConOut->OutputString(ST->ConOut, strTmp); - } - } -#endif // ifdef __DEBUG__ - - return *this; -} - -/** -@brief putc wrapper over EFI ConOut. -*/ -Boot::BootTextWriter& Boot::BootTextWriter::WriteCharacter(CharacterTypeUTF16 c) -{ -#ifdef __DEBUG__ - EfiCharType str[2]; - - str[0] = c; - str[1] = 0; - ST->ConOut->OutputString(ST->ConOut, str); -#endif // ifdef __DEBUG__ - - return *this; -} - -Boot::BootTextWriter& Boot::BootTextWriter::Write(const Long& x) -{ -#ifdef __DEBUG__ - this->_Write(x); - this->Write("h"); -#endif // ifdef __DEBUG__ - - return *this; -} - -Boot::BootTextWriter& Boot::BootTextWriter::_Write(const Long& x) -{ -#ifdef __DEBUG__ - UInt64 y = (x > 0 ? x : -x) / 16; - UInt64 h = (x > 0 ? x : -x) % 16; - - if (y) - this->_Write(y); - - /* fail if the hex number is not base-16 */ - if (h > 16) - { - this->WriteCharacter('?'); - return *this; - } - - if (y < 0) - y = -y; - - const char cNumbers[] = "0123456789ABCDEF"; - - this->WriteCharacter(cNumbers[h]); -#endif // ifdef __DEBUG__ - - return *this; -} |
