diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-03 14:52:52 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-03 14:52:52 +0100 |
| commit | fcccf780db4cdc23858c108c6cde1d08360ee88f (patch) | |
| tree | 6e9d871860fe4a6f415b95f7d77d2ac5bf9275a2 /Private/NewBoot/Source/String.cxx | |
| parent | 1f0cdb9f4ad64623ae8434a81fcbe8d37a5c8164 (diff) | |
Kernel: Got stuck at the way I do things, trying another approach see
hcore ticket HCR-11 in Jira.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/Source/String.cxx')
| -rw-r--r-- | Private/NewBoot/Source/String.cxx | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/Private/NewBoot/Source/String.cxx b/Private/NewBoot/Source/String.cxx new file mode 100644 index 00000000..a2d19f1f --- /dev/null +++ b/Private/NewBoot/Source/String.cxx @@ -0,0 +1,88 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: String.cxx + Purpose: NewBoot string library + + Revision History: + + + +------------------------------------------- */ + +#include <BootKit/BootKit.hxx> +#include <EFIKit/Api.hxx> +#include <FSKit/NewFS.hxx> + +/// bugs 0 + +///////////////////////////////////////////////////////////////////////////////////////////////////////// + +HCore::SizeT BCopyMem(CharacterType *dest, CharacterType *src, + const HCore::SizeT len) { + if (!dest || !src) return 0; + + SizeT index = 0UL; + for (; index < len; ++index) { + dest[index] = src[index]; + } + + return index; +} + +HCore::SizeT BStrLen(const CharacterType *ptr) { + if (!ptr) return 0; + + HCore::SizeT cnt = 0; + + while (*ptr != (CharacterType)0) { + ++ptr; + ++cnt; + } + + return cnt; +} + +HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte, + const HCore::SizeT len) { + if (!src) return 0; + + HCore::SizeT cnt = 0UL; + + while (*src != 0) { + if (cnt > len) break; + + *src = byte; + ++src; + + ++cnt; + } + + return cnt; +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +@brief puts wrapper over EFI. +*/ +BTextWriter &BTextWriter::WriteString(const CharacterType *str) { + if (*str == 0 || !str) return *this; + + ST->ConOut->OutputString(ST->ConOut, str); + + return *this; +} + +/** +@brief putc wrapper over EFI. +*/ +BTextWriter &BTextWriter::WriteCharacter(CharacterType c) { + EfiCharType str[2]; + str[0] = c; + str[1] = 0; + ST->ConOut->OutputString(ST->ConOut, str); + + return *this; +} |
