New platform Posix. Replace strlen, strcmp implementation.

This commit is contained in:
jief 2020-03-13 16:11:58 +03:00
parent 81286c08b1
commit 0484955f0b
48 changed files with 1183 additions and 80 deletions

View File

@ -11,6 +11,17 @@
9A28CC94241AB33700F3D247 /* XString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC92241AB33700F3D247 /* XString.h */; };
9A28CC97241AB34800F3D247 /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC95241AB34800F3D247 /* XString_test.cpp */; };
9A28CC98241AB34800F3D247 /* XString_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC96241AB34800F3D247 /* XString_test.h */; };
9A28CCA3241B66EA00F3D247 /* stdlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC9A241B66EA00F3D247 /* stdlib.h */; };
9A28CCA4241B66EA00F3D247 /* limits.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC9B241B66EA00F3D247 /* limits.h */; };
9A28CCA5241B66EA00F3D247 /* stddef.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC9C241B66EA00F3D247 /* stddef.h */; };
9A28CCA6241B66EA00F3D247 /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC9D241B66EA00F3D247 /* abort.c */; };
9A28CCA7241B66EA00F3D247 /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC9E241B66EA00F3D247 /* strlen.c */; };
9A28CCA8241B66EA00F3D247 /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC9F241B66EA00F3D247 /* strcmp.c */; };
9A28CCA9241B66EA00F3D247 /* posix.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CCA0241B66EA00F3D247 /* posix.h */; };
9A28CCAA241B66EA00F3D247 /* stdarg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CCA1241B66EA00F3D247 /* stdarg.h */; };
9A28CCAB241B66EA00F3D247 /* stdint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CCA2241B66EA00F3D247 /* stdint.h */; };
9A28CD03241B8CBA00F3D247 /* posix_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD01241B8CBA00F3D247 /* posix_test.cpp */; };
9A28CD04241B8CBA00F3D247 /* posix_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CD02241B8CBA00F3D247 /* posix_test.h */; };
9A57C25724192D650029A39F /* XUINTN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C25524192D650029A39F /* XUINTN.cpp */; };
9A57C25824192D650029A39F /* XUINTN.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A57C25624192D650029A39F /* XUINTN.h */; };
9A57C25B24192D710029A39F /* XUINTN_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C25924192D710029A39F /* XUINTN_test.cpp */; };
@ -192,6 +203,17 @@
9A28CC92241AB33700F3D247 /* XString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString.h; sourceTree = "<group>"; };
9A28CC95241AB34800F3D247 /* XString_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString_test.cpp; sourceTree = "<group>"; };
9A28CC96241AB34800F3D247 /* XString_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString_test.h; sourceTree = "<group>"; };
9A28CC9A241B66EA00F3D247 /* stdlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdlib.h; sourceTree = "<group>"; };
9A28CC9B241B66EA00F3D247 /* limits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = limits.h; sourceTree = "<group>"; };
9A28CC9C241B66EA00F3D247 /* stddef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stddef.h; sourceTree = "<group>"; };
9A28CC9D241B66EA00F3D247 /* abort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = abort.c; sourceTree = "<group>"; };
9A28CC9E241B66EA00F3D247 /* strlen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlen.c; sourceTree = "<group>"; };
9A28CC9F241B66EA00F3D247 /* strcmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcmp.c; sourceTree = "<group>"; };
9A28CCA0241B66EA00F3D247 /* posix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
9A28CCA1241B66EA00F3D247 /* stdarg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdarg.h; sourceTree = "<group>"; };
9A28CCA2241B66EA00F3D247 /* stdint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdint.h; sourceTree = "<group>"; };
9A28CD01241B8CBA00F3D247 /* posix_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = posix_test.cpp; sourceTree = "<group>"; };
9A28CD02241B8CBA00F3D247 /* posix_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = posix_test.h; sourceTree = "<group>"; };
9A57C25524192D650029A39F /* XUINTN.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XUINTN.cpp; sourceTree = "<group>"; };
9A57C25624192D650029A39F /* XUINTN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XUINTN.h; sourceTree = "<group>"; };
9A57C25924192D710029A39F /* XUINTN_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XUINTN_test.cpp; sourceTree = "<group>"; };
@ -380,6 +402,22 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9A28CC99241B66EA00F3D247 /* Posix */ = {
isa = PBXGroup;
children = (
9A28CC9A241B66EA00F3D247 /* stdlib.h */,
9A28CC9B241B66EA00F3D247 /* limits.h */,
9A28CC9C241B66EA00F3D247 /* stddef.h */,
9A28CC9D241B66EA00F3D247 /* abort.c */,
9A28CC9E241B66EA00F3D247 /* strlen.c */,
9A28CC9F241B66EA00F3D247 /* strcmp.c */,
9A28CCA0241B66EA00F3D247 /* posix.h */,
9A28CCA1241B66EA00F3D247 /* stdarg.h */,
9A28CCA2241B66EA00F3D247 /* stdint.h */,
);
path = Posix;
sourceTree = "<group>";
};
9AC77EB824176B08005CDD5C = {
isa = PBXGroup;
children = (
@ -429,6 +467,8 @@
9AC77ED724176C04005CDD5C /* all_tests.h */,
9AC780B22417EE4A005CDD5C /* global_test.cpp */,
9AC780B42417EE53005CDD5C /* global_test.h */,
9A28CD01241B8CBA00F3D247 /* posix_test.cpp */,
9A28CD02241B8CBA00F3D247 /* posix_test.h */,
9AC77ED624176C04005CDD5C /* XArray_tests.cpp */,
9AC77ECD24176C04005CDD5C /* XArray_tests.h */,
9AC77ED524176C04005CDD5C /* XObjArray_tests.cpp */,
@ -457,6 +497,7 @@
9AC77F1624176C04005CDD5C /* Platform */ = {
isa = PBXGroup;
children = (
9A28CC99241B66EA00F3D247 /* Posix */,
9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */,
9AC77F2324176C04005CDD5C /* AmlGenerator.cpp */,
9AC77F1E24176C04005CDD5C /* AmlGenerator.h */,
@ -696,7 +737,10 @@
9AC7808F24176C04005CDD5C /* XStringW.h in Headers */,
9AC7809624176C04005CDD5C /* printf_lite.h in Headers */,
9AC7809324176C04005CDD5C /* utf8Conversion.h in Headers */,
9A28CCAA241B66EA00F3D247 /* stdarg.h in Headers */,
9A28CCA9241B66EA00F3D247 /* posix.h in Headers */,
9AC7807B24176C04005CDD5C /* list.h in Headers */,
9A28CCA3241B66EA00F3D247 /* stdlib.h in Headers */,
9AC77FC024176C04005CDD5C /* XObjArray_tests.h in Headers */,
9AC7801D24176C04005CDD5C /* Events.h in Headers */,
9AC7808D24176C04005CDD5C /* XStringWArray.h in Headers */,
@ -729,10 +773,12 @@
9AC7804A24176C04005CDD5C /* XPointer.h in Headers */,
9AC7808E24176C04005CDD5C /* XToolsCommon.h in Headers */,
9AC7806D24176C04005CDD5C /* bootscreen.h in Headers */,
9A28CCA4241B66EA00F3D247 /* limits.h in Headers */,
9AC7800E24176C04005CDD5C /* Settings.h in Headers */,
9AC77FBF24176C04005CDD5C /* XStringW_test.h in Headers */,
9AC7803824176C04005CDD5C /* ati_reg.h in Headers */,
9AC7804824176C04005CDD5C /* libegint.h in Headers */,
9A28CD04241B8CBA00F3D247 /* posix_test.h in Headers */,
9AC7800624176C04005CDD5C /* memvendors.h in Headers */,
9AC7800B24176C04005CDD5C /* kernel_patcher.h in Headers */,
9AC7808A24176C04005CDD5C /* memory.h in Headers */,
@ -751,10 +797,12 @@
9AC7802424176C04005CDD5C /* sse3_patcher.h in Headers */,
9AC77FFD24176C04005CDD5C /* Version.h in Headers */,
9A28CC98241AB34800F3D247 /* XString_test.h in Headers */,
9A28CCAB241B66EA00F3D247 /* stdint.h in Headers */,
9AC7807424176C04005CDD5C /* REFIT_MENU_SCREEN.h in Headers */,
9AC7804124176C04005CDD5C /* Platform.h in Headers */,
9AC7805824176C04005CDD5C /* XImage.h in Headers */,
9AC7808624176C04005CDD5C /* globals_ctor.h in Headers */,
9A28CCA5241B66EA00F3D247 /* stddef.h in Headers */,
9AC7806724176C04005CDD5C /* securebootkeys.h in Headers */,
9A28CC94241AB33700F3D247 /* XString.h in Headers */,
9AC7805A24176C04005CDD5C /* FloatLib.h in Headers */,
@ -849,6 +897,7 @@
9AC7802324176C04005CDD5C /* BootOptions.cpp in Sources */,
9AC7808924176C04005CDD5C /* operatorNewDelete.cpp in Sources */,
9AC7807124176C04005CDD5C /* securehash.cpp in Sources */,
9A28CCA6241B66EA00F3D247 /* abort.c in Sources */,
9AC7804B24176C04005CDD5C /* image.cpp in Sources */,
9AC7803624176C04005CDD5C /* Events.cpp in Sources */,
9AC7805B24176C04005CDD5C /* libscreen.cpp in Sources */,
@ -876,6 +925,7 @@
9AC780B32417EE4B005CDD5C /* global_test.cpp in Sources */,
9AC7805624176C04005CDD5C /* load_icns.cpp in Sources */,
9AC7805124176C04005CDD5C /* egemb_font.cpp in Sources */,
9A28CD03241B8CBA00F3D247 /* posix_test.cpp in Sources */,
9AC7806424176C04005CDD5C /* securemenu.cpp in Sources */,
9AC7804D24176C04005CDD5C /* text.cpp in Sources */,
9AC7800C24176C04005CDD5C /* AmlGenerator.cpp in Sources */,
@ -886,6 +936,7 @@
9AC780B92417F359005CDD5C /* XStringWP.cpp in Sources */,
9AC7808224176C04005CDD5C /* memory.cpp in Sources */,
9AC7803B24176C04005CDD5C /* cpu.cpp in Sources */,
9A28CCA8241B66EA00F3D247 /* strcmp.c in Sources */,
9AC7800124176C04005CDD5C /* LegacyBoot.cpp in Sources */,
9AC7807524176C04005CDD5C /* REFIT_MENU_SCREEN.cpp in Sources */,
9AC7801F24176C04005CDD5C /* LegacyBiosThunk.cpp in Sources */,
@ -925,6 +976,7 @@
9AC7806C24176C04005CDD5C /* bootscreen.cpp in Sources */,
9A57C25724192D650029A39F /* XUINTN.cpp in Sources */,
9AC7801424176C04005CDD5C /* Console.cpp in Sources */,
9A28CCA7241B66EA00F3D247 /* strlen.c in Sources */,
9AC7809224176C04005CDD5C /* utf8Conversion.cpp in Sources */,
9AC7802E24176C04005CDD5C /* StartupSound.cpp in Sources */,
9AC7808724176C04005CDD5C /* globals_ctor.cpp in Sources */,
@ -959,15 +1011,16 @@
NO_MSABI_VA_FUNCS,
);
HEADER_SEARCH_PATHS = (
$PROJECT_DIR/../../rEFIt_UEFI/Platform/Posix,
$PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG,
$PROJECT_DIR/../../rEFIt_UEFI,
$PROJECT_DIR/../../rEFIt_UEFI/Platform,
$PROJECT_DIR/../../Include,
$PROJECT_DIR/../../IntelFrameworkModulePkg/Include,
$PROJECT_DIR/../../IntelFrameworkPkg/Include,
$PROJECT_DIR/../../MdePkg/Include,
$PROJECT_DIR/../../MdePkg/Include/X64,
$PROJECT_DIR/../../Include,
$PROJECT_DIR/../../MdeModulePkg/Include,
$PROJECT_DIR/../../IntelFrameworkPkg/Include,
$PROJECT_DIR/../../Library/OpensslLib/Include,
$PROJECT_DIR/../../rEFIt_UEFI,
$PROJECT_DIR/../../IntelFrameworkModulePkg/Include,
);
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
@ -988,6 +1041,7 @@
"-Wno-incompatible-ms-struct",
);
SUPPORTED_PLATFORMS = macosx;
USE_HEADERMAP = NO;
VALID_ARCHS = x86_64;
};
name = Debug;
@ -1000,15 +1054,16 @@
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
HEADER_SEARCH_PATHS = (
$PROJECT_DIR/../../rEFIt_UEFI/Platform/Posix,
$PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG,
$PROJECT_DIR/../../rEFIt_UEFI,
$PROJECT_DIR/../../rEFIt_UEFI/Platform,
$PROJECT_DIR/../../Include,
$PROJECT_DIR/../../IntelFrameworkModulePkg/Include,
$PROJECT_DIR/../../IntelFrameworkPkg/Include,
$PROJECT_DIR/../../MdePkg/Include,
$PROJECT_DIR/../../MdePkg/Include/X64,
$PROJECT_DIR/../../Include,
$PROJECT_DIR/../../MdeModulePkg/Include,
$PROJECT_DIR/../../IntelFrameworkPkg/Include,
$PROJECT_DIR/../../Library/OpensslLib/Include,
$PROJECT_DIR/../../rEFIt_UEFI,
$PROJECT_DIR/../../IntelFrameworkModulePkg/Include,
);
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
@ -1029,6 +1084,7 @@
"-Wno-incompatible-ms-struct",
);
SUPPORTED_PLATFORMS = macosx;
USE_HEADERMAP = NO;
VALID_ARCHS = x86_64;
};
name = Release;

