1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Remove one further macro.

This commit is contained in:
Thomas Harte 2024-01-18 11:36:30 -05:00
parent ab4ecccf57
commit c619e353bd

View File

@ -303,10 +303,12 @@ Media Analyser::Static::GetMedia(const std::string &file_name) {
} }
TargetList Analyser::Static::GetTargets(const std::string &file_name) { TargetList Analyser::Static::GetTargets(const std::string &file_name) {
TargetList targets;
const std::string extension = get_extension(file_name); const std::string extension = get_extension(file_name);
TargetList targets;
// Check whether the file directly identifies a target; if so then just return that. // Check whether the file directly identifies a target; if so then just return that.
#define Format(ext, class) \ #define Format(ext, class) \
if(extension == ext) { \ if(extension == ext) { \
try { \ try { \
@ -333,30 +335,33 @@ TargetList Analyser::Static::GetTargets(const std::string &file_name) {
// Hand off to platform-specific determination of whether these // Hand off to platform-specific determination of whether these
// things are actually compatible and, if so, how to load them. // things are actually compatible and, if so, how to load them.
#define Append(x) if(potential_platforms & TargetPlatform::x) {\ const auto append = [&](TargetPlatform::IntType platform, auto evaluator) {
auto new_targets = x::GetTargets(media, file_name, potential_platforms);\ if(!(potential_platforms & platform)) {
std::move(new_targets.begin(), new_targets.end(), std::back_inserter(targets));\ return;
} }
Append(Acorn); auto new_targets = evaluator(media, file_name, potential_platforms);
Append(AmstradCPC); std::move(new_targets.begin(), new_targets.end(), std::back_inserter(targets));
Append(AppleII); };
Append(AppleIIgs);
Append(Amiga); append(TargetPlatform::Acorn, Acorn::GetTargets);
Append(Atari2600); append(TargetPlatform::AmstradCPC, AmstradCPC::GetTargets);
Append(AtariST); append(TargetPlatform::AppleII, AppleII::GetTargets);
Append(Coleco); append(TargetPlatform::AppleIIgs, AppleIIgs::GetTargets);
Append(Commodore); append(TargetPlatform::Amiga, Amiga::GetTargets);
Append(DiskII); append(TargetPlatform::Atari2600, Atari2600::GetTargets);
Append(Enterprise); append(TargetPlatform::AtariST, AtariST::GetTargets);
Append(FAT12); append(TargetPlatform::Coleco, Coleco::GetTargets);
Append(Macintosh); append(TargetPlatform::Commodore, Commodore::GetTargets);
Append(MSX); append(TargetPlatform::DiskII, DiskII::GetTargets);
Append(Oric); append(TargetPlatform::Enterprise, Enterprise::GetTargets);
Append(PCCompatible); append(TargetPlatform::FAT12, FAT12::GetTargets);
Append(Sega); append(TargetPlatform::Macintosh, Macintosh::GetTargets);
Append(ZX8081); append(TargetPlatform::MSX, MSX::GetTargets);
Append(ZXSpectrum); append(TargetPlatform::Oric, Oric::GetTargets);
#undef Append append(TargetPlatform::PCCompatible, PCCompatible::GetTargets);
append(TargetPlatform::Sega, Sega::GetTargets);
append(TargetPlatform::ZX8081, ZX8081::GetTargets);
append(TargetPlatform::ZXSpectrum, ZXSpectrum::GetTargets);
// Reset any tapes to their initial position. // Reset any tapes to their initial position.
for(const auto &target : targets) { for(const auto &target : targets) {