From ef336d6ba6f25600b09b5c8765dcaf0543b61f7a Mon Sep 17 00:00:00 2001 From: Makiras <22570332+Makiras@users.noreply.github.com> Date: Sat, 4 Apr 2026 10:20:32 +0800 Subject: [PATCH 01/13] (fix): artifacts patch --- template/cpp/dut.cpp | 5 +---- template/mem_direct/Makefile | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/template/cpp/dut.cpp b/template/cpp/dut.cpp index 6a4ac5b..09e16ba 100644 --- a/template/cpp/dut.cpp +++ b/template/cpp/dut.cpp @@ -54,10 +54,7 @@ void UT{{__TOP_MODULE_NAME__}}::init() // add {{__TOP_MODULE_NAME__}} ports {{__XPORT_ADD__}} - xfunction stepfunc = [&](bool d) -> int { - return this->dut->simStep(d); - }; - this->xclock.ReInit(stepfunc, {}, {}); + this->xclock.ReInit(this->dut->pxcStep, this->dut->pSelf, {}, {}); this->xclock.Add(this->xport); this->xcfg = new XSignalCFG(this->dut->GetXSignalCFGPath(), this->dut->GetXSignalCFGBasePtr()); diff --git a/template/mem_direct/Makefile b/template/mem_direct/Makefile index 33d78fb..5de57a5 100644 --- a/template/mem_direct/Makefile +++ b/template/mem_direct/Makefile @@ -21,7 +21,7 @@ CXXFLAGS += -I ${V_ROOT}/include -I ${V_ROOT}/include/vltstd/ \ -I ../build/DPI${TOP_NAME} \ -L../build ${CFLAGS} LDFLAGS += $(WHOLE_ARCHIVE_LDFLAGS) -Wl,-undefined,dynamic_lookup -LDLIBS += -lpthread -lz +LDLIBS += -lpthread -lz -L/usr/local/lib -lxspcomm {% endif %} {% if __SIMULATOR__ == "gsim" %} From 71398e1597c2b00839db86d257531c7b3ffc92a1 Mon Sep 17 00:00:00 2001 From: Makiras <22570332+Makiras@users.noreply.github.com> Date: Thu, 18 Jun 2026 09:53:57 +0800 Subject: [PATCH 02/13] (fix) vcs waveform: support fsdb rename and flush --- src/codegen/sv.cpp | 30 +++++++++++++++++++++++----- template/lib/dut_base.cpp | 13 +++++++----- template/lib/dut_base.hpp | 3 +++ test/test_codegen_sv_param_multi.cpp | 3 +++ 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/codegen/sv.cpp b/src/codegen/sv.cpp index fca3faf..d6b3980 100644 --- a/src/codegen/sv.cpp +++ b/src/codegen/sv.cpp @@ -32,6 +32,24 @@ namespace picker { namespace codegen { " $finish;\n" " endfunction\n"; + static const std::string vcs_fsdb_control_sv_template = + " export \"DPI-C\" function vcs_fsdb_set_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}};\n" + " function void vcs_fsdb_set_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}};\n" + " input string filename;\n" + " $fsdbDumpfile(filename);\n" + " $fsdbDumpvars(0, {{__TOP_MODULE_NAME__}}_top{{__DUMP_VAR_OPTIONS__}});\n" + " endfunction\n\n" + " export \"DPI-C\" function vcs_fsdb_flush_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}};\n" + " function void vcs_fsdb_flush_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}};\n" + " $fsdbDumpflush;\n" + " endfunction\n\n" + " export \"DPI-C\" function vcs_fsdb_waveform_enable_{{__LIB_DPI_FUNC_NAME_HASH__}};\n" + " function void vcs_fsdb_waveform_enable_{{__LIB_DPI_FUNC_NAME_HASH__}};\n" + " input byte unsigned enable;\n" + " if (enable) $fsdbDumpon;\n" + " else $fsdbDumpoff;\n" + " endfunction\n"; + /// @brief Export external pin for verilog render, contains pin connect, /// @param pin /// @param pin_connect @@ -130,14 +148,15 @@ namespace picker { namespace codegen { void render_sv_waveform(const std::string &simulator, const std::string &wave_file_name, nlohmann::json &data) { inja::Environment env; - std::string sv_dump_wave, trace, dum_var_options; + std::string sv_dump_wave, sv_waveform_control, trace, dum_var_options; dum_var_options = picker::get_env("DUMPVARS_OPTION", ""); if (!dum_var_options.empty()) { PK_DEBUG("Find DUMPVARS_OPTION=%s", dum_var_options.c_str()); dum_var_options = ", \"" + dum_var_options + "\""; } - data["__WAVE_FILE_NAME__"] = wave_file_name; - data["__DUMP_VAR_OPTIONS__"] = dum_var_options; + data["__WAVE_FILE_NAME__"] = wave_file_name; + data["__DUMP_VAR_OPTIONS__"] = dum_var_options; + data["__LIB_DPI_FUNC_NAME_HASH__"] = std::string(lib_random_hash); if (simulator == "verilator") { if (wave_file_name.length() > 0) { if (wave_file_name.ends_with(".vcd") || wave_file_name.ends_with(".fst")) @@ -151,13 +170,14 @@ namespace picker { namespace codegen { PK_FATAL("Verilator trace file must be .vcd or .fst format.\n"); } } else if (simulator == "vcs") { + sv_waveform_control = env.render(vcs_fsdb_control_sv_template, data); if (wave_file_name.length() > 0) { if (wave_file_name.ends_with(".fsdb") == false) PK_FATAL("VCS trace file must be .fsdb format.\n"); sv_dump_wave = env.render(" initial begin\n" " $fsdbDumpfile(\"{{__WAVE_FILE_NAME__}}\");\n" " $fsdbDumpvars(0, {{__TOP_MODULE_NAME__}}_top{{__DUMP_VAR_OPTIONS__}});\n" - " end", + " end\n\n", data); } } else if (simulator == "uvs") { @@ -177,7 +197,7 @@ namespace picker { namespace codegen { data["__TRACE__"] = sv_dump_wave.length() > 0 ? wave_file_name.substr(wave_file_name.find_last_of(".") + 1, wave_file_name.length()) : "OFF"; - data["__SV_DUMP_WAVE__"] = sv_dump_wave; + data["__SV_DUMP_WAVE__"] = sv_dump_wave + sv_waveform_control; } void render_signal_tree(const std::vector &external_pin, diff --git a/template/lib/dut_base.cpp b/template/lib/dut_base.cpp index 735c965..28cdef6 100644 --- a/template/lib/dut_base.cpp +++ b/template/lib/dut_base.cpp @@ -89,7 +89,10 @@ int DutVcsBase::Finish() void DutVcsBase::SetWaveform(const char *filename) { - XInfo("VCS waveform is not supported"); + if (filename == nullptr || !std::string(filename).ends_with(".fsdb")) { + XFatal("VCS trace file must be .fsdb format"); + } + vcs_fsdb_set_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}}(filename); }; void DutVcsBase::SetCoverage(const char *filename) { @@ -97,21 +100,21 @@ void DutVcsBase::SetCoverage(const char *filename) }; void DutVcsBase::FlushWaveform() { - XInfo("VCS waveform is not supported"); + vcs_fsdb_flush_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}}(); }; bool DutVcsBase::ResumeWaveformDump() { - XInfo("VCS waveform is not supported"); + vcs_fsdb_waveform_enable_{{__LIB_DPI_FUNC_NAME_HASH__}}(1); return true; }; bool DutVcsBase::PauseWaveformDump() { - XInfo("VCS waveform is not supported"); + vcs_fsdb_waveform_enable_{{__LIB_DPI_FUNC_NAME_HASH__}}(0); return true; }; void DutVcsBase::WaveformEnable(bool enable) { - XInfo("VCS waveform is not supported"); + vcs_fsdb_waveform_enable_{{__LIB_DPI_FUNC_NAME_HASH__}}(enable ? 1 : 0); }; int DutVcsBase::CheckPoint(const char *filename) { diff --git a/template/lib/dut_base.hpp b/template/lib/dut_base.hpp index 1c126aa..dd90021 100644 --- a/template/lib/dut_base.hpp +++ b/template/lib/dut_base.hpp @@ -134,6 +134,9 @@ int VcsMain(int argc, char **argv); void VcsInit(); void VcsSimUntil(uint64_t *); void finish_{{__LIB_DPI_FUNC_NAME_HASH__}}(); +void vcs_fsdb_set_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}}(const char *filename); +void vcs_fsdb_flush_waveform_{{__LIB_DPI_FUNC_NAME_HASH__}}(); +void vcs_fsdb_waveform_enable_{{__LIB_DPI_FUNC_NAME_HASH__}}(unsigned char enable); } #include "vc_hdrs.h" diff --git a/test/test_codegen_sv_param_multi.cpp b/test/test_codegen_sv_param_multi.cpp index bade98a..7c2b681 100644 --- a/test/test_codegen_sv_param_multi.cpp +++ b/test/test_codegen_sv_param_multi.cpp @@ -47,6 +47,9 @@ int main() const auto sv_wave = data["__SV_DUMP_WAVE__"].get(); assert(contains_line(sv_wave, "$fsdbDumpfile(\"dump.fsdb\")")); + assert(contains_line(sv_wave, "export \"DPI-C\" function vcs_fsdb_set_waveform_H")); + assert(contains_line(sv_wave, "$fsdbDumpflush")); + assert(contains_line(sv_wave, "$fsdbDumpoff")); assert(data["__TRACE__"].get() == "fsdb"); nlohmann::json data2; From f6ee9a77b3be18fae8eab342a3b96ce1afcaf43b Mon Sep 17 00:00:00 2001 From: Makiras <22570332+Makiras@users.noreply.github.com> Date: Thu, 18 Jun 2026 10:09:15 +0800 Subject: [PATCH 03/13] (update) yaml-cpp: move to dependence and bump to 0.9.0 --- CMakeLists.txt | 2 +- dependence/yaml-cpp/.bazelignore | 1 + {third => dependence}/yaml-cpp/.clang-format | 0 {third => dependence}/yaml-cpp/.codedocs | 2 +- dependence/yaml-cpp/.github/dependabot.yml | 11 + .../yaml-cpp/.github/workflows/build.yml | 141 + .../.github/workflows/bzlmod-archive.yml | 19 + {third => dependence}/yaml-cpp/.gitignore | 0 {third => dependence}/yaml-cpp/BUILD.bazel | 2 + {third => dependence}/yaml-cpp/CMakeLists.txt | 40 +- .../yaml-cpp/CONTRIBUTING.md | 4 +- {third => dependence}/yaml-cpp/LICENSE | 0 dependence/yaml-cpp/MODULE.bazel | 14 + dependence/yaml-cpp/MODULE.bazel.lock | 282 ++ {third => dependence}/yaml-cpp/README.md | 32 +- {third => dependence}/yaml-cpp/SECURITY.md | 0 .../yaml-cpp/cmake_uninstall.cmake.in | 0 .../yaml-cpp/docs/Breaking-Changes.md | 0 .../yaml-cpp/docs/How-To-Emit-YAML.md | 14 +- .../docs/How-To-Parse-A-Document-(Old-API).md | 0 .../yaml-cpp/docs/Strings.md | 0 .../yaml-cpp/docs/Tutorial.md | 0 .../yaml-cpp/docs/_config.yml | 0 {third => dependence}/yaml-cpp/docs/index.md | 0 .../yaml-cpp/include/yaml-cpp/anchor.h | 0 .../yaml-cpp/include/yaml-cpp/binary.h | 0 .../include/yaml-cpp/contrib/anchordict.h | 0 .../include/yaml-cpp/contrib/graphbuilder.h | 0 .../yaml-cpp/include/yaml-cpp/depthguard.h | 0 .../yaml-cpp/include/yaml-cpp/dll.h | 2 - .../include/yaml-cpp/emitfromevents.h | 1 + .../yaml-cpp/include/yaml-cpp/emitter.h | 20 +- .../yaml-cpp/include/yaml-cpp/emitterdef.h | 0 .../yaml-cpp/include/yaml-cpp/emittermanip.h | 0 .../yaml-cpp/include/yaml-cpp/emitterstyle.h | 7 +- .../yaml-cpp/include/yaml-cpp/eventhandler.h | 0 .../yaml-cpp/include/yaml-cpp/exceptions.h | 2 + .../yaml-cpp/include/yaml-cpp/fptostring.h | 15 + .../yaml-cpp/include/yaml-cpp/mark.h | 0 .../yaml-cpp/include/yaml-cpp/node/convert.h | 9 +- .../include/yaml-cpp/node/detail/impl.h | 0 .../include/yaml-cpp/node/detail/iterator.h | 2 +- .../yaml-cpp/node/detail/iterator_fwd.h | 0 .../include/yaml-cpp/node/detail/memory.h | 1 + .../include/yaml-cpp/node/detail/node.h | 0 .../include/yaml-cpp/node/detail/node_data.h | 0 .../yaml-cpp/node/detail/node_iterator.h | 2 +- .../include/yaml-cpp/node/detail/node_ref.h | 0 .../yaml-cpp/include/yaml-cpp/node/emit.h | 0 .../yaml-cpp/include/yaml-cpp/node/impl.h | 8 +- .../yaml-cpp/include/yaml-cpp/node/iterator.h | 0 .../yaml-cpp/include/yaml-cpp/node/node.h | 0 .../yaml-cpp/include/yaml-cpp/node/parse.h | 0 .../yaml-cpp/include/yaml-cpp/node/ptr.h | 0 .../yaml-cpp/include/yaml-cpp/node/type.h | 7 +- .../yaml-cpp/include/yaml-cpp/noexcept.h | 0 .../yaml-cpp/include/yaml-cpp/null.h | 4 +- .../include/yaml-cpp/ostream_wrapper.h | 0 .../yaml-cpp/include/yaml-cpp/parser.h | 0 .../yaml-cpp/include/yaml-cpp/stlemitter.h | 0 .../yaml-cpp/include/yaml-cpp/traits.h | 1 + .../yaml-cpp/include/yaml-cpp/yaml.h | 4 + {third => dependence}/yaml-cpp/install.txt | 0 {third => dependence}/yaml-cpp/src/binary.cpp | 0 .../yaml-cpp/src/collectionstack.h | 0 dependence/yaml-cpp/src/contrib/dragonbox.h | 4196 +++++++++++++++++ .../yaml-cpp/src/contrib/graphbuilder.cpp | 0 .../src/contrib/graphbuilderadapter.cpp | 0 .../src/contrib/graphbuilderadapter.h | 0 .../yaml-cpp/src/contrib/yaml-cpp.natvis | 0 .../yaml-cpp/src/contrib/yaml-cpp.natvis.md | 0 .../yaml-cpp/src/convert.cpp | 0 .../yaml-cpp/src/depthguard.cpp | 0 .../yaml-cpp/src/directives.cpp | 0 .../yaml-cpp/src/directives.h | 0 {third => dependence}/yaml-cpp/src/emit.cpp | 0 .../yaml-cpp/src/emitfromevents.cpp | 9 +- .../yaml-cpp/src/emitter.cpp | 27 +- .../yaml-cpp/src/emitterstate.cpp | 0 .../yaml-cpp/src/emitterstate.h | 0 .../yaml-cpp/src/emitterutils.cpp | 76 +- .../yaml-cpp/src/emitterutils.h | 14 +- .../yaml-cpp/src/exceptions.cpp | 0 {third => dependence}/yaml-cpp/src/exp.cpp | 0 {third => dependence}/yaml-cpp/src/exp.h | 0 dependence/yaml-cpp/src/fptostring.cpp | 255 + .../yaml-cpp/src/indentation.h | 1 - {third => dependence}/yaml-cpp/src/memory.cpp | 8 + {third => dependence}/yaml-cpp/src/node.cpp | 0 .../yaml-cpp/src/node_data.cpp | 1 + .../yaml-cpp/src/nodebuilder.cpp | 0 .../yaml-cpp/src/nodebuilder.h | 0 .../yaml-cpp/src/nodeevents.cpp | 0 .../yaml-cpp/src/nodeevents.h | 0 dependence/yaml-cpp/src/null.cpp | 17 + .../yaml-cpp/src/ostream_wrapper.cpp | 2 +- {third => dependence}/yaml-cpp/src/parse.cpp | 2 +- {third => dependence}/yaml-cpp/src/parser.cpp | 1 + .../yaml-cpp/src/ptr_vector.h | 0 .../yaml-cpp/src/regex_yaml.cpp | 0 .../yaml-cpp/src/regex_yaml.h | 0 .../yaml-cpp/src/regeximpl.h | 4 + .../yaml-cpp/src/scanner.cpp | 24 + {third => dependence}/yaml-cpp/src/scanner.h | 1 + .../yaml-cpp/src/scanscalar.cpp | 0 .../yaml-cpp/src/scanscalar.h | 0 .../yaml-cpp/src/scantag.cpp | 0 {third => dependence}/yaml-cpp/src/scantag.h | 0 .../yaml-cpp/src/scantoken.cpp | 7 + {third => dependence}/yaml-cpp/src/setting.h | 0 .../yaml-cpp/src/simplekey.cpp | 0 .../yaml-cpp/src/singledocparser.cpp | 7 +- .../yaml-cpp/src/singledocparser.h | 0 {third => dependence}/yaml-cpp/src/stream.cpp | 21 +- {third => dependence}/yaml-cpp/src/stream.h | 3 +- .../yaml-cpp/src/streamcharsource.h | 0 .../yaml-cpp/src/stringsource.h | 0 {third => dependence}/yaml-cpp/src/tag.cpp | 0 {third => dependence}/yaml-cpp/src/tag.h | 0 {third => dependence}/yaml-cpp/src/token.h | 7 +- .../yaml-cpp/util/CMakeLists.txt | 0 {third => dependence}/yaml-cpp/util/api.cpp | 0 {third => dependence}/yaml-cpp/util/parse.cpp | 0 {third => dependence}/yaml-cpp/util/read.cpp | 4 +- .../yaml-cpp/util/sandbox.cpp | 4 +- .../yaml-cpp/yaml-cpp-config.cmake.in | 17 +- {third => dependence}/yaml-cpp/yaml-cpp.pc.in | 0 third/yaml-cpp/.github/workflows/build.yml | 72 - third/yaml-cpp/WORKSPACE | 10 - third/yaml-cpp/src/null.cpp | 10 - third/yaml-cpp/yaml-cpp-config-version.cmake | 37 - third/yaml-cpp/yaml-cpp-config.cmake | 46 - third/yaml-cpp/yaml-cpp.pc | 11 - 133 files changed, 5231 insertions(+), 312 deletions(-) create mode 100644 dependence/yaml-cpp/.bazelignore rename {third => dependence}/yaml-cpp/.clang-format (100%) rename {third => dependence}/yaml-cpp/.codedocs (98%) create mode 100644 dependence/yaml-cpp/.github/dependabot.yml create mode 100644 dependence/yaml-cpp/.github/workflows/build.yml create mode 100644 dependence/yaml-cpp/.github/workflows/bzlmod-archive.yml rename {third => dependence}/yaml-cpp/.gitignore (100%) rename {third => dependence}/yaml-cpp/BUILD.bazel (92%) rename {third => dependence}/yaml-cpp/CMakeLists.txt (83%) rename {third => dependence}/yaml-cpp/CONTRIBUTING.md (78%) rename {third => dependence}/yaml-cpp/LICENSE (100%) create mode 100644 dependence/yaml-cpp/MODULE.bazel create mode 100644 dependence/yaml-cpp/MODULE.bazel.lock rename {third => dependence}/yaml-cpp/README.md (68%) rename {third => dependence}/yaml-cpp/SECURITY.md (100%) rename {third => dependence}/yaml-cpp/cmake_uninstall.cmake.in (100%) rename {third => dependence}/yaml-cpp/docs/Breaking-Changes.md (100%) rename {third => dependence}/yaml-cpp/docs/How-To-Emit-YAML.md (95%) rename {third => dependence}/yaml-cpp/docs/How-To-Parse-A-Document-(Old-API).md (100%) rename {third => dependence}/yaml-cpp/docs/Strings.md (100%) rename {third => dependence}/yaml-cpp/docs/Tutorial.md (100%) rename {third => dependence}/yaml-cpp/docs/_config.yml (100%) rename {third => dependence}/yaml-cpp/docs/index.md (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/anchor.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/binary.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/contrib/anchordict.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/depthguard.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/dll.h (93%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/emitfromevents.h (97%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/emitter.h (92%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/emitterdef.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/emittermanip.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/emitterstyle.h (87%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/eventhandler.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/exceptions.h (98%) create mode 100644 dependence/yaml-cpp/include/yaml-cpp/fptostring.h rename {third => dependence}/yaml-cpp/include/yaml-cpp/mark.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/convert.h (97%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/impl.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/iterator.h (99%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/memory.h (97%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/node.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/node_data.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h (99%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/emit.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/impl.h (97%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/iterator.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/node.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/parse.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/ptr.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/node/type.h (84%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/noexcept.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/null.h (89%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/ostream_wrapper.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/parser.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/stlemitter.h (100%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/traits.h (98%) rename {third => dependence}/yaml-cpp/include/yaml-cpp/yaml.h (92%) rename {third => dependence}/yaml-cpp/install.txt (100%) rename {third => dependence}/yaml-cpp/src/binary.cpp (100%) rename {third => dependence}/yaml-cpp/src/collectionstack.h (100%) create mode 100644 dependence/yaml-cpp/src/contrib/dragonbox.h rename {third => dependence}/yaml-cpp/src/contrib/graphbuilder.cpp (100%) rename {third => dependence}/yaml-cpp/src/contrib/graphbuilderadapter.cpp (100%) rename {third => dependence}/yaml-cpp/src/contrib/graphbuilderadapter.h (100%) rename {third => dependence}/yaml-cpp/src/contrib/yaml-cpp.natvis (100%) rename {third => dependence}/yaml-cpp/src/contrib/yaml-cpp.natvis.md (100%) rename {third => dependence}/yaml-cpp/src/convert.cpp (100%) rename {third => dependence}/yaml-cpp/src/depthguard.cpp (100%) rename {third => dependence}/yaml-cpp/src/directives.cpp (100%) rename {third => dependence}/yaml-cpp/src/directives.h (100%) rename {third => dependence}/yaml-cpp/src/emit.cpp (100%) rename {third => dependence}/yaml-cpp/src/emitfromevents.cpp (93%) rename {third => dependence}/yaml-cpp/src/emitter.cpp (96%) rename {third => dependence}/yaml-cpp/src/emitterstate.cpp (100%) rename {third => dependence}/yaml-cpp/src/emitterstate.h (100%) rename {third => dependence}/yaml-cpp/src/emitterutils.cpp (83%) rename {third => dependence}/yaml-cpp/src/emitterutils.h (73%) rename {third => dependence}/yaml-cpp/src/exceptions.cpp (100%) rename {third => dependence}/yaml-cpp/src/exp.cpp (100%) rename {third => dependence}/yaml-cpp/src/exp.h (100%) create mode 100644 dependence/yaml-cpp/src/fptostring.cpp rename {third => dependence}/yaml-cpp/src/indentation.h (98%) rename {third => dependence}/yaml-cpp/src/memory.cpp (78%) rename {third => dependence}/yaml-cpp/src/node.cpp (100%) rename {third => dependence}/yaml-cpp/src/node_data.cpp (99%) rename {third => dependence}/yaml-cpp/src/nodebuilder.cpp (100%) rename {third => dependence}/yaml-cpp/src/nodebuilder.h (100%) rename {third => dependence}/yaml-cpp/src/nodeevents.cpp (100%) rename {third => dependence}/yaml-cpp/src/nodeevents.h (100%) create mode 100644 dependence/yaml-cpp/src/null.cpp rename {third => dependence}/yaml-cpp/src/ostream_wrapper.cpp (98%) rename {third => dependence}/yaml-cpp/src/parse.cpp (94%) rename {third => dependence}/yaml-cpp/src/parser.cpp (98%) rename {third => dependence}/yaml-cpp/src/ptr_vector.h (100%) rename {third => dependence}/yaml-cpp/src/regex_yaml.cpp (100%) rename {third => dependence}/yaml-cpp/src/regex_yaml.h (100%) rename {third => dependence}/yaml-cpp/src/regeximpl.h (96%) rename {third => dependence}/yaml-cpp/src/scanner.cpp (91%) rename {third => dependence}/yaml-cpp/src/scanner.h (99%) rename {third => dependence}/yaml-cpp/src/scanscalar.cpp (100%) rename {third => dependence}/yaml-cpp/src/scanscalar.h (100%) rename {third => dependence}/yaml-cpp/src/scantag.cpp (100%) rename {third => dependence}/yaml-cpp/src/scantag.h (100%) rename {third => dependence}/yaml-cpp/src/scantoken.cpp (97%) rename {third => dependence}/yaml-cpp/src/setting.h (100%) rename {third => dependence}/yaml-cpp/src/simplekey.cpp (100%) rename {third => dependence}/yaml-cpp/src/singledocparser.cpp (98%) rename {third => dependence}/yaml-cpp/src/singledocparser.h (100%) rename {third => dependence}/yaml-cpp/src/stream.cpp (95%) rename {third => dependence}/yaml-cpp/src/stream.h (95%) rename {third => dependence}/yaml-cpp/src/streamcharsource.h (100%) rename {third => dependence}/yaml-cpp/src/stringsource.h (100%) rename {third => dependence}/yaml-cpp/src/tag.cpp (100%) rename {third => dependence}/yaml-cpp/src/tag.h (100%) rename {third => dependence}/yaml-cpp/src/token.h (95%) rename {third => dependence}/yaml-cpp/util/CMakeLists.txt (100%) rename {third => dependence}/yaml-cpp/util/api.cpp (100%) rename {third => dependence}/yaml-cpp/util/parse.cpp (100%) rename {third => dependence}/yaml-cpp/util/read.cpp (94%) rename {third => dependence}/yaml-cpp/util/sandbox.cpp (87%) rename {third => dependence}/yaml-cpp/yaml-cpp-config.cmake.in (52%) rename {third => dependence}/yaml-cpp/yaml-cpp.pc.in (100%) delete mode 100644 third/yaml-cpp/.github/workflows/build.yml delete mode 100644 third/yaml-cpp/WORKSPACE delete mode 100644 third/yaml-cpp/src/null.cpp delete mode 100644 third/yaml-cpp/yaml-cpp-config-version.cmake delete mode 100644 third/yaml-cpp/yaml-cpp-config.cmake delete mode 100644 third/yaml-cpp/yaml-cpp.pc diff --git a/CMakeLists.txt b/CMakeLists.txt index 74263eb..39a4e69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ endif() # third # add_subdirectory(third/type_safe) # add_subdirectory(third/cppast) -add_subdirectory(third/yaml-cpp) +add_subdirectory(dependence/yaml-cpp) LINK_LIBRARIES(yaml-cpp) # source diff --git a/dependence/yaml-cpp/.bazelignore b/dependence/yaml-cpp/.bazelignore new file mode 100644 index 0000000..446ebd0 --- /dev/null +++ b/dependence/yaml-cpp/.bazelignore @@ -0,0 +1 @@ +test/googletest-1.13.0 diff --git a/third/yaml-cpp/.clang-format b/dependence/yaml-cpp/.clang-format similarity index 100% rename from third/yaml-cpp/.clang-format rename to dependence/yaml-cpp/.clang-format diff --git a/third/yaml-cpp/.codedocs b/dependence/yaml-cpp/.codedocs similarity index 98% rename from third/yaml-cpp/.codedocs rename to dependence/yaml-cpp/.codedocs index 02e4382..ae63822 100644 --- a/third/yaml-cpp/.codedocs +++ b/dependence/yaml-cpp/.codedocs @@ -8,7 +8,7 @@ EXAMPLE_PATH = # One or more directories and files to exclude from documentation generation. # Use relative paths with respect to the repository root directory. -EXCLUDE = test/gtest-1.8.0/ +EXCLUDE = test/googletest-1.13.0/ # One or more wildcard patterns to exclude files and directories from document # generation. diff --git a/dependence/yaml-cpp/.github/dependabot.yml b/dependence/yaml-cpp/.github/dependabot.yml new file mode 100644 index 0000000..dc23806 --- /dev/null +++ b/dependence/yaml-cpp/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + groups: + github-actions: + patterns: + - "*" + diff --git a/dependence/yaml-cpp/.github/workflows/build.yml b/dependence/yaml-cpp/.github/workflows/build.yml new file mode 100644 index 0000000..5c7614b --- /dev/null +++ b/dependence/yaml-cpp/.github/workflows/build.yml @@ -0,0 +1,141 @@ +name: Github PR +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: +permissions: read-all +defaults: + run: + shell: bash +jobs: + cmake-build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + cxx_standard: [11, 17, 20] + build: [static, shared] + googletest: [build, system] + generator: ["Default Generator", "MinGW Makefiles"] + exclude: + - os: ubuntu-latest + cxx_standard: 11 + googletest: system + - os: macos-latest + build: shared + - os: macos-latest + generator: "MinGW Makefiles" + - os: ubuntu-latest + generator: "MinGW Makefiles" + - os: macos-latest + googletest: system + - os: windows-latest + googletest: system + env: + YAML_BUILD_SHARED_LIBS: ${{ matrix.build == 'shared' && 'ON' || 'OFF' }} + YAML_USE_SYSTEM_GTEST: ${{ matrix.googletest == 'system' && 'ON' || 'OFF' }} + CMAKE_GENERATOR: >- + ${{format(matrix.generator != 'Default Generator' && '-G "{0}"' || '', matrix.generator)}} + CMAKE_INSTALL_PREFIX: "${{ github.workspace }}/install-prefix" + CMAKE_BUILD_TYPE: Debug + CMAKE_CXX_FLAGS_DEBUG: ${{ matrix.googletest == 'build' && '-g -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC' || '-g' }} + runs-on: ${{ matrix.os }} + steps: + + - uses: awalsh128/cache-apt-pkgs-action@latest + if: matrix.os == 'ubuntu-latest' + with: + packages: googletest libgmock-dev libgtest-dev + version: 1.0 + + - uses: actions/checkout@v6.0.2 + + - name: Configure + run: | + cmake \ + ${{ env.CMAKE_GENERATOR }} \ + -S "${{ github.workspace }}" \ + -B build \ + -D CMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} \ + -D CMAKE_INSTALL_PREFIX="${{ env.CMAKE_INSTALL_PREFIX }}" \ + -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \ + -D CMAKE_CXX_FLAGS_DEBUG="${{ env.CMAKE_CXX_FLAGS_DEBUG }}" \ + -D YAML_BUILD_SHARED_LIBS=${{ env.YAML_BUILD_SHARED_LIBS }} \ + -D YAML_USE_SYSTEM_GTEST=${{ env.YAML_USE_SYSTEM_GTEST }} \ + -D YAML_CPP_BUILD_TESTS=ON + + - name: Build + run: | + cmake \ + --build build \ + --config ${{ env.CMAKE_BUILD_TYPE }} \ + --verbose \ + --parallel + + - name: Run Tests + shell: bash + run: | + ctest \ + --test-dir build \ + --build-config ${{ env.CMAKE_BUILD_TYPE }} \ + --output-on-failure \ + --verbose + + - name: Install + run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} + + - name: Configure CMake package test + run: | + cmake \ + ${{ env.CMAKE_GENERATOR }} \ + -S "${{ github.workspace }}/test/cmake" \ + -B consumer-build \ + -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \ + -D CMAKE_PREFIX_PATH="${{ env.CMAKE_INSTALL_PREFIX }}" + + - name: Build CMake package test + run: | + cmake \ + --build consumer-build \ + --config ${{ env.CMAKE_BUILD_TYPE }} \ + --verbose + + bazel-build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v6.0.2 + + - name: Build + run: | + cd "${{ github.workspace }}" + bazel build :all + + - name: Test + run: | + cd "${{ github.workspace }}" + bazel test test + + bzlmod-build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v6.0.2 + + - name: Build + shell: bash + run: | + cd "${{ github.workspace }}" + bazel build --enable_bzlmod :all + + - name: Test + shell: bash + run: | + cd "${{ github.workspace }}" + bazel test --enable_bzlmod test diff --git a/dependence/yaml-cpp/.github/workflows/bzlmod-archive.yml b/dependence/yaml-cpp/.github/workflows/bzlmod-archive.yml new file mode 100644 index 0000000..1b07d82 --- /dev/null +++ b/dependence/yaml-cpp/.github/workflows/bzlmod-archive.yml @@ -0,0 +1,19 @@ +name: Bazel Release + +on: + release: + types: [published] + +jobs: + # A release archive is required for bzlmod + # See: https://blog.bazel.build/2023/02/15/github-archive-checksum.html + bazel-release-archive: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.1.1 + - run: git archive $GITHUB_REF -o "yaml-cpp-${GITHUB_REF:10}.tar.gz" + - run: gh release upload ${GITHUB_REF:10} "yaml-cpp-${GITHUB_REF:10}.tar.gz" + env: + GH_TOKEN: ${{ github.token }} diff --git a/third/yaml-cpp/.gitignore b/dependence/yaml-cpp/.gitignore similarity index 100% rename from third/yaml-cpp/.gitignore rename to dependence/yaml-cpp/.gitignore diff --git a/third/yaml-cpp/BUILD.bazel b/dependence/yaml-cpp/BUILD.bazel similarity index 92% rename from third/yaml-cpp/BUILD.bazel rename to dependence/yaml-cpp/BUILD.bazel index 23e847e..45ae375 100644 --- a/third/yaml-cpp/BUILD.bazel +++ b/dependence/yaml-cpp/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + yaml_cpp_defines = select({ # On Windows, ensure static linking is used. "@platforms//os:windows": ["YAML_CPP_STATIC_DEFINE", "YAML_CPP_NO_CONTRIB"], diff --git a/third/yaml-cpp/CMakeLists.txt b/dependence/yaml-cpp/CMakeLists.txt similarity index 83% rename from third/yaml-cpp/CMakeLists.txt rename to dependence/yaml-cpp/CMakeLists.txt index e02a73e..631bfa3 100644 --- a/third/yaml-cpp/CMakeLists.txt +++ b/dependence/yaml-cpp/CMakeLists.txt @@ -1,5 +1,6 @@ -# CMake 4.0 and above no longer support compatibility with versions earlier than 3.5 -cmake_minimum_required(VERSION 3.5) +# 3.5 is actually available almost everywhere. +# 3.30 as the upper policy limit avoids CMake deprecation warnings. +cmake_minimum_required(VERSION 3.5...3.30) # enable MSVC_RUNTIME_LIBRARY target property # see https://cmake.org/cmake/help/latest/policy/CMP0091.html @@ -7,7 +8,7 @@ if(POLICY CMP0091) cmake_policy(SET CMP0091 NEW) endif() -project(YAML_CPP VERSION 0.8.0 LANGUAGES CXX) +project(YAML_CPP VERSION 0.9.0 LANGUAGES CXX) set(YAML_CPP_MAIN_PROJECT OFF) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) @@ -24,13 +25,19 @@ option(YAML_CPP_BUILD_CONTRIB "Enable yaml-cpp contrib in library" ON) option(YAML_CPP_BUILD_TOOLS "Enable parse tools" ON) option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library" ${BUILD_SHARED_LIBS}) option(YAML_CPP_INSTALL "Enable generation of yaml-cpp install targets" ${YAML_CPP_MAIN_PROJECT}) -option(YAML_CPP_FORMAT_SOURCE "Format source" ON) +option(YAML_CPP_FORMAT_SOURCE "Format source" ${YAML_CPP_MAIN_PROJECT}) +option(YAML_CPP_DISABLE_UNINSTALL "Disable uninstallation of yaml-cpp" OFF) +option(YAML_USE_SYSTEM_GTEST "Use system googletest if found" OFF) +option(YAML_ENABLE_PIC "Use Position-Independent Code " ON) + cmake_dependent_option(YAML_CPP_BUILD_TESTS "Enable yaml-cpp tests" OFF "BUILD_TESTING;YAML_CPP_MAIN_PROJECT" OFF) cmake_dependent_option(YAML_MSVC_SHARED_RT "MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON "CMAKE_SYSTEM_NAME MATCHES Windows" OFF) +set(YAML_CPP_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp" + CACHE STRING "Path to install the CMake package to") if (YAML_CPP_FORMAT_SOURCE) find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format) @@ -85,7 +92,7 @@ set_property(TARGET yaml-cpp CXX_STANDARD_REQUIRED ON) if (NOT YAML_BUILD_SHARED_LIBS) - set_property(TARGET yaml-cpp PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET yaml-cpp PROPERTY POSITION_INDEPENDENT_CODE ${YAML_ENABLE_PIC}) endif() target_include_directories(yaml-cpp @@ -143,13 +150,12 @@ set_target_properties(yaml-cpp PROPERTIES PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}" DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") -set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp") -set(EXPORT_TARGETS yaml-cpp) +set(EXPORT_TARGETS yaml-cpp::yaml-cpp) configure_package_config_file( "${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in" "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" - INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}" - PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CONFIG_EXPORT_DIR YAML_BUILD_SHARED_LIBS) + INSTALL_DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}" + PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR) unset(EXPORT_TARGETS) write_basic_package_version_file( @@ -169,26 +175,34 @@ if (YAML_CPP_INSTALL) FILES_MATCHING PATTERN "*.h") install(EXPORT yaml-cpp-targets NAMESPACE yaml-cpp:: - DESTINATION "${CONFIG_EXPORT_DIR}") + DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}") install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" - DESTINATION "${CONFIG_EXPORT_DIR}") + DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}") install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() -unset(CONFIG_EXPORT_DIR) + +if(YAML_CPP_BUILD_TESTS) + add_subdirectory(test) +endif() + +if(YAML_CPP_BUILD_TOOLS) + add_subdirectory(util) +endif() if (YAML_CPP_FORMAT_SOURCE AND YAML_CPP_CLANG_FORMAT_EXE) add_custom_target(format COMMAND clang-format --style=file -i $ COMMAND_EXPAND_LISTS COMMENT "Running clang-format" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM) endif() # uninstall target -if(NOT TARGET uninstall) +if(YAML_CPP_INSTALL AND NOT YAML_CPP_DISABLE_UNINSTALL AND NOT TARGET uninstall) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" diff --git a/third/yaml-cpp/CONTRIBUTING.md b/dependence/yaml-cpp/CONTRIBUTING.md similarity index 78% rename from third/yaml-cpp/CONTRIBUTING.md rename to dependence/yaml-cpp/CONTRIBUTING.md index 5705fe2..e4ca076 100644 --- a/third/yaml-cpp/CONTRIBUTING.md +++ b/dependence/yaml-cpp/CONTRIBUTING.md @@ -17,9 +17,9 @@ Commit messages should be in the imperative mood, as described in the [Git contr # Tests -Please verify the tests pass by running the target `test/yaml-cpp-tests`. +Please verify the tests pass by configuring CMake with `-D YAML_CPP_BUILD_TESTS=ON` and running the target `test/yaml-cpp-tests`. -If you are adding functionality, add tests accordingly. +If you are adding functionality, add tests accordingly. Note that the "spec tests" are reserved for examples directly from the YAML spec, so if you have new examples, put them in other test files. # Pull request process diff --git a/third/yaml-cpp/LICENSE b/dependence/yaml-cpp/LICENSE similarity index 100% rename from third/yaml-cpp/LICENSE rename to dependence/yaml-cpp/LICENSE diff --git a/dependence/yaml-cpp/MODULE.bazel b/dependence/yaml-cpp/MODULE.bazel new file mode 100644 index 0000000..132cde1 --- /dev/null +++ b/dependence/yaml-cpp/MODULE.bazel @@ -0,0 +1,14 @@ +""" +yaml-cpp is a YAML parser and emitter in c++ matching the YAML specification. +""" + +module( + name = "yaml-cpp", + compatibility_level = 1, + version = "0.8.0", +) + +bazel_dep(name = "platforms", version = "1.0.0") +bazel_dep(name = "rules_cc", version = "0.2.14") + +bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True) diff --git a/dependence/yaml-cpp/MODULE.bazel.lock b/dependence/yaml-cpp/MODULE.bazel.lock new file mode 100644 index 0000000..d06bb14 --- /dev/null +++ b/dependence/yaml-cpp/MODULE.bazel.lock @@ -0,0 +1,282 @@ +{ + "lockFileVersion": 24, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.2/MODULE.bazel": "73939767a4686cd9a520d16af5ab440071ed75cec1a876bf2fcfaf1f71987a16", + "https://bcr.bazel.build/modules/abseil-cpp/20250127.1/MODULE.bazel": "c4a89e7ceb9bf1e25cf84a9f830ff6b817b72874088bf5141b314726e46a57c1", + "https://bcr.bazel.build/modules/abseil-cpp/20250512.1/MODULE.bazel": "d209fdb6f36ffaf61c509fcc81b19e81b411a999a934a032e10cd009a0226215", + "https://bcr.bazel.build/modules/abseil-cpp/20250512.1/source.json": "d725d73707d01bb46ab3ca59ba408b8e9bd336642ca77a2269d4bfb8bbfd413d", + "https://bcr.bazel.build/modules/apple_support/1.15.1/MODULE.bazel": "a0556fefca0b1bb2de8567b8827518f94db6a6e7e7d632b4c48dc5f865bc7c85", + "https://bcr.bazel.build/modules/apple_support/1.22.1/MODULE.bazel": "90bd1a660590f3ceffbdf524e37483094b29352d85317060b2327fff8f3f4458", + "https://bcr.bazel.build/modules/apple_support/1.23.1/MODULE.bazel": "53763fed456a968cf919b3240427cf3a9d5481ec5466abc9d5dc51bc70087442", + "https://bcr.bazel.build/modules/apple_support/1.23.1/source.json": "d888b44312eb0ad2c21a91d026753f330caa48a25c9b2102fae75eb2b0dcfdd2", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", + "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", + "https://bcr.bazel.build/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b", + "https://bcr.bazel.build/modules/bazel_features/1.27.0/MODULE.bazel": "621eeee06c4458a9121d1f104efb80f39d34deff4984e778359c60eaf1a8cb65", + "https://bcr.bazel.build/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", + "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/googletest/1.15.2/MODULE.bazel": "6de1edc1d26cafb0ea1a6ab3f4d4192d91a312fd2d360b63adaa213cd00b2108", + "https://bcr.bazel.build/modules/googletest/1.17.0.bcr.2/MODULE.bazel": "827f54f492a3ce549c940106d73de332c2b30cebd0c20c0bc5d786aba7f116cb", + "https://bcr.bazel.build/modules/googletest/1.17.0.bcr.2/source.json": "3664514073a819992320ffbce5825e4238459df344d8b01748af2208f8d2e1eb", + "https://bcr.bazel.build/modules/googletest/1.17.0/MODULE.bazel": "dbec758171594a705933a29fcf69293d2468c49ec1f2ebca65c36f504d72df46", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d", + "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", + "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", + "https://bcr.bazel.build/modules/platforms/1.0.0/MODULE.bazel": "f05feb42b48f1b3c225e4ccf351f367be0371411a803198ec34a389fb22aa580", + "https://bcr.bazel.build/modules/platforms/1.0.0/source.json": "f4ff1fd412e0246fd38c82328eb209130ead81d62dcd5a9e40910f867f733d96", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/23.1/MODULE.bazel": "88b393b3eb4101d18129e5db51847cd40a5517a53e81216144a8c32dfeeca52a", + "https://bcr.bazel.build/modules/protobuf/24.4/MODULE.bazel": "7bc7ce5f2abf36b3b7b7c8218d3acdebb9426aeb35c2257c96445756f970eb12", + "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c", + "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", + "https://bcr.bazel.build/modules/protobuf/29.0-rc3/MODULE.bazel": "33c2dfa286578573afc55a7acaea3cada4122b9631007c594bf0729f41c8de92", + "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", + "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", + "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", + "https://bcr.bazel.build/modules/pybind11_bazel/2.13.6/MODULE.bazel": "2d746fda559464b253b2b2e6073cb51643a2ac79009ca02100ebbc44b4548656", + "https://bcr.bazel.build/modules/pybind11_bazel/2.13.6/source.json": "6aa0703de8efb20cc897bbdbeb928582ee7beaf278bcd001ac253e1605bddfae", + "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", + "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", + "https://bcr.bazel.build/modules/re2/2024-07-02/MODULE.bazel": "0eadc4395959969297cbcf31a249ff457f2f1d456228c67719480205aa306daa", + "https://bcr.bazel.build/modules/re2/2025-08-12.bcr.1/MODULE.bazel": "e09b434b122bfb786a69179f9b325e35cb1856c3f56a7a81dd61609260ed46e1", + "https://bcr.bazel.build/modules/re2/2025-08-12.bcr.1/source.json": "a8ae7c09533bf67f9f6e5122d884d5741600b09d78dca6fc0f2f8d2ee0c2d957", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", + "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", + "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.17/MODULE.bazel": "2ae1d8f4238ec67d7185d8861cb0a2cdf4bc608697c331b95bf990e69b62e64a", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", + "https://bcr.bazel.build/modules/rules_cc/0.1.4/MODULE.bazel": "bb03a452a7527ac25a7518fb86a946ef63df860b9657d8323a0c50f8504fb0b9", + "https://bcr.bazel.build/modules/rules_cc/0.2.14/MODULE.bazel": "353c99ed148887ee89c54a17d4100ae7e7e436593d104b668476019023b58df8", + "https://bcr.bazel.build/modules/rules_cc/0.2.14/source.json": "55d0a4587c5592fad350f6e698530f4faf0e7dd15e69d43f8d87e220c78bea54", + "https://bcr.bazel.build/modules/rules_cc/0.2.8/MODULE.bazel": "f1df20f0bf22c28192a794f29b501ee2018fa37a3862a1a2132ae2940a23a642", + "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31", + "https://bcr.bazel.build/modules/rules_java/7.1.0/MODULE.bazel": "30d9135a2b6561c761bd67bd4990da591e6bdc128790ce3e7afd6a3558b2fb64", + "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615", + "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc", + "https://bcr.bazel.build/modules/rules_java/8.3.2/MODULE.bazel": "7336d5511ad5af0b8615fdc7477535a2e4e723a357b6713af439fe8cf0195017", + "https://bcr.bazel.build/modules/rules_java/8.5.1/MODULE.bazel": "d8a9e38cc5228881f7055a6079f6f7821a073df3744d441978e7a43e20226939", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/source.json": "6f5f5a5a4419ae4e37c35a5bb0a6ae657ed40b7abc5a5189111b47fcebe43197", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/MODULE.bazel": "1e5b502e2e1a9e825eef74476a5a1ee524a92297085015a052510b09a1a09483", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", + "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.33.2/MODULE.bazel": "3e036c4ad8d804a4dad897d333d8dce200d943df4827cb849840055be8d2e937", + "https://bcr.bazel.build/modules/rules_python/0.34.0/MODULE.bazel": "1d623d026e075b78c9fde483a889cda7996f5da4f36dffb24c246ab30f06513a", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", + "https://bcr.bazel.build/modules/rules_python/1.5.1/MODULE.bazel": "acfe65880942d44a69129d4c5c3122d57baaf3edf58ae5a6bd4edea114906bf5", + "https://bcr.bazel.build/modules/rules_python/1.5.1/source.json": "aa903e1bcbdfa1580f2b8e2d55100b7c18bc92d779ebb507fec896c75635f7bd", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/source.json": "7f27af3c28037d9701487c4744b5448d26537cc66cdef0d8df7ae85411f8de95", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.2/MODULE.bazel": "fc152419aa2ea0f51c29583fab1e8c99ddefd5b3778421845606ee628629e0e5", + "https://bcr.bazel.build/modules/stardoc/0.7.2/source.json": "58b029e5e901d6802967754adf0a9056747e8176f017cfe3607c0851f4d42216", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/upb/0.0.0-20230516-61a97ef/MODULE.bazel": "c0df5e35ad55e264160417fd0875932ee3c9dda63d9fccace35ac62f45e1b6f9", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806", + "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "rL/34P1aFDq2GqVC2zCFgQ8nTuOC6ziogocpvG50Qz8=", + "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin+", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_python+//python/uv:uv.bzl%uv": { + "general": { + "bzlTransitiveDigest": "8vT1ddXtljNxYD0tJkksqzeKE6xqx4Ix+tXthAppjTI=", + "usagesDigest": "WYhzIw9khRBy34H1GxV5+fI1yi07O90NmCXosPUdHWQ=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "uv": { + "repoRuleId": "@@rules_python+//python/uv/private:uv_toolchains_repo.bzl%uv_toolchains_repo", + "attributes": { + "toolchain_type": "'@@rules_python+//python/uv:uv_toolchain_type'", + "toolchain_names": [ + "none" + ], + "toolchain_implementations": { + "none": "'@@rules_python+//python:none'" + }, + "toolchain_compatible_with": { + "none": [ + "@platforms//:incompatible" + ] + }, + "toolchain_target_settings": {} + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_python+", + "platforms", + "platforms" + ] + ] + } + } + }, + "facts": {} +} diff --git a/third/yaml-cpp/README.md b/dependence/yaml-cpp/README.md similarity index 68% rename from third/yaml-cpp/README.md rename to dependence/yaml-cpp/README.md index 70c2314..ec72636 100644 --- a/third/yaml-cpp/README.md +++ b/dependence/yaml-cpp/README.md @@ -31,6 +31,17 @@ cmake [-G generator] [-DYAML_BUILD_SHARED_LIBS=on|OFF] .. * `yaml-cpp` builds a static library by default, you may want to build a shared library by specifying `-DYAML_BUILD_SHARED_LIBS=ON`. + * [Debug mode of the GNU standard C++ + library](https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html) + can be used when both `yaml-cpp` and client code is compiled with the + `_GLIBCXX_DEBUG` flag (e.g. by calling CMake with `-D + CMAKE_CXX_FLAGS_DEBUG='-g -D_GLIBCXX_DEBUG'` option). + + Note that for `yaml-cpp` unit tests to run successfully, the _GoogleTest_ + library also must be built with this flag, i.e. the system one cannot be + used (the _YAML_USE_SYSTEM_GTEST_ CMake option must be _OFF_, which is the + default). + * For more options on customizing the build, see the [CMakeLists.txt](https://github.com/jbeder/yaml-cpp/blob/master/CMakeLists.txt) file. #### 2. Build it! @@ -38,13 +49,30 @@ cmake [-G generator] [-DYAML_BUILD_SHARED_LIBS=on|OFF] .. **Note:** To clean up, just remove the `build` directory. +## How to Integrate it within your project using CMake + +You can use for example FetchContent : + +```cmake +include(FetchContent) + +FetchContent_Declare( + yaml-cpp + GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git + GIT_TAG # Can be a tag (yaml-cpp-x.x.x), a commit hash, or a branch name (master) +) +FetchContent_MakeAvailable(yaml-cpp) + +target_link_libraries(YOUR_LIBRARY PUBLIC yaml-cpp::yaml-cpp) # The library or executable that require yaml-cpp library +``` + ## Recent Releases -[yaml-cpp 0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0) released! This release requires C++11, and no longer depends on Boost. +[yaml-cpp 0.8.0](https://github.com/jbeder/yaml-cpp/releases/tag/0.8.0) released! [yaml-cpp 0.3.0](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.3.0) is still available if you want the old API. -**The old API will continue to be supported, and will still receive bugfixes!** The 0.3.x and 0.4.x versions will be old API releases, and 0.5.x and above will all be new API releases. +**The old API will stop receiving bugfixes in 2026.** The 0.3.x versions provide the old API, and 0.5.x and above all provide the new API. # API Documentation diff --git a/third/yaml-cpp/SECURITY.md b/dependence/yaml-cpp/SECURITY.md similarity index 100% rename from third/yaml-cpp/SECURITY.md rename to dependence/yaml-cpp/SECURITY.md diff --git a/third/yaml-cpp/cmake_uninstall.cmake.in b/dependence/yaml-cpp/cmake_uninstall.cmake.in similarity index 100% rename from third/yaml-cpp/cmake_uninstall.cmake.in rename to dependence/yaml-cpp/cmake_uninstall.cmake.in diff --git a/third/yaml-cpp/docs/Breaking-Changes.md b/dependence/yaml-cpp/docs/Breaking-Changes.md similarity index 100% rename from third/yaml-cpp/docs/Breaking-Changes.md rename to dependence/yaml-cpp/docs/Breaking-Changes.md diff --git a/third/yaml-cpp/docs/How-To-Emit-YAML.md b/dependence/yaml-cpp/docs/How-To-Emit-YAML.md similarity index 95% rename from third/yaml-cpp/docs/How-To-Emit-YAML.md rename to dependence/yaml-cpp/docs/How-To-Emit-YAML.md index 9340701..6e6f9f5 100644 --- a/third/yaml-cpp/docs/How-To-Emit-YAML.md +++ b/dependence/yaml-cpp/docs/How-To-Emit-YAML.md @@ -154,16 +154,11 @@ produces # STL Containers, and Other Overloads # We overload `operator <<` for `std::vector`, `std::list`, and `std::map`, so you can write stuff like: +{% raw %} ```cpp -std::vector squares; -squares.push_back(1); -squares.push_back(4); -squares.push_back(9); -squares.push_back(16); +std::vector squares = {1, 4, 9, 16}; -std::map ages; -ages["Daniel"] = 26; -ages["Jesse"] = 24; +std::map ages = {{"Daniel", 26}, {"Jesse", 24}}; YAML::Emitter out; out << YAML::BeginSeq; @@ -171,6 +166,7 @@ out << YAML::Flow << squares; out << ages; out << YAML::EndSeq; ``` +{% endraw %} produces @@ -227,4 +223,4 @@ assert(out.good()); out << YAML::Key; assert(!out.good()); std::cout << "Emitter error: " << out.GetLastError() << "\n"; -``` \ No newline at end of file +``` diff --git a/third/yaml-cpp/docs/How-To-Parse-A-Document-(Old-API).md b/dependence/yaml-cpp/docs/How-To-Parse-A-Document-(Old-API).md similarity index 100% rename from third/yaml-cpp/docs/How-To-Parse-A-Document-(Old-API).md rename to dependence/yaml-cpp/docs/How-To-Parse-A-Document-(Old-API).md diff --git a/third/yaml-cpp/docs/Strings.md b/dependence/yaml-cpp/docs/Strings.md similarity index 100% rename from third/yaml-cpp/docs/Strings.md rename to dependence/yaml-cpp/docs/Strings.md diff --git a/third/yaml-cpp/docs/Tutorial.md b/dependence/yaml-cpp/docs/Tutorial.md similarity index 100% rename from third/yaml-cpp/docs/Tutorial.md rename to dependence/yaml-cpp/docs/Tutorial.md diff --git a/third/yaml-cpp/docs/_config.yml b/dependence/yaml-cpp/docs/_config.yml similarity index 100% rename from third/yaml-cpp/docs/_config.yml rename to dependence/yaml-cpp/docs/_config.yml diff --git a/third/yaml-cpp/docs/index.md b/dependence/yaml-cpp/docs/index.md similarity index 100% rename from third/yaml-cpp/docs/index.md rename to dependence/yaml-cpp/docs/index.md diff --git a/third/yaml-cpp/include/yaml-cpp/anchor.h b/dependence/yaml-cpp/include/yaml-cpp/anchor.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/anchor.h rename to dependence/yaml-cpp/include/yaml-cpp/anchor.h diff --git a/third/yaml-cpp/include/yaml-cpp/binary.h b/dependence/yaml-cpp/include/yaml-cpp/binary.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/binary.h rename to dependence/yaml-cpp/include/yaml-cpp/binary.h diff --git a/third/yaml-cpp/include/yaml-cpp/contrib/anchordict.h b/dependence/yaml-cpp/include/yaml-cpp/contrib/anchordict.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/contrib/anchordict.h rename to dependence/yaml-cpp/include/yaml-cpp/contrib/anchordict.h diff --git a/third/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h b/dependence/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h rename to dependence/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h diff --git a/third/yaml-cpp/include/yaml-cpp/depthguard.h b/dependence/yaml-cpp/include/yaml-cpp/depthguard.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/depthguard.h rename to dependence/yaml-cpp/include/yaml-cpp/depthguard.h diff --git a/third/yaml-cpp/include/yaml-cpp/dll.h b/dependence/yaml-cpp/include/yaml-cpp/dll.h similarity index 93% rename from third/yaml-cpp/include/yaml-cpp/dll.h rename to dependence/yaml-cpp/include/yaml-cpp/dll.h index eabdda1..4e55ab8 100644 --- a/third/yaml-cpp/include/yaml-cpp/dll.h +++ b/dependence/yaml-cpp/include/yaml-cpp/dll.h @@ -15,11 +15,9 @@ # ifndef YAML_CPP_API # ifdef yaml_cpp_EXPORTS /* We are building this library */ -# pragma message( "Defining YAML_CPP_API for DLL export" ) # define YAML_CPP_API __declspec(dllexport) # else /* We are using this library */ -# pragma message( "Defining YAML_CPP_API for DLL import" ) # define YAML_CPP_API __declspec(dllimport) # endif # endif diff --git a/third/yaml-cpp/include/yaml-cpp/emitfromevents.h b/dependence/yaml-cpp/include/yaml-cpp/emitfromevents.h similarity index 97% rename from third/yaml-cpp/include/yaml-cpp/emitfromevents.h rename to dependence/yaml-cpp/include/yaml-cpp/emitfromevents.h index 1f389c5..c00d26e 100644 --- a/third/yaml-cpp/include/yaml-cpp/emitfromevents.h +++ b/dependence/yaml-cpp/include/yaml-cpp/emitfromevents.h @@ -23,6 +23,7 @@ class Emitter; class EmitFromEvents : public EventHandler { public: EmitFromEvents(Emitter& emitter); + ~EmitFromEvents() override = default; void OnDocumentStart(const Mark& mark) override; void OnDocumentEnd() override; diff --git a/third/yaml-cpp/include/yaml-cpp/emitter.h b/dependence/yaml-cpp/include/yaml-cpp/emitter.h similarity index 92% rename from third/yaml-cpp/include/yaml-cpp/emitter.h rename to dependence/yaml-cpp/include/yaml-cpp/emitter.h index 210b1ec..67810ef 100644 --- a/third/yaml-cpp/include/yaml-cpp/emitter.h +++ b/dependence/yaml-cpp/include/yaml-cpp/emitter.h @@ -9,18 +9,24 @@ #include #include +#include #include #include #include #include #include +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) +#include +#endif + #include "yaml-cpp/binary.h" #include "yaml-cpp/dll.h" #include "yaml-cpp/emitterdef.h" #include "yaml-cpp/emittermanip.h" #include "yaml-cpp/null.h" #include "yaml-cpp/ostream_wrapper.h" +#include "yaml-cpp/fptostring.h" namespace YAML { class Binary; @@ -67,6 +73,7 @@ class YAML_CPP_API Emitter { Emitter& SetLocalPrecision(const _Precision& precision); // overloads of write + Emitter& Write(const char* str, std::size_t size); Emitter& Write(const std::string& str); Emitter& Write(bool b); Emitter& Write(char ch); @@ -141,6 +148,7 @@ inline Emitter& Emitter::WriteIntegralType(T value) { PrepareNode(EmitterNodeType::Scalar); std::stringstream stream; + stream.imbue(std::locale::classic()); PrepareIntegralStream(stream); stream << value; m_stream << stream.str(); @@ -158,6 +166,7 @@ inline Emitter& Emitter::WriteStreamable(T value) { PrepareNode(EmitterNodeType::Scalar); std::stringstream stream; + stream.imbue(std::locale::classic()); SetStreamablePrecision(stream); bool special = false; @@ -178,7 +187,7 @@ inline Emitter& Emitter::WriteStreamable(T value) { } if (!special) { - stream << value; + stream << FpToString(value, stream.precision()); } m_stream << stream.str(); @@ -198,8 +207,13 @@ inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { } // overloads of insertion +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) +inline Emitter& operator<<(Emitter& emitter, const std::string_view& v) { + return emitter.Write(v.data(), v.size()); +} +#endif inline Emitter& operator<<(Emitter& emitter, const std::string& v) { - return emitter.Write(v); + return emitter.Write(v.data(), v.size()); } inline Emitter& operator<<(Emitter& emitter, bool v) { return emitter.Write(v); @@ -230,7 +244,7 @@ inline Emitter& operator<<(Emitter& emitter, const Binary& b) { } inline Emitter& operator<<(Emitter& emitter, const char* v) { - return emitter.Write(std::string(v)); + return emitter.Write(v, std::strlen(v)); } inline Emitter& operator<<(Emitter& emitter, int v) { diff --git a/third/yaml-cpp/include/yaml-cpp/emitterdef.h b/dependence/yaml-cpp/include/yaml-cpp/emitterdef.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/emitterdef.h rename to dependence/yaml-cpp/include/yaml-cpp/emitterdef.h diff --git a/third/yaml-cpp/include/yaml-cpp/emittermanip.h b/dependence/yaml-cpp/include/yaml-cpp/emittermanip.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/emittermanip.h rename to dependence/yaml-cpp/include/yaml-cpp/emittermanip.h diff --git a/third/yaml-cpp/include/yaml-cpp/emitterstyle.h b/dependence/yaml-cpp/include/yaml-cpp/emitterstyle.h similarity index 87% rename from third/yaml-cpp/include/yaml-cpp/emitterstyle.h rename to dependence/yaml-cpp/include/yaml-cpp/emitterstyle.h index 67bb398..5a6355f 100644 --- a/third/yaml-cpp/include/yaml-cpp/emitterstyle.h +++ b/dependence/yaml-cpp/include/yaml-cpp/emitterstyle.h @@ -8,9 +8,10 @@ #endif namespace YAML { -struct EmitterStyle { - enum value { Default, Block, Flow }; -}; +namespace EmitterStyle { +enum value { Default, Block, Flow }; +} + } #endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/third/yaml-cpp/include/yaml-cpp/eventhandler.h b/dependence/yaml-cpp/include/yaml-cpp/eventhandler.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/eventhandler.h rename to dependence/yaml-cpp/include/yaml-cpp/eventhandler.h diff --git a/third/yaml-cpp/include/yaml-cpp/exceptions.h b/dependence/yaml-cpp/include/yaml-cpp/exceptions.h similarity index 98% rename from third/yaml-cpp/include/yaml-cpp/exceptions.h rename to dependence/yaml-cpp/include/yaml-cpp/exceptions.h index f6b2602..99e06b2 100644 --- a/third/yaml-cpp/include/yaml-cpp/exceptions.h +++ b/dependence/yaml-cpp/include/yaml-cpp/exceptions.h @@ -48,6 +48,8 @@ const char* const UNKNOWN_TOKEN = "unknown token"; const char* const DOC_IN_SCALAR = "illegal document indicator in scalar"; const char* const EOF_IN_SCALAR = "illegal EOF in scalar"; const char* const CHAR_IN_SCALAR = "illegal character in scalar"; +const char* const UNEXPECTED_SCALAR = "unexpected scalar"; +const char* const UNEXPECTED_FLOW = "plain value cannot start with flow indicator character"; const char* const TAB_IN_INDENTATION = "illegal tab when looking for indentation"; const char* const FLOW_END = "illegal flow end"; diff --git a/dependence/yaml-cpp/include/yaml-cpp/fptostring.h b/dependence/yaml-cpp/include/yaml-cpp/fptostring.h new file mode 100644 index 0000000..051053b --- /dev/null +++ b/dependence/yaml-cpp/include/yaml-cpp/fptostring.h @@ -0,0 +1,15 @@ +#ifndef YAML_H_FPTOSTRING +#define YAML_H_FPTOSTRING + +#include "yaml-cpp/dll.h" + +#include + +namespace YAML { +// "precision = 0" refers to shortest known unique representation of the value +YAML_CPP_API std::string FpToString(float v, size_t precision = 0); +YAML_CPP_API std::string FpToString(double v, size_t precision = 0); +YAML_CPP_API std::string FpToString(long double v, size_t precision = 0); +} + +#endif diff --git a/third/yaml-cpp/include/yaml-cpp/mark.h b/dependence/yaml-cpp/include/yaml-cpp/mark.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/mark.h rename to dependence/yaml-cpp/include/yaml-cpp/mark.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/convert.h b/dependence/yaml-cpp/include/yaml-cpp/node/convert.h similarity index 97% rename from third/yaml-cpp/include/yaml-cpp/node/convert.h rename to dependence/yaml-cpp/include/yaml-cpp/node/convert.h index d0eb450..0f04ea6 100644 --- a/third/yaml-cpp/include/yaml-cpp/node/convert.h +++ b/dependence/yaml-cpp/include/yaml-cpp/node/convert.h @@ -18,7 +18,7 @@ #include #include -#if __cplusplus >= 201703L +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #include #endif @@ -28,6 +28,7 @@ #include "yaml-cpp/node/node.h" #include "yaml-cpp/node/type.h" #include "yaml-cpp/null.h" +#include "yaml-cpp/fptostring.h" namespace YAML { @@ -93,7 +94,7 @@ struct convert { static Node encode(const char* rhs) { return Node(rhs); } }; -#if __cplusplus >= 201703L +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) template <> struct convert { static Node encode(std::string_view rhs) { return Node(std::string(rhs)); } @@ -129,7 +130,7 @@ inner_encode(const T& rhs, std::stringstream& stream){ stream << ".inf"; } } else { - stream << rhs; + stream << FpToString(rhs, stream.precision()); } } @@ -171,6 +172,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) { \ static Node encode(const type& rhs) { \ std::stringstream stream; \ + stream.imbue(std::locale::classic()); \ stream.precision(std::numeric_limits::max_digits10); \ conversion::inner_encode(rhs, stream); \ return Node(stream.str()); \ @@ -182,6 +184,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) { } \ const std::string& input = node.Scalar(); \ std::stringstream stream(input); \ + stream.imbue(std::locale::classic()); \ stream.unsetf(std::ios::dec); \ if ((stream.peek() == '-') && std::is_unsigned::value) { \ return false; \ diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/impl.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/impl.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/detail/impl.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/impl.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/iterator.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/iterator.h similarity index 99% rename from third/yaml-cpp/include/yaml-cpp/node/detail/iterator.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/iterator.h index 997c69a..04d2da4 100644 --- a/third/yaml-cpp/include/yaml-cpp/node/detail/iterator.h +++ b/dependence/yaml-cpp/include/yaml-cpp/node/detail/iterator.h @@ -41,7 +41,7 @@ class iterator_base { using value_type = V; using difference_type = std::ptrdiff_t; using pointer = V*; - using reference = V; + using reference = V&; public: iterator_base() : m_iterator(), m_pMemory() {} diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/memory.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/memory.h similarity index 97% rename from third/yaml-cpp/include/yaml-cpp/node/detail/memory.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/memory.h index e881545..942ab66 100644 --- a/third/yaml-cpp/include/yaml-cpp/node/detail/memory.h +++ b/dependence/yaml-cpp/include/yaml-cpp/node/detail/memory.h @@ -25,6 +25,7 @@ class YAML_CPP_API memory { memory() : m_nodes{} {} node& create_node(); void merge(const memory& rhs); + size_t size() const; private: using Nodes = std::set; diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/node.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/node.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/detail/node.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/node.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/node_data.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/node_data.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/detail/node_data.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/node_data.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h similarity index 99% rename from third/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h index 49dcf95..6eb4ddc 100644 --- a/third/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h +++ b/dependence/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h @@ -69,7 +69,7 @@ class node_iterator_base { using value_type = node_iterator_value; using difference_type = std::ptrdiff_t; using pointer = node_iterator_value*; - using reference = node_iterator_value; + using reference = node_iterator_value&; using SeqIter = typename node_iterator_type::seq; using MapIter = typename node_iterator_type::map; diff --git a/third/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h b/dependence/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h rename to dependence/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/emit.h b/dependence/yaml-cpp/include/yaml-cpp/node/emit.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/emit.h rename to dependence/yaml-cpp/include/yaml-cpp/node/emit.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/impl.h b/dependence/yaml-cpp/include/yaml-cpp/node/impl.h similarity index 97% rename from third/yaml-cpp/include/yaml-cpp/node/impl.h rename to dependence/yaml-cpp/include/yaml-cpp/node/impl.h index 312281f..f5d622b 100644 --- a/third/yaml-cpp/include/yaml-cpp/node/impl.h +++ b/dependence/yaml-cpp/include/yaml-cpp/node/impl.h @@ -97,7 +97,7 @@ struct as_if { if (!node.m_pNode) return fallback; - T t; + T t = fallback; if (convert::decode(node, t)) return t; return fallback; @@ -124,8 +124,8 @@ struct as_if { const Node& node; T operator()() const { - if (!node.m_pNode) - throw TypedBadConversion(node.Mark()); + if (!node.m_pNode) // no fallback + throw InvalidNode(node.m_invalidKey); T t; if (convert::decode(node, t)) @@ -140,6 +140,8 @@ struct as_if { const Node& node; std::string operator()() const { + if (node.Type() == NodeType::Undefined) // no fallback + throw InvalidNode(node.m_invalidKey); if (node.Type() == NodeType::Null) return "null"; if (node.Type() != NodeType::Scalar) diff --git a/third/yaml-cpp/include/yaml-cpp/node/iterator.h b/dependence/yaml-cpp/include/yaml-cpp/node/iterator.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/iterator.h rename to dependence/yaml-cpp/include/yaml-cpp/node/iterator.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/node.h b/dependence/yaml-cpp/include/yaml-cpp/node/node.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/node.h rename to dependence/yaml-cpp/include/yaml-cpp/node/node.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/parse.h b/dependence/yaml-cpp/include/yaml-cpp/node/parse.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/parse.h rename to dependence/yaml-cpp/include/yaml-cpp/node/parse.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/ptr.h b/dependence/yaml-cpp/include/yaml-cpp/node/ptr.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/node/ptr.h rename to dependence/yaml-cpp/include/yaml-cpp/node/ptr.h diff --git a/third/yaml-cpp/include/yaml-cpp/node/type.h b/dependence/yaml-cpp/include/yaml-cpp/node/type.h similarity index 84% rename from third/yaml-cpp/include/yaml-cpp/node/type.h rename to dependence/yaml-cpp/include/yaml-cpp/node/type.h index 9d55ca9..b123767 100644 --- a/third/yaml-cpp/include/yaml-cpp/node/type.h +++ b/dependence/yaml-cpp/include/yaml-cpp/node/type.h @@ -8,9 +8,10 @@ #endif namespace YAML { -struct NodeType { - enum value { Undefined, Null, Scalar, Sequence, Map }; -}; +namespace NodeType { +enum value { Undefined, Null, Scalar, Sequence, Map }; +} + } #endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/third/yaml-cpp/include/yaml-cpp/noexcept.h b/dependence/yaml-cpp/include/yaml-cpp/noexcept.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/noexcept.h rename to dependence/yaml-cpp/include/yaml-cpp/noexcept.h diff --git a/third/yaml-cpp/include/yaml-cpp/null.h b/dependence/yaml-cpp/include/yaml-cpp/null.h similarity index 89% rename from third/yaml-cpp/include/yaml-cpp/null.h rename to dependence/yaml-cpp/include/yaml-cpp/null.h index b9521d4..472e961 100644 --- a/third/yaml-cpp/include/yaml-cpp/null.h +++ b/dependence/yaml-cpp/include/yaml-cpp/null.h @@ -8,7 +8,7 @@ #endif #include "yaml-cpp/dll.h" -#include +#include namespace YAML { class Node; @@ -18,7 +18,7 @@ inline bool operator==(const _Null&, const _Null&) { return true; } inline bool operator!=(const _Null&, const _Null&) { return false; } YAML_CPP_API bool IsNull(const Node& node); // old API only -YAML_CPP_API bool IsNullString(const std::string& str); +YAML_CPP_API bool IsNullString(const char* str, std::size_t size); extern YAML_CPP_API _Null Null; } diff --git a/third/yaml-cpp/include/yaml-cpp/ostream_wrapper.h b/dependence/yaml-cpp/include/yaml-cpp/ostream_wrapper.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/ostream_wrapper.h rename to dependence/yaml-cpp/include/yaml-cpp/ostream_wrapper.h diff --git a/third/yaml-cpp/include/yaml-cpp/parser.h b/dependence/yaml-cpp/include/yaml-cpp/parser.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/parser.h rename to dependence/yaml-cpp/include/yaml-cpp/parser.h diff --git a/third/yaml-cpp/include/yaml-cpp/stlemitter.h b/dependence/yaml-cpp/include/yaml-cpp/stlemitter.h similarity index 100% rename from third/yaml-cpp/include/yaml-cpp/stlemitter.h rename to dependence/yaml-cpp/include/yaml-cpp/stlemitter.h diff --git a/third/yaml-cpp/include/yaml-cpp/traits.h b/dependence/yaml-cpp/include/yaml-cpp/traits.h similarity index 98% rename from third/yaml-cpp/include/yaml-cpp/traits.h rename to dependence/yaml-cpp/include/yaml-cpp/traits.h index ffe9999..8df9393 100644 --- a/third/yaml-cpp/include/yaml-cpp/traits.h +++ b/dependence/yaml-cpp/include/yaml-cpp/traits.h @@ -121,6 +121,7 @@ template struct streamable_to_string { static std::string impl(const Key& key) { std::stringstream ss; + ss.imbue(std::locale::classic()); ss << key; return ss.str(); } diff --git a/third/yaml-cpp/include/yaml-cpp/yaml.h b/dependence/yaml-cpp/include/yaml-cpp/yaml.h similarity index 92% rename from third/yaml-cpp/include/yaml-cpp/yaml.h rename to dependence/yaml-cpp/include/yaml-cpp/yaml.h index 7f515ef..7da7cf3 100644 --- a/third/yaml-cpp/include/yaml-cpp/yaml.h +++ b/dependence/yaml-cpp/include/yaml-cpp/yaml.h @@ -7,6 +7,8 @@ #pragma once #endif +// IWYU pragma: begin_exports + #include "yaml-cpp/parser.h" #include "yaml-cpp/emitter.h" #include "yaml-cpp/emitterstyle.h" @@ -21,4 +23,6 @@ #include "yaml-cpp/node/parse.h" #include "yaml-cpp/node/emit.h" +// IWYU pragma: end_exports + #endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/third/yaml-cpp/install.txt b/dependence/yaml-cpp/install.txt similarity index 100% rename from third/yaml-cpp/install.txt rename to dependence/yaml-cpp/install.txt diff --git a/third/yaml-cpp/src/binary.cpp b/dependence/yaml-cpp/src/binary.cpp similarity index 100% rename from third/yaml-cpp/src/binary.cpp rename to dependence/yaml-cpp/src/binary.cpp diff --git a/third/yaml-cpp/src/collectionstack.h b/dependence/yaml-cpp/src/collectionstack.h similarity index 100% rename from third/yaml-cpp/src/collectionstack.h rename to dependence/yaml-cpp/src/collectionstack.h diff --git a/dependence/yaml-cpp/src/contrib/dragonbox.h b/dependence/yaml-cpp/src/contrib/dragonbox.h new file mode 100644 index 0000000..de5a79f --- /dev/null +++ b/dependence/yaml-cpp/src/contrib/dragonbox.h @@ -0,0 +1,4196 @@ +// SPDX-FileCopyrightText: 2020-2024 Junekey Jeon +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-License-Identifier: BSL-1.0 +// SPDX-License-Identifier: MIT + +// This file is an adjusted copy of https://github.com/jk-jeon/dragonbox +// Junekey Jeon agreed to license this file under MIT license explicitly for +// usage in yaml-cpp. +// +// Changes to the original dragonbox library: +// - Added additional license information and information at top +// - Wrapped the 'jkj' namespace in an additional 'YAML' namespace + +#ifndef JKJ_HEADER_DRAGONBOX +#define JKJ_HEADER_DRAGONBOX + +// Attribute for storing static data into a dedicated place, e.g. flash memory. Every ODR-used +// static data declaration will be decorated with this macro. The users may define this macro, +// before including the library headers, into whatever they want. +#ifndef JKJ_STATIC_DATA_SECTION + #define JKJ_STATIC_DATA_SECTION +#else + #define JKJ_STATIC_DATA_SECTION_DEFINED 1 +#endif + +// To use the library with toolchains without standard C++ headers, the users may define this macro +// into their custom namespace which contains the defintions of all the standard C++ library +// features used in this header. (The list can be found below.) +#ifndef JKJ_STD_REPLACEMENT_NAMESPACE + #define JKJ_STD_REPLACEMENT_NAMESPACE std + #include + #include + #include + #include + #include + + #ifdef __has_include + #if __has_include() + #include + #endif + #endif +#else + #define JKJ_STD_REPLACEMENT_NAMESPACE_DEFINED 1 +#endif + +//////////////////////////////////////////////////////////////////////////////////////// +// Language feature detections. +//////////////////////////////////////////////////////////////////////////////////////// + +// C++14 constexpr +#if defined(__cpp_constexpr) && __cpp_constexpr >= 201304L + #define JKJ_HAS_CONSTEXPR14 1 +#elif __cplusplus >= 201402L + #define JKJ_HAS_CONSTEXPR14 1 +#elif defined(_MSC_VER) && _MSC_VER >= 1910 && _MSVC_LANG >= 201402L + #define JKJ_HAS_CONSTEXPR14 1 +#else + #define JKJ_HAS_CONSTEXPR14 0 +#endif + +#if JKJ_HAS_CONSTEXPR14 + #define JKJ_CONSTEXPR14 constexpr +#else + #define JKJ_CONSTEXPR14 +#endif + +// C++17 constexpr lambdas +#if defined(__cpp_constexpr) && __cpp_constexpr >= 201603L + #define JKJ_HAS_CONSTEXPR17 1 +#elif __cplusplus >= 201703L + #define JKJ_HAS_CONSTEXPR17 1 +#elif defined(_MSC_VER) && _MSC_VER >= 1911 && _MSVC_LANG >= 201703L + #define JKJ_HAS_CONSTEXPR17 1 +#else + #define JKJ_HAS_CONSTEXPR17 0 +#endif + +// C++17 inline variables +#if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L + #define JKJ_HAS_INLINE_VARIABLE 1 +#elif __cplusplus >= 201703L + #define JKJ_HAS_INLINE_VARIABLE 1 +#elif defined(_MSC_VER) && _MSC_VER >= 1912 && _MSVC_LANG >= 201703L + #define JKJ_HAS_INLINE_VARIABLE 1 +#else + #define JKJ_HAS_INLINE_VARIABLE 0 +#endif + +#if JKJ_HAS_INLINE_VARIABLE + #define JKJ_INLINE_VARIABLE inline constexpr +#else + #define JKJ_INLINE_VARIABLE static constexpr +#endif + +// C++17 if constexpr +#if defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606L + #define JKJ_HAS_IF_CONSTEXPR 1 +#elif __cplusplus >= 201703L + #define JKJ_HAS_IF_CONSTEXPR 1 +#elif defined(_MSC_VER) && _MSC_VER >= 1911 && _MSVC_LANG >= 201703L + #define JKJ_HAS_IF_CONSTEXPR 1 +#else + #define JKJ_HAS_IF_CONSTEXPR 0 +#endif + +#if JKJ_HAS_IF_CONSTEXPR + #define JKJ_IF_CONSTEXPR if constexpr +#else + #define JKJ_IF_CONSTEXPR if +#endif + +// C++20 std::bit_cast +#if JKJ_STD_REPLACEMENT_NAMESPACE_DEFINED + #if JKJ_STD_REPLACEMENT_HAS_BIT_CAST + #define JKJ_HAS_BIT_CAST 1 + #else + #define JKJ_HAS_BIT_CAST 0 + #endif +#elif defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L + #include + #define JKJ_HAS_BIT_CAST 1 +#else + #define JKJ_HAS_BIT_CAST 0 +#endif + +// C++23 if consteval or C++20 std::is_constant_evaluated +#if defined(__cpp_if_consteval) && __cpp_is_consteval >= 202106L + #define JKJ_IF_CONSTEVAL if consteval + #define JKJ_IF_NOT_CONSTEVAL if !consteval + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 1 + #define JKJ_USE_IS_CONSTANT_EVALUATED 0 +#elif JKJ_STD_REPLACEMENT_NAMESPACE_DEFINED + #if JKJ_STD_REPLACEMENT_HAS_IS_CONSTANT_EVALUATED + #define JKJ_IF_CONSTEVAL if (stdr::is_constant_evaluated()) + #define JKJ_IF_NOT_CONSTEVAL if (!stdr::is_constant_evaluated()) + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 1 + #define JKJ_USE_IS_CONSTANT_EVALUATED 1 + #elif JKJ_HAS_IF_CONSTEXPR + #define JKJ_IF_CONSTEVAL if constexpr (false) + #define JKJ_IF_NOT_CONSTEVAL if constexpr (true) + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 0 + #define JKJ_USE_IS_CONSTANT_EVALUATED 0 + #else + #define JKJ_IF_CONSTEVAL if (false) + #define JKJ_IF_NOT_CONSTEVAL if (true) + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 0 + #define JKJ_USE_IS_CONSTANT_EVALUATED 0 + #endif +#else + #if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L + #define JKJ_IF_CONSTEVAL if (stdr::is_constant_evaluated()) + #define JKJ_IF_NOT_CONSTEVAL if (!stdr::is_constant_evaluated()) + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 1 + #define JKJ_USE_IS_CONSTANT_EVALUATED 1 + #elif JKJ_HAS_IF_CONSTEXPR + #define JKJ_IF_CONSTEVAL if constexpr (false) + #define JKJ_IF_NOT_CONSTEVAL if constexpr (true) + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 0 + #define JKJ_USE_IS_CONSTANT_EVALUATED 0 + #else + #define JKJ_IF_CONSTEVAL if (false) + #define JKJ_IF_NOT_CONSTEVAL if (true) + #define JKJ_CAN_BRANCH_ON_CONSTEVAL 0 + #define JKJ_USE_IS_CONSTANT_EVALUATED 0 + #endif +#endif + +#if JKJ_CAN_BRANCH_ON_CONSTEVAL && JKJ_HAS_BIT_CAST + #define JKJ_CONSTEXPR20 constexpr +#else + #define JKJ_CONSTEXPR20 +#endif + +// Suppress additional buffer overrun check. +// I have no idea why MSVC thinks some functions here are vulnerable to the buffer overrun +// attacks. No, they aren't. +#if defined(__GNUC__) || defined(__clang__) + #define JKJ_SAFEBUFFERS + #define JKJ_FORCEINLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) + #define JKJ_SAFEBUFFERS __declspec(safebuffers) + #define JKJ_FORCEINLINE __forceinline +#else + #define JKJ_SAFEBUFFERS + #define JKJ_FORCEINLINE inline +#endif + +#if defined(__has_builtin) + #define JKJ_HAS_BUILTIN(x) __has_builtin(x) +#else + #define JKJ_HAS_BUILTIN(x) false +#endif + +#if defined(_MSC_VER) + #include +#elif defined(__INTEL_COMPILER) + #include +#endif + +namespace YAML { +namespace jkj { + namespace dragonbox { + //////////////////////////////////////////////////////////////////////////////////////// + // The Compatibility layer for toolchains without standard C++ headers. + //////////////////////////////////////////////////////////////////////////////////////// + namespace detail { + namespace stdr { + // +#if JKJ_HAS_BIT_CAST + using JKJ_STD_REPLACEMENT_NAMESPACE::bit_cast; +#endif + + // + // We need assert() macro, but it is not namespaced anyway, so nothing to do here. + + // + using JKJ_STD_REPLACEMENT_NAMESPACE::int_least8_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::int_least16_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::int_least32_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::int_fast8_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::int_fast16_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::int_fast32_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_least8_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_least16_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_least32_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_least64_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_fast8_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_fast16_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::uint_fast32_t; + // We need INT32_C, UINT32_C and UINT64_C macros too, but again there is nothing to do + // here. + + // + using JKJ_STD_REPLACEMENT_NAMESPACE::size_t; + using JKJ_STD_REPLACEMENT_NAMESPACE::memcpy; + + // + template + using numeric_limits = JKJ_STD_REPLACEMENT_NAMESPACE::numeric_limits; + + // + template + using enable_if = JKJ_STD_REPLACEMENT_NAMESPACE::enable_if; + template + using add_rvalue_reference = JKJ_STD_REPLACEMENT_NAMESPACE::add_rvalue_reference; + template + using conditional = JKJ_STD_REPLACEMENT_NAMESPACE::conditional; +#if JKJ_USE_IS_CONSTANT_EVALUATED + using JKJ_STD_REPLACEMENT_NAMESPACE::is_constant_evaluated; +#endif + template + using is_same = JKJ_STD_REPLACEMENT_NAMESPACE::is_same; +#if !JKJ_HAS_BIT_CAST + template + using is_trivially_copyable = JKJ_STD_REPLACEMENT_NAMESPACE::is_trivially_copyable; +#endif + template + using is_integral = JKJ_STD_REPLACEMENT_NAMESPACE::is_integral; + template + using is_signed = JKJ_STD_REPLACEMENT_NAMESPACE::is_signed; + template + using is_unsigned = JKJ_STD_REPLACEMENT_NAMESPACE::is_unsigned; + } + } + + + //////////////////////////////////////////////////////////////////////////////////////// + // Some general utilities for C++11-compatibility. + //////////////////////////////////////////////////////////////////////////////////////// + namespace detail { +#if !JKJ_HAS_CONSTEXPR17 + template + struct index_sequence {}; + + template + struct make_index_sequence_impl { + using type = typename make_index_sequence_impl::type; + }; + + template + struct make_index_sequence_impl { + using type = index_sequence; + }; + + template + using make_index_sequence = typename make_index_sequence_impl<0, N, void>::type; +#endif + + // Available since C++11, but including just for this is an overkill. + template + typename stdr::add_rvalue_reference::type declval() noexcept; + + // Similarly, including is an overkill. + template + struct array { + T data_[N]; + constexpr T operator[](stdr::size_t idx) const noexcept { return data_[idx]; } + JKJ_CONSTEXPR14 T& operator[](stdr::size_t idx) noexcept { return data_[idx]; } + }; + } + + + //////////////////////////////////////////////////////////////////////////////////////// + // Some basic features for encoding/decoding IEEE-754 formats. + //////////////////////////////////////////////////////////////////////////////////////// + namespace detail { + template + struct physical_bits { + static constexpr stdr::size_t value = + sizeof(T) * stdr::numeric_limits::digits; + }; + template + struct value_bits { + static constexpr stdr::size_t value = stdr::numeric_limits< + typename stdr::enable_if::value, T>::type>::digits; + }; + + template + JKJ_CONSTEXPR20 To bit_cast(const From& from) { +#if JKJ_HAS_BIT_CAST + return stdr::bit_cast(from); +#else + static_assert(sizeof(From) == sizeof(To), ""); + static_assert(stdr::is_trivially_copyable::value, ""); + static_assert(stdr::is_trivially_copyable::value, ""); + To to; + stdr::memcpy(&to, &from, sizeof(To)); + return to; +#endif + } + } + + // These classes expose encoding specs of IEEE-754-like floating-point formats. + // Currently available formats are IEEE-754 binary32 & IEEE-754 binary64. + + struct ieee754_binary32 { + static constexpr int total_bits = 32; + static constexpr int significand_bits = 23; + static constexpr int exponent_bits = 8; + static constexpr int min_exponent = -126; + static constexpr int max_exponent = 127; + static constexpr int exponent_bias = -127; + static constexpr int decimal_significand_digits = 9; + static constexpr int decimal_exponent_digits = 2; + }; + struct ieee754_binary64 { + static constexpr int total_bits = 64; + static constexpr int significand_bits = 52; + static constexpr int exponent_bits = 11; + static constexpr int min_exponent = -1022; + static constexpr int max_exponent = 1023; + static constexpr int exponent_bias = -1023; + static constexpr int decimal_significand_digits = 17; + static constexpr int decimal_exponent_digits = 3; + }; + + // A floating-point format traits class defines ways to interpret a bit pattern of given size as + // an encoding of floating-point number. This is an implementation of such a traits class, + // supporting ways to interpret IEEE-754 binary floating-point numbers. + template + struct ieee754_binary_traits { + // CarrierUInt needs to have enough size to hold the entire contents of floating-point + // numbers. The actual bits are assumed to be aligned to the LSB, and every other bits are + // assumed to be zeroed. + static_assert(detail::value_bits::value >= Format::total_bits, + "jkj::dragonbox: insufficient number of bits"); + static_assert(detail::stdr::is_unsigned::value, ""); + + // ExponentUInt needs to be large enough to hold (unsigned) exponent bits as well as the + // (signed) actual exponent. + // TODO: static overflow guard against intermediate computations. + static_assert(detail::value_bits::value >= Format::exponent_bits + 1, + "jkj::dragonbox: insufficient number of bits"); + static_assert(detail::stdr::is_signed::value, ""); + + using format = Format; + using carrier_uint = CarrierUInt; + static constexpr int carrier_bits = int(detail::value_bits::value); + using exponent_int = ExponentInt; + + // Extract exponent bits from a bit pattern. + // The result must be aligned to the LSB so that there is no additional zero paddings + // on the right. This function does not do bias adjustment. + static constexpr exponent_int extract_exponent_bits(carrier_uint u) noexcept { + return exponent_int((u >> format::significand_bits) & + ((exponent_int(1) << format::exponent_bits) - 1)); + } + + // Extract significand bits from a bit pattern. + // The result must be aligned to the LSB so that there is no additional zero paddings + // on the right. The result does not contain the implicit bit. + static constexpr carrier_uint extract_significand_bits(carrier_uint u) noexcept { + return carrier_uint(u & ((carrier_uint(1) << format::significand_bits) - 1u)); + } + + // Remove the exponent bits and extract significand bits together with the sign bit. + static constexpr carrier_uint remove_exponent_bits(carrier_uint u) noexcept { + return carrier_uint(u & ~(((carrier_uint(1) << format::exponent_bits) - 1u) + << format::significand_bits)); + } + + // Shift the obtained signed significand bits to the left by 1 to remove the sign bit. + static constexpr carrier_uint remove_sign_bit_and_shift(carrier_uint u) noexcept { + return carrier_uint((carrier_uint(u) << 1) & + ((((carrier_uint(1) << (Format::total_bits - 1)) - 1u) << 1) | 1u)); + } + + // Obtain the actual value of the binary exponent from the extracted exponent bits. + static constexpr exponent_int binary_exponent(exponent_int exponent_bits) noexcept { + return exponent_int(exponent_bits == 0 ? format::min_exponent + : exponent_bits + format::exponent_bias); + } + + // Obtain the actual value of the binary significand from the extracted significand bits + // and exponent bits. + static constexpr carrier_uint binary_significand(carrier_uint significand_bits, + exponent_int exponent_bits) noexcept { + return carrier_uint( + exponent_bits == 0 + ? significand_bits + : (significand_bits | (carrier_uint(1) << format::significand_bits))); + } + + /* Various boolean observer functions */ + + static constexpr bool is_nonzero(carrier_uint u) noexcept { + return (u & ((carrier_uint(1) << (format::significand_bits + format::exponent_bits)) - + 1u)) != 0; + } + static constexpr bool is_positive(carrier_uint u) noexcept { + return u < (carrier_uint(1) << (format::significand_bits + format::exponent_bits)); + } + static constexpr bool is_negative(carrier_uint u) noexcept { return !is_positive(u); } + static constexpr bool is_finite(exponent_int exponent_bits) noexcept { + return exponent_bits != ((exponent_int(1) << format::exponent_bits) - 1); + } + static constexpr bool has_all_zero_significand_bits(carrier_uint u) noexcept { + return ((u << 1) & + ((((carrier_uint(1) << (Format::total_bits - 1)) - 1u) << 1) | 1u)) == 0; + } + static constexpr bool has_even_significand_bits(carrier_uint u) noexcept { + return u % 2 == 0; + } + }; + + // Convert between bit patterns stored in carrier_uint and instances of an actual + // floating-point type. Depending on format and carrier_uint, this operation might not + // be possible for some specific bit patterns. However, the contract is that u always + // denotes a valid bit pattern, so the functions here are assumed to be noexcept. + // Users might specialize this class to change the behavior for certain types. + // The default provided by the library is to treat the given floating-point type Float as either + // IEEE-754 binary32 or IEEE-754 binary64, depending on the bitwise size of Float. + template + struct default_float_bit_carrier_conversion_traits { + // Guards against types that have different internal representations than IEEE-754 + // binary32/64. I don't know if there is a truly reliable way of detecting IEEE-754 binary + // formats. I just did my best here. Note that in some cases + // numeric_limits::is_iec559 may report false even if the internal representation is + // IEEE-754 compatible. In such a case, the user can specialize this traits template and + // remove this static sanity check in order to make Dragonbox work for Float. + static_assert(detail::stdr::numeric_limits::is_iec559 && + detail::stdr::numeric_limits::radix == 2 && + (detail::physical_bits::value == 32 || + detail::physical_bits::value == 64), + "jkj::dragonbox: Float may not be of IEEE-754 binary32/binary64"); + + // Specifies the unsigned integer type to hold bitwise value of Float. + using carrier_uint = + typename detail::stdr::conditional::value == 32, + detail::stdr::uint_least32_t, + detail::stdr::uint_least64_t>::type; + + // Specifies the floating-point format. + using format = typename detail::stdr::conditional::value == 32, + ieee754_binary32, ieee754_binary64>::type; + + // Converts the floating-point type into the bit-carrier unsigned integer type. + static JKJ_CONSTEXPR20 carrier_uint float_to_carrier(Float x) noexcept { + return detail::bit_cast(x); + } + + // Converts the bit-carrier unsigned integer type into the floating-point type. + static JKJ_CONSTEXPR20 Float carrier_to_float(carrier_uint x) noexcept { + return detail::bit_cast(x); + } + }; + + // Convenient wrappers for floating-point traits classes. + // In order to reduce the argument passing overhead, these classes should be as simple as + // possible (e.g., no inheritance, no private non-static data member, etc.; this is an + // unfortunate fact about common ABI convention). + + template + struct signed_significand_bits { + using format_traits = FormatTraits; + using carrier_uint = typename format_traits::carrier_uint; + + carrier_uint u; + + signed_significand_bits() = default; + constexpr explicit signed_significand_bits(carrier_uint bit_pattern) noexcept + : u{bit_pattern} {} + + // Shift the obtained signed significand bits to the left by 1 to remove the sign bit. + constexpr carrier_uint remove_sign_bit_and_shift() const noexcept { + return format_traits::remove_sign_bit_and_shift(u); + } + + constexpr bool is_positive() const noexcept { return format_traits::is_positive(u); } + constexpr bool is_negative() const noexcept { return format_traits::is_negative(u); } + constexpr bool has_all_zero_significand_bits() const noexcept { + return format_traits::has_all_zero_significand_bits(u); + } + constexpr bool has_even_significand_bits() const noexcept { + return format_traits::has_even_significand_bits(u); + } + }; + + template + struct float_bits { + using format_traits = FormatTraits; + using carrier_uint = typename format_traits::carrier_uint; + using exponent_int = typename format_traits::exponent_int; + + carrier_uint u; + + float_bits() = default; + constexpr explicit float_bits(carrier_uint bit_pattern) noexcept : u{bit_pattern} {} + + // Extract exponent bits from a bit pattern. + // The result must be aligned to the LSB so that there is no additional zero paddings + // on the right. This function does not do bias adjustment. + constexpr exponent_int extract_exponent_bits() const noexcept { + return format_traits::extract_exponent_bits(u); + } + + // Extract significand bits from a bit pattern. + // The result must be aligned to the LSB so that there is no additional zero paddings + // on the right. The result does not contain the implicit bit. + constexpr carrier_uint extract_significand_bits() const noexcept { + return format_traits::extract_significand_bits(u); + } + + // Remove the exponent bits and extract significand bits together with the sign bit. + constexpr signed_significand_bits remove_exponent_bits() const noexcept { + return signed_significand_bits(format_traits::remove_exponent_bits(u)); + } + + // Obtain the actual value of the binary exponent from the extracted exponent bits. + static constexpr exponent_int binary_exponent(exponent_int exponent_bits) noexcept { + return format_traits::binary_exponent(exponent_bits); + } + constexpr exponent_int binary_exponent() const noexcept { + return binary_exponent(extract_exponent_bits()); + } + + // Obtain the actual value of the binary exponent from the extracted significand bits + // and exponent bits. + static constexpr carrier_uint binary_significand(carrier_uint significand_bits, + exponent_int exponent_bits) noexcept { + return format_traits::binary_significand(significand_bits, exponent_bits); + } + constexpr carrier_uint binary_significand() const noexcept { + return binary_significand(extract_significand_bits(), extract_exponent_bits()); + } + + constexpr bool is_nonzero() const noexcept { return format_traits::is_nonzero(u); } + constexpr bool is_positive() const noexcept { return format_traits::is_positive(u); } + constexpr bool is_negative() const noexcept { return format_traits::is_negative(u); } + constexpr bool is_finite(exponent_int exponent_bits) const noexcept { + return format_traits::is_finite(exponent_bits); + } + constexpr bool is_finite() const noexcept { + return format_traits::is_finite(extract_exponent_bits()); + } + constexpr bool has_even_significand_bits() const noexcept { + return format_traits::has_even_significand_bits(u); + } + }; + + template , + class FormatTraits = ieee754_binary_traits> + JKJ_CONSTEXPR20 float_bits make_float_bits(Float x) noexcept { + return float_bits(ConversionTraits::float_to_carrier(x)); + } + + namespace detail { + //////////////////////////////////////////////////////////////////////////////////////// + // Bit operation intrinsics. + //////////////////////////////////////////////////////////////////////////////////////// + + namespace bits { + // Most compilers should be able to optimize this into the ROR instruction. + // n is assumed to be at most of bit_width bits. + template + JKJ_CONSTEXPR14 UInt rotr(UInt n, unsigned int r) noexcept { + static_assert(bit_width > 0, "jkj::dragonbox: rotation bit-width must be positive"); + static_assert(bit_width <= value_bits::value, + "jkj::dragonbox: rotation bit-width is too large"); + r &= (bit_width - 1); + return (n >> r) | (n << ((bit_width - r) & (bit_width - 1))); + } + } + + //////////////////////////////////////////////////////////////////////////////////////// + // Utilities for wide unsigned integer arithmetic. + //////////////////////////////////////////////////////////////////////////////////////// + + namespace wuint { + // Compilers might support built-in 128-bit integer types. However, it seems that + // emulating them with a pair of 64-bit integers actually produces a better code, + // so we avoid using those built-ins. That said, they are still useful for + // implementing 64-bit x 64-bit -> 128-bit multiplication. + + // clang-format off +#if defined(__SIZEOF_INT128__) + // To silence "error: ISO C++ does not support '__int128' for 'type name' + // [-Wpedantic]" +#if defined(__GNUC__) + __extension__ +#endif + using builtin_uint128_t = unsigned __int128; +#endif + // clang-format on + + struct uint128 { + uint128() = default; + + stdr::uint_least64_t high_; + stdr::uint_least64_t low_; + + constexpr uint128(stdr::uint_least64_t high, stdr::uint_least64_t low) noexcept + : high_{high}, low_{low} {} + + constexpr stdr::uint_least64_t high() const noexcept { return high_; } + constexpr stdr::uint_least64_t low() const noexcept { return low_; } + + JKJ_CONSTEXPR20 uint128& operator+=(stdr::uint_least64_t n) & noexcept { + auto const generic_impl = [&] { + auto const sum = (low_ + n) & UINT64_C(0xffffffffffffffff); + high_ += (sum < low_ ? 1 : 0); + low_ = sum; + }; + // To suppress warning. + static_cast(generic_impl); + + JKJ_IF_CONSTEXPR(value_bits::value > 64) { + generic_impl(); + return *this; + } + + JKJ_IF_CONSTEVAL { + generic_impl(); + return *this; + } + + // See https://github.com/fmtlib/fmt/pull/2985. +#if JKJ_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__) + JKJ_IF_CONSTEXPR( + stdr::is_same::value) { + unsigned long long carry{}; + low_ = stdr::uint_least64_t(__builtin_addcll(low_, n, 0, &carry)); + high_ = stdr::uint_least64_t(__builtin_addcll(high_, 0, carry, &carry)); + return *this; + } +#endif +#if JKJ_HAS_BUILTIN(__builtin_addcl) && !defined(__ibmxl__) + JKJ_IF_CONSTEXPR(stdr::is_same::value) { + unsigned long carry{}; + low_ = stdr::uint_least64_t( + __builtin_addcl(static_cast(low_), + static_cast(n), 0, &carry)); + high_ = stdr::uint_least64_t( + __builtin_addcl(static_cast(high_), 0, carry, &carry)); + return *this; + } +#endif +#if JKJ_HAS_BUILTIN(__builtin_addc) && !defined(__ibmxl__) + JKJ_IF_CONSTEXPR(stdr::is_same::value) { + unsigned int carry{}; + low_ = stdr::uint_least64_t(__builtin_addc(static_cast(low_), + static_cast(n), 0, + &carry)); + high_ = stdr::uint_least64_t( + __builtin_addc(static_cast(high_), 0, carry, &carry)); + return *this; + } +#endif + +#if JKJ_HAS_BUILTIN(__builtin_ia32_addcarry_u64) + // __builtin_ia32_addcarry_u64 is not documented, but it seems it takes unsigned + // long long arguments. + unsigned long long result{}; + auto const carry = __builtin_ia32_addcarry_u64(0, low_, n, &result); + low_ = stdr::uint_least64_t(result); + __builtin_ia32_addcarry_u64(carry, high_, 0, &result); + high_ = stdr::uint_least64_t(result); +#elif defined(_MSC_VER) && defined(_M_X64) + // On MSVC, uint_least64_t and __int64 must be unsigned long long; see + // https://learn.microsoft.com/en-us/cpp/c-runtime-library/standard-types + // and https://learn.microsoft.com/en-us/cpp/cpp/int8-int16-int32-int64. + static_assert(stdr::is_same::value, + ""); + auto const carry = _addcarry_u64(0, low_, n, &low_); + _addcarry_u64(carry, high_, 0, &high_); +#elif defined(__INTEL_COMPILER) && (defined(_M_X64) || defined(__x86_64)) + // Cannot find any documentation on how things are defined, but hopefully this + // is always true... + static_assert(stdr::is_same::value, ""); + auto const carry = _addcarry_u64(0, low_, n, &low_); + _addcarry_u64(carry, high_, 0, &high_); +#else + generic_impl(); +#endif + return *this; + } + }; + + inline JKJ_CONSTEXPR20 stdr::uint_least64_t umul64(stdr::uint_least32_t x, + stdr::uint_least32_t y) noexcept { +#if defined(_MSC_VER) && defined(_M_IX86) + JKJ_IF_NOT_CONSTEVAL { return __emulu(x, y); } +#endif + return x * stdr::uint_least64_t(y); + } + + // Get 128-bit result of multiplication of two 64-bit unsigned integers. + JKJ_SAFEBUFFERS inline JKJ_CONSTEXPR20 uint128 + umul128(stdr::uint_least64_t x, stdr::uint_least64_t y) noexcept { + auto const generic_impl = [=]() -> uint128 { + auto const a = stdr::uint_least32_t(x >> 32); + auto const b = stdr::uint_least32_t(x); + auto const c = stdr::uint_least32_t(y >> 32); + auto const d = stdr::uint_least32_t(y); + + auto const ac = umul64(a, c); + auto const bc = umul64(b, c); + auto const ad = umul64(a, d); + auto const bd = umul64(b, d); + + auto const intermediate = + (bd >> 32) + stdr::uint_least32_t(ad) + stdr::uint_least32_t(bc); + + return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32), + (intermediate << 32) + stdr::uint_least32_t(bd)}; + }; + // To silence warning. + static_cast(generic_impl); + +#if defined(__SIZEOF_INT128__) + auto const result = builtin_uint128_t(x) * builtin_uint128_t(y); + return {stdr::uint_least64_t(result >> 64), stdr::uint_least64_t(result)}; +#elif defined(_MSC_VER) && defined(_M_X64) + JKJ_IF_CONSTEVAL { + // This redundant variable is to workaround MSVC's codegen bug caused by the + // interaction of NRVO and intrinsics. + auto const result = generic_impl(); + return result; + } + uint128 result; + #if defined(__AVX2__) + result.low_ = _mulx_u64(x, y, &result.high_); + #else + result.low_ = _umul128(x, y, &result.high_); + #endif + return result; +#else + return generic_impl(); +#endif + } + + // Get high half of the 128-bit result of multiplication of two 64-bit unsigned + // integers. + JKJ_SAFEBUFFERS inline JKJ_CONSTEXPR20 stdr::uint_least64_t + umul128_upper64(stdr::uint_least64_t x, stdr::uint_least64_t y) noexcept { + auto const generic_impl = [=]() -> stdr::uint_least64_t { + auto const a = stdr::uint_least32_t(x >> 32); + auto const b = stdr::uint_least32_t(x); + auto const c = stdr::uint_least32_t(y >> 32); + auto const d = stdr::uint_least32_t(y); + + auto const ac = umul64(a, c); + auto const bc = umul64(b, c); + auto const ad = umul64(a, d); + auto const bd = umul64(b, d); + + auto const intermediate = + (bd >> 32) + stdr::uint_least32_t(ad) + stdr::uint_least32_t(bc); + + return ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32); + }; + // To silence warning. + static_cast(generic_impl); + +#if defined(__SIZEOF_INT128__) + auto const result = builtin_uint128_t(x) * builtin_uint128_t(y); + return stdr::uint_least64_t(result >> 64); +#elif defined(_MSC_VER) && defined(_M_X64) + JKJ_IF_CONSTEVAL { + // This redundant variable is to workaround MSVC's codegen bug caused by the + // interaction of NRVO and intrinsics. + auto const result = generic_impl(); + return result; + } + stdr::uint_least64_t result; + #if defined(__AVX2__) + _mulx_u64(x, y, &result); + #else + result = __umulh(x, y); + #endif + return result; +#else + return generic_impl(); +#endif + } + + // Get upper 128-bits of multiplication of a 64-bit unsigned integer and a 128-bit + // unsigned integer. + JKJ_SAFEBUFFERS inline JKJ_CONSTEXPR20 uint128 umul192_upper128(stdr::uint_least64_t x, + uint128 y) noexcept { + auto r = umul128(x, y.high()); + r += umul128_upper64(x, y.low()); + return r; + } + + // Get upper 64-bits of multiplication of a 32-bit unsigned integer and a 64-bit + // unsigned integer. + inline JKJ_CONSTEXPR20 stdr::uint_least64_t + umul96_upper64(stdr::uint_least32_t x, stdr::uint_least64_t y) noexcept { +#if defined(__SIZEOF_INT128__) || (defined(_MSC_VER) && defined(_M_X64)) + return umul128_upper64(stdr::uint_least64_t(x) << 32, y); +#else + auto const yh = stdr::uint_least32_t(y >> 32); + auto const yl = stdr::uint_least32_t(y); + + auto const xyh = umul64(x, yh); + auto const xyl = umul64(x, yl); + + return xyh + (xyl >> 32); +#endif + } + + // Get lower 128-bits of multiplication of a 64-bit unsigned integer and a 128-bit + // unsigned integer. + JKJ_SAFEBUFFERS inline JKJ_CONSTEXPR20 uint128 umul192_lower128(stdr::uint_least64_t x, + uint128 y) noexcept { + auto const high = x * y.high(); + auto const high_low = umul128(x, y.low()); + return {(high + high_low.high()) & UINT64_C(0xffffffffffffffff), high_low.low()}; + } + + // Get lower 64-bits of multiplication of a 32-bit unsigned integer and a 64-bit + // unsigned integer. + constexpr stdr::uint_least64_t umul96_lower64(stdr::uint_least32_t x, + stdr::uint_least64_t y) noexcept { + return (x * y) & UINT64_C(0xffffffffffffffff); + } + } + + //////////////////////////////////////////////////////////////////////////////////////// + // Some simple utilities for constexpr computation. + //////////////////////////////////////////////////////////////////////////////////////// + + template + constexpr Int compute_power(Int a) noexcept { + static_assert(k >= 0, ""); +#if JKJ_HAS_CONSTEXPR14 + Int p = 1; + for (int i = 0; i < k; ++i) { + p *= a; + } + return p; +#else + return k == 0 ? 1 + : k % 2 == 0 ? compute_power(a * a) + : a * compute_power(a * a); +#endif + } + + template + constexpr int count_factors(UInt n) noexcept { + static_assert(a > 1, ""); +#if JKJ_HAS_CONSTEXPR14 + int c = 0; + while (n % a == 0) { + n /= a; + ++c; + } + return c; +#else + return n % a == 0 ? count_factors(n / a) + 1 : 0; +#endif + } + + //////////////////////////////////////////////////////////////////////////////////////// + // Utilities for fast/constexpr log computation. + //////////////////////////////////////////////////////////////////////////////////////// + + namespace log { + static_assert((stdr::int_fast32_t(-1) >> 1) == stdr::int_fast32_t(-1) && + (stdr::int_fast16_t(-1) >> 1) == stdr::int_fast16_t(-1), + "jkj::dragonbox: right-shift for signed integers must be arithmetic"); + + // For constexpr computation. + // Returns -1 when n = 0. + template + constexpr int floor_log2(UInt n) noexcept { +#if JKJ_HAS_CONSTEXPR14 + int count = -1; + while (n != 0) { + ++count; + n >>= 1; + } + return count; +#else + return n == 0 ? -1 : floor_log2(n / 2) + 1; +#endif + } + + template