View File

@ -30,6 +30,24 @@
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
9A0B087F2403B08400E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
9A0B08802403B08400E2B470 /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */; };
9A28CD09241B8DD400F3D247 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
9A28CD0A241B8DD400F3D247 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
9A28CD0B241B8DD400F3D247 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
9A28CD0C241B8DD400F3D247 /* strcmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */; };
9A28CD0D241B8DD400F3D247 /* strcmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */; };
9A28CD0E241B8DD400F3D247 /* strcmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */; };
9A28CD10241B9EF800F3D247 /* strcmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD0F241B9EF800F3D247 /* strcmp.cpp */; };
9A28CD11241B9EF800F3D247 /* strcmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD0F241B9EF800F3D247 /* strcmp.cpp */; };
9A28CD12241B9EF800F3D247 /* strcmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD0F241B9EF800F3D247 /* strcmp.cpp */; };
9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD15241BACBB00F3D247 /* strlen_test.cpp */; };
9A28CD17241BACBB00F3D247 /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD15241BACBB00F3D247 /* strlen_test.cpp */; };
9A28CD18241BACBB00F3D247 /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD15241BACBB00F3D247 /* strlen_test.cpp */; };
9A28CD1F241BB61B00F3D247 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1D241BB61B00F3D247 /* abort.cpp */; };
9A28CD20241BB61B00F3D247 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1D241BB61B00F3D247 /* abort.cpp */; };
9A28CD21241BB61B00F3D247 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1D241BB61B00F3D247 /* abort.cpp */; };
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
9A57C20D2418A27B0029A39F /* XUINTN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C20B2418A27B0029A39F /* XUINTN.cpp */; };
9A57C20E2418A27B0029A39F /* XUINTN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C20B2418A27B0029A39F /* XUINTN.cpp */; };
9A57C2112418A3560029A39F /* XUINTN_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C20F2418A3550029A39F /* XUINTN_test.cpp */; };
@ -120,6 +138,22 @@
9A0B086B24039FE700E2B470 /* printf_lite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = printf_lite.cpp; path = "../../../../../Embedded/Shared/printf_lite-master/printf_lite.cpp"; sourceTree = "<group>"; };
9A0B086C24039FE700E2B470 /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printf_lite.h; path = "../../../../../Embedded/Shared/printf_lite-master/printf_lite.h"; sourceTree = "<group>"; };
9A0B08862403B08400E2B470 /* cpp_tests UTF32 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32"; sourceTree = BUILT_PRODUCTS_DIR; };
9A28CCB0241B816400F3D247 /* stdlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdlib.h; sourceTree = "<group>"; };
9A28CCB1241B816400F3D247 /* limits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = limits.h; sourceTree = "<group>"; };
9A28CCB2241B816400F3D247 /* stddef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stddef.h; sourceTree = "<group>"; };
9A28CCB6241B816400F3D247 /* posix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
9A28CCB7241B816400F3D247 /* stdarg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdarg.h; sourceTree = "<group>"; };
9A28CCB8241B816400F3D247 /* stdint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdint.h; sourceTree = "<group>"; };
9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strncmp_test.cpp; sourceTree = "<group>"; };
9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strcmp_test.cpp; sourceTree = "<group>"; };
9A28CD07241B8DD400F3D247 /* strcmp_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strcmp_test.h; sourceTree = "<group>"; };
9A28CD08241B8DD400F3D247 /* strncmp_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strncmp_test.h; sourceTree = "<group>"; };
9A28CD0F241B9EF800F3D247 /* strcmp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strcmp.cpp; sourceTree = "<group>"; };
9A28CD13241B9FEE00F3D247 /* posix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
9A28CD14241BACBB00F3D247 /* strlen_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strlen_test.h; sourceTree = "<group>"; };
9A28CD15241BACBB00F3D247 /* strlen_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen_test.cpp; sourceTree = "<group>"; };
9A28CD1D241BB61B00F3D247 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = "<group>"; };
9A57C20A2418A1FD0029A39F /* global_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = global_test.h; sourceTree = "<group>"; };
9A57C20B2418A27B0029A39F /* XUINTN.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XUINTN.cpp; sourceTree = "<group>"; };
9A57C20C2418A27B0029A39F /* XUINTN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XUINTN.h; sourceTree = "<group>"; };
@ -199,6 +233,12 @@
9A0B08542402FE9B00E2B470 /* all_tests.h */,
9A0B08642403144C00E2B470 /* global_test.cpp */,
9A57C20A2418A1FD0029A39F /* global_test.h */,
9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */,
9A28CD07241B8DD400F3D247 /* strcmp_test.h */,
9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */,
9A28CD08241B8DD400F3D247 /* strncmp_test.h */,
9A28CD15241BACBB00F3D247 /* strlen_test.cpp */,
9A28CD14241BACBB00F3D247 /* strlen_test.h */,
9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */,
9A0B084E2402FE9B00E2B470 /* XArray_tests.h */,
9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */,
@ -216,13 +256,39 @@
path = ../../rEFIt_UEFI/cpp_unit_test;
sourceTree = "<group>";
};
9A28CCAC241B816400F3D247 /* Platform */ = {
isa = PBXGroup;
children = (
9A28CCAF241B816400F3D247 /* Posix */,
);
name = Platform;
path = ../../rEFIt_UEFI/Platform;
sourceTree = "<group>";
};
9A28CCAF241B816400F3D247 /* Posix */ = {
isa = PBXGroup;
children = (
9A28CD1D241BB61B00F3D247 /* abort.cpp */,
9A28CD1E241BB61B00F3D247 /* strlen.cpp */,
9A28CD0F241B9EF800F3D247 /* strcmp.cpp */,
9A28CCB0241B816400F3D247 /* stdlib.h */,
9A28CCB1241B816400F3D247 /* limits.h */,
9A28CCB2241B816400F3D247 /* stddef.h */,
9A28CCB6241B816400F3D247 /* posix.h */,
9A28CCB7241B816400F3D247 /* stdarg.h */,
9A28CCB8241B816400F3D247 /* stdint.h */,
);
path = Posix;
sourceTree = "<group>";
};
9A9223242402FD1000483CBA = {
isa = PBXGroup;
children = (
9A0B08432402FE9300E2B470 /* cpp_foundation */,
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */,
9A92232F2402FD1000483CBA /* cpp_tests */,
9A92232F2402FD1000483CBA /* Main */,
9AC7809C2417DD2F005CDD5C /* cpp_util */,
9A28CCAC241B816400F3D247 /* Platform */,
9A92232E2402FD1000483CBA /* Products */,
);
sourceTree = "<group>";
@ -237,14 +303,15 @@
name = Products;
sourceTree = "<group>";
};
9A92232F2402FD1000483CBA /* cpp_tests */ = {
9A92232F2402FD1000483CBA /* Main */ = {
isa = PBXGroup;
children = (
9A9223302402FD1000483CBA /* main.cpp */,
9A92234D2402FD9500483CBA /* Platform.h */,
9A0B085D240300E000E2B470 /* Platform.cpp */,
9A28CD13241B9FEE00F3D247 /* posix.h */,
);
name = cpp_tests;
name = Main;
path = src;
sourceTree = "<group>";
};
@ -352,11 +419,16 @@
files = (
9A57C20E2418A27B0029A39F /* XUINTN.cpp in Sources */,
9A0B08732403B08400E2B470 /* XObjArray_tests.cpp in Sources */,
9A28CD20241BB61B00F3D247 /* abort.cpp in Sources */,
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */,
9A0B08742403B08400E2B470 /* main.cpp in Sources */,
9A57C264241A752E0029A39F /* XString_test.cpp in Sources */,
9A0B08752403B08400E2B470 /* printf_lite.cpp in Sources */,
9A28CD17241BACBB00F3D247 /* strlen_test.cpp in Sources */,
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */,
9A57C2122418A3560029A39F /* XUINTN_test.cpp in Sources */,
9A28CD0D241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
9A28CD0A241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
9AA05BB8240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */,
9AC780AF2417DD2F005CDD5C /* panic.cpp in Sources */,
9A0B08792403B08400E2B470 /* XStringW.cpp in Sources */,
@ -364,6 +436,7 @@
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */,
9A0B087C2403B08400E2B470 /* XToolsCommon.cpp in Sources */,
9A0B087D2403B08400E2B470 /* XStringWArray_test.cpp in Sources */,
9A28CD11241B9EF800F3D247 /* strcmp.cpp in Sources */,
9A57C2162418A6EA0029A39F /* XStringWP.cpp in Sources */,
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */,
9A0B087F2403B08400E2B470 /* Platform.cpp in Sources */,
@ -378,11 +451,16 @@
files = (
9A57C2192418B9A00029A39F /* XUINTN.cpp in Sources */,
9A57C21A2418B9A00029A39F /* XObjArray_tests.cpp in Sources */,
9A28CD21241BB61B00F3D247 /* abort.cpp in Sources */,
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */,
9A57C21B2418B9A00029A39F /* main.cpp in Sources */,
9A57C265241A752E0029A39F /* XString_test.cpp in Sources */,
9A57C21C2418B9A00029A39F /* printf_lite.cpp in Sources */,
9A28CD18241BACBB00F3D247 /* strlen_test.cpp in Sources */,
9A57C21D2418B9A00029A39F /* XStringWArray.cpp in Sources */,
9A57C21E2418B9A00029A39F /* XUINTN_test.cpp in Sources */,
9A28CD0E241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
9A28CD0B241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
9A57C21F2418B9A00029A39F /* utf8Conversion.cpp in Sources */,
9A57C2202418B9A00029A39F /* panic.cpp in Sources */,
9A57C2212418B9A00029A39F /* XStringW.cpp in Sources */,
@ -390,6 +468,7 @@
9A57C2232418B9A00029A39F /* global_test.cpp in Sources */,
9A57C2242418B9A00029A39F /* XToolsCommon.cpp in Sources */,
9A57C2252418B9A00029A39F /* XStringWArray_test.cpp in Sources */,
9A28CD12241B9EF800F3D247 /* strcmp.cpp in Sources */,
9A57C2262418B9A00029A39F /* XStringWP.cpp in Sources */,
9A57C2272418B9A00029A39F /* XArray_tests.cpp in Sources */,
9A57C2282418B9A00029A39F /* Platform.cpp in Sources */,
@ -404,11 +483,16 @@
files = (
9A57C20D2418A27B0029A39F /* XUINTN.cpp in Sources */,
9A0B085A2402FF8400E2B470 /* XObjArray_tests.cpp in Sources */,
9A28CD1F241BB61B00F3D247 /* abort.cpp in Sources */,
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */,
9A9223312402FD1000483CBA /* main.cpp in Sources */,
9A57C263241A752E0029A39F /* XString_test.cpp in Sources */,
9A0B086D24039FE700E2B470 /* printf_lite.cpp in Sources */,
9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */,
9A0B08562402FF7700E2B470 /* XStringWArray.cpp in Sources */,
9A57C2112418A3560029A39F /* XUINTN_test.cpp in Sources */,
9A28CD0C241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
9A28CD09241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
9AA05BB7240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */,
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */,
9A0B085F240308E400E2B470 /* XStringW.cpp in Sources */,
@ -416,6 +500,7 @@
9A0B08662403144C00E2B470 /* global_test.cpp in Sources */,
9A0B08572402FF7A00E2B470 /* XToolsCommon.cpp in Sources */,
9A0B08582402FF7F00E2B470 /* XStringWArray_test.cpp in Sources */,
9A28CD10241B9EF800F3D247 /* strcmp.cpp in Sources */,
9A57C2152418A6EA0029A39F /* XStringWP.cpp in Sources */,
9A0B085B2402FF8700E2B470 /* XArray_tests.cpp in Sources */,
9A0B085E240300E000E2B470 /* Platform.cpp in Sources */,
@ -549,6 +634,7 @@
Platform.h,
);
SDKROOT = macosx;
USE_HEADERMAP = NO;
};
name = Debug;
};
@ -635,6 +721,7 @@
Platform.h,
);
SDKROOT = macosx;
USE_HEADERMAP = NO;
};
name = Release;
};

