fxos/lib/symbols.cpp

44 lines
1.1 KiB
C++

//---------------------------------------------------------------------------//
// 1100101 |_ mov #0, r4 __ //
// 11 |_ <0xb380 %5c4> / _|_ _____ ___ //
// 0110 |_ 3.50 -> 3.60 | _\ \ / _ (_-< //
// |_ base# + offset |_| /_\_\___/__/ //
//---------------------------------------------------------------------------//
#include <fxos/symbols.h>
#include <fxos/vspace.h>
namespace FxOS {
SymbolTable::SymbolTable()
{
}
void SymbolTable::add(Symbol s)
{
symbols.push_back(s);
}
std::optional<std::string> SymbolTable::query(
Symbol::Type type, uint32_t value) const
{
for(auto &sym: symbols) {
if(sym.type == type && sym.value == value)
return sym.name;
}
return std::nullopt;
}
std::optional<Symbol> SymbolTable::lookup(std::string name) const
{
for(auto &sym: symbols) {
if(sym.name == name)
return sym;
}
return std::nullopt;
}
} /* namespace FxOS */