Skip to content

Commit

Permalink
Adding internal language modules library source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Mar 29, 2024
1 parent a693f8b commit 5b9e872
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 13 additions & 13 deletions libskrypt/skrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/dll/shared_library.hpp>

#include <iostream>
#include <fstream>
#include <iostream>
#include <string>


Expand Down Expand Up @@ -365,7 +365,7 @@ Skrypt::Skrypt(std::istream & stream)
}

boost::filesystem::path Skrypt::FindModulePath(std::string_view name) const {
auto path = sourceFilePath.parent_path() / name;
auto path = sourceFilePath.parent_path() / name;
if (!path.has_extension())
path.replace_extension(".skrypt");
if (!boost::filesystem::exists(path)) {
Expand Down Expand Up @@ -406,16 +406,16 @@ boost::filesystem::path Skrypt::FindModulePath(std::string_view name) const {

Skrypt::module_t Skrypt::GetLoadedModule(std::string_view fileName) const {
module_t loaded;
std::shared_lock lock(modulesMapMutex);
auto it = modules.find(fileName);
if (it != modules.end()) {
loaded = it->second;
}
return loaded;
std::shared_lock lock(modulesMapMutex);
auto it = modules.find(fileName);
if (it != modules.end()) {
loaded = it->second;
}
return loaded;
}

bool Skrypt::IsModuleLoading(std::string_view name) const {
std::shared_lock lock(modulesLoadingMutex);
std::shared_lock lock(modulesLoadingMutex);
return modulesLoading.contains(name);
}

Expand Down Expand Up @@ -473,7 +473,7 @@ Skrypt::module_t Skrypt::Module(std::string_view name) {
WaitTillModuleLoadingComplete(name);
}
}
return module;
return module;
}

Skrypt::loading_module_t Skrypt::StartLoadingModule(std::string_view moduleName) {
Expand Down Expand Up @@ -539,9 +539,9 @@ void Skrypt::BackgroudLoadingModules(const ::omnn::math::Valuable& v) {
}

std::string_view Skrypt::GetVariableName(const ::omnn::math::Variable& v) const {
auto host = v.getVaHost();
auto name = host->GetName(v.getId());
return name;
auto host = v.getVaHost();
auto name = host->GetName(v.getId());
return name;
}

std::string_view Skrypt::GetModuleName(std::string_view name) const {
Expand Down
2 changes: 2 additions & 0 deletions modules/physics/relativity.skrypt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

E=m*(c^2)

0 comments on commit 5b9e872

Please sign in to comment.