1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-10 12:29:01 +00:00
CLK/StaticAnalyser/StaticAnalyser.cpp

45 lines
1.1 KiB
C++
Raw Normal View History

//
// StaticAnalyser.cpp
// Clock Signal
//
// Created by Thomas Harte on 23/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#include "StaticAnalyser.hpp"
#include <cstdlib>
2016-08-27 17:42:51 +00:00
using namespace StaticAnalyser;
std::list<Target> StaticAnalyser::GetTargets(const char *file_name)
2016-08-27 17:42:51 +00:00
{
std::list<Target> targets;
// 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
{
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
}
// 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
// Obtain the union of all platforms that
printf("Lowercase extension: %s", lowercase_extension);
2016-08-27 17:42:51 +00:00
free(lowercase_extension);
2016-08-27 17:42:51 +00:00
return targets;
}