View File

@ -26,12 +26,47 @@ void CpuDeadLoop(void)
exit(1);
}
static char *dull_replace(const char *in, const char *pattern, const char *by, char* res)
{
size_t outsize = strlen(in) + 1;
// TODO maybe avoid reallocing by counting the non-overlapping occurences of pattern
// char *res = malloc(outsize);
// use this to iterate over the output
size_t resoffset = 0;
const char *needle;
while ( (needle = strstr(in, pattern)) ) {
// copy everything up to the pattern
memcpy(res + resoffset, in, (size_t)(needle - in));
resoffset += (size_t)(needle - in);
// skip the pattern in the input-string
in = needle + strlen(pattern);
// adjust space for replacement
// outsize = outsize - strlen(pattern) + strlen(by);
// res = realloc(res, outsize);
// copy the pattern
memcpy(res + resoffset, by, strlen(by));
resoffset += strlen(by);
}
// copy the remaining input
strcpy(res + resoffset, in);
return res;
}
void DebugLog(int DebugMode, const char *FormatString, ...)
{
(void)DebugMode;
char NewFormat[strlen(FormatString)+1];
dull_replace(FormatString, "%a", "%s", NewFormat);
va_list va;
va_start(va, FormatString);
vprintf(FormatString, va);
vprintf(NewFormat, va);
va_end(va);
}

