Mark GrpDIB, GrpText, CullingManager and FileLoader PORTED; test the text file loader

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 12:25:28 +09:00
co-authored by Claude Opus 5.5
parent 3c2ef81536
commit 549e12db7c
6 changed files with 449 additions and 33 deletions
+4
View File
@@ -576,3 +576,7 @@
{"date": "2026-09-30T03:23:35+00:00", "unit": "SphereLib/spherepack.cpp", "action": "all functions PORTED: src/port/SphereLib is the 40250 source verbatim", "evidence": "diff vs ClientVS22/source/SphereLib (cp949->utf8, CR stripped, #include lines dropped) = 0 lines; tests/port/port_spherelib_test.cpp range/point/ray/frustum queries"}
{"date": "2026-09-30T03:23:35+00:00", "unit": "SphereLib/sphere.cpp", "action": "all functions PORTED: src/port/SphereLib is the 40250 source verbatim", "evidence": "diff vs ClientVS22/source/SphereLib (cp949->utf8, CR stripped, #include lines dropped) = 0 lines; tests/port/port_spherelib_test.cpp range/point/ray/frustum queries"}
{"date": "2026-09-30T03:23:35+00:00", "unit": "SphereLib/frustum.cpp", "action": "all functions PORTED: src/port/SphereLib is the 40250 source verbatim", "evidence": "diff vs ClientVS22/source/SphereLib (cp949->utf8, CR stripped, #include lines dropped) = 0 lines; tests/port/port_spherelib_test.cpp range/point/ray/frustum queries"}
{"date": "2026-09-30T03:25:27+00:00", "unit": "EterLib/GrpDIB.cpp", "action": "all functions PORTED (verbatim)", "evidence": "diff vs ClientVS22/source (cp949->utf8, CR stripped, #include dropped): only header comments"}
{"date": "2026-09-30T03:25:27+00:00", "unit": "EterLib/GrpText.cpp", "action": "all functions PORTED (verbatim)", "evidence": "diff vs ClientVS22/source (cp949->utf8, CR stripped, #include dropped): only header comments"}
{"date": "2026-09-30T03:25:27+00:00", "unit": "EterLib/CullingManager.cpp", "action": "all functions PORTED (verbatim)", "evidence": "diff vs ClientVS22/source (cp949->utf8, CR stripped, #include dropped): only header comments"}
{"date": "2026-09-30T03:25:27+00:00", "unit": "EterBase/FileLoader.cpp", "action": "all functions PORTED (verbatim)", "evidence": "diff vs ClientVS22/source (cp949->utf8, CR stripped, #include dropped): only header comments and the signed-char cast"}
+123 -33
View File
@@ -5,98 +5,188 @@
"contracts": [],
"functions": {
"CMemoryTextFileLoader::CMemoryTextFileLoader": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::CMemoryTextFileLoader"
],
"status": "ADAPTED",
"note": "40250 file verbatim, one change: the high-bit test casts to signed char (char is unsigned on arm64)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::~CMemoryTextFileLoader": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::~CMemoryTextFileLoader"
],
"status": "ADAPTED",
"note": "40250 file verbatim, one change: the high-bit test casts to signed char (char is unsigned on arm64)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::SplitLineByTab": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::SplitLineByTab"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::SplitLine2": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::SplitLine2"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::SplitLine": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::SplitLine"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::GetLineCount": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::GetLineCount"
],
"status": "ADAPTED",
"note": "40250 file verbatim, one change: the high-bit test casts to signed char (char is unsigned on arm64)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::CheckLineIndex": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::CheckLineIndex"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::GetLineString": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::GetLineString"
],
"status": "ADAPTED",
"note": "40250 file verbatim, one change: the high-bit test casts to signed char (char is unsigned on arm64)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryTextFileLoader::Bind": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryTextFileLoader::Bind"
],
"status": "ADAPTED",
"note": "40250 file verbatim, one change: the high-bit test casts to signed char (char is unsigned on arm64)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::GetSize": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::GetSize"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::GetPosition": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::GetPosition"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::IsReadableSize": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::IsReadableSize"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::Read": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::Read"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::GetCurrentPositionPointer": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::GetCurrentPositionPointer"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::CMemoryFileLoader": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::CMemoryFileLoader"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CMemoryFileLoader::~CMemoryFileLoader": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CMemoryFileLoader::~CMemoryFileLoader"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::GetSize": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::GetSize"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::Read": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::Read"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::Open": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::Open"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::Close": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::Close"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::Initialize": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::Initialize"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::CDiskFileLoader": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::CDiskFileLoader"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
},
"CDiskFileLoader::~CDiskFileLoader": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileLoader.cpp:CDiskFileLoader::~CDiskFileLoader"
],
"test": "tests/port/port_utils_test.cpp",
"note": "verbatim 40250 source; the CP949 lead-byte test in Bind casts to signed char because char is unsigned on arm64"
}
}
}
@@ -0,0 +1,99 @@
{
"reference": "EterLib/CullingManager.cpp",
"reference_sha256": "77d62d9fa8cc373d8420d5e36d441ca93e53961720542176458f80daf1033c3e",
"priority": "P4",
"contracts": [],
"functions": {
"CCullingManager::RayTraceCallback": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::RayTraceCallback"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::VisibilityCallback": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::VisibilityCallback"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::RangeTestCallback": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::RangeTestCallback"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::Reset": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::Reset"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::Update": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::Update"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::Process": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::Process"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::Register": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::Register"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::Unregister": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::Unregister"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::CCullingManager": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::CCullingManager"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::~CCullingManager": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::~CCullingManager"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::FindRange": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::FindRange"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::FindRay": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::FindRay"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
},
"CCullingManager::FindRayDistance": {
"status": "PORTED",
"impl": [
"src/port/EterLib/CullingManager.cpp:CCullingManager::FindRayDistance"
],
"note": "verbatim 40250 source (only a mis-encoded Korean comment differs); sphere tree covered by tests/port/port_spherelib_test.cpp"
}
}
}
+104
View File
@@ -0,0 +1,104 @@
{
"reference": "EterLib/GrpDIB.cpp",
"reference_sha256": "b0b1967724d32cdb9a68cdba8c430cb9b2f3331880dc60f020e0aa5337f1efb5",
"priority": "P4",
"contracts": [],
"functions": {
"CGraphicDib::CGraphicDib": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::CGraphicDib"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::~CGraphicDib": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::~CGraphicDib"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::Initialize": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::Initialize"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::Destroy": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::Destroy"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::Create": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::Create"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::GetDCHandle": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::GetDCHandle"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::SetBkMode": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::SetBkMode"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::TextOut": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::TextOut"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::Put": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::Put"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::GetPointer": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::GetPointer"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::GetWidth": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::GetWidth"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
},
"CGraphicDib::GetHeight": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpDIB.cpp:CGraphicDib::GetHeight"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source; the GDI calls are the FreeType-backed platform/Win32Gdi.cpp"
}
}
}
+88
View File
@@ -0,0 +1,88 @@
{
"reference": "EterLib/GrpText.cpp",
"reference_sha256": "da823bc888a627e8f57f07535b96345dd5b9b167ef54167c82d7665ea575a448",
"priority": "P4",
"contracts": [],
"functions": {
"CGraphicText::CGraphicText": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::CGraphicText"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::~CGraphicText": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::~CGraphicText"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::CreateDeviceObjects": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::CreateDeviceObjects"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::DestroyDeviceObjects": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::DestroyDeviceObjects"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::GetFontTexturePointer": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::GetFontTexturePointer"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::Type": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::Type"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::OnLoad": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::OnLoad"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::OnClear": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::OnClear"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::OnIsEmpty": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::OnIsEmpty"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
},
"CGraphicText::OnIsType": {
"status": "PORTED",
"impl": [
"src/platform/EterLib/GrpText.cpp:CGraphicText::OnIsType"
],
"test": "tests/port/port_text_test.cpp",
"note": "verbatim 40250 source"
}
}
}
+31
View File
@@ -1,5 +1,6 @@
#include "EterBase/StdAfx.h"
#include "EterBase/Utils.h"
#include "EterBase/FileLoader.h"
#include <cstdio>
#include <cstring>
@@ -57,5 +58,35 @@ int main()
PCHAR* argv = CommandLineToArgv(const_cast<PCHAR>("x \"y z\" w"), &argc);
check(argc == 3 && !strcmp(argv[1], "y z"), "CommandLineToArgv");
free(argv);
// FileLoader (40250 EterBase/FileLoader.cpp): Bind keeps a CP949 lead byte and its trail byte together,
// on hosts where char is unsigned too, and takes any pair of '\r'/'\n' as one line break ("\n\n" too).
{
const char text[] = "a \"b c\"\td\r\n\xB0\xA1\tx\n\n\nlast";
CMemoryTextFileLoader loader;
loader.Bind(int(sizeof(text) - 1), text);
check(loader.GetLineCount() == 4 && loader.CheckLineIndex(3) && !loader.CheckLineIndex(4), "TextFileLoader lines");
CTokenVector tokens;
check(loader.SplitLine(0, &tokens) && tokens.size() == 3 && tokens[1] == "b c" && tokens[2] == "d", "SplitLine quoted");
check(loader.SplitLine2(0, &tokens) == 0 && tokens.size() == 3, "SplitLine2");
check(loader.SplitLineByTab(1, &tokens) && tokens.size() == 2 && tokens[0] == "\xB0\xA1" && tokens[1] == "x", "SplitLineByTab CP949");
check(!loader.SplitLine(2, &tokens) && !loader.SplitLineByTab(2, &tokens), "empty line");
check(loader.GetLineString(3) == "last", "last line without newline");
const unsigned char bytes[] = {1, 2, 3, 4, 5};
CMemoryFileLoader mem(5, bytes);
unsigned char got[4] = {};
check(mem.Read(3, got) && got[2] == 3 && mem.GetPosition() == 3 && !mem.Read(3, got) && mem.GetSize() == 5, "MemoryFileLoader");
char path[] = "/tmp/mt_fileloader_XXXXXX";
int fd = mkstemp(path);
FILE * fp = fdopen(fd, "wb");
fwrite(bytes, 1, 5, fp);
fclose(fp);
CDiskFileLoader disk;
check(disk.Open(path) && disk.GetSize() == 5 && disk.Read(4, got) && got[3] == 4, "DiskFileLoader");
disk.Close();
check(!disk.Open("/nonexistent/mt_fileloader"), "DiskFileLoader missing");
remove(path);
}
return failures ? 1 : 0;
}