mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-28 21:49:27 +00:00
Eliminate final macro.
This commit is contained in:
parent
9cc572ee7f
commit
16add86372
@ -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) {
|
||||||
#define Format(ext, class) \
|
return false;
|
||||||
if(extension == ext) { \
|
|
||||||
try { \
|
|
||||||
auto target = Storage::State::class::load(file_name); \
|
|
||||||
if(target) { \
|
|
||||||
targets.push_back(std::move(target)); \
|
|
||||||
return targets; \
|
|
||||||
} \
|
|
||||||
} catch(...) {} \
|
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
auto target = loader(file_name);
|
||||||
|
if(target) {
|
||||||
|
targets.push_back(std::move(target));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch(...) {}
|
||||||
|
|
||||||
Format("sna", SNA);
|
return false;
|
||||||
Format("szx", SZX);
|
};
|
||||||
Format("z80", Z80);
|
|
||||||
|
|
||||||
#undef TryInsert
|
if(try_snapshot("sna", Storage::State::SNA::load)) return targets;
|
||||||
|
if(try_snapshot("szx", Storage::State::SZX::load)) return targets;
|
||||||
|
if(try_snapshot("z80", Storage::State::Z80::load)) return targets;
|
||||||
|
|
||||||
// Otherwise:
|
// Otherwise:
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user