mirror of
https://github.com/open-goal/jak-project
synced 2026-07-08 14:36:52 -04:00
deps/fmt: code compiles now (untested)
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
#include "common/formatter/rules/rule_config.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/FileUtil.h"
|
||||
#include "common/util/ast_util.h"
|
||||
#include "common/util/string_util.h"
|
||||
|
||||
#include "tree_sitter/api.h"
|
||||
|
||||
#include "fmt/format.h"
|
||||
#include "fmt/ranges.h"
|
||||
|
||||
// Declare the `tree_sitter_opengoal` function, which is
|
||||
// implemented by the `tree-sitter-opengoal` library.
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "common/util/string_util.h"
|
||||
#include "common/util/unicode_util.h"
|
||||
|
||||
#include "fmt/args.h"
|
||||
#include "fmt/base.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
@@ -1770,26 +1771,16 @@ Object Interpreter::eval_format(const Object& form,
|
||||
throw_eval_error(form, "format string must be a string");
|
||||
}
|
||||
|
||||
std::vector<std::string> strings;
|
||||
fmt::dynamic_format_arg_store<fmt::format_context> arg_store;
|
||||
for (size_t i = 2; i < args.unnamed.size(); i++) {
|
||||
if (args.unnamed.at(i).is_string()) {
|
||||
strings.push_back(args.unnamed.at(i).as_string()->data);
|
||||
} else {
|
||||
strings.push_back(args.unnamed.at(i).print());
|
||||
}
|
||||
if (args.unnamed.at(i).is_string()) {
|
||||
arg_store.push_back(args.unnamed.at(i).as_string()->data);
|
||||
} else {
|
||||
arg_store.push_back(args.unnamed.at(i).print());
|
||||
}
|
||||
}
|
||||
|
||||
// Create a vector of fmt::format_arg
|
||||
std::vector<fmt::basic_format_arg<fmt::format_context>> fmt_args;
|
||||
for (auto& x : strings) {
|
||||
fmt_args.push_back(fmt::make_format_args<fmt::format_context>(x));
|
||||
}
|
||||
|
||||
// Format the string using the public API
|
||||
auto formatted = fmt::vformat(
|
||||
format_str.as_string()->data,
|
||||
fmt::basic_format_args(fmt_args.data(), static_cast<unsigned>(fmt_args.size()))
|
||||
);
|
||||
auto formatted = fmt::vformat(format_str.as_string()->data, arg_store);
|
||||
if (truthy(dest)) {
|
||||
lg::print("{}", formatted.c_str());
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ void print(const std::string& format, Args&&... args) {
|
||||
}
|
||||
template <typename... Args>
|
||||
void print(const fmt::text_style& ts, const std::string& format, Args&&... args) {
|
||||
std::string formatted_message = fmt::format(ts, format, std::forward<Args>(args)...);
|
||||
std::string formatted_message = fmt::vformat(ts, format, fmt::make_format_args(args...));
|
||||
internal::log_print(formatted_message.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "fmt/color.h"
|
||||
#include "fmt/format.h"
|
||||
#include "fmt/ranges.h"
|
||||
#include "third-party/replxx/include/replxx.hxx"
|
||||
|
||||
namespace REPL {
|
||||
@@ -41,7 +42,7 @@ void Wrapper::print_welcome_message(const std::vector<std::string>& loaded_proje
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " . --- .");
|
||||
message +=
|
||||
fmt::format(" Project Path: {}\n",
|
||||
fmt::format(fg(fmt::color::gray), file_util::get_jak_project_dir().string()));
|
||||
fmt::styled(file_util::get_jak_project_dir().string(), fg(fmt::color::gray)));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " - :===: -");
|
||||
std::string effective_iso_path;
|
||||
if (repl_config.iso_path.empty()) {
|
||||
@@ -50,7 +51,7 @@ void Wrapper::print_welcome_message(const std::vector<std::string>& loaded_proje
|
||||
effective_iso_path = repl_config.iso_path;
|
||||
}
|
||||
message +=
|
||||
fmt::format(" ISO Data Path: {}\n", fmt::format(fg(fmt::color::gray), effective_iso_path));
|
||||
fmt::format(" ISO Data Path: {}\n", fmt::styled(effective_iso_path, fg(fmt::color::gray)));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " --. .--: :--. .--");
|
||||
message += " nREPL:";
|
||||
if (!nrepl_alive) {
|
||||
@@ -63,7 +64,7 @@ void Wrapper::print_welcome_message(const std::vector<std::string>& loaded_proje
|
||||
message += " Source File Search Dirs: ";
|
||||
const auto search_dir_string =
|
||||
fmt::format("{}", fmt::join(repl_config.asm_file_search_dirs, ","));
|
||||
message += fmt::format("[{}]\n", fmt::format(fg(fmt::color::gray), search_dir_string));
|
||||
message += fmt::format("[{}]\n", fmt::styled(search_dir_string, fg(fmt::color::gray)));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .-=====-. .-=====-");
|
||||
message += fmt::format(" {} or {} for basic help and usage\n",
|
||||
fmt::format(fg(fmt::color::cyan), "(repl-help)"),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
@@ -849,4 +850,4 @@ void CPageManager::GarbageCollectPageList(jak3::CPageList* list) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace jak3
|
||||
} // namespace jak3
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/log/log.h"
|
||||
|
||||
#include "fmt/ranges.h"
|
||||
#include "third-party/SDL/include/SDL3/SDL.h"
|
||||
|
||||
namespace sdl_util {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <array>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "goalc/build_level/jak1/FileInfo.h"
|
||||
#include "goalc/build_level/jak1/LevelFile.h"
|
||||
|
||||
#include "fmt/ranges.h"
|
||||
|
||||
namespace jak1 {
|
||||
bool run_build_level(const std::string& input_file,
|
||||
const std::string& bsp_output_file,
|
||||
|
||||
Reference in New Issue
Block a user