View File

@ -12,6 +12,7 @@
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#define UINTN unsigned long long
#define MAX_UINTN ULONG_MAX

View File

@ -0,0 +1,44 @@
#ifndef __POSIX_H__
#define __POSIX_H__
#include "stdint.h"
#include "stddef.h"
////
//// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions
//// originally from OpensslLib
//
//#define memcpy(dest,source,count) CopyMem(dest,source,(UINTN)(count))
//#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
//#define memchr(buf,ch,count) ScanMem8(buf,(UINTN)(count),(UINT8)ch)
//#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))
//#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
//#define strcmp AsciiStrCmp
//#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
//// edkII Strcmp seens quite inefficient, even vs a naive implementation
int strcmp(const char* s1, const char* s2);
int strncmp( const char* s1, const char* s2, size_t n );
//
//#ifdef CLOVER_BUILD
//#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,AsciiStrLen(strDest)+1,strSource)
//#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,(UINTN)count+1,strSource,(UINTN)count)
//#define strlen(str) (size_t)(AsciiStrLen(str))
//#define strcat(strDest,strSource) AsciiStrCatS(strDest,AsciiStrLen(strDest)+1,strSource)
//#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
//#define strstr(a,b) AsciiStrStr(a,b)
//#endif
//
//void abort(void);
//
//
//inline float fabsf(float x) {
// if (x < 0.f) return -x;
// return x;
//}
//
#endif

39
rEFIt_UEFI/Platform/BootLog.h Executable file
View File

@ -0,0 +1,39 @@
/*
Headers collection for procedures
*/
#ifndef __BOOTLOG__H__
#define __BOOTLOG__H__
#ifdef __cplusplus
extern "C" {
#endif
#include <Protocol/SimpleFileSystem.h> // for EFI_FILE_HANDLE
#ifdef __cplusplus
} // extern "C"
#endif
VOID
InitBooterLog (VOID);
EFI_STATUS
SetupBooterLog (
BOOLEAN AllowGrownSize
);
EFI_STATUS
SaveBooterLog (
IN EFI_FILE_HANDLE BaseDir OPTIONAL,
IN CONST CHAR16 *FileName
);
VOID
EFIAPI
DebugLog (
IN INTN DebugMode,
IN CONST CHAR8 *FormatString, ...);
#endif

View File

@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#include "entry_scan.h"
#include "../entry_scan/entry_scan.h"
//#include "device_tree.h"
#include "kernel_patcher.h"

View File

@ -10,6 +10,8 @@ Headers collection for procedures
// Comment to use source debug options
//#define DEBUG_ALL 2
#include "Posix/posix.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -1784,25 +1786,8 @@ KillMouse (VOID);
VOID
HidePointer (VOID);
*/
VOID
InitBooterLog (VOID);
EFI_STATUS
SetupBooterLog (
BOOLEAN AllowGrownSize
);
EFI_STATUS
SaveBooterLog (
IN EFI_FILE_HANDLE BaseDir OPTIONAL,
IN CONST CHAR16 *FileName
);
VOID
EFIAPI
DebugLog (
IN INTN DebugMode,
IN CONST CHAR8 *FormatString, ...);
#include "BootLog.h"
/** Prints series of bytes. */
VOID

View File

@ -0,0 +1,25 @@
#ifdef CLOVER_BUILD
#include "../../Platform/BootLog.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <Library/BaseLib.h> // for CpuDeadLoop
#ifdef __cplusplus
} // extern "C"
#endif
#else
#include <Platform.h>
#endif
void abort(void)
{
DebugLog(2, "A fatal error happened. System halted\n");
CpuDeadLoop();
}

View File

@ -0,0 +1 @@
//#define UINT_MAX

View File

