0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:Ⓜ️ Rename modules map to imports.

This commit is contained in:
Jason Volk 2018-08-14 15:51:57 -07:00
parent c00d27d7ea
commit 19b4e58944
3 changed files with 14 additions and 14 deletions

View file

@ -15,7 +15,7 @@ namespace ircd::m
{
template<class prototype> struct import;
extern std::map<std::string, ircd::module, std::less<>> modules;
extern std::map<std::string, ircd::module, std::less<>> imports;
}
template<class prototype>
@ -58,7 +58,7 @@ ircd::m::import<prototype>::reload()
try
{
auto &import(static_cast<mods::import<prototype> &>(*this));
import = { modules.at(modname), symname };
import = { imports.at(modname), symname };
}
catch(const std::out_of_range &e)
{

View file

@ -144,8 +144,8 @@ try
}
// Manually load first modules
m::modules.emplace("vm"s, "vm"s);
m::modules.emplace("vm_fetch"s, "vm_fetch"s);
m::imports.emplace("vm"s, "vm"s);
m::imports.emplace("vm_fetch"s, "vm_fetch"s);
// The order of these prefixes will be the loading order. Order of
// specific modules within a prefix is not determined here.
@ -158,10 +158,10 @@ try
for(const auto &prefix : prefixes)
for(const auto &name : mods::available())
if(startswith(name, prefix))
m::modules.emplace(name, name);
m::imports.emplace(name, name);
// Manually load last modules
m::modules.emplace("webroot"s, "webroot"s);
m::imports.emplace("webroot"s, "webroot"s);
}
catch(...)
{
@ -171,7 +171,7 @@ catch(...)
ircd::m::init::modules::~modules()
noexcept
{
m::modules.clear();
m::imports.clear();
}
namespace ircd::m
@ -3598,8 +3598,8 @@ ircd::m::_hook_match(const m::event &matching,
// m/import.h
//
decltype(ircd::m::modules)
ircd::m::modules
decltype(ircd::m::imports)
ircd::m::imports
{};
///////////////////////////////////////////////////////////////////////////////

View file

@ -751,7 +751,7 @@ console_cmd__mod__reload(opt &out, const string_view &line)
for(auto it(names.begin()); it != names.end(); ++it)
{
const auto &name{*it};
if(m::modules.erase(std::string{name}))
if(m::imports.erase(std::string{name}))
out << name << " unloaded." << std::endl;
else
out << name << " is not loaded." << std::endl;
@ -760,7 +760,7 @@ console_cmd__mod__reload(opt &out, const string_view &line)
for(auto it(names.rbegin()); it != names.rend(); ++it)
{
const auto &name{*it};
if(m::modules.emplace(std::string{name}, name).second)
if(m::imports.emplace(std::string{name}, name).second)
out << name << " loaded." << std::endl;
else
out << name << " is already loaded." << std::endl;
@ -775,13 +775,13 @@ console_cmd__mod__load(opt &out, const string_view &line)
tokens(line, ' ', [&out]
(const string_view &name)
{
if(m::modules.find(name) != end(m::modules))
if(m::imports.find(name) != end(m::imports))
{
out << name << " is already loaded." << std::endl;
return;
}
m::modules.emplace(std::string{name}, name);
m::imports.emplace(std::string{name}, name);
out << name << " loaded." << std::endl;
});
@ -794,7 +794,7 @@ console_cmd__mod__unload(opt &out, const string_view &line)
tokens(line, ' ', [&out]
(const string_view &name)
{
if(!m::modules.erase(std::string{name}))
if(!m::imports.erase(std::string{name}))
{
out << name << " is not loaded." << std::endl;
return;