rename TargetDescription into Target

This commit is contained in:
Lephenixnoir 2021-03-16 17:30:28 +01:00
parent 245af5e993
commit cd52f5efd6
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
7 changed files with 15 additions and 16 deletions

View File

@ -5,11 +5,11 @@
using namespace FxOS;
/* Print the details of a single target on standard output */
void show_target(std::string name, TargetDescription const &tgt)
void show_target(std::string name, Target const &target)
{
printf(" %s:", name.c_str());
for(TargetDescription::Binding const &b: tgt.bindings)
for(Target::Binding const &b: target.bindings)
{
MemoryRegion const &reg = b.first;

View File

@ -33,7 +33,7 @@ struct Library
return m_paths;
}
/* Targets loaded by exploration */
const std::map<std::string, TargetDescription> &targets() {
const std::map<std::string, Target> &targets() {
return m_targets;
}
/* Simple list of assembly tables */
@ -47,7 +47,7 @@ struct Library
private:
std::vector<std::string> m_paths;
std::map<std::string, TargetDescription> m_targets;
std::map<std::string, Target> m_targets;
std::vector<std::pair<std::string, int>> m_asmtables;
std::vector<SymbolTable> m_symtables;
};

View File

@ -40,7 +40,7 @@ int load_asm(Buffer const &file, size_t offset, size_t line);
/* Load a target description into the target database. This function returns
the complete target description */
TargetDescription load_target(Buffer const &file, size_t offset, size_t line);
Target load_target(Buffer const &file, size_t offset, size_t line);
/* Load a symbol table into a previously allocated SymbolTable object. This
function populates the table by calls to add(), which may result in

View File

@ -91,7 +91,7 @@ struct Binding: public AbstractMemory
};
/* A target description in the database; loadable, but not loaded yet */
struct TargetDescription
struct Target
{
/* Just a list of bindings to be formed */
using Binding = std::pair<MemoryRegion,std::string>;
@ -108,8 +108,7 @@ public:
VirtualSpace();
/* Create a new virtual space with a target loaded. */
VirtualSpace(TargetDescription const &description,
std::vector<std::string> folders);
VirtualSpace(Target const &target,std::vector<std::string> const &folders);
/* MPU used by this target, or an empty string if unspecified */
std::string mpu;

View File

@ -79,7 +79,7 @@ void Library::load(std::string path)
return;
}
TargetDescription t = load_target(file, offset, line);
Target t = load_target(file, offset, line);
t.mpu = h["mpu"];
m_targets[h["name"]] = t;
}

View File

@ -105,10 +105,10 @@ static int expect(int type)
}
/* Load a target description into the target database. */
TargetDescription load_target(Buffer const &file, size_t offset, size_t line)
Target load_target(Buffer const &file, size_t offset, size_t line)
{
/* Build a target description without actually loading the files. */
TargetDescription descr;
Target descr;
YY_BUFFER_STATE buf = yy_scan_bytes(file.data.get() + offset,
file.size - offset);
@ -145,7 +145,7 @@ TargetDescription load_target(Buffer const &file, size_t offset, size_t line)
std::string path = yylval.path;
free(yylval.path);
TargetDescription::Binding b = std::make_pair(reg, path);
Target::Binding b = std::make_pair(reg, path);
descr.bindings.push_back(b);
}

View File

@ -114,11 +114,11 @@ VirtualSpace::VirtualSpace():
{
}
VirtualSpace::VirtualSpace(TargetDescription const &descr,
std::vector<std::string> folders):
VirtualSpace::VirtualSpace(Target const &target,
std::vector<std::string> const &folders):
VirtualSpace()
{
for(auto binding: descr.bindings)
for(auto binding: target.bindings)
{
MemoryRegion region = binding.first;
ssize_t size = (region.size() > 0 ? region.size() : -1);
@ -128,7 +128,7 @@ VirtualSpace::VirtualSpace(TargetDescription const &descr,
bind_region(region, *b);
}
this->mpu = descr.mpu;
this->mpu = target.mpu;
}
void VirtualSpace::bind_region(MemoryRegion const &region,Buffer const &buffer)