@ -0,0 +1,51 @@
#ifndef __POSIX_H__
#define __POSIX_H__
//
//#ifdef __cplusplus
//extern "C" {
//#endif
#include "stdint.h"
#include "stddef.h"
//
// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions
// originally from OpensslLib
#define memcpy(dest,source,count) CopyMem(dest,source,(UINTN)(count))
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
#define memchr(buf,ch,count) ScanMem8(buf,(UINTN)(count),(UINT8)ch)
#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))
#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
//#define strcmp AsciiStrCmp
//#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,AsciiStrLen(strDest)+1,strSource)
#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,(UINTN)count+1,strSource,(UINTN)count)
//#define strlen(str) (size_t)(AsciiStrLen(str))
#define strcat(strDest,strSource) AsciiStrCatS(strDest,AsciiStrLen(strDest)+1,strSource)
#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
#define strstr(a,b) AsciiStrStr(a,b)
void abort(void);
//// edkII Strcmp seems quite inefficient, even vs a naive implementation
int strcmp(const char* s1, const char* s2);
int strncmp(const char* s1, const char* s2, size_t n);
size_t strlen(const char *str);
inline float fabsf(float x) {
if (x < 0.f) return -x;
return x;
}
//
//
//#ifdef __cplusplus
//} // extern "C"
//#endif
#endif

View File

@ -0,0 +1,6 @@
#define va_list VA_LIST
#define va_arg VA_ARG
#define va_start VA_START
#define va_end VA_END

View File

@ -0,0 +1,5 @@
#include "stdint.h"
#define SIZE_T_MAX MAX_UINT32
typedef UINT32 size_t;

View File

@ -0,0 +1,21 @@
#define INT8_MIN (-128)
#define INT16_MIN (-32768)
#define INT32_MIN (-2147483647 - 1)
#define INT64_MIN (-9223372036854775807LL - 1)
#define INT8_MAX 127
#define INT16_MAX 32767
#define INT32_MAX 2147483647
#define INT64_MAX 9223372036854775807LL
#define UINT8_MAX 0xff /* 255U */
#define UINT16_MAX 0xffff /* 65535U */
#define UINT32_MAX 0xffffffff /* 4294967295U */
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;

View File

@ -0,0 +1 @@
void abort(void);

View File

@ -0,0 +1,140 @@
#include <posix.h>
#ifndef strcmp
/*
* Taken from glibc. Seems not optimized at all...
*/
/* Compare S1 and S2, returning less than, equal to or
greater than zero if S1 is lexicographically less than,
equal to or greater than S2. */
int strcmp (const char *p1, const char *p2)
{
const unsigned char *s1 = (const unsigned char *) p1;
const unsigned char *s2 = (const unsigned char *) p2;
unsigned char c1, c2;
do
{
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0')
return c1 - c2;
}
while (c1 == c2);
return c1 - c2;
}
#endif
#ifndef strncmp
// faster implementation than AsciiStrnCmp. AsciiStrnCmp calls AsciiStrSize 4 times.
//int strncmp( const char * s1, const char * s2, size_t n )
//{
// while ( n && *s1 && ( *s1 == *s2 ) )
// {
// ++s1;
// ++s2;
// --n;
// }
// if ( n == 0 )
// {
// return 0;
// }
// else
// {
// return ( *(unsigned char *)s1 - *(unsigned char *)s2 );
// }
//}
/* Compare no more than N characters of S1 and S2,
returning less than, equal to or greater than zero
if S1 is lexicographically less than, equal to or
greater than S2. */
int
strncmp(const char *s1, const char *s2, size_t n)
{
unsigned char c1 = '\0';
unsigned char c2 = '\0';
if (n >= 4)
{
size_t n4 = n >> 2;
do
{
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0' || c1 != c2)
return c1 - c2;
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0' || c1 != c2)
return c1 - c2;
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0' || c1 != c2)
return c1 - c2;
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0' || c1 != c2)
return c1 - c2;
} while (--n4 > 0);
n &= 3;
}
while (n > 0)
{
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0' || c1 != c2)
return c1 - c2;
n--;
}
return c1 - c2;
}
//
//// Got his here : http://mgronhol.github.io/fast-strcmp/
//int strncmp_(const char *ptr0, const char *ptr1, size_t len)
//{
// size_t fast = len / sizeof(size_t) + 1;
// size_t offset = (fast - 1) * sizeof(size_t);
// size_t current_block = 0;
//
// if (len < sizeof(size_t)) {
// fast = 0;
// }
//
// size_t *lptr0 = (size_t*) ptr0;
// size_t *lptr1 = (size_t*) ptr1;
//
// while (current_block < fast) {
// if ((lptr0[current_block] ^ lptr1[current_block])) {
// size_t pos;
// for (pos = current_block * sizeof(size_t); pos < len; ++pos) {
// if ((ptr0[pos] ^ ptr1[pos]) || (ptr0[pos] == 0) || (ptr1[pos] == 0)) {
// return (int) ((unsigned char) ptr0[pos] - (unsigned char) ptr1[pos]);
// }
// }
// }
//
// ++current_block;
// }
//
// while (len > offset) {
// if ((ptr0[offset] ^ ptr1[offset])) {
// return (int) ((unsigned char) ptr0[offset] - (unsigned char) ptr1[offset]);
// }
// ++offset;
// }
//
// return 0;
//}
#endif

View File

@ -0,0 +1,101 @@
//#include <posix.h> // use angled, so posix.h will vary depending of the platform
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#ifdef MAP_TO_EDK_STRLEN
extern "C" UINTN EFIAPI AsciiStrLen (IN CONST CHAR8 *String);
#endif
/* Return the length of the null-terminated string STR. Scan for
the null terminator quickly by testing four bytes at a time. */
size_t strlen (const char *str)
{
#ifdef MAP_TO_EDK_STRLEN
return (size_t)(AsciiStrLen(str));
#endif
const char *char_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, himagic, lomagic;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
for (char_ptr = str; ((unsigned long int) char_ptr
& (sizeof (longword) - 1)) != 0;
++char_ptr)
if (*char_ptr == '\0') {
if ( char_ptr - str > SIZE_T_MAX ) abort();
return (size_t)(char_ptr - str);
}
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
longword_ptr = (unsigned long int *) char_ptr;
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
the "holes." Note that there is a hole just to the left of
each byte, with an extra at the end:
bits: 01111110 11111110 11111110 11111111
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
himagic = 0x80808080L;
lomagic = 0x01010101L;
if (sizeof (longword) > 4)
{
/* 64-bit version of the magic. */
/* Do the shift in two steps to avoid a warning if long has 32 bits. */
himagic = ((himagic << 16) << 16) | himagic;
lomagic = ((lomagic << 16) << 16) | lomagic;
}
if (sizeof (longword) > 8)
abort ();
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
if *any of the four* bytes in the longword in question are zero. */
for (;;)
{
longword = *longword_ptr++;
if (((longword - lomagic) & ~longword & himagic) != 0)
{
/* Which of the bytes was the zero? If none of them were, it was
a misfire; continue the search. */
const char *cp = (const char *) (longword_ptr - 1);
if (cp[0] == 0)
return cp - str;
if (cp[1] == 0)
return cp - str + 1;
if (cp[2] == 0)
return cp - str + 2;
if (cp[3] == 0)
return cp - str + 3;
if (sizeof (longword) > 4)
{
if (cp[4] == 0)
return cp - str + 4;
if (cp[5] == 0)
return cp - str + 5;
if (cp[6] == 0)
return cp - str + 6;
if (cp[7] == 0)
return cp - str + 7;
}
}
}
}
/* to be able to call strlen when running in a libc environment. */
size_t clover_strlen (const char *str)
{
return strlen(str);
}

View File

