From cd52f5efd6fce3230b5fefb2097aa2d885752da0 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Tue, 16 Mar 2021 17:30:28 +0100 Subject: [PATCH] rename TargetDescription into Target --- fxos/library.cpp | 4 ++-- include/fxos/library.h | 4 ++-- include/fxos/load.h | 2 +- include/fxos/vspace.h | 5 ++--- lib/library.cpp | 2 +- lib/load-target.l | 6 +++--- lib/vspace.cpp | 8 ++++---- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/fxos/library.cpp b/fxos/library.cpp index 93048c4..c92c6b3 100644 --- a/fxos/library.cpp +++ b/fxos/library.cpp @@ -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 ® = b.first; diff --git a/include/fxos/library.h b/include/fxos/library.h index f215564..47f01cb 100644 --- a/include/fxos/library.h +++ b/include/fxos/library.h @@ -33,7 +33,7 @@ struct Library return m_paths; } /* Targets loaded by exploration */ - const std::map &targets() { + const std::map &targets() { return m_targets; } /* Simple list of assembly tables */ @@ -47,7 +47,7 @@ struct Library private: std::vector m_paths; - std::map m_targets; + std::map m_targets; std::vector> m_asmtables; std::vector m_symtables; }; diff --git a/include/fxos/load.h b/include/fxos/load.h index d2ea92b..8ee4345 100644 --- a/include/fxos/load.h +++ b/include/fxos/load.h @@ -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 diff --git a/include/fxos/vspace.h b/include/fxos/vspace.h index 53adc48..64ee2bc 100644 --- a/include/fxos/vspace.h +++ b/include/fxos/vspace.h @@ -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; @@ -108,8 +108,7 @@ public: VirtualSpace(); /* Create a new virtual space with a target loaded. */ - VirtualSpace(TargetDescription const &description, - std::vector folders); + VirtualSpace(Target const &target,std::vector const &folders); /* MPU used by this target, or an empty string if unspecified */ std::string mpu; diff --git a/lib/library.cpp b/lib/library.cpp index e8e549d..4c07932 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -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; } diff --git a/lib/load-target.l b/lib/load-target.l index 8ccecd6..8f7a03e 100644 --- a/lib/load-target.l +++ b/lib/load-target.l @@ -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); } diff --git a/lib/vspace.cpp b/lib/vspace.cpp index 70364f8..827d685 100644 --- a/lib/vspace.cpp +++ b/lib/vspace.cpp @@ -114,11 +114,11 @@ VirtualSpace::VirtualSpace(): { } -VirtualSpace::VirtualSpace(TargetDescription const &descr, - std::vector folders): +VirtualSpace::VirtualSpace(Target const &target, + std::vector 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 ®ion,Buffer const &buffer)