2017-06-04 21:04:06 +00:00
|
|
|
//
|
|
|
|
// StaticAnalyser.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 04/06/2017.
|
|
|
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "StaticAnalyser.hpp"
|
|
|
|
|
2017-06-07 21:30:53 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "../../Storage/Tape/Parsers/ZX8081.hpp"
|
|
|
|
|
2017-06-08 23:09:51 +00:00
|
|
|
static std::vector<Storage::Data::ZX8081::File> GetFiles(const std::shared_ptr<Storage::Tape::Tape> &tape) {
|
|
|
|
std::vector<Storage::Data::ZX8081::File> files;
|
2017-06-07 21:30:53 +00:00
|
|
|
Storage::Tape::ZX8081::Parser parser;
|
|
|
|
|
|
|
|
while(!tape->is_at_end()) {
|
2017-06-08 23:09:51 +00:00
|
|
|
std::shared_ptr<Storage::Data::ZX8081::File> next_file = parser.get_next_file(tape);
|
2017-06-07 21:30:53 +00:00
|
|
|
if(next_file != nullptr) {
|
|
|
|
files.push_back(*next_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
|
2017-06-04 21:04:06 +00:00
|
|
|
void StaticAnalyser::ZX8081::AddTargets(
|
|
|
|
const std::list<std::shared_ptr<Storage::Disk::Disk>> &disks,
|
|
|
|
const std::list<std::shared_ptr<Storage::Tape::Tape>> &tapes,
|
|
|
|
const std::list<std::shared_ptr<Storage::Cartridge::Cartridge>> &cartridges,
|
|
|
|
std::list<StaticAnalyser::Target> &destination) {
|
2017-06-07 21:30:53 +00:00
|
|
|
|
|
|
|
if(!tapes.empty()) {
|
2017-06-08 23:09:51 +00:00
|
|
|
std::vector<Storage::Data::ZX8081::File> files = GetFiles(tapes.front());
|
2017-06-07 21:30:53 +00:00
|
|
|
if(!files.empty()) {
|
|
|
|
// TODO: check files for machine type, memory size.
|
|
|
|
StaticAnalyser::Target target;
|
|
|
|
target.machine = Target::ZX80;
|
|
|
|
target.tapes = tapes;
|
|
|
|
destination.push_back(target);
|
|
|
|
}
|
|
|
|
}
|
2017-06-04 21:04:06 +00:00
|
|
|
}
|