Skip to content

Commit

Permalink
refactor: remove srell
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed May 15, 2024
1 parent 7f7b2e8 commit 59546e1
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 66 deletions.
8 changes: 0 additions & 8 deletions AddressLibGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ add_project(
GROUPED_FILES
"src/main.cpp"
)

find_package(srell MODULE REQUIRED)

target_link_libraries(
"${PROJECT_NAME}"
PRIVATE
srell::srell
)
2 changes: 1 addition & 1 deletion AddressLibGen/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
## Build Dependencies
* [SRELL](https://www.akenotsuki.com/misc/srell/en/)
* None
8 changes: 4 additions & 4 deletions AddressLibGen/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <map>
#include <memory>
#include <optional>
#include <regex>
#include <set>
#include <sstream>
#include <string>
Expand All @@ -20,7 +21,6 @@
#include <utility>
#include <vector>

#include <srell.hpp>
#pragma warning(pop)

using namespace std::literals;
Expand Down Expand Up @@ -117,12 +117,12 @@ using files_t = std::vector<std::tuple<Version, Version, std::filesystem::path>>
[[nodiscard]] files_t get_files(const std::filesystem::path& a_root)
{
files_t results;
srell::wregex regex(L"(\\d+)\\.(\\d+)\\.(\\d+)_(\\d+)\\.(\\d+)\\.(\\d+)\\.txt"s, srell::regex::ECMAScript);
std::wregex regex(L"(\\d+)\\.(\\d+)\\.(\\d+)_(\\d+)\\.(\\d+)\\.(\\d+)\\.txt"s, std::regex::ECMAScript);
for (const auto& entry : std::filesystem::directory_iterator(a_root)) {
if (entry.is_regular_file()) {
const auto filename = entry.path().filename();
srell::wsmatch matches;
if (srell::regex_match(filename.native(), matches, regex) && matches.size() == 7) {
std::wsmatch matches;
if (std::regex_match(filename.native(), matches, regex) && matches.size() == 7) {
results.emplace_back();
auto& [lversion, rversion, path] = results.back();

Expand Down
2 changes: 0 additions & 2 deletions RTTIDump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ if(NOT TARGET CommonLibF4)
endif()

find_package(spdlog REQUIRED CONFIG)
find_package(srell MODULE REQUIRED)

target_link_libraries(
"${PROJECT_NAME}"
PUBLIC
CommonLibF4::CommonLibF4
Dbghelp.lib
spdlog::spdlog
srell::srell
)

copy_files(
Expand Down
4 changes: 3 additions & 1 deletion RTTIDump/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Build Dependencies
* [CommonLibF4](https://github.com/Ryan-rsm-McKenzie/CommonLibF4)
* [spdlog](https://github.com/gabime/spdlog)
* [SRELL](https://www.akenotsuki.com/misc/srell/en/)

## Note
Build with Release mode otherwise the dump will take ages
10 changes: 3 additions & 7 deletions RTTIDump/src/PCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@
#include <fstream>
#include <functional>
#include <memory>
#include <regex>
#include <span>
#include <tuple>
#include <unordered_set>
#include <utility>
#include <vector>

#include <srell.hpp>

#ifdef NDEBUG
# include <spdlog/sinks/basic_file_sink.h>
#else
# include <spdlog/sinks/msvc_sink.h>
#endif
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/msvc_sink.h>

#define DLLEXPORT extern "C" [[maybe_unused]] __declspec(dllexport)

Expand Down
23 changes: 11 additions & 12 deletions RTTIDump/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ class VTable
{
static const std::array expressions{
std::make_pair(
srell::regex{ R"regex((`anonymous namespace'|[ &'*\-`]){1})regex"s, srell::regex::ECMAScript },
std::function{ [](std::string& a_name, const srell::ssub_match& a_match) {
std::regex{ R"regex((`anonymous namespace'|[ &'*\-`]){1})regex"s, std::regex::ECMAScript },
std::function{ [](std::string& a_name, const std::ssub_match& a_match) {
a_name.erase(a_match.first, a_match.second);
} }),
std::make_pair(
srell::regex{ R"regex(([(),:<>]){1})regex"s, srell::regex::ECMAScript },
std::function{ [](std::string& a_name, const srell::ssub_match& a_match) {
std::regex{ R"regex(([(),:<>]){1})regex"s, std::regex::ECMAScript },
std::function{ [](std::string& a_name, const std::ssub_match& a_match) {
a_name.replace(a_match.first, a_match.second, "_"sv);
} }),
};

srell::smatch matches;
std::smatch matches;
for (const auto& [expr, callback] : expressions) {
while (srell::regex_search(a_name, matches, expr)) {
while (std::regex_search(a_name, matches, expr)) {
for (std::size_t i = 1; i < matches.size(); ++i) {
callback(a_name, matches[static_cast<int>(i)]);
}
Expand Down Expand Up @@ -389,20 +389,19 @@ void MessageHandler(F4SE::MessagingInterface::Message* a_message)

DLLEXPORT bool F4SEAPI F4SEPlugin_Load(const F4SE::LoadInterface* a_f4se)
{
#ifndef NDEBUG
auto sink = std::make_shared<spdlog::sinks::msvc_sink_mt>();
#else
auto path = logger::log_directory();
if (!path) {
return false;
}

*path /= "RTTIDump.log"sv;
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true);
#endif

auto log = std::make_shared<spdlog::logger>("global log", std::move(sink));
spdlog::sinks_init_list sinks{
std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true),
std::make_shared<spdlog::sinks::msvc_sink_mt>()
};

auto log = std::make_shared<spdlog::logger>("global", sinks);
#ifndef NDEBUG
log->set_level(spdlog::level::trace);
#else
Expand Down
30 changes: 0 additions & 30 deletions cmake/Findsrell.cmake

This file was deleted.

1 change: 0 additions & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"boost-stl-interfaces",
"rsm-mmio",
"spdlog",
"srell",
"xbyak"
]
}

0 comments on commit 59546e1

Please sign in to comment.