2016-08-24 01:35:59 +00:00
|
|
|
//
|
|
|
|
// StaticAnalyser.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 23/08/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "StaticAnalyser.hpp"
|
2016-08-27 18:25:16 +00:00
|
|
|
#include <cstdlib>
|
2016-08-27 17:42:51 +00:00
|
|
|
|
|
|
|
using namespace StaticAnalyser;
|
|
|
|
|
2016-08-27 18:25:16 +00:00
|
|
|
std::list<Target> StaticAnalyser::GetTargets(const char *file_name)
|
2016-08-27 17:42:51 +00:00
|
|
|
{
|
|
|
|
std::list<Target> targets;
|
|
|
|
|
2016-08-27 18:25:16 +00:00
|
|
|
// Get the extension, if any; it will be assumed that extensions are reliable, so an extension is a broad-phase
|
|
|
|
// test as to file format.
|
|
|
|
const char *mixed_case_extension = strrchr(file_name, '.');
|
|
|
|
char *lowercase_extension = nullptr;
|
|
|
|
if(mixed_case_extension)
|
2016-08-27 17:42:51 +00:00
|
|
|
{
|
2016-08-27 18:25:16 +00:00
|
|
|
lowercase_extension = strdup(mixed_case_extension);
|
|
|
|
char *parser = lowercase_extension;
|
|
|
|
while(*parser)
|
|
|
|
{
|
|
|
|
*parser = (char)tolower(*parser);
|
|
|
|
parser++;
|
|
|
|
}
|
2016-08-27 17:42:51 +00:00
|
|
|
}
|
|
|
|
|
2016-08-27 18:25:16 +00:00
|
|
|
// Collect all disks, tapes and ROMs as can be extrapolated from this file, forming the
|
|
|
|
// union of all platforms this file might be a target for.
|
|
|
|
std::list<std::shared_ptr<Storage::Disk>> disks;
|
|
|
|
std::list<std::shared_ptr<Storage::Tape>> tapes;
|
2016-08-27 17:42:51 +00:00
|
|
|
|
2016-08-27 18:25:16 +00:00
|
|
|
// Obtain the union of all platforms that
|
|
|
|
|
|
|
|
printf("Lowercase extension: %s", lowercase_extension);
|
2016-08-27 17:42:51 +00:00
|
|
|
|
2016-08-27 18:25:16 +00:00
|
|
|
free(lowercase_extension);
|
2016-08-27 17:42:51 +00:00
|
|
|
return targets;
|
|
|
|
}
|