@ -2,10 +2,10 @@
Slice 2012
*/
#include "entry_scan.h"
#include "../entry_scan/entry_scan.h"
#include "kernel_patcher.h"
#include "ati.h"
#include "nanosvg.h"
#include "../libeg/nanosvg.h"
#include "nvidia.h"
#include "../refit/screen.h"
#include "../refit/menu.h"

View File

@ -17,15 +17,15 @@
#include "printf_lite.h"
#ifndef memcpy
#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
#endif
#ifndef strlen
#define strlen(str) (xsize)(AsciiStrLen(str))
#endif
#ifndef memmove
#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
#endif
//#ifndef memcpy
//#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
//#endif
//#ifndef strlen
//#define strlen(str) (xsize)(AsciiStrLen(str))
//#endif
//#ifndef memmove
//#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
//#endif
xsize XStringGrowByDefault = 1024;
const XString NullXString;

View File

@ -17,6 +17,8 @@ extern xsize XBufferGrowByDefault;
#ifdef CLOVER_BUILD
#include <posix.h>
extern "C" {
#include <ProcessorBind.h>
#include <Library/BaseLib.h> // for StrCmp
@ -33,7 +35,7 @@ extern "C" {
// Declare here instead of include to avoid circular dependancy.
// Declare here instead of include to avoid circular dependency.
VOID
EFIAPI
DebugLog (

View File

@ -8,7 +8,7 @@
#define __PRINTF_LITE_H__
#include <stdarg.h>
#include <stddef.h>
#include <stddef.h> // for size_t
#ifdef ARDUINO
#include <WString.h>
#ifdef HAS_LIQUID_CRYSTAL

View File

@ -122,10 +122,5 @@ int XString_tests()
if ( str3 != "Выход" ) return 50;
#endif
// XStringW CommonName("EFI\\CLOVER\\misc\\screenshot");
// for (UINTN Index = 0; Index < 20; Index++) {
// XStringW Name = CommonName + SPrintf("%lld", Index) + ".png";
// DebugLog(2, "XStringW_test shot: %s\n", Name.data());
// }
return 0;
}

View File

@ -2,7 +2,7 @@
#include "../cpp_foundation/XUINTN.h"
#include "../cpp_foundation/XStringWP.h"
#include <stdio.h>
//#include <stdio.h>
#ifdef _MSC_VER
#pragma warning(disable : 4310)

View File

@ -9,6 +9,9 @@
#include "XString_test.h"
#include "XStringW_test.h"
#include "XUINTN_test.h"
#include "strcmp_test.h"
#include "strncmp_test.h"
#include "strlen_test.h"
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
@ -17,6 +20,21 @@ bool all_tests()
bool all_ok = true;
int ret;
ret = strlen_tests();
if ( ret != 0 ) {
DebugLog(2, "posix_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = strcmp_tests();
if ( ret != 0 ) {
DebugLog(2, "posix_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = strncmp_tests();
if ( ret != 0 ) {
DebugLog(2, "posix_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = XArray_tests();
if ( ret != 0 ) {
DebugLog(2, "XArray_tests() failed at test %d\n", ret);

View File

@ -0,0 +1,168 @@
#include <Platform.h>
#include "../cpp_foundation/XString.h"
#include "../cpp_foundation/utf8Conversion.h"
#include "global_test.h"
static float rndf() //expected 0..1
{
static UINT32 seed = 12345;
// UINT16 Rand = 0;
// AsmRdRand16(&Rand); //it's a pity panic
// return (float)Rand / 65536.f;
seed = seed * 214013 + 2531011;
float x = (float)seed / 4294967296.0f;
return x;
}
static int sign(int ret) {
if ( ret < 0 ) return -1;
if ( ret > 0 ) return 1;
return 0;
}
//#include <wchar.h>
static int strcmp_reference(const char *p1, const char *p2)
{
const unsigned char *s1 = (const unsigned char *) p1;
const unsigned char *s2 = (const unsigned char *) p2;
unsigned char c1, c2;
do
{
c1 = (unsigned char) *s1++;
c2 = (unsigned char) *s2++;
if (c1 == '\0')
return c1 - c2;
}
while (c1 == c2);
return c1 - c2;
}
static int compare(const char*s1, const char*s2)
{
int ret1 = strcmp(s1, s2);
int ret2 = strcmp_reference(s1, s2);;
if ( sign(ret1) != sign(ret2) ) {
DebugLog(2, "Comparing '%a' and '%a' gives %d and should have given %d\n", s1, s2, ret1, ret2);
return 1; // whatever if not 0
}
return 0;
}
static int symetric_compare(const char*s1, const char*s2, int code)
{
int ret;
ret = compare(s1, s1);
if ( ret != 0 ) return code;
ret = compare(s2, s2);
if ( ret != 0 ) return code;
ret = compare(s1, s2);
if ( ret != 0 ) return code;
ret = compare(s2, s1);
if ( ret != 0 ) return code;
ret = compare(s1, "");
if ( ret != 0 ) return code;
ret = compare("", s1);
if ( ret != 0 ) return code;
ret = compare(s2, "");
if ( ret != 0 ) return code;
ret = compare("", s2);
if ( ret != 0 ) return code;
return 0;
}
// ATENTION : s must count+1 in size
static void fillRandom(char* s, size_t count)
{
size_t i;
for ( i = 0 ; i<count ; i++ ) { // not using strcpy to not depend of another test.
((unsigned char *)s)[i] = (unsigned char)(rndf()*255.0);
}
s[i] = 0;
}
#define NB_ITERATIONS 515
static int compare_s1_with_variable_sizes(const char* s1, int code)
{
char s2[515];
for ( size_t i=0 ; i < NB_ITERATIONS ; i++ )
{
size_t count = (size_t)(rndf()*sizeof(s2)-1);
if ( count >= sizeof(s2) ) {
DebugLog(2, "compare_s1_with_variable_sizes, BUG : sizeof=%d, count=%d\n", sizeof(s2), count);
continue;
}
fillRandom(s2, count);
int ret = symetric_compare(s2, s1, code+(int)i); // s2 is always 'superior'
if ( ret != 0 ) return ret;
}
return 0;
}
static int compare_with_variable_sizes(int code)
{
unsigned char s1[514];
for ( size_t i=0 ; i < sizeof(s1) ; i++ ) {
size_t j=0;
for ( j = 0 ; j < sizeof(s1) && j < i ; j++ ) { // not using strcpy to not depend of another test.
s1[j] = (unsigned char)(rndf()*255.0);
}
s1[i] = 0;
int ret = compare_s1_with_variable_sizes((const char*)s1, code+(int)i);
if ( ret != 0 ) return ret;
}
return 0;
}
int strcmp_tests()
{
int ret;
// Efficient version of strcmp may do with blocks
// So there maybe a bug when some string has some specific length
ret = symetric_compare("", "z", 1);
if ( ret != 0 ) return ret;
ret = symetric_compare("a", "b", 10);
if ( ret != 0 ) return ret;
ret = symetric_compare("a", "c", 20);
if ( ret != 0 ) return ret;
ret = symetric_compare("aa", "ad", 30);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaa", "aae", 40);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaa", "aaaf", 50);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaaa", "aaaag", 60);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaaaa", "aaaaaah", 70);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaaaaa", "aaaaaaai", 80);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaaaaaa", "aaaaaaaaj", 90);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaaaaaaa", "aaaaaaaaak", 100);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaaaaaaaa", "aaaaaaaaaal", 110);
if ( ret != 0 ) return ret;
ret = symetric_compare("aaaabbbbccccddddeeeeffffA", "aaaabbbbccccddddeeeeffffM", 120);
if ( ret != 0 ) return ret;
ret = compare_with_variable_sizes(1000000);
return 0;
}

View File

@ -0,0 +1 @@
int strcmp_tests();

View File

@ -0,0 +1,94 @@
#include <Platform.h>
#include "../cpp_foundation/XString.h"
#include "../cpp_foundation/utf8Conversion.h"
#include "global_test.h"
//size_t clover_strlen (const char *str);
static int len(const char* s1, size_t count, int code)
{
//DebugLog(2, "strlen of '%a'\n", s1);
size_t ret1 = strlen(s1);
if ( ret1 != count ) {
DebugLog(2, "strlen of '%a' gives %d and should have given %d\n", s1, ret1, count);
return code;
}
return 0;
}
static int strlen_s1_all_length(const char* s1, size_t count, int code)
{
for ( size_t i=0 ; i < count; i++ )
{
int ret = len(s1+i, count-i, code);
if ( ret != 0 ) return ret;
}
return 0;
}
static int strlen_s1_all_offset(const char* s1, size_t count, int code)
{
for ( size_t i=0 ; i < count; i++ )
{
int ret = strlen_s1_all_length(s1+i, count-i, code);
if ( ret != 0 ) return ret;
}
return 0;
}
//
//static int compare_with_variable_sizes(int code)
//{
// unsigned char s1[514];
// for ( size_t i=0 ; i < sizeof(s1) ; i++ ) {
// size_t j=0;
// for ( j = 0 ; j < sizeof(s1) && j < i ; j++ ) { // not using strcpy to not depend of another test.
// s1[j] = (unsigned char)(rndf()*255.0);
// }
// s1[i] = 0;
// int ret = compare_s1_with_variable_sizes((const char*)s1, code+(int)i);
// if ( ret != 0 ) return ret;
// }
// return 0;
//}
int strlen_tests()
{
#ifdef JIEF_DEBUG
// DebugLog(2, "XStringW_tests -> Enter\n");
#endif
const char* s;
s = "1234567890"; // use intermediary var to not be optimized out.
if ( strlen(s) != 10 ) return 1;
s = "";
if ( strlen(s) != 0 ) return 2;
int ret;
s = "12345678901234567890123456789012345678901234567890"; // use intermediary var to not be optimized out.
ret = strlen_s1_all_offset(s, 50, 10);
if ( ret != 0 ) return ret;
#ifdef CLOVER_BUILD
// UINTN start = AsmReadTsc();
// DebugLog(2, "strlen_tests -> Enter\n");
//
// for ( UINTN i=0 ; i<100000 ; i++ ) {
// ret = strlen_s1_all_offset(s, 50, 10);
// }
//
// DebugLog(2, "strlen_tests -> Exit\n");
// UINTN end = AsmReadTsc();
// DebugLog(2, "Strlen bench time = %d\n", end - start);
#endif
return 0;
}

View File

@ -0,0 +1 @@
int strlen_tests();

View File

@ -0,0 +1,213 @@
#include <Platform.h>
#include "../cpp_foundation/XString.h"
#include "../cpp_foundation/utf8Conversion.h"
#include "global_test.h"
static float rndf() //expected 0..1
{
static UINT32 seed = 12345;
// UINT16 Rand = 0;
// AsmRdRand16(&Rand); //it's a pity panic
// return (float)Rand / 65536.f;
seed = seed * 214013 + 2531011;
float x = (float)seed / 4294967296.0f;
return x;
}
static int sign(int ret) {
if ( ret < 0 ) return -1;
if ( ret > 0 ) return 1;
return 0;
}
static size_t strlen_reference(const char *str)
{
const char *s;
for (s = str; *s; ++s)
;
return (size_t)(s - str);
}
static int strncmp_reference( const char * s1, const char * s2, size_t n )
{
while ( n && *s1 && ( *s1 == *s2 ) )
{
++s1;
++s2;
--n;
}
if ( n == 0 )
{
return 0;
}
else
{
return ( *(unsigned char *)s1 - *(unsigned char *)s2 );
}
}
static int nb_compare = 0;
static int compare(const char*s1, const char*s2, size_t count)
{
nb_compare ++;
//DebugLog(2, "Comparing '%a' and '%a' with count %d\n", s1, s2, count);
int ret1 = strncmp(s1, s2, count);
int ret2 = strncmp_reference(s1, s2, count);
if ( sign(ret1) != sign(ret2) ) {
DebugLog(2, "Comparing '%a' and '%a' with count %d gives %d and should have given %d\n", s1, s2, count, ret1, ret2);
int ret3 = strncmp(s1, s2, count); // for live debugging
(void)ret3;
return 1; // whatever if not 0
}
return 0;
}
static int symetric_compare(const char*s1, const char*s2, size_t count, int code)
{
int ret;
ret = compare(s1, s1, count);
if ( ret != 0 ) return code;
ret = compare(s2, s2, count);
if ( ret != 0 ) return code;
ret = compare(s1, s2, count);
if ( ret != 0 ) return code;
ret = compare(s2, s1, count);
if ( ret != 0 ) return code;
ret = compare(s1, "", count);
if ( ret != 0 ) return code;
ret = compare("", s1, count);
if ( ret != 0 ) return code;
ret = compare(s2, "", count);
if ( ret != 0 ) return code;
ret = compare("", s2, count);
if ( ret != 0 ) return code;
return 0;
}
// ATENTION : s must count+1 in size
static void fillRandom(char* s, size_t count)
{
size_t i;
for ( i = 0 ; i<count ; i++ ) { // not using strcpy to not depend of another test.
((unsigned char *)s)[i] = (unsigned char)(rndf()*255.0);
}
s[i] = 0;
}
static int compare_s1_s2_with_variable_count(const char* s1, size_t s1count, const char* s2, size_t s2count, int code)
{
size_t test_count = s1count;
if ( s2count > s1count ) test_count = s2count;
for ( size_t count=0 ; count < test_count ; count++ ) {
int ret = 0;
ret = symetric_compare((const char*)s2, s1, count, code);
if ( ret != 0 ) return code;
}
return 0;
}
static int compare_s1_s2_with_variable_count(const char* s1, const char* s2, int code)
{
return compare_s1_s2_with_variable_count(s1, strlen_reference(s1), s2, strlen_reference(s2), code);
}
#ifdef CLOVER_BUILD
#define NB_ITERATIONS 37
#else
#define NB_ITERATIONS 189
#endif
static int compare_s1_with_variable_sizes(const char* s1, size_t s1count, int code)
{
#ifdef CLOVER_BUILD
char s2[514];
#else
char s2[49];
#endif
for ( size_t i=0 ; i < NB_ITERATIONS ; i++ )
{
size_t s2count = (size_t)(rndf()*sizeof(s2)-1);
if ( s2count >= sizeof(s2) ) {
DebugLog(2, "compare_s1_with_variable_sizes, BUG : sizeof=%d, count=%d\n", sizeof(s2), s2count);
continue;
}
fillRandom(s2, s2count);
int ret = 0;
ret = compare_s1_s2_with_variable_count(s1, s1count, s2, s2count, code+(int)i);
// for ( size_t k=0 ; k < sizeof(s2) ; k++ ) {
// }
if ( ret != 0 ) return code;
}
return 0;
}
static int compare_with_variable_sizes(int code)
{
char s1[67];
size_t s1count;
for ( s1count=0 ; s1count < sizeof(s1)-1 ; s1count++ ) {
fillRandom(s1, s1count);
int ret = compare_s1_with_variable_sizes((const char*)s1, s1count, code);
if ( ret != 0 ) return code;
}
return 0;
}
/*
* ATTENTION : strlen and str(n)cmp seems to be optimized out if called with litteral.
* like strlen("sdfsdf") is computed at compiled time.
* so far, using a temporary var seems to be enough to not be optmized.
*/
int strncmp_tests()
{
const char* s;
int ret;
// Efficient version of strcmp may do with blocks
// So there maybe a bug when some string has some specific length
s = "aaaaaaaaj";
ret = strncmp(s, "", 8);
s = "";
ret = strncmp(s, "", 2);
ret = symetric_compare("#1D1D1B", "#1D1D1B", 4, 1);
if ( ret != 0 ) return ret;
ret = symetric_compare("#FFFFFF", "#FFFFFF", 4, 1);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("", "z", 1);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("a", "b", 10);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("aaaaaaa", "aaaaaaai", 80);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("aaaaaaaa", "aaaaaaaaj", 90);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("aaaaaaaaa", "aaaaaaaaak", 100);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("aaaaaaaaaa", "aaaaaaaaaal", 110);
if ( ret != 0 ) return ret;
ret = compare_s1_s2_with_variable_count("aaaabbbbccccddddeeeeffffA", "aaaabbbbccccddddeeeeffffM", 120);
if ( ret != 0 ) return ret;
ret = compare_with_variable_sizes(1000000);
if ( ret != 0 ) return ret;
return 0;
}

View File

@ -0,0 +1 @@
int strncmp_tests();

View File

@ -13,7 +13,7 @@
extern "C" {
#include <stddef.h>
// #include <stddef.h>
}
#include "globals_ctor.h"
#include <Platform/Platform.h>

View File

@ -1,6 +1,8 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#undef memset
#undef memcpy
extern "C" {
/*

View File

@ -36,7 +36,7 @@
#define __REFIT_MENU_SCREEN_H__
#include "libeg.h"
#include "../libeg/libeg.h"
#include "../refit/lib.h"
#include "../cpp_foundation/XObjArray.h"

View File

@ -35,7 +35,7 @@
#include "menu_items.h"
#include "libeg.h"
#include "../../libeg/libeg.h"
#include "../../refit/lib.h"
#ifdef __cplusplus
#include "../../cpp_foundation/XObjArray.h"

View File

@ -36,7 +36,7 @@
#define __menu_items_H__
#include "libeg.h"
#include "../libeg/libeg.h"
#include "../../refit/lib.h"
#ifdef __cplusplus
#include "../../cpp_foundation/XObjArray.h"

View File

@ -6,10 +6,10 @@
//
#include "FloatLib.h"
#include "IO.h"
#include "../refit/IO.h"
#define memcpy(dest,source,count) CopyMem(dest,(void*)source,(UINTN)(count))
//#define memcpy(dest,source,count) CopyMem(dest,(void*)source,(UINTN)(count))
//#define fabsf(x) ((x >= 0.0f)?x:(-x))
#define fabsf(x) FabsF(x)

View File

@ -5,7 +5,7 @@
*
*/
#include "../Platform/Platform.h"
#include "nanosvg.h"
#include "FloatLib.h"
#include "lodepng.h"

View File

@ -7,7 +7,7 @@
#include "XPointer.h"
#include "libegint.h" //this includes platform.h
#include "../refit/screen.h"
#include "menu.h"
#include "../refit/menu.h"
#ifndef DEBUG_ALL
#define DEBUG_MOUSE 1

View File

@ -41,7 +41,7 @@
//#include <efi.h>
//#include <efilib.h>
#include "Platform.h"
#include "../Platform/Platform.h"
#if defined(_MSC_VER)

View File

@ -67,8 +67,8 @@ with the "LODEPNG_COMPILE_" #defines divide this up further in an intermixed way
/* ////////////////////////////////////////////////////////////////////////// */
/* ////////////////////////////////////////////////////////////////////////// */
#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
//#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
//#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
//Slice my qsort implementation.It can be moved into common library
VOID QuickSortWorker(UINT8* Array, INTN Low, INTN High, INTN Size, int(*compare)(CONST VOID* a, CONST VOID* b), VOID* Temp)

View File

@ -50,7 +50,7 @@
#define DBG(...) DebugLog(DEBUG_SVG, __VA_ARGS__)
#endif
typedef UINTN size_t;
//typedef UINTN size_t;
#define NSVG_PI (3.14159265358979323846264338327f)
#define NSVG_PI_DEG (0.01745329251994f)
@ -2031,7 +2031,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
attr->fontFace->fontStyle = 'n';
}
} else if (strcmp(name, "id") == 0) {
strncpy(attr->id, value, 63);
strncpy(attr->id, value, sizeof(attr->id)-1); // -1 or not -1, doesn't change a thing because of the next line.
attr->id[63] = '\0';
} else if (strcmp(name, "x") == 0) {
nsvg__xformSetTranslation(xform, (float)nsvg__atof(value), 0);

View File

@ -52,14 +52,14 @@ extern "C" {
//There are defines for compilation as first step. Must be revised
#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
#define strcmp(a,b) AsciiStrCmp(a,b)
#define strncmp(a,b,n) AsciiStrnCmp(a,b,n)
#define strstr(a,b) AsciiStrStr(a,b)
//#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
//#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
//#define strcmp(a,b) AsciiStrCmp(a,b)
//#define strncmp(a,b,n) AsciiStrnCmp(a,b,n)
//#define strstr(a,b) AsciiStrStr(a,b)
#define strlen(s) AsciiStrLen(s)
#define strncpy(a,b,n) AsciiSPrint(a,n,"%a",b)
//#define strlen(s) AsciiStrLen(s)
//#define strncpy(a,b,n) AsciiSPrint(a,n,"%a",b)
enum NSVGpaintType {
NSVG_PAINT_NONE = 0,

View File

@ -93,6 +93,10 @@
libeg/XImage.h
libeg/XPointer.cpp
libeg/XPointer.h
Platform/Posix/posix.h
Platform/Posix/strcmp.cpp
Platform/Posix/strlen.cpp
Platform/Posix/abort.cpp
Platform/AcpiPatcher.cpp
Platform/ati_reg.h
Platform/AmlGenerator.cpp
@ -206,6 +210,12 @@
cpp_unit_test/all_tests.cpp
cpp_unit_test/global_test.cpp
cpp_unit_test/global_test.h
cpp_unit_test/strlen_test.cpp
cpp_unit_test/strlen_test.h
cpp_unit_test/strcmp_test.cpp
cpp_unit_test/strcmp_test.h
cpp_unit_test/strncmp_test.cpp
cpp_unit_test/strncmp_test.h
cpp_unit_test/XArray_tests.cpp
cpp_unit_test/XArray_tests.h
cpp_unit_test/XObjArray_tests.cpp

View File

@ -34,7 +34,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libegint.h"
#include "../libeg/libegint.h"
//#include "../include/egemb_icons.h"
#ifndef DEBUG_ALL

View File

@ -59,7 +59,7 @@
// Experimental <--
#include "libeg.h"
#include "../libeg/libeg.h"
#ifdef __cplusplus
#include "../cpp_foundation/XObjArray.h"
#include "../cpp_foundation/XStringWArray.h"

View File

@ -40,8 +40,8 @@
#include "../cpp_unit_test/all_tests.h"
#include "Version.h"
#include "entry_scan.h"
#include "nanosvg.h"
#include "../entry_scan/entry_scan.h"
#include "../libeg/nanosvg.h"
#include "../gui/menu_items/menu_globals.h"
#include "menu.h"
#include "../Platform/Settings.h"

View File

@ -35,14 +35,14 @@
*/
//#include "Platform.h"
#include "libegint.h" //this includes platform.h
#include "../libeg/libegint.h" //this includes platform.h
//#include "../include/scroll_images.h"
#include "../../Version.h"
//#include "colors.h"
#include "nanosvg.h"
#include "FloatLib.h"
#include "../libeg/nanosvg.h"
#include "../libeg/FloatLib.h"
#include "HdaCodecDump.h"
#include "menu.h"
#include "screen.h"

View File

@ -36,7 +36,7 @@
#include "../Platform/Platform.h"
#include "screen.h"
#include "libegint.h"
#include "../libeg/libegint.h"
#ifndef DEBUG_ALL
#define DEBUG_SCR 1