diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ae81123..305a06cb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: build-macos: name: Build macOS - runs-on: macos-latest + runs-on: macos-13 strategy: fail-fast: false matrix: @@ -86,6 +86,16 @@ jobs: fetch-depth: 0 lfs: false + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Install LLVM + run: brew install llvm + + - name: Add LLVM to PATH + run: | + echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH + - name: Add premake5 to PATH uses: abel0b/setup-premake@v2.3 with: @@ -119,7 +129,7 @@ jobs: - release arch: - x64 - - arm64 + # - arm64 steps: - name: Check out files uses: actions/checkout@v4 @@ -128,11 +138,15 @@ jobs: fetch-depth: 0 lfs: false - - name: Install dependencies (arm64) - if: matrix.arch == 'arm64' + - name: Install LLVM run: | - sudo apt-get update - sudo apt-get install crossbuild-essential-arm64 -y + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 17 + + # - name: Install dependencies (arm64) + # if: matrix.arch == 'arm64' + # run: sudo apt-get install crossbuild-essential-arm64 -y - name: Add premake5 to PATH uses: abel0b/setup-premake@v2.3 @@ -150,8 +164,8 @@ jobs: pushd build make config=${{matrix.config}}_${{matrix.arch}} -j$(nproc) env: - CC: clang - CXX: clang++ + CC: clang-17 + CXX: clang++-17 - name: Upload ${{matrix.arch}} ${{matrix.config}} binaries uses: actions/upload-artifact@v3.1.3 diff --git a/.gitmodules b/.gitmodules index 4ba6c4d2..49ffcf1a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,9 +2,6 @@ path = deps/zlib url = https://github.com/madler/zlib branch = master -[submodule "deps/fmt"] - path = deps/fmt - url = https://github.com/fmtlib/fmt [submodule "deps/cxxopts"] path = deps/cxxopts url = https://github.com/jarro2783/cxxopts.git diff --git a/deps/fmt b/deps/fmt deleted file mode 160000 index 67c0c0c0..00000000 --- a/deps/fmt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 67c0c0c09cf74d407d71a29c194761981614df3e diff --git a/deps/fmt.lua b/deps/fmt.lua deleted file mode 100644 index ebf7c59c..00000000 --- a/deps/fmt.lua +++ /dev/null @@ -1,31 +0,0 @@ -fmt = { base = path.join(dependencies.base, "fmt") } - -function fmt:include() - includedirs { path.join(fmt.base, "include") } -end - -function fmt:link() - links { "fmt" } - self:include() -end - -function fmt:project() - project "fmt" - kind "StaticLib" - language "C++" - - self:include() - - files - { - path.join(fmt.base, "include/fmt/*.h"), - path.join(fmt.base, "src/*.cc") - } - - removefiles - { - path.join(fmt.base, "src/fmt.cc") - } -end - -table.insert(dependencies, fmt) diff --git a/deps/zlib.lua b/deps/zlib.lua index 9b3c893f..af7453aa 100644 --- a/deps/zlib.lua +++ b/deps/zlib.lua @@ -15,24 +15,24 @@ function zlib:project() language "C" warnings "off" + if os.istarget("linux") or os.istarget("macosx") then + defines { + "HAVE_UNISTD_H" + } + elseif os.istarget("windows") then + defines { + "_CRT_SECURE_NO_WARNINGS", + "_CRT_NONSTDC_NO_DEPRECATE", + "_CRT_SECURE_NO_DEPRECATE", + } + end + self:include() - files - { + files { path.join(zlib.base, "*.h"), path.join(zlib.base, "*.c") } - - defines - { - "_CRT_SECURE_NO_WARNINGS", - "_CRT_NONSTDC_NO_DEPRECATE", - "_CRT_SECURE_NO_DEPRECATE", - } - - if os.istarget("darwin") then - defines "HAVE_UNISTD_H" - end end table.insert(dependencies, zlib) diff --git a/gen/arc/parser.ypp b/gen/arc/parser.ypp index 41263ce8..c5ca329e 100644 --- a/gen/arc/parser.ypp +++ b/gen/arc/parser.ypp @@ -517,13 +517,13 @@ stmt_for stmt_foreach : FOREACH LPAREN expr_identifier IN expr RPAREN stmt { - auto array = expr_identifier::make(@$, fmt::format("_a{}", ++index)); - auto key = expr_identifier::make(@$, fmt::format("_k{}", ++index)); + auto array = expr_identifier::make(@$, std::format("_a{}", ++index)); + auto key = expr_identifier::make(@$, std::format("_k{}", ++index)); $$ = stmt_foreach::make(@$, std::move($5), std::move($3), std::move(array), std::move(key), std::move($7), false); } | FOREACH LPAREN expr_identifier COMMA expr_identifier IN expr RPAREN stmt { - auto array = expr_identifier::make(@$, fmt::format("_a{}", ++index)); + auto array = expr_identifier::make(@$, std::format("_a{}", ++index)); $$ = stmt_foreach::make(@$, std::move($7), std::move($5), std::move(array), std::move($3), std::move($9), true); } ; @@ -1161,7 +1161,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type } } - throw error(fmt::format("unmapped token! {}", (u8)tok.type)); + throw error(std::format("unmapped token! {}", (u8)tok.type)); } auto ARClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type diff --git a/gen/gsc/parser.ypp b/gen/gsc/parser.ypp index c5561b8b..5aecb4d6 100644 --- a/gen/gsc/parser.ypp +++ b/gen/gsc/parser.ypp @@ -321,7 +321,7 @@ decl_constant : expr_identifier ASSIGN expr SEMICOLON { ppr.ban_header(@$); $$ = decl_constant::make(@$, std::move($1), std::move($3)); - printf("%s" , fmt::format("{}: constants deprecated, use #define instead\n", @$.print()).data()); + printf("%s" , std::format("{}: constants deprecated, use #define instead\n", @$.print()).data()); } ; @@ -496,14 +496,14 @@ stmt_for stmt_foreach : FOREACH LPAREN expr_identifier IN expr RPAREN stmt { - auto array = expr_identifier::make(@$, fmt::format("_temp_{}", ++index)); - auto key = expr_identifier::make(@$, fmt::format("_temp_{}", ++index)); + auto array = expr_identifier::make(@$, std::format("_temp_{}", ++index)); + auto key = expr_identifier::make(@$, std::format("_temp_{}", ++index)); $$ = stmt_foreach::make(@$, std::move($5), std::move($3), expr_empty::make(@$), std::move(array), std::move(key), std::move($7), false); } | FOREACH LPAREN expr_identifier COMMA expr_identifier IN expr RPAREN stmt { - auto array = expr_identifier::make(@$, fmt::format("_temp_{}", ++index)); - expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(@$, fmt::format("_temp_{}", ++index)) : std::move($3); + auto array = expr_identifier::make(@$, std::format("_temp_{}", ++index)); + expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(@$, std::format("_temp_{}", ++index)) : std::move($3); $$ = stmt_foreach::make(@$, std::move($7), std::move($5), (ctx_->props() & props::foreach) ? std::move($3) : (expr::ptr)expr_empty::make(@$), std::move(array), std::move(key), std::move($9), true); } ; @@ -821,7 +821,7 @@ expr_tuple : LBRACKET expr_tuple_arguments RBRACKET { $$ = std::move($2); - $$->as().temp = expr_identifier::make($$->loc(), fmt::format("_temp_{}", ++index)); + $$->as().temp = expr_identifier::make($$->loc(), std::format("_temp_{}", ++index)); } ; @@ -1088,7 +1088,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type } } - throw error(fmt::format("unmapped token! {}", (u8)tok.type)); + throw error(std::format("unmapped token! {}", (u8)tok.type)); } auto GSClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type diff --git a/include/xsk/arc/common/location.hpp b/include/xsk/arc/common/location.hpp index 7b2fc31e..dfc9dca8 100644 --- a/include/xsk/arc/common/location.hpp +++ b/include/xsk/arc/common/location.hpp @@ -119,12 +119,12 @@ public: auto print() const -> std::string { - return fmt::format("{}:{}:{}", *begin.filename, begin.line, begin.column); + return std::format("{}:{}:{}", *begin.filename, begin.line, begin.column); } auto label() const -> std::string { - return fmt::format("loc_{:X}", begin.line); + return std::format("loc_{:X}", begin.line); } }; diff --git a/include/xsk/gsc/common/location.hpp b/include/xsk/gsc/common/location.hpp index d8f0ca7d..229e5a9c 100644 --- a/include/xsk/gsc/common/location.hpp +++ b/include/xsk/gsc/common/location.hpp @@ -119,12 +119,12 @@ public: auto print() const -> std::string { - return fmt::format("{}:{}:{}", *begin.filename, begin.line, begin.column); + return std::format("{}:{}:{}", *begin.filename, begin.line, begin.column); } auto label() const -> std::string { - return fmt::format("loc_{:X}", begin.line); + return std::format("loc_{:X}", begin.line); } }; diff --git a/include/xsk/stdinc.hpp b/include/xsk/stdinc.hpp index ec3d31cb..d959b79c 100644 --- a/include/xsk/stdinc.hpp +++ b/include/xsk/stdinc.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -31,13 +32,6 @@ #include #include -#ifdef __cpp_lib_format -#include -namespace fmt = std; -#else -#include -#endif - #ifdef _WINDOWS_ #undef ERROR #undef IN diff --git a/premake5.lua b/premake5.lua index 9855d3bc..8041c08a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -84,7 +84,7 @@ workspace "gsc-tool" configurations { "debug", "release" } - if os.istarget("linux") or os.istarget("darwin") then + if os.istarget("linux") or os.istarget("macosx") then platforms { "x64", "arm64" } else platforms { "x86", "x64", "arm64" } @@ -119,23 +119,18 @@ workspace "gsc-tool" staticruntime "On" warnings "Extra" - filter { "system:linux", "system:macosx" } - buildoptions "-pthread" - linkoptions "-pthread" + filter "system:linux" + linkoptions "-fuse-ld=lld" filter {} - if os.istarget("linux") then - filter { "platforms:arm64" } - buildoptions "--target=arm64-linux-gnu" - linkoptions "--target=arm64-linux-gnu" - filter {} - - linkoptions "-fuse-ld=lld" - end + filter { "system:linux", "platforms:arm64" } + buildoptions "--target=arm64-linux-gnu" + linkoptions "--target=arm64-linux-gnu" + filter {} filter { "system:macosx", "platforms:arm64" } - buildoptions "-arch arm64" - linkoptions "-arch arm64" + buildoptions "-arch arm64" + linkoptions "-arch arm64" filter {} filter "configurations:release" @@ -178,7 +173,6 @@ project "xsk-tool" } cxxopts:link() - fmt:link() zlib:link() project "xsk-utils" @@ -195,7 +189,6 @@ project "xsk-utils" "./include", } - fmt:include() zlib:include() project "xsk-arc" @@ -212,8 +205,6 @@ project "xsk-arc" "./include", } - fmt:include() - project "xsk-gsc" kind "StaticLib" language "C++" @@ -228,8 +219,5 @@ project "xsk-gsc" "./include", } - fmt:include() - group "Dependencies" zlib:project() - fmt:project() diff --git a/src/arc/assembler.cpp b/src/arc/assembler.cpp index a94a7eee..e2fd2eb2 100644 --- a/src/arc/assembler.cpp +++ b/src/arc/assembler.cpp @@ -467,7 +467,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void assemble_end_switch(inst); break; default: - throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); + throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } @@ -533,7 +533,7 @@ auto assembler::assemble_end_switch(instruction const& inst) -> void } else { - throw asm_error(fmt::format("invalid switch case {}", inst.data[1 + (3 * i)])); + throw asm_error(std::format("invalid switch case {}", inst.data[1 + (3 * i)])); } } } @@ -846,7 +846,7 @@ auto assembler::align_instruction(instruction& inst) -> void break; } default: - throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); + throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } @@ -860,7 +860,7 @@ auto assembler::resolve_label(std::string const& name) -> i32 } } - throw asm_error(fmt::format("couldn't resolve label address of {}", name)); + throw asm_error(std::format("couldn't resolve label address of {}", name)); } auto assembler::resolve_string(std::string const& name) -> u16 @@ -872,7 +872,7 @@ auto assembler::resolve_string(std::string const& name) -> u16 return itr->second; } - throw asm_error(fmt::format("couldn't resolve string address of {}", name)); + throw asm_error(std::format("couldn't resolve string address of {}", name)); } void assembler::add_stringref(std::string const& str, string_type type, u32 ref) diff --git a/src/arc/common/exception.cpp b/src/arc/common/exception.cpp index c1f067b9..4278c204 100644 --- a/src/arc/common/exception.cpp +++ b/src/arc/common/exception.cpp @@ -10,27 +10,27 @@ namespace xsk::arc { -error::error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]: {}", what)) +error::error(std::string const& what) : std::runtime_error(std::format("[ERROR]: {}", what)) { } -asm_error::asm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:assembler: {}", what)) +asm_error::asm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:assembler: {}", what)) { } -disasm_error::disasm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:disassembler: {}", what)) +disasm_error::disasm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:disassembler: {}", what)) { } -ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:preprocessor:{}: {}", loc.print(), what)) +ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:preprocessor:{}: {}", loc.print(), what)) { } -comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:compiler:{}: {}", loc.print(), what)) +comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:compiler:{}: {}", loc.print(), what)) { } -decomp_error::decomp_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:decompiler: {}", what)) +decomp_error::decomp_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:decompiler: {}", what)) { } diff --git a/src/arc/compiler.cpp b/src/arc/compiler.cpp index dc73b371..d84baecc 100644 --- a/src/arc/compiler.cpp +++ b/src/arc/compiler.cpp @@ -49,7 +49,7 @@ auto compiler::emit_program(program const& prog) -> void for (auto const& entry : localfuncs_) { if (entry == name) - throw comp_error(dec->loc(), fmt::format("function name '{}' already defined as local function", name)); + throw comp_error(dec->loc(), std::format("function name '{}' already defined as local function", name)); } localfuncs_.push_back(dec->as().name->value); @@ -70,7 +70,7 @@ auto compiler::emit_include(include const& inc) -> void { if (entry == path) { - throw comp_error(inc.loc(), fmt::format("duplicated include file {}", path)); + throw comp_error(inc.loc(), std::format("duplicated include file {}", path)); } } @@ -322,7 +322,7 @@ auto compiler::emit_stmt_waittill(stmt_waittill const& stm) -> void if (entry->is()) emit_opcode(opcode::OP_SafeDecTop); else - emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, fmt::format("{}", variable_access(entry->as()))); + emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, std::format("{}", variable_access(entry->as()))); } emit_opcode(opcode::OP_ClearParams); @@ -333,7 +333,7 @@ auto compiler::emit_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void emit_expr_arguments(*stm.args); emit_expr(*stm.event); emit_expr(*stm.obj); - emit_opcode(opcode::OP_WaitTillMatch, fmt::format("{}", stm.args->list.size())); + emit_opcode(opcode::OP_WaitTillMatch, std::format("{}", stm.args->list.size())); emit_opcode(opcode::OP_ClearParams); } @@ -527,7 +527,7 @@ auto compiler::emit_stmt_foreach(stmt_foreach const& stm) -> void can_continue_ = true; emit_expr_variable(*stm.key); - emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(stm.array->as()))); + emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(stm.array->as()))); emit_opcode(opcode::OP_EvalArray); emit_expr_variable_ref(*stm.value, true); @@ -565,7 +565,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void can_break_ = true; auto data = std::vector{}; - data.push_back(fmt::format("{}", stm.body->block->list.size())); + data.push_back(std::format("{}", stm.body->block->list.size())); auto type = switch_type::none; auto loc_default = std::string{}; @@ -635,7 +635,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void data.push_back(loc_default); } - data.push_back(fmt::format("{}", static_cast>(type))); + data.push_back(std::format("{}", static_cast>(type))); insert_label(table_loc); emit_opcode(opcode::OP_EndSwitch, data); @@ -863,10 +863,10 @@ auto compiler::emit_expr_const(expr_const const& exp) -> void auto const itr = constants_.find(exp.lvalue->value); if (itr != constants_.end()) - throw comp_error(exp.loc(), fmt::format("duplicated constant '{}'", exp.lvalue->value)); + throw comp_error(exp.loc(), std::format("duplicated constant '{}'", exp.lvalue->value)); if (std::find(stackframe_.begin(), stackframe_.end(), exp.lvalue->value) != stackframe_.end()) - throw comp_error(exp.loc(), fmt::format("constant already defined as local variable '{}'", exp.lvalue->value)); + throw comp_error(exp.loc(), std::format("constant already defined as local variable '{}'", exp.lvalue->value)); constants_.insert({ exp.lvalue->value, exp.rvalue.get() }); } @@ -1120,7 +1120,7 @@ auto compiler::emit_expr_call_pointer(expr_pointer const& exp, bool is_stmt) -> emit_expr_arguments(*exp.args); emit_expr(*exp.func); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); switch (exp.mode) { @@ -1173,18 +1173,18 @@ auto compiler::emit_expr_call_function(expr_function const& exp, bool is_stmt) - emit_opcode(opcode::OP_PreScriptCall); emit_expr_arguments(*exp.args); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); auto flags = developer_thread_ ? static_cast(import_flags::developer) : 0; switch (exp.mode) { case call::mode::normal: flags |= static_cast(import_flags::func_call); - emit_opcode(opcode::OP_ScriptFunctionCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) }); + emit_opcode(opcode::OP_ScriptFunctionCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) }); break; case call::mode::thread: flags |= static_cast(import_flags::func_call_thread); - emit_opcode(opcode::OP_ScriptThreadCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) }); + emit_opcode(opcode::OP_ScriptThreadCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) }); break; default: break; @@ -1217,7 +1217,7 @@ auto compiler::emit_expr_method_pointer(expr_pointer const& exp, expr const& obj emit_expr(obj); emit_expr(*exp.func); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); switch (exp.mode) { @@ -1260,18 +1260,18 @@ auto compiler::emit_expr_method_function(expr_function const& exp, expr const& o emit_expr_arguments(*exp.args); emit_expr(obj); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); auto flags = developer_thread_ ? static_cast(import_flags::developer) : 0; switch (exp.mode) { case call::mode::normal: flags |= static_cast(import_flags::meth_call); - emit_opcode(opcode::OP_ScriptMethodCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) }); + emit_opcode(opcode::OP_ScriptMethodCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) }); break; case call::mode::thread: flags |= static_cast(import_flags::meth_call_thread); - emit_opcode(opcode::OP_ScriptMethodThreadCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) }); + emit_opcode(opcode::OP_ScriptMethodThreadCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) }); break; default: break; @@ -1456,7 +1456,7 @@ auto compiler::emit_expr_reference(expr_reference const& exp) -> void auto flags = developer_thread_ ? static_cast(import_flags::developer) : 0; flags |= static_cast(import_flags::func_reference); - emit_opcode(opcode::OP_GetFunction, { exp.path->value, exp.name->value, "0", fmt::format("{}", flags) }); + emit_opcode(opcode::OP_GetFunction, { exp.path->value, exp.name->value, "0", std::format("{}", flags) }); } auto compiler::emit_expr_size(expr_size const& exp) -> void @@ -1542,7 +1542,7 @@ auto compiler::emit_expr_field_ref(expr_field const& exp, bool set) -> void if (set) emit_opcode(opcode::OP_SetVariableField); break; case node::expr_identifier: - emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.obj->as()))); + emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.obj->as()))); emit_opcode(opcode::OP_CastFieldObject); emit_opcode(opcode::OP_EvalFieldVariableRef, field); if (set) emit_opcode(opcode::OP_SetVariableField); @@ -1570,10 +1570,10 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, bool set) -> void if (it != constants_.end()) { - throw comp_error(exp.loc(), fmt::format("variable name already defined as constant '{}'", exp.value)); + throw comp_error(exp.loc(), std::format("variable name already defined as constant '{}'", exp.value)); } - emit_opcode(opcode::OP_EvalLocalVariableRefCached, fmt::format("{}", variable_access(exp))); + emit_opcode(opcode::OP_EvalLocalVariableRefCached, std::format("{}", variable_access(exp))); if (set) { @@ -1645,7 +1645,7 @@ auto compiler::emit_expr_field(expr_field const& exp) -> void emit_opcode(opcode::OP_EvalFieldVariable, field); break; case node::expr_identifier: - emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.obj->as()))); + emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.obj->as()))); emit_opcode(opcode::OP_CastFieldObject); emit_opcode(opcode::OP_EvalFieldVariable, field); break; @@ -1661,7 +1661,7 @@ auto compiler::emit_expr_local(expr_identifier const& exp) -> void if (it != constants_.end()) emit_expr(*it->second); else - emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp))); + emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp))); } auto compiler::emit_expr_object(expr const& exp) -> void @@ -1694,7 +1694,7 @@ auto compiler::emit_expr_object(expr const& exp) -> void emit_opcode(opcode::OP_CastFieldObject); break; case node::expr_identifier: - emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.as()))); + emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.as()))); emit_opcode(opcode::OP_CastFieldObject); break; default: @@ -1785,7 +1785,7 @@ auto compiler::emit_expr_vector(expr_vector const& exp) -> void if (isconst) { - emit_opcode(opcode::OP_VectorConstant, fmt::format("{}", flags)); + emit_opcode(opcode::OP_VectorConstant, std::format("{}", flags)); } else { @@ -2156,7 +2156,7 @@ auto compiler::variable_access(expr_identifier const& exp) -> u8 } } - throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value)); + throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value)); } auto compiler::is_constant_condition(expr const& exp) -> bool @@ -2227,7 +2227,7 @@ auto compiler::insert_label() -> std::string else { label_idx_++; - auto name = fmt::format("loc_{}", label_idx_); + auto name = std::format("loc_{}", label_idx_); function_->labels.insert({ index_, name }); return name; } @@ -2236,7 +2236,7 @@ auto compiler::insert_label() -> std::string auto compiler::create_label() -> std::string { label_idx_++; - return fmt::format("loc_{}", label_idx_); + return std::format("loc_{}", label_idx_); } } // namespace xsk::arc diff --git a/src/arc/context.cpp b/src/arc/context.cpp index 5c0a55e9..29018e2e 100644 --- a/src/arc/context.cpp +++ b/src/arc/context.cpp @@ -206,7 +206,7 @@ auto context::opcode_size(opcode op) const -> u32 case opcode::OP_GetVector: return (props_ & props::size64) ? 14 : 13; default: - throw error(fmt::format("couldn't resolve instruction size for '{}'", opcode_name(op))); + throw error(std::format("couldn't resolve instruction size for '{}'", opcode_name(op))); } } @@ -219,7 +219,7 @@ auto context::opcode_id(opcode op) const -> u16 return itr->second; } - throw error(fmt::format("couldn't resolve opcode id for '{}'", opcode_name(op))); + throw error(std::format("couldn't resolve opcode id for '{}'", opcode_name(op))); } auto context::opcode_name(opcode op) const -> std::string @@ -231,7 +231,7 @@ auto context::opcode_name(opcode op) const -> std::string return std::string{ itr->second }; } - throw std::runtime_error(fmt::format("couldn't resolve opcode string for enum '{}'", static_cast>(op))); + throw std::runtime_error(std::format("couldn't resolve opcode string for enum '{}'", static_cast>(op))); } auto context::opcode_enum(std::string const& name) const -> opcode @@ -243,7 +243,7 @@ auto context::opcode_enum(std::string const& name) const -> opcode return itr->second; } - throw std::runtime_error(fmt::format("couldn't resolve opcode enum for name '{}'", name)); + throw std::runtime_error(std::format("couldn't resolve opcode enum for name '{}'", name)); } auto context::opcode_enum(u16 id) const -> opcode @@ -302,7 +302,7 @@ auto context::hash_name(u32 id) const -> std::string return std::string(itr->second); } - return fmt::format("_id_{:08X}", id); + return std::format("_id_{:08X}", id); } auto context::make_token(std::string_view str) const -> std::string @@ -344,7 +344,7 @@ auto context::load_header(std::string const& name) -> std::tuple, opcode_count> const opcode_list diff --git a/src/arc/decompiler.cpp b/src/arc/decompiler.cpp index 2f154abb..db9b5e01 100644 --- a/src/arc/decompiler.cpp +++ b/src/arc/decompiler.cpp @@ -86,7 +86,7 @@ auto decompiler::decompile_function(function const& func) -> void } auto& list = func_->body->block->list; - locs_.end = fmt::format("loc_{:X}", list.back()->loc().begin.line + 1); + locs_.end = std::format("loc_{:X}", list.back()->loc().begin.line + 1); decompile_statements(*func_->body->block); @@ -1137,7 +1137,7 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo case opcode::OP_EvalLocalVariableCachedDebug: case opcode::OP_EvalLocalVariableRefCachedDebug: default: - throw decomp_error(fmt::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode))); + throw decomp_error(std::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode))); } } @@ -1933,7 +1933,7 @@ auto decompiler::find_location_index(stmt_list const& stm, std::string const& lo index++; } - throw decomp_error(fmt::format("location '{}' not found", loc)); + throw decomp_error(std::format("location '{}' not found", loc)); } auto decompiler::last_location_index(stmt_list const& stm, usize index) -> bool @@ -1992,7 +1992,7 @@ auto decompiler::resolve_label(std::string const& name) -> u32 } } - throw decomp_error(fmt::format("couldn't resolve label address of '{}'", name)); + throw decomp_error(std::format("couldn't resolve label address of '{}'", name)); } auto decompiler::process_function(decl_function& func) -> void diff --git a/src/arc/disassembler.cpp b/src/arc/disassembler.cpp index 588f9172..7852269a 100644 --- a/src/arc/disassembler.cpp +++ b/src/arc/disassembler.cpp @@ -476,17 +476,17 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void break; case opcode::OP_GetByte: case opcode::OP_GetNegByte: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetUnsignedShort: case opcode::OP_GetNegUnsignedShort: inst.size += script_.align(2); - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetInteger: inst.size += script_.align(4); disassemble_animtree(inst); - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetFloat: inst.size += script_.align(4); @@ -496,7 +496,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void //case opcode::OP_ProfileStart: case opcode::OP_GetAPIFunction: inst.size += script_.align(8); - inst.data.push_back(fmt::format("0x{:016X}", script_.read())); + inst.data.push_back(std::format("0x{:016X}", script_.read())); break; case opcode::OP_GetVector: inst.size += script_.align(4); @@ -512,10 +512,10 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void disassemble_animation(inst); break; case opcode::OP_WaitTillMatch: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_VectorConstant: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetHash: inst.size += script_.align(4); @@ -535,7 +535,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void case opcode::OP_EvalLocalArrayRefCached: case opcode::OP_SafeSetWaittillVariableFieldCached: case opcode::OP_EvalLocalVariableRefCached: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_EvalFieldVariable: case opcode::OP_EvalFieldVariableRef: @@ -553,7 +553,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void case opcode::OP_ScriptMethodCallPointer: case opcode::OP_ScriptThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetFunction: disassemble_import(inst); @@ -583,7 +583,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void disassemble_end_switch(inst); break; default: - throw disasm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); + throw disasm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } @@ -606,7 +606,7 @@ auto disassembler::disassemble_name(instruction& inst) -> void return; } - throw disasm_error(fmt::format("string reference not found at index {:04X}", inst.index)); + throw disasm_error(std::format("string reference not found at index {:04X}", inst.index)); } } @@ -620,7 +620,7 @@ auto disassembler::disassemble_params(instruction& inst) -> void { inst.size += script_.align(4) + 5; inst.data.push_back(ctx_->hash_name(script_.read())); - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); } else { @@ -644,7 +644,7 @@ auto disassembler::disassemble_import(instruction& inst) -> void return; } - throw disasm_error(fmt::format("import reference not found at index {:04X}", inst.index)); + throw disasm_error(std::format("import reference not found at index {:04X}", inst.index)); } auto disassembler::disassemble_string(instruction& inst) -> void @@ -660,7 +660,7 @@ auto disassembler::disassemble_string(instruction& inst) -> void return; } - throw disasm_error(fmt::format("string reference not found at index {:04X}", inst.index)); + throw disasm_error(std::format("string reference not found at index {:04X}", inst.index)); } auto disassembler::disassemble_animtree(instruction& inst) -> void @@ -695,7 +695,7 @@ auto disassembler::disassemble_animation(instruction& inst) -> void } } - throw disasm_error(fmt::format("animation reference not found at index {:04X}", inst.index)); + throw disasm_error(std::format("animation reference not found at index {:04X}", inst.index)); } auto disassembler::disassemble_jump(instruction& inst) -> void @@ -709,7 +709,7 @@ auto disassembler::disassemble_jump(instruction& inst) -> void else addr = script_.read() + script_.pos(); - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -720,7 +720,7 @@ auto disassembler::disassemble_switch(instruction& inst) -> void inst.size += script_.align(4); auto const addr = script_.read() + script_.pos(); - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -738,7 +738,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void { if (entry->opcode == opcode::OP_Switch && entry->data[0] == itr->second) { - auto const label = fmt::format("loc_{:X}", inst.index); + auto const label = std::format("loc_{:X}", inst.index); entry->data[0] = label; func_->labels.erase(script_.pos()); @@ -754,7 +754,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void auto type = switch_type::none; auto const count = script_.read(); - inst.data.push_back(fmt::format("{}", count)); + inst.data.push_back(std::format("{}", count)); for (auto i = 0u; i < count; i++) { @@ -777,7 +777,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void { type = switch_type::integer; inst.data.push_back("case"); - inst.data.push_back(fmt::format("{}", value)); + inst.data.push_back(std::format("{}", value)); } } else @@ -798,12 +798,12 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void { type = switch_type::integer; inst.data.push_back("case"); - inst.data.push_back(fmt::format("{}", (value - 0x800000) & 0xFFFFFF)); + inst.data.push_back(std::format("{}", (value - 0x800000) & 0xFFFFFF)); } } auto const addr = script_.read() + script_.pos(); - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -811,7 +811,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void inst.size += 8; } - inst.data.push_back(fmt::format("{}", static_cast>(type))); + inst.data.push_back(std::format("{}", static_cast>(type))); } } // namespace xsk::arc diff --git a/src/arc/lexer.cpp b/src/arc/lexer.cpp index f716783b..a0644b57 100644 --- a/src/arc/lexer.cpp +++ b/src/arc/lexer.cpp @@ -327,7 +327,7 @@ auto lexer::lex() -> token else if (last == '_' || (last >= 'A' && last <= 'Z') || (last >= 'a' && last <= 'z')) goto lex_name; - throw comp_error(loc_, fmt::format("bad token: '{}'", last)); + throw comp_error(loc_, std::format("bad token: '{}'", last)); } lex_string: diff --git a/src/arc/parser.cpp b/src/arc/parser.cpp index c95db62c..6d1d8bb5 100644 --- a/src/arc/parser.cpp +++ b/src/arc/parser.cpp @@ -1807,7 +1807,7 @@ namespace xsk { namespace arc { int yylen = 0; // Error handling. - int yynerrs_ = 0; + [[maybe_unused]] int yynerrs_ = 0; int yyerrstatus_ = 0; /// The lookahead symbol. @@ -2836,8 +2836,8 @@ namespace xsk { namespace arc { case 87: // stmt_foreach: "foreach" "(" expr_identifier "in" expr ")" stmt #line 519 "parser.ypp" { - auto array = expr_identifier::make(yylhs.location, fmt::format("_a{}", ++index)); - auto key = expr_identifier::make(yylhs.location, fmt::format("_k{}", ++index)); + auto array = expr_identifier::make(yylhs.location, std::format("_a{}", ++index)); + auto key = expr_identifier::make(yylhs.location, std::format("_k{}", ++index)); yylhs.value.as < stmt_foreach::ptr > () = stmt_foreach::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr_identifier::ptr > ()), std::move(array), std::move(key), std::move(yystack_[0].value.as < stmt::ptr > ()), false); } #line 2850 "parser.cpp" @@ -2846,7 +2846,7 @@ namespace xsk { namespace arc { case 88: // stmt_foreach: "foreach" "(" expr_identifier "," expr_identifier "in" expr ")" stmt #line 525 "parser.ypp" { - auto array = expr_identifier::make(yylhs.location, fmt::format("_a{}", ++index)); + auto array = expr_identifier::make(yylhs.location, std::format("_a{}", ++index)); yylhs.value.as < stmt_foreach::ptr > () = stmt_foreach::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr_identifier::ptr > ()), std::move(array), std::move(yystack_[6].value.as < expr_identifier::ptr > ()), std::move(yystack_[0].value.as < stmt::ptr > ()), true); } #line 2859 "parser.cpp" @@ -5609,7 +5609,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type } } - throw error(fmt::format("unmapped token! {}", (u8)tok.type)); + throw error(std::format("unmapped token! {}", (u8)tok.type)); } auto ARClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type diff --git a/src/arc/preprocessor.cpp b/src/arc/preprocessor.cpp index 9db17a27..09780ceb 100644 --- a/src/arc/preprocessor.cpp +++ b/src/arc/preprocessor.cpp @@ -97,12 +97,12 @@ auto preprocessor::push_header(std::string const& file) -> void { try { - auto name = fmt::format("{}.gsh", file); + auto name = std::format("{}.gsh", file); for (auto& inc : includes_) { if (inc == name) - throw ppr_error(location{}, fmt::format("recursive header inclusion {} at {}", name, includes_.back())); + throw ppr_error(location{}, std::format("recursive header inclusion {} at {}", name, includes_.back())); } auto data = ctx_->load_header(name); @@ -112,7 +112,7 @@ auto preprocessor::push_header(std::string const& file) -> void } catch (std::exception const& e) { - throw error(fmt::format("parsing header file '{}': {}", file, e.what())); + throw error(std::format("parsing header file '{}': {}", file, e.what())); } } @@ -252,7 +252,7 @@ auto preprocessor::read_directive(token& tok) -> void } } - throw ppr_error(next.pos, fmt::format("invalid preprocessing directive '{}'", next.data)); + throw ppr_error(next.pos, std::format("invalid preprocessing directive '{}'", next.data)); } auto preprocessor::read_directive_if(token&) -> void @@ -763,7 +763,7 @@ auto preprocessor::expand(token& tok, define& def) -> void } else if (tok.data == "__LINE__") { - tokens_.push_front(token{ token::STRING, tok.space, tok.pos, fmt::format("{}", tok.pos.begin.line) }); + tokens_.push_front(token{ token::STRING, tok.space, tok.pos, std::format("{}", tok.pos.begin.line) }); } else if (tok.data == "__DATE__") { @@ -942,7 +942,7 @@ auto preprocessor::expect(token& tok, token::kind expected, spacing) -> void { if (tok.type != expected) { - throw ppr_error(tok.pos, fmt::format("expected {} found {}", (u8)expected, (u8)tok.type)); + throw ppr_error(tok.pos, std::format("expected {} found {}", (u8)expected, (u8)tok.type)); } } @@ -1095,7 +1095,7 @@ auto preprocessor::eval_consume(token::kind type, std::string_view msg) { if (eval_check(type)) return eval_next(); - throw ppr_error(eval_peek().pos, fmt::format("{}", msg)); + throw ppr_error(eval_peek().pos, std::format("{}", msg)); } auto preprocessor::eval_expr() -> i32 diff --git a/src/arc/source.cpp b/src/arc/source.cpp index 308e30e3..b86a0be7 100644 --- a/src/arc/source.cpp +++ b/src/arc/source.cpp @@ -51,7 +51,7 @@ auto source::parse_program(std::string const& name, u8 const* data, usize size) if (!psr.parse() && res != nullptr) return res; - throw error{ fmt::format("an unknown error ocurred while parsing script {}", name) }; + throw error{ std::format("an unknown error ocurred while parsing script {}", name) }; } auto source::dump(assembly const& data) -> std::vector @@ -59,8 +59,8 @@ auto source::dump(assembly const& data) -> std::vector buf_ = std::vector{}; buf_.reserve(0x10000); - fmt::format_to(std::back_inserter(buf_), "// {} GSC ASSEMBLY\n", ctx_->engine_name()); - fmt::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); + std::format_to(std::back_inserter(buf_), "// {} GSC ASSEMBLY\n", ctx_->engine_name()); + std::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); dump_assembly(data); @@ -72,8 +72,8 @@ auto source::dump(program const& data) -> std::vector buf_ = std::vector{}; buf_.reserve(0x10000); - fmt::format_to(std::back_inserter(buf_), "// {} GSC SOURCE\n", ctx_->engine_name()); - fmt::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); + std::format_to(std::back_inserter(buf_), "// {} GSC SOURCE\n", ctx_->engine_name()); + std::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); dump_program(data); @@ -90,7 +90,7 @@ auto source::dump_assembly(assembly const& data) -> void auto source::dump_function(function const& func) -> void { - fmt::format_to(std::back_inserter(buf_), "\nsub:{}\n", func.name); + std::format_to(std::back_inserter(buf_), "\nsub:{}\n", func.name); for (auto const& inst : func.instructions) { @@ -98,39 +98,39 @@ auto source::dump_function(function const& func) -> void if (itr != func.labels.end()) { - fmt::format_to(std::back_inserter(buf_), "\t{}\n", itr->second); + std::format_to(std::back_inserter(buf_), "\t{}\n", itr->second); } dump_instruction(*inst); } - fmt::format_to(std::back_inserter(buf_), "end:{}\n", func.name); + std::format_to(std::back_inserter(buf_), "end:{}\n", func.name); } auto source::dump_instruction(instruction const& inst) -> void { - fmt::format_to(std::back_inserter(buf_), "\t\t{}", ctx_->opcode_name(inst.opcode)); + std::format_to(std::back_inserter(buf_), "\t\t{}", ctx_->opcode_name(inst.opcode)); switch (inst.opcode) { case opcode::OP_GetString: case opcode::OP_GetIString: - fmt::format_to(std::back_inserter(buf_), " \"{}\"", inst.data[0]); + std::format_to(std::back_inserter(buf_), " \"{}\"", inst.data[0]); break; case opcode::OP_GetAnimation: - fmt::format_to(std::back_inserter(buf_), " \"{}\" \"{}\"", inst.data[0], inst.data[1]); + std::format_to(std::back_inserter(buf_), " \"{}\" \"{}\"", inst.data[0], inst.data[1]); break; // case opcode::OP_GetLocalFunction: // case opcode::OP_ScriptLocalFunctionCall: // case opcode::OP_ScriptLocalFunctionCall2: // case opcode::OP_ScriptLocalMethodCall: - // fmt::format_to(std::back_inserter(buf_), " {}", inst.data[0]); + // std::format_to(std::back_inserter(buf_), " {}", inst.data[0]); // break; // case opcode::OP_ScriptLocalThreadCall: // case opcode::OP_ScriptLocalChildThreadCall: // case opcode::OP_ScriptLocalMethodThreadCall: // case opcode::OP_ScriptLocalMethodChildThreadCall: - // fmt::format_to(std::back_inserter(buf_), " {} {}\n", inst.data[0], inst.data[1]); + // std::format_to(std::back_inserter(buf_), " {} {}\n", inst.data[0], inst.data[1]); // break; case opcode::OP_EndSwitch: { @@ -138,24 +138,24 @@ auto source::dump_instruction(instruction const& inst) -> void auto type = static_cast(std::stoul(inst.data.back())); auto index = 1; - fmt::format_to(std::back_inserter(buf_), " {}\n", count); + std::format_to(std::back_inserter(buf_), " {}\n", count); for (auto i = 0u; i < count; i++) { if (inst.data[index] == "case") { - auto data = (type == switch_type::integer) ? fmt::format("{}", inst.data[index + 1]) : fmt::format("\"{}\"", inst.data[index + 1]); - fmt::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 2]); + auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 1]) : std::format("\"{}\"", inst.data[index + 1]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 2]); index += 3; } else if (inst.data[index] == "default") { - fmt::format_to(std::back_inserter(buf_), "\t\t\t{} {}", inst.data[index], inst.data[index + 1]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {}", inst.data[index], inst.data[index + 1]); index += 2; } if (i != count - 1) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); } } break; @@ -163,12 +163,12 @@ auto source::dump_instruction(instruction const& inst) -> void default: for (auto const& entry : inst.data) { - fmt::format_to(std::back_inserter(buf_), " {}", entry); + std::format_to(std::back_inserter(buf_), " {}", entry); } break; } - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); } auto source::dump_program(program const& data) -> void @@ -180,7 +180,7 @@ auto source::dump_program(program const& data) -> void for (auto const& dec : data.declarations) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_decl(*dec); } } @@ -188,12 +188,12 @@ auto source::dump_program(program const& data) -> void auto source::dump_include(include const& inc) -> void { if (ctx_->props() & props::size64) - fmt::format_to(std::back_inserter(buf_), "#using "); + std::format_to(std::back_inserter(buf_), "#using "); else - fmt::format_to(std::back_inserter(buf_), "#include "); + std::format_to(std::back_inserter(buf_), "#include "); dump_expr_path(*inc.path); - fmt::format_to(std::back_inserter(buf_), ";\n"); + std::format_to(std::back_inserter(buf_), ";\n"); } auto source::dump_decl(decl const& dec) -> void @@ -225,26 +225,26 @@ auto source::dump_decl(decl const& dec) -> void auto source::dump_decl_dev_begin(decl_dev_begin const&) -> void { - fmt::format_to(std::back_inserter(buf_), "/#"); + std::format_to(std::back_inserter(buf_), "/#"); } auto source::dump_decl_dev_end(decl_dev_end const&) -> void { - fmt::format_to(std::back_inserter(buf_), "#/"); + std::format_to(std::back_inserter(buf_), "#/"); } auto source::dump_decl_namespace(decl_namespace const& dec) -> void { - fmt::format_to(std::back_inserter(buf_), "#namespace "); + std::format_to(std::back_inserter(buf_), "#namespace "); dump_expr_string(*dec.name); - fmt::format_to(std::back_inserter(buf_), ";\n"); + std::format_to(std::back_inserter(buf_), ";\n"); } auto source::dump_decl_usingtree(decl_usingtree const& dec) -> void { - fmt::format_to(std::back_inserter(buf_), "#using_animtree("); + std::format_to(std::back_inserter(buf_), "#using_animtree("); dump_expr_string(*dec.name); - fmt::format_to(std::back_inserter(buf_), ");\n"); + std::format_to(std::back_inserter(buf_), ");\n"); } auto source::dump_decl_function(decl_function const& dec) -> void @@ -252,36 +252,36 @@ auto source::dump_decl_function(decl_function const& dec) -> void indent_ = 0; if (ctx_->props() & props::spaces) - fmt::format_to(std::back_inserter(buf_), "function "); + std::format_to(std::back_inserter(buf_), "function "); if (static_cast(dec.flags) & static_cast(export_flags::export_private)) - fmt::format_to(std::back_inserter(buf_), "private "); + std::format_to(std::back_inserter(buf_), "private "); if (static_cast(dec.flags) & static_cast(export_flags::export_private2)) - fmt::format_to(std::back_inserter(buf_), "private "); + std::format_to(std::back_inserter(buf_), "private "); if (static_cast(dec.flags) & static_cast(export_flags::export_autoexec)) - fmt::format_to(std::back_inserter(buf_), "autoexec "); + std::format_to(std::back_inserter(buf_), "autoexec "); if (static_cast(dec.flags) & static_cast(export_flags::export_codecall)) - fmt::format_to(std::back_inserter(buf_), "codecall "); + std::format_to(std::back_inserter(buf_), "codecall "); if ((ctx_->props() & props::spaces) && !dec.space->value.empty()) { - fmt::format_to(std::back_inserter(buf_), "{}::", dec.space->value); + std::format_to(std::back_inserter(buf_), "{}::", dec.space->value); } dump_expr_identifier(*dec.name); - fmt::format_to(std::back_inserter(buf_), "("); + std::format_to(std::back_inserter(buf_), "("); dump_expr_parameters(*dec.params); - fmt::format_to(std::back_inserter(buf_), ")\n"); + std::format_to(std::back_inserter(buf_), ")\n"); dump_stmt_comp(*dec.body); - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); } auto source::dump_decl_empty(decl_empty const&) -> void { - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_stmt(stmt const& stm) -> void @@ -391,7 +391,7 @@ auto source::dump_stmt(stmt const& stm) -> void auto source::dump_stmt_empty(stmt_empty const&) -> void { - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_stmt_list(stmt_list const& stm) -> void @@ -402,7 +402,7 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void for (auto const& entry : stm.list) { if ((&entry != &stm.list.front() && entry->is_special_stmt()) || last_special) - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); if (entry->is()) { @@ -410,12 +410,12 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void } else { - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*entry); } if (&entry != &stm.list.back()) - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); if (entry->is_special_stmt()) last_special = true; @@ -428,17 +428,17 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void auto source::dump_stmt_comp(stmt_comp const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "{: >{}}\n", "{", indent_ + 1); + std::format_to(std::back_inserter(buf_), "{: >{}}\n", "{", indent_ + 1); dump_stmt_list(*stm.block); - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}", "}", indent_ + 1); + std::format_to(std::back_inserter(buf_), "\n{: >{}}", "}", indent_ + 1); } auto source::dump_stmt_dev(stmt_dev const& stm) -> void { indent_ -= 4; - fmt::format_to(std::back_inserter(buf_), "/#\n"); + std::format_to(std::back_inserter(buf_), "/#\n"); dump_stmt_list(*stm.block); - fmt::format_to(std::back_inserter(buf_), "\n#/"); + std::format_to(std::back_inserter(buf_), "\n#/"); indent_ += 4; } @@ -469,55 +469,55 @@ auto source::dump_stmt_expr(stmt_expr const& stm) -> void break; } - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_stmt_endon(stmt_endon const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " endon( "); + std::format_to(std::back_inserter(buf_), " endon( "); dump_expr(*stm.event); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } auto source::dump_stmt_notify(stmt_notify const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " notify( "); + std::format_to(std::back_inserter(buf_), " notify( "); dump_expr(*stm.event); if (stm.args->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); } else { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_wait(stmt_wait const& stm) -> void { if (stm.time->is() || stm.time->is()) { - fmt::format_to(std::back_inserter(buf_), "wait "); + std::format_to(std::back_inserter(buf_), "wait "); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } else if (stm.time->is()) { - fmt::format_to(std::back_inserter(buf_), "wait"); + std::format_to(std::back_inserter(buf_), "wait"); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } else { - fmt::format_to(std::back_inserter(buf_), "wait( "); + std::format_to(std::back_inserter(buf_), "wait( "); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } } @@ -525,66 +525,66 @@ auto source::dump_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void { if (stm.time->is()) { - fmt::format_to(std::back_inserter(buf_), "waitrealtime"); + std::format_to(std::back_inserter(buf_), "waitrealtime"); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } else { - fmt::format_to(std::back_inserter(buf_), "waitrealtime( "); + std::format_to(std::back_inserter(buf_), "waitrealtime( "); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } } auto source::dump_stmt_waittill(stmt_waittill const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " waittill( "); + std::format_to(std::back_inserter(buf_), " waittill( "); dump_expr(*stm.event); if (stm.args->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); } else { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " waittillmatch( "); + std::format_to(std::back_inserter(buf_), " waittillmatch( "); dump_expr(*stm.event); if (stm.args->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); } else { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_waittillframeend(stmt_waittillframeend const&) -> void { - fmt::format_to(std::back_inserter(buf_), "waittillframeend;"); + std::format_to(std::back_inserter(buf_), "waittillframeend;"); } auto source::dump_stmt_if(stmt_if const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "if ( "); + std::format_to(std::back_inserter(buf_), "if ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); if (stm.body->is()) { @@ -593,7 +593,7 @@ auto source::dump_stmt_if(stmt_if const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -601,9 +601,9 @@ auto source::dump_stmt_if(stmt_if const& stm) -> void auto source::dump_stmt_ifelse(stmt_ifelse const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "if ( "); + std::format_to(std::back_inserter(buf_), "if ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); if (stm.stmt_if->is()) { @@ -612,29 +612,29 @@ auto source::dump_stmt_ifelse(stmt_ifelse const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.stmt_if); indent_ -= 4; } - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}else", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}else", "", indent_); if (stm.stmt_else->is()) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_stmt(*stm.stmt_else); } else { if (stm.stmt_else->is() || stm.stmt_else ->is()) { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_stmt(*stm.stmt_else); } else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}", "", indent_); dump_stmt(*stm.stmt_else); indent_ -= 4; } @@ -645,13 +645,13 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void { if (stm.test->is()) { - fmt::format_to(std::back_inserter(buf_), "while ( true )\n"); + std::format_to(std::back_inserter(buf_), "while ( true )\n"); } else { - fmt::format_to(std::back_inserter(buf_), "while ( "); + std::format_to(std::back_inserter(buf_), "while ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); } if (stm.body->is()) @@ -661,7 +661,7 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -669,7 +669,7 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void auto source::dump_stmt_dowhile(stmt_dowhile const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "do\n"); + std::format_to(std::back_inserter(buf_), "do\n"); if (stm.body->is()) { @@ -678,20 +678,20 @@ auto source::dump_stmt_dowhile(stmt_dowhile const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } if (stm.test->is()) { - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}while ( true )", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}while ( true )", "", indent_); } else { - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}while (", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}while (", "", indent_); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } } @@ -699,19 +699,19 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void { if (stm.test->is()) { - fmt::format_to(std::back_inserter(buf_), "for (;;)\n"); + std::format_to(std::back_inserter(buf_), "for (;;)\n"); } else { - fmt::format_to(std::back_inserter(buf_), "for ( "); + std::format_to(std::back_inserter(buf_), "for ( "); dump_stmt(*stm.init); buf_.pop_back(); - fmt::format_to(std::back_inserter(buf_), "; "); + std::format_to(std::back_inserter(buf_), "; "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), "; "); + std::format_to(std::back_inserter(buf_), "; "); dump_stmt(*stm.iter); buf_.pop_back(); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); } if (stm.body->is()) @@ -721,7 +721,7 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -729,18 +729,18 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "foreach ( "); + std::format_to(std::back_inserter(buf_), "foreach ( "); if (stm.use_key) { dump_expr(*stm.key); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); } dump_expr(*stm.value); - fmt::format_to(std::back_inserter(buf_), " in "); + std::format_to(std::back_inserter(buf_), " in "); dump_expr(*stm.container); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); if (stm.body->is()) { @@ -749,7 +749,7 @@ auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -757,117 +757,117 @@ auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void auto source::dump_stmt_switch(stmt_switch const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "switch ( "); + std::format_to(std::back_inserter(buf_), "switch ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); dump_stmt_comp(*stm.body); } auto source::dump_stmt_case(stmt_case const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "case "); + std::format_to(std::back_inserter(buf_), "case "); dump_expr(*stm.value); - fmt::format_to(std::back_inserter(buf_), ":"); + std::format_to(std::back_inserter(buf_), ":"); if (stm.body != nullptr && stm.body->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_stmt_list(*stm.body); } } auto source::dump_stmt_default(stmt_default const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "default:"); + std::format_to(std::back_inserter(buf_), "default:"); if (stm.body != nullptr && stm.body->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_stmt_list(*stm.body); } } auto source::dump_stmt_break(stmt_break const&) -> void { - fmt::format_to(std::back_inserter(buf_), "break;"); + std::format_to(std::back_inserter(buf_), "break;"); } auto source::dump_stmt_continue(stmt_continue const&) -> void { - fmt::format_to(std::back_inserter(buf_), "continue;"); + std::format_to(std::back_inserter(buf_), "continue;"); } auto source::dump_stmt_return(stmt_return const& stm) -> void { if (stm.value->is()) { - fmt::format_to(std::back_inserter(buf_), "return;"); + std::format_to(std::back_inserter(buf_), "return;"); } else { - fmt::format_to(std::back_inserter(buf_), "return "); + std::format_to(std::back_inserter(buf_), "return "); dump_expr(*stm.value); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } } auto source::dump_stmt_breakpoint(stmt_breakpoint const&) -> void { - fmt::format_to(std::back_inserter(buf_), "breakpoint;"); + std::format_to(std::back_inserter(buf_), "breakpoint;"); } auto source::dump_stmt_prof_begin(stmt_prof_begin const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "prof_begin("); + std::format_to(std::back_inserter(buf_), "prof_begin("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_prof_end(stmt_prof_end const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "prof_end("); + std::format_to(std::back_inserter(buf_), "prof_end("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_jmp(stmt_jmp const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp( {} )", stm.value); } auto source::dump_stmt_jmp_back(stmt_jmp_back const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_back( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_back( {} )", stm.value); } auto source::dump_stmt_jmp_cond(stmt_jmp_cond const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_cond( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_cond( {} )", stm.value); } auto source::dump_stmt_jmp_true(stmt_jmp_true const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_expr_true( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_expr_true( {} )", stm.value); } auto source::dump_stmt_jmp_false(stmt_jmp_false const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_expr_false( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_expr_false( {} )", stm.value); } auto source::dump_stmt_jmp_switch(stmt_jmp_switch const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_switch( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_switch( {} )", stm.value); } auto source::dump_stmt_jmp_endswitch(stmt_jmp_endswitch const&) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_endswitch()"); + std::format_to(std::back_inserter(buf_), "__asm_endswitch()"); } auto source::dump_stmt_jmp_dev(stmt_jmp_dev const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_dev( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_dev( {} )", stm.value); } auto source::dump_expr(expr const& exp) -> void @@ -1048,13 +1048,13 @@ auto source::dump_expr_increment(expr_increment const& exp) -> void { if (exp.prefix) { - fmt::format_to(std::back_inserter(buf_), "++"); + std::format_to(std::back_inserter(buf_), "++"); dump_expr(*exp.lvalue); } else { dump_expr(*exp.lvalue); - fmt::format_to(std::back_inserter(buf_), "++"); + std::format_to(std::back_inserter(buf_), "++"); } } @@ -1062,13 +1062,13 @@ auto source::dump_expr_decrement(expr_decrement const& exp) -> void { if (exp.prefix) { - fmt::format_to(std::back_inserter(buf_), "--"); + std::format_to(std::back_inserter(buf_), "--"); dump_expr(*exp.lvalue); } else { dump_expr(*exp.lvalue); - fmt::format_to(std::back_inserter(buf_), "--"); + std::format_to(std::back_inserter(buf_), "--"); } } @@ -1079,37 +1079,37 @@ auto source::dump_expr_assign(expr_assign const& exp) -> void switch (exp.oper) { case expr_assign::op::eq: - fmt::format_to(std::back_inserter(buf_), " = "); + std::format_to(std::back_inserter(buf_), " = "); break; case expr_assign::op::add: - fmt::format_to(std::back_inserter(buf_), " += "); + std::format_to(std::back_inserter(buf_), " += "); break; case expr_assign::op::sub: - fmt::format_to(std::back_inserter(buf_), " -= "); + std::format_to(std::back_inserter(buf_), " -= "); break; case expr_assign::op::mul: - fmt::format_to(std::back_inserter(buf_), " *= "); + std::format_to(std::back_inserter(buf_), " *= "); break; case expr_assign::op::div: - fmt::format_to(std::back_inserter(buf_), " /= "); + std::format_to(std::back_inserter(buf_), " /= "); break; case expr_assign::op::mod: - fmt::format_to(std::back_inserter(buf_), " %= "); + std::format_to(std::back_inserter(buf_), " %= "); break; case expr_assign::op::shl: - fmt::format_to(std::back_inserter(buf_), " <<= "); + std::format_to(std::back_inserter(buf_), " <<= "); break; case expr_assign::op::shr: - fmt::format_to(std::back_inserter(buf_), " >>= "); + std::format_to(std::back_inserter(buf_), " >>= "); break; case expr_assign::op::bwor: - fmt::format_to(std::back_inserter(buf_), " |= "); + std::format_to(std::back_inserter(buf_), " |= "); break; case expr_assign::op::bwand: - fmt::format_to(std::back_inserter(buf_), " &= "); + std::format_to(std::back_inserter(buf_), " &= "); break; case expr_assign::op::bwexor: - fmt::format_to(std::back_inserter(buf_), " ^= "); + std::format_to(std::back_inserter(buf_), " ^= "); break; } @@ -1118,19 +1118,19 @@ auto source::dump_expr_assign(expr_assign const& exp) -> void auto source::dump_expr_const(expr_const const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "const "); + std::format_to(std::back_inserter(buf_), "const "); dump_expr_identifier(*exp.lvalue); - fmt::format_to(std::back_inserter(buf_), " = "); + std::format_to(std::back_inserter(buf_), " = "); dump_expr(*exp.rvalue); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_expr_ternary(expr_ternary const& exp) -> void { dump_expr(*exp.test); - fmt::format_to(std::back_inserter(buf_), " ? "); + std::format_to(std::back_inserter(buf_), " ? "); dump_expr(*exp.true_expr); - fmt::format_to(std::back_inserter(buf_), " : "); + std::format_to(std::back_inserter(buf_), " : "); dump_expr(*exp.false_expr); } @@ -1141,64 +1141,64 @@ auto source::dump_expr_binary(expr_binary const& exp) -> void switch (exp.oper) { case expr_binary::op::bool_or: - fmt::format_to(std::back_inserter(buf_), " || "); + std::format_to(std::back_inserter(buf_), " || "); break; case expr_binary::op::bool_and: - fmt::format_to(std::back_inserter(buf_), " && "); + std::format_to(std::back_inserter(buf_), " && "); break; case expr_binary::op::seq: - fmt::format_to(std::back_inserter(buf_), " === "); + std::format_to(std::back_inserter(buf_), " === "); break; case expr_binary::op::sne: - fmt::format_to(std::back_inserter(buf_), " !== "); + std::format_to(std::back_inserter(buf_), " !== "); break; case expr_binary::op::eq: - fmt::format_to(std::back_inserter(buf_), " == "); + std::format_to(std::back_inserter(buf_), " == "); break; case expr_binary::op::ne: - fmt::format_to(std::back_inserter(buf_), " != "); + std::format_to(std::back_inserter(buf_), " != "); break; case expr_binary::op::le: - fmt::format_to(std::back_inserter(buf_), " <= "); + std::format_to(std::back_inserter(buf_), " <= "); break; case expr_binary::op::ge: - fmt::format_to(std::back_inserter(buf_), " >= "); + std::format_to(std::back_inserter(buf_), " >= "); break; case expr_binary::op::lt: - fmt::format_to(std::back_inserter(buf_), " < "); + std::format_to(std::back_inserter(buf_), " < "); break; case expr_binary::op::gt: - fmt::format_to(std::back_inserter(buf_), " > "); + std::format_to(std::back_inserter(buf_), " > "); break; case expr_binary::op::add: - fmt::format_to(std::back_inserter(buf_), " + "); + std::format_to(std::back_inserter(buf_), " + "); break; case expr_binary::op::sub: - fmt::format_to(std::back_inserter(buf_), " - "); + std::format_to(std::back_inserter(buf_), " - "); break; case expr_binary::op::mul: - fmt::format_to(std::back_inserter(buf_), " * "); + std::format_to(std::back_inserter(buf_), " * "); break; case expr_binary::op::div: - fmt::format_to(std::back_inserter(buf_), " / "); + std::format_to(std::back_inserter(buf_), " / "); break; case expr_binary::op::mod: - fmt::format_to(std::back_inserter(buf_), " % "); + std::format_to(std::back_inserter(buf_), " % "); break; case expr_binary::op::shl: - fmt::format_to(std::back_inserter(buf_), " << "); + std::format_to(std::back_inserter(buf_), " << "); break; case expr_binary::op::shr: - fmt::format_to(std::back_inserter(buf_), " >> "); + std::format_to(std::back_inserter(buf_), " >> "); break; case expr_binary::op::bwor: - fmt::format_to(std::back_inserter(buf_), " | "); + std::format_to(std::back_inserter(buf_), " | "); break; case expr_binary::op::bwand: - fmt::format_to(std::back_inserter(buf_), " & "); + std::format_to(std::back_inserter(buf_), " & "); break; case expr_binary::op::bwexor: - fmt::format_to(std::back_inserter(buf_), " ^ "); + std::format_to(std::back_inserter(buf_), " ^ "); break; } @@ -1207,27 +1207,27 @@ auto source::dump_expr_binary(expr_binary const& exp) -> void auto source::dump_expr_not(expr_not const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "!"); + std::format_to(std::back_inserter(buf_), "!"); dump_expr(*exp.rvalue); } auto source::dump_expr_negate(expr_negate const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "-"); + std::format_to(std::back_inserter(buf_), "-"); dump_expr(*exp.rvalue); } auto source::dump_expr_complement(expr_complement const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "~"); + std::format_to(std::back_inserter(buf_), "~"); dump_expr(*exp.rvalue); } auto source::dump_expr_new(expr_new const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "new "); + std::format_to(std::back_inserter(buf_), "new "); dump_expr_identifier(*exp.name); - fmt::format_to(std::back_inserter(buf_), "()"); + std::format_to(std::back_inserter(buf_), "()"); } auto source::dump_expr_call(expr_call const& exp) -> void @@ -1238,7 +1238,7 @@ auto source::dump_expr_call(expr_call const& exp) -> void auto source::dump_expr_method(expr_method const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_call(*exp.value); } @@ -1263,57 +1263,57 @@ auto source::dump_call(call const& exp) -> void auto source::dump_expr_function(expr_function const& exp) -> void { if (exp.mode == call::mode::thread) - fmt::format_to(std::back_inserter(buf_), "thread "); + std::format_to(std::back_inserter(buf_), "thread "); if (!exp.path->value.empty()) { dump_expr_path(*exp.path); - fmt::format_to(std::back_inserter(buf_), "::"); + std::format_to(std::back_inserter(buf_), "::"); } dump_expr_identifier(*exp.name); - fmt::format_to(std::back_inserter(buf_), "("); + std::format_to(std::back_inserter(buf_), "("); dump_expr_arguments(*exp.args); - fmt::format_to(std::back_inserter(buf_), ")"); + std::format_to(std::back_inserter(buf_), ")"); } auto source::dump_expr_pointer(expr_pointer const& exp) -> void { if (exp.mode == call::mode::thread) - fmt::format_to(std::back_inserter(buf_), "thread "); + std::format_to(std::back_inserter(buf_), "thread "); - fmt::format_to(std::back_inserter(buf_), "[[ "); + std::format_to(std::back_inserter(buf_), "[[ "); dump_expr(*exp.func); - fmt::format_to(std::back_inserter(buf_), " ]]("); + std::format_to(std::back_inserter(buf_), " ]]("); dump_expr_arguments(*exp.args); - fmt::format_to(std::back_inserter(buf_), ")"); + std::format_to(std::back_inserter(buf_), ")"); } auto source::dump_expr_member(expr_member const& exp) -> void { if (exp.mode == call::mode::thread) - fmt::format_to(std::back_inserter(buf_), "thread "); + std::format_to(std::back_inserter(buf_), "thread "); - fmt::format_to(std::back_inserter(buf_), "[[ "); + std::format_to(std::back_inserter(buf_), "[[ "); dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), " ]]->"); + std::format_to(std::back_inserter(buf_), " ]]->"); dump_expr_identifier(*exp.name); - fmt::format_to(std::back_inserter(buf_), "("); + std::format_to(std::back_inserter(buf_), "("); dump_expr_arguments(*exp.args); - fmt::format_to(std::back_inserter(buf_), ")"); + std::format_to(std::back_inserter(buf_), ")"); } auto source::dump_expr_parameters(expr_parameters const& exp) -> void { for (auto const& entry : exp.list) { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_expr(*entry); if (&entry != &exp.list.back()) - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); else - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } } @@ -1321,167 +1321,167 @@ auto source::dump_expr_arguments(expr_arguments const& exp) -> void { for (auto const& entry : exp.list) { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_expr(*entry); if (&entry != &exp.list.back()) - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); else - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } } auto source::dump_expr_isdefined(expr_isdefined const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "isdefined( "); + std::format_to(std::back_inserter(buf_), "isdefined( "); dump_expr(*exp.value); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_vectorscale(expr_vectorscale const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "vectorscale( "); + std::format_to(std::back_inserter(buf_), "vectorscale( "); dump_expr(*exp.arg1); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); dump_expr(*exp.arg2); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_anglestoup(expr_anglestoup const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "anglestoup( "); + std::format_to(std::back_inserter(buf_), "anglestoup( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_anglestoright(expr_anglestoright const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "anglestoright( "); + std::format_to(std::back_inserter(buf_), "anglestoright( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_anglestoforward(expr_anglestoforward const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "anglestoforward( "); + std::format_to(std::back_inserter(buf_), "anglestoforward( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_angleclamp180(expr_angleclamp180 const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "angleclamp180( "); + std::format_to(std::back_inserter(buf_), "angleclamp180( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_vectortoangles(expr_vectortoangles const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "vectortoangles( "); + std::format_to(std::back_inserter(buf_), "vectortoangles( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_abs(expr_abs const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "abs( "); + std::format_to(std::back_inserter(buf_), "abs( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_gettime(expr_gettime const&) -> void { - fmt::format_to(std::back_inserter(buf_), "gettime()"); + std::format_to(std::back_inserter(buf_), "gettime()"); } auto source::dump_expr_getdvar(expr_getdvar const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvar( "); + std::format_to(std::back_inserter(buf_), "getdvar( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarint(expr_getdvarint const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarint( "); + std::format_to(std::back_inserter(buf_), "getdvarint( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarfloat(expr_getdvarfloat const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarfloat( "); + std::format_to(std::back_inserter(buf_), "getdvarfloat( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarvector(expr_getdvarvector const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarvector( "); + std::format_to(std::back_inserter(buf_), "getdvarvector( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarcolorred(expr_getdvarcolorred const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarcolorred( "); + std::format_to(std::back_inserter(buf_), "getdvarcolorred( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarcolorgreen(expr_getdvarcolorgreen const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarcolorgreen( "); + std::format_to(std::back_inserter(buf_), "getdvarcolorgreen( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarcolorblue(expr_getdvarcolorblue const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarcolorblue( "); + std::format_to(std::back_inserter(buf_), "getdvarcolorblue( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getdvarcoloralpha(expr_getdvarcoloralpha const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getdvarcoloralpha( "); + std::format_to(std::back_inserter(buf_), "getdvarcoloralpha( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getfirstarraykey(expr_getfirstarraykey const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getfirstarraykey( "); + std::format_to(std::back_inserter(buf_), "getfirstarraykey( "); dump_expr(*exp.arg); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_getnextarraykey(expr_getnextarraykey const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "getnextarraykey( "); + std::format_to(std::back_inserter(buf_), "getnextarraykey( "); dump_expr(*exp.arg1); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); dump_expr(*exp.arg2); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_reference(expr_reference const& exp) -> void { if (ctx_->props() & props::refvarg) { - fmt::format_to(std::back_inserter(buf_), "&"); + std::format_to(std::back_inserter(buf_), "&"); if (!exp.path->value.empty()) { dump_expr_path(*exp.path); - fmt::format_to(std::back_inserter(buf_), "::"); + std::format_to(std::back_inserter(buf_), "::"); } } else { dump_expr_path(*exp.path); - fmt::format_to(std::back_inserter(buf_), "::"); + std::format_to(std::back_inserter(buf_), "::"); } dump_expr_identifier(*exp.name); @@ -1490,140 +1490,140 @@ auto source::dump_expr_reference(expr_reference const& exp) -> void auto source::dump_expr_array(expr_array const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), "["); + std::format_to(std::back_inserter(buf_), "["); dump_expr(*exp.key); - fmt::format_to(std::back_inserter(buf_), "]"); + std::format_to(std::back_inserter(buf_), "]"); } auto source::dump_expr_field(expr_field const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), "."); + std::format_to(std::back_inserter(buf_), "."); dump_expr_identifier(*exp.field); } auto source::dump_expr_size(expr_size const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), ".size"); + std::format_to(std::back_inserter(buf_), ".size"); } auto source::dump_expr_paren(expr_paren const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "( "); + std::format_to(std::back_inserter(buf_), "( "); dump_expr(*exp.value); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_ellipsis(expr_ellipsis const&) -> void { - fmt::format_to(std::back_inserter(buf_), "..."); + std::format_to(std::back_inserter(buf_), "..."); } auto source::dump_expr_empty_array(expr_empty_array const&) -> void { - fmt::format_to(std::back_inserter(buf_), "[]"); + std::format_to(std::back_inserter(buf_), "[]"); } auto source::dump_expr_undefined(expr_undefined const&) -> void { - fmt::format_to(std::back_inserter(buf_), "undefined"); + std::format_to(std::back_inserter(buf_), "undefined"); } auto source::dump_expr_game(expr_game const&) -> void { - fmt::format_to(std::back_inserter(buf_), "game"); + std::format_to(std::back_inserter(buf_), "game"); } auto source::dump_expr_self(expr_self const&) -> void { - fmt::format_to(std::back_inserter(buf_), "self"); + std::format_to(std::back_inserter(buf_), "self"); } auto source::dump_expr_anim(expr_anim const&) -> void { - fmt::format_to(std::back_inserter(buf_), "anim"); + std::format_to(std::back_inserter(buf_), "anim"); } auto source::dump_expr_level(expr_level const&) -> void { - fmt::format_to(std::back_inserter(buf_), "level"); + std::format_to(std::back_inserter(buf_), "level"); } auto source::dump_expr_world(expr_world const&) -> void { - fmt::format_to(std::back_inserter(buf_), "world"); + std::format_to(std::back_inserter(buf_), "world"); } auto source::dump_expr_classes(expr_classes const&) -> void { - fmt::format_to(std::back_inserter(buf_), "classes"); + std::format_to(std::back_inserter(buf_), "classes"); } auto source::dump_expr_animation(expr_animation const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "%{}", exp.value); + std::format_to(std::back_inserter(buf_), "%{}", exp.value); } auto source::dump_expr_animtree(expr_animtree const&) -> void { - fmt::format_to(std::back_inserter(buf_), "#animtree"); + std::format_to(std::back_inserter(buf_), "#animtree"); } auto source::dump_expr_identifier(expr_identifier const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", exp.value); + std::format_to(std::back_inserter(buf_), "{}", exp.value); } auto source::dump_expr_path(expr_path const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", utils::string::backslash(exp.value)); + std::format_to(std::back_inserter(buf_), "{}", utils::string::backslash(exp.value)); } auto source::dump_expr_istring(expr_istring const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "&{}", utils::string::to_literal(exp.value)); + std::format_to(std::back_inserter(buf_), "&{}", utils::string::to_literal(exp.value)); } auto source::dump_expr_string(expr_string const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", utils::string::to_literal(exp.value)); + std::format_to(std::back_inserter(buf_), "{}", utils::string::to_literal(exp.value)); } auto source::dump_expr_hash(expr_hash const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "#{}", utils::string::to_literal(exp.value)); + std::format_to(std::back_inserter(buf_), "#{}", utils::string::to_literal(exp.value)); } auto source::dump_expr_vector(expr_vector const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "( "); + std::format_to(std::back_inserter(buf_), "( "); dump_expr(*exp.x); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); dump_expr(*exp.y); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); dump_expr(*exp.z); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_float(expr_float const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", exp.value); + std::format_to(std::back_inserter(buf_), "{}", exp.value); } auto source::dump_expr_integer(expr_integer const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", exp.value); + std::format_to(std::back_inserter(buf_), "{}", exp.value); } auto source::dump_expr_false(expr_false const&) -> void { - fmt::format_to(std::back_inserter(buf_), "false"); + std::format_to(std::back_inserter(buf_), "false"); } auto source::dump_expr_true(expr_true const&) -> void { - fmt::format_to(std::back_inserter(buf_), "true"); + std::format_to(std::back_inserter(buf_), "true"); } } // namespace xsk::arc diff --git a/src/gsc/assembler.cpp b/src/gsc/assembler.cpp index 7849efec..c538096d 100644 --- a/src/gsc/assembler.cpp +++ b/src/gsc/assembler.cpp @@ -326,7 +326,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void assemble_formal_params(inst); break; default: - throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); + throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } @@ -339,7 +339,7 @@ auto assembler::assemble_builtin_call(instruction const& inst, bool method, bool if (ctx_->props() & props::hash) { - stack_.write_cstr(fmt::format("#xS{:x}", ctx_->hash_id(inst.data[0]))); + stack_.write_cstr(std::format("#xS{:x}", ctx_->hash_id(inst.data[0]))); script_.write(0); } else @@ -477,7 +477,7 @@ auto assembler::assemble_end_switch(instruction const& inst) -> void } else { - throw asm_error(fmt::format("invalid switch case {}", inst.data[1 + (4 * i)])); + throw asm_error(std::format("invalid switch case {}", inst.data[1 + (4 * i)])); } } else @@ -513,7 +513,7 @@ auto assembler::assemble_end_switch(instruction const& inst) -> void } else { - throw asm_error(fmt::format("invalid switch case {}", inst.data[1 + (3 * i)])); + throw asm_error(std::format("invalid switch case {}", inst.data[1 + (3 * i)])); } } } @@ -619,7 +619,7 @@ auto assembler::resolve_function(std::string const& name) -> std::int32_t } } - throw asm_error(fmt::format("couldn't resolve local function address of {}", name)); + throw asm_error(std::format("couldn't resolve local function address of {}", name)); } auto assembler::resolve_label(std::string const& name) -> std::int32_t @@ -632,7 +632,7 @@ auto assembler::resolve_label(std::string const& name) -> std::int32_t } } - throw asm_error(fmt::format("couldn't resolve label address of {}", name)); + throw asm_error(std::format("couldn't resolve label address of {}", name)); } auto assembler::encrypt_string(std::string const& str) -> std::string diff --git a/src/gsc/common/exception.cpp b/src/gsc/common/exception.cpp index 6f1b0226..37a30cf1 100644 --- a/src/gsc/common/exception.cpp +++ b/src/gsc/common/exception.cpp @@ -10,27 +10,27 @@ namespace xsk::gsc { -error::error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]: {}", what)) +error::error(std::string const& what) : std::runtime_error(std::format("[ERROR]: {}", what)) { } -asm_error::asm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:assembler: {}", what)) +asm_error::asm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:assembler: {}", what)) { } -disasm_error::disasm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:disassembler: {}", what)) +disasm_error::disasm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:disassembler: {}", what)) { } -ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:preprocessor:{}: {}", loc.print(), what)) +ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:preprocessor:{}: {}", loc.print(), what)) { } -comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:compiler:{}: {}", loc.print(), what)) +comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:compiler:{}: {}", loc.print(), what)) { } -decomp_error::decomp_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:decompiler: {}", what)) +decomp_error::decomp_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:decompiler: {}", what)) { } diff --git a/src/gsc/compiler.cpp b/src/gsc/compiler.cpp index 7fc7cd28..0a2b503e 100644 --- a/src/gsc/compiler.cpp +++ b/src/gsc/compiler.cpp @@ -45,7 +45,7 @@ auto compiler::emit_program(program const& prog) -> void if (!ctx_->load_include(path)) { - throw error(fmt::format("duplicated include file {}", path)); + throw error(std::format("duplicated include file {}", path)); } } @@ -57,13 +57,13 @@ auto compiler::emit_program(program const& prog) -> void if (ctx_->func_exists(name) || ctx_->meth_exists(name)) { - throw comp_error(dec->loc(), fmt::format("function name '{}' already defined as builtin", name)); + throw comp_error(dec->loc(), std::format("function name '{}' already defined as builtin", name)); } for (auto const& entry : localfuncs_) { if (entry == name) - throw comp_error(dec->loc(), fmt::format("function name '{}' already defined as local function", name)); + throw comp_error(dec->loc(), std::format("function name '{}' already defined as local function", name)); } localfuncs_.push_back(dec->as().name->value); @@ -114,7 +114,7 @@ auto compiler::emit_decl_constant(decl_constant const& constant) -> void auto const it = constants_.find(constant.name->value); if (it != constants_.end()) - throw comp_error(constant.loc(), fmt::format("duplicated constant '{}'", constant.name->value)); + throw comp_error(constant.loc(), std::format("duplicated constant '{}'", constant.name->value)); constants_.insert({ constant.name->value, constant.value.get() }); } @@ -323,7 +323,7 @@ auto compiler::emit_stmt_waittill(stmt_waittill const& stm, scope& scp) -> void for (auto const& entry : stm.args->list) { - emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, fmt::format("{}", variable_create(entry->as(), scp))); + emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, std::format("{}", variable_create(entry->as(), scp))); } emit_opcode(opcode::OP_clearparams); @@ -334,7 +334,7 @@ auto compiler::emit_stmt_waittillmatch(stmt_waittillmatch const& stm, scope& scp emit_expr_arguments(*stm.args, scp); emit_expr(*stm.event, scp); emit_expr(*stm.obj, scp); - emit_opcode(opcode::OP_waittillmatch, fmt::format("{}", stm.args->list.size())); + emit_opcode(opcode::OP_waittillmatch, std::format("{}", stm.args->list.size())); emit_opcode(opcode::OP_waittillmatch2); emit_opcode(opcode::OP_clearparams); } @@ -676,7 +676,7 @@ auto compiler::emit_stmt_foreach(stmt_foreach const& stm, scope& scp) -> void can_continue_ = true; emit_expr_variable(*stm.key, *scp_body); - emit_opcode(opcode::OP_EvalLocalArrayCached, fmt::format("{}", variable_access(stm.array->as(), *scp_body))); + emit_opcode(opcode::OP_EvalLocalArrayCached, std::format("{}", variable_access(stm.array->as(), *scp_body))); emit_expr_variable_ref(*stm.value, *scp_body, true); if (ctx_->props() & props::foreach && stm.use_key) @@ -734,7 +734,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void can_break_ = true; auto data = std::vector{}; - data.push_back(fmt::format("{}", stm.body->block->list.size())); + data.push_back(std::format("{}", stm.body->block->list.size())); auto type = switch_type::none; auto loc_default = std::string{}; @@ -753,7 +753,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void { if (ctx_->engine() == engine::iw9) { - data.push_back(fmt::format("{}", static_cast>(switch_type::integer))); + data.push_back(std::format("{}", static_cast>(switch_type::integer))); } else { @@ -772,7 +772,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void { if (ctx_->engine() == engine::iw9) { - data.push_back(fmt::format("{}", static_cast>(switch_type::string))); + data.push_back(std::format("{}", static_cast>(switch_type::string))); } else { @@ -834,7 +834,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void scp.init(break_blks_); } - data.push_back(fmt::format("{}", static_cast>(type))); + data.push_back(std::format("{}", static_cast>(type))); insert_label(table_loc); @@ -1128,7 +1128,7 @@ auto compiler::emit_expr_clear_local(expr_identifier const& exp, scope& scp) -> if (index == 0) emit_opcode(opcode::OP_ClearLocalVariableFieldCached0); else - emit_opcode(opcode::OP_ClearLocalVariableFieldCached, fmt::format("{}", index)); + emit_opcode(opcode::OP_ClearLocalVariableFieldCached, std::format("{}", index)); } auto compiler::emit_expr_increment(expr_increment const& exp, scope& scp, bool is_stmt) -> void @@ -1323,7 +1323,7 @@ auto compiler::emit_expr_call_pointer(expr_pointer const& exp, scope& scp, bool emit_expr_arguments(*exp.args, scp); emit_expr(*exp.func, scp); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); switch (exp.mode) { @@ -1360,7 +1360,7 @@ auto compiler::emit_expr_call_function(expr_function const& exp, scope& scp, boo emit_expr_arguments(*exp.args, scp); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); if (type == call::type::local) { @@ -1465,7 +1465,7 @@ auto compiler::emit_expr_method_pointer(expr_pointer const& exp, expr const& obj emit_expr(obj, scp); emit_expr(*exp.func, scp); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); switch (exp.mode) { @@ -1503,7 +1503,7 @@ auto compiler::emit_expr_method_function(expr_function const& exp, expr const& o emit_expr_arguments(*exp.args, scp); emit_expr(obj, scp); - auto argcount = fmt::format("{}", exp.args->list.size()); + auto argcount = std::format("{}", exp.args->list.size()); if (type == call::type::local) { @@ -1605,12 +1605,12 @@ auto compiler::emit_expr_parameters(expr_parameters const& exp, scope& scp) -> v auto data = std::vector{}; auto size = (ctx_->props() & props::hash) ? num * 8 : num; - data.push_back(fmt::format("{}", num)); + data.push_back(std::format("{}", num)); for (auto const& entry : exp.list) { auto index = variable_initialize(*entry, scp); - data.push_back((ctx_->props() & props::hash) ? entry->value : fmt::format("{}", index)); + data.push_back((ctx_->props() & props::hash) ? entry->value : std::format("{}", index)); } emit_opcode(opcode::OP_FormalParams, data); @@ -1626,7 +1626,7 @@ auto compiler::emit_expr_parameters(expr_parameters const& exp, scope& scp) -> v { for (auto const& entry : exp.list) { - emit_opcode(opcode::OP_SafeCreateVariableFieldCached, fmt::format("{}", variable_initialize(*entry, scp))); + emit_opcode(opcode::OP_SafeCreateVariableFieldCached, std::format("{}", variable_initialize(*entry, scp))); } emit_opcode(opcode::OP_checkclearparams); @@ -1698,11 +1698,11 @@ auto compiler::emit_expr_tuple(expr_tuple const& exp, scope& scp) -> void if (index == 0) emit_opcode(opcode::OP_GetZero); else - emit_opcode(opcode::OP_GetByte, fmt::format("{}", index)); + emit_opcode(opcode::OP_GetByte, std::format("{}", index)); index++; - emit_opcode(opcode::OP_EvalLocalArrayCached, fmt::format("{}", variable_access(exp.temp->as(), scp))); + emit_opcode(opcode::OP_EvalLocalArrayCached, std::format("{}", variable_access(exp.temp->as(), scp))); emit_expr_variable_ref(*entry, scp, true); } @@ -1750,7 +1750,7 @@ auto compiler::emit_expr_array_ref(expr_array const& exp, scope& scp, bool set) if (!variable_initialized(exp.obj->as(), scp)) { auto index = variable_initialize(exp.obj->as(), scp); - emit_opcode(opcode::OP_EvalNewLocalArrayRefCached0, (ctx_->props() & props::hash) ? exp.obj->as().value : fmt::format("{}", index)); + emit_opcode(opcode::OP_EvalNewLocalArrayRefCached0, (ctx_->props() & props::hash) ? exp.obj->as().value : std::format("{}", index)); if (!set) throw comp_error(exp.loc(), "INTERNAL: VAR CREATED BUT NOT SET"); } @@ -1761,7 +1761,7 @@ auto compiler::emit_expr_array_ref(expr_array const& exp, scope& scp, bool set) if (index == 0) emit_opcode(opcode::OP_EvalLocalArrayRefCached0); else - emit_opcode(opcode::OP_EvalLocalArrayRefCached, fmt::format("{}", index)); + emit_opcode(opcode::OP_EvalLocalArrayRefCached, std::format("{}", index)); } if (set) emit_opcode(opcode::OP_SetVariableField); @@ -1802,7 +1802,7 @@ auto compiler::emit_expr_field_ref(expr_field const& exp, scope& scp, bool set) if (set) emit_opcode(opcode::OP_SetVariableField); break; case node::expr_identifier: - emit_opcode(opcode::OP_EvalLocalVariableObjectCached, fmt::format("{}", variable_access(exp.obj->as(), scp))); + emit_opcode(opcode::OP_EvalLocalVariableObjectCached, std::format("{}", variable_access(exp.obj->as(), scp))); emit_opcode(opcode::OP_EvalFieldVariableRef, field); if (set) emit_opcode(opcode::OP_SetVariableField); break; @@ -1829,7 +1829,7 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, scope& scp, bool if (it != constants_.end()) { - throw comp_error(exp.loc(), fmt::format("variable name already defined as constant '{}'", exp.value)); + throw comp_error(exp.loc(), std::format("variable name already defined as constant '{}'", exp.value)); } if (set) @@ -1837,7 +1837,7 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, scope& scp, bool if (!variable_initialized(exp, scp)) { auto index = variable_initialize(exp, scp); - emit_opcode(opcode::OP_SetNewLocalVariableFieldCached0, (ctx_->props() & props::hash) ? exp.value : fmt::format("{}", index)); + emit_opcode(opcode::OP_SetNewLocalVariableFieldCached0, (ctx_->props() & props::hash) ? exp.value : std::format("{}", index)); } else { @@ -1846,7 +1846,7 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, scope& scp, bool if (index == 0) emit_opcode(opcode::OP_SetLocalVariableFieldCached0); else - emit_opcode(opcode::OP_SetLocalVariableFieldCached, fmt::format("{}", index)); + emit_opcode(opcode::OP_SetLocalVariableFieldCached, std::format("{}", index)); } } else @@ -1856,7 +1856,7 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, scope& scp, bool if (index == 0) emit_opcode(opcode::OP_EvalLocalVariableRefCached0); else - emit_opcode(opcode::OP_EvalLocalVariableRefCached, fmt::format("{}", index)); + emit_opcode(opcode::OP_EvalLocalVariableRefCached, std::format("{}", index)); } } @@ -1884,7 +1884,7 @@ auto compiler::emit_expr_array(expr_array const& exp, scope& scp) -> void if (exp.obj->is()) { - emit_opcode(opcode::OP_EvalLocalArrayCached, fmt::format("{}", variable_access(exp.obj->as(), scp))); + emit_opcode(opcode::OP_EvalLocalArrayCached, std::format("{}", variable_access(exp.obj->as(), scp))); } else { @@ -1929,7 +1929,7 @@ auto compiler::emit_expr_field(expr_field const& exp, scope& scp) -> void emit_opcode(opcode::OP_EvalFieldVariable, field); break; case node::expr_identifier: - emit_opcode(opcode::OP_EvalLocalVariableObjectCached, fmt::format("{}", variable_access(exp.obj->as(), scp))); + emit_opcode(opcode::OP_EvalLocalVariableObjectCached, std::format("{}", variable_access(exp.obj->as(), scp))); emit_opcode(opcode::OP_EvalFieldVariable, field); break; default: @@ -1971,7 +1971,7 @@ auto compiler::emit_expr_local(expr_identifier const& exp, scope& scp) -> void emit_opcode(opcode::OP_EvalLocalVariableCached5); break; default: - emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", index)); + emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", index)); break; } } @@ -2006,7 +2006,7 @@ auto compiler::emit_expr_object(expr const& exp, scope& scp) -> void emit_opcode(opcode::OP_CastFieldObject); break; case node::expr_identifier: - emit_opcode(opcode::OP_EvalLocalVariableObjectCached, fmt::format("{}", variable_access(exp.as(), scp))); + emit_opcode(opcode::OP_EvalLocalVariableObjectCached, std::format("{}", variable_access(exp.as(), scp))); break; default: throw comp_error(exp.loc(), "not an object"); @@ -2173,7 +2173,7 @@ auto compiler::emit_create_local_vars(scope& scp) -> void { for (auto i = scp.create_count; i < scp.public_count; i++) { - emit_opcode(opcode::OP_CreateLocalVariable, (ctx_->props() & props::hash) ? scp.vars[i].name : fmt::format("{}", scp.vars[i].create)); + emit_opcode(opcode::OP_CreateLocalVariable, (ctx_->props() & props::hash) ? scp.vars[i].name : std::format("{}", scp.vars[i].create)); scp.vars[i].init = true; } @@ -2189,7 +2189,7 @@ auto compiler::emit_remove_local_vars(scope& scp) -> void if (count > 0) { - emit_opcode(opcode::OP_RemoveLocalVariables, fmt::format("{}", count)); + emit_opcode(opcode::OP_RemoveLocalVariables, std::format("{}", count)); } } } @@ -2726,7 +2726,7 @@ auto compiler::variable_initialized(expr_identifier const& exp, scope& scp) -> b } } - throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value)); + throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value)); } auto compiler::variable_initialize(expr_identifier const& exp, scope& scp) -> u8 @@ -2742,7 +2742,7 @@ auto compiler::variable_initialize(expr_identifier const& exp, scope& scp) -> u8 if (!scp.vars[j].init) { scp.vars[j].init = true; - emit_opcode(opcode::OP_CreateLocalVariable, (ctx_->props() & props::hash) ? scp.vars[j].name : fmt::format("{}", scp.vars[j].create)); + emit_opcode(opcode::OP_CreateLocalVariable, (ctx_->props() & props::hash) ? scp.vars[j].name : std::format("{}", scp.vars[j].create)); } } @@ -2753,7 +2753,7 @@ auto compiler::variable_initialize(expr_identifier const& exp, scope& scp) -> u8 } } - throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value)); + throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value)); } auto compiler::variable_create(expr_identifier const& exp, scope& scp) -> u8 @@ -2766,7 +2766,7 @@ auto compiler::variable_create(expr_identifier const& exp, scope& scp) -> u8 { if (!var.init) { - emit_opcode(opcode::OP_CreateLocalVariable, (ctx_->props() & props::hash) ? var.name : fmt::format("{}", var.create)); + emit_opcode(opcode::OP_CreateLocalVariable, (ctx_->props() & props::hash) ? var.name : std::format("{}", var.create)); var.init = true; scp.create_count++; } @@ -2775,7 +2775,7 @@ auto compiler::variable_create(expr_identifier const& exp, scope& scp) -> u8 } } - throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value)); + throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value)); } auto compiler::variable_access(expr_identifier const& exp, scope& scp) -> u8 @@ -2789,11 +2789,11 @@ auto compiler::variable_access(expr_identifier const& exp, scope& scp) -> u8 return static_cast(scp.create_count - 1 - i); } - throw comp_error(exp.loc(), fmt::format("local variable '{}' not initialized", exp.value)); + throw comp_error(exp.loc(), std::format("local variable '{}' not initialized", exp.value)); } } - throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value)); + throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value)); } auto compiler::resolve_function_type(expr_function const& exp, std::string& path) -> call::type @@ -2922,7 +2922,7 @@ auto compiler::insert_label() -> std::string else { label_idx_++; - auto name = fmt::format("loc_{}", label_idx_); + auto name = std::format("loc_{}", label_idx_); function_->labels.insert({ index_, name }); return name; } @@ -2931,7 +2931,7 @@ auto compiler::insert_label() -> std::string auto compiler::create_label() -> std::string { label_idx_++; - return fmt::format("loc_{}", label_idx_); + return std::format("loc_{}", label_idx_); } } // namespace xsk::gsc diff --git a/src/gsc/context.cpp b/src/gsc/context.cpp index 70a01857..4efe871c 100644 --- a/src/gsc/context.cpp +++ b/src/gsc/context.cpp @@ -279,7 +279,7 @@ auto context::opcode_size(opcode op) const -> u32 case opcode::OP_iw9_144: case opcode::OP_iw9_166: default: - throw error(fmt::format("couldn't resolve instruction size for '{}'", opcode_name(op))); + throw error(std::format("couldn't resolve instruction size for '{}'", opcode_name(op))); } } @@ -292,7 +292,7 @@ auto context::opcode_id(opcode op) const -> u8 return itr->second; } - throw error(fmt::format("couldn't resolve opcode id for '{}'", opcode_name(op))); + throw error(std::format("couldn't resolve opcode id for '{}'", opcode_name(op))); } auto context::opcode_name(opcode op) const -> std::string @@ -304,7 +304,7 @@ auto context::opcode_name(opcode op) const -> std::string return std::string{ itr->second }; } - throw std::runtime_error(fmt::format("couldn't resolve opcode string for enum '{}'", static_cast>(op))); + throw std::runtime_error(std::format("couldn't resolve opcode string for enum '{}'", static_cast>(op))); } auto context::opcode_enum(std::string const& name) const -> opcode @@ -316,7 +316,7 @@ auto context::opcode_enum(std::string const& name) const -> opcode return itr->second; } - throw std::runtime_error(fmt::format("couldn't resolve opcode enum for name '{}'", name)); + throw std::runtime_error(std::format("couldn't resolve opcode enum for name '{}'", name)); } auto context::opcode_enum(u8 id) const -> opcode @@ -328,7 +328,7 @@ auto context::opcode_enum(u8 id) const -> opcode return itr->second; } - throw error(fmt::format("couldn't resolve opcode enum for '{:02X}'", id)); + throw error(std::format("couldn't resolve opcode enum for '{:02X}'", id)); } auto context::func_id(std::string const& name) const -> u16 @@ -345,7 +345,7 @@ auto context::func_id(std::string const& name) const -> u16 return itr->second; } - throw error(fmt::format("couldn't resolve builtin function id for {}", name)); + throw error(std::format("couldn't resolve builtin function id for {}", name)); } auto context::func_name(u16 id) const -> std::string @@ -357,7 +357,7 @@ auto context::func_name(u16 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_func_{:04X}", id); + return std::format("_func_{:04X}", id); } auto context::func2_id(std::string const& name) const -> u64 @@ -394,7 +394,7 @@ auto context::func2_name(u64 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_func_{:16X}", id); + return std::format("_func_{:16X}", id); } auto context::func_exists(std::string const& name) const -> bool @@ -417,7 +417,7 @@ auto context::func_add(std::string const& name, u16 id) -> void if (itr != func_map_rev_.end()) { - throw error(fmt::format("builtin function '{}' already defined", name)); + throw error(std::format("builtin function '{}' already defined", name)); } auto const str = new_func_map_.find(name); @@ -453,7 +453,7 @@ auto context::meth_id(std::string const& name) const -> u16 return itr->second; } - throw error(fmt::format("couldn't resolve builtin method id for {}", name)); + throw error(std::format("couldn't resolve builtin method id for {}", name)); } auto context::meth_name(u16 id) const -> std::string @@ -465,7 +465,7 @@ auto context::meth_name(u16 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_meth_{:04X}", id); + return std::format("_meth_{:04X}", id); } auto context::meth2_id(std::string const& name) const -> u64 @@ -502,7 +502,7 @@ auto context::meth2_name(u64 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_meth_{:16X}", id); + return std::format("_meth_{:16X}", id); } @@ -526,7 +526,7 @@ auto context::meth_add(std::string const& name, u16 id) -> void if (itr != meth_map_rev_.end()) { - throw error(fmt::format("builtin method '{}' already defined", name)); + throw error(std::format("builtin method '{}' already defined", name)); } auto const str = new_meth_map_.find(name); @@ -574,7 +574,7 @@ auto context::token_name(u32 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_id_{:04X}", id); + return std::format("_id_{:04X}", id); } auto context::path_id(std::string const& name) const -> u64 @@ -615,7 +615,7 @@ auto context::path_name(u64 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_id_{:016X}", id); + return std::format("_id_{:016X}", id); } auto context::hash_id(std::string const& name) const -> u64 @@ -652,7 +652,7 @@ auto context::hash_name(u64 id) const -> std::string return std::string{ itr->second }; } - return fmt::format("_id_{:016X}", id); + return std::format("_id_{:016X}", id); } auto context::make_token(std::string_view str) const -> std::string @@ -694,7 +694,7 @@ auto context::load_header(std::string const& name) -> std::tuple bool @@ -755,7 +755,7 @@ auto context::load_include(std::string const& name) -> bool } catch (std::exception const& e) { - throw error(fmt::format("parsing include file '{}': {}", name, e.what())); + throw error(std::format("parsing include file '{}': {}", name, e.what())); } } diff --git a/src/gsc/decompiler.cpp b/src/gsc/decompiler.cpp index 2ed865b5..82b8d24a 100644 --- a/src/gsc/decompiler.cpp +++ b/src/gsc/decompiler.cpp @@ -1238,7 +1238,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void } case opcode::OP_SafeCreateVariableFieldCached: { - auto name = (ctx_->props() & props::hash) ? inst.data[0] : fmt::format("var_{}", inst.data[0]); + auto name = (ctx_->props() & props::hash) ? inst.data[0] : std::format("var_{}", inst.data[0]); func_->params->list.push_back(expr_identifier::make(loc, name)); break; } @@ -1456,7 +1456,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void for (auto i = 1; i <= count; i++) { - auto name = (ctx_->props() & props::hash) ? inst.data[i] : fmt::format("var_{}", inst.data[i]); + auto name = (ctx_->props() & props::hash) ? inst.data[i] : std::format("var_{}", inst.data[i]); func_->params->list.push_back(expr_identifier::make(loc, name)); } break; @@ -1481,22 +1481,22 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void } case opcode::OP_GetStatHash: { - stack_.push(expr_string::make(loc, fmt::format("stat_{}", inst.data[0]))); + stack_.push(expr_string::make(loc, std::format("stat_{}", inst.data[0]))); break; } case opcode::OP_GetUnkxHash: { - stack_.push(expr_string::make(loc, fmt::format("hunk_{}", inst.data[0]))); + stack_.push(expr_string::make(loc, std::format("hunk_{}", inst.data[0]))); break; } case opcode::OP_GetEnumHash: { - stack_.push(expr_string::make(loc, fmt::format("enum_{}", inst.data[0]))); + stack_.push(expr_string::make(loc, std::format("enum_{}", inst.data[0]))); break; } case opcode::OP_GetDvarHash: { - stack_.push(expr_string::make(loc, fmt::format("dvar_{}", inst.data[0]))); + stack_.push(expr_string::make(loc, std::format("dvar_{}", inst.data[0]))); break; } case opcode::OP_waittillmatch2: @@ -1505,7 +1505,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void case opcode::OP_CastBool: break; default: - throw decomp_error(fmt::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode))); + throw decomp_error(std::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode))); } } @@ -1782,7 +1782,7 @@ auto decompiler::decompile_aborts(stmt_list& stm) -> void } else { - std::cout << fmt::format("WARNING: unresolved jump to '{}', maybe incomplete for loop\n", jmp); + std::cout << std::format("WARNING: unresolved jump to '{}', maybe incomplete for loop\n", jmp); } } } @@ -2396,7 +2396,7 @@ auto decompiler::find_location_index(stmt_list const& stm, std::string const& lo index++; } - throw decomp_error(fmt::format("location '{}' not found", loc)); + throw decomp_error(std::format("location '{}' not found", loc)); } auto decompiler::last_location_index(stmt_list const& stm, usize index) -> bool @@ -2817,7 +2817,7 @@ auto decompiler::process_stmt_return(stmt_return& stm, scope& scp) -> void auto decompiler::process_stmt_create(stmt_create& stm, scope& scp) -> void { - auto var = (ctx_->props() & props::hash) ? stm.index : fmt::format("var_{}", stm.index); + auto var = (ctx_->props() & props::hash) ? stm.index : std::format("var_{}", stm.index); scp.vars.push_back({ var, static_cast(scp.create_count), true }); scp.create_count++; } @@ -3103,12 +3103,12 @@ auto decompiler::process_expr_var_create(expr::ptr& exp, scope& scp) -> void { for (auto const& entry : exp->as().vars) { - auto var = (ctx_->props() & props::hash) ? entry : fmt::format("var_{}", entry); + auto var = (ctx_->props() & props::hash) ? entry : std::format("var_{}", entry); scp.vars.push_back({ var, static_cast(scp.create_count), true }); scp.create_count++; } - auto var = (ctx_->props() & props::hash) ? exp->as().index : fmt::format("var_{}", exp->as().index); + auto var = (ctx_->props() & props::hash) ? exp->as().index : std::format("var_{}", exp->as().index); scp.vars.push_back({ var, static_cast(scp.create_count), true }); scp.create_count++; @@ -3121,7 +3121,7 @@ auto decompiler::process_expr_var_access(expr::ptr& exp, scope& scp) -> void if (scp.vars.size() <= index) { - std::cout << fmt::format("WARNING: bad local var access\n"); + std::cout << std::format("WARNING: bad local var access\n"); } else { diff --git a/src/gsc/disassembler.cpp b/src/gsc/disassembler.cpp index a002dd34..283c2f71 100644 --- a/src/gsc/disassembler.cpp +++ b/src/gsc/disassembler.cpp @@ -153,21 +153,21 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void break; case opcode::OP_GetByte: case opcode::OP_GetNegByte: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetUnsignedShort: case opcode::OP_GetNegUnsignedShort: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetUnsignedInt: case opcode::OP_GetNegUnsignedInt: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetInteger: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetInteger64: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetFloat: inst.data.push_back(utils::string::float_string(script_.read())); @@ -193,15 +193,15 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void inst.data.push_back(decrypt_string(stack_.read_cstr())); break; case opcode::OP_GetUnkxHash: // xhash : only used on unittests - inst.data.push_back(fmt::format("{:08X}", script_.read())); + inst.data.push_back(std::format("{:08X}", script_.read())); break; case opcode::OP_GetStatHash: // xhash : "kill" -> 0xEF9582D72160F199 case opcode::OP_GetEnumHash: // xhash : "WEAPON/AMMO_SLUGS" -> 0x6AA606A18241AD16 c++ enum ?? case opcode::OP_GetDvarHash: // xhash : #d"mapname" -> 0x687FB8F9B7A23245 - inst.data.push_back(fmt::format("{:016X}", script_.read())); + inst.data.push_back(std::format("{:016X}", script_.read())); break; case opcode::OP_waittillmatch: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_ClearLocalVariableFieldCached: case opcode::OP_SetLocalVariableFieldCached: @@ -213,13 +213,13 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void case opcode::OP_SafeSetWaittillVariableFieldCached: case opcode::OP_EvalLocalVariableObjectCached: case opcode::OP_EvalLocalArrayCached: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_CreateLocalVariable: case opcode::OP_EvalNewLocalArrayRefCached0: case opcode::OP_SafeCreateVariableFieldCached: case opcode::OP_SetNewLocalVariableFieldCached0: - inst.data.push_back((ctx_->props() & props::hash) ? ctx_->hash_name(script_.read()) : fmt::format("{}", script_.read())); + inst.data.push_back((ctx_->props() & props::hash) ? ctx_->hash_name(script_.read()) : std::format("{}", script_.read())); break; case opcode::OP_EvalSelfFieldVariable: case opcode::OP_SetLevelFieldVariableField: @@ -241,7 +241,7 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); break; case opcode::OP_GetLocalFunction: case opcode::OP_ScriptLocalFunctionCall2: @@ -313,7 +313,7 @@ auto disassembler::dissasemble_instruction(instruction& inst) -> void disassemble_formal_params(inst); break; default: - throw disasm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); + throw disasm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index)); } } @@ -321,7 +321,7 @@ auto disassembler::disassemble_builtin_call(instruction& inst, bool method, bool { if (args) { - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); } if (ctx_->props() & props::hash) @@ -350,11 +350,11 @@ auto disassembler::disassemble_local_call(instruction& inst, bool thread) -> voi { auto const offs = disassemble_offset(); - inst.data.push_back(fmt::format("{}", inst.index + 1 + offs)); + inst.data.push_back(std::format("{}", inst.index + 1 + offs)); if (thread) { - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); } } @@ -366,7 +366,7 @@ auto disassembler::disassemble_far_call(instruction& inst, bool thread) -> void if (thread) { - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); } auto file = stack_.read(); @@ -374,7 +374,7 @@ auto disassembler::disassemble_far_call(instruction& inst, bool thread) -> void if (file == 0) { - inst.data.emplace(inst.data.begin(), fmt::format("{}", inst.index + 1 + offs)); + inst.data.emplace(inst.data.begin(), std::format("{}", inst.index + 1 + offs)); inst.data.emplace(inst.data.begin(), ""); } else @@ -396,7 +396,7 @@ auto disassembler::disassemble_far_call(instruction& inst, bool thread) -> void if (thread) { - inst.data.push_back(fmt::format("{}", script_.read())); + inst.data.push_back(std::format("{}", script_.read())); } auto const file_id = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); @@ -412,7 +412,7 @@ auto disassembler::disassemble_far_call(instruction& inst, bool thread) -> void auto disassembler::disassemble_switch(instruction& inst) -> void { auto const addr = inst.index + 4 + script_.read(); - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -422,7 +422,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void { auto const count = script_.read(); - inst.data.push_back(fmt::format("{}", count)); + inst.data.push_back(std::format("{}", count)); auto type = switch_type::none; auto index = inst.index + 3u; @@ -439,13 +439,13 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void if (byte == 1) { inst.data.push_back("case"); - inst.data.push_back(fmt::format("{}", static_cast>(switch_type::integer))); - inst.data.push_back(fmt::format("{}", data)); + inst.data.push_back(std::format("{}", static_cast>(switch_type::integer))); + inst.data.push_back(std::format("{}", data)); } else if (byte == 2) { inst.data.push_back("case"); - inst.data.push_back(fmt::format("{}", static_cast>(switch_type::string))); + inst.data.push_back(std::format("{}", static_cast>(switch_type::string))); inst.data.push_back(stack_.read_cstr()); } else // byte == 0 @@ -455,7 +455,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void } auto const addr = index + 4 + offs; - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -488,11 +488,11 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void type = switch_type::integer; inst.data.push_back("case"); - inst.data.push_back(fmt::format("{}", (value - 0x800000) & 0xFFFFFF)); + inst.data.push_back(std::format("{}", (value - 0x800000) & 0xFFFFFF)); } auto const addr = index + 4 + disassemble_offset(); - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -502,7 +502,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void } } - inst.data.push_back(fmt::format("{}", static_cast>(type))); + inst.data.push_back(std::format("{}", static_cast>(type))); } auto disassembler::disassemble_field_variable(instruction& inst) -> void @@ -519,7 +519,7 @@ auto disassembler::disassemble_field_variable(instruction& inst) -> void if (id > ctx_->str_count()) { auto const temp = (ctx_->props() & props::tok4) ? stack_.read() : stack_.read(); - name = (temp == 0) ? decrypt_string(stack_.read_cstr()) : fmt::format("{}", temp); + name = (temp == 0) ? decrypt_string(stack_.read_cstr()) : std::format("{}", temp); } else { @@ -535,11 +535,11 @@ auto disassembler::disassemble_formal_params(instruction& inst) -> void auto const count = script_.read(); inst.size += (ctx_->props() & props::hash) ? count * 8 : count; - inst.data.push_back(fmt::format("{}", count)); + inst.data.push_back(std::format("{}", count)); for (auto i = 0u; i < count; i++) { - inst.data.push_back((ctx_->props() & props::hash) ? ctx_->hash_name(script_.read()) : fmt::format("{}", script_.read())); + inst.data.push_back((ctx_->props() & props::hash) ? ctx_->hash_name(script_.read()) : std::format("{}", script_.read())); } } @@ -560,7 +560,7 @@ auto disassembler::disassemble_jump(instruction& inst, bool expr, bool back) -> addr = inst.index + 5 + script_.read(); } - auto const label = fmt::format("loc_{:X}", addr); + auto const label = std::format("loc_{:X}", addr); inst.data.push_back(label); func_->labels.insert({ addr, label }); @@ -639,7 +639,7 @@ auto disassembler::resolve_function(std::string const& index) -> std::string } } - throw disasm_error(fmt::format("couldn't resolve function name at index 0x{}", index)); + throw disasm_error(std::format("couldn't resolve function name at index 0x{}", index)); } auto disassembler::decrypt_string(std::string const& str) -> std::string @@ -652,7 +652,7 @@ auto disassembler::decrypt_string(std::string const& str) -> std::string for (auto i = 0u; i < str.size(); i++) { - data += fmt::format("{:02X}", static_cast(str[i])); + data += std::format("{:02X}", static_cast(str[i])); } return data; diff --git a/src/gsc/lexer.cpp b/src/gsc/lexer.cpp index 02938c34..27a2e7fd 100644 --- a/src/gsc/lexer.cpp +++ b/src/gsc/lexer.cpp @@ -327,7 +327,7 @@ auto lexer::lex() -> token else if (last == '_' || (last >= 'A' && last <= 'Z') || (last >= 'a' && last <= 'z')) goto lex_name; - throw comp_error(loc_, fmt::format("bad token: '{}'", last)); + throw comp_error(loc_, std::format("bad token: '{}'", last)); } lex_string: diff --git a/src/gsc/parser.cpp b/src/gsc/parser.cpp index c071da24..8a5b7bbf 100644 --- a/src/gsc/parser.cpp +++ b/src/gsc/parser.cpp @@ -1642,7 +1642,7 @@ namespace xsk { namespace gsc { int yylen = 0; // Error handling. - int yynerrs_ = 0; + [[maybe_unused]] int yynerrs_ = 0; int yyerrstatus_ = 0; /// The lookahead symbol. @@ -2229,7 +2229,7 @@ namespace xsk { namespace gsc { #line 322 "parser.ypp" { ppr.ban_header(yylhs.location); yylhs.value.as < decl_constant::ptr > () = decl_constant::make(yylhs.location, std::move(yystack_[3].value.as < expr_identifier::ptr > ()), std::move(yystack_[1].value.as < expr::ptr > ())); - printf("%s" , fmt::format("{}: constants deprecated, use #define instead\n", yylhs.location.print()).data()); + printf("%s" , std::format("{}: constants deprecated, use #define instead\n", yylhs.location.print()).data()); } #line 2242 "parser.cpp" break; @@ -2645,8 +2645,8 @@ namespace xsk { namespace gsc { case 89: // stmt_foreach: "foreach" "(" expr_identifier "in" expr ")" stmt #line 498 "parser.ypp" { - auto array = expr_identifier::make(yylhs.location, fmt::format("_temp_{}", ++index)); - auto key = expr_identifier::make(yylhs.location, fmt::format("_temp_{}", ++index)); + auto array = expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)); + auto key = expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)); yylhs.value.as < stmt_foreach::ptr > () = stmt_foreach::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr_identifier::ptr > ()), expr_empty::make(yylhs.location), std::move(array), std::move(key), std::move(yystack_[0].value.as < stmt::ptr > ()), false); } #line 2660 "parser.cpp" @@ -2655,8 +2655,8 @@ namespace xsk { namespace gsc { case 90: // stmt_foreach: "foreach" "(" expr_identifier "," expr_identifier "in" expr ")" stmt #line 504 "parser.ypp" { - auto array = expr_identifier::make(yylhs.location, fmt::format("_temp_{}", ++index)); - expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(yylhs.location, fmt::format("_temp_{}", ++index)) : std::move(yystack_[6].value.as < expr_identifier::ptr > ()); + auto array = expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)); + expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(yylhs.location, std::format("_temp_{}", ++index)) : std::move(yystack_[6].value.as < expr_identifier::ptr > ()); yylhs.value.as < stmt_foreach::ptr > () = stmt_foreach::make(yylhs.location, std::move(yystack_[2].value.as < expr::ptr > ()), std::move(yystack_[4].value.as < expr_identifier::ptr > ()), (ctx_->props() & props::foreach) ? std::move(yystack_[6].value.as < expr_identifier::ptr > ()) : (expr::ptr)expr_empty::make(yylhs.location), std::move(array), std::move(key), std::move(yystack_[0].value.as < stmt::ptr > ()), true); } #line 2670 "parser.cpp" @@ -3374,7 +3374,7 @@ namespace xsk { namespace gsc { #line 822 "parser.ypp" { yylhs.value.as < expr::ptr > () = std::move(yystack_[1].value.as < expr_tuple::ptr > ()); - yylhs.value.as < expr::ptr > ()->as().temp = expr_identifier::make(yylhs.value.as < expr::ptr > ()->loc(), fmt::format("_temp_{}", ++index)); + yylhs.value.as < expr::ptr > ()->as().temp = expr_identifier::make(yylhs.value.as < expr::ptr > ()->loc(), std::format("_temp_{}", ++index)); } #line 3387 "parser.cpp" break; @@ -5048,7 +5048,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type } } - throw error(fmt::format("unmapped token! {}", (u8)tok.type)); + throw error(std::format("unmapped token! {}", (u8)tok.type)); } auto GSClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type diff --git a/src/gsc/preprocessor.cpp b/src/gsc/preprocessor.cpp index d084367e..1f1ce5af 100644 --- a/src/gsc/preprocessor.cpp +++ b/src/gsc/preprocessor.cpp @@ -97,12 +97,12 @@ auto preprocessor::push_header(std::string const& file) -> void { try { - auto name = fmt::format("{}.gsh", file); + auto name = std::format("{}.gsh", file); for (auto& inc : includes_) { if (inc == name) - throw ppr_error(location{}, fmt::format("recursive header inclusion {} at {}", name, includes_.back())); + throw ppr_error(location{}, std::format("recursive header inclusion {} at {}", name, includes_.back())); } auto data = ctx_->load_header(name); @@ -112,7 +112,7 @@ auto preprocessor::push_header(std::string const& file) -> void } catch (std::exception const& e) { - throw error(fmt::format("parsing header file '{}': {}", file, e.what())); + throw error(std::format("parsing header file '{}': {}", file, e.what())); } } @@ -252,7 +252,7 @@ auto preprocessor::read_directive(token& tok) -> void } } - throw ppr_error(next.pos, fmt::format("invalid preprocessing directive '{}'", next.data)); + throw ppr_error(next.pos, std::format("invalid preprocessing directive '{}'", next.data)); } auto preprocessor::read_directive_if(token&) -> void @@ -746,7 +746,7 @@ auto preprocessor::expand(token& tok, define& def) -> void } else if (tok.data == "__LINE__") { - tokens_.push_front(token{ token::STRING, tok.space, tok.pos, fmt::format("{}", tok.pos.begin.line) }); + tokens_.push_front(token{ token::STRING, tok.space, tok.pos, std::format("{}", tok.pos.begin.line) }); } else if (tok.data == "__DATE__") { @@ -925,7 +925,7 @@ auto preprocessor::expect(token& tok, token::kind expected, spacing) -> void { if (tok.type != expected) { - throw ppr_error(tok.pos, fmt::format("expected {} found {}", (u8)expected, (u8)tok.type)); + throw ppr_error(tok.pos, std::format("expected {} found {}", (u8)expected, (u8)tok.type)); } } @@ -1078,7 +1078,7 @@ auto preprocessor::eval_consume(token::kind type, std::string_view msg) { if (eval_check(type)) return eval_next(); - throw ppr_error(eval_peek().pos, fmt::format("{}", msg)); + throw ppr_error(eval_peek().pos, std::format("{}", msg)); } auto preprocessor::eval_expr() -> i32 diff --git a/src/gsc/source.cpp b/src/gsc/source.cpp index 7c3cfb28..59e20744 100644 --- a/src/gsc/source.cpp +++ b/src/gsc/source.cpp @@ -149,7 +149,7 @@ auto source::parse_program(std::string const& name, u8 const* data, usize size) if (!psr.parse() && res != nullptr) return res; - throw error{ fmt::format("an unknown error ocurred while parsing script {}", name) }; + throw error{ std::format("an unknown error ocurred while parsing script {}", name) }; } auto source::dump(assembly const& data) -> std::vector @@ -157,8 +157,8 @@ auto source::dump(assembly const& data) -> std::vector buf_ = std::vector{}; buf_.reserve(0x10000); - fmt::format_to(std::back_inserter(buf_), "// {} GSC ASSEMBLY\n", ctx_->engine_name()); - fmt::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); + std::format_to(std::back_inserter(buf_), "// {} GSC ASSEMBLY\n", ctx_->engine_name()); + std::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); dump_assembly(data); @@ -170,8 +170,8 @@ auto source::dump(program const& data) -> std::vector buf_ = std::vector{}; buf_.reserve(0x10000); - fmt::format_to(std::back_inserter(buf_), "// {} GSC SOURCE\n", ctx_->engine_name()); - fmt::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); + std::format_to(std::back_inserter(buf_), "// {} GSC SOURCE\n", ctx_->engine_name()); + std::format_to(std::back_inserter(buf_), "// Generated by https://github.com/xensik/gsc-tool\n"); dump_program(data); @@ -188,7 +188,7 @@ auto source::dump_assembly(assembly const& data) -> void auto source::dump_function(function const& func) -> void { - fmt::format_to(std::back_inserter(buf_), "\nsub:{}\n", func.name); + std::format_to(std::back_inserter(buf_), "\nsub:{}\n", func.name); for (auto const& inst : func.instructions) { @@ -196,40 +196,40 @@ auto source::dump_function(function const& func) -> void if (itr != func.labels.end()) { - fmt::format_to(std::back_inserter(buf_), "\t{}\n", itr->second); + std::format_to(std::back_inserter(buf_), "\t{}\n", itr->second); } dump_instruction(*inst); } - fmt::format_to(std::back_inserter(buf_), "end:{}\n", func.name); + std::format_to(std::back_inserter(buf_), "end:{}\n", func.name); } auto source::dump_instruction(instruction const& inst) -> void { - fmt::format_to(std::back_inserter(buf_), "\t\t{}", ctx_->opcode_name(inst.opcode)); + std::format_to(std::back_inserter(buf_), "\t\t{}", ctx_->opcode_name(inst.opcode)); switch (inst.opcode) { case opcode::OP_GetString: case opcode::OP_GetIString: case opcode::OP_GetAnimTree: - fmt::format_to(std::back_inserter(buf_), " \"{}\"", inst.data[0]); + std::format_to(std::back_inserter(buf_), " \"{}\"", inst.data[0]); break; case opcode::OP_GetAnimation: - fmt::format_to(std::back_inserter(buf_), " \"{}\" \"{}\"", inst.data[0], inst.data[1]); + std::format_to(std::back_inserter(buf_), " \"{}\" \"{}\"", inst.data[0], inst.data[1]); break; case opcode::OP_GetLocalFunction: case opcode::OP_ScriptLocalFunctionCall: case opcode::OP_ScriptLocalFunctionCall2: case opcode::OP_ScriptLocalMethodCall: - fmt::format_to(std::back_inserter(buf_), " {}", inst.data[0]); + std::format_to(std::back_inserter(buf_), " {}", inst.data[0]); break; case opcode::OP_ScriptLocalThreadCall: case opcode::OP_ScriptLocalChildThreadCall: case opcode::OP_ScriptLocalMethodThreadCall: case opcode::OP_ScriptLocalMethodChildThreadCall: - fmt::format_to(std::back_inserter(buf_), " {} {}\n", inst.data[0], inst.data[1]); + std::format_to(std::back_inserter(buf_), " {} {}\n", inst.data[0], inst.data[1]); break; case opcode::OP_endswitch: { @@ -237,7 +237,7 @@ auto source::dump_instruction(instruction const& inst) -> void auto type = static_cast(std::stoul(inst.data.back())); auto index = 1; - fmt::format_to(std::back_inserter(buf_), " {}\n", count); + std::format_to(std::back_inserter(buf_), " {}\n", count); for (auto i = 0u; i < count; i++) { @@ -246,25 +246,25 @@ auto source::dump_instruction(instruction const& inst) -> void if (ctx_->engine() == engine::iw9) { type = static_cast(std::stoul(inst.data[index + 1])); - auto data = (type == switch_type::integer) ? fmt::format("{}", inst.data[index + 2]) : fmt::format("\"{}\"", inst.data[index + 2]); - fmt::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 3]); + auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 2]) : std::format("\"{}\"", inst.data[index + 2]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 3]); index += 4; } else { - auto data = (type == switch_type::integer) ? fmt::format("{}", inst.data[index + 1]) : fmt::format("\"{}\"", inst.data[index + 1]); - fmt::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 2]); + auto data = (type == switch_type::integer) ? std::format("{}", inst.data[index + 1]) : std::format("\"{}\"", inst.data[index + 1]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {} {}", inst.data[index], data, inst.data[index + 2]); index += 3; } } else if (inst.data[index] == "default") { - fmt::format_to(std::back_inserter(buf_), "\t\t\t{} {}", inst.data[index], inst.data[index + 1]); + std::format_to(std::back_inserter(buf_), "\t\t\t{} {}", inst.data[index], inst.data[index + 1]); index += 2; } if (i != count - 1) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); } } break; @@ -272,12 +272,12 @@ auto source::dump_instruction(instruction const& inst) -> void default: for (auto const& entry : inst.data) { - fmt::format_to(std::back_inserter(buf_), " {}", entry); + std::format_to(std::back_inserter(buf_), " {}", entry); } break; } - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); } auto source::dump_program(program const& data) -> void @@ -289,16 +289,16 @@ auto source::dump_program(program const& data) -> void for (auto const& dec : data.declarations) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_decl(*dec); } } auto source::dump_include(include const& inc) -> void { - fmt::format_to(std::back_inserter(buf_), "#include "); + std::format_to(std::back_inserter(buf_), "#include "); dump_expr_path(*inc.path); - fmt::format_to(std::back_inserter(buf_), ";\n"); + std::format_to(std::back_inserter(buf_), ";\n"); } auto source::dump_decl(decl const& dec) -> void @@ -330,43 +330,43 @@ auto source::dump_decl(decl const& dec) -> void auto source::dump_decl_dev_begin(decl_dev_begin const&) -> void { - fmt::format_to(std::back_inserter(buf_), "/#"); + std::format_to(std::back_inserter(buf_), "/#"); } auto source::dump_decl_dev_end(decl_dev_end const&) -> void { - fmt::format_to(std::back_inserter(buf_), "#/"); + std::format_to(std::back_inserter(buf_), "#/"); } auto source::dump_decl_usingtree(decl_usingtree const& dec) -> void { - fmt::format_to(std::back_inserter(buf_), "#using_animtree("); + std::format_to(std::back_inserter(buf_), "#using_animtree("); dump_expr_string(*dec.name); - fmt::format_to(std::back_inserter(buf_), ");\n"); + std::format_to(std::back_inserter(buf_), ");\n"); } auto source::dump_decl_constant(decl_constant const& dec) -> void { dump_expr_identifier(*dec.name); - fmt::format_to(std::back_inserter(buf_), " = "); + std::format_to(std::back_inserter(buf_), " = "); dump_expr(*dec.value); - fmt::format_to(std::back_inserter(buf_), ";\n"); + std::format_to(std::back_inserter(buf_), ";\n"); } auto source::dump_decl_function(decl_function const& dec) -> void { indent_ = 0; dump_expr_identifier(*dec.name); - fmt::format_to(std::back_inserter(buf_), "("); + std::format_to(std::back_inserter(buf_), "("); dump_expr_parameters(*dec.params); - fmt::format_to(std::back_inserter(buf_), ")\n"); + std::format_to(std::back_inserter(buf_), ")\n"); dump_stmt_comp(*dec.body); - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); } auto source::dump_decl_empty(decl_empty const&) -> void { - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_stmt(stmt const& stm) -> void @@ -491,7 +491,7 @@ auto source::dump_stmt(stmt const& stm) -> void auto source::dump_stmt_empty(stmt_empty const&) -> void { - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_stmt_list(stmt_list const& stm) -> void @@ -502,7 +502,7 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void for (auto const& entry : stm.list) { if ((&entry != &stm.list.front() && entry->is_special_stmt()) || last_special) - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); if (entry->is()) { @@ -510,12 +510,12 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void } else { - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*entry); } if (&entry != &stm.list.back()) - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); if (entry->is_special_stmt()) last_special = true; @@ -528,16 +528,16 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void auto source::dump_stmt_comp(stmt_comp const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "{: >{}}\n", "{", indent_ + 1); + std::format_to(std::back_inserter(buf_), "{: >{}}\n", "{", indent_ + 1); dump_stmt_list(*stm.block); - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}", "}", indent_ + 1); + std::format_to(std::back_inserter(buf_), "\n{: >{}}", "}", indent_ + 1); } auto source::dump_stmt_dev(stmt_dev const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "/#\n"); + std::format_to(std::back_inserter(buf_), "/#\n"); dump_stmt_list(*stm.block); - fmt::format_to(std::back_inserter(buf_), "\n#/"); + std::format_to(std::back_inserter(buf_), "\n#/"); } auto source::dump_stmt_expr(stmt_expr const& stm) -> void @@ -564,111 +564,111 @@ auto source::dump_stmt_expr(stmt_expr const& stm) -> void break; } - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } auto source::dump_stmt_endon(stmt_endon const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " endon( "); + std::format_to(std::back_inserter(buf_), " endon( "); dump_expr(*stm.event); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } auto source::dump_stmt_notify(stmt_notify const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " notify( "); + std::format_to(std::back_inserter(buf_), " notify( "); dump_expr(*stm.event); if (stm.args->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); } else { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_wait(stmt_wait const& stm) -> void { if (stm.time->is() || stm.time->is()) { - fmt::format_to(std::back_inserter(buf_), "wait "); + std::format_to(std::back_inserter(buf_), "wait "); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } else if (stm.time->is()) { - fmt::format_to(std::back_inserter(buf_), "wait"); + std::format_to(std::back_inserter(buf_), "wait"); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } else { - fmt::format_to(std::back_inserter(buf_), "wait( "); + std::format_to(std::back_inserter(buf_), "wait( "); dump_expr(*stm.time); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } } auto source::dump_stmt_waittill(stmt_waittill const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " waittill( "); + std::format_to(std::back_inserter(buf_), " waittill( "); dump_expr(*stm.event); if (stm.args->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); } else { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void { dump_expr(*stm.obj); - fmt::format_to(std::back_inserter(buf_), " waittillmatch( "); + std::format_to(std::back_inserter(buf_), " waittillmatch( "); dump_expr(*stm.event); if (stm.args->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); dump_expr_arguments(*stm.args); } else { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_waittillframeend(stmt_waittillframeend const&) -> void { - fmt::format_to(std::back_inserter(buf_), "waittillframeend;"); + std::format_to(std::back_inserter(buf_), "waittillframeend;"); } auto source::dump_stmt_waitframe(stmt_waitframe const&) -> void { - fmt::format_to(std::back_inserter(buf_), "waitframe();"); + std::format_to(std::back_inserter(buf_), "waitframe();"); } auto source::dump_stmt_if(stmt_if const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "if ( "); + std::format_to(std::back_inserter(buf_), "if ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); if (stm.body->is()) { @@ -677,7 +677,7 @@ auto source::dump_stmt_if(stmt_if const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -685,9 +685,9 @@ auto source::dump_stmt_if(stmt_if const& stm) -> void auto source::dump_stmt_ifelse(stmt_ifelse const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "if ( "); + std::format_to(std::back_inserter(buf_), "if ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); if (stm.stmt_if->is()) { @@ -696,29 +696,29 @@ auto source::dump_stmt_ifelse(stmt_ifelse const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.stmt_if); indent_ -= 4; } - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}else", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}else", "", indent_); if (stm.stmt_else->is()) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_stmt(*stm.stmt_else); } else { if (stm.stmt_else->is() || stm.stmt_else ->is()) { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_stmt(*stm.stmt_else); } else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}", "", indent_); dump_stmt(*stm.stmt_else); indent_ -= 4; } @@ -729,13 +729,13 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void { if (stm.test->is()) { - fmt::format_to(std::back_inserter(buf_), "while ( true )\n"); + std::format_to(std::back_inserter(buf_), "while ( true )\n"); } else { - fmt::format_to(std::back_inserter(buf_), "while ( "); + std::format_to(std::back_inserter(buf_), "while ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); } if (stm.body->is()) @@ -745,7 +745,7 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -753,7 +753,7 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void auto source::dump_stmt_dowhile(stmt_dowhile const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "do\n"); + std::format_to(std::back_inserter(buf_), "do\n"); if (stm.body->is()) { @@ -762,20 +762,20 @@ auto source::dump_stmt_dowhile(stmt_dowhile const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } if (stm.test->is()) { - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}while ( true )", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}while ( true )", "", indent_); } else { - fmt::format_to(std::back_inserter(buf_), "\n{: >{}}while (", "", indent_); + std::format_to(std::back_inserter(buf_), "\n{: >{}}while (", "", indent_); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " );"); + std::format_to(std::back_inserter(buf_), " );"); } } @@ -783,19 +783,19 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void { if (stm.test->is()) { - fmt::format_to(std::back_inserter(buf_), "for (;;)\n"); + std::format_to(std::back_inserter(buf_), "for (;;)\n"); } else { - fmt::format_to(std::back_inserter(buf_), "for ( "); + std::format_to(std::back_inserter(buf_), "for ( "); dump_stmt(*stm.init); buf_.pop_back(); - fmt::format_to(std::back_inserter(buf_), "; "); + std::format_to(std::back_inserter(buf_), "; "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), "; "); + std::format_to(std::back_inserter(buf_), "; "); dump_stmt(*stm.iter); buf_.pop_back(); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); } if (stm.body->is()) @@ -805,7 +805,7 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -813,18 +813,18 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "foreach ( "); + std::format_to(std::back_inserter(buf_), "foreach ( "); if (stm.use_key) { dump_expr((ctx_->props() & props::foreach) ? *stm.index : *stm.key); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); } dump_expr(*stm.value); - fmt::format_to(std::back_inserter(buf_), " in "); + std::format_to(std::back_inserter(buf_), " in "); dump_expr(*stm.container); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); if (stm.body->is()) { @@ -833,7 +833,7 @@ auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void else { indent_ += 4; - fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); + std::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_); dump_stmt(*stm.body); indent_ -= 4; } @@ -841,148 +841,148 @@ auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void auto source::dump_stmt_switch(stmt_switch const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "switch ( "); + std::format_to(std::back_inserter(buf_), "switch ( "); dump_expr(*stm.test); - fmt::format_to(std::back_inserter(buf_), " )\n"); + std::format_to(std::back_inserter(buf_), " )\n"); dump_stmt_comp(*stm.body); } auto source::dump_stmt_case(stmt_case const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "case "); + std::format_to(std::back_inserter(buf_), "case "); dump_expr(*stm.value); - fmt::format_to(std::back_inserter(buf_), ":"); + std::format_to(std::back_inserter(buf_), ":"); if (stm.body != nullptr && stm.body->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_stmt_list(*stm.body); } } auto source::dump_stmt_default(stmt_default const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "default:"); + std::format_to(std::back_inserter(buf_), "default:"); if (stm.body != nullptr && stm.body->list.size() > 0) { - fmt::format_to(std::back_inserter(buf_), "\n"); + std::format_to(std::back_inserter(buf_), "\n"); dump_stmt_list(*stm.body); } } auto source::dump_stmt_break(stmt_break const&) -> void { - fmt::format_to(std::back_inserter(buf_), "break;"); + std::format_to(std::back_inserter(buf_), "break;"); } auto source::dump_stmt_continue(stmt_continue const&) -> void { - fmt::format_to(std::back_inserter(buf_), "continue;"); + std::format_to(std::back_inserter(buf_), "continue;"); } auto source::dump_stmt_return(stmt_return const& stm) -> void { if (stm.value->is()) { - fmt::format_to(std::back_inserter(buf_), "return;"); + std::format_to(std::back_inserter(buf_), "return;"); } else { - fmt::format_to(std::back_inserter(buf_), "return "); + std::format_to(std::back_inserter(buf_), "return "); dump_expr(*stm.value); - fmt::format_to(std::back_inserter(buf_), ";"); + std::format_to(std::back_inserter(buf_), ";"); } } auto source::dump_stmt_breakpoint(stmt_breakpoint const&) -> void { - fmt::format_to(std::back_inserter(buf_), "breakpoint;"); + std::format_to(std::back_inserter(buf_), "breakpoint;"); } auto source::dump_stmt_prof_begin(stmt_prof_begin const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "prof_begin("); + std::format_to(std::back_inserter(buf_), "prof_begin("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_prof_end(stmt_prof_end const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "prof_end("); + std::format_to(std::back_inserter(buf_), "prof_end("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_assert(stmt_assert const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "assert("); + std::format_to(std::back_inserter(buf_), "assert("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_assertex(stmt_assertex const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "assertex("); + std::format_to(std::back_inserter(buf_), "assertex("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_assertmsg(stmt_assertmsg const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "assertmsg("); + std::format_to(std::back_inserter(buf_), "assertmsg("); dump_expr_arguments(*stm.args); - fmt::format_to(std::back_inserter(buf_), ");"); + std::format_to(std::back_inserter(buf_), ");"); } auto source::dump_stmt_create(stmt_create const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_var_create( {} )", stm.index); + std::format_to(std::back_inserter(buf_), "__asm_var_create( {} )", stm.index); } auto source::dump_stmt_remove(stmt_remove const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_var_remove( {} )", stm.index); + std::format_to(std::back_inserter(buf_), "__asm_var_remove( {} )", stm.index); } auto source::dump_stmt_clear(stmt_clear const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_var_clear( {} )", stm.index); + std::format_to(std::back_inserter(buf_), "__asm_var_clear( {} )", stm.index); } auto source::dump_stmt_jmp(stmt_jmp const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp( {} )", stm.value); } auto source::dump_stmt_jmp_back(stmt_jmp_back const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_back( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_back( {} )", stm.value); } auto source::dump_stmt_jmp_cond(stmt_jmp_cond const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_cond( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_cond( {} )", stm.value); } auto source::dump_stmt_jmp_true(stmt_jmp_true const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_expr_true( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_expr_true( {} )", stm.value); } auto source::dump_stmt_jmp_false(stmt_jmp_false const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_jmp_expr_false( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_jmp_expr_false( {} )", stm.value); } auto source::dump_stmt_jmp_switch(stmt_jmp_switch const& stm) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_switch( {} )", stm.value); + std::format_to(std::back_inserter(buf_), "__asm_switch( {} )", stm.value); } auto source::dump_stmt_jmp_endswitch(stmt_jmp_endswitch const&) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_endswitch()"); + std::format_to(std::back_inserter(buf_), "__asm_endswitch()"); } auto source::dump_expr(expr const& exp) -> void @@ -1118,13 +1118,13 @@ auto source::dump_expr_increment(expr_increment const& exp) -> void { if (exp.prefix) { - fmt::format_to(std::back_inserter(buf_), "++"); + std::format_to(std::back_inserter(buf_), "++"); dump_expr(*exp.lvalue); } else { dump_expr(*exp.lvalue); - fmt::format_to(std::back_inserter(buf_), "++"); + std::format_to(std::back_inserter(buf_), "++"); } } @@ -1132,13 +1132,13 @@ auto source::dump_expr_decrement(expr_decrement const& exp) -> void { if (exp.prefix) { - fmt::format_to(std::back_inserter(buf_), "--"); + std::format_to(std::back_inserter(buf_), "--"); dump_expr(*exp.lvalue); } else { dump_expr(*exp.lvalue); - fmt::format_to(std::back_inserter(buf_), "--"); + std::format_to(std::back_inserter(buf_), "--"); } } @@ -1149,37 +1149,37 @@ auto source::dump_expr_assign(expr_assign const& exp) -> void switch (exp.oper) { case expr_assign::op::eq: - fmt::format_to(std::back_inserter(buf_), " = "); + std::format_to(std::back_inserter(buf_), " = "); break; case expr_assign::op::add: - fmt::format_to(std::back_inserter(buf_), " += "); + std::format_to(std::back_inserter(buf_), " += "); break; case expr_assign::op::sub: - fmt::format_to(std::back_inserter(buf_), " -= "); + std::format_to(std::back_inserter(buf_), " -= "); break; case expr_assign::op::mul: - fmt::format_to(std::back_inserter(buf_), " *= "); + std::format_to(std::back_inserter(buf_), " *= "); break; case expr_assign::op::div: - fmt::format_to(std::back_inserter(buf_), " /= "); + std::format_to(std::back_inserter(buf_), " /= "); break; case expr_assign::op::mod: - fmt::format_to(std::back_inserter(buf_), " %= "); + std::format_to(std::back_inserter(buf_), " %= "); break; case expr_assign::op::shl: - fmt::format_to(std::back_inserter(buf_), " <<= "); + std::format_to(std::back_inserter(buf_), " <<= "); break; case expr_assign::op::shr: - fmt::format_to(std::back_inserter(buf_), " >>= "); + std::format_to(std::back_inserter(buf_), " >>= "); break; case expr_assign::op::bwor: - fmt::format_to(std::back_inserter(buf_), " |= "); + std::format_to(std::back_inserter(buf_), " |= "); break; case expr_assign::op::bwand: - fmt::format_to(std::back_inserter(buf_), " &= "); + std::format_to(std::back_inserter(buf_), " &= "); break; case expr_assign::op::bwexor: - fmt::format_to(std::back_inserter(buf_), " ^= "); + std::format_to(std::back_inserter(buf_), " ^= "); break; } @@ -1189,9 +1189,9 @@ auto source::dump_expr_assign(expr_assign const& exp) -> void auto source::dump_expr_ternary(expr_ternary const& exp) -> void { dump_expr(*exp.test); - fmt::format_to(std::back_inserter(buf_), " ? "); + std::format_to(std::back_inserter(buf_), " ? "); dump_expr(*exp.true_expr); - fmt::format_to(std::back_inserter(buf_), " : "); + std::format_to(std::back_inserter(buf_), " : "); dump_expr(*exp.false_expr); } @@ -1202,58 +1202,58 @@ auto source::dump_expr_binary(expr_binary const& exp) -> void switch (exp.oper) { case expr_binary::op::bool_or: - fmt::format_to(std::back_inserter(buf_), " || "); + std::format_to(std::back_inserter(buf_), " || "); break; case expr_binary::op::bool_and: - fmt::format_to(std::back_inserter(buf_), " && "); + std::format_to(std::back_inserter(buf_), " && "); break; case expr_binary::op::eq: - fmt::format_to(std::back_inserter(buf_), " == "); + std::format_to(std::back_inserter(buf_), " == "); break; case expr_binary::op::ne: - fmt::format_to(std::back_inserter(buf_), " != "); + std::format_to(std::back_inserter(buf_), " != "); break; case expr_binary::op::le: - fmt::format_to(std::back_inserter(buf_), " <= "); + std::format_to(std::back_inserter(buf_), " <= "); break; case expr_binary::op::ge: - fmt::format_to(std::back_inserter(buf_), " >= "); + std::format_to(std::back_inserter(buf_), " >= "); break; case expr_binary::op::lt: - fmt::format_to(std::back_inserter(buf_), " < "); + std::format_to(std::back_inserter(buf_), " < "); break; case expr_binary::op::gt: - fmt::format_to(std::back_inserter(buf_), " > "); + std::format_to(std::back_inserter(buf_), " > "); break; case expr_binary::op::add: - fmt::format_to(std::back_inserter(buf_), " + "); + std::format_to(std::back_inserter(buf_), " + "); break; case expr_binary::op::sub: - fmt::format_to(std::back_inserter(buf_), " - "); + std::format_to(std::back_inserter(buf_), " - "); break; case expr_binary::op::mul: - fmt::format_to(std::back_inserter(buf_), " * "); + std::format_to(std::back_inserter(buf_), " * "); break; case expr_binary::op::div: - fmt::format_to(std::back_inserter(buf_), " / "); + std::format_to(std::back_inserter(buf_), " / "); break; case expr_binary::op::mod: - fmt::format_to(std::back_inserter(buf_), " % "); + std::format_to(std::back_inserter(buf_), " % "); break; case expr_binary::op::shl: - fmt::format_to(std::back_inserter(buf_), " << "); + std::format_to(std::back_inserter(buf_), " << "); break; case expr_binary::op::shr: - fmt::format_to(std::back_inserter(buf_), " >> "); + std::format_to(std::back_inserter(buf_), " >> "); break; case expr_binary::op::bwor: - fmt::format_to(std::back_inserter(buf_), " | "); + std::format_to(std::back_inserter(buf_), " | "); break; case expr_binary::op::bwand: - fmt::format_to(std::back_inserter(buf_), " & "); + std::format_to(std::back_inserter(buf_), " & "); break; case expr_binary::op::bwexor: - fmt::format_to(std::back_inserter(buf_), " ^ "); + std::format_to(std::back_inserter(buf_), " ^ "); break; } @@ -1262,19 +1262,19 @@ auto source::dump_expr_binary(expr_binary const& exp) -> void auto source::dump_expr_not(expr_not const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "!"); + std::format_to(std::back_inserter(buf_), "!"); dump_expr(*exp.rvalue); } auto source::dump_expr_negate(expr_negate const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "-"); + std::format_to(std::back_inserter(buf_), "-"); dump_expr(*exp.rvalue); } auto source::dump_expr_complement(expr_complement const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "~"); + std::format_to(std::back_inserter(buf_), "~"); dump_expr(*exp.rvalue); } @@ -1286,7 +1286,7 @@ auto source::dump_expr_call(expr_call const& exp) -> void auto source::dump_expr_method(expr_method const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_call(*exp.value); } @@ -1308,56 +1308,56 @@ auto source::dump_call(call const& exp) -> void auto source::dump_expr_function(expr_function const& exp) -> void { if (exp.mode == call::mode::thread) - fmt::format_to(std::back_inserter(buf_), "thread "); + std::format_to(std::back_inserter(buf_), "thread "); else if (exp.mode == call::mode::childthread) - fmt::format_to(std::back_inserter(buf_), "childthread "); + std::format_to(std::back_inserter(buf_), "childthread "); if (exp.path->value != "") { dump_expr_path(*exp.path); - fmt::format_to(std::back_inserter(buf_), "::"); + std::format_to(std::back_inserter(buf_), "::"); } dump_expr_identifier(*exp.name); - fmt::format_to(std::back_inserter(buf_), "("); + std::format_to(std::back_inserter(buf_), "("); dump_expr_arguments(*exp.args); - fmt::format_to(std::back_inserter(buf_), ")"); + std::format_to(std::back_inserter(buf_), ")"); } auto source::dump_expr_pointer(expr_pointer const& exp) -> void { if (exp.mode == call::mode::builtin) - fmt::format_to(std::back_inserter(buf_), "call "); + std::format_to(std::back_inserter(buf_), "call "); else if (exp.mode == call::mode::thread) - fmt::format_to(std::back_inserter(buf_), "thread "); + std::format_to(std::back_inserter(buf_), "thread "); else if (exp.mode == call::mode::childthread) - fmt::format_to(std::back_inserter(buf_), "childthread "); + std::format_to(std::back_inserter(buf_), "childthread "); - fmt::format_to(std::back_inserter(buf_), "[[ "); + std::format_to(std::back_inserter(buf_), "[[ "); dump_expr(*exp.func); - fmt::format_to(std::back_inserter(buf_), " ]]("); + std::format_to(std::back_inserter(buf_), " ]]("); dump_expr_arguments(*exp.args); - fmt::format_to(std::back_inserter(buf_), ")"); + std::format_to(std::back_inserter(buf_), ")"); } auto source::dump_expr_add_array(expr_add_array const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "["); + std::format_to(std::back_inserter(buf_), "["); dump_expr_arguments(*exp.args); - fmt::format_to(std::back_inserter(buf_), "]"); + std::format_to(std::back_inserter(buf_), "]"); } auto source::dump_expr_parameters(expr_parameters const& exp) -> void { for (auto const& entry : exp.list) { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_expr_identifier(*entry); if (&entry != &exp.list.back()) - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); else - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } } @@ -1365,184 +1365,184 @@ auto source::dump_expr_arguments(expr_arguments const& exp) -> void { for (auto const& entry : exp.list) { - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); dump_expr(*entry); if (&entry != &exp.list.back()) - fmt::format_to(std::back_inserter(buf_), ","); + std::format_to(std::back_inserter(buf_), ","); else - fmt::format_to(std::back_inserter(buf_), " "); + std::format_to(std::back_inserter(buf_), " "); } } auto source::dump_expr_isdefined(expr_isdefined const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "isdefined( "); + std::format_to(std::back_inserter(buf_), "isdefined( "); dump_expr(*exp.value); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_istrue(expr_istrue const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "istrue( "); + std::format_to(std::back_inserter(buf_), "istrue( "); dump_expr(*exp.value); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_reference(expr_reference const& exp) -> void { dump_expr_path(*exp.path); - fmt::format_to(std::back_inserter(buf_), "::"); + std::format_to(std::back_inserter(buf_), "::"); dump_expr_identifier(*exp.name); } auto source::dump_expr_tuple(expr_tuple const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "["); + std::format_to(std::back_inserter(buf_), "["); for (auto const& entry : exp.list) { dump_expr(*entry); if (&entry != &exp.list.back()) - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); } - fmt::format_to(std::back_inserter(buf_), "]"); + std::format_to(std::back_inserter(buf_), "]"); } auto source::dump_expr_array(expr_array const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), "["); + std::format_to(std::back_inserter(buf_), "["); dump_expr(*exp.key); - fmt::format_to(std::back_inserter(buf_), "]"); + std::format_to(std::back_inserter(buf_), "]"); } auto source::dump_expr_field(expr_field const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), "."); + std::format_to(std::back_inserter(buf_), "."); dump_expr_identifier(*exp.field); } auto source::dump_expr_size(expr_size const& exp) -> void { dump_expr(*exp.obj); - fmt::format_to(std::back_inserter(buf_), ".size"); + std::format_to(std::back_inserter(buf_), ".size"); } auto source::dump_expr_paren(expr_paren const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "( "); + std::format_to(std::back_inserter(buf_), "( "); dump_expr(*exp.value); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_thisthread(expr_thisthread const&) -> void { - fmt::format_to(std::back_inserter(buf_), "thisthread"); + std::format_to(std::back_inserter(buf_), "thisthread"); } auto source::dump_expr_empty_array(expr_empty_array const&) -> void { - fmt::format_to(std::back_inserter(buf_), "[]"); + std::format_to(std::back_inserter(buf_), "[]"); } auto source::dump_expr_undefined(expr_undefined const&) -> void { - fmt::format_to(std::back_inserter(buf_), "undefined"); + std::format_to(std::back_inserter(buf_), "undefined"); } auto source::dump_expr_game(expr_game const&) -> void { - fmt::format_to(std::back_inserter(buf_), "game"); + std::format_to(std::back_inserter(buf_), "game"); } auto source::dump_expr_self(expr_self const&) -> void { - fmt::format_to(std::back_inserter(buf_), "self"); + std::format_to(std::back_inserter(buf_), "self"); } auto source::dump_expr_anim(expr_anim const&) -> void { - fmt::format_to(std::back_inserter(buf_), "anim"); + std::format_to(std::back_inserter(buf_), "anim"); } auto source::dump_expr_level(expr_level const&) -> void { - fmt::format_to(std::back_inserter(buf_), "level"); + std::format_to(std::back_inserter(buf_), "level"); } auto source::dump_expr_animation(expr_animation const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "%{}", exp.value); + std::format_to(std::back_inserter(buf_), "%{}", exp.value); } auto source::dump_expr_animtree(expr_animtree const&) -> void { - fmt::format_to(std::back_inserter(buf_), "#animtree"); + std::format_to(std::back_inserter(buf_), "#animtree"); } auto source::dump_expr_identifier(expr_identifier const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", exp.value); + std::format_to(std::back_inserter(buf_), "{}", exp.value); } auto source::dump_expr_path(expr_path const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", utils::string::backslash(exp.value)); + std::format_to(std::back_inserter(buf_), "{}", utils::string::backslash(exp.value)); } auto source::dump_expr_istring(expr_istring const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "&{}", utils::string::to_literal(exp.value)); + std::format_to(std::back_inserter(buf_), "&{}", utils::string::to_literal(exp.value)); } auto source::dump_expr_string(expr_string const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", utils::string::to_literal(exp.value)); + std::format_to(std::back_inserter(buf_), "{}", utils::string::to_literal(exp.value)); } auto source::dump_expr_vector(expr_vector const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "( "); + std::format_to(std::back_inserter(buf_), "( "); dump_expr(*exp.x); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); dump_expr(*exp.y); - fmt::format_to(std::back_inserter(buf_), ", "); + std::format_to(std::back_inserter(buf_), ", "); dump_expr(*exp.z); - fmt::format_to(std::back_inserter(buf_), " )"); + std::format_to(std::back_inserter(buf_), " )"); } auto source::dump_expr_float(expr_float const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", exp.value); + std::format_to(std::back_inserter(buf_), "{}", exp.value); } auto source::dump_expr_integer(expr_integer const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "{}", exp.value); + std::format_to(std::back_inserter(buf_), "{}", exp.value); } auto source::dump_expr_false(expr_false const&) -> void { - fmt::format_to(std::back_inserter(buf_), "false"); + std::format_to(std::back_inserter(buf_), "false"); } auto source::dump_expr_true(expr_true const&) -> void { - fmt::format_to(std::back_inserter(buf_), "true"); + std::format_to(std::back_inserter(buf_), "true"); } auto source::dump_expr_var_create(expr_var_create const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_var_create( {} )", exp.index); + std::format_to(std::back_inserter(buf_), "__asm_var_create( {} )", exp.index); } auto source::dump_expr_var_access(expr_var_access const& exp) -> void { - fmt::format_to(std::back_inserter(buf_), "__asm_var_access( {} )", exp.index); + std::format_to(std::back_inserter(buf_), "__asm_var_access( {} )", exp.index); } } // namespace xsk::gsc diff --git a/src/tool/main.cpp b/src/tool/main.cpp index d142817f..d30bbdfb 100644 --- a/src/tool/main.cpp +++ b/src/tool/main.cpp @@ -179,7 +179,7 @@ auto assemble_file(game game, mach mach, fs::path file, fs::path rel) -> result auto path = fs::path{ "assembled" } / rel; utils::file::save(path, std::get<0>(outbin).data, std::get<0>(outbin).size); utils::file::save(path.replace_extension(".cgsc.stack"), std::get<1>(outbin).data, std::get<1>(outbin).size); - std::cout << fmt::format("assembled {}\n", rel.generic_string()); + std::cout << std::format("assembled {}\n", rel.generic_string()); } else { @@ -199,7 +199,7 @@ auto assemble_file(game game, mach mach, fs::path file, fs::path rel) -> result auto result = script.serialize(); utils::file::save(fs::path{ "assembled" } / rel, result); - std::cout << fmt::format("assembled {}\n", rel.generic_string()); + std::cout << std::format("assembled {}\n", rel.generic_string()); } } @@ -207,7 +207,7 @@ auto assemble_file(game game, mach mach, fs::path file, fs::path rel) -> result } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -247,12 +247,12 @@ auto disassemble_file(game game, mach mach, fs::path file, fs::path rel) -> resu auto outsrc = contexts[game][mach]->source().dump(*outasm); utils::file::save(fs::path{ "disassembled" } / rel, outsrc); - std::cout << fmt::format("disassembled {}\n", rel.generic_string()); + std::cout << std::format("disassembled {}\n", rel.generic_string()); return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -274,7 +274,7 @@ auto compile_file(game game, mach mach, fs::path file, fs::path rel) -> result auto path = fs::path{ "compiled" } / rel; utils::file::save(path, std::get<0>(outbin).data, std::get<0>(outbin).size); utils::file::save(path.replace_extension(".cgsc.stack"), std::get<1>(outbin).data, std::get<1>(outbin).size); - std::cout << fmt::format("compiled {}\n", rel.generic_string()); + std::cout << std::format("compiled {}\n", rel.generic_string()); } else { @@ -294,12 +294,12 @@ auto compile_file(game game, mach mach, fs::path file, fs::path rel) -> result auto result = script.serialize(); utils::file::save(fs::path{ "compiled" } / rel, result); - std::cout << fmt::format("compiled {}\n", rel.generic_string()); + std::cout << std::format("compiled {}\n", rel.generic_string()); if ((contexts[game][mach]->build() & build::dev_maps) != build::prod) { utils::file::save(fs::path{ "compiled" } / fs::path{ "developer_maps" } / rel.replace_extension(".gscmap"), std::get<2>(outbin).data, std::get<2>(outbin).size); - std::cout << fmt::format("saved developer map {}\n", rel.generic_string()); + std::cout << std::format("saved developer map {}\n", rel.generic_string()); } } } @@ -308,7 +308,7 @@ auto compile_file(game game, mach mach, fs::path file, fs::path rel) -> result } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -349,12 +349,12 @@ auto decompile_file(game game, mach mach, fs::path file, fs::path rel) -> result auto outsrc = contexts[game][mach]->source().dump(*outast); utils::file::save(fs::path{ "decompiled" } / rel, outsrc); - std::cout << fmt::format("decompiled {}\n", rel.generic_string()); + std::cout << std::format("decompiled {}\n", rel.generic_string()); return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -369,12 +369,12 @@ auto parse_file(game game, mach mach, fs::path file, fs::path rel) -> result auto prog = contexts[game][mach]->source().parse_program(file.string(), data); utils::file::save(fs::path{ "parsed" } / rel, contexts[game][mach]->source().dump(*prog)); - std::cout << fmt::format("parsed {}\n", rel.generic_string()); + std::cout << std::format("parsed {}\n", rel.generic_string()); return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -419,20 +419,20 @@ auto rename_file(game game, mach mach, fs::path file, fs::path rel) -> result auto data = utils::file::read(file); utils::file::save(fs::path{ "renamed" } / rel, data); - std::cout << fmt::format("renamed {} -> {}\n", file.filename().generic_string(), rel.generic_string()); + std::cout << std::format("renamed {} -> {}\n", file.filename().generic_string(), rel.generic_string()); if (zt) { auto stack = utils::file::read(file.replace_extension(".cgsc.stack")); utils::file::save(fs::path{ "renamed" } / rel.replace_extension(".cgsc.stack"), stack); - std::cout << fmt::format("renamed {} -> {}\n", file.filename().generic_string(), rel.generic_string()); + std::cout << std::format("renamed {} -> {}\n", file.filename().generic_string(), rel.generic_string()); } return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -749,12 +749,12 @@ auto assemble_file(game game, mach mach, fs::path const& file, fs::path rel) -> auto outbin = contexts[game][mach]->assembler().assemble(*outasm); utils::file::save(fs::path{ "assembled" } / rel, outbin.first.data, outbin.first.size); - std::cout << fmt::format("assembled {}\n", rel.generic_string()); + std::cout << std::format("assembled {}\n", rel.generic_string()); return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -770,12 +770,12 @@ auto disassemble_file(game game, mach mach, fs::path const& file, fs::path rel) auto outsrc = contexts[game][mach]->source().dump(*outasm); utils::file::save(fs::path{ "disassembled" } / rel, outsrc); - std::cout << fmt::format("disassembled {}\n", rel.generic_string()); + std::cout << std::format("disassembled {}\n", rel.generic_string()); return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -793,7 +793,7 @@ auto compile_file(game game, mach mach, fs::path const& file, fs::path rel) -> r if (!std::memcmp(&data[0], "\x80GSC", 4)) { - std::cerr << fmt::format("{} at {}\n", "already compiled", file.generic_string()); + std::cerr << std::format("{} at {}\n", "already compiled", file.generic_string()); return result::success; } @@ -801,19 +801,19 @@ auto compile_file(game game, mach mach, fs::path const& file, fs::path rel) -> r auto outbin = contexts[game][mach]->assembler().assemble(*outasm); utils::file::save(fs::path{ "compiled" } / rel, outbin.first.data, outbin.first.size); - std::cout << fmt::format("compiled {}\n", rel.generic_string()); + std::cout << std::format("compiled {}\n", rel.generic_string()); if ((contexts[game][mach]->build() & build::dev_maps) != build::prod) { utils::file::save(fs::path{ "compiled" } / fs::path{ "developer_maps" } / rel.replace_extension((rel.extension().string().starts_with(".gsc") ? ".gscmap" : ".cscmap")), outbin.second.data, outbin.second.size); - std::cout << fmt::format("saved developer map {}\n", rel.generic_string()); + std::cout << std::format("saved developer map {}\n", rel.generic_string()); } return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } @@ -831,25 +831,25 @@ auto decompile_file(game game, mach mach, fs::path const& file, fs::path rel) -> auto output = contexts[game][mach]->source().dump(*outsrc); utils::file::save(fs::path{ "decompiled" } / rel, output); - std::cout << fmt::format("decompiled {}\n", rel.generic_string()); + std::cout << std::format("decompiled {}\n", rel.generic_string()); return result::success; } catch (std::exception const& e) { - std::cerr << fmt::format("{} at {}\n", e.what(), file.generic_string()); + std::cerr << std::format("{} at {}\n", e.what(), file.generic_string()); return result::failure; } } auto parse_file(game, mach, fs::path const&, fs::path) -> result { - std::cerr << fmt::format("not implemented for treyarch\n"); + std::cerr << std::format("not implemented for treyarch\n"); return result::failure; } auto rename_file(game, mach, fs::path const&, fs::path) -> result { - std::cerr << fmt::format("not implemented for treyarch\n"); + std::cerr << std::format("not implemented for treyarch\n"); return result::failure; } @@ -1023,7 +1023,7 @@ auto execute(mode mode, game game, mach mach, fs::path const& path, bool dev) -> { if (!extension_match(path.extension(), mode, game)) { - std::cerr << fmt::format("bad extension '{}'\n", path.extension().string()); + std::cerr << std::format("bad extension '{}'\n", path.extension().string()); return result::failure; } @@ -1034,7 +1034,7 @@ auto execute(mode mode, game game, mach mach, fs::path const& path, bool dev) -> } else { - std::cerr << fmt::format("bad path '{}'\n", path.generic_string()); + std::cerr << std::format("bad path '{}'\n", path.generic_string()); return result::failure; } } @@ -1090,7 +1090,7 @@ auto parse_system(std::string const& arg, mach& out) -> bool auto branding() -> std::string { - return fmt::format("GSC Tool {} created by xensik\n", XSK_VERSION_STR); + return std::format("GSC Tool {} created by xensik\n", XSK_VERSION_STR); } auto main(u32 argc, char** argv) -> result diff --git a/src/utils/file.cpp b/src/utils/file.cpp index e1457c7b..1fe849ca 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -17,7 +17,7 @@ auto file::read(std::filesystem::path const& file) -> std::vector if (!stream.good() && !stream.is_open()) { - throw std::runtime_error(fmt::format("couldn't open file {}", file.string())); + throw std::runtime_error(std::format("couldn't open file {}", file.string())); } stream.seekg(0, std::ios::end); diff --git a/src/utils/reader.cpp b/src/utils/reader.cpp index 97f2d52e..e247e1a3 100644 --- a/src/utils/reader.cpp +++ b/src/utils/reader.cpp @@ -207,7 +207,7 @@ auto reader::read_bytes(u32 pos, u32 count) -> std::string for (auto i = pos; i < pos + count; i++) { - fmt::format_to(std::back_insert_iterator(data), "{:02X} ", *reinterpret_cast(data_ + i)); + std::format_to(std::back_insert_iterator(data), "{:02X} ", *reinterpret_cast(data_ + i)); } data.pop_back(); diff --git a/src/utils/zlib.cpp b/src/utils/zlib.cpp index f4f0b557..1175e432 100644 --- a/src/utils/zlib.cpp +++ b/src/utils/zlib.cpp @@ -25,7 +25,7 @@ auto zlib::compress(std::vector const& data) -> std::vector return output; } - throw std::runtime_error(fmt::format("zlib compress error {}", result)); + throw std::runtime_error(std::format("zlib compress error {}", result)); } auto zlib::decompress(std::vector const& data, u32 length) -> std::vector @@ -38,7 +38,7 @@ auto zlib::decompress(std::vector const& data, u32 length) -> std::vector