mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
ircd:Ⓜ️ Rename modules map to imports.
This commit is contained in:
parent
c00d27d7ea
commit
19b4e58944
3 changed files with 14 additions and 14 deletions
|
@ -15,7 +15,7 @@ namespace ircd::m
|
||||||
{
|
{
|
||||||
template<class prototype> struct import;
|
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>
|
template<class prototype>
|
||||||
|
@ -58,7 +58,7 @@ ircd::m::import<prototype>::reload()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto &import(static_cast<mods::import<prototype> &>(*this));
|
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)
|
catch(const std::out_of_range &e)
|
||||||
{
|
{
|
||||||
|
|
14
ircd/m/m.cc
14
ircd/m/m.cc
|
@ -144,8 +144,8 @@ try
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually load first modules
|
// Manually load first modules
|
||||||
m::modules.emplace("vm"s, "vm"s);
|
m::imports.emplace("vm"s, "vm"s);
|
||||||
m::modules.emplace("vm_fetch"s, "vm_fetch"s);
|
m::imports.emplace("vm_fetch"s, "vm_fetch"s);
|
||||||
|
|
||||||
// The order of these prefixes will be the loading order. Order of
|
// The order of these prefixes will be the loading order. Order of
|
||||||
// specific modules within a prefix is not determined here.
|
// specific modules within a prefix is not determined here.
|
||||||
|
@ -158,10 +158,10 @@ try
|
||||||
for(const auto &prefix : prefixes)
|
for(const auto &prefix : prefixes)
|
||||||
for(const auto &name : mods::available())
|
for(const auto &name : mods::available())
|
||||||
if(startswith(name, prefix))
|
if(startswith(name, prefix))
|
||||||
m::modules.emplace(name, name);
|
m::imports.emplace(name, name);
|
||||||
|
|
||||||
// Manually load last modules
|
// Manually load last modules
|
||||||
m::modules.emplace("webroot"s, "webroot"s);
|
m::imports.emplace("webroot"s, "webroot"s);
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
@ -171,7 +171,7 @@ catch(...)
|
||||||
ircd::m::init::modules::~modules()
|
ircd::m::init::modules::~modules()
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
m::modules.clear();
|
m::imports.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ircd::m
|
namespace ircd::m
|
||||||
|
@ -3598,8 +3598,8 @@ ircd::m::_hook_match(const m::event &matching,
|
||||||
// m/import.h
|
// m/import.h
|
||||||
//
|
//
|
||||||
|
|
||||||
decltype(ircd::m::modules)
|
decltype(ircd::m::imports)
|
||||||
ircd::m::modules
|
ircd::m::imports
|
||||||
{};
|
{};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -751,7 +751,7 @@ console_cmd__mod__reload(opt &out, const string_view &line)
|
||||||
for(auto it(names.begin()); it != names.end(); ++it)
|
for(auto it(names.begin()); it != names.end(); ++it)
|
||||||
{
|
{
|
||||||
const auto &name{*it};
|
const auto &name{*it};
|
||||||
if(m::modules.erase(std::string{name}))
|
if(m::imports.erase(std::string{name}))
|
||||||
out << name << " unloaded." << std::endl;
|
out << name << " unloaded." << std::endl;
|
||||||
else
|
else
|
||||||
out << name << " is not loaded." << std::endl;
|
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)
|
for(auto it(names.rbegin()); it != names.rend(); ++it)
|
||||||
{
|
{
|
||||||
const auto &name{*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;
|
out << name << " loaded." << std::endl;
|
||||||
else
|
else
|
||||||
out << name << " is already loaded." << std::endl;
|
out << name << " is already loaded." << std::endl;
|
||||||
|
@ -775,13 +775,13 @@ console_cmd__mod__load(opt &out, const string_view &line)
|
||||||
tokens(line, ' ', [&out]
|
tokens(line, ' ', [&out]
|
||||||
(const string_view &name)
|
(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;
|
out << name << " is already loaded." << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m::modules.emplace(std::string{name}, name);
|
m::imports.emplace(std::string{name}, name);
|
||||||
out << name << " loaded." << std::endl;
|
out << name << " loaded." << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ console_cmd__mod__unload(opt &out, const string_view &line)
|
||||||
tokens(line, ' ', [&out]
|
tokens(line, ' ', [&out]
|
||||||
(const string_view &name)
|
(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;
|
out << name << " is not loaded." << std::endl;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue