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

Eliminate final macro.

This commit is contained in:
Thomas Harte 2024-01-18 12:02:38 -05:00
parent 9cc572ee7f
commit 16add86372

View File

@ -307,24 +307,24 @@ TargetList Analyser::Static::GetTargets(const std::string &file_name) {
TargetList targets; 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.
const auto try_snapshot = [&](const char *ext, auto loader) -> bool {
if(extension != ext) {
return false;
}
try {
auto target = loader(file_name);
if(target) {
targets.push_back(std::move(target));
return true;
}
} catch(...) {}
return false;
};
#define Format(ext, class) \ if(try_snapshot("sna", Storage::State::SNA::load)) return targets;
if(extension == ext) { \ if(try_snapshot("szx", Storage::State::SZX::load)) return targets;
try { \ if(try_snapshot("z80", Storage::State::Z80::load)) return targets;
auto target = Storage::State::class::load(file_name); \
if(target) { \
targets.push_back(std::move(target)); \
return targets; \
} \
} catch(...) {} \
}
Format("sna", SNA);
Format("szx", SZX);
Format("z80", Z80);
#undef TryInsert
// Otherwise: // Otherwise:
// //