mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
resolve conflicts
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
commit
314652c49c
@ -783,8 +783,8 @@ final class CloverConfig: NSObject {
|
||||
// SMBIOS TYPE1
|
||||
SMBIOS["Manufacturer"] = s.value(for: "ManufactureName", type: .CHAR8String)
|
||||
SMBIOS["ProductName"] = s.value(for: "ProductName", type: .CHAR8String)
|
||||
SMBIOS["Version"] = s.value(for: "SerialNr", type: .CHAR8String)
|
||||
SMBIOS["SerialNumber"] = s.value(for: "ReleaseDate", type: .CHAR8String)
|
||||
SMBIOS["Version"] = s.value(for: "VersionNr", type: .CHAR8String)
|
||||
SMBIOS["SerialNumber"] = s.value(for: "SerialNr", type: .CHAR8String)
|
||||
SMBIOS["SmUUID"] = s.value(for: "SmUUID", type: .UUIDString)
|
||||
SMBIOS["Family"] = s.value(for: "FamilyName", type: .CHAR8String)
|
||||
// SMBIOS TYPE2
|
||||
|
@ -554,13 +554,13 @@ final class InstallerViewController: NSViewController {
|
||||
self.altBootCheck.state = .off
|
||||
if let disk = sender?.selectedItem?.representedObject as? String {
|
||||
if !isMountPoint(path: disk) {
|
||||
//DispatchQueue.global(qos: .background).async {
|
||||
DispatchQueue.global(priority: .background).async(execute: { () -> Void in
|
||||
let cmd = "diskutil mount \(disk)"
|
||||
let msg = String(format: "Clover wants to mount %@", disk)
|
||||
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
|
||||
|
||||
let task = Process()
|
||||
|
||||
|
||||
if #available(OSX 10.12, *) {
|
||||
task.launchPath = "/usr/bin/osascript"
|
||||
task.arguments = ["-e", script]
|
||||
@ -572,24 +572,31 @@ final class InstallerViewController: NSViewController {
|
||||
task.terminationHandler = { t in
|
||||
if t.terminationStatus == 0 {
|
||||
if isMountPoint(path: disk) {
|
||||
self.targetVol = getMountPoint(from: disk) ?? ""
|
||||
DispatchQueue.main.async {
|
||||
self.targetVol = getMountPoint(from: disk) ?? ""
|
||||
self.populateTargets()
|
||||
self.setPreferences(for: self.targetVol)
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async { self.view.window?.makeKeyAndOrderFront(nil) }
|
||||
DispatchQueue.main.async {
|
||||
self.view.window?.makeKeyAndOrderFront(nil)
|
||||
self.view.window?.level = .floating
|
||||
self.view.window?.level = .normal
|
||||
}
|
||||
} else {
|
||||
NSSound.beep()
|
||||
DispatchQueue.main.async {
|
||||
if #available(OSX 10.11, *) {
|
||||
self.driversCollection.reloadData()
|
||||
self.view.window?.makeKeyAndOrderFront(nil)
|
||||
self.view.window?.level = .floating
|
||||
self.view.window?.level = .normal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
task.launch()
|
||||
//}
|
||||
})
|
||||
} else {
|
||||
self.targetVol = getMountPoint(from: disk) ?? ""
|
||||
self.populateTargets()
|
||||
|
@ -499,13 +499,13 @@ final class InstallerOutViewController: NSViewController {
|
||||
self.altBootCheck.state = .off
|
||||
if let disk = sender?.selectedItem?.representedObject as? String {
|
||||
if !isMountPoint(path: disk) {
|
||||
//DispatchQueue.global(qos: .background).async {
|
||||
DispatchQueue.global(priority: .background).async(execute: { () -> Void in
|
||||
let cmd = "diskutil mount \(disk)"
|
||||
let msg = String(format: "Clover wants to mount %@", disk)
|
||||
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
|
||||
|
||||
let task = Process()
|
||||
|
||||
|
||||
if #available(OSX 10.12, *) {
|
||||
task.launchPath = "/usr/bin/osascript"
|
||||
task.arguments = ["-e", script]
|
||||
@ -517,23 +517,30 @@ final class InstallerOutViewController: NSViewController {
|
||||
task.terminationHandler = { t in
|
||||
if t.terminationStatus == 0 {
|
||||
if isMountPoint(path: disk) {
|
||||
self.targetVol = getMountPoint(from: disk) ?? ""
|
||||
DispatchQueue.main.async {
|
||||
self.targetVol = getMountPoint(from: disk) ?? ""
|
||||
self.populateTargets()
|
||||
self.setPreferences(for: self.targetVol)
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async { self.view.window?.makeKeyAndOrderFront(nil) }
|
||||
DispatchQueue.main.async {
|
||||
self.view.window?.makeKeyAndOrderFront(nil)
|
||||
self.view.window?.level = .floating
|
||||
self.view.window?.level = .normal
|
||||
}
|
||||
} else {
|
||||
NSSound.beep()
|
||||
DispatchQueue.main.async {
|
||||
self.driversOutline.reloadData()
|
||||
self.expandAllSections()
|
||||
self.view.window?.makeKeyAndOrderFront(nil)
|
||||
self.view.window?.level = .floating
|
||||
self.view.window?.level = .normal
|
||||
}
|
||||
}
|
||||
}
|
||||
task.launch()
|
||||
//}
|
||||
})
|
||||
} else {
|
||||
self.targetVol = getMountPoint(from: disk) ?? ""
|
||||
self.populateTargets()
|
||||
|
@ -630,20 +630,15 @@ final class SettingsViewController:
|
||||
// MARK: Controls actions
|
||||
@IBAction func openThemeManager(_ sender: NSButton!) {
|
||||
DispatchQueue.main.async {
|
||||
if #available(OSX 10.11, *) {
|
||||
if (AppSD.themeManagerWC == nil) {
|
||||
AppSD.themeManagerWC = ThemeManagerWC.loadFromNib()
|
||||
}
|
||||
|
||||
AppSD.themeManagerWC?.showWindow(self)
|
||||
} else {
|
||||
if (AppSD.themeManagerWC == nil) {
|
||||
AppSD.themeManagerWC = ThemeManagerWC.loadFromNib()
|
||||
}
|
||||
|
||||
AppSD.themeManagerWC?.showWindow(self)
|
||||
if (AppSD.themeManagerWC == nil) {
|
||||
AppSD.themeManagerWC = ThemeManagerWC.loadFromNib()
|
||||
}
|
||||
AppSD.themeManagerWC?.showWindow(self)
|
||||
|
||||
AppSD.themeManagerWC?.window?.level = .floating
|
||||
AppSD.themeManagerWC?.window?.makeKeyAndOrderFront(nil)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
AppSD.themeManagerWC?.window?.level = .normal
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,14 +855,21 @@ final class SettingsViewController:
|
||||
}
|
||||
|
||||
AppSD.installerWC?.showWindow(self)
|
||||
AppSD.installerWC?.window?.level = .floating
|
||||
AppSD.installerWC?.window?.makeKeyAndOrderFront(nil)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
AppSD.installerWC?.window?.level = .normal
|
||||
} else {
|
||||
if (AppSD.installerOutWC == nil) {
|
||||
AppSD.installerOutWC = InstallerOutWindowController.loadFromNib()
|
||||
}
|
||||
|
||||
AppSD.installerOutWC?.showWindow(self)
|
||||
AppSD.installerOutWC?.window?.level = .floating
|
||||
AppSD.installerOutWC?.window?.makeKeyAndOrderFront(nil)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
AppSD.installerOutWC?.window?.level = .normal
|
||||
}
|
||||
//NSApp.activate(ignoringOtherApps: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -759,37 +759,51 @@ NSComboBoxDataSource {
|
||||
@IBAction func targetPopPressed(_ sender: FWPopUpButton!) {
|
||||
if let disk = sender?.selectedItem?.representedObject as? String {
|
||||
if !isMountPoint(path: disk) {
|
||||
//DispatchQueue.global(qos: .background).async {
|
||||
let cmd = "diskutil mount \(disk)"
|
||||
let msg = String(format: "Clover wants to mount %@", disk)
|
||||
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
|
||||
|
||||
let task = Process()
|
||||
|
||||
if #available(OSX 10.12, *) {
|
||||
task.launchPath = "/usr/bin/osascript"
|
||||
task.arguments = ["-e", script]
|
||||
} else {
|
||||
task.launchPath = "/usr/sbin/diskutil"
|
||||
task.arguments = ["mount", disk]
|
||||
}
|
||||
|
||||
task.terminationHandler = { t in
|
||||
if t.terminationStatus == 0 {
|
||||
if isMountPoint(path: disk) {
|
||||
self.targetVolume = getMountPoint(from: disk)
|
||||
self.installButton.isEnabled = false
|
||||
self.view.window?.level = .floating
|
||||
DispatchQueue.global(priority: .background).async(execute: { () -> Void in
|
||||
let cmd = "diskutil mount \(disk)"
|
||||
let msg = String(format: "Clover wants to mount %@", disk)
|
||||
let script = "do shell script \"\(cmd)\" with prompt \"\(msg)\" with administrator privileges"
|
||||
|
||||
let task = Process()
|
||||
|
||||
if #available(OSX 10.12, *) {
|
||||
task.launchPath = "/usr/bin/osascript"
|
||||
task.arguments = ["-e", script]
|
||||
} else {
|
||||
task.launchPath = "/usr/sbin/diskutil"
|
||||
task.arguments = ["mount", disk]
|
||||
}
|
||||
|
||||
task.terminationHandler = { t in
|
||||
if t.terminationStatus == 0 {
|
||||
if isMountPoint(path: disk) {
|
||||
DispatchQueue.main.async {
|
||||
self.targetVolume = getMountPoint(from: disk)
|
||||
self.populateTargets()
|
||||
self.showInstalledThemes(self.installedThemesCheckBox)
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.populateTargets()
|
||||
self.installButton.isEnabled = true
|
||||
self.view.window?.makeKeyAndOrderFront(nil)
|
||||
self.view.window?.level = .floating
|
||||
self.view.window?.level = .normal
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
NSSound.beep()
|
||||
self.installButton.isEnabled = true
|
||||
self.view.window?.makeKeyAndOrderFront(nil)
|
||||
self.view.window?.level = .floating
|
||||
self.view.window?.level = .normal
|
||||
self.showInstalledThemes(self.installedThemesCheckBox)
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async { self.view.window?.makeKeyAndOrderFront(nil) }
|
||||
} else {
|
||||
NSSound.beep()
|
||||
self.showInstalledThemes(self.installedThemesCheckBox)
|
||||
}
|
||||
}
|
||||
task.launch()
|
||||
task.launch()
|
||||
})
|
||||
//}
|
||||
} else {
|
||||
self.targetVolume = getMountPoint(from: disk)
|
||||
|
@ -122,6 +122,7 @@
|
||||
9A637AE82430D927000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A637AE92430D928000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A637AEA2430D928000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A7AEDE7245963BF003AAD04 /* XToolsCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A7AEDE6245963BF003AAD04 /* XToolsCommon.h */; };
|
||||
9A9AEB94243F7B5600FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB90243F7B5600FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9AEB97243F7B5600FBD7D8 /* unicode_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9AEB93243F7B5600FBD7D8 /* unicode_conversions.h */; };
|
||||
9A9AEB99243F7B7A00FBD7D8 /* printf_lite-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9AEB98243F7B7900FBD7D8 /* printf_lite-test.h */; };
|
||||
@ -129,6 +130,14 @@
|
||||
9A9AEB9B243F7B8400FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB90243F7B5600FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9AEB9C243F7B8400FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB90243F7B5600FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9D3B2324221563006D8CD9 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */; };
|
||||
9A9EA7FE245AD97F0076EC02 /* XToolsCommon_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */; };
|
||||
9A9EA7FF245AD97F0076EC02 /* XToolsCommon_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */; };
|
||||
9A9EA800245AD97F0076EC02 /* XToolsCommon_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */; };
|
||||
9A9EA801245AD97F0076EC02 /* XToolsCommon_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */; };
|
||||
9A9EA806245AD9B30076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9A9EA807245AD9B30076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9A9EA808245AD9B40076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9A9EA80A245AD9E50076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9AC77FB924176C04005CDD5C /* XStringArray_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECC24176C04005CDD5C /* XStringArray_test.h */; };
|
||||
9AC77FBA24176C04005CDD5C /* XArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECD24176C04005CDD5C /* XArray_tests.h */; };
|
||||
9AC77FBB24176C04005CDD5C /* XStringArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ECE24176C04005CDD5C /* XStringArray_test.cpp */; };
|
||||
@ -884,10 +893,13 @@
|
||||
9A35A6172451FE1500CAFF76 /* XStringAbstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringAbstract.h; sourceTree = "<group>"; };
|
||||
9A4185B42439F29D00BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; };
|
||||
9A7AEDE6245963BF003AAD04 /* XToolsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon.h; sourceTree = "<group>"; };
|
||||
9A9AEB90243F7B5600FBD7D8 /* unicode_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unicode_conversions.cpp; sourceTree = "<group>"; };
|
||||
9A9AEB93243F7B5600FBD7D8 /* unicode_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode_conversions.h; sourceTree = "<group>"; };
|
||||
9A9AEB98243F7B7900FBD7D8 /* printf_lite-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test.h"; sourceTree = "<group>"; };
|
||||
9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printf_lite-test.cpp"; sourceTree = "<group>"; };
|
||||
9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon_test.h; sourceTree = "<group>"; };
|
||||
9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon_test.cpp; sourceTree = "<group>"; };
|
||||
9AC77EC424176BF2005CDD5C /* libCloverX64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCloverX64.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9AC77ECC24176C04005CDD5C /* XStringArray_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray_test.h; sourceTree = "<group>"; };
|
||||
9AC77ECD24176C04005CDD5C /* XArray_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XArray_tests.h; sourceTree = "<group>"; };
|
||||
@ -1168,6 +1180,8 @@
|
||||
9AC77ECA24176C04005CDD5C /* cpp_unit_test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */,
|
||||
9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */,
|
||||
9A9AEB98243F7B7900FBD7D8 /* printf_lite-test.h */,
|
||||
9AC77ED424176C04005CDD5C /* all_tests.cpp */,
|
||||
9AC77ED724176C04005CDD5C /* all_tests.h */,
|
||||
@ -1442,6 +1456,7 @@
|
||||
9AC77FAB24176C04005CDD5C /* cpp_foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A7AEDE6245963BF003AAD04 /* XToolsCommon.h */,
|
||||
9A9AEB90243F7B5600FBD7D8 /* unicode_conversions.cpp */,
|
||||
9A9AEB93243F7B5600FBD7D8 /* unicode_conversions.h */,
|
||||
9AC77FB624176C04005CDD5C /* XArray.h */,
|
||||
@ -1488,8 +1503,10 @@
|
||||
9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */,
|
||||
9AC7808D24176C04005CDD5C /* XStringArray.h in Headers */,
|
||||
9A105B7824483AE40006DE06 /* usbfix.h in Headers */,
|
||||
9A9EA7FE245AD97F0076EC02 /* XToolsCommon_test.h in Headers */,
|
||||
9A28CD33241BC0DF00F3D247 /* strcmp_test.h in Headers */,
|
||||
9AC7802124176C04005CDD5C /* boot.h in Headers */,
|
||||
9A7AEDE7245963BF003AAD04 /* XToolsCommon.h in Headers */,
|
||||
9AC7802F24176C04005CDD5C /* ati.h in Headers */,
|
||||
9A105B6D24483AE40006DE06 /* stddef.h in Headers */,
|
||||
9AC780B52417EE53005CDD5C /* global_test.h in Headers */,
|
||||
@ -1596,6 +1613,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9ACFE64E24309AF80071CC93 /* abort.h in Headers */,
|
||||
9A9EA801245AD97F0076EC02 /* XToolsCommon_test.h in Headers */,
|
||||
9ACFE64F24309AF80071CC93 /* MSKEK.h in Headers */,
|
||||
9ACFE65024309AF80071CC93 /* menu_items.h in Headers */,
|
||||
9ACFE65124309AF80071CC93 /* XTheme.h in Headers */,
|
||||
@ -1758,6 +1776,7 @@
|
||||
9AF415D0242CD75C00D2644C /* Hibernate.h in Headers */,
|
||||
9AF415D1242CD75C00D2644C /* strlen_test.h in Headers */,
|
||||
9AF415D2242CD75C00D2644C /* XArray_tests.h in Headers */,
|
||||
9A9EA7FF245AD97F0076EC02 /* XToolsCommon_test.h in Headers */,
|
||||
9AF415D3242CD75C00D2644C /* Handle.h in Headers */,
|
||||
9AF415D4242CD75C00D2644C /* XArray.h in Headers */,
|
||||
9AF415D5242CD75C00D2644C /* MSPCADB.h in Headers */,
|
||||
@ -1853,6 +1872,7 @@
|
||||
9AF416AD242CDA5800D2644C /* Hibernate.h in Headers */,
|
||||
9AF416AE242CDA5800D2644C /* strlen_test.h in Headers */,
|
||||
9AF416AF242CDA5800D2644C /* XArray_tests.h in Headers */,
|
||||
9A9EA800245AD97F0076EC02 /* XToolsCommon_test.h in Headers */,
|
||||
9AF416B0242CDA5800D2644C /* Handle.h in Headers */,
|
||||
9AF416B1242CDA5800D2644C /* XArray.h in Headers */,
|
||||
9AF416B2242CDA5800D2644C /* MSPCADB.h in Headers */,
|
||||
@ -2167,6 +2187,7 @@
|
||||
9AC7805E24176C04005CDD5C /* common.cpp in Sources */,
|
||||
9AC7804924176C04005CDD5C /* egemb_icons.cpp in Sources */,
|
||||
9AC7801124176C04005CDD5C /* Edid.cpp in Sources */,
|
||||
9A9EA80A245AD9E50076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9AC7803A24176C04005CDD5C /* smbios.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -2280,6 +2301,7 @@
|
||||
9ACFE71F24309AF80071CC93 /* common.cpp in Sources */,
|
||||
9ACFE72024309AF80071CC93 /* egemb_icons.cpp in Sources */,
|
||||
9ACFE72124309AF80071CC93 /* Edid.cpp in Sources */,
|
||||
9A9EA806245AD9B30076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9ACFE72224309AF80071CC93 /* smbios.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -2393,6 +2415,7 @@
|
||||
9AF41655242CD75C00D2644C /* common.cpp in Sources */,
|
||||
9AF41656242CD75C00D2644C /* egemb_icons.cpp in Sources */,
|
||||
9AF41657242CD75C00D2644C /* Edid.cpp in Sources */,
|
||||
9A9EA808245AD9B40076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9AF41658242CD75C00D2644C /* smbios.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -2506,6 +2529,7 @@
|
||||
9AF41732242CDA5800D2644C /* common.cpp in Sources */,
|
||||
9AF41733242CDA5800D2644C /* egemb_icons.cpp in Sources */,
|
||||
9AF41734242CDA5800D2644C /* Edid.cpp in Sources */,
|
||||
9A9EA807245AD9B30076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9AF41735242CDA5800D2644C /* smbios.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -41,6 +41,27 @@
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A2A7C6C24576CCE00422263 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A2A7C6D24576CCE00422263 /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
9A2A7C6E24576CCE00422263 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1D241BB61B00F3D247 /* abort.cpp */; };
|
||||
9A2A7C6F24576CCE00422263 /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA7C2451C8330050B38B /* XString.cpp */; };
|
||||
9A2A7C7024576CCE00422263 /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA802451C88D0050B38B /* XString_test.cpp */; };
|
||||
9A2A7C7124576CCE00422263 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
|
||||
9A2A7C7224576CCE00422263 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A2A7C7324576CCE00422263 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9A2A7C7424576CCE00422263 /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD15241BACBB00F3D247 /* strlen_test.cpp */; };
|
||||
9A2A7C7524576CCE00422263 /* strcmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */; };
|
||||
9A2A7C7624576CCE00422263 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
|
||||
9A2A7C7724576CCE00422263 /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A2A7C7824576CCE00422263 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A2A7C7924576CCE00422263 /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A2A7C7A24576CCE00422263 /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9A2A7C7B24576CCE00422263 /* XStringArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringArray_test.cpp */; };
|
||||
9A2A7C7C24576CCE00422263 /* strcmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD0F241B9EF800F3D247 /* strcmp.cpp */; };
|
||||
9A2A7C7D24576CCE00422263 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A2A7C7E24576CCE00422263 /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
9A2A7C7F24576CCE00422263 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
9A2A7C8024576CCE00422263 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
9A4185B12439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4185B22439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4185B32439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
@ -64,6 +85,10 @@
|
||||
9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9AEB8E243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9AEB8F243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9EA7F8245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9A9EA7F9245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9A9EA7FA245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9A9EA7FB245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */; };
|
||||
9AA0458A2425F94D000D6970 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
9AA0458B2425F94D000D6970 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
9AA0458C2425F94D000D6970 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
@ -82,6 +107,15 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
9A2A7C8224576CCE00422263 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
9A57C22B2418B9A00029A39F /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -129,6 +163,7 @@
|
||||
9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = "<group>"; };
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf_fixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xcode_utf_fixed.h; sourceTree = "<group>"; };
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xcode_utf_fixed.cpp; sourceTree = "<group>"; };
|
||||
9A2A7C8624576CCE00422263 /* cpp_tests UTF32 c++17 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32 c++17"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; };
|
||||
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = "<group>"; };
|
||||
@ -140,11 +175,14 @@
|
||||
9A57C22F2418B9A00029A39F /* cpp_tests UTF16 unsigned char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 unsigned char"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A57C266241A799B0029A39F /* XString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString.h; sourceTree = "<group>"; };
|
||||
9A6BA73C2449977300BDA52C /* XStringAbstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringAbstract.h; sourceTree = "<group>"; };
|
||||
9A7AEDE82459696C003AAD04 /* XToolsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon.h; sourceTree = "<group>"; };
|
||||
9A92232D2402FD1000483CBA /* cpp_tests UTF16 signed char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 signed char"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A9223302402FD1000483CBA /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
9A92234D2402FD9500483CBA /* Platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
|
||||
9A9AEB8B243F73CE00FBD7D8 /* unicode_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode_conversions.h; sourceTree = "<group>"; };
|
||||
9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unicode_conversions.cpp; sourceTree = "<group>"; };
|
||||
9A9EA7F6245AAB310076EC02 /* XToolsCommon_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon_test.h; sourceTree = "<group>"; };
|
||||
9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon_test.cpp; sourceTree = "<group>"; };
|
||||
9AA045732425D200000D6970 /* IO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IO.h; sourceTree = "<group>"; };
|
||||
9AA045742425D200000D6970 /* IO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IO.cpp; sourceTree = "<group>"; };
|
||||
9AA045882425F94D000D6970 /* printf_lite-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test.h"; sourceTree = "<group>"; };
|
||||
@ -178,6 +216,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9A2A7C8124576CCE00422263 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9A57C22A2418B9A00029A39F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -198,6 +243,7 @@
|
||||
9A0B08432402FE9300E2B470 /* cpp_foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A7AEDE82459696C003AAD04 /* XToolsCommon.h */,
|
||||
9A4FFA7C2451C8330050B38B /* XString.cpp */,
|
||||
9A57C266241A799B0029A39F /* XString.h */,
|
||||
9A6BA73C2449977300BDA52C /* XStringAbstract.h */,
|
||||
@ -215,6 +261,8 @@
|
||||
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */,
|
||||
9A9EA7F6245AAB310076EC02 /* XToolsCommon_test.h */,
|
||||
9A4FFA802451C88D0050B38B /* XString_test.cpp */,
|
||||
9A4FFA7F2451C88C0050B38B /* XString_test.h */,
|
||||
9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */,
|
||||
@ -300,6 +348,7 @@
|
||||
9A92232D2402FD1000483CBA /* cpp_tests UTF16 signed char */,
|
||||
9A0B08862403B08400E2B470 /* cpp_tests UTF32 */,
|
||||
9A57C22F2418B9A00029A39F /* cpp_tests UTF16 unsigned char */,
|
||||
9A2A7C8624576CCE00422263 /* cpp_tests UTF32 c++17 */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -364,6 +413,23 @@
|
||||
productReference = 9A0B08862403B08400E2B470 /* cpp_tests UTF32 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
9A2A7C6A24576CCE00422263 /* cpp_tests UTF32 c++17 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9A2A7C8324576CCE00422263 /* Build configuration list for PBXNativeTarget "cpp_tests UTF32 c++17" */;
|
||||
buildPhases = (
|
||||
9A2A7C6B24576CCE00422263 /* Sources */,
|
||||
9A2A7C8124576CCE00422263 /* Frameworks */,
|
||||
9A2A7C8224576CCE00422263 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "cpp_tests UTF32 c++17";
|
||||
productName = cpp_tests;
|
||||
productReference = 9A2A7C8624576CCE00422263 /* cpp_tests UTF32 c++17 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
9A57C2172418B9A00029A39F /* cpp_tests UTF16 unsigned char */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9A57C22C2418B9A00029A39F /* Build configuration list for PBXNativeTarget "cpp_tests UTF16 unsigned char" */;
|
||||
@ -427,6 +493,7 @@
|
||||
9A92232C2402FD1000483CBA /* cpp_tests UTF16 signed char */,
|
||||
9A0B08712403B08400E2B470 /* cpp_tests UTF32 */,
|
||||
9A57C2172418B9A00029A39F /* cpp_tests UTF16 unsigned char */,
|
||||
9A2A7C6A24576CCE00422263 /* cpp_tests UTF32 c++17 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -441,6 +508,7 @@
|
||||
9A28CD20241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA842451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA822451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A9EA7F9245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A0B08742403B08400E2B470 /* main.cpp in Sources */,
|
||||
@ -460,6 +528,35 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9A2A7C6B24576CCE00422263 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9A2A7C6C24576CCE00422263 /* LoadOptions_test.cpp in Sources */,
|
||||
9A2A7C6D24576CCE00422263 /* XObjArray_tests.cpp in Sources */,
|
||||
9A2A7C6E24576CCE00422263 /* abort.cpp in Sources */,
|
||||
9A2A7C6F24576CCE00422263 /* XString.cpp in Sources */,
|
||||
9A2A7C7024576CCE00422263 /* XString_test.cpp in Sources */,
|
||||
9A9EA7FB245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A2A7C7124576CCE00422263 /* strlen.cpp in Sources */,
|
||||
9A2A7C7224576CCE00422263 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A2A7C7324576CCE00422263 /* main.cpp in Sources */,
|
||||
9A2A7C7424576CCE00422263 /* strlen_test.cpp in Sources */,
|
||||
9A2A7C7524576CCE00422263 /* strcmp_test.cpp in Sources */,
|
||||
9A2A7C7624576CCE00422263 /* strncmp_test.cpp in Sources */,
|
||||
9A2A7C7724576CCE00422263 /* all_tests.cpp in Sources */,
|
||||
9A2A7C7824576CCE00422263 /* unicode_conversions.cpp in Sources */,
|
||||
9A2A7C7924576CCE00422263 /* global_test.cpp in Sources */,
|
||||
9A2A7C7A24576CCE00422263 /* printf_lite.c in Sources */,
|
||||
9A2A7C7B24576CCE00422263 /* XStringArray_test.cpp in Sources */,
|
||||
9A2A7C7C24576CCE00422263 /* strcmp.cpp in Sources */,
|
||||
9A2A7C7D24576CCE00422263 /* XStringArray.cpp in Sources */,
|
||||
9A2A7C7E24576CCE00422263 /* XArray_tests.cpp in Sources */,
|
||||
9A2A7C7F24576CCE00422263 /* printf_lite-test.cpp in Sources */,
|
||||
9A2A7C8024576CCE00422263 /* Platform.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9A57C2182418B9A00029A39F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -469,6 +566,7 @@
|
||||
9A28CD21241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA852451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA832451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A9EA7FA245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A57C21B2418B9A00029A39F /* main.cpp in Sources */,
|
||||
@ -497,6 +595,7 @@
|
||||
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A9EA7F8245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A9223312402FD1000483CBA /* main.cpp in Sources */,
|
||||
9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
@ -536,6 +635,25 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9A2A7C8424576CCE00422263 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9A2A7C8524576CCE00422263 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9A57C22D2418B9A00029A39F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@ -773,6 +891,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9A2A7C8324576CCE00422263 /* Build configuration list for PBXNativeTarget "cpp_tests UTF32 c++17" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9A2A7C8424576CCE00422263 /* Debug */,
|
||||
9A2A7C8524576CCE00422263 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9A57C22C2418B9A00029A39F /* Build configuration list for PBXNativeTarget "cpp_tests UTF16 unsigned char" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
@ -12,7 +12,7 @@ fi
|
||||
# Ctools source version
|
||||
# here we can change source versions of tools
|
||||
#
|
||||
export CCTOOLS_VERSION=${CCTOOLS_VERSION:-921}
|
||||
export CCTOOLS_VERSION=${CCTOOLS_VERSION:-949.0.1}
|
||||
|
||||
# Change PREFIX if you want mtoc installed on different place
|
||||
#
|
||||
|
@ -394,16 +394,16 @@ UINT8 hpet1[] = // Name (_CID, EisaId ("PNP0C01"))
|
||||
};
|
||||
*/
|
||||
const UINT8 wakret[] = { 0xA4, 0x12, 0x04, 0x02, 0x00, 0x00 };
|
||||
const UINT8 wakslp1[] = { 0x5B, 0x80, 0x50, 0x4D, 0x33, 0x30, 0x01 };
|
||||
const UINT8 wakslp2[] = { 0x0A, 0x08, 0x5B, 0x81, 0x0D, 0x50, 0x4D, 0x33, 0x30, 0x01,
|
||||
0x00, 0x04, 0x53, 0x4C, 0x4D, 0x45, 0x01, 0x70, 0x00, 0x53, 0x4C, 0x4D, 0x45 };
|
||||
//const UINT8 wakslp1[] = { 0x5B, 0x80, 0x50, 0x4D, 0x33, 0x30, 0x01 };
|
||||
//const UINT8 wakslp2[] = { 0x0A, 0x08, 0x5B, 0x81, 0x0D, 0x50, 0x4D, 0x33, 0x30, 0x01,
|
||||
// 0x00, 0x04, 0x53, 0x4C, 0x4D, 0x45, 0x01, 0x70, 0x00, 0x53, 0x4C, 0x4D, 0x45 };
|
||||
|
||||
const UINT8 waksecur[] = {0xA0, 0x0D, 0x91, 0x95, 0x68, 0x01, 0x94, 0x68, 0x0A, 0x05,
|
||||
0x70, 0x0A, 0x03, 0x68};
|
||||
|
||||
const UINT8 pwrb[] = { //? \_SB_PWRB, 0x02
|
||||
0x86, 0x5C, 0x2E, 0x5F, 0x53, 0x42, 0x5F, 0x50, 0x57, 0x52, 0x42, 0x0A, 0x02
|
||||
};
|
||||
//const UINT8 pwrb[] = { //? \_SB_PWRB, 0x02
|
||||
// 0x86, 0x5C, 0x2E, 0x5F, 0x53, 0x42, 0x5F, 0x50, 0x57, 0x52, 0x42, 0x0A, 0x02
|
||||
//};
|
||||
|
||||
|
||||
const UINT8 acpi3[] = { //Name(_HID, "ACPI003")
|
||||
@ -423,16 +423,16 @@ const UINT8 dtgp_1[] = { // DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
|
||||
0x71, 0x60, 0xA4, 0x60
|
||||
};
|
||||
|
||||
const UINT8 pwrbcid[] = {
|
||||
0x08, 0x5F, 0x43, 0x49, 0x44, 0x0C, 0x41, 0xD0, 0x0C, 0x0E, 0x14,
|
||||
0x0E, 0x5F, 0x50, 0x52, 0x57, 0x00, 0xA4, 0x12, 0x06, 0x02, 0x0A,
|
||||
0x0B, 0x0A, 0x04
|
||||
};
|
||||
//const UINT8 pwrbcid[] = {
|
||||
// 0x08, 0x5F, 0x43, 0x49, 0x44, 0x0C, 0x41, 0xD0, 0x0C, 0x0E, 0x14,
|
||||
// 0x0E, 0x5F, 0x50, 0x52, 0x57, 0x00, 0xA4, 0x12, 0x06, 0x02, 0x0A,
|
||||
// 0x0B, 0x0A, 0x04
|
||||
//};
|
||||
|
||||
const UINT8 pwrbprw[] = {
|
||||
0x14, 0x0E, 0x5F, 0x50, 0x52, 0x57, 0x00, 0xA4, 0x12, 0x06, 0x02,
|
||||
0x0A, 0x0B, 0x0A, 0x04
|
||||
};
|
||||
//const UINT8 pwrbprw[] = {
|
||||
// 0x14, 0x0E, 0x5F, 0x50, 0x52, 0x57, 0x00, 0xA4, 0x12, 0x06, 0x02,
|
||||
// 0x0A, 0x0B, 0x0A, 0x04
|
||||
//};
|
||||
|
||||
const UINT8 shutdown0[] = {
|
||||
0xA0, 0x05, 0x93, 0x68, 0x0A, 0x05, 0xA1, 0x01
|
||||
@ -451,14 +451,14 @@ const UINT8 pnlf[] = {
|
||||
0x08, 0x5F, 0x55, 0x49, 0x44, 0x0A, 0x0A, // Name (_UID, 0x0A)
|
||||
0x08, 0x5F, 0x53, 0x54, 0x41, 0x0A, 0x0B // Name (_STA, 0x0B)
|
||||
};
|
||||
//Scope (_SB.PCI0.LPCB)
|
||||
const UINT8 pnlfLPC[] = {
|
||||
0x10, 0x3e, 0x2f, 0x03, 0x5f, 0x53, 0x42, 0x5f, 0x50, 0x43, 0x49, 0x30, 0x4c, 0x50, 0x43, 0x42,
|
||||
0x5b, 0x82, 0x2d, 0x50, 0x4e, 0x4c, 0x46, 0x08, 0x5f, 0x48, 0x49,
|
||||
0x44, 0x0c, 0x06, 0x10, 0x00, 0x02, 0x08, 0x5f, 0x43, 0x49, 0x44, 0x0d,
|
||||
0x62, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x00, 0x08, 0x5f,
|
||||
0x55, 0x49, 0x44, 0x0a, 0x0a, 0x08, 0x5f, 0x53, 0x54, 0x41, 0x0a, 0x0b
|
||||
};
|
||||
////Scope (_SB.PCI0.LPCB)
|
||||
//const UINT8 pnlfLPC[] = {
|
||||
// 0x10, 0x3e, 0x2f, 0x03, 0x5f, 0x53, 0x42, 0x5f, 0x50, 0x43, 0x49, 0x30, 0x4c, 0x50, 0x43, 0x42,
|
||||
// 0x5b, 0x82, 0x2d, 0x50, 0x4e, 0x4c, 0x46, 0x08, 0x5f, 0x48, 0x49,
|
||||
// 0x44, 0x0c, 0x06, 0x10, 0x00, 0x02, 0x08, 0x5f, 0x43, 0x49, 0x44, 0x0d,
|
||||
// 0x62, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x00, 0x08, 0x5f,
|
||||
// 0x55, 0x49, 0x44, 0x0a, 0x0a, 0x08, 0x5f, 0x53, 0x54, 0x41, 0x0a, 0x0b
|
||||
//};
|
||||
|
||||
|
||||
const UINT8 app2[] = { //Name (_HID, EisaId("APP0002"))
|
||||
|
@ -1384,7 +1384,7 @@ EFI_STATUS SetStartupDiskVolume (
|
||||
// Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, Size, EfiBootDevice);
|
||||
// FreePool(EfiBootDevice);
|
||||
|
||||
XString EfiBootDevice;
|
||||
XString8 EfiBootDevice;
|
||||
EfiBootDevice.SPrintf(
|
||||
"<array><dict>"
|
||||
"<key>IOMatch</key>"
|
||||
|
@ -21,7 +21,7 @@ extern "C" {
|
||||
|
||||
#include "../../cpp_foundation/XString.h"
|
||||
|
||||
static XString stdio_static_buf;
|
||||
static XString8 stdio_static_buf;
|
||||
static XStringW stdio_static_wbuf;
|
||||
|
||||
int vprintf(const char* format, VA_LIST va)
|
||||
@ -44,24 +44,28 @@ int printf(const char* format, ...)
|
||||
|
||||
const char* strerror(EFI_STATUS Status)
|
||||
{
|
||||
size_t size = stdio_static_buf.allocatedSize();
|
||||
UINTN n = 0;
|
||||
do {
|
||||
stdio_static_buf.CheckSize(stdio_static_buf.length()+10);
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%r", Status);
|
||||
} while ( n > stdio_static_buf.allocatedSize() - 2 );
|
||||
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%r", Status);
|
||||
while ( n > size - 2 )
|
||||
{
|
||||
size += 10;
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%r", Status);
|
||||
}
|
||||
return stdio_static_buf.s();
|
||||
}
|
||||
|
||||
//this function print guid in LittleEndian format while we need BigEndian as Apple do
|
||||
const char* strguid(EFI_GUID* guid)
|
||||
{
|
||||
size_t size = stdio_static_buf.allocatedSize();
|
||||
UINTN n = 0;
|
||||
do {
|
||||
stdio_static_buf.CheckSize(stdio_static_buf.length()+10);
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%g", guid);
|
||||
} while ( n > stdio_static_buf.allocatedSize() - 2 );
|
||||
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%g", guid);
|
||||
while ( n > size - 2 )
|
||||
{
|
||||
size += 10;
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%g", guid);
|
||||
}
|
||||
return stdio_static_buf.s();
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ INTN LayoutBannerOffset = 64;
|
||||
INTN LayoutTextOffset = 0;
|
||||
INTN LayoutButtonOffset = 0;
|
||||
|
||||
ACPI_PATCHED_AML *ACPIPatchedAML;
|
||||
ACPI_PATCHED_AML *ACPIPatchedAML = NULL;
|
||||
SIDELOAD_KEXT *InjectKextList = NULL;
|
||||
//SYSVARIABLES *SysVariables;
|
||||
CHAR16 *IconFormat = NULL;
|
||||
@ -96,7 +96,7 @@ UINTN ThemesNum = 0;
|
||||
CONST CHAR16 *ThemesList[100]; //no more then 100 themes?
|
||||
UINTN ConfigsNum;
|
||||
CHAR16 *ConfigsList[20];
|
||||
UINTN DsdtsNum;
|
||||
UINTN DsdtsNum = 0;
|
||||
CHAR16 *DsdtsList[20];
|
||||
UINTN AudioNum;
|
||||
HDA_OUTPUTS AudioList[20];
|
||||
@ -1905,12 +1905,12 @@ FillinCustomEntry (
|
||||
// } else {
|
||||
// Entry->Options.SPrintf("%s", Prop->string);
|
||||
// }
|
||||
Entry->LoadOptions = Split<XStringArray>(Prop->string, " ");
|
||||
Entry->LoadOptions.import(Split<XStringArray>(Prop->string, " "));
|
||||
} else {
|
||||
Prop = GetProperty(DictPointer, "Arguments");
|
||||
if (Prop != NULL && (Prop->type == kTagTypeString)) {
|
||||
// Entry->Options.SPrintf("%s", Prop->string);
|
||||
Entry->LoadOptions = Split<XStringArray>(Prop->string, " ");
|
||||
Entry->LoadOptions = Split<XStringArray>(Prop->string, " ");
|
||||
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS);
|
||||
}
|
||||
}
|
||||
@ -2046,6 +2046,7 @@ FillinCustomEntry (
|
||||
Entry->Type = OSTYPE_WINEFI;
|
||||
} else if (AsciiStriCmp(Prop->string, "Linux") == 0) {
|
||||
Entry->Type = OSTYPE_LIN;
|
||||
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS);
|
||||
} else if (AsciiStriCmp(Prop->string, "LinuxKernel") == 0) {
|
||||
Entry->Type = OSTYPE_LINEFI;
|
||||
} else {
|
||||
@ -3261,6 +3262,13 @@ GetListOfDsdts ()
|
||||
INTN NameLen;
|
||||
CHAR16* AcpiPath = PoolPrint(L"%s\\ACPI\\patched", OEMPath);
|
||||
|
||||
if (DsdtsNum > 0) {
|
||||
for (UINTN i = 0; i < DsdtsNum; i++) {
|
||||
if (DsdtsList[DsdtsNum] != NULL) {
|
||||
FreePool(DsdtsList[DsdtsNum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DsdtsNum = 0;
|
||||
OldChosenDsdt = 0xFFFF;
|
||||
|
||||
@ -3272,13 +3280,13 @@ GetListOfDsdts ()
|
||||
continue;
|
||||
}
|
||||
|
||||
snwprintf(FullName, 512, "%ls\\%ls", AcpiPath, DirEntry->FileName);
|
||||
snwprintf(FullName, 512, "%ls\\%ls", AcpiPath, DirEntry->FileName);
|
||||
if (FileExists(SelfRootDir, FullName)) {
|
||||
if (StriCmp(DirEntry->FileName, gSettings.DsdtName) == 0) {
|
||||
OldChosenDsdt = DsdtsNum;
|
||||
}
|
||||
NameLen = StrLen(DirEntry->FileName); //with ".aml"
|
||||
DsdtsList[DsdtsNum] = (CHAR16*)AllocateCopyPool(NameLen * sizeof(CHAR16) + 2, DirEntry->FileName);
|
||||
DsdtsList[DsdtsNum] = (CHAR16*)AllocateCopyPool(NameLen * sizeof(CHAR16) + 2, DirEntry->FileName); // if changing, notice freepool above
|
||||
DsdtsList[DsdtsNum++][NameLen] = L'\0';
|
||||
DBG("- %ls\n", DirEntry->FileName);
|
||||
}
|
||||
@ -3296,6 +3304,14 @@ GetListOfACPI ()
|
||||
INTN i, Count = gSettings.DisabledAMLCount;
|
||||
CHAR16* AcpiPath = PoolPrint(L"%s\\ACPI\\patched", OEMPath);
|
||||
|
||||
while (ACPIPatchedAML != NULL) {
|
||||
if (ACPIPatchedAML->FileName) {
|
||||
FreePool(ACPIPatchedAML->FileName);
|
||||
}
|
||||
ACPIPatchedAMLTmp = ACPIPatchedAML;
|
||||
ACPIPatchedAML = ACPIPatchedAML->Next;
|
||||
FreePool(ACPIPatchedAMLTmp);
|
||||
}
|
||||
ACPIPatchedAML = NULL;
|
||||
|
||||
DirIterOpen(SelfRootDir, AcpiPath, &DirIter);
|
||||
@ -3309,11 +3325,11 @@ GetListOfACPI ()
|
||||
continue;
|
||||
}
|
||||
|
||||
snwprintf(FullName, 512, "%ls\\%ls", AcpiPath, DirEntry->FileName);
|
||||
snwprintf(FullName, 512, "%ls\\%ls", AcpiPath, DirEntry->FileName);
|
||||
if (FileExists(SelfRootDir, FullName)) {
|
||||
BOOLEAN ACPIDisabled = FALSE;
|
||||
ACPIPatchedAMLTmp = (__typeof__(ACPIPatchedAMLTmp))AllocateZeroPool(sizeof(ACPI_PATCHED_AML));
|
||||
ACPIPatchedAMLTmp->FileName = PoolPrint(L"%s", DirEntry->FileName);
|
||||
ACPIPatchedAMLTmp = (__typeof__(ACPIPatchedAMLTmp))AllocateZeroPool(sizeof(ACPI_PATCHED_AML)); // if changing, notice freepool above
|
||||
ACPIPatchedAMLTmp->FileName = PoolPrint(L"%s", DirEntry->FileName); // if changing, notice freepool above
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
if ((gSettings.DisabledAML[i] != NULL) &&
|
||||
|
@ -20,58 +20,64 @@
|
||||
|
||||
#include "../../Include/Library/printf_lite.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//constexpr LString8 operator"" _XS8 ( const char* s, size_t len)
|
||||
//{
|
||||
//// LString8 returnValue;
|
||||
//// returnValue.takeValueFromLiteral(s);
|
||||
//// (void)len;
|
||||
//// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
// return LString8(s); // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
//}
|
||||
//
|
||||
//XString16 operator"" _XS16 ( const char16_t* s, size_t len)
|
||||
//{
|
||||
// XString16 returnValue;
|
||||
// returnValue.takeValueFromLiteral(s);
|
||||
// (void)len;
|
||||
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
//}
|
||||
//
|
||||
//XString32 operator"" _XS32 ( const char32_t* s, size_t len)
|
||||
//{
|
||||
// XString32 returnValue;
|
||||
// returnValue.takeValueFromLiteral(s);
|
||||
// (void)len;
|
||||
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
//}
|
||||
//
|
||||
//XStringW operator"" _XSW ( const wchar_t* s, size_t len)
|
||||
//{
|
||||
// XStringW returnValue;
|
||||
// returnValue.takeValueFromLiteral(s);
|
||||
// (void)len;
|
||||
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
//}
|
||||
|
||||
XString operator"" _XS ( const char* s, size_t len)
|
||||
{
|
||||
XString returnValue;
|
||||
returnValue.takeValueFrom(s, len);
|
||||
return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
}
|
||||
|
||||
XString16 operator"" _XS16 ( const char16_t* s, size_t len)
|
||||
{
|
||||
XString16 returnValue;
|
||||
returnValue.takeValueFrom(s, len);
|
||||
return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
}
|
||||
|
||||
XString32 operator"" _XS32 ( const char32_t* s, size_t len)
|
||||
{
|
||||
XString32 returnValue;
|
||||
returnValue.takeValueFrom(s, len);
|
||||
return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
}
|
||||
|
||||
XStringW operator"" _XSW ( const char* s, size_t len)
|
||||
{
|
||||
XStringW returnValue;
|
||||
returnValue.takeValueFrom(s, len);
|
||||
return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
}
|
||||
|
||||
XStringW operator"" _XSW ( const wchar_t* s, size_t len)
|
||||
{
|
||||
XStringW returnValue;
|
||||
returnValue.takeValueFrom(s, len);
|
||||
return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
}
|
||||
|
||||
const XString NullXString;
|
||||
const XString8 NullXString;
|
||||
const XString16 NullXString16;
|
||||
const XString32 NullXString32;
|
||||
const XStringW NullXStringW;
|
||||
|
||||
|
||||
XString SPrintf(const char* format, ...)
|
||||
//template<class O/*, enable_if(is_char(O))*/>
|
||||
//XStringW LStringW::operator + (const O* p2) { XStringW s; s.strcat(this->s()); s.strcat(p2); return s; }
|
||||
//
|
||||
//template<>
|
||||
//XStringW LStringW::operator + (const wchar_t* p2) { XStringW s; s.strcat(this->s()); s.strcat(p2); return s; }
|
||||
|
||||
|
||||
XString8 SPrintf(const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
XString str;
|
||||
XString8 str;
|
||||
|
||||
va_start (va, format);
|
||||
str.vSPrintf(format, va);
|
||||
va_end(va);
|
||||
va_end(va);
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -83,7 +89,7 @@ XStringW SWPrintf(const char* format, ...)
|
||||
|
||||
va_start (va, format);
|
||||
str.vSWPrintf(format, va);
|
||||
va_end(va);
|
||||
va_end(va);
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -97,21 +103,3 @@ XStringW SWPrintf(const char* format, ...)
|
||||
// return ret;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//XStringW CleanCtrl(const XStringW &S)
|
||||
//{
|
||||
// XStringW ReturnValue;
|
||||
// UINTN i;
|
||||
//
|
||||
// for ( i=0 ; i<S.size() ; i+=1 ) {
|
||||
//#if __WCHAR_MIN__ < 0
|
||||
// if ( S.wc_str()[i] >=0 && S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* wchar_t are signed */
|
||||
//#else
|
||||
// if ( S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* wchar_t are unsigned */
|
||||
//#endif
|
||||
// else ReturnValue += S.wc_str()[i];
|
||||
// }
|
||||
// return ReturnValue;
|
||||
//}
|
||||
|
||||
|
||||
|
@ -21,27 +21,37 @@
|
||||
#define XString16GrowByDefault 16
|
||||
#endif
|
||||
|
||||
//typedef XStringAbstract<char> XString;
|
||||
|
||||
class XString : public XStringAbstract<char, XString>
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
class XString8;
|
||||
class LString8 : public LString<char, XString8>
|
||||
{
|
||||
public:
|
||||
XString() : XStringAbstract<char, XString>() {};
|
||||
XString(const XString& S) : XStringAbstract<char, XString>(S) {}
|
||||
constexpr LString8() = delete;
|
||||
constexpr LString8(const char* s) : LString<char, XString8>(s) {};
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XString(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstract<char, XString>(S) {}
|
||||
// no assignement, no destructor
|
||||
|
||||
XString& operator=(const XString &S) { this->XStringAbstract<char, XString>::operator=(S); return *this; }
|
||||
friend constexpr LString8 operator "" _XS8 ( const char* s, size_t) { return LString8(s); }
|
||||
};
|
||||
|
||||
using XStringAbstract<char, XString>::operator =;
|
||||
class XString8 : public XStringAbstract<char, XString8>
|
||||
{
|
||||
public:
|
||||
XString8() : XStringAbstract<char, XString8>() {};
|
||||
XString8(const XString8& S) : XStringAbstract<char, XString8>(S) {}
|
||||
XString8(const LString8& S) : XStringAbstract<char, XString8>(S) { }
|
||||
|
||||
template<class OtherXStringClass, enable_if( is___String(OtherXStringClass) && !is___LString(OtherXStringClass))> // enable_if is to avoid constructing with a non-corresponding LString. To avoid memory allocation.
|
||||
XString8(const OtherXStringClass& S) : XStringAbstract<char, XString8>(S) {}
|
||||
|
||||
XString8& operator=(const XString8 &S) { this->XStringAbstract<char, XString8>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<char, XString8>::operator =;
|
||||
|
||||
protected:
|
||||
static void transmitSPrintf(const char* buf, unsigned int nbchar, void* context)
|
||||
{
|
||||
((XString*)(context))->strncat(buf, nbchar);
|
||||
((XString8*)(context))->strncat(buf, nbchar);
|
||||
}
|
||||
public:
|
||||
void vSPrintf(const char* format, va_list va)
|
||||
@ -57,7 +67,16 @@ public:
|
||||
vSPrintf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
class XString16;
|
||||
class LString16 : public LString<char16_t, XString16>
|
||||
{
|
||||
constexpr LString16(const char16_t* s) : LString<char16_t, XString16>(s) {};
|
||||
|
||||
friend constexpr LString16 operator "" _XS16 ( const char16_t* s, size_t) { return LString16(s); }
|
||||
};
|
||||
|
||||
class XString16 : public XStringAbstract<char16_t, XString16>
|
||||
@ -66,12 +85,24 @@ class XString16 : public XStringAbstract<char16_t, XString16>
|
||||
XString16() : XStringAbstract<char16_t, XString16>() {};
|
||||
XString16(const XString16& S) : XStringAbstract<char16_t, XString16>(S) {}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XString16(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstract<char16_t, XString16>(S) {}
|
||||
template<class OtherXStringClass, enable_if( is___String(OtherXStringClass) && !is___LString(OtherXStringClass))> // enable_if is to avoid constructing with a non-corresponding LString. To avoid memory allocation.
|
||||
XString16(const OtherXStringClass& S) : XStringAbstract<char16_t, XString16>(S) {}
|
||||
|
||||
XString16& operator=(const XString16 &S) { this->XStringAbstract<char16_t, XString16>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<char16_t, XString16>::operator =;
|
||||
|
||||
// friend LString16 operator "" _XS16 ( const char16_t* s, size_t len);
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
class XString32;
|
||||
class LString32 : public LString<char32_t, XString32>
|
||||
{
|
||||
constexpr LString32(const char32_t* s) : LString<char32_t, XString32>(s) {};
|
||||
|
||||
friend constexpr LString32 operator "" _XS32 ( const char32_t* s, size_t) { return LString32(s); }
|
||||
};
|
||||
|
||||
class XString32 : public XStringAbstract<char32_t, XString32>
|
||||
@ -80,12 +111,25 @@ class XString32 : public XStringAbstract<char32_t, XString32>
|
||||
XString32() : XStringAbstract<char32_t, XString32>() {};
|
||||
XString32(const XString32& S) : XStringAbstract<char32_t, XString32>(S) {}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XString32(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstract<char32_t, XString32>(S) {}
|
||||
template<class OtherXStringClass, enable_if( is___String(OtherXStringClass) && !is___LString(OtherXStringClass))> // enable_if is to avoid constructing with a non-corresponding LString. To avoid memory allocation.
|
||||
XString32(const OtherXStringClass& S) : XStringAbstract<char32_t, XString32>(S) {}
|
||||
|
||||
XString32& operator=(const XString32 &S) { this->XStringAbstract<char32_t, XString32>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<char32_t, XString32>::operator =;
|
||||
|
||||
// friend LString32 operator "" _XS32 ( const char32_t* s, size_t len);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
class XStringW;
|
||||
class LStringW : public LString<wchar_t, XStringW>
|
||||
{
|
||||
public:
|
||||
constexpr LStringW() = delete;
|
||||
constexpr LStringW(const wchar_t* s) : LString<wchar_t, XStringW>(s) {};
|
||||
|
||||
friend constexpr LStringW operator "" _XSW ( const wchar_t* s, size_t) { return LStringW(s); }
|
||||
};
|
||||
|
||||
class XStringW : public XStringAbstract<wchar_t, XStringW>
|
||||
@ -94,8 +138,10 @@ class XStringW : public XStringAbstract<wchar_t, XStringW>
|
||||
XStringW() : XStringAbstract<wchar_t, XStringW>() {};
|
||||
XStringW(const XStringW& S) : XStringAbstract<wchar_t, XStringW>(S) {}
|
||||
|
||||
template<class OtherXStringClass>
|
||||
template<class OtherXStringClass, enable_if( is___String(OtherXStringClass) && !is___LString(OtherXStringClass))> // enable_if is to avoid constructing with a non-corresponding LString. To avoid memory allocation.
|
||||
XStringW(const OtherXStringClass& S) : XStringAbstract<wchar_t, XStringW>(S) {}
|
||||
|
||||
XStringW(const LStringW& S) : XStringAbstract<wchar_t, XStringW>(S) { }
|
||||
|
||||
XStringW& operator=(const XStringW &S) { this->XStringAbstract<wchar_t, XStringW>::operator=(S); return *this; }
|
||||
|
||||
@ -122,28 +168,26 @@ public:
|
||||
vSWPrintf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
XString operator"" _XS ( const char* s, size_t len);
|
||||
XString16 operator"" _XS16 ( const char16_t* s, size_t len);
|
||||
XString32 operator"" _XS32 ( const char32_t* s, size_t len);
|
||||
XStringW operator"" _XSW ( const char* s, size_t len);
|
||||
XStringW operator"" _XSW ( const wchar_t* s, size_t len);
|
||||
|
||||
extern const XString NullXString;
|
||||
constexpr LString8 operator"" _XS8 ( const char* s, size_t len);
|
||||
constexpr LString16 operator"" _XS16 ( const char16_t* s, size_t len);
|
||||
constexpr LString32 operator"" _XS32 ( const char32_t* s, size_t len);
|
||||
constexpr LStringW operator"" _XSW ( const wchar_t* s, size_t len);
|
||||
|
||||
extern const XString8 NullXString;
|
||||
extern const XStringW NullXStringW;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define __attribute__(x)
|
||||
#endif
|
||||
|
||||
XString SPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
||||
XString8 SPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
||||
XStringW SWPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
||||
|
||||
|
||||
//
|
||||
//XStringAbstract SubString(const T *S, size_t pos, size_t count);
|
||||
//XStringAbstract CleanCtrl(const XStringAbstract &S);
|
||||
|
||||
#endif
|
||||
|
@ -1,10 +1,27 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// XSTRING
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
/*
|
||||
* Copyright (c) 2019 Jief Luce.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(__XSTRINGABSTRACT_H__)
|
||||
#define __XSTRINGABSTRACT_H__
|
||||
@ -179,15 +196,13 @@ size_t XStringAbstract__rindexOf(const O* s, size_t Pos, const P* other, bool to
|
||||
|
||||
|
||||
template<class T, class ThisXStringClass>
|
||||
class XStringAbstractNoDtor
|
||||
class __String
|
||||
{
|
||||
public:
|
||||
// const SubType NullXString;
|
||||
static T nullChar;
|
||||
|
||||
typedef T char_t;
|
||||
typedef ThisXStringClass xs_t;
|
||||
protected:
|
||||
T *m_data;
|
||||
size_t m_allocatedSize;
|
||||
|
||||
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
|
||||
size_t Xmin(size_t x1, size_t x2) const { if ( x1 < x2 ) return x1; return x2; }
|
||||
@ -203,101 +218,29 @@ protected:
|
||||
size_t offset = size_of_utf_string_len(m_data, (unsigned_type(IntegralType))pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
return m_data + offset;
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Init , Alloc
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
void Init(size_t aSize=0)
|
||||
{
|
||||
//DBG_XSTRING("Init aSize=%d\n", aSize);
|
||||
// We don't allocate any memory at first. To not have to test all the time if m_data is null, we init it to an empty string
|
||||
m_data = &nullChar;
|
||||
m_allocatedSize = 0;
|
||||
// if aSize == 0, nothing is done, because m_allocatedSize == aSize
|
||||
CheckSize(aSize, 0);
|
||||
}
|
||||
public:
|
||||
T *CheckSize(size_t nNewSize, size_t nGrowBy = XStringGrowByDefault) // nNewSize is in number of chars, NOT bytes
|
||||
{
|
||||
//DBG_XSTRING("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
|
||||
|
||||
if ( m_allocatedSize < nNewSize )
|
||||
{
|
||||
nNewSize += nGrowBy;
|
||||
if ( m_allocatedSize == 0 ) m_data = (T*)malloc( (nNewSize+1)*sizeof(T) );
|
||||
else m_data = (T*)Xrealloc(m_data, (nNewSize+1)*sizeof(T), (m_allocatedSize+1)*sizeof(T));
|
||||
if ( !m_data ) {
|
||||
panic("XStringAbstractNoDtor<T>::CheckSize(%zu, %zu) : Xrealloc(%" PRIuPTR ", %lu, %zd) returned NULL. System halted\n", nNewSize, nGrowBy, uintptr_t(m_data), nNewSize*sizeof(T), m_allocatedSize*sizeof(T));
|
||||
}
|
||||
m_allocatedSize = nNewSize;
|
||||
m_data[m_allocatedSize] = 0; // we allocated one more char (nNewSize+1). This \0 is an extra precaution. It's not for the normal null terminator. All string operation must considered that only m_allocatedSize bytes were allocated.
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
// void setSize(size_t newSize) // nNewSize is in number of chars, NOT bytes
|
||||
// {
|
||||
// //DBG_XSTRING("setLength(%d)\n", len);
|
||||
// CheckSize(newSize);
|
||||
// // if ( len >= size() ) {
|
||||
// // DBG_XSTRING("XStringAbstractNoDtor<T>::setLength(size_t len) : len >= size() (%d != %d). System halted\n", len, size());
|
||||
// // panic();
|
||||
// // }
|
||||
// m_data[newSize] = 0; // we may rewrite a 0 in nullChar, if no memory were allocated. That's ok.
|
||||
// }
|
||||
|
||||
|
||||
// T* memoryOffset(size_t i) {
|
||||
//
|
||||
// }
|
||||
|
||||
public:
|
||||
constexpr XStringAbstractNoDtor() : m_data(&nullChar), m_allocatedSize(0) {}
|
||||
constexpr __String(const T* s) : m_data((T*)s) {}
|
||||
public:
|
||||
// constexpr __String() : m_data(&nullChar) { }
|
||||
constexpr __String(const __String&) = delete;
|
||||
constexpr __String() = delete;
|
||||
|
||||
// ~XStringAbstractNoDtor()
|
||||
// {
|
||||
// //DBG_XSTRING("Destructor :%ls\n", data());
|
||||
//// if ( m_allocatedSize > 0 ) free((void*)m_data);
|
||||
// }
|
||||
// no assignement, no destructor
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) const { return _data(pos); }
|
||||
|
||||
// template<typename IntegralType, typename XStringAbstract__enable_if<XStringAbstract__is_integral<IntegralType>::value, IntegralType>::type* = nullptr>
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* dataSized(IntegralType size)
|
||||
{
|
||||
if ( size<0 ) panic("T* dataSized() -> i < 0");
|
||||
if ( (unsigned_type(IntegralType))size > MAX_XSIZE ) panic("T* dataSized() -> i > MAX_XSIZE");
|
||||
CheckSize((size_t)size);
|
||||
return _data(0);
|
||||
}
|
||||
//
|
||||
// // Pos is counted in logical char but size is counted in physical char (char, char16_t, char32_t or wchar_t)
|
||||
// template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
|
||||
// T* dataSized(IntegralType1 pos, IntegralType2 size)
|
||||
// {
|
||||
// if ( pos<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
// if ( size<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
// size_t offset = size_of_utf_string_len(m_data, (typename XStringAbstract__make_unsigned<IntegralType1>::type)pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
// CheckSize(offset + (typename XStringAbstract__make_unsigned<IntegralType2>::type)size);
|
||||
// return _data(pos);
|
||||
// }
|
||||
|
||||
|
||||
T* forgetDataWithoutFreeing()
|
||||
{
|
||||
T* ret = m_data;
|
||||
Init(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t length() const { return length_of_utf_string(m_data); }
|
||||
// size_t sizeZZ() const { return size_of_utf_string(m_data); }
|
||||
size_t sizeInNativeChars() const { return size_of_utf_string(m_data); }
|
||||
size_t sizeInBytes() const { return size_of_utf_string(m_data)*sizeof(T); }
|
||||
size_t sizeInBytesIncludingTerminator() const { return (size_of_utf_string(m_data)+1)*sizeof(T); } // usefull for unit tests
|
||||
size_t allocatedSize() const { return m_allocatedSize; }
|
||||
|
||||
|
||||
const T* wc_str() const { return m_data; }
|
||||
@ -306,7 +249,6 @@ public:
|
||||
const T* data() const { return m_data; } // todo delete
|
||||
|
||||
/* Empty ? */
|
||||
void setEmpty() { m_data[0] = 0; } // we may rewrite a 0 in nullChar if no memory were allocated (m_data == &nullChar). That's ok.
|
||||
bool isEmpty() const { return m_data == nullptr || *m_data == 0; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
|
||||
@ -323,7 +265,7 @@ public:
|
||||
char32_t char32At(IntegralType i) const
|
||||
{
|
||||
if (i < 0) {
|
||||
panic("XStringAbstractNoDtor<T>::char32At(size_t i) : i < 0. System halted\n");
|
||||
panic("__String<T>::char32At(size_t i) : i < 0. System halted\n");
|
||||
}
|
||||
size_t nb = 0;
|
||||
const T *p = m_data;
|
||||
@ -332,7 +274,7 @@ public:
|
||||
p = get_char32_from_string(p, &char32);
|
||||
if (!char32) {
|
||||
if ( (unsigned_type(IntegralType))i == nb ) return 0; // no panic if we want to access the null terminator
|
||||
panic("XStringAbstractNoDtor::char32At(size_t i) : i >= length(). System halted\n");
|
||||
panic("__String::char32At(size_t i) : i >= length(). System halted\n");
|
||||
}
|
||||
nb += 1;
|
||||
} while (nb <= (unsigned_type(IntegralType))i);
|
||||
@ -353,137 +295,21 @@ public:
|
||||
|
||||
|
||||
char32_t lastChar() const { if ( length() > 0 ) return char32At(length()-1); else return 0; }
|
||||
|
||||
//--------------------------------------------------------------------- strcat, strcpy, operator =
|
||||
|
||||
/* strcpy char */
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
void strcpy(O otherChar)
|
||||
{
|
||||
if ( otherChar != 0) {
|
||||
size_t newSize = utf_size_of_utf_string_len(m_data, &otherChar, 1);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, &otherChar, 1);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
/* strcpy */
|
||||
template<typename O>
|
||||
void strcpy(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t newSize = utf_size_of_utf_string(m_data, other);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data, m_allocatedSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
/* strncpy */
|
||||
template<typename O>
|
||||
void strncpy(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t newSize = utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
/* strcat char */
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
void strcat(O otherChar)
|
||||
{
|
||||
if ( otherChar ) {
|
||||
size_t currentSize = size_of_utf_string(m_data);
|
||||
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, &otherChar, 1);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, &otherChar, 1);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* strcat */
|
||||
template<typename O>
|
||||
void strcat(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t currentSize = size_of_utf_string(m_data); // size is number of T, not in bytes
|
||||
size_t newSize = currentSize + utf_size_of_utf_string(m_data, other); // size is number of T, not in bytes
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data+currentSize, m_allocatedSize-currentSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* strncat */
|
||||
template<typename O>
|
||||
void strncat(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t currentSize = size_of_utf_string(m_data);
|
||||
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* takeValueFrom */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const XStringAbstractNoDtor<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S) { strcpy(S); return *((ThisXStringClass*)this); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const XStringAbstractNoDtor<O, OtherXStringClass>& S, size_t len) { strncpy(S.data(0), len); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S, size_t len) { strncpy(S, len); return *((ThisXStringClass*)this); }
|
||||
|
||||
/* copy ctor */
|
||||
XStringAbstractNoDtor<T, ThisXStringClass>(const XStringAbstractNoDtor<T, ThisXStringClass> &S) { Init(0); takeValueFrom(S); }
|
||||
/* ctor */
|
||||
template<typename O, class OtherXStringClass>
|
||||
explicit XStringAbstractNoDtor<T, ThisXStringClass>(const XStringAbstractNoDtor<O, OtherXStringClass>& S) { Init(0); takeValueFrom(S); }
|
||||
// template<typename O>
|
||||
// explicit XStringAbstractNoDtor<T, ThisXStringClass>(const O* S) { Init(0); takeValueFrom(S); }
|
||||
// /* copy ctor */
|
||||
// __String<T, ThisXStringClass>(const __String<T, ThisXStringClass> &S) { Init(0); takeValueFrom(S); }
|
||||
// /* ctor */
|
||||
// template<typename O, class OtherXStringClass>
|
||||
// explicit __String<T, ThisXStringClass>(const __String<O, OtherXStringClass>& S) { Init(0); takeValueFrom(S); }
|
||||
//// template<typename O>
|
||||
//// explicit __String<T, ThisXStringClass>(const O* S) { Init(0); takeValueFrom(S); }
|
||||
|
||||
/* Copy Assign */ // Only other XString, no litteral at the moment.
|
||||
XStringAbstractNoDtor<T, ThisXStringClass>& operator =(const XStringAbstractNoDtor<T, ThisXStringClass>& S) { strcpy(S.s()); return *this; }
|
||||
/* Assign */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& operator =(const XStringAbstractNoDtor<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
// template<class O>
|
||||
// ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; }
|
||||
|
||||
/* += */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& operator += (const XStringAbstractNoDtor<O, OtherXStringClass>& S) { strcat(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
ThisXStringClass& operator += (O S) { strcat(S); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& operator += (const O* S) { strcat(S); return *((ThisXStringClass*)this); }
|
||||
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass operator + (const XStringAbstractNoDtor<O, OtherXStringClass>& p2) const { ThisXStringClass s; s=*this; s+=p2; return s; }
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
ThisXStringClass operator + (O p1) const { ThisXStringClass s; s=*this; s.strcat(p1); return s; }
|
||||
template<typename O>
|
||||
ThisXStringClass operator + (const O* p2) const { ThisXStringClass s; s=*this; s+=p2; return s; }
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
friend ThisXStringClass operator + (O p1, const ThisXStringClass& p2) { ThisXStringClass s; s.strcat(p1); s.strcat(p2.s()); return s; }
|
||||
template<typename O>
|
||||
friend ThisXStringClass operator + (const O *p1, const ThisXStringClass& p2) { ThisXStringClass s; s.strcat(p1); s.strcat(p2.s()); return s; }
|
||||
|
||||
// __String<T, ThisXStringClass>& operator =(const __String<T, ThisXStringClass>& S) { strcpy(S.s()); return *this; }
|
||||
// /* Assign */
|
||||
// template<typename O, class OtherXStringClass>
|
||||
// ThisXStringClass& operator =(const __String<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
//// template<class O>
|
||||
//// ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; }
|
||||
|
||||
//--------------------------------------------------------------------- indexOf, rindexOf, contains, subString
|
||||
|
||||
@ -496,7 +322,7 @@ public:
|
||||
template<typename O>
|
||||
size_t indexOf(const O* S, size_t Pos = 0) const { return XStringAbstract__indexOf(m_data, Pos, S, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t indexOf(const XStringAbstractNoDtor<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOf(S.s(), Pos); }
|
||||
size_t indexOf(const __String<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOf(S.s(), Pos); }
|
||||
/* IC */
|
||||
size_t indexOfIC(char32_t char32Searched, size_t Pos = 0) const
|
||||
{
|
||||
@ -506,7 +332,7 @@ public:
|
||||
template<typename O>
|
||||
size_t indexOfIC(const O* S, size_t Pos = 0) const { return XStringAbstract__indexOf(m_data, Pos, S, true); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t indexOfIC(const XStringAbstractNoDtor<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOfIC(S.s(), Pos); }
|
||||
size_t indexOfIC(const __String<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOfIC(S.s(), Pos); }
|
||||
|
||||
|
||||
/* rindexOf */
|
||||
@ -518,7 +344,7 @@ public:
|
||||
template<typename O>
|
||||
size_t rindexOf(const O* S, size_t Pos = MAX_XSIZE-1) const { return XStringAbstract__rindexOf(m_data, Pos, S, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t rindexOf(const XStringAbstractNoDtor<O, OtherXStringClass>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
size_t rindexOf(const __String<O, OtherXStringClass>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
/* IC */
|
||||
size_t rindexOfIC(const char32_t char32Searched, size_t Pos = MAX_XSIZE-1) const
|
||||
{
|
||||
@ -528,14 +354,14 @@ public:
|
||||
template<typename O>
|
||||
size_t rindexOfIC(const O* S, size_t Pos = MAX_XSIZE-1) const { return XStringAbstract__rindexOf(m_data, Pos, S, true); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t rindexOfIC(const XStringAbstractNoDtor<O, OtherXStringClass>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
size_t rindexOfIC(const __String<O, OtherXStringClass>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool contains(const XStringAbstractNoDtor<O, OtherXStringClass>& S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
bool contains(const __String<O, OtherXStringClass>& S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
bool contains(const O* S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t containsIC(const XStringAbstractNoDtor<O, OtherXStringClass>& S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
size_t containsIC(const __String<O, OtherXStringClass>& S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
size_t containsIC(const O* S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
|
||||
@ -558,11 +384,11 @@ public:
|
||||
}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool startWith(const XStringAbstractNoDtor<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWith(m_data, otherS.m_data, false); }
|
||||
bool startWith(const __String<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWith(m_data, otherS.m_data, false); }
|
||||
template<typename O>
|
||||
bool startWith(const O* other) const { return XStringAbstract__startWith(m_data, other, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool startWithIC(const XStringAbstractNoDtor<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWith(m_data, otherS.m_data, true); }
|
||||
bool startWithIC(const __String<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWith(m_data, otherS.m_data, true); }
|
||||
template<typename O>
|
||||
bool startWithIC(const O* other) const { return XStringAbstract__startWith(m_data, other, true); }
|
||||
|
||||
@ -636,7 +462,7 @@ public:
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// void insert(const XStringAbstractNoDtor<T, ThisXStringClass>& Str, size_t pos);
|
||||
// void insert(const __String<T, ThisXStringClass>& Str, size_t pos);
|
||||
//{
|
||||
// if ( pos < size() ) {
|
||||
// CheckSize(size()+Str.size());
|
||||
@ -693,10 +519,10 @@ public:
|
||||
// p += 1;
|
||||
// }
|
||||
// }
|
||||
// XStringAbstractNoDtor SubStringReplace(T c1, T c2);
|
||||
// __String SubStringReplace(T c1, T c2);
|
||||
//{
|
||||
// T* p;
|
||||
// XStringAbstractNoDtor Result;
|
||||
// __String Result;
|
||||
//
|
||||
// p = s();
|
||||
// while ( *p ) {
|
||||
@ -717,12 +543,12 @@ public:
|
||||
// int Compare(const wchar_t* S) const { return ::Compare<T, wchar_t>(m_data, S); };
|
||||
//
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool equal(const XStringAbstractNoDtor<O, OtherXStringClass>& S) const { return XStringAbstract__compare(m_data, S.s(), false) == 0; }
|
||||
bool equal(const __String<O, OtherXStringClass>& S) const { return XStringAbstract__compare(m_data, S.s(), false) == 0; }
|
||||
template<typename O>
|
||||
bool equal(const O* S) const { return XStringAbstract__compare(m_data, S, false) == 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool equalIC(const XStringAbstractNoDtor<O, OtherXStringClass>& S) const { return XStringAbstract__compare(m_data, S.s(), true) == 0; }
|
||||
bool equalIC(const __String<O, OtherXStringClass>& S) const { return XStringAbstract__compare(m_data, S.s(), true) == 0; }
|
||||
template<typename O>
|
||||
bool equalIC(const O* S) const { return XStringAbstract__compare(m_data, S, true) == 0; }
|
||||
|
||||
@ -731,42 +557,42 @@ public:
|
||||
public:
|
||||
// == operator
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator == (const XStringAbstractNoDtor<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) == 0; }
|
||||
bool operator == (const __String<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) == 0; }
|
||||
// template<typename O>
|
||||
// bool operator == (const O* s2) const { return (*this).strcmp(s2) == 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator == (const O* s1, ThisXStringClass& s2) { return s2.strcmp(s1) == 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator != (const XStringAbstractNoDtor<O, OtherXStringClass>& s2) const { return !(*this == s2); }
|
||||
bool operator != (const __String<O, OtherXStringClass>& s2) const { return !(*this == s2); }
|
||||
// template<typename O>
|
||||
// bool operator != (const O* s2) const { return !(*this == s2); }
|
||||
// template<typename O>
|
||||
// friend bool operator != (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) != 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator < (const XStringAbstractNoDtor<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) < 0; }
|
||||
bool operator < (const __String<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) < 0; }
|
||||
// template<typename O>
|
||||
// bool operator < (const O* s2) const { return (*this).strcmp(s2) < 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator < (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) > 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator > (const XStringAbstractNoDtor<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) > 0; }
|
||||
bool operator > (const __String<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) > 0; }
|
||||
// template<typename O>
|
||||
// bool operator > (const O* s2) const { return (*this).strcmp(s2) > 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator > (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) < 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator <= (const XStringAbstractNoDtor<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) <= 0; }
|
||||
bool operator <= (const __String<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) <= 0; }
|
||||
// template<typename O>
|
||||
// bool operator <= (const O* s2) const { return (*this).strcmp(s2) <= 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator <= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) >= 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator >= (const XStringAbstractNoDtor<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) >= 0; }
|
||||
bool operator >= (const __String<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) >= 0; }
|
||||
// template<typename O>
|
||||
// bool operator >= (const O* s2) const { return (*this).strcmp(s2) >= 0; }
|
||||
// template<typename O>
|
||||
@ -775,44 +601,368 @@ public:
|
||||
};
|
||||
|
||||
|
||||
template<class T, class ThisXStringClass>
|
||||
T XStringAbstractNoDtor<T, ThisXStringClass>::nullChar = 0;
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
template<class T, class ThisXStringClass>
|
||||
class XStringAbstract : public XStringAbstractNoDtor<T, ThisXStringClass>
|
||||
class LString : public __String<T, ThisXStringClass>
|
||||
{
|
||||
public:
|
||||
XStringAbstract() : XStringAbstractNoDtor<T, ThisXStringClass>() {}
|
||||
XStringAbstract(const XStringAbstract& S) : XStringAbstractNoDtor<T, ThisXStringClass>(S) {}
|
||||
public:
|
||||
protected:
|
||||
constexpr LString(const T* s) : __String<T, ThisXStringClass>(s) {};
|
||||
constexpr LString() = delete;
|
||||
constexpr LString(const LString& L) : __String<T, ThisXStringClass>(L.m_data) {};
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XStringAbstract(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstractNoDtor<T, ThisXStringClass>(S) {}
|
||||
//
|
||||
XStringAbstract& operator=(const XStringAbstract &S) { this->XStringAbstractNoDtor<T, ThisXStringClass>::operator=(S); return *this; }
|
||||
using XStringAbstractNoDtor<T, ThisXStringClass>::operator =;
|
||||
// no assignement, no destructor
|
||||
|
||||
~XStringAbstract()
|
||||
{
|
||||
//DBG_XSTRING("Destructor :%ls\n", data());
|
||||
if ( XStringAbstractNoDtor<T, ThisXStringClass>::m_allocatedSize > 0 ) free((void*)XStringAbstractNoDtor<T, ThisXStringClass>::m_data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
||||
#define m_data __String<T, ThisXStringClass>::m_data
|
||||
|
||||
template<class T, class ThisXStringClass>
|
||||
class XStringAbstract : public __String<T, ThisXStringClass>
|
||||
{
|
||||
static T nullChar;
|
||||
|
||||
protected:
|
||||
size_t m_allocatedSize;
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Init , Alloc
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
//
|
||||
// void Init(size_t aSize=0)
|
||||
// {
|
||||
// //DBG_XSTRING("Init aSize=%d\n", aSize);
|
||||
// // We don't allocate any memory at first. To not have to test all the time if m_data is null, we init it to an empty string
|
||||
// m_data = &nullChar;
|
||||
// m_allocatedSize = 0;
|
||||
// // if aSize == 0, nothing is done, because m_allocatedSize == aSize
|
||||
// CheckSize(aSize, 0);
|
||||
// }
|
||||
|
||||
/*
|
||||
* nNewSize doesn't include null terminator. Alloc(0) will allocate 1 char.
|
||||
* NOTE : m_allocatedSize WILL include the the null terminator. Alloc(0) makes m_allocatedSize == 1
|
||||
*/
|
||||
void Alloc(size_t nNewSize)
|
||||
{
|
||||
if ( m_allocatedSize == 0 ) m_data = (T*)malloc( (nNewSize+1)*sizeof(T) );
|
||||
else m_data = (T*)Xrealloc(m_data, (nNewSize+1)*sizeof(T), (m_allocatedSize+1)*sizeof(T));
|
||||
if ( !m_data ) {
|
||||
panic("XStringAbstract::Alloc(%zu) : Xrealloc(%" PRIuPTR ", %lu, %zd) returned NULL. System halted\n", nNewSize, uintptr_t(m_data), (nNewSize+1)*sizeof(T), (m_allocatedSize+1)*sizeof(T));
|
||||
}
|
||||
m_allocatedSize = nNewSize;
|
||||
}
|
||||
// public:
|
||||
T *CheckSize(size_t nNewSize, size_t nGrowBy = XStringGrowByDefault) // nNewSize is in number of chars, NOT bytes
|
||||
{
|
||||
//DBG_XSTRING("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
|
||||
|
||||
if ( m_allocatedSize < nNewSize )
|
||||
{
|
||||
nNewSize += nGrowBy;
|
||||
if ( m_allocatedSize == 0 ) { //if ( *m_data ) {
|
||||
size_t len = __String<T, ThisXStringClass>::length();
|
||||
if ( nNewSize < len ) nNewSize = len;
|
||||
T* m_dataSav = m_data;
|
||||
m_data = NULL;
|
||||
Alloc(nNewSize);
|
||||
utf_string_from_utf_string(m_data, m_allocatedSize, m_dataSav);
|
||||
}else{
|
||||
Alloc(nNewSize);
|
||||
}
|
||||
// m_data[m_allocatedSize] = 0; // we allocated one more char (nNewSize+1). This \0 is an extra precaution. It's not for the normal null terminator. All string operation must considered that only m_allocatedSize bytes were allocated.
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
// void setSize(size_t newSize) // nNewSize is in number of chars, NOT bytes
|
||||
// {
|
||||
// //DBG_XSTRING("setLength(%d)\n", len);
|
||||
// CheckSize(newSize);
|
||||
// // if ( len >= size() ) {
|
||||
// // DBG_XSTRING("__String<T>::setLength(size_t len) : len >= size() (%d != %d). System halted\n", len, size());
|
||||
// // panic();
|
||||
// // }
|
||||
// m_data[newSize] = 0; // we may rewrite a 0 in nullChar, if no memory were allocated. That's ok.
|
||||
// }
|
||||
|
||||
|
||||
public:
|
||||
/* default ctor */
|
||||
XStringAbstract() : __String<T, ThisXStringClass>(&nullChar), m_allocatedSize(0) {}
|
||||
|
||||
/* copy ctor */
|
||||
XStringAbstract(const XStringAbstract& S) : __String<T, ThisXStringClass>(&nullChar), m_allocatedSize(0)
|
||||
{
|
||||
if ( S.m_data && !S.m_allocatedSize ) {
|
||||
m_data = S.m_data;
|
||||
}else{
|
||||
takeValueFrom(S);
|
||||
}
|
||||
}
|
||||
|
||||
~XStringAbstract()
|
||||
{
|
||||
//DBG_XSTRING("Destructor :%ls\n", data());
|
||||
if ( m_allocatedSize > 0 ) free((void*)m_data);
|
||||
}
|
||||
|
||||
/* ctor */
|
||||
template<class OtherLStringClass>
|
||||
explicit XStringAbstract(const LString<T, OtherLStringClass>& S) : __String<T, ThisXStringClass>(S.s()), m_allocatedSize(0) {}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
explicit XStringAbstract<T, ThisXStringClass>(const XStringAbstract<O, OtherXStringClass>& S) : __String<T, ThisXStringClass>(&nullChar), m_allocatedSize(0) { takeValueFrom(S); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
explicit XStringAbstract<T, ThisXStringClass>(const LString<O, OtherXStringClass>& S) : __String<T, ThisXStringClass>(&nullChar), m_allocatedSize(0) { takeValueFrom(S); }
|
||||
// TEMPORARILY DISABLED
|
||||
// template<typename O>
|
||||
// explicit __String<T, ThisXStringClass>(const O* S) { Init(0); takeValueFrom(S); }
|
||||
//
|
||||
/* Copy Assign */ // Only other XString, no litteral at the moment.
|
||||
XStringAbstract& operator=(const XStringAbstract &S) { takeValueFrom(S); return *this; }
|
||||
/* Assign */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& operator =(const __String<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
// TEMPORARILY DISABLED
|
||||
// template<class O>
|
||||
// ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; }
|
||||
|
||||
protected:
|
||||
ThisXStringClass& takeValueFromLiteral (const T* s)
|
||||
{
|
||||
if ( m_allocatedSize > 0 ) panic("XStringAbstract::takeValueFromLiteral -> m_allocatedSize > 0");
|
||||
m_data = (T*)s;
|
||||
return *((ThisXStringClass*)this);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
size_t allocatedSize() const { return m_allocatedSize; }
|
||||
|
||||
void setEmpty()
|
||||
{
|
||||
if ( m_allocatedSize <= 0 ) m_data = &nullChar;
|
||||
else m_data[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* dataSized(IntegralType size)
|
||||
{
|
||||
if ( size<0 ) panic("T* dataSized() -> i < 0");
|
||||
if ( (unsigned_type(IntegralType))size > MAX_XSIZE ) panic("T* dataSized() -> i > MAX_XSIZE");
|
||||
CheckSize((size_t)size);
|
||||
return __String<T, ThisXStringClass>::_data(0);
|
||||
}
|
||||
//
|
||||
// // Pos is counted in logical char but size is counted in physical char (char, char16_t, char32_t or wchar_t)
|
||||
// template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
|
||||
// T* dataSized(IntegralType1 pos, IntegralType2 size)
|
||||
// {
|
||||
// if ( pos<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
// if ( size<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
// size_t offset = size_of_utf_string_len(m_data, (typename _xtools__make_unsigned<IntegralType1>::type)pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
// CheckSize(offset + (typename _xtools__make_unsigned<IntegralType2>::type)size);
|
||||
// return _data(pos);
|
||||
// }
|
||||
|
||||
|
||||
T* forgetDataWithoutFreeing()
|
||||
{
|
||||
T* ret = m_data;
|
||||
m_data = &nullChar;
|
||||
m_allocatedSize = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- strcat, strcpy, operator =
|
||||
|
||||
/* strcpy char */
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
void strcpy(O otherChar)
|
||||
{
|
||||
if ( otherChar != 0) {
|
||||
size_t newSize = utf_size_of_utf_string_len(m_data, &otherChar, 1);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, &otherChar, 1);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
/* strcpy */
|
||||
template<typename O>
|
||||
void strcpy(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t newSize = utf_size_of_utf_string(m_data, other);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data, m_allocatedSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
/* strncpy */
|
||||
template<typename O>
|
||||
void strncpy(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t newSize = utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
/* strcat char */
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
void strcat(O otherChar)
|
||||
{
|
||||
if ( otherChar ) {
|
||||
size_t currentSize = size_of_utf_string(m_data);
|
||||
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, &otherChar, 1);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, &otherChar, 1);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* strcat char* */
|
||||
template<typename O>
|
||||
void strcat(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t currentSize = size_of_utf_string(m_data); // size is number of T, not in bytes
|
||||
size_t newSize = currentSize + utf_size_of_utf_string(m_data, other); // size is number of T, not in bytes
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data+currentSize, m_allocatedSize-currentSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* strcat __String */
|
||||
template<typename OtherCharType, class OtherXStringClass>
|
||||
void strcat(const __String<OtherCharType, OtherXStringClass>& other)
|
||||
{
|
||||
size_t currentSize = size_of_utf_string(m_data); // size is number of T, not in bytes
|
||||
size_t newSize = currentSize + utf_size_of_utf_string(m_data, other.s()); // size is number of T, not in bytes
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data+currentSize, m_allocatedSize-currentSize, other.s());
|
||||
m_data[newSize] = 0;
|
||||
}
|
||||
/* strncat */
|
||||
template<typename O>
|
||||
void strncat(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t currentSize = size_of_utf_string(m_data);
|
||||
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* takeValueFrom */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S) { strcpy(S); return *((ThisXStringClass*)this); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S, size_t len) { strncpy(S.data(0), len); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S, size_t len) { strncpy(S, len); return *((ThisXStringClass*)this); }
|
||||
|
||||
|
||||
/* += */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& operator += (const __String<O, OtherXStringClass>& S) { strcat(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
ThisXStringClass& operator += (O S) { strcat(S); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& operator += (const O* S) { strcat(S); return *((ThisXStringClass*)this); }
|
||||
|
||||
|
||||
};
|
||||
|
||||
template<class T, class ThisXStringClass>
|
||||
T XStringAbstract<T, ThisXStringClass>::nullChar = 0;
|
||||
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
///* __String + char32_t */
|
||||
//template<typename CharType1, class XStringClass1>
|
||||
//XStringClass1 operator + (const __String<CharType1, XStringClass1>& p1, char32_t p2) { XStringClass1 s; s.takeValueFrom(p1); s.strcat(p2); return s; }
|
||||
//
|
||||
///* __String + __String */
|
||||
//template<typename CharType1, class XStringClass1, typename CharType2, class XStringClass2>
|
||||
//XStringClass1 operator + (const __String<CharType1, XStringClass1>& p1, const __String<CharType2, XStringClass2>& p2) { XStringClass1 s; s.takeValueFrom(p1); s.strcat(p2); return s; }
|
||||
//
|
||||
///* char* + __String */
|
||||
//template<typename CharType1, typename CharType2, class XStringClass2>
|
||||
//XStringClass2 operator + (const CharType1* p1, const __String<CharType2, XStringClass2>& p2) { XStringClass2 s; s.takeValueFrom(p1); s.strcat(p2); return s; }
|
||||
//
|
||||
///* __String + char* */
|
||||
//template<typename T1, class XStringClass1, typename CharType2>
|
||||
//XStringClass1 operator + (const __String<T1, XStringClass1>& p1, const CharType2* p2) { XStringClass1 s; s.takeValueFrom(p1); s.strcat(p2); return s; }
|
||||
|
||||
|
||||
template <typename Base> _xtools__true_type is_base_of_test_func( Base* );
|
||||
template <typename Base> _xtools__false_type is_base_of_test_func( void* );
|
||||
template <typename B, typename D>
|
||||
auto test_pre_is_base_of(int) -> decltype(is_base_of_test_func<B>(static_cast<D*>(nullptr)));
|
||||
|
||||
|
||||
template< class, class = _xtools__void_t<>, class = _xtools__void_t<> >
|
||||
struct __string_type { typedef void type; };
|
||||
template< typename T >
|
||||
struct __string_type<T, _xtools__void_t<typename T::xs_t>, _xtools__void_t<typename T::char_t>> { typedef __String<typename T::char_t, typename T::xs_t> type; };
|
||||
|
||||
#define is___String_t(x) decltype(test_pre_is_base_of< typename __string_type<x>::type , x>(0))
|
||||
#define is___String(x) is___String_t(x)::value
|
||||
|
||||
|
||||
template< class, class = _xtools__void_t<>, class = _xtools__void_t<> >
|
||||
struct __lstring_type { typedef void type; };
|
||||
template< typename T >
|
||||
struct __lstring_type<T, _xtools__void_t<typename T::xs_t>, _xtools__void_t<typename T::char_t>> { typedef LString<typename T::char_t, typename T::xs_t> type; };
|
||||
|
||||
#define is___LString_t(x) decltype(test_pre_is_base_of< typename __lstring_type<x>::type , x>(0))
|
||||
#define is___LString(x) is___LString_t(x)::value
|
||||
|
||||
/* __string_class_or<T1, T2>::type is T1 is T1 is a subclass of __String. If T1 is not a subclass of __String, returns T2 if it's a subclass of __String */
|
||||
template <typename T1, typename T2, typename Tdummy=void> struct __string_class_or;
|
||||
template <typename T1, typename T2>
|
||||
struct __string_class_or<T1, T2, enable_if_t(!is___String(T1) && !is___String(T2))> { /*typedef double type;*/ };
|
||||
template <typename T1, typename T2>
|
||||
struct __string_class_or<T1, T2, enable_if_t(is___String(T1))> { typedef typename T1::xs_t type; };
|
||||
template <typename T1, typename T2>
|
||||
struct __string_class_or<T1, T2, enable_if_t(!is___String(T1) && is___String(T2))> { typedef typename T2::xs_t type; };
|
||||
|
||||
//------------------------------------------------------- + operator
|
||||
|
||||
template<typename T1, typename T2, enable_if( is___String(T1) || is___String(T2) )>
|
||||
typename __string_class_or<T1, T2>::type operator + (T1 p1, T2 p2) { typename __string_class_or<T1, T2>::type s; s.takeValueFrom(p1); s.strcat(p2); return s; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
|
||||
#undef DBG_XSTRING
|
||||
#undef asciiToLower
|
||||
|
||||
#undef m_data
|
||||
|
||||
|
||||
#endif // __XSTRINGABSTRACT_H__
|
||||
|
@ -33,7 +33,7 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
bool isEmpty() const { return this->size() == 0 ; }
|
||||
bool notEmpty() const { return this->size() > 0 ; }
|
||||
|
||||
// #define enable_if XStringAbstract__enable_if_t
|
||||
// #define enable_if _xtools_enable_if_t
|
||||
/* [] */
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
const XStringClass& operator [](IntegralType i) const { return array[i]; }
|
||||
@ -46,8 +46,8 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
|
||||
// const XStringClass& dbg(size_t i) const { return array[i]; }
|
||||
|
||||
|
||||
XStringClass ConcatAll(const XStringClass& Separator = ", "_XS, const XStringClass& Prefix = NullXString, const XStringClass& Suffix = NullXString) const
|
||||
template<class XStringClass1, class XStringClass2, class XStringClass3, enable_if(is___String(XStringClass1) && is___String(XStringClass2) && is___String(XStringClass3))>
|
||||
XStringClass ConcatAll(const XStringClass1& Separator, const XStringClass2& Prefix, const XStringClass3& Suffix) const
|
||||
{
|
||||
xsize i;
|
||||
XStringClass s;
|
||||
@ -64,6 +64,17 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
return s;
|
||||
}
|
||||
|
||||
XStringClass ConcatAll() const
|
||||
{
|
||||
return ConcatAll(", "_XS8, NullXString, NullXString);
|
||||
}
|
||||
|
||||
template<class XStringClass1, enable_if(is___String(XStringClass1))>
|
||||
XStringClass ConcatAll(const XStringClass1& Separator) const
|
||||
{
|
||||
return ConcatAll(Separator, NullXString, NullXString);
|
||||
}
|
||||
|
||||
|
||||
template<class OtherXStringArrayClass>
|
||||
bool Equal(const OtherXStringArrayClass &aStrings) const
|
||||
@ -229,7 +240,7 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
|
||||
};
|
||||
|
||||
class XStringArray : public XStringArray_<XString>
|
||||
class XStringArray : public XStringArray_<XString8>
|
||||
{
|
||||
};
|
||||
extern const XStringArray NullXStringArray;
|
||||
@ -254,7 +265,7 @@ extern const XStringWArray NullXStringWArray;
|
||||
//template<class XStringArrayClass, class XStringClass1, enable_if(!is_char(XStringClass1) && !is_char_ptr(XStringClass1))>
|
||||
//XStringArrayClass Split(const XStringClass1& S)
|
||||
//{
|
||||
// return Split<XStringArrayClass>(S, ", "_XS);
|
||||
// return Split<XStringArrayClass>(S, ", "_XS8);
|
||||
//};
|
||||
|
||||
|
||||
@ -310,7 +321,7 @@ XStringArrayClass Split(const CharType1* S, const CharType2* Separator)
|
||||
// return Split<XStringArrayClass>(SS, XSeparator);
|
||||
};
|
||||
|
||||
template<class XStringArrayClass, class XStringClass1, class XStringClass2, enable_if(!is_char(XStringClass1) && !is_char_ptr(XStringClass1) && !is_char(XStringClass2))>
|
||||
template<class XStringArrayClass, class XStringClass1, class XStringClass2, enable_if(is___String(XStringClass1) && is___String(XStringClass2))>
|
||||
XStringArrayClass Split(const XStringClass1& S, const XStringClass2& Separator)
|
||||
{
|
||||
return Split<XStringArrayClass>(S.s(), Separator.s());
|
||||
@ -337,7 +348,7 @@ XStringArrayClass Split(const XStringClass1& S, const XStringClass2& Separator)
|
||||
template<class XStringArrayClass, class XStringClass1, enable_if(!is_char(XStringClass1) && !is_char_ptr(XStringClass1))>
|
||||
XStringArrayClass Split(const XStringClass1& S)
|
||||
{
|
||||
return Split<XStringArrayClass>(S, ", "_XS);
|
||||
return Split<XStringArrayClass>(S, ", "_XS8);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -10,80 +10,70 @@
|
||||
#define XToolsCommon_h
|
||||
|
||||
|
||||
struct XStringAbstract__false_type {
|
||||
struct _xtools__false_type {
|
||||
static constexpr bool value = false;
|
||||
bool v() const { return false; }
|
||||
};
|
||||
|
||||
struct XStringAbstract__true_type {
|
||||
struct _xtools__true_type {
|
||||
static constexpr bool value = true;
|
||||
bool v() const { return true; }
|
||||
};
|
||||
|
||||
/* make unsigned */
|
||||
template <class _Tp>
|
||||
struct XStringAbstract__make_unsigned {};
|
||||
struct _xtools__make_unsigned {};
|
||||
|
||||
template <> struct XStringAbstract__make_unsigned< char> {typedef unsigned char type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed char> {typedef unsigned char type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned char> {typedef unsigned char type;};
|
||||
template <> struct XStringAbstract__make_unsigned< char16_t> {typedef char16_t type;};
|
||||
template <> struct XStringAbstract__make_unsigned< char32_t> {typedef char32_t type;};
|
||||
template <> struct XStringAbstract__make_unsigned< wchar_t> {typedef wchar_t type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed short> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned short> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed int> {typedef unsigned int type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned int> {typedef unsigned int type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed long> {typedef unsigned long type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned long> {typedef unsigned long type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed long long> {typedef unsigned long long type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned long long> {typedef unsigned long long type;};
|
||||
#define unsigned_type(x) typename XStringAbstract__make_unsigned<x>::type
|
||||
|
||||
/* enable_if */
|
||||
template <bool, typename T = void>
|
||||
struct XStringAbstract__enable_if_t
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct XStringAbstract__enable_if_t<true, T> {
|
||||
typedef T type;
|
||||
};
|
||||
//#define enable_if(x) XStringAbstract__enable_if_t(x, void)::type
|
||||
#define enable_if(x) typename enable_if_type = typename XStringAbstract__enable_if_t<x>::type
|
||||
|
||||
//
|
||||
//template< bool B, class T = void >
|
||||
//using XStringAbstract__enable_if_t = typename XStringAbstract__enable_if<B,T>::type;
|
||||
template <> struct _xtools__make_unsigned< char> {typedef unsigned char type;};
|
||||
template <> struct _xtools__make_unsigned< signed char> {typedef unsigned char type;};
|
||||
template <> struct _xtools__make_unsigned< unsigned char> {typedef unsigned char type;};
|
||||
template <> struct _xtools__make_unsigned< char16_t> {typedef char16_t type;};
|
||||
template <> struct _xtools__make_unsigned< char32_t> {typedef char32_t type;};
|
||||
#if WCHAR_MAX <= 0xFFFF
|
||||
template <> struct _xtools__make_unsigned< wchar_t> {typedef char16_t type;};
|
||||
#else
|
||||
template <> struct _xtools__make_unsigned< wchar_t> {typedef char32_t type;};
|
||||
#endif
|
||||
template <> struct _xtools__make_unsigned< short> {typedef unsigned short type;};
|
||||
template <> struct _xtools__make_unsigned< unsigned short> {typedef unsigned short type;};
|
||||
template <> struct _xtools__make_unsigned< int> {typedef unsigned int type;};
|
||||
template <> struct _xtools__make_unsigned< unsigned int> {typedef unsigned int type;};
|
||||
template <> struct _xtools__make_unsigned< long> {typedef unsigned long type;};
|
||||
template <> struct _xtools__make_unsigned< unsigned long> {typedef unsigned long type;};
|
||||
template <> struct _xtools__make_unsigned< long long> {typedef unsigned long long type;};
|
||||
template <> struct _xtools__make_unsigned<unsigned long long> {typedef unsigned long long type;};
|
||||
|
||||
|
||||
// is_integral
|
||||
template <class _Tp> struct XStringAbstract__is_integral_st : public XStringAbstract__false_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<bool> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<signed char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<wchar_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<short> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned short> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<int> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned int> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<long long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned long long> : public XStringAbstract__true_type {};
|
||||
#define is_integral(x) XStringAbstract__is_integral_st<x>::value
|
||||
template <class _Tp> struct _xtools__is_integral_st : public _xtools__false_type {};
|
||||
//template <> struct _xtools__is_integral_st<bool> : public _xtools__true_type {};
|
||||
//template <> struct _xtools__is_integral_st<char> : public _xtools__true_type {};
|
||||
//template <> struct _xtools__is_integral_st<signed char> : public _xtools__true_type {};
|
||||
//template <> struct _xtools__is_integral_st<unsigned char> : public _xtools__true_type {};
|
||||
//template <> struct _xtools__is_integral_st<wchar_t> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<short> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<unsigned short> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<int> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<unsigned int> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<long> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<unsigned long> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<long long> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_integral_st<unsigned long long> : public _xtools__true_type {};
|
||||
|
||||
|
||||
// is_char
|
||||
template <class _Tp> struct XStringAbstract__is_char_st : public XStringAbstract__false_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<signed char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<unsigned char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char16_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char32_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<wchar_t> : public XStringAbstract__true_type {};
|
||||
#define is_char(x) XStringAbstract__is_char_st<x>::value
|
||||
// Looks like I don't need to remove reference.
|
||||
// This : template<typename O, enable_if(is_char(O))>
|
||||
// void strcpy(O otherChar)
|
||||
// is still enabled if parameter is a char&
|
||||
|
||||
template <class _Tp> struct _xtools__is_char_st : public _xtools__false_type {};
|
||||
template <> struct _xtools__is_char_st<char> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_st<signed char> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_st<unsigned char> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_st<char16_t> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_st<char32_t> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_st<wchar_t> : public _xtools__true_type {};
|
||||
|
||||
//
|
||||
//// STRUCT TEMPLATE remove_reference
|
||||
@ -100,38 +90,93 @@ template <> struct XStringAbstract__is_char_st<wchar_t>
|
||||
// };
|
||||
|
||||
// STRUCT TEMPLATE remove_const
|
||||
template<class _Ty>
|
||||
struct remove_const
|
||||
{ // remove const
|
||||
using type = _Ty;
|
||||
};
|
||||
//template<class _Ty>
|
||||
// struct remove_const
|
||||
// { // remove const
|
||||
// typedef _Ty type;
|
||||
// };
|
||||
//
|
||||
//template<class _Ty>
|
||||
// struct remove_const<const _Ty>
|
||||
// { // remove const
|
||||
// typedef _Ty type;
|
||||
// };
|
||||
|
||||
template<class _Ty>
|
||||
struct remove_const<const _Ty>
|
||||
{ // remove const
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template< class T > struct _xtools__remove_ref { typedef T type; };
|
||||
template< class T > struct _xtools__remove_ref<T&> { typedef T type; };
|
||||
|
||||
template< class T > struct _xtools__remove_const { typedef T type; };
|
||||
template< class T > struct _xtools__remove_const<const T> { typedef T type; };
|
||||
template< class T > struct _xtools__remove_const<const T&> { typedef T& type; };
|
||||
template< class T > struct _xtools__remove_const<const T*> { typedef T* type; };
|
||||
|
||||
template< class T > struct _xtools__remove_const_ptr { typedef T type; };
|
||||
template< class T > struct _xtools__remove_const_ptr<const T> { typedef T type; };
|
||||
template< class T > struct _xtools__remove_const_ptr<T*> { typedef T type; };
|
||||
template< class T > struct _xtools__remove_const_ptr<const T*> { typedef T type; };
|
||||
template< class T, int n > struct _xtools__remove_const_ptr<T[n]> { typedef T type; };
|
||||
template< class T, int n > struct _xtools__remove_const_ptr<const T[n]> { typedef T type; };
|
||||
|
||||
|
||||
// is_char_ptr
|
||||
template <class _Tp> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__false_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<char*> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<char[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_ptr_st<char[_Np]> : public XStringAbstract__true_type {};
|
||||
//template <> struct XStringAbstract__is_char_ptr_st<signed char> : public XStringAbstract__true_type {};
|
||||
//template <> struct XStringAbstract__is_char_ptr_st<unsigned char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<char16_t*> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<char16_t[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_ptr_st<char16_t[_Np]> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<char32_t*> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<char32_t[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_ptr_st<char32_t[_Np]> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<wchar_t*> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_ptr_st<wchar_t[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_ptr_st<wchar_t[_Np]> : public XStringAbstract__true_type {};
|
||||
#define is_char_ptr(x) XStringAbstract__is_char_ptr_st<typename remove_const<x>::type>::value
|
||||
template <class _Tp> struct _xtools__is_char_ptr_st : public _xtools__false_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<char*> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<char[]> : public _xtools__true_type {};
|
||||
template <size_t _Np> struct _xtools__is_char_ptr_st<char[_Np]> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<signed char*> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<signed char[]> : public _xtools__true_type {};
|
||||
template <size_t _Np> struct _xtools__is_char_ptr_st<signed char[_Np]> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<unsigned char*> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<unsigned char[]> : public _xtools__true_type {};
|
||||
template <size_t _Np> struct _xtools__is_char_ptr_st<unsigned char[_Np]> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<char16_t*> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<char16_t[]> : public _xtools__true_type {};
|
||||
template <size_t _Np> struct _xtools__is_char_ptr_st<char16_t[_Np]> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<char32_t*> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<char32_t[]> : public _xtools__true_type {};
|
||||
template <size_t _Np> struct _xtools__is_char_ptr_st<char32_t[_Np]> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<wchar_t*> : public _xtools__true_type {};
|
||||
template <> struct _xtools__is_char_ptr_st<wchar_t[]> : public _xtools__true_type {};
|
||||
template <size_t _Np> struct _xtools__is_char_ptr_st<wchar_t[_Np]> : public _xtools__true_type {};
|
||||
|
||||
|
||||
/* enable_if */
|
||||
template <bool, typename T = void>
|
||||
struct _xtools_enable_if_t
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct _xtools_enable_if_t<true, T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template< class... >
|
||||
using _xtools__void_t = void;
|
||||
|
||||
/* has type member */
|
||||
// primary template handles types that have no nested ::type member:
|
||||
template< class, class = _xtools__void_t<> >
|
||||
struct _xtools__has_type_member : _xtools__false_type { };
|
||||
|
||||
// specialization recognizes types that do have a nested ::type member:
|
||||
template< class T >
|
||||
struct _xtools__has_type_member<T, _xtools__void_t<typename T::char_t>> : _xtools__true_type { };
|
||||
|
||||
|
||||
|
||||
|
||||
#define remove_const(x) typename _xtools__remove_const<x>::type
|
||||
#define unsigned_type(x) typename _xtools__make_unsigned<remove_const(x)>::type
|
||||
#define remove_ref(x) typename _xtools__remove_ref<x>::type
|
||||
#define remove_const_ptr(x) typename _xtools__remove_const_ptr<x>::type
|
||||
|
||||
#define is_integral(x) _xtools__is_integral_st<remove_const(x)>::value
|
||||
#define is_char(x) _xtools__is_char_st<remove_const(x)>::value
|
||||
#define is_char_ptr(x) _xtools__is_char_ptr_st<typename _xtools__remove_const<x>::type>::value
|
||||
#define enable_if_t(x) typename _xtools_enable_if_t<x>::type
|
||||
#define enable_if(x) typename enable_if_type = typename _xtools_enable_if_t<x>::type
|
||||
|
||||
#endif /* XToolsCommon_h */
|
||||
|
@ -100,7 +100,7 @@ CHAR16 *Old1_RemoveLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *Loa
|
||||
// if ( LoadOptions.contains(LoadOption) ) return LoadOptions; //good
|
||||
// // Otherwise add option
|
||||
//// return SPrintf("%s %s", LoadOptions.c_str(), LoadOption.c_str()); //LoadOptions + LoadOption
|
||||
// return LoadOptions + " "_XS + LoadOption; //why not?
|
||||
// return LoadOptions + " "_XS8 + LoadOption; //why not?
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@ -112,7 +112,7 @@ CHAR16 *Old1_RemoveLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *Loa
|
||||
//
|
||||
// //DBG("LoadOptions: '%ls', remove LoadOption: '%ls'\n", LoadOptions, LoadOption);
|
||||
// // If there are no options then nothing to do
|
||||
// if (LoadOptions.isEmpty()) return ""_XS;
|
||||
// if (LoadOptions.isEmpty()) return ""_XS8;
|
||||
// // If there is no option to remove then duplicate original
|
||||
// if (LoadOption.isEmpty()) return LoadOptions;
|
||||
// // If not present duplicate original
|
||||
@ -142,7 +142,7 @@ CHAR16 *Old1_RemoveLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *Loa
|
||||
// }
|
||||
//
|
||||
// // If it's the whole string return NULL
|
||||
// if (OptionLength == Length) return ""_XS;
|
||||
// if (OptionLength == Length) return ""_XS8;
|
||||
//
|
||||
// XString NewLoadOptions;
|
||||
// if (Offset == 0) {
|
||||
@ -183,49 +183,49 @@ int BootOptions_tests()
|
||||
LoadOptions = Old1_AddLoadOption(LoadOptions, L"opt2");
|
||||
LoadOptions = Old1_AddLoadOption(LoadOptions, L"opt3");
|
||||
|
||||
if ( XString().takeValueFrom(LoadOptions) != "opt1 opt2 opt3"_XS ) return 1;
|
||||
if ( XString8().takeValueFrom(LoadOptions) != "opt1 opt2 opt3"_XS8 ) return 1;
|
||||
|
||||
CHAR16* LoadOptions1 = Old1_RemoveLoadOption(LoadOptions, L"opt1");
|
||||
if ( XString().takeValueFrom(LoadOptions1) != "opt2 opt3"_XS ) return 2;
|
||||
if ( XString8().takeValueFrom(LoadOptions1) != "opt2 opt3"_XS8 ) return 2;
|
||||
CHAR16* LoadOptions2 = Old1_RemoveLoadOption(LoadOptions, L"opt2");
|
||||
if ( XString().takeValueFrom(LoadOptions2) != "opt1 opt3"_XS ) return 3;
|
||||
if ( XString8().takeValueFrom(LoadOptions2) != "opt1 opt3"_XS8 ) return 3;
|
||||
CHAR16* LoadOptions3 = Old1_RemoveLoadOption(LoadOptions, L"opt3");
|
||||
if ( XString().takeValueFrom(LoadOptions3) != "opt1 opt2"_XS ) return 4;
|
||||
if ( XString8().takeValueFrom(LoadOptions3) != "opt1 opt2"_XS8 ) return 4;
|
||||
}
|
||||
// {
|
||||
// XString LoadOptions;
|
||||
//
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt1"_XS);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt2"_XS);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt3"_XS);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt1"_XS8);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt2"_XS8);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt3"_XS8);
|
||||
//
|
||||
// if ( LoadOptions != "opt1 opt2 opt3"_XS ) return 10;
|
||||
// if ( LoadOptions != "opt1 opt2 opt3"_XS8 ) return 10;
|
||||
//
|
||||
// XString LoadOptions1 = RemoveLoadOption(LoadOptions, "opt1"_XS);
|
||||
// if ( LoadOptions1 != "opt2 opt3"_XS ) return 11;
|
||||
// XString LoadOptions2 = RemoveLoadOption(LoadOptions, "opt2"_XS);
|
||||
// if ( LoadOptions2 != "opt1 opt3"_XS ) return 12;
|
||||
// XString LoadOptions3 = RemoveLoadOption(LoadOptions, "opt3"_XS);
|
||||
// if ( LoadOptions3 != "opt1 opt2"_XS ) return 13;
|
||||
// XString LoadOptions1 = RemoveLoadOption(LoadOptions, "opt1"_XS8);
|
||||
// if ( LoadOptions1 != "opt2 opt3"_XS8 ) return 11;
|
||||
// XString LoadOptions2 = RemoveLoadOption(LoadOptions, "opt2"_XS8);
|
||||
// if ( LoadOptions2 != "opt1 opt3"_XS8 ) return 12;
|
||||
// XString LoadOptions3 = RemoveLoadOption(LoadOptions, "opt3"_XS8);
|
||||
// if ( LoadOptions3 != "opt1 opt2"_XS8 ) return 13;
|
||||
// }
|
||||
{
|
||||
XStringArray LoadOptions;
|
||||
|
||||
LoadOptions.AddID("opt1"_XS);
|
||||
LoadOptions.AddID("opt2"_XS);
|
||||
LoadOptions.AddID("opt3"_XS);
|
||||
LoadOptions.AddID("opt1"_XS8);
|
||||
LoadOptions.AddID("opt2"_XS8);
|
||||
LoadOptions.AddID("opt3"_XS8);
|
||||
|
||||
if ( LoadOptions.ConcatAll(" "_XS) != "opt1 opt2 opt3"_XS ) return 30;
|
||||
if ( LoadOptions.ConcatAll(" "_XS8) != "opt1 opt2 opt3"_XS8 ) return 30;
|
||||
|
||||
XStringArray LoadOptions1 = LoadOptions;
|
||||
LoadOptions1.remove("opt1"_XS);
|
||||
if ( LoadOptions1.ConcatAll(" "_XS) != "opt2 opt3"_XS ) return 31;
|
||||
LoadOptions1.remove("opt1"_XS8);
|
||||
if ( LoadOptions1.ConcatAll(" "_XS8) != "opt2 opt3"_XS8 ) return 31;
|
||||
XStringArray LoadOptions2 = LoadOptions;
|
||||
LoadOptions2.remove("opt2"_XS);
|
||||
if ( LoadOptions2.ConcatAll(" "_XS) != "opt1 opt3"_XS ) return 32;
|
||||
LoadOptions2.remove("opt2"_XS8);
|
||||
if ( LoadOptions2.ConcatAll(" "_XS8) != "opt1 opt3"_XS8 ) return 32;
|
||||
XStringArray LoadOptions3 = LoadOptions;
|
||||
LoadOptions3.remove("opt3"_XS);
|
||||
if ( LoadOptions3.ConcatAll(" "_XS) != "opt1 opt2"_XS ) return 33;
|
||||
LoadOptions3.remove("opt3"_XS8);
|
||||
if ( LoadOptions3.ConcatAll(" "_XS8) != "opt1 opt2"_XS8 ) return 33;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -14,9 +14,9 @@ int XStringArray_tests()
|
||||
|
||||
array1.Add(L"1"_XSW);
|
||||
if ( array1.isEmpty() ) return 2;
|
||||
if ( array1[0] != "1"_XS ) return 21;
|
||||
if ( array1[0] != "1"_XS8 ) return 21;
|
||||
array1.Add(L"2"_XSW);
|
||||
if ( array1[1] != "2"_XS ) return 21;
|
||||
if ( array1[1] != "2"_XS8 ) return 21;
|
||||
|
||||
if ( !array1.contains(L"2"_XSW) ) return 5;
|
||||
|
||||
@ -33,21 +33,21 @@ int XStringArray_tests()
|
||||
// Split
|
||||
{
|
||||
XStringArray array = Split<XStringArray>(" word1 word2 word3 ", " ");
|
||||
if ( array[0] != "word1"_XS ) return 31;
|
||||
if ( array[1] != "word2"_XS ) return 32;
|
||||
if ( array[2] != "word3"_XS ) return 33;
|
||||
if ( array[0] != "word1"_XS8 ) return 31;
|
||||
if ( array[1] != "word2"_XS8 ) return 32;
|
||||
if ( array[2] != "word3"_XS8 ) return 33;
|
||||
}
|
||||
{
|
||||
XStringArray array = Split<XStringArray>("word1, word2, word3", ", ");
|
||||
if ( array[0] != "word1"_XS ) return 31;
|
||||
if ( array[1] != "word2"_XS ) return 32;
|
||||
if ( array[2] != "word3"_XS ) return 33;
|
||||
if ( array[0] != "word1"_XS8 ) return 31;
|
||||
if ( array[1] != "word2"_XS8 ) return 32;
|
||||
if ( array[2] != "word3"_XS8 ) return 33;
|
||||
}
|
||||
{
|
||||
XStringArray array = Split<XStringArray>(" word1 word2 word3 "_XS, " "_XS);
|
||||
if ( array[0] != "word1"_XS ) return 31;
|
||||
if ( array[1] != "word2"_XS ) return 32;
|
||||
if ( array[2] != "word3"_XS ) return 33;
|
||||
XStringArray array = Split<XStringArray>(" word1 word2 word3 "_XS8, " "_XS8);
|
||||
if ( array[0] != "word1"_XS8 ) return 31;
|
||||
if ( array[1] != "word2"_XS8 ) return 32;
|
||||
if ( array[2] != "word3"_XS8 ) return 33;
|
||||
}
|
||||
|
||||
// Test concat and Split
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
|
||||
|
||||
int nbTest = 0;
|
||||
int nbTestFailed = 0;
|
||||
bool displayOnlyFailed = true;
|
||||
static int nbTest = 0;
|
||||
static int nbTestFailed = 0;
|
||||
static bool displayOnlyFailed = true;
|
||||
|
||||
|
||||
#define STRINGIFY_(s) #s
|
||||
@ -267,10 +267,10 @@ struct XStringClassInfo
|
||||
};
|
||||
|
||||
template<>
|
||||
struct XStringClassInfo<XString>
|
||||
struct XStringClassInfo<XString8>
|
||||
{
|
||||
typedef char ch_t;
|
||||
typedef XString xs_t;
|
||||
typedef XString8 xs_t;
|
||||
static constexpr const char* prefix = "";
|
||||
static constexpr const char* xStringClassName = "XString";
|
||||
};
|
||||
@ -306,7 +306,7 @@ template<>
|
||||
struct XStringClassInfo<char>
|
||||
{
|
||||
typedef char ch_t;
|
||||
typedef XString xs_t;
|
||||
typedef XString8 xs_t;
|
||||
static constexpr const char* prefix = "";
|
||||
static constexpr const char* xStringClassName = "XString";
|
||||
};
|
||||
@ -342,7 +342,7 @@ template<>
|
||||
struct XStringClassInfo<TestString<char>>
|
||||
{
|
||||
typedef char ch_t;
|
||||
typedef XString xs_t;
|
||||
typedef XString8 xs_t;
|
||||
static constexpr const char* prefix = "";
|
||||
static constexpr const char* xStringClassName = "XString";
|
||||
};
|
||||
@ -470,7 +470,7 @@ bool displayOnlyIfFailed_tmp;
|
||||
__TEST_ALL_UTF2(test, XStringClass, classEncoding, wchar); \
|
||||
|
||||
#define TEST_ALL_CLASSES(test, macro) \
|
||||
macro(test, XString, utf8); \
|
||||
macro(test, XString8, utf8); \
|
||||
macro(test, XString16, utf16); \
|
||||
macro(test, XString32, utf32); \
|
||||
macro(test, XStringW, wchar); \
|
||||
@ -859,7 +859,7 @@ SimpleString teststrncat_(const InitialValue& initialValue, const ValueToCat& va
|
||||
xstr.takeValueFrom(initialValue.cha);
|
||||
xstr.strncat(valueToCat.cha, i);
|
||||
|
||||
size_t expectedLength = length_of_utf_string(initialValue.cha) + min(i, valueToCat.utf32_length);
|
||||
size_t expectedLength = length_of_utf_string(initialValue.cha) + Xmin(i, valueToCat.utf32_length);
|
||||
CHECK_RESULT(xstr.length() == expectedLength,
|
||||
ssprintf("xstr.length() == expectedLength (%zu)", expectedLength),
|
||||
ssprintf("xstr.length() != expectedLength (%zu!=%zu)", xstr.length(), expectedLength)
|
||||
@ -1411,34 +1411,34 @@ SimpleString teststartWith_(const InitialValue& initialValue)
|
||||
// typedef typename XStringClassInfo<XStringClass>::ch_t ch_t;
|
||||
// ch_t c; // dummy for call utf function
|
||||
|
||||
XStringClass initialString;
|
||||
initialString.takeValueFrom(initialValue.cha);
|
||||
XStringClass initia__String;
|
||||
initia__String.takeValueFrom(initialValue.cha);
|
||||
|
||||
char32_t expectedChar = 0;
|
||||
if ( initialValue.utf32_length > 0) expectedChar = initialValue.utf32[initialValue.utf32_length-1];
|
||||
|
||||
for ( size_t count = 0 ; count < initialValue.utf32_length+3 ; count+=1 )
|
||||
{
|
||||
XStringClass subStr = initialString.subString(0, count);
|
||||
XStringClass subStr = initia__String.subString(0, count);
|
||||
|
||||
bool expectedResult = true;
|
||||
if ( subStr.length() > 0 && count >= initialValue.utf32_length ) expectedResult = false;
|
||||
|
||||
CHECK_RESULT(initialString.startWith(subStr) == expectedResult,
|
||||
ssprintf("\"%s\".startWith(\"%s\") == %d", SimpleString(initialString.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult),
|
||||
ssprintf("\"%s\".startWith(\"%s\") != %d", SimpleString(initialString.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult)
|
||||
CHECK_RESULT(initia__String.startWith(subStr) == expectedResult,
|
||||
ssprintf("\"%s\".startWith(\"%s\") == %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult),
|
||||
ssprintf("\"%s\".startWith(\"%s\") != %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult)
|
||||
);
|
||||
//initialString.startWith(subStr);
|
||||
//initia__String.startWith(subStr);
|
||||
|
||||
subStr = initialString.subString(0, count-1) + ((char32_t)(initialValue.utf32[count-1]+1));
|
||||
subStr = initia__String.subString(0, count-1) + ((char32_t)(initialValue.utf32[count-1]+1));
|
||||
expectedResult = false;
|
||||
CHECK_RESULT(initialString.startWith(subStr) == expectedResult,
|
||||
ssprintf("\"%s\".startWith(\"%s\") == %d", SimpleString(initialString.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult),
|
||||
ssprintf("\"%s\".startWith(\"%s\") != %d", SimpleString(initialString.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult)
|
||||
CHECK_RESULT(initia__String.startWith(subStr) == expectedResult,
|
||||
ssprintf("\"%s\".startWith(\"%s\") == %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult),
|
||||
ssprintf("\"%s\".startWith(\"%s\") != %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult)
|
||||
);
|
||||
//subStr = initialString.subString(0, count-1);
|
||||
//subStr = initia__String.subString(0, count-1);
|
||||
//subStr = subStr + ((char32_t)(initialValue.utf32[count-1]+1));
|
||||
//initialString.startWith(subStr);
|
||||
//initia__String.startWith(subStr);
|
||||
|
||||
}
|
||||
//str.takeValueFrom(initialValue.cha);
|
||||
@ -1463,16 +1463,16 @@ SimpleString testbasename_(const InitialValue& initialValue, const TestString<Ex
|
||||
// typedef typename XStringClassInfo<XStringClass>::ch_t ch_t;
|
||||
// ch_t c; // dummy for call utf function
|
||||
|
||||
XStringClass initialString;
|
||||
initialString.takeValueFrom(initialValue.cha);
|
||||
XStringClass initia__String;
|
||||
initia__String.takeValueFrom(initialValue.cha);
|
||||
|
||||
XStringClass xstr = initialString.basename();
|
||||
XStringClass xstr = initia__String.basename();
|
||||
|
||||
CHECK_RESULT(xstr.strcmp(expectedResult.cha) == 0,
|
||||
ssprintf("\"%s\".basename() == \"%s\"", SimpleString(initialString.s()).c_str(), SimpleString(expectedResult.cha).c_str()),
|
||||
ssprintf("\"%s\".basename() != (\"%s\"!=\"%s\")", SimpleString(initialString.s()).c_str(), SimpleString(xstr.s()).c_str(), SimpleString(expectedResult.cha).c_str())
|
||||
ssprintf("\"%s\".basename() == \"%s\"", SimpleString(initia__String.s()).c_str(), SimpleString(expectedResult.cha).c_str()),
|
||||
ssprintf("\"%s\".basename() != (\"%s\"!=\"%s\")", SimpleString(initia__String.s()).c_str(), SimpleString(xstr.s()).c_str(), SimpleString(expectedResult.cha).c_str())
|
||||
);
|
||||
XStringClass xstr2 = initialString.basename();
|
||||
XStringClass xstr2 = initia__String.basename();
|
||||
|
||||
return SimpleString();
|
||||
}
|
||||
@ -1486,7 +1486,6 @@ XStringClass xstr2 = initialString.basename();
|
||||
|
||||
|
||||
/***************************** *****************************/
|
||||
#undef realloc
|
||||
//
|
||||
//#include <type_traits>
|
||||
//#include <typeinfo>
|
||||
@ -1494,80 +1493,53 @@ XStringClass xstr2 = initialString.basename();
|
||||
//#include <libgen.h>
|
||||
|
||||
//std::is_class
|
||||
//
|
||||
//void func_test(XStringW& xsw)
|
||||
//{
|
||||
// (void)xsw;
|
||||
//}
|
||||
|
||||
void func_test(XStringW& xsw)
|
||||
{
|
||||
(void)xsw;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class CE
|
||||
class C
|
||||
{
|
||||
public:
|
||||
const T* data;
|
||||
constexpr CE() : data(0) { }
|
||||
typedef char char_t;
|
||||
const char* data;
|
||||
constexpr C() : data(0) { }
|
||||
};
|
||||
|
||||
class CE2 : public XStringAbstractNoDtor<char, CE2>
|
||||
{
|
||||
};
|
||||
//constexpr LString8 g_xs1 = "foobar";
|
||||
//constexpr LStringW g_xsw1 = L"foobar";
|
||||
//XString g_xs2 = "foobar"_XS8;
|
||||
|
||||
int XString_tests()
|
||||
{
|
||||
#ifdef JIEF_DEBUG
|
||||
// printf("XString16_tests -> Enter\n");
|
||||
// printf("XString_tests -> Enter\n");
|
||||
#endif
|
||||
|
||||
//constexpr CE<char> ce;
|
||||
//constexpr CE2 xsw;
|
||||
|
||||
//const char c = ' ';
|
||||
//const char* cc = " ";
|
||||
//char buf[64];
|
||||
//char16_t* buf16 = (char16_t*)u"foo16";
|
||||
XString x1("a"_XS);
|
||||
XString x2("b"_XS);
|
||||
XStringW xw1("c"_XS);
|
||||
|
||||
char c = 1;
|
||||
int ii = sizeof(size_t);
|
||||
unsigned long long ull = 1;
|
||||
unsigned long long ll = 3;
|
||||
xw1.dataSized(c);
|
||||
xw1.dataSized(ii);
|
||||
xw1.dataSized(ull);
|
||||
xw1.dataSized(ll);
|
||||
//char c = 'a';
|
||||
//int ii = sizeof(size_t);
|
||||
//unsigned long long ull = 1;
|
||||
//unsigned long long ll = 3;
|
||||
//xw1.dataSized(c);
|
||||
//xw1.dataSized(ii);
|
||||
//xw1.dataSized(ull);
|
||||
//xw1.dataSized(ll);
|
||||
|
||||
//auto x3 = xw1 = x1;
|
||||
//func_test(x3);
|
||||
//
|
||||
//XStringAbstract__is_char_st<decltype(buf16)> a;
|
||||
//printf("a.v()=%d\n", a.v());
|
||||
|
||||
//XStringW sw1 = buf16;
|
||||
|
||||
//std::is_array<decltype(buf)> b;
|
||||
|
||||
//XStringAbstract__enable_if_t<is_char(decltype(c))>::type a;
|
||||
|
||||
//printf("%ls", XStringW().takeValueFrom(" ").s());
|
||||
//func_test(XStringW().takeValueFrom(" "));
|
||||
|
||||
// testDefaultCtor<XString>("XString");
|
||||
// XString16 a = u"toto"_XS16;
|
||||
|
||||
const char* utf8 = "ギ"; (void)utf8;
|
||||
size_t utf8_size = sizeof("ギ") - 1; (void)utf8_size; // this char is 6 bytes long !
|
||||
const wchar_t* utfw = L"ギ"; (void)utfw;
|
||||
size_t utfw_size = sizeof(L"ギ") - 1; (void)utfw_size; // this char is 6 bytes long !
|
||||
const char16_t* utf16 = u"ギ"; (void)utf16;
|
||||
size_t utf16_size = sizeof(u"ギ") - 1; (void)utf16_size; // this char is 6 bytes long !
|
||||
const char32_t* utf32 = U"ギ"; (void)utf32;
|
||||
size_t utf32_size = sizeof(U"ギ") - 1; (void)utf32_size; // this char is 6 bytes long !
|
||||
//const char* utf8 = "ギ"; (void)utf8;
|
||||
//size_t utf8_size = sizeof("ギ") - 1; (void)utf8_size; // this char is 6 bytes long !
|
||||
//const wchar_t* utfw = L"ギ"; (void)utfw;
|
||||
//size_t utfw_size = sizeof(L"ギ") - 1; (void)utfw_size; // this char is 6 bytes long !
|
||||
//const char16_t* utf16 = u"ギ"; (void)utf16;
|
||||
//size_t utf16_size = sizeof(u"ギ") - 1; (void)utf16_size; // this char is 6 bytes long !
|
||||
//const char32_t* utf32 = U"ギ"; (void)utf32;
|
||||
//size_t utf32_size = sizeof(U"ギ") - 1; (void)utf32_size; // this char is 6 bytes long !
|
||||
//size_t size = sizeof("ꇉ")-1; // this char is 3 bytes long
|
||||
//size_t size = sizeof("伽")-1; // this char is 3 bytes long
|
||||
//size_t size = sizeof("楘")-1; // this char is 3 bytes long
|
||||
//XString str = "ギꇉ伽楘"_XS;
|
||||
//XString str = "ギꇉ伽楘"_XS8;
|
||||
//char* s = str.data(42);
|
||||
|
||||
//size_t size1 = sizeof("В")-1;
|
||||
@ -1578,46 +1550,28 @@ size_t utf32_size = sizeof(U"ギ") - 1; (void)utf32_size; // this char is 6 b
|
||||
#ifdef _MSC_VER
|
||||
//SetConsoleOutputCP(65001);
|
||||
#endif
|
||||
//
|
||||
//printf("%s", "Выход \n");
|
||||
//XString ddd = "Выход "_XS;
|
||||
//printf(" xstring %s, asize=%zu, sizeinbyte=%zu sizeof=%zu lastcharat=%zu\n", ddd.c_str(), ddd.allocatedSize(), ddd.sizeInBytes(), sizeof(ddd), ddd.indexOf(ddd.lastChar()));
|
||||
//
|
||||
//TestString<char> ts1 = TestString<char>(nbchar("Выход "), "Выход ", nbchar(PREFIX_U("Выход ")), PREFIX_U("Выход "));
|
||||
//testlastChar_<XString>(ts1);
|
||||
|
||||
|
||||
//teststrncpy_<XString>("utf8", testStringMultiCodedArray[1].utf8, testStringMultiCodedArray[1].wchar);
|
||||
//testindexOf(XString, utf8, utf16);
|
||||
//testCompare(XString, utf8, utf16);
|
||||
//testindexOf_<XString>(testStringMultiCoded4CaseArray[0].utf8);
|
||||
//testTakeValueFrom_<XString16>(testStringMultiCodedArray[0].utf16, testStringMultiCodedArray[0].utf16);
|
||||
|
||||
//const char* p1 = "foo/bar"; // basename returns bar
|
||||
//const char* p1 = "foo/"; // basename returns foo
|
||||
//const char* p1 = "foo//"; // basename returns foo
|
||||
//const char* p1 = "foo///"; // basename returns foo
|
||||
//const char* p1 = ""; // basename returns "."
|
||||
//const char* p1 = " foo/bar "; // basename returns "bar "
|
||||
//const char* p1 = " foo "; // basename returns " foo "
|
||||
//const char* p1 = " "; // basename returns " "
|
||||
//const char* p2 = basename((char*)p1);
|
||||
TEST_ALL_CLASSES(testDefaultCtor, __TEST0);
|
||||
TEST_ALL_CLASSES(testEmpty, __TEST0);
|
||||
TEST_ALL_CLASSES(testTakeValueFrom, TEST_ALL_UTF);
|
||||
TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
TEST_ALL_CLASSES(testdataSized, TEST_ALL_INTEGRAL);
|
||||
|
||||
TEST_ALL_CLASSES(teststrncpy, TEST_ALL_UTF); // 26944 tests
|
||||
TEST_ALL_CLASSES(teststrcat, TEST_ALL_UTF_ALL_UTF);
|
||||
TEST_ALL_CLASSES(teststrncat, TEST_ALL_UTF_ALL_UTF); // 2101632 tests
|
||||
|
||||
// TEST_ALL_CLASSES(testDefaultCtor, __TEST0);
|
||||
// TEST_ALL_CLASSES(testEmpty, __TEST0);
|
||||
// TEST_ALL_CLASSES(testTakeValueFrom, TEST_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
// TEST_ALL_CLASSES(testdataSized, TEST_ALL_INTEGRAL);
|
||||
//
|
||||
// TEST_ALL_CLASSES(teststrncpy, TEST_ALL_UTF); // 26944 tests
|
||||
// TEST_ALL_CLASSES(teststrcat, TEST_ALL_UTF_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(teststrncat, TEST_ALL_UTF_ALL_UTF); // 2101632 tests
|
||||
//
|
||||
TEST_ALL_CLASSES(testSubString, __TEST0);
|
||||
// TEST_ALL_CLASSES(testCompare, TEST_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(testindexOf, TEST_ALL_UTF);
|
||||
//
|
||||
// TEST_ALL_CLASSES(testlastChar, __TEST0);
|
||||
TEST_ALL_CLASSES(testCompare, TEST_ALL_UTF);
|
||||
TEST_ALL_CLASSES(testindexOf, TEST_ALL_UTF);
|
||||
|
||||
TEST_ALL_CLASSES(testlastChar, __TEST0);
|
||||
TEST_ALL_CLASSES(testtrim, __TEST0);
|
||||
TEST_ALL_CLASSES(teststartWith, __TEST0);
|
||||
TEST_ALL_CLASSES(testbasename, __TEST0);
|
||||
@ -1643,3 +1597,18 @@ size_t utf32_size = sizeof(U"ギ") - 1; (void)utf32_size; // this char is 6 b
|
||||
#endif
|
||||
return nbTestFailed > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//const char* p1 = "foo/bar"; // basename returns bar
|
||||
//const char* p1 = "foo/"; // basename returns foo
|
||||
//const char* p1 = "foo//"; // basename returns foo
|
||||
//const char* p1 = "foo///"; // basename returns foo
|
||||
//const char* p1 = ""; // basename returns "."
|
||||
//const char* p1 = " foo/bar "; // basename returns "bar "
|
||||
//const char* p1 = " foo "; // basename returns " foo "
|
||||
//const char* p1 = " "; // basename returns " "
|
||||
//const char* p2 = basename((char*)p1);
|
||||
|
||||
|
136
rEFIt_UEFI/cpp_unit_test/XToolsCommon_test.cpp
Executable file
136
rEFIt_UEFI/cpp_unit_test/XToolsCommon_test.cpp
Executable file
@ -0,0 +1,136 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/unicode_conversions.h"
|
||||
|
||||
|
||||
|
||||
static int nbTest = 0;
|
||||
static int nbTestFailed = 0;
|
||||
//static bool displayOnlyFailed = true;
|
||||
|
||||
|
||||
#define STRINGIFY_(s) #s
|
||||
#define STRINGIFY(s) STRINGIFY_(s)
|
||||
|
||||
|
||||
//#include <type_traits>
|
||||
//#include <typeinfo>
|
||||
//#include <iostream>
|
||||
//#include <libgen.h>
|
||||
|
||||
class C
|
||||
{
|
||||
public:
|
||||
typedef char char_t;
|
||||
const char* data;
|
||||
constexpr C() : data(0) { }
|
||||
};
|
||||
|
||||
#define ASSERT_CONST_NONCONST(test, type, expectedResult) \
|
||||
test(type, expectedResult) \
|
||||
test(const type, expectedResult) \
|
||||
|
||||
#define ASSERT_ALL_INTEGRAL(test, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, short, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, short, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, int, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, unsigned int, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, long, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, unsigned long, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, long, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, unsigned long long, expectedResult) \
|
||||
|
||||
#define ASSERT_ALL_CHAR(test, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, char, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, signed char, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, unsigned char, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, char16_t, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, char32_t, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, wchar_t, expectedResult) \
|
||||
|
||||
#define ASSERT_ALL_PTR(test, type, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, type*, expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, type[], expectedResult) \
|
||||
ASSERT_CONST_NONCONST(test, type[10], expectedResult) \
|
||||
|
||||
#define ASSERT_ALL_CHAR_PTR(test, expectedResult) \
|
||||
ASSERT_ALL_PTR(test, char, expectedResult) \
|
||||
ASSERT_ALL_PTR(test, signed char, expectedResult) \
|
||||
ASSERT_ALL_PTR(test, unsigned char, expectedResult) \
|
||||
ASSERT_ALL_PTR(test, char16_t, expectedResult) \
|
||||
ASSERT_ALL_PTR(test, char32_t, expectedResult) \
|
||||
ASSERT_ALL_PTR(test, wchar_t, expectedResult) \
|
||||
|
||||
#define ASSERT_ALL_INTEGRAL_CHAR(test, expectedResult) \
|
||||
ASSERT_ALL_INTEGRAL(test, expectedResult) \
|
||||
ASSERT_ALL_CHAR(test, expectedResult) \
|
||||
|
||||
template <bool>
|
||||
struct _xtools__is_unsigned_true_false : public _xtools__false_type {};
|
||||
template <>
|
||||
struct _xtools__is_unsigned_true_false<true> : public _xtools__true_type {};
|
||||
template <>
|
||||
struct _xtools__is_unsigned_true_false<false> : public _xtools__false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct _xtools__is_unsigned : public _xtools__is_unsigned_true_false< ( _Tp(0) < _Tp(-1) ) > {};
|
||||
|
||||
#define is_unsigned(x) _xtools__is_unsigned<x>::value
|
||||
|
||||
#define ASSERT_UNSIGNED_TYPE(type, expectedResult) \
|
||||
static_assert(is_unsigned(unsigned_type(type)) == expectedResult, "unsigned_type " STRINGIFY(type) " failed");
|
||||
|
||||
#define ASSERT_SIZEOF_UNSIGNED_TYPE(type, expectedResult) \
|
||||
static_assert(sizeof(unsigned_type(type)) == sizeof(type), "sizeof(unsigned_type(" STRINGIFY(type) ")) == sizeof(" STRINGIFY(type) ") failed");
|
||||
|
||||
#define ASSERT_IS_INTEGRAL(type, expectedResult) \
|
||||
static_assert(is_integral(type) == expectedResult, "is_integral(" STRINGIFY(type) ") failed");
|
||||
|
||||
#define ASSERT_IS_CHAR(type, expectedResult) \
|
||||
static_assert(is_char(type) == expectedResult, "is_char(" STRINGIFY(type) ") failed");
|
||||
|
||||
#define ASSERT_IS_CHAR_PTR(type, expectedResult) \
|
||||
/*printf("is_char_ptr(%s)\n", STRINGIFY(type)); */ \
|
||||
static_assert(is_char_ptr(type) == expectedResult, "is_char_ptr(" STRINGIFY(type) ") failed");
|
||||
|
||||
|
||||
int XToolsCommon_tests()
|
||||
{
|
||||
#ifdef JIEF_DEBUG
|
||||
// printf("XToolsCommon_tests -> Enter\n");
|
||||
#endif
|
||||
|
||||
ASSERT_ALL_INTEGRAL_CHAR(ASSERT_UNSIGNED_TYPE, true)
|
||||
ASSERT_ALL_INTEGRAL_CHAR(ASSERT_SIZEOF_UNSIGNED_TYPE, true) // expectedResult unused by ASSERT_SIZEOF_UNSIGNED_TYPE
|
||||
ASSERT_ALL_INTEGRAL(ASSERT_IS_INTEGRAL, true)
|
||||
ASSERT_ALL_CHAR(ASSERT_IS_INTEGRAL, false)
|
||||
|
||||
ASSERT_ALL_INTEGRAL(ASSERT_IS_CHAR, false)
|
||||
ASSERT_ALL_CHAR(ASSERT_IS_CHAR, true)
|
||||
ASSERT_ALL_CHAR_PTR(ASSERT_IS_CHAR_PTR, true)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
if ( nbTestFailed == 0 ) printf("All %d tests succeeded.\n", nbTest);
|
||||
else printf("%d tests succeeded out of %d.\n", nbTest-nbTestFailed, nbTest);
|
||||
#endif
|
||||
return nbTestFailed > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//const char* p1 = "foo/bar"; // basename returns bar
|
||||
//const char* p1 = "foo/"; // basename returns foo
|
||||
//const char* p1 = "foo//"; // basename returns foo
|
||||
//const char* p1 = "foo///"; // basename returns foo
|
||||
//const char* p1 = ""; // basename returns "."
|
||||
//const char* p1 = " foo/bar "; // basename returns "bar "
|
||||
//const char* p1 = " foo "; // basename returns " foo "
|
||||
//const char* p1 = " "; // basename returns " "
|
||||
//const char* p2 = basename((char*)p1);
|
||||
|
1
rEFIt_UEFI/cpp_unit_test/XToolsCommon_test.h
Executable file
1
rEFIt_UEFI/cpp_unit_test/XToolsCommon_test.h
Executable file
@ -0,0 +1 @@
|
||||
int XToolsCommon_tests();
|
@ -13,6 +13,7 @@
|
||||
#include "strlen_test.h"
|
||||
#include "printf_lite-test.h"
|
||||
#include "LoadOptions_test.h"
|
||||
#include "XToolsCommon_test.h"
|
||||
|
||||
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
|
||||
#include "poolprint-test.h"
|
||||
@ -31,11 +32,18 @@ bool all_tests()
|
||||
bool all_ok = true;
|
||||
int ret;
|
||||
|
||||
ret = XString_tests();
|
||||
// ret = XString_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// printf("XString16_tests() failed at test %d\n", ret);
|
||||
// all_ok = false;
|
||||
// }
|
||||
#if defined(JIEF_DEBUG)
|
||||
ret = XToolsCommon_tests();
|
||||
if ( ret != 0 ) {
|
||||
printf("XString16_tests() failed at test %d\n", ret);
|
||||
printf("printlib_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
#endif
|
||||
//return ret;
|
||||
// ret = XUINTN_tests();
|
||||
// if ( ret != 0 ) {
|
||||
@ -86,11 +94,11 @@ bool all_tests()
|
||||
printf("XObjArray_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
// ret = XString_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// printf("XString_tests() failed at test %d\n", ret);
|
||||
// all_ok = false;
|
||||
// }
|
||||
ret = XString_tests();
|
||||
if ( ret != 0 ) {
|
||||
printf("XString_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = XStringArray_tests();
|
||||
if ( ret != 0 ) {
|
||||
printf("XStringArray_tests() failed at test %d\n", ret);
|
||||
|
@ -9,10 +9,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class XStringTest : public XString
|
||||
class XStringTest : public XString8
|
||||
{
|
||||
public:
|
||||
XStringTest(const char *S) : XString()
|
||||
XStringTest(const char *S) : XString8()
|
||||
{
|
||||
strcpy(S);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EF
|
||||
// if ( LoadOptions.contains(LoadOption) ) return LoadOptions; //good
|
||||
// // Otherwise add option
|
||||
//// return SPrintf("%s %s", LoadOptions.c_str(), LoadOption.c_str()); //LoadOptions + LoadOption
|
||||
// return LoadOptions + " "_XS + LoadOption; //why not?
|
||||
// return LoadOptions + " "_XS8 + LoadOption; //why not?
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@ -146,7 +146,7 @@ const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EF
|
||||
//
|
||||
// //DBG("LoadOptions: '%ls', remove LoadOption: '%ls'\n", LoadOptions, LoadOption);
|
||||
// // If there are no options then nothing to do
|
||||
// if (LoadOptions.isEmpty()) return ""_XS;
|
||||
// if (LoadOptions.isEmpty()) return ""_XS8;
|
||||
// // If there is no option to remove then duplicate original
|
||||
// if (LoadOption.isEmpty()) return LoadOptions;
|
||||
// // If not present duplicate original
|
||||
@ -176,7 +176,7 @@ const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EF
|
||||
// }
|
||||
//
|
||||
// // If it's the whole string return NULL
|
||||
// if (OptionLength == Length) return ""_XS;
|
||||
// if (OptionLength == Length) return ""_XS8;
|
||||
//
|
||||
// XString NewLoadOptions;
|
||||
// if (Offset == 0) {
|
||||
|
@ -138,7 +138,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
|
||||
} else {
|
||||
Entry->Image = ThemeX.LoadOSIcon(Volume->LegacyOS->IconName);
|
||||
if (Entry->Image.isEmpty()) {
|
||||
Entry->Image = ThemeX.GetIcon("os_win"_XS); //we have no legacy.png
|
||||
Entry->Image = ThemeX.GetIcon("os_win"_XS8); //we have no legacy.png
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
|
||||
}
|
||||
Entry->Volume = Volume;
|
||||
Entry->DevicePathString = Volume->DevicePathString;
|
||||
// Entry->LoadOptions = (Volume->DiskKind == DISK_KIND_OPTICAL) ? "CD"_XS : ((Volume->DiskKind == DISK_KIND_EXTERNAL) ? "USB"_XS : "HD"_XS);
|
||||
// Entry->LoadOptions = (Volume->DiskKind == DISK_KIND_OPTICAL) ? "CD"_XS8 : ((Volume->DiskKind == DISK_KIND_EXTERNAL) ? "USB"_XS8 : "HD"_XS8);
|
||||
Entry->LoadOptions.setEmpty();
|
||||
Entry->LoadOptions.Add((Volume->DiskKind == DISK_KIND_OPTICAL) ? "CD" : ((Volume->DiskKind == DISK_KIND_EXTERNAL) ? "USB" : "HD"));
|
||||
// create the submenu
|
||||
|
@ -59,12 +59,12 @@
|
||||
#define DBG(...) DebugLog(DEBUG_SCAN_LOADER, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
const XStringW MACOSX_LOADER_PATH = "\\System\\Library\\CoreServices\\boot.efi"_XSW;
|
||||
const XStringW MACOSX_LOADER_PATH = L"\\System\\Library\\CoreServices\\boot.efi"_XSW;
|
||||
|
||||
const XStringW LINUX_ISSUE_PATH = "\\etc\\issue"_XSW;
|
||||
const XStringW LINUX_ISSUE_PATH = L"\\etc\\issue"_XSW;
|
||||
#define LINUX_BOOT_PATH L"\\boot"
|
||||
#define LINUX_BOOT_ALT_PATH L"\\boot"
|
||||
const XString LINUX_LOADER_PATH = "vmlinuz"_XS;
|
||||
const XString8 LINUX_LOADER_PATH = "vmlinuz"_XS8;
|
||||
const XStringW LINUX_FULL_LOADER_PATH = SWPrintf("%ls\\%s", LINUX_BOOT_PATH, LINUX_LOADER_PATH.c_str());
|
||||
#define LINUX_LOADER_SEARCH_PATH L"vmlinuz*"
|
||||
const XStringArray LINUX_DEFAULT_OPTIONS = Split<XStringArray>("ro add_efi_memmap quiet splash vt.handoff=7", " ");
|
||||
@ -84,7 +84,7 @@ typedef struct LINUX_PATH_DATA
|
||||
CONST XStringW Path;
|
||||
CONST XStringW Title;
|
||||
CONST XStringW Icon;
|
||||
CONST XString Issue;
|
||||
CONST XString8 Issue;
|
||||
} LINUX_PATH_DATA;
|
||||
|
||||
typedef struct LINUX_ICON_DATA
|
||||
@ -129,7 +129,7 @@ STATIC LINUX_PATH_DATA LinuxEntryData[] = {
|
||||
// { L"\\EFI\\Manjaro\\grubx64.efi", L"Manjaro EFI boot menu", L"manjaro,linux", "Manjaro" },
|
||||
// { L"\\EFI\\xubuntu\\grubx64.efi", L"Xubuntu EFI boot menu", L"xubuntu,linux", "Xubuntu" },
|
||||
// { L"\\EFI\\zorin\\grubx64.efi", L"Zorin EFI boot menu", L"zorin,linux", "Zorin" },
|
||||
{ L"\\EFI\\goofiboot\\goofibootx64.efi"_XSW, L"Solus EFI boot menu"_XSW, L"solus,linux"_XSW, "Solus"_XSW },
|
||||
{ L"\\EFI\\goofiboot\\goofibootx64.efi"_XSW, L"Solus EFI boot menu"_XSW, L"solus,linux"_XSW, "Solus"_XS8 },
|
||||
// { L"\\EFI\\centos\\grubx64.efi", L"CentOS EFI boot menu", L"centos,linux", "CentOS" },
|
||||
// { L"\\EFI\\pclinuxos\\grubx64.efi", L"PCLinuxOS EFI boot menu", L"pclinux,linux", "PCLinux" },
|
||||
// { L"\\EFI\\neon\\grubx64.efi", L"KDE Neon EFI boot menu", L"neon,linux", "KDE Neon" },
|
||||
@ -196,9 +196,9 @@ STATIC CONST UINTN AndroidEntryDataCount = (sizeof(AndroidEntryData) / sizeof(AN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CONST XStringW PaperBoot = "\\com.apple.boot.P\\boot.efi"_XSW;
|
||||
CONST XStringW RockBoot = "\\com.apple.boot.R\\boot.efi"_XSW;
|
||||
CONST XStringW ScissorBoot = "\\com.apple.boot.S\\boot.efi"_XSW;
|
||||
CONST XStringW PaperBoot = L"\\com.apple.boot.P\\boot.efi"_XSW;
|
||||
CONST XStringW RockBoot = L"\\com.apple.boot.R\\boot.efi"_XSW;
|
||||
CONST XStringW ScissorBoot = L"\\com.apple.boot.S\\boot.efi"_XSW;
|
||||
|
||||
// OS X installer paths
|
||||
CONST XStringW OSXInstallerPaths[] = {
|
||||
@ -339,13 +339,13 @@ STATIC CONST XStringW& LinuxIconNameFromPath(IN CONST XStringW& Path,
|
||||
return linux;
|
||||
}
|
||||
|
||||
STATIC CONST XString LinuxInitImagePath[] = {
|
||||
"initrd%s"_XS,
|
||||
"initrd.img%s"_XS,
|
||||
"initrd%s.img"_XS,
|
||||
"initramfs%s"_XS,
|
||||
"initramfs.img%s"_XS,
|
||||
"initramfs%s.img"_XS,
|
||||
STATIC CONST XString8 LinuxInitImagePath[] = {
|
||||
"initrd%s"_XS8,
|
||||
"initrd.img%s"_XS8,
|
||||
"initrd%s.img"_XS8,
|
||||
"initramfs%s"_XS8,
|
||||
"initramfs.img%s"_XS8,
|
||||
"initramfs%s.img"_XS8,
|
||||
};
|
||||
STATIC CONST UINTN LinuxInitImagePathCount = (sizeof(LinuxInitImagePath) / sizeof(LinuxInitImagePath[0]));
|
||||
|
||||
@ -822,7 +822,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (Guid) {
|
||||
SubScreen->AddMenuInfoLine_f("UUID: %s", strguid(Guid));
|
||||
}
|
||||
SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.ConcatAll(" "_XS).c_str());
|
||||
SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.ConcatAll(" "_XS8).c_str());
|
||||
// loader-specific submenu entries
|
||||
if (Entry->LoaderType == OSTYPE_OSX ||
|
||||
Entry->LoaderType == OSTYPE_OSX_INSTALLER ||
|
||||
@ -938,10 +938,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
if (Quiet) {
|
||||
SubEntry->Title.SWPrintf("%ls verbose", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("quiet"_XS);
|
||||
SubEntry->LoadOptions.removeIC("quiet"_XS8);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls quiet", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("quiet"_XS);
|
||||
SubEntry->LoadOptions.AddID("quiet"_XS8);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
@ -949,10 +949,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
if (WithSplash) {
|
||||
SubEntry->Title.SWPrintf("%ls without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS);
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS8);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("splash"_XS);
|
||||
SubEntry->LoadOptions.AddID("splash"_XS8);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
@ -961,30 +961,30 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (WithSplash) {
|
||||
if (Quiet) {
|
||||
SubEntry->Title.SWPrintf("%ls verbose without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS);
|
||||
SubEntry->LoadOptions.removeIC("quiet"_XS);
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS8);
|
||||
SubEntry->LoadOptions.removeIC("quiet"_XS8);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls quiet without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS);
|
||||
SubEntry->LoadOptions.Add("quiet"_XS);
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS8);
|
||||
SubEntry->LoadOptions.Add("quiet"_XS8);
|
||||
}
|
||||
} else if (Quiet) {
|
||||
// TempOptions.RemoveIC("quiet"_XS);
|
||||
// TempOptions.RemoveIC("quiet"_XS8);
|
||||
SubEntry->Title.SWPrintf("%ls verbose with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("splash"_XS);
|
||||
SubEntry->LoadOptions.AddID("splash"_XS8);
|
||||
// FreePool(TempOptions);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls quiet with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("quiet"_XS);
|
||||
SubEntry->LoadOptions.AddID("splash"_XS);
|
||||
SubEntry->LoadOptions.AddID("quiet"_XS8);
|
||||
SubEntry->LoadOptions.AddID("splash"_XS8);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
} else if ((Entry->LoaderType == OSTYPE_WIN) || (Entry->LoaderType == OSTYPE_WINEFI)) {
|
||||
// by default, skip the built-in selection and boot from hard disk only
|
||||
Entry->LoadOptions.setEmpty();
|
||||
Entry->LoadOptions.Add("-s"_XS);
|
||||
Entry->LoadOptions.Add("-h"_XS);
|
||||
Entry->LoadOptions.Add("-s"_XS8);
|
||||
Entry->LoadOptions.Add("-h"_XS8);
|
||||
|
||||
// default entry
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
@ -1003,8 +1003,8 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.takeValueFrom("Boot Windows from CD-ROM");
|
||||
Entry->LoadOptions.setEmpty();
|
||||
Entry->LoadOptions.Add("-s"_XS);
|
||||
Entry->LoadOptions.Add("-c"_XS);
|
||||
Entry->LoadOptions.Add("-s"_XS8);
|
||||
Entry->LoadOptions.Add("-c"_XS8);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
@ -1013,7 +1013,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
SubEntry->Title.SWPrintf("Run %ls in text mode", FileName.wc_str());
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_USEGRAPHICS);
|
||||
Entry->LoadOptions.setEmpty();
|
||||
Entry->LoadOptions.Add("-v"_XS);
|
||||
Entry->LoadOptions.Add("-v"_XS8);
|
||||
SubEntry->LoaderType = OSTYPE_OTHER; // Sothor - Why are we using OSTYPE_OTHER here?
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
@ -1163,7 +1163,7 @@ VOID ScanLoader(VOID)
|
||||
if (FileExists(Volume->RootDir, L"\\Install OS X Mavericks.app") ||
|
||||
FileExists(Volume->RootDir, L"\\Install OS X Yosemite.app") ||
|
||||
FileExists(Volume->RootDir, L"\\Install OS X El Capitan.app")) {
|
||||
AddLoaderEntry("\\.IABootFiles\\boot.efi"_XSW, NullXStringArray, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.9 - 10.11
|
||||
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXStringArray, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.9 - 10.11
|
||||
} else {
|
||||
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXStringArray, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.13.3
|
||||
}
|
||||
@ -1171,7 +1171,7 @@ VOID ScanLoader(VOID)
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.13.4+
|
||||
}
|
||||
// 2nd stage - InstallESD/AppStore/startosinstall/Fusion Drive
|
||||
AddLoaderEntry("\\Mac OS X Install Data\\boot.efi"_XSW, NullXStringArray, L"Mac OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
|
||||
AddLoaderEntry(L"\\Mac OS X Install Data\\boot.efi"_XSW, NullXStringArray, L"Mac OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
|
||||
AddLoaderEntry(L"\\OS X Install Data\\boot.efi"_XSW, NullXStringArray, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
|
||||
AddLoaderEntry(L"\\macOS Install Data\\boot.efi"_XSW, NullXStringArray, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.12.3
|
||||
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\Boot Files\\boot.efi"_XSW, NullXStringArray, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12.4+
|
||||
@ -2039,7 +2039,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
|
||||
if (Guid) {
|
||||
SubScreen->AddMenuInfoLine_f("UUID: %s", strguid(Guid));
|
||||
}
|
||||
SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.ConcatAll(" "_XS).c_str());
|
||||
SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.ConcatAll(" "_XS8).c_str());
|
||||
DBG("Create sub entries\n");
|
||||
for (CustomSubEntry = Custom->SubEntries; CustomSubEntry; CustomSubEntry = CustomSubEntry->Next) {
|
||||
if (!CustomSubEntry->Settings) {
|
||||
|
@ -43,10 +43,10 @@
|
||||
//
|
||||
// Clover File location to boot from on removable media devices
|
||||
//
|
||||
#define CLOVER_MEDIA_FILE_NAME_IA32 "\\EFI\\CLOVER\\CLOVERIA32.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_IA64 "\\EFI\\CLOVER\\CLOVERIA64.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_X64 "\\EFI\\CLOVER\\CLOVERX64.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_ARM "\\EFI\\CLOVER\\CLOVERARM.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_IA32 L"\\EFI\\CLOVER\\CLOVERIA32.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_IA64 L"\\EFI\\CLOVER\\CLOVERIA64.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_X64 L"\\EFI\\CLOVER\\CLOVERX64.EFI"_XSW
|
||||
#define CLOVER_MEDIA_FILE_NAME_ARM L"\\EFI\\CLOVER\\CLOVERARM.EFI"_XSW
|
||||
|
||||
#if defined (MDE_CPU_IA32)
|
||||
#define CLOVER_MEDIA_FILE_NAME CLOVER_MEDIA_FILE_NAME_IA32
|
||||
@ -200,7 +200,7 @@ VOID ScanTool(VOID)
|
||||
// DBG("Scanning for tools...\n");
|
||||
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_SHELL)) {
|
||||
if (!AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64U.efi"_XSW, NULL, L"UEFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXStringArray)) {
|
||||
AddToolEntry("\\EFI\\CLOVER\\tools\\Shell64.efi"_XSW, NULL, L"EFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXStringArray);
|
||||
AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64.efi"_XSW, NULL, L"EFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXStringArray);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2034,7 +2034,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
|
||||
if (MainImage.isEmpty()) {
|
||||
// DBG(" why MainImage is empty? Report to devs\n");
|
||||
if (!IsEmbeddedTheme()) {
|
||||
MainImage = ThemeX.GetIcon("os_mac"_XS);
|
||||
MainImage = ThemeX.GetIcon("os_mac"_XS8);
|
||||
}
|
||||
if (MainImage.isEmpty()) {
|
||||
MainImage.DummyImage(MainSize);
|
||||
@ -2663,7 +2663,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
||||
}
|
||||
if (/*MenuExit == MENU_EXIT_ENTER &&*/ MainChosenEntry->getLOADER_ENTRY()) {
|
||||
if (MainChosenEntry->getLOADER_ENTRY()->LoadOptions.notEmpty()) {
|
||||
snprintf(gSettings.BootArgs, 255, "%s", MainChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS).c_str());
|
||||
snprintf(gSettings.BootArgs, 255, "%s", MainChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8).c_str());
|
||||
} else {
|
||||
ZeroMem(&gSettings.BootArgs, 255);
|
||||
}
|
||||
|
@ -44,27 +44,27 @@
|
||||
//#include "menu_items/menu_items.h"
|
||||
//#include "../entry_scan/common.h"
|
||||
|
||||
CONST XString ArgOptional[NUM_OPT] = {
|
||||
"arch=i386"_XS, //0
|
||||
"arch=x86_64"_XS, //1
|
||||
"-v"_XS, //2
|
||||
"-f"_XS, //3
|
||||
"-s"_XS, //4
|
||||
"-x"_XS, //5
|
||||
"nv_disable=1"_XS, //6
|
||||
"slide=0"_XS, //7
|
||||
"darkwake=0"_XS, //8
|
||||
"-xcpm"_XS, //9
|
||||
"-gux_no_idle"_XS, //10
|
||||
"-gux_nosleep"_XS, //11
|
||||
"-gux_nomsi"_XS, //12
|
||||
"-gux_defer_usb2"_XS, //13
|
||||
"keepsyms=1"_XS, //14
|
||||
"debug=0x100"_XS, //15
|
||||
"kextlog=0xffff"_XS, //16
|
||||
"-alcoff"_XS, //17
|
||||
"-shikioff"_XS, //18
|
||||
"nvda_drv=1"_XS //19
|
||||
CONST XString8 ArgOptional[NUM_OPT] = {
|
||||
"arch=i386"_XS8, //0
|
||||
"arch=x86_64"_XS8, //1
|
||||
"-v"_XS8, //2
|
||||
"-f"_XS8, //3
|
||||
"-s"_XS8, //4
|
||||
"-x"_XS8, //5
|
||||
"nv_disable=1"_XS8, //6
|
||||
"slide=0"_XS8, //7
|
||||
"darkwake=0"_XS8, //8
|
||||
"-xcpm"_XS8, //9
|
||||
"-gux_no_idle"_XS8, //10
|
||||
"-gux_nosleep"_XS8, //11
|
||||
"-gux_nomsi"_XS8, //12
|
||||
"-gux_defer_usb2"_XS8, //13
|
||||
"keepsyms=1"_XS8, //14
|
||||
"debug=0x100"_XS8, //15
|
||||
"kextlog=0xffff"_XS8, //16
|
||||
"-alcoff"_XS8, //17
|
||||
"-shikioff"_XS8, //18
|
||||
"nvda_drv=1"_XS8 //19
|
||||
};
|
||||
CONST CHAR16 *VBIOS_BIN = L"EFI\\CLOVER\\misc\\c0000.bin";
|
||||
|
||||
|
@ -53,7 +53,7 @@ extern UINTN FrameTime;
|
||||
|
||||
textFaces textFace[4]; //0-help 1-message 2-menu 3-test, far future it will be infinite list with id
|
||||
|
||||
EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString& IconNameX, XImage* Image)
|
||||
EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, XImage* Image)
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
NSVGimage *SVGimage;
|
||||
@ -95,7 +95,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString& IconNameX, XImage* Imag
|
||||
shape->opacity = 0.f;
|
||||
}
|
||||
// if (strstr(shape->id, "BoundingRect") != NULL) {
|
||||
if (XString().takeValueFrom(shape->id).contains("BoundingRect")) {
|
||||
if (XString8().takeValueFrom(shape->id).contains("BoundingRect")) {
|
||||
//there is bounds after nsvgParse()
|
||||
IconImage->width = shape->bounds[2] - shape->bounds[0];
|
||||
IconImage->height = shape->bounds[3] - shape->bounds[1];
|
||||
@ -161,7 +161,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString& IconNameX, XImage* Imag
|
||||
// if (strcmp(group->id, IconNameX.c_str()) == 0) {
|
||||
// break;
|
||||
// }
|
||||
if (IconNameX == XString().takeValueFrom(group->id)) {
|
||||
if (IconNameX == XString8().takeValueFrom(group->id)) {
|
||||
break;
|
||||
}
|
||||
group = group->parent;
|
||||
@ -267,20 +267,20 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
}
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!ThemeX.Daylight) {
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BACKGROUND, "Background_night"_XS, &BigBack);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BACKGROUND, "Background_night"_XS8, &BigBack);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BACKGROUND, "Background"_XS, &BigBack);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BACKGROUND, "Background"_XS8, &BigBack);
|
||||
}
|
||||
DBG(" Background parsed [%lld, %lld]\n", BigBack.GetWidth(), BigBack.GetHeight()); //Background parsed [1067, 133]
|
||||
// --- Make Banner
|
||||
Banner.setEmpty(); //for the case of theme switch
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!ThemeX.Daylight) {
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BANNER, "Banner_night"_XS, &Banner);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BANNER, "Banner_night"_XS8, &Banner);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BANNER, "Banner"_XS, &Banner);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_BANNER, "Banner"_XS8, &Banner);
|
||||
}
|
||||
// DBG("Banner parsed\n");
|
||||
BanHeight = (int)(Banner.GetHeight() * Scale + 1.f);
|
||||
@ -296,7 +296,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
|
||||
NewIcon->Native = !EFI_ERROR(Status);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS, &NewIcon->ImageNight);
|
||||
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS8, &NewIcon->ImageNight);
|
||||
}
|
||||
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
|
||||
Icons.AddReference(NewIcon, true);
|
||||
@ -315,16 +315,16 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
// DBG("parse %s i=%lld status %s\n", NewIcon->Name.c_str(), i, strerror(Status));
|
||||
NewIcon->Native = !EFI_ERROR(Status);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS, &NewIcon->ImageNight);
|
||||
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS8, &NewIcon->ImageNight);
|
||||
}
|
||||
Icons.AddReference(NewIcon, true);
|
||||
}
|
||||
|
||||
//selection for bootcampstyle
|
||||
Icon *NewIcon = new Icon(BUILTIN_ICON_SELECTION);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator"_XS, &NewIcon->Image);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator"_XS8, &NewIcon->Image);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator_night"_XS, &NewIcon->ImageNight);
|
||||
ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator_night"_XS8, &NewIcon->ImageNight);
|
||||
}
|
||||
Icons.AddReference(NewIcon, true);
|
||||
|
||||
@ -434,7 +434,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
EFI_STATUS XTheme::LoadSvgFrame(INTN i, OUT XImage* XFrame)
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
XString XFrameName = SPrintf("frame_%04lld", i+1);
|
||||
XString8 XFrameName = SPrintf("frame_%04lld", i+1);
|
||||
Status = ParseSVGXIcon(BUILTIN_ICON_ANIME, XFrameName, XFrame);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("frame '%s' not loaded, status=%s\n", XFrameName.c_str(), strerror(Status));
|
||||
|
@ -299,7 +299,7 @@ void XTheme::Init()
|
||||
static XImage NullIcon;
|
||||
static XImage DummyIcon;
|
||||
|
||||
const XImage& XTheme::GetIcon(const XString& Name)
|
||||
const XImage& XTheme::GetIcon(const XString8& Name)
|
||||
{
|
||||
for (size_t i = 0; i < Icons.size(); i++)
|
||||
{
|
||||
@ -385,26 +385,26 @@ const XImage& XTheme::GetIconAlt(INTN Id, INTN Alt) //if not found then take emb
|
||||
|
||||
const XImage& XTheme::LoadOSIcon(const CHAR16* OSIconName)
|
||||
{
|
||||
return LoadOSIcon(XString().takeValueFrom(OSIconName));
|
||||
return LoadOSIcon(XString8().takeValueFrom(OSIconName));
|
||||
}
|
||||
|
||||
const XImage& XTheme::LoadOSIcon(const XString& Full)
|
||||
const XImage& XTheme::LoadOSIcon(const XString8& Full)
|
||||
{
|
||||
// input value can be L"win", L"ubuntu,linux", L"moja,mac" set by GetOSIconName (OSVersion)
|
||||
XString First;
|
||||
XString Second;
|
||||
XString Third;
|
||||
XString8 First;
|
||||
XString8 Second;
|
||||
XString8 Third;
|
||||
const XImage *ReturnImage;
|
||||
UINTN Comma = Full.indexOf(',');
|
||||
UINTN Size = Full.length();
|
||||
DBG("IconName=%s comma=%lld size=%lld\n", Full.c_str(), Comma, Size);
|
||||
if (Comma != MAX_XSIZE) { //Comma
|
||||
First = "os_"_XS + Full.subString(0, Comma);
|
||||
First = "os_"_XS8 + Full.subString(0, Comma);
|
||||
ReturnImage = &GetIcon(First);
|
||||
DBG(" first=%s\n", First.c_str());
|
||||
if (!ReturnImage->isEmpty()) return *ReturnImage;
|
||||
//else search second name
|
||||
Second = "os_"_XS + Full.subString(Comma + 1, Size - Comma - 1);
|
||||
Second = "os_"_XS8 + Full.subString(Comma + 1, Size - Comma - 1);
|
||||
//moreover names can be triple L"chrome,grub,linux"
|
||||
UINTN SecondComma = Second.indexOf(',');
|
||||
if (Comma == MAX_XSIZE) {
|
||||
@ -414,14 +414,14 @@ const XImage& XTheme::LoadOSIcon(const XString& Full)
|
||||
First = Second.subString(0, SecondComma);
|
||||
ReturnImage = &GetIcon(First);
|
||||
if (!ReturnImage->isEmpty()) return *ReturnImage;
|
||||
Third = "os_"_XS + Second.subString(SecondComma + 1, Size - SecondComma - 1);
|
||||
Third = "os_"_XS8 + Second.subString(SecondComma + 1, Size - SecondComma - 1);
|
||||
ReturnImage = &GetIcon(Third);
|
||||
if (!ReturnImage->isEmpty()) return *ReturnImage;
|
||||
}
|
||||
DBG(" Second=%s\n", Second.c_str());
|
||||
if (!ReturnImage->isEmpty()) return *ReturnImage;
|
||||
} else {
|
||||
ReturnImage = &GetIcon("os_"_XS + Full);
|
||||
ReturnImage = &GetIcon("os_"_XS8 + Full);
|
||||
DBG(" Full=%s\n", Full.c_str());
|
||||
if (!ReturnImage->isEmpty()) return *ReturnImage;
|
||||
}
|
||||
@ -733,10 +733,10 @@ void XTheme::InitSelection() //for PNG theme
|
||||
}
|
||||
} else {
|
||||
//SVG theme already parsed all icons
|
||||
Buttons[0] = GetIcon("radio_button"_XS);
|
||||
Buttons[1] = GetIcon("radio_button_selected"_XS);
|
||||
Buttons[2] = GetIcon("checkbox"_XS);
|
||||
Buttons[3] = GetIcon("checkbox_checked"_XS);
|
||||
Buttons[0] = GetIcon("radio_button"_XS8);
|
||||
Buttons[1] = GetIcon("radio_button_selected"_XS8);
|
||||
Buttons[2] = GetIcon("checkbox"_XS8);
|
||||
Buttons[3] = GetIcon("checkbox_checked"_XS8);
|
||||
}
|
||||
|
||||
// non-selected background images
|
||||
@ -852,7 +852,7 @@ void XTheme::InitBar()
|
||||
if (ScrollbarBackgroundImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
//return OSIconsTable[i].image;
|
||||
ScrollbarBackgroundImage = GetIcon("scrollbar_background"_XS);
|
||||
ScrollbarBackgroundImage = GetIcon("scrollbar_background"_XS8);
|
||||
}
|
||||
if (ScrollbarBackgroundImage.isEmpty()) {
|
||||
ScrollbarBackgroundImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_bar_fill), ACCESS_EMB_SIZE(emb_scroll_bar_fill));
|
||||
@ -860,7 +860,7 @@ void XTheme::InitBar()
|
||||
}
|
||||
if (ScrollbarImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
ScrollbarImage = GetIcon("scrollbar_holder"_XS); //"_night" is already accounting
|
||||
ScrollbarImage = GetIcon("scrollbar_holder"_XS8); //"_night" is already accounting
|
||||
}
|
||||
if (ScrollbarImage.isEmpty()) {
|
||||
ScrollbarImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_scroll_fill), ACCESS_EMB_SIZE(emb_scroll_scroll_fill));
|
||||
@ -868,7 +868,7 @@ void XTheme::InitBar()
|
||||
}
|
||||
if (ScrollStartImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
ScrollStartImage = GetIcon("scrollbar_start"_XS);
|
||||
ScrollStartImage = GetIcon("scrollbar_start"_XS8);
|
||||
}
|
||||
if (ScrollStartImage.isEmpty()) {
|
||||
ScrollStartImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_scroll_start), ACCESS_EMB_SIZE(emb_scroll_scroll_start));
|
||||
@ -876,7 +876,7 @@ void XTheme::InitBar()
|
||||
}
|
||||
if (ScrollEndImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
ScrollEndImage = GetIcon("scrollbar_end"_XS);
|
||||
ScrollEndImage = GetIcon("scrollbar_end"_XS8);
|
||||
}
|
||||
if (ScrollEndImage.isEmpty()) {
|
||||
ScrollEndImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_scroll_end), ACCESS_EMB_SIZE(emb_scroll_scroll_end));
|
||||
@ -884,13 +884,13 @@ void XTheme::InitBar()
|
||||
}
|
||||
if (UpButtonImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
UpButtonImage = GetIcon("scrollbar_up_button"_XS);
|
||||
UpButtonImage = GetIcon("scrollbar_up_button"_XS8);
|
||||
}
|
||||
UpButtonImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_up_button), ACCESS_EMB_SIZE(emb_scroll_up_button));
|
||||
}
|
||||
if (DownButtonImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
DownButtonImage = GetIcon("scrollbar_down_button"_XS);
|
||||
DownButtonImage = GetIcon("scrollbar_down_button"_XS8);
|
||||
}
|
||||
if (DownButtonImage.isEmpty()) {
|
||||
DownButtonImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_down_button), ACCESS_EMB_SIZE(emb_scroll_down_button));
|
||||
|
@ -15,7 +15,7 @@ class Icon
|
||||
{
|
||||
public:
|
||||
INTN Id; //for example BUILTIN_ICON_POINTER
|
||||
XString Name; //for example "os_moja", "vol_internal"
|
||||
XString8 Name; //for example "os_moja", "vol_internal"
|
||||
XImage Image;
|
||||
XImage ImageNight;
|
||||
bool Native;
|
||||
@ -126,11 +126,11 @@ public:
|
||||
//fill the theme
|
||||
// const XImage& GetIcon(const char* Name);
|
||||
// const XImage& GetIcon(const CHAR16* Name);
|
||||
const XImage& GetIcon(const XString& Name); //get by name
|
||||
const XImage& GetIcon(const XString8& Name); //get by name
|
||||
const XImage& GetIcon(INTN Id); //get by id
|
||||
const XImage& GetIconAlt(INTN Id, INTN Alt); //if id not found
|
||||
const XImage& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider
|
||||
const XImage& LoadOSIcon(const XString& Full);
|
||||
const XImage& LoadOSIcon(const XString8& Full);
|
||||
bool CheckNative(INTN Id);
|
||||
|
||||
//fonts
|
||||
@ -140,7 +140,7 @@ public:
|
||||
INTN RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
||||
IN INTN PosX, IN INTN PosY, IN UINTN Cursor, INTN textType, float textScale = 0.f);
|
||||
//overload for UTF8 text
|
||||
INTN RenderText(IN const XString& Text, OUT XImage* CompImage_ptr,
|
||||
INTN RenderText(IN const XString8& Text, OUT XImage* CompImage_ptr,
|
||||
IN INTN PosX, IN INTN PosY, IN UINTN Cursor, INTN textType, float textScale = 0.f);
|
||||
VOID MeasureText(IN const XStringW& Text, OUT INTN *Width, OUT INTN *Height);
|
||||
|
||||
@ -151,7 +151,7 @@ public:
|
||||
EFI_STATUS GetThemeTagSettings(void* DictPointer);
|
||||
void parseTheme(void* p, const char** dict); //in nano project
|
||||
EFI_STATUS ParseSVGXTheme(const CHAR8* buffer); // in VectorTheme
|
||||
EFI_STATUS ParseSVGXIcon(INTN Id, const XString& IconNameX, XImage* Image);
|
||||
EFI_STATUS ParseSVGXIcon(INTN Id, const XString8& IconNameX, XImage* Image);
|
||||
void* LoadTheme(const CHAR16 *TestTheme); //return TagPtr why?
|
||||
EFI_STATUS LoadSvgFrame(INTN i, OUT XImage* XFrame); // for animation
|
||||
|
||||
|
@ -438,7 +438,7 @@ VOID egDumpGOPVideoModes(VOID);
|
||||
EFI_STATUS egSetMode(INT32 Next);
|
||||
|
||||
VOID egGetScreenSize(OUT INTN *ScreenWidth, OUT INTN *ScreenHeight);
|
||||
XString egScreenDescription(VOID);
|
||||
XString8 egScreenDescription(VOID);
|
||||
BOOLEAN egHasGraphicsMode(VOID);
|
||||
BOOLEAN egIsGraphicsModeEnabled(VOID);
|
||||
VOID egSetGraphicsModeEnabled(IN BOOLEAN Enable);
|
||||
|
@ -439,7 +439,7 @@ VOID egGetScreenSize(OUT INTN *ScreenWidth, OUT INTN *ScreenHeight)
|
||||
*ScreenHeight = egScreenHeight;
|
||||
}
|
||||
|
||||
XString egScreenDescription(VOID)
|
||||
XString8 egScreenDescription(VOID)
|
||||
{
|
||||
if (egHasGraphics) {
|
||||
if (GraphicsOutput != NULL) {
|
||||
@ -447,10 +447,10 @@ XString egScreenDescription(VOID)
|
||||
} else if (UgaDraw != NULL) {
|
||||
return SPrintf("UGA Draw (EFI 1.10), %lldx%lld", egScreenWidth, egScreenHeight);
|
||||
} else {
|
||||
return "Internal Error"_XS;
|
||||
return "Internal Error"_XS8;
|
||||
}
|
||||
} else {
|
||||
return "Text Console"_XS;
|
||||
return "Text Console"_XS8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ INTN XTheme::GetEmpty(const XImage& Buffer, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL&
|
||||
return m;
|
||||
}
|
||||
|
||||
INTN XTheme::RenderText(IN const XString& Text, OUT XImage* CompImage_ptr,
|
||||
INTN XTheme::RenderText(IN const XString8& Text, OUT XImage* CompImage_ptr,
|
||||
IN INTN PosX, IN INTN PosY, IN UINTN Cursor, INTN textType, float textScale)
|
||||
{
|
||||
const XStringW& UTF16Text = XStringW().takeValueFrom(Text.c_str());
|
||||
|
@ -248,6 +248,7 @@
|
||||
cpp_foundation/XStringArray.cpp
|
||||
cpp_foundation/XStringArray.h
|
||||
cpp_foundation/XStringArray.cpp
|
||||
cpp_foundation/XToolsCommon.h
|
||||
# cpp_foundation/XUINTN.cpp
|
||||
# cpp_foundation/XUINTN.h
|
||||
cpp_unit_test/all_tests.h
|
||||
|
@ -229,9 +229,9 @@ static EFI_STATUS StartEFILoadedImage(IN EFI_HANDLE ChildImageHandle,
|
||||
if (LoadOptionsPrefix != NULL) {
|
||||
// NOTE: That last space is also added by the EFI shell and seems to be significant
|
||||
// when passing options to Apple's boot.efi...
|
||||
loadOptionsW = SWPrintf("%ls %s ", LoadOptionsPrefix, LoadOptions.ConcatAll(" "_XS).wc_str());
|
||||
loadOptionsW = SWPrintf("%ls %s ", LoadOptionsPrefix, LoadOptions.ConcatAll(" "_XS8).wc_str());
|
||||
}else{
|
||||
loadOptionsW = SWPrintf("%s ", LoadOptions.ConcatAll(" "_XS).wc_str()); // Jief : should we add a space ? Wasn't the case before big refactoring. Yes, a space required.
|
||||
loadOptionsW = SWPrintf("%s ", LoadOptions.ConcatAll(" "_XS8).wc_str()); // Jief : should we add a space ? Wasn't the case before big refactoring. Yes, a space required.
|
||||
}
|
||||
// NOTE: We also include the terminating null in the length for safety.
|
||||
ChildLoadedImage->LoadOptionsSize = (UINT32)loadOptionsW.sizeInBytes() + sizeof(wchar_t);
|
||||
@ -749,7 +749,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
|
||||
// Set boot argument for kernel if no caches, this should force kernel loading
|
||||
if ( OSFLAG_ISSET(Flags, OSFLAG_NOCACHES) && !LoadOptions.containsStartWithIC("Kernel=") ) {
|
||||
XString KernelLocation;
|
||||
XString8 KernelLocation;
|
||||
|
||||
if (OSVersion && AsciiOSVersionToUint64(OSVersion) <= AsciiOSVersionToUint64("10.9")) {
|
||||
KernelLocation.SPrintf("\"Kernel=/mach_kernel\"");
|
||||
@ -774,7 +774,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
|
||||
// If KPDebug is true boot in verbose mode to see the debug messages
|
||||
if ((KernelAndKextPatches != NULL) && KernelAndKextPatches->KPDebug) {
|
||||
LoadOptions.AddID("-v"_XS);
|
||||
LoadOptions.AddID("-v"_XS8);
|
||||
}
|
||||
|
||||
DbgHeader("RestSetup macOS");
|
||||
@ -803,7 +803,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
!DoHibernateWake &&
|
||||
!LoadOptions.containsStartWithIC("slide=") ) {
|
||||
// Add slide=0 argument for ML+ if not present
|
||||
LoadOptions.AddID("slide=0"_XS);
|
||||
LoadOptions.AddID("slide=0"_XS8);
|
||||
}
|
||||
|
||||
|
||||
@ -817,7 +817,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
(AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.12")) &&
|
||||
(!LoadOptions.containsIC("-xcpm"))) {
|
||||
// add "-xcpm" argv if not present on Haswell+ Celeron/Pentium
|
||||
LoadOptions.AddID("-xcpm"_XS);
|
||||
LoadOptions.AddID("-xcpm"_XS8);
|
||||
}
|
||||
|
||||
// add -xcpm on Ivy Bridge if set KernelXCPM and system version is 10.8.5 - 10.11.x
|
||||
@ -827,7 +827,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
(AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.12")) &&
|
||||
(!LoadOptions.containsIC("-xcpm"))) {
|
||||
// add "-xcpm" argv if not present on Ivy Bridge
|
||||
LoadOptions.AddID("-xcpm"_XS);
|
||||
LoadOptions.AddID("-xcpm"_XS8);
|
||||
}
|
||||
|
||||
if (AudioIo) {
|
||||
@ -919,7 +919,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
// DBG("BeginExternalScreen\n");
|
||||
BeginExternalScreen(OSFLAG_ISSET(Flags, OSFLAG_USEGRAPHICS)/*, L"Booting OS"*/);
|
||||
|
||||
if (!OSTYPE_IS_WINDOWS(LoaderType)) {
|
||||
if (!OSTYPE_IS_WINDOWS(LoaderType) && !OSTYPE_IS_LINUX(LoaderType)) {
|
||||
if (OSFLAG_ISSET(Flags, OSFLAG_USEGRAPHICS)) {
|
||||
// save orig OutputString and replace it with
|
||||
// null implementation
|
||||
@ -2135,7 +2135,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
DBG(" string %ls, size=%lld, len=%lld sizeof=%ld iStrLen=%lld\n", aaa, StrSize(aaa), StrLen(aaa), sizeof(aaa), iStrLen(bbb, 10));
|
||||
const CHAR8* ccc = "Выход ";
|
||||
DBG(" string %s, size=%lld, len=%lld sizeof=%ld iStrLen=%lld\n", ccc, AsciiStrSize(ccc), AsciiStrLen(ccc), sizeof(ccc), iStrLen(ccc, 10));
|
||||
XString ddd = "Выход "_XS;
|
||||
XString8 ddd = "Выход "_XS8;
|
||||
// size_t sizex = ddd.allocatedSize();
|
||||
DBG(" xstring %s, asize=%ld, sizeinbyte=%ld sizeof=%ld lastcharat=%ld\n", ddd.c_str(), ddd.allocatedSize(), ddd.sizeInBytes(), sizeof(ddd),
|
||||
ddd.indexOf(ddd.lastChar()));
|
||||
@ -2362,12 +2362,17 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
}
|
||||
|
||||
|
||||
GetListOfDsdts(); //only after GetUserSettings
|
||||
GetListOfACPI(); //ssdt and other tables
|
||||
|
||||
AfterTool = FALSE;
|
||||
gGuiIsReady = TRUE;
|
||||
gBootChanged = TRUE;
|
||||
gThemeChanged = TRUE;
|
||||
do {
|
||||
if (gBootChanged && gThemeChanged) { // config changed
|
||||
GetListOfDsdts(); //only after GetUserSettings
|
||||
GetListOfACPI(); //ssdt and other tables
|
||||
}
|
||||
gBootChanged = FALSE;
|
||||
|
||||
MainMenu.Entries.Empty();
|
||||
OptionMenu.Entries.Empty();
|
||||
InitKextList();
|
||||
@ -2413,7 +2418,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
if (gThemeNeedInit) {
|
||||
InitTheme(TRUE, &Now);
|
||||
gThemeNeedInit = FALSE;
|
||||
gThemeChanged = TRUE;
|
||||
} else if (gThemeChanged) {
|
||||
DBG("change theme\n");
|
||||
InitTheme(FALSE, NULL);
|
||||
|
@ -1020,12 +1020,12 @@ VOID ApplyInputs(VOID)
|
||||
if (InputItems[i].Valid) {
|
||||
Status = LoadUserSettings(SelfRootDir, ConfigsList[OldChosenConfig], &dict);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
gBootChanged = TRUE;
|
||||
gThemeChanged = TRUE;
|
||||
Status = GetUserSettings(SelfRootDir, dict);
|
||||
if (gConfigDict[2]) FreeTag(gConfigDict[2]);
|
||||
gConfigDict[2] = dict;
|
||||
snwprintf(gSettings.ConfigName, 64, "%ls", ConfigsList[OldChosenConfig]);
|
||||
gBootChanged = TRUE;
|
||||
gThemeChanged = TRUE;
|
||||
snwprintf(gSettings.ConfigName, 64, "%ls", ConfigsList[OldChosenConfig]);
|
||||
}
|
||||
FillInputs(FALSE);
|
||||
NeedSave = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user