You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/06/15 00:25:28 UTC
[trafficserver] branch 8.0.x updated (c677d67 -> 2e8724d)
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a change to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.
from c677d67 Fixed coredump with origin throttling
new 39fedef Importing yaml-cpp into tree
new 6b45069 Converts logging.config and ssl_server_name.config to YAML-based files
new 9e4eacb Removes luajit lib and custom Lua bindings
new 2e8724d doc: Updates for the logging.config and ssl_server_name.config yaml conversion
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CMakeLists.txt | 159 +-
NOTICE | 11 +-
build/yaml-cpp.m4 | 82 +
ci/jenkins/bin/clang-analyzer.sh | 8 -
ci/rat-regex.txt | 2 +-
configure.ac | 53 +-
doc/admin-guide/files/logging.config.en.rst | 107 +-
.../files/ssl_server_name.config.en.rst | 36 +-
doc/admin-guide/logging/destinations.en.rst | 16 +-
doc/admin-guide/logging/examples.en.rst | 114 +-
doc/admin-guide/logging/formatting.en.rst | 17 +-
doc/admin-guide/logging/understanding.en.rst | 10 +-
iocore/net/LuaSNIConfig.cc | 127 -
iocore/net/LuaSNIConfig.h | 114 -
iocore/net/Makefile.am | 12 +-
iocore/net/P_SSLSNI.h | 4 +-
iocore/net/SSLSNIConfig.cc | 23 +-
iocore/net/YamlSNIConfig.cc | 107 +
iocore/net/YamlSNIConfig.h | 62 +
lib/Makefile.am | 35 +-
lib/bindings/Makefile.am | 38 -
lib/bindings/bindings.cc | 317 -
lib/bindings/bindings.h | 73 -
lib/bindings/lua.cc | 100 -
lib/bindings/lua.h | 101 -
lib/bindings/repl.cc | 60 -
lib/bindings/repl.h | 27 -
lib/luajit/.gitignore | 11 -
lib/luajit/COPYRIGHT | 56 -
lib/luajit/Makefile | 151 -
lib/luajit/README | 16 -
lib/luajit/doc/bluequad-print.css | 166 -
lib/luajit/doc/bluequad.css | 325 -
lib/luajit/doc/changes.html | 978 --
lib/luajit/doc/contact.html | 102 -
lib/luajit/doc/ext_c_api.html | 187 -
lib/luajit/doc/ext_ffi.html | 330 -
lib/luajit/doc/ext_ffi_api.html | 566 --
lib/luajit/doc/ext_ffi_semantics.html | 1245 ---
lib/luajit/doc/ext_ffi_tutorial.html | 601 --
lib/luajit/doc/ext_jit.html | 199 -
lib/luajit/doc/extensions.html | 408 -
lib/luajit/doc/faq.html | 184 -
lib/luajit/doc/img/contact.png | Bin 1340 -> 0 bytes
lib/luajit/doc/install.html | 646 --
lib/luajit/doc/luajit.html | 234 -
lib/luajit/doc/running.html | 306 -
lib/luajit/doc/status.html | 116 -
lib/luajit/dynasm/dasm_arm.h | 456 -
lib/luajit/dynasm/dasm_arm.lua | 1125 ---
lib/luajit/dynasm/dasm_mips.h | 416 -
lib/luajit/dynasm/dasm_mips.lua | 953 --
lib/luajit/dynasm/dasm_ppc.h | 412 -
lib/luajit/dynasm/dasm_ppc.lua | 1249 ---
lib/luajit/dynasm/dasm_proto.h | 83 -
lib/luajit/dynasm/dasm_x64.lua | 12 -
lib/luajit/dynasm/dasm_x86.h | 472 -
lib/luajit/dynasm/dasm_x86.lua | 1945 ----
lib/luajit/dynasm/dynasm.lua | 1094 ---
lib/luajit/etc/luajit.1 | 88 -
lib/luajit/etc/luajit.pc | 25 -
lib/luajit/src/.gitignore | 7 -
lib/luajit/src/Makefile | 684 --
lib/luajit/src/Makefile.dep | 226 -
lib/luajit/src/host/.gitignore | 3 -
lib/luajit/src/host/README | 4 -
lib/luajit/src/host/buildvm.c | 516 --
lib/luajit/src/host/buildvm.h | 104 -
lib/luajit/src/host/buildvm_asm.c | 313 -
lib/luajit/src/host/buildvm_fold.c | 229 -
lib/luajit/src/host/buildvm_lib.c | 398 -
lib/luajit/src/host/buildvm_peobj.c | 368 -
lib/luajit/src/host/genminilua.lua | 428 -
lib/luajit/src/host/minilua.c | 7770 ----------------
lib/luajit/src/jit/.gitignore | 1 -
lib/luajit/src/jit/bc.lua | 191 -
lib/luajit/src/jit/bcsave.lua | 659 --
lib/luajit/src/jit/dis_arm.lua | 689 --
lib/luajit/src/jit/dis_mips.lua | 428 -
lib/luajit/src/jit/dis_mipsel.lua | 20 -
lib/luajit/src/jit/dis_ppc.lua | 591 --
lib/luajit/src/jit/dis_x64.lua | 20 -
lib/luajit/src/jit/dis_x86.lua | 836 --
lib/luajit/src/jit/dump.lua | 699 --
lib/luajit/src/jit/v.lua | 167 -
lib/luajit/src/lauxlib.h | 167 -
lib/luajit/src/lib_aux.c | 356 -
lib/luajit/src/lib_base.c | 683 --
lib/luajit/src/lib_bit.c | 74 -
lib/luajit/src/lib_debug.c | 405 -
lib/luajit/src/lib_ffi.c | 851 --
lib/luajit/src/lib_init.c | 55 -
lib/luajit/src/lib_io.c | 539 --
lib/luajit/src/lib_jit.c | 663 --
lib/luajit/src/lib_math.c | 233 -
lib/luajit/src/lib_os.c | 287 -
lib/luajit/src/lib_package.c | 602 --
lib/luajit/src/lib_string.c | 940 --
lib/luajit/src/lib_table.c | 300 -
lib/luajit/src/lj.supp | 26 -
lib/luajit/src/lj_alloc.c | 1396 ---
lib/luajit/src/lj_alloc.h | 17 -
lib/luajit/src/lj_api.c | 1200 ---
lib/luajit/src/lj_arch.h | 437 -
lib/luajit/src/lj_asm.c | 1920 ----
lib/luajit/src/lj_asm.h | 17 -
lib/luajit/src/lj_asm_arm.h | 2361 -----
lib/luajit/src/lj_asm_mips.h | 1977 ----
lib/luajit/src/lj_asm_ppc.h | 2169 -----
lib/luajit/src/lj_asm_x86.h | 2806 ------
lib/luajit/src/lj_bc.c | 14 -
lib/luajit/src/lj_bc.h | 261 -
lib/luajit/src/lj_bcdump.h | 66 -
lib/luajit/src/lj_bcread.c | 476 -
lib/luajit/src/lj_bcwrite.c | 396 -
lib/luajit/src/lj_carith.c | 353 -
lib/luajit/src/lj_carith.h | 27 -
lib/luajit/src/lj_ccall.c | 900 --
lib/luajit/src/lj_ccall.h | 171 -
lib/luajit/src/lj_ccallback.c | 644 --
lib/luajit/src/lj_ccallback.h | 25 -
lib/luajit/src/lj_cconv.c | 752 --
lib/luajit/src/lj_cconv.h | 70 -
lib/luajit/src/lj_cdata.c | 285 -
lib/luajit/src/lj_cdata.h | 75 -
lib/luajit/src/lj_char.c | 43 -
lib/luajit/src/lj_char.h | 42 -
lib/luajit/src/lj_clib.c | 409 -
lib/luajit/src/lj_clib.h | 29 -
lib/luajit/src/lj_cparse.c | 1877 ----
lib/luajit/src/lj_cparse.h | 65 -
lib/luajit/src/lj_crecord.c | 1671 ----
lib/luajit/src/lj_crecord.h | 31 -
lib/luajit/src/lj_ctype.c | 634 --
lib/luajit/src/lj_ctype.h | 461 -
lib/luajit/src/lj_debug.c | 605 --
lib/luajit/src/lj_debug.h | 61 -
lib/luajit/src/lj_def.h | 353 -
lib/luajit/src/lj_dispatch.c | 494 -
lib/luajit/src/lj_dispatch.h | 131 -
lib/luajit/src/lj_emit_arm.h | 356 -
lib/luajit/src/lj_emit_mips.h | 211 -
lib/luajit/src/lj_emit_ppc.h | 238 -
lib/luajit/src/lj_emit_x86.h | 466 -
lib/luajit/src/lj_err.c | 800 --
lib/luajit/src/lj_err.h | 41 -
lib/luajit/src/lj_errmsg.h | 193 -
lib/luajit/src/lj_ff.h | 18 -
lib/luajit/src/lj_ffrecord.c | 888 --
lib/luajit/src/lj_ffrecord.h | 24 -
lib/luajit/src/lj_frame.h | 183 -
lib/luajit/src/lj_func.c | 185 -
lib/luajit/src/lj_func.h | 24 -
lib/luajit/src/lj_gc.c | 849 --
lib/luajit/src/lj_gc.h | 134 -
lib/luajit/src/lj_gdbjit.c | 795 --
lib/luajit/src/lj_gdbjit.h | 22 -
lib/luajit/src/lj_ir.c | 501 -
lib/luajit/src/lj_ir.h | 551 --
lib/luajit/src/lj_ircall.h | 277 -
lib/luajit/src/lj_iropt.h | 161 -
lib/luajit/src/lj_jit.h | 417 -
lib/luajit/src/lj_lex.c | 482 -
lib/luajit/src/lj_lex.h | 85 -
lib/luajit/src/lj_lib.c | 258 -
lib/luajit/src/lj_lib.h | 112 -
lib/luajit/src/lj_load.c | 168 -
lib/luajit/src/lj_mcode.c | 386 -
lib/luajit/src/lj_mcode.h | 30 -
lib/luajit/src/lj_meta.c | 466 -
lib/luajit/src/lj_meta.h | 37 -
lib/luajit/src/lj_obj.c | 35 -
lib/luajit/src/lj_obj.h | 856 --
lib/luajit/src/lj_opt_dce.c | 78 -
lib/luajit/src/lj_opt_fold.c | 2304 -----
lib/luajit/src/lj_opt_loop.c | 436 -
lib/luajit/src/lj_opt_mem.c | 916 --
lib/luajit/src/lj_opt_narrow.c | 656 --
lib/luajit/src/lj_opt_sink.c | 245 -
lib/luajit/src/lj_opt_split.c | 731 --
lib/luajit/src/lj_parse.c | 2754 ------
lib/luajit/src/lj_parse.h | 18 -
lib/luajit/src/lj_record.c | 2252 -----
lib/luajit/src/lj_record.h | 44 -
lib/luajit/src/lj_snap.c | 866 --
lib/luajit/src/lj_snap.h | 34 -
lib/luajit/src/lj_state.c | 287 -
lib/luajit/src/lj_state.h | 35 -
lib/luajit/src/lj_str.c | 339 -
lib/luajit/src/lj_str.h | 50 -
lib/luajit/src/lj_strscan.c | 498 -
lib/luajit/src/lj_strscan.h | 39 -
lib/luajit/src/lj_tab.c | 631 --
lib/luajit/src/lj_tab.h | 70 -
lib/luajit/src/lj_target.h | 162 -
lib/luajit/src/lj_target_arm.h | 274 -
lib/luajit/src/lj_target_mips.h | 257 -
lib/luajit/src/lj_target_ppc.h | 280 -
lib/luajit/src/lj_target_x86.h | 342 -
lib/luajit/src/lj_trace.c | 816 --
lib/luajit/src/lj_trace.h | 53 -
lib/luajit/src/lj_traceerr.h | 61 -
lib/luajit/src/lj_udata.c | 34 -
lib/luajit/src/lj_udata.h | 14 -
lib/luajit/src/lj_vm.h | 116 -
lib/luajit/src/lj_vmevent.c | 57 -
lib/luajit/src/lj_vmevent.h | 59 -
lib/luajit/src/lj_vmmath.c | 140 -
lib/luajit/src/ljamalg.c | 93 -
lib/luajit/src/lua.h | 393 -
lib/luajit/src/lua.hpp | 9 -
lib/luajit/src/luaconf.h | 156 -
lib/luajit/src/luajit.c | 571 --
lib/luajit/src/luajit.h | 70 -
lib/luajit/src/lualib.h | 43 -
lib/luajit/src/msvcbuild.bat | 113 -
lib/luajit/src/ps4build.bat | 103 -
lib/luajit/src/psvitabuild.bat | 93 -
lib/luajit/src/vm_arm.dasc | 4486 ---------
lib/luajit/src/vm_mips.dasc | 4241 ---------
lib/luajit/src/vm_ppc.dasc | 5160 -----------
lib/luajit/src/vm_ppcspe.dasc | 3691 --------
lib/luajit/src/vm_x86.dasc | 6377 -------------
lib/luajit/src/xedkbuild.bat | 92 -
lib/ts/EnumDescriptor.h | 61 +
lib/tsconfig/Makefile.am | 4 +-
lib/tsconfig/TsConfigLua.cc | 53 -
lib/tsconfig/TsConfigLua.h | 184 -
lib/yamlcpp/.clang-format | 47 +
lib/yamlcpp/.codedocs | 50 +
lib/yamlcpp/.gitignore | 1 +
lib/yamlcpp/.travis.yml | 28 +
lib/yamlcpp/CMakeLists.txt | 365 +
lib/yamlcpp/CONTRIBUTING.md | 26 +
lib/yamlcpp/LICENSE | 19 +
lib/yamlcpp/Makefile.am | 66 +
lib/yamlcpp/README.md | 51 +
lib/yamlcpp/include/yaml-cpp/anchor.h | 17 +
lib/yamlcpp/include/yaml-cpp/binary.h | 67 +
lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h | 39 +
.../include/yaml-cpp/contrib/graphbuilder.h | 149 +
lib/yamlcpp/include/yaml-cpp/dll.h | 33 +
lib/yamlcpp/include/yaml-cpp/emitfromevents.h | 57 +
lib/yamlcpp/include/yaml-cpp/emitter.h | 254 +
lib/yamlcpp/include/yaml-cpp/emitterdef.h | 16 +
lib/yamlcpp/include/yaml-cpp/emittermanip.h | 137 +
lib/yamlcpp/include/yaml-cpp/emitterstyle.h | 16 +
lib/yamlcpp/include/yaml-cpp/eventhandler.h | 40 +
lib/yamlcpp/include/yaml-cpp/exceptions.h | 267 +
lib/yamlcpp/include/yaml-cpp/mark.h | 29 +
lib/yamlcpp/include/yaml-cpp/node/convert.h | 331 +
.../include/yaml-cpp/node/detail/bool_type.h | 26 +
lib/yamlcpp/include/yaml-cpp/node/detail/impl.h | 185 +
.../include/yaml-cpp/node/detail/iterator.h | 92 +
.../include/yaml-cpp/node/detail/iterator_fwd.h | 27 +
lib/yamlcpp/include/yaml-cpp/node/detail/memory.h | 46 +
lib/yamlcpp/include/yaml-cpp/node/detail/node.h | 169 +
.../include/yaml-cpp/node/detail/node_data.h | 127 +
.../include/yaml-cpp/node/detail/node_iterator.h | 180 +
.../include/yaml-cpp/node/detail/node_ref.h | 98 +
lib/yamlcpp/include/yaml-cpp/node/emit.h | 32 +
lib/yamlcpp/include/yaml-cpp/node/impl.h | 448 +
lib/yamlcpp/include/yaml-cpp/node/iterator.h | 31 +
lib/yamlcpp/include/yaml-cpp/node/node.h | 145 +
lib/yamlcpp/include/yaml-cpp/node/parse.h | 78 +
lib/yamlcpp/include/yaml-cpp/node/ptr.h | 29 +
lib/yamlcpp/include/yaml-cpp/node/type.h | 16 +
lib/yamlcpp/include/yaml-cpp/noncopyable.h | 25 +
lib/yamlcpp/include/yaml-cpp/null.h | 26 +
lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h | 72 +
lib/yamlcpp/include/yaml-cpp/parser.h | 86 +
lib/yamlcpp/include/yaml-cpp/stlemitter.h | 51 +
lib/yamlcpp/include/yaml-cpp/traits.h | 103 +
lib/yamlcpp/include/yaml-cpp/yaml.h | 24 +
lib/yamlcpp/install.txt | 24 +
lib/yamlcpp/src/binary.cpp | 93 +
lib/yamlcpp/src/collectionstack.h | 39 +
lib/yamlcpp/src/contrib/graphbuilder.cpp | 17 +
lib/yamlcpp/src/contrib/graphbuilderadapter.cpp | 94 +
lib/yamlcpp/src/contrib/graphbuilderadapter.h | 79 +
lib/yamlcpp/src/convert.cpp | 75 +
lib/yamlcpp/src/directives.cpp | 22 +
lib/yamlcpp/src/directives.h | 29 +
lib/yamlcpp/src/emit.cpp | 25 +
lib/yamlcpp/src/emitfromevents.cpp | 119 +
lib/yamlcpp/src/emitter.cpp | 911 ++
lib/yamlcpp/src/emitterstate.cpp | 365 +
lib/yamlcpp/src/emitterstate.h | 203 +
lib/yamlcpp/src/emitterutils.cpp | 483 +
lib/yamlcpp/src/emitterutils.h | 50 +
lib/yamlcpp/src/exceptions.cpp | 31 +
lib/yamlcpp/src/exp.cpp | 136 +
lib/yamlcpp/src/exp.h | 222 +
lib/yamlcpp/src/indentation.h | 41 +
lib/yamlcpp/src/memory.cpp | 26 +
lib/yamlcpp/src/node.cpp | 12 +
lib/yamlcpp/src/node_data.cpp | 300 +
lib/yamlcpp/src/nodebuilder.cpp | 130 +
lib/yamlcpp/src/nodebuilder.h | 70 +
lib/yamlcpp/src/nodeevents.cpp | 101 +
lib/yamlcpp/src/nodeevents.h | 64 +
lib/yamlcpp/src/null.cpp | 10 +
lib/yamlcpp/src/ostream_wrapper.cpp | 57 +
lib/yamlcpp/src/parse.cpp | 72 +
lib/yamlcpp/src/parser.cpp | 129 +
lib/yamlcpp/src/ptr_vector.h | 43 +
lib/yamlcpp/src/regex_yaml.cpp | 45 +
lib/yamlcpp/src/regex_yaml.h | 87 +
lib/yamlcpp/src/regeximpl.h | 186 +
lib/yamlcpp/src/scanner.cpp | 386 +
lib/yamlcpp/src/scanner.h | 190 +
lib/yamlcpp/src/scanscalar.cpp | 250 +
lib/yamlcpp/src/scanscalar.h | 63 +
lib/yamlcpp/src/scantag.cpp | 81 +
lib/yamlcpp/src/scantag.h | 19 +
lib/yamlcpp/src/scantoken.cpp | 437 +
lib/yamlcpp/src/setting.h | 95 +
lib/yamlcpp/src/simplekey.cpp | 128 +
lib/yamlcpp/src/singledocparser.cpp | 414 +
lib/yamlcpp/src/singledocparser.h | 65 +
lib/yamlcpp/src/stream.cpp | 448 +
lib/yamlcpp/src/stream.h | 76 +
lib/yamlcpp/src/streamcharsource.h | 48 +
lib/yamlcpp/src/stringsource.h | 48 +
lib/yamlcpp/src/tag.cpp | 49 +
lib/yamlcpp/src/tag.h | 33 +
lib/yamlcpp/src/token.h | 69 +
lib/yamlcpp/test/CMakeLists.txt | 44 +
lib/yamlcpp/test/create-emitter-tests.py | 211 +
lib/yamlcpp/test/handler_test.h | 32 +
lib/yamlcpp/test/integration/emitter_test.cpp | 1038 +++
lib/yamlcpp/test/integration/encoding_test.cpp | 182 +
lib/yamlcpp/test/integration/gen_emitter_test.cpp | 9759 ++++++++++++++++++++
lib/yamlcpp/test/integration/handler_spec_test.cpp | 1611 ++++
lib/yamlcpp/test/integration/handler_test.cpp | 76 +
lib/yamlcpp/test/integration/load_node_test.cpp | 241 +
lib/yamlcpp/test/integration/node_spec_test.cpp | 1131 +++
lib/yamlcpp/test/main.cpp | 6 +
lib/yamlcpp/test/mock_event_handler.h | 26 +
lib/yamlcpp/test/node/node_test.cpp | 517 ++
lib/yamlcpp/test/ostream_wrapper_test.cpp | 66 +
lib/yamlcpp/test/regex_test.cpp | 177 +
lib/yamlcpp/test/specexamples.h | 846 ++
lib/yamlcpp/util/CMakeLists.txt | 14 +
lib/yamlcpp/util/api.cpp | 137 +
lib/yamlcpp/util/parse.cpp | 61 +
lib/yamlcpp/util/read.cpp | 103 +
lib/yamlcpp/util/sandbox.cpp | 36 +
lib/yamlcpp/yaml-cpp-config-version.cmake.in | 11 +
lib/yamlcpp/yaml-cpp-config.cmake.in | 14 +
lib/yamlcpp/yaml-cpp.pc.cmake | 11 +
plugins/Makefile.am | 2 +
proxy/Makefile.am | 5 -
proxy/config/logging.config.default | 234 +-
proxy/logging/LogBindings.cc | 509 -
proxy/logging/LogBindings.h | 30 -
proxy/logging/LogConfig.cc | 33 +-
proxy/logging/LogConfig.h | 4 +
proxy/logging/LogField.cc | 4 +-
proxy/logging/LogField.h | 2 +-
proxy/logging/LogFilter.cc | 2 +-
proxy/logging/LogFilter.h | 2 +-
proxy/logging/Makefile.am | 12 +-
proxy/logging/YamlLogConfig.cc | 247 +
proxy/logging/YamlLogConfig.h | 46 +
proxy/logging/YamlLogConfigDecoders.cc | 118 +
proxy/logging/YamlLogConfigDecoders.h | 41 +
src/traffic_logcat/Makefile.inc | 16 +-
src/traffic_logstats/Makefile.inc | 13 +-
src/traffic_manager/Makefile.inc | 27 +-
src/traffic_server/Makefile.inc | 17 +-
src/traffic_wccp/Makefile.inc | 1 -
tests/gold_tests/h2/httpbin.test.py | 15 +-
tests/gold_tests/logging/ccid_ctid.test.py | 16 +-
tests/gold_tests/logging/custom-log.test.py | 16 +-
tests/gold_tests/logging/log-field.test.py | 13 +-
376 files changed, 28995 insertions(+), 116705 deletions(-)
create mode 100644 build/yaml-cpp.m4
delete mode 100644 iocore/net/LuaSNIConfig.cc
delete mode 100644 iocore/net/LuaSNIConfig.h
create mode 100644 iocore/net/YamlSNIConfig.cc
create mode 100644 iocore/net/YamlSNIConfig.h
delete mode 100644 lib/bindings/Makefile.am
delete mode 100644 lib/bindings/bindings.cc
delete mode 100644 lib/bindings/bindings.h
delete mode 100644 lib/bindings/lua.cc
delete mode 100644 lib/bindings/lua.h
delete mode 100644 lib/bindings/repl.cc
delete mode 100644 lib/bindings/repl.h
delete mode 100644 lib/luajit/.gitignore
delete mode 100644 lib/luajit/COPYRIGHT
delete mode 100644 lib/luajit/Makefile
delete mode 100644 lib/luajit/README
delete mode 100644 lib/luajit/doc/bluequad-print.css
delete mode 100644 lib/luajit/doc/bluequad.css
delete mode 100644 lib/luajit/doc/changes.html
delete mode 100644 lib/luajit/doc/contact.html
delete mode 100644 lib/luajit/doc/ext_c_api.html
delete mode 100644 lib/luajit/doc/ext_ffi.html
delete mode 100644 lib/luajit/doc/ext_ffi_api.html
delete mode 100644 lib/luajit/doc/ext_ffi_semantics.html
delete mode 100644 lib/luajit/doc/ext_ffi_tutorial.html
delete mode 100644 lib/luajit/doc/ext_jit.html
delete mode 100644 lib/luajit/doc/extensions.html
delete mode 100644 lib/luajit/doc/faq.html
delete mode 100644 lib/luajit/doc/img/contact.png
delete mode 100644 lib/luajit/doc/install.html
delete mode 100644 lib/luajit/doc/luajit.html
delete mode 100644 lib/luajit/doc/running.html
delete mode 100644 lib/luajit/doc/status.html
delete mode 100644 lib/luajit/dynasm/dasm_arm.h
delete mode 100644 lib/luajit/dynasm/dasm_arm.lua
delete mode 100644 lib/luajit/dynasm/dasm_mips.h
delete mode 100644 lib/luajit/dynasm/dasm_mips.lua
delete mode 100644 lib/luajit/dynasm/dasm_ppc.h
delete mode 100644 lib/luajit/dynasm/dasm_ppc.lua
delete mode 100644 lib/luajit/dynasm/dasm_proto.h
delete mode 100644 lib/luajit/dynasm/dasm_x64.lua
delete mode 100644 lib/luajit/dynasm/dasm_x86.h
delete mode 100644 lib/luajit/dynasm/dasm_x86.lua
delete mode 100644 lib/luajit/dynasm/dynasm.lua
delete mode 100644 lib/luajit/etc/luajit.1
delete mode 100644 lib/luajit/etc/luajit.pc
delete mode 100644 lib/luajit/src/.gitignore
delete mode 100644 lib/luajit/src/Makefile
delete mode 100644 lib/luajit/src/Makefile.dep
delete mode 100644 lib/luajit/src/host/.gitignore
delete mode 100644 lib/luajit/src/host/README
delete mode 100644 lib/luajit/src/host/buildvm.c
delete mode 100644 lib/luajit/src/host/buildvm.h
delete mode 100644 lib/luajit/src/host/buildvm_asm.c
delete mode 100644 lib/luajit/src/host/buildvm_fold.c
delete mode 100644 lib/luajit/src/host/buildvm_lib.c
delete mode 100644 lib/luajit/src/host/buildvm_peobj.c
delete mode 100644 lib/luajit/src/host/genminilua.lua
delete mode 100644 lib/luajit/src/host/minilua.c
delete mode 100644 lib/luajit/src/jit/.gitignore
delete mode 100644 lib/luajit/src/jit/bc.lua
delete mode 100644 lib/luajit/src/jit/bcsave.lua
delete mode 100644 lib/luajit/src/jit/dis_arm.lua
delete mode 100644 lib/luajit/src/jit/dis_mips.lua
delete mode 100644 lib/luajit/src/jit/dis_mipsel.lua
delete mode 100644 lib/luajit/src/jit/dis_ppc.lua
delete mode 100644 lib/luajit/src/jit/dis_x64.lua
delete mode 100644 lib/luajit/src/jit/dis_x86.lua
delete mode 100644 lib/luajit/src/jit/dump.lua
delete mode 100644 lib/luajit/src/jit/v.lua
delete mode 100644 lib/luajit/src/lauxlib.h
delete mode 100644 lib/luajit/src/lib_aux.c
delete mode 100644 lib/luajit/src/lib_base.c
delete mode 100644 lib/luajit/src/lib_bit.c
delete mode 100644 lib/luajit/src/lib_debug.c
delete mode 100644 lib/luajit/src/lib_ffi.c
delete mode 100644 lib/luajit/src/lib_init.c
delete mode 100644 lib/luajit/src/lib_io.c
delete mode 100644 lib/luajit/src/lib_jit.c
delete mode 100644 lib/luajit/src/lib_math.c
delete mode 100644 lib/luajit/src/lib_os.c
delete mode 100644 lib/luajit/src/lib_package.c
delete mode 100644 lib/luajit/src/lib_string.c
delete mode 100644 lib/luajit/src/lib_table.c
delete mode 100644 lib/luajit/src/lj.supp
delete mode 100644 lib/luajit/src/lj_alloc.c
delete mode 100644 lib/luajit/src/lj_alloc.h
delete mode 100644 lib/luajit/src/lj_api.c
delete mode 100644 lib/luajit/src/lj_arch.h
delete mode 100644 lib/luajit/src/lj_asm.c
delete mode 100644 lib/luajit/src/lj_asm.h
delete mode 100644 lib/luajit/src/lj_asm_arm.h
delete mode 100644 lib/luajit/src/lj_asm_mips.h
delete mode 100644 lib/luajit/src/lj_asm_ppc.h
delete mode 100644 lib/luajit/src/lj_asm_x86.h
delete mode 100644 lib/luajit/src/lj_bc.c
delete mode 100644 lib/luajit/src/lj_bc.h
delete mode 100644 lib/luajit/src/lj_bcdump.h
delete mode 100644 lib/luajit/src/lj_bcread.c
delete mode 100644 lib/luajit/src/lj_bcwrite.c
delete mode 100644 lib/luajit/src/lj_carith.c
delete mode 100644 lib/luajit/src/lj_carith.h
delete mode 100644 lib/luajit/src/lj_ccall.c
delete mode 100644 lib/luajit/src/lj_ccall.h
delete mode 100644 lib/luajit/src/lj_ccallback.c
delete mode 100644 lib/luajit/src/lj_ccallback.h
delete mode 100644 lib/luajit/src/lj_cconv.c
delete mode 100644 lib/luajit/src/lj_cconv.h
delete mode 100644 lib/luajit/src/lj_cdata.c
delete mode 100644 lib/luajit/src/lj_cdata.h
delete mode 100644 lib/luajit/src/lj_char.c
delete mode 100644 lib/luajit/src/lj_char.h
delete mode 100644 lib/luajit/src/lj_clib.c
delete mode 100644 lib/luajit/src/lj_clib.h
delete mode 100644 lib/luajit/src/lj_cparse.c
delete mode 100644 lib/luajit/src/lj_cparse.h
delete mode 100644 lib/luajit/src/lj_crecord.c
delete mode 100644 lib/luajit/src/lj_crecord.h
delete mode 100644 lib/luajit/src/lj_ctype.c
delete mode 100644 lib/luajit/src/lj_ctype.h
delete mode 100644 lib/luajit/src/lj_debug.c
delete mode 100644 lib/luajit/src/lj_debug.h
delete mode 100644 lib/luajit/src/lj_def.h
delete mode 100644 lib/luajit/src/lj_dispatch.c
delete mode 100644 lib/luajit/src/lj_dispatch.h
delete mode 100644 lib/luajit/src/lj_emit_arm.h
delete mode 100644 lib/luajit/src/lj_emit_mips.h
delete mode 100644 lib/luajit/src/lj_emit_ppc.h
delete mode 100644 lib/luajit/src/lj_emit_x86.h
delete mode 100644 lib/luajit/src/lj_err.c
delete mode 100644 lib/luajit/src/lj_err.h
delete mode 100644 lib/luajit/src/lj_errmsg.h
delete mode 100644 lib/luajit/src/lj_ff.h
delete mode 100644 lib/luajit/src/lj_ffrecord.c
delete mode 100644 lib/luajit/src/lj_ffrecord.h
delete mode 100644 lib/luajit/src/lj_frame.h
delete mode 100644 lib/luajit/src/lj_func.c
delete mode 100644 lib/luajit/src/lj_func.h
delete mode 100644 lib/luajit/src/lj_gc.c
delete mode 100644 lib/luajit/src/lj_gc.h
delete mode 100644 lib/luajit/src/lj_gdbjit.c
delete mode 100644 lib/luajit/src/lj_gdbjit.h
delete mode 100644 lib/luajit/src/lj_ir.c
delete mode 100644 lib/luajit/src/lj_ir.h
delete mode 100644 lib/luajit/src/lj_ircall.h
delete mode 100644 lib/luajit/src/lj_iropt.h
delete mode 100644 lib/luajit/src/lj_jit.h
delete mode 100644 lib/luajit/src/lj_lex.c
delete mode 100644 lib/luajit/src/lj_lex.h
delete mode 100644 lib/luajit/src/lj_lib.c
delete mode 100644 lib/luajit/src/lj_lib.h
delete mode 100644 lib/luajit/src/lj_load.c
delete mode 100644 lib/luajit/src/lj_mcode.c
delete mode 100644 lib/luajit/src/lj_mcode.h
delete mode 100644 lib/luajit/src/lj_meta.c
delete mode 100644 lib/luajit/src/lj_meta.h
delete mode 100644 lib/luajit/src/lj_obj.c
delete mode 100644 lib/luajit/src/lj_obj.h
delete mode 100644 lib/luajit/src/lj_opt_dce.c
delete mode 100644 lib/luajit/src/lj_opt_fold.c
delete mode 100644 lib/luajit/src/lj_opt_loop.c
delete mode 100644 lib/luajit/src/lj_opt_mem.c
delete mode 100644 lib/luajit/src/lj_opt_narrow.c
delete mode 100644 lib/luajit/src/lj_opt_sink.c
delete mode 100644 lib/luajit/src/lj_opt_split.c
delete mode 100644 lib/luajit/src/lj_parse.c
delete mode 100644 lib/luajit/src/lj_parse.h
delete mode 100644 lib/luajit/src/lj_record.c
delete mode 100644 lib/luajit/src/lj_record.h
delete mode 100644 lib/luajit/src/lj_snap.c
delete mode 100644 lib/luajit/src/lj_snap.h
delete mode 100644 lib/luajit/src/lj_state.c
delete mode 100644 lib/luajit/src/lj_state.h
delete mode 100644 lib/luajit/src/lj_str.c
delete mode 100644 lib/luajit/src/lj_str.h
delete mode 100644 lib/luajit/src/lj_strscan.c
delete mode 100644 lib/luajit/src/lj_strscan.h
delete mode 100644 lib/luajit/src/lj_tab.c
delete mode 100644 lib/luajit/src/lj_tab.h
delete mode 100644 lib/luajit/src/lj_target.h
delete mode 100644 lib/luajit/src/lj_target_arm.h
delete mode 100644 lib/luajit/src/lj_target_mips.h
delete mode 100644 lib/luajit/src/lj_target_ppc.h
delete mode 100644 lib/luajit/src/lj_target_x86.h
delete mode 100644 lib/luajit/src/lj_trace.c
delete mode 100644 lib/luajit/src/lj_trace.h
delete mode 100644 lib/luajit/src/lj_traceerr.h
delete mode 100644 lib/luajit/src/lj_udata.c
delete mode 100644 lib/luajit/src/lj_udata.h
delete mode 100644 lib/luajit/src/lj_vm.h
delete mode 100644 lib/luajit/src/lj_vmevent.c
delete mode 100644 lib/luajit/src/lj_vmevent.h
delete mode 100644 lib/luajit/src/lj_vmmath.c
delete mode 100644 lib/luajit/src/ljamalg.c
delete mode 100644 lib/luajit/src/lua.h
delete mode 100644 lib/luajit/src/lua.hpp
delete mode 100644 lib/luajit/src/luaconf.h
delete mode 100644 lib/luajit/src/luajit.c
delete mode 100644 lib/luajit/src/luajit.h
delete mode 100644 lib/luajit/src/lualib.h
delete mode 100644 lib/luajit/src/msvcbuild.bat
delete mode 100644 lib/luajit/src/ps4build.bat
delete mode 100644 lib/luajit/src/psvitabuild.bat
delete mode 100644 lib/luajit/src/vm_arm.dasc
delete mode 100644 lib/luajit/src/vm_mips.dasc
delete mode 100644 lib/luajit/src/vm_ppc.dasc
delete mode 100644 lib/luajit/src/vm_ppcspe.dasc
delete mode 100644 lib/luajit/src/vm_x86.dasc
delete mode 100644 lib/luajit/src/xedkbuild.bat
create mode 100644 lib/ts/EnumDescriptor.h
delete mode 100644 lib/tsconfig/TsConfigLua.cc
delete mode 100644 lib/tsconfig/TsConfigLua.h
create mode 100644 lib/yamlcpp/.clang-format
create mode 100644 lib/yamlcpp/.codedocs
create mode 100644 lib/yamlcpp/.gitignore
create mode 100644 lib/yamlcpp/.travis.yml
create mode 100644 lib/yamlcpp/CMakeLists.txt
create mode 100644 lib/yamlcpp/CONTRIBUTING.md
create mode 100644 lib/yamlcpp/LICENSE
create mode 100644 lib/yamlcpp/Makefile.am
create mode 100644 lib/yamlcpp/README.md
create mode 100644 lib/yamlcpp/include/yaml-cpp/anchor.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/binary.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/dll.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/emitfromevents.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/emitter.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/emitterdef.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/emittermanip.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/emitterstyle.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/eventhandler.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/exceptions.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/mark.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/convert.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/impl.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/memory.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/node.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/emit.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/impl.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/iterator.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/node.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/parse.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/ptr.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/node/type.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/noncopyable.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/null.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/parser.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/stlemitter.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/traits.h
create mode 100644 lib/yamlcpp/include/yaml-cpp/yaml.h
create mode 100644 lib/yamlcpp/install.txt
create mode 100644 lib/yamlcpp/src/binary.cpp
create mode 100644 lib/yamlcpp/src/collectionstack.h
create mode 100644 lib/yamlcpp/src/contrib/graphbuilder.cpp
create mode 100644 lib/yamlcpp/src/contrib/graphbuilderadapter.cpp
create mode 100644 lib/yamlcpp/src/contrib/graphbuilderadapter.h
create mode 100644 lib/yamlcpp/src/convert.cpp
create mode 100644 lib/yamlcpp/src/directives.cpp
create mode 100644 lib/yamlcpp/src/directives.h
create mode 100644 lib/yamlcpp/src/emit.cpp
create mode 100644 lib/yamlcpp/src/emitfromevents.cpp
create mode 100644 lib/yamlcpp/src/emitter.cpp
create mode 100644 lib/yamlcpp/src/emitterstate.cpp
create mode 100644 lib/yamlcpp/src/emitterstate.h
create mode 100644 lib/yamlcpp/src/emitterutils.cpp
create mode 100644 lib/yamlcpp/src/emitterutils.h
create mode 100644 lib/yamlcpp/src/exceptions.cpp
create mode 100644 lib/yamlcpp/src/exp.cpp
create mode 100644 lib/yamlcpp/src/exp.h
create mode 100644 lib/yamlcpp/src/indentation.h
create mode 100644 lib/yamlcpp/src/memory.cpp
create mode 100644 lib/yamlcpp/src/node.cpp
create mode 100644 lib/yamlcpp/src/node_data.cpp
create mode 100644 lib/yamlcpp/src/nodebuilder.cpp
create mode 100644 lib/yamlcpp/src/nodebuilder.h
create mode 100644 lib/yamlcpp/src/nodeevents.cpp
create mode 100644 lib/yamlcpp/src/nodeevents.h
create mode 100644 lib/yamlcpp/src/null.cpp
create mode 100644 lib/yamlcpp/src/ostream_wrapper.cpp
create mode 100644 lib/yamlcpp/src/parse.cpp
create mode 100644 lib/yamlcpp/src/parser.cpp
create mode 100644 lib/yamlcpp/src/ptr_vector.h
create mode 100644 lib/yamlcpp/src/regex_yaml.cpp
create mode 100644 lib/yamlcpp/src/regex_yaml.h
create mode 100644 lib/yamlcpp/src/regeximpl.h
create mode 100644 lib/yamlcpp/src/scanner.cpp
create mode 100644 lib/yamlcpp/src/scanner.h
create mode 100644 lib/yamlcpp/src/scanscalar.cpp
create mode 100644 lib/yamlcpp/src/scanscalar.h
create mode 100644 lib/yamlcpp/src/scantag.cpp
create mode 100644 lib/yamlcpp/src/scantag.h
create mode 100644 lib/yamlcpp/src/scantoken.cpp
create mode 100644 lib/yamlcpp/src/setting.h
create mode 100644 lib/yamlcpp/src/simplekey.cpp
create mode 100644 lib/yamlcpp/src/singledocparser.cpp
create mode 100644 lib/yamlcpp/src/singledocparser.h
create mode 100644 lib/yamlcpp/src/stream.cpp
create mode 100644 lib/yamlcpp/src/stream.h
create mode 100644 lib/yamlcpp/src/streamcharsource.h
create mode 100644 lib/yamlcpp/src/stringsource.h
create mode 100644 lib/yamlcpp/src/tag.cpp
create mode 100644 lib/yamlcpp/src/tag.h
create mode 100644 lib/yamlcpp/src/token.h
create mode 100644 lib/yamlcpp/test/CMakeLists.txt
create mode 100644 lib/yamlcpp/test/create-emitter-tests.py
create mode 100644 lib/yamlcpp/test/handler_test.h
create mode 100644 lib/yamlcpp/test/integration/emitter_test.cpp
create mode 100644 lib/yamlcpp/test/integration/encoding_test.cpp
create mode 100644 lib/yamlcpp/test/integration/gen_emitter_test.cpp
create mode 100644 lib/yamlcpp/test/integration/handler_spec_test.cpp
create mode 100644 lib/yamlcpp/test/integration/handler_test.cpp
create mode 100644 lib/yamlcpp/test/integration/load_node_test.cpp
create mode 100644 lib/yamlcpp/test/integration/node_spec_test.cpp
create mode 100644 lib/yamlcpp/test/main.cpp
create mode 100644 lib/yamlcpp/test/mock_event_handler.h
create mode 100644 lib/yamlcpp/test/node/node_test.cpp
create mode 100644 lib/yamlcpp/test/ostream_wrapper_test.cpp
create mode 100644 lib/yamlcpp/test/regex_test.cpp
create mode 100644 lib/yamlcpp/test/specexamples.h
create mode 100644 lib/yamlcpp/util/CMakeLists.txt
create mode 100644 lib/yamlcpp/util/api.cpp
create mode 100644 lib/yamlcpp/util/parse.cpp
create mode 100644 lib/yamlcpp/util/read.cpp
create mode 100644 lib/yamlcpp/util/sandbox.cpp
create mode 100644 lib/yamlcpp/yaml-cpp-config-version.cmake.in
create mode 100644 lib/yamlcpp/yaml-cpp-config.cmake.in
create mode 100644 lib/yamlcpp/yaml-cpp.pc.cmake
delete mode 100644 proxy/logging/LogBindings.cc
delete mode 100644 proxy/logging/LogBindings.h
create mode 100644 proxy/logging/YamlLogConfig.cc
create mode 100644 proxy/logging/YamlLogConfig.h
create mode 100644 proxy/logging/YamlLogConfigDecoders.cc
create mode 100644 proxy/logging/YamlLogConfigDecoders.h
--
To stop receiving notification emails like this one, please contact
bcall@apache.org.
[trafficserver] 02/04: Converts logging.config and
ssl_server_name.config to YAML-based files
Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 6b45069404e6740c023155d45f775e05e661069e
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Mon May 7 13:26:06 2018 +0100
Converts logging.config and ssl_server_name.config to YAML-based files
(cherry picked from commit aa908d1ee7afc89c8a0f34ebd5932f6238b8cfb1)
---
CMakeLists.txt | 5 +-
iocore/net/LuaSNIConfig.cc | 127 --------------
iocore/net/LuaSNIConfig.h | 114 -------------
iocore/net/Makefile.am | 10 +-
iocore/net/P_SSLSNI.h | 4 +-
iocore/net/SSLSNIConfig.cc | 23 ++-
iocore/net/YamlSNIConfig.cc | 107 ++++++++++++
iocore/net/YamlSNIConfig.h | 62 +++++++
lib/Makefile.am | 10 +-
lib/ts/EnumDescriptor.h | 61 +++++++
proxy/config/logging.config.default | 234 ++++++++++----------------
proxy/logging/LogConfig.cc | 32 +++-
proxy/logging/LogConfig.h | 4 +
proxy/logging/LogField.cc | 4 +-
proxy/logging/LogField.h | 2 +-
proxy/logging/LogFilter.cc | 2 +-
proxy/logging/LogFilter.h | 2 +-
proxy/logging/Makefile.am | 5 +-
proxy/logging/YamlLogConfig.cc | 247 ++++++++++++++++++++++++++++
proxy/logging/YamlLogConfig.h | 46 ++++++
proxy/logging/YamlLogConfigDecoders.cc | 118 +++++++++++++
proxy/logging/YamlLogConfigDecoders.h | 41 +++++
src/traffic_logcat/Makefile.inc | 3 +-
src/traffic_logstats/Makefile.inc | 1 +
src/traffic_server/Makefile.inc | 1 +
tests/gold_tests/h2/httpbin.test.py | 15 +-
tests/gold_tests/logging/ccid_ctid.test.py | 16 +-
tests/gold_tests/logging/custom-log.test.py | 16 +-
tests/gold_tests/logging/log-field.test.py | 13 +-
29 files changed, 866 insertions(+), 459 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f03d8a..c92624a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@ include_directories(lib
lib/records
lib/wccp
lib/cppapi/include
+ lib/yamlcpp/include
iocore/eventsystem
iocore/net
iocore/dns
@@ -276,8 +277,8 @@ add_executable(ats
iocore/net/I_UDPNet.h
iocore/net/I_UDPPacket.h
iocore/net/Inline.cc
- iocore/net/LuaSNIConfig.cc
- iocore/net/LuaSNIConfig.h
+ iocore/net/YamlSNIConfig.cc
+ iocore/net/YamlSNIConfig.h
iocore/net/Net.cc
iocore/net/NetVConnection.cc
iocore/net/NetVCTest.cc
diff --git a/iocore/net/LuaSNIConfig.cc b/iocore/net/LuaSNIConfig.cc
deleted file mode 100644
index 6a13157..0000000
--- a/iocore/net/LuaSNIConfig.cc
+++ /dev/null
@@ -1,127 +0,0 @@
-/** @file
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#include "LuaSNIConfig.h"
-#include <cstring>
-#include "ts/Diags.h"
-#include "P_SNIActionPerformer.h"
-#include "tsconfig/Errata.h"
-#include "tsconfig/TsConfigLua.h"
-
-TsConfigDescriptor LuaSNIConfig::desc = {TsConfigDescriptor::Type::ARRAY, "Array", "Item vector", "Vector"};
-TsConfigArrayDescriptor LuaSNIConfig::DESCRIPTOR(LuaSNIConfig::desc);
-TsConfigDescriptor LuaSNIConfig::Item::FQDN_DESCRIPTOR = {TsConfigDescriptor::Type::STRING, "String", TS_fqdn,
- "Fully Qualified Domain Name"};
-TsConfigDescriptor LuaSNIConfig::Item::DISABLE_h2_DESCRIPTOR = {TsConfigDescriptor::Type::BOOL, "Boolean", TS_disable_H2,
- "Disable H2"};
-TsConfigEnumDescriptor LuaSNIConfig::Item::LEVEL_DESCRIPTOR = {TsConfigDescriptor::Type::ENUM,
- "enum",
- "Level",
- "Level for client verification",
- {{"NONE", 0}, {"MODERATE", 1}, {"STRICT", 2}}};
-TsConfigDescriptor LuaSNIConfig::Item::TUNNEL_DEST_DESCRIPTOR = {TsConfigDescriptor::Type::STRING, "String", TS_tunnel_route,
- "tunnel route destination"};
-TsConfigDescriptor LuaSNIConfig::Item::CLIENT_CERT_DESCRIPTOR = {TsConfigDescriptor::Type::STRING, "String", TS_client_cert,
- "Client certificate to present to the next hop server"};
-TsConfigDescriptor LuaSNIConfig::Item::VERIFY_NEXT_SERVER_DESCRIPTOR = {TsConfigDescriptor::Type::INT, "Int",
- TS_verify_origin_server, "Next hop verification level"};
-
-ts::Errata
-LuaSNIConfig::loader(lua_State *L)
-{
- ts::Errata zret;
- // char buff[256];
- // int error;
-
- lua_getfield(L, LUA_GLOBALSINDEX, "server_config");
- int l_type = lua_type(L, -1);
-
- switch (l_type) {
- case LUA_TTABLE: // this has to be a multidimensional table
- lua_pushnil(L);
- while (lua_next(L, -2) != 0) {
- l_type = lua_type(L, -1);
- if (l_type == LUA_TTABLE) { // the item should be table
- // new Item
- LuaSNIConfig::Item item;
- item.loader(L);
- items.push_back(item);
- } else {
- zret.push(ts::Errata::Message(0, 0, "Invalid Entry at SNI config"));
- }
- lua_pop(L, 1);
- }
- break;
- case LUA_TSTRING:
- Debug("ssl", "string value %s", lua_tostring(L, -1));
- break;
- default:
- zret.push(ts::Errata::Message(0, 0, "Invalid Lua SNI Config"));
- Debug("ssl", "Please check your SNI config");
- break;
- }
-
- return zret;
-}
-
-ts::Errata
-LuaSNIConfig::Item::loader(lua_State *L)
-{
- ts::Errata zret;
- //-1 will contain the subarray now (since it is a value in the main table))
- lua_pushnil(L);
- while (lua_next(L, -2)) {
- if (lua_type(L, -2) != LUA_TSTRING) {
- Debug("ssl", "string keys expected for entries in %s", SSL_SERVER_NAME_CONFIG);
- }
- const char *name = lua_tostring(L, -2);
- if (!strncmp(name, TS_fqdn, strlen(TS_fqdn))) {
- FQDN_CONFIG.loader(L);
- } else if (!strncmp(name, TS_disable_H2, strlen(TS_disable_H2))) {
- DISABLEH2_CONFIG.loader(L);
- } else if (!strncmp(name, TS_verify_client, strlen(TS_verify_client))) {
- VERIFYCLIENT_CONFIG.loader(L);
- } else if (!strncmp(name, TS_verify_origin_server, strlen(TS_verify_origin_server))) {
- VERIFY_NEXT_SERVER_CONFIG.loader(L);
- } else if (!strncmp(name, TS_client_cert, strlen(TS_client_cert))) {
- CLIENT_CERT_CONFIG.loader(L);
- } else if (!strncmp(name, TS_tunnel_route, strlen(TS_tunnel_route))) {
- TUNNEL_DEST_CONFIG.loader(L);
- } else {
- zret.push(ts::Errata::Message(0, 0, "Invalid Entry at SNI config"));
- }
- lua_pop(L, 1);
- }
- return zret;
-}
-
-ts::Errata
-LuaSNIConfig::registerEnum(lua_State *L)
-{
- ts::Errata zret;
- lua_newtable(L);
- lua_setglobal(L, "LevelTable");
- int i = start;
- LUA_ENUM(L, "NONE", i++);
- LUA_ENUM(L, "MODERATE", i++);
- LUA_ENUM(L, "STRICT", i++);
- return zret;
-}
diff --git a/iocore/net/LuaSNIConfig.h b/iocore/net/LuaSNIConfig.h
deleted file mode 100644
index f301a6d..0000000
--- a/iocore/net/LuaSNIConfig.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-/*
- * File: LuaSNIConfig.h
- * Author: persia
- *
- * Created on September 21, 2017, 4:25 PM
- */
-
-#ifndef LUASNICONFIG_H
-#define LUASNICONFIG_H
-
-#include "tsconfig/TsConfigLua.h"
-
-#include <vector>
-
-using ts::Errata;
-#define LUA_ENUM(L, name, val) \
- lua_pushlstring(L, #name, sizeof(#name) - 1); \
- lua_pushnumber(L, val); \
- lua_settable(L, -3);
-
-constexpr char TS_fqdn[] = "fqdn";
-constexpr char TS_disable_H2[] = "disable_h2";
-constexpr char TS_verify_client[] = "verify_client";
-constexpr char TS_tunnel_route[] = "tunnel_route";
-constexpr char TS_verify_origin_server[] = "verify_origin_server";
-constexpr char TS_client_cert[] = "client_cert";
-
-const int start = 0;
-struct LuaSNIConfig : public TsConfigBase {
- using self = LuaSNIConfig;
- enum class Action {
- disable_h2 = start,
- verify_client,
- tunnel_route, // blind tunnel action
- verify_origin_server, // this applies to server side vc only
- client_cert
-
- };
- enum class Level { NONE = 0, MODERATE, STRICT };
- static TsConfigDescriptor desc;
- static TsConfigArrayDescriptor DESCRIPTOR;
-
- LuaSNIConfig() : TsConfigBase(this->DESCRIPTOR) { self::Item::Initialize(); }
-
- struct Item : public TsConfigBase {
- Item()
- : TsConfigBase(DESCRIPTOR),
- FQDN_CONFIG(FQDN_DESCRIPTOR, fqdn),
- DISABLEH2_CONFIG(DISABLE_h2_DESCRIPTOR, disable_h2),
- VERIFYCLIENT_CONFIG(LEVEL_DESCRIPTOR, (int &)verify_client_level),
- TUNNEL_DEST_CONFIG(TUNNEL_DEST_DESCRIPTOR, tunnel_destination),
- CLIENT_CERT_CONFIG(CLIENT_CERT_DESCRIPTOR, client_cert),
- VERIFY_NEXT_SERVER_CONFIG(VERIFY_NEXT_SERVER_DESCRIPTOR, (int &)verify_origin_server)
- {
- }
- ts::Errata loader(lua_State *s) override;
- static void
- Initialize()
- {
- // ACTION_DESCRIPTOR.values = {
- // {TS_disable_H2, 0}, {TS_verify_client, 1}, {TS_tunnel_route, 2}, {TS_verify_origin_server, 3}, {TS_client_cert, 4}};
- //
- // ACTION_DESCRIPTOR.keys = {
- // {0, TS_disable_H2}, {1, TS_verify_client}, {2, TS_tunnel_route}, {3, TS_verify_origin_server}, {4, TS_client_cert}};
- }
-
- std::string fqdn;
- bool disable_h2 = false;
- uint8_t verify_client_level = 0;
- std::string tunnel_destination;
- uint8_t verify_origin_server = 0;
- std::string client_cert;
-
- // These need to be initialized statically.
- static TsConfigObjectDescriptor OBJ_DESCRIPTOR;
- static TsConfigDescriptor FQDN_DESCRIPTOR;
- TsConfigString FQDN_CONFIG;
- static TsConfigDescriptor DISABLE_h2_DESCRIPTOR;
- TsConfigBool DISABLEH2_CONFIG;
- static TsConfigEnumDescriptor LEVEL_DESCRIPTOR;
- TsConfigEnum<self::Level> VERIFYCLIENT_CONFIG;
- static TsConfigDescriptor TUNNEL_DEST_DESCRIPTOR;
- TsConfigString TUNNEL_DEST_CONFIG;
- static TsConfigDescriptor CLIENT_CERT_DESCRIPTOR;
- TsConfigString CLIENT_CERT_CONFIG;
- static TsConfigDescriptor VERIFY_NEXT_SERVER_DESCRIPTOR;
- TsConfigInt VERIFY_NEXT_SERVER_CONFIG;
- ~Item() override {}
- };
- std::vector<self::Item> items;
- ts::Errata loader(lua_State *s) override;
- ts::Errata registerEnum(lua_State *L);
-};
-#endif /* LUASNICONFIG_H */
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index 6ebb1d5..ee66ec6 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -47,7 +47,8 @@ test_certlookup_LDADD = \
@OPENSSL_LIBS@ \
$(top_builddir)/lib/ts/libtsutil.la \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
- $(top_builddir)/proxy/ParentSelectionStrategy.o
+ $(top_builddir)/proxy/ParentSelectionStrategy.o \
+ @LIB_YAMLCPP@
test_UDPNet_CPPFLAGS = \
$(AM_CPPFLAGS) \
@@ -73,8 +74,7 @@ test_UDPNet_LDADD = \
$(top_builddir)/lib/ts/libtsutil.la \
$(top_builddir)/proxy/ParentSelectionStrategy.o \
$(top_builddir)/lib/tsconfig/libtsconfig.la \
- $(top_builddir)/lib/luajit/src/libluajit.a \
- @LIBTCL@ @HWLOC_LIBS@ @OPENSSL_LIBS@
+ @LIBTCL@ @HWLOC_LIBS@ @OPENSSL_LIBS@ @LIB_YAMLCPP@
test_UDPNet_SOURCES = \
test_I_UDPNet.cc
@@ -93,8 +93,8 @@ libinknet_a_SOURCES = \
Inline.cc \
I_SessionAccept.h \
SessionAccept.cc \
- LuaSNIConfig.h \
- LuaSNIConfig.cc \
+ YamlSNIConfig.h \
+ YamlSNIConfig.cc \
Net.cc \
NetVConnection.cc \
P_SNIActionPerformer.h \
diff --git a/iocore/net/P_SSLSNI.h b/iocore/net/P_SSLSNI.h
index a7f4463..06b7f2f 100644
--- a/iocore/net/P_SSLSNI.h
+++ b/iocore/net/P_SSLSNI.h
@@ -37,7 +37,7 @@
#include "openssl/ossl_typ.h"
#include <vector>
#include <strings.h>
-#include "LuaSNIConfig.h"
+#include "YamlSNIConfig.h"
// Properties for the next hop server
struct NextHopProperty {
@@ -57,7 +57,7 @@ struct SNIConfigParams : public ConfigInfo {
SNIMap wild_sni_action_map;
NextHopPropertyTable next_hop_table;
NextHopPropertyTable wild_next_hop_table;
- LuaSNIConfig L_sni;
+ YamlSNIConfig Y_sni;
NextHopProperty *getPropertyConfig(cchar *servername) const;
SNIConfigParams();
~SNIConfigParams() override;
diff --git a/iocore/net/SSLSNIConfig.cc b/iocore/net/SSLSNIConfig.cc
index 9c3cc5b..f140612 100644
--- a/iocore/net/SSLSNIConfig.cc
+++ b/iocore/net/SSLSNIConfig.cc
@@ -56,7 +56,7 @@ SNIConfigParams::getPropertyConfig(cchar *servername) const
void
SNIConfigParams::loadSNIConfig()
{
- for (auto item : L_sni.items) {
+ for (auto item : Y_sni.items) {
actionVector *aiVec = new actionVector();
Debug("ssl", "name: %s", item.fqdn.data());
cchar *servername = item.fqdn.data();
@@ -139,28 +139,25 @@ int
SNIConfigParams::Initialize()
{
sni_filename = ats_stringdup(RecConfigReadConfigPath("proxy.config.ssl.servername.filename"));
+
+ Note("loading %s", sni_filename);
+
struct stat sbuf;
if (stat(sni_filename, &sbuf) == -1 && errno == ENOENT) {
+ Note("failed to reload ssl_server_name.config");
Warning("Loading SNI configuration - filename: %s doesn't exist", sni_filename);
return 1;
}
- lua_State *L = lua_open(); /* opens Lua */
- luaL_openlibs(L);
- if (luaL_loadfile(L, sni_filename)) {
- Error("Loading SNI configuration - luaL_loadfile: %s", lua_tostring(L, -1));
- lua_pop(L, 1);
- return 1;
- }
-
- if (lua_pcall(L, 0, 0, 0)) {
- Error("Loading SNI configuration - luap_pcall: %s failed: %s", sni_filename, lua_tostring(L, -1));
- lua_pop(L, 1);
+ ts::Errata zret = Y_sni.loader(sni_filename);
+ if (!zret.isOK()) {
+ Note("failed to reload ssl_server_name.config");
return 1;
}
- L_sni.loader(L);
loadSNIConfig();
+ Note("ssl_server_name.config done reloading!");
+
return 0;
}
diff --git a/iocore/net/YamlSNIConfig.cc b/iocore/net/YamlSNIConfig.cc
new file mode 100644
index 0000000..5ab7ad2
--- /dev/null
+++ b/iocore/net/YamlSNIConfig.cc
@@ -0,0 +1,107 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#include "YamlSNIConfig.h"
+
+#include <unordered_map>
+#include <set>
+#include <string_view>
+
+#include <yaml-cpp/yaml.h>
+
+#include "ts/Diags.h"
+#include "ts/EnumDescriptor.h"
+#include "tsconfig/Errata.h"
+
+ts::Errata
+YamlSNIConfig::loader(const char *cfgFilename)
+{
+ try {
+ YAML::Node config = YAML::LoadFile(cfgFilename);
+ if (!config.IsSequence()) {
+ return ts::Errata::Message(1, 1, "expected sequence");
+ }
+
+ for (auto it = config.begin(); it != config.end(); ++it) {
+ items.push_back(it->as<YamlSNIConfig::Item>());
+ }
+ } catch (std::exception &ex) {
+ return ts::Errata::Message(1, 1, ex.what());
+ }
+
+ return ts::Errata();
+}
+
+TsEnumDescriptor LEVEL_DESCRIPTOR = {{{"NONE", 0}, {"MODERATE", 1}, {"STRICT", 2}}};
+
+std::set<std::string> valid_sni_config_keys = {TS_fqdn, TS_disable_H2, TS_verify_client,
+ TS_tunnel_route, TS_verify_origin_server, TS_client_cert};
+
+namespace YAML
+{
+template <> struct convert<YamlSNIConfig::Item> {
+ static bool
+ decode(const Node &node, YamlSNIConfig::Item &item)
+ {
+ for (auto &&item : node) {
+ if (std::none_of(valid_sni_config_keys.begin(), valid_sni_config_keys.end(),
+ [&item](std::string s) { return s == item.first.as<std::string>(); })) {
+ throw std::runtime_error("unsupported key " + item.first.as<std::string>());
+ }
+ }
+
+ if (node[TS_fqdn]) {
+ item.fqdn = node[TS_fqdn].as<std::string>();
+ }
+ if (node[TS_disable_H2]) {
+ item.fqdn = node[TS_disable_H2].as<bool>();
+ }
+
+ // enum
+ if (node[TS_verify_client]) {
+ auto value = node[TS_verify_client].as<std::string>();
+ int level = LEVEL_DESCRIPTOR.get(value);
+ if (level < 0) {
+ throw std::runtime_error("unknown value " + value);
+ }
+ item.verify_client_level = static_cast<uint8_t>(level);
+ }
+
+ if (node[TS_tunnel_route]) {
+ item.tunnel_destination = node[TS_tunnel_route].as<std::string>();
+ }
+
+ if (node[TS_verify_origin_server]) {
+ auto value = node[TS_verify_origin_server].as<std::string>();
+ int level = LEVEL_DESCRIPTOR.get(value);
+ if (level < 0) {
+ throw std::runtime_error("unknown value " + value);
+ }
+ item.verify_origin_server = static_cast<uint8_t>(level);
+ }
+
+ if (node[TS_client_cert]) {
+ item.client_cert = node[TS_client_cert].as<std::string>();
+ }
+ return true;
+ }
+};
+} // namespace YAML
diff --git a/iocore/net/YamlSNIConfig.h b/iocore/net/YamlSNIConfig.h
new file mode 100644
index 0000000..e3fcd11
--- /dev/null
+++ b/iocore/net/YamlSNIConfig.h
@@ -0,0 +1,62 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#pragma once
+
+#include <vector>
+#include <string>
+
+#include "tsconfig/Errata.h"
+
+constexpr char TS_fqdn[] = "fqdn";
+constexpr char TS_disable_H2[] = "disable_h2";
+constexpr char TS_verify_client[] = "verify_client";
+constexpr char TS_tunnel_route[] = "tunnel_route";
+constexpr char TS_verify_origin_server[] = "verify_origin_server";
+constexpr char TS_client_cert[] = "client_cert";
+
+const int start = 0;
+struct YamlSNIConfig {
+ enum class Action {
+ disable_h2 = start,
+ verify_client,
+ tunnel_route, // blind tunnel action
+ verify_origin_server, // this applies to server side vc only
+ client_cert
+
+ };
+ enum class Level { NONE = 0, MODERATE, STRICT };
+
+ YamlSNIConfig() {}
+
+ struct Item {
+ std::string fqdn;
+ bool disable_h2 = false;
+ uint8_t verify_client_level = 0;
+ std::string tunnel_destination;
+ uint8_t verify_origin_server = 0;
+ std::string client_cert;
+ };
+
+ ts::Errata loader(const char *cfgFilename);
+
+ std::vector<YamlSNIConfig::Item> items;
+};
diff --git a/lib/Makefile.am b/lib/Makefile.am
index df3b438..5af2b38 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -26,16 +26,16 @@ if BUILD_WCCP
SUBDIRS += wccp
endif
-#if BUILD_YAML_CPP
-SUBDIRS += yamlcpp
-#endif
-
LOCAL =
if BUILD_LUAJIT
LOCAL += all-luajit
endif
+if BUILD_YAML_CPP
+LOCAL += yamlcpp
+endif
+
# Support verbose LuaJIT builds with "make V=1".
luajit__v_ = $(luajit__v_$(AM_DEFAULT_VERBOSITY))
luajit__v_0 = @
@@ -62,7 +62,9 @@ all-luajit:
XCFLAGS="" \
LDFLAGS="$(LUAJIT_LDFLAGS)" \
Q=$(luajit__v_$(V))
+ $(MAKE) -C yamlcpp
clean-local:
test "$(top_srcdir)" != "$(top_builddir)" || (cd "$(top_builddir)/$(subdir)/luajit" && $(MAKE) CC="$(CC)" clean)
test "$(top_srcdir)" = "$(top_builddir)" || rm -rf "$(top_builddir)/$(subdir)/luajit"
+ $(MAKE) -C yamlcpp clean
diff --git a/lib/ts/EnumDescriptor.h b/lib/ts/EnumDescriptor.h
new file mode 100644
index 0000000..274ba92
--- /dev/null
+++ b/lib/ts/EnumDescriptor.h
@@ -0,0 +1,61 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include <string_view>
+#include <unordered_map>
+
+#include "ts/HashFNV.h"
+
+/// Hash functor for @c string_view
+inline size_t
+TsLuaConfigSVHash(std::string_view const &sv)
+{
+ ATSHash64FNV1a h;
+ h.update(sv.data(), sv.size());
+ return h.get();
+}
+
+class TsEnumDescriptor
+{
+public:
+ struct Pair {
+ std::string_view key;
+ int value;
+ };
+ TsEnumDescriptor(std::initializer_list<Pair> pairs) : values{pairs.size(), &TsLuaConfigSVHash}, keys{pairs.size()}
+ {
+ for (auto &p : pairs) {
+ values[p.key] = p.value;
+ keys[p.value] = p.key;
+ }
+ }
+ std::unordered_map<std::string_view, int, size_t (*)(std::string_view const &)> values;
+ std::unordered_map<int, std::string_view> keys;
+ int
+ get(std::string_view key)
+ {
+ auto it = values.find(key);
+ if (it != values.end()) {
+ return it->second;
+ }
+ return -1;
+ }
+};
diff --git a/proxy/config/logging.config.default b/proxy/config/logging.config.default
index 7f623fa..6147ae5 100644
--- a/proxy/config/logging.config.default
+++ b/proxy/config/logging.config.default
@@ -1,157 +1,97 @@
--- Custom log configuration.
+# Custom log configuration.
--- Predefined Functions.
---
--- format(table)
--- Returns a format object. The given table supports the following fields:
--- Format (string, required): log format string
--- Interval (number, optional): log aggregation interval
---
--- filter.accept(string)
--- Create a filter object that accepts logs matching the filter string.
---
--- filter.reject(string)
--- Create a filter object that drops logs matching the filter string.
---
--- filter.wipe(string)
--- Create a filter object that wipes (read: removes) the log fields specified in the filter string.
---
--- log.ascii(table)
--- Creates an ASCII logging object.
---
--- log.binary(table)
--- Creates a binary logging object.
---
--- log.pipe(table)
--- Creates a logging object that logs to a pipe.
---
--- The log.* functions accept a table that supports the following fields:
--- Filename (string, required):
--- Format (string or format object, required):
--- Header (string, optional):
--- RollingEnabled (boolean, optional):
--- RollingIntervalSec (number, optional):
--- RollingOffsetHr (number, optional):
--- RollingSizeMb (number, optional):
--- Filters (array of filter objects, optional):
--- CollationHosts (array of strings, optional):
--- This parameter may be either a single string or an array of entries.
--- Entries may be strings or arrays of strings. A string specifies a
--- single collation host, which is equivalent to providing an array
--- containing a single string.
---
--- If multiple entries are given, multiple collation hosts are configured
--- and each log entry will be forwarded to every host.
---
--- If an entry is an array of strings, this defines a collation host
--- failover group. The first array entry is the primary collation host
--- and the remaining entries are attached as ordered failover hosts
--- that will be attempted if the primary host fails.
---
--- A single collation host with failover:
--- { {'logs-1.example.com:4567', 'logs-2.example.com:4567'} }
---
--- Multiple collation hosts:
--- {'logs-1.example.com:4567', 'logs-2.example.com:4567'}
---
--- Multiple collation hosts with some failover:
--- {'logs-1.example.com:4567', { 'logs-2.example.com:4567', 'logs-2a.example.com:4567'} }
+# The log.* functions accept a table that supports the following fields:
+# Filename (string, required):
+# Format (string or format object, required):
+# Header (string, optional):
+# RollingEnabled (boolean, optional):
+# RollingIntervalSec (number, optional):
+# RollingOffsetHr (number, optional):
+# RollingSizeMb (number, optional):
+# Filters (array of filter objects, optional):
+# CollationHosts (array of strings, optional):
+# This parameter may be either a single string or an array of entries.
+# Entries may be strings or arrays of strings. A string specifies a
+# single collation host, which is equivalent to providing an array
+# containing a single string.
+#
+# If multiple entries are given, multiple collation hosts are configured
+# and each log entry will be forwarded to every host.
+#
+# If an entry is an array of strings, this defines a collation host
+# failover group. The first array entry is the primary collation host
+# and the remaining entries are attached as ordered failover hosts
+# that will be attempted if the primary host fails.
+#
+# A single collation host with failover:
+# { {'logs-1.example.com:4567', 'logs-2.example.com:4567'} }
+#
+# Multiple collation hosts:
+# {'logs-1.example.com:4567', 'logs-2.example.com:4567'}
+#
+# Multiple collation hosts with some failover:
+# {'logs-1.example.com:4567', { 'logs-2.example.com:4567', 'logs-2a.example.com:4567'} }
--- Predefined variables.
---
--- log.roll.none (number)
--- RollingEnabled value to disable all log rolling.
---
--- log.roll.time (number)
--- RollingEnabled value. Roll at a certain time frequency, specified
--- by RollingIntervalSec, and RollingOffsetHr.
---
--- log.roll.size (number)
--- RollingEnabled value. Roll when the size exceeds RollingSizeMb.
---
--- log.roll.both (number)
--- RollingEnabled value. Roll when either the specified rolling
--- time is reached or the specified file size is reached.
---
--- log.roll.any (number)
--- RollingEnabled value. Roll the log file when the specified
--- rolling time is reached if the size of the file equals or exceeds
--- the specified size.
---
--- log.protocol.http (number)
--- Server protocol constants for constructing %<etype> filters.
+# Predefined variables.
+#
+# log.roll.none (number)
+# RollingEnabled value to disable all log rolling.
+#
+# log.roll.time (number)
+# RollingEnabled value. Roll at a certain time frequency, specified
+# by RollingIntervalSec, and RollingOffsetHr.
+#
+# log.roll.size (number)
+# RollingEnabled value. Roll when the size exceeds RollingSizeMb.
+#
+# log.roll.both (number)
+# RollingEnabled value. Roll when either the specified rolling
+# time is reached or the specified file size is reached.
+#
+# log.roll.any (number)
+# RollingEnabled value. Roll the log file when the specified
+# rolling time is reached if the size of the file equals or exceeds
+# the specified size.
+#
+# log.protocol.http (number)
+# Server protocol constants for constructing %<etype> filters.
--- Removed parameters.
---
--- The following logging object parameters that were supported in
--- the XML configuration file have been removed.
---
--- Protocols:
--- The list of protocols to log is a comma separated list of the
--- protocols that the object logs. If the log object has no
--- Protocol tag, then it logs all protocols. The Protocol tag
--- simply provides an easy way to create a filter that accepts
--- the specified protocols.
---
--- The log object Protocols parameter is no longer supported. This
--- parameter can be implemented with a filter on the %<etype> (log
--- entry type) log field, eg.
---
--- all = filter.accept(string.format('%%<etype> CONTAIN %d', log.protocol.http))
--- http_only = filter.accept(string.format('%%<etype> CONTAIN %d', log.protocol.http))
---
--- ServerHosts:
--- This parameter provides an easy way to create a filter that logs
--- only the requests to hosts in the comma separated list. Only entries
--- from the named servers will be included in the log file. Servers
--- can only be specified by name, not by IP address.
---
--- The log object ServerHosts parameter is no longer supported. It can
--- implemented with a filter on the %<shn> (server host name) log
--- field, eg.
---
--- hosts = filter.accept('%<shn> CASE_INSENSITIVE_CONTAIN host1,host2,host3,etc")
+formats:
+ # WebTrends Enhanced Log Format.
+ #
+ # The following is compatible with the WebTrends Enhanced Log Format.
+ # If you want to generate a log that can be parsed by WebTrends
+ # reporting tools, simply create a log that uses this format.
+ - name: welf
+ format: |-
+ id=firewall time="%<cqtd> %<cqtt>" fw=%<phn> pri=6 proto=%<cqus> duration=%<ttmsf> sent=%<psql> rcvd=%<cqhl> src=%<chi> dst=%<shi> dstname=%<shn> user=%<caun> op=%<cqhm> arg="%<cqup>" result=%<pssc> ref="%<{Referer}cqh>" agent="%<{user-agent}cqh>" cache=%<crc>
+ # Squid Log Format with seconds resolution timestamp.
+ # The following is the squid format but with a seconds-only timestamp
+ # (cqts) instead of a seconds and milliseconds timestamp (cqtq).
+ - name: squid_seconds_only_timestamp
+ format: '%<cqts> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
--- WebTrends Enhanced Log Format.
---
--- The following is compatible with the WebTrends Enhanced Log Format.
--- If you want to generate a log that can be parsed by WebTrends
--- reporting tools, simply create a log that uses this format.
-welf = format {
- Format = 'id=firewall time="%<cqtd> %<cqtt>" fw=%<phn> pri=6 proto=%<cqus> duration=%<ttmsf> sent=%<psql> rcvd=%<cqhl> src=%<chi> dst=%<shi> dstname=%<shn> user=%<caun> op=%<cqhm> arg="%<cqup>" result=%<pssc> ref="%<{Referer}cqh>" agent="%<{user-agent}cqh>" cache=%<crc>'
-}
+ # Squid Log Format.
+ - name: squid
+ format: '%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
--- Squid Log Format with seconds resolution timestamp.
---
--- The following is the squid format but with a seconds-only timestamp
--- (cqts) instead of a seconds and milliseconds timestamp (cqtq).
-squid_seconds_only_timestamp = format {
- Format = '%<cqts> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
-}
+ # Common Log Format.
+ - name: common
+ format: '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
--- Squid Log Format.
-squid = format {
- Format = '%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
-}
+ # Extended Log Format.
+ - name: 'extended'
+ formatX: |-
+ %<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts>
--- Common Log Format.
-common = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
-}
+ # Extended2 Log Formats
+ - name: "extended2"
+ format: '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts> %<phr> %<cfsc> %<pfsc> %<crc>'
--- Extended Log Format.
-extended = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts>'
-}
+logs:
+ - filename: squid
+ format: quid
+ mode: binary
--- Extended2 Log Formats
-extended2 = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts> %<phr> %<cfsc> %<pfsc> %<crc>'
-}
-log.binary {
- Format = squid,
- Filename = 'squid'
-}
-
--- vim: set ft=lua :
+# vim: set ft=yaml :
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index f52517b..3c10148 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -51,6 +51,8 @@
#include "LogCollationAccept.h"
+#include "YamlLogConfig.h"
+
#define DISK_IS_CONFIG_FULL_MESSAGE \
"Access logging to local log directory suspended - " \
"configured space allocation exhausted."
@@ -472,6 +474,12 @@ LogConfig::display(FILE *fd)
fprintf(fd, "\n");
fprintf(fd, "************ Log Objects (%u objects) ************\n", (unsigned int)log_object_manager.get_num_objects());
log_object_manager.display(fd);
+
+ fprintf(fd, "************ Filter List (%u filters) ************\n", filter_list.count());
+ filter_list.display(fd);
+
+ fprintf(fd, "************ Format List (%u formats) ************\n", format_list.count());
+ format_list.display(fd);
}
//-----------------------------------------------------------------------------
@@ -488,7 +496,9 @@ LogConfig::setup_log_objects()
{
Debug("log", "creating objects...");
- // Evaluate logging.config to construct the custome log objects.
+ filter_list.clear();
+
+ // Evaluate logging.config to construct the custom log objects.
evaluate_config();
// Open local pipes so readers can see them.
@@ -915,16 +925,22 @@ LogConfig::update_space_used()
bool
LogConfig::evaluate_config()
{
- BindingInstance binding;
ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", "logging.config"));
-
- if (!binding.construct()) {
- Fatal("failed to initialize Lua runtime");
+ struct stat sbuf;
+ if (stat(path.get(), &sbuf) == -1 && errno == ENOENT) {
+ Warning("logging configuration '%s' doesn't exist", path.get());
+ return false;
}
- if (MakeLogBindings(binding, this)) {
- return binding.require(path.get());
+ Note("loading logging.config");
+ YamlLogConfig y(this);
+
+ bool zret = y.parse(path.get());
+ if (zret) {
+ Note("logging.config done reloading!");
+ } else {
+ Note("failed to reload logging.config");
}
- return false;
+ return zret;
}
diff --git a/proxy/logging/LogConfig.h b/proxy/logging/LogConfig.h
index ead00e3..816e22b 100644
--- a/proxy/logging/LogConfig.h
+++ b/proxy/logging/LogConfig.h
@@ -26,6 +26,7 @@
#include "ts/ink_platform.h"
#include "P_RecProcess.h"
#include "ProxyConfig.h"
+#include "LogObject.h"
/* Instead of enumerating the stats in DynamicStats.h, each module needs
to enumerate its stats separately and register them with librecords
@@ -168,6 +169,9 @@ public:
LogObjectManager log_object_manager;
+ LogFilterList filter_list;
+ LogFormatList format_list;
+
int log_buffer_size;
int max_secs_per_buffer;
int max_space_mb_for_logs;
diff --git a/proxy/logging/LogField.cc b/proxy/logging/LogField.cc
index e458f17..049f2b3 100644
--- a/proxy/logging/LogField.cc
+++ b/proxy/logging/LogField.cc
@@ -678,9 +678,9 @@ LogField::valid_aggregate_name(char *name)
}
bool
-LogField::fieldlist_contains_aggregates(char *fieldlist)
+LogField::fieldlist_contains_aggregates(const char *fieldlist)
{
- char *match;
+ const char *match;
for (unsigned i = 1; i < countof(aggregate_names); i++) {
if ((match = strstr(fieldlist, aggregate_names[i])) != nullptr) {
diff --git a/proxy/logging/LogField.h b/proxy/logging/LogField.h
index 20df638..c892091 100644
--- a/proxy/logging/LogField.h
+++ b/proxy/logging/LogField.h
@@ -177,7 +177,7 @@ public:
static void init_milestone_container(void);
static Container valid_container_name(char *name);
static Aggregate valid_aggregate_name(char *name);
- static bool fieldlist_contains_aggregates(char *fieldlist);
+ static bool fieldlist_contains_aggregates(const char *fieldlist);
private:
char *m_name;
diff --git a/proxy/logging/LogFilter.cc b/proxy/logging/LogFilter.cc
index f8d6bad..8c60d82 100644
--- a/proxy/logging/LogFilter.cc
+++ b/proxy/logging/LogFilter.cc
@@ -1045,7 +1045,7 @@ LogFilterList::toss_this_entry(LogAccess *lad)
-------------------------------------------------------------------------*/
LogFilter *
-LogFilterList::find_by_name(char *name)
+LogFilterList::find_by_name(const char *name)
{
for (LogFilter *f = first(); f; f = next(f)) {
if (strcmp(f->name(), name) == 0) {
diff --git a/proxy/logging/LogFilter.h b/proxy/logging/LogFilter.h
index 1597ab6..259f9dd 100644
--- a/proxy/logging/LogFilter.h
+++ b/proxy/logging/LogFilter.h
@@ -263,7 +263,7 @@ public:
void add(LogFilter *filter, bool copy = true);
bool toss_this_entry(LogAccess *lad);
bool wipe_this_entry(LogAccess *lad);
- LogFilter *find_by_name(char *name);
+ LogFilter *find_by_name(const char *name);
void clear();
LogFilter *
diff --git a/proxy/logging/Makefile.am b/proxy/logging/Makefile.am
index 90a7caf..24f4aa7 100644
--- a/proxy/logging/Makefile.am
+++ b/proxy/logging/Makefile.am
@@ -72,7 +72,10 @@ liblogging_a_SOURCES = \
LogSock.cc \
LogSock.h \
LogUtils.cc \
- LogUtils.h
+ LogUtils.h \
+ YamlLogConfig.cc \
+ YamlLogConfigDecoders.cc \
+ YamlLogConfig.h
liblogcollation_a_SOURCES = \
LogCollationAccept.cc \
diff --git a/proxy/logging/YamlLogConfig.cc b/proxy/logging/YamlLogConfig.cc
new file mode 100644
index 0000000..83cc384
--- /dev/null
+++ b/proxy/logging/YamlLogConfig.cc
@@ -0,0 +1,247 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#include "YamlLogConfig.h"
+#include "YamlLogConfigDecoders.h"
+
+#include "LogConfig.h"
+#include "LogObject.h"
+
+#include "ts/EnumDescriptor.h"
+
+#include <yaml-cpp/yaml.h>
+#include <algorithm>
+#include <memory>
+
+bool
+YamlLogConfig::parse(const char *cfgFilename)
+{
+ bool result;
+ try {
+ result = loadLogConfig(cfgFilename);
+ } catch (std::exception &ex) {
+ Error("%s", ex.what());
+ result = false;
+ }
+ return result;
+}
+
+bool
+YamlLogConfig::loadLogConfig(const char *cfgFilename)
+{
+ YAML::Node config = YAML::LoadFile(cfgFilename);
+
+ if (config.IsNull()) {
+ Warning("logging.config is empty");
+ return false;
+ }
+
+ if (!config.IsMap()) {
+ Error("malformed logging.config file; expected a map");
+ return false;
+ }
+
+ auto formats = config["formats"];
+ for (auto it = formats.begin(); it != formats.end(); ++it) {
+ auto fmt = it->as<std::unique_ptr<LogFormat>>().release();
+ if (fmt->valid()) {
+ cfg->format_list.add(fmt, false);
+
+ if (is_debug_tag_set("log")) {
+ printf("The following format was added to the global format list\n");
+ fmt->display(stdout);
+ }
+ } else {
+ Note("Format named \"%s\" will not be active; not a valid format", fmt->name() ? fmt->name() : "");
+ delete fmt;
+ }
+ }
+
+ auto filters = config["filters"];
+ for (auto it = filters.begin(); it != filters.end(); ++it) {
+ auto filter = it->as<std::unique_ptr<LogFilter>>().release();
+
+ if (filter) {
+ cfg->filter_list.add(filter, false);
+
+ if (is_debug_tag_set("xml")) {
+ printf("The following filter was added to the global filter list\n");
+ filter->display(stdout);
+ }
+ }
+ }
+
+ auto logs = config["logs"];
+ for (auto it = logs.begin(); it != logs.end(); ++it) {
+ auto obj = decodeLogObject(*it);
+ if (obj) {
+ cfg->log_object_manager.manage_object(obj);
+ }
+ }
+ return true;
+}
+
+TsEnumDescriptor ROLLING_MODE = {{{"none", 0}, {"time", 1}, {"size", 2}, {"both", 3}, {"any", 4}}};
+
+std::set<std::string> valid_log_object_keys = {
+ "filename", "format", "mode", "header", "rolling_enabled", "rolling_interval_sec",
+ "rolling_offset_hr", "rolling_size_mb", "filters", "collation_hosts"};
+
+LogObject *
+YamlLogConfig::decodeLogObject(const YAML::Node &node)
+{
+ for (auto &&item : node) {
+ if (std::none_of(valid_log_object_keys.begin(), valid_log_object_keys.end(),
+ [&item](std::string s) { return s == item.first.as<std::string>(); })) {
+ throw std::runtime_error("log: unsupported key '" + item.first.as<std::string>() + "'");
+ }
+ }
+
+ if (!node["format"]) {
+ throw std::runtime_error("missing 'format' argument");
+ }
+ std::string format = node["format"].as<std::string>();
+
+ if (!node["filename"]) {
+ throw std::runtime_error("missing 'filename' argument");
+ }
+
+ std::string header;
+ if (node["header"]) {
+ header = node["header"].as<std::string>();
+ }
+
+ std::string filename = node["filename"].as<std::string>();
+ LogFormat *fmt = cfg->format_list.find_by_name(format.c_str());
+ if (!fmt) {
+ Error("Format %s is not a known format; cannot create LogObject", format.c_str());
+ return nullptr;
+ }
+
+ // file format
+ LogFileFormat file_type = LOG_FILE_ASCII; // default value
+ if (node["mode"]) {
+ const char *mode_str = node["mode"].as<std::string>().c_str();
+ file_type = (strncasecmp(mode_str, "bin", 3) == 0 || (mode_str[0] == 'b' && mode_str[1] == 0) ?
+ LOG_FILE_BINARY :
+ (strcasecmp(mode_str, "ascii_pipe") == 0 ? LOG_FILE_PIPE : LOG_FILE_ASCII));
+ }
+
+ int obj_rolling_enabled = 0;
+ int obj_rolling_interval_sec = cfg->rolling_interval_sec;
+ int obj_rolling_offset_hr = cfg->rolling_offset_hr;
+ int obj_rolling_size_mb = cfg->rolling_size_mb;
+
+ if (node["rolling_enabled"]) {
+ auto value = node["rolling_enabled"].as<std::string>();
+ obj_rolling_enabled = ROLLING_MODE.get(value);
+ if (obj_rolling_enabled < 0) {
+ throw std::runtime_error("unknown value " + value);
+ }
+ }
+ if (node["rolling_interval_sec"]) {
+ obj_rolling_interval_sec = node["rolling_interval_sec"].as<int>();
+ }
+ if (node["rolling_offset_hr"]) {
+ obj_rolling_offset_hr = node["rolling_offset_hr"].as<int>();
+ }
+ if (node["rolling_size_mb"]) {
+ obj_rolling_size_mb = node["rolling_size_mb"].as<int>();
+ }
+
+ if (!LogRollingEnabledIsValid(obj_rolling_enabled)) {
+ Warning("Invalid log rolling value '%d' in log object", obj_rolling_enabled);
+ }
+
+ auto logObject = new LogObject(fmt, Log::config->logfile_dir, filename.c_str(), file_type, header.c_str(),
+ (Log::RollingEnabledValues)obj_rolling_enabled, Log::config->collation_preproc_threads,
+ obj_rolling_interval_sec, obj_rolling_offset_hr, obj_rolling_size_mb);
+
+ // filters
+ auto filters = node["filters"];
+ if (!filters) {
+ return logObject;
+ }
+
+ if (!filters.IsSequence()) {
+ throw std::runtime_error("'filters' should be a list");
+ }
+
+ for (auto &&filter : filters) {
+ const char *filter_name = filter.as<std::string>().c_str();
+ LogFilter *f = cfg->filter_list.find_by_name(filter_name);
+ if (!f) {
+ Warning("Filter %s is not a known filter; cannot add to this LogObject", filter_name);
+ } else {
+ logObject->add_filter(f);
+ }
+ }
+
+ auto collation_host_list = node["collation_hosts"];
+ if (!collation_host_list) {
+ return logObject;
+ }
+
+ if (!collation_host_list.IsSequence()) {
+ throw std::runtime_error("'collation_hosts' should be a list of collation_host objects");
+ }
+
+ for (auto &&collation_host : collation_host_list) {
+ if (!collation_host["host"]) {
+ Warning("no collation 'host' name; cannot add this Collation host");
+ continue;
+ }
+
+ auto collation_host_name = collation_host["host"].as<std::string>();
+
+ LogHost *lh = new LogHost(logObject->get_full_filename(), logObject->get_signature());
+ if (!lh->set_name_or_ipstr(collation_host_name.c_str())) {
+ Warning("Could not set \"%s\" as collation host", collation_host_name.c_str());
+ delete lh;
+ continue;
+ }
+
+ logObject->add_loghost(lh, false);
+ if (!collation_host["failover"]) {
+ continue;
+ }
+
+ if (!collation_host["failover"].IsSequence()) {
+ delete lh;
+ throw std::runtime_error("'failover' should be a list of host names");
+ }
+
+ LogHost *prev = lh;
+ for (auto &&failover_host : collation_host["failover"]) {
+ auto failover_host_name = failover_host.as<std::string>();
+ LogHost *flh = new LogHost(logObject->get_full_filename(), logObject->get_signature());
+ if (!flh->set_name_or_ipstr(failover_host_name.c_str())) {
+ Warning("Could not set \"%s\" as a failover host", failover_host_name.c_str());
+ delete flh;
+ continue;
+ }
+ prev->failover_link.next = flh;
+ prev = flh;
+ }
+ }
+
+ return logObject;
+}
diff --git a/proxy/logging/YamlLogConfig.h b/proxy/logging/YamlLogConfig.h
new file mode 100644
index 0000000..323b406
--- /dev/null
+++ b/proxy/logging/YamlLogConfig.h
@@ -0,0 +1,46 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#pragma once
+
+class LogConfig;
+class LogObject;
+namespace YAML
+{
+class Node;
+};
+
+class YamlLogConfig
+{
+public:
+ YamlLogConfig(LogConfig *logConfig) : cfg(logConfig){};
+ bool parse(const char *cfgFilename);
+
+private:
+ bool loadLogConfig(const char *cfgFilename);
+
+ LogObject *decodeLogObject(const YAML::Node &node);
+
+ YamlLogConfig(const YamlLogConfig &) = delete;
+ YamlLogConfig &operator=(const YamlLogConfig &) = delete;
+
+ LogConfig *cfg;
+};
diff --git a/proxy/logging/YamlLogConfigDecoders.cc b/proxy/logging/YamlLogConfigDecoders.cc
new file mode 100644
index 0000000..d1853c1
--- /dev/null
+++ b/proxy/logging/YamlLogConfigDecoders.cc
@@ -0,0 +1,118 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#include "YamlLogConfigDecoders.h"
+
+#include "LogConfig.h"
+#include "LogObject.h"
+
+#include <yaml-cpp/yaml.h>
+#include <algorithm>
+#include <memory>
+
+std::set<std::string> valid_log_format_keys = {"name", "format", "interval"};
+std::set<std::string> valid_log_filter_keys = {"name", "action", "condition"};
+
+namespace YAML
+{
+bool
+convert<std::unique_ptr<LogFormat>>::decode(const Node &node, std::unique_ptr<LogFormat> &logFormat)
+{
+ for (auto &&item : node) {
+ if (std::none_of(valid_log_format_keys.begin(), valid_log_format_keys.end(),
+ [&item](std::string s) { return s == item.first.as<std::string>(); })) {
+ throw std::runtime_error("format: unsupported key '" + item.first.as<std::string>() + "'");
+ }
+ }
+
+ if (!node["format"]) {
+ throw std::runtime_error("missing 'format' argument");
+ }
+ std::string format = node["format"].as<std::string>();
+
+ std::string name;
+ if (node["name"]) {
+ name = node["name"].as<std::string>();
+ }
+
+ // if the format_str contains any of the aggregate operators,
+ // we need to ensure that an interval was specified.
+ if (LogField::fieldlist_contains_aggregates(format.c_str())) {
+ if (!node["interval"]) {
+ Note("'interval' attribute missing for LogFormat object"
+ " %s that contains aggregate operators: %s",
+ name.c_str(), format.c_str());
+ return false;
+ }
+ }
+
+ unsigned interval = 0;
+ if (node["interval"]) {
+ interval = node["interval"].as<unsigned>();
+ }
+
+ logFormat.reset(new LogFormat(name.c_str(), format.c_str(), interval));
+
+ return true;
+}
+
+bool
+convert<std::unique_ptr<LogFilter>>::decode(const Node &node, std::unique_ptr<LogFilter> &logFilter)
+{
+ for (auto &&item : node) {
+ if (std::none_of(valid_log_filter_keys.begin(), valid_log_filter_keys.end(),
+ [&item](std::string s) { return s == item.first.as<std::string>(); })) {
+ throw std::runtime_error("filter: unsupported key '" + item.first.as<std::string>() + "'");
+ }
+ }
+
+ // we require all keys for LogFilter
+ for (auto &&item : valid_log_filter_keys) {
+ if (!node[item]) {
+ throw std::runtime_error("missing '" + item + "' argument");
+ }
+ }
+
+ auto name = node["name"].as<std::string>();
+ auto action = node["action"].as<std::string>();
+ auto condition = node["condition"].as<std::string>();
+
+ auto action_str = action.c_str();
+ LogFilter::Action act = LogFilter::REJECT; /* lv: make gcc happy */
+ int i;
+ for (i = 0; i < LogFilter::N_ACTIONS; i++) {
+ if (strcasecmp(action_str, LogFilter::ACTION_NAME[i]) == 0) {
+ act = (LogFilter::Action)i;
+ break;
+ }
+ }
+
+ if (i == LogFilter::N_ACTIONS) {
+ Warning("%s is not a valid filter action value; cannot create filter %s.", action_str, name.c_str());
+ return false;
+ }
+
+ logFilter.reset(LogFilter::parse(name.c_str(), act, condition.c_str()));
+
+ return true;
+}
+
+} // namespace YAML
diff --git a/proxy/logging/YamlLogConfigDecoders.h b/proxy/logging/YamlLogConfigDecoders.h
new file mode 100644
index 0000000..108ba17
--- /dev/null
+++ b/proxy/logging/YamlLogConfigDecoders.h
@@ -0,0 +1,41 @@
+/** @file
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <yaml-cpp/yaml.h>
+
+class LogFormat;
+class LogFilter;
+
+namespace YAML
+{
+template <> struct convert<std::unique_ptr<LogFormat>> {
+ static bool decode(const Node &node, std::unique_ptr<LogFormat> &logFormat);
+};
+
+template <> struct convert<std::unique_ptr<LogFilter>> {
+ static bool decode(const Node &node, std::unique_ptr<LogFilter> &logFilter);
+};
+
+} // namespace YAML
diff --git a/src/traffic_logcat/Makefile.inc b/src/traffic_logcat/Makefile.inc
index f46c098..bc91386 100644
--- a/src/traffic_logcat/Makefile.inc
+++ b/src/traffic_logcat/Makefile.inc
@@ -50,7 +50,8 @@ traffic_logcat_traffic_logcat_LDADD += \
endif
traffic_logcat_traffic_logcat_LDADD += \
- @LIBTCL@ @HWLOC_LIBS@\
+ @LIBTCL@ @HWLOC_LIBS@ \
+ @LIB_YAMLCPP@ \
@LIBPROFILER@ -lm
if SYSTEM_LUAJIT
diff --git a/src/traffic_logstats/Makefile.inc b/src/traffic_logstats/Makefile.inc
index 347c005..b69bb64 100644
--- a/src/traffic_logstats/Makefile.inc
+++ b/src/traffic_logstats/Makefile.inc
@@ -55,6 +55,7 @@ endif
traffic_logstats_traffic_logstats_LDADD += \
@LIBTCL@ @HWLOC_LIBS@ \
+ @LIB_YAMLCPP@ \
@LIBPROFILER@ -lm
if SYSTEM_LUAJIT
diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc
index 19f8aec..28d825b 100644
--- a/src/traffic_server/Makefile.inc
+++ b/src/traffic_server/Makefile.inc
@@ -95,6 +95,7 @@ traffic_server_traffic_server_LDADD += \
@LIBLZMA@ \
@LIBPROFILER@ \
@OPENSSL_LIBS@ \
+ @LIB_YAMLCPP@ \
-lm
if BUILD_LUAJIT
diff --git a/tests/gold_tests/h2/httpbin.test.py b/tests/gold_tests/h2/httpbin.test.py
index f615507..9738739 100644
--- a/tests/gold_tests/h2/httpbin.test.py
+++ b/tests/gold_tests/h2/httpbin.test.py
@@ -67,14 +67,15 @@ ts.Disk.records_config.update({
})
ts.Disk.logging_config.AddLines(
'''
--- Extended Log Format.
-access = format {
- Format = '[%<cqtn>] %<cqtx> %<cqpv> %<cqssv> %<cqssc> %<crc> %<pssc> %<pscl>'
-}
+formats:
+ # Extended Log Format.
+ - name: access
+ format: |-
+[%<cqtn>] %<cqtx> %<cqpv> %<cqssv> %<cqssc> %<crc> %<pssc> %<pscl>
-log.ascii {
- Format = access,
- Filename = 'access'
+logs:
+ - filename: access
+ format: access
}
'''.split("\n")
)
diff --git a/tests/gold_tests/logging/ccid_ctid.test.py b/tests/gold_tests/logging/ccid_ctid.test.py
index b990891..762529c 100644
--- a/tests/gold_tests/logging/ccid_ctid.test.py
+++ b/tests/gold_tests/logging/ccid_ctid.test.py
@@ -59,14 +59,14 @@ ts.Disk.ssl_multicert_config.AddLine(
)
ts.Disk.logging_config.AddLines(
- '''custom = format {
- Format = "%<ccid> %<ctid>"
-}
-
-log.ascii {
- Format = custom,
- Filename = 'test_ccid_ctid'
-}'''.split("\n")
+ '''
+formats:
+ - name: custom
+ format: "%<ccid> %<ctid>"
+logs:
+ - filename: test_ccid_ctid
+ format: custom
+'''.split("\n")
)
tr = Test.AddTestRun()
diff --git a/tests/gold_tests/logging/custom-log.test.py b/tests/gold_tests/logging/custom-log.test.py
index 683a251..e297348 100644
--- a/tests/gold_tests/logging/custom-log.test.py
+++ b/tests/gold_tests/logging/custom-log.test.py
@@ -37,14 +37,14 @@ ts.Disk.remap_config.AddLine(
)
ts.Disk.logging_config.AddLines(
- '''custom = format {
- Format = "%<hii> %<hiih>"
-}
-
-log.ascii {
- Format = custom,
- Filename = 'test_log_field'
-}'''.split("\n")
+ '''
+formats:
+ - name: custom
+ format: "%<hii> %<hiih>"
+logs:
+ - filename: test_log_field
+ format: custom
+'''.split("\n")
)
# #########################################################################
diff --git a/tests/gold_tests/logging/log-field.test.py b/tests/gold_tests/logging/log-field.test.py
index 66cd7c7..81359f0 100644
--- a/tests/gold_tests/logging/log-field.test.py
+++ b/tests/gold_tests/logging/log-field.test.py
@@ -57,14 +57,13 @@ ts.Disk.remap_config.AddLine(
ts.Disk.logging_config.AddLines(
'''
-custom = format {
- Format = '%<{Content-Type}essh>'
-}
+formats:
+ - name: custom
+ format: '%<{Content-Type}essh>'
-log.ascii {
- Format = custom,
- Filename = 'field-test'
-}
+logs:
+ - filename: field-test
+ format: custom
'''.split("\n")
)
--
To stop receiving notification emails like this one, please contact
bcall@apache.org.
[trafficserver] 04/04: doc: Updates for the logging.config and
ssl_server_name.config yaml conversion
Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 2e8724d535e37e60bd04030c7ae161cff925a74a
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Fri Jun 1 08:09:10 2018 -0700
doc: Updates for the logging.config and ssl_server_name.config yaml conversion
This is still a WIP
(cherry picked from commit 1c189cdfb0b41130e78cf5ef18438db2fc5e18c3)
---
doc/admin-guide/files/logging.config.en.rst | 107 +++++++++----------
.../files/ssl_server_name.config.en.rst | 36 +++----
doc/admin-guide/logging/destinations.en.rst | 16 +--
doc/admin-guide/logging/examples.en.rst | 114 +++++++++++----------
doc/admin-guide/logging/formatting.en.rst | 17 +--
doc/admin-guide/logging/understanding.en.rst | 10 +-
6 files changed, 150 insertions(+), 150 deletions(-)
diff --git a/doc/admin-guide/files/logging.config.en.rst b/doc/admin-guide/files/logging.config.en.rst
index d368435..9ad9a21 100644
--- a/doc/admin-guide/files/logging.config.en.rst
+++ b/doc/admin-guide/files/logging.config.en.rst
@@ -68,20 +68,20 @@ variable. The function takes a table with two attributes: a mandatory string
optional number ``Interval`` defining the aggregation interval for summary
logs.
-.. code:: lua
+.. code:: yaml
- -- A one-line-per-event format that just prints event timestamps.
- myformat = format {
- Format = '%<cqtq>'
- }
+ # A one-line-per-event format that just prints event timestamps.
+ formats:
+ - name: myformat
+ format: '%<cqtq>'
- -- An aggregation/summary format that prints the last event timestamp from
- -- the interval along with the total count of events in the same interval.
- -- (Doing so every 30 seconds.)
- mysummaryformat = format {
- Format = '%<LAST(cqtq)> %<COUNT(*)>',
- Interval = 30
- }
+ # An aggregation/summary format that prints the last event timestamp from
+ # the interval along with the total count of events in the same interval.
+ # (Doing so every 30 seconds.)
+ formats:
+ - name: mysummaryformat
+ format: '%<LAST(cqtq)> %<COUNT(*)>'
+ interval: 30
You may define as many and as varied a collection of format objects as you
desire.
@@ -294,30 +294,29 @@ required.
=================== =========== ===============================================
Name Type Description
=================== =========== ===============================================
-Filename string The name of the logfile relative to the default
+filename string The name of the logfile relative to the default
logging directory (set with
:ts:cv:`proxy.config.log.logfile_dir`).
-Format string or Either a format object created earlier, or a
- format obj string with a valid format specification.
-Header string If present, emitted as the first line of each
+format string a string with a valid named format specification.
+header string If present, emitted as the first line of each
new log file.
-RollingEnabled *see below* Determines the type of log rolling to use (or
+rolling_enabled *see below* Determines the type of log rolling to use (or
whether to disable rolling). Overrides
:ts:cv:`proxy.config.log.rolling_enabled`.
-RollingIntervalSec number Interval in seconds between log file rolling.
+rolling_interval_sec number Interval in seconds between log file rolling.
Overrides
:ts:cv:`proxy.config.log.rolling_interval_sec`.
-RollingOffsetHr number Specifies an hour (from 0 to 23) at which log
+rolling_offset_hr number Specifies an hour (from 0 to 23) at which log
rolling is guaranteed to align. Only has an
effect if RollingIntervalSec is set to greater
than one hour. Overrides
:ts:cv:`proxy.config.log.rolling_offset_hr`.
-RollingSizeMb number Size, in megabytes, at which log files are
+rolling_size_mb number Size, in megabytes, at which log files are
rolled.
-Filters array of The optional list of filter objects which
+filters array of The optional list of filter objects which
filters restrict the individual events logged. The array
may only contain one accept filter.
-CollationHosts array of If present, one or more strings specifying the
+collation_hosts array of If present, one or more strings specifying the
strings log collation hosts to which logs should be
delivered, each in the form of "<ip>:<port>".
:ref:`admin-logging-collation` for more
@@ -325,7 +324,7 @@ CollationHosts array of If present, one or more strings specifying the
=================== =========== ===============================================
Enabling log rolling may be done globally in :file:`records.config`, or on a
-per-log basis by passing appropriate values for the ``RollingEnabled`` key. The
+per-log basis by passing appropriate values for the ``rolling_enabled`` key. The
latter method may also be used to effect different rolling settings for
individual logs. The numeric values that may be passed are the same as used by
:ts:cv:`proxy.config.log.rolling_enabled`. For convenience and readability,
@@ -355,64 +354,60 @@ Examples
The following is an example of a format that collects information using three
common fields:
-.. code:: lua
+.. code:: yaml
- minimalfmt = format {
- Format = '%<chi> : %<cqu> : %<pssc>'
- }
+ formats:
+ - name: minimalfmt
+ format: '%<chi> : %<cqu> : %<pssc>'
The following is an example of a format that uses aggregate operators to
produce a summary log:
-.. code:: lua
+.. code:: yaml
- summaryfmt = format {
- Format = '%<LAST(cqts)> : %<COUNT(*)> : %<SUM(psql)>',
- Interval = 10
- }
+ formats:
+ - name: summaryfmt
+ format: '%<LAST(cqts)> : %<COUNT(*)> : %<SUM(psql)>'
+ interval: 10
The following is an example of a filter that will cause only REFRESH_HIT events
to be logged:
-.. code:: lua
+.. code:: yaml
- refreshhitfilter = filter.accept('pssc MATCH REFRESH_HIT')
+ filters:
+ - name: refreshhitfilter
+ accept: pssc MATCH REFRESH_HIT
The following is an example of a filter that will cause the value of the first
query parameter named ``passwd`` to be wiped.
-.. code:: lua
+.. code:: yaml
- passwdfilter = filter.wipe('passwd')
+ filters:
+ - name: passwdfilter
+ wipe: passwd
The following is an example of a log specification that creates a local log
file for the minimal format defined earlier. The log filename will be
``minimal.log`` because we select the ASCII logging format.
-.. code:: lua
+.. code:: yaml
- log.ascii {
- Filename = 'minimal',
- Format = minimalfmt
- }
+ logs:
+ - mode: ascii
+ filename: minimal
+ format: minimalfmt
The following is an example of a log specification that creates a local log
file using the summary format from earlier, and only includes events that
matched the REFRESH_HIT filter we created.
-.. code:: lua
+.. code:: yaml
- log.ascii {
- Filename = 'refreshhit_summary',
- Format = summaryfmt,
- Filters = { refreshhitfilter }
- }
-
-Further Reading
-===============
-
-As the :file:`logging.config` configuration file is just a Lua script (with a
-handful of predefined functions and variables), general Lua references may be
-handy for those not already familiar with the language.
-
-* `Lua Documentation <https://www.lua.org/docs.html>`_
+ logs:
+ - mode: ascii
+ filename: refreshhit_summary
+ format: summaryfmt
+ filters:
+ - refreshhitfilter
diff --git a/doc/admin-guide/files/ssl_server_name.config.en.rst b/doc/admin-guide/files/ssl_server_name.config.en.rst
index 281edf7..7760ee0 100644
--- a/doc/admin-guide/files/ssl_server_name.config.en.rst
+++ b/doc/admin-guide/files/ssl_server_name.config.en.rst
@@ -37,11 +37,10 @@ By default this is named :file:`ssl_server_name.config`. The file can be changed
:ts:cv:`proxy.config.ssl.servername.filename`. This file is loaded on start up and by
:option:`traffic_ctl config reload` if the file has been modified since process start.
-The configuration file is Lua based. After parsing and executing the Lua code, the global Lua
-variable :code:`server_config` is examined. Its value should be a list of tables. Each table is a set
-of key / value pairs that create a configuration item. This configuration file accepts wildcard entries. To apply an SNI based
-setting on all the servernames with a common upper level domain name, the user needs to enter the fqdn in the configuration
-with a ``*.`` followed by the common domain name. (``*.yahoo.com`` for e.g.,).
+The configuration file is yaml-based. After parsing the configuration, a list of tables will be the result.
+Each table is a set of key / value pairs that create a configuration item. This configuration file accepts
+wildcard entries. To apply an SNI based setting on all the servernames with a common upper level domain name,
+the user needs to enter the fqdn in the configuration with a ``*.`` followed by the common domain name. (``*.yahoo.com`` for e.g.,).
======================= ==============================================================================
Key Meaning
@@ -108,31 +107,28 @@ Examples
Disable HTTP/2 for ``no-http2.example.com``.
-.. code-block:: lua
+.. code-block:: yaml
- server_config = {{ fqdn="no-http2.example.com", disable_h2=true }}
+ - fqdn: no-http2.example.com
+ disable_h2: true
Require client certificate verification for ``example.com`` and any server name ending with ``.yahoo.com``. Therefore, client request for a server name ending with yahoo.com (for e.g., def.yahoo.com, abc.yahoo.com etc.) will cause |TS| require and verify the client certificate. By contrast, |TS| will allow a client certficate to be provided for ``example.com`` and if it is, |TS| will require the certificate to be valid.
-.. code-block:: lua
+.. code-block:: yaml
- server_config = {
- { fqdn="example.com", verify_client='MODERATE' },
- { fqdn="*.yahoo.com", verify_client='STRICT' }
- }
+ - fqdn: example.com
+ verify_client: MODERATE
+ - fqdn: '*.yahoo.com'
+ verify_client: STRICT
Disable outbound server certificate verification for ``trusted.example.com`` and require a valid
client certificate.
-.. code-block:: lua
+.. code-block:: yaml
- server_config = {
- {
- fqdn="trusted.example.com",
- verify_origin_server='NONE',
- verify_client='STRICT'
- }
- }
+ - fqdn: trusted.example.com
+ verify_origin_server: NONE
+ verify_client: STRICT
See Also
========
diff --git a/doc/admin-guide/logging/destinations.en.rst b/doc/admin-guide/logging/destinations.en.rst
index 1cb2c44..354fb80 100644
--- a/doc/admin-guide/logging/destinations.en.rst
+++ b/doc/admin-guide/logging/destinations.en.rst
@@ -306,13 +306,15 @@ To collate custom event log files:
``CollationHosts`` attribute to the relevant logs. For example, adding two
collation hosts to an ASCII log that uses the Squid format would look like:
- .. code:: lua
-
- log.ascii {
- Format = squid,
- Filename = 'squid',
- CollationHosts = { '192.168.1.100:4567', '192.168.1.101:4567' }
- }
+ .. code:: yaml
+
+ logs:
+ - mode: ascii
+ format: squid
+ filename: squid
+ collationhosts:
+ - 192.168.1.100:4567
+ - 192.168.1.101:4567
#. Run the command :option:`traffic_ctl config reload` to restart |TS|.
diff --git a/doc/admin-guide/logging/examples.en.rst b/doc/admin-guide/logging/examples.en.rst
index 12a51bc..07474bf 100644
--- a/doc/admin-guide/logging/examples.en.rst
+++ b/doc/admin-guide/logging/examples.en.rst
@@ -68,11 +68,11 @@ No. Field Description
To recreate this as a log format in :file:`logging.config` you would define the
following format object:
-.. code:: lua
+.. code:: yaml
- common = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
- }
+ formats:
+ - name: common
+ format: '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
.. _admin-logging-examples-extended:
@@ -115,11 +115,11 @@ No. Field Description
To recreate this as a log format in :file:`logging.config` you would define the
following format object:
-.. code:: lua
+.. code:: yaml
- extended = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts>'
- }
+ formats:
+ - name: extended
+ format: '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts>'
.. _admin-logging-examples-extended2:
@@ -154,11 +154,11 @@ No. Field Description
To recreate this as a log format in :file:`logging.config` you would define the
following format object:
-.. code:: lua
+.. code:: yaml
- extended2 = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts> %<phr> %<cfsc> %<pfsc> %<crc>'
- }
+ formats:
+ - name: extended2
+ format: '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl> %<sssc> %<sscl> %<cqcl> %<pqcl> %<cqhl> %<pshl> %<pqhl> %<sshl> %<tts> %<phr> %<cfsc> %<pfsc> %<crc>'
.. _admin-logging-examples-squid:
@@ -208,11 +208,11 @@ No. Field Description
To recreate this as a log format in :file:`logging.config` you would define the
following format object:
-.. code:: lua
+.. code:: yaml
- squid = format {
- Format = '%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
- }
+ formats:
+ - name: squid
+ format: '%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
Hourly Rotated Squid Proxy Logs
===============================
@@ -221,19 +221,19 @@ The following example demonstrates the creation of a Squid-compatible log
format, which is then applied to a log object containing an hourly rotation
policy.
-.. code:: lua
+.. code:: yaml
- squid = format {
- Format = '%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
- }
+ formats:
+ - name: squid
+ format: '%<cqtq> %<ttms> %<chi> %<crc>/%<pssc> %<psql> %<cqhm> %<cquc> %<caun> %<phr>/%<pqsn> %<psct>'
- log.ascii {
- Format = squid,
- Filename = 'squid',
- RollingEnabled = 1,
- RollingIntervalSec = 3600,
- RollingOffsetHr = 0
- }
+ logs:
+ - mode: ascii
+ format: squid
+ filename: squid
+ rolling_enabled: time
+ rolling_interval_sec: 3600
+ rolling_offset_hr: 0
Summarizing Number of Requests and Total Bytes Sent Every 10 Seconds
====================================================================
@@ -243,12 +243,12 @@ contains the timestamp of the last entry of the interval, a count of the number
of entries seen within that 10-second interval, and the sum of all bytes sent
to clients:
-.. code:: lua
+.. code:: yaml
- mysummary = format {
- Format = "%<LAST(cqts)> : %<COUNT(*)> : %<SUM(psql)>",
- Interval = "10"
- }
+ formats:
+ - name: mysummary
+ format: '%<LAST(cqts)> : %<COUNT(*)> : %<SUM(psql)>'
+ interval: 10
Dual Output to Compact Binary Logs and ASCII Pipes
==================================================
@@ -258,7 +258,7 @@ a hypothetical scenario where we may wish to keep a compact form of our logs
available for archival purposes, while performing live log analysis on a stream
of the event data.
-.. code:: lua
+.. code:: yaml
ourformat = format {
Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
@@ -282,19 +282,22 @@ off all sorts of alarms. To accomplish this, we demonstrate the use of a filter
object that matches events against these particular canaries and emits log data
for them to a UNIX pipe that the alerting software can constantly read from.
-.. code:: lua
+.. code:: yaml
- canaryformat = format {
- Format = '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
- }
+ formats:
+ - name: canaryformat
+ format: '%<chi> - %<caun> [%<cqtn>] "%<cqtx>" %<pssc> %<pscl>'
- canaryfilter = filter.accept('cqup MATCH "/nightmare/scenario/dont/touch"')
+ filters:
+ - name: canaryfilter
+ accept: cqup MATCH "/nightmare/scenario/dont/touch"
- log.pipe {
- Format = canaryformat,
- Filters = [ canaryfilter ],
- Filename = 'alerting_canaries'
- }
+ logs:
+ - mode: pipe
+ format: canaryformat
+ filters:
+ - canaryfilter
+ filename: alerting_canaries
Summarizing Origin Responses by Hour
====================================
@@ -305,18 +308,21 @@ servers (where we assume that any cache result code without the string ``HIT``
in it signals origin access), as well as the average time it took to fulfill
the request to clients during that hour.
-.. code:: lua
+.. code:: yaml
- originrepformat = format {
- Format = '%<FIRST(cqtq)> %<COUNT(*)> %<AVERAGE(ttms)>',
- Interval = 3600
- }
+ formats:
+ - name: originrepformat
+ format: '%<FIRST(cqtq)> %<COUNT(*)> %<AVERAGE(ttms)>'
+ interval: 3600
- originfilter = filter.reject('crc CONTAINS "HIT"')
+ filters:
+ - name: originfilter
+ reject: crc CONTAINS "HIT"
- log.ascii {
- Format = originrepformat,
- Filters = [ originfilter ],
- Filename = 'origin_access_summary'
- }
+ logs:
+ - mode: ascii
+ format: originrepformat
+ filters:
+ - originfilter
+ filename: origin_access_summary
diff --git a/doc/admin-guide/logging/formatting.en.rst b/doc/admin-guide/logging/formatting.en.rst
index 6ac7b7f..d42640b 100644
--- a/doc/admin-guide/logging/formatting.en.rst
+++ b/doc/admin-guide/logging/formatting.en.rst
@@ -48,11 +48,12 @@ logging destinations.
A very simple exampe, which contains only the timestamp of when the event began
and the canonical URL of the request, would look like:
-.. code:: lua
+.. code:: yaml
+
+ formats:
+ - name: myformat
+ format: '%<cqtq> %<cauc>'
- myformat = format {
- Format = "%<cqtq> %<cauc>"
- }
You may include as many custom field codes as you wish. The full list of codes
available can be found in :ref:`admin-logging-fields`. You may also include
@@ -61,11 +62,11 @@ the timestamp and canonical URL in our customer format above with a slash
instead of a space, or even a slash surrounded by spaces, we could do so by
just adding the desired characters to the format string:
-.. code:: lua
+.. code:: yaml
- myformat = format {
- Format = "%<cqtq> / %<cauc>"
- }
+ formats:
+ - name: myformat
+ format: '%<cqtq> / %<cauc>'
You may define as many custom formats as you wish. To apply changes to custom
formats, you will need to run the command :option:`traffic_ctl config reload`
diff --git a/doc/admin-guide/logging/understanding.en.rst b/doc/admin-guide/logging/understanding.en.rst
index 2839ca2..0c9fcb9 100644
--- a/doc/admin-guide/logging/understanding.en.rst
+++ b/doc/admin-guide/logging/understanding.en.rst
@@ -147,12 +147,12 @@ Summary logs are defined in :file:`logging.config` just like regular event
logs, with the only two differences being the exclusive use of the
aforementioned aggregate functions and the specification of an interval, as so:
-.. code:: lua
+.. code:: yaml
- mysummary = format {
- Format = "%<operator(field)> : %<operator(field)>",
- Interval = "n"
- }
+ formats:
+ - name: mysummary
+ format: '%<operator(field)> : %<operator(field)>'
+ interval: n
The interval itself is given with *n* as the number of seconds for each period
of aggregation. There is no default value.
--
To stop receiving notification emails like this one, please contact
bcall@apache.org.
[trafficserver] 03/04: Removes luajit lib and custom Lua bindings
Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 9e4eacb1f7b58bf37204882d0c5ce6cd3525b414
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Fri May 18 10:25:18 2018 -0700
Removes luajit lib and custom Lua bindings
(cherry picked from commit b0c16535a7196ba6d9edd6525ff50413e901c9d1)
---
CMakeLists.txt | 154 +-
NOTICE | 5 -
ci/jenkins/bin/clang-analyzer.sh | 8 -
ci/rat-regex.txt | 1 -
configure.ac | 47 +-
iocore/net/Makefile.am | 2 -
lib/Makefile.am | 33 +-
lib/bindings/Makefile.am | 38 -
lib/bindings/bindings.cc | 317 --
lib/bindings/bindings.h | 73 -
lib/bindings/lua.cc | 100 -
lib/bindings/lua.h | 101 -
lib/bindings/repl.cc | 60 -
lib/bindings/repl.h | 27 -
lib/luajit/.gitignore | 11 -
lib/luajit/COPYRIGHT | 56 -
lib/luajit/Makefile | 151 -
lib/luajit/README | 16 -
lib/luajit/doc/bluequad-print.css | 166 -
lib/luajit/doc/bluequad.css | 325 --
lib/luajit/doc/changes.html | 978 -----
lib/luajit/doc/contact.html | 102 -
lib/luajit/doc/ext_c_api.html | 187 -
lib/luajit/doc/ext_ffi.html | 330 --
lib/luajit/doc/ext_ffi_api.html | 566 ---
lib/luajit/doc/ext_ffi_semantics.html | 1245 ------
lib/luajit/doc/ext_ffi_tutorial.html | 601 ---
lib/luajit/doc/ext_jit.html | 199 -
lib/luajit/doc/extensions.html | 408 --
lib/luajit/doc/faq.html | 184 -
lib/luajit/doc/img/contact.png | Bin 1340 -> 0 bytes
lib/luajit/doc/install.html | 646 ---
lib/luajit/doc/luajit.html | 234 -
lib/luajit/doc/running.html | 306 --
lib/luajit/doc/status.html | 116 -
lib/luajit/dynasm/dasm_arm.h | 456 --
lib/luajit/dynasm/dasm_arm.lua | 1125 -----
lib/luajit/dynasm/dasm_mips.h | 416 --
lib/luajit/dynasm/dasm_mips.lua | 953 ----
lib/luajit/dynasm/dasm_ppc.h | 412 --
lib/luajit/dynasm/dasm_ppc.lua | 1249 ------
lib/luajit/dynasm/dasm_proto.h | 83 -
lib/luajit/dynasm/dasm_x64.lua | 12 -
lib/luajit/dynasm/dasm_x86.h | 472 --
lib/luajit/dynasm/dasm_x86.lua | 1945 ---------
lib/luajit/dynasm/dynasm.lua | 1094 -----
lib/luajit/etc/luajit.1 | 88 -
lib/luajit/etc/luajit.pc | 25 -
lib/luajit/src/.gitignore | 7 -
lib/luajit/src/Makefile | 684 ---
lib/luajit/src/Makefile.dep | 226 -
lib/luajit/src/host/.gitignore | 3 -
lib/luajit/src/host/README | 4 -
lib/luajit/src/host/buildvm.c | 516 ---
lib/luajit/src/host/buildvm.h | 104 -
lib/luajit/src/host/buildvm_asm.c | 313 --
lib/luajit/src/host/buildvm_fold.c | 229 -
lib/luajit/src/host/buildvm_lib.c | 398 --
lib/luajit/src/host/buildvm_peobj.c | 368 --
lib/luajit/src/host/genminilua.lua | 428 --
lib/luajit/src/host/minilua.c | 7770 ---------------------------------
lib/luajit/src/jit/.gitignore | 1 -
lib/luajit/src/jit/bc.lua | 191 -
lib/luajit/src/jit/bcsave.lua | 659 ---
lib/luajit/src/jit/dis_arm.lua | 689 ---
lib/luajit/src/jit/dis_mips.lua | 428 --
lib/luajit/src/jit/dis_mipsel.lua | 20 -
lib/luajit/src/jit/dis_ppc.lua | 591 ---
lib/luajit/src/jit/dis_x64.lua | 20 -
lib/luajit/src/jit/dis_x86.lua | 836 ----
lib/luajit/src/jit/dump.lua | 699 ---
lib/luajit/src/jit/v.lua | 167 -
lib/luajit/src/lauxlib.h | 167 -
lib/luajit/src/lib_aux.c | 356 --
lib/luajit/src/lib_base.c | 683 ---
lib/luajit/src/lib_bit.c | 74 -
lib/luajit/src/lib_debug.c | 405 --
lib/luajit/src/lib_ffi.c | 851 ----
lib/luajit/src/lib_init.c | 55 -
lib/luajit/src/lib_io.c | 539 ---
lib/luajit/src/lib_jit.c | 663 ---
lib/luajit/src/lib_math.c | 233 -
lib/luajit/src/lib_os.c | 287 --
lib/luajit/src/lib_package.c | 602 ---
lib/luajit/src/lib_string.c | 940 ----
lib/luajit/src/lib_table.c | 300 --
lib/luajit/src/lj.supp | 26 -
lib/luajit/src/lj_alloc.c | 1396 ------
lib/luajit/src/lj_alloc.h | 17 -
lib/luajit/src/lj_api.c | 1200 -----
lib/luajit/src/lj_arch.h | 437 --
lib/luajit/src/lj_asm.c | 1920 --------
lib/luajit/src/lj_asm.h | 17 -
lib/luajit/src/lj_asm_arm.h | 2361 ----------
lib/luajit/src/lj_asm_mips.h | 1977 ---------
lib/luajit/src/lj_asm_ppc.h | 2169 ---------
lib/luajit/src/lj_asm_x86.h | 2806 ------------
lib/luajit/src/lj_bc.c | 14 -
lib/luajit/src/lj_bc.h | 261 --
lib/luajit/src/lj_bcdump.h | 66 -
lib/luajit/src/lj_bcread.c | 476 --
lib/luajit/src/lj_bcwrite.c | 396 --
lib/luajit/src/lj_carith.c | 353 --
lib/luajit/src/lj_carith.h | 27 -
lib/luajit/src/lj_ccall.c | 900 ----
lib/luajit/src/lj_ccall.h | 171 -
lib/luajit/src/lj_ccallback.c | 644 ---
lib/luajit/src/lj_ccallback.h | 25 -
lib/luajit/src/lj_cconv.c | 752 ----
lib/luajit/src/lj_cconv.h | 70 -
lib/luajit/src/lj_cdata.c | 285 --
lib/luajit/src/lj_cdata.h | 75 -
lib/luajit/src/lj_char.c | 43 -
lib/luajit/src/lj_char.h | 42 -
lib/luajit/src/lj_clib.c | 409 --
lib/luajit/src/lj_clib.h | 29 -
lib/luajit/src/lj_cparse.c | 1877 --------
lib/luajit/src/lj_cparse.h | 65 -
lib/luajit/src/lj_crecord.c | 1671 -------
lib/luajit/src/lj_crecord.h | 31 -
lib/luajit/src/lj_ctype.c | 634 ---
lib/luajit/src/lj_ctype.h | 461 --
lib/luajit/src/lj_debug.c | 605 ---
lib/luajit/src/lj_debug.h | 61 -
lib/luajit/src/lj_def.h | 353 --
lib/luajit/src/lj_dispatch.c | 494 ---
lib/luajit/src/lj_dispatch.h | 131 -
lib/luajit/src/lj_emit_arm.h | 356 --
lib/luajit/src/lj_emit_mips.h | 211 -
lib/luajit/src/lj_emit_ppc.h | 238 -
lib/luajit/src/lj_emit_x86.h | 466 --
lib/luajit/src/lj_err.c | 800 ----
lib/luajit/src/lj_err.h | 41 -
lib/luajit/src/lj_errmsg.h | 193 -
lib/luajit/src/lj_ff.h | 18 -
lib/luajit/src/lj_ffrecord.c | 888 ----
lib/luajit/src/lj_ffrecord.h | 24 -
lib/luajit/src/lj_frame.h | 183 -
lib/luajit/src/lj_func.c | 185 -
lib/luajit/src/lj_func.h | 24 -
lib/luajit/src/lj_gc.c | 849 ----
lib/luajit/src/lj_gc.h | 134 -
lib/luajit/src/lj_gdbjit.c | 795 ----
lib/luajit/src/lj_gdbjit.h | 22 -
lib/luajit/src/lj_ir.c | 501 ---
lib/luajit/src/lj_ir.h | 551 ---
lib/luajit/src/lj_ircall.h | 277 --
lib/luajit/src/lj_iropt.h | 161 -
lib/luajit/src/lj_jit.h | 417 --
lib/luajit/src/lj_lex.c | 482 --
lib/luajit/src/lj_lex.h | 85 -
lib/luajit/src/lj_lib.c | 258 --
lib/luajit/src/lj_lib.h | 112 -
lib/luajit/src/lj_load.c | 168 -
lib/luajit/src/lj_mcode.c | 386 --
lib/luajit/src/lj_mcode.h | 30 -
lib/luajit/src/lj_meta.c | 466 --
lib/luajit/src/lj_meta.h | 37 -
lib/luajit/src/lj_obj.c | 35 -
lib/luajit/src/lj_obj.h | 856 ----
lib/luajit/src/lj_opt_dce.c | 78 -
lib/luajit/src/lj_opt_fold.c | 2304 ----------
lib/luajit/src/lj_opt_loop.c | 436 --
lib/luajit/src/lj_opt_mem.c | 916 ----
lib/luajit/src/lj_opt_narrow.c | 656 ---
lib/luajit/src/lj_opt_sink.c | 245 --
lib/luajit/src/lj_opt_split.c | 731 ----
lib/luajit/src/lj_parse.c | 2754 ------------
lib/luajit/src/lj_parse.h | 18 -
lib/luajit/src/lj_record.c | 2252 ----------
lib/luajit/src/lj_record.h | 44 -
lib/luajit/src/lj_snap.c | 866 ----
lib/luajit/src/lj_snap.h | 34 -
lib/luajit/src/lj_state.c | 287 --
lib/luajit/src/lj_state.h | 35 -
lib/luajit/src/lj_str.c | 339 --
lib/luajit/src/lj_str.h | 50 -
lib/luajit/src/lj_strscan.c | 498 ---
lib/luajit/src/lj_strscan.h | 39 -
lib/luajit/src/lj_tab.c | 631 ---
lib/luajit/src/lj_tab.h | 70 -
lib/luajit/src/lj_target.h | 162 -
lib/luajit/src/lj_target_arm.h | 274 --
lib/luajit/src/lj_target_mips.h | 257 --
lib/luajit/src/lj_target_ppc.h | 280 --
lib/luajit/src/lj_target_x86.h | 342 --
lib/luajit/src/lj_trace.c | 816 ----
lib/luajit/src/lj_trace.h | 53 -
lib/luajit/src/lj_traceerr.h | 61 -
lib/luajit/src/lj_udata.c | 34 -
lib/luajit/src/lj_udata.h | 14 -
lib/luajit/src/lj_vm.h | 116 -
lib/luajit/src/lj_vmevent.c | 57 -
lib/luajit/src/lj_vmevent.h | 59 -
lib/luajit/src/lj_vmmath.c | 140 -
lib/luajit/src/ljamalg.c | 93 -
lib/luajit/src/lua.h | 393 --
lib/luajit/src/lua.hpp | 9 -
lib/luajit/src/luaconf.h | 156 -
lib/luajit/src/luajit.c | 571 ---
lib/luajit/src/luajit.h | 70 -
lib/luajit/src/lualib.h | 43 -
lib/luajit/src/msvcbuild.bat | 113 -
lib/luajit/src/ps4build.bat | 103 -
lib/luajit/src/psvitabuild.bat | 93 -
lib/luajit/src/vm_arm.dasc | 4486 -------------------
lib/luajit/src/vm_mips.dasc | 4241 ------------------
lib/luajit/src/vm_ppc.dasc | 5160 ----------------------
lib/luajit/src/vm_ppcspe.dasc | 3691 ----------------
lib/luajit/src/vm_x86.dasc | 6377 ---------------------------
lib/luajit/src/xedkbuild.bat | 92 -
lib/tsconfig/Makefile.am | 4 +-
lib/tsconfig/TsConfigLua.cc | 53 -
lib/tsconfig/TsConfigLua.h | 184 -
plugins/Makefile.am | 2 +
proxy/Makefile.am | 5 -
proxy/logging/LogBindings.cc | 509 ---
proxy/logging/LogBindings.h | 30 -
proxy/logging/LogConfig.cc | 1 -
proxy/logging/Makefile.am | 7 -
src/traffic_logcat/Makefile.inc | 13 +-
src/traffic_logstats/Makefile.inc | 12 +-
src/traffic_manager/Makefile.inc | 27 +-
src/traffic_server/Makefile.inc | 16 -
src/traffic_wccp/Makefile.inc | 1 -
225 files changed, 26 insertions(+), 116102 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c92624a..f88c463 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,7 @@ include_directories(lib
mgmt/api
mgmt/utils
mgmt/api/include
- proxy/api
- lib/luajit/src)
+ proxy/api)
add_executable(traffic_crashlog
src/traffic_crashlog/procinfo.cc
@@ -353,12 +352,6 @@ add_executable(ats
iocore/utils/Machine.cc
iocore/utils/OneWayMultiTunnel.cc
iocore/utils/OneWayTunnel.cc
- lib/bindings/bindings.cc
- lib/bindings/bindings.h
- lib/bindings/lua.cc
- lib/bindings/lua.h
- lib/bindings/repl.cc
- lib/bindings/repl.h
lib/cppapi/include/atscppapi/Async.h
lib/cppapi/include/atscppapi/AsyncHttpFetch.h
lib/cppapi/include/atscppapi/AsyncTimer.h
@@ -410,147 +403,6 @@ add_executable(ats
lib/cppapi/Url.cc
lib/cppapi/utils.cc
lib/cppapi/utils_internal.cc
- lib/luajit/dynasm/dasm_arm.h
- lib/luajit/dynasm/dasm_mips.h
- lib/luajit/dynasm/dasm_ppc.h
- lib/luajit/dynasm/dasm_proto.h
- lib/luajit/dynasm/dasm_x86.h
- lib/luajit/src/host/buildvm.c
- lib/luajit/src/host/buildvm.h
- lib/luajit/src/host/buildvm_asm.c
- lib/luajit/src/host/buildvm_fold.c
- lib/luajit/src/host/buildvm_lib.c
- lib/luajit/src/host/buildvm_peobj.c
- lib/luajit/src/host/minilua.c
- lib/luajit/src/lauxlib.h
- lib/luajit/src/lib_aux.c
- lib/luajit/src/lib_base.c
- lib/luajit/src/lib_bit.c
- lib/luajit/src/lib_debug.c
- lib/luajit/src/lib_ffi.c
- lib/luajit/src/lib_init.c
- lib/luajit/src/lib_io.c
- lib/luajit/src/lib_jit.c
- lib/luajit/src/lib_math.c
- lib/luajit/src/lib_os.c
- lib/luajit/src/lib_package.c
- lib/luajit/src/lib_string.c
- lib/luajit/src/lib_table.c
- lib/luajit/src/lj_alloc.c
- lib/luajit/src/lj_alloc.h
- lib/luajit/src/lj_api.c
- lib/luajit/src/lj_arch.h
- lib/luajit/src/lj_asm.c
- lib/luajit/src/lj_asm.h
- lib/luajit/src/lj_asm_arm.h
- lib/luajit/src/lj_asm_mips.h
- lib/luajit/src/lj_asm_ppc.h
- lib/luajit/src/lj_asm_x86.h
- lib/luajit/src/lj_bc.c
- lib/luajit/src/lj_bc.h
- lib/luajit/src/lj_bcdump.h
- lib/luajit/src/lj_bcread.c
- lib/luajit/src/lj_bcwrite.c
- lib/luajit/src/lj_carith.c
- lib/luajit/src/lj_carith.h
- lib/luajit/src/lj_ccall.c
- lib/luajit/src/lj_ccall.h
- lib/luajit/src/lj_ccallback.c
- lib/luajit/src/lj_ccallback.h
- lib/luajit/src/lj_cconv.c
- lib/luajit/src/lj_cconv.h
- lib/luajit/src/lj_cdata.c
- lib/luajit/src/lj_cdata.h
- lib/luajit/src/lj_char.c
- lib/luajit/src/lj_char.h
- lib/luajit/src/lj_clib.c
- lib/luajit/src/lj_clib.h
- lib/luajit/src/lj_cparse.c
- lib/luajit/src/lj_cparse.h
- lib/luajit/src/lj_crecord.c
- lib/luajit/src/lj_crecord.h
- lib/luajit/src/lj_ctype.c
- lib/luajit/src/lj_ctype.h
- lib/luajit/src/lj_debug.c
- lib/luajit/src/lj_debug.h
- lib/luajit/src/lj_def.h
- lib/luajit/src/lj_dispatch.c
- lib/luajit/src/lj_dispatch.h
- lib/luajit/src/lj_emit_arm.h
- lib/luajit/src/lj_emit_mips.h
- lib/luajit/src/lj_emit_ppc.h
- lib/luajit/src/lj_emit_x86.h
- lib/luajit/src/lj_err.c
- lib/luajit/src/lj_err.h
- lib/luajit/src/lj_errmsg.h
- lib/luajit/src/lj_ff.h
- lib/luajit/src/lj_ffrecord.c
- lib/luajit/src/lj_ffrecord.h
- lib/luajit/src/lj_frame.h
- lib/luajit/src/lj_func.c
- lib/luajit/src/lj_func.h
- lib/luajit/src/lj_gc.c
- lib/luajit/src/lj_gc.h
- lib/luajit/src/lj_gdbjit.c
- lib/luajit/src/lj_gdbjit.h
- lib/luajit/src/lj_ir.c
- lib/luajit/src/lj_ir.h
- lib/luajit/src/lj_ircall.h
- lib/luajit/src/lj_iropt.h
- lib/luajit/src/lj_jit.h
- lib/luajit/src/lj_lex.c
- lib/luajit/src/lj_lex.h
- lib/luajit/src/lj_lib.c
- lib/luajit/src/lj_lib.h
- lib/luajit/src/lj_load.c
- lib/luajit/src/lj_mcode.c
- lib/luajit/src/lj_mcode.h
- lib/luajit/src/lj_meta.c
- lib/luajit/src/lj_meta.h
- lib/luajit/src/lj_obj.c
- lib/luajit/src/lj_obj.h
- lib/luajit/src/lj_opt_dce.c
- lib/luajit/src/lj_opt_fold.c
- lib/luajit/src/lj_opt_loop.c
- lib/luajit/src/lj_opt_mem.c
- lib/luajit/src/lj_opt_narrow.c
- lib/luajit/src/lj_opt_sink.c
- lib/luajit/src/lj_opt_split.c
- lib/luajit/src/lj_parse.c
- lib/luajit/src/lj_parse.h
- lib/luajit/src/lj_record.c
- lib/luajit/src/lj_record.h
- lib/luajit/src/lj_snap.c
- lib/luajit/src/lj_snap.h
- lib/luajit/src/lj_state.c
- lib/luajit/src/lj_state.h
- lib/luajit/src/lj_str.c
- lib/luajit/src/lj_str.h
- lib/luajit/src/lj_strscan.c
- lib/luajit/src/lj_strscan.h
- lib/luajit/src/lj_tab.c
- lib/luajit/src/lj_tab.h
- lib/luajit/src/lj_target.h
- lib/luajit/src/lj_target_arm.h
- lib/luajit/src/lj_target_mips.h
- lib/luajit/src/lj_target_ppc.h
- lib/luajit/src/lj_target_x86.h
- lib/luajit/src/lj_trace.c
- lib/luajit/src/lj_trace.h
- lib/luajit/src/lj_traceerr.h
- lib/luajit/src/lj_udata.c
- lib/luajit/src/lj_udata.h
- lib/luajit/src/lj_vm.h
- lib/luajit/src/lj_vmevent.c
- lib/luajit/src/lj_vmevent.h
- lib/luajit/src/lj_vmmath.c
- lib/luajit/src/ljamalg.c
- lib/luajit/src/lua.h
- lib/luajit/src/lua.hpp
- lib/luajit/src/luaconf.h
- lib/luajit/src/luajit.c
- lib/luajit/src/luajit.h
- lib/luajit/src/lualib.h
lib/records/I_RecAlarms.h
lib/records/I_RecCore.h
lib/records/I_RecDefs.h
@@ -1031,8 +883,6 @@ add_executable(ats
proxy/logging/LogAccessHttp.h
proxy/logging/LogAccessTest.cc
proxy/logging/LogAccessTest.h
- proxy/logging/LogBindings.cc
- proxy/logging/LogBindings.h
proxy/logging/LogBuffer.cc
proxy/logging/LogBuffer.h
proxy/logging/LogBufferSink.h
@@ -1367,8 +1217,6 @@ add_library(libtsconfig SHARED
lib/tsconfig/TsConfigGrammar.c
lib/tsconfig/TsConfigGrammar.h
lib/tsconfig/TsConfigLexer.h
- lib/tsconfig/TsConfigLua.cc
- lib/tsconfig/TsConfigLua.h
lib/tsconfig/TsConfigParseEvents.h
lib/tsconfig/TsConfigSyntax.c
lib/tsconfig/TsConfigTypes.h
diff --git a/NOTICE b/NOTICE
index 57abb87..4e3f05d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -55,11 +55,6 @@ Copyright (C) 2014 Comcast
~~~
-LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
-Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-
-~~~
-
collapsed_collapsing: Plugin for connection collapsing to origin
Copyright (C) 2014 Yahoo! Inc. All rights reserved.
diff --git a/ci/jenkins/bin/clang-analyzer.sh b/ci/jenkins/bin/clang-analyzer.sh
index 4190011..471d31f 100755
--- a/ci/jenkins/bin/clang-analyzer.sh
+++ b/ci/jenkins/bin/clang-analyzer.sh
@@ -16,10 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This disables LuaJIT for now, to avoid all the warnings from it. Maybe we need
-# to talk to the author of it, or ideally, figure out how to get clang-analyzer to
-# ignore them ?
-
# Where are our LLVM tools?
LLVM_BASE=${LLVM:-/opt/llvm}
NPROCS=${NPROCS:-$(getconf _NPROCESSORS_ONLN)}
@@ -79,10 +75,6 @@ ${LLVM_BASE}/bin/scan-build ./configure ${configure} \
CXXFLAGS="-stdlib=libc++ -I${LLVM_BASE}/include/c++/v1 -std=c++17" \
LDFLAGS="-L${LLVM_BASE}/lib64 -Wl,-rpath=${LLVM_BASE}/lib64"
-# Since we don't want the analyzer to look at LuaJIT, build it first
-# without scan-build. The subsequent make will then skip it.
-${ATS_MAKE} -j $NPROCS -C lib all-local V=1 Q=
-
${LLVM_BASE}/bin/scan-build ${checkers} ${options} -o ${output} \
--html-title="clang-analyzer: ${ATS_BRANCH}${github_pr}" \
${ATS_MAKE} -j $NPROCS V=1 Q=
diff --git a/ci/rat-regex.txt b/ci/rat-regex.txt
index 3dc3691..3c8401a 100644
--- a/ci/rat-regex.txt
+++ b/ci/rat-regex.txt
@@ -58,7 +58,6 @@ port\.h
^HashFNV.cc$
^HashSip.cc$
^TsConfigGrammar[.][ch]$
-^luajit$
^.*crt$
^.*key$
^protocol_binary.h$
diff --git a/configure.ac b/configure.ac
index e3908ba..df18d2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -349,16 +349,15 @@ AC_ARG_WITH([profiler],
AC_MSG_RESULT([$with_profiler])
# System luajit
-AC_MSG_CHECKING([whether to enable system luajit])
-AC_ARG_ENABLE([system-luajit],
- [AS_HELP_STRING([--enable-system-luajit],[enable support for system-installed luajit])],
- [enable_system_luajit=yes],
- [enable_system_luajit=no]
+AC_MSG_CHECKING([whether to enable luajit])
+AC_ARG_ENABLE([luajit],
+ [AS_HELP_STRING([--enable-luajit],[enable support for system-installed luajit])],
+ [enable_luajit=yes],
+ [enable_luajit=no]
)
-AC_MSG_RESULT([$enable_system_luajit])
-TS_ARG_ENABLE_VAR([has],[system_luajit])
-AM_CONDITIONAL([BUILD_LUAJIT], [test 0 -eq $has_system_luajit])
-AM_CONDITIONAL([SYSTEM_LUAJIT], [test 0 -ne $has_system_luajit])
+AC_MSG_RESULT([$enable_luajit])
+TS_ARG_ENABLE_VAR([has],[luajit])
+AM_CONDITIONAL([HAS_LUAJIT], [test 0 -ne $has_luajit])
# Disable all static library builds
@@ -851,7 +850,6 @@ case $host_os_def in
debug_opt="-ggdb3 $common_opt -Qunused-arguments"
release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing -Qunused-arguments"
cxx_opt="-Wno-invalid-offsetof"
- luajit_cflags="-Wno-parentheses-equality -Wno-tautological-compare -analyzer-disable-all-checks -Wno-varargs"
])
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
@@ -875,7 +873,6 @@ case $host_os_def in
debug_opt="-g $common_opt"
release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing"
cxx_opt="-Wno-invalid-offsetof"
- luajit_cflags="-Wno-parentheses-equality -Wno-tautological-compare -Wno-varargs"
], [
AC_MSG_WARN([clang is the only supported compiler on Darwin])
])
@@ -896,7 +893,6 @@ case $host_os_def in
debug_opt="-ggdb3 $common_opt"
release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing"
cxx_opt="-Wno-invalid-offsetof"
- luajit_cflags="-Wno-parentheses-equality -Wno-tautological-compare -Wno-varargs"
])
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
@@ -1236,7 +1232,7 @@ TS_CHECK_LZMA
# System LuaJIT
#
-if test "x$enable_system_luajit" == "xyes"; then
+if test "x$enable_luajit" == "xyes"; then
saveLIBS=$LIBS
LIBS=""
AC_CHECK_HEADER(lua.h, [],
@@ -1247,7 +1243,14 @@ if test "x$enable_system_luajit" == "xyes"; then
PKG_CHECK_MODULES([LUAJIT], [luajit < 2.1.0, luajit >= 2.0.0], [
AC_SUBST([LIBLUAJIT], [$LUAJIT_LIBS])
TS_ADDTO(AM_CPPFLAGS, [$LUAJIT_CFLAGS])
- ], [AC_MSG_ERROR([*** system luajit requested but either libluajit-5.1 or lua.h cannot be found ***])])
+ # On Darwin LuaJIT requires magic link options, otherwise it will crash in luaL_openlibs() at startup. See
+ # http://luajit.org/install.html.
+ case $host_os_def in
+ darwin)
+ LUAJIT_LDFLAGS="-Wl,-pagezero_size,10000 -Wl,-image_base,100000000"
+ ;;
+ esac
+ ], [AC_MSG_ERROR([*** luajit requested but either libluajit-5.1 or lua.h cannot be found ***])])
else
AC_SUBST([LIBLUAJIT], [$LIBS])
fi
@@ -1612,18 +1615,6 @@ TS_CHECK_TCMALLOC
# Check for libreadline/libedit
AX_LIB_READLINE
-# On Darwin LuaJIT requires magic link options, otherwise it will crash in luaL_openlibs() at startup. See
-# http://luajit.org/install.html.
-case $host_os_def in
- darwin)
- LUAJIT_LDFLAGS="-Wl,-pagezero_size,10000 -Wl,-image_base,100000000"
- ;;
-esac
-
-# Flags for building and linking against our internal copy of LuaJIT.
-AC_SUBST([LUAJIT_LDFLAGS])
-AC_SUBST([LUAJIT_CPPFLAGS], ['-I$(abs_top_srcdir)/lib/luajit/src'])
-
# We should be able to build http_load if epoll(2) is available.
AM_CONDITIONAL([BUILD_HTTP_LOAD], [test x"$ac_cv_func_epoll_ctl" = x"yes"])
@@ -2047,7 +2038,6 @@ AC_CONFIG_FILES([
iocore/utils/Makefile
lib/Makefile
lib/cppapi/Makefile
- lib/bindings/Makefile
lib/perl/Makefile
lib/perl/lib/Apache/TS.pm
lib/records/Makefile
@@ -2106,7 +2096,4 @@ AC_MSG_NOTICE([Build option summary:
TS_INCLUDES: $TS_INCLUDES
OPENSSL_LDFLAGS: $OPENSSL_LDFLAGS
OPENSSL_INCLUDES: $OPENSSL_INCLUDES
- LUAJIT_CFLAGS: $LUAJIT_CFLAGS
- LUAJIT_CPPFLAGS: $LUAJIT_CPPFLAGS
- LUAJIT_LDFLAGS: $LUAJIT_LDFLAGS
])
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index ee66ec6..825ec46 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -52,7 +52,6 @@ test_certlookup_LDADD = \
test_UDPNet_CPPFLAGS = \
$(AM_CPPFLAGS) \
- $(LUAJIT_CPPFLAGS) \
$(iocore_include_dirs) \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/hdrs \
@@ -163,7 +162,6 @@ libinknet_a_SOURCES += \
endif
libinknet_a_LIBADD = \
- $(top_builddir)/lib/luajit/src/libluajit.a \
$(top_builddir)/lib/tsconfig/libtsconfig.la
include $(top_srcdir)/build/tidy.mk
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5af2b38..c07ab92 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SUBDIRS = ts records . tsconfig bindings cppapi
+SUBDIRS = ts records . tsconfig cppapi
if BUILD_PERL_LIB
SUBDIRS += perl
@@ -28,43 +28,12 @@ endif
LOCAL =
-if BUILD_LUAJIT
-LOCAL += all-luajit
-endif
-
if BUILD_YAML_CPP
LOCAL += yamlcpp
endif
-# Support verbose LuaJIT builds with "make V=1".
-luajit__v_ = $(luajit__v_$(AM_DEFAULT_VERBOSITY))
-luajit__v_0 = @
-luajit__v_1 =
-
-# Some special hacks around building the luajit.
-#
-# - Copy the luajit source tree if we're doing out-of-source builds
-# - Upon clean, remove the luajit tree from the out-of-source build tree
-#
-# Note: The LUAJIT_LDFLAGS is a bit of a hack, since LuaJIT on OmniOS needs
-# the -m64 flag. See configure.ac.
-#
all-local: $(LOCAL)
-
-all-luajit:
- @echo "Making all in luajit"
- test -d "$(top_builddir)/$(subdir)/luajit/src" || cp -rf "$(srcdir)/luajit" "$(top_builddir)/$(subdir)/"
- cd luajit && $(MAKE) $(AM_MAKEFLAGS) \
- BUILDMODE="static" \
- PREFIX="$(prefix)" \
- CC="$(CC)" \
- CFLAGS="$(LUAJIT_CFLAGS)" \
- XCFLAGS="" \
- LDFLAGS="$(LUAJIT_LDFLAGS)" \
- Q=$(luajit__v_$(V))
$(MAKE) -C yamlcpp
clean-local:
- test "$(top_srcdir)" != "$(top_builddir)" || (cd "$(top_builddir)/$(subdir)/luajit" && $(MAKE) CC="$(CC)" clean)
- test "$(top_srcdir)" = "$(top_builddir)" || rm -rf "$(top_builddir)/$(subdir)/luajit"
$(MAKE) -C yamlcpp clean
diff --git a/lib/bindings/Makefile.am b/lib/bindings/Makefile.am
deleted file mode 100644
index eef61e3..0000000
--- a/lib/bindings/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-# Makefile.am
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include $(top_srcdir)/build/tidy.mk
-
-AM_CPPFLAGS += \
- $(LUAJIT_CPPFLAGS) \
- -I$(abs_top_srcdir)/lib \
- -I$(abs_top_srcdir)/lib/records \
- $(TS_INCLUDES)
-
-noinst_LTLIBRARIES = libbindings.la
-
-libbindings_la_SOURCES = \
- bindings.cc \
- bindings.h \
- lua.cc \
- lua.h \
- repl.cc \
- repl.h
-
-clang-tidy-local: $(DIST_SOURCES)
- $(CXX_Clang_Tidy)
diff --git a/lib/bindings/bindings.cc b/lib/bindings/bindings.cc
deleted file mode 100644
index cde72e3..0000000
--- a/lib/bindings/bindings.cc
+++ /dev/null
@@ -1,317 +0,0 @@
-/** @file
- *
- * A brief file description
- *
- * @section license License
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "bindings.h"
-#include "ts/Diags.h"
-
-static const char selfkey[] = "bb3ecc8d-de6b-4f48-9aca-b3a3f14bdbad";
-
-static bool
-is_indexable(lua_State *L, int index)
-{
- return lua_istable(L, index) || lua_isuserdata(L, index);
-}
-
-BindingInstance::BindingInstance() : lua(nullptr) {}
-
-BindingInstance::~BindingInstance()
-{
- if (this->lua) {
- lua_close(this->lua);
- }
-}
-
-void
-BindingInstance::attach_ptr(const char *name, void *ptr)
-{
- this->attachments[name] = ptr;
-}
-
-void *
-BindingInstance::retrieve_ptr(const char *name)
-{
- auto ptr = this->attachments.find(name);
- return (ptr == this->attachments.end()) ? nullptr : ptr->second;
-}
-
-bool
-BindingInstance::bind_constant(const char *name, lua_Integer value)
-{
- bool bound;
-
- lua_pushinteger(this->lua, value);
- bound = this->bind_value(name, -1);
- lua_pop(this->lua, 1);
-
- return bound;
-}
-
-bool
-BindingInstance::bind_constant(const char *name, const char *value)
-{
- bool bound;
-
- lua_pushlstring(this->lua, value, strlen(value));
- bound = this->bind_value(name, -1);
- lua_pop(this->lua, 1);
-
- return bound;
-}
-
-bool
-BindingInstance::bind_function(const char *name, int (*value)(lua_State *))
-{
- bool bound;
-
- lua_pushcfunction(this->lua, value);
- bound = this->bind_value(name, -1);
- lua_pop(this->lua, 1);
-
- return bound;
-}
-
-// Bind an arbitrary Lua value from the give stack position.
-bool
-BindingInstance::bind_value(const char *name, int value)
-{
- const char *start = name;
- const char *end = name;
-
- int depth = 0;
-
- // Make the value an absolute stack inde because we are going to
- // invalidate relative indices.
- value = lua_absolute_index(this->lua, value);
-
- // XXX extract this code so that we can using it for binding constants
- // into an arbitrary table path ...
- Debug("lua", "binding %s value at %d to %s", luaL_typename(this->lua, value), value, name);
-
- for (; (end = ::strchr(start, '.')); start = end + 1) {
- std::string name(start, end);
-
- Debug("lua", "checking for table '%s'", name.c_str());
- if (depth == 0) {
- lua_getglobal(this->lua, name.c_str());
- if (lua_isnil(this->lua, -1)) {
- // No table with this name, construct one.
- Debug("lua", "creating global table '%s'", name.c_str());
-
- lua_pop(this->lua, 1); // Pop the nil.
- lua_newtable(this->lua);
- lua_setglobal(this->lua, name.c_str());
- lua_getglobal(this->lua, name.c_str());
-
- // Top of stack MUST be a table now.
- ink_assert(lua_istable(this->lua, -1));
- }
-
- ink_assert(is_indexable(this->lua, -1));
- } else {
- ink_assert(is_indexable(this->lua, -1));
-
- Debug("lua", "checking for table key '%s'", name.c_str());
-
- // Push the string key.
- lua_pushlstring(this->lua, &name[0], name.size());
- // Get the table entry (now on top of the stack).
- lua_gettable(this->lua, -2);
-
- if (lua_isnil(this->lua, -1)) {
- Debug("lua", "creating table key '%s'", name.c_str());
-
- lua_pop(this->lua, 1); // Pop the nil.
- lua_pushlstring(this->lua, &name[0], name.size());
- lua_newtable(this->lua);
-
- // Set the table entry. The stack now looks like:
- // -1 value (the new table)
- // -2 index (string)
- // -3 target (the table to add the index to)
- lua_settable(this->lua, -3);
-
- // Get the table entry we just created.
- lua_pushlstring(this->lua, &name[0], name.size());
- lua_gettable(this->lua, -2);
-
- // Top of stack MUST be a table now.
- ink_assert(lua_istable(this->lua, -1));
- }
-
- // The new entry is on top of the stack.
- ink_assert(is_indexable(this->lua, -1));
- }
-
- ++depth;
- }
-
- Debug("lua", "stack depth is %d (expected %d)", lua_gettop(this->lua), depth);
- Debug("lua", "last name token is '%s'", start);
-
- // If we pushed a series of tables onto the stack, bind the name to a table
- // entry. otherwise bind it as a global name.
- if (depth) {
- // At this point the top of stack should be something indexable.
- ink_assert(is_indexable(this->lua, -1));
-
- Debug("lua", "stack depth is %d (expected %d)", lua_gettop(this->lua), depth);
-
- lua_pushstring(this->lua, start);
- lua_pushvalue(this->lua, value);
- lua_settable(this->lua, -3);
-
- Debug("lua", "stack depth is %d (expected %d)", lua_gettop(this->lua), depth);
- lua_pop(this->lua, depth);
- } else {
- // Always push the value so we can get the update
- lua_pushvalue(this->lua, value);
- lua_setglobal(this->lua, start);
- }
-
- return true;
-}
-
-bool
-BindingInstance::construct()
-{
- ink_release_assert(this->lua == nullptr);
-
- if ((this->lua = luaL_newstate())) {
- luaL_openlibs(this->lua);
-
- // Push a pointer to ourself into the well-known registry key.
-
- // We do not use lightuserdata here because BindingInstance variables
- // are often declared on stack which would make "this" a stack variable.
- // While this might seem fine and actually work on many platforms, those
- // 64bit platforms with split VA space where heap and stack may live in
- // a separate 47bit VA will violate internal assumptions that luajit
- // places on lightuserdata. Plain userdata will provide luajit-happy
- // address in which we have the full 64bits to store our pointer to this.
- // see: https://www.circonus.com/2016/07/luajit-illumos-vm/
-
- BindingInstance **lua_surrogate;
- lua_surrogate = (BindingInstance **)lua_newuserdata(this->lua, sizeof(BindingInstance *));
- *lua_surrogate = this;
- lua_setfield(this->lua, LUA_REGISTRYINDEX, selfkey);
-
- ink_release_assert(BindingInstance::self(this->lua) == this);
- }
-
- return this->lua;
-}
-
-bool
-BindingInstance::require(const char *path)
-{
- ink_release_assert(this->lua != nullptr);
-
- if (luaL_dofile(this->lua, path) != 0) {
- Warning("%s", lua_tostring(this->lua, -1));
- lua_pop(this->lua, 1);
- return false;
- }
-
- return true;
-}
-
-bool
-BindingInstance::eval(const char *chunk)
-{
- ink_release_assert(this->lua != nullptr);
-
- if (luaL_dostring(this->lua, chunk) != 0) {
- const char *w = lua_tostring(this->lua, -1);
- Warning("%s", w);
- lua_pop(this->lua, 1);
- return false;
- }
-
- return true;
-}
-
-BindingInstance *
-BindingInstance::self(lua_State *lua)
-{
- BindingInstance **binding;
-
- lua_getfield(lua, LUA_REGISTRYINDEX, selfkey);
- binding = (BindingInstance **)lua_touserdata(lua, -1);
-
- ink_release_assert(binding != nullptr);
- ink_release_assert(*binding != nullptr);
- ink_release_assert((*binding)->lua == lua);
-
- lua_pop(lua, 1);
- return *binding;
-}
-
-void
-BindingInstance::typecheck(lua_State *lua, const char *name, ...)
-{
- int nargs = lua_gettop(lua);
- int seen = 0;
- va_list ap;
-
- va_start(ap, name);
-
- for (; seen < nargs; ++seen) {
- int expected = va_arg(ap, int);
-
- if (expected == LUA_TNONE) {
- va_end(ap);
- luaL_error(lua, "too many arguments to '%s'", name);
- return;
- }
-
- if (lua_type(lua, seen + 1) != expected) {
- va_end(ap);
- luaL_error(lua, "bad argument #%d to '%s' (expected %s, received %s)", seen + 1, name, lua_typename(lua, expected),
- lua_typename(lua, lua_type(lua, seen + 1)));
- return;
- }
- }
-
- va_end(ap);
-
- if (seen != nargs) {
- luaL_error(lua, "too few arguments to '%s' (seen %d, nargs %d)", name, seen, nargs);
- }
-}
-
-void
-BindingInstance::register_metatable(lua_State *lua, const char *name, const luaL_reg *metatable)
-{
- // Create a metatable, adding it to the Lua registry.
- luaL_newmetatable(lua, name);
- // Dup the metatable.
- lua_pushvalue(lua, -1);
- // Pop one of those copies and assign it to __index field on the 1st metatable
- lua_setfield(lua, -2, "__index");
- // register functions in the metatable
- luaL_register(lua, nullptr, metatable);
-
- lua_pop(lua, 1); /* drop metatable */
-
- ink_assert(lua_gettop(lua) == 0);
-}
diff --git a/lib/bindings/bindings.h b/lib/bindings/bindings.h
deleted file mode 100644
index af7978d..0000000
--- a/lib/bindings/bindings.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- *
- * Lua bindings object.
- *
- * @section license License
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <string>
-#include <map>
-#include "lua.h"
-
-struct BindingInstance {
- BindingInstance();
- ~BindingInstance();
-
- // Construct this Lua bindings instance.
- bool construct();
-
- // Import a Lua file.
- bool require(const char *path);
-
- // Eval a chunk of Lua code.
- bool eval(const char *chunk);
-
- // Bind values to the specified global name. If the name contains '.'
- // separators, intermediate tables are constucted and the value is bound
- // to the final path component.
- bool bind_constant(const char *name, lua_Integer value);
- bool bind_constant(const char *name, const char *value);
- bool bind_function(const char *name, int (*value)(lua_State *));
- bool bind_value(const char *name, int value);
-
- // Attach a named pointer that we can later fish out from a Lua state.
- void attach_ptr(const char *, void *);
- void *retrieve_ptr(const char *);
-
- // Generic typecheck helper for Lua APIs. Pass in a list of Lua type IDs
- // (ie. LUA_Txxx) terminated by LUA_TNONE. Throws a Lua error string on
- // failure.
- static void typecheck(lua_State *, const char *name, ...);
-
- // Given a Lua state, return the binding instance that owns it.
- static BindingInstance *self(lua_State *);
-
- // Register a Lua metatable for a custom type.
- static void register_metatable(lua_State *, const char *, const luaL_reg *);
-
- lua_State *lua;
-
- BindingInstance(const BindingInstance &) = delete;
- BindingInstance &operator=(const BindingInstance &) = delete;
-
-private:
- std::map<std::string, void *> attachments;
-};
diff --git a/lib/bindings/lua.cc b/lib/bindings/lua.cc
deleted file mode 100644
index 434eecb..0000000
--- a/lib/bindings/lua.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
- *
- * Lua utilities and extensions.
- *
- * @section license License
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "lua.h"
-
-int
-lua_absolute_index(lua_State *L, int relative)
-{
- return (relative > 0 || relative <= LUA_REGISTRYINDEX) ? relative : lua_gettop(L) + relative + 1;
-}
-
-// Check the type at the given index. Error if it is not the expected type.
-void
-lua_checktype(lua_State *L, int index, int ltype)
-{
- if (lua_type(L, index) != ltype) {
- luaL_error(L, "bad type, expected '%s' but found '%s'", lua_typename(L, ltype), lua_typename(L, lua_type(L, index)));
- }
-}
-
-// luaL_checkudata() throws an exception if it fails, so to accept variadic
-// user types, we need to non-destructively test whether a userdata is an
-// instance of the type we want.
-bool
-lua_is_userdata(lua_State *L, int index, const char *metatype)
-{
- int target = lua_absolute_index(L, index);
- bool result = false;
-
- // Get the metatable of the target.
- if (lua_getmetatable(L, target) != 0) {
- // If there was one, get the metatable of the target type.
- luaL_getmetatable(L, metatype);
-
- // Compare them.
- result = lua_equal(L, -1, -2) == 1;
-
- // Pop the 2 metatables.
- lua_pop(L, 2);
- }
-
- return result;
-}
-
-template <>
-lua_Integer
-lua_getfield(lua_State *L, int table, const char *key, lua_Integer default_value)
-{
- lua_Integer result = default_value;
-
- lua_pushvalue(L, table); // Table is at -1.
- lua_pushstring(L, key); // Now key is at -1 and table is at -2.
- lua_gettable(L, -2); // Now the result is at -1.
-
- if (!lua_isnil(L, -1)) {
- result = lua_tointeger(L, -1);
- }
-
- lua_pop(L, 2); // Pop the result and the table.
-
- return result;
-}
-
-template <>
-const char *
-lua_getfield(lua_State *L, int table, const char *key, const char *default_value)
-{
- const char *result = default_value;
-
- lua_pushvalue(L, table); // Table is at -1.
- lua_pushstring(L, key); // Now key is at -1 and table is at -2.
- lua_gettable(L, -2); // Now the result is at -1.
-
- if (!lua_isnil(L, -1)) {
- result = lua_tostring(L, -1);
- }
-
- lua_pop(L, 2); // Pop the result and the table.
- return result;
-}
diff --git a/lib/bindings/lua.h b/lib/bindings/lua.h
deleted file mode 100644
index a085a0d..0000000
--- a/lib/bindings/lua.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- *
- * Lua utilities and extensions.
- *
- * @section license License
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-
-// Redeclare luaL_error with format string checking.
-LUALIB_API int(luaL_error)(lua_State *L, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
-
-#ifdef __cplusplus
-}
-#endif
-
-// Our version of abs_index() from lauxlib.c. Converts a absolute or relative
-// stack index into an absolute index. This is helpful for functions that
-// accepts an index but are going to do stack manipulation themselves.
-int lua_absolute_index(lua_State *L, int relative);
-
-// Check the type at the given index. Error if it is not the expected type.
-void lua_checktype(lua_State *L, int index, int ltype);
-
-// luaL_checkudata() throws an exception if it fails, so to accept variadic
-// user types, we need to non-destructively test whether a userdata is an
-// instance of the type we want.
-bool lua_is_userdata(lua_State *L, int index, const char *metatype);
-
-// Like lua_newuserdata() but for C++ objects.
-template <typename T>
-T *
-lua_newuserobject(lua_State *L)
-{
- T *ptr = (T *)lua_newuserdata(L, sizeof(T));
- if (ptr) {
- return new (ptr) T();
- }
-
- return (T *)nullptr;
-}
-
-// Index the given key in the table at the specified index. If the
-// key doesn't exist, the default value is returned. This returns
-// values referenced by the table (not copies).
-template <typename T> T lua_getfield(lua_State *L, int table, const char *key, T default_value);
-
-// Often, you want to push a value to the Lua stack and pop it when
-// you return from the scope. lua_scoped_stack is a simple RAII object
-// that pops the desired number of stack values when the enclosing
-// scope is destroyed. Use with some caution since clearly it has to
-// assume that the values it is popping are on top of the stack, so
-// you need to ensure there are no intermediate stack values.
-struct lua_scoped_stack {
- explicit lua_scoped_stack(lua_State *L) : L(L), nvals(0) {}
- ~lua_scoped_stack()
- {
- if (nvals) {
- lua_pop(L, nvals);
- }
- }
-
- void
- push_value(int value)
- {
- lua_pushvalue(L, value);
- nvals++;
- }
-
- // noncopyable
- lua_scoped_stack(const lua_scoped_stack &) = delete; // Disabled.
- lua_scoped_stack &operator=(const lua_scoped_stack &) = delete; // Disabled.
-
-private:
- lua_State *L;
- unsigned nvals;
-};
diff --git a/lib/bindings/repl.cc b/lib/bindings/repl.cc
deleted file mode 100644
index 8175a74..0000000
--- a/lib/bindings/repl.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
- *
- * Lua bindings REPL.
- *
- * @section license License
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ink_autoconf.h"
-#include "bindings.h"
-#include <cstdlib>
-
-#if HAVE_READLINE_H
-#include <readline.h>
-#endif
-
-void
-repl(BindingInstance &binding)
-{
-#if HAVE_READLINE_H
- for (;;) {
- char *line;
-
- line = readline("> ");
- if (line == nullptr) {
- exit(0);
- }
-
- if (*line) {
- ::add_history(line);
-
- if (luaL_loadbuffer(this->lua, line, ::strlen(line), "@stdin" /* source */) != 0 ||
- lua_pcall(this->lua, 0, LUA_MULTRET, 0) != 0) {
- // Pop the error message off the top of the stack and show it ...
- error("%s\n", lua_tostring(this->lua, -1));
- lua_pop(this->lua, 1);
- }
- }
-
- ::free(line);
- }
-
-#endif /* HAVE_READLINE_H */
- ::exit(0);
-}
diff --git a/lib/bindings/repl.h b/lib/bindings/repl.h
deleted file mode 100644
index 9c01ee3..0000000
--- a/lib/bindings/repl.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/** @file
- *
- * Lua bindings REPL.
- *
- * @section license License
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-// Drop this binding instance into a Lua REPL (and never come out).
-void repl(BindingInstance &binding) TS_NORETURN;
diff --git a/lib/luajit/.gitignore b/lib/luajit/.gitignore
deleted file mode 100644
index 1a07bf7..0000000
--- a/lib/luajit/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.[oa]
-*.so
-*.obj
-*.lib
-*.exp
-*.dll
-*.exe
-*.manifest
-*.dmp
-*.swp
-.tags
diff --git a/lib/luajit/COPYRIGHT b/lib/luajit/COPYRIGHT
deleted file mode 100644
index 1ef7df6..0000000
--- a/lib/luajit/COPYRIGHT
+++ /dev/null
@@ -1,56 +0,0 @@
-===============================================================================
-LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
-
-Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-[ MIT license: http://www.opensource.org/licenses/mit-license.php ]
-
-===============================================================================
-[ LuaJIT includes code from Lua 5.1/5.2, which has this license statement: ]
-
-Copyright (C) 1994-2012 Lua.org, PUC-Rio.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-===============================================================================
-[ LuaJIT includes code from dlmalloc, which has this license statement: ]
-
-This is a version (aka dlmalloc) of malloc/free/realloc written by
-Doug Lea and released to the public domain, as explained at
-http://creativecommons.org/licenses/publicdomain
-
-===============================================================================
diff --git a/lib/luajit/Makefile b/lib/luajit/Makefile
deleted file mode 100644
index 0cbe741..0000000
--- a/lib/luajit/Makefile
+++ /dev/null
@@ -1,151 +0,0 @@
-##############################################################################
-# LuaJIT top level Makefile for installation. Requires GNU Make.
-#
-# Please read doc/install.html before changing any variables!
-#
-# Suitable for POSIX platforms (Linux, *BSD, OSX etc.).
-# Note: src/Makefile has many more configurable options.
-#
-# ##### This Makefile is NOT useful for Windows! #####
-# For MSVC, please follow the instructions given in src/msvcbuild.bat.
-# For MinGW and Cygwin, cd to src and run make with the Makefile there.
-#
-# Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
-##############################################################################
-
-MAJVER= 2
-MINVER= 0
-RELVER= 4
-VERSION= $(MAJVER).$(MINVER).$(RELVER)
-ABIVER= 5.1
-
-##############################################################################
-#
-# Change the installation path as needed. This automatically adjusts
-# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
-#
-export PREFIX= /usr/local
-export MULTILIB= lib
-##############################################################################
-
-DPREFIX= $(DESTDIR)$(PREFIX)
-INSTALL_BIN= $(DPREFIX)/bin
-INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
-INSTALL_SHARE= $(DPREFIX)/share
-INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
-
-INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION)
-INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
-INSTALL_LMODD= $(INSTALL_SHARE)/lua
-INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
-INSTALL_CMODD= $(INSTALL_LIB)/lua
-INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER)
-INSTALL_MAN= $(INSTALL_SHARE)/man/man1
-INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
-
-INSTALL_TNAME= luajit-$(VERSION)
-INSTALL_TSYMNAME= luajit
-INSTALL_ANAME= libluajit-$(ABIVER).a
-INSTALL_SONAME= libluajit-$(ABIVER).so.$(MAJVER).$(MINVER).$(RELVER)
-INSTALL_SOSHORT= libluajit-$(ABIVER).so
-INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
-INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib
-INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib
-INSTALL_PCNAME= luajit.pc
-
-INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
-INSTALL_DYN= $(INSTALL_LIB)/$(INSTALL_SONAME)
-INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_SOSHORT)
-INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT)
-INSTALL_T= $(INSTALL_BIN)/$(INSTALL_TNAME)
-INSTALL_TSYM= $(INSTALL_BIN)/$(INSTALL_TSYMNAME)
-INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)
-
-INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) $(INSTALL_MAN) \
- $(INSTALL_PKGCONFIG) $(INSTALL_JITLIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
-UNINSTALL_DIRS= $(INSTALL_JITLIB) $(INSTALL_LJLIBD) $(INSTALL_INC) \
- $(INSTALL_LMOD) $(INSTALL_LMODD) $(INSTALL_CMOD) $(INSTALL_CMODD)
-
-RM= rm -f
-MKDIR= mkdir -p
-RMDIR= rmdir 2>/dev/null
-SYMLINK= ln -sf
-INSTALL_X= install -m 0755
-INSTALL_F= install -m 0644
-UNINSTALL= $(RM)
-LDCONFIG= ldconfig -n
-SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
- -e "s|^multilib=.*|multilib=$(MULTILIB)|"
-
-FILE_T= luajit
-FILE_A= libluajit.a
-FILE_SO= libluajit.so
-FILE_MAN= luajit.1
-FILE_PC= luajit.pc
-FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
-FILES_JITLIB= bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \
- dis_ppc.lua dis_mips.lua dis_mipsel.lua bcsave.lua vmdef.lua
-
-ifeq (,$(findstring Windows,$(OS)))
- ifeq (Darwin,$(shell uname -s))
- INSTALL_SONAME= $(INSTALL_DYLIBNAME)
- INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT1)
- INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT2)
- LDCONFIG= :
- endif
-endif
-
-##############################################################################
-
-INSTALL_DEP= src/luajit
-
-default all $(INSTALL_DEP):
- @echo "==== Building LuaJIT $(VERSION) ===="
- $(MAKE) -C src
- @echo "==== Successfully built LuaJIT $(VERSION) ===="
-
-install: $(INSTALL_DEP)
- @echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
- $(MKDIR) $(INSTALL_DIRS)
- cd src && $(INSTALL_X) $(FILE_T) $(INSTALL_T)
- cd src && test -f $(FILE_A) && $(INSTALL_F) $(FILE_A) $(INSTALL_STATIC) || :
- $(RM) $(INSTALL_TSYM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
- cd src && test -f $(FILE_SO) && \
- $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
- $(LDCONFIG) $(INSTALL_LIB) && \
- $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
- $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
- cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
- cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
- $(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
- $(RM) $(FILE_PC).tmp
- cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
- cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
- $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)
- @echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
-
-uninstall:
- @echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
- $(UNINSTALL) $(INSTALL_TSYM) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
- for file in $(FILES_JITLIB); do \
- $(UNINSTALL) $(INSTALL_JITLIB)/$$file; \
- done
- for file in $(FILES_INC); do \
- $(UNINSTALL) $(INSTALL_INC)/$$file; \
- done
- $(LDCONFIG) $(INSTALL_LIB)
- $(RMDIR) $(UNINSTALL_DIRS) || :
- @echo "==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
-
-##############################################################################
-
-amalg:
- @echo "Building LuaJIT $(VERSION)"
- $(MAKE) -C src amalg
-
-clean:
- $(MAKE) -C src clean
-
-.PHONY: all install amalg clean
-
-##############################################################################
diff --git a/lib/luajit/README b/lib/luajit/README
deleted file mode 100644
index 44366af..0000000
--- a/lib/luajit/README
+++ /dev/null
@@ -1,16 +0,0 @@
-README for LuaJIT 2.0.4
------------------------
-
-LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
-
-Project Homepage: http://luajit.org/
-
-LuaJIT is Copyright (C) 2005-2015 Mike Pall.
-LuaJIT is free software, released under the MIT license.
-See full Copyright Notice in the COPYRIGHT file or in luajit.h.
-
-Documentation for LuaJIT is available in HTML format.
-Please point your favorite browser to:
-
- doc/luajit.html
-
diff --git a/lib/luajit/doc/bluequad-print.css b/lib/luajit/doc/bluequad-print.css
deleted file mode 100644
index 07f5c84..0000000
--- a/lib/luajit/doc/bluequad-print.css
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Copyright (C) 2004-2015 Mike Pall.
- *
- * You are welcome to use the general ideas of this design for your own sites.
- * But please do not steal the stylesheet, the layout or the color scheme.
- */
-body {
- font-family: serif;
- font-size: 11pt;
- margin: 0 3em;
- padding: 0;
- border: none;
-}
-a:link, a:visited, a:hover, a:active {
- text-decoration: none;
- background: transparent;
- color: #0000ff;
-}
-h1, h2, h3 {
- font-family: sans-serif;
- font-weight: bold;
- text-align: left;
- margin: 0.5em 0;
- padding: 0;
-}
-h1 {
- font-size: 200%;
-}
-h2 {
- font-size: 150%;
-}
-h3 {
- font-size: 125%;
-}
-p {
- margin: 0 0 0.5em 0;
- padding: 0;
-}
-ul, ol {
- margin: 0.5em 0;
- padding: 0 0 0 2em;
-}
-ul {
- list-style: outside square;
-}
-ol {
- list-style: outside decimal;
-}
-li {
- margin: 0;
- padding: 0;
-}
-dl {
- margin: 1em 0;
- padding: 1em;
- border: 1px solid black;
-}
-dt {
- font-weight: bold;
- margin: 0;
- padding: 0;
-}
-dt sup {
- float: right;
- margin-left: 1em;
-}
-dd {
- margin: 0.5em 0 0 2em;
- padding: 0;
-}
-table {
- table-layout: fixed;
- width: 100%;
- margin: 1em 0;
- padding: 0;
- border: 1px solid black;
- border-spacing: 0;
- border-collapse: collapse;
-}
-tr {
- margin: 0;
- padding: 0;
- border: none;
-}
-td {
- text-align: left;
- margin: 0;
- padding: 0.2em 0.5em;
- border-top: 1px solid black;
- border-bottom: 1px solid black;
-}
-tr.separate td {
- border-top: double;
-}
-tt, pre, code, kbd, samp {
- font-family: monospace;
- font-size: 75%;
-}
-kbd {
- font-weight: bolder;
-}
-blockquote, pre {
- margin: 1em 2em;
- padding: 0;
-}
-img {
- border: none;
- vertical-align: baseline;
- margin: 0;
- padding: 0;
-}
-img.left {
- float: left;
- margin: 0.5em 1em 0.5em 0;
-}
-img.right {
- float: right;
- margin: 0.5em 0 0.5em 1em;
-}
-.flush {
- clear: both;
- visibility: hidden;
-}
-.hide, .noprint, #nav {
- display: none !important;
-}
-.pagebreak {
- page-break-before: always;
-}
-#site {
- text-align: right;
- font-family: sans-serif;
- font-weight: bold;
- margin: 0 1em;
- border-bottom: 1pt solid black;
-}
-#site a {
- font-size: 1.2em;
-}
-#site a:link, #site a:visited {
- text-decoration: none;
- font-weight: bold;
- background: transparent;
- color: #ffffff;
-}
-#logo {
- color: #ff8000;
-}
-#head {
- clear: both;
- margin: 0 1em;
-}
-#main {
- line-height: 1.3;
- text-align: justify;
- margin: 1em;
-}
-#foot {
- clear: both;
- font-size: 80%;
- text-align: center;
- margin: 0 1.25em;
- padding: 0.5em 0 0 0;
- border-top: 1pt solid black;
- page-break-before: avoid;
- page-break-after: avoid;
-}
diff --git a/lib/luajit/doc/bluequad.css b/lib/luajit/doc/bluequad.css
deleted file mode 100644
index ae53143..0000000
--- a/lib/luajit/doc/bluequad.css
+++ /dev/null
@@ -1,325 +0,0 @@
-/* Copyright (C) 2004-2015 Mike Pall.
- *
- * You are welcome to use the general ideas of this design for your own sites.
- * But please do not steal the stylesheet, the layout or the color scheme.
- */
-/* colorscheme:
- *
- * site | head #4162bf/white | #6078bf/#e6ecff
- * ------+------ ----------------+-------------------
- * nav | main #bfcfff | #e6ecff/black
- *
- * nav: hiback loback #c5d5ff #b9c9f9
- * hiborder loborder #e6ecff #97a7d7
- * link hover #2142bf #ff0000
- *
- * link: link visited hover #2142bf #8122bf #ff0000
- *
- * main: boxback boxborder #f0f4ff #bfcfff
- */
-body {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- margin: 0;
- padding: 0;
- border: none;
- background: #e0e0e0;
- color: #000000;
-}
-a:link {
- text-decoration: none;
- background: transparent;
- color: #2142bf;
-}
-a:visited {
- text-decoration: none;
- background: transparent;
- color: #8122bf;
-}
-a:hover, a:active {
- text-decoration: underline;
- background: transparent;
- color: #ff0000;
-}
-h1, h2, h3 {
- font-weight: bold;
- text-align: left;
- margin: 0.5em 0;
- padding: 0;
- background: transparent;
-}
-h1 {
- font-size: 200%;
- line-height: 3em; /* really 6em relative to body, match #site span */
- margin: 0;
-}
-h2 {
- font-size: 150%;
- color: #606060;
-}
-h3 {
- font-size: 125%;
- color: #404040;
-}
-p {
- max-width: 600px;
- margin: 0 0 0.5em 0;
- padding: 0;
-}
-b {
- color: #404040;
-}
-ul, ol {
- max-width: 600px;
- margin: 0.5em 0;
- padding: 0 0 0 2em;
-}
-ul {
- list-style: outside square;
-}
-ol {
- list-style: outside decimal;
-}
-li {
- margin: 0;
- padding: 0;
-}
-dl {
- max-width: 600px;
- margin: 1em 0;
- padding: 1em;
- border: 1px solid #bfcfff;
- background: #f0f4ff;
-}
-dt {
- font-weight: bold;
- margin: 0;
- padding: 0;
-}
-dt sup {
- float: right;
- margin-left: 1em;
- color: #808080;
-}
-dt a:visited {
- text-decoration: none;
- color: #2142bf;
-}
-dt a:hover, dt a:active {
- text-decoration: none;
- color: #ff0000;
-}
-dd {
- margin: 0.5em 0 0 2em;
- padding: 0;
-}
-div.tablewrap { /* for IE *sigh* */
- max-width: 600px;
-}
-table {
- table-layout: fixed;
- border-spacing: 0;
- border-collapse: collapse;
- max-width: 600px;
- width: 100%;
- margin: 1em 0;
- padding: 0;
- border: 1px solid #bfcfff;
-}
-tr {
- margin: 0;
- padding: 0;
- border: none;
-}
-tr.odd {
- background: #f0f4ff;
-}
-tr.separate td {
- border-top: 1px solid #bfcfff;
-}
-td {
- text-align: left;
- margin: 0;
- padding: 0.2em 0.5em;
- border: none;
-}
-tt, code, kbd, samp {
- font-family: Courier New, Courier, monospace;
- line-height: 1.2;
- font-size: 110%;
-}
-kbd {
- font-weight: bolder;
-}
-blockquote, pre {
- max-width: 600px;
- margin: 1em 2em;
- padding: 0;
-}
-pre {
- line-height: 1.1;
-}
-pre.code {
- line-height: 1.4;
- margin: 0.5em 0 1em 0.5em;
- padding: 0.5em 1em;
- border: 1px solid #bfcfff;
- background: #f0f4ff;
-}
-pre.mark {
- padding-left: 2em;
-}
-span.codemark {
- position:absolute;
- left: 16em;
- color: #4040c0;
-}
-span.mark {
- color: #4040c0;
- font-family: Courier New, Courier, monospace;
- line-height: 1.1;
-}
-img {
- border: none;
- vertical-align: baseline;
- margin: 0;
- padding: 0;
-}
-img.left {
- float: left;
- margin: 0.5em 1em 0.5em 0;
-}
-img.right {
- float: right;
- margin: 0.5em 0 0.5em 1em;
-}
-.indent {
- padding-left: 1em;
-}
-.flush {
- clear: both;
- visibility: hidden;
-}
-.hide, .noscreen {
- display: none !important;
-}
-.ext {
- color: #ff8000;
-}
-.new {
- font-size: 6pt;
- vertical-align: middle;
- background: #ff8000;
- color: #ffffff;
-}
-#site {
- clear: both;
- float: left;
- width: 13em;
- text-align: center;
- font-weight: bold;
- margin: 0;
- padding: 0;
- background: transparent;
- color: #ffffff;
-}
-#site a {
- font-size: 200%;
-}
-#site a:link, #site a:visited {
- text-decoration: none;
- font-weight: bold;
- background: transparent;
- color: #ffffff;
-}
-#site span {
- line-height: 3em; /* really 6em relative to body, match h1 */
-}
-#logo {
- color: #ffb380;
-}
-#head {
- margin: 0;
- padding: 0 0 0 2em;
- border-left: solid 13em #4162bf;
- border-right: solid 3em #6078bf;
- background: #6078bf;
- color: #e6ecff;
-}
-#nav {
- clear: both;
- float: left;
- overflow: hidden;
- text-align: left;
- line-height: 1.5;
- width: 13em;
- padding-top: 1em;
- background: transparent;
-}
-#nav ul {
- list-style: none outside;
- margin: 0;
- padding: 0;
-}
-#nav li {
- margin: 0;
- padding: 0;
-}
-#nav a {
- display: block;
- text-decoration: none;
- font-weight: bold;
- margin: 0;
- padding: 2px 1em;
- border-top: 1px solid transparent;
- border-bottom: 1px solid transparent;
- background: transparent;
- color: #2142bf;
-}
-#nav a:hover, #nav a:active {
- text-decoration: none;
- border-top: 1px solid #97a7d7;
- border-bottom: 1px solid #e6ecff;
- background: #b9c9f9;
- color: #ff0000;
-}
-#nav a.current, #nav a.current:hover, #nav a.current:active {
- border-top: 1px solid #e6ecff;
- border-bottom: 1px solid #97a7d7;
- background: #c5d5ff;
- color: #2142bf;
-}
-#nav ul ul a {
- padding: 0 1em 0 1.7em;
-}
-#nav ul ul ul a {
- padding: 0 0.5em 0 2.4em;
-}
-#main {
- line-height: 1.5;
- text-align: left;
- margin: 0;
- padding: 1em 2em;
- border-left: solid 13em #bfcfff;
- border-right: solid 3em #e6ecff;
- background: #e6ecff;
-}
-#foot {
- clear: both;
- font-size: 80%;
- text-align: center;
- margin: 0;
- padding: 0.5em;
- background: #6078bf;
- color: #ffffff;
-}
-#foot a:link, #foot a:visited {
- text-decoration: underline;
- background: transparent;
- color: #ffffff;
-}
-#foot a:hover, #foot a:active {
- text-decoration: underline;
- background: transparent;
- color: #bfcfff;
-}
diff --git a/lib/luajit/doc/changes.html b/lib/luajit/doc/changes.html
deleted file mode 100644
index d7b83ce..0000000
--- a/lib/luajit/doc/changes.html
+++ /dev/null
@@ -1,978 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>LuaJIT Change History</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; }
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>LuaJIT Change History</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a class="current" href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-This is a list of changes between the released versions of LuaJIT.<br>
-The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT 2.0.4</strong>.<br>
-</p>
-<p>
-Please check the
-<a href="http://luajit.org/changes.html"><span class="ext">»</span> Online Change History</a>
-to see whether newer versions are available.
-</p>
-
-<div class="major" style="background: #d0d0ff;">
-<h2 id="LuaJIT-2.0.4">LuaJIT 2.0.4 — 2015-05-14</h2>
-<ul>
-<li>Fix stack check in narrowing optimization.</li>
-<li>Fix Lua/C API typecheck error for special indexes.</li>
-<li>Fix string to number conversion.</li>
-<li>Fix lexer error for chunks without tokens.</li>
-<li>Don't compile <tt>IR_RETF</tt> after <tt>CALLT</tt> to ff with-side effects.</li>
-<li>Fix <tt>BC_UCLO</tt>/<tt>BC_JMP</tt> join optimization in Lua parser.</li>
-<li>Fix corner case in string to number conversion.</li>
-<li>Gracefully handle <tt>lua_error()</tt> for a suspended coroutine.</li>
-<li>Avoid error messages when building with Clang.</li>
-<li>Fix snapshot #0 handling for traces with a stack check on entry.</li>
-<li>Fix fused constant loads under high register pressure.</li>
-<li>Invalidate backpropagation cache after DCE.</li>
-<li>Fix ABC elimination.</li>
-<li>Fix debug info for main chunk of stripped bytecode.</li>
-<li>Fix FOLD rule for <tt>string.sub(s, ...) == k</tt>.</li>
-<li>Fix FOLD rule for <tt>STRREF</tt> of <tt>SNEW</tt>.</li>
-<li>Fix frame traversal while searching for error function.</li>
-<li>Prevent GC estimate miscalculation due to buffer growth.</li>
-<li>Prevent adding side traces for stack checks.</li>
-<li>Fix top slot calculation for snapshots with continuations.</li>
-<li>Fix check for reuse of SCEV results in <tt>FORL</tt>.</li>
-<li>Add PS Vita port.</li>
-<li>Fix compatibility issues with Illumos.</li>
-<li>Fix DragonFly build (unsupported).</li>
-<li>OpenBSD/x86: Better executable memory allocation for W^X mode.</li>
-<li>x86: Fix argument checks for <tt>ipairs()</tt> iterator.</li>
-<li>x86: <tt>lj_math_random_step()</tt> clobbers XMM regs on OSX Clang.</li>
-<li>x86: Fix code generation for unused result of <tt>math.random()</tt>.</li>
-<li>x64: Allow building with <tt>LUAJIT_USE_SYSMALLOC</tt> and <tt>LUAJIT_USE_VALGRIND</tt>.</li>
-<li>x86/x64: Fix argument check for bit shifts.</li>
-<li>x86/x64: Fix code generation for fused test/arith ops.</li>
-<li>ARM: Fix write barrier check in <tt>BC_USETS</tt>.</li>
-<li>PPC: Fix red zone overflow in machine code generation.</li>
-<li>PPC: Don't use <tt>mcrxr</tt> on PPE.</li>
-<li>Various archs: Fix excess stack growth in interpreter.</li>
-<li>FFI: Fix FOLD rule for <tt>TOBIT</tt> + <tt>CONV num.u32</tt>.</li>
-<li>FFI: Prevent DSE across <tt>ffi.string()</tt>.</li>
-<li>FFI: No meta fallback when indexing pointer to incomplete struct.</li>
-<li>FFI: Fix initialization of unions of subtypes.</li>
-<li>FFI: Fix cdata vs. non-cdata arithmetic and comparisons.</li>
-<li>FFI: Fix <tt>__index</tt>/<tt>__newindex</tt> metamethod resolution for ctypes.</li>
-<li>FFI: Fix compilation of reference field access.</li>
-<li>FFI: Fix frame traversal for backtraces with FFI callbacks.</li>
-<li>FFI: Fix recording of indexing a struct pointer ctype object itself.</li>
-<li>FFI: Allow non-scalar cdata to be compared for equality by address.</li>
-<li>FFI: Fix pseudo type conversions for type punning.</li>
-</ul>
-
-<h2 id="LuaJIT-2.0.3">LuaJIT 2.0.3 — 2014-03-12</h2>
-<ul>
-<li>Add PS4 port.</li>
-<li>Add support for multilib distro builds.</li>
-<li>Fix OSX build.</li>
-<li>Fix MinGW build.</li>
-<li>Fix Xbox 360 build.</li>
-<li>Improve ULOAD forwarding for open upvalues.</li>
-<li>Fix GC steps threshold handling when called by JIT-compiled code.</li>
-<li>Fix argument checks for <tt>math.deg()</tt> and <tt>math.rad()</tt>.</li>
-<li>Fix <tt>jit.flush(func|true)</tt>.</li>
-<li>Respect <tt>jit.off(func)</tt> when returning to a function, too.</li>
-<li>Fix compilation of <tt>string.byte(s, nil, n)</tt>.</li>
-<li>Fix line number for relocated bytecode after closure fixup</li>
-<li>Fix frame traversal for backtraces.</li>
-<li>Fix ABC elimination.</li>
-<li>Fix handling of redundant PHIs.</li>
-<li>Fix snapshot restore for exit to function header.</li>
-<li>Fix type punning alias analysis for constified pointers</li>
-<li>Fix call unroll checks in the presence of metamethod frames.</li>
-<li>Fix initial maxslot for down-recursive traces.</li>
-<li>Prevent BASE register coalescing if parent uses <tt>IR_RETF</tt>.</li>
-<li>Don't purge modified function from stack slots in <tt>BC_RET</tt>.</li>
-<li>Fix recording of <tt>BC_VARG</tt>.</li>
-<li>Don't access dangling reference to reallocated IR.</li>
-<li>Fix frame depth display for bytecode dump in <tt>-jdump</tt>.</li>
-<li>ARM: Fix register allocation when rematerializing FPRs.</li>
-<li>x64: Fix store to upvalue for lightuserdata values.</li>
-<li>FFI: Add missing GC steps for callback argument conversions.</li>
-<li>FFI: Properly unload loaded DLLs.</li>
-<li>FFI: Fix argument checks for <tt>ffi.string()</tt>.</li>
-<li>FFI/x64: Fix passing of vector arguments to calls.</li>
-<li>FFI: Rehash finalizer table after GC cycle, if needed.</li>
-<li>FFI: Fix <tt>cts->L</tt> for cdata unsinking in snapshot restore.</li>
-</ul>
-
-<h2 id="LuaJIT-2.0.2">LuaJIT 2.0.2 — 2013-06-03</h2>
-<ul>
-<li>Fix memory access check for fast string interning.</li>
-<li>Fix MSVC intrinsics for older versions.</li>
-<li>Add missing GC steps for <tt>io.*</tt> functions.</li>
-<li>Fix spurious red zone overflows in machine code generation.</li>
-<li>Fix jump-range constrained mcode allocation.</li>
-<li>Inhibit DSE for implicit loads via calls.</li>
-<li>Fix builtin string to number conversion for overflow digits.</li>
-<li>Fix optional argument handling while recording builtins.</li>
-<li>Fix optional argument handling in <tt>table.concat()</tt>.</li>
-<li>Add partial support for building with MingW64 GCC 4.8-SEH.</li>
-<li>Add missing PHI barrier to <tt>string.sub(str, a, b) == kstr</tt> FOLD rule.</li>
-<li>Fix compatibility issues with Illumos.</li>
-<li>ARM: Fix cache flush/sync for exit stubs of JIT-compiled code.</li>
-<li>MIPS: Fix cache flush/sync for JIT-compiled code jump area.</li>
-<li>PPC: Add <tt>plt</tt> suffix for external calls from assembler code.</li>
-<li>FFI: Fix snapshot substitution in SPLIT pass.</li>
-<li>FFI/x86: Fix register allocation for 64 bit comparisons.</li>
-<li>FFI: Fix tailcall in lowest frame to C function with bool result.</li>
-<li>FFI: Ignore <tt>long</tt> type specifier in <tt>ffi.istype()</tt>.</li>
-<li>FFI: Fix calling conventions for 32 bit OSX and iOS simulator (struct returns).</li>
-<li>FFI: Fix calling conventions for ARM hard-float EABI (nested structs).</li>
-<li>FFI: Improve error messages for arithmetic and comparison operators.</li>
-<li>FFI: Insert no-op type conversion for pointer to integer cast.</li>
-<li>FFI: Fix unroll limit for <tt>ffi.fill()</tt>.</li>
-<li>FFI: Must sink <tt>XBAR</tt> together with <tt>XSTORE</tt>s.</li>
-<li>FFI: Preserve intermediate string for <tt>const char *</tt> conversion.</li>
-</ul>
-
-<h2 id="LuaJIT-2.0.1">LuaJIT 2.0.1 — 2013-02-19</h2>
-<ul>
-<li>Don't clear frame for out-of-memory error.</li>
-<li>Leave hook when resume catches error thrown from hook.</li>
-<li>Add missing GC steps for template table creation.</li>
-<li>Fix discharge order of comparisons in Lua parser.</li>
-<li>Improve buffer handling for <tt>io.read()</tt>.</li>
-<li>OSX: Add support for Mach-O object files to <tt>-b</tt> option.</li>
-<li>Fix PS3 port.</li>
-<li>Fix/enable Xbox 360 port.</li>
-<li>x86/x64: Always mark ref for shift count as non-weak.</li>
-<li>x64: Don't fuse implicitly 32-to-64 extended operands.</li>
-<li>ARM: Fix armhf call argument handling.</li>
-<li>ARM: Fix code generation for integer math.min/math.max.</li>
-<li>PPC/e500: Fix <tt>lj_vm_floor()</tt> for Inf/NaN.</li>
-<li>FFI: Change priority of table initializer variants for structs.</li>
-<li>FFI: Fix code generation for bool call result check on x86/x64.</li>
-<li>FFI: Load FFI library on-demand for bytecode with cdata literals.</li>
-<li>FFI: Fix handling of qualified transparent structs/unions.</li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0">LuaJIT 2.0.0 — 2012-11-08</h2>
-<ul>
-<li>Correctness and completeness:
-<ul>
- <li>Fix Android/x86 build.</li>
- <li>Fix recording of equality comparisons with <tt>__eq</tt> metamethods.</li>
- <li>Fix detection of immutable upvalues.</li>
- <li>Replace error with PANIC for callbacks from JIT-compiled code.</li>
- <li>Fix builtin string to number conversion for <tt>INT_MIN</tt>.</li>
- <li>Don't create unneeded array part for template tables.</li>
- <li>Fix <tt>CONV.num.int</tt> sinking.</li>
- <li>Don't propagate implicitly widened number to index metamethods.</li>
- <li>ARM: Fix ordered comparisons of number vs. non-number.</li>
- <li>FFI: Fix code generation for replay of sunk float fields.</li>
- <li>FFI: Fix signedness of bool.</li>
- <li>FFI: Fix recording of bool call result check on x86/x64.</li>
- <li>FFI: Fix stack-adjustment for <tt>__thiscall</tt> callbacks.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta11">LuaJIT 2.0.0-beta11 — 2012-10-16</h2>
-<ul>
-<li>New features:
-<ul>
- <li>Use ARM VFP instructions, if available (build-time detection).</li>
- <li>Add support for ARM hard-float EABI (<tt>armhf</tt>).</li>
- <li>Add PS3 port.</li>
- <li>Add many features from Lua 5.2, e.g. <tt>goto</tt>/labels.
- Refer to <a href="extensions.html#lua52">this list</a>.</li>
- <li>FFI: Add parameterized C types.</li>
- <li>FFI: Add support for copy constructors.</li>
- <li>FFI: Equality comparisons never raise an error (treat as unequal instead).</li>
- <li>FFI: Box all accessed or returned enums.</li>
- <li>FFI: Check for <tt>__new</tt> metamethod when calling a constructor.</li>
- <li>FFI: Handle <tt>__pairs</tt>/<tt>__ipairs</tt> metamethods for cdata objects.</li>
- <li>FFI: Convert <tt>io.*</tt> file handle to <tt>FILE *</tt> pointer (but as a <tt>void *</tt>).</li>
- <li>FFI: Detect and support type punning through unions.</li>
- <li>FFI: Improve various error messages.</li>
-</ul></li>
-<li>Build-system reorganization:
-<ul>
- <li>Reorganize directory layout:<br>
- <tt>lib/*</tt> → <tt>src/jit/*</tt><br>
- <tt>src/buildvm_*.dasc</tt> → <tt>src/vm_*.dasc</tt><br>
- <tt>src/buildvm_*.h</tt> → removed<br>
- <tt>src/buildvm*</tt> → <tt>src/host/*</tt></li>
- <li>Add minified Lua interpreter plus Lua BitOp (<tt>minilua</tt>) to run DynASM.</li>
- <li>Change DynASM bit operations to use Lua BitOp</li>
- <li>Translate only <tt>vm_*.dasc</tt> for detected target architecture.</li>
- <li>Improve target detection for <tt>msvcbuild.bat</tt>.</li>
- <li>Fix build issues on Cygwin and MinGW with optional MSys.</li>
- <li>Handle cross-compiles with FPU/no-FPU or hard-fp/soft-fp ABI mismatch.</li>
- <li>Remove some library functions for no-JIT/no-FFI builds.</li>
- <li>Add uninstall target to top-level Makefile.</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
- <li>Preserve snapshot #0 PC for all traces.</li>
- <li>Fix argument checks for <tt>coroutine.create()</tt>.</li>
- <li>Command line prints version and JIT status to <tt>stdout</tt>, not <tt>stderr</tt>.</li>
- <li>Fix userdata <tt>__gc</tt> separations at Lua state close.</li>
- <li>Fix <tt>TDUP</tt> to <tt>HLOAD</tt> forwarding for <tt>LJ_DUALNUM</tt> builds.</li>
- <li>Fix buffer check in bytecode writer.</li>
- <li>Make <tt>os.date()</tt> thread-safe.</li>
- <li>Add missing declarations for MSVC intrinsics.</li>
- <li>Fix dispatch table modifications for return hooks.</li>
- <li>Workaround for MSVC conversion bug (<tt>double</tt> → <tt>uint32_t</tt> → <tt>int32_t</tt>).</li>
- <li>Fix FOLD rule <tt>(i-j)-i => 0-j</tt>.</li>
- <li>Never use DWARF unwinder on Windows.</li>
- <li>Fix shrinking of direct mapped blocks in builtin allocator.</li>
- <li>Limit recursion depth in <tt>string.match()</tt> et al.</li>
- <li>Fix late despecialization of <tt>ITERN</tt> after loop has been entered.</li>
- <li>Fix <tt>'f'</tt> and <tt>'L'</tt> options for <tt>debug.getinfo()</tt> and <tt>lua_getinfo()</tt>.</li>
- <li>Fix <tt>package.searchpath()</tt>.</li>
- <li>OSX: Change dylib names to be consistent with other platforms.</li>
- <li>Android: Workaround for broken <tt>sprintf("%g", -0.0)</tt>.</li>
- <li>x86: Remove support for ancient CPUs without <tt>CMOV</tt> (before Pentium Pro).</li>
- <li>x86: Fix register allocation for calls returning register pair.</li>
- <li>x86/x64: Fix fusion of unsigned byte comparisons with swapped operands.</li>
- <li>ARM: Fix <tt>tonumber()</tt> argument check.</li>
- <li>ARM: Fix modulo operator and <tt>math.floor()</tt>/<tt>math.ceil()</tt> for <tt>inf</tt>/<tt>nan</tt>.</li>
- <li>ARM: Invoke SPLIT pass for leftover <tt>IR_TOBIT</tt>.</li>
- <li>ARM: Fix BASE register coalescing.</li>
- <li>PPC: Fix interpreter state setup in callbacks.</li>
- <li>PPC: Fix <tt>string.sub()</tt> range check.</li>
- <li>MIPS: Support generation of MIPS/MIPSEL bytecode object files.</li>
- <li>MIPS: Fix calls to <tt>floor()</tt>/<tt>ceil()</tt><tt>/trunc()</tt>.</li>
- <li>ARM/PPC: Detect more target architecture variants.</li>
- <li>ARM/PPC/e500/MIPS: Fix tailcalls from fast functions, esp. <tt>tostring()</tt>.</li>
- <li>ARM/PPC/MIPS: Fix rematerialization of FP constants.</li>
- <li>FFI: Don't call <tt>FreeLibrary()</tt> on our own EXE/DLL.</li>
- <li>FFI: Resolve metamethods for constructors, too.</li>
- <li>FFI: Properly disable callbacks on iOS (would require executable memory).</li>
- <li>FFI: Fix cdecl string parsing during recording.</li>
- <li>FFI: Show address pointed to for <tt>tostring(ref)</tt>, too.</li>
- <li>FFI: Fix alignment of C call argument/return structure.</li>
- <li>FFI: Initialize all fields of standard types.</li>
- <li>FFI: Fix callback handling when new C types are declared in callback.</li>
- <li>FFI: Fix recording of constructors for pointers.</li>
- <li>FFI: Always resolve metamethods for pointers to structs.</li>
- <li>FFI: Correctly propagate alignment when interning nested types.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
- <li>Add allocation sinking and store sinking optimization.</li>
- <li>Constify immutable upvalues.</li>
- <li>Add builtin string to integer or FP number conversion. Improves cross-platform consistency and correctness.</li>
- <li>Create string hash slots in template tables for non-const values, too. Avoids later table resizes.</li>
- <li>Eliminate <tt>HREFK</tt> guard for template table references.</li>
- <li>Add various new FOLD rules.</li>
- <li>Don't use stack unwinding for <tt>lua_yield()</tt> (slow on x64).</li>
- <li>ARM, PPC, MIPS: Improve <tt>XLOAD</tt> operand fusion and register hinting.</li>
- <li>PPC, MIPS: Compile <tt>math.sqrt()</tt> to sqrt instruction, if available.</li>
- <li>FFI: Fold <tt>KPTR</tt> + constant offset in SPLIT pass.</li>
- <li>FFI: Optimize/inline <tt>ffi.copy()</tt> and <tt>ffi.fill()</tt>.</li>
- <li>FFI: Compile and optimize array/struct copies.</li>
- <li>FFI: Compile <tt>ffi.typeof(cdata|ctype)</tt>, <tt>ffi.sizeof()</tt>, <tt>ffi.alignof()</tt>, <tt>ffi.offsetof()</tt> and <tt>ffi.gc()</tt>.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta10">LuaJIT 2.0.0-beta10 — 2012-05-09</h2>
-<ul>
-<li>New features:
-<ul>
-<li>The MIPS of LuaJIT is complete. It requires a CPU conforming to the
-MIPS32 R1 architecture with hardware FPU. O32 hard-fp ABI,
-little-endian or big-endian.</li>
-<li>Auto-detect target arch via cross-compiler. No need for
-<tt>TARGET=arch</tt> anymore.</li>
-<li>Make DynASM compatible with Lua 5.2.</li>
-<li>From Lua 5.2: Try <tt>__tostring</tt> metamethod on non-string error
-messages..</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
-<li>Fix parsing of hex literals with exponents.</li>
-<li>Fix bytecode dump for certain number constants.</li>
-<li>Fix argument type in error message for relative arguments.</li>
-<li>Fix argument error handling on Lua stacks without a frame.</li>
-<li>Add missing mcode limit check in assembler backend.</li>
-<li>Fix compilation on OpenBSD.</li>
-<li>Avoid recursive GC steps after GC-triggered trace exit.</li>
-<li>Replace <tt><unwind.h></tt> definitions with our own.</li>
-<li>Fix OSX build issues. Bump minimum required OSX version to 10.4.</li>
-<li>Fix discharge order of comparisons in Lua parser.</li>
-<li>Ensure running <tt>__gc</tt> of userdata created in <tt>__gc</tt>
-at state close.</li>
-<li>Limit number of userdata <tt>__gc</tt> separations at state close.</li>
-<li>Fix bytecode <tt>JMP</tt> slot range when optimizing
-<tt>and</tt>/<tt>or</tt> with constant LHS.</li>
-<li>Fix DSE of <tt>USTORE</tt>.</li>
-<li>Make <tt>lua_concat()</tt> work from C hook with partial frame.</li>
-<li>Add required PHIs for implicit conversions, e.g. via <tt>XREF</tt>
-forwarding.</li>
-<li>Add more comparison variants to Valgrind suppressions file.</li>
-<li>Disable loading bytecode with an extra header (BOM or <tt>#!</tt>).</li>
-<li>Fix PHI stack slot syncing.</li>
-<li>ARM: Reorder type/value tests to silence Valgrind.</li>
-<li>ARM: Fix register allocation for <tt>ldrd</tt>-optimized
-<tt>HREFK</tt>.</li>
-<li>ARM: Fix conditional branch fixup for <tt>OBAR</tt>.</li>
-<li>ARM: Invoke SPLIT pass for <tt>double</tt> args in FFI call.</li>
-<li>ARM: Handle all <tt>CALL*</tt> ops with <tt>double</tt> results in
-SPLIT pass.</li>
-<li>ARM: Fix rejoin of <tt>POW</tt> in SPLIT pass.</li>
-<li>ARM: Fix compilation of <tt>math.sinh</tt>, <tt>math.cosh</tt>,
-<tt>math.tanh</tt>.</li>
-<li>ARM, PPC: Avoid pointless arg clearing in <tt>BC_IFUNCF</tt>.</li>
-<li>PPC: Fix resume after yield from hook.</li>
-<li>PPC: Fix argument checking for <tt>rawget()</tt>.</li>
-<li>PPC: Fix fusion of floating-point <tt>XLOAD</tt>/<tt>XSTORE</tt>.</li>
-<li>PPC: Fix <tt>HREFK</tt> code generation for huge tables.</li>
-<li>PPC: Use builtin D-Cache/I-Cache sync code.</li>
-</ul></li>
-<li>FFI library:
-<ul>
-<li>Ignore empty statements in <tt>ffi.cdef()</tt>.</li>
-<li>Ignore number parsing errors while skipping definitions.</li>
-<li>Don't touch frame in callbacks with tailcalls to fast functions.</li>
-<li>Fix library unloading on POSIX systems.</li>
-<li>Finalize cdata before userdata when closing the state.</li>
-<li>Change <tt>ffi.load()</tt> library name resolution for Cygwin.</li>
-<li>Fix resolving of function name redirects on Windows/x86.</li>
-<li>Fix symbol resolving error messages on Windows.</li>
-<li>Fix blacklisting of C functions calling callbacks.</li>
-<li>Fix result type of pointer difference.</li>
-<li>Use correct PC in FFI metamethod error message.</li>
-<li>Allow <tt>'typedef _Bool int BOOL;'</tt> for the Windows API.</li>
-<li>Don't record test for bool result of call, if ignored.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta9">LuaJIT 2.0.0-beta9 — 2011-12-14</h2>
-<ul>
-<li>New features:
-<ul>
-<li>PPC port of LuaJIT is complete. Default is the dual-number port
-(usually faster). Single-number port selectable via <tt>src/Makefile</tt>
-at build time.</li>
-<li>Add FFI callback support.</li>
-<li>Extend <tt>-b</tt> to generate <tt>.c</tt>, <tt>.h</tt> or <tt>.obj/.o</tt>
-files with embedded bytecode.</li>
-<li>Allow loading embedded bytecode with <tt>require()</tt>.</li>
-<li>From Lua 5.2: Change to <tt>'\z'</tt> escape. Reject undefined escape
-sequences.</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
-<li>Fix OSX 10.7 build. Fix <tt>install_name</tt> and versioning on OSX.</li>
-<li>Fix iOS build.</li>
-<li>Install <tt>dis_arm.lua</tt>, too.</li>
-<li>Mark installed shared library as executable.</li>
-<li>Add debug option to <tt>msvcbuild.bat</tt> and improve error handling.</li>
-<li>Fix data-flow analysis for iterators.</li>
-<li>Fix forced unwinding triggered by external unwinder.</li>
-<li>Record missing <tt>for</tt> loop slot loads (return to lower frame).</li>
-<li>Always use ANSI variants of Windows system functions.</li>
-<li>Fix GC barrier for multi-result table constructor (<tt>TSETM</tt>).</li>
-<li>Fix/add various FOLD rules.</li>
-<li>Add potential PHI for number conversions due to type instability.</li>
-<li>Do not eliminate PHIs only referenced from other PHIs.</li>
-<li>Correctly anchor implicit number to string conversions in Lua/C API.</li>
-<li>Fix various stack limit checks.</li>
-<li>x64: Use thread-safe exceptions for external unwinding (GCC platforms).</li>
-<li>x64: Fix result type of cdata index conversions.</li>
-<li>x64: Fix <tt>math.random()</tt> and <tt>bit.bswap()</tt> code generation.</li>
-<li>x64: Fix <tt>lightuserdata</tt> comparisons.</li>
-<li>x64: Always extend stack-passed arguments to pointer size.</li>
-<li>ARM: Many fixes to code generation backend.</li>
-<li>PPC/e500: Fix dispatch for binop metamethods.</li>
-<li>PPC/e500: Save/restore condition registers when entering/leaving the VM.</li>
-<li>PPC/e500: Fix write barrier in stores of strings to upvalues.</li>
-</ul></li>
-<li>FFI library:
-<ul>
-<li>Fix C comment parsing.</li>
-<li>Fix snapshot optimization for cdata comparisons.</li>
-<li>Fix recording of const/enum lookups in namespaces.</li>
-<li>Fix call argument and return handling for <tt>I8/U8/I16/U16</tt> types.</li>
-<li>Fix unfused loads of float fields.</li>
-<li>Fix <tt>ffi.string()</tt> recording.</li>
-<li>Save <tt>GetLastError()</tt> around <tt>ffi.load()</tt> and symbol
-resolving, too.</li>
-<li>Improve ld script detection in <tt>ffi.load()</tt>.</li>
-<li>Record loads/stores to external variables in namespaces.</li>
-<li>Compile calls to stdcall, fastcall and vararg functions.</li>
-<li>Treat function ctypes like pointers in comparisons.</li>
-<li>Resolve <tt>__call</tt> metamethod for pointers, too.</li>
-<li>Record C function calls with bool return values.</li>
-<li>Record <tt>ffi.errno()</tt>.</li>
-<li>x86: Fix number to <tt>uint32_t</tt> conversion rounding.</li>
-<li>x86: Fix 64 bit arithmetic in assembler backend.</li>
-<li>x64: Fix struct-by-value calling conventions.</li>
-<li>ARM: Ensure invocation of SPLIT pass for float conversions.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>Display trace types with <tt>-jv</tt> and <tt>-jdump</tt>.</li>
-<li>Record isolated calls. But prefer recording loops over calls.</li>
-<li>Specialize to prototype for non-monomorphic functions. Solves the
-trace-explosion problem for closure-heavy programming styles.</li>
-<li>Always generate a portable <tt>vmdef.lua</tt>. Easier for distros.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta8">LuaJIT 2.0.0-beta8 — 2011-06-23</h2>
-<ul>
-<li>New features:
-<ul>
-<li>Soft-float ARM port of LuaJIT is complete.</li>
-<li>Add support for bytecode loading/saving and <tt>-b</tt> command line
-option.</li>
-<li>From Lua 5.2: <tt>__len</tt> metamethod for tables
-(disabled by default).</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
-<li>ARM: Misc. fixes for interpreter.</li>
-<li>x86/x64: Fix <tt>bit.*</tt> argument checking in interpreter.</li>
-<li>Catch early out-of-memory in memory allocator initialization.</li>
-<li>Fix data-flow analysis for paths leading to an upvalue close.</li>
-<li>Fix check for missing arguments in <tt>string.format()</tt>.</li>
-<li>Fix Solaris/x86 build (note: not a supported target).</li>
-<li>Fix recording of loops with instable directions in side traces.</li>
-<li>x86/x64: Fix fusion of comparisons with <tt>u8</tt>/<tt>u16</tt>
-<tt>XLOAD</tt>.</li>
-<li>x86/x64: Fix register allocation for variable shifts.</li>
-</ul></li>
-<li>FFI library:
-<ul>
-<li>Add <tt>ffi.errno()</tt>. Save <tt>errno</tt>/<tt>GetLastError()</tt>
-around allocations etc.</li>
-<li>Fix <tt>__gc</tt> for VLA/VLS cdata objects.</li>
-<li>Fix recording of casts from 32 bit cdata pointers to integers.</li>
-<li><tt>tonumber(cdata)</tt> returns <tt>nil</tt> for non-numbers.</li>
-<li>Show address pointed to for <tt>tostring(pointer)</tt>.</li>
-<li>Print <tt>NULL</tt> pointers as <tt>"cdata<... *>: NULL"</tt>.</li>
-<li>Support <tt>__tostring</tt> metamethod for pointers to structs, too.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>More tuning for loop unrolling heuristics.</li>
-<li>Flatten and compress in-memory debug info (saves ~70%).</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta7">LuaJIT 2.0.0-beta7 — 2011-05-05</h2>
-<ul>
-<li>New features:
-<ul>
-<li>ARM port of the LuaJIT interpreter is complete.</li>
-<li>FFI library: Add <tt>ffi.gc()</tt>, <tt>ffi.metatype()</tt>,
-<tt>ffi.istype()</tt>.</li>
-<li>FFI library: Resolve ld script redirection in <tt>ffi.load()</tt>.</li>
-<li>From Lua 5.2: <tt>package.searchpath()</tt>, <tt>fp:read("*L")</tt>,
-<tt>load(string)</tt>.</li>
-<li>From Lua 5.2, disabled by default: empty statement,
-<tt>table.unpack()</tt>, modified <tt>coroutine.running()</tt>.</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
-<li>FFI library: numerous fixes.</li>
-<li>Fix type mismatches in store-to-load forwarding.</li>
-<li>Fix error handling within metamethods.</li>
-<li>Fix <tt>table.maxn()</tt>.</li>
-<li>Improve accuracy of <tt>x^-k</tt> on x64.</li>
-<li>Fix code generation for Intel Atom in x64 mode.</li>
-<li>Fix narrowing of POW.</li>
-<li>Fix recording of retried fast functions.</li>
-<li>Fix code generation for <tt>bit.bnot()</tt> and multiplies.</li>
-<li>Fix error location within cpcall frames.</li>
-<li>Add workaround for old libgcc unwind bug.</li>
-<li>Fix <tt>lua_yield()</tt> and <tt>getmetatable(lightuserdata)</tt> on x64.</li>
-<li>Misc. fixes for PPC/e500 interpreter.</li>
-<li>Fix stack slot updates for down-recursion.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>Add dual-number mode (int/double) for the VM. Enabled for ARM.</li>
-<li>Improve narrowing of arithmetic operators and <tt>for</tt> loops.</li>
-<li>Tune loop unrolling heuristics and increase trace recorder limits.</li>
-<li>Eliminate dead slots in snapshots using bytecode data-flow analysis.</li>
-<li>Avoid phantom stores to proxy tables.</li>
-<li>Optimize lookups in empty proxy tables.</li>
-<li>Improve bytecode optimization of <tt>and</tt>/<tt>or</tt> operators.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta6">LuaJIT 2.0.0-beta6 — 2011-02-11</h2>
-<ul>
-<li>New features:
-<ul>
-<li>PowerPC/e500v2 port of the LuaJIT interpreter is complete.</li>
-<li>Various minor features from Lua 5.2: Hex escapes in literals,
-<tt>'\*'</tt> escape, reversible <tt>string.format("%q",s)</tt>,
-<tt>"%g"</tt> pattern, <tt>table.sort</tt> checks callbacks,
-<tt>os.exit(status|true|false[,close])</tt>.</li>
-<li>Lua 5.2 <tt>__pairs</tt> and <tt>__ipairs</tt> metamethods
-(disabled by default).</li>
-<li>Initial release of the FFI library.</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
-<li>Fix <tt>string.format()</tt> for non-finite numbers.</li>
-<li>Fix memory leak when compiled to use the built-in allocator.</li>
-<li>x86/x64: Fix unnecessary resize in <tt>TSETM</tt> bytecode.</li>
-<li>Fix various GC issues with traces and <tt>jit.flush()</tt>.</li>
-<li>x64: Fix fusion of indexes for array references.</li>
-<li>x86/x64: Fix stack overflow handling for coroutine results.</li>
-<li>Enable low-2GB memory allocation on FreeBSD/x64.</li>
-<li>Fix <tt>collectgarbage("count")</tt> result if more than 2GB is in use.</li>
-<li>Fix parsing of hex floats.</li>
-<li>x86/x64: Fix loop branch inversion with trailing
-<tt>HREF+NE/EQ</tt>.</li>
-<li>Add <tt>jit.os</tt> string.</li>
-<li><tt>coroutine.create()</tt> permits running C functions, too.</li>
-<li>Fix OSX build to work with newer ld64 versions.</li>
-<li>Fix bytecode optimization of <tt>and</tt>/<tt>or</tt> operators.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>Emit specialized bytecode for <tt>pairs()</tt>/<tt>next()</tt>.</li>
-<li>Improve bytecode coalescing of <tt>nil</tt> constants.</li>
-<li>Compile calls to vararg functions.</li>
-<li>Compile <tt>select()</tt>.</li>
-<li>Improve alias analysis, esp. for loads from allocations.</li>
-<li>Tuning of various compiler heuristics.</li>
-<li>Refactor and extend IR conversion instructions.</li>
-<li>x86/x64: Various backend enhancements related to the FFI.</li>
-<li>Add SPLIT pass to split 64 bit IR instructions for 32 bit CPUs.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta5">LuaJIT 2.0.0-beta5 — 2010-08-24</h2>
-<ul>
-<li>Correctness and completeness:
-<ul>
-<li>Fix trace exit dispatch to function headers.</li>
-<li>Fix Windows and OSX builds with LUAJIT_DISABLE_JIT.</li>
-<li>Reorganize and fix placement of generated machine code on x64.</li>
-<li>Fix TNEW in x64 interpreter.</li>
-<li>Do not eliminate PHIs for values only referenced from side exits.</li>
-<li>OS-independent canonicalization of strings for non-finite numbers.</li>
-<li>Fix <tt>string.char()</tt> range check on x64.</li>
-<li>Fix <tt>tostring()</tt> resolving within <tt>print()</tt>.</li>
-<li>Fix error handling for <tt>next()</tt>.</li>
-<li>Fix passing of constant arguments to external calls on x64.</li>
-<li>Fix interpreter argument check for two-argument SSE math functions.</li>
-<li>Fix C frame chain corruption caused by <tt>lua_cpcall()</tt>.</li>
-<li>Fix return from <tt>pcall()</tt> within active hook.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>Replace on-trace GC frame syncing with interpreter exit.</li>
-<li>Improve hash lookup specialization by not removing dead keys during GC.</li>
-<li>Turn traces into true GC objects.</li>
-<li>Avoid starting a GC cycle immediately after library init.</li>
-<li>Add weak guards to improve dead-code elimination.</li>
-<li>Speed up string interning.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta4">LuaJIT 2.0.0-beta4 — 2010-03-28</h2>
-<ul>
-<li>Correctness and completeness:
-<ul>
-<li>Fix precondition for on-trace creation of table keys.</li>
-<li>Fix <tt>{f()}</tt> on x64 when table is resized.</li>
-<li>Fix folding of ordered comparisons with same references.</li>
-<li>Fix snapshot restores for multi-result bytecodes.</li>
-<li>Fix potential hang when recording bytecode with nested closures.</li>
-<li>Fix recording of <tt>getmetatable()</tt>, <tt>tonumber()</tt> and bad argument types.</li>
-<li>Fix SLOAD fusion across returns to lower frames.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>Add array bounds check elimination. <tt>-Oabc</tt> is enabled by default.</li>
-<li>More tuning for x64, e.g. smaller table objects.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta3">LuaJIT 2.0.0-beta3 — 2010-03-07</h2>
-<ul>
-<li>LuaJIT x64 port:
-<ul>
-<li>Port integrated memory allocator to Linux/x64, Windows/x64 and OSX/x64.</li>
-<li>Port interpreter and JIT compiler to x64.</li>
-<li>Port DynASM to x64.</li>
-<li>Many 32/64 bit cleanups in the VM.</li>
-<li>Allow building the interpreter with either x87 or SSE2 arithmetics.</li>
-<li>Add external unwinding and C++ exception interop (default on x64).</li>
-</ul></li>
-<li>Correctness and completeness:
-<ul>
-<li>Fix constructor bytecode generation for certain conditional values.</li>
-<li>Fix some cases of ordered string comparisons.</li>
-<li>Fix <tt>lua_tocfunction()</tt>.</li>
-<li>Fix cutoff register in JMP bytecode for some conditional expressions.</li>
-<li>Fix PHI marking algorithm for references from variant slots.</li>
-<li>Fix <tt>package.cpath</tt> for non-default PREFIX.</li>
-<li>Fix DWARF2 frame unwind information for interpreter on OSX.</li>
-<li>Drive the GC forward on string allocations in the parser.</li>
-<li>Implement call/return hooks (zero-cost if disabled).</li>
-<li>Implement yield from C hooks.</li>
-<li>Disable JIT compiler on older non-SSE2 CPUs instead of aborting.</li>
-</ul></li>
-<li>Structural and performance enhancements:
-<ul>
-<li>Compile recursive code (tail-, up- and down-recursion).</li>
-<li>Improve heuristics for bytecode penalties and blacklisting.</li>
-<li>Split CALL/FUNC recording and clean up fast function call semantics.</li>
-<li>Major redesign of internal function call handling.</li>
-<li>Improve FOR loop const specialization and integerness checks.</li>
-<li>Switch to pre-initialized stacks. Avoid frame-clearing.</li>
-<li>Colocation of prototypes and related data: bytecode, constants, debug info.</li>
-<li>Cleanup parser and streamline bytecode generation.</li>
-<li>Add support for weak IR references to register allocator.</li>
-<li>Switch to compressed, extensible snapshots.</li>
-<li>Compile returns to frames below the start frame.</li>
-<li>Improve alias analysis of upvalues using a disambiguation hash value.</li>
-<li>Compile floor/ceil/trunc to SSE2 helper calls or SSE4.1 instructions.</li>
-<li>Add generic C call handling to IR and backend.</li>
-<li>Improve KNUM fuse vs. load heuristics.</li>
-<li>Compile various <tt>io.*()</tt> functions.</li>
-<li>Compile <tt>math.sinh()</tt>, <tt>math.cosh()</tt>, <tt>math.tanh()</tt>
-and <tt>math.random()</tt>.</li>
-</ul></li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta2">LuaJIT 2.0.0-beta2 — 2009-11-09</h2>
-<ul>
-<li>Reorganize build system. Build static+shared library on POSIX.</li>
-<li>Allow C++ exception conversion on all platforms
-using a wrapper function.</li>
-<li>Automatically catch C++ exceptions and rethrow Lua error
-(DWARF2 only).</li>
-<li>Check for the correct x87 FPU precision at strategic points.</li>
-<li>Always use wrappers for libm functions.</li>
-<li>Resurrect metamethod name strings before copying them.</li>
-<li>Mark current trace, even if compiler is idle.</li>
-<li>Ensure FILE metatable is created only once.</li>
-<li>Fix type comparisons when different integer types are involved.</li>
-<li>Fix <tt>getmetatable()</tt> recording.</li>
-<li>Fix TDUP with dead keys in template table.</li>
-<li><tt>jit.flush(tr)</tt> returns status.
-Prevent manual flush of a trace that's still linked.</li>
-<li>Improve register allocation heuristics for invariant references.</li>
-<li>Compile the push/pop variants of <tt>table.insert()</tt> and
-<tt>table.remove()</tt>.</li>
-<li>Compatibility with MSVC <tt>link /debug</tt>.</li>
-<li>Fix <tt>lua_iscfunction()</tt>.</li>
-<li>Fix <tt>math.random()</tt> when compiled with <tt>-fpic</tt> (OSX).</li>
-<li>Fix <tt>table.maxn()</tt>.</li>
-<li>Bump <tt>MACOSX_DEPLOYMENT_TARGET</tt> to <tt>10.4</tt></li>
-<li><tt>luaL_check*()</tt> and <tt>luaL_opt*()</tt> now support
-negative arguments, too.<br>
-This matches the behavior of Lua 5.1, but not the specification.</li>
-</ul>
-
-<h2 id="LuaJIT-2.0.0-beta1">LuaJIT 2.0.0-beta1 — 2009-10-31</h2>
-<ul>
-<li>This is the first public release of LuaJIT 2.0.</li>
-<li>The whole VM has been rewritten from the ground up, so there's
-no point in listing differences over earlier versions.</li>
-</ul>
-</div>
-
-<div class="major" style="background: #ffff80;">
-<h2 id="LuaJIT-1.1.8">LuaJIT 1.1.8 — 2012-04-16</h2>
-<ul>
-<li>Merged with Lua 5.1.5. Also integrated fixes for all
-<a href="http://www.lua.org/bugs.html#5.1.5"><span class="ext">»</span> <span class="ext">»</span> currently known bugs in Lua 5.1.5</a>.</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.7">LuaJIT 1.1.7 — 2011-05-05</h2>
-<ul>
-<li>Added fixes for the
-<a href="http://www.lua.org/bugs.html#5.1.4"><span class="ext">»</span> currently known bugs in Lua 5.1.4</a>.</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.6">LuaJIT 1.1.6 — 2010-03-28</h2>
-<ul>
-<li>Added fixes for the
-<a href="http://www.lua.org/bugs.html#5.1.4"><span class="ext">»</span> currently known bugs in Lua 5.1.4</a>.</li>
-<li>Removed wrong GC check in <tt>jit_createstate()</tt>.
-Thanks to Tim Mensch.</li>
-<li>Fixed bad assertions while compiling <tt>table.insert()</tt> and
-<tt>table.remove()</tt>.</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.5">LuaJIT 1.1.5 — 2008-10-25</h2>
-<ul>
-<li>Merged with Lua 5.1.4. Fixes all
-<a href="http://www.lua.org/bugs.html#5.1.3"><span class="ext">»</span> known bugs in Lua 5.1.3</a>.</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.4">LuaJIT 1.1.4 — 2008-02-05</h2>
-<ul>
-<li>Merged with Lua 5.1.3. Fixes all
-<a href="http://www.lua.org/bugs.html#5.1.2"><span class="ext">»</span> known bugs in Lua 5.1.2</a>.</li>
-<li>Fixed possible (but unlikely) stack corruption while compiling
-<tt>k^x</tt> expressions.</li>
-<li>Fixed DynASM template for cmpss instruction.</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.3">LuaJIT 1.1.3 — 2007-05-24</h2>
-<ul>
-<li>Merged with Lua 5.1.2. Fixes all
-<a href="http://www.lua.org/bugs.html#5.1.1"><span class="ext">»</span> known bugs in Lua 5.1.1</a>.</li>
-<li>Merged pending Lua 5.1.x fixes: "return -nil" bug, spurious count hook call.</li>
-<li>Remove a (sometimes) wrong assertion in <tt>luaJIT_findpc()</tt>.</li>
-<li>DynASM now allows labels for displacements and <tt>.aword</tt>.</li>
-<li>Fix some compiler warnings for DynASM glue (internal API change).</li>
-<li>Correct naming for SSSE3 (temporarily known as SSE4) in DynASM and x86 disassembler.</li>
-<li>The loadable debug modules now handle redirection to stdout
-(e.g. <tt>-j trace=-</tt>).</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.2">LuaJIT 1.1.2 — 2006-06-24</h2>
-<ul>
-<li>Fix MSVC inline assembly: use only local variables with
-<tt>lua_number2int()</tt>.</li>
-<li>Fix "attempt to call a thread value" bug on Mac OS X:
-make values of consts used as lightuserdata keys unique
-to avoid joining by the compiler/linker.</li>
-</ul>
-
-<h2 id="LuaJIT-1.1.1">LuaJIT 1.1.1 — 2006-06-20</h2>
-<ul>
-<li>Merged with Lua 5.1.1. Fixes all
-<a href="http://www.lua.org/bugs.html#5.1"><span class="ext">»</span> known bugs in Lua 5.1</a>.</li>
-<li>Enforce (dynamic) linker error for EXE/DLL version mismatches.</li>
-<li>Minor changes to DynASM: faster pre-processing, smaller encoding
-for some immediates.</li>
-</ul>
-<p>
-This release is in sync with Coco 1.1.1 (see the
-<a href="http://coco.luajit.org/changes.html"><span class="ext">»</span> Coco Change History</a>).
-</p>
-
-<h2 id="LuaJIT-1.1.0">LuaJIT 1.1.0 — 2006-03-13</h2>
-<ul>
-<li>Merged with Lua 5.1 (final).</li>
-
-<li>New JIT call frame setup:
-<ul>
-<li>The C stack is kept 16 byte aligned (faster).
-Mandatory for Mac OS X on Intel, too.</li>
-<li>Faster calling conventions for internal C helper functions.</li>
-<li>Better instruction scheduling for function prologue, OP_CALL and
-OP_RETURN.</li>
-</ul></li>
-
-<li>Miscellaneous optimizations:
-<ul>
-<li>Faster loads of FP constants. Remove narrow-to-wide store-to-load
-forwarding stalls.</li>
-<li>Use (scalar) SSE2 ops (if the CPU supports it) to speed up slot moves
-and FP to integer conversions.</li>
-<li>Optimized the two-argument form of <tt>OP_CONCAT</tt> (<tt>a..b</tt>).</li>
-<li>Inlined <tt>OP_MOD</tt> (<tt>a%b</tt>).
-With better accuracy than the C variant, too.</li>
-<li>Inlined <tt>OP_POW</tt> (<tt>a^b</tt>). Unroll <tt>x^k</tt> or
-use <tt>k^x = 2^(log2(k)*x)</tt> or call <tt>pow()</tt>.</li>
-</ul></li>
-
-<li>Changes in the optimizer:
-<ul>
-<li>Improved hinting for table keys derived from table values
-(<tt>t1[t2[x]]</tt>).</li>
-<li>Lookup hinting now works with arbitrary object types and
-supports index chains, too.</li>
-<li>Generate type hints for arithmetic and comparison operators,
-OP_LEN, OP_CONCAT and OP_FORPREP.</li>
-<li>Remove several hint definitions in favour of a generic COMBINE hint.</li>
-<li>Complete rewrite of <tt>jit.opt_inline</tt> module
-(ex <tt>jit.opt_lib</tt>).</li>
-</ul></li>
-
-<li>Use adaptive deoptimization:
-<ul>
-<li>If runtime verification of a contract fails, the affected
-instruction is recompiled and patched on-the-fly.
-Regular programs will trigger deoptimization only occasionally.</li>
-<li>This avoids generating code for uncommon fallback cases
-most of the time. Generated code is up to 30% smaller compared to
-LuaJIT 1.0.3.</li>
-<li>Deoptimization is used for many opcodes and contracts:
-<ul>
-<li>OP_CALL, OP_TAILCALL: type mismatch for callable.</li>
-<li>Inlined calls: closure mismatch, parameter number and type mismatches.</li>
-<li>OP_GETTABLE, OP_SETTABLE: table or key type and range mismatches.</li>
-<li>All arithmetic and comparison operators, OP_LEN, OP_CONCAT,
-OP_FORPREP: operand type and range mismatches.</li>
-</ul></li>
-<li>Complete redesign of the debug and traceback info
-(bytecode ↔ mcode) to support deoptimization.
-Much more flexible and needs only 50% of the space.</li>
-<li>The modules <tt>jit.trace</tt>, <tt>jit.dumphints</tt> and
-<tt>jit.dump</tt> handle deoptimization.</li>
-</ul></li>
-
-<li>Inlined many popular library functions
-(for commonly used arguments only):
-<ul>
-<li>Most <tt>math.*</tt> functions (the 18 most used ones)
-[2x-10x faster].</li>
-<li><tt>string.len</tt>, <tt>string.sub</tt> and <tt>string.char</tt>
-[2x-10x faster].</li>
-<li><tt>table.insert</tt>, <tt>table.remove</tt> and <tt>table.getn</tt>
-[3x-5x faster].</li>
-<li><tt>coroutine.yield</tt> and <tt>coroutine.resume</tt>
-[3x-5x faster].</li>
-<li><tt>pairs</tt>, <tt>ipairs</tt> and the corresponding iterators
-[8x-15x faster].</li>
-</ul></li>
-
-<li>Changes in the core and loadable modules and the stand-alone executable:
-<ul>
-<li>Added <tt>jit.version</tt>, <tt>jit.version_num</tt>
-and <tt>jit.arch</tt>.</li>
-<li>Reorganized some internal API functions (<tt>jit.util.*mcode*</tt>).</li>
-<li>The <tt>-j dump</tt> output now shows JSUB names, too.</li>
-<li>New x86 disassembler module written in pure Lua. No dependency
-on ndisasm anymore. Flexible API, very compact (500 lines)
-and complete (x87, MMX, SSE, SSE2, SSE3, SSSE3, privileged instructions).</li>
-<li><tt>luajit -v</tt> prints the LuaJIT version and copyright
-on a separate line.</li>
-</ul></li>
-
-<li>Added SSE, SSE2, SSE3 and SSSE3 support to DynASM.</li>
-<li>Miscellaneous doc changes. Added a section about
-<a href="install.html#embedding">embedding LuaJIT</a>.</li>
-</ul>
-<p>
-This release is in sync with Coco 1.1.0 (see the
-<a href="http://coco.luajit.org/changes.html"><span class="ext">»</span> Coco Change History</a>).
-</p>
-</div>
-
-<div class="major" style="background: #ffffd0;">
-<h2 id="LuaJIT-1.0.3">LuaJIT 1.0.3 — 2005-09-08</h2>
-<ul>
-<li>Even more docs.</li>
-<li>Unified closure checks in <tt>jit.*</tt>.</li>
-<li>Fixed some range checks in <tt>jit.util.*</tt>.</li>
-<li>Fixed __newindex call originating from <tt>jit_settable_str()</tt>.</li>
-<li>Merged with Lua 5.1 alpha (including early bug fixes).</li>
-</ul>
-<p>
-This is the first public release of LuaJIT.
-</p>
-
-<h2 id="LuaJIT-1.0.2">LuaJIT 1.0.2 — 2005-09-02</h2>
-<ul>
-<li>Add support for flushing the Valgrind translation cache <br>
-(<tt>MYCFLAGS= -DUSE_VALGRIND</tt>).</li>
-<li>Add support for freeing executable mcode memory to the <tt>mmap()</tt>-based
-variant for POSIX systems.</li>
-<li>Reorganized the C function signature handling in
-<tt>jit.opt_lib</tt>.</li>
-<li>Changed to index-based hints for inlining C functions.
-Still no support in the backend for inlining.</li>
-<li>Hardcode <tt>HEAP_CREATE_ENABLE_EXECUTE</tt> value if undefined.</li>
-<li>Misc. changes to the <tt>jit.*</tt> modules.</li>
-<li>Misc. changes to the Makefiles.</li>
-<li>Lots of new docs.</li>
-<li>Complete doc reorg.</li>
-</ul>
-<p>
-Not released because Lua 5.1 alpha came out today.
-</p>
-
-<h2 id="LuaJIT-1.0.1">LuaJIT 1.0.1 — 2005-08-31</h2>
-<ul>
-<li>Missing GC step in <tt>OP_CONCAT</tt>.</li>
-<li>Fix result handling for C –> JIT calls.</li>
-<li>Detect CPU feature bits.</li>
-<li>Encode conditional moves (<tt>fucomip</tt>) only when supported.</li>
-<li>Add fallback instructions for FP compares.</li>
-<li>Add support for <tt>LUA_COMPAT_VARARG</tt>. Still disabled by default.</li>
-<li>MSVC needs a specific place for the <tt>CALLBACK</tt> attribute
-(David Burgess).</li>
-<li>Misc. doc updates.</li>
-</ul>
-<p>
-Interim non-public release.
-Special thanks to Adam D. Moss for reporting most of the bugs.
-</p>
-
-<h2 id="LuaJIT-1.0.0">LuaJIT 1.0.0 — 2005-08-29</h2>
-<p>
-This is the initial non-public release of LuaJIT.
-</p>
-</div>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/contact.html b/lib/luajit/doc/contact.html
deleted file mode 100644
index 0ef01a7..0000000
--- a/lib/luajit/doc/contact.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Contact</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Contact</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-Please send general questions to the
-<a href="http://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a>.
-You can also send any questions you have directly to me:
-</p>
-
-<script type="text/javascript">
-<!--
-var xS="@-:\" .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ<abc>defghijklmnopqrstuvwxyz";function xD(s)
-{var len=s.length;var r="";for(var i=0;i<len;i++)
-{var c=s.charAt(i);var n=xS.indexOf(c);if(n!=-1)c=xS.charAt(69-n);r+=c;}
-document.write("<"+"p>"+r+"<"+"/p>\n");}
-//-->
-</script>
-<script type="text/javascript">
-<!--
-xD("fyZKB8xv\"FJytmz8.KAB0u52D")
-//--></script>
-<noscript>
-<p><img src="img/contact.png" alt="Contact info in image" width="170" height="13">
-</p>
-</noscript>
-
-<h2>Copyright</h2>
-<p>
-All documentation is
-Copyright © 2005-2015 Mike Pall.
-</p>
-
-
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/ext_c_api.html b/lib/luajit/doc/ext_c_api.html
deleted file mode 100644
index 6598180..0000000
--- a/lib/luajit/doc/ext_c_api.html
+++ /dev/null
@@ -1,187 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Lua/C API Extensions</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Lua/C API Extensions</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a class="current" href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-LuaJIT adds some extensions to the standard Lua/C API. The LuaJIT include
-directory must be in the compiler search path (<tt>-I<i>path</i></tt>)
-to be able to include the required header for C code:
-</p>
-<pre class="code">
-#include "luajit.h"
-</pre>
-<p>
-Or for C++ code:
-</p>
-<pre class="code">
-#include "lua.hpp"
-</pre>
-
-<h2 id="luaJIT_setmode"><tt>luaJIT_setmode(L, idx, mode)</tt>
-— Control VM</h2>
-<p>
-This is a C API extension to allow control of the VM from C code. The
-full prototype of <tt>LuaJIT_setmode</tt> is:
-</p>
-<pre class="code">
-LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode);
-</pre>
-<p>
-The returned status is either success (<tt>1</tt>) or failure (<tt>0</tt>).
-The second argument is either <tt>0</tt> or a stack index (similar to the
-other Lua/C API functions).
-</p>
-<p>
-The third argument specifies the mode, which is 'or'ed with a flag.
-The flag can be <tt>LUAJIT_MODE_OFF</tt> to turn a feature on,
-<tt>LUAJIT_MODE_ON</tt> to turn a feature off, or
-<tt>LUAJIT_MODE_FLUSH</tt> to flush cached code.
-</p>
-<p>
-The following modes are defined:
-</p>
-
-<h3 id="mode_engine"><tt>luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE|flag)</tt></h3>
-<p>
-Turn the whole JIT compiler on or off or flush the whole cache of compiled code.
-</p>
-
-<h3 id="mode_func"><tt>luaJIT_setmode(L, idx, LUAJIT_MODE_FUNC|flag)</tt><br>
-<tt>luaJIT_setmode(L, idx, LUAJIT_MODE_ALLFUNC|flag)</tt><br>
-<tt>luaJIT_setmode(L, idx, LUAJIT_MODE_ALLSUBFUNC|flag)</tt></h3>
-<p>
-This sets the mode for the function at the stack index <tt>idx</tt> or
-the parent of the calling function (<tt>idx = 0</tt>). It either
-enables JIT compilation for a function, disables it and flushes any
-already compiled code or only flushes already compiled code. This
-applies recursively to all sub-functions of the function with
-<tt>LUAJIT_MODE_ALLFUNC</tt> or only to the sub-functions with
-<tt>LUAJIT_MODE_ALLSUBFUNC</tt>.
-</p>
-
-<h3 id="mode_trace"><tt>luaJIT_setmode(L, trace,<br>
- LUAJIT_MODE_TRACE|LUAJIT_MODE_FLUSH)</tt></h3>
-<p>
-Flushes the specified root trace and all of its side traces from the cache.
-The code for the trace will be retained as long as there are any other
-traces which link to it.
-</p>
-
-<h3 id="mode_wrapcfunc"><tt>luaJIT_setmode(L, idx, LUAJIT_MODE_WRAPCFUNC|flag)</tt></h3>
-<p>
-This mode defines a wrapper function for calls to C functions. If
-called with <tt>LUAJIT_MODE_ON</tt>, the stack index at <tt>idx</tt>
-must be a <tt>lightuserdata</tt> object holding a pointer to the wrapper
-function. From now on all C functions are called through the wrapper
-function. If called with <tt>LUAJIT_MODE_OFF</tt> this mode is turned
-off and all C functions are directly called.
-</p>
-<p>
-The wrapper function can be used for debugging purposes or to catch
-and convert foreign exceptions. But please read the section on
-<a href="extensions.html#exceptions">C++ exception interoperability</a>
-first. Recommended usage can be seen in this C++ code excerpt:
-</p>
-<pre class="code">
-#include <exception>
-#include "lua.hpp"
-
-// Catch C++ exceptions and convert them to Lua error messages.
-// Customize as needed for your own exception classes.
-static int wrap_exceptions(lua_State *L, lua_CFunction f)
-{
- try {
- return f(L); // Call wrapped function and return result.
- } catch (const char *s) { // Catch and convert exceptions.
- lua_pushstring(L, s);
- } catch (std::exception& e) {
- lua_pushstring(L, e.what());
- } catch (...) {
- lua_pushliteral(L, "caught (...)");
- }
- return lua_error(L); // Rethrow as a Lua error.
-}
-
-static int myinit(lua_State *L)
-{
- ...
- // Define wrapper function and enable it.
- lua_pushlightuserdata(L, (void *)wrap_exceptions);
- luaJIT_setmode(L, -1, LUAJIT_MODE_WRAPCFUNC|LUAJIT_MODE_ON);
- lua_pop(L, 1);
- ...
-}
-</pre>
-<p>
-Note that you can only define <b>a single global wrapper function</b>,
-so be careful when using this mechanism from multiple C++ modules.
-Also note that this mechanism is not without overhead.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/ext_ffi.html b/lib/luajit/doc/ext_ffi.html
deleted file mode 100644
index 77b8e26..0000000
--- a/lib/luajit/doc/ext_ffi.html
+++ /dev/null
@@ -1,330 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>FFI Library</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>FFI Library</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a class="current" href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-
-The FFI library allows <b>calling external C functions</b> and
-<b>using C data structures</b> from pure Lua code.
-
-</p>
-<p>
-
-The FFI library largely obviates the need to write tedious manual
-Lua/C bindings in C. No need to learn a separate binding language
-— <b>it parses plain C declarations!</b> These can be
-cut-n-pasted from C header files or reference manuals. It's up to
-the task of binding large libraries without the need for dealing with
-fragile binding generators.
-
-</p>
-<p>
-The FFI library is tightly integrated into LuaJIT (it's not available
-as a separate module). The code generated by the JIT-compiler for
-accesses to C data structures from Lua code is on par with the
-code a C compiler would generate. Calls to C functions can
-be inlined in JIT-compiled code, unlike calls to functions bound via
-the classic Lua/C API.
-</p>
-<p>
-This page gives a short introduction to the usage of the FFI library.
-<em>Please use the FFI sub-topics in the navigation bar to learn more.</em>
-</p>
-
-<h2 id="call">Motivating Example: Calling External C Functions</h2>
-<p>
-It's really easy to call an external C library function:
-</p>
-<pre class="code mark">
-<span class="codemark">①
-②
-
-
-③</span>local ffi = require("ffi")
-ffi.cdef[[
-<span style="color:#00a000;">int printf(const char *fmt, ...);</span>
-]]
-ffi.C.printf("Hello %s!", "world")
-</pre>
-<p>
-So, let's pick that apart:
-</p>
-<p>
-<span class="mark">①</span> Load the FFI library.
-</p>
-<p>
-<span class="mark">②</span> Add a C declaration
-for the function. The part inside the double-brackets (in green) is
-just standard C syntax.
-</p>
-<p>
-<span class="mark">③</span> Call the named
-C function — Yes, it's that simple!
-</p>
-<p style="font-size: 8pt;">
-Actually, what goes on behind the scenes is far from simple: <span
-style="color:#4040c0;">③</span> makes use of the standard
-C library namespace <tt>ffi.C</tt>. Indexing this namespace with
-a symbol name (<tt>"printf"</tt>) automatically binds it to the
-standard C library. The result is a special kind of object which,
-when called, runs the <tt>printf</tt> function. The arguments passed
-to this function are automatically converted from Lua objects to the
-corresponding C types.
-</p>
-<p>
-Ok, so maybe the use of <tt>printf()</tt> wasn't such a spectacular
-example. You could have done that with <tt>io.write()</tt> and
-<tt>string.format()</tt>, too. But you get the idea ...
-</p>
-<p>
-So here's something to pop up a message box on Windows:
-</p>
-<pre class="code">
-local ffi = require("ffi")
-ffi.cdef[[
-<span style="color:#00a000;">int MessageBoxA(void *w, const char *txt, const char *cap, int type);</span>
-]]
-ffi.C.MessageBoxA(nil, "Hello world!", "Test", 0)
-</pre>
-<p>
-Bing! Again, that was far too easy, no?
-</p>
-<p style="font-size: 8pt;">
-Compare this with the effort required to bind that function using the
-classic Lua/C API: create an extra C file, add a C function
-that retrieves and checks the argument types passed from Lua and calls
-the actual C function, add a list of module functions and their
-names, add a <tt>luaopen_*</tt> function and register all module
-functions, compile and link it into a shared library (DLL), move it to
-the proper path, add Lua code that loads the module aaaand ... finally
-call the binding function. Phew!
-</p>
-
-<h2 id="cdata">Motivating Example: Using C Data Structures</h2>
-<p>
-The FFI library allows you to create and access C data
-structures. Of course the main use for this is for interfacing with
-C functions. But they can be used stand-alone, too.
-</p>
-<p>
-Lua is built upon high-level data types. They are flexible, extensible
-and dynamic. That's why we all love Lua so much. Alas, this can be
-inefficient for certain tasks, where you'd really want a low-level
-data type. E.g. a large array of a fixed structure needs to be
-implemented with a big table holding lots of tiny tables. This imposes
-both a substantial memory overhead as well as a performance overhead.
-</p>
-<p>
-Here's a sketch of a library that operates on color images plus a
-simple benchmark. First, the plain Lua version:
-</p>
-<pre class="code">
-local floor = math.floor
-
-local function image_ramp_green(n)
- local img = {}
- local f = 255/(n-1)
- for i=1,n do
- img[i] = { red = 0, green = floor((i-1)*f), blue = 0, alpha = 255 }
- end
- return img
-end
-
-local function image_to_grey(img, n)
- for i=1,n do
- local y = floor(0.3*img[i].red + 0.59*img[i].green + 0.11*img[i].blue)
- img[i].red = y; img[i].green = y; img[i].blue = y
- end
-end
-
-local N = 400*400
-local img = image_ramp_green(N)
-for i=1,1000 do
- image_to_grey(img, N)
-end
-</pre>
-<p>
-This creates a table with 160.000 pixels, each of which is a table
-holding four number values in the range of 0-255. First an image with
-a green ramp is created (1D for simplicity), then the image is
-converted to greyscale 1000 times. Yes, that's silly, but I was in
-need of a simple example ...
-</p>
-<p>
-And here's the FFI version. The modified parts have been marked in
-bold:
-</p>
-<pre class="code mark">
-<span class="codemark">①
-
-
-
-
-
-②
-
-③
-④
-
-
-
-
-
-
-③
-⑤</span><b>local ffi = require("ffi")
-ffi.cdef[[
-</b><span style="color:#00a000;">typedef struct { uint8_t red, green, blue, alpha; } rgba_pixel;</span><b>
-]]</b>
-
-local function image_ramp_green(n)
- <b>local img = ffi.new("rgba_pixel[?]", n)</b>
- local f = 255/(n-1)
- for i=<b>0,n-1</b> do
- <b>img[i].green = i*f</b>
- <b>img[i].alpha = 255</b>
- end
- return img
-end
-
-local function image_to_grey(img, n)
- for i=<b>0,n-1</b> do
- local y = <b>0.3*img[i].red + 0.59*img[i].green + 0.11*img[i].blue</b>
- img[i].red = y; img[i].green = y; img[i].blue = y
- end
-end
-
-local N = 400*400
-local img = image_ramp_green(N)
-for i=1,1000 do
- image_to_grey(img, N)
-end
-</pre>
-<p>
-Ok, so that wasn't too difficult:
-</p>
-<p>
-<span class="mark">①</span> First, load the FFI
-library and declare the low-level data type. Here we choose a
-<tt>struct</tt> which holds four byte fields, one for each component
-of a 4x8 bit RGBA pixel.
-</p>
-<p>
-<span class="mark">②</span> Creating the data
-structure with <tt>ffi.new()</tt> is straightforward — the
-<tt>'?'</tt> is a placeholder for the number of elements of a
-variable-length array.
-</p>
-<p>
-<span class="mark">③</span> C arrays are
-zero-based, so the indexes have to run from <tt>0</tt> to
-<tt>n-1</tt>. One might want to allocate one more element instead to
-simplify converting legacy code.
-</p>
-<p>
-<span class="mark">④</span> Since <tt>ffi.new()</tt>
-zero-fills the array by default, we only need to set the green and the
-alpha fields.
-</p>
-<p>
-<span class="mark">⑤</span> The calls to
-<tt>math.floor()</tt> can be omitted here, because floating-point
-numbers are already truncated towards zero when converting them to an
-integer. This happens implicitly when the number is stored in the
-fields of each pixel.
-</p>
-<p>
-Now let's have a look at the impact of the changes: first, memory
-consumption for the image is down from 22 Megabytes to
-640 Kilobytes (400*400*4 bytes). That's a factor of 35x less! So,
-yes, tables do have a noticeable overhead. BTW: The original program
-would consume 40 Megabytes in plain Lua (on x64).
-</p>
-<p>
-Next, performance: the pure Lua version runs in 9.57 seconds (52.9
-seconds with the Lua interpreter) and the FFI version runs in 0.48
-seconds on my machine (YMMV). That's a factor of 20x faster (110x
-faster than the Lua interpreter).
-</p>
-<p style="font-size: 8pt;">
-The avid reader may notice that converting the pure Lua version over
-to use array indexes for the colors (<tt>[1]</tt> instead of
-<tt>.red</tt>, <tt>[2]</tt> instead of <tt>.green</tt> etc.) ought to
-be more compact and faster. This is certainly true (by a factor of
-~1.7x). Switching to a struct-of-arrays would help, too.
-</p>
-<p style="font-size: 8pt;">
-However the resulting code would be less idiomatic and rather
-error-prone. And it still doesn't get even close to the performance of
-the FFI version of the code. Also, high-level data structures cannot
-be easily passed to other C functions, especially I/O functions,
-without undue conversion penalties.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/ext_ffi_api.html b/lib/luajit/doc/ext_ffi_api.html
deleted file mode 100644
index 8f577e9..0000000
--- a/lib/luajit/doc/ext_ffi_api.html
+++ /dev/null
@@ -1,566 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>ffi.* API Functions</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-table.abitable { width: 30em; line-height: 1.2; }
-tr.abihead td { font-weight: bold; }
-td.abiparam { font-weight: bold; width: 6em; }
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1><tt>ffi.*</tt> API Functions</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a class="current" href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-This page describes the API functions provided by the FFI library in
-detail. It's recommended to read through the
-<a href="ext_ffi.html">introduction</a> and the
-<a href="ext_ffi_tutorial.html">FFI tutorial</a> first.
-</p>
-
-<h2 id="glossary">Glossary</h2>
-<ul>
-<li><b>cdecl</b> — An abstract C type declaration (a Lua
-string).</li>
-<li><b>ctype</b> — A C type object. This is a special kind of
-<b>cdata</b> returned by <tt>ffi.typeof()</tt>. It serves as a
-<b>cdata</b> <a href="#ffi_new">constructor</a> when called.</li>
-<li><b>cdata</b> — A C data object. It holds a value of the
-corresponding <b>ctype</b>.</li>
-<li><b>ct</b> — A C type specification which can be used for
-most of the API functions. Either a <b>cdecl</b>, a <b>ctype</b> or a
-<b>cdata</b> serving as a template type.</li>
-<li><b>cb</b> — A callback object. This is a C data object
-holding a special function pointer. Calling this function from
-C code runs an associated Lua function.</li>
-<li><b>VLA</b> — A variable-length array is declared with a
-<tt>?</tt> instead of the number of elements, e.g. <tt>"int[?]"</tt>.
-The number of elements (<tt>nelem</tt>) must be given when it's
-<a href="#ffi_new">created</a>.</li>
-<li><b>VLS</b> — A variable-length struct is a <tt>struct</tt> C
-type where the last element is a <b>VLA</b>. The same rules for
-declaration and creation apply.</li>
-</ul>
-
-<h2 id="decl">Declaring and Accessing External Symbols</h2>
-<p>
-External symbols must be declared first and can then be accessed by
-indexing a <a href="ext_ffi_semantics.html#clib">C library
-namespace</a>, which automatically binds the symbol to a specific
-library.
-</p>
-
-<h3 id="ffi_cdef"><tt>ffi.cdef(def)</tt></h3>
-<p>
-Adds multiple C declarations for types or external symbols (named
-variables or functions). <tt>def</tt> must be a Lua string. It's
-recommended to use the syntactic sugar for string arguments as
-follows:
-</p>
-<pre class="code">
-ffi.cdef[[
-<span style="color:#00a000;">typedef struct foo { int a, b; } foo_t; // Declare a struct and typedef.
-int dofoo(foo_t *f, int n); /* Declare an external C function. */</span>
-]]
-</pre>
-<p>
-The contents of the string (the part in green above) must be a
-sequence of
-<a href="ext_ffi_semantics.html#clang">C declarations</a>,
-separated by semicolons. The trailing semicolon for a single
-declaration may be omitted.
-</p>
-<p>
-Please note that external symbols are only <em>declared</em>, but they
-are <em>not bound</em> to any specific address, yet. Binding is
-achieved with C library namespaces (see below).
-</p>
-<p style="color: #c00000;">
-C declarations are not passed through a C pre-processor,
-yet. No pre-processor tokens are allowed, except for
-<tt>#pragma pack</tt>. Replace <tt>#define</tt> in existing
-C header files with <tt>enum</tt>, <tt>static const</tt>
-or <tt>typedef</tt> and/or pass the files through an external
-C pre-processor (once). Be careful not to include unneeded or
-redundant declarations from unrelated header files.
-</p>
-
-<h3 id="ffi_C"><tt>ffi.C</tt></h3>
-<p>
-This is the default C library namespace — note the
-uppercase <tt>'C'</tt>. It binds to the default set of symbols or
-libraries on the target system. These are more or less the same as a
-C compiler would offer by default, without specifying extra link
-libraries.
-</p>
-<p>
-On POSIX systems, this binds to symbols in the default or global
-namespace. This includes all exported symbols from the executable and
-any libraries loaded into the global namespace. This includes at least
-<tt>libc</tt>, <tt>libm</tt>, <tt>libdl</tt> (on Linux),
-<tt>libgcc</tt> (if compiled with GCC), as well as any exported
-symbols from the Lua/C API provided by LuaJIT itself.
-</p>
-<p>
-On Windows systems, this binds to symbols exported from the
-<tt>*.exe</tt>, the <tt>lua51.dll</tt> (i.e. the Lua/C API
-provided by LuaJIT itself), the C runtime library LuaJIT was linked
-with (<tt>msvcrt*.dll</tt>), <tt>kernel32.dll</tt>,
-<tt>user32.dll</tt> and <tt>gdi32.dll</tt>.
-</p>
-
-<h3 id="ffi_load"><tt>clib = ffi.load(name [,global])</tt></h3>
-<p>
-This loads the dynamic library given by <tt>name</tt> and returns
-a new C library namespace which binds to its symbols. On POSIX
-systems, if <tt>global</tt> is <tt>true</tt>, the library symbols are
-loaded into the global namespace, too.
-</p>
-<p>
-If <tt>name</tt> is a path, the library is loaded from this path.
-Otherwise <tt>name</tt> is canonicalized in a system-dependent way and
-searched in the default search path for dynamic libraries:
-</p>
-<p>
-On POSIX systems, if the name contains no dot, the extension
-<tt>.so</tt> is appended. Also, the <tt>lib</tt> prefix is prepended
-if necessary. So <tt>ffi.load("z")</tt> looks for <tt>"libz.so"</tt>
-in the default shared library search path.
-</p>
-<p>
-On Windows systems, if the name contains no dot, the extension
-<tt>.dll</tt> is appended. So <tt>ffi.load("ws2_32")</tt> looks for
-<tt>"ws2_32.dll"</tt> in the default DLL search path.
-</p>
-
-<h2 id="create">Creating cdata Objects</h2>
-<p>
-The following API functions create cdata objects (<tt>type()</tt>
-returns <tt>"cdata"</tt>). All created cdata objects are
-<a href="ext_ffi_semantics.html#gc">garbage collected</a>.
-</p>
-
-<h3 id="ffi_new"><tt>cdata = ffi.new(ct [,nelem] [,init...])<br>
-cdata = <em>ctype</em>([nelem,] [init...])</tt></h3>
-<p>
-Creates a cdata object for the given <tt>ct</tt>. VLA/VLS types
-require the <tt>nelem</tt> argument. The second syntax uses a ctype as
-a constructor and is otherwise fully equivalent.
-</p>
-<p>
-The cdata object is initialized according to the
-<a href="ext_ffi_semantics.html#init">rules for initializers</a>,
-using the optional <tt>init</tt> arguments. Excess initializers cause
-an error.
-</p>
-<p>
-Performance notice: if you want to create many objects of one kind,
-parse the cdecl only once and get its ctype with
-<tt>ffi.typeof()</tt>. Then use the ctype as a constructor repeatedly.
-</p>
-<p style="font-size: 8pt;">
-Please note that an anonymous <tt>struct</tt> declaration implicitly
-creates a new and distinguished ctype every time you use it for
-<tt>ffi.new()</tt>. This is probably <b>not</b> what you want,
-especially if you create more than one cdata object. Different anonymous
-<tt>structs</tt> are not considered assignment-compatible by the
-C standard, even though they may have the same fields! Also, they
-are considered different types by the JIT-compiler, which may cause an
-excessive number of traces. It's strongly suggested to either declare
-a named <tt>struct</tt> or <tt>typedef</tt> with <tt>ffi.cdef()</tt>
-or to create a single ctype object for an anonymous <tt>struct</tt>
-with <tt>ffi.typeof()</tt>.
-</p>
-
-<h3 id="ffi_typeof"><tt>ctype = ffi.typeof(ct)</tt></h3>
-<p>
-Creates a ctype object for the given <tt>ct</tt>.
-</p>
-<p>
-This function is especially useful to parse a cdecl only once and then
-use the resulting ctype object as a <a href="#ffi_new">constructor</a>.
-</p>
-
-<h3 id="ffi_cast"><tt>cdata = ffi.cast(ct, init)</tt></h3>
-<p>
-Creates a scalar cdata object for the given <tt>ct</tt>. The cdata
-object is initialized with <tt>init</tt> using the "cast" variant of
-the <a href="ext_ffi_semantics.html#convert">C type conversion
-rules</a>.
-</p>
-<p>
-This functions is mainly useful to override the pointer compatibility
-checks or to convert pointers to addresses or vice versa.
-</p>
-
-<h3 id="ffi_metatype"><tt>ctype = ffi.metatype(ct, metatable)</tt></h3>
-<p>
-Creates a ctype object for the given <tt>ct</tt> and associates it with
-a metatable. Only <tt>struct</tt>/<tt>union</tt> types, complex numbers
-and vectors are allowed. Other types may be wrapped in a
-<tt>struct</tt>, if needed.
-</p>
-<p>
-The association with a metatable is permanent and cannot be changed
-afterwards. Neither the contents of the <tt>metatable</tt> nor the
-contents of an <tt>__index</tt> table (if any) may be modified
-afterwards. The associated metatable automatically applies to all uses
-of this type, no matter how the objects are created or where they
-originate from. Note that pre-defined operations on types have
-precedence (e.g. declared field names cannot be overriden).
-</p>
-<p>
-All standard Lua metamethods are implemented. These are called directly,
-without shortcuts and on any mix of types. For binary operations, the
-left operand is checked first for a valid ctype metamethod. The
-<tt>__gc</tt> metamethod only applies to <tt>struct</tt>/<tt>union</tt>
-types and performs an implicit <a href="#ffi_gc"><tt>ffi.gc()</tt></a>
-call during creation of an instance.
-</p>
-
-<h3 id="ffi_gc"><tt>cdata = ffi.gc(cdata, finalizer)</tt></h3>
-<p>
-Associates a finalizer with a pointer or aggregate cdata object. The
-cdata object is returned unchanged.
-</p>
-<p>
-This function allows safe integration of unmanaged resources into the
-automatic memory management of the LuaJIT garbage collector. Typical
-usage:
-</p>
-<pre class="code">
-local p = ffi.gc(ffi.C.malloc(n), ffi.C.free)
-...
-p = nil -- Last reference to p is gone.
--- GC will eventually run finalizer: ffi.C.free(p)
-</pre>
-<p>
-A cdata finalizer works like the <tt>__gc</tt> metamethod for userdata
-objects: when the last reference to a cdata object is gone, the
-associated finalizer is called with the cdata object as an argument. The
-finalizer can be a Lua function or a cdata function or cdata function
-pointer. An existing finalizer can be removed by setting a <tt>nil</tt>
-finalizer, e.g. right before explicitly deleting a resource:
-</p>
-<pre class="code">
-ffi.C.free(ffi.gc(p, nil)) -- Manually free the memory.
-</pre>
-
-<h2 id="info">C Type Information</h2>
-<p>
-The following API functions return information about C types.
-They are most useful for inspecting cdata objects.
-</p>
-
-<h3 id="ffi_sizeof"><tt>size = ffi.sizeof(ct [,nelem])</tt></h3>
-<p>
-Returns the size of <tt>ct</tt> in bytes. Returns <tt>nil</tt> if
-the size is not known (e.g. for <tt>"void"</tt> or function types).
-Requires <tt>nelem</tt> for VLA/VLS types, except for cdata objects.
-</p>
-
-<h3 id="ffi_alignof"><tt>align = ffi.alignof(ct)</tt></h3>
-<p>
-Returns the minimum required alignment for <tt>ct</tt> in bytes.
-</p>
-
-<h3 id="ffi_offsetof"><tt>ofs [,bpos,bsize] = ffi.offsetof(ct, field)</tt></h3>
-<p>
-Returns the offset (in bytes) of <tt>field</tt> relative to the start
-of <tt>ct</tt>, which must be a <tt>struct</tt>. Additionally returns
-the position and the field size (in bits) for bit fields.
-</p>
-
-<h3 id="ffi_istype"><tt>status = ffi.istype(ct, obj)</tt></h3>
-<p>
-Returns <tt>true</tt> if <tt>obj</tt> has the C type given by
-<tt>ct</tt>. Returns <tt>false</tt> otherwise.
-</p>
-<p>
-C type qualifiers (<tt>const</tt> etc.) are ignored. Pointers are
-checked with the standard pointer compatibility rules, but without any
-special treatment for <tt>void *</tt>. If <tt>ct</tt> specifies a
-<tt>struct</tt>/<tt>union</tt>, then a pointer to this type is accepted,
-too. Otherwise the types must match exactly.
-</p>
-<p>
-Note: this function accepts all kinds of Lua objects for the
-<tt>obj</tt> argument, but always returns <tt>false</tt> for non-cdata
-objects.
-</p>
-
-<h2 id="util">Utility Functions</h2>
-
-<h3 id="ffi_errno"><tt>err = ffi.errno([newerr])</tt></h3>
-<p>
-Returns the error number set by the last C function call which
-indicated an error condition. If the optional <tt>newerr</tt> argument
-is present, the error number is set to the new value and the previous
-value is returned.
-</p>
-<p>
-This function offers a portable and OS-independent way to get and set the
-error number. Note that only <em>some</em> C functions set the error
-number. And it's only significant if the function actually indicated an
-error condition (e.g. with a return value of <tt>-1</tt> or
-<tt>NULL</tt>). Otherwise, it may or may not contain any previously set
-value.
-</p>
-<p>
-You're advised to call this function only when needed and as close as
-possible after the return of the related C function. The
-<tt>errno</tt> value is preserved across hooks, memory allocations,
-invocations of the JIT compiler and other internal VM activity. The same
-applies to the value returned by <tt>GetLastError()</tt> on Windows, but
-you need to declare and call it yourself.
-</p>
-
-<h3 id="ffi_string"><tt>str = ffi.string(ptr [,len])</tt></h3>
-<p>
-Creates an interned Lua string from the data pointed to by
-<tt>ptr</tt>.
-</p>
-<p>
-If the optional argument <tt>len</tt> is missing, <tt>ptr</tt> is
-converted to a <tt>"char *"</tt> and the data is assumed to be
-zero-terminated. The length of the string is computed with
-<tt>strlen()</tt>.
-</p>
-<p>
-Otherwise <tt>ptr</tt> is converted to a <tt>"void *"</tt> and
-<tt>len</tt> gives the length of the data. The data may contain
-embedded zeros and need not be byte-oriented (though this may cause
-endianess issues).
-</p>
-<p>
-This function is mainly useful to convert (temporary)
-<tt>"const char *"</tt> pointers returned by
-C functions to Lua strings and store them or pass them to other
-functions expecting a Lua string. The Lua string is an (interned) copy
-of the data and bears no relation to the original data area anymore.
-Lua strings are 8 bit clean and may be used to hold arbitrary,
-non-character data.
-</p>
-<p>
-Performance notice: it's faster to pass the length of the string, if
-it's known. E.g. when the length is returned by a C call like
-<tt>sprintf()</tt>.
-</p>
-
-<h3 id="ffi_copy"><tt>ffi.copy(dst, src, len)<br>
-ffi.copy(dst, str)</tt></h3>
-<p>
-Copies the data pointed to by <tt>src</tt> to <tt>dst</tt>.
-<tt>dst</tt> is converted to a <tt>"void *"</tt> and <tt>src</tt>
-is converted to a <tt>"const void *"</tt>.
-</p>
-<p>
-In the first syntax, <tt>len</tt> gives the number of bytes to copy.
-Caveat: if <tt>src</tt> is a Lua string, then <tt>len</tt> must not
-exceed <tt>#src+1</tt>.
-</p>
-<p>
-In the second syntax, the source of the copy must be a Lua string. All
-bytes of the string <em>plus a zero-terminator</em> are copied to
-<tt>dst</tt> (i.e. <tt>#src+1</tt> bytes).
-</p>
-<p>
-Performance notice: <tt>ffi.copy()</tt> may be used as a faster
-(inlinable) replacement for the C library functions
-<tt>memcpy()</tt>, <tt>strcpy()</tt> and <tt>strncpy()</tt>.
-</p>
-
-<h3 id="ffi_fill"><tt>ffi.fill(dst, len [,c])</tt></h3>
-<p>
-Fills the data pointed to by <tt>dst</tt> with <tt>len</tt> constant
-bytes, given by <tt>c</tt>. If <tt>c</tt> is omitted, the data is
-zero-filled.
-</p>
-<p>
-Performance notice: <tt>ffi.fill()</tt> may be used as a faster
-(inlinable) replacement for the C library function
-<tt>memset(dst, c, len)</tt>. Please note the different
-order of arguments!
-</p>
-
-<h2 id="target">Target-specific Information</h2>
-
-<h3 id="ffi_abi"><tt>status = ffi.abi(param)</tt></h3>
-<p>
-Returns <tt>true</tt> if <tt>param</tt> (a Lua string) applies for the
-target ABI (Application Binary Interface). Returns <tt>false</tt>
-otherwise. The following parameters are currently defined:
-</p>
-<table class="abitable">
-<tr class="abihead">
-<td class="abiparam">Parameter</td>
-<td class="abidesc">Description</td>
-</tr>
-<tr class="odd separate">
-<td class="abiparam">32bit</td><td class="abidesc">32 bit architecture</td></tr>
-<tr class="even">
-<td class="abiparam">64bit</td><td class="abidesc">64 bit architecture</td></tr>
-<tr class="odd separate">
-<td class="abiparam">le</td><td class="abidesc">Little-endian architecture</td></tr>
-<tr class="even">
-<td class="abiparam">be</td><td class="abidesc">Big-endian architecture</td></tr>
-<tr class="odd separate">
-<td class="abiparam">fpu</td><td class="abidesc">Target has a hardware FPU</td></tr>
-<tr class="even">
-<td class="abiparam">softfp</td><td class="abidesc">softfp calling conventions</td></tr>
-<tr class="odd">
-<td class="abiparam">hardfp</td><td class="abidesc">hardfp calling conventions</td></tr>
-<tr class="even separate">
-<td class="abiparam">eabi</td><td class="abidesc">EABI variant of the standard ABI</td></tr>
-<tr class="odd">
-<td class="abiparam">win</td><td class="abidesc">Windows variant of the standard ABI</td></tr>
-</table>
-
-<h3 id="ffi_os"><tt>ffi.os</tt></h3>
-<p>
-Contains the target OS name. Same contents as
-<a href="ext_jit.html#jit_os"><tt>jit.os</tt></a>.
-</p>
-
-<h3 id="ffi_arch"><tt>ffi.arch</tt></h3>
-<p>
-Contains the target architecture name. Same contents as
-<a href="ext_jit.html#jit_arch"><tt>jit.arch</tt></a>.
-</p>
-
-<h2 id="callback">Methods for Callbacks</h2>
-<p>
-The C types for <a href="ext_ffi_semantics.html#callback">callbacks</a>
-have some extra methods:
-</p>
-
-<h3 id="callback_free"><tt>cb:free()</tt></h3>
-<p>
-Free the resources associated with a callback. The associated Lua
-function is unanchored and may be garbage collected. The callback
-function pointer is no longer valid and must not be called anymore
-(it may be reused by a subsequently created callback).
-</p>
-
-<h3 id="callback_set"><tt>cb:set(func)</tt></h3>
-<p>
-Associate a new Lua function with a callback. The C type of the
-callback and the callback function pointer are unchanged.
-</p>
-<p>
-This method is useful to dynamically switch the receiver of callbacks
-without creating a new callback each time and registering it again (e.g.
-with a GUI library).
-</p>
-
-<h2 id="extended">Extended Standard Library Functions</h2>
-<p>
-The following standard library functions have been extended to work
-with cdata objects:
-</p>
-
-<h3 id="tonumber"><tt>n = tonumber(cdata)</tt></h3>
-<p>
-Converts a number cdata object to a <tt>double</tt> and returns it as
-a Lua number. This is particularly useful for boxed 64 bit
-integer values. Caveat: this conversion may incur a precision loss.
-</p>
-
-<h3 id="tostring"><tt>s = tostring(cdata)</tt></h3>
-<p>
-Returns a string representation of the value of 64 bit integers
-(<tt><b>"</b>nnn<b>LL"</b></tt> or <tt><b>"</b>nnn<b>ULL"</b></tt>) or
-complex numbers (<tt><b>"</b>re±im<b>i"</b></tt>). Otherwise
-returns a string representation of the C type of a ctype object
-(<tt><b>"ctype<</b>type<b>>"</b></tt>) or a cdata object
-(<tt><b>"cdata<</b>type<b>>: </b>address"</tt>), unless you
-override it with a <tt>__tostring</tt> metamethod (see
-<a href="#ffi_metatype"><tt>ffi.metatype()</tt></a>).
-</p>
-
-<h3 id="pairs"><tt>iter, obj, start = pairs(cdata)<br>
-iter, obj, start = ipairs(cdata)<br></tt></h3>
-<p>
-Calls the <tt>__pairs</tt> or <tt>__ipairs</tt> metamethod of the
-corresponding ctype.
-</p>
-
-<h2 id="literals">Extensions to the Lua Parser</h2>
-<p>
-The parser for Lua source code treats numeric literals with the
-suffixes <tt>LL</tt> or <tt>ULL</tt> as signed or unsigned 64 bit
-integers. Case doesn't matter, but uppercase is recommended for
-readability. It handles both decimal (<tt>42LL</tt>) and hexadecimal
-(<tt>0x2aLL</tt>) literals.
-</p>
-<p>
-The imaginary part of complex numbers can be specified by suffixing
-number literals with <tt>i</tt> or <tt>I</tt>, e.g. <tt>12.5i</tt>.
-Caveat: you'll need to use <tt>1i</tt> to get an imaginary part with
-the value one, since <tt>i</tt> itself still refers to a variable
-named <tt>i</tt>.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/ext_ffi_semantics.html b/lib/luajit/doc/ext_ffi_semantics.html
deleted file mode 100644
index c267b55..0000000
--- a/lib/luajit/doc/ext_ffi_semantics.html
+++ /dev/null
@@ -1,1245 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>FFI Semantics</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-table.convtable { line-height: 1.2; }
-tr.convhead td { font-weight: bold; }
-td.convop { font-style: italic; width: 40%; }
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>FFI Semantics</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a class="current" href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-This page describes the detailed semantics underlying the FFI library
-and its interaction with both Lua and C code.
-</p>
-<p>
-Given that the FFI library is designed to interface with C code
-and that declarations can be written in plain C syntax, <b>it
-closely follows the C language semantics</b>, wherever possible.
-Some minor concessions are needed for smoother interoperation with Lua
-language semantics.
-</p>
-<p>
-Please don't be overwhelmed by the contents of this page — this
-is a reference and you may need to consult it, if in doubt. It doesn't
-hurt to skim this page, but most of the semantics "just work" as you'd
-expect them to work. It should be straightforward to write
-applications using the LuaJIT FFI for developers with a C or C++
-background.
-</p>
-
-<h2 id="clang">C Language Support</h2>
-<p>
-The FFI library has a built-in C parser with a minimal memory
-footprint. It's used by the <a href="ext_ffi_api.html">ffi.* library
-functions</a> to declare C types or external symbols.
-</p>
-<p>
-It's only purpose is to parse C declarations, as found e.g. in
-C header files. Although it does evaluate constant expressions,
-it's <em>not</em> a C compiler. The body of <tt>inline</tt>
-C function definitions is simply ignored.
-</p>
-<p>
-Also, this is <em>not</em> a validating C parser. It expects and
-accepts correctly formed C declarations, but it may choose to
-ignore bad declarations or show rather generic error messages. If in
-doubt, please check the input against your favorite C compiler.
-</p>
-<p>
-The C parser complies to the <b>C99 language standard</b> plus
-the following extensions:
-</p>
-<ul>
-
-<li>The <tt>'\e'</tt> escape in character and string literals.</li>
-
-<li>The C99/C++ boolean type, declared with the keywords <tt>bool</tt>
-or <tt>_Bool</tt>.</li>
-
-<li>Complex numbers, declared with the keywords <tt>complex</tt> or
-<tt>_Complex</tt>.</li>
-
-<li>Two complex number types: <tt>complex</tt> (aka
-<tt>complex double</tt>) and <tt>complex float</tt>.</li>
-
-<li>Vector types, declared with the GCC <tt>mode</tt> or
-<tt>vector_size</tt> attribute.</li>
-
-<li>Unnamed ('transparent') <tt>struct</tt>/<tt>union</tt> fields
-inside a <tt>struct</tt>/<tt>union</tt>.</li>
-
-<li>Incomplete <tt>enum</tt> declarations, handled like incomplete
-<tt>struct</tt> declarations.</li>
-
-<li>Unnamed <tt>enum</tt> fields inside a
-<tt>struct</tt>/<tt>union</tt>. This is similar to a scoped C++
-<tt>enum</tt>, except that declared constants are visible in the
-global namespace, too.</li>
-
-<li>Scoped <tt>static const</tt> declarations inside a
-<tt>struct</tt>/<tt>union</tt> (from C++).</li>
-
-<li>Zero-length arrays (<tt>[0]</tt>), empty
-<tt>struct</tt>/<tt>union</tt>, variable-length arrays (VLA,
-<tt>[?]</tt>) and variable-length structs (VLS, with a trailing
-VLA).</li>
-
-<li>C++ reference types (<tt>int &x</tt>).</li>
-
-<li>Alternate GCC keywords with '<tt>__</tt>', e.g.
-<tt>__const__</tt>.</li>
-
-<li>GCC <tt>__attribute__</tt> with the following attributes:
-<tt>aligned</tt>, <tt>packed</tt>, <tt>mode</tt>,
-<tt>vector_size</tt>, <tt>cdecl</tt>, <tt>fastcall</tt>,
-<tt>stdcall</tt>, <tt>thiscall</tt>.</li>
-
-<li>The GCC <tt>__extension__</tt> keyword and the GCC
-<tt>__alignof__</tt> operator.</li>
-
-<li>GCC <tt>__asm__("symname")</tt> symbol name redirection for
-function declarations.</li>
-
-<li>MSVC keywords for fixed-length types: <tt>__int8</tt>,
-<tt>__int16</tt>, <tt>__int32</tt> and <tt>__int64</tt>.</li>
-
-<li>MSVC <tt>__cdecl</tt>, <tt>__fastcall</tt>, <tt>__stdcall</tt>,
-<tt>__thiscall</tt>, <tt>__ptr32</tt>, <tt>__ptr64</tt>,
-<tt>__declspec(align(n))</tt> and <tt>#pragma pack</tt>.</li>
-
-<li>All other GCC/MSVC-specific attributes are ignored.</li>
-
-</ul>
-<p>
-The following C types are pre-defined by the C parser (like
-a <tt>typedef</tt>, except re-declarations will be ignored):
-</p>
-<ul>
-
-<li>Vararg handling: <tt>va_list</tt>, <tt>__builtin_va_list</tt>,
-<tt>__gnuc_va_list</tt>.</li>
-
-<li>From <tt><stddef.h></tt>: <tt>ptrdiff_t</tt>,
-<tt>size_t</tt>, <tt>wchar_t</tt>.</li>
-
-<li>From <tt><stdint.h></tt>: <tt>int8_t</tt>, <tt>int16_t</tt>,
-<tt>int32_t</tt>, <tt>int64_t</tt>, <tt>uint8_t</tt>,
-<tt>uint16_t</tt>, <tt>uint32_t</tt>, <tt>uint64_t</tt>,
-<tt>intptr_t</tt>, <tt>uintptr_t</tt>.</li>
-
-</ul>
-<p>
-You're encouraged to use these types in preference to
-compiler-specific extensions or target-dependent standard types.
-E.g. <tt>char</tt> differs in signedness and <tt>long</tt> differs in
-size, depending on the target architecture and platform ABI.
-</p>
-<p>
-The following C features are <b>not</b> supported:
-</p>
-<ul>
-
-<li>A declaration must always have a type specifier; it doesn't
-default to an <tt>int</tt> type.</li>
-
-<li>Old-style empty function declarations (K&R) are not allowed.
-All C functions must have a proper prototype declaration. A
-function declared without parameters (<tt>int foo();</tt>) is
-treated as a function taking zero arguments, like in C++.</li>
-
-<li>The <tt>long double</tt> C type is parsed correctly, but
-there's no support for the related conversions, accesses or arithmetic
-operations.</li>
-
-<li>Wide character strings and character literals are not
-supported.</li>
-
-<li><a href="#status">See below</a> for features that are currently
-not implemented.</li>
-
-</ul>
-
-<h2 id="convert">C Type Conversion Rules</h2>
-
-<h3 id="convert_tolua">Conversions from C types to Lua objects</h3>
-<p>
-These conversion rules apply for <em>read accesses</em> to
-C types: indexing pointers, arrays or
-<tt>struct</tt>/<tt>union</tt> types; reading external variables or
-constant values; retrieving return values from C calls:
-</p>
-<table class="convtable">
-<tr class="convhead">
-<td class="convin">Input</td>
-<td class="convop">Conversion</td>
-<td class="convout">Output</td>
-</tr>
-<tr class="odd separate">
-<td class="convin"><tt>int8_t</tt>, <tt>int16_t</tt></td><td class="convop">→<sup>sign-ext</sup> <tt>int32_t</tt> → <tt>double</tt></td><td class="convout">number</td></tr>
-<tr class="even">
-<td class="convin"><tt>uint8_t</tt>, <tt>uint16_t</tt></td><td class="convop">→<sup>zero-ext</sup> <tt>int32_t</tt> → <tt>double</tt></td><td class="convout">number</td></tr>
-<tr class="odd">
-<td class="convin"><tt>int32_t</tt>, <tt>uint32_t</tt></td><td class="convop">→ <tt>double</tt></td><td class="convout">number</td></tr>
-<tr class="even">
-<td class="convin"><tt>int64_t</tt>, <tt>uint64_t</tt></td><td class="convop">boxed value</td><td class="convout">64 bit int cdata</td></tr>
-<tr class="odd separate">
-<td class="convin"><tt>double</tt>, <tt>float</tt></td><td class="convop">→ <tt>double</tt></td><td class="convout">number</td></tr>
-<tr class="even separate">
-<td class="convin"><tt>bool</tt></td><td class="convop">0 → <tt>false</tt>, otherwise <tt>true</tt></td><td class="convout">boolean</td></tr>
-<tr class="odd separate">
-<td class="convin"><tt>enum</tt></td><td class="convop">boxed value</td><td class="convout">enum cdata</td></tr>
-<tr class="even">
-<td class="convin">Complex number</td><td class="convop">boxed value</td><td class="convout">complex cdata</td></tr>
-<tr class="odd">
-<td class="convin">Vector</td><td class="convop">boxed value</td><td class="convout">vector cdata</td></tr>
-<tr class="even">
-<td class="convin">Pointer</td><td class="convop">boxed value</td><td class="convout">pointer cdata</td></tr>
-<tr class="odd separate">
-<td class="convin">Array</td><td class="convop">boxed reference</td><td class="convout">reference cdata</td></tr>
-<tr class="even">
-<td class="convin"><tt>struct</tt>/<tt>union</tt></td><td class="convop">boxed reference</td><td class="convout">reference cdata</td></tr>
-</table>
-<p>
-Bitfields are treated like their underlying type.
-</p>
-<p>
-Reference types are dereferenced <em>before</em> a conversion can take
-place — the conversion is applied to the C type pointed to
-by the reference.
-</p>
-
-<h3 id="convert_fromlua">Conversions from Lua objects to C types</h3>
-<p>
-These conversion rules apply for <em>write accesses</em> to
-C types: indexing pointers, arrays or
-<tt>struct</tt>/<tt>union</tt> types; initializing cdata objects;
-casts to C types; writing to external variables; passing
-arguments to C calls:
-</p>
-<table class="convtable">
-<tr class="convhead">
-<td class="convin">Input</td>
-<td class="convop">Conversion</td>
-<td class="convout">Output</td>
-</tr>
-<tr class="odd separate">
-<td class="convin">number</td><td class="convop">→</td><td class="convout"><tt>double</tt></td></tr>
-<tr class="even">
-<td class="convin">boolean</td><td class="convop"><tt>false</tt> → 0, <tt>true</tt> → 1</td><td class="convout"><tt>bool</tt></td></tr>
-<tr class="odd separate">
-<td class="convin">nil</td><td class="convop"><tt>NULL</tt> →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="even">
-<td class="convin">lightuserdata</td><td class="convop">lightuserdata address →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="odd">
-<td class="convin">userdata</td><td class="convop">userdata payload →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="even">
-<td class="convin">io.* file</td><td class="convop">get FILE * handle →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="odd separate">
-<td class="convin">string</td><td class="convop">match against <tt>enum</tt> constant</td><td class="convout"><tt>enum</tt></td></tr>
-<tr class="even">
-<td class="convin">string</td><td class="convop">copy string data + zero-byte</td><td class="convout"><tt>int8_t[]</tt>, <tt>uint8_t[]</tt></td></tr>
-<tr class="odd">
-<td class="convin">string</td><td class="convop">string data →</td><td class="convout"><tt>const char[]</tt></td></tr>
-<tr class="even separate">
-<td class="convin">function</td><td class="convop"><a href="#callback">create callback</a> →</td><td class="convout">C function type</td></tr>
-<tr class="odd separate">
-<td class="convin">table</td><td class="convop"><a href="#init_table">table initializer</a></td><td class="convout">Array</td></tr>
-<tr class="even">
-<td class="convin">table</td><td class="convop"><a href="#init_table">table initializer</a></td><td class="convout"><tt>struct</tt>/<tt>union</tt></td></tr>
-<tr class="odd separate">
-<td class="convin">cdata</td><td class="convop">cdata payload →</td><td class="convout">C type</td></tr>
-</table>
-<p>
-If the result type of this conversion doesn't match the
-C type of the destination, the
-<a href="#convert_between">conversion rules between C types</a>
-are applied.
-</p>
-<p>
-Reference types are immutable after initialization ("no re-seating of
-references"). For initialization purposes or when passing values to
-reference parameters, they are treated like pointers. Note that unlike
-in C++, there's no way to implement automatic reference generation of
-variables under the Lua language semantics. If you want to call a
-function with a reference parameter, you need to explicitly pass a
-one-element array.
-</p>
-
-<h3 id="convert_between">Conversions between C types</h3>
-<p>
-These conversion rules are more or less the same as the standard
-C conversion rules. Some rules only apply to casts, or require
-pointer or type compatibility:
-</p>
-<table class="convtable">
-<tr class="convhead">
-<td class="convin">Input</td>
-<td class="convop">Conversion</td>
-<td class="convout">Output</td>
-</tr>
-<tr class="odd separate">
-<td class="convin">Signed integer</td><td class="convop">→<sup>narrow or sign-extend</sup></td><td class="convout">Integer</td></tr>
-<tr class="even">
-<td class="convin">Unsigned integer</td><td class="convop">→<sup>narrow or zero-extend</sup></td><td class="convout">Integer</td></tr>
-<tr class="odd">
-<td class="convin">Integer</td><td class="convop">→<sup>round</sup></td><td class="convout"><tt>double</tt>, <tt>float</tt></td></tr>
-<tr class="even">
-<td class="convin"><tt>double</tt>, <tt>float</tt></td><td class="convop">→<sup>trunc</sup> <tt>int32_t</tt> →<sup>narrow</sup></td><td class="convout"><tt>(u)int8_t</tt>, <tt>(u)int16_t</tt></td></tr>
-<tr class="odd">
-<td class="convin"><tt>double</tt>, <tt>float</tt></td><td class="convop">→<sup>trunc</sup></td><td class="convout"><tt>(u)int32_t</tt>, <tt>(u)int64_t</tt></td></tr>
-<tr class="even">
-<td class="convin"><tt>double</tt>, <tt>float</tt></td><td class="convop">→<sup>round</sup></td><td class="convout"><tt>float</tt>, <tt>double</tt></td></tr>
-<tr class="odd separate">
-<td class="convin">Number</td><td class="convop">n == 0 → 0, otherwise 1</td><td class="convout"><tt>bool</tt></td></tr>
-<tr class="even">
-<td class="convin"><tt>bool</tt></td><td class="convop"><tt>false</tt> → 0, <tt>true</tt> → 1</td><td class="convout">Number</td></tr>
-<tr class="odd separate">
-<td class="convin">Complex number</td><td class="convop">convert real part</td><td class="convout">Number</td></tr>
-<tr class="even">
-<td class="convin">Number</td><td class="convop">convert real part, imag = 0</td><td class="convout">Complex number</td></tr>
-<tr class="odd">
-<td class="convin">Complex number</td><td class="convop">convert real and imag part</td><td class="convout">Complex number</td></tr>
-<tr class="even separate">
-<td class="convin">Number</td><td class="convop">convert scalar and replicate</td><td class="convout">Vector</td></tr>
-<tr class="odd">
-<td class="convin">Vector</td><td class="convop">copy (same size)</td><td class="convout">Vector</td></tr>
-<tr class="even separate">
-<td class="convin"><tt>struct</tt>/<tt>union</tt></td><td class="convop">take base address (compat)</td><td class="convout">Pointer</td></tr>
-<tr class="odd">
-<td class="convin">Array</td><td class="convop">take base address (compat)</td><td class="convout">Pointer</td></tr>
-<tr class="even">
-<td class="convin">Function</td><td class="convop">take function address</td><td class="convout">Function pointer</td></tr>
-<tr class="odd separate">
-<td class="convin">Number</td><td class="convop">convert via <tt>uintptr_t</tt> (cast)</td><td class="convout">Pointer</td></tr>
-<tr class="even">
-<td class="convin">Pointer</td><td class="convop">convert address (compat/cast)</td><td class="convout">Pointer</td></tr>
-<tr class="odd">
-<td class="convin">Pointer</td><td class="convop">convert address (cast)</td><td class="convout">Integer</td></tr>
-<tr class="even">
-<td class="convin">Array</td><td class="convop">convert base address (cast)</td><td class="convout">Integer</td></tr>
-<tr class="odd separate">
-<td class="convin">Array</td><td class="convop">copy (compat)</td><td class="convout">Array</td></tr>
-<tr class="even">
-<td class="convin"><tt>struct</tt>/<tt>union</tt></td><td class="convop">copy (identical type)</td><td class="convout"><tt>struct</tt>/<tt>union</tt></td></tr>
-</table>
-<p>
-Bitfields or <tt>enum</tt> types are treated like their underlying
-type.
-</p>
-<p>
-Conversions not listed above will raise an error. E.g. it's not
-possible to convert a pointer to a complex number or vice versa.
-</p>
-
-<h3 id="convert_vararg">Conversions for vararg C function arguments</h3>
-<p>
-The following default conversion rules apply when passing Lua objects
-to the variable argument part of vararg C functions:
-</p>
-<table class="convtable">
-<tr class="convhead">
-<td class="convin">Input</td>
-<td class="convop">Conversion</td>
-<td class="convout">Output</td>
-</tr>
-<tr class="odd separate">
-<td class="convin">number</td><td class="convop">→</td><td class="convout"><tt>double</tt></td></tr>
-<tr class="even">
-<td class="convin">boolean</td><td class="convop"><tt>false</tt> → 0, <tt>true</tt> → 1</td><td class="convout"><tt>bool</tt></td></tr>
-<tr class="odd separate">
-<td class="convin">nil</td><td class="convop"><tt>NULL</tt> →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="even">
-<td class="convin">userdata</td><td class="convop">userdata payload →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="odd">
-<td class="convin">lightuserdata</td><td class="convop">lightuserdata address →</td><td class="convout"><tt>(void *)</tt></td></tr>
-<tr class="even separate">
-<td class="convin">string</td><td class="convop">string data →</td><td class="convout"><tt>const char *</tt></td></tr>
-<tr class="odd separate">
-<td class="convin"><tt>float</tt> cdata</td><td class="convop">→</td><td class="convout"><tt>double</tt></td></tr>
-<tr class="even">
-<td class="convin">Array cdata</td><td class="convop">take base address</td><td class="convout">Element pointer</td></tr>
-<tr class="odd">
-<td class="convin"><tt>struct</tt>/<tt>union</tt> cdata</td><td class="convop">take base address</td><td class="convout"><tt>struct</tt>/<tt>union</tt> pointer</td></tr>
-<tr class="even">
-<td class="convin">Function cdata</td><td class="convop">take function address</td><td class="convout">Function pointer</td></tr>
-<tr class="odd">
-<td class="convin">Any other cdata</td><td class="convop">no conversion</td><td class="convout">C type</td></tr>
-</table>
-<p>
-To pass a Lua object, other than a cdata object, as a specific type,
-you need to override the conversion rules: create a temporary cdata
-object with a constructor or a cast and initialize it with the value
-to pass:
-</p>
-<p>
-Assuming <tt>x</tt> is a Lua number, here's how to pass it as an
-integer to a vararg function:
-</p>
-<pre class="code">
-ffi.cdef[[
-int printf(const char *fmt, ...);
-]]
-ffi.C.printf("integer value: %d\n", ffi.new("int", x))
-</pre>
-<p>
-If you don't do this, the default Lua number → <tt>double</tt>
-conversion rule applies. A vararg C function expecting an integer
-will see a garbled or uninitialized value.
-</p>
-
-<h2 id="init">Initializers</h2>
-<p>
-Creating a cdata object with
-<a href="ext_ffi_api.html#ffi_new"><tt>ffi.new()</tt></a> or the
-equivalent constructor syntax always initializes its contents, too.
-Different rules apply, depending on the number of optional
-initializers and the C types involved:
-</p>
-<ul>
-<li>If no initializers are given, the object is filled with zero bytes.</li>
-
-<li>Scalar types (numbers and pointers) accept a single initializer.
-The Lua object is <a href="#convert_fromlua">converted to the scalar
-C type</a>.</li>
-
-<li>Valarrays (complex numbers and vectors) are treated like scalars
-when a single initializer is given. Otherwise they are treated like
-regular arrays.</li>
-
-<li>Aggregate types (arrays and structs) accept either a single cdata
-initializer of the same type (copy constructor), a single
-<a href="#init_table">table initializer</a>, or a flat list of
-initializers.</li>
-
-<li>The elements of an array are initialized, starting at index zero.
-If a single initializer is given for an array, it's repeated for all
-remaining elements. This doesn't happen if two or more initializers
-are given: all remaining uninitialized elements are filled with zero
-bytes.</li>
-
-<li>Byte arrays may also be initialized with a Lua string. This copies
-the whole string plus a terminating zero-byte. The copy stops early only
-if the array has a known, fixed size.</li>
-
-<li>The fields of a <tt>struct</tt> are initialized in the order of
-their declaration. Uninitialized fields are filled with zero
-bytes.</li>
-
-<li>Only the first field of a <tt>union</tt> can be initialized with a
-flat initializer.</li>
-
-<li>Elements or fields which are aggregates themselves are initialized
-with a <em>single</em> initializer, but this may be a table
-initializer or a compatible aggregate.</li>
-
-<li>Excess initializers cause an error.</li>
-
-</ul>
-
-<h2 id="init_table">Table Initializers</h2>
-<p>
-The following rules apply if a Lua table is used to initialize an
-Array or a <tt>struct</tt>/<tt>union</tt>:
-</p>
-<ul>
-
-<li>If the table index <tt>[0]</tt> is non-<tt>nil</tt>, then the
-table is assumed to be zero-based. Otherwise it's assumed to be
-one-based.</li>
-
-<li>Array elements, starting at index zero, are initialized one-by-one
-with the consecutive table elements, starting at either index
-<tt>[0]</tt> or <tt>[1]</tt>. This process stops at the first
-<tt>nil</tt> table element.</li>
-
-<li>If exactly one array element was initialized, it's repeated for
-all the remaining elements. Otherwise all remaining uninitialized
-elements are filled with zero bytes.</li>
-
-<li>The above logic only applies to arrays with a known fixed size.
-A VLA is only initialized with the element(s) given in the table.
-Depending on the use case, you may need to explicitly add a
-<tt>NULL</tt> or <tt>0</tt> terminator to a VLA.</li>
-
-<li>A <tt>struct</tt>/<tt>union</tt> can be initialized in the
-order of the declaration of its fields. Each field is initialized with
-consecutive table elements, starting at either index <tt>[0]</tt>
-or <tt>[1]</tt>. This process stops at the first <tt>nil</tt> table
-element.</li>
-
-<li>Otherwise, if neither index <tt>[0]</tt> nor <tt>[1]</tt> is present,
-a <tt>struct</tt>/<tt>union</tt> is initialized by looking up each field
-name (as a string key) in the table. Each non-<tt>nil</tt> value is
-used to initialize the corresponding field.</li>
-
-<li>Uninitialized fields of a <tt>struct</tt> are filled with zero
-bytes, except for the trailing VLA of a VLS.</li>
-
-<li>Initialization of a <tt>union</tt> stops after one field has been
-initialized. If no field has been initialized, the <tt>union</tt> is
-filled with zero bytes.</li>
-
-<li>Elements or fields which are aggregates themselves are initialized
-with a <em>single</em> initializer, but this may be a nested table
-initializer (or a compatible aggregate).</li>
-
-<li>Excess initializers for an array cause an error. Excess
-initializers for a <tt>struct</tt>/<tt>union</tt> are ignored.
-Unrelated table entries are ignored, too.</li>
-
-</ul>
-<p>
-Example:
-</p>
-<pre class="code">
-local ffi = require("ffi")
-
-ffi.cdef[[
-struct foo { int a, b; };
-union bar { int i; double d; };
-struct nested { int x; struct foo y; };
-]]
-
-ffi.new("int[3]", {}) --> 0, 0, 0
-ffi.new("int[3]", {1}) --> 1, 1, 1
-ffi.new("int[3]", {1,2}) --> 1, 2, 0
-ffi.new("int[3]", {1,2,3}) --> 1, 2, 3
-ffi.new("int[3]", {[0]=1}) --> 1, 1, 1
-ffi.new("int[3]", {[0]=1,2}) --> 1, 2, 0
-ffi.new("int[3]", {[0]=1,2,3}) --> 1, 2, 3
-ffi.new("int[3]", {[0]=1,2,3,4}) --> error: too many initializers
-
-ffi.new("struct foo", {}) --> a = 0, b = 0
-ffi.new("struct foo", {1}) --> a = 1, b = 0
-ffi.new("struct foo", {1,2}) --> a = 1, b = 2
-ffi.new("struct foo", {[0]=1,2}) --> a = 1, b = 2
-ffi.new("struct foo", {b=2}) --> a = 0, b = 2
-ffi.new("struct foo", {a=1,b=2,c=3}) --> a = 1, b = 2 'c' is ignored
-
-ffi.new("union bar", {}) --> i = 0, d = 0.0
-ffi.new("union bar", {1}) --> i = 1, d = ?
-ffi.new("union bar", {[0]=1,2}) --> i = 1, d = ? '2' is ignored
-ffi.new("union bar", {d=2}) --> i = ?, d = 2.0
-
-ffi.new("struct nested", {1,{2,3}}) --> x = 1, y.a = 2, y.b = 3
-ffi.new("struct nested", {x=1,y={2,3}}) --> x = 1, y.a = 2, y.b = 3
-</pre>
-
-<h2 id="cdata_ops">Operations on cdata Objects</h2>
-<p>
-All of the standard Lua operators can be applied to cdata objects or a
-mix of a cdata object and another Lua object. The following list shows
-the pre-defined operations.
-</p>
-<p>
-Reference types are dereferenced <em>before</em> performing each of
-the operations below — the operation is applied to the
-C type pointed to by the reference.
-</p>
-<p>
-The pre-defined operations are always tried first before deferring to a
-metamethod or index table (if any) for the corresponding ctype (except
-for <tt>__new</tt>). An error is raised if the metamethod lookup or
-index table lookup fails.
-</p>
-
-<h3 id="cdata_array">Indexing a cdata object</h3>
-<ul>
-
-<li><b>Indexing a pointer/array</b>: a cdata pointer/array can be
-indexed by a cdata number or a Lua number. The element address is
-computed as the base address plus the number value multiplied by the
-element size in bytes. A read access loads the element value and
-<a href="#convert_tolua">converts it to a Lua object</a>. A write
-access <a href="#convert_fromlua">converts a Lua object to the element
-type</a> and stores the converted value to the element. An error is
-raised if the element size is undefined or a write access to a
-constant element is attempted.</li>
-
-<li><b>Dereferencing a <tt>struct</tt>/<tt>union</tt> field</b>: a
-cdata <tt>struct</tt>/<tt>union</tt> or a pointer to a
-<tt>struct</tt>/<tt>union</tt> can be dereferenced by a string key,
-giving the field name. The field address is computed as the base
-address plus the relative offset of the field. A read access loads the
-field value and <a href="#convert_tolua">converts it to a Lua
-object</a>. A write access <a href="#convert_fromlua">converts a Lua
-object to the field type</a> and stores the converted value to the
-field. An error is raised if a write access to a constant
-<tt>struct</tt>/<tt>union</tt> or a constant field is attempted.
-Scoped enum constants or static constants are treated like a constant
-field.</li>
-
-<li><b>Indexing a complex number</b>: a complex number can be indexed
-either by a cdata number or a Lua number with the values 0 or 1, or by
-the strings <tt>"re"</tt> or <tt>"im"</tt>. A read access loads the
-real part (<tt>[0]</tt>, <tt>.re</tt>) or the imaginary part
-(<tt>[1]</tt>, <tt>.im</tt>) part of a complex number and
-<a href="#convert_tolua">converts it to a Lua number</a>. The
-sub-parts of a complex number are immutable — assigning to an
-index of a complex number raises an error. Accessing out-of-bound
-indexes returns unspecified results, but is guaranteed not to trigger
-memory access violations.</li>
-
-<li><b>Indexing a vector</b>: a vector is treated like an array for
-indexing purposes, except the vector elements are immutable —
-assigning to an index of a vector raises an error.</li>
-
-</ul>
-<p>
-A ctype object can be indexed with a string key, too. The only
-pre-defined operation is reading scoped constants of
-<tt>struct</tt>/<tt>union</tt> types. All other accesses defer
-to the corresponding metamethods or index tables (if any).
-</p>
-<p>
-Note: since there's (deliberately) no address-of operator, a cdata
-object holding a value type is effectively immutable after
-initialization. The JIT compiler benefits from this fact when applying
-certain optimizations.
-</p>
-<p>
-As a consequence, the <em>elements</em> of complex numbers and
-vectors are immutable. But the elements of an aggregate holding these
-types <em>may</em> be modified of course. I.e. you cannot assign to
-<tt>foo.c.im</tt>, but you can assign a (newly created) complex number
-to <tt>foo.c</tt>.
-</p>
-<p>
-The JIT compiler implements strict aliasing rules: accesses to different
-types do <b>not</b> alias, except for differences in signedness (this
-applies even to <tt>char</tt> pointers, unlike C99). Type punning
-through unions is explicitly detected and allowed.
-</p>
-
-<h3 id="cdata_call">Calling a cdata object</h3>
-<ul>
-
-<li><b>Constructor</b>: a ctype object can be called and used as a
-<a href="ext_ffi_api.html#ffi_new">constructor</a>. This is equivalent
-to <tt>ffi.new(ct, ...)</tt>, unless a <tt>__new</tt> metamethod is
-defined. The <tt>__new</tt> metamethod is called with the ctype object
-plus any other arguments passed to the contructor. Note that you have to
-use <tt>ffi.new</tt> inside of it, since calling <tt>ct(...)</tt> would
-cause infinite recursion.</li>
-
-<li><b>C function call</b>: a cdata function or cdata function
-pointer can be called. The passed arguments are
-<a href="#convert_fromlua">converted to the C types</a> of the
-parameters given by the function declaration. Arguments passed to the
-variable argument part of vararg C function use
-<a href="#convert_vararg">special conversion rules</a>. This
-C function is called and the return value (if any) is
-<a href="#convert_tolua">converted to a Lua object</a>.<br>
-On Windows/x86 systems, <tt>__stdcall</tt> functions are automatically
-detected and a function declared as <tt>__cdecl</tt> (the default) is
-silently fixed up after the first call.</li>
-
-</ul>
-
-<h3 id="cdata_arith">Arithmetic on cdata objects</h3>
-<ul>
-
-<li><b>Pointer arithmetic</b>: a cdata pointer/array and a cdata
-number or a Lua number can be added or subtracted. The number must be
-on the right hand side for a subtraction. The result is a pointer of
-the same type with an address plus or minus the number value
-multiplied by the element size in bytes. An error is raised if the
-element size is undefined.</li>
-
-<li><b>Pointer difference</b>: two compatible cdata pointers/arrays
-can be subtracted. The result is the difference between their
-addresses, divided by the element size in bytes. An error is raised if
-the element size is undefined or zero.</li>
-
-<li><b>64 bit integer arithmetic</b>: the standard arithmetic
-operators (<tt>+ - * / % ^</tt> and unary
-minus) can be applied to two cdata numbers, or a cdata number and a
-Lua number. If one of them is an <tt>uint64_t</tt>, the other side is
-converted to an <tt>uint64_t</tt> and an unsigned arithmetic operation
-is performed. Otherwise both sides are converted to an
-<tt>int64_t</tt> and a signed arithmetic operation is performed. The
-result is a boxed 64 bit cdata object.<br>
-
-If one of the operands is an <tt>enum</tt> and the other operand is a
-string, the string is converted to the value of a matching <tt>enum</tt>
-constant before the above conversion.<br>
-
-These rules ensure that 64 bit integers are "sticky". Any
-expression involving at least one 64 bit integer operand results
-in another one. The undefined cases for the division, modulo and power
-operators return <tt>2LL ^ 63</tt> or
-<tt>2ULL ^ 63</tt>.<br>
-
-You'll have to explicitly convert a 64 bit integer to a Lua
-number (e.g. for regular floating-point calculations) with
-<tt>tonumber()</tt>. But note this may incur a precision loss.</li>
-
-</ul>
-
-<h3 id="cdata_comp">Comparisons of cdata objects</h3>
-<ul>
-
-<li><b>Pointer comparison</b>: two compatible cdata pointers/arrays
-can be compared. The result is the same as an unsigned comparison of
-their addresses. <tt>nil</tt> is treated like a <tt>NULL</tt> pointer,
-which is compatible with any other pointer type.</li>
-
-<li><b>64 bit integer comparison</b>: two cdata numbers, or a
-cdata number and a Lua number can be compared with each other. If one
-of them is an <tt>uint64_t</tt>, the other side is converted to an
-<tt>uint64_t</tt> and an unsigned comparison is performed. Otherwise
-both sides are converted to an <tt>int64_t</tt> and a signed
-comparison is performed.<br>
-
-If one of the operands is an <tt>enum</tt> and the other operand is a
-string, the string is converted to the value of a matching <tt>enum</tt>
-constant before the above conversion.<br>
-
-<li><b>Comparisons for equality/inequality</b> never raise an error.
-Even incompatible pointers can be compared for equality by address. Any
-other incompatible comparison (also with non-cdata objects) treats the
-two sides as unequal.</li>
-
-</ul>
-
-<h3 id="cdata_key">cdata objects as table keys</h3>
-<p>
-Lua tables may be indexed by cdata objects, but this doesn't provide
-any useful semantics — <b>cdata objects are unsuitable as table
-keys!</b>
-</p>
-<p>
-A cdata object is treated like any other garbage-collected object and
-is hashed and compared by its address for table indexing. Since
-there's no interning for cdata value types, the same value may be
-boxed in different cdata objects with different addresses. Thus
-<tt>t[1LL+1LL]</tt> and <tt>t[2LL]</tt> usually <b>do not</b> point to
-the same hash slot and they certainly <b>do not</b> point to the same
-hash slot as <tt>t[2]</tt>.
-</p>
-<p>
-It would seriously drive up implementation complexity and slow down
-the common case, if one were to add extra handling for by-value
-hashing and comparisons to Lua tables. Given the ubiquity of their use
-inside the VM, this is not acceptable.
-</p>
-<p>
-There are three viable alternatives, if you really need to use cdata
-objects as keys:
-</p>
-<ul>
-
-<li>If you can get by with the precision of Lua numbers
-(52 bits), then use <tt>tonumber()</tt> on a cdata number or
-combine multiple fields of a cdata aggregate to a Lua number. Then use
-the resulting Lua number as a key when indexing tables.<br>
-One obvious benefit: <tt>t[tonumber(2LL)]</tt> <b>does</b> point to
-the same slot as <tt>t[2]</tt>.</li>
-
-<li>Otherwise use either <tt>tostring()</tt> on 64 bit integers
-or complex numbers or combine multiple fields of a cdata aggregate to
-a Lua string (e.g. with
-<a href="ext_ffi_api.html#ffi_string"><tt>ffi.string()</tt></a>). Then
-use the resulting Lua string as a key when indexing tables.</li>
-
-<li>Create your own specialized hash table implementation using the
-C types provided by the FFI library, just like you would in
-C code. Ultimately this may give much better performance than the
-other alternatives or what a generic by-value hash table could
-possibly provide.</li>
-
-</ul>
-
-<h2 id="param">Parameterized Types</h2>
-<p>
-To facilitate some abstractions, the two functions
-<a href="ext_ffi_api.html#ffi_typeof"><tt>ffi.typeof</tt></a> and
-<a href="ext_ffi_api.html#ffi_cdef"><tt>ffi.cdef</tt></a> support
-parameterized types in C declarations. Note: none of the other API
-functions taking a cdecl allow this.
-</p>
-<p>
-Any place you can write a <b><tt>typedef</tt> name</b>, an
-<b>identifier</b> or a <b>number</b> in a declaration, you can write
-<tt>$</tt> (the dollar sign) instead. These placeholders are replaced in
-order of appearance with the arguments following the cdecl string:
-</p>
-<pre class="code">
--- Declare a struct with a parameterized field type and name:
-ffi.cdef([[
-typedef struct { $ $; } foo_t;
-]], type1, name1)
-
--- Anonymous struct with dynamic names:
-local bar_t = ffi.typeof("struct { int $, $; }", name1, name2)
--- Derived pointer type:
-local bar_ptr_t = ffi.typeof("$ *", bar_t)
-
--- Parameterized dimensions work even where a VLA won't work:
-local matrix_t = ffi.typeof("uint8_t[$][$]", width, height)
-</pre>
-<p>
-Caveat: this is <em>not</em> simple text substitution! A passed ctype or
-cdata object is treated like the underlying type, a passed string is
-considered an identifier and a number is considered a number. You must
-not mix this up: e.g. passing <tt>"int"</tt> as a string doesn't work in
-place of a type, you'd need to use <tt>ffi.typeof("int")</tt> instead.
-</p>
-<p>
-The main use for parameterized types are libraries implementing abstract
-data types
-(<a href="http://www.freelists.org/post/luajit/ffi-type-of-pointer-to,8"><span class="ext">»</span> example</a>),
-similar to what can be achieved with C++ template metaprogramming.
-Another use case are derived types of anonymous structs, which avoids
-pollution of the global struct namespace.
-</p>
-<p>
-Please note that parameterized types are a nice tool and indispensable
-for certain use cases. But you'll want to use them sparingly in regular
-code, e.g. when all types are actually fixed.
-</p>
-
-<h2 id="gc">Garbage Collection of cdata Objects</h2>
-<p>
-All explicitly (<tt>ffi.new()</tt>, <tt>ffi.cast()</tt> etc.) or
-implicitly (accessors) created cdata objects are garbage collected.
-You need to ensure to retain valid references to cdata objects
-somewhere on a Lua stack, an upvalue or in a Lua table while they are
-still in use. Once the last reference to a cdata object is gone, the
-garbage collector will automatically free the memory used by it (at
-the end of the next GC cycle).
-</p>
-<p>
-Please note that pointers themselves are cdata objects, however they
-are <b>not</b> followed by the garbage collector. So e.g. if you
-assign a cdata array to a pointer, you must keep the cdata object
-holding the array alive as long as the pointer is still in use:
-</p>
-<pre class="code">
-ffi.cdef[[
-typedef struct { int *a; } foo_t;
-]]
-
-local s = ffi.new("foo_t", ffi.new("int[10]")) -- <span style="color:#c00000;">WRONG!</span>
-
-local a = ffi.new("int[10]") -- <span style="color:#00a000;">OK</span>
-local s = ffi.new("foo_t", a)
--- Now do something with 's', but keep 'a' alive until you're done.
-</pre>
-<p>
-Similar rules apply for Lua strings which are implicitly converted to
-<tt>"const char *"</tt>: the string object itself must be
-referenced somewhere or it'll be garbage collected eventually. The
-pointer will then point to stale data, which may have already been
-overwritten. Note that <em>string literals</em> are automatically kept
-alive as long as the function containing it (actually its prototype)
-is not garbage collected.
-</p>
-<p>
-Objects which are passed as an argument to an external C function
-are kept alive until the call returns. So it's generally safe to
-create temporary cdata objects in argument lists. This is a common
-idiom for <a href="#convert_vararg">passing specific C types to
-vararg functions</a>.
-</p>
-<p>
-Memory areas returned by C functions (e.g. from <tt>malloc()</tt>)
-must be manually managed, of course (or use
-<a href="ext_ffi_api.html#ffi_gc"><tt>ffi.gc()</tt></a>). Pointers to
-cdata objects are indistinguishable from pointers returned by C
-functions (which is one of the reasons why the GC cannot follow them).
-</p>
-
-<h2 id="callback">Callbacks</h2>
-<p>
-The LuaJIT FFI automatically generates special callback functions
-whenever a Lua function is converted to a C function pointer. This
-associates the generated callback function pointer with the C type
-of the function pointer and the Lua function object (closure).
-</p>
-<p>
-This can happen implicitly due to the usual conversions, e.g. when
-passing a Lua function to a function pointer argument. Or you can use
-<tt>ffi.cast()</tt> to explicitly cast a Lua function to a
-C function pointer.
-</p>
-<p>
-Currently only certain C function types can be used as callback
-functions. Neither C vararg functions nor functions with
-pass-by-value aggregate argument or result types are supported. There
-are no restrictions for the kind of Lua functions that can be called
-from the callback — no checks for the proper number of arguments
-are made. The return value of the Lua function will be converted to the
-result type and an error will be thrown for invalid conversions.
-</p>
-<p>
-It's allowed to throw errors across a callback invocation, but it's not
-advisable in general. Do this only if you know the C function, that
-called the callback, copes with the forced stack unwinding and doesn't
-leak resources.
-</p>
-<p>
-One thing that's not allowed, is to let an FFI call into a C function
-get JIT-compiled, which in turn calls a callback, calling into Lua again.
-Usually this attempt is caught by the interpreter first and the
-C function is blacklisted for compilation.
-</p>
-<p>
-However, this heuristic may fail under specific circumstances: e.g. a
-message polling function might not run Lua callbacks right away and the call
-gets JIT-compiled. If it later happens to call back into Lua (e.g. a rarely
-invoked error callback), you'll get a VM PANIC with the message
-<tt>"bad callback"</tt>. Then you'll need to manually turn off
-JIT-compilation with
-<a href="ext_jit.html#jit_onoff_func"><tt>jit.off()</tt></a> for the
-surrounding Lua function that invokes such a message polling function (or
-similar).
-</p>
-
-<h3 id="callback_resources">Callback resource handling</h3>
-<p>
-Callbacks take up resources — you can only have a limited number
-of them at the same time (500 - 1000, depending on the
-architecture). The associated Lua functions are anchored to prevent
-garbage collection, too.
-</p>
-<p>
-<b>Callbacks due to implicit conversions are permanent!</b> There is no
-way to guess their lifetime, since the C side might store the
-function pointer for later use (typical for GUI toolkits). The associated
-resources cannot be reclaimed until termination:
-</p>
-<pre class="code">
-ffi.cdef[[
-typedef int (__stdcall *WNDENUMPROC)(void *hwnd, intptr_t l);
-int EnumWindows(WNDENUMPROC func, intptr_t l);
-]]
-
--- Implicit conversion to a callback via function pointer argument.
-local count = 0
-ffi.C.EnumWindows(function(hwnd, l)
- count = count + 1
- return true
-end, 0)
--- The callback is permanent and its resources cannot be reclaimed!
--- Ok, so this may not be a problem, if you do this only once.
-</pre>
-<p>
-Note: this example shows that you <em>must</em> properly declare
-<tt>__stdcall</tt> callbacks on Windows/x86 systems. The calling
-convention cannot be automatically detected, unlike for
-<tt>__stdcall</tt> calls <em>to</em> Windows functions.
-</p>
-<p>
-For some use cases it's necessary to free up the resources or to
-dynamically redirect callbacks. Use an explicit cast to a
-C function pointer and keep the resulting cdata object. Then use
-the <a href="ext_ffi_api.html#callback_free"><tt>cb:free()</tt></a>
-or <a href="ext_ffi_api.html#callback_set"><tt>cb:set()</tt></a> methods
-on the cdata object:
-</p>
-<pre class="code">
--- Explicitly convert to a callback via cast.
-local count = 0
-local cb = ffi.cast("WNDENUMPROC", function(hwnd, l)
- count = count + 1
- return true
-end)
-
--- Pass it to a C function.
-ffi.C.EnumWindows(cb, 0)
--- EnumWindows doesn't need the callback after it returns, so free it.
-
-cb:free()
--- The callback function pointer is no longer valid and its resources
--- will be reclaimed. The created Lua closure will be garbage collected.
-</pre>
-
-<h3 id="callback_performance">Callback performance</h3>
-<p>
-<b>Callbacks are slow!</b> First, the C to Lua transition itself
-has an unavoidable cost, similar to a <tt>lua_call()</tt> or
-<tt>lua_pcall()</tt>. Argument and result marshalling add to that cost.
-And finally, neither the C compiler nor LuaJIT can inline or
-optimize across the language barrier and hoist repeated computations out
-of a callback function.
-</p>
-<p>
-Do not use callbacks for performance-sensitive work: e.g. consider a
-numerical integration routine which takes a user-defined function to
-integrate over. It's a bad idea to call a user-defined Lua function from
-C code millions of times. The callback overhead will be absolutely
-detrimental for performance.
-</p>
-<p>
-It's considerably faster to write the numerical integration routine
-itself in Lua — the JIT compiler will be able to inline the
-user-defined function and optimize it together with its calling context,
-with very competitive performance.
-</p>
-<p>
-As a general guideline: <b>use callbacks only when you must</b>, because
-of existing C APIs. E.g. callback performance is irrelevant for a
-GUI application, which waits for user input most of the time, anyway.
-</p>
-<p>
-For new designs <b>avoid push-style APIs</b>: a C function repeatedly
-calling a callback for each result. Instead <b>use pull-style APIs</b>:
-call a C function repeatedly to get a new result. Calls from Lua
-to C via the FFI are much faster than the other way round. Most well-designed
-libraries already use pull-style APIs (read/write, get/put).
-</p>
-
-<h2 id="clib">C Library Namespaces</h2>
-<p>
-A C library namespace is a special kind of object which allows
-access to the symbols contained in shared libraries or the default
-symbol namespace. The default
-<a href="ext_ffi_api.html#ffi_C"><tt>ffi.C</tt></a> namespace is
-automatically created when the FFI library is loaded. C library
-namespaces for specific shared libraries may be created with the
-<a href="ext_ffi_api.html#ffi_load"><tt>ffi.load()</tt></a> API
-function.
-</p>
-<p>
-Indexing a C library namespace object with a symbol name (a Lua
-string) automatically binds it to the library. First the symbol type
-is resolved — it must have been declared with
-<a href="ext_ffi_api.html#ffi_cdef"><tt>ffi.cdef</tt></a>. Then the
-symbol address is resolved by searching for the symbol name in the
-associated shared libraries or the default symbol namespace. Finally,
-the resulting binding between the symbol name, the symbol type and its
-address is cached. Missing symbol declarations or nonexistent symbol
-names cause an error.
-</p>
-<p>
-This is what happens on a <b>read access</b> for the different kinds of
-symbols:
-</p>
-<ul>
-
-<li>External functions: a cdata object with the type of the function
-and its address is returned.</li>
-
-<li>External variables: the symbol address is dereferenced and the
-loaded value is <a href="#convert_tolua">converted to a Lua object</a>
-and returned.</li>
-
-<li>Constant values (<tt>static const</tt> or <tt>enum</tt>
-constants): the constant is <a href="#convert_tolua">converted to a
-Lua object</a> and returned.</li>
-
-</ul>
-<p>
-This is what happens on a <b>write access</b>:
-</p>
-<ul>
-
-<li>External variables: the value to be written is
-<a href="#convert_fromlua">converted to the C type</a> of the
-variable and then stored at the symbol address.</li>
-
-<li>Writing to constant variables or to any other symbol type causes
-an error, like any other attempted write to a constant location.</li>
-
-</ul>
-<p>
-C library namespaces themselves are garbage collected objects. If
-the last reference to the namespace object is gone, the garbage
-collector will eventually release the shared library reference and
-remove all memory associated with the namespace. Since this may
-trigger the removal of the shared library from the memory of the
-running process, it's generally <em>not safe</em> to use function
-cdata objects obtained from a library if the namespace object may be
-unreferenced.
-</p>
-<p>
-Performance notice: the JIT compiler specializes to the identity of
-namespace objects and to the strings used to index it. This
-effectively turns function cdata objects into constants. It's not
-useful and actually counter-productive to explicitly cache these
-function objects, e.g. <tt>local strlen = ffi.C.strlen</tt>. OTOH it
-<em>is</em> useful to cache the namespace itself, e.g. <tt>local C =
-ffi.C</tt>.
-</p>
-
-<h2 id="policy">No Hand-holding!</h2>
-<p>
-The FFI library has been designed as <b>a low-level library</b>. The
-goal is to interface with C code and C data types with a
-minimum of overhead. This means <b>you can do anything you can do
-from C</b>: access all memory, overwrite anything in memory, call
-machine code at any memory address and so on.
-</p>
-<p>
-The FFI library provides <b>no memory safety</b>, unlike regular Lua
-code. It will happily allow you to dereference a <tt>NULL</tt>
-pointer, to access arrays out of bounds or to misdeclare
-C functions. If you make a mistake, your application might crash,
-just like equivalent C code would.
-</p>
-<p>
-This behavior is inevitable, since the goal is to provide full
-interoperability with C code. Adding extra safety measures, like
-bounds checks, would be futile. There's no way to detect
-misdeclarations of C functions, since shared libraries only
-provide symbol names, but no type information. Likewise there's no way
-to infer the valid range of indexes for a returned pointer.
-</p>
-<p>
-Again: the FFI library is a low-level library. This implies it needs
-to be used with care, but it's flexibility and performance often
-outweigh this concern. If you're a C or C++ developer, it'll be easy
-to apply your existing knowledge. OTOH writing code for the FFI
-library is not for the faint of heart and probably shouldn't be the
-first exercise for someone with little experience in Lua, C or C++.
-</p>
-<p>
-As a corollary of the above, the FFI library is <b>not safe for use by
-untrusted Lua code</b>. If you're sandboxing untrusted Lua code, you
-definitely don't want to give this code access to the FFI library or
-to <em>any</em> cdata object (except 64 bit integers or complex
-numbers). Any properly engineered Lua sandbox needs to provide safety
-wrappers for many of the standard Lua library functions —
-similar wrappers need to be written for high-level operations on FFI
-data types, too.
-</p>
-
-<h2 id="status">Current Status</h2>
-<p>
-The initial release of the FFI library has some limitations and is
-missing some features. Most of these will be fixed in future releases.
-</p>
-<p>
-<a href="#clang">C language support</a> is
-currently incomplete:
-</p>
-<ul>
-<li>C declarations are not passed through a C pre-processor,
-yet.</li>
-<li>The C parser is able to evaluate most constant expressions
-commonly found in C header files. However it doesn't handle the
-full range of C expression semantics and may fail for some
-obscure constructs.</li>
-<li><tt>static const</tt> declarations only work for integer types
-up to 32 bits. Neither declaring string constants nor
-floating-point constants is supported.</li>
-<li>Packed <tt>struct</tt> bitfields that cross container boundaries
-are not implemented.</li>
-<li>Native vector types may be defined with the GCC <tt>mode</tt> or
-<tt>vector_size</tt> attribute. But no operations other than loading,
-storing and initializing them are supported, yet.</li>
-<li>The <tt>volatile</tt> type qualifier is currently ignored by
-compiled code.</li>
-<li><a href="ext_ffi_api.html#ffi_cdef"><tt>ffi.cdef</tt></a> silently
-ignores most re-declarations. Note: avoid re-declarations which do not
-conform to C99. The implementation will eventually be changed to
-perform strict checks.</li>
-</ul>
-<p>
-The JIT compiler already handles a large subset of all FFI operations.
-It automatically falls back to the interpreter for unimplemented
-operations (you can check for this with the
-<a href="running.html#opt_j"><tt>-jv</tt></a> command line option).
-The following operations are currently not compiled and may exhibit
-suboptimal performance, especially when used in inner loops:
-</p>
-<ul>
-<li>Bitfield accesses and initializations.</li>
-<li>Vector operations.</li>
-<li>Table initializers.</li>
-<li>Initialization of nested <tt>struct</tt>/<tt>union</tt> types.</li>
-<li>Allocations of variable-length arrays or structs.</li>
-<li>Allocations of C types with a size > 128 bytes or an
-alignment > 8 bytes.</li>
-<li>Conversions from lightuserdata to <tt>void *</tt>.</li>
-<li>Pointer differences for element sizes that are not a power of
-two.</li>
-<li>Calls to C functions with aggregates passed or returned by
-value.</li>
-<li>Calls to ctype metamethods which are not plain functions.</li>
-<li>ctype <tt>__newindex</tt> tables and non-string lookups in ctype
-<tt>__index</tt> tables.</li>
-<li><tt>tostring()</tt> for cdata types.</li>
-<li>Calls to <tt>ffi.cdef()</tt>, <tt>ffi.load()</tt> and
-<tt>ffi.metatype()</tt>.</li>
-</ul>
-<p>
-Other missing features:
-</p>
-<ul>
-<li>Bit operations for 64 bit types.</li>
-<li>Arithmetic for <tt>complex</tt> numbers.</li>
-<li>Passing structs by value to vararg C functions.</li>
-<li><a href="extensions.html#exceptions">C++ exception interoperability</a>
-does not extend to C functions called via the FFI, if the call is
-compiled.</li>
-</ul>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/ext_ffi_tutorial.html b/lib/luajit/doc/ext_ffi_tutorial.html
deleted file mode 100644
index 8f99bfb..0000000
--- a/lib/luajit/doc/ext_ffi_tutorial.html
+++ /dev/null
@@ -1,601 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>FFI Tutorial</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-table.idiomtable { font-size: 90%; line-height: 1.2; }
-table.idiomtable tt { font-size: 100%; }
-table.idiomtable td { vertical-align: top; }
-tr.idiomhead td { font-weight: bold; }
-td.idiomlua b { font-weight: normal; color: #2142bf; }
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>FFI Tutorial</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a class="current" href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-This page is intended to give you an overview of the features of the FFI
-library by presenting a few use cases and guidelines.
-</p>
-<p>
-This page makes no attempt to explain all of the FFI library, though.
-You'll want to have a look at the <a href="ext_ffi_api.html">ffi.* API
-function reference</a> and the <a href="ext_ffi_semantics.html">FFI
-semantics</a> to learn more.
-</p>
-
-<h2 id="load">Loading the FFI Library</h2>
-<p>
-The FFI library is built into LuaJIT by default, but it's not loaded
-and initialized by default. The suggested way to use the FFI library
-is to add the following to the start of every Lua file that needs one
-of its functions:
-</p>
-<pre class="code">
-local ffi = require("ffi")
-</pre>
-<p>
-Please note this doesn't define an <tt>ffi</tt> variable in the table
-of globals — you really need to use the local variable. The
-<tt>require</tt> function ensures the library is only loaded once.
-</p>
-<p style="font-size: 8pt;">
-Note: If you want to experiment with the FFI from the interactive prompt
-of the command line executable, omit the <tt>local</tt>, as it doesn't
-preserve local variables across lines.
-</p>
-
-<h2 id="sleep">Accessing Standard System Functions</h2>
-<p>
-The following code explains how to access standard system functions.
-We slowly print two lines of dots by sleeping for 10 milliseconds
-after each dot:
-</p>
-<pre class="code mark">
-<span class="codemark">
-①
-
-
-
-
-
-②
-③
-④
-
-
-
-⑤
-
-
-
-
-
-⑥</span>local ffi = require("ffi")
-ffi.cdef[[
-<span style="color:#00a000;">void Sleep(int ms);
-int poll(struct pollfd *fds, unsigned long nfds, int timeout);</span>
-]]
-
-local sleep
-if ffi.os == "Windows" then
- function sleep(s)
- ffi.C.Sleep(s*1000)
- end
-else
- function sleep(s)
- ffi.C.poll(nil, 0, s*1000)
- end
-end
-
-for i=1,160 do
- io.write("."); io.flush()
- sleep(0.01)
-end
-io.write("\n")
-</pre>
-<p>
-Here's the step-by-step explanation:
-</p>
-<p>
-<span class="mark">①</span> This defines the
-C library functions we're going to use. The part inside the
-double-brackets (in green) is just standard C syntax. You can
-usually get this info from the C header files or the
-documentation provided by each C library or C compiler.
-</p>
-<p>
-<span class="mark">②</span> The difficulty we're
-facing here, is that there are different standards to choose from.
-Windows has a simple <tt>Sleep()</tt> function. On other systems there
-are a variety of functions available to achieve sub-second sleeps, but
-with no clear consensus. Thankfully <tt>poll()</tt> can be used for
-this task, too, and it's present on most non-Windows systems. The
-check for <tt>ffi.os</tt> makes sure we use the Windows-specific
-function only on Windows systems.
-</p>
-<p>
-<span class="mark">③</span> Here we're wrapping the
-call to the C function in a Lua function. This isn't strictly
-necessary, but it's helpful to deal with system-specific issues only
-in one part of the code. The way we're wrapping it ensures the check
-for the OS is only done during initialization and not for every call.
-</p>
-<p>
-<span class="mark">④</span> A more subtle point is
-that we defined our <tt>sleep()</tt> function (for the sake of this
-example) as taking the number of seconds, but accepting fractional
-seconds. Multiplying this by 1000 gets us milliseconds, but that still
-leaves it a Lua number, which is a floating-point value. Alas, the
-<tt>Sleep()</tt> function only accepts an integer value. Luckily for
-us, the FFI library automatically performs the conversion when calling
-the function (truncating the FP value towards zero, like in C).
-</p>
-<p style="font-size: 8pt;">
-Some readers will notice that <tt>Sleep()</tt> is part of
-<tt>KERNEL32.DLL</tt> and is also a <tt>stdcall</tt> function. So how
-can this possibly work? The FFI library provides the <tt>ffi.C</tt>
-default C library namespace, which allows calling functions from
-the default set of libraries, like a C compiler would. Also, the
-FFI library automatically detects <tt>stdcall</tt> functions, so you
-don't need to declare them as such.
-</p>
-<p>
-<span class="mark">⑤</span> The <tt>poll()</tt>
-function takes a couple more arguments we're not going to use. You can
-simply use <tt>nil</tt> to pass a <tt>NULL</tt> pointer and <tt>0</tt>
-for the <tt>nfds</tt> parameter. Please note that the
-number <tt>0</tt> <em>does not convert to a pointer value</em>,
-unlike in C++. You really have to pass pointers to pointer arguments
-and numbers to number arguments.
-</p>
-<p style="font-size: 8pt;">
-The page on <a href="ext_ffi_semantics.html">FFI semantics</a> has all
-of the gory details about
-<a href="ext_ffi_semantics.html#convert">conversions between Lua
-objects and C types</a>. For the most part you don't have to deal
-with this, as it's performed automatically and it's carefully designed
-to bridge the semantic differences between Lua and C.
-</p>
-<p>
-<span class="mark">⑥</span> Now that we have defined
-our own <tt>sleep()</tt> function, we can just call it from plain Lua
-code. That wasn't so bad, huh? Turning these boring animated dots into
-a fascinating best-selling game is left as an exercise for the reader.
-:-)
-</p>
-
-<h2 id="zlib">Accessing the zlib Compression Library</h2>
-<p>
-The following code shows how to access the <a
-href="http://zlib.net/">zlib</a> compression library from Lua code.
-We'll define two convenience wrapper functions that take a string and
-compress or uncompress it to another string:
-</p>
-<pre class="code mark">
-<span class="codemark">
-①
-
-
-
-
-
-
-②
-
-
-③
-
-④
-
-
-⑤
-
-
-⑥
-
-
-
-
-
-
-
-⑦</span>local ffi = require("ffi")
-ffi.cdef[[
-<span style="color:#00a000;">unsigned long compressBound(unsigned long sourceLen);
-int compress2(uint8_t *dest, unsigned long *destLen,
- const uint8_t *source, unsigned long sourceLen, int level);
-int uncompress(uint8_t *dest, unsigned long *destLen,
- const uint8_t *source, unsigned long sourceLen);</span>
-]]
-local zlib = ffi.load(ffi.os == "Windows" and "zlib1" or "z")
-
-local function compress(txt)
- local n = zlib.compressBound(#txt)
- local buf = ffi.new("uint8_t[?]", n)
- local buflen = ffi.new("unsigned long[1]", n)
- local res = zlib.compress2(buf, buflen, txt, #txt, 9)
- assert(res == 0)
- return ffi.string(buf, buflen[0])
-end
-
-local function uncompress(comp, n)
- local buf = ffi.new("uint8_t[?]", n)
- local buflen = ffi.new("unsigned long[1]", n)
- local res = zlib.uncompress(buf, buflen, comp, #comp)
- assert(res == 0)
- return ffi.string(buf, buflen[0])
-end
-
--- Simple test code.
-local txt = string.rep("abcd", 1000)
-print("Uncompressed size: ", #txt)
-local c = compress(txt)
-print("Compressed size: ", #c)
-local txt2 = uncompress(c, #txt)
-assert(txt2 == txt)
-</pre>
-<p>
-Here's the step-by-step explanation:
-</p>
-<p>
-<span class="mark">①</span> This defines some of the
-C functions provided by zlib. For the sake of this example, some
-type indirections have been reduced and it uses the pre-defined
-fixed-size integer types, while still adhering to the zlib API/ABI.
-</p>
-<p>
-<span class="mark">②</span> This loads the zlib shared
-library. On POSIX systems it's named <tt>libz.so</tt> and usually
-comes pre-installed. Since <tt>ffi.load()</tt> automatically adds any
-missing standard prefixes/suffixes, we can simply load the
-<tt>"z"</tt> library. On Windows it's named <tt>zlib1.dll</tt> and
-you'll have to download it first from the
-<a href="http://zlib.net/"><span class="ext">»</span> zlib site</a>. The check for
-<tt>ffi.os</tt> makes sure we pass the right name to
-<tt>ffi.load()</tt>.
-</p>
-<p>
-<span class="mark">③</span> First, the maximum size of
-the compression buffer is obtained by calling the
-<tt>zlib.compressBound</tt> function with the length of the
-uncompressed string. The next line allocates a byte buffer of this
-size. The <tt>[?]</tt> in the type specification indicates a
-variable-length array (VLA). The actual number of elements of this
-array is given as the 2nd argument to <tt>ffi.new()</tt>.
-</p>
-<p>
-<span class="mark">④</span> This may look strange at
-first, but have a look at the declaration of the <tt>compress2</tt>
-function from zlib: the destination length is defined as a pointer!
-This is because you pass in the maximum buffer size and get back the
-actual length that was used.
-</p>
-<p>
-In C you'd pass in the address of a local variable
-(<tt>&buflen</tt>). But since there's no address-of operator in
-Lua, we'll just pass in a one-element array. Conveniently it can be
-initialized with the maximum buffer size in one step. Calling the
-actual <tt>zlib.compress2</tt> function is then straightforward.
-</p>
-<p>
-<span class="mark">⑤</span> We want to return the
-compressed data as a Lua string, so we'll use <tt>ffi.string()</tt>.
-It needs a pointer to the start of the data and the actual length. The
-length has been returned in the <tt>buflen</tt> array, so we'll just
-get it from there.
-</p>
-<p style="font-size: 8pt;">
-Note that since the function returns now, the <tt>buf</tt> and
-<tt>buflen</tt> variables will eventually be garbage collected. This
-is fine, because <tt>ffi.string()</tt> has copied the contents to a
-newly created (interned) Lua string. If you plan to call this function
-lots of times, consider reusing the buffers and/or handing back the
-results in buffers instead of strings. This will reduce the overhead
-for garbage collection and string interning.
-</p>
-<p>
-<span class="mark">⑥</span> The <tt>uncompress</tt>
-functions does the exact opposite of the <tt>compress</tt> function.
-The compressed data doesn't include the size of the original string,
-so this needs to be passed in. Otherwise no surprises here.
-</p>
-<p>
-<span class="mark">⑦</span> The code, that makes use
-of the functions we just defined, is just plain Lua code. It doesn't
-need to know anything about the LuaJIT FFI — the convenience
-wrapper functions completely hide it.
-</p>
-<p>
-One major advantage of the LuaJIT FFI is that you are now able to
-write those wrappers <em>in Lua</em>. And at a fraction of the time it
-would cost you to create an extra C module using the Lua/C API.
-Many of the simpler C functions can probably be used directly
-from your Lua code, without any wrappers.
-</p>
-<p style="font-size: 8pt;">
-Side note: the zlib API uses the <tt>long</tt> type for passing
-lengths and sizes around. But all those zlib functions actually only
-deal with 32 bit values. This is an unfortunate choice for a
-public API, but may be explained by zlib's history — we'll just
-have to deal with it.
-</p>
-<p style="font-size: 8pt;">
-First, you should know that a <tt>long</tt> is a 64 bit type e.g.
-on POSIX/x64 systems, but a 32 bit type on Windows/x64 and on
-32 bit systems. Thus a <tt>long</tt> result can be either a plain
-Lua number or a boxed 64 bit integer cdata object, depending on
-the target system.
-</p>
-<p style="font-size: 8pt;">
-Ok, so the <tt>ffi.*</tt> functions generally accept cdata objects
-wherever you'd want to use a number. That's why we get a away with
-passing <tt>n</tt> to <tt>ffi.string()</tt> above. But other Lua
-library functions or modules don't know how to deal with this. So for
-maximum portability one needs to use <tt>tonumber()</tt> on returned
-<tt>long</tt> results before passing them on. Otherwise the
-application might work on some systems, but would fail in a POSIX/x64
-environment.
-</p>
-
-<h2 id="metatype">Defining Metamethods for a C Type</h2>
-<p>
-The following code explains how to define metamethods for a C type.
-We define a simple point type and add some operations to it:
-</p>
-<pre class="code mark">
-<span class="codemark">
-①
-
-
-
-②
-
-③
-
-④
-
-
-
-⑤
-
-⑥</span>local ffi = require("ffi")
-ffi.cdef[[
-<span style="color:#00a000;">typedef struct { double x, y; } point_t;</span>
-]]
-
-local point
-local mt = {
- __add = function(a, b) return point(a.x+b.x, a.y+b.y) end,
- __len = function(a) return math.sqrt(a.x*a.x + a.y*a.y) end,
- __index = {
- area = function(a) return a.x*a.x + a.y*a.y end,
- },
-}
-point = ffi.metatype("point_t", mt)
-
-local a = point(3, 4)
-print(a.x, a.y) --> 3 4
-print(#a) --> 5
-print(a:area()) --> 25
-local b = a + point(0.5, 8)
-print(#b) --> 12.5
-</pre>
-<p>
-Here's the step-by-step explanation:
-</p>
-<p>
-<span class="mark">①</span> This defines the C type for a
-two-dimensional point object.
-</p>
-<p>
-<span class="mark">②</span> We have to declare the variable
-holding the point constructor first, because it's used inside of a
-metamethod.
-</p>
-<p>
-<span class="mark">③</span> Let's define an <tt>__add</tt>
-metamethod which adds the coordinates of two points and creates a new
-point object. For simplicity, this function assumes that both arguments
-are points. But it could be any mix of objects, if at least one operand
-is of the required type (e.g. adding a point plus a number or vice
-versa). Our <tt>__len</tt> metamethod returns the distance of a point to
-the origin.
-</p>
-<p>
-<span class="mark">④</span> If we run out of operators, we can
-define named methods, too. Here the <tt>__index</tt> table defines an
-<tt>area</tt> function. For custom indexing needs, one might want to
-define <tt>__index</tt> and <tt>__newindex</tt> <em>functions</em> instead.
-</p>
-<p>
-<span class="mark">⑤</span> This associates the metamethods with
-our C type. This only needs to be done once. For convenience, a
-constructor is returned by
-<a href="ext_ffi_api.html#ffi_metatype"><tt>ffi.metatype()</tt></a>.
-We're not required to use it, though. The original C type can still
-be used e.g. to create an array of points. The metamethods automatically
-apply to any and all uses of this type.
-</p>
-<p>
-Please note that the association with a metatable is permanent and
-<b>the metatable must not be modified afterwards!</b> Ditto for the
-<tt>__index</tt> table.
-</p>
-<p>
-<span class="mark">⑥</span> Here are some simple usage examples
-for the point type and their expected results. The pre-defined
-operations (such as <tt>a.x</tt>) can be freely mixed with the newly
-defined metamethods. Note that <tt>area</tt> is a method and must be
-called with the Lua syntax for methods: <tt>a:area()</tt>, not
-<tt>a.area()</tt>.
-</p>
-<p>
-The C type metamethod mechanism is most useful when used in
-conjunction with C libraries that are written in an object-oriented
-style. Creators return a pointer to a new instance and methods take an
-instance pointer as the first argument. Sometimes you can just point
-<tt>__index</tt> to the library namespace and <tt>__gc</tt> to the
-destructor and you're done. But often enough you'll want to add
-convenience wrappers, e.g. to return actual Lua strings or when
-returning multiple values.
-</p>
-<p>
-Some C libraries only declare instance pointers as an opaque
-<tt>void *</tt> type. In this case you can use a fake type for all
-declarations, e.g. a pointer to a named (incomplete) struct will do:
-<tt>typedef struct foo_type *foo_handle</tt>. The C side doesn't
-know what you declare with the LuaJIT FFI, but as long as the underlying
-types are compatible, everything still works.
-</p>
-
-<h2 id="idioms">Translating C Idioms</h2>
-<p>
-Here's a list of common C idioms and their translation to the
-LuaJIT FFI:
-</p>
-<table class="idiomtable">
-<tr class="idiomhead">
-<td class="idiomdesc">Idiom</td>
-<td class="idiomc">C code</td>
-<td class="idiomlua">Lua code</td>
-</tr>
-<tr class="odd separate">
-<td class="idiomdesc">Pointer dereference<br><tt>int *p;</tt></td><td class="idiomc"><tt>x = *p;<br>*p = y;</tt></td><td class="idiomlua"><tt>x = <b>p[0]</b><br><b>p[0]</b> = y</tt></td></tr>
-<tr class="even">
-<td class="idiomdesc">Pointer indexing<br><tt>int i, *p;</tt></td><td class="idiomc"><tt>x = p[i];<br>p[i+1] = y;</tt></td><td class="idiomlua"><tt>x = p[i]<br>p[i+1] = y</tt></td></tr>
-<tr class="odd">
-<td class="idiomdesc">Array indexing<br><tt>int i, a[];</tt></td><td class="idiomc"><tt>x = a[i];<br>a[i+1] = y;</tt></td><td class="idiomlua"><tt>x = a[i]<br>a[i+1] = y</tt></td></tr>
-<tr class="even separate">
-<td class="idiomdesc"><tt>struct</tt>/<tt>union</tt> dereference<br><tt>struct foo s;</tt></td><td class="idiomc"><tt>x = s.field;<br>s.field = y;</tt></td><td class="idiomlua"><tt>x = s.field<br>s.field = y</tt></td></tr>
-<tr class="odd">
-<td class="idiomdesc"><tt>struct</tt>/<tt>union</tt> pointer deref.<br><tt>struct foo *sp;</tt></td><td class="idiomc"><tt>x = sp->field;<br>sp->field = y;</tt></td><td class="idiomlua"><tt>x = <b>s.field</b><br><b>s.field</b> = y</tt></td></tr>
-<tr class="even separate">
-<td class="idiomdesc">Pointer arithmetic<br><tt>int i, *p;</tt></td><td class="idiomc"><tt>x = p + i;<br>y = p - i;</tt></td><td class="idiomlua"><tt>x = p + i<br>y = p - i</tt></td></tr>
-<tr class="odd">
-<td class="idiomdesc">Pointer difference<br><tt>int *p1, *p2;</tt></td><td class="idiomc"><tt>x = p1 - p2;</tt></td><td class="idiomlua"><tt>x = p1 - p2</tt></td></tr>
-<tr class="even">
-<td class="idiomdesc">Array element pointer<br><tt>int i, a[];</tt></td><td class="idiomc"><tt>x = &a[i];</tt></td><td class="idiomlua"><tt>x = <b>a+i</b></tt></td></tr>
-<tr class="odd">
-<td class="idiomdesc">Cast pointer to address<br><tt>int *p;</tt></td><td class="idiomc"><tt>x = (intptr_t)p;</tt></td><td class="idiomlua"><tt>x = <b>tonumber(<br> ffi.cast("intptr_t",<br> p))</b></tt></td></tr>
-<tr class="even separate">
-<td class="idiomdesc">Functions with outargs<br><tt>void foo(int *inoutlen);</tt></td><td class="idiomc"><tt>int len = x;<br>foo(&len);<br>y = len;</tt></td><td class="idiomlua"><tt><b>local len =<br> ffi.new("int[1]", x)<br>foo(len)<br>y = len[0]</b></tt></td></tr>
-<tr class="odd">
-<td class="idiomdesc"><a href="ext_ffi_semantics.html#convert_vararg">Vararg conversions</a><br><tt>int printf(char *fmt, ...);</tt></td><td class="idiomc"><tt>printf("%g", 1.0);<br>printf("%d", 1);<br> </tt></td><td class="idiomlua"><tt>printf("%g", 1);<br>printf("%d",<br> <b>ffi.new("int", 1)</b>)</tt></td></tr>
-</table>
-
-<h2 id="cache">To Cache or Not to Cache</h2>
-<p>
-It's a common Lua idiom to cache library functions in local variables
-or upvalues, e.g.:
-</p>
-<pre class="code">
-local byte, char = string.byte, string.char
-local function foo(x)
- return char(byte(x)+1)
-end
-</pre>
-<p>
-This replaces several hash-table lookups with a (faster) direct use of
-a local or an upvalue. This is less important with LuaJIT, since the
-JIT compiler optimizes hash-table lookups a lot and is even able to
-hoist most of them out of the inner loops. It can't eliminate
-<em>all</em> of them, though, and it saves some typing for often-used
-functions. So there's still a place for this, even with LuaJIT.
-</p>
-<p>
-The situation is a bit different with C function calls via the
-FFI library. The JIT compiler has special logic to eliminate <em>all
-of the lookup overhead</em> for functions resolved from a
-<a href="ext_ffi_semantics.html#clib">C library namespace</a>!
-Thus it's not helpful and actually counter-productive to cache
-individual C functions like this:
-</p>
-<pre class="code">
-local <b>funca</b>, <b>funcb</b> = ffi.C.funca, ffi.C.funcb -- <span style="color:#c00000;">Not helpful!</span>
-local function foo(x, n)
- for i=1,n do <b>funcb</b>(<b>funca</b>(x, i), 1) end
-end
-</pre>
-<p>
-This turns them into indirect calls and generates bigger and slower
-machine code. Instead you'll want to cache the namespace itself and
-rely on the JIT compiler to eliminate the lookups:
-</p>
-<pre class="code">
-local <b>C</b> = ffi.C -- <span style="color:#00a000;">Instead use this!</span>
-local function foo(x, n)
- for i=1,n do <b>C.funcb</b>(<b>C.funca</b>(x, i), 1) end
-end
-</pre>
-<p>
-This generates both shorter and faster code. So <b>don't cache
-C functions</b>, but <b>do</b> cache namespaces! Most often the
-namespace is already in a local variable at an outer scope, e.g. from
-<tt>local lib = ffi.load(...)</tt>. Note that copying
-it to a local variable in the function scope is unnecessary.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/ext_jit.html b/lib/luajit/doc/ext_jit.html
deleted file mode 100644
index 27351dd..0000000
--- a/lib/luajit/doc/ext_jit.html
+++ /dev/null
@@ -1,199 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>jit.* Library</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1><tt>jit.*</tt> Library</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a class="current" href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-The functions in this built-in module control the behavior of the JIT
-compiler engine. Note that JIT-compilation is fully automatic —
-you probably won't need to use any of the following functions unless
-you have special needs.
-</p>
-
-<h3 id="jit_onoff"><tt>jit.on()<br>
-jit.off()</tt></h3>
-<p>
-Turns the whole JIT compiler on (default) or off.
-</p>
-<p>
-These functions are typically used with the command line options
-<tt>-j on</tt> or <tt>-j off</tt>.
-</p>
-
-<h3 id="jit_flush"><tt>jit.flush()</tt></h3>
-<p>
-Flushes the whole cache of compiled code.
-</p>
-
-<h3 id="jit_onoff_func"><tt>jit.on(func|true [,true|false])<br>
-jit.off(func|true [,true|false])<br>
-jit.flush(func|true [,true|false])</tt></h3>
-<p>
-<tt>jit.on</tt> enables JIT compilation for a Lua function (this is
-the default).
-</p>
-<p>
-<tt>jit.off</tt> disables JIT compilation for a Lua function and
-flushes any already compiled code from the code cache.
-</p>
-<p>
-<tt>jit.flush</tt> flushes the code, but doesn't affect the
-enable/disable status.
-</p>
-<p>
-The current function, i.e. the Lua function calling this library
-function, can also be specified by passing <tt>true</tt> as the first
-argument.
-</p>
-<p>
-If the second argument is <tt>true</tt>, JIT compilation is also
-enabled, disabled or flushed recursively for all sub-functions of a
-function. With <tt>false</tt> only the sub-functions are affected.
-</p>
-<p>
-The <tt>jit.on</tt> and <tt>jit.off</tt> functions only set a flag
-which is checked when the function is about to be compiled. They do
-not trigger immediate compilation.
-</p>
-<p>
-Typical usage is <tt>jit.off(true, true)</tt> in the main chunk
-of a module to turn off JIT compilation for the whole module for
-debugging purposes.
-</p>
-
-<h3 id="jit_flush_tr"><tt>jit.flush(tr)</tt></h3>
-<p>
-Flushes the root trace, specified by its number, and all of its side
-traces from the cache. The code for the trace will be retained as long
-as there are any other traces which link to it.
-</p>
-
-<h3 id="jit_status"><tt>status, ... = jit.status()</tt></h3>
-<p>
-Returns the current status of the JIT compiler. The first result is
-either <tt>true</tt> or <tt>false</tt> if the JIT compiler is turned
-on or off. The remaining results are strings for CPU-specific features
-and enabled optimizations.
-</p>
-
-<h3 id="jit_version"><tt>jit.version</tt></h3>
-<p>
-Contains the LuaJIT version string.
-</p>
-
-<h3 id="jit_version_num"><tt>jit.version_num</tt></h3>
-<p>
-Contains the version number of the LuaJIT core. Version xx.yy.zz
-is represented by the decimal number xxyyzz.
-</p>
-
-<h3 id="jit_os"><tt>jit.os</tt></h3>
-<p>
-Contains the target OS name:
-"Windows", "Linux", "OSX", "BSD", "POSIX" or "Other".
-</p>
-
-<h3 id="jit_arch"><tt>jit.arch</tt></h3>
-<p>
-Contains the target architecture name:
-"x86", "x64", "arm", "ppc", "ppcspe", or "mips".
-</p>
-
-<h2 id="jit_opt"><tt>jit.opt.*</tt> — JIT compiler optimization control</h2>
-<p>
-This sub-module provides the backend for the <tt>-O</tt> command line
-option.
-</p>
-<p>
-You can also use it programmatically, e.g.:
-</p>
-<pre class="code">
-jit.opt.start(2) -- same as -O2
-jit.opt.start("-dce")
-jit.opt.start("hotloop=10", "hotexit=2")
-</pre>
-<p>
-Unlike in LuaJIT 1.x, the module is built-in and
-<b>optimization is turned on by default!</b>
-It's no longer necessary to run <tt>require("jit.opt").start()</tt>,
-which was one of the ways to enable optimization.
-</p>
-
-<h2 id="jit_util"><tt>jit.util.*</tt> — JIT compiler introspection</h2>
-<p>
-This sub-module holds functions to introspect the bytecode, generated
-traces, the IR and the generated machine code. The functionality
-provided by this module is still in flux and therefore undocumented.
-</p>
-<p>
-The debug modules <tt>-jbc</tt>, <tt>-jv</tt> and <tt>-jdump</tt> make
-extensive use of these functions. Please check out their source code,
-if you want to know more.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/extensions.html b/lib/luajit/doc/extensions.html
deleted file mode 100644
index e9cd136..0000000
--- a/lib/luajit/doc/extensions.html
+++ /dev/null
@@ -1,408 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Extensions</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-table.exc {
- line-height: 1.2;
-}
-tr.exchead td {
- font-weight: bold;
-}
-td.excplatform {
- width: 48%;
-}
-td.exccompiler {
- width: 29%;
-}
-td.excinterop {
- width: 23%;
-}
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Extensions</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a class="current" href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-LuaJIT is fully upwards-compatible with Lua 5.1. It supports all
-<a href="http://www.lua.org/manual/5.1/manual.html#5"><span class="ext">»</span> standard Lua
-library functions</a> and the full set of
-<a href="http://www.lua.org/manual/5.1/manual.html#3"><span class="ext">»</span> Lua/C API
-functions</a>.
-</p>
-<p>
-LuaJIT is also fully ABI-compatible to Lua 5.1 at the linker/dynamic
-loader level. This means you can compile a C module against the
-standard Lua headers and load the same shared library from either Lua
-or LuaJIT.
-</p>
-<p>
-LuaJIT extends the standard Lua VM with new functionality and adds
-several extension modules. Please note this page is only about
-<em>functional</em> enhancements and not about performance enhancements,
-such as the optimized VM, the faster interpreter or the JIT compiler.
-</p>
-
-<h2 id="modules">Extensions Modules</h2>
-<p>
-LuaJIT comes with several built-in extension modules:
-</p>
-
-<h3 id="bit"><tt>bit.*</tt> — Bitwise operations</h3>
-<p>
-LuaJIT supports all bitwise operations as defined by
-<a href="http://bitop.luajit.org"><span class="ext">»</span> Lua BitOp</a>:
-</p>
-<pre class="code">
-bit.tobit bit.tohex bit.bnot bit.band bit.bor bit.bxor
-bit.lshift bit.rshift bit.arshift bit.rol bit.ror bit.bswap
-</pre>
-<p>
-This module is a LuaJIT built-in — you don't need to download or
-install Lua BitOp. The Lua BitOp site has full documentation for all
-<a href="http://bitop.luajit.org/api.html"><span class="ext">»</span> Lua BitOp API functions</a>.
-</p>
-<p>
-Please make sure to <tt>require</tt> the module before using any of
-its functions:
-</p>
-<pre class="code">
-local bit = require("bit")
-</pre>
-<p>
-An already installed Lua BitOp module is ignored by LuaJIT.
-This way you can use bit operations from both Lua and LuaJIT on a
-shared installation.
-</p>
-
-<h3 id="ffi"><tt>ffi.*</tt> — FFI library</h3>
-<p>
-The <a href="ext_ffi.html">FFI library</a> allows calling external
-C functions and the use of C data structures from pure Lua
-code.
-</p>
-
-<h3 id="jit"><tt>jit.*</tt> — JIT compiler control</h3>
-<p>
-The functions in this module
-<a href="ext_jit.html">control the behavior of the JIT compiler engine</a>.
-</p>
-
-<h3 id="c_api">C API extensions</h3>
-<p>
-LuaJIT adds some
-<a href="ext_c_api.html">extra functions to the Lua/C API</a>.
-</p>
-
-<h2 id="library">Enhanced Standard Library Functions</h2>
-
-<h3 id="xpcall"><tt>xpcall(f, err [,args...])</tt> passes arguments</h3>
-<p>
-Unlike the standard implementation in Lua 5.1, <tt>xpcall()</tt>
-passes any arguments after the error function to the function
-which is called in a protected context.
-</p>
-
-<h3 id="load"><tt>loadfile()</tt> etc. handle UTF-8 source code</h3>
-<p>
-Non-ASCII characters are handled transparently by the Lua source code parser.
-This allows the use of UTF-8 characters in identifiers and strings.
-A UTF-8 BOM is skipped at the start of the source code.
-</p>
-
-<h3 id="tostring"><tt>tostring()</tt> etc. canonicalize NaN and ±Inf</h3>
-<p>
-All number-to-string conversions consistently convert non-finite numbers
-to the same strings on all platforms. NaN results in <tt>"nan"</tt>,
-positive infinity results in <tt>"inf"</tt> and negative infinity results
-in <tt>"-inf"</tt>.
-</p>
-
-<h3 id="tonumber"><tt>tonumber()</tt> etc. use builtin string to number conversion</h3>
-<p>
-All string-to-number conversions consistently convert integer and
-floating-point inputs in decimal and hexadecimal on all platforms.
-<tt>strtod()</tt> is <em>not</em> used anymore, which avoids numerous
-problems with poor C library implementations. The builtin conversion
-function provides full precision according to the IEEE-754 standard, it
-works independently of the current locale and it supports hex floating-point
-numbers (e.g. <tt>0x1.5p-3</tt>).
-</p>
-
-<h3 id="string_dump"><tt>string.dump(f [,strip])</tt> generates portable bytecode</h3>
-<p>
-An extra argument has been added to <tt>string.dump()</tt>. If set to
-<tt>true</tt>, 'stripped' bytecode without debug information is
-generated. This speeds up later bytecode loading and reduces memory
-usage. See also the
-<a href="running.html#opt_b"><tt>-b</tt> command line option</a>.
-</p>
-<p>
-The generated bytecode is portable and can be loaded on any architecture
-that LuaJIT supports, independent of word size or endianess. However the
-bytecode compatibility versions must match. Bytecode stays compatible
-for dot releases (x.y.0 → x.y.1), but may change with major or
-minor releases (2.0 → 2.1) or between any beta release. Foreign
-bytecode (e.g. from Lua 5.1) is incompatible and cannot be loaded.
-</p>
-
-<h3 id="math_random">Enhanced PRNG for <tt>math.random()</tt></h3>
-<p>
-LuaJIT uses a Tausworthe PRNG with period 2^223 to implement
-<tt>math.random()</tt> and <tt>math.randomseed()</tt>. The quality of
-the PRNG results is much superior compared to the standard Lua
-implementation which uses the platform-specific ANSI rand().
-</p>
-<p>
-The PRNG generates the same sequences from the same seeds on all
-platforms and makes use of all bits in the seed argument.
-<tt>math.random()</tt> without arguments generates 52 pseudo-random bits
-for every call. The result is uniformly distributed between 0.0 and 1.0.
-It's correctly scaled up and rounded for <tt>math.random(n [,m])</tt> to
-preserve uniformity.
-</p>
-
-<h3 id="io"><tt>io.*</tt> functions handle 64 bit file offsets</h3>
-<p>
-The file I/O functions in the standard <tt>io.*</tt> library handle
-64 bit file offsets. In particular this means it's possible
-to open files larger than 2 Gigabytes and to reposition or obtain
-the current file position for offsets beyond 2 GB
-(<tt>fp:seek()</tt> method).
-</p>
-
-<h3 id="debug_meta"><tt>debug.*</tt> functions identify metamethods</h3>
-<p>
-<tt>debug.getinfo()</tt> and <tt>lua_getinfo()</tt> also return information
-about invoked metamethods. The <tt>namewhat</tt> field is set to
-<tt>"metamethod"</tt> and the <tt>name</tt> field has the name of
-the corresponding metamethod (e.g. <tt>"__index"</tt>).
-</p>
-
-<h2 id="resumable">Fully Resumable VM</h2>
-<p>
-The LuaJIT VM is fully resumable. This means you can yield from a
-coroutine even across contexts, where this would not possible with
-the standard Lua 5.1 VM: e.g. you can yield across <tt>pcall()</tt>
-and <tt>xpcall()</tt>, across iterators and across metamethods.
-</p>
-
-<h2 id="lua52">Extensions from Lua 5.2</h2>
-<p>
-LuaJIT supports some language and library extensions from Lua 5.2.
-Features that are unlikely to break existing code are unconditionally
-enabled:
-</p>
-<ul>
-<li><tt>goto</tt> and <tt>::labels::</tt>.</li>
-<li>Hex escapes <tt>'\x3F'</tt> and <tt>'\*'</tt> escape in strings.</li>
-<li><tt>load(string|reader [, chunkname [,mode [,env]]])</tt>.</li>
-<li><tt>loadstring()</tt> is an alias for <tt>load()</tt>.</li>
-<li><tt>loadfile(filename [,mode [,env]])</tt>.</li>
-<li><tt>math.log(x [,base])</tt>.
-<li><tt>string.rep(s, n [,sep])</tt>.
-<li><tt>string.format()</tt>: <tt>%q</tt> reversible.
-<tt>%s</tt> checks <tt>__tostring</tt>.
-<tt>%a</tt> and <tt>"%A</tt> added.</li>
-<li>String matching pattern <tt>%g</tt> added.</li>
-<li><tt>io.read("*L")</tt>.</li>
-<li><tt>io.lines()</tt> and <tt>file:lines()</tt> process
-<tt>io.read()</tt> options.</li>
-<li><tt>os.exit(status|true|false [,close])</tt>.</li>
-<li><tt>package.searchpath(name, path [, sep [, rep]])</tt>.</li>
-<li><tt>package.loadlib(name, "*")</tt>.</li>
-<li><tt>debug.getinfo()</tt> returns <tt>nparams</tt> and <tt>isvararg</tt>
-for option <tt>"u"</tt>.</li>
-<li><tt>debug.getlocal()</tt> accepts function instead of level.</li>
-<li><tt>debug.getlocal()</tt> and <tt>debug.setlocal()</tt> accept negative
-indexes for varargs.</li>
-<li><tt>debug.getupvalue()</tt> and <tt>debug.setupvalue()</tt> handle
-C functions.</li>
-<li><tt>debug.upvalueid()</tt> and <tt>debug.upvaluejoin()</tt>.</li>
-<li>Command line option <tt>-E</tt>.</li>
-<li>Command line checks <tt>__tostring</tt> for errors.</li>
-</ul>
-<p>
-Other features are only enabled, if LuaJIT is built with
-<tt>-DLUAJIT_ENABLE_LUA52COMPAT</tt>:
-</p>
-<ul>
-<li><tt>goto</tt> is a keyword and not a valid variable name anymore.</li>
-<li><tt>break</tt> can be placed anywhere. Empty statements (<tt>;;</tt>)
-are allowed.</li>
-<li><tt>__lt</tt>, <tt>__le</tt> are invoked for mixed types.</li>
-<li><tt>__len</tt> for tables. <tt>rawlen()</tt> library function.</li>
-<li><tt>pairs()</tt> and <tt>ipairs()</tt> check for <tt>__pairs</tt> and
-<tt>__ipairs</tt>.</li>
-<li><tt>coroutine.running()</tt> returns two results.</li>
-<li><tt>table.pack()</tt> and <tt>table.unpack()</tt>
-(same as <tt>unpack()</tt>).</li>
-<li><tt>io.write()</tt> and <tt>file:write()</tt> return file handle
-instead of <tt>true</tt>.</li>
-<li><tt>os.execute()</tt> and <tt>pipe:close()</tt> return detailed
-exit status.</li>
-<li><tt>debug.setmetatable()</tt> returns object.</li>
-<li><tt>debug.getuservalue()</tt> and <tt>debug.setuservalue()</tt>.</li>
-<li>Remove <tt>math.mod()</tt>, <tt>string.gfind()</tt>.
-</ul>
-<p>
-Note: this provides only partial compatibility with Lua 5.2 at the
-language and Lua library level. LuaJIT is API+ABI-compatible with
-Lua 5.1, which prevents implementing features that would otherwise
-break the Lua/C API and ABI (e.g. <tt>_ENV</tt>).
-</p>
-
-<h2 id="exceptions">C++ Exception Interoperability</h2>
-<p>
-LuaJIT has built-in support for interoperating with C++ exceptions.
-The available range of features depends on the target platform and
-the toolchain used to compile LuaJIT:
-</p>
-<table class="exc">
-<tr class="exchead">
-<td class="excplatform">Platform</td>
-<td class="exccompiler">Compiler</td>
-<td class="excinterop">Interoperability</td>
-</tr>
-<tr class="odd separate">
-<td class="excplatform">POSIX/x64, DWARF2 unwinding</td>
-<td class="exccompiler">GCC 4.3+</td>
-<td class="excinterop"><b style="color: #00a000;">Full</b></td>
-</tr>
-<tr class="even">
-<td class="excplatform">Other platforms, DWARF2 unwinding</td>
-<td class="exccompiler">GCC</td>
-<td class="excinterop"><b style="color: #c06000;">Limited</b></td>
-</tr>
-<tr class="odd">
-<td class="excplatform">Windows/x64</td>
-<td class="exccompiler">MSVC or WinSDK</td>
-<td class="excinterop"><b style="color: #00a000;">Full</b></td>
-</tr>
-<tr class="even">
-<td class="excplatform">Windows/x86</td>
-<td class="exccompiler">Any</td>
-<td class="excinterop"><b style="color: #a00000;">No</b></td>
-</tr>
-<tr class="odd">
-<td class="excplatform">Other platforms</td>
-<td class="exccompiler">Other compilers</td>
-<td class="excinterop"><b style="color: #a00000;">No</b></td>
-</tr>
-</table>
-<p>
-<b style="color: #00a000;">Full interoperability</b> means:
-</p>
-<ul>
-<li>C++ exceptions can be caught on the Lua side with <tt>pcall()</tt>,
-<tt>lua_pcall()</tt> etc.</li>
-<li>C++ exceptions will be converted to the generic Lua error
-<tt>"C++ exception"</tt>, unless you use the
-<a href="ext_c_api.html#mode_wrapcfunc">C call wrapper</a> feature.</li>
-<li>It's safe to throw C++ exceptions across non-protected Lua frames
-on the C stack. The contents of the C++ exception object
-pass through unmodified.</li>
-<li>Lua errors can be caught on the C++ side with <tt>catch(...)</tt>.
-The corresponding Lua error message can be retrieved from the Lua stack.</li>
-<li>Throwing Lua errors across C++ frames is safe. C++ destructors
-will be called.</li>
-</ul>
-<p>
-<b style="color: #c06000;">Limited interoperability</b> means:
-</p>
-<ul>
-<li>C++ exceptions can be caught on the Lua side with <tt>pcall()</tt>,
-<tt>lua_pcall()</tt> etc.</li>
-<li>C++ exceptions will be converted to the generic Lua error
-<tt>"C++ exception"</tt>, unless you use the
-<a href="ext_c_api.html#mode_wrapcfunc">C call wrapper</a> feature.</li>
-<li>C++ exceptions will be caught by non-protected Lua frames and
-are rethrown as a generic Lua error. The C++ exception object will
-be destroyed.</li>
-<li>Lua errors <b>cannot</b> be caught on the C++ side.</li>
-<li>Throwing Lua errors across C++ frames will <b>not</b> call
-C++ destructors.</li>
-</ul>
-
-<p>
-<b style="color: #a00000;">No interoperability</b> means:
-</p>
-<ul>
-<li>It's <b>not</b> safe to throw C++ exceptions across Lua frames.</li>
-<li>C++ exceptions <b>cannot</b> be caught on the Lua side.</li>
-<li>Lua errors <b>cannot</b> be caught on the C++ side.</li>
-<li>Throwing Lua errors across C++ frames will <b>not</b> call
-C++ destructors.</li>
-<li>Additionally, on Windows/x86 with SEH-based C++ exceptions:
-it's <b>not</b> safe to throw a Lua error across any frames containing
-a C++ function with any try/catch construct or using variables with
-(implicit) destructors. This also applies to any functions which may be
-inlined in such a function. It doesn't matter whether <tt>lua_error()</tt>
-is called inside or outside of a try/catch or whether any object actually
-needs to be destroyed: the SEH chain is corrupted and this will eventually
-lead to the termination of the process.</li>
-</ul>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/faq.html b/lib/luajit/doc/faq.html
deleted file mode 100644
index 9902f09..0000000
--- a/lib/luajit/doc/faq.html
+++ /dev/null
@@ -1,184 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Frequently Asked Questions (FAQ)</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-dd { margin-left: 1.5em; }
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Frequently Asked Questions (FAQ)</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a class="current" href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<dl>
-<dt>Q: Where can I learn more about LuaJIT and Lua?</dt>
-<dd>
-<ul style="padding: 0;">
-<li>The <a href="http://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a> focuses on topics
-related to LuaJIT.</li>
-<li>The <a href="http://wiki.luajit.org/"><span class="ext">»</span> LuaJIT wiki</a> gathers community
-resources about LuaJIT.</li>
-<li>News about Lua itself can be found at the
-<a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>.
-The mailing list archives are worth checking out for older postings
-about LuaJIT.</li>
-<li>The <a href="http://lua.org"><span class="ext">»</span> main Lua.org site</a> has complete
-<a href="http://www.lua.org/docs.html"><span class="ext">»</span> documentation</a> of the language
-and links to books and papers about Lua.</li>
-<li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">»</span> Lua Wiki</a>
-has information about diverse topics.</li>
-</ul>
-</dl>
-
-<dl>
-<dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt>
-<dd>
-I'm planning to write more documentation about the internals of LuaJIT.
-In the meantime, please use the following Google Scholar searches
-to find relevant papers:<br>
-Search for: <a href="http://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">»</span> Trace Compiler</a><br>
-Search for: <a href="http://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">»</span> JIT Compiler</a><br>
-Search for: <a href="http://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">»</span> Dynamic Language Optimizations</a><br>
-Search for: <a href="http://scholar.google.com/scholar?q=SSA+Form"><span class="ext">»</span> SSA Form</a><br>
-Search for: <a href="http://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">»</span> Linear Scan Register Allocation</a><br>
-Here is a list of the <a href="http://article.gmane.org/gmane.comp.lang.lua.general/58908"><span class="ext">»</span> innovative features in LuaJIT</a>.<br>
-And, you know, reading the source is of course the only way to enlightenment. :-)
-</dd>
-</dl>
-
-<dl>
-<dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br>
-Q: My vararg functions fail after switching to LuaJIT!</dt>
-<dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
-support the implicit <tt>arg</tt> parameter for old-style vararg
-functions from Lua 5.0.<br>Please convert your code to the
-<a href="http://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">»</span> Lua 5.1
-vararg syntax</a>.</dd>
-</dl>
-
-<dl>
-<dt>Q: Why do I get this error: "bad FPU precision"?<br>
-<dt>Q: I get weird behavior after initializing Direct3D.<br>
-<dt>Q: Some FPU operations crash after I load a Delphi DLL.<br>
-</dt>
-<dd>
-
-DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision
-mode by default. This violates the Windows ABI and interferes with the
-operation of many programs — LuaJIT is affected, too. Please make
-sure you always use the <tt>D3DCREATE_FPU_PRESERVE</tt> flag when
-initializing Direct3D.<br>
-
-Direct3D version 10 or higher do not show this behavior anymore.
-Consider testing your application with older versions, too.<br>
-
-Similarly, the Borland/Delphi runtime modifies the FPU control word and
-enables FP exceptions. Of course this violates the Windows ABI, too.
-Please check the Delphi docs for the Set8087CW method.
-
-</dl>
-
-<dl>
-<dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt>
-<dd>The interrupt signal handler sets a Lua debug hook. But this is
-currently ignored by compiled code (this will eventually be fixed). If
-your program is running in a tight loop and never falls back to the
-interpreter, the debug hook never runs and can't throw the
-"interrupted!" error.<br> In the meantime you have to press Ctrl-C
-twice to get stop your program. That's similar to when it's stuck
-running inside a C function under the Lua interpreter.</dd>
-</dl>
-
-<dl>
-<dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt>
-<dd>Because it's a completely redesigned VM and has very little code
-in common with Lua anymore. Also, if the patch introduces changes to
-the Lua semantics, these would need to be reflected everywhere in the
-VM, from the interpreter up to all stages of the compiler.<br> Please
-use only standard Lua language constructs. For many common needs you
-can use source transformations or use wrapper or proxy functions.
-The compiler will happily optimize away such indirections.</dd>
-</dl>
-
-<dl>
-<dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt>
-<dd>Because it's a compiler — it needs to generate native
-machine code. This means the code generator must be ported to each
-architecture. And the fast interpreter is written in assembler and
-must be ported, too. This is quite an undertaking.<br>
-The <a href="install.html">install documentation</a> shows the supported
-architectures. Other architectures will follow based on sufficient user
-demand and/or sponsoring.</dd>
-</dl>
-
-<dl>
-<dt>Q: When will feature X be added? When will the next version be released?</dt>
-<dd>When it's ready.<br>
-C'mon, it's open source — I'm doing it on my own time and you're
-getting it for free. You can either contribute a patch or sponsor
-the development of certain features, if they are important to you.
-</dd>
-</dl>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/img/contact.png b/lib/luajit/doc/img/contact.png
deleted file mode 100644
index 9c73dc5..0000000
Binary files a/lib/luajit/doc/img/contact.png and /dev/null differ
diff --git a/lib/luajit/doc/install.html b/lib/luajit/doc/install.html
deleted file mode 100644
index 7a878b1..0000000
--- a/lib/luajit/doc/install.html
+++ /dev/null
@@ -1,646 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Installation</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-table.compat {
- line-height: 1.2;
- font-size: 80%;
-}
-table.compat td {
- border: 1px solid #bfcfff;
- height: 2.5em;
-}
-table.compat tr.compathead td {
- font-weight: bold;
- border-bottom: 2px solid #bfcfff;
-}
-tr.compathead td.compatos {
- vertical-align: top;
-}
-table.compat td.compatcpu {
- width: 18%;
- border-right: 2px solid #bfcfff;
-}
-td.compatos {
- width: 21%;
- vertical-align: middle;
-}
-td.compatno {
- background-color: #d0d0d0;
-}
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Installation</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a class="current" href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-LuaJIT is only distributed as a source package. This page explains
-how to build and install LuaJIT with different operating systems
-and C compilers.
-</p>
-<p>
-For the impatient (on POSIX systems):
-</p>
-<pre class="code">
-make && sudo make install
-</pre>
-<p>
-LuaJIT currently builds out-of-the box on most systems.
-Here's the compatibility matrix for the supported combinations of
-operating systems, CPUs and compilers:
-</p>
-<table class="compat">
-<tr class="compathead">
-<td class="compatcpu">CPU / OS</td>
-<td class="compatos"><a href="#posix">Linux</a> or<br><a href="#android">Android</a></td>
-<td class="compatos"><a href="#posix">*BSD, Other</a></td>
-<td class="compatos"><a href="#posix">OSX 10.4+</a> or<br><a href="#ios">iOS 3.0+</a></td>
-<td class="compatos"><a href="#windows">Windows<br>XP/Vista/7</a></td>
-</tr>
-<tr class="odd separate">
-<td class="compatcpu">x86 (32 bit)</td>
-<td class="compatos">GCC 4.x<br>GCC 3.4</td>
-<td class="compatos">GCC 4.x<br>GCC 3.4</td>
-<td class="compatos">GCC 4.x<br>GCC 3.4</td>
-<td class="compatos">MSVC, MSVC/EE<br>WinSDK<br>MinGW, Cygwin</td>
-</tr>
-<tr class="even">
-<td class="compatcpu">x64 (64 bit)</td>
-<td class="compatos">GCC 4.x</td>
-<td class="compatos">ORBIS (<a href="#ps4">PS4</a>)</td>
-<td class="compatos">GCC 4.x</td>
-<td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td>
-</tr>
-<tr class="odd">
-<td class="compatcpu"><a href="#cross2">ARMv5+<br>ARM9E+</a></td>
-<td class="compatos">GCC 4.2+</td>
-<td class="compatos">GCC 4.2+<br>PSP2 (<a href="#psvita">PS VITA</a>)</td>
-<td class="compatos">GCC 4.2+</td>
-<td class="compatos compatno"> </td>
-</tr>
-<tr class="even">
-<td class="compatcpu"><a href="#cross2">PPC</a></td>
-<td class="compatos">GCC 4.3+</td>
-<td class="compatos">GCC 4.3+<br>GCC 4.1 (<a href="#ps3">PS3</a>)</td>
-<td class="compatos compatno"> </td>
-<td class="compatos">XEDK (<a href="#xbox360">Xbox 360</a>)</td>
-</tr>
-<tr class="odd">
-<td class="compatcpu"><a href="#cross2">PPC/e500v2</a></td>
-<td class="compatos">GCC 4.3+</td>
-<td class="compatos">GCC 4.3+</td>
-<td class="compatos compatno"> </td>
-<td class="compatos compatno"> </td>
-</tr>
-<tr class="even">
-<td class="compatcpu"><a href="#cross2">MIPS</a></td>
-<td class="compatos">GCC 4.3+</td>
-<td class="compatos">GCC 4.3+</td>
-<td class="compatos compatno"> </td>
-<td class="compatos compatno"> </td>
-</tr>
-</table>
-
-<h2>Configuring LuaJIT</h2>
-<p>
-The standard configuration should work fine for most installations.
-Usually there is no need to tweak the settings. The following files
-hold all user-configurable settings:
-</p>
-<ul>
-<li><tt>src/luaconf.h</tt> sets some configuration variables.</li>
-<li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX
-only).</li>
-<li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT
-under POSIX, MinGW or Cygwin.</li>
-<li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
-MSVC or WinSDK.</li>
-</ul>
-<p>
-Please read the instructions given in these files, before changing
-any settings.
-</p>
-
-<h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
-<h3>Prerequisites</h3>
-<p>
-Depending on your distribution, you may need to install a package for
-GCC, the development headers and/or a complete SDK. E.g. on a current
-Debian/Ubuntu, install <tt>libc6-dev</tt> with the package manager.
-</p>
-<p>
-Download the current source package of LuaJIT (pick the .tar.gz),
-if you haven't already done so. Move it to a directory of your choice,
-open a terminal window and change to this directory. Now unpack the archive
-and change to the newly created directory:
-</p>
-<pre class="code">
-tar zxf LuaJIT-2.0.4.tar.gz
-cd LuaJIT-2.0.4</pre>
-<h3>Building LuaJIT</h3>
-<p>
-The supplied Makefiles try to auto-detect the settings needed for your
-operating system and your compiler. They need to be run with GNU Make,
-which is probably the default on your system, anyway. Simply run:
-</p>
-<pre class="code">
-make
-</pre>
-<p>
-This always builds a native x86, x64 or PPC binary, depending on the host OS
-you're running this command on. Check the section on
-<a href="#cross">cross-compilation</a> for more options.
-</p>
-<p>
-By default, modules are only searched under the prefix <tt>/usr/local</tt>.
-You can add an extra prefix to the search paths by appending the
-<tt>PREFIX</tt> option, e.g.:
-</p>
-<pre class="code">
-make PREFIX=/home/myself/lj2
-</pre>
-<p>
-Note for OSX: if the <tt>MACOSX_DEPLOYMENT_TARGET</tt> environment
-variable is not set, then it's forced to <tt>10.4</tt>.
-</p>
-<h3>Installing LuaJIT</h3>
-<p>
-The top-level Makefile installs LuaJIT by default under
-<tt>/usr/local</tt>, i.e. the executable ends up in
-<tt>/usr/local/bin</tt> and so on. You need root privileges
-to write to this path. So, assuming sudo is installed on your system,
-run the following command and enter your sudo password:
-</p>
-<pre class="code">
-sudo make install
-</pre>
-<p>
-Otherwise specify the directory prefix as an absolute path, e.g.:
-</p>
-<pre class="code">
-make install PREFIX=/home/myself/lj2
-</pre>
-<p>
-Obviously the prefixes given during build and installation need to be the same.
-</p>
-
-<h2 id="windows">Windows Systems</h2>
-<h3>Prerequisites</h3>
-<p>
-Either install one of the open source SDKs
-(<a href="http://mingw.org/"><span class="ext">»</span> MinGW</a> or
-<a href="http://www.cygwin.com/"><span class="ext">»</span> Cygwin</a>), which come with a modified
-GCC plus the required development headers.
-</p>
-<p>
-Or install Microsoft's Visual C++ (MSVC). The freely downloadable
-<a href="http://www.microsoft.com/Express/VC/"><span class="ext">»</span> Express Edition</a>
-works just fine, but only contains an x86 compiler.
-</p>
-<p>
-The freely downloadable
-<a href="http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx"><span class="ext">»</span> Windows SDK</a>
-only comes with command line tools, but this is all you need to build LuaJIT.
-It contains x86 and x64 compilers.
-</p>
-<p>
-Next, download the source package and unpack it using an archive manager
-(e.g. the Windows Explorer) to a directory of your choice.
-</p>
-<h3>Building with MSVC</h3>
-<p>
-Open a "Visual Studio .NET Command Prompt", <tt>cd</tt> to the
-directory where you've unpacked the sources and run these commands:
-</p>
-<pre class="code">
-cd src
-msvcbuild
-</pre>
-<p>
-Then follow the installation instructions below.
-</p>
-<h3>Building with the Windows SDK</h3>
-<p>
-Open a "Windows SDK Command Shell" and select the x86 compiler:
-</p>
-<pre class="code">
-setenv /release /x86
-</pre>
-<p>
-Or select the x64 compiler:
-</p>
-<pre class="code">
-setenv /release /x64
-</pre>
-<p>
-Then <tt>cd</tt> to the directory where you've unpacked the sources
-and run these commands:
-</p>
-<pre class="code">
-cd src
-msvcbuild
-</pre>
-<p>
-Then follow the installation instructions below.
-</p>
-<h3>Building with MinGW or Cygwin</h3>
-<p>
-Open a command prompt window and make sure the MinGW or Cygwin programs
-are in your path. Then <tt>cd</tt> to the directory where
-you've unpacked the sources and run this command for MinGW:
-</p>
-<pre class="code">
-mingw32-make
-</pre>
-<p>
-Or this command for Cygwin:
-</p>
-<pre class="code">
-make
-</pre>
-<p>
-Then follow the installation instructions below.
-</p>
-<h3>Installing LuaJIT</h3>
-<p>
-Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> (built in the <tt>src</tt>
-directory) to a newly created directory (any location is ok).
-Add <tt>lua</tt> and <tt>lua\jit</tt> directories below it and copy
-all Lua files from the <tt>src\jit</tt> directory of the distribution
-to the latter directory.
-</p>
-<p>
-There are no hardcoded
-absolute path names — all modules are loaded relative to the
-directory where <tt>luajit.exe</tt> is installed
-(see <tt>src/luaconf.h</tt>).
-</p>
-
-<h2 id="cross">Cross-compiling LuaJIT</h2>
-<p>
-The GNU Makefile-based build system allows cross-compiling on any host
-for any supported target, as long as both architectures have the same
-pointer size. If you want to cross-compile to any 32 bit target on an
-x64 OS, you need to install the multilib development package (e.g.
-<tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part
-(<tt>HOST_CC="gcc -m32"</tt>).
-</p>
-<p>
-You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the
-target OS differ, or you'll get assembler or linker errors. E.g. if
-you're compiling on a Windows or OSX host for embedded Linux or Android,
-you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a
-minimal target OS, you may need to disable the built-in allocator in
-<tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. The examples
-below only show some popular targets — please check the comments
-in <tt>src/Makefile</tt> for more details.
-</p>
-<pre class="code">
-# Cross-compile to a 32 bit binary on a multilib x64 OS
-make CC="gcc -m32"
-
-# Cross-compile on Debian/Ubuntu for Windows (mingw32 package)
-make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
-</pre>
-<p id="cross2">
-The <tt>CROSS</tt> prefix allows specifying a standard GNU cross-compile
-toolchain (Binutils, GCC and a matching libc). The prefix may vary
-depending on the <tt>--target</tt> the toolchain was built for (note the
-<tt>CROSS</tt> prefix has a trailing <tt>"-"</tt>). The examples below
-use the canonical toolchain triplets for Linux.
-</p>
-<p>
-Since there's often no easy way to detect CPU features at runtime, it's
-important to compile with the proper CPU or architecture settings. You
-can specify these when building the toolchain yourself. Or add
-<tt>-mcpu=...</tt> or <tt>-march=...</tt> to <tt>TARGET_CFLAGS</tt>. For
-ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting,
-too. Otherwise LuaJIT may not run at the full performance of your target
-CPU.
-</p>
-<pre class="code">
-# ARM soft-float
-make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
- TARGET_CFLAGS="-mfloat-abi=soft"
-
-# ARM soft-float ABI with VFP (example for Cortex-A8)
-make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
- TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp"
-
-# ARM hard-float ABI with VFP (armhf, requires recent toolchain)
-make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
-
-# PPC
-make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
-# PPC/e500v2 (fast interpreter only)
-make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe-
-
-# MIPS big-endian
-make HOST_CC="gcc -m32" CROSS=mips-linux-
-# MIPS little-endian
-make HOST_CC="gcc -m32" CROSS=mipsel-linux-
-</pre>
-<p>
-You can cross-compile for <b id="android">Android</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">»</span> Android NDK</a>.
-The environment variables need to match the install locations and the
-desired target platform. E.g. Android 4.0 corresponds to ABI level 14.
-For details check the folder <tt>docs</tt> in the NDK directory.
-</p>
-<p>
-Only a few common variations for the different CPUs, ABIs and platforms
-are listed. Please use your own judgement for which combination you want
-to build/deploy or which lowest common denominator you want to pick:
-</p>
-<pre class="code">
-# Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo)
-NDK=/opt/android/ndk
-NDKABI=8
-NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
-NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
-NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
-make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
-
-# Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS)
-NDK=/opt/android/ndk
-NDKABI=14
-NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
-NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
-NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
-NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
-make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
-
-# Android/MIPS, mips (MIPS32R1 hard-float), Android 4.0+ (ICS)
-NDK=/opt/android/ndk
-NDKABI=14
-NDKVER=$NDK/toolchains/mipsel-linux-android-4.6
-NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android-
-NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips"
-make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
-
-# Android/x86, x86 (i686 SSE3), Android 4.0+ (ICS)
-NDK=/opt/android/ndk
-NDKABI=14
-NDKVER=$NDK/toolchains/x86-4.6
-NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android-
-NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86"
-make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
-</pre>
-<p>
-You can cross-compile for <b id="ios">iOS 3.0+</b> (iPhone/iPad) using the <a href="http://developer.apple.com/devcenter/ios/index.action"><span class="ext">»</span> iOS SDK</a>.
-The environment variables need to match the iOS SDK version:
-</p>
-<p style="font-size: 8pt;">
-Note: <b>the JIT compiler is disabled for iOS</b>, because regular iOS Apps
-are not allowed to generate code at runtime. You'll only get the performance
-of the LuaJIT interpreter on iOS. This is still faster than plain Lua, but
-much slower than the JIT compiler. Please complain to Apple, not me.
-Or use Android. :-p
-</p>
-<pre class="code">
-IXCODE=`xcode-select -print-path`
-ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer
-ISDKVER=iPhoneOS6.0.sdk
-ISDKP=$ISDK/usr/bin/
-ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
-make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
- TARGET_SYS=iOS
-</pre>
-
-<h3 id="consoles">Cross-compiling for consoles</h3>
-<p>
-Building LuaJIT for consoles requires both a supported host compiler
-(x86 or x64) and a cross-compiler (to PPC or ARM) from the official
-console SDK.
-</p>
-<p>
-Due to restrictions on consoles, the JIT compiler is disabled and only
-the fast interpreter is built. This is still faster than plain Lua,
-but much slower than the JIT compiler. The FFI is disabled, too, since
-it's not very useful in such an environment.
-</p>
-<p>
-The following commands build a static library <tt>libluajit.a</tt>,
-which can be linked against your game, just like the Lua library.
-</p>
-<p>
-To cross-compile for <b id="ps3">PS3</b> from a Linux host (requires
-32 bit GCC, i.e. multilib Linux/x64) or a Windows host (requires
-32 bit MinGW), run this command:
-</p>
-<pre class="code">
-make HOST_CC="gcc -m32" CROSS=ppu-lv2-
-</pre>
-<p>
-To cross-compile for <b id="ps4">PS4</b> from a Windows host,
-open a "Visual Studio .NET Command Prompt" (64 bit host compiler),
-<tt>cd</tt> to the directory where you've unpacked the sources and
-run the following commands:
-</p>
-<pre class="code">
-cd src
-ps4build
-</pre>
-<p>
-To cross-compile for <b id="psvita">PS Vita</b> from a Windows host,
-open a "Visual Studio .NET Command Prompt" (32 bit host compiler),
-<tt>cd</tt> to the directory where you've unpacked the sources and
-run the following commands:
-</p>
-<pre class="code">
-cd src
-psvitabuild
-</pre>
-<p>
-To cross-compile for <b id="xbox360">Xbox 360</b> from a Windows host,
-open a "Visual Studio .NET Command Prompt" (32 bit host compiler),
-<tt>cd</tt> to the directory where you've unpacked the sources and run
-the following commands:
-</p>
-<pre class="code">
-cd src
-xedkbuild
-</pre>
-
-<h2 id="embed">Embedding LuaJIT</h2>
-<p>
-LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua
-into your application, you probably don't need to do anything to switch
-to LuaJIT, except link with a different library:
-</p>
-<ul>
-<li>It's strongly suggested to build LuaJIT separately using the supplied
-build system. Please do <em>not</em> attempt to integrate the individual
-source files into your build tree. You'll most likely get the internal build
-dependencies wrong or mess up the compiler flags. Treat LuaJIT like any
-other external library and link your application with either the dynamic
-or static library, depending on your needs.</li>
-<li>If you want to load C modules compiled for plain Lua
-with <tt>require()</tt>, you need to make sure the public symbols
-(e.g. <tt>lua_pushnumber</tt>) are exported, too:
-<ul><li>On POSIX systems you can either link to the shared library
-or link the static library into your application. In the latter case
-you'll need to export all public symbols from your main executable
-(e.g. <tt>-Wl,-E</tt> on Linux) and add the external dependencies
-(e.g. <tt>-lm -ldl</tt> on Linux).</li>
-<li>Since Windows symbols are bound to a specific DLL name, you need to
-link to the <tt>lua51.dll</tt> created by the LuaJIT build (do not rename
-the DLL). You may link LuaJIT statically on Windows only if you don't
-intend to load Lua/C modules at runtime.
-</li></ul>
-</li>
-<li>
-If you're building a 64 bit application on OSX which links directly or
-indirectly against LuaJIT, you need to link your main executable
-with these flags:
-<pre class="code">
--pagezero_size 10000 -image_base 100000000
-</pre>
-Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries
-which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
-See: <tt>man rebase</tt>
-</li>
-</ul>
-<p>Additional hints for initializing LuaJIT using the C API functions:</p>
-<ul>
-<li>Here's a
-<a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">»</span> simple example</a>
-for embedding Lua or LuaJIT into your application.</li>
-<li>Make sure you use <tt>luaL_newstate</tt>. Avoid using
-<tt>lua_newstate</tt>, since this uses the (slower) default memory
-allocator from your system (no support for this on x64).</li>
-<li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style
-of calling <tt>luaopen_base</tt> etc. directly.</li>
-<li>To change or extend the list of standard libraries to load, copy
-<tt>src/lib_init.c</tt> to your project and modify it accordingly.
-Make sure the <tt>jit</tt> library is loaded or the JIT compiler
-will not be activated.</li>
-<li>The <tt>bit.*</tt> module for bitwise operations
-is already built-in. There's no need to statically link
-<a href="http://bitop.luajit.org/"><span class="ext">»</span> Lua BitOp</a> to your application.</li>
-</ul>
-
-<h2 id="distro">Hints for Distribution Maintainers</h2>
-<p>
-The LuaJIT build system has extra provisions for the needs of most
-POSIX-based distributions. If you're a package maintainer for
-a distribution, <em>please</em> make use of these features and
-avoid patching, subverting, autotoolizing or messing up the build system
-in unspeakable ways.
-</p>
-<p>
-There should be absolutely no need to patch <tt>luaconf.h</tt> or any
-of the Makefiles. And please do not hand-pick files for your packages —
-simply use whatever <tt>make install</tt> creates. There's a reason
-for all of the files <em>and</em> directories it creates.
-</p>
-<p>
-The build system uses GNU make and auto-detects most settings based on
-the host you're building it on. This should work fine for native builds,
-even when sandboxed. You may need to pass some of the following flags to
-<em>both</em> the <tt>make</tt> and the <tt>make install</tt> command lines
-for a regular distribution build:
-</p>
-<ul>
-<li><tt>PREFIX</tt> overrides the installation path and should usually
-be set to <tt>/usr</tt>. Setting this also changes the module paths and
-the paths needed to locate the shared library.</li>
-<li><tt>DESTDIR</tt> is an absolute path which allows you to install
-to a shadow tree instead of the root tree of the build system.</li>
-<li><tt>MULTILIB</tt> sets the architecture-specific library path component
-for multilib systems. The default is <tt>lib</tt>.</li>
-<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
-for additional variables to tweak. The following variables <em>may</em> be
-overridden, but it's <em>not</em> recommended, except for special needs
-like cross-builds:
-<tt>BUILDMODE, CC, HOST_CC, STATIC_CC, DYNAMIC_CC, CFLAGS, HOST_CFLAGS,
-TARGET_CFLAGS, LDFLAGS, HOST_LDFLAGS, TARGET_LDFLAGS, TARGET_SHLDFLAGS,
-TARGET_FLAGS, LIBS, HOST_LIBS, TARGET_LIBS, CROSS, HOST_SYS, TARGET_SYS
-</tt></li>
-</ul>
-<p>
-The build system has a special target for an amalgamated build, i.e.
-<tt>make amalg</tt>. This compiles the LuaJIT core as one huge C file
-and allows GCC to generate faster and shorter code. Alas, this requires
-lots of memory during the build. This may be a problem for some users,
-that's why it's not enabled by default. But it shouldn't be a problem for
-most build farms. It's recommended that binary distributions use this
-target for their LuaJIT builds.
-</p>
-<p>
-The tl;dr version of the above:
-</p>
-<pre class="code">
-make amalg PREFIX=/usr && \
-make install PREFIX=/usr DESTDIR=/tmp/buildroot
-</pre>
-<p>
-Finally, if you encounter any difficulties, please
-<a href="contact.html">contact me</a> first, instead of releasing a broken
-package onto unsuspecting users. Because they'll usually gonna complain
-to me (the upstream) and not you (the package maintainer), anyway.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/luajit.html b/lib/luajit/doc/luajit.html
deleted file mode 100644
index 45507c1..0000000
--- a/lib/luajit/doc/luajit.html
+++ /dev/null
@@ -1,234 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>LuaJIT</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<meta name="description" content="LuaJIT is a Just-In-Time (JIT) compiler for the Lua language.">
-<style type="text/css">
-table.feature {
- width: inherit;
- line-height: 1.2;
- margin: 0;
-}
-table.feature td {
- width: 80px;
- height: 40px;
- vertical-align: middle;
- text-align: center;
- font-weight: bold;
- border: 4px solid #e6ecff;
- border-radius: 12px;
-}
-table.os td {
- background: #7080d0;
- background-image: linear-gradient(#4060c0 10%, #b0b0ff 95%);
- background-image: -moz-linear-gradient(#4060c0 10%, #b0b0ff 95%);
- background-image: -webkit-linear-gradient(#4060c0 10%, #b0b0ff 95%);
- background-image: -o-linear-gradient(#4060c0 10%, #b0b0ff 95%);
- background-image: -ms-linear-gradient(#4060c0 10%, #b0b0ff 95%);
-}
-table.os1 td {
- color: #ffff80;
-}
-table.os2 td {
- color: #ffa040;
-}
-table.os3 td {
- color: #40ffff;
-}
-table.compiler td {
- color: #2080ff;
- background: #62bf41;
- background-image: linear-gradient(#62bf41 10%, #b0ffb0 95%);
- background-image: -moz-linear-gradient(#62bf41 10%, #b0ffb0 95%);
- background-image: -webkit-linear-gradient(#62bf41 10%, #b0ffb0 95%);
- background-image: -o-linear-gradient(#62bf41 10%, #b0ffb0 95%);
- background-image: -ms-linear-gradient(#62bf41 10%, #b0ffb0 95%);
-}
-table.cpu td {
- color: #ffff00;
- background: #cf7251;
- background-image: linear-gradient(#bf6241 10%, #ffb0b0 95%);
- background-image: -moz-linear-gradient(#bf6241 10%, #ffb0b0 95%);
- background-image: -webkit-linear-gradient(#bf6241 10%, #ffb0b0 95%);
- background-image: -o-linear-gradient(#bf6241 10%, #ffb0b0 95%);
- background-image: -ms-linear-gradient(#bf6241 10%, #ffb0b0 95%);
-}
-table.fcompat td {
- color: #2060e0;
- background: #61cfcf;
- background-image: linear-gradient(#41bfbf 10%, #b0ffff 95%);
- background-image: -moz-linear-gradient(#41bfbf 10%, #b0ffff 95%);
- background-image: -webkit-linear-gradient(#41bfbf 10%, #b0ffff 95%);
- background-image: -o-linear-gradient(#41bfbf 10%, #b0ffff 95%);
- background-image: -ms-linear-gradient(#41bfbf 10%, #b0ffff 95%);
-}
-table.stats td {
- color: #ffffff;
- background: #a0a0a0;
- background-image: linear-gradient(#808080 10%, #d0d0d0 95%);
- background-image: -moz-linear-gradient(#808080 10%, #d0d0d0 95%);
- background-image: -webkit-linear-gradient(#808080 10%, #d0d0d0 95%);
- background-image: -o-linear-gradient(#808080 10%, #d0d0d0 95%);
- background-image: -ms-linear-gradient(#808080 10%, #d0d0d0 95%);
-}
-table.stats td.speed {
- color: #ff4020;
-}
-table.stats td.kb {
- color: #ffff80;
- background: #808080;
- background-image: linear-gradient(#606060 10%, #c0c0c0 95%);
- background-image: -moz-linear-gradient(#606060 10%, #c0c0c0 95%);
- background-image: -webkit-linear-gradient(#606060 10%, #c0c0c0 95%);
- background-image: -o-linear-gradient(#606060 10%, #c0c0c0 95%);
- background-image: -ms-linear-gradient(#606060 10%, #c0c0c0 95%);
-}
-table.feature small {
- font-size: 50%;
-}
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>LuaJIT</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a class="current" href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-LuaJIT is a <b>Just-In-Time Compiler</b> (JIT) for the
-<a href="http://www.lua.org/"><span class="ext">»</span> Lua</a> programming language.
-Lua is a powerful, dynamic and light-weight programming language.
-It may be embedded or used as a general-purpose, stand-alone language.
-</p>
-<p>
-LuaJIT is Copyright © 2005-2015 Mike Pall, released under the
-<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">»</span> MIT open source license</a>.
-</p>
-<p>
-</p>
-
-<h2>Compatibility</h2>
-<table class="feature os os1">
-<tr><td>Windows</td><td>Linux</td><td>BSD</td><td>OSX</td><td>POSIX</td></tr>
-</table>
-<table class="feature os os2">
-<tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td></tr>
-</table>
-<table class="feature os os3">
-<tr><td>PS3</td><td>PS4</td><td>PS Vita</td><td>Xbox 360</td></tr>
-</table>
-<table class="feature compiler">
-<tr><td>GCC</td><td>CLANG<br>LLVM</td><td>MSVC</td></tr>
-</table>
-<table class="feature cpu">
-<tr><td>x86</td><td>x64</td><td>ARM</td><td>PPC</td><td>e500</td><td>MIPS</td></tr>
-</table>
-<table class="feature fcompat">
-<tr><td>Lua 5.1<br>API+ABI</td><td>+ JIT</td><td>+ BitOp</td><td>+ FFI</td><td>Drop-in<br>DLL/.so</td></tr>
-</table>
-
-<h2>Overview</h2>
-<table class="feature stats">
-<tr>
-<td class="speed">3x<br>- 100x</td>
-<td class="kb">115 <small>KB</small><br>VM</td>
-<td class="kb">90 <small>KB</small><br>JIT</td>
-<td class="kloc">63 <small>KLOC</small><br>C</td>
-<td class="kloc">24 <small>KLOC</small><br>ASM</td>
-<td class="kloc">11 <small>KLOC</small><br>Lua</td>
-</tr>
-</table>
-<p style="margin-top: 1em;">
-LuaJIT has been successfully used as a <b>scripting middleware</b> in
-games, appliances, network and graphics apps, numerical simulations,
-trading platforms and many other specialty applications. It scales from
-embedded devices, smartphones, desktops up to server farms. It combines
-high flexibility with <a href="http://luajit.org/performance.html"><span class="ext">»</span> high performance</a>
-and an unmatched <b>low memory footprint</b>.
-</p>
-<p>
-LuaJIT has been in continuous development since 2005. It's widely
-considered to be <b>one of the fastest dynamic language
-implementations</b>. It has outperformed other dynamic languages on many
-cross-language benchmarks since its first release — often by a
-substantial margin.
-</p>
-<p>
-For <b>LuaJIT 2.0</b>, the whole VM has been rewritten from the ground up
-and relentlessly optimized for performance. It combines a <b>high-speed
-interpreter</b>, written in assembler, with a <b>state-of-the-art JIT
-compiler</b>.
-</p>
-<p>
-An innovative <b>trace compiler</b> is integrated with advanced,
-SSA-based optimizations and highly tuned code generation backends.
-A substantial reduction of the overhead associated with dynamic languages
-allows it to break into the performance range traditionally reserved for
-offline, static language compilers.
-</p>
-
-<h2>More ...</h2>
-<p>
-Please select a sub-topic in the navigation bar to learn more about LuaJIT.
-</p>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/running.html b/lib/luajit/doc/running.html
deleted file mode 100644
index c6e1c29..0000000
--- a/lib/luajit/doc/running.html
+++ /dev/null
@@ -1,306 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Running LuaJIT</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-table.opt {
- line-height: 1.2;
-}
-tr.opthead td {
- font-weight: bold;
-}
-td.flag_name {
- width: 4em;
-}
-td.flag_level {
- width: 2em;
- text-align: center;
-}
-td.param_name {
- width: 6em;
-}
-td.param_default {
- width: 4em;
- text-align: right;
-}
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Running LuaJIT</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a class="current" href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-LuaJIT has only a single stand-alone executable, called <tt>luajit</tt> on
-POSIX systems or <tt>luajit.exe</tt> on Windows. It can be used to run simple
-Lua statements or whole Lua applications from the command line. It has an
-interactive mode, too.
-</p>
-
-<h2 id="options">Command Line Options</h2>
-<p>
-The <tt>luajit</tt> stand-alone executable is just a slightly modified
-version of the regular <tt>lua</tt> stand-alone executable.
-It supports the same basic options, too. <tt>luajit -h</tt>
-prints a short list of the available options. Please have a look at the
-<a href="http://www.lua.org/manual/5.1/manual.html#6"><span class="ext">»</span> Lua manual</a>
-for details.
-</p>
-<p>
-LuaJIT has some additional options:
-</p>
-
-<h3 id="opt_b"><tt>-b[options] input output</tt></h3>
-<p>
-This option saves or lists bytecode. The following additional options
-are accepted:
-</p>
-<ul>
-<li><tt>-l</tt> — Only list bytecode.</li>
-<li><tt>-s</tt> — Strip debug info (this is the default).</li>
-<li><tt>-g</tt> — Keep debug info.</li>
-<li><tt>-n name</tt> — Set module name (default: auto-detect from input name)</li>
-<li><tt>-t type</tt> — Set output file type (default: auto-detect from output name).</li>
-<li><tt>-a arch</tt> — Override architecture for object files (default: native).</li>
-<li><tt>-o os</tt> — Override OS for object files (default: native).</li>
-<li><tt>-e chunk</tt> — Use chunk string as input.</li>
-<li><tt>-</tt> (a single minus sign) — Use stdin as input and/or stdout as output.</li>
-</ul>
-<p>
-The output file type is auto-detected from the extension of the output
-file name:
-</p>
-<ul>
-<li><tt>c</tt> — C source file, exported bytecode data.</li>
-<li><tt>h</tt> — C header file, static bytecode data.</li>
-<li><tt>obj</tt> or <tt>o</tt> — Object file, exported bytecode data
-(OS- and architecture-specific).</li>
-<li><tt>raw</tt> or any other extension — Raw bytecode file (portable).
-</ul>
-<p>
-Notes:
-</p>
-<ul>
-<li>See also <a href="extensions.html#string_dump">string.dump()</a>
-for information on bytecode portability and compatibility.</li>
-<li>A file in raw bytecode format is auto-detected and can be loaded like
-any Lua source file. E.g. directly from the command line or with
-<tt>loadfile()</tt>, <tt>dofile()</tt> etc.</li>
-<li>To statically embed the bytecode of a module in your application,
-generate an object file and just link it with your application.</li>
-<li>On most ELF-based systems (e.g. Linux) you need to explicitly export the
-global symbols when linking your application, e.g. with: <tt>-Wl,-E</tt></li>
-<li><tt>require()</tt> tries to load embedded bytecode data from exported
-symbols (in <tt>*.exe</tt> or <tt>lua51.dll</tt> on Windows) and from
-shared libraries in <tt>package.cpath</tt>.</li>
-</ul>
-<p>
-Typical usage examples:
-</p>
-<pre class="code">
-luajit -b test.lua test.out # Save bytecode to test.out
-luajit -bg test.lua test.out # Keep debug info
-luajit -be "print('hello world')" test.out # Save cmdline script
-
-luajit -bl test.lua # List to stdout
-luajit -bl test.lua test.txt # List to test.txt
-luajit -ble "print('hello world')" # List cmdline script
-
-luajit -b test.lua test.obj # Generate object file
-# Link test.obj with your application and load it with require("test")
-</pre>
-
-<h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3>
-<p>
-This option performs a LuaJIT control command or activates one of the
-loadable extension modules. The command is first looked up in the
-<tt>jit.*</tt> library. If no matching function is found, a module
-named <tt>jit.<cmd></tt> is loaded and the <tt>start()</tt>
-function of the module is called with the specified arguments (if
-any). The space between <tt>-j</tt> and <tt>cmd</tt> is optional.
-</p>
-<p>
-Here are the available LuaJIT control commands:
-</p>
-<ul>
-<li id="j_on"><tt>-jon</tt> — Turns the JIT compiler on (default).</li>
-<li id="j_off"><tt>-joff</tt> — Turns the JIT compiler off (only use the interpreter).</li>
-<li id="j_flush"><tt>-jflush</tt> — Flushes the whole cache of compiled code.</li>
-<li id="j_v"><tt>-jv</tt> — Shows verbose information about the progress of the JIT compiler.</li>
-<li id="j_dump"><tt>-jdump</tt> — Dumps the code and structures used in various compiler stages.</li>
-</ul>
-<p>
-The <tt>-jv</tt> and <tt>-jdump</tt> commands are extension modules
-written in Lua. They are mainly used for debugging the JIT compiler
-itself. For a description of their options and output format, please
-read the comment block at the start of their source.
-They can be found in the <tt>lib</tt> directory of the source
-distribution or installed under the <tt>jit</tt> directory. By default
-this is <tt>/usr/local/share/luajit-2.0.4/jit</tt> on POSIX
-systems.
-</p>
-
-<h3 id="opt_O"><tt>-O[level]</tt><br>
-<tt>-O[+]flag</tt> <tt>-O-flag</tt><br>
-<tt>-Oparam=value</tt></h3>
-<p>
-This options allows fine-tuned control of the optimizations used by
-the JIT compiler. This is mainly intended for debugging LuaJIT itself.
-Please note that the JIT compiler is extremely fast (we are talking
-about the microsecond to millisecond range). Disabling optimizations
-doesn't have any visible impact on its overhead, but usually generates
-code that runs slower.
-</p>
-<p>
-The first form sets an optimization level — this enables a
-specific mix of optimization flags. <tt>-O0</tt> turns off all
-optimizations and higher numbers enable more optimizations. Omitting
-the level (i.e. just <tt>-O</tt>) sets the default optimization level,
-which is <tt>-O3</tt> in the current version.
-</p>
-<p>
-The second form adds or removes individual optimization flags.
-The third form sets a parameter for the VM or the JIT compiler
-to a specific value.
-</p>
-<p>
-You can either use this option multiple times (like <tt>-Ocse
--O-dce -Ohotloop=10</tt>) or separate several settings with a comma
-(like <tt>-O+cse,-dce,hotloop=10</tt>). The settings are applied from
-left to right and later settings override earlier ones. You can freely
-mix the three forms, but note that setting an optimization level
-overrides all earlier flags.
-</p>
-<p>
-Here are the available flags and at what optimization levels they
-are enabled:
-</p>
-<table class="opt">
-<tr class="opthead">
-<td class="flag_name">Flag</td>
-<td class="flag_level">-O1</td>
-<td class="flag_level">-O2</td>
-<td class="flag_level">-O3</td>
-<td class="flag_desc"> </td>
-</tr>
-<tr class="odd separate">
-<td class="flag_name">fold</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Constant Folding, Simplifications and Reassociation</td></tr>
-<tr class="even">
-<td class="flag_name">cse</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Common-Subexpression Elimination</td></tr>
-<tr class="odd">
-<td class="flag_name">dce</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Dead-Code Elimination</td></tr>
-<tr class="even">
-<td class="flag_name">narrow</td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Narrowing of numbers to integers</td></tr>
-<tr class="odd">
-<td class="flag_name">loop</td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Loop Optimizations (code hoisting)</td></tr>
-<tr class="even">
-<td class="flag_name">fwd</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Load Forwarding (L2L) and Store Forwarding (S2L)</td></tr>
-<tr class="odd">
-<td class="flag_name">dse</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Dead-Store Elimination</td></tr>
-<tr class="even">
-<td class="flag_name">abc</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Array Bounds Check Elimination</td></tr>
-<tr class="odd">
-<td class="flag_name">sink</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Allocation/Store Sinking</td></tr>
-<tr class="even">
-<td class="flag_name">fuse</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Fusion of operands into instructions</td></tr>
-</table>
-<p>
-Here are the parameters and their default settings:
-</p>
-<table class="opt">
-<tr class="opthead">
-<td class="param_name">Parameter</td>
-<td class="param_default">Default</td>
-<td class="param_desc"> </td>
-</tr>
-<tr class="odd separate">
-<td class="param_name">maxtrace</td><td class="param_default">1000</td><td class="param_desc">Max. number of traces in the cache</td></tr>
-<tr class="even">
-<td class="param_name">maxrecord</td><td class="param_default">4000</td><td class="param_desc">Max. number of recorded IR instructions</td></tr>
-<tr class="odd">
-<td class="param_name">maxirconst</td><td class="param_default">500</td><td class="param_desc">Max. number of IR constants of a trace</td></tr>
-<tr class="even">
-<td class="param_name">maxside</td><td class="param_default">100</td><td class="param_desc">Max. number of side traces of a root trace</td></tr>
-<tr class="odd">
-<td class="param_name">maxsnap</td><td class="param_default">500</td><td class="param_desc">Max. number of snapshots for a trace</td></tr>
-<tr class="even separate">
-<td class="param_name">hotloop</td><td class="param_default">56</td><td class="param_desc">Number of iterations to detect a hot loop or hot call</td></tr>
-<tr class="odd">
-<td class="param_name">hotexit</td><td class="param_default">10</td><td class="param_desc">Number of taken exits to start a side trace</td></tr>
-<tr class="even">
-<td class="param_name">tryside</td><td class="param_default">4</td><td class="param_desc">Number of attempts to compile a side trace</td></tr>
-<tr class="odd separate">
-<td class="param_name">instunroll</td><td class="param_default">4</td><td class="param_desc">Max. unroll factor for instable loops</td></tr>
-<tr class="even">
-<td class="param_name">loopunroll</td><td class="param_default">15</td><td class="param_desc">Max. unroll factor for loop ops in side traces</td></tr>
-<tr class="odd">
-<td class="param_name">callunroll</td><td class="param_default">3</td><td class="param_desc">Max. unroll factor for pseudo-recursive calls</td></tr>
-<tr class="even">
-<td class="param_name">recunroll</td><td class="param_default">2</td><td class="param_desc">Min. unroll factor for true recursion</td></tr>
-<tr class="odd separate">
-<td class="param_name">sizemcode</td><td class="param_default">32</td><td class="param_desc">Size of each machine code area in KBytes (Windows: 64K)</td></tr>
-<tr class="even">
-<td class="param_name">maxmcode</td><td class="param_default">512</td><td class="param_desc">Max. total size of all machine code areas in KBytes</td></tr>
-</table>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/doc/status.html b/lib/luajit/doc/status.html
deleted file mode 100644
index b4bbec7..0000000
--- a/lib/luajit/doc/status.html
+++ /dev/null
@@ -1,116 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Status</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
-<meta name="Language" content="en">
-<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
-<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
-<style type="text/css">
-ul li { padding-bottom: 0.3em; }
-</style>
-</head>
-<body>
-<div id="site">
-<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
-</div>
-<div id="head">
-<h1>Status</h1>
-</div>
-<div id="nav">
-<ul><li>
-<a href="luajit.html">LuaJIT</a>
-<ul><li>
-<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
-</li><li>
-<a href="install.html">Installation</a>
-</li><li>
-<a href="running.html">Running</a>
-</li></ul>
-</li><li>
-<a href="extensions.html">Extensions</a>
-<ul><li>
-<a href="ext_ffi.html">FFI Library</a>
-<ul><li>
-<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
-</li><li>
-<a href="ext_ffi_api.html">ffi.* API</a>
-</li><li>
-<a href="ext_ffi_semantics.html">FFI Semantics</a>
-</li></ul>
-</li><li>
-<a href="ext_jit.html">jit.* Library</a>
-</li><li>
-<a href="ext_c_api.html">Lua/C API</a>
-</li></ul>
-</li><li>
-<a class="current" href="status.html">Status</a>
-<ul><li>
-<a href="changes.html">Changes</a>
-</li></ul>
-</li><li>
-<a href="faq.html">FAQ</a>
-</li><li>
-<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
-</li><li>
-<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
-</li><li>
-<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
-</li></ul>
-</div>
-<div id="main">
-<p>
-<span style="color: #0000c0;">LuaJIT 2.0</span> is the current
-<span style="color: #0000c0;">stable branch</span>. This branch is in
-feature-freeze — new features will only be added to LuaJIT 2.1.
-</p>
-
-<h2>Current Status</h2>
-<p>
-LuaJIT ought to run all Lua 5.1-compatible source code just fine.
-It's considered a serious bug if the VM crashes or produces unexpected
-results — please report this.
-</p>
-<p>
-Known incompatibilities and issues in LuaJIT 2.0:
-</p>
-<ul>
-<li>
-There are some differences in <b>implementation-defined</b> behavior.
-These either have a good reason, are arbitrary design choices
-or are due to quirks in the VM. The latter cases may get fixed if a
-demonstrable need is shown.
-</li>
-<li>
-The Lua <b>debug API</b> is missing a couple of features (return
-hooks for non-Lua functions) and shows slightly different behavior
-in LuaJIT (no per-coroutine hooks, no tail call counting).
-</li>
-<li>
-Some checks are missing in the JIT-compiled code for obscure situations
-with <b>open upvalues aliasing</b> one of the SSA slots later on (or
-vice versa). Bonus points, if you can find a real world test case for
-this.
-</li>
-<li>
-Currently some <b>out-of-memory</b> errors from <b>on-trace code</b> are not
-handled correctly. The error may fall through an on-trace
-<tt>pcall</tt> or it may be passed on to the function set with
-<tt>lua_atpanic</tt> on x64. This issue will be fixed with the new
-garbage collector.
-</li>
-</ul>
-<br class="flush">
-</div>
-<div id="foot">
-<hr class="hide">
-Copyright © 2005-2015 Mike Pall
-<span class="noprint">
-·
-<a href="contact.html">Contact</a>
-</span>
-</div>
-</body>
-</html>
diff --git a/lib/luajit/dynasm/dasm_arm.h b/lib/luajit/dynasm/dasm_arm.h
deleted file mode 100644
index 57e0116..0000000
--- a/lib/luajit/dynasm/dasm_arm.h
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
-** DynASM ARM encoding engine.
-** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-** Released under the MIT license. See dynasm.lua for full copyright notice.
-*/
-
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define DASM_ARCH "arm"
-
-#ifndef DASM_EXTERN
-#define DASM_EXTERN(a,b,c,d) 0
-#endif
-
-/* Action definitions. */
-enum {
- DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
- /* The following actions need a buffer position. */
- DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
- /* The following actions also have an argument. */
- DASM_REL_PC, DASM_LABEL_PC,
- DASM_IMM, DASM_IMM12, DASM_IMM16, DASM_IMML8, DASM_IMML12, DASM_IMMV8,
- DASM__MAX
-};
-
-/* Maximum number of section buffer positions for a single dasm_put() call. */
-#define DASM_MAXSECPOS 25
-
-/* DynASM encoder status codes. Action list offset or number are or'ed in. */
-#define DASM_S_OK 0x00000000
-#define DASM_S_NOMEM 0x01000000
-#define DASM_S_PHASE 0x02000000
-#define DASM_S_MATCH_SEC 0x03000000
-#define DASM_S_RANGE_I 0x11000000
-#define DASM_S_RANGE_SEC 0x12000000
-#define DASM_S_RANGE_LG 0x13000000
-#define DASM_S_RANGE_PC 0x14000000
-#define DASM_S_RANGE_REL 0x15000000
-#define DASM_S_UNDEF_LG 0x21000000
-#define DASM_S_UNDEF_PC 0x22000000
-
-/* Macros to convert positions (8 bit section + 24 bit index). */
-#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
-#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
-#define DASM_SEC2POS(sec) ((sec)<<24)
-#define DASM_POS2SEC(pos) ((pos)>>24)
-#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
-
-/* Action list type. */
-typedef const unsigned int *dasm_ActList;
-
-/* Per-section structure. */
-typedef struct dasm_Section {
- int *rbuf; /* Biased buffer pointer (negative section bias). */
- int *buf; /* True buffer pointer. */
- size_t bsize; /* Buffer size in bytes. */
- int pos; /* Biased buffer position. */
- int epos; /* End of biased buffer position - max single put. */
- int ofs; /* Byte offset into section. */
-} dasm_Section;
-
-/* Core structure holding the DynASM encoding state. */
-struct dasm_State {
- size_t psize; /* Allocated size of this structure. */
- dasm_ActList actionlist; /* Current actionlist pointer. */
- int *lglabels; /* Local/global chain/pos ptrs. */
- size_t lgsize;
- int *pclabels; /* PC label chains/pos ptrs. */
- size_t pcsize;
- void **globals; /* Array of globals (bias -10). */
- dasm_Section *section; /* Pointer to active section. */
- size_t codesize; /* Total size of all code sections. */
- int maxsection; /* 0 <= sectionidx < maxsection. */
- int status; /* Status code. */
- dasm_Section sections[1]; /* All sections. Alloc-extended. */
-};
-
-/* The size of the core structure depends on the max. number of sections. */
-#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
-
-
-/* Initialize DynASM state. */
-void dasm_init(Dst_DECL, int maxsection)
-{
- dasm_State *D;
- size_t psz = 0;
- int i;
- Dst_REF = NULL;
- DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
- D = Dst_REF;
- D->psize = psz;
- D->lglabels = NULL;
- D->lgsize = 0;
- D->pclabels = NULL;
- D->pcsize = 0;
- D->globals = NULL;
- D->maxsection = maxsection;
- for (i = 0; i < maxsection; i++) {
- D->sections[i].buf = NULL; /* Need this for pass3. */
- D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
- D->sections[i].bsize = 0;
- D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
- }
-}
-
-/* Free DynASM state. */
-void dasm_free(Dst_DECL)
-{
- dasm_State *D = Dst_REF;
- int i;
- for (i = 0; i < D->maxsection; i++)
- if (D->sections[i].buf)
- DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
- if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
- if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
- DASM_M_FREE(Dst, D, D->psize);
-}
-
-/* Setup global label array. Must be called before dasm_setup(). */
-void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
-{
- dasm_State *D = Dst_REF;
- D->globals = gl - 10; /* Negative bias to compensate for locals. */
- DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
-}
-
-/* Grow PC label array. Can be called after dasm_setup(), too. */
-void dasm_growpc(Dst_DECL, unsigned int maxpc)
-{
- dasm_State *D = Dst_REF;
- size_t osz = D->pcsize;
- DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
- memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
-}
-
-/* Setup encoder. */
-void dasm_setup(Dst_DECL, const void *actionlist)
-{
- dasm_State *D = Dst_REF;
- int i;
- D->actionlist = (dasm_ActList)actionlist;
- D->status = DASM_S_OK;
- D->section = &D->sections[0];
- memset((void *)D->lglabels, 0, D->lgsize);
- if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
- for (i = 0; i < D->maxsection; i++) {
- D->sections[i].pos = DASM_SEC2POS(i);
- D->sections[i].ofs = 0;
- }
-}
-
-
-#ifdef DASM_CHECKS
-#define CK(x, st) \
- do { if (!(x)) { \
- D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
-#define CKPL(kind, st) \
- do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
- D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
-#else
-#define CK(x, st) ((void)0)
-#define CKPL(kind, st) ((void)0)
-#endif
-
-static int dasm_imm12(unsigned int n)
-{
- int i;
- for (i = 0; i < 16; i++, n = (n << 2) | (n >> 30))
- if (n <= 255) return (int)(n + (i << 8));
- return -1;
-}
-
-/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
-void dasm_put(Dst_DECL, int start, ...)
-{
- va_list ap;
- dasm_State *D = Dst_REF;
- dasm_ActList p = D->actionlist + start;
- dasm_Section *sec = D->section;
- int pos = sec->pos, ofs = sec->ofs;
- int *b;
-
- if (pos >= sec->epos) {
- DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
- sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
- sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
- sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
- }
-
- b = sec->rbuf;
- b[pos++] = start;
-
- va_start(ap, start);
- while (1) {
- unsigned int ins = *p++;
- unsigned int action = (ins >> 16);
- if (action >= DASM__MAX) {
- ofs += 4;
- } else {
- int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
- switch (action) {
- case DASM_STOP: goto stop;
- case DASM_SECTION:
- n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
- D->section = &D->sections[n]; goto stop;
- case DASM_ESC: p++; ofs += 4; break;
- case DASM_REL_EXT: break;
- case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
- case DASM_REL_LG:
- n = (ins & 2047) - 10; pl = D->lglabels + n;
- /* Bkwd rel or global. */
- if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
- pl += 10; n = *pl;
- if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
- goto linkrel;
- case DASM_REL_PC:
- pl = D->pclabels + n; CKPL(pc, PC);
- putrel:
- n = *pl;
- if (n < 0) { /* Label exists. Get label pos and store it. */
- b[pos] = -n;
- } else {
- linkrel:
- b[pos] = n; /* Else link to rel chain, anchored at label. */
- *pl = pos;
- }
- pos++;
- break;
- case DASM_LABEL_LG:
- pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
- case DASM_LABEL_PC:
- pl = D->pclabels + n; CKPL(pc, PC);
- putlabel:
- n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
- while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
- }
- *pl = -pos; /* Label exists now. */
- b[pos++] = ofs; /* Store pass1 offset estimate. */
- break;
- case DASM_IMM:
- case DASM_IMM16:
-#ifdef DASM_CHECKS
- CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
- if ((ins & 0x8000))
- CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
- else
- CK((n>>((ins>>5)&31)) == 0, RANGE_I);
-#endif
- b[pos++] = n;
- break;
- case DASM_IMMV8:
- CK((n & 3) == 0, RANGE_I);
- n >>= 2;
- case DASM_IMML8:
- case DASM_IMML12:
- CK(n >= 0 ? ((n>>((ins>>5)&31)) == 0) :
- (((-n)>>((ins>>5)&31)) == 0), RANGE_I);
- b[pos++] = n;
- break;
- case DASM_IMM12:
- CK(dasm_imm12((unsigned int)n) != -1, RANGE_I);
- b[pos++] = n;
- break;
- }
- }
- }
-stop:
- va_end(ap);
- sec->pos = pos;
- sec->ofs = ofs;
-}
-#undef CK
-
-/* Pass 2: Link sections, shrink aligns, fix label offsets. */
-int dasm_link(Dst_DECL, size_t *szp)
-{
- dasm_State *D = Dst_REF;
- int secnum;
- int ofs = 0;
-
-#ifdef DASM_CHECKS
- *szp = 0;
- if (D->status != DASM_S_OK) return D->status;
- {
- int pc;
- for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
- if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
- }
-#endif
-
- { /* Handle globals not defined in this translation unit. */
- int idx;
- for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
- int n = D->lglabels[idx];
- /* Undefined label: Collapse rel chain and replace with marker (< 0). */
- while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
- }
- }
-
- /* Combine all code sections. No support for data sections (yet). */
- for (secnum = 0; secnum < D->maxsection; secnum++) {
- dasm_Section *sec = D->sections + secnum;
- int *b = sec->rbuf;
- int pos = DASM_SEC2POS(secnum);
- int lastpos = sec->pos;
-
- while (pos != lastpos) {
- dasm_ActList p = D->actionlist + b[pos++];
- while (1) {
- unsigned int ins = *p++;
- unsigned int action = (ins >> 16);
- switch (action) {
- case DASM_STOP: case DASM_SECTION: goto stop;
- case DASM_ESC: p++; break;
- case DASM_REL_EXT: break;
- case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
- case DASM_REL_LG: case DASM_REL_PC: pos++; break;
- case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
- case DASM_IMM: case DASM_IMM12: case DASM_IMM16:
- case DASM_IMML8: case DASM_IMML12: case DASM_IMMV8: pos++; break;
- }
- }
- stop: (void)0;
- }
- ofs += sec->ofs; /* Next section starts right after current section. */
- }
-
- D->codesize = ofs; /* Total size of all code sections */
- *szp = ofs;
- return DASM_S_OK;
-}
-
-#ifdef DASM_CHECKS
-#define CK(x, st) \
- do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
-#else
-#define CK(x, st) ((void)0)
-#endif
-
-/* Pass 3: Encode sections. */
-int dasm_encode(Dst_DECL, void *buffer)
-{
- dasm_State *D = Dst_REF;
- char *base = (char *)buffer;
- unsigned int *cp = (unsigned int *)buffer;
- int secnum;
-
- /* Encode all code sections. No support for data sections (yet). */
- for (secnum = 0; secnum < D->maxsection; secnum++) {
- dasm_Section *sec = D->sections + secnum;
- int *b = sec->buf;
- int *endb = sec->rbuf + sec->pos;
-
- while (b != endb) {
- dasm_ActList p = D->actionlist + *b++;
- while (1) {
- unsigned int ins = *p++;
- unsigned int action = (ins >> 16);
- int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
- switch (action) {
- case DASM_STOP: case DASM_SECTION: goto stop;
- case DASM_ESC: *cp++ = *p++; break;
- case DASM_REL_EXT:
- n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins&2047), !(ins&2048));
- goto patchrel;
- case DASM_ALIGN:
- ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
- break;
- case DASM_REL_LG:
- CK(n >= 0, UNDEF_LG);
- case DASM_REL_PC:
- CK(n >= 0, UNDEF_PC);
- n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) - 4;
- patchrel:
- if ((ins & 0x800) == 0) {
- CK((n & 3) == 0 && ((n+0x02000000) >> 26) == 0, RANGE_REL);
- cp[-1] |= ((n >> 2) & 0x00ffffff);
- } else if ((ins & 0x1000)) {
- CK((n & 3) == 0 && -256 <= n && n <= 256, RANGE_REL);
- goto patchimml8;
- } else if ((ins & 0x2000) == 0) {
- CK((n & 3) == 0 && -4096 <= n && n <= 4096, RANGE_REL);
- goto patchimml;
- } else {
- CK((n & 3) == 0 && -1020 <= n && n <= 1020, RANGE_REL);
- n >>= 2;
- goto patchimml;
- }
- break;
- case DASM_LABEL_LG:
- ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
- break;
- case DASM_LABEL_PC: break;
- case DASM_IMM:
- cp[-1] |= ((n>>((ins>>10)&31)) & ((1<<((ins>>5)&31))-1)) << (ins&31);
- break;
- case DASM_IMM12:
- cp[-1] |= dasm_imm12((unsigned int)n);
- break;
- case DASM_IMM16:
- cp[-1] |= ((n & 0xf000) << 4) | (n & 0x0fff);
- break;
- case DASM_IMML8: patchimml8:
- cp[-1] |= n >= 0 ? (0x00800000 | (n & 0x0f) | ((n & 0xf0) << 4)) :
- ((-n & 0x0f) | ((-n & 0xf0) << 4));
- break;
- case DASM_IMML12: case DASM_IMMV8: patchimml:
- cp[-1] |= n >= 0 ? (0x00800000 | n) : (-n);
- break;
- default: *cp++ = ins; break;
- }
- }
- stop: (void)0;
- }
- }
-
- if (base + D->codesize != (char *)cp) /* Check for phase errors. */
- return DASM_S_PHASE;
- return DASM_S_OK;
-}
-#undef CK
-
-/* Get PC label offset. */
-int dasm_getpclabel(Dst_DECL, unsigned int pc)
-{
- dasm_State *D = Dst_REF;
- if (pc*sizeof(int) < D->pcsize) {
- int pos = D->pclabels[pc];
- if (pos < 0) return *DASM_POS2PTR(D, -pos);
- if (pos > 0) return -1; /* Undefined. */
- }
- return -2; /* Unused or out of range. */
-}
-
-#ifdef DASM_CHECKS
-/* Optional sanity checker to call between isolated encoding steps. */
-int dasm_checkstep(Dst_DECL, int secmatch)
-{
- dasm_State *D = Dst_REF;
- if (D->status == DASM_S_OK) {
- int i;
- for (i = 1; i <= 9; i++) {
- if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
- D->lglabels[i] = 0;
- }
- }
- if (D->status == DASM_S_OK && secmatch >= 0 &&
- D->section != &D->sections[secmatch])
- D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
- return D->status;
-}
-#endif
-
diff --git a/lib/luajit/dynasm/dasm_arm.lua b/lib/luajit/dynasm/dasm_arm.lua
deleted file mode 100644
index 90a259c..0000000
--- a/lib/luajit/dynasm/dasm_arm.lua
+++ /dev/null
@@ -1,1125 +0,0 @@
-------------------------------------------------------------------------------
--- DynASM ARM module.
---
--- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
--- See dynasm.lua for full copyright notice.
-------------------------------------------------------------------------------
-
--- Module information:
-local _info = {
- arch = "arm",
- description = "DynASM ARM module",
- version = "1.3.0",
- vernum = 10300,
- release = "2011-05-05",
- author = "Mike Pall",
- license = "MIT",
-}
-
--- Exported glue functions for the arch-specific module.
-local _M = { _info = _info }
-
--- Cache library functions.
-local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
-local assert, setmetatable, rawget = assert, setmetatable, rawget
-local _s = string
-local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
-local match, gmatch, gsub = _s.match, _s.gmatch, _s.gsub
-local concat, sort, insert = table.concat, table.sort, table.insert
-local bit = bit or require("bit")
-local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
-local ror, tohex = bit.ror, bit.tohex
-
--- Inherited tables and callbacks.
-local g_opt, g_arch
-local wline, werror, wfatal, wwarn
-
--- Action name list.
--- CHECK: Keep this in sync with the C code!
-local action_names = {
- "STOP", "SECTION", "ESC", "REL_EXT",
- "ALIGN", "REL_LG", "LABEL_LG",
- "REL_PC", "LABEL_PC", "IMM", "IMM12", "IMM16", "IMML8", "IMML12", "IMMV8",
-}
-
--- Maximum number of section buffer positions for dasm_put().
--- CHECK: Keep this in sync with the C code!
-local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
-
--- Action name -> action number.
-local map_action = {}
-for n,name in ipairs(action_names) do
- map_action[name] = n-1
-end
-
--- Action list buffer.
-local actlist = {}
-
--- Argument list for next dasm_put(). Start with offset 0 into action list.
-local actargs = { 0 }
-
--- Current number of section buffer positions for dasm_put().
-local secpos = 1
-
-------------------------------------------------------------------------------
-
--- Dump action names and numbers.
-local function dumpactions(out)
- out:write("DynASM encoding engine action codes:\n")
- for n,name in ipairs(action_names) do
- local num = map_action[name]
- out:write(format(" %-10s %02X %d\n", name, num, num))
- end
- out:write("\n")
-end
-
--- Write action list buffer as a huge static C array.
-local function writeactions(out, name)
- local nn = #actlist
- if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
- out:write("static const unsigned int ", name, "[", nn, "] = {\n")
- for i = 1,nn-1 do
- assert(out:write("0x", tohex(actlist[i]), ",\n"))
- end
- assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
-end
-
-------------------------------------------------------------------------------
-
--- Add word to action list.
-local function wputxw(n)
- assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
- actlist[#actlist+1] = n
-end
-
--- Add action to list with optional arg. Advance buffer pos, too.
-local function waction(action, val, a, num)
- local w = assert(map_action[action], "bad action name `"..action.."'")
- wputxw(w * 0x10000 + (val or 0))
- if a then actargs[#actargs+1] = a end
- if a or num then secpos = secpos + (num or 1) end
-end
-
--- Flush action list (intervening C code or buffer pos overflow).
-local function wflush(term)
- if #actlist == actargs[1] then return end -- Nothing to flush.
- if not term then waction("STOP") end -- Terminate action list.
- wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
- actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
- secpos = 1 -- The actionlist offset occupies a buffer position, too.
-end
-
--- Put escaped word.
-local function wputw(n)
- if n <= 0x000fffff then waction("ESC") end
- wputxw(n)
-end
-
--- Reserve position for word.
-local function wpos()
- local pos = #actlist+1
- actlist[pos] = ""
- return pos
-end
-
--- Store word to reserved position.
-local function wputpos(pos, n)
- assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
- if n <= 0x000fffff then
- insert(actlist, pos+1, n)
- n = map_action.ESC * 0x10000
- end
- actlist[pos] = n
-end
-
-------------------------------------------------------------------------------
-
--- Global label name -> global label number. With auto assignment on 1st use.
-local next_global = 20
-local map_global = setmetatable({}, { __index = function(t, name)
- if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
- local n = next_global
- if n > 2047 then werror("too many global labels") end
- next_global = n + 1
- t[name] = n
- return n
-end})
-
--- Dump global labels.
-local function dumpglobals(out, lvl)
- local t = {}
- for name, n in pairs(map_global) do t[n] = name end
- out:write("Global labels:\n")
- for i=20,next_global-1 do
- out:write(format(" %s\n", t[i]))
- end
- out:write("\n")
-end
-
--- Write global label enum.
-local function writeglobals(out, prefix)
- local t = {}
- for name, n in pairs(map_global) do t[n] = name end
- out:write("enum {\n")
- for i=20,next_global-1 do
- out:write(" ", prefix, t[i], ",\n")
- end
- out:write(" ", prefix, "_MAX\n};\n")
-end
-
--- Write global label names.
-local function writeglobalnames(out, name)
- local t = {}
- for name, n in pairs(map_global) do t[n] = name end
- out:write("static const char *const ", name, "[] = {\n")
- for i=20,next_global-1 do
- out:write(" \"", t[i], "\",\n")
- end
- out:write(" (const char *)0\n};\n")
-end
-
-------------------------------------------------------------------------------
-
--- Extern label name -> extern label number. With auto assignment on 1st use.
-local next_extern = 0
-local map_extern_ = {}
-local map_extern = setmetatable({}, { __index = function(t, name)
- -- No restrictions on the name for now.
- local n = next_extern
- if n > 2047 then werror("too many extern labels") end
- next_extern = n + 1
- t[name] = n
- map_extern_[n] = name
- return n
-end})
-
--- Dump extern labels.
-local function dumpexterns(out, lvl)
- out:write("Extern labels:\n")
- for i=0,next_extern-1 do
- out:write(format(" %s\n", map_extern_[i]))
- end
- out:write("\n")
-end
-
--- Write extern label names.
-local function writeexternnames(out, name)
- out:write("static const char *const ", name, "[] = {\n")
- for i=0,next_extern-1 do
- out:write(" \"", map_extern_[i], "\",\n")
- end
- out:write(" (const char *)0\n};\n")
-end
-
-------------------------------------------------------------------------------
-
--- Arch-specific maps.
-
--- Ext. register name -> int. name.
-local map_archdef = { sp = "r13", lr = "r14", pc = "r15", }
-
--- Int. register name -> ext. name.
-local map_reg_rev = { r13 = "sp", r14 = "lr", r15 = "pc", }
-
-local map_type = {} -- Type name -> { ctype, reg }
-local ctypenum = 0 -- Type number (for Dt... macros).
-
--- Reverse defines for registers.
-function _M.revdef(s)
- return map_reg_rev[s] or s
-end
-
-local map_shift = { lsl = 0, lsr = 1, asr = 2, ror = 3, }
-
-local map_cond = {
- eq = 0, ne = 1, cs = 2, cc = 3, mi = 4, pl = 5, vs = 6, vc = 7,
- hi = 8, ls = 9, ge = 10, lt = 11, gt = 12, le = 13, al = 14,
- hs = 2, lo = 3,
-}
-
-------------------------------------------------------------------------------
-
--- Template strings for ARM instructions.
-local map_op = {
- -- Basic data processing instructions.
- and_3 = "e0000000DNPs",
- eor_3 = "e0200000DNPs",
- sub_3 = "e0400000DNPs",
- rsb_3 = "e0600000DNPs",
- add_3 = "e0800000DNPs",
- adc_3 = "e0a00000DNPs",
- sbc_3 = "e0c00000DNPs",
- rsc_3 = "e0e00000DNPs",
- tst_2 = "e1100000NP",
- teq_2 = "e1300000NP",
- cmp_2 = "e1500000NP",
- cmn_2 = "e1700000NP",
- orr_3 = "e1800000DNPs",
- mov_2 = "e1a00000DPs",
- bic_3 = "e1c00000DNPs",
- mvn_2 = "e1e00000DPs",
-
- and_4 = "e0000000DNMps",
- eor_4 = "e0200000DNMps",
- sub_4 = "e0400000DNMps",
- rsb_4 = "e0600000DNMps",
- add_4 = "e0800000DNMps",
- adc_4 = "e0a00000DNMps",
- sbc_4 = "e0c00000DNMps",
- rsc_4 = "e0e00000DNMps",
- tst_3 = "e1100000NMp",
- teq_3 = "e1300000NMp",
- cmp_3 = "e1500000NMp",
- cmn_3 = "e1700000NMp",
- orr_4 = "e1800000DNMps",
- mov_3 = "e1a00000DMps",
- bic_4 = "e1c00000DNMps",
- mvn_3 = "e1e00000DMps",
-
- lsl_3 = "e1a00000DMws",
- lsr_3 = "e1a00020DMws",
- asr_3 = "e1a00040DMws",
- ror_3 = "e1a00060DMws",
- rrx_2 = "e1a00060DMs",
-
- -- Multiply and multiply-accumulate.
- mul_3 = "e0000090NMSs",
- mla_4 = "e0200090NMSDs",
- umaal_4 = "e0400090DNMSs", -- v6
- mls_4 = "e0600090DNMSs", -- v6T2
- umull_4 = "e0800090DNMSs",
- umlal_4 = "e0a00090DNMSs",
- smull_4 = "e0c00090DNMSs",
- smlal_4 = "e0e00090DNMSs",
-
- -- Halfword multiply and multiply-accumulate.
- smlabb_4 = "e1000080NMSD", -- v5TE
- smlatb_4 = "e10000a0NMSD", -- v5TE
- smlabt_4 = "e10000c0NMSD", -- v5TE
- smlatt_4 = "e10000e0NMSD", -- v5TE
- smlawb_4 = "e1200080NMSD", -- v5TE
- smulwb_3 = "e12000a0NMS", -- v5TE
- smlawt_4 = "e12000c0NMSD", -- v5TE
- smulwt_3 = "e12000e0NMS", -- v5TE
- smlalbb_4 = "e1400080NMSD", -- v5TE
- smlaltb_4 = "e14000a0NMSD", -- v5TE
- smlalbt_4 = "e14000c0NMSD", -- v5TE
- smlaltt_4 = "e14000e0NMSD", -- v5TE
- smulbb_3 = "e1600080NMS", -- v5TE
- smultb_3 = "e16000a0NMS", -- v5TE
- smulbt_3 = "e16000c0NMS", -- v5TE
- smultt_3 = "e16000e0NMS", -- v5TE
-
- -- Miscellaneous data processing instructions.
- clz_2 = "e16f0f10DM", -- v5T
- rev_2 = "e6bf0f30DM", -- v6
- rev16_2 = "e6bf0fb0DM", -- v6
- revsh_2 = "e6ff0fb0DM", -- v6
- sel_3 = "e6800fb0DNM", -- v6
- usad8_3 = "e780f010NMS", -- v6
- usada8_4 = "e7800010NMSD", -- v6
- rbit_2 = "e6ff0f30DM", -- v6T2
- movw_2 = "e3000000DW", -- v6T2
- movt_2 = "e3400000DW", -- v6T2
- -- Note: the X encodes width-1, not width.
- sbfx_4 = "e7a00050DMvX", -- v6T2
- ubfx_4 = "e7e00050DMvX", -- v6T2
- -- Note: the X encodes the msb field, not the width.
- bfc_3 = "e7c0001fDvX", -- v6T2
- bfi_4 = "e7c00010DMvX", -- v6T2
-
- -- Packing and unpacking instructions.
- pkhbt_3 = "e6800010DNM", pkhbt_4 = "e6800010DNMv", -- v6
- pkhtb_3 = "e6800050DNM", pkhtb_4 = "e6800050DNMv", -- v6
- sxtab_3 = "e6a00070DNM", sxtab_4 = "e6a00070DNMv", -- v6
- sxtab16_3 = "e6800070DNM", sxtab16_4 = "e6800070DNMv", -- v6
- sxtah_3 = "e6b00070DNM", sxtah_4 = "e6b00070DNMv", -- v6
- sxtb_2 = "e6af0070DM", sxtb_3 = "e6af0070DMv", -- v6
- sxtb16_2 = "e68f0070DM", sxtb16_3 = "e68f0070DMv", -- v6
- sxth_2 = "e6bf0070DM", sxth_3 = "e6bf0070DMv", -- v6
- uxtab_3 = "e6e00070DNM", uxtab_4 = "e6e00070DNMv", -- v6
- uxtab16_3 = "e6c00070DNM", uxtab16_4 = "e6c00070DNMv", -- v6
- uxtah_3 = "e6f00070DNM", uxtah_4 = "e6f00070DNMv", -- v6
- uxtb_2 = "e6ef0070DM", uxtb_3 = "e6ef0070DMv", -- v6
- uxtb16_2 = "e6cf0070DM", uxtb16_3 = "e6cf0070DMv", -- v6
- uxth_2 = "e6ff0070DM", uxth_3 = "e6ff0070DMv", -- v6
-
- -- Saturating instructions.
- qadd_3 = "e1000050DMN", -- v5TE
- qsub_3 = "e1200050DMN", -- v5TE
- qdadd_3 = "e1400050DMN", -- v5TE
- qdsub_3 = "e1600050DMN", -- v5TE
- -- Note: the X for ssat* encodes sat_imm-1, not sat_imm.
- ssat_3 = "e6a00010DXM", ssat_4 = "e6a00010DXMp", -- v6
- usat_3 = "e6e00010DXM", usat_4 = "e6e00010DXMp", -- v6
- ssat16_3 = "e6a00f30DXM", -- v6
- usat16_3 = "e6e00f30DXM", -- v6
-
- -- Parallel addition and subtraction.
- sadd16_3 = "e6100f10DNM", -- v6
- sasx_3 = "e6100f30DNM", -- v6
- ssax_3 = "e6100f50DNM", -- v6
- ssub16_3 = "e6100f70DNM", -- v6
- sadd8_3 = "e6100f90DNM", -- v6
- ssub8_3 = "e6100ff0DNM", -- v6
- qadd16_3 = "e6200f10DNM", -- v6
- qasx_3 = "e6200f30DNM", -- v6
- qsax_3 = "e6200f50DNM", -- v6
- qsub16_3 = "e6200f70DNM", -- v6
- qadd8_3 = "e6200f90DNM", -- v6
- qsub8_3 = "e6200ff0DNM", -- v6
- shadd16_3 = "e6300f10DNM", -- v6
- shasx_3 = "e6300f30DNM", -- v6
- shsax_3 = "e6300f50DNM", -- v6
- shsub16_3 = "e6300f70DNM", -- v6
- shadd8_3 = "e6300f90DNM", -- v6
- shsub8_3 = "e6300ff0DNM", -- v6
- uadd16_3 = "e6500f10DNM", -- v6
- uasx_3 = "e6500f30DNM", -- v6
- usax_3 = "e6500f50DNM", -- v6
- usub16_3 = "e6500f70DNM", -- v6
- uadd8_3 = "e6500f90DNM", -- v6
- usub8_3 = "e6500ff0DNM", -- v6
- uqadd16_3 = "e6600f10DNM", -- v6
- uqasx_3 = "e6600f30DNM", -- v6
- uqsax_3 = "e6600f50DNM", -- v6
- uqsub16_3 = "e6600f70DNM", -- v6
- uqadd8_3 = "e6600f90DNM", -- v6
- uqsub8_3 = "e6600ff0DNM", -- v6
- uhadd16_3 = "e6700f10DNM", -- v6
- uhasx_3 = "e6700f30DNM", -- v6
- uhsax_3 = "e6700f50DNM", -- v6
- uhsub16_3 = "e6700f70DNM", -- v6
- uhadd8_3 = "e6700f90DNM", -- v6
- uhsub8_3 = "e6700ff0DNM", -- v6
-
- -- Load/store instructions.
- str_2 = "e4000000DL", str_3 = "e4000000DL", str_4 = "e4000000DL",
- strb_2 = "e4400000DL", strb_3 = "e4400000DL", strb_4 = "e4400000DL",
- ldr_2 = "e4100000DL", ldr_3 = "e4100000DL", ldr_4 = "e4100000DL",
- ldrb_2 = "e4500000DL", ldrb_3 = "e4500000DL", ldrb_4 = "e4500000DL",
- strh_2 = "e00000b0DL", strh_3 = "e00000b0DL",
- ldrh_2 = "e01000b0DL", ldrh_3 = "e01000b0DL",
- ldrd_2 = "e00000d0DL", ldrd_3 = "e00000d0DL", -- v5TE
- ldrsb_2 = "e01000d0DL", ldrsb_3 = "e01000d0DL",
- strd_2 = "e00000f0DL", strd_3 = "e00000f0DL", -- v5TE
- ldrsh_2 = "e01000f0DL", ldrsh_3 = "e01000f0DL",
-
- ldm_2 = "e8900000oR", ldmia_2 = "e8900000oR", ldmfd_2 = "e8900000oR",
- ldmda_2 = "e8100000oR", ldmfa_2 = "e8100000oR",
- ldmdb_2 = "e9100000oR", ldmea_2 = "e9100000oR",
- ldmib_2 = "e9900000oR", ldmed_2 = "e9900000oR",
- stm_2 = "e8800000oR", stmia_2 = "e8800000oR", stmfd_2 = "e8800000oR",
- stmda_2 = "e8000000oR", stmfa_2 = "e8000000oR",
- stmdb_2 = "e9000000oR", stmea_2 = "e9000000oR",
- stmib_2 = "e9800000oR", stmed_2 = "e9800000oR",
- pop_1 = "e8bd0000R", push_1 = "e92d0000R",
-
- -- Branch instructions.
- b_1 = "ea000000B",
- bl_1 = "eb000000B",
- blx_1 = "e12fff30C",
- bx_1 = "e12fff10M",
-
- -- Miscellaneous instructions.
- nop_0 = "e1a00000",
- mrs_1 = "e10f0000D",
- bkpt_1 = "e1200070K", -- v5T
- svc_1 = "ef000000T", swi_1 = "ef000000T",
- ud_0 = "e7f001f0",
-
- -- VFP instructions.
- ["vadd.f32_3"] = "ee300a00dnm",
- ["vadd.f64_3"] = "ee300b00Gdnm",
- ["vsub.f32_3"] = "ee300a40dnm",
- ["vsub.f64_3"] = "ee300b40Gdnm",
- ["vmul.f32_3"] = "ee200a00dnm",
- ["vmul.f64_3"] = "ee200b00Gdnm",
- ["vnmul.f32_3"] = "ee200a40dnm",
- ["vnmul.f64_3"] = "ee200b40Gdnm",
- ["vmla.f32_3"] = "ee000a00dnm",
- ["vmla.f64_3"] = "ee000b00Gdnm",
- ["vmls.f32_3"] = "ee000a40dnm",
- ["vmls.f64_3"] = "ee000b40Gdnm",
- ["vnmla.f32_3"] = "ee100a40dnm",
- ["vnmla.f64_3"] = "ee100b40Gdnm",
- ["vnmls.f32_3"] = "ee100a00dnm",
- ["vnmls.f64_3"] = "ee100b00Gdnm",
- ["vdiv.f32_3"] = "ee800a00dnm",
- ["vdiv.f64_3"] = "ee800b00Gdnm",
-
- ["vabs.f32_2"] = "eeb00ac0dm",
- ["vabs.f64_2"] = "eeb00bc0Gdm",
- ["vneg.f32_2"] = "eeb10a40dm",
- ["vneg.f64_2"] = "eeb10b40Gdm",
- ["vsqrt.f32_2"] = "eeb10ac0dm",
- ["vsqrt.f64_2"] = "eeb10bc0Gdm",
- ["vcmp.f32_2"] = "eeb40a40dm",
- ["vcmp.f64_2"] = "eeb40b40Gdm",
- ["vcmpe.f32_2"] = "eeb40ac0dm",
- ["vcmpe.f64_2"] = "eeb40bc0Gdm",
- ["vcmpz.f32_1"] = "eeb50a40d",
- ["vcmpz.f64_1"] = "eeb50b40Gd",
- ["vcmpze.f32_1"] = "eeb50ac0d",
- ["vcmpze.f64_1"] = "eeb50bc0Gd",
-
- vldr_2 = "ed100a00dl|ed100b00Gdl",
- vstr_2 = "ed000a00dl|ed000b00Gdl",
- vldm_2 = "ec900a00or",
- vldmia_2 = "ec900a00or",
- vldmdb_2 = "ed100a00or",
- vpop_1 = "ecbd0a00r",
- vstm_2 = "ec800a00or",
- vstmia_2 = "ec800a00or",
- vstmdb_2 = "ed000a00or",
- vpush_1 = "ed2d0a00r",
-
- ["vmov.f32_2"] = "eeb00a40dm|eeb00a00dY", -- #imm is VFPv3 only
- ["vmov.f64_2"] = "eeb00b40Gdm|eeb00b00GdY", -- #imm is VFPv3 only
- vmov_2 = "ee100a10Dn|ee000a10nD",
- vmov_3 = "ec500a10DNm|ec400a10mDN|ec500b10GDNm|ec400b10GmDN",
-
- vmrs_0 = "eef1fa10",
- vmrs_1 = "eef10a10D",
- vmsr_1 = "eee10a10D",
-
- ["vcvt.s32.f32_2"] = "eebd0ac0dm",
- ["vcvt.s32.f64_2"] = "eebd0bc0dGm",
- ["vcvt.u32.f32_2"] = "eebc0ac0dm",
- ["vcvt.u32.f64_2"] = "eebc0bc0dGm",
- ["vcvtr.s32.f32_2"] = "eebd0a40dm",
- ["vcvtr.s32.f64_2"] = "eebd0b40dGm",
- ["vcvtr.u32.f32_2"] = "eebc0a40dm",
- ["vcvtr.u32.f64_2"] = "eebc0b40dGm",
- ["vcvt.f32.s32_2"] = "eeb80ac0dm",
- ["vcvt.f64.s32_2"] = "eeb80bc0GdFm",
- ["vcvt.f32.u32_2"] = "eeb80a40dm",
- ["vcvt.f64.u32_2"] = "eeb80b40GdFm",
- ["vcvt.f32.f64_2"] = "eeb70bc0dGm",
- ["vcvt.f64.f32_2"] = "eeb70ac0GdFm",
-
- -- VFPv4 only:
- ["vfma.f32_3"] = "eea00a00dnm",
- ["vfma.f64_3"] = "eea00b00Gdnm",
- ["vfms.f32_3"] = "eea00a40dnm",
- ["vfms.f64_3"] = "eea00b40Gdnm",
- ["vfnma.f32_3"] = "ee900a40dnm",
- ["vfnma.f64_3"] = "ee900b40Gdnm",
- ["vfnms.f32_3"] = "ee900a00dnm",
- ["vfnms.f64_3"] = "ee900b00Gdnm",
-
- -- NYI: Advanced SIMD instructions.
-
- -- NYI: I have no need for these instructions right now:
- -- swp, swpb, strex, ldrex, strexd, ldrexd, strexb, ldrexb, strexh, ldrexh
- -- msr, nopv6, yield, wfe, wfi, sev, dbg, bxj, smc, srs, rfe
- -- cps, setend, pli, pld, pldw, clrex, dsb, dmb, isb
- -- stc, ldc, mcr, mcr2, mrc, mrc2, mcrr, mcrr2, mrrc, mrrc2, cdp, cdp2
-}
-
--- Add mnemonics for "s" variants.
-do
- local t = {}
- for k,v in pairs(map_op) do
- if sub(v, -1) == "s" then
- local v2 = sub(v, 1, 2)..char(byte(v, 3)+1)..sub(v, 4, -2)
- t[sub(k, 1, -3).."s"..sub(k, -2)] = v2
- end
- end
- for k,v in pairs(t) do
- map_op[k] = v
- end
-end
-
-------------------------------------------------------------------------------
-
-local function parse_gpr(expr)
- local tname, ovreg = match(expr, "^([%w_]+):(r1?[0-9])$")
- local tp = map_type[tname or expr]
- if tp then
- local reg = ovreg or tp.reg
- if not reg then
- werror("type `"..(tname or expr).."' needs a register override")
- end
- expr = reg
- end
- local r = match(expr, "^r(1?[0-9])$")
- if r then
- r = tonumber(r)
- if r <= 15 then return r, tp end
- end
- werror("bad register name `"..expr.."'")
-end
-
-local function parse_gpr_pm(expr)
- local pm, expr2 = match(expr, "^([+-]?)(.*)$")
- return parse_gpr(expr2), (pm == "-")
-end
-
-local function parse_vr(expr, tp)
- local t, r = match(expr, "^([sd])([0-9]+)$")
- if t == tp then
- r = tonumber(r)
- if r <= 31 then
- if t == "s" then return shr(r, 1), band(r, 1) end
- return band(r, 15), shr(r, 4)
- end
- end
- werror("bad register name `"..expr.."'")
-end
-
-local function parse_reglist(reglist)
- reglist = match(reglist, "^{%s*([^}]*)}$")
- if not reglist then werror("register list expected") end
- local rr = 0
- for p in gmatch(reglist..",", "%s*([^,]*),") do
- local rbit = shl(1, parse_gpr(gsub(p, "%s+$", "")))
- if band(rr, rbit) ~= 0 then
- werror("duplicate register `"..p.."'")
- end
- rr = rr + rbit
- end
- return rr
-end
-
-local function parse_vrlist(reglist)
- local ta, ra, tb, rb = match(reglist,
- "^{%s*([sd])([0-9]+)%s*%-%s*([sd])([0-9]+)%s*}$")
- ra, rb = tonumber(ra), tonumber(rb)
- if ta and ta == tb and ra and rb and ra <= 31 and rb <= 31 and ra <= rb then
- local nr = rb+1 - ra
- if ta == "s" then
- return shl(shr(ra,1),12)+shl(band(ra,1),22) + nr
- else
- return shl(band(ra,15),12)+shl(shr(ra,4),22) + nr*2 + 0x100
- end
- end
- werror("register list expected")
-end
-
-local function parse_imm(imm, bits, shift, scale, signed)
- imm = match(imm, "^#(.*)$")
- if not imm then werror("expected immediate operand") end
- local n = tonumber(imm)
- if n then
- local m = sar(n, scale)
- if shl(m, scale) == n then
- if signed then
- local s = sar(m, bits-1)
- if s == 0 then return shl(m, shift)
- elseif s == -1 then return shl(m + shl(1, bits), shift) end
- else
- if sar(m, bits) == 0 then return shl(m, shift) end
- end
- end
- werror("out of range immediate `"..imm.."'")
- else
- waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
- return 0
- end
-end
-
-local function parse_imm12(imm)
- local n = tonumber(imm)
- if n then
- local m = band(n)
- for i=0,-15,-1 do
- if shr(m, 8) == 0 then return m + shl(band(i, 15), 8) end
- m = ror(m, 2)
- end
- werror("out of range immediate `"..imm.."'")
- else
- waction("IMM12", 0, imm)
- return 0
- end
-end
-
-local function parse_imm16(imm)
- imm = match(imm, "^#(.*)$")
- if not imm then werror("expected immediate operand") end
- local n = tonumber(imm)
- if n then
- if shr(n, 16) == 0 then return band(n, 0x0fff) + shl(band(n, 0xf000), 4) end
- werror("out of range immediate `"..imm.."'")
- else
- waction("IMM16", 32*16, imm)
- return 0
- end
-end
-
-local function parse_imm_load(imm, ext)
- local n = tonumber(imm)
- if n then
- if ext then
- if n >= -255 and n <= 255 then
- local up = 0x00800000
- if n < 0 then n = -n; up = 0 end
- return shl(band(n, 0xf0), 4) + band(n, 0x0f) + up
- end
- else
- if n >= -4095 and n <= 4095 then
- if n >= 0 then return n+0x00800000 end
- return -n
- end
- end
- werror("out of range immediate `"..imm.."'")
- else
- waction(ext and "IMML8" or "IMML12", 32768 + shl(ext and 8 or 12, 5), imm)
- return 0
- end
-end
-
-local function parse_shift(shift, gprok)
- if shift == "rrx" then
- return 3 * 32
- else
- local s, s2 = match(shift, "^(%S+)%s*(.*)$")
- s = map_shift[s]
- if not s then werror("expected shift operand") end
- if sub(s2, 1, 1) == "#" then
- return parse_imm(s2, 5, 7, 0, false) + shl(s, 5)
- else
- if not gprok then werror("expected immediate shift operand") end
- return shl(parse_gpr(s2), 8) + shl(s, 5) + 16
- end
- end
-end
-
-local function parse_label(label, def)
- local prefix = sub(label, 1, 2)
- -- =>label (pc label reference)
- if prefix == "=>" then
- return "PC", 0, sub(label, 3)
- end
- -- ->name (global label reference)
- if prefix == "->" then
- return "LG", map_global[sub(label, 3)]
- end
- if def then
- -- [1-9] (local label definition)
- if match(label, "^[1-9]$") then
- return "LG", 10+tonumber(label)
- end
- else
- -- [<>][1-9] (local label reference)
- local dir, lnum = match(label, "^([<>])([1-9])$")
- if dir then -- Fwd: 1-9, Bkwd: 11-19.
- return "LG", lnum + (dir == ">" and 0 or 10)
- end
- -- extern label (extern label reference)
- local extname = match(label, "^extern%s+(%S+)$")
- if extname then
- return "EXT", map_extern[extname]
- end
- end
- werror("bad label `"..label.."'")
-end
-
-local function parse_load(params, nparams, n, op)
- local oplo = band(op, 255)
- local ext, ldrd = (oplo ~= 0), (oplo == 208)
- local d
- if (ldrd or oplo == 240) then
- d = band(shr(op, 12), 15)
- if band(d, 1) ~= 0 then werror("odd destination register") end
- end
- local pn = params[n]
- local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
- local p2 = params[n+1]
- if not p1 then
- if not p2 then
- if match(pn, "^[<>=%-]") or match(pn, "^extern%s+") then
- local mode, n, s = parse_label(pn, false)
- waction("REL_"..mode, n + (ext and 0x1800 or 0x0800), s, 1)
- return op + 15 * 65536 + 0x01000000 + (ext and 0x00400000 or 0)
- end
- local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
- if reg and tailr ~= "" then
- local d, tp = parse_gpr(reg)
- if tp then
- waction(ext and "IMML8" or "IMML12", 32768 + 32*(ext and 8 or 12),
- format(tp.ctypefmt, tailr))
- return op + shl(d, 16) + 0x01000000 + (ext and 0x00400000 or 0)
- end
- end
- end
- werror("expected address operand")
- end
- if wb == "!" then op = op + 0x00200000 end
- if p2 then
- if wb == "!" then werror("bad use of '!'") end
- local p3 = params[n+2]
- op = op + shl(parse_gpr(p1), 16)
- local imm = match(p2, "^#(.*)$")
- if imm then
- local m = parse_imm_load(imm, ext)
- if p3 then werror("too many parameters") end
- op = op + m + (ext and 0x00400000 or 0)
- else
- local m, neg = parse_gpr_pm(p2)
- if ldrd and (m == d or m-1 == d) then werror("register conflict") end
- op = op + m + (neg and 0 or 0x00800000) + (ext and 0 or 0x02000000)
- if p3 then op = op + parse_shift(p3) end
- end
- else
- local p1a, p2 = match(p1, "^([^,%s]*)%s*(.*)$")
- op = op + shl(parse_gpr(p1a), 16) + 0x01000000
- if p2 ~= "" then
- local imm = match(p2, "^,%s*#(.*)$")
- if imm then
- local m = parse_imm_load(imm, ext)
- op = op + m + (ext and 0x00400000 or 0)
- else
- local p2a, p3 = match(p2, "^,%s*([^,%s]*)%s*,?%s*(.*)$")
- local m, neg = parse_gpr_pm(p2a)
- if ldrd and (m == d or m-1 == d) then werror("register conflict") end
- op = op + m + (neg and 0 or 0x00800000) + (ext and 0 or 0x02000000)
- if p3 ~= "" then
- if ext then werror("too many parameters") end
- op = op + parse_shift(p3)
- end
- end
- else
- if wb == "!" then werror("bad use of '!'") end
- op = op + (ext and 0x00c00000 or 0x00800000)
- end
- end
- return op
-end
-
-local function parse_vload(q)
- local reg, imm = match(q, "^%[%s*([^,%s]*)%s*(.*)%]$")
- if reg then
- local d = shl(parse_gpr(reg), 16)
- if imm == "" then return d end
- imm = match(imm, "^,%s*#(.*)$")
- if imm then
- local n = tonumber(imm)
- if n then
- if n >= -1020 and n <= 1020 and n%4 == 0 then
- return d + (n >= 0 and n/4+0x00800000 or -n/4)
- end
- werror("out of range immediate `"..imm.."'")
- else
- waction("IMMV8", 32768 + 32*8, imm)
- return d
- end
- end
- else
- if match(q, "^[<>=%-]") or match(q, "^extern%s+") then
- local mode, n, s = parse_label(q, false)
- waction("REL_"..mode, n + 0x2800, s, 1)
- return 15 * 65536
- end
- local reg, tailr = match(q, "^([%w_:]+)%s*(.*)$")
- if reg and tailr ~= "" then
- local d, tp = parse_gpr(reg)
- if tp then
- waction("IMMV8", 32768 + 32*8, format(tp.ctypefmt, tailr))
- return shl(d, 16)
- end
- end
- end
- werror("expected address operand")
-end
-
-------------------------------------------------------------------------------
-
--- Handle opcodes defined with template strings.
-local function parse_template(params, template, nparams, pos)
- local op = tonumber(sub(template, 1, 8), 16)
- local n = 1
- local vr = "s"
-
- -- Process each character.
- for p in gmatch(sub(template, 9), ".") do
- local q = params[n]
- if p == "D" then
- op = op + shl(parse_gpr(q), 12); n = n + 1
- elseif p == "N" then
- op = op + shl(parse_gpr(q), 16); n = n + 1
- elseif p == "S" then
- op = op + shl(parse_gpr(q), 8); n = n + 1
- elseif p == "M" then
- op = op + parse_gpr(q); n = n + 1
- elseif p == "d" then
- local r,h = parse_vr(q, vr); op = op+shl(r,12)+shl(h,22); n = n + 1
- elseif p == "n" then
- local r,h = parse_vr(q, vr); op = op+shl(r,16)+shl(h,7); n = n + 1
- elseif p == "m" then
- local r,h = parse_vr(q, vr); op = op+r+shl(h,5); n = n + 1
- elseif p == "P" then
- local imm = match(q, "^#(.*)$")
- if imm then
- op = op + parse_imm12(imm) + 0x02000000
- else
- op = op + parse_gpr(q)
- end
- n = n + 1
- elseif p == "p" then
- op = op + parse_shift(q, true); n = n + 1
- elseif p == "L" then
- op = parse_load(params, nparams, n, op)
- elseif p == "l" then
- op = op + parse_vload(q)
- elseif p == "B" then
- local mode, n, s = parse_label(q, false)
- waction("REL_"..mode, n, s, 1)
- elseif p == "C" then -- blx gpr vs. blx label.
- if match(q, "^([%w_]+):(r1?[0-9])$") or match(q, "^r(1?[0-9])$") then
- op = op + parse_gpr(q)
- else
- if op < 0xe0000000 then werror("unconditional instruction") end
- local mode, n, s = parse_label(q, false)
- waction("REL_"..mode, n, s, 1)
- op = 0xfa000000
- end
- elseif p == "F" then
- vr = "s"
- elseif p == "G" then
- vr = "d"
- elseif p == "o" then
- local r, wb = match(q, "^([^!]*)(!?)$")
- op = op + shl(parse_gpr(r), 16) + (wb == "!" and 0x00200000 or 0)
- n = n + 1
- elseif p == "R" then
- op = op + parse_reglist(q); n = n + 1
- elseif p == "r" then
- op = op + parse_vrlist(q); n = n + 1
- elseif p == "W" then
- op = op + parse_imm16(q); n = n + 1
- elseif p == "v" then
- op = op + parse_imm(q, 5, 7, 0, false); n = n + 1
- elseif p == "w" then
- local imm = match(q, "^#(.*)$")
- if imm then
- op = op + parse_imm(q, 5, 7, 0, false); n = n + 1
- else
- op = op + shl(parse_gpr(q), 8) + 16
- end
- elseif p == "X" then
- op = op + parse_imm(q, 5, 16, 0, false); n = n + 1
- elseif p == "Y" then
- local imm = tonumber(match(q, "^#(.*)$")); n = n + 1
- if not imm or shr(imm, 8) ~= 0 then
- werror("bad immediate operand")
- end
- op = op + shl(band(imm, 0xf0), 12) + band(imm, 0x0f)
- elseif p == "K" then
- local imm = tonumber(match(q, "^#(.*)$")); n = n + 1
- if not imm or shr(imm, 16) ~= 0 then
- werror("bad immediate operand")
- end
- op = op + shl(band(imm, 0xfff0), 4) + band(imm, 0x000f)
- elseif p == "T" then
- op = op + parse_imm(q, 24, 0, 0, false); n = n + 1
- elseif p == "s" then
- -- Ignored.
- else
- assert(false)
- end
- end
- wputpos(pos, op)
-end
-
-map_op[".template__"] = function(params, template, nparams)
- if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end
-
- -- Limit number of section buffer positions used by a single dasm_put().
- -- A single opcode needs a maximum of 3 positions.
- if secpos+3 > maxsecpos then wflush() end
- local pos = wpos()
- local lpos, apos, spos = #actlist, #actargs, secpos
-
- local ok, err
- for t in gmatch(template, "[^|]+") do
- ok, err = pcall(parse_template, params, t, nparams, pos)
- if ok then return end
- secpos = spos
- actlist[lpos+1] = nil
- actlist[lpos+2] = nil
- actlist[lpos+3] = nil
- actargs[apos+1] = nil
- actargs[apos+2] = nil
- actargs[apos+3] = nil
- end
- error(err, 0)
-end
-
-------------------------------------------------------------------------------
-
--- Pseudo-opcode to mark the position where the action list is to be emitted.
-map_op[".actionlist_1"] = function(params)
- if not params then return "cvar" end
- local name = params[1] -- No syntax check. You get to keep the pieces.
- wline(function(out) writeactions(out, name) end)
-end
-
--- Pseudo-opcode to mark the position where the global enum is to be emitted.
-map_op[".globals_1"] = function(params)
- if not params then return "prefix" end
- local prefix = params[1] -- No syntax check. You get to keep the pieces.
- wline(function(out) writeglobals(out, prefix) end)
-end
-
--- Pseudo-opcode to mark the position where the global names are to be emitted.
-map_op[".globalnames_1"] = function(params)
- if not params then return "cvar" end
- local name = params[1] -- No syntax check. You get to keep the pieces.
- wline(function(out) writeglobalnames(out, name) end)
-end
-
--- Pseudo-opcode to mark the position where the extern names are to be emitted.
-map_op[".externnames_1"] = function(params)
- if not params then return "cvar" end
- local name = params[1] -- No syntax check. You get to keep the pieces.
- wline(function(out) writeexternnames(out, name) end)
-end
-
-------------------------------------------------------------------------------
-
--- Label pseudo-opcode (converted from trailing colon form).
-map_op[".label_1"] = function(params)
- if not params then return "[1-9] | ->global | =>pcexpr" end
- if secpos+1 > maxsecpos then wflush() end
- local mode, n, s = parse_label(params[1], true)
- if mode == "EXT" then werror("bad label definition") end
- waction("LABEL_"..mode, n, s, 1)
-end
-
-------------------------------------------------------------------------------
-
--- Pseudo-opcodes for data storage.
-map_op[".long_*"] = function(params)
- if not params then return "imm..." end
- for _,p in ipairs(params) do
- local n = tonumber(p)
- if not n then werror("bad immediate `"..p.."'") end
- if n < 0 then n = n + 2^32 end
- wputw(n)
- if secpos+2 > maxsecpos then wflush() end
- end
-end
-
--- Alignment pseudo-opcode.
-map_op[".align_1"] = function(params)
- if not params then return "numpow2" end
- if secpos+1 > maxsecpos then wflush() end
- local align = tonumber(params[1])
- if align then
- local x = align
- -- Must be a power of 2 in the range (2 ... 256).
- for i=1,8 do
- x = x / 2
- if x == 1 then
- waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
- return
- end
- end
- end
- werror("bad alignment")
-end
-
-------------------------------------------------------------------------------
-
--- Pseudo-opcode for (primitive) type definitions (map to C types).
-map_op[".type_3"] = function(params, nparams)
- if not params then
- return nparams == 2 and "name, ctype" or "name, ctype, reg"
- end
- local name, ctype, reg = params[1], params[2], params[3]
- if not match(name, "^[%a_][%w_]*$") then
- werror("bad type name `"..name.."'")
- end
- local tp = map_type[name]
- if tp then
- werror("duplicate type `"..name.."'")
- end
- -- Add #type to defines. A bit unclean to put it in map_archdef.
- map_archdef["#"..name] = "sizeof("..ctype..")"
- -- Add new type and emit shortcut define.
- local num = ctypenum + 1
- map_type[name] = {
- ctype = ctype,
- ctypefmt = format("Dt%X(%%s)", num),
- reg = reg,
- }
- wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
- ctypenum = num
-end
-map_op[".type_2"] = map_op[".type_3"]
-
--- Dump type definitions.
-local function dumptypes(out, lvl)
- local t = {}
- for name in pairs(map_type) do t[#t+1] = name end
- sort(t)
- out:write("Type definitions:\n")
- for _,name in ipairs(t) do
- local tp = map_type[name]
- local reg = tp.reg or ""
- out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
- end
- out:write("\n")
-end
-
-------------------------------------------------------------------------------
-
--- Set the current section.
-function _M.section(num)
- waction("SECTION", num)
- wflush(true) -- SECTION is a terminal action.
-end
-
-------------------------------------------------------------------------------
-
--- Dump architecture description.
-function _M.dumparch(out)
- out:write(format("DynASM %s version %s, released %s\n\n",
- _info.arch, _info.version, _info.release))
- dumpactions(out)
-end
-
--- Dump all user defined elements.
-function _M.dumpdef(out, lvl)
- dumptypes(out, lvl)
- dumpglobals(out, lvl)
- dumpexterns(out, lvl)
-end
-
-------------------------------------------------------------------------------
-
--- Pass callbacks from/to the DynASM core.
-function _M.passcb(wl, we, wf, ww)
- wline, werror, wfatal, wwarn = wl, we, wf, ww
- return wflush
-end
-
--- Setup the arch-specific module.
-function _M.setup(arch, opt)
- g_arch, g_opt = arch, opt
-end
-
--- Merge the core maps and the arch-specific maps.
-function _M.mergemaps(map_coreop, map_def)
- setmetatable(map_op, { __index = function(t, k)
- local v = map_coreop[k]
- if v then return v end
- local k1, cc, k2 = match(k, "^(.-)(..)([._].*)$")
- local cv = map_cond[cc]
- if cv then
- local v = rawget(t, k1..k2)
- if type(v) == "string" then
- local scv = format("%x", cv)
- return gsub(scv..sub(v, 2), "|e", "|"..scv)
- end
- end
- end })
- setmetatable(map_def, { __index = map_archdef })
- return map_op, map_def
-end
-
-return _M
-
-------------------------------------------------------------------------------
-
diff --git a/lib/luajit/dynasm/dasm_mips.h b/lib/luajit/dynasm/dasm_mips.h
deleted file mode 100644
index 2f4c2d2..0000000
--- a/lib/luajit/dynasm/dasm_mips.h
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
-** DynASM MIPS encoding engine.
-** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-** Released under the MIT license. See dynasm.lua for full copyright notice.
-*/
-
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define DASM_ARCH "mips"
-
-#ifndef DASM_EXTERN
-#define DASM_EXTERN(a,b,c,d) 0
-#endif
-
-/* Action definitions. */
-enum {
- DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
... 107943 lines suppressed ...
--
To stop receiving notification emails like this one, please contact
bcall@apache.org.
[trafficserver] 01/04: Importing yaml-cpp into tree
Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 39fedef71bdc54397b31a9340c06bfb17ccc04d4
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Tue May 29 18:46:41 2018 -0700
Importing yaml-cpp into tree
This change imports yaml-cpp 0.6.2 (into lib/yamlcpp)
NOTE: I've removed gtest from it's tree
(cherry picked from commit 96592e575547fa70028e099b9f910d7cdf0e272c)
---
NOTICE | 6 +
build/yaml-cpp.m4 | 82 +
ci/rat-regex.txt | 1 +
configure.ac | 6 +
lib/Makefile.am | 4 +
lib/yamlcpp/.clang-format | 47 +
lib/yamlcpp/.codedocs | 50 +
lib/yamlcpp/.gitignore | 1 +
lib/yamlcpp/.travis.yml | 28 +
lib/yamlcpp/CMakeLists.txt | 365 +
lib/yamlcpp/CONTRIBUTING.md | 26 +
lib/yamlcpp/LICENSE | 19 +
lib/yamlcpp/Makefile.am | 66 +
lib/yamlcpp/README.md | 51 +
lib/yamlcpp/include/yaml-cpp/anchor.h | 17 +
lib/yamlcpp/include/yaml-cpp/binary.h | 67 +
lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h | 39 +
.../include/yaml-cpp/contrib/graphbuilder.h | 149 +
lib/yamlcpp/include/yaml-cpp/dll.h | 33 +
lib/yamlcpp/include/yaml-cpp/emitfromevents.h | 57 +
lib/yamlcpp/include/yaml-cpp/emitter.h | 254 +
lib/yamlcpp/include/yaml-cpp/emitterdef.h | 16 +
lib/yamlcpp/include/yaml-cpp/emittermanip.h | 137 +
lib/yamlcpp/include/yaml-cpp/emitterstyle.h | 16 +
lib/yamlcpp/include/yaml-cpp/eventhandler.h | 40 +
lib/yamlcpp/include/yaml-cpp/exceptions.h | 267 +
lib/yamlcpp/include/yaml-cpp/mark.h | 29 +
lib/yamlcpp/include/yaml-cpp/node/convert.h | 331 +
.../include/yaml-cpp/node/detail/bool_type.h | 26 +
lib/yamlcpp/include/yaml-cpp/node/detail/impl.h | 185 +
.../include/yaml-cpp/node/detail/iterator.h | 92 +
.../include/yaml-cpp/node/detail/iterator_fwd.h | 27 +
lib/yamlcpp/include/yaml-cpp/node/detail/memory.h | 46 +
lib/yamlcpp/include/yaml-cpp/node/detail/node.h | 169 +
.../include/yaml-cpp/node/detail/node_data.h | 127 +
.../include/yaml-cpp/node/detail/node_iterator.h | 180 +
.../include/yaml-cpp/node/detail/node_ref.h | 98 +
lib/yamlcpp/include/yaml-cpp/node/emit.h | 32 +
lib/yamlcpp/include/yaml-cpp/node/impl.h | 448 +
lib/yamlcpp/include/yaml-cpp/node/iterator.h | 31 +
lib/yamlcpp/include/yaml-cpp/node/node.h | 145 +
lib/yamlcpp/include/yaml-cpp/node/parse.h | 78 +
lib/yamlcpp/include/yaml-cpp/node/ptr.h | 29 +
lib/yamlcpp/include/yaml-cpp/node/type.h | 16 +
lib/yamlcpp/include/yaml-cpp/noncopyable.h | 25 +
lib/yamlcpp/include/yaml-cpp/null.h | 26 +
lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h | 72 +
lib/yamlcpp/include/yaml-cpp/parser.h | 86 +
lib/yamlcpp/include/yaml-cpp/stlemitter.h | 51 +
lib/yamlcpp/include/yaml-cpp/traits.h | 103 +
lib/yamlcpp/include/yaml-cpp/yaml.h | 24 +
lib/yamlcpp/install.txt | 24 +
lib/yamlcpp/src/binary.cpp | 93 +
lib/yamlcpp/src/collectionstack.h | 39 +
lib/yamlcpp/src/contrib/graphbuilder.cpp | 17 +
lib/yamlcpp/src/contrib/graphbuilderadapter.cpp | 94 +
lib/yamlcpp/src/contrib/graphbuilderadapter.h | 79 +
lib/yamlcpp/src/convert.cpp | 75 +
lib/yamlcpp/src/directives.cpp | 22 +
lib/yamlcpp/src/directives.h | 29 +
lib/yamlcpp/src/emit.cpp | 25 +
lib/yamlcpp/src/emitfromevents.cpp | 119 +
lib/yamlcpp/src/emitter.cpp | 911 ++
lib/yamlcpp/src/emitterstate.cpp | 365 +
lib/yamlcpp/src/emitterstate.h | 203 +
lib/yamlcpp/src/emitterutils.cpp | 483 +
lib/yamlcpp/src/emitterutils.h | 50 +
lib/yamlcpp/src/exceptions.cpp | 31 +
lib/yamlcpp/src/exp.cpp | 136 +
lib/yamlcpp/src/exp.h | 222 +
lib/yamlcpp/src/indentation.h | 41 +
lib/yamlcpp/src/memory.cpp | 26 +
lib/yamlcpp/src/node.cpp | 12 +
lib/yamlcpp/src/node_data.cpp | 300 +
lib/yamlcpp/src/nodebuilder.cpp | 130 +
lib/yamlcpp/src/nodebuilder.h | 70 +
lib/yamlcpp/src/nodeevents.cpp | 101 +
lib/yamlcpp/src/nodeevents.h | 64 +
lib/yamlcpp/src/null.cpp | 10 +
lib/yamlcpp/src/ostream_wrapper.cpp | 57 +
lib/yamlcpp/src/parse.cpp | 72 +
lib/yamlcpp/src/parser.cpp | 129 +
lib/yamlcpp/src/ptr_vector.h | 43 +
lib/yamlcpp/src/regex_yaml.cpp | 45 +
lib/yamlcpp/src/regex_yaml.h | 87 +
lib/yamlcpp/src/regeximpl.h | 186 +
lib/yamlcpp/src/scanner.cpp | 386 +
lib/yamlcpp/src/scanner.h | 190 +
lib/yamlcpp/src/scanscalar.cpp | 250 +
lib/yamlcpp/src/scanscalar.h | 63 +
lib/yamlcpp/src/scantag.cpp | 81 +
lib/yamlcpp/src/scantag.h | 19 +
lib/yamlcpp/src/scantoken.cpp | 437 +
lib/yamlcpp/src/setting.h | 95 +
lib/yamlcpp/src/simplekey.cpp | 128 +
lib/yamlcpp/src/singledocparser.cpp | 414 +
lib/yamlcpp/src/singledocparser.h | 65 +
lib/yamlcpp/src/stream.cpp | 448 +
lib/yamlcpp/src/stream.h | 76 +
lib/yamlcpp/src/streamcharsource.h | 48 +
lib/yamlcpp/src/stringsource.h | 48 +
lib/yamlcpp/src/tag.cpp | 49 +
lib/yamlcpp/src/tag.h | 33 +
lib/yamlcpp/src/token.h | 69 +
lib/yamlcpp/test/CMakeLists.txt | 44 +
lib/yamlcpp/test/create-emitter-tests.py | 211 +
lib/yamlcpp/test/handler_test.h | 32 +
lib/yamlcpp/test/integration/emitter_test.cpp | 1038 +++
lib/yamlcpp/test/integration/encoding_test.cpp | 182 +
lib/yamlcpp/test/integration/gen_emitter_test.cpp | 9759 ++++++++++++++++++++
lib/yamlcpp/test/integration/handler_spec_test.cpp | 1611 ++++
lib/yamlcpp/test/integration/handler_test.cpp | 76 +
lib/yamlcpp/test/integration/load_node_test.cpp | 241 +
lib/yamlcpp/test/integration/node_spec_test.cpp | 1131 +++
lib/yamlcpp/test/main.cpp | 6 +
lib/yamlcpp/test/mock_event_handler.h | 26 +
lib/yamlcpp/test/node/node_test.cpp | 517 ++
lib/yamlcpp/test/ostream_wrapper_test.cpp | 66 +
lib/yamlcpp/test/regex_test.cpp | 177 +
lib/yamlcpp/test/specexamples.h | 846 ++
lib/yamlcpp/util/CMakeLists.txt | 14 +
lib/yamlcpp/util/api.cpp | 137 +
lib/yamlcpp/util/parse.cpp | 61 +
lib/yamlcpp/util/read.cpp | 103 +
lib/yamlcpp/util/sandbox.cpp | 36 +
lib/yamlcpp/yaml-cpp-config-version.cmake.in | 11 +
lib/yamlcpp/yaml-cpp-config.cmake.in | 14 +
lib/yamlcpp/yaml-cpp.pc.cmake | 11 +
128 files changed, 27959 insertions(+)
diff --git a/NOTICE b/NOTICE
index 0d77dd1..57abb87 100644
--- a/NOTICE
+++ b/NOTICE
@@ -101,3 +101,9 @@ Copyright (c) 2015-2016 Jason Kenny All Rights Reserved.
Folly: Facebook Open-source Library
https://github.com/facebook/folly
+
+
+~~
+
+yaml-cpp: A YAML parser and emitter in C++
+https://github.com/jbeder/yaml-cpp
diff --git a/build/yaml-cpp.m4 b/build/yaml-cpp.m4
new file mode 100644
index 0000000..444939b
--- /dev/null
+++ b/build/yaml-cpp.m4
@@ -0,0 +1,82 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements. See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl yaml-cpp.m4: Trafficserver's yaml-cpp autoconf macros
+dnl
+
+dnl
+dnl TS_CHECK_YAML_CPP: look for yaml-cpp libraries and headers
+dnl
+AC_DEFUN([TS_CHECK_YAML_CPP], [
+has_yaml_cpp=no
+AC_ARG_WITH(yaml-cpp, [AC_HELP_STRING([--with-yaml-cpp=DIR],[use a specific yaml-cpp library])],
+[
+ if test "x$withval" != "xyes" && test "x$withval" != "x"; then
+ yaml_cpp_base_dir="$withval"
+ if test "$withval" != "no"; then
+ has_yaml_cpp=yes
+ case "$withval" in
+ *":"*)
+ yaml_cpp_include="`echo $withval |sed -e 's/:.*$//'`"
+ yaml_cpp_ldflags="`echo $withval |sed -e 's/^.*://'`"
+ AC_MSG_CHECKING(checking for yaml-cpp includes in $yaml_cpp_include libs in $yaml_cpp_ldflags )
+ ;;
+ *)
+ yaml_cpp_include="$withval/include"
+ yaml_cpp_ldflags="$withval/lib"
+ yaml_cpp_base_dir="$withval"
+ AC_MSG_CHECKING(yaml-cpp includes in $withval libs in $yaml_cpp_ldflags)
+ ;;
+ esac
+ fi
+ fi
+
+ if test -d $yaml_cpp_include && test -d $yaml_cpp_ldflags && test -f $yaml_cpp_include/yaml-cpp/yaml.h; then
+ AC_MSG_RESULT([ok])
+ else
+ AC_MSG_RESULT([not found])
+ fi
+
+if test "$has_yaml_cpp" != "no"; then
+ saved_ldflags=$LDFLAGS
+ saved_cppflags=$CPPFLAGS
+ yaml_cpp_have_headers=0
+ yaml_cpp_have_libs=0
+ if test "$yaml_cpp_base_dir" != "/usr"; then
+ TS_ADDTO(CPPFLAGS, [-I${yaml_cpp_include}])
+ TS_ADDTO(LDFLAGS, [-L${yaml_cpp_ldflags}])
+ TS_ADDTO_RPATH(${yaml_cpp_ldflags})
+ fi
+
+ if test "$yaml_cpp_include" != "0"; then
+ AC_SUBST([LIB_YAMLCPP], [-lyaml-cpp])
+ AC_SUBST([CFLAGS_YAMLCPP], [-I${yaml_cpp_include}])
+ else
+ has_yaml_cpp=no
+ CPPFLAGS=$saved_cppflags
+ LDFLAGS=$saved_ldflags
+ fi
+fi
+],
+[
+ has_yaml_cpp=no
+ TS_ADDTO(CPPFLAGS, [-I\${abs_top_srcdir}/lib/yamlcpp/include])
+ TS_ADDTO(LDFLAGS, [-L\${abs_top_builddir}/lib/yamlcpp])
+ AC_SUBST([LIB_YAMLCPP], [-lyamlcpp])
+])
+
+])
diff --git a/ci/rat-regex.txt b/ci/rat-regex.txt
index 6285c22..3dc3691 100644
--- a/ci/rat-regex.txt
+++ b/ci/rat-regex.txt
@@ -64,3 +64,4 @@ port\.h
^protocol_binary.h$
^override.css$
^catch[.]hpp$
+^yamlcpp$
diff --git a/configure.ac b/configure.ac
index 3d87284..e3908ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1339,6 +1339,11 @@ AM_CONDITIONAL([BUILD_URI_SIGNING_PLUGIN], [test ! -z "${LIBCJOSE}" -a ! -z "${L
AC_SUBST([LIBCJOSE])
AC_SUBST([LIBJANSSON])
+# Check for yaml-cpp library
+#
+TS_CHECK_YAML_CPP
+AM_CONDITIONAL([BUILD_YAML_CPP], [test x"$has_yaml_cpp" = x"no"])
+
# Check for backtrace() support
has_backtrace=0
AC_CHECK_HEADERS([execinfo.h], [has_backtrace=1],[])
@@ -2051,6 +2056,7 @@ AC_CONFIG_FILES([
lib/ts/ink_config.h
lib/tsconfig/Makefile
lib/wccp/Makefile
+ lib/yamlcpp/Makefile
mgmt/Makefile
mgmt/api/Makefile
mgmt/api/include/Makefile
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 32ec467..df3b438 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -26,6 +26,10 @@ if BUILD_WCCP
SUBDIRS += wccp
endif
+#if BUILD_YAML_CPP
+SUBDIRS += yamlcpp
+#endif
+
LOCAL =
if BUILD_LUAJIT
diff --git a/lib/yamlcpp/.clang-format b/lib/yamlcpp/.clang-format
new file mode 100644
index 0000000..d6d46fb
--- /dev/null
+++ b/lib/yamlcpp/.clang-format
@@ -0,0 +1,47 @@
+---
+# BasedOnStyle: Google
+AccessModifierOffset: -1
+ConstructorInitializerIndentWidth: 4
+AlignEscapedNewlinesLeft: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: true
+AlwaysBreakBeforeMultilineStrings: true
+BreakBeforeBinaryOperators: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BinPackParameters: true
+ColumnLimit: 80
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+DerivePointerBinding: true
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 60
+PenaltyBreakString: 1000
+PenaltyBreakFirstLessLess: 120
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerBindsToType: true
+SpacesBeforeTrailingComments: 2
+Cpp11BracedListStyle: true
+Standard: Cpp11
+IndentWidth: 2
+TabWidth: 8
+UseTab: Never
+BreakBeforeBraces: Attach
+IndentFunctionDeclarationAfterType: true
+SpacesInParentheses: false
+SpacesInAngles: false
+SpaceInEmptyParentheses: false
+SpacesInCStyleCastParentheses: false
+SpaceAfterControlStatementKeyword: true
+SpaceBeforeAssignmentOperators: true
+ContinuationIndentWidth: 4
+...
+
diff --git a/lib/yamlcpp/.codedocs b/lib/yamlcpp/.codedocs
new file mode 100644
index 0000000..02e4382
--- /dev/null
+++ b/lib/yamlcpp/.codedocs
@@ -0,0 +1,50 @@
+# CodeDocs.xyz Configuration File
+
+# Optional project name, if left empty the GitHub repository name will be used.
+PROJECT_NAME =
+
+# One or more directories and files that contain example code to be included.
+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/
+
+# One or more wildcard patterns to exclude files and directories from document
+# generation.
+EXCLUDE_PATTERNS =
+
+# One or more symbols to exclude from document generation. Symbols can be
+# namespaces, classes, or functions.
+EXCLUDE_SYMBOLS =
+
+# Override the default parser (language) used for each file extension.
+EXTENSION_MAPPING =
+
+# Set the wildcard patterns used to filter out the source-files.
+# If left blank the default is:
+# *.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl,
+# *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php,
+# *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox, *.py,
+# *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
+FILE_PATTERNS =
+
+# Hide undocumented class members.
+HIDE_UNDOC_MEMBERS =
+
+# Hide undocumented classes.
+HIDE_UNDOC_CLASSES =
+
+# Specify a markdown page whose contents should be used as the main page
+# (index.html). This will override a page marked as \mainpage. For example, a
+# README.md file usually serves as a useful main page.
+USE_MDFILE_AS_MAINPAGE = README.md
+
+# Specify external repository to link documentation with.
+# This is similar to Doxygen's TAGFILES option, but will automatically link to
+# tags of other repositories already using CodeDocs. List each repository to
+# link with by giving its location in the form of owner/repository.
+# For example:
+# TAGLINKS = doxygen/doxygen CodeDocs/osg
+# Note: these repositories must already be built on CodeDocs.
+TAGLINKS =
diff --git a/lib/yamlcpp/.gitignore b/lib/yamlcpp/.gitignore
new file mode 100644
index 0000000..567609b
--- /dev/null
+++ b/lib/yamlcpp/.gitignore
@@ -0,0 +1 @@
+build/
diff --git a/lib/yamlcpp/.travis.yml b/lib/yamlcpp/.travis.yml
new file mode 100644
index 0000000..d0b6a04
--- /dev/null
+++ b/lib/yamlcpp/.travis.yml
@@ -0,0 +1,28 @@
+language: c++
+os:
+ - linux
+ - osx
+compiler:
+ - clang
+ - gcc
+before_install:
+ - |
+ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
+ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y \
+ && sudo apt-get update -qq \
+ && if [ "$CXX" == "g++" ]; then
+ sudo apt-get install -qq g++-4.7 && export CXX="g++-4.7" CC="gcc-4.7"
+ fi
+ fi
+before_script:
+ - mkdir build
+ - cd build
+ - cmake ..
+script:
+ - make
+ - test/run-tests
+
+matrix:
+ exclude:
+ - os: linux
+ compiler: clang
diff --git a/lib/yamlcpp/CMakeLists.txt b/lib/yamlcpp/CMakeLists.txt
new file mode 100644
index 0000000..d2d8810
--- /dev/null
+++ b/lib/yamlcpp/CMakeLists.txt
@@ -0,0 +1,365 @@
+###
+### CMake settings
+###
+## Due to Mac OSX we need to keep compatibility with CMake 2.6
+# see http://www.cmake.org/Wiki/CMake_Policies
+cmake_minimum_required(VERSION 2.6)
+# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012
+if(POLICY CMP0012)
+ cmake_policy(SET CMP0012 OLD)
+endif()
+# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015
+if(POLICY CMP0015)
+ cmake_policy(SET CMP0015 OLD)
+endif()
+# see https://cmake.org/cmake/help/latest/policy/CMP0042.html
+if(POLICY CMP0042)
+ # Enable MACOSX_RPATH by default.
+ cmake_policy(SET CMP0042 NEW)
+endif()
+
+include(CheckCXXCompilerFlag)
+
+
+###
+### Project settings
+###
+project(YAML_CPP)
+
+set(YAML_CPP_VERSION_MAJOR "0")
+set(YAML_CPP_VERSION_MINOR "6")
+set(YAML_CPP_VERSION_PATCH "2")
+set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
+
+enable_testing()
+
+
+###
+### Project options
+###
+## Project stuff
+option(YAML_CPP_BUILD_TESTS "Enable testing" ON)
+option(YAML_CPP_BUILD_TOOLS "Enable parse tools" ON)
+option(YAML_CPP_BUILD_CONTRIB "Enable contrib stuff in library" ON)
+
+## Build options
+# --> General
+# see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS
+# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library
+option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
+
+# --> Apple
+option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
+
+# --> Microsoft Visual C++
+# see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx
+# http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx
+option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" ON)
+option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF)
+
+###
+### Sources, headers, directories and libs
+###
+
+# From http://www.cmake.org/pipermail/cmake/2010-March/035992.html:
+# function to collect all the sources from sub-directories
+# into a single list
+function(add_sources)
+ get_property(is_defined GLOBAL PROPERTY SRCS_LIST DEFINED)
+ if(NOT is_defined)
+ define_property(GLOBAL PROPERTY SRCS_LIST
+ BRIEF_DOCS "List of source files"
+ FULL_DOCS "List of all source files in the entire project")
+ endif()
+ # make absolute paths
+ set(SRCS)
+ foreach(s IN LISTS ARGN)
+ if(NOT IS_ABSOLUTE "${s}")
+ get_filename_component(s "${s}" ABSOLUTE)
+ endif()
+ list(APPEND SRCS "${s}")
+ endforeach()
+ # append to global list
+ set_property(GLOBAL APPEND PROPERTY SRCS_LIST "${SRCS}")
+endfunction(add_sources)
+
+set(header_directory "include/yaml-cpp/")
+
+file(GLOB sources "src/[a-zA-Z]*.cpp")
+file(GLOB_RECURSE public_headers "include/yaml-cpp/[a-zA-Z]*.h")
+file(GLOB private_headers "src/[a-zA-Z]*.h")
+
+if(YAML_CPP_BUILD_CONTRIB)
+ file(GLOB contrib_sources "src/contrib/[a-zA-Z]*.cpp")
+ file(GLOB contrib_public_headers "include/yaml-cpp/contrib/[a-zA-Z]*.h")
+ file(GLOB contrib_private_headers "src/contrib/[a-zA-Z]*.h")
+else()
+ add_definitions(-DYAML_CPP_NO_CONTRIB)
+endif()
+
+set(library_sources
+ ${sources}
+ ${public_headers}
+ ${private_headers}
+ ${contrib_sources}
+ ${contrib_public_headers}
+ ${contrib_private_headers}
+)
+add_sources(${library_sources})
+
+if(VERBOSE)
+ message(STATUS "sources: ${sources}")
+ message(STATUS "public_headers: ${public_headers}")
+ message(STATUS "private_headers: ${private_headers}")
+ message(STATUS "contrib_sources: ${contrib_sources}")
+ message(STATUS "contrib_public_headers: ${contrib_public_headers}")
+ message(STATUS "contrib_private_headers: ${contrib_private_headers}")
+endif()
+
+include_directories(${YAML_CPP_SOURCE_DIR}/src)
+include_directories(${YAML_CPP_SOURCE_DIR}/include)
+
+
+
+###
+### General compilation settings
+###
+set(yaml_c_flags ${CMAKE_C_FLAGS})
+set(yaml_cxx_flags ${CMAKE_CXX_FLAGS})
+
+if(BUILD_SHARED_LIBS)
+ set(LABEL_SUFFIX "shared")
+else()
+ set(LABEL_SUFFIX "static")
+endif()
+
+if(APPLE)
+ if(APPLE_UNIVERSAL_BIN)
+ set(CMAKE_OSX_ARCHITECTURES ppc;i386)
+ endif()
+endif()
+
+if(IPHONE)
+ set(CMAKE_OSX_SYSROOT "iphoneos4.2")
+ set(CMAKE_OSX_ARCHITECTURES "armv6;armv7")
+endif()
+
+if(WIN32)
+ if(BUILD_SHARED_LIBS)
+ add_definitions(-D${PROJECT_NAME}_DLL) # use or build Windows DLL
+ endif()
+ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX "C:/")
+ endif()
+endif()
+
+# GCC or Clang or Intel Compiler specialities
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
+ CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+
+ ### General stuff
+ if(WIN32)
+ set(CMAKE_SHARED_LIBRARY_PREFIX "") # DLLs do not have a "lib" prefix
+ set(CMAKE_IMPORT_LIBRARY_PREFIX "") # same for DLL import libs
+ set(CMAKE_LINK_DEF_FILE_FLAG "") # CMake workaround (2.8.3)
+ endif()
+
+ ### Project stuff
+ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+ endif()
+ #
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
+ #
+ set(GCC_EXTRA_OPTIONS "")
+ #
+ if(BUILD_SHARED_LIBS)
+ set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} -fPIC")
+ endif()
+ #
+ set(FLAG_TESTED "-Wextra")
+ check_cxx_compiler_flag(${FLAG_TESTED} FLAG_WEXTRA)
+ if(FLAG_WEXTRA)
+ set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}")
+ endif()
+ #
+ set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long -std=c++11 ${yaml_cxx_flags}")
+
+ ### Make specific
+ if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake)
+ add_custom_target(debuggable $(MAKE) clean
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
+ COMMENT "Adjusting settings for debug compilation"
+ VERBATIM)
+ add_custom_target(releasable $(MAKE) clean
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
+ COMMENT "Adjusting settings for release compilation"
+ VERBATIM)
+ endif()
+endif()
+
+# Microsoft VisualC++ specialities
+if(MSVC)
+ ### General stuff
+ # a) Change MSVC runtime library settings (/MD[d], /MT[d], /ML[d] (single-threaded until VS 2003))
+ # plus set lib suffix for later use and project label accordingly
+ # see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx
+ # http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx
+ set(LIB_RT_SUFFIX "md") # CMake defaults to /MD for MSVC
+ set(LIB_RT_OPTION "/MD")
+ #
+ if(NOT MSVC_SHARED_RT) # User wants to have static runtime libraries (/MT, /ML)
+ if(MSVC_STHREADED_RT) # User wants to have old single-threaded static runtime libraries
+ set(LIB_RT_SUFFIX "ml")
+ set(LIB_RT_OPTION "/ML")
+ if(NOT ${MSVC_VERSION} LESS 1400)
+ message(FATAL_ERROR "Single-threaded static runtime libraries (/ML) only available until VS .NET 2003 (7.1).")
+ endif()
+ else()
+ set(LIB_RT_SUFFIX "mt")
+ set(LIB_RT_OPTION "/MT")
+ endif()
+
+ # correct linker options
+ foreach(flag_var CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ foreach(config_name "" DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
+ set(var_name "${flag_var}")
+ if(NOT "${config_name}" STREQUAL "")
+ set(var_name "${var_name}_${config_name}")
+ endif()
+ string(REPLACE "/MD" "${LIB_RT_OPTION}" ${var_name} "${${var_name}}")
+ set(${var_name} "${${var_name}}" CACHE STRING "" FORCE)
+ endforeach()
+ endforeach()
+ endif()
+ #
+ set(LABEL_SUFFIX "${LABEL_SUFFIX} ${LIB_RT_SUFFIX}")
+
+ # b) Change prefix for static libraries
+ set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # to distinguish static libraries from DLL import libs
+
+ # c) Correct suffixes for static libraries
+ if(NOT BUILD_SHARED_LIBS)
+ ### General stuff
+ set(LIB_TARGET_SUFFIX "${LIB_SUFFIX}${LIB_RT_SUFFIX}")
+ endif()
+
+ ### Project stuff
+ # /W3 = set warning level; see http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
+ # /wd4127 = disable warning C4127 "conditional expression is constant"; see http://msdn.microsoft.com/en-us/library/6t66728h.aspx
+ # /wd4355 = disable warning C4355 "'this' : used in base member initializer list"; http://msdn.microsoft.com/en-us/library/3c594ae3.aspx
+ set(yaml_cxx_flags "/W3 /wd4127 /wd4355 ${yaml_cxx_flags}")
+endif()
+
+
+###
+### General install settings
+###
+set(INCLUDE_INSTALL_ROOT_DIR include)
+
+set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_ROOT_DIR}/yaml-cpp)
+set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}")
+
+set(_INSTALL_DESTINATIONS
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+)
+
+
+###
+### Library
+###
+add_library(yaml-cpp ${library_sources})
+set_target_properties(yaml-cpp PROPERTIES
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
+)
+
+set_target_properties(yaml-cpp PROPERTIES
+ VERSION "${YAML_CPP_VERSION}"
+ SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}"
+ PROJECT_LABEL "yaml-cpp ${LABEL_SUFFIX}"
+)
+
+if(IPHONE)
+ set_target_properties(yaml-cpp PROPERTIES
+ XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "3.0"
+ )
+endif()
+
+if(MSVC)
+ if(NOT BUILD_SHARED_LIBS)
+ # correct library names
+ set_target_properties(yaml-cpp PROPERTIES
+ DEBUG_POSTFIX "${LIB_TARGET_SUFFIX}d"
+ RELEASE_POSTFIX "${LIB_TARGET_SUFFIX}"
+ MINSIZEREL_POSTFIX "${LIB_TARGET_SUFFIX}"
+ RELWITHDEBINFO_POSTFIX "${LIB_TARGET_SUFFIX}"
+ )
+ endif()
+endif()
+
+install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS})
+install(
+ DIRECTORY ${header_directory}
+ DESTINATION ${INCLUDE_INSTALL_DIR}
+ FILES_MATCHING PATTERN "*.h"
+)
+
+export(
+ TARGETS yaml-cpp
+ FILE "${PROJECT_BINARY_DIR}/yaml-cpp-targets.cmake")
+export(PACKAGE yaml-cpp)
+set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets")
+
+set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" @ONLY)
+
+if(WIN32 AND NOT CYGWIN)
+ set(INSTALL_CMAKE_DIR CMake)
+else()
+ set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/yaml-cpp)
+endif()
+
+file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_ROOT_DIR}")
+set(CONFIG_INCLUDE_DIRS "\${YAML_CPP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" @ONLY)
+
+install(FILES
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+ DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
+install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR})
+
+if(UNIX)
+ set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
+ configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY)
+ install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+endif()
+
+
+###
+### Extras
+###
+if(YAML_CPP_BUILD_TESTS)
+ add_subdirectory(test)
+endif()
+if(YAML_CPP_BUILD_TOOLS)
+ add_subdirectory(util)
+endif()
+
+### Formatting
+get_property(all_sources GLOBAL PROPERTY SRCS_LIST)
+add_custom_target(format
+ COMMAND clang-format --style=file -i ${all_sources}
+ COMMENT "Running clang-format"
+ VERBATIM)
diff --git a/lib/yamlcpp/CONTRIBUTING.md b/lib/yamlcpp/CONTRIBUTING.md
new file mode 100644
index 0000000..cd09a1a
--- /dev/null
+++ b/lib/yamlcpp/CONTRIBUTING.md
@@ -0,0 +1,26 @@
+# Style
+
+This project is formatted with [clang-format][fmt] using the style file at the root of the repository. Please run clang-format before sending a pull request.
+
+In general, try to follow the style of surrounding code. We mostly follow the [Google C++ style guide][cpp-style].
+
+Commit messages should be in the imperative mood, as described in the [Git contributing file][git-contrib]:
+
+> Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
+> instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
+> to do frotz", as if you are giving orders to the codebase to change
+> its behaviour.
+
+[fmt]: http://clang.llvm.org/docs/ClangFormat.html
+[cpp-style]: https://google.github.io/styleguide/cppguide.html
+[git-contrib]: http://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches?id=HEAD
+
+# Tests
+
+Please verify the tests pass by running the target `tests/run_tests`.
+
+If you are adding functionality, add tests accordingly.
+
+# Pull request process
+
+Every pull request undergoes a code review. Unfortunately, github's code review process isn't great, but we'll manage. During the code review, if you make changes, add new commits to the pull request for each change. Once the code review is complete, rebase against the master branch and squash into a single commit.
diff --git a/lib/yamlcpp/LICENSE b/lib/yamlcpp/LICENSE
new file mode 100644
index 0000000..991fdbb
--- /dev/null
+++ b/lib/yamlcpp/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2008-2015 Jesse Beder.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/lib/yamlcpp/Makefile.am b/lib/yamlcpp/Makefile.am
new file mode 100644
index 0000000..c32d00b
--- /dev/null
+++ b/lib/yamlcpp/Makefile.am
@@ -0,0 +1,66 @@
+#
+# Makefile.am for yaml-cpp library
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include $(top_srcdir)/build/tidy.mk
+
+AM_CPPFLAGS += \
+ -I$(abs_top_srcdir)/lib/yamlcpp/include
+
+#WCCP_DEFS = @WCCP_DEFS@
+#DEFS += $(WCCP_DEFS)
+
+noinst_LIBRARIES = libyamlcpp.a
+# noinst_PROGRAMS = test-cache
+
+libyamlcpp_a_SOURCES = src/binary.cpp \
+src/convert.cpp \
+src/directives.cpp \
+src/emit.cpp \
+src/emitfromevents.cpp \
+src/emitter.cpp \
+src/emitterstate.cpp \
+src/emitterutils.cpp \
+src/exceptions.cpp \
+src/exp.cpp \
+src/memory.cpp \
+src/node.cpp \
+src/node_data.cpp \
+src/nodebuilder.cpp \
+src/nodeevents.cpp \
+src/null.cpp \
+src/ostream_wrapper.cpp \
+src/parse.cpp \
+src/parser.cpp \
+src/regex_yaml.cpp \
+src/scanner.cpp \
+src/scanscalar.cpp \
+src/scantag.cpp \
+src/scantoken.cpp \
+src/simplekey.cpp \
+src/singledocparser.cpp \
+src/stream.cpp \
+src/tag.cpp
+
+# test_cache_SOURCES = \
+# wccp-test-cache.cc
+
+# test_cache_LDADD = $(LDADD) -L$(top_builddir)/lib/tsconfig -ltsconfig -L$(top_builddir)/lib/wccp -lwccp -L$(top_builddir)/lib/ts -ltsutil
+
+clang-tidy-local: $(DIST_SOURCES)
+ $(CXX_Clang_Tidy)
diff --git a/lib/yamlcpp/README.md b/lib/yamlcpp/README.md
new file mode 100644
index 0000000..f33d350
--- /dev/null
+++ b/lib/yamlcpp/README.md
@@ -0,0 +1,51 @@
+# yaml-cpp [](https://travis-ci.org/jbeder/yaml-cpp) [](https://codedocs.xyz/jbeder/yaml-cpp/)
+
+yaml-cpp is a [YAML](http://www.yaml.org/) parser and emitter in C++ matching the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html).
+
+To get a feel for how it can be used, see the [Tutorial](https://github.com/jbeder/yaml-cpp/wiki/Tutorial) or [How to Emit YAML](https://github.com/jbeder/yaml-cpp/wiki/How-To-Emit-YAML). For the old API (version < 0.5.0), see [How To Parse A Document](https://github.com/jbeder/yaml-cpp/wiki/How-To-Parse-A-Document-(Old-API)).
+
+# Problems? #
+
+If you find a bug, post an [issue](https://github.com/jbeder/yaml-cpp/issues)! If you have questions about how to use yaml-cpp, please post it on http://stackoverflow.com and tag it [`yaml-cpp`](http://stackoverflow.com/questions/tagged/yaml-cpp).
+
+# How to Build #
+
+yaml-cpp uses [CMake](http://www.cmake.org) to support cross-platform building. The basic steps to build are:
+
+1. Download and install [CMake](http://www.cmake.org) (Resources -> Download).
+
+**Note:** If you don't use the provided installer for your platform, make sure that you add CMake's bin folder to your path.
+
+2. Navigate into the source directory, and type:
+
+```
+mkdir build
+cd build
+```
+
+3. Run CMake. The basic syntax is:
+
+```
+cmake [-G generator] [-DBUILD_SHARED_LIBS=ON|OFF] ..
+```
+
+ * The `generator` is whatever type of build system you'd like to use. To see a full list of generators on your platform, just run `cmake` (with no arguments). For example:
+ * On Windows, you might use "Visual Studio 12 2013" to generate a Visual Studio 2013 solution or "Visual Studio 14 2015 Win64" to generate a 64-bit Visual Studio 2015 solution.
+ * On OS X, you might use "Xcode" to generate an Xcode project
+ * On a UNIX-y system, simply omit the option to generate a makefile
+
+ * yaml-cpp defaults to building a static library, but you may build a shared library by specifying `-DBUILD_SHARED_LIBS=ON`.
+
+ * For more options on customizing the build, see the [CMakeLists.txt](https://github.com/jbeder/yaml-cpp/blob/master/CMakeLists.txt) file.
+
+4. Build it!
+
+5. To clean up, just remove the `build` directory.
+
+# Recent Release #
+
+[yaml-cpp 0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0) has been released! This release requires C++11, and no longer depends on Boost.
+
+[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.
diff --git a/lib/yamlcpp/include/yaml-cpp/anchor.h b/lib/yamlcpp/include/yaml-cpp/anchor.h
new file mode 100644
index 0000000..06759c7
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/anchor.h
@@ -0,0 +1,17 @@
+#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+
+namespace YAML {
+typedef std::size_t anchor_t;
+const anchor_t NullAnchor = 0;
+}
+
+#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/binary.h b/lib/yamlcpp/include/yaml-cpp/binary.h
new file mode 100644
index 0000000..29d5dbd
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/binary.h
@@ -0,0 +1,67 @@
+#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+YAML_CPP_API std::string EncodeBase64(const unsigned char *data,
+ std::size_t size);
+YAML_CPP_API std::vector<unsigned char> DecodeBase64(const std::string &input);
+
+class YAML_CPP_API Binary {
+ public:
+ Binary() : m_unownedData(0), m_unownedSize(0) {}
+ Binary(const unsigned char *data_, std::size_t size_)
+ : m_unownedData(data_), m_unownedSize(size_) {}
+
+ bool owned() const { return !m_unownedData; }
+ std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
+ const unsigned char *data() const {
+ return owned() ? &m_data[0] : m_unownedData;
+ }
+
+ void swap(std::vector<unsigned char> &rhs) {
+ if (m_unownedData) {
+ m_data.swap(rhs);
+ rhs.clear();
+ rhs.resize(m_unownedSize);
+ std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin());
+ m_unownedData = 0;
+ m_unownedSize = 0;
+ } else {
+ m_data.swap(rhs);
+ }
+ }
+
+ bool operator==(const Binary &rhs) const {
+ const std::size_t s = size();
+ if (s != rhs.size())
+ return false;
+ const unsigned char *d1 = data();
+ const unsigned char *d2 = rhs.data();
+ for (std::size_t i = 0; i < s; i++) {
+ if (*d1++ != *d2++)
+ return false;
+ }
+ return true;
+ }
+
+ bool operator!=(const Binary &rhs) const { return !(*this == rhs); }
+
+ private:
+ std::vector<unsigned char> m_data;
+ const unsigned char *m_unownedData;
+ std::size_t m_unownedSize;
+};
+}
+
+#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h b/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h
new file mode 100644
index 0000000..78db9ec
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h
@@ -0,0 +1,39 @@
+#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+
+#include "../anchor.h"
+
+namespace YAML {
+/**
+ * An object that stores and retrieves values correlating to {@link anchor_t}
+ * values.
+ *
+ * <p>Efficient implementation that can make assumptions about how
+ * {@code anchor_t} values are assigned by the {@link Parser} class.
+ */
+template <class T>
+class AnchorDict {
+ public:
+ void Register(anchor_t anchor, T value) {
+ if (anchor > m_data.size()) {
+ m_data.resize(anchor);
+ }
+ m_data[anchor - 1] = value;
+ }
+
+ T Get(anchor_t anchor) const { return m_data[anchor - 1]; }
+
+ private:
+ std::vector<T> m_data;
+};
+}
+
+#endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h b/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h
new file mode 100644
index 0000000..f0a38f2
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h
@@ -0,0 +1,149 @@
+#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/mark.h"
+#include <string>
+
+namespace YAML {
+class Parser;
+
+// GraphBuilderInterface
+// . Abstraction of node creation
+// . pParentNode is always NULL or the return value of one of the NewXXX()
+// functions.
+class GraphBuilderInterface {
+ public:
+ virtual ~GraphBuilderInterface() = 0;
+
+ // Create and return a new node with a null value.
+ virtual void *NewNull(const Mark &mark, void *pParentNode) = 0;
+
+ // Create and return a new node with the given tag and value.
+ virtual void *NewScalar(const Mark &mark, const std::string &tag,
+ void *pParentNode, const std::string &value) = 0;
+
+ // Create and return a new sequence node
+ virtual void *NewSequence(const Mark &mark, const std::string &tag,
+ void *pParentNode) = 0;
+
+ // Add pNode to pSequence. pNode was created with one of the NewXxx()
+ // functions and pSequence with NewSequence().
+ virtual void AppendToSequence(void *pSequence, void *pNode) = 0;
+
+ // Note that no moew entries will be added to pSequence
+ virtual void SequenceComplete(void *pSequence) { (void)pSequence; }
+
+ // Create and return a new map node
+ virtual void *NewMap(const Mark &mark, const std::string &tag,
+ void *pParentNode) = 0;
+
+ // Add the pKeyNode => pValueNode mapping to pMap. pKeyNode and pValueNode
+ // were created with one of the NewXxx() methods and pMap with NewMap().
+ virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) = 0;
+
+ // Note that no more assignments will be made in pMap
+ virtual void MapComplete(void *pMap) { (void)pMap; }
+
+ // Return the node that should be used in place of an alias referencing
+ // pNode (pNode by default)
+ virtual void *AnchorReference(const Mark &mark, void *pNode) {
+ (void)mark;
+ return pNode;
+ }
+};
+
+// Typesafe wrapper for GraphBuilderInterface. Assumes that Impl defines
+// Node, Sequence, and Map types. Sequence and Map must derive from Node
+// (unless Node is defined as void). Impl must also implement function with
+// all of the same names as the virtual functions in GraphBuilderInterface
+// -- including the ones with default implementations -- but with the
+// prototypes changed to accept an explicit Node*, Sequence*, or Map* where
+// appropriate.
+template <class Impl>
+class GraphBuilder : public GraphBuilderInterface {
+ public:
+ typedef typename Impl::Node Node;
+ typedef typename Impl::Sequence Sequence;
+ typedef typename Impl::Map Map;
+
+ GraphBuilder(Impl &impl) : m_impl(impl) {
+ Map *pMap = NULL;
+ Sequence *pSeq = NULL;
+ Node *pNode = NULL;
+
+ // Type consistency checks
+ pNode = pMap;
+ pNode = pSeq;
+ }
+
+ GraphBuilderInterface &AsBuilderInterface() { return *this; }
+
+ virtual void *NewNull(const Mark &mark, void *pParentNode) {
+ return CheckType<Node>(m_impl.NewNull(mark, AsNode(pParentNode)));
+ }
+
+ virtual void *NewScalar(const Mark &mark, const std::string &tag,
+ void *pParentNode, const std::string &value) {
+ return CheckType<Node>(
+ m_impl.NewScalar(mark, tag, AsNode(pParentNode), value));
+ }
+
+ virtual void *NewSequence(const Mark &mark, const std::string &tag,
+ void *pParentNode) {
+ return CheckType<Sequence>(
+ m_impl.NewSequence(mark, tag, AsNode(pParentNode)));
+ }
+ virtual void AppendToSequence(void *pSequence, void *pNode) {
+ m_impl.AppendToSequence(AsSequence(pSequence), AsNode(pNode));
+ }
+ virtual void SequenceComplete(void *pSequence) {
+ m_impl.SequenceComplete(AsSequence(pSequence));
+ }
+
+ virtual void *NewMap(const Mark &mark, const std::string &tag,
+ void *pParentNode) {
+ return CheckType<Map>(m_impl.NewMap(mark, tag, AsNode(pParentNode)));
+ }
+ virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) {
+ m_impl.AssignInMap(AsMap(pMap), AsNode(pKeyNode), AsNode(pValueNode));
+ }
+ virtual void MapComplete(void *pMap) { m_impl.MapComplete(AsMap(pMap)); }
+
+ virtual void *AnchorReference(const Mark &mark, void *pNode) {
+ return CheckType<Node>(m_impl.AnchorReference(mark, AsNode(pNode)));
+ }
+
+ private:
+ Impl &m_impl;
+
+ // Static check for pointer to T
+ template <class T, class U>
+ static T *CheckType(U *p) {
+ return p;
+ }
+
+ static Node *AsNode(void *pNode) { return static_cast<Node *>(pNode); }
+ static Sequence *AsSequence(void *pSeq) {
+ return static_cast<Sequence *>(pSeq);
+ }
+ static Map *AsMap(void *pMap) { return static_cast<Map *>(pMap); }
+};
+
+void *BuildGraphOfNextDocument(Parser &parser,
+ GraphBuilderInterface &graphBuilder);
+
+template <class Impl>
+typename Impl::Node *BuildGraphOfNextDocument(Parser &parser, Impl &impl) {
+ GraphBuilder<Impl> graphBuilder(impl);
+ return static_cast<typename Impl::Node *>(
+ BuildGraphOfNextDocument(parser, graphBuilder));
+}
+}
+
+#endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/dll.h b/lib/yamlcpp/include/yaml-cpp/dll.h
new file mode 100644
index 0000000..a32c06b
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/dll.h
@@ -0,0 +1,33 @@
+#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+// The following ifdef block is the standard way of creating macros which make
+// exporting from a DLL simpler. All files within this DLL are compiled with the
+// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
+// be defined on any project that uses this DLL. This way any other project
+// whose source files include this file see YAML_CPP_API functions as being
+// imported from a DLL, whereas this DLL sees symbols defined with this macro as
+// being exported.
+#undef YAML_CPP_API
+
+#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
+ // manually)
+#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
+ // or defined manually)
+// #pragma message( "Defining YAML_CPP_API for DLL export" )
+#define YAML_CPP_API __declspec(dllexport)
+#else // yaml_cpp_EXPORTS
+// #pragma message( "Defining YAML_CPP_API for DLL import" )
+#define YAML_CPP_API __declspec(dllimport)
+#endif // yaml_cpp_EXPORTS
+#else // YAML_CPP_DLL
+#define YAML_CPP_API
+#endif // YAML_CPP_DLL
+
+#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/emitfromevents.h b/lib/yamlcpp/include/yaml-cpp/emitfromevents.h
new file mode 100644
index 0000000..f14b051
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/emitfromevents.h
@@ -0,0 +1,57 @@
+#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <stack>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+
+namespace YAML {
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+class Emitter;
+
+class EmitFromEvents : public EventHandler {
+ public:
+ EmitFromEvents(Emitter& emitter);
+
+ virtual void OnDocumentStart(const Mark& mark);
+ virtual void OnDocumentEnd();
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor);
+ virtual void OnAlias(const Mark& mark, anchor_t anchor);
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value);
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnSequenceEnd();
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnMapEnd();
+
+ private:
+ void BeginNode();
+ void EmitProps(const std::string& tag, anchor_t anchor);
+
+ private:
+ Emitter& m_emitter;
+
+ struct State {
+ enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue };
+ };
+ std::stack<State::value> m_stateStack;
+};
+}
+
+#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/emitter.h b/lib/yamlcpp/include/yaml-cpp/emitter.h
new file mode 100644
index 0000000..ef92cc4
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/emitter.h
@@ -0,0 +1,254 @@
+#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+#include <memory>
+#include <sstream>
+#include <string>
+
+#include "yaml-cpp/binary.h"
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/noncopyable.h"
+#include "yaml-cpp/null.h"
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+class Binary;
+struct _Null;
+} // namespace YAML
+
+namespace YAML {
+class EmitterState;
+
+class YAML_CPP_API Emitter : private noncopyable {
+ public:
+ Emitter();
+ explicit Emitter(std::ostream& stream);
+ ~Emitter();
+
+ // output
+ const char* c_str() const;
+ std::size_t size() const;
+
+ // state checking
+ bool good() const;
+ const std::string GetLastError() const;
+
+ // global setters
+ bool SetOutputCharset(EMITTER_MANIP value);
+ bool SetStringFormat(EMITTER_MANIP value);
+ bool SetBoolFormat(EMITTER_MANIP value);
+ bool SetIntBase(EMITTER_MANIP value);
+ bool SetSeqFormat(EMITTER_MANIP value);
+ bool SetMapFormat(EMITTER_MANIP value);
+ bool SetIndent(std::size_t n);
+ bool SetPreCommentIndent(std::size_t n);
+ bool SetPostCommentIndent(std::size_t n);
+ bool SetFloatPrecision(std::size_t n);
+ bool SetDoublePrecision(std::size_t n);
+
+ // local setters
+ Emitter& SetLocalValue(EMITTER_MANIP value);
+ Emitter& SetLocalIndent(const _Indent& indent);
+ Emitter& SetLocalPrecision(const _Precision& precision);
+
+ // overloads of write
+ Emitter& Write(const std::string& str);
+ Emitter& Write(bool b);
+ Emitter& Write(char ch);
+ Emitter& Write(const _Alias& alias);
+ Emitter& Write(const _Anchor& anchor);
+ Emitter& Write(const _Tag& tag);
+ Emitter& Write(const _Comment& comment);
+ Emitter& Write(const _Null& n);
+ Emitter& Write(const Binary& binary);
+
+ template <typename T>
+ Emitter& WriteIntegralType(T value);
+
+ template <typename T>
+ Emitter& WriteStreamable(T value);
+
+ private:
+ template <typename T>
+ void SetStreamablePrecision(std::stringstream&) {}
+ std::size_t GetFloatPrecision() const;
+ std::size_t GetDoublePrecision() const;
+
+ void PrepareIntegralStream(std::stringstream& stream) const;
+ void StartedScalar();
+
+ private:
+ void EmitBeginDoc();
+ void EmitEndDoc();
+ void EmitBeginSeq();
+ void EmitEndSeq();
+ void EmitBeginMap();
+ void EmitEndMap();
+ void EmitNewline();
+ void EmitKindTag();
+ void EmitTag(bool verbatim, const _Tag& tag);
+
+ void PrepareNode(EmitterNodeType::value child);
+ void PrepareTopNode(EmitterNodeType::value child);
+ void FlowSeqPrepareNode(EmitterNodeType::value child);
+ void BlockSeqPrepareNode(EmitterNodeType::value child);
+
+ void FlowMapPrepareNode(EmitterNodeType::value child);
+
+ void FlowMapPrepareLongKey(EmitterNodeType::value child);
+ void FlowMapPrepareLongKeyValue(EmitterNodeType::value child);
+ void FlowMapPrepareSimpleKey(EmitterNodeType::value child);
+ void FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child);
+
+ void BlockMapPrepareNode(EmitterNodeType::value child);
+
+ void BlockMapPrepareLongKey(EmitterNodeType::value child);
+ void BlockMapPrepareLongKeyValue(EmitterNodeType::value child);
+ void BlockMapPrepareSimpleKey(EmitterNodeType::value child);
+ void BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child);
+
+ void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
+
+ const char* ComputeFullBoolName(bool b) const;
+ bool CanEmitNewline() const;
+
+ private:
+ std::unique_ptr<EmitterState> m_pState;
+ ostream_wrapper m_stream;
+};
+
+template <typename T>
+inline Emitter& Emitter::WriteIntegralType(T value) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ std::stringstream stream;
+ PrepareIntegralStream(stream);
+ stream << value;
+ m_stream << stream.str();
+
+ StartedScalar();
+
+ return *this;
+}
+
+template <typename T>
+inline Emitter& Emitter::WriteStreamable(T value) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ std::stringstream stream;
+ SetStreamablePrecision<T>(stream);
+ stream << value;
+ m_stream << stream.str();
+
+ StartedScalar();
+
+ return *this;
+}
+
+template <>
+inline void Emitter::SetStreamablePrecision<float>(std::stringstream& stream) {
+ stream.precision(static_cast<std::streamsize>(GetFloatPrecision()));
+}
+
+template <>
+inline void Emitter::SetStreamablePrecision<double>(std::stringstream& stream) {
+ stream.precision(static_cast<std::streamsize>(GetDoublePrecision()));
+}
+
+// overloads of insertion
+inline Emitter& operator<<(Emitter& emitter, const std::string& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, bool v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, char v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned char v) {
+ return emitter.Write(static_cast<char>(v));
+}
+inline Emitter& operator<<(Emitter& emitter, const _Alias& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Anchor& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Tag& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Comment& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Null& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const Binary& b) {
+ return emitter.Write(b);
+}
+
+inline Emitter& operator<<(Emitter& emitter, const char* v) {
+ return emitter.Write(std::string(v));
+}
+
+inline Emitter& operator<<(Emitter& emitter, int v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned int v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, short v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned short v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, long v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned long v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, long long v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned long long v) {
+ return emitter.WriteIntegralType(v);
+}
+
+inline Emitter& operator<<(Emitter& emitter, float v) {
+ return emitter.WriteStreamable(v);
+}
+inline Emitter& operator<<(Emitter& emitter, double v) {
+ return emitter.WriteStreamable(v);
+}
+
+inline Emitter& operator<<(Emitter& emitter, EMITTER_MANIP value) {
+ return emitter.SetLocalValue(value);
+}
+
+inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
+ return emitter.SetLocalIndent(indent);
+}
+
+inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
+ return emitter.SetLocalPrecision(precision);
+}
+}
+
+#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/emitterdef.h b/lib/yamlcpp/include/yaml-cpp/emitterdef.h
new file mode 100644
index 0000000..0b42695
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/emitterdef.h
@@ -0,0 +1,16 @@
+#ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+struct EmitterNodeType {
+ enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap };
+};
+}
+
+#endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/emittermanip.h b/lib/yamlcpp/include/yaml-cpp/emittermanip.h
new file mode 100644
index 0000000..89f7256
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/emittermanip.h
@@ -0,0 +1,137 @@
+#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+namespace YAML {
+enum EMITTER_MANIP {
+ // general manipulators
+ Auto,
+ TagByKind,
+ Newline,
+
+ // output character set
+ EmitNonAscii,
+ EscapeNonAscii,
+
+ // string manipulators
+ // Auto, // duplicate
+ SingleQuoted,
+ DoubleQuoted,
+ Literal,
+
+ // bool manipulators
+ YesNoBool, // yes, no
+ TrueFalseBool, // true, false
+ OnOffBool, // on, off
+ UpperCase, // TRUE, N
+ LowerCase, // f, yes
+ CamelCase, // No, Off
+ LongBool, // yes, On
+ ShortBool, // y, t
+
+ // int manipulators
+ Dec,
+ Hex,
+ Oct,
+
+ // document manipulators
+ BeginDoc,
+ EndDoc,
+
+ // sequence manipulators
+ BeginSeq,
+ EndSeq,
+ Flow,
+ Block,
+
+ // map manipulators
+ BeginMap,
+ EndMap,
+ Key,
+ Value,
+ // Flow, // duplicate
+ // Block, // duplicate
+ // Auto, // duplicate
+ LongKey
+};
+
+struct _Indent {
+ _Indent(int value_) : value(value_) {}
+ int value;
+};
+
+inline _Indent Indent(int value) { return _Indent(value); }
+
+struct _Alias {
+ _Alias(const std::string& content_) : content(content_) {}
+ std::string content;
+};
+
+inline _Alias Alias(const std::string content) { return _Alias(content); }
+
+struct _Anchor {
+ _Anchor(const std::string& content_) : content(content_) {}
+ std::string content;
+};
+
+inline _Anchor Anchor(const std::string content) { return _Anchor(content); }
+
+struct _Tag {
+ struct Type {
+ enum value { Verbatim, PrimaryHandle, NamedHandle };
+ };
+
+ explicit _Tag(const std::string& prefix_, const std::string& content_,
+ Type::value type_)
+ : prefix(prefix_), content(content_), type(type_) {}
+ std::string prefix;
+ std::string content;
+ Type::value type;
+};
+
+inline _Tag VerbatimTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::Verbatim);
+}
+
+inline _Tag LocalTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::PrimaryHandle);
+}
+
+inline _Tag LocalTag(const std::string& prefix, const std::string content) {
+ return _Tag(prefix, content, _Tag::Type::NamedHandle);
+}
+
+inline _Tag SecondaryTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::NamedHandle);
+}
+
+struct _Comment {
+ _Comment(const std::string& content_) : content(content_) {}
+ std::string content;
+};
+
+inline _Comment Comment(const std::string content) { return _Comment(content); }
+
+struct _Precision {
+ _Precision(int floatPrecision_, int doublePrecision_)
+ : floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {}
+
+ int floatPrecision;
+ int doublePrecision;
+};
+
+inline _Precision FloatPrecision(int n) { return _Precision(n, -1); }
+
+inline _Precision DoublePrecision(int n) { return _Precision(-1, n); }
+
+inline _Precision Precision(int n) { return _Precision(n, n); }
+}
+
+#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/emitterstyle.h b/lib/yamlcpp/include/yaml-cpp/emitterstyle.h
new file mode 100644
index 0000000..67bb398
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/emitterstyle.h
@@ -0,0 +1,16 @@
+#ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+struct EmitterStyle {
+ enum value { Default, Block, Flow };
+};
+}
+
+#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/eventhandler.h b/lib/yamlcpp/include/yaml-cpp/eventhandler.h
new file mode 100644
index 0000000..efe381c
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/eventhandler.h
@@ -0,0 +1,40 @@
+#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+
+namespace YAML {
+struct Mark;
+
+class EventHandler {
+ public:
+ virtual ~EventHandler() {}
+
+ virtual void OnDocumentStart(const Mark& mark) = 0;
+ virtual void OnDocumentEnd() = 0;
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor) = 0;
+ virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0;
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value) = 0;
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) = 0;
+ virtual void OnSequenceEnd() = 0;
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) = 0;
+ virtual void OnMapEnd() = 0;
+};
+}
+
+#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/exceptions.h b/lib/yamlcpp/include/yaml-cpp/exceptions.h
new file mode 100644
index 0000000..9c96859
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/exceptions.h
@@ -0,0 +1,267 @@
+#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/traits.h"
+#include <sstream>
+#include <stdexcept>
+#include <string>
+
+// This is here for compatibility with older versions of Visual Studio
+// which don't support noexcept
+#ifdef _MSC_VER
+ #define YAML_CPP_NOEXCEPT _NOEXCEPT
+#else
+ #define YAML_CPP_NOEXCEPT noexcept
+#endif
+
+namespace YAML {
+// error messages
+namespace ErrorMsg {
+const char* const YAML_DIRECTIVE_ARGS =
+ "YAML directives must have exactly one argument";
+const char* const YAML_VERSION = "bad YAML version: ";
+const char* const YAML_MAJOR_VERSION = "YAML major version too large";
+const char* const REPEATED_YAML_DIRECTIVE = "repeated YAML directive";
+const char* const TAG_DIRECTIVE_ARGS =
+ "TAG directives must have exactly two arguments";
+const char* const REPEATED_TAG_DIRECTIVE = "repeated TAG directive";
+const char* const CHAR_IN_TAG_HANDLE =
+ "illegal character found while scanning tag handle";
+const char* const TAG_WITH_NO_SUFFIX = "tag handle with no suffix";
+const char* const END_OF_VERBATIM_TAG = "end of verbatim tag not found";
+const char* const END_OF_MAP = "end of map not found";
+const char* const END_OF_MAP_FLOW = "end of map flow not found";
+const char* const END_OF_SEQ = "end of sequence not found";
+const char* const END_OF_SEQ_FLOW = "end of sequence flow not found";
+const char* const MULTIPLE_TAGS =
+ "cannot assign multiple tags to the same node";
+const char* const MULTIPLE_ANCHORS =
+ "cannot assign multiple anchors to the same node";
+const char* const MULTIPLE_ALIASES =
+ "cannot assign multiple aliases to the same node";
+const char* const ALIAS_CONTENT =
+ "aliases can't have any content, *including* tags";
+const char* const INVALID_HEX = "bad character found while scanning hex number";
+const char* const INVALID_UNICODE = "invalid unicode: ";
+const char* const INVALID_ESCAPE = "unknown escape character: ";
+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 TAB_IN_INDENTATION =
+ "illegal tab when looking for indentation";
+const char* const FLOW_END = "illegal flow end";
+const char* const BLOCK_ENTRY = "illegal block entry";
+const char* const MAP_KEY = "illegal map key";
+const char* const MAP_VALUE = "illegal map value";
+const char* const ALIAS_NOT_FOUND = "alias not found after *";
+const char* const ANCHOR_NOT_FOUND = "anchor not found after &";
+const char* const CHAR_IN_ALIAS =
+ "illegal character found while scanning alias";
+const char* const CHAR_IN_ANCHOR =
+ "illegal character found while scanning anchor";
+const char* const ZERO_INDENT_IN_BLOCK =
+ "cannot set zero indentation for a block scalar";
+const char* const CHAR_IN_BLOCK = "unexpected character in block scalar";
+const char* const AMBIGUOUS_ANCHOR =
+ "cannot assign the same alias to multiple nodes";
+const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
+
+const char* const INVALID_NODE =
+ "invalid node; this may result from using a map iterator as a sequence "
+ "iterator, or vice-versa";
+const char* const INVALID_SCALAR = "invalid scalar";
+const char* const KEY_NOT_FOUND = "key not found";
+const char* const BAD_CONVERSION = "bad conversion";
+const char* const BAD_DEREFERENCE = "bad dereference";
+const char* const BAD_SUBSCRIPT = "operator[] call on a scalar";
+const char* const BAD_PUSHBACK = "appending to a non-sequence";
+const char* const BAD_INSERT = "inserting in a non-convertible-to-map";
+
+const char* const UNMATCHED_GROUP_TAG = "unmatched group tag";
+const char* const UNEXPECTED_END_SEQ = "unexpected end sequence token";
+const char* const UNEXPECTED_END_MAP = "unexpected end map token";
+const char* const SINGLE_QUOTED_CHAR =
+ "invalid character in single-quoted string";
+const char* const INVALID_ANCHOR = "invalid anchor";
+const char* const INVALID_ALIAS = "invalid alias";
+const char* const INVALID_TAG = "invalid tag";
+const char* const BAD_FILE = "bad file";
+
+template <typename T>
+inline const std::string KEY_NOT_FOUND_WITH_KEY(
+ const T&, typename disable_if<is_numeric<T>>::type* = 0) {
+ return KEY_NOT_FOUND;
+}
+
+inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+}
+
+template <typename T>
+inline const std::string KEY_NOT_FOUND_WITH_KEY(
+ const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+}
+}
+
+class YAML_CPP_API Exception : public std::runtime_error {
+ public:
+ Exception(const Mark& mark_, const std::string& msg_)
+ : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
+ virtual ~Exception() YAML_CPP_NOEXCEPT;
+
+ Exception(const Exception&) = default;
+
+ Mark mark;
+ std::string msg;
+
+ private:
+ static const std::string build_what(const Mark& mark,
+ const std::string& msg) {
+ if (mark.is_null()) {
+ return msg.c_str();
+ }
+
+ std::stringstream output;
+ output << "yaml-cpp: error at line " << mark.line + 1 << ", column "
+ << mark.column + 1 << ": " << msg;
+ return output.str();
+ }
+};
+
+class YAML_CPP_API ParserException : public Exception {
+ public:
+ ParserException(const Mark& mark_, const std::string& msg_)
+ : Exception(mark_, msg_) {}
+ ParserException(const ParserException&) = default;
+ virtual ~ParserException() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API RepresentationException : public Exception {
+ public:
+ RepresentationException(const Mark& mark_, const std::string& msg_)
+ : Exception(mark_, msg_) {}
+ RepresentationException(const RepresentationException&) = default;
+ virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
+};
+
+// representation exceptions
+class YAML_CPP_API InvalidScalar : public RepresentationException {
+ public:
+ InvalidScalar(const Mark& mark_)
+ : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
+ InvalidScalar(const InvalidScalar&) = default;
+ virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API KeyNotFound : public RepresentationException {
+ public:
+ template <typename T>
+ KeyNotFound(const Mark& mark_, const T& key_)
+ : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
+ }
+ KeyNotFound(const KeyNotFound&) = default;
+ virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
+};
+
+template <typename T>
+class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
+ public:
+ TypedKeyNotFound(const Mark& mark_, const T& key_)
+ : KeyNotFound(mark_, key_), key(key_) {}
+ virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
+
+ T key;
+};
+
+template <typename T>
+inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
+ const T& key) {
+ return TypedKeyNotFound<T>(mark, key);
+}
+
+class YAML_CPP_API InvalidNode : public RepresentationException {
+ public:
+ InvalidNode()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
+ InvalidNode(const InvalidNode&) = default;
+ virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadConversion : public RepresentationException {
+ public:
+ explicit BadConversion(const Mark& mark_)
+ : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
+ BadConversion(const BadConversion&) = default;
+ virtual ~BadConversion() YAML_CPP_NOEXCEPT;
+};
+
+template <typename T>
+class TypedBadConversion : public BadConversion {
+ public:
+ explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
+};
+
+class YAML_CPP_API BadDereference : public RepresentationException {
+ public:
+ BadDereference()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
+ BadDereference(const BadDereference&) = default;
+ virtual ~BadDereference() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadSubscript : public RepresentationException {
+ public:
+ BadSubscript()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
+ BadSubscript(const BadSubscript&) = default;
+ virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadPushback : public RepresentationException {
+ public:
+ BadPushback()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
+ BadPushback(const BadPushback&) = default;
+ virtual ~BadPushback() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadInsert : public RepresentationException {
+ public:
+ BadInsert()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
+ BadInsert(const BadInsert&) = default;
+ virtual ~BadInsert() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API EmitterException : public Exception {
+ public:
+ EmitterException(const std::string& msg_)
+ : Exception(Mark::null_mark(), msg_) {}
+ EmitterException(const EmitterException&) = default;
+ virtual ~EmitterException() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadFile : public Exception {
+ public:
+ BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
+ BadFile(const BadFile&) = default;
+ virtual ~BadFile() YAML_CPP_NOEXCEPT;
+};
+}
+
+#undef YAML_CPP_NOEXCEPT
+
+#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/mark.h b/lib/yamlcpp/include/yaml-cpp/mark.h
new file mode 100644
index 0000000..bf94b4f
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/mark.h
@@ -0,0 +1,29 @@
+#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+struct YAML_CPP_API Mark {
+ Mark() : pos(0), line(0), column(0) {}
+
+ static const Mark null_mark() { return Mark(-1, -1, -1); }
+
+ bool is_null() const { return pos == -1 && line == -1 && column == -1; }
+
+ int pos;
+ int line, column;
+
+ private:
+ Mark(int pos_, int line_, int column_)
+ : pos(pos_), line(line_), column(column_) {}
+};
+}
+
+#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/convert.h b/lib/yamlcpp/include/yaml-cpp/node/convert.h
new file mode 100644
index 0000000..45a878a
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/convert.h
@@ -0,0 +1,331 @@
+#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <array>
+#include <limits>
+#include <list>
+#include <map>
+#include <sstream>
+#include <vector>
+
+#include "yaml-cpp/binary.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+class Binary;
+struct _Null;
+template <typename T>
+struct convert;
+} // namespace YAML
+
+namespace YAML {
+namespace conversion {
+inline bool IsInfinity(const std::string& input) {
+ return input == ".inf" || input == ".Inf" || input == ".INF" ||
+ input == "+.inf" || input == "+.Inf" || input == "+.INF";
+}
+
+inline bool IsNegativeInfinity(const std::string& input) {
+ return input == "-.inf" || input == "-.Inf" || input == "-.INF";
+}
+
+inline bool IsNaN(const std::string& input) {
+ return input == ".nan" || input == ".NaN" || input == ".NAN";
+}
+}
+
+// Node
+template <>
+struct convert<Node> {
+ static Node encode(const Node& rhs) { return rhs; }
+
+ static bool decode(const Node& node, Node& rhs) {
+ rhs.reset(node);
+ return true;
+ }
+};
+
+// std::string
+template <>
+struct convert<std::string> {
+ static Node encode(const std::string& rhs) { return Node(rhs); }
+
+ static bool decode(const Node& node, std::string& rhs) {
+ if (!node.IsScalar())
+ return false;
+ rhs = node.Scalar();
+ return true;
+ }
+};
+
+// C-strings can only be encoded
+template <>
+struct convert<const char*> {
+ static Node encode(const char*& rhs) { return Node(rhs); }
+};
+
+template <std::size_t N>
+struct convert<const char[N]> {
+ static Node encode(const char(&rhs)[N]) { return Node(rhs); }
+};
+
+template <>
+struct convert<_Null> {
+ static Node encode(const _Null& /* rhs */) { return Node(); }
+
+ static bool decode(const Node& node, _Null& /* rhs */) {
+ return node.IsNull();
+ }
+};
+
+#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
+ template <> \
+ struct convert<type> { \
+ static Node encode(const type& rhs) { \
+ std::stringstream stream; \
+ stream.precision(std::numeric_limits<type>::digits10 + 1); \
+ stream << rhs; \
+ return Node(stream.str()); \
+ } \
+ \
+ static bool decode(const Node& node, type& rhs) { \
+ if (node.Type() != NodeType::Scalar) \
+ return false; \
+ const std::string& input = node.Scalar(); \
+ std::stringstream stream(input); \
+ stream.unsetf(std::ios::dec); \
+ if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \
+ return true; \
+ if (std::numeric_limits<type>::has_infinity) { \
+ if (conversion::IsInfinity(input)) { \
+ rhs = std::numeric_limits<type>::infinity(); \
+ return true; \
+ } else if (conversion::IsNegativeInfinity(input)) { \
+ rhs = negative_op std::numeric_limits<type>::infinity(); \
+ return true; \
+ } \
+ } \
+ \
+ if (std::numeric_limits<type>::has_quiet_NaN && \
+ conversion::IsNaN(input)) { \
+ rhs = std::numeric_limits<type>::quiet_NaN(); \
+ return true; \
+ } \
+ \
+ return false; \
+ } \
+ }
+
+#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \
+ YAML_DEFINE_CONVERT_STREAMABLE(type, -)
+
+#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type) \
+ YAML_DEFINE_CONVERT_STREAMABLE(type, +)
+
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long);
+
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(signed char);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char);
+
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double);
+
+#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED
+#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED
+#undef YAML_DEFINE_CONVERT_STREAMABLE
+
+// bool
+template <>
+struct convert<bool> {
+ static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); }
+
+ YAML_CPP_API static bool decode(const Node& node, bool& rhs);
+};
+
+// std::map
+template <typename K, typename V>
+struct convert<std::map<K, V>> {
+ static Node encode(const std::map<K, V>& rhs) {
+ Node node(NodeType::Map);
+ for (typename std::map<K, V>::const_iterator it = rhs.begin();
+ it != rhs.end(); ++it)
+ node.force_insert(it->first, it->second);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::map<K, V>& rhs) {
+ if (!node.IsMap())
+ return false;
+
+ rhs.clear();
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[it->first.template as<K>()] = it->second.template as<V>();
+#else
+ rhs[it->first.as<K>()] = it->second.as<V>();
+#endif
+ return true;
+ }
+};
+
+// std::vector
+template <typename T>
+struct convert<std::vector<T>> {
+ static Node encode(const std::vector<T>& rhs) {
+ Node node(NodeType::Sequence);
+ for (typename std::vector<T>::const_iterator it = rhs.begin();
+ it != rhs.end(); ++it)
+ node.push_back(*it);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::vector<T>& rhs) {
+ if (!node.IsSequence())
+ return false;
+
+ rhs.clear();
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.push_back(it->template as<T>());
+#else
+ rhs.push_back(it->as<T>());
+#endif
+ return true;
+ }
+};
+
+// std::list
+template <typename T>
+struct convert<std::list<T>> {
+ static Node encode(const std::list<T>& rhs) {
+ Node node(NodeType::Sequence);
+ for (typename std::list<T>::const_iterator it = rhs.begin();
+ it != rhs.end(); ++it)
+ node.push_back(*it);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::list<T>& rhs) {
+ if (!node.IsSequence())
+ return false;
+
+ rhs.clear();
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.push_back(it->template as<T>());
+#else
+ rhs.push_back(it->as<T>());
+#endif
+ return true;
+ }
+};
+
+// std::array
+template <typename T, std::size_t N>
+struct convert<std::array<T, N>> {
+ static Node encode(const std::array<T, N>& rhs) {
+ Node node(NodeType::Sequence);
+ for (const auto& element : rhs) {
+ node.push_back(element);
+ }
+ return node;
+ }
+
+ static bool decode(const Node& node, std::array<T, N>& rhs) {
+ if (!isNodeValid(node)) {
+ return false;
+ }
+
+ for (auto i = 0u; i < node.size(); ++i) {
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[i] = node[i].template as<T>();
+#else
+ rhs[i] = node[i].as<T>();
+#endif
+ }
+ return true;
+ }
+
+ private:
+ static bool isNodeValid(const Node& node) {
+ return node.IsSequence() && node.size() == N;
+ }
+};
+
+// std::pair
+template <typename T, typename U>
+struct convert<std::pair<T, U>> {
+ static Node encode(const std::pair<T, U>& rhs) {
+ Node node(NodeType::Sequence);
+ node.push_back(rhs.first);
+ node.push_back(rhs.second);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::pair<T, U>& rhs) {
+ if (!node.IsSequence())
+ return false;
+ if (node.size() != 2)
+ return false;
+
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.first = node[0].template as<T>();
+#else
+ rhs.first = node[0].as<T>();
+#endif
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.second = node[1].template as<U>();
+#else
+ rhs.second = node[1].as<U>();
+#endif
+ return true;
+ }
+};
+
+// binary
+template <>
+struct convert<Binary> {
+ static Node encode(const Binary& rhs) {
+ return Node(EncodeBase64(rhs.data(), rhs.size()));
+ }
+
+ static bool decode(const Node& node, Binary& rhs) {
+ if (!node.IsScalar())
+ return false;
+
+ std::vector<unsigned char> data = DecodeBase64(node.Scalar());
+ if (data.empty() && !node.Scalar().empty())
+ return false;
+
+ rhs.swap(data);
+ return true;
+ }
+};
+}
+
+#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h b/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h
new file mode 100644
index 0000000..2c80705
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h
@@ -0,0 +1,26 @@
+#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+namespace detail {
+struct unspecified_bool {
+ struct NOT_ALLOWED;
+ static void true_value(NOT_ALLOWED*) {}
+};
+typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*);
+}
+}
+
+#define YAML_CPP_OPERATOR_BOOL() \
+ operator YAML::detail::unspecified_bool_type() const { \
+ return this->operator!() ? 0 \
+ : &YAML::detail::unspecified_bool::true_value; \
+ }
+
+#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h b/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h
new file mode 100644
index 0000000..09e55f8
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h
@@ -0,0 +1,185 @@
+#ifndef NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/detail/node_data.h"
+#include <type_traits>
+
+namespace YAML {
+namespace detail {
+template <typename Key, typename Enable = void>
+struct get_idx {
+ static node* get(const std::vector<node*>& /* sequence */,
+ const Key& /* key */, shared_memory_holder /* pMemory */) {
+ return 0;
+ }
+};
+
+template <typename Key>
+struct get_idx<Key,
+ typename std::enable_if<std::is_unsigned<Key>::value &&
+ !std::is_same<Key, bool>::value>::type> {
+ static node* get(const std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder /* pMemory */) {
+ return key < sequence.size() ? sequence[key] : 0;
+ }
+
+ static node* get(std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder pMemory) {
+ if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
+ return 0;
+ if (key == sequence.size())
+ sequence.push_back(&pMemory->create_node());
+ return sequence[key];
+ }
+};
+
+template <typename Key>
+struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
+ static node* get(const std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder pMemory) {
+ return key >= 0 ? get_idx<std::size_t>::get(
+ sequence, static_cast<std::size_t>(key), pMemory)
+ : 0;
+ }
+ static node* get(std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder pMemory) {
+ return key >= 0 ? get_idx<std::size_t>::get(
+ sequence, static_cast<std::size_t>(key), pMemory)
+ : 0;
+ }
+};
+
+template <typename T>
+inline bool node::equals(const T& rhs, shared_memory_holder pMemory) {
+ T lhs;
+ if (convert<T>::decode(Node(*this, pMemory), lhs)) {
+ return lhs == rhs;
+ }
+ return false;
+}
+
+inline bool node::equals(const char* rhs, shared_memory_holder pMemory) {
+ return equals<std::string>(rhs, pMemory);
+}
+
+// indexing
+template <typename Key>
+inline node* node_data::get(const Key& key,
+ shared_memory_holder pMemory) const {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ return NULL;
+ case NodeType::Sequence:
+ if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory))
+ return pNode;
+ return NULL;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->equals(key, pMemory)) {
+ return it->second;
+ }
+ }
+
+ return NULL;
+}
+
+template <typename Key>
+inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory)) {
+ m_type = NodeType::Sequence;
+ return *pNode;
+ }
+
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->equals(key, pMemory)) {
+ return *it->second;
+ }
+ }
+
+ node& k = convert_to_node(key, pMemory);
+ node& v = pMemory->create_node();
+ insert_map_pair(k, v);
+ return v;
+}
+
+template <typename Key>
+inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
+ if (m_type != NodeType::Map)
+ return false;
+
+ for (kv_pairs::iterator it = m_undefinedPairs.begin();
+ it != m_undefinedPairs.end();) {
+ kv_pairs::iterator jt = std::next(it);
+ if (it->first->equals(key, pMemory))
+ m_undefinedPairs.erase(it);
+ it = jt;
+ }
+
+ for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->equals(key, pMemory)) {
+ m_map.erase(it);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// map
+template <typename Key, typename Value>
+inline void node_data::force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadInsert();
+ }
+
+ node& k = convert_to_node(key, pMemory);
+ node& v = convert_to_node(value, pMemory);
+ insert_map_pair(k, v);
+}
+
+template <typename T>
+inline node& node_data::convert_to_node(const T& rhs,
+ shared_memory_holder pMemory) {
+ Node value = convert<T>::encode(rhs);
+ value.EnsureNodeExists();
+ pMemory->merge(*value.m_pMemory);
+ return *value.m_pNode;
+}
+}
+}
+
+#endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h
new file mode 100644
index 0000000..deec8fb
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h
@@ -0,0 +1,92 @@
+#ifndef VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include <cstddef>
+#include <iterator>
+
+namespace YAML {
+namespace detail {
+struct iterator_value;
+
+template <typename V>
+class iterator_base : public std::iterator<std::forward_iterator_tag, V,
+ std::ptrdiff_t, V*, V> {
+
+ private:
+ template <typename>
+ friend class iterator_base;
+ struct enabler {};
+ typedef node_iterator base_type;
+
+ struct proxy {
+ explicit proxy(const V& x) : m_ref(x) {}
+ V* operator->() { return std::addressof(m_ref); }
+ operator V*() { return std::addressof(m_ref); }
+
+ V m_ref;
+ };
+
+ public:
+ typedef typename iterator_base::value_type value_type;
+
+ public:
+ iterator_base() : m_iterator(), m_pMemory() {}
+ explicit iterator_base(base_type rhs, shared_memory_holder pMemory)
+ : m_iterator(rhs), m_pMemory(pMemory) {}
+
+ template <class W>
+ iterator_base(const iterator_base<W>& rhs,
+ typename std::enable_if<std::is_convertible<W*, V*>::value,
+ enabler>::type = enabler())
+ : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
+
+ iterator_base<V>& operator++() {
+ ++m_iterator;
+ return *this;
+ }
+
+ iterator_base<V> operator++(int) {
+ iterator_base<V> iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
+
+ template <typename W>
+ bool operator==(const iterator_base<W>& rhs) const {
+ return m_iterator == rhs.m_iterator;
+ }
+
+ template <typename W>
+ bool operator!=(const iterator_base<W>& rhs) const {
+ return m_iterator != rhs.m_iterator;
+ }
+
+ value_type operator*() const {
+ const typename base_type::value_type& v = *m_iterator;
+ if (v.pNode)
+ return value_type(Node(*v, m_pMemory));
+ if (v.first && v.second)
+ return value_type(Node(*v.first, m_pMemory), Node(*v.second, m_pMemory));
+ return value_type();
+ }
+
+ proxy operator->() const { return proxy(**this); }
+
+ private:
+ base_type m_iterator;
+ shared_memory_holder m_pMemory;
+};
+}
+}
+
+#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h
new file mode 100644
index 0000000..5f1ffe7
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h
@@ -0,0 +1,27 @@
+#ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <list>
+#include <utility>
+#include <vector>
+
+namespace YAML {
+
+namespace detail {
+struct iterator_value;
+template <typename V>
+class iterator_base;
+}
+
+typedef detail::iterator_base<detail::iterator_value> iterator;
+typedef detail::iterator_base<const detail::iterator_value> const_iterator;
+}
+
+#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h b/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h
new file mode 100644
index 0000000..8f2bc26
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h
@@ -0,0 +1,46 @@
+#ifndef VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <set>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+namespace detail {
+class YAML_CPP_API memory {
+ public:
+ node& create_node();
+ void merge(const memory& rhs);
+
+ private:
+ typedef std::set<shared_node> Nodes;
+ Nodes m_nodes;
+};
+
+class YAML_CPP_API memory_holder {
+ public:
+ memory_holder() : m_pMemory(new memory) {}
+
+ node& create_node() { return m_pMemory->create_node(); }
+ void merge(memory_holder& rhs);
+
+ private:
+ shared_memory m_pMemory;
+};
+}
+}
+
+#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
new file mode 100644
index 0000000..8a776f6
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
@@ -0,0 +1,169 @@
+#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/type.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/detail/node_ref.h"
+#include <set>
+
+namespace YAML {
+namespace detail {
+class node {
+ public:
+ node() : m_pRef(new node_ref) {}
+ node(const node&) = delete;
+ node& operator=(const node&) = delete;
+
+ bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
+ const node_ref* ref() const { return m_pRef.get(); }
+
+ bool is_defined() const { return m_pRef->is_defined(); }
+ const Mark& mark() const { return m_pRef->mark(); }
+ NodeType::value type() const { return m_pRef->type(); }
+
+ const std::string& scalar() const { return m_pRef->scalar(); }
+ const std::string& tag() const { return m_pRef->tag(); }
+ EmitterStyle::value style() const { return m_pRef->style(); }
+
+ template <typename T>
+ bool equals(const T& rhs, shared_memory_holder pMemory);
+ bool equals(const char* rhs, shared_memory_holder pMemory);
+
+ void mark_defined() {
+ if (is_defined())
+ return;
+
+ m_pRef->mark_defined();
+ for (nodes::iterator it = m_dependencies.begin();
+ it != m_dependencies.end(); ++it)
+ (*it)->mark_defined();
+ m_dependencies.clear();
+ }
+
+ void add_dependency(node& rhs) {
+ if (is_defined())
+ rhs.mark_defined();
+ else
+ m_dependencies.insert(&rhs);
+ }
+
+ void set_ref(const node& rhs) {
+ if (rhs.is_defined())
+ mark_defined();
+ m_pRef = rhs.m_pRef;
+ }
+ void set_data(const node& rhs) {
+ if (rhs.is_defined())
+ mark_defined();
+ m_pRef->set_data(*rhs.m_pRef);
+ }
+
+ void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
+
+ void set_type(NodeType::value type) {
+ if (type != NodeType::Undefined)
+ mark_defined();
+ m_pRef->set_type(type);
+ }
+ void set_null() {
+ mark_defined();
+ m_pRef->set_null();
+ }
+ void set_scalar(const std::string& scalar) {
+ mark_defined();
+ m_pRef->set_scalar(scalar);
+ }
+ void set_tag(const std::string& tag) {
+ mark_defined();
+ m_pRef->set_tag(tag);
+ }
+
+ // style
+ void set_style(EmitterStyle::value style) {
+ mark_defined();
+ m_pRef->set_style(style);
+ }
+
+ // size/iterator
+ std::size_t size() const { return m_pRef->size(); }
+
+ const_node_iterator begin() const {
+ return static_cast<const node_ref&>(*m_pRef).begin();
+ }
+ node_iterator begin() { return m_pRef->begin(); }
+
+ const_node_iterator end() const {
+ return static_cast<const node_ref&>(*m_pRef).end();
+ }
+ node_iterator end() { return m_pRef->end(); }
+
+ // sequence
+ void push_back(node& input, shared_memory_holder pMemory) {
+ m_pRef->push_back(input, pMemory);
+ input.add_dependency(*this);
+ }
+ void insert(node& key, node& value, shared_memory_holder pMemory) {
+ m_pRef->insert(key, value, pMemory);
+ key.add_dependency(*this);
+ value.add_dependency(*this);
+ }
+
+ // indexing
+ template <typename Key>
+ node* get(const Key& key, shared_memory_holder pMemory) const {
+ // NOTE: this returns a non-const node so that the top-level Node can wrap
+ // it, and returns a pointer so that it can be NULL (if there is no such
+ // key).
+ return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
+ }
+ template <typename Key>
+ node& get(const Key& key, shared_memory_holder pMemory) {
+ node& value = m_pRef->get(key, pMemory);
+ value.add_dependency(*this);
+ return value;
+ }
+ template <typename Key>
+ bool remove(const Key& key, shared_memory_holder pMemory) {
+ return m_pRef->remove(key, pMemory);
+ }
+
+ node* get(node& key, shared_memory_holder pMemory) const {
+ // NOTE: this returns a non-const node so that the top-level Node can wrap
+ // it, and returns a pointer so that it can be NULL (if there is no such
+ // key).
+ return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
+ }
+ node& get(node& key, shared_memory_holder pMemory) {
+ node& value = m_pRef->get(key, pMemory);
+ key.add_dependency(*this);
+ value.add_dependency(*this);
+ return value;
+ }
+ bool remove(node& key, shared_memory_holder pMemory) {
+ return m_pRef->remove(key, pMemory);
+ }
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory) {
+ m_pRef->force_insert(key, value, pMemory);
+ }
+
+ private:
+ shared_node_ref m_pRef;
+ typedef std::set<node*> nodes;
+ nodes m_dependencies;
+};
+}
+}
+
+#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h
new file mode 100644
index 0000000..50bcd74
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h
@@ -0,0 +1,127 @@
+#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <list>
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+namespace detail {
+class YAML_CPP_API node_data {
+ public:
+ node_data();
+ node_data(const node_data&) = delete;
+ node_data& operator=(const node_data&) = delete;
+
+ void mark_defined();
+ void set_mark(const Mark& mark);
+ void set_type(NodeType::value type);
+ void set_tag(const std::string& tag);
+ void set_null();
+ void set_scalar(const std::string& scalar);
+ void set_style(EmitterStyle::value style);
+
+ bool is_defined() const { return m_isDefined; }
+ const Mark& mark() const { return m_mark; }
+ NodeType::value type() const {
+ return m_isDefined ? m_type : NodeType::Undefined;
+ }
+ const std::string& scalar() const { return m_scalar; }
+ const std::string& tag() const { return m_tag; }
+ EmitterStyle::value style() const { return m_style; }
+
+ // size/iterator
+ std::size_t size() const;
+
+ const_node_iterator begin() const;
+ node_iterator begin();
+
+ const_node_iterator end() const;
+ node_iterator end();
+
+ // sequence
+ void push_back(node& node, shared_memory_holder pMemory);
+ void insert(node& key, node& value, shared_memory_holder pMemory);
+
+ // indexing
+ template <typename Key>
+ node* get(const Key& key, shared_memory_holder pMemory) const;
+ template <typename Key>
+ node& get(const Key& key, shared_memory_holder pMemory);
+ template <typename Key>
+ bool remove(const Key& key, shared_memory_holder pMemory);
+
+ node* get(node& key, shared_memory_holder pMemory) const;
+ node& get(node& key, shared_memory_holder pMemory);
+ bool remove(node& key, shared_memory_holder pMemory);
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory);
+
+ public:
+ static std::string empty_scalar;
+
+ private:
+ void compute_seq_size() const;
+ void compute_map_size() const;
+
+ void reset_sequence();
+ void reset_map();
+
+ void insert_map_pair(node& key, node& value);
+ void convert_to_map(shared_memory_holder pMemory);
+ void convert_sequence_to_map(shared_memory_holder pMemory);
+
+ template <typename T>
+ static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
+
+ private:
+ bool m_isDefined;
+ Mark m_mark;
+ NodeType::value m_type;
+ std::string m_tag;
+ EmitterStyle::value m_style;
+
+ // scalar
+ std::string m_scalar;
+
+ // sequence
+ typedef std::vector<node*> node_seq;
+ node_seq m_sequence;
+
+ mutable std::size_t m_seqSize;
+
+ // map
+ typedef std::vector<std::pair<node*, node*>> node_map;
+ node_map m_map;
+
+ typedef std::pair<node*, node*> kv_pair;
+ typedef std::list<kv_pair> kv_pairs;
+ mutable kv_pairs m_undefinedPairs;
+};
+}
+}
+
+#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h
new file mode 100644
index 0000000..088090f
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h
@@ -0,0 +1,180 @@
+#ifndef VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/ptr.h"
+#include <cstddef>
+#include <iterator>
+#include <memory>
+#include <map>
+#include <utility>
+#include <vector>
+
+namespace YAML {
+namespace detail {
+struct iterator_type {
+ enum value { NoneType, Sequence, Map };
+};
+
+template <typename V>
+struct node_iterator_value : public std::pair<V*, V*> {
+ typedef std::pair<V*, V*> kv;
+
+ node_iterator_value() : kv(), pNode(0) {}
+ explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {}
+ explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {}
+
+ V& operator*() const { return *pNode; }
+ V& operator->() const { return *pNode; }
+
+ V* pNode;
+};
+
+typedef std::vector<node*> node_seq;
+typedef std::vector<std::pair<node*, node*>> node_map;
+
+template <typename V>
+struct node_iterator_type {
+ typedef node_seq::iterator seq;
+ typedef node_map::iterator map;
+};
+
+template <typename V>
+struct node_iterator_type<const V> {
+ typedef node_seq::const_iterator seq;
+ typedef node_map::const_iterator map;
+};
+
+template <typename V>
+class node_iterator_base
+ : public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
+ std::ptrdiff_t, node_iterator_value<V>*,
+ node_iterator_value<V>> {
+ private:
+ struct enabler {};
+
+ struct proxy {
+ explicit proxy(const node_iterator_value<V>& x) : m_ref(x) {}
+ node_iterator_value<V>* operator->() { return std::addressof(m_ref); }
+ operator node_iterator_value<V>*() { return std::addressof(m_ref); }
+
+ node_iterator_value<V> m_ref;
+ };
+
+ public:
+ typedef typename node_iterator_type<V>::seq SeqIter;
+ typedef typename node_iterator_type<V>::map MapIter;
+ typedef node_iterator_value<V> value_type;
+
+ node_iterator_base()
+ : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
+ explicit node_iterator_base(SeqIter seqIt)
+ : m_type(iterator_type::Sequence),
+ m_seqIt(seqIt),
+ m_mapIt(),
+ m_mapEnd() {}
+ explicit node_iterator_base(MapIter mapIt, MapIter mapEnd)
+ : m_type(iterator_type::Map),
+ m_seqIt(),
+ m_mapIt(mapIt),
+ m_mapEnd(mapEnd) {
+ m_mapIt = increment_until_defined(m_mapIt);
+ }
+
+ template <typename W>
+ node_iterator_base(const node_iterator_base<W>& rhs,
+ typename std::enable_if<std::is_convertible<W*, V*>::value,
+ enabler>::type = enabler())
+ : m_type(rhs.m_type),
+ m_seqIt(rhs.m_seqIt),
+ m_mapIt(rhs.m_mapIt),
+ m_mapEnd(rhs.m_mapEnd) {}
+
+ template <typename>
+ friend class node_iterator_base;
+
+ template <typename W>
+ bool operator==(const node_iterator_base<W>& rhs) const {
+ if (m_type != rhs.m_type)
+ return false;
+
+ switch (m_type) {
+ case iterator_type::NoneType:
+ return true;
+ case iterator_type::Sequence:
+ return m_seqIt == rhs.m_seqIt;
+ case iterator_type::Map:
+ return m_mapIt == rhs.m_mapIt;
+ }
+ return true;
+ }
+
+ template <typename W>
+ bool operator!=(const node_iterator_base<W>& rhs) const {
+ return !(*this == rhs);
+ }
+
+ node_iterator_base<V>& operator++() {
+ switch (m_type) {
+ case iterator_type::NoneType:
+ break;
+ case iterator_type::Sequence:
+ ++m_seqIt;
+ break;
+ case iterator_type::Map:
+ ++m_mapIt;
+ m_mapIt = increment_until_defined(m_mapIt);
+ break;
+ }
+ return *this;
+ }
+
+ node_iterator_base<V> operator++(int) {
+ node_iterator_base<V> iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
+
+ value_type operator*() const {
+ switch (m_type) {
+ case iterator_type::NoneType:
+ return value_type();
+ case iterator_type::Sequence:
+ return value_type(**m_seqIt);
+ case iterator_type::Map:
+ return value_type(*m_mapIt->first, *m_mapIt->second);
+ }
+ return value_type();
+ }
+
+ proxy operator->() const { return proxy(**this); }
+
+ MapIter increment_until_defined(MapIter it) {
+ while (it != m_mapEnd && !is_defined(it))
+ ++it;
+ return it;
+ }
+
+ bool is_defined(MapIter it) const {
+ return it->first->is_defined() && it->second->is_defined();
+ }
+
+ private:
+ typename iterator_type::value m_type;
+
+ SeqIter m_seqIt;
+ MapIter m_mapIt, m_mapEnd;
+};
+
+typedef node_iterator_base<node> node_iterator;
+typedef node_iterator_base<const node> const_node_iterator;
+}
+}
+
+#endif // VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h
new file mode 100644
index 0000000..d8a94f8
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h
@@ -0,0 +1,98 @@
+#ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/type.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/detail/node_data.h"
+
+namespace YAML {
+namespace detail {
+class node_ref {
+ public:
+ node_ref() : m_pData(new node_data) {}
+ node_ref(const node_ref&) = delete;
+ node_ref& operator=(const node_ref&) = delete;
+
+ bool is_defined() const { return m_pData->is_defined(); }
+ const Mark& mark() const { return m_pData->mark(); }
+ NodeType::value type() const { return m_pData->type(); }
+ const std::string& scalar() const { return m_pData->scalar(); }
+ const std::string& tag() const { return m_pData->tag(); }
+ EmitterStyle::value style() const { return m_pData->style(); }
+
+ void mark_defined() { m_pData->mark_defined(); }
+ void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; }
+
+ void set_mark(const Mark& mark) { m_pData->set_mark(mark); }
+ void set_type(NodeType::value type) { m_pData->set_type(type); }
+ void set_tag(const std::string& tag) { m_pData->set_tag(tag); }
+ void set_null() { m_pData->set_null(); }
+ void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); }
+ void set_style(EmitterStyle::value style) { m_pData->set_style(style); }
+
+ // size/iterator
+ std::size_t size() const { return m_pData->size(); }
+
+ const_node_iterator begin() const {
+ return static_cast<const node_data&>(*m_pData).begin();
+ }
+ node_iterator begin() { return m_pData->begin(); }
+
+ const_node_iterator end() const {
+ return static_cast<const node_data&>(*m_pData).end();
+ }
+ node_iterator end() { return m_pData->end(); }
+
+ // sequence
+ void push_back(node& node, shared_memory_holder pMemory) {
+ m_pData->push_back(node, pMemory);
+ }
+ void insert(node& key, node& value, shared_memory_holder pMemory) {
+ m_pData->insert(key, value, pMemory);
+ }
+
+ // indexing
+ template <typename Key>
+ node* get(const Key& key, shared_memory_holder pMemory) const {
+ return static_cast<const node_data&>(*m_pData).get(key, pMemory);
+ }
+ template <typename Key>
+ node& get(const Key& key, shared_memory_holder pMemory) {
+ return m_pData->get(key, pMemory);
+ }
+ template <typename Key>
+ bool remove(const Key& key, shared_memory_holder pMemory) {
+ return m_pData->remove(key, pMemory);
+ }
+
+ node* get(node& key, shared_memory_holder pMemory) const {
+ return static_cast<const node_data&>(*m_pData).get(key, pMemory);
+ }
+ node& get(node& key, shared_memory_holder pMemory) {
+ return m_pData->get(key, pMemory);
+ }
+ bool remove(node& key, shared_memory_holder pMemory) {
+ return m_pData->remove(key, pMemory);
+ }
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory) {
+ m_pData->force_insert(key, value, pMemory);
+ }
+
+ private:
+ shared_node_data m_pData;
+};
+}
+}
+
+#endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/emit.h b/lib/yamlcpp/include/yaml-cpp/node/emit.h
new file mode 100644
index 0000000..032268c
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/emit.h
@@ -0,0 +1,32 @@
+#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <iosfwd>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class Emitter;
+class Node;
+
+/**
+ * Emits the node to the given {@link Emitter}. If there is an error in writing,
+ * {@link Emitter#good} will return false.
+ */
+YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node);
+
+/** Emits the node to the given output stream. */
+YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node);
+
+/** Converts the node to a YAML string. */
+YAML_CPP_API std::string Dump(const Node& node);
+} // namespace YAML
+
+#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/impl.h b/lib/yamlcpp/include/yaml-cpp/node/impl.h
new file mode 100644
index 0000000..20c487a
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/impl.h
@@ -0,0 +1,448 @@
+#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/exceptions.h"
+#include <string>
+
+namespace YAML {
+inline Node::Node() : m_isValid(true), m_pNode(NULL) {}
+
+inline Node::Node(NodeType::value type)
+ : m_isValid(true),
+ m_pMemory(new detail::memory_holder),
+ m_pNode(&m_pMemory->create_node()) {
+ m_pNode->set_type(type);
+}
+
+template <typename T>
+inline Node::Node(const T& rhs)
+ : m_isValid(true),
+ m_pMemory(new detail::memory_holder),
+ m_pNode(&m_pMemory->create_node()) {
+ Assign(rhs);
+}
+
+inline Node::Node(const detail::iterator_value& rhs)
+ : m_isValid(rhs.m_isValid),
+ m_pMemory(rhs.m_pMemory),
+ m_pNode(rhs.m_pNode) {}
+
+inline Node::Node(const Node& rhs)
+ : m_isValid(rhs.m_isValid),
+ m_pMemory(rhs.m_pMemory),
+ m_pNode(rhs.m_pNode) {}
+
+inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {}
+
+inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
+ : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {}
+
+inline Node::~Node() {}
+
+inline void Node::EnsureNodeExists() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ if (!m_pNode) {
+ m_pMemory.reset(new detail::memory_holder);
+ m_pNode = &m_pMemory->create_node();
+ m_pNode->set_null();
+ }
+}
+
+inline bool Node::IsDefined() const {
+ if (!m_isValid) {
+ return false;
+ }
+ return m_pNode ? m_pNode->is_defined() : true;
+}
+
+inline Mark Node::Mark() const {
+ if (!m_isValid) {
+ throw InvalidNode();
+ }
+ return m_pNode ? m_pNode->mark() : Mark::null_mark();
+}
+
+inline NodeType::value Node::Type() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->type() : NodeType::Null;
+}
+
+// access
+
+// template helpers
+template <typename T, typename S>
+struct as_if {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ T operator()(const S& fallback) const {
+ if (!node.m_pNode)
+ return fallback;
+
+ T t;
+ if (convert<T>::decode(node, t))
+ return t;
+ return fallback;
+ }
+};
+
+template <typename S>
+struct as_if<std::string, S> {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ std::string operator()(const S& fallback) const {
+ if (node.Type() != NodeType::Scalar)
+ return fallback;
+ return node.Scalar();
+ }
+};
+
+template <typename T>
+struct as_if<T, void> {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ T operator()() const {
+ if (!node.m_pNode)
+ throw TypedBadConversion<T>(node.Mark());
+
+ T t;
+ if (convert<T>::decode(node, t))
+ return t;
+ throw TypedBadConversion<T>(node.Mark());
+ }
+};
+
+template <>
+struct as_if<std::string, void> {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ std::string operator()() const {
+ if (node.Type() != NodeType::Scalar)
+ throw TypedBadConversion<std::string>(node.Mark());
+ return node.Scalar();
+ }
+};
+
+// access functions
+template <typename T>
+inline T Node::as() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return as_if<T, void>(*this)();
+}
+
+template <typename T, typename S>
+inline T Node::as(const S& fallback) const {
+ if (!m_isValid)
+ return fallback;
+ return as_if<T, S>(*this)(fallback);
+}
+
+inline const std::string& Node::Scalar() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
+}
+
+inline const std::string& Node::Tag() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
+}
+
+inline void Node::SetTag(const std::string& tag) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_tag(tag);
+}
+
+inline EmitterStyle::value Node::Style() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->style() : EmitterStyle::Default;
+}
+
+inline void Node::SetStyle(EmitterStyle::value style) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_style(style);
+}
+
+// assignment
+inline bool Node::is(const Node& rhs) const {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ if (!m_pNode || !rhs.m_pNode)
+ return false;
+ return m_pNode->is(*rhs.m_pNode);
+}
+
+template <typename T>
+inline Node& Node::operator=(const T& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ Assign(rhs);
+ return *this;
+}
+
+inline void Node::reset(const YAML::Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ m_pMemory = rhs.m_pMemory;
+ m_pNode = rhs.m_pNode;
+}
+
+template <typename T>
+inline void Node::Assign(const T& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ AssignData(convert<T>::encode(rhs));
+}
+
+template <>
+inline void Node::Assign(const std::string& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_scalar(rhs);
+}
+
+inline void Node::Assign(const char* rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_scalar(rhs);
+}
+
+inline void Node::Assign(char* rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_scalar(rhs);
+}
+
+inline Node& Node::operator=(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ if (is(rhs))
+ return *this;
+ AssignNode(rhs);
+ return *this;
+}
+
+inline void Node::AssignData(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ rhs.EnsureNodeExists();
+
+ m_pNode->set_data(*rhs.m_pNode);
+ m_pMemory->merge(*rhs.m_pMemory);
+}
+
+inline void Node::AssignNode(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ rhs.EnsureNodeExists();
+
+ if (!m_pNode) {
+ m_pNode = rhs.m_pNode;
+ m_pMemory = rhs.m_pMemory;
+ return;
+ }
+
+ m_pNode->set_ref(*rhs.m_pNode);
+ m_pMemory->merge(*rhs.m_pMemory);
+ m_pNode = rhs.m_pNode;
+}
+
+// size/iterator
+inline std::size_t Node::size() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->size() : 0;
+}
+
+inline const_iterator Node::begin() const {
+ if (!m_isValid)
+ return const_iterator();
+ return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory)
+ : const_iterator();
+}
+
+inline iterator Node::begin() {
+ if (!m_isValid)
+ return iterator();
+ return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator();
+}
+
+inline const_iterator Node::end() const {
+ if (!m_isValid)
+ return const_iterator();
+ return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator();
+}
+
+inline iterator Node::end() {
+ if (!m_isValid)
+ return iterator();
+ return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator();
+}
+
+// sequence
+template <typename T>
+inline void Node::push_back(const T& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ push_back(Node(rhs));
+}
+
+inline void Node::push_back(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ rhs.EnsureNodeExists();
+
+ m_pNode->push_back(*rhs.m_pNode, m_pMemory);
+ m_pMemory->merge(*rhs.m_pMemory);
+}
+
+// helpers for indexing
+namespace detail {
+template <typename T>
+struct to_value_t {
+ explicit to_value_t(const T& t_) : t(t_) {}
+ const T& t;
+ typedef const T& return_type;
+
+ const T& operator()() const { return t; }
+};
+
+template <>
+struct to_value_t<const char*> {
+ explicit to_value_t(const char* t_) : t(t_) {}
+ const char* t;
+ typedef std::string return_type;
+
+ const std::string operator()() const { return t; }
+};
+
+template <>
+struct to_value_t<char*> {
+ explicit to_value_t(char* t_) : t(t_) {}
+ const char* t;
+ typedef std::string return_type;
+
+ const std::string operator()() const { return t; }
+};
+
+template <std::size_t N>
+struct to_value_t<char[N]> {
+ explicit to_value_t(const char* t_) : t(t_) {}
+ const char* t;
+ typedef std::string return_type;
+
+ const std::string operator()() const { return t; }
+};
+
+// converts C-strings to std::strings so they can be copied
+template <typename T>
+inline typename to_value_t<T>::return_type to_value(const T& t) {
+ return to_value_t<T>(t)();
+}
+}
+
+// indexing
+template <typename Key>
+inline const Node Node::operator[](const Key& key) const {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ detail::node* value = static_cast<const detail::node&>(*m_pNode)
+ .get(detail::to_value(key), m_pMemory);
+ if (!value) {
+ return Node(ZombieNode);
+ }
+ return Node(*value, m_pMemory);
+}
+
+template <typename Key>
+inline Node Node::operator[](const Key& key) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
+ return Node(value, m_pMemory);
+}
+
+template <typename Key>
+inline bool Node::remove(const Key& key) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ return m_pNode->remove(detail::to_value(key), m_pMemory);
+}
+
+inline const Node Node::operator[](const Node& key) const {
+ if (!m_isValid || !key.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ key.EnsureNodeExists();
+ m_pMemory->merge(*key.m_pMemory);
+ detail::node* value =
+ static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
+ if (!value) {
+ return Node(ZombieNode);
+ }
+ return Node(*value, m_pMemory);
+}
+
+inline Node Node::operator[](const Node& key) {
+ if (!m_isValid || !key.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ key.EnsureNodeExists();
+ m_pMemory->merge(*key.m_pMemory);
+ detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
+ return Node(value, m_pMemory);
+}
+
+inline bool Node::remove(const Node& key) {
+ if (!m_isValid || !key.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ key.EnsureNodeExists();
+ return m_pNode->remove(*key.m_pNode, m_pMemory);
+}
+
+// map
+template <typename Key, typename Value>
+inline void Node::force_insert(const Key& key, const Value& value) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->force_insert(detail::to_value(key), detail::to_value(value),
+ m_pMemory);
+}
+
+// free functions
+inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
+}
+
+#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/iterator.h b/lib/yamlcpp/include/yaml-cpp/node/iterator.h
new file mode 100644
index 0000000..366a9c8
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/iterator.h
@@ -0,0 +1,31 @@
+#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/detail/iterator_fwd.h"
+#include "yaml-cpp/node/detail/iterator.h"
+#include <list>
+#include <utility>
+#include <vector>
+
+namespace YAML {
+namespace detail {
+struct iterator_value : public Node, std::pair<Node, Node> {
+ iterator_value() {}
+ explicit iterator_value(const Node& rhs)
+ : Node(rhs),
+ std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
+ explicit iterator_value(const Node& key, const Node& value)
+ : Node(Node::ZombieNode), std::pair<Node, Node>(key, value) {}
+};
+}
+}
+
+#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/node.h b/lib/yamlcpp/include/yaml-cpp/node/node.h
new file mode 100644
index 0000000..1ded7d2
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/node.h
@@ -0,0 +1,145 @@
+#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <stdexcept>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/node/detail/bool_type.h"
+#include "yaml-cpp/node/detail/iterator_fwd.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+class node;
+class node_data;
+struct iterator_value;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+class YAML_CPP_API Node {
+ public:
+ friend class NodeBuilder;
+ friend class NodeEvents;
+ friend struct detail::iterator_value;
+ friend class detail::node;
+ friend class detail::node_data;
+ template <typename>
+ friend class detail::iterator_base;
+ template <typename T, typename S>
+ friend struct as_if;
+
+ typedef YAML::iterator iterator;
+ typedef YAML::const_iterator const_iterator;
+
+ Node();
+ explicit Node(NodeType::value type);
+ template <typename T>
+ explicit Node(const T& rhs);
+ explicit Node(const detail::iterator_value& rhs);
+ Node(const Node& rhs);
+ ~Node();
+
+ YAML::Mark Mark() const;
+ NodeType::value Type() const;
+ bool IsDefined() const;
+ bool IsNull() const { return Type() == NodeType::Null; }
+ bool IsScalar() const { return Type() == NodeType::Scalar; }
+ bool IsSequence() const { return Type() == NodeType::Sequence; }
+ bool IsMap() const { return Type() == NodeType::Map; }
+
+ // bool conversions
+ YAML_CPP_OPERATOR_BOOL()
+ bool operator!() const { return !IsDefined(); }
+
+ // access
+ template <typename T>
+ T as() const;
+ template <typename T, typename S>
+ T as(const S& fallback) const;
+ const std::string& Scalar() const;
+
+ const std::string& Tag() const;
+ void SetTag(const std::string& tag);
+
+ // style
+ // WARNING: This API might change in future releases.
+ EmitterStyle::value Style() const;
+ void SetStyle(EmitterStyle::value style);
+
+ // assignment
+ bool is(const Node& rhs) const;
+ template <typename T>
+ Node& operator=(const T& rhs);
+ Node& operator=(const Node& rhs);
+ void reset(const Node& rhs = Node());
+
+ // size/iterator
+ std::size_t size() const;
+
+ const_iterator begin() const;
+ iterator begin();
+
+ const_iterator end() const;
+ iterator end();
+
+ // sequence
+ template <typename T>
+ void push_back(const T& rhs);
+ void push_back(const Node& rhs);
+
+ // indexing
+ template <typename Key>
+ const Node operator[](const Key& key) const;
+ template <typename Key>
+ Node operator[](const Key& key);
+ template <typename Key>
+ bool remove(const Key& key);
+
+ const Node operator[](const Node& key) const;
+ Node operator[](const Node& key);
+ bool remove(const Node& key);
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value);
+
+ private:
+ enum Zombie { ZombieNode };
+ explicit Node(Zombie);
+ explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
+
+ void EnsureNodeExists() const;
+
+ template <typename T>
+ void Assign(const T& rhs);
+ void Assign(const char* rhs);
+ void Assign(char* rhs);
+
+ void AssignData(const Node& rhs);
+ void AssignNode(const Node& rhs);
+
+ private:
+ bool m_isValid;
+ mutable detail::shared_memory_holder m_pMemory;
+ mutable detail::node* m_pNode;
+};
+
+YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs);
+
+YAML_CPP_API Node Clone(const Node& node);
+
+template <typename T>
+struct convert;
+}
+
+#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/parse.h b/lib/yamlcpp/include/yaml-cpp/node/parse.h
new file mode 100644
index 0000000..7745fd7
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/parse.h
@@ -0,0 +1,78 @@
+#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class Node;
+
+/**
+ * Loads the input string as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API Node Load(const std::string& input);
+
+/**
+ * Loads the input string as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API Node Load(const char* input);
+
+/**
+ * Loads the input stream as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API Node Load(std::istream& input);
+
+/**
+ * Loads the input file as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ * @throws {@link BadFile} if the file cannot be loaded.
+ */
+YAML_CPP_API Node LoadFile(const std::string& filename);
+
+/**
+ * Loads the input string as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API std::vector<Node> LoadAll(const std::string& input);
+
+/**
+ * Loads the input string as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API std::vector<Node> LoadAll(const char* input);
+
+/**
+ * Loads the input stream as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API std::vector<Node> LoadAll(std::istream& input);
+
+/**
+ * Loads the input file as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ * @throws {@link BadFile} if the file cannot be loaded.
+ */
+YAML_CPP_API std::vector<Node> LoadAllFromFile(const std::string& filename);
+} // namespace YAML
+
+#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/ptr.h b/lib/yamlcpp/include/yaml-cpp/node/ptr.h
new file mode 100644
index 0000000..ce085dd
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/ptr.h
@@ -0,0 +1,29 @@
+#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <memory>
+
+namespace YAML {
+namespace detail {
+class node;
+class node_ref;
+class node_data;
+class memory;
+class memory_holder;
+
+typedef std::shared_ptr<node> shared_node;
+typedef std::shared_ptr<node_ref> shared_node_ref;
+typedef std::shared_ptr<node_data> shared_node_data;
+typedef std::shared_ptr<memory_holder> shared_memory_holder;
+typedef std::shared_ptr<memory> shared_memory;
+}
+}
+
+#endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/node/type.h b/lib/yamlcpp/include/yaml-cpp/node/type.h
new file mode 100644
index 0000000..9d55ca9
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/node/type.h
@@ -0,0 +1,16 @@
+#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+struct NodeType {
+ enum value { Undefined, Null, Scalar, Sequence, Map };
+};
+}
+
+#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/noncopyable.h b/lib/yamlcpp/include/yaml-cpp/noncopyable.h
new file mode 100644
index 0000000..a261040
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/noncopyable.h
@@ -0,0 +1,25 @@
+#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+// this is basically boost::noncopyable
+class YAML_CPP_API noncopyable {
+ protected:
+ noncopyable() {}
+ ~noncopyable() {}
+
+ private:
+ noncopyable(const noncopyable&);
+ const noncopyable& operator=(const noncopyable&);
+};
+}
+
+#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/null.h b/lib/yamlcpp/include/yaml-cpp/null.h
new file mode 100644
index 0000000..b9521d4
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/null.h
@@ -0,0 +1,26 @@
+#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <string>
+
+namespace YAML {
+class Node;
+
+struct YAML_CPP_API _Null {};
+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);
+
+extern YAML_CPP_API _Null Null;
+}
+
+#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h b/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h
new file mode 100644
index 0000000..09d45f3
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h
@@ -0,0 +1,72 @@
+#ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class YAML_CPP_API ostream_wrapper {
+ public:
+ ostream_wrapper();
+ explicit ostream_wrapper(std::ostream& stream);
+ ~ostream_wrapper();
+
+ void write(const std::string& str);
+ void write(const char* str, std::size_t size);
+
+ void set_comment() { m_comment = true; }
+
+ const char* str() const {
+ if (m_pStream) {
+ return 0;
+ } else {
+ m_buffer[m_pos] = '\0';
+ return &m_buffer[0];
+ }
+ }
+
+ std::size_t row() const { return m_row; }
+ std::size_t col() const { return m_col; }
+ std::size_t pos() const { return m_pos; }
+ bool comment() const { return m_comment; }
+
+ private:
+ void update_pos(char ch);
+
+ private:
+ mutable std::vector<char> m_buffer;
+ std::ostream* const m_pStream;
+
+ std::size_t m_pos;
+ std::size_t m_row, m_col;
+ bool m_comment;
+};
+
+template <std::size_t N>
+inline ostream_wrapper& operator<<(ostream_wrapper& stream,
+ const char(&str)[N]) {
+ stream.write(str, N - 1);
+ return stream;
+}
+
+inline ostream_wrapper& operator<<(ostream_wrapper& stream,
+ const std::string& str) {
+ stream.write(str);
+ return stream;
+}
+
+inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
+ stream.write(&ch, 1);
+ return stream;
+}
+}
+
+#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/parser.h b/lib/yamlcpp/include/yaml-cpp/parser.h
new file mode 100644
index 0000000..ceac22d
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/parser.h
@@ -0,0 +1,86 @@
+#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <ios>
+#include <memory>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/noncopyable.h"
+
+namespace YAML {
+class EventHandler;
+class Node;
+class Scanner;
+struct Directives;
+struct Token;
+
+/**
+ * A parser turns a stream of bytes into one stream of "events" per YAML
+ * document in the input stream.
+ */
+class YAML_CPP_API Parser : private noncopyable {
+ public:
+ /** Constructs an empty parser (with no input. */
+ Parser();
+
+ /**
+ * Constructs a parser from the given input stream. The input stream must
+ * live as long as the parser.
+ */
+ explicit Parser(std::istream& in);
+
+ ~Parser();
+
+ /** Evaluates to true if the parser has some valid input to be read. */
+ explicit operator bool() const;
+
+ /**
+ * Resets the parser with the given input stream. Any existing state is
+ * erased.
+ */
+ void Load(std::istream& in);
+
+ /**
+ * Handles the next document by calling events on the {@code eventHandler}.
+ *
+ * @throw a ParserException on error.
+ * @return false if there are no more documents
+ */
+ bool HandleNextDocument(EventHandler& eventHandler);
+
+ void PrintTokens(std::ostream& out);
+
+ private:
+ /**
+ * Reads any directives that are next in the queue, setting the internal
+ * {@code m_pDirectives} state.
+ */
+ void ParseDirectives();
+
+ void HandleDirective(const Token& token);
+
+ /**
+ * Handles a "YAML" directive, which should be of the form 'major.minor' (like
+ * a version number).
+ */
+ void HandleYamlDirective(const Token& token);
+
+ /**
+ * Handles a "TAG" directive, which should be of the form 'handle prefix',
+ * where 'handle' is converted to 'prefix' in the file.
+ */
+ void HandleTagDirective(const Token& token);
+
+ private:
+ std::unique_ptr<Scanner> m_pScanner;
+ std::unique_ptr<Directives> m_pDirectives;
+};
+}
+
+#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/stlemitter.h b/lib/yamlcpp/include/yaml-cpp/stlemitter.h
new file mode 100644
index 0000000..06780c8
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/stlemitter.h
@@ -0,0 +1,51 @@
+#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+#include <list>
+#include <set>
+#include <map>
+
+namespace YAML {
+template <typename Seq>
+inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
+ emitter << BeginSeq;
+ for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it)
+ emitter << *it;
+ emitter << EndSeq;
+ return emitter;
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::vector<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::list<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename K, typename V>
+inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
+ typedef typename std::map<K, V> map;
+ emitter << BeginMap;
+ for (typename map::const_iterator it = m.begin(); it != m.end(); ++it)
+ emitter << Key << it->first << Value << it->second;
+ emitter << EndMap;
+ return emitter;
+}
+}
+
+#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/traits.h b/lib/yamlcpp/include/yaml-cpp/traits.h
new file mode 100644
index 0000000..f33d0e1
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/traits.h
@@ -0,0 +1,103 @@
+#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+template <typename>
+struct is_numeric {
+ enum { value = false };
+};
+
+template <>
+struct is_numeric<char> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned char> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<long int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned long int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<short int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned short int> {
+ enum { value = true };
+};
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+template <>
+struct is_numeric<__int64> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned __int64> {
+ enum { value = true };
+};
+#else
+template <>
+struct is_numeric<long long> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned long long> {
+ enum { value = true };
+};
+#endif
+template <>
+struct is_numeric<float> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<double> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<long double> {
+ enum { value = true };
+};
+
+template <bool, class T = void>
+struct enable_if_c {
+ typedef T type;
+};
+
+template <class T>
+struct enable_if_c<false, T> {};
+
+template <class Cond, class T = void>
+struct enable_if : public enable_if_c<Cond::value, T> {};
+
+template <bool, class T = void>
+struct disable_if_c {
+ typedef T type;
+};
+
+template <class T>
+struct disable_if_c<true, T> {};
+
+template <class Cond, class T = void>
+struct disable_if : public disable_if_c<Cond::value, T> {};
+}
+
+#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/include/yaml-cpp/yaml.h b/lib/yamlcpp/include/yaml-cpp/yaml.h
new file mode 100644
index 0000000..7f515ef
--- /dev/null
+++ b/lib/yamlcpp/include/yaml-cpp/yaml.h
@@ -0,0 +1,24 @@
+#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/parser.h"
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/stlemitter.h"
+#include "yaml-cpp/exceptions.h"
+
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/convert.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/detail/impl.h"
+#include "yaml-cpp/node/parse.h"
+#include "yaml-cpp/node/emit.h"
+
+#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/install.txt b/lib/yamlcpp/install.txt
new file mode 100644
index 0000000..9392362
--- /dev/null
+++ b/lib/yamlcpp/install.txt
@@ -0,0 +1,24 @@
+*** With CMake ***
+
+yaml-cpp uses CMake to support cross-platform building. In a UNIX-like system, the basic steps to build are:
+
+1. Download and install CMake (if you don't have root privileges, just install to a local directory, like ~/bin)
+
+2. From the source directory, run:
+
+mkdir build
+cd build
+cmake ..
+
+and then the usual
+
+make
+make install
+
+3. To clean up, just remove the 'build' directory.
+
+*** Without CMake ***
+
+If you don't want to use CMake, just add all .cpp files to a makefile. yaml-cpp does not need any special build settings, so no 'configure' file is necessary.
+
+(Note: this is pretty tedious. It's sooo much easier to use CMake.)
diff --git a/lib/yamlcpp/src/binary.cpp b/lib/yamlcpp/src/binary.cpp
new file mode 100644
index 0000000..a7e5130
--- /dev/null
+++ b/lib/yamlcpp/src/binary.cpp
@@ -0,0 +1,93 @@
+#include "yaml-cpp/binary.h"
+
+namespace YAML {
+static const char encoding[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+std::string EncodeBase64(const unsigned char *data, std::size_t size) {
+ const char PAD = '=';
+
+ std::string ret;
+ ret.resize(4 * size / 3 + 3);
+ char *out = &ret[0];
+
+ std::size_t chunks = size / 3;
+ std::size_t remainder = size % 3;
+
+ for (std::size_t i = 0; i < chunks; i++, data += 3) {
+ *out++ = encoding[data[0] >> 2];
+ *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)];
+ *out++ = encoding[((data[1] & 0xf) << 2) | (data[2] >> 6)];
+ *out++ = encoding[data[2] & 0x3f];
+ }
+
+ switch (remainder) {
+ case 0:
+ break;
+ case 1:
+ *out++ = encoding[data[0] >> 2];
+ *out++ = encoding[((data[0] & 0x3) << 4)];
+ *out++ = PAD;
+ *out++ = PAD;
+ break;
+ case 2:
+ *out++ = encoding[data[0] >> 2];
+ *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)];
+ *out++ = encoding[((data[1] & 0xf) << 2)];
+ *out++ = PAD;
+ break;
+ }
+
+ ret.resize(out - &ret[0]);
+ return ret;
+}
+
+static const unsigned char decoding[] = {
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
+ 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
+ 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255,
+};
+
+std::vector<unsigned char> DecodeBase64(const std::string &input) {
+ typedef std::vector<unsigned char> ret_type;
+ if (input.empty())
+ return ret_type();
+
+ ret_type ret(3 * input.size() / 4 + 1);
+ unsigned char *out = &ret[0];
+
+ unsigned value = 0;
+ for (std::size_t i = 0; i < input.size(); i++) {
+ unsigned char d = decoding[static_cast<unsigned>(input[i])];
+ if (d == 255)
+ return ret_type();
+
+ value = (value << 6) | d;
+ if (i % 4 == 3) {
+ *out++ = value >> 16;
+ if (i > 0 && input[i - 1] != '=')
+ *out++ = value >> 8;
+ if (input[i] != '=')
+ *out++ = value;
+ }
+ }
+
+ ret.resize(out - &ret[0]);
+ return ret;
+}
+}
diff --git a/lib/yamlcpp/src/collectionstack.h b/lib/yamlcpp/src/collectionstack.h
new file mode 100644
index 0000000..2302786
--- /dev/null
+++ b/lib/yamlcpp/src/collectionstack.h
@@ -0,0 +1,39 @@
+#ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <stack>
+#include <cassert>
+
+namespace YAML {
+struct CollectionType {
+ enum value { NoCollection, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap };
+};
+
+class CollectionStack {
+ public:
+ CollectionType::value GetCurCollectionType() const {
+ if (collectionStack.empty())
+ return CollectionType::NoCollection;
+ return collectionStack.top();
+ }
+
+ void PushCollectionType(CollectionType::value type) {
+ collectionStack.push(type);
+ }
+ void PopCollectionType(CollectionType::value type) {
+ assert(type == GetCurCollectionType());
+ collectionStack.pop();
+ }
+
+ private:
+ std::stack<CollectionType::value> collectionStack;
+};
+}
+
+#endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/contrib/graphbuilder.cpp b/lib/yamlcpp/src/contrib/graphbuilder.cpp
new file mode 100644
index 0000000..416c135
--- /dev/null
+++ b/lib/yamlcpp/src/contrib/graphbuilder.cpp
@@ -0,0 +1,17 @@
+#include "graphbuilderadapter.h"
+
+#include "yaml-cpp/parser.h" // IWYU pragma: keep
+
+namespace YAML {
+class GraphBuilderInterface;
+
+void* BuildGraphOfNextDocument(Parser& parser,
+ GraphBuilderInterface& graphBuilder) {
+ GraphBuilderAdapter eventHandler(graphBuilder);
+ if (parser.HandleNextDocument(eventHandler)) {
+ return eventHandler.RootNode();
+ } else {
+ return NULL;
+ }
+}
+}
diff --git a/lib/yamlcpp/src/contrib/graphbuilderadapter.cpp b/lib/yamlcpp/src/contrib/graphbuilderadapter.cpp
new file mode 100644
index 0000000..02a3d97
--- /dev/null
+++ b/lib/yamlcpp/src/contrib/graphbuilderadapter.cpp
@@ -0,0 +1,94 @@
+#include "graphbuilderadapter.h"
+#include "yaml-cpp/contrib/graphbuilder.h"
+
+namespace YAML {
+struct Mark;
+
+int GraphBuilderAdapter::ContainerFrame::sequenceMarker;
+
+void GraphBuilderAdapter::OnNull(const Mark &mark, anchor_t anchor) {
+ void *pParent = GetCurrentParent();
+ void *pNode = m_builder.NewNull(mark, pParent);
+ RegisterAnchor(anchor, pNode);
+
+ DispositionNode(pNode);
+}
+
+void GraphBuilderAdapter::OnAlias(const Mark &mark, anchor_t anchor) {
+ void *pReffedNode = m_anchors.Get(anchor);
+ DispositionNode(m_builder.AnchorReference(mark, pReffedNode));
+}
+
+void GraphBuilderAdapter::OnScalar(const Mark &mark, const std::string &tag,
+ anchor_t anchor, const std::string &value) {
+ void *pParent = GetCurrentParent();
+ void *pNode = m_builder.NewScalar(mark, tag, pParent, value);
+ RegisterAnchor(anchor, pNode);
+
+ DispositionNode(pNode);
+}
+
+void GraphBuilderAdapter::OnSequenceStart(const Mark &mark,
+ const std::string &tag,
+ anchor_t anchor,
+ EmitterStyle::value /* style */) {
+ void *pNode = m_builder.NewSequence(mark, tag, GetCurrentParent());
+ m_containers.push(ContainerFrame(pNode));
+ RegisterAnchor(anchor, pNode);
+}
+
+void GraphBuilderAdapter::OnSequenceEnd() {
+ void *pSequence = m_containers.top().pContainer;
+ m_containers.pop();
+
+ DispositionNode(pSequence);
+}
+
+void GraphBuilderAdapter::OnMapStart(const Mark &mark, const std::string &tag,
+ anchor_t anchor,
+ EmitterStyle::value /* style */) {
+ void *pNode = m_builder.NewMap(mark, tag, GetCurrentParent());
+ m_containers.push(ContainerFrame(pNode, m_pKeyNode));
+ m_pKeyNode = NULL;
+ RegisterAnchor(anchor, pNode);
+}
+
+void GraphBuilderAdapter::OnMapEnd() {
+ void *pMap = m_containers.top().pContainer;
+ m_pKeyNode = m_containers.top().pPrevKeyNode;
+ m_containers.pop();
+ DispositionNode(pMap);
+}
+
+void *GraphBuilderAdapter::GetCurrentParent() const {
+ if (m_containers.empty()) {
+ return NULL;
+ }
+ return m_containers.top().pContainer;
+}
+
+void GraphBuilderAdapter::RegisterAnchor(anchor_t anchor, void *pNode) {
+ if (anchor) {
+ m_anchors.Register(anchor, pNode);
+ }
+}
+
+void GraphBuilderAdapter::DispositionNode(void *pNode) {
+ if (m_containers.empty()) {
+ m_pRootNode = pNode;
+ return;
+ }
+
+ void *pContainer = m_containers.top().pContainer;
+ if (m_containers.top().isMap()) {
+ if (m_pKeyNode) {
+ m_builder.AssignInMap(pContainer, m_pKeyNode, pNode);
+ m_pKeyNode = NULL;
+ } else {
+ m_pKeyNode = pNode;
+ }
+ } else {
+ m_builder.AppendToSequence(pContainer, pNode);
+ }
+}
+}
diff --git a/lib/yamlcpp/src/contrib/graphbuilderadapter.h b/lib/yamlcpp/src/contrib/graphbuilderadapter.h
new file mode 100644
index 0000000..0d1e579
--- /dev/null
+++ b/lib/yamlcpp/src/contrib/graphbuilderadapter.h
@@ -0,0 +1,79 @@
+#ifndef GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstdlib>
+#include <map>
+#include <stack>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/contrib/anchordict.h"
+#include "yaml-cpp/contrib/graphbuilder.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+
+namespace YAML {
+class GraphBuilderInterface;
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+class GraphBuilderAdapter : public EventHandler {
+ public:
+ GraphBuilderAdapter(GraphBuilderInterface& builder)
+ : m_builder(builder), m_pRootNode(NULL), m_pKeyNode(NULL) {}
+
+ virtual void OnDocumentStart(const Mark& mark) { (void)mark; }
+ virtual void OnDocumentEnd() {}
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor);
+ virtual void OnAlias(const Mark& mark, anchor_t anchor);
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value);
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnSequenceEnd();
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnMapEnd();
+
+ void* RootNode() const { return m_pRootNode; }
+
+ private:
+ struct ContainerFrame {
+ ContainerFrame(void* pSequence)
+ : pContainer(pSequence), pPrevKeyNode(&sequenceMarker) {}
+ ContainerFrame(void* pMap, void* pPrevKeyNode)
+ : pContainer(pMap), pPrevKeyNode(pPrevKeyNode) {}
+
+ void* pContainer;
+ void* pPrevKeyNode;
+
+ bool isMap() const { return pPrevKeyNode != &sequenceMarker; }
+
+ private:
+ static int sequenceMarker;
+ };
+ typedef std::stack<ContainerFrame> ContainerStack;
+ typedef AnchorDict<void*> AnchorMap;
+
+ GraphBuilderInterface& m_builder;
+ ContainerStack m_containers;
+ AnchorMap m_anchors;
+ void* m_pRootNode;
+ void* m_pKeyNode;
+
+ void* GetCurrentParent() const;
+ void RegisterAnchor(anchor_t anchor, void* pNode);
+ void DispositionNode(void* pNode);
+};
+}
+
+#endif // GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/convert.cpp b/lib/yamlcpp/src/convert.cpp
new file mode 100644
index 0000000..ec05b77
--- /dev/null
+++ b/lib/yamlcpp/src/convert.cpp
@@ -0,0 +1,75 @@
+#include <algorithm>
+
+#include "yaml-cpp/node/convert.h"
+
+namespace {
+// we're not gonna mess with the mess that is all the isupper/etc. functions
+bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; }
+bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; }
+char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; }
+
+std::string tolower(const std::string& str) {
+ std::string s(str);
+ std::transform(s.begin(), s.end(), s.begin(), ToLower);
+ return s;
+}
+
+template <typename T>
+bool IsEntirely(const std::string& str, T func) {
+ for (std::size_t i = 0; i < str.size(); i++)
+ if (!func(str[i]))
+ return false;
+
+ return true;
+}
+
+// IsFlexibleCase
+// . Returns true if 'str' is:
+// . UPPERCASE
+// . lowercase
+// . Capitalized
+bool IsFlexibleCase(const std::string& str) {
+ if (str.empty())
+ return true;
+
+ if (IsEntirely(str, IsLower))
+ return true;
+
+ bool firstcaps = IsUpper(str[0]);
+ std::string rest = str.substr(1);
+ return firstcaps && (IsEntirely(rest, IsLower) || IsEntirely(rest, IsUpper));
+}
+}
+
+namespace YAML {
+bool convert<bool>::decode(const Node& node, bool& rhs) {
+ if (!node.IsScalar())
+ return false;
+
+ // we can't use iostream bool extraction operators as they don't
+ // recognize all possible values in the table below (taken from
+ // http://yaml.org/type/bool.html)
+ static const struct {
+ std::string truename, falsename;
+ } names[] = {
+ {"y", "n"}, {"yes", "no"}, {"true", "false"}, {"on", "off"},
+ };
+
+ if (!IsFlexibleCase(node.Scalar()))
+ return false;
+
+ for (unsigned i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
+ if (names[i].truename == tolower(node.Scalar())) {
+ rhs = true;
+ return true;
+ }
+
+ if (names[i].falsename == tolower(node.Scalar())) {
+ rhs = false;
+ return true;
+ }
+ }
+
+ return false;
+}
+}
diff --git a/lib/yamlcpp/src/directives.cpp b/lib/yamlcpp/src/directives.cpp
new file mode 100644
index 0000000..963bd2c
--- /dev/null
+++ b/lib/yamlcpp/src/directives.cpp
@@ -0,0 +1,22 @@
+#include "directives.h"
+
+namespace YAML {
+Directives::Directives() {
+ // version
+ version.isDefault = true;
+ version.major = 1;
+ version.minor = 2;
+}
+
+const std::string Directives::TranslateTagHandle(
+ const std::string& handle) const {
+ std::map<std::string, std::string>::const_iterator it = tags.find(handle);
+ if (it == tags.end()) {
+ if (handle == "!!")
+ return "tag:yaml.org,2002:";
+ return handle;
+ }
+
+ return it->second;
+}
+}
diff --git a/lib/yamlcpp/src/directives.h b/lib/yamlcpp/src/directives.h
new file mode 100644
index 0000000..333af26
--- /dev/null
+++ b/lib/yamlcpp/src/directives.h
@@ -0,0 +1,29 @@
+#ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <map>
+
+namespace YAML {
+struct Version {
+ bool isDefault;
+ int major, minor;
+};
+
+struct Directives {
+ Directives();
+
+ const std::string TranslateTagHandle(const std::string& handle) const;
+
+ Version version;
+ std::map<std::string, std::string> tags;
+};
+}
+
+#endif // DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/emit.cpp b/lib/yamlcpp/src/emit.cpp
new file mode 100644
index 0000000..51bc791
--- /dev/null
+++ b/lib/yamlcpp/src/emit.cpp
@@ -0,0 +1,25 @@
+#include "yaml-cpp/node/emit.h"
+#include "yaml-cpp/emitfromevents.h"
+#include "yaml-cpp/emitter.h"
+#include "nodeevents.h"
+
+namespace YAML {
+Emitter& operator<<(Emitter& out, const Node& node) {
+ EmitFromEvents emitFromEvents(out);
+ NodeEvents events(node);
+ events.Emit(emitFromEvents);
+ return out;
+}
+
+std::ostream& operator<<(std::ostream& out, const Node& node) {
+ Emitter emitter(out);
+ emitter << node;
+ return out;
+}
+
+std::string Dump(const Node& node) {
+ Emitter emitter;
+ emitter << node;
+ return emitter.c_str();
+}
+} // namespace YAML
diff --git a/lib/yamlcpp/src/emitfromevents.cpp b/lib/yamlcpp/src/emitfromevents.cpp
new file mode 100644
index 0000000..4832649
--- /dev/null
+++ b/lib/yamlcpp/src/emitfromevents.cpp
@@ -0,0 +1,119 @@
+#include <cassert>
+#include <sstream>
+
+#include "yaml-cpp/emitfromevents.h"
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+struct Mark;
+} // namespace YAML
+
+namespace {
+std::string ToString(YAML::anchor_t anchor) {
+ std::stringstream stream;
+ stream << anchor;
+ return stream.str();
+}
+}
+
+namespace YAML {
+EmitFromEvents::EmitFromEvents(Emitter& emitter) : m_emitter(emitter) {}
+
+void EmitFromEvents::OnDocumentStart(const Mark&) {}
+
+void EmitFromEvents::OnDocumentEnd() {}
+
+void EmitFromEvents::OnNull(const Mark&, anchor_t anchor) {
+ BeginNode();
+ EmitProps("", anchor);
+ m_emitter << Null;
+}
+
+void EmitFromEvents::OnAlias(const Mark&, anchor_t anchor) {
+ BeginNode();
+ m_emitter << Alias(ToString(anchor));
+}
+
+void EmitFromEvents::OnScalar(const Mark&, const std::string& tag,
+ anchor_t anchor, const std::string& value) {
+ BeginNode();
+ EmitProps(tag, anchor);
+ m_emitter << value;
+}
+
+void EmitFromEvents::OnSequenceStart(const Mark&, const std::string& tag,
+ anchor_t anchor,
+ EmitterStyle::value style) {
+ BeginNode();
+ EmitProps(tag, anchor);
+ switch (style) {
+ case EmitterStyle::Block:
+ m_emitter << Block;
+ break;
+ case EmitterStyle::Flow:
+ m_emitter << Flow;
+ break;
+ default:
+ break;
+ }
+ m_emitter << BeginSeq;
+ m_stateStack.push(State::WaitingForSequenceEntry);
+}
+
+void EmitFromEvents::OnSequenceEnd() {
+ m_emitter << EndSeq;
+ assert(m_stateStack.top() == State::WaitingForSequenceEntry);
+ m_stateStack.pop();
+}
+
+void EmitFromEvents::OnMapStart(const Mark&, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
+ BeginNode();
+ EmitProps(tag, anchor);
+ switch (style) {
+ case EmitterStyle::Block:
+ m_emitter << Block;
+ break;
+ case EmitterStyle::Flow:
+ m_emitter << Flow;
+ break;
+ default:
+ break;
+ }
+ m_emitter << BeginMap;
+ m_stateStack.push(State::WaitingForKey);
+}
+
+void EmitFromEvents::OnMapEnd() {
+ m_emitter << EndMap;
+ assert(m_stateStack.top() == State::WaitingForKey);
+ m_stateStack.pop();
+}
+
+void EmitFromEvents::BeginNode() {
+ if (m_stateStack.empty())
+ return;
+
+ switch (m_stateStack.top()) {
+ case State::WaitingForKey:
+ m_emitter << Key;
+ m_stateStack.top() = State::WaitingForValue;
+ break;
+ case State::WaitingForValue:
+ m_emitter << Value;
+ m_stateStack.top() = State::WaitingForKey;
+ break;
+ default:
+ break;
+ }
+}
+
+void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) {
+ if (!tag.empty() && tag != "?" && tag != "!")
+ m_emitter << VerbatimTag(tag);
+ if (anchor)
+ m_emitter << Anchor(ToString(anchor));
+}
+}
diff --git a/lib/yamlcpp/src/emitter.cpp b/lib/yamlcpp/src/emitter.cpp
new file mode 100644
index 0000000..ebeb059
--- /dev/null
+++ b/lib/yamlcpp/src/emitter.cpp
@@ -0,0 +1,911 @@
+#include <sstream>
+
+#include "emitterutils.h"
+#include "indentation.h" // IWYU pragma: keep
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+class Binary;
+struct _Null;
+
+Emitter::Emitter() : m_pState(new EmitterState) {}
+
+Emitter::Emitter(std::ostream& stream)
+ : m_pState(new EmitterState), m_stream(stream) {}
+
+Emitter::~Emitter() {}
+
+const char* Emitter::c_str() const { return m_stream.str(); }
+
+std::size_t Emitter::size() const { return m_stream.pos(); }
+
+// state checking
+bool Emitter::good() const { return m_pState->good(); }
+
+const std::string Emitter::GetLastError() const {
+ return m_pState->GetLastError();
+}
+
+// global setters
+bool Emitter::SetOutputCharset(EMITTER_MANIP value) {
+ return m_pState->SetOutputCharset(value, FmtScope::Global);
+}
+
+bool Emitter::SetStringFormat(EMITTER_MANIP value) {
+ return m_pState->SetStringFormat(value, FmtScope::Global);
+}
+
+bool Emitter::SetBoolFormat(EMITTER_MANIP value) {
+ bool ok = false;
+ if (m_pState->SetBoolFormat(value, FmtScope::Global))
+ ok = true;
+ if (m_pState->SetBoolCaseFormat(value, FmtScope::Global))
+ ok = true;
+ if (m_pState->SetBoolLengthFormat(value, FmtScope::Global))
+ ok = true;
+ return ok;
+}
+
+bool Emitter::SetIntBase(EMITTER_MANIP value) {
+ return m_pState->SetIntFormat(value, FmtScope::Global);
+}
+
+bool Emitter::SetSeqFormat(EMITTER_MANIP value) {
+ return m_pState->SetFlowType(GroupType::Seq, value, FmtScope::Global);
+}
+
+bool Emitter::SetMapFormat(EMITTER_MANIP value) {
+ bool ok = false;
+ if (m_pState->SetFlowType(GroupType::Map, value, FmtScope::Global))
+ ok = true;
+ if (m_pState->SetMapKeyFormat(value, FmtScope::Global))
+ ok = true;
+ return ok;
+}
+
+bool Emitter::SetIndent(std::size_t n) {
+ return m_pState->SetIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetPreCommentIndent(std::size_t n) {
+ return m_pState->SetPreCommentIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetPostCommentIndent(std::size_t n) {
+ return m_pState->SetPostCommentIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetFloatPrecision(std::size_t n) {
+ return m_pState->SetFloatPrecision(n, FmtScope::Global);
+}
+
+bool Emitter::SetDoublePrecision(std::size_t n) {
+ return m_pState->SetDoublePrecision(n, FmtScope::Global);
+}
+
+// SetLocalValue
+// . Either start/end a group, or set a modifier locally
+Emitter& Emitter::SetLocalValue(EMITTER_MANIP value) {
+ if (!good())
+ return *this;
+
+ switch (value) {
+ case BeginDoc:
+ EmitBeginDoc();
+ break;
+ case EndDoc:
+ EmitEndDoc();
+ break;
+ case BeginSeq:
+ EmitBeginSeq();
+ break;
+ case EndSeq:
+ EmitEndSeq();
+ break;
+ case BeginMap:
+ EmitBeginMap();
+ break;
+ case EndMap:
+ EmitEndMap();
+ break;
+ case Key:
+ case Value:
+ // deprecated (these can be deduced by the parity of nodes in a map)
+ break;
+ case TagByKind:
+ EmitKindTag();
+ break;
+ case Newline:
+ EmitNewline();
+ break;
+ default:
+ m_pState->SetLocalValue(value);
+ break;
+ }
+ return *this;
+}
+
+Emitter& Emitter::SetLocalIndent(const _Indent& indent) {
+ m_pState->SetIndent(indent.value, FmtScope::Local);
+ return *this;
+}
+
+Emitter& Emitter::SetLocalPrecision(const _Precision& precision) {
+ if (precision.floatPrecision >= 0)
+ m_pState->SetFloatPrecision(precision.floatPrecision, FmtScope::Local);
+ if (precision.doublePrecision >= 0)
+ m_pState->SetDoublePrecision(precision.doublePrecision, FmtScope::Local);
+ return *this;
+}
+
+// EmitBeginDoc
+void Emitter::EmitBeginDoc() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupType() != GroupType::NoType) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_pState->HasAnchor() || m_pState->HasTag()) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_stream.col() > 0)
+ m_stream << "\n";
+ m_stream << "---\n";
+
+ m_pState->StartedDoc();
+}
+
+// EmitEndDoc
+void Emitter::EmitEndDoc() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupType() != GroupType::NoType) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_pState->HasAnchor() || m_pState->HasTag()) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_stream.col() > 0)
+ m_stream << "\n";
+ m_stream << "...\n";
+}
+
+// EmitBeginSeq
+void Emitter::EmitBeginSeq() {
+ if (!good())
+ return;
+
+ PrepareNode(m_pState->NextGroupType(GroupType::Seq));
+
+ m_pState->StartedGroup(GroupType::Seq);
+}
+
+// EmitEndSeq
+void Emitter::EmitEndSeq() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupChildCount() == 0)
+ m_pState->ForceFlow();
+
+ if (m_pState->CurGroupFlowType() == FlowType::Flow) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(m_pState->CurIndent());
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "[";
+ m_stream << "]";
+ }
+
+ m_pState->EndedGroup(GroupType::Seq);
+}
+
+// EmitBeginMap
+void Emitter::EmitBeginMap() {
+ if (!good())
+ return;
+
+ PrepareNode(m_pState->NextGroupType(GroupType::Map));
+
+ m_pState->StartedGroup(GroupType::Map);
+}
+
+// EmitEndMap
+void Emitter::EmitEndMap() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupChildCount() == 0)
+ m_pState->ForceFlow();
+
+ if (m_pState->CurGroupFlowType() == FlowType::Flow) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(m_pState->CurIndent());
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "{";
+ m_stream << "}";
+ }
+
+ m_pState->EndedGroup(GroupType::Map);
+}
+
+// EmitNewline
+void Emitter::EmitNewline() {
+ if (!good())
+ return;
+
+ PrepareNode(EmitterNodeType::NoType);
+ m_stream << "\n";
+ m_pState->SetNonContent();
+}
+
+bool Emitter::CanEmitNewline() const { return true; }
+
+// Put the stream in a state so we can simply write the next node
+// E.g., if we're in a sequence, write the "- "
+void Emitter::PrepareNode(EmitterNodeType::value child) {
+ switch (m_pState->CurGroupNodeType()) {
+ case EmitterNodeType::NoType:
+ PrepareTopNode(child);
+ break;
+ case EmitterNodeType::FlowSeq:
+ FlowSeqPrepareNode(child);
+ break;
+ case EmitterNodeType::BlockSeq:
+ BlockSeqPrepareNode(child);
+ break;
+ case EmitterNodeType::FlowMap:
+ FlowMapPrepareNode(child);
+ break;
+ case EmitterNodeType::BlockMap:
+ BlockMapPrepareNode(child);
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::PrepareTopNode(EmitterNodeType::value child) {
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (m_pState->CurGroupChildCount() > 0 && m_stream.col() > 0) {
+ if (child != EmitterNodeType::NoType)
+ EmitBeginDoc();
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ // TODO: if we were writing null, and
+ // we wanted it blank, we wouldn't want a space
+ SpaceOrIndentTo(m_pState->HasBegunContent(), 0);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ if (m_pState->HasBegunNode())
+ m_stream << "\n";
+ break;
+ }
+}
+
+void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "[";
+ else
+ m_stream << ",";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunContent()) {
+ if (m_pState->CurGroupChildCount() > 0 || m_stream.comment()) {
+ m_stream << "\n";
+ }
+ m_stream << IndentTo(curIndent);
+ m_stream << "-";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(m_pState->HasBegunContent(), nextIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ m_stream << "\n";
+ break;
+ case EmitterNodeType::BlockMap:
+ if (m_pState->HasBegunContent() || m_stream.comment())
+ m_stream << "\n";
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareNode(EmitterNodeType::value child) {
+ if (m_pState->CurGroupChildCount() % 2 == 0) {
+ if (m_pState->GetMapKeyFormat() == LongKey)
+ m_pState->SetLongKey();
+
+ if (m_pState->CurGroupLongKey())
+ FlowMapPrepareLongKey(child);
+ else
+ FlowMapPrepareSimpleKey(child);
+ } else {
+ if (m_pState->CurGroupLongKey())
+ FlowMapPrepareLongKeyValue(child);
+ else
+ FlowMapPrepareSimpleKeyValue(child);
+ }
+}
+
+void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "{ ?";
+ else
+ m_stream << ", ?";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "{";
+ else
+ m_stream << ",";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
+ if (m_pState->CurGroupChildCount() % 2 == 0) {
+ if (m_pState->GetMapKeyFormat() == LongKey)
+ m_pState->SetLongKey();
+ if (child == EmitterNodeType::BlockSeq ||
+ child == EmitterNodeType::BlockMap)
+ m_pState->SetLongKey();
+
+ if (m_pState->CurGroupLongKey())
+ BlockMapPrepareLongKey(child);
+ else
+ BlockMapPrepareSimpleKey(child);
+ } else {
+ if (m_pState->CurGroupLongKey())
+ BlockMapPrepareLongKeyValue(child);
+ else
+ BlockMapPrepareSimpleKeyValue(child);
+ }
+}
+
+void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t childCount = m_pState->CurGroupChildCount();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunContent()) {
+ if (childCount > 0) {
+ m_stream << "\n";
+ }
+ if (m_stream.comment()) {
+ m_stream << "\n";
+ }
+ m_stream << IndentTo(curIndent);
+ m_stream << "?";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(true, curIndent + 1);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunContent()) {
+ m_stream << "\n";
+ m_stream << IndentTo(curIndent);
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ SpaceOrIndentTo(true, curIndent + 1);
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t childCount = m_pState->CurGroupChildCount();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunNode()) {
+ if (childCount > 0) {
+ m_stream << "\n";
+ }
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(m_pState->HasBegunContent(), curIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(true, nextIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ m_stream << "\n";
+ break;
+ }
+}
+
+// SpaceOrIndentTo
+// . Prepares for some more content by proper spacing
+void Emitter::SpaceOrIndentTo(bool requireSpace, std::size_t indent) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ if (m_stream.col() > 0 && requireSpace)
+ m_stream << " ";
+ m_stream << IndentTo(indent);
+}
+
+void Emitter::PrepareIntegralStream(std::stringstream& stream) const {
+
+ switch (m_pState->GetIntFormat()) {
+ case Dec:
+ stream << std::dec;
+ break;
+ case Hex:
+ stream << "0x";
+ stream << std::hex;
+ break;
+ case Oct:
+ stream << "0";
+ stream << std::oct;
+ break;
+ default:
+ assert(false);
+ }
+}
+
+void Emitter::StartedScalar() { m_pState->StartedScalar(); }
+
+// *******************************************************************************************
+// overloads of Write
+
+Emitter& Emitter::Write(const std::string& str) {
+ if (!good())
+ return *this;
+
+ const bool escapeNonAscii = m_pState->GetOutputCharset() == EscapeNonAscii;
+ const StringFormat::value strFormat =
+ Utils::ComputeStringFormat(str, m_pState->GetStringFormat(),
+ m_pState->CurGroupFlowType(), escapeNonAscii);
+
+ if (strFormat == StringFormat::Literal)
+ m_pState->SetMapKeyFormat(YAML::LongKey, FmtScope::Local);
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ switch (strFormat) {
+ case StringFormat::Plain:
+ m_stream << str;
+ break;
+ case StringFormat::SingleQuoted:
+ Utils::WriteSingleQuotedString(m_stream, str);
+ break;
+ case StringFormat::DoubleQuoted:
+ Utils::WriteDoubleQuotedString(m_stream, str, escapeNonAscii);
+ break;
+ case StringFormat::Literal:
+ Utils::WriteLiteralString(m_stream, str,
+ m_pState->CurIndent() + m_pState->GetIndent());
+ break;
+ }
+
+ StartedScalar();
+
+ return *this;
+}
+
+std::size_t Emitter::GetFloatPrecision() const {
+ return m_pState->GetFloatPrecision();
+}
+
+std::size_t Emitter::GetDoublePrecision() const {
+ return m_pState->GetDoublePrecision();
+}
+
+const char* Emitter::ComputeFullBoolName(bool b) const {
+ const EMITTER_MANIP mainFmt = (m_pState->GetBoolLengthFormat() == ShortBool
+ ? YesNoBool
+ : m_pState->GetBoolFormat());
+ const EMITTER_MANIP caseFmt = m_pState->GetBoolCaseFormat();
+ switch (mainFmt) {
+ case YesNoBool:
+ switch (caseFmt) {
+ case UpperCase:
+ return b ? "YES" : "NO";
+ case CamelCase:
+ return b ? "Yes" : "No";
+ case LowerCase:
+ return b ? "yes" : "no";
+ default:
+ break;
+ }
+ break;
+ case OnOffBool:
+ switch (caseFmt) {
+ case UpperCase:
+ return b ? "ON" : "OFF";
+ case CamelCase:
+ return b ? "On" : "Off";
+ case LowerCase:
+ return b ? "on" : "off";
+ default:
+ break;
+ }
+ break;
+ case TrueFalseBool:
+ switch (caseFmt) {
+ case UpperCase:
+ return b ? "TRUE" : "FALSE";
+ case CamelCase:
+ return b ? "True" : "False";
+ case LowerCase:
+ return b ? "true" : "false";
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return b ? "y" : "n"; // should never get here, but it can't hurt to give
+ // these answers
+}
+
+Emitter& Emitter::Write(bool b) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ const char* name = ComputeFullBoolName(b);
+ if (m_pState->GetBoolLengthFormat() == ShortBool)
+ m_stream << name[0];
+ else
+ m_stream << name;
+
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(char ch) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+ Utils::WriteChar(m_stream, ch);
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Alias& alias) {
+ if (!good())
+ return *this;
+
+ if (m_pState->HasAnchor() || m_pState->HasTag()) {
+ m_pState->SetError(ErrorMsg::INVALID_ALIAS);
+ return *this;
+ }
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ if (!Utils::WriteAlias(m_stream, alias.content)) {
+ m_pState->SetError(ErrorMsg::INVALID_ALIAS);
+ return *this;
+ }
+
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Anchor& anchor) {
+ if (!good())
+ return *this;
+
+ if (m_pState->HasAnchor()) {
+ m_pState->SetError(ErrorMsg::INVALID_ANCHOR);
+ return *this;
+ }
+
+ PrepareNode(EmitterNodeType::Property);
+
+ if (!Utils::WriteAnchor(m_stream, anchor.content)) {
+ m_pState->SetError(ErrorMsg::INVALID_ANCHOR);
+ return *this;
+ }
+
+ m_pState->SetAnchor();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Tag& tag) {
+ if (!good())
+ return *this;
+
+ if (m_pState->HasTag()) {
+ m_pState->SetError(ErrorMsg::INVALID_TAG);
+ return *this;
+ }
+
+ PrepareNode(EmitterNodeType::Property);
+
+ bool success = false;
+ if (tag.type == _Tag::Type::Verbatim)
+ success = Utils::WriteTag(m_stream, tag.content, true);
+ else if (tag.type == _Tag::Type::PrimaryHandle)
+ success = Utils::WriteTag(m_stream, tag.content, false);
+ else
+ success = Utils::WriteTagWithPrefix(m_stream, tag.prefix, tag.content);
+
+ if (!success) {
+ m_pState->SetError(ErrorMsg::INVALID_TAG);
+ return *this;
+ }
+
+ m_pState->SetTag();
+
+ return *this;
+}
+
+void Emitter::EmitKindTag() { Write(LocalTag("")); }
+
+Emitter& Emitter::Write(const _Comment& comment) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::NoType);
+
+ if (m_stream.col() > 0)
+ m_stream << Indentation(m_pState->GetPreCommentIndent());
+ Utils::WriteComment(m_stream, comment.content,
+ m_pState->GetPostCommentIndent());
+
+ m_pState->SetNonContent();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Null& /*null*/) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ m_stream << "~";
+
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const Binary& binary) {
+ Write(SecondaryTag("binary"));
+
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+ Utils::WriteBinary(m_stream, binary);
+ StartedScalar();
+
+ return *this;
+}
+}
diff --git a/lib/yamlcpp/src/emitterstate.cpp b/lib/yamlcpp/src/emitterstate.cpp
new file mode 100644
index 0000000..3542aaf
--- /dev/null
+++ b/lib/yamlcpp/src/emitterstate.cpp
@@ -0,0 +1,365 @@
+#include <limits>
+
+#include "emitterstate.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+EmitterState::EmitterState()
+ : m_isGood(true),
+ m_curIndent(0),
+ m_hasAnchor(false),
+ m_hasTag(false),
+ m_hasNonContent(false),
+ m_docCount(0) {
+ // set default global manipulators
+ m_charset.set(EmitNonAscii);
+ m_strFmt.set(Auto);
+ m_boolFmt.set(TrueFalseBool);
+ m_boolLengthFmt.set(LongBool);
+ m_boolCaseFmt.set(LowerCase);
+ m_intFmt.set(Dec);
+ m_indent.set(2);
+ m_preCommentIndent.set(2);
+ m_postCommentIndent.set(1);
+ m_seqFmt.set(Block);
+ m_mapFmt.set(Block);
+ m_mapKeyFmt.set(Auto);
+ m_floatPrecision.set(std::numeric_limits<float>::digits10 + 1);
+ m_doublePrecision.set(std::numeric_limits<double>::digits10 + 1);
+}
+
+EmitterState::~EmitterState() {}
+
+// SetLocalValue
+// . We blindly tries to set all possible formatters to this value
+// . Only the ones that make sense will be accepted
+void EmitterState::SetLocalValue(EMITTER_MANIP value) {
+ SetOutputCharset(value, FmtScope::Local);
+ SetStringFormat(value, FmtScope::Local);
+ SetBoolFormat(value, FmtScope::Local);
+ SetBoolCaseFormat(value, FmtScope::Local);
+ SetBoolLengthFormat(value, FmtScope::Local);
+ SetIntFormat(value, FmtScope::Local);
+ SetFlowType(GroupType::Seq, value, FmtScope::Local);
+ SetFlowType(GroupType::Map, value, FmtScope::Local);
+ SetMapKeyFormat(value, FmtScope::Local);
+}
+
+void EmitterState::SetAnchor() { m_hasAnchor = true; }
+
+void EmitterState::SetTag() { m_hasTag = true; }
+
+void EmitterState::SetNonContent() { m_hasNonContent = true; }
+
+void EmitterState::SetLongKey() {
+ assert(!m_groups.empty());
+ if (m_groups.empty()) {
+ return;
+ }
+
+ assert(m_groups.back()->type == GroupType::Map);
+ m_groups.back()->longKey = true;
+}
+
+void EmitterState::ForceFlow() {
+ assert(!m_groups.empty());
+ if (m_groups.empty()) {
+ return;
+ }
+
+ m_groups.back()->flowType = FlowType::Flow;
+}
+
+void EmitterState::StartedNode() {
+ if (m_groups.empty()) {
+ m_docCount++;
+ } else {
+ m_groups.back()->childCount++;
+ if (m_groups.back()->childCount % 2 == 0) {
+ m_groups.back()->longKey = false;
+ }
+ }
+
+ m_hasAnchor = false;
+ m_hasTag = false;
+ m_hasNonContent = false;
+}
+
+EmitterNodeType::value EmitterState::NextGroupType(
+ GroupType::value type) const {
+ if (type == GroupType::Seq) {
+ if (GetFlowType(type) == Block)
+ return EmitterNodeType::BlockSeq;
+ else
+ return EmitterNodeType::FlowSeq;
+ } else {
+ if (GetFlowType(type) == Block)
+ return EmitterNodeType::BlockMap;
+ else
+ return EmitterNodeType::FlowMap;
+ }
+
+ // can't happen
+ assert(false);
+ return EmitterNodeType::NoType;
+}
+
+void EmitterState::StartedDoc() {
+ m_hasAnchor = false;
+ m_hasTag = false;
+ m_hasNonContent = false;
+}
+
+void EmitterState::EndedDoc() {
+ m_hasAnchor = false;
+ m_hasTag = false;
+ m_hasNonContent = false;
+}
+
+void EmitterState::StartedScalar() {
+ StartedNode();
+ ClearModifiedSettings();
+}
+
+void EmitterState::StartedGroup(GroupType::value type) {
+ StartedNode();
+
+ const std::size_t lastGroupIndent =
+ (m_groups.empty() ? 0 : m_groups.back()->indent);
+ m_curIndent += lastGroupIndent;
+
+ // TODO: Create move constructors for settings types to simplify transfer
+ std::unique_ptr<Group> pGroup(new Group(type));
+
+ // transfer settings (which last until this group is done)
+ //
+ // NB: if pGroup->modifiedSettings == m_modifiedSettings,
+ // m_modifiedSettings is not changed!
+ pGroup->modifiedSettings = std::move(m_modifiedSettings);
+
+ // set up group
+ if (GetFlowType(type) == Block) {
+ pGroup->flowType = FlowType::Block;
+ } else {
+ pGroup->flowType = FlowType::Flow;
+ }
+ pGroup->indent = GetIndent();
+
+ m_groups.push_back(std::move(pGroup));
+}
+
+void EmitterState::EndedGroup(GroupType::value type) {
+ if (m_groups.empty()) {
+ if (type == GroupType::Seq) {
+ return SetError(ErrorMsg::UNEXPECTED_END_SEQ);
+ } else {
+ return SetError(ErrorMsg::UNEXPECTED_END_MAP);
+ }
+ }
+
+ // get rid of the current group
+ {
+ std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back());
+ m_groups.pop_back();
+ if (pFinishedGroup->type != type) {
+ return SetError(ErrorMsg::UNMATCHED_GROUP_TAG);
+ }
+ }
+
+ // reset old settings
+ std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent);
+ assert(m_curIndent >= lastIndent);
+ m_curIndent -= lastIndent;
+
+ // some global settings that we changed may have been overridden
+ // by a local setting we just popped, so we need to restore them
+ m_globalModifiedSettings.restore();
+
+ ClearModifiedSettings();
+}
+
+EmitterNodeType::value EmitterState::CurGroupNodeType() const {
+ if (m_groups.empty()) {
+ return EmitterNodeType::NoType;
+ }
+
+ return m_groups.back()->NodeType();
+}
+
+GroupType::value EmitterState::CurGroupType() const {
+ return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
+}
+
+FlowType::value EmitterState::CurGroupFlowType() const {
+ return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
+}
+
+std::size_t EmitterState::CurGroupIndent() const {
+ return m_groups.empty() ? 0 : m_groups.back()->indent;
+}
+
+std::size_t EmitterState::CurGroupChildCount() const {
+ return m_groups.empty() ? m_docCount : m_groups.back()->childCount;
+}
+
+bool EmitterState::CurGroupLongKey() const {
+ return m_groups.empty() ? false : m_groups.back()->longKey;
+}
+
+std::size_t EmitterState::LastIndent() const {
+ if (m_groups.size() <= 1) {
+ return 0;
+ }
+
+ return m_curIndent - m_groups[m_groups.size() - 2]->indent;
+}
+
+void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); }
+
+bool EmitterState::SetOutputCharset(EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case EmitNonAscii:
+ case EscapeNonAscii:
+ _Set(m_charset, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case Auto:
+ case SingleQuoted:
+ case DoubleQuoted:
+ case Literal:
+ _Set(m_strFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case OnOffBool:
+ case TrueFalseBool:
+ case YesNoBool:
+ _Set(m_boolFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case LongBool:
+ case ShortBool:
+ _Set(m_boolLengthFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case UpperCase:
+ case LowerCase:
+ case CamelCase:
+ _Set(m_boolCaseFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case Dec:
+ case Hex:
+ case Oct:
+ _Set(m_intFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetIndent(std::size_t value, FmtScope::value scope) {
+ if (value <= 1)
+ return false;
+
+ _Set(m_indent, value, scope);
+ return true;
+}
+
+bool EmitterState::SetPreCommentIndent(std::size_t value,
+ FmtScope::value scope) {
+ if (value == 0)
+ return false;
+
+ _Set(m_preCommentIndent, value, scope);
+ return true;
+}
+
+bool EmitterState::SetPostCommentIndent(std::size_t value,
+ FmtScope::value scope) {
+ if (value == 0)
+ return false;
+
+ _Set(m_postCommentIndent, value, scope);
+ return true;
+}
+
+bool EmitterState::SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case Block:
+ case Flow:
+ _Set(groupType == GroupType::Seq ? m_seqFmt : m_mapFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+EMITTER_MANIP EmitterState::GetFlowType(GroupType::value groupType) const {
+ // force flow style if we're currently in a flow
+ if (CurGroupFlowType() == FlowType::Flow)
+ return Flow;
+
+ // otherwise, go with what's asked of us
+ return (groupType == GroupType::Seq ? m_seqFmt.get() : m_mapFmt.get());
+}
+
+bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case Auto:
+ case LongKey:
+ _Set(m_mapKeyFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
+ if (value > std::numeric_limits<float>::digits10 + 1)
+ return false;
+ _Set(m_floatPrecision, value, scope);
+ return true;
+}
+
+bool EmitterState::SetDoublePrecision(std::size_t value,
+ FmtScope::value scope) {
+ if (value > std::numeric_limits<double>::digits10 + 1)
+ return false;
+ _Set(m_doublePrecision, value, scope);
+ return true;
+}
+}
diff --git a/lib/yamlcpp/src/emitterstate.h b/lib/yamlcpp/src/emitterstate.h
new file mode 100644
index 0000000..0937f00
--- /dev/null
+++ b/lib/yamlcpp/src/emitterstate.h
@@ -0,0 +1,203 @@
+#ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "setting.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+
+#include <cassert>
+#include <memory>
+#include <stack>
+#include <stdexcept>
+#include <vector>
+
+namespace YAML {
+struct FmtScope {
+ enum value { Local, Global };
+};
+struct GroupType {
+ enum value { NoType, Seq, Map };
+};
+struct FlowType {
+ enum value { NoType, Flow, Block };
+};
+
+class EmitterState {
+ public:
+ EmitterState();
+ ~EmitterState();
+
+ // basic state checking
+ bool good() const { return m_isGood; }
+ const std::string GetLastError() const { return m_lastError; }
+ void SetError(const std::string& error) {
+ m_isGood = false;
+ m_lastError = error;
+ }
+
+ // node handling
+ void SetAnchor();
+ void SetTag();
+ void SetNonContent();
+ void SetLongKey();
+ void ForceFlow();
+ void StartedDoc();
+ void EndedDoc();
+ void StartedScalar();
+ void StartedGroup(GroupType::value type);
+ void EndedGroup(GroupType::value type);
+
+ EmitterNodeType::value NextGroupType(GroupType::value type) const;
+ EmitterNodeType::value CurGroupNodeType() const;
+
+ GroupType::value CurGroupType() const;
+ FlowType::value CurGroupFlowType() const;
+ std::size_t CurGroupIndent() const;
+ std::size_t CurGroupChildCount() const;
+ bool CurGroupLongKey() const;
+
+ std::size_t LastIndent() const;
+ std::size_t CurIndent() const { return m_curIndent; }
+ bool HasAnchor() const { return m_hasAnchor; }
+ bool HasTag() const { return m_hasTag; }
+ bool HasBegunNode() const {
+ return m_hasAnchor || m_hasTag || m_hasNonContent;
+ }
+ bool HasBegunContent() const { return m_hasAnchor || m_hasTag; }
+
+ void ClearModifiedSettings();
+
+ // formatters
+ void SetLocalValue(EMITTER_MANIP value);
+
+ bool SetOutputCharset(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); }
+
+ bool SetStringFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); }
+
+ bool SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); }
+
+ bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); }
+
+ bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); }
+
+ bool SetIntFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }
+
+ bool SetIndent(std::size_t value, FmtScope::value scope);
+ std::size_t GetIndent() const { return m_indent.get(); }
+
+ bool SetPreCommentIndent(std::size_t value, FmtScope::value scope);
+ std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
+ bool SetPostCommentIndent(std::size_t value, FmtScope::value scope);
+ std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
+
+ bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
+ FmtScope::value scope);
+ EMITTER_MANIP GetFlowType(GroupType::value groupType) const;
+
+ bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
+
+ bool SetFloatPrecision(std::size_t value, FmtScope::value scope);
+ std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }
+ bool SetDoublePrecision(std::size_t value, FmtScope::value scope);
+ std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }
+
+ private:
+ template <typename T>
+ void _Set(Setting<T>& fmt, T value, FmtScope::value scope);
+
+ void StartedNode();
+
+ private:
+ // basic state ok?
+ bool m_isGood;
+ std::string m_lastError;
+
+ // other state
+ Setting<EMITTER_MANIP> m_charset;
+ Setting<EMITTER_MANIP> m_strFmt;
+ Setting<EMITTER_MANIP> m_boolFmt;
+ Setting<EMITTER_MANIP> m_boolLengthFmt;
+ Setting<EMITTER_MANIP> m_boolCaseFmt;
+ Setting<EMITTER_MANIP> m_intFmt;
+ Setting<std::size_t> m_indent;
+ Setting<std::size_t> m_preCommentIndent, m_postCommentIndent;
+ Setting<EMITTER_MANIP> m_seqFmt;
+ Setting<EMITTER_MANIP> m_mapFmt;
+ Setting<EMITTER_MANIP> m_mapKeyFmt;
+ Setting<std::size_t> m_floatPrecision;
+ Setting<std::size_t> m_doublePrecision;
+
+ SettingChanges m_modifiedSettings;
+ SettingChanges m_globalModifiedSettings;
+
+ struct Group {
+ explicit Group(GroupType::value type_)
+ : type(type_), indent(0), childCount(0), longKey(false) {}
+
+ GroupType::value type;
+ FlowType::value flowType;
+ std::size_t indent;
+ std::size_t childCount;
+ bool longKey;
+
+ SettingChanges modifiedSettings;
+
+ EmitterNodeType::value NodeType() const {
+ if (type == GroupType::Seq) {
+ if (flowType == FlowType::Flow)
+ return EmitterNodeType::FlowSeq;
+ else
+ return EmitterNodeType::BlockSeq;
+ } else {
+ if (flowType == FlowType::Flow)
+ return EmitterNodeType::FlowMap;
+ else
+ return EmitterNodeType::BlockMap;
+ }
+
+ // can't get here
+ assert(false);
+ return EmitterNodeType::NoType;
+ }
+ };
+
+ std::vector<std::unique_ptr<Group>> m_groups;
+ std::size_t m_curIndent;
+ bool m_hasAnchor;
+ bool m_hasTag;
+ bool m_hasNonContent;
+ std::size_t m_docCount;
+};
+
+template <typename T>
+void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
+ switch (scope) {
+ case FmtScope::Local:
+ m_modifiedSettings.push(fmt.set(value));
+ break;
+ case FmtScope::Global:
+ fmt.set(value);
+ m_globalModifiedSettings.push(
+ fmt.set(value)); // this pushes an identity set, so when we restore,
+ // it restores to the value here, and not the previous one
+ break;
+ default:
+ assert(false);
+ }
+}
+}
+
+#endif // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/emitterutils.cpp b/lib/yamlcpp/src/emitterutils.cpp
new file mode 100644
index 0000000..147738a
--- /dev/null
+++ b/lib/yamlcpp/src/emitterutils.cpp
@@ -0,0 +1,483 @@
+#include <iomanip>
+#include <sstream>
+
+#include "emitterutils.h"
+#include "exp.h"
+#include "indentation.h"
+#include "regex_yaml.h"
+#include "regeximpl.h"
+#include "stringsource.h"
+#include "yaml-cpp/binary.h" // IWYU pragma: keep
+#include "yaml-cpp/ostream_wrapper.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+namespace Utils {
+namespace {
+enum { REPLACEMENT_CHARACTER = 0xFFFD };
+
+bool IsAnchorChar(int ch) { // test for ns-anchor-char
+ switch (ch) {
+ case ',':
+ case '[':
+ case ']':
+ case '{':
+ case '}': // c-flow-indicator
+ case ' ':
+ case '\t': // s-white
+ case 0xFEFF: // c-byte-order-mark
+ case 0xA:
+ case 0xD: // b-char
+ return false;
+ case 0x85:
+ return true;
+ }
+
+ if (ch < 0x20) {
+ return false;
+ }
+
+ if (ch < 0x7E) {
+ return true;
+ }
+
+ if (ch < 0xA0) {
+ return false;
+ }
+ if (ch >= 0xD800 && ch <= 0xDFFF) {
+ return false;
+ }
+ if ((ch & 0xFFFE) == 0xFFFE) {
+ return false;
+ }
+ if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) {
+ return false;
+ }
+ if (ch > 0x10FFFF) {
+ return false;
+ }
+
+ return true;
+}
+
+int Utf8BytesIndicated(char ch) {
+ int byteVal = static_cast<unsigned char>(ch);
+ switch (byteVal >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ return 1;
+ case 12:
+ case 13:
+ return 2;
+ case 14:
+ return 3;
+ case 15:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+bool IsTrailingByte(char ch) { return (ch & 0xC0) == 0x80; }
+
+bool GetNextCodePointAndAdvance(int& codePoint,
+ std::string::const_iterator& first,
+ std::string::const_iterator last) {
+ if (first == last)
+ return false;
+
+ int nBytes = Utf8BytesIndicated(*first);
+ if (nBytes < 1) {
+ // Bad lead byte
+ ++first;
+ codePoint = REPLACEMENT_CHARACTER;
+ return true;
+ }
+
+ if (nBytes == 1) {
+ codePoint = *first++;
+ return true;
+ }
+
+ // Gather bits from trailing bytes
+ codePoint = static_cast<unsigned char>(*first) & ~(0xFF << (7 - nBytes));
+ ++first;
+ --nBytes;
+ for (; nBytes > 0; ++first, --nBytes) {
+ if ((first == last) || !IsTrailingByte(*first)) {
+ codePoint = REPLACEMENT_CHARACTER;
+ break;
+ }
+ codePoint <<= 6;
+ codePoint |= *first & 0x3F;
+ }
+
+ // Check for illegal code points
+ if (codePoint > 0x10FFFF)
+ codePoint = REPLACEMENT_CHARACTER;
+ else if (codePoint >= 0xD800 && codePoint <= 0xDFFF)
+ codePoint = REPLACEMENT_CHARACTER;
+ else if ((codePoint & 0xFFFE) == 0xFFFE)
+ codePoint = REPLACEMENT_CHARACTER;
+ else if (codePoint >= 0xFDD0 && codePoint <= 0xFDEF)
+ codePoint = REPLACEMENT_CHARACTER;
+ return true;
+}
+
+void WriteCodePoint(ostream_wrapper& out, int codePoint) {
+ if (codePoint < 0 || codePoint > 0x10FFFF) {
+ codePoint = REPLACEMENT_CHARACTER;
+ }
+ if (codePoint < 0x7F) {
+ out << static_cast<char>(codePoint);
+ } else if (codePoint < 0x7FF) {
+ out << static_cast<char>(0xC0 | (codePoint >> 6))
+ << static_cast<char>(0x80 | (codePoint & 0x3F));
+ } else if (codePoint < 0xFFFF) {
+ out << static_cast<char>(0xE0 | (codePoint >> 12))
+ << static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F))
+ << static_cast<char>(0x80 | (codePoint & 0x3F));
+ } else {
+ out << static_cast<char>(0xF0 | (codePoint >> 18))
+ << static_cast<char>(0x80 | ((codePoint >> 12) & 0x3F))
+ << static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F))
+ << static_cast<char>(0x80 | (codePoint & 0x3F));
+ }
+}
+
+bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
+ bool allowOnlyAscii) {
+ // check against null
+ if (IsNullString(str)) {
+ return false;
+ }
+
+ // check the start
+ const RegEx& start = (flowType == FlowType::Flow ? Exp::PlainScalarInFlow()
+ : Exp::PlainScalar());
+ if (!start.Matches(str)) {
+ return false;
+ }
+
+ // and check the end for plain whitespace (which can't be faithfully kept in a
+ // plain scalar)
+ if (!str.empty() && *str.rbegin() == ' ') {
+ return false;
+ }
+
+ // then check until something is disallowed
+ static const RegEx& disallowed_flow =
+ Exp::EndScalarInFlow() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+ Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
+ Exp::Tab();
+ static const RegEx& disallowed_block =
+ Exp::EndScalar() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+ Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
+ Exp::Tab();
+ const RegEx& disallowed =
+ flowType == FlowType::Flow ? disallowed_flow : disallowed_block;
+
+ StringCharSource buffer(str.c_str(), str.size());
+ while (buffer) {
+ if (disallowed.Matches(buffer)) {
+ return false;
+ }
+ if (allowOnlyAscii && (0x80 <= static_cast<unsigned char>(buffer[0]))) {
+ return false;
+ }
+ ++buffer;
+ }
+
+ return true;
+}
+
+bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) {
+ // TODO: check for non-printable characters?
+ for (std::size_t i = 0; i < str.size(); i++) {
+ if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
+ return false;
+ }
+ if (str[i] == '\n') {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType,
+ bool escapeNonAscii) {
+ if (flowType == FlowType::Flow) {
+ return false;
+ }
+
+ // TODO: check for non-printable characters?
+ for (std::size_t i = 0; i < str.size(); i++) {
+ if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+void WriteDoubleQuoteEscapeSequence(ostream_wrapper& out, int codePoint) {
+ static const char hexDigits[] = "0123456789abcdef";
+
+ out << "\\";
+ int digits = 8;
+ if (codePoint < 0xFF) {
+ out << "x";
+ digits = 2;
+ } else if (codePoint < 0xFFFF) {
+ out << "u";
+ digits = 4;
+ } else {
+ out << "U";
+ digits = 8;
+ }
+
+ // Write digits into the escape sequence
+ for (; digits > 0; --digits)
+ out << hexDigits[(codePoint >> (4 * (digits - 1))) & 0xF];
+}
+
+bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (!IsAnchorChar(codePoint)) {
+ return false;
+ }
+
+ WriteCodePoint(out, codePoint);
+ }
+ return true;
+}
+}
+
+StringFormat::value ComputeStringFormat(const std::string& str,
+ EMITTER_MANIP strFormat,
+ FlowType::value flowType,
+ bool escapeNonAscii) {
+ switch (strFormat) {
+ case Auto:
+ if (IsValidPlainScalar(str, flowType, escapeNonAscii)) {
+ return StringFormat::Plain;
+ }
+ return StringFormat::DoubleQuoted;
+ case SingleQuoted:
+ if (IsValidSingleQuotedScalar(str, escapeNonAscii)) {
+ return StringFormat::SingleQuoted;
+ }
+ return StringFormat::DoubleQuoted;
+ case DoubleQuoted:
+ return StringFormat::DoubleQuoted;
+ case Literal:
+ if (IsValidLiteralScalar(str, flowType, escapeNonAscii)) {
+ return StringFormat::Literal;
+ }
+ return StringFormat::DoubleQuoted;
+ default:
+ break;
+ }
+
+ return StringFormat::DoubleQuoted;
+}
+
+bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str) {
+ out << "'";
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (codePoint == '\n') {
+ return false; // We can't handle a new line and the attendant indentation
+ // yet
+ }
+
+ if (codePoint == '\'') {
+ out << "''";
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ out << "'";
+ return true;
+}
+
+bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
+ bool escapeNonAscii) {
+ out << "\"";
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ switch (codePoint) {
+ case '\"':
+ out << "\\\"";
+ break;
+ case '\\':
+ out << "\\\\";
+ break;
+ case '\n':
+ out << "\\n";
+ break;
+ case '\t':
+ out << "\\t";
+ break;
+ case '\r':
+ out << "\\r";
+ break;
+ case '\b':
+ out << "\\b";
+ break;
+ default:
+ if (codePoint < 0x20 ||
+ (codePoint >= 0x80 &&
+ codePoint <= 0xA0)) { // Control characters and non-breaking space
+ WriteDoubleQuoteEscapeSequence(out, codePoint);
+ } else if (codePoint == 0xFEFF) { // Byte order marks (ZWNS) should be
+ // escaped (YAML 1.2, sec. 5.2)
+ WriteDoubleQuoteEscapeSequence(out, codePoint);
+ } else if (escapeNonAscii && codePoint > 0x7E) {
+ WriteDoubleQuoteEscapeSequence(out, codePoint);
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ }
+ out << "\"";
+ return true;
+}
+
+bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
+ std::size_t indent) {
+ out << "|\n";
+ out << IndentTo(indent);
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (codePoint == '\n') {
+ out << "\n" << IndentTo(indent);
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ return true;
+}
+
+bool WriteChar(ostream_wrapper& out, char ch) {
+ if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) {
+ out << ch;
+ } else if (ch == '\"') {
+ out << "\"\\\"\"";
+ } else if (ch == '\t') {
+ out << "\"\\t\"";
+ } else if (ch == '\n') {
+ out << "\"\\n\"";
+ } else if (ch == '\b') {
+ out << "\"\\b\"";
+ } else if (ch == '\\') {
+ out << "\"\\\\\"";
+ } else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') {
+ out << "\"" << ch << "\"";
+ } else {
+ out << "\"";
+ WriteDoubleQuoteEscapeSequence(out, ch);
+ out << "\"";
+ }
+ return true;
+}
+
+bool WriteComment(ostream_wrapper& out, const std::string& str,
+ std::size_t postCommentIndent) {
+ const std::size_t curIndent = out.col();
+ out << "#" << Indentation(postCommentIndent);
+ out.set_comment();
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (codePoint == '\n') {
+ out << "\n" << IndentTo(curIndent) << "#"
+ << Indentation(postCommentIndent);
+ out.set_comment();
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ return true;
+}
+
+bool WriteAlias(ostream_wrapper& out, const std::string& str) {
+ out << "*";
+ return WriteAliasName(out, str);
+}
+
+bool WriteAnchor(ostream_wrapper& out, const std::string& str) {
+ out << "&";
+ return WriteAliasName(out, str);
+}
+
+bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim) {
+ out << (verbatim ? "!<" : "!");
+ StringCharSource buffer(str.c_str(), str.size());
+ const RegEx& reValid = verbatim ? Exp::URI() : Exp::Tag();
+ while (buffer) {
+ int n = reValid.Match(buffer);
+ if (n <= 0) {
+ return false;
+ }
+
+ while (--n >= 0) {
+ out << buffer[0];
+ ++buffer;
+ }
+ }
+ if (verbatim) {
+ out << ">";
+ }
+ return true;
+}
+
+bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
+ const std::string& tag) {
+ out << "!";
+ StringCharSource prefixBuffer(prefix.c_str(), prefix.size());
+ while (prefixBuffer) {
+ int n = Exp::URI().Match(prefixBuffer);
+ if (n <= 0) {
+ return false;
+ }
+
+ while (--n >= 0) {
+ out << prefixBuffer[0];
+ ++prefixBuffer;
+ }
+ }
+
+ out << "!";
+ StringCharSource tagBuffer(tag.c_str(), tag.size());
+ while (tagBuffer) {
+ int n = Exp::Tag().Match(tagBuffer);
+ if (n <= 0) {
+ return false;
+ }
+
+ while (--n >= 0) {
+ out << tagBuffer[0];
+ ++tagBuffer;
+ }
+ }
+ return true;
+}
+
+bool WriteBinary(ostream_wrapper& out, const Binary& binary) {
+ WriteDoubleQuotedString(out, EncodeBase64(binary.data(), binary.size()),
+ false);
+ return true;
+}
+}
+}
diff --git a/lib/yamlcpp/src/emitterutils.h b/lib/yamlcpp/src/emitterutils.h
new file mode 100644
index 0000000..6cc7319
--- /dev/null
+++ b/lib/yamlcpp/src/emitterutils.h
@@ -0,0 +1,50 @@
+#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+#include "emitterstate.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+class ostream_wrapper;
+} // namespace YAML
+
+namespace YAML {
+class Binary;
+
+struct StringFormat {
+ enum value { Plain, SingleQuoted, DoubleQuoted, Literal };
+};
+
+namespace Utils {
+StringFormat::value ComputeStringFormat(const std::string& str,
+ EMITTER_MANIP strFormat,
+ FlowType::value flowType,
+ bool escapeNonAscii);
+
+bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
+bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
+ bool escapeNonAscii);
+bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
+ std::size_t indent);
+bool WriteChar(ostream_wrapper& out, char ch);
+bool WriteComment(ostream_wrapper& out, const std::string& str,
+ std::size_t postCommentIndent);
+bool WriteAlias(ostream_wrapper& out, const std::string& str);
+bool WriteAnchor(ostream_wrapper& out, const std::string& str);
+bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
+bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
+ const std::string& tag);
+bool WriteBinary(ostream_wrapper& out, const Binary& binary);
+}
+}
+
+#endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/exceptions.cpp b/lib/yamlcpp/src/exceptions.cpp
new file mode 100644
index 0000000..9b6d891
--- /dev/null
+++ b/lib/yamlcpp/src/exceptions.cpp
@@ -0,0 +1,31 @@
+#include "yaml-cpp/exceptions.h"
+
+// This is here for compatibility with older versions of Visual Studio
+// which don't support noexcept
+#ifdef _MSC_VER
+ #define YAML_CPP_NOEXCEPT _NOEXCEPT
+#else
+ #define YAML_CPP_NOEXCEPT noexcept
+#endif
+
+namespace YAML {
+
+// These destructors are defined out-of-line so the vtable is only emitted once.
+Exception::~Exception() YAML_CPP_NOEXCEPT {}
+ParserException::~ParserException() YAML_CPP_NOEXCEPT {}
+RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {}
+InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {}
+KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {}
+InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {}
+BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {}
+BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {}
+BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {}
+BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {}
+BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {}
+EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {}
+BadFile::~BadFile() YAML_CPP_NOEXCEPT {}
+}
+
+#undef YAML_CPP_NOEXCEPT
+
+
diff --git a/lib/yamlcpp/src/exp.cpp b/lib/yamlcpp/src/exp.cpp
new file mode 100644
index 0000000..695440a
--- /dev/null
+++ b/lib/yamlcpp/src/exp.cpp
@@ -0,0 +1,136 @@
+#include <sstream>
+
+#include "exp.h"
+#include "stream.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+namespace Exp {
+unsigned ParseHex(const std::string& str, const Mark& mark) {
+ unsigned value = 0;
+ for (std::size_t i = 0; i < str.size(); i++) {
+ char ch = str[i];
+ int digit = 0;
+ if ('a' <= ch && ch <= 'f')
+ digit = ch - 'a' + 10;
+ else if ('A' <= ch && ch <= 'F')
+ digit = ch - 'A' + 10;
+ else if ('0' <= ch && ch <= '9')
+ digit = ch - '0';
+ else
+ throw ParserException(mark, ErrorMsg::INVALID_HEX);
+
+ value = (value << 4) + digit;
+ }
+
+ return value;
+}
+
+std::string Str(unsigned ch) { return std::string(1, static_cast<char>(ch)); }
+
+// Escape
+// . Translates the next 'codeLength' characters into a hex number and returns
+// the result.
+// . Throws if it's not actually hex.
+std::string Escape(Stream& in, int codeLength) {
+ // grab string
+ std::string str;
+ for (int i = 0; i < codeLength; i++)
+ str += in.get();
+
+ // get the value
+ unsigned value = ParseHex(str, in.mark());
+
+ // legal unicode?
+ if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
+ std::stringstream msg;
+ msg << ErrorMsg::INVALID_UNICODE << value;
+ throw ParserException(in.mark(), msg.str());
+ }
+
+ // now break it up into chars
+ if (value <= 0x7F)
+ return Str(value);
+ else if (value <= 0x7FF)
+ return Str(0xC0 + (value >> 6)) + Str(0x80 + (value & 0x3F));
+ else if (value <= 0xFFFF)
+ return Str(0xE0 + (value >> 12)) + Str(0x80 + ((value >> 6) & 0x3F)) +
+ Str(0x80 + (value & 0x3F));
+ else
+ return Str(0xF0 + (value >> 18)) + Str(0x80 + ((value >> 12) & 0x3F)) +
+ Str(0x80 + ((value >> 6) & 0x3F)) + Str(0x80 + (value & 0x3F));
+}
+
+// Escape
+// . Escapes the sequence starting 'in' (it must begin with a '\' or single
+// quote)
+// and returns the result.
+// . Throws if it's an unknown escape character.
+std::string Escape(Stream& in) {
+ // eat slash
+ char escape = in.get();
+
+ // switch on escape character
+ char ch = in.get();
+
+ // first do single quote, since it's easier
+ if (escape == '\'' && ch == '\'')
+ return "\'";
+
+ // now do the slash (we're not gonna check if it's a slash - you better pass
+ // one!)
+ switch (ch) {
+ case '0':
+ return std::string(1, '\x00');
+ case 'a':
+ return "\x07";
+ case 'b':
+ return "\x08";
+ case 't':
+ case '\t':
+ return "\x09";
+ case 'n':
+ return "\x0A";
+ case 'v':
+ return "\x0B";
+ case 'f':
+ return "\x0C";
+ case 'r':
+ return "\x0D";
+ case 'e':
+ return "\x1B";
+ case ' ':
+ return "\x20";
+ case '\"':
+ return "\"";
+ case '\'':
+ return "\'";
+ case '\\':
+ return "\\";
+ case '/':
+ return "/";
+ case 'N':
+ return "\x85";
+ case '_':
+ return "\xA0";
+ case 'L':
+ return "\xE2\x80\xA8"; // LS (#x2028)
+ case 'P':
+ return "\xE2\x80\xA9"; // PS (#x2029)
+ case 'x':
+ return Escape(in, 2);
+ case 'u':
+ return Escape(in, 4);
+ case 'U':
+ return Escape(in, 8);
+ }
+
+ std::stringstream msg;
+ throw ParserException(in.mark(), std::string(ErrorMsg::INVALID_ESCAPE) + ch);
+}
+}
+}
diff --git a/lib/yamlcpp/src/exp.h b/lib/yamlcpp/src/exp.h
new file mode 100644
index 0000000..7c02cf6
--- /dev/null
+++ b/lib/yamlcpp/src/exp.h
@@ -0,0 +1,222 @@
+#ifndef EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <ios>
+#include <string>
+
+#include "regex_yaml.h"
+#include "stream.h"
+
+namespace YAML {
+////////////////////////////////////////////////////////////////////////////////
+// Here we store a bunch of expressions for matching different parts of the
+// file.
+
+namespace Exp {
+// misc
+inline const RegEx& Empty() {
+ static const RegEx e;
+ return e;
+}
+inline const RegEx& Space() {
+ static const RegEx e = RegEx(' ');
+ return e;
+}
+inline const RegEx& Tab() {
+ static const RegEx e = RegEx('\t');
+ return e;
+}
+inline const RegEx& Blank() {
+ static const RegEx e = Space() || Tab();
+ return e;
+}
+inline const RegEx& Break() {
+ static const RegEx e = RegEx('\n') || RegEx("\r\n");
+ return e;
+}
+inline const RegEx& BlankOrBreak() {
+ static const RegEx e = Blank() || Break();
+ return e;
+}
+inline const RegEx& Digit() {
+ static const RegEx e = RegEx('0', '9');
+ return e;
+}
+inline const RegEx& Alpha() {
+ static const RegEx e = RegEx('a', 'z') || RegEx('A', 'Z');
+ return e;
+}
+inline const RegEx& AlphaNumeric() {
+ static const RegEx e = Alpha() || Digit();
+ return e;
+}
+inline const RegEx& Word() {
+ static const RegEx e = AlphaNumeric() || RegEx('-');
+ return e;
+}
+inline const RegEx& Hex() {
+ static const RegEx e = Digit() || RegEx('A', 'F') || RegEx('a', 'f');
+ return e;
+}
+// Valid Unicode code points that are not part of c-printable (YAML 1.2, sec.
+// 5.1)
+inline const RegEx& NotPrintable() {
+ static const RegEx e =
+ RegEx(0) ||
+ RegEx("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x7F", REGEX_OR) ||
+ RegEx(0x0E, 0x1F) ||
+ (RegEx('\xC2') + (RegEx('\x80', '\x84') || RegEx('\x86', '\x9F')));
+ return e;
+}
+inline const RegEx& Utf8_ByteOrderMark() {
+ static const RegEx e = RegEx("\xEF\xBB\xBF");
+ return e;
+}
+
+// actual tags
+
+inline const RegEx& DocStart() {
+ static const RegEx e = RegEx("---") + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& DocEnd() {
+ static const RegEx e = RegEx("...") + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& DocIndicator() {
+ static const RegEx e = DocStart() || DocEnd();
+ return e;
+}
+inline const RegEx& BlockEntry() {
+ static const RegEx e = RegEx('-') + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& Key() {
+ static const RegEx e = RegEx('?') + BlankOrBreak();
+ return e;
+}
+inline const RegEx& KeyInFlow() {
+ static const RegEx e = RegEx('?') + BlankOrBreak();
+ return e;
+}
+inline const RegEx& Value() {
+ static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& ValueInFlow() {
+ static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx(",}", REGEX_OR));
+ return e;
+}
+inline const RegEx& ValueInJSONFlow() {
+ static const RegEx e = RegEx(':');
+ return e;
+}
+inline const RegEx Comment() {
+ static const RegEx e = RegEx('#');
+ return e;
+}
+inline const RegEx& Anchor() {
+ static const RegEx e = !(RegEx("[]{},", REGEX_OR) || BlankOrBreak());
+ return e;
+}
+inline const RegEx& AnchorEnd() {
+ static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak();
+ return e;
+}
+inline const RegEx& URI() {
+ static const RegEx e = Word() || RegEx("#;/?:@&=+$,_.!~*'()[]", REGEX_OR) ||
+ (RegEx('%') + Hex() + Hex());
+ return e;
+}
+inline const RegEx& Tag() {
+ static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'()", REGEX_OR) ||
+ (RegEx('%') + Hex() + Hex());
+ return e;
+}
+
+// Plain scalar rules:
+// . Cannot start with a blank.
+// . Can never start with any of , [ ] { } # & * ! | > \' \" % @ `
+// . In the block context - ? : must be not be followed with a space.
+// . In the flow context ? is illegal and : and - must not be followed with a
+// space.
+inline const RegEx& PlainScalar() {
+ static const RegEx e =
+ !(BlankOrBreak() || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+ (RegEx("-?:", REGEX_OR) + (BlankOrBreak() || RegEx())));
+ return e;
+}
+inline const RegEx& PlainScalarInFlow() {
+ static const RegEx e =
+ !(BlankOrBreak() || RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+ (RegEx("-:", REGEX_OR) + Blank()));
+ return e;
+}
+inline const RegEx& EndScalar() {
+ static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& EndScalarInFlow() {
+ static const RegEx e =
+ (RegEx(':') + (BlankOrBreak() || RegEx() || RegEx(",]}", REGEX_OR))) ||
+ RegEx(",?[]{}", REGEX_OR);
+ return e;
+}
+
+inline const RegEx& ScanScalarEndInFlow() {
+ static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
+ return e;
+}
+
+inline const RegEx& ScanScalarEnd() {
+ static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
+ return e;
+}
+inline const RegEx& EscSingleQuote() {
+ static const RegEx e = RegEx("\'\'");
+ return e;
+}
+inline const RegEx& EscBreak() {
+ static const RegEx e = RegEx('\\') + Break();
+ return e;
+}
+
+inline const RegEx& ChompIndicator() {
+ static const RegEx e = RegEx("+-", REGEX_OR);
+ return e;
+}
+inline const RegEx& Chomp() {
+ static const RegEx e = (ChompIndicator() + Digit()) ||
+ (Digit() + ChompIndicator()) || ChompIndicator() ||
+ Digit();
+ return e;
+}
+
+// and some functions
+std::string Escape(Stream& in);
+} // namespace Exp
+
+namespace Keys {
+const char Directive = '%';
+const char FlowSeqStart = '[';
+const char FlowSeqEnd = ']';
+const char FlowMapStart = '{';
+const char FlowMapEnd = '}';
+const char FlowEntry = ',';
+const char Alias = '*';
+const char Anchor = '&';
+const char Tag = '!';
+const char LiteralScalar = '|';
+const char FoldedScalar = '>';
+const char VerbatimTagStart = '<';
+const char VerbatimTagEnd = '>';
+} // namespace Keys
+} // namespace YAML
+
+#endif // EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/indentation.h b/lib/yamlcpp/src/indentation.h
new file mode 100644
index 0000000..1a2ccae
--- /dev/null
+++ b/lib/yamlcpp/src/indentation.h
@@ -0,0 +1,41 @@
+#ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <iostream>
+#include <cstddef>
+
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+struct Indentation {
+ Indentation(std::size_t n_) : n(n_) {}
+ std::size_t n;
+};
+
+inline ostream_wrapper& operator<<(ostream_wrapper& out,
+ const Indentation& indent) {
+ for (std::size_t i = 0; i < indent.n; i++)
+ out << ' ';
+ return out;
+}
+
+struct IndentTo {
+ IndentTo(std::size_t n_) : n(n_) {}
+ std::size_t n;
+};
+
+inline ostream_wrapper& operator<<(ostream_wrapper& out,
+ const IndentTo& indent) {
+ while (out.col() < indent.n)
+ out << ' ';
+ return out;
+}
+}
+
+#endif // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/memory.cpp b/lib/yamlcpp/src/memory.cpp
new file mode 100644
index 0000000..e5f8a9d
--- /dev/null
+++ b/lib/yamlcpp/src/memory.cpp
@@ -0,0 +1,26 @@
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+
+void memory_holder::merge(memory_holder& rhs) {
+ if (m_pMemory == rhs.m_pMemory)
+ return;
+
+ m_pMemory->merge(*rhs.m_pMemory);
+ rhs.m_pMemory = m_pMemory;
+}
+
+node& memory::create_node() {
+ shared_node pNode(new node);
+ m_nodes.insert(pNode);
+ return *pNode;
+}
+
+void memory::merge(const memory& rhs) {
+ m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
+}
+}
+}
diff --git a/lib/yamlcpp/src/node.cpp b/lib/yamlcpp/src/node.cpp
new file mode 100644
index 0000000..2088e13
--- /dev/null
+++ b/lib/yamlcpp/src/node.cpp
@@ -0,0 +1,12 @@
+#include "yaml-cpp/node/node.h"
+#include "nodebuilder.h"
+#include "nodeevents.h"
+
+namespace YAML {
+Node Clone(const Node& node) {
+ NodeEvents events(node);
+ NodeBuilder builder;
+ events.Emit(builder);
+ return builder.Root();
+}
+}
diff --git a/lib/yamlcpp/src/node_data.cpp b/lib/yamlcpp/src/node_data.cpp
new file mode 100644
index 0000000..77cd465
--- /dev/null
+++ b/lib/yamlcpp/src/node_data.cpp
@@ -0,0 +1,300 @@
+#include <assert.h>
+#include <iterator>
+#include <sstream>
+
+#include "yaml-cpp/exceptions.h"
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep
+#include "yaml-cpp/node/detail/node_data.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+
+std::string node_data::empty_scalar;
+
+node_data::node_data()
+ : m_isDefined(false),
+ m_mark(Mark::null_mark()),
+ m_type(NodeType::Null),
+ m_style(EmitterStyle::Default),
+ m_seqSize(0) {}
+
+void node_data::mark_defined() {
+ if (m_type == NodeType::Undefined)
+ m_type = NodeType::Null;
+ m_isDefined = true;
+}
+
+void node_data::set_mark(const Mark& mark) { m_mark = mark; }
+
+void node_data::set_type(NodeType::value type) {
+ if (type == NodeType::Undefined) {
+ m_type = type;
+ m_isDefined = false;
+ return;
+ }
+
+ m_isDefined = true;
+ if (type == m_type)
+ return;
+
+ m_type = type;
+
+ switch (m_type) {
+ case NodeType::Null:
+ break;
+ case NodeType::Scalar:
+ m_scalar.clear();
+ break;
+ case NodeType::Sequence:
+ reset_sequence();
+ break;
+ case NodeType::Map:
+ reset_map();
+ break;
+ case NodeType::Undefined:
+ assert(false);
+ break;
+ }
+}
+
+void node_data::set_tag(const std::string& tag) { m_tag = tag; }
+
+void node_data::set_style(EmitterStyle::value style) { m_style = style; }
+
+void node_data::set_null() {
+ m_isDefined = true;
+ m_type = NodeType::Null;
+}
+
+void node_data::set_scalar(const std::string& scalar) {
+ m_isDefined = true;
+ m_type = NodeType::Scalar;
+ m_scalar = scalar;
+}
+
+// size/iterator
+std::size_t node_data::size() const {
+ if (!m_isDefined)
+ return 0;
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ compute_seq_size();
+ return m_seqSize;
+ case NodeType::Map:
+ compute_map_size();
+ return m_map.size() - m_undefinedPairs.size();
+ default:
+ return 0;
+ }
+ return 0;
+}
+
+void node_data::compute_seq_size() const {
+ while (m_seqSize < m_sequence.size() && m_sequence[m_seqSize]->is_defined())
+ m_seqSize++;
+}
+
+void node_data::compute_map_size() const {
+ kv_pairs::iterator it = m_undefinedPairs.begin();
+ while (it != m_undefinedPairs.end()) {
+ kv_pairs::iterator jt = std::next(it);
+ if (it->first->is_defined() && it->second->is_defined())
+ m_undefinedPairs.erase(it);
+ it = jt;
+ }
+}
+
+const_node_iterator node_data::begin() const {
+ if (!m_isDefined)
+ return const_node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return const_node_iterator(m_sequence.begin());
+ case NodeType::Map:
+ return const_node_iterator(m_map.begin(), m_map.end());
+ default:
+ return const_node_iterator();
+ }
+}
+
+node_iterator node_data::begin() {
+ if (!m_isDefined)
+ return node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return node_iterator(m_sequence.begin());
+ case NodeType::Map:
+ return node_iterator(m_map.begin(), m_map.end());
+ default:
+ return node_iterator();
+ }
+}
+
+const_node_iterator node_data::end() const {
+ if (!m_isDefined)
+ return const_node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return const_node_iterator(m_sequence.end());
+ case NodeType::Map:
+ return const_node_iterator(m_map.end(), m_map.end());
+ default:
+ return const_node_iterator();
+ }
+}
+
+node_iterator node_data::end() {
+ if (!m_isDefined)
+ return node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return node_iterator(m_sequence.end());
+ case NodeType::Map:
+ return node_iterator(m_map.end(), m_map.end());
+ default:
+ return node_iterator();
+ }
+}
+
+// sequence
+void node_data::push_back(node& node, shared_memory_holder /* pMemory */) {
+ if (m_type == NodeType::Undefined || m_type == NodeType::Null) {
+ m_type = NodeType::Sequence;
+ reset_sequence();
+ }
+
+ if (m_type != NodeType::Sequence)
+ throw BadPushback();
+
+ m_sequence.push_back(&node);
+}
+
+void node_data::insert(node& key, node& value, shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ insert_map_pair(key, value);
+}
+
+// indexing
+node* node_data::get(node& key, shared_memory_holder /* pMemory */) const {
+ if (m_type != NodeType::Map) {
+ return NULL;
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->is(key))
+ return it->second;
+ }
+
+ return NULL;
+}
+
+node& node_data::get(node& key, shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->is(key))
+ return *it->second;
+ }
+
+ node& value = pMemory->create_node();
+ insert_map_pair(key, value);
+ return value;
+}
+
+bool node_data::remove(node& key, shared_memory_holder /* pMemory */) {
+ if (m_type != NodeType::Map)
+ return false;
+
+ for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->is(key)) {
+ m_map.erase(it);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void node_data::reset_sequence() {
+ m_sequence.clear();
+ m_seqSize = 0;
+}
+
+void node_data::reset_map() {
+ m_map.clear();
+ m_undefinedPairs.clear();
+}
+
+void node_data::insert_map_pair(node& key, node& value) {
+ m_map.emplace_back(&key, &value);
+
+ if (!key.is_defined() || !value.is_defined())
+ m_undefinedPairs.emplace_back(&key, &value);
+}
+
+void node_data::convert_to_map(shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Undefined:
+ case NodeType::Null:
+ reset_map();
+ m_type = NodeType::Map;
+ break;
+ case NodeType::Sequence:
+ convert_sequence_to_map(pMemory);
+ break;
+ case NodeType::Map:
+ break;
+ case NodeType::Scalar:
+ assert(false);
+ break;
+ }
+}
+
+void node_data::convert_sequence_to_map(shared_memory_holder pMemory) {
+ assert(m_type == NodeType::Sequence);
+
+ reset_map();
+ for (std::size_t i = 0; i < m_sequence.size(); i++) {
+ std::stringstream stream;
+ stream << i;
+
+ node& key = pMemory->create_node();
+ key.set_scalar(stream.str());
+ insert_map_pair(key, *m_sequence[i]);
+ }
+
+ reset_sequence();
+ m_type = NodeType::Map;
+}
+}
+}
diff --git a/lib/yamlcpp/src/nodebuilder.cpp b/lib/yamlcpp/src/nodebuilder.cpp
new file mode 100644
index 0000000..093d2ef
--- /dev/null
+++ b/lib/yamlcpp/src/nodebuilder.cpp
@@ -0,0 +1,130 @@
+#include <assert.h>
+#include <cassert>
+
+#include "nodebuilder.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+struct Mark;
+
+NodeBuilder::NodeBuilder()
+ : m_pMemory(new detail::memory_holder), m_pRoot(0), m_mapDepth(0) {
+ m_anchors.push_back(0); // since the anchors start at 1
+}
+
+NodeBuilder::~NodeBuilder() {}
+
+Node NodeBuilder::Root() {
+ if (!m_pRoot)
+ return Node();
+
+ return Node(*m_pRoot, m_pMemory);
+}
+
+void NodeBuilder::OnDocumentStart(const Mark&) {}
+
+void NodeBuilder::OnDocumentEnd() {}
+
+void NodeBuilder::OnNull(const Mark& mark, anchor_t anchor) {
+ detail::node& node = Push(mark, anchor);
+ node.set_null();
+ Pop();
+}
+
+void NodeBuilder::OnAlias(const Mark& /* mark */, anchor_t anchor) {
+ detail::node& node = *m_anchors[anchor];
+ Push(node);
+ Pop();
+}
+
+void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value) {
+ detail::node& node = Push(mark, anchor);
+ node.set_scalar(value);
+ node.set_tag(tag);
+ Pop();
+}
+
+void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
+ detail::node& node = Push(mark, anchor);
+ node.set_tag(tag);
+ node.set_type(NodeType::Sequence);
+ node.set_style(style);
+}
+
+void NodeBuilder::OnSequenceEnd() { Pop(); }
+
+void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
+ detail::node& node = Push(mark, anchor);
+ node.set_type(NodeType::Map);
+ node.set_tag(tag);
+ node.set_style(style);
+ m_mapDepth++;
+}
+
+void NodeBuilder::OnMapEnd() {
+ assert(m_mapDepth > 0);
+ m_mapDepth--;
+ Pop();
+}
+
+detail::node& NodeBuilder::Push(const Mark& mark, anchor_t anchor) {
+ detail::node& node = m_pMemory->create_node();
+ node.set_mark(mark);
+ RegisterAnchor(anchor, node);
+ Push(node);
+ return node;
+}
+
+void NodeBuilder::Push(detail::node& node) {
+ const bool needsKey =
+ (!m_stack.empty() && m_stack.back()->type() == NodeType::Map &&
+ m_keys.size() < m_mapDepth);
+
+ m_stack.push_back(&node);
+ if (needsKey)
+ m_keys.push_back(PushedKey(&node, false));
+}
+
+void NodeBuilder::Pop() {
+ assert(!m_stack.empty());
+ if (m_stack.size() == 1) {
+ m_pRoot = m_stack[0];
+ m_stack.pop_back();
+ return;
+ }
+
+ detail::node& node = *m_stack.back();
+ m_stack.pop_back();
+
+ detail::node& collection = *m_stack.back();
+
+ if (collection.type() == NodeType::Sequence) {
+ collection.push_back(node, m_pMemory);
+ } else if (collection.type() == NodeType::Map) {
+ assert(!m_keys.empty());
+ PushedKey& key = m_keys.back();
+ if (key.second) {
+ collection.insert(*key.first, node, m_pMemory);
+ m_keys.pop_back();
+ } else {
+ key.second = true;
+ }
+ } else {
+ assert(false);
+ m_stack.clear();
+ }
+}
+
+void NodeBuilder::RegisterAnchor(anchor_t anchor, detail::node& node) {
+ if (anchor) {
+ assert(anchor == m_anchors.size());
+ m_anchors.push_back(&node);
+ }
+}
+}
diff --git a/lib/yamlcpp/src/nodebuilder.h b/lib/yamlcpp/src/nodebuilder.h
new file mode 100644
index 0000000..a6a47f0
--- /dev/null
+++ b/lib/yamlcpp/src/nodebuilder.h
@@ -0,0 +1,70 @@
+#ifndef NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+class Node;
+
+class NodeBuilder : public EventHandler {
+ public:
+ NodeBuilder();
+ virtual ~NodeBuilder();
+
+ Node Root();
+
+ virtual void OnDocumentStart(const Mark& mark);
+ virtual void OnDocumentEnd();
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor);
+ virtual void OnAlias(const Mark& mark, anchor_t anchor);
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value);
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnSequenceEnd();
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnMapEnd();
+
+ private:
+ detail::node& Push(const Mark& mark, anchor_t anchor);
+ void Push(detail::node& node);
+ void Pop();
+ void RegisterAnchor(anchor_t anchor, detail::node& node);
+
+ private:
+ detail::shared_memory_holder m_pMemory;
+ detail::node* m_pRoot;
+
+ typedef std::vector<detail::node*> Nodes;
+ Nodes m_stack;
+ Nodes m_anchors;
+
+ typedef std::pair<detail::node*, bool> PushedKey;
+ std::vector<PushedKey> m_keys;
+ std::size_t m_mapDepth;
+};
+}
+
+#endif // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/nodeevents.cpp b/lib/yamlcpp/src/nodeevents.cpp
new file mode 100644
index 0000000..82261fe
--- /dev/null
+++ b/lib/yamlcpp/src/nodeevents.cpp
@@ -0,0 +1,101 @@
+#include "nodeevents.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+void NodeEvents::AliasManager::RegisterReference(const detail::node& node) {
+ m_anchorByIdentity.insert(std::make_pair(node.ref(), _CreateNewAnchor()));
+}
+
+anchor_t NodeEvents::AliasManager::LookupAnchor(
+ const detail::node& node) const {
+ AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(node.ref());
+ if (it == m_anchorByIdentity.end())
+ return 0;
+ return it->second;
+}
+
+NodeEvents::NodeEvents(const Node& node)
+ : m_pMemory(node.m_pMemory), m_root(node.m_pNode) {
+ if (m_root)
+ Setup(*m_root);
+}
+
+void NodeEvents::Setup(const detail::node& node) {
+ int& refCount = m_refCount[node.ref()];
+ refCount++;
+ if (refCount > 1)
+ return;
+
+ if (node.type() == NodeType::Sequence) {
+ for (detail::const_node_iterator it = node.begin(); it != node.end(); ++it)
+ Setup(**it);
+ } else if (node.type() == NodeType::Map) {
+ for (detail::const_node_iterator it = node.begin(); it != node.end();
+ ++it) {
+ Setup(*it->first);
+ Setup(*it->second);
+ }
+ }
+}
+
+void NodeEvents::Emit(EventHandler& handler) {
+ AliasManager am;
+
+ handler.OnDocumentStart(Mark());
+ if (m_root)
+ Emit(*m_root, handler, am);
+ handler.OnDocumentEnd();
+}
+
+void NodeEvents::Emit(const detail::node& node, EventHandler& handler,
+ AliasManager& am) const {
+ anchor_t anchor = NullAnchor;
+ if (IsAliased(node)) {
+ anchor = am.LookupAnchor(node);
+ if (anchor) {
+ handler.OnAlias(Mark(), anchor);
+ return;
+ }
+
+ am.RegisterReference(node);
+ anchor = am.LookupAnchor(node);
+ }
+
+ switch (node.type()) {
+ case NodeType::Undefined:
+ break;
+ case NodeType::Null:
+ handler.OnNull(Mark(), anchor);
+ break;
+ case NodeType::Scalar:
+ handler.OnScalar(Mark(), node.tag(), anchor, node.scalar());
+ break;
+ case NodeType::Sequence:
+ handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style());
+ for (detail::const_node_iterator it = node.begin(); it != node.end();
+ ++it)
+ Emit(**it, handler, am);
+ handler.OnSequenceEnd();
+ break;
+ case NodeType::Map:
+ handler.OnMapStart(Mark(), node.tag(), anchor, node.style());
+ for (detail::const_node_iterator it = node.begin(); it != node.end();
+ ++it) {
+ Emit(*it->first, handler, am);
+ Emit(*it->second, handler, am);
+ }
+ handler.OnMapEnd();
+ break;
+ }
+}
+
+bool NodeEvents::IsAliased(const detail::node& node) const {
+ RefCount::const_iterator it = m_refCount.find(node.ref());
+ return it != m_refCount.end() && it->second > 1;
+}
+}
diff --git a/lib/yamlcpp/src/nodeevents.h b/lib/yamlcpp/src/nodeevents.h
new file mode 100644
index 0000000..49c18eb
--- /dev/null
+++ b/lib/yamlcpp/src/nodeevents.h
@@ -0,0 +1,64 @@
+#ifndef NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <map>
+#include <vector>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+class EventHandler;
+class Node;
+
+class NodeEvents {
+ public:
+ explicit NodeEvents(const Node& node);
+
+ void Emit(EventHandler& handler);
+
+ private:
+ class AliasManager {
+ public:
+ AliasManager() : m_curAnchor(0) {}
+
+ void RegisterReference(const detail::node& node);
+ anchor_t LookupAnchor(const detail::node& node) const;
+
+ private:
+ anchor_t _CreateNewAnchor() { return ++m_curAnchor; }
+
+ private:
+ typedef std::map<const detail::node_ref*, anchor_t> AnchorByIdentity;
+ AnchorByIdentity m_anchorByIdentity;
+
+ anchor_t m_curAnchor;
+ };
+
+ void Setup(const detail::node& node);
+ void Emit(const detail::node& node, EventHandler& handler,
+ AliasManager& am) const;
+ bool IsAliased(const detail::node& node) const;
+
+ private:
+ detail::shared_memory_holder m_pMemory;
+ detail::node* m_root;
+
+ typedef std::map<const detail::node_ref*, int> RefCount;
+ RefCount m_refCount;
+};
+}
+
+#endif // NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/null.cpp b/lib/yamlcpp/src/null.cpp
new file mode 100644
index 0000000..d12dd08
--- /dev/null
+++ b/lib/yamlcpp/src/null.cpp
@@ -0,0 +1,10 @@
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+_Null Null;
+
+bool IsNullString(const std::string& str) {
+ return str.empty() || str == "~" || str == "null" || str == "Null" ||
+ str == "NULL";
+}
+}
diff --git a/lib/yamlcpp/src/ostream_wrapper.cpp b/lib/yamlcpp/src/ostream_wrapper.cpp
new file mode 100644
index 0000000..357fc00
--- /dev/null
+++ b/lib/yamlcpp/src/ostream_wrapper.cpp
@@ -0,0 +1,57 @@
+#include "yaml-cpp/ostream_wrapper.h"
+
+#include <algorithm>
+#include <cstring>
+#include <iostream>
+
+namespace YAML {
+ostream_wrapper::ostream_wrapper()
+ : m_buffer(1, '\0'),
+ m_pStream(0),
+ m_pos(0),
+ m_row(0),
+ m_col(0),
+ m_comment(false) {}
+
+ostream_wrapper::ostream_wrapper(std::ostream& stream)
+ : m_pStream(&stream), m_pos(0), m_row(0), m_col(0), m_comment(false) {}
+
+ostream_wrapper::~ostream_wrapper() {}
+
+void ostream_wrapper::write(const std::string& str) {
+ if (m_pStream) {
+ m_pStream->write(str.c_str(), str.size());
+ } else {
+ m_buffer.resize(std::max(m_buffer.size(), m_pos + str.size() + 1));
+ std::copy(str.begin(), str.end(), m_buffer.begin() + m_pos);
+ }
+
+ for (std::size_t i = 0; i < str.size(); i++) {
+ update_pos(str[i]);
+ }
+}
+
+void ostream_wrapper::write(const char* str, std::size_t size) {
+ if (m_pStream) {
+ m_pStream->write(str, size);
+ } else {
+ m_buffer.resize(std::max(m_buffer.size(), m_pos + size + 1));
+ std::copy(str, str + size, m_buffer.begin() + m_pos);
+ }
+
+ for (std::size_t i = 0; i < size; i++) {
+ update_pos(str[i]);
+ }
+}
+
+void ostream_wrapper::update_pos(char ch) {
+ m_pos++;
+ m_col++;
+
+ if (ch == '\n') {
+ m_row++;
+ m_col = 0;
+ m_comment = false;
+ }
+}
+}
diff --git a/lib/yamlcpp/src/parse.cpp b/lib/yamlcpp/src/parse.cpp
new file mode 100644
index 0000000..0b2ae4a
--- /dev/null
+++ b/lib/yamlcpp/src/parse.cpp
@@ -0,0 +1,72 @@
+#include "yaml-cpp/node/parse.h"
+
+#include <fstream>
+#include <sstream>
+
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/parser.h"
+#include "nodebuilder.h"
+
+namespace YAML {
+Node Load(const std::string& input) {
+ std::stringstream stream(input);
+ return Load(stream);
+}
+
+Node Load(const char* input) {
+ std::stringstream stream(input);
+ return Load(stream);
+}
+
+Node Load(std::istream& input) {
+ Parser parser(input);
+ NodeBuilder builder;
+ if (!parser.HandleNextDocument(builder)) {
+ return Node();
+ }
+
+ return builder.Root();
+}
+
+Node LoadFile(const std::string& filename) {
+ std::ifstream fin(filename.c_str());
+ if (!fin) {
+ throw BadFile();
+ }
+ return Load(fin);
+}
+
+std::vector<Node> LoadAll(const std::string& input) {
+ std::stringstream stream(input);
+ return LoadAll(stream);
+}
+
+std::vector<Node> LoadAll(const char* input) {
+ std::stringstream stream(input);
+ return LoadAll(stream);
+}
+
+std::vector<Node> LoadAll(std::istream& input) {
+ std::vector<Node> docs;
+
+ Parser parser(input);
+ while (1) {
+ NodeBuilder builder;
+ if (!parser.HandleNextDocument(builder)) {
+ break;
+ }
+ docs.push_back(builder.Root());
+ }
+
+ return docs;
+}
+
+std::vector<Node> LoadAllFromFile(const std::string& filename) {
+ std::ifstream fin(filename.c_str());
+ if (!fin) {
+ throw BadFile();
+ }
+ return LoadAll(fin);
+}
+} // namespace YAML
diff --git a/lib/yamlcpp/src/parser.cpp b/lib/yamlcpp/src/parser.cpp
new file mode 100644
index 0000000..cd69f39
--- /dev/null
+++ b/lib/yamlcpp/src/parser.cpp
@@ -0,0 +1,129 @@
+#include <cstdio>
+#include <sstream>
+
+#include "directives.h" // IWYU pragma: keep
+#include "scanner.h" // IWYU pragma: keep
+#include "singledocparser.h"
+#include "token.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+#include "yaml-cpp/parser.h"
+
+namespace YAML {
+class EventHandler;
+
+Parser::Parser() {}
+
+Parser::Parser(std::istream& in) { Load(in); }
+
+Parser::~Parser() {}
+
+Parser::operator bool() const {
+ return m_pScanner.get() && !m_pScanner->empty();
+}
+
+void Parser::Load(std::istream& in) {
+ m_pScanner.reset(new Scanner(in));
+ m_pDirectives.reset(new Directives);
+}
+
+bool Parser::HandleNextDocument(EventHandler& eventHandler) {
+ if (!m_pScanner.get())
+ return false;
+
+ ParseDirectives();
+ if (m_pScanner->empty()) {
+ return false;
+ }
+
+ SingleDocParser sdp(*m_pScanner, *m_pDirectives);
+ sdp.HandleDocument(eventHandler);
+ return true;
+}
+
+void Parser::ParseDirectives() {
+ bool readDirective = false;
+
+ while (1) {
+ if (m_pScanner->empty()) {
+ break;
+ }
+
+ Token& token = m_pScanner->peek();
+ if (token.type != Token::DIRECTIVE) {
+ break;
+ }
+
+ // we keep the directives from the last document if none are specified;
+ // but if any directives are specific, then we reset them
+ if (!readDirective) {
+ m_pDirectives.reset(new Directives);
+ }
+
+ readDirective = true;
+ HandleDirective(token);
+ m_pScanner->pop();
+ }
+}
+
+void Parser::HandleDirective(const Token& token) {
+ if (token.value == "YAML") {
+ HandleYamlDirective(token);
+ } else if (token.value == "TAG") {
+ HandleTagDirective(token);
+ }
+}
+
+void Parser::HandleYamlDirective(const Token& token) {
+ if (token.params.size() != 1) {
+ throw ParserException(token.mark, ErrorMsg::YAML_DIRECTIVE_ARGS);
+ }
+
+ if (!m_pDirectives->version.isDefault) {
+ throw ParserException(token.mark, ErrorMsg::REPEATED_YAML_DIRECTIVE);
+ }
+
+ std::stringstream str(token.params[0]);
+ str >> m_pDirectives->version.major;
+ str.get();
+ str >> m_pDirectives->version.minor;
+ if (!str || str.peek() != EOF) {
+ throw ParserException(
+ token.mark, std::string(ErrorMsg::YAML_VERSION) + token.params[0]);
+ }
+
+ if (m_pDirectives->version.major > 1) {
+ throw ParserException(token.mark, ErrorMsg::YAML_MAJOR_VERSION);
+ }
+
+ m_pDirectives->version.isDefault = false;
+ // TODO: warning on major == 1, minor > 2?
+}
+
+void Parser::HandleTagDirective(const Token& token) {
+ if (token.params.size() != 2)
+ throw ParserException(token.mark, ErrorMsg::TAG_DIRECTIVE_ARGS);
+
+ const std::string& handle = token.params[0];
+ const std::string& prefix = token.params[1];
+ if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) {
+ throw ParserException(token.mark, ErrorMsg::REPEATED_TAG_DIRECTIVE);
+ }
+
+ m_pDirectives->tags[handle] = prefix;
+}
+
+void Parser::PrintTokens(std::ostream& out) {
+ if (!m_pScanner.get()) {
+ return;
+ }
+
+ while (1) {
+ if (m_pScanner->empty()) {
+ break;
+ }
+
+ out << m_pScanner->peek() << "\n";
+ m_pScanner->pop();
+ }
+}
+}
diff --git a/lib/yamlcpp/src/ptr_vector.h b/lib/yamlcpp/src/ptr_vector.h
new file mode 100644
index 0000000..955aebd
--- /dev/null
+++ b/lib/yamlcpp/src/ptr_vector.h
@@ -0,0 +1,43 @@
+#ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+#include <cstdlib>
+#include <memory>
+#include <vector>
+
+#include "yaml-cpp/noncopyable.h"
+
+namespace YAML {
+
+// TODO: This class is no longer needed
+template <typename T>
+class ptr_vector : private YAML::noncopyable {
+ public:
+ ptr_vector() {}
+
+ void clear() { m_data.clear(); }
+
+ std::size_t size() const { return m_data.size(); }
+ bool empty() const { return m_data.empty(); }
+
+ void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); }
+ T& operator[](std::size_t i) { return *m_data[i]; }
+ const T& operator[](std::size_t i) const { return *m_data[i]; }
+
+ T& back() { return *(m_data.back().get()); }
+
+ const T& back() const { return *(m_data.back().get()); }
+
+ private:
+ std::vector<std::unique_ptr<T>> m_data;
+};
+}
+
+#endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/regex_yaml.cpp b/lib/yamlcpp/src/regex_yaml.cpp
new file mode 100644
index 0000000..20b7720
--- /dev/null
+++ b/lib/yamlcpp/src/regex_yaml.cpp
@@ -0,0 +1,45 @@
+#include "regex_yaml.h"
+
+namespace YAML {
+// constructors
+RegEx::RegEx() : m_op(REGEX_EMPTY) {}
+
+RegEx::RegEx(REGEX_OP op) : m_op(op) {}
+
+RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch) {}
+
+RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z) {}
+
+RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op) {
+ for (std::size_t i = 0; i < str.size(); i++)
+ m_params.push_back(RegEx(str[i]));
+}
+
+// combination constructors
+RegEx operator!(const RegEx& ex) {
+ RegEx ret(REGEX_NOT);
+ ret.m_params.push_back(ex);
+ return ret;
+}
+
+RegEx operator||(const RegEx& ex1, const RegEx& ex2) {
+ RegEx ret(REGEX_OR);
+ ret.m_params.push_back(ex1);
+ ret.m_params.push_back(ex2);
+ return ret;
+}
+
+RegEx operator&&(const RegEx& ex1, const RegEx& ex2) {
+ RegEx ret(REGEX_AND);
+ ret.m_params.push_back(ex1);
+ ret.m_params.push_back(ex2);
+ return ret;
+}
+
+RegEx operator+(const RegEx& ex1, const RegEx& ex2) {
+ RegEx ret(REGEX_SEQ);
+ ret.m_params.push_back(ex1);
+ ret.m_params.push_back(ex2);
+ return ret;
+}
+}
diff --git a/lib/yamlcpp/src/regex_yaml.h b/lib/yamlcpp/src/regex_yaml.h
new file mode 100644
index 0000000..8f28b85
--- /dev/null
+++ b/lib/yamlcpp/src/regex_yaml.h
@@ -0,0 +1,87 @@
+#ifndef REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class Stream;
+
+enum REGEX_OP {
+ REGEX_EMPTY,
+ REGEX_MATCH,
+ REGEX_RANGE,
+ REGEX_OR,
+ REGEX_AND,
+ REGEX_NOT,
+ REGEX_SEQ
+};
+
+// simplified regular expressions
+// . Only straightforward matches (no repeated characters)
+// . Only matches from start of string
+class YAML_CPP_API RegEx {
+ public:
+ RegEx();
+ RegEx(char ch);
+ RegEx(char a, char z);
+ RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
+ ~RegEx() {}
+
+ friend YAML_CPP_API RegEx operator!(const RegEx& ex);
+ friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2);
+
+ bool Matches(char ch) const;
+ bool Matches(const std::string& str) const;
+ bool Matches(const Stream& in) const;
+ template <typename Source>
+ bool Matches(const Source& source) const;
+
+ int Match(const std::string& str) const;
+ int Match(const Stream& in) const;
+ template <typename Source>
+ int Match(const Source& source) const;
+
+ private:
+ RegEx(REGEX_OP op);
+
+ template <typename Source>
+ bool IsValidSource(const Source& source) const;
+ template <typename Source>
+ int MatchUnchecked(const Source& source) const;
+
+ template <typename Source>
+ int MatchOpEmpty(const Source& source) const;
+ template <typename Source>
+ int MatchOpMatch(const Source& source) const;
+ template <typename Source>
+ int MatchOpRange(const Source& source) const;
+ template <typename Source>
+ int MatchOpOr(const Source& source) const;
+ template <typename Source>
+ int MatchOpAnd(const Source& source) const;
+ template <typename Source>
+ int MatchOpNot(const Source& source) const;
+ template <typename Source>
+ int MatchOpSeq(const Source& source) const;
+
+ private:
+ REGEX_OP m_op;
+ char m_a, m_z;
+ std::vector<RegEx> m_params;
+};
+}
+
+#include "regeximpl.h"
+
+#endif // REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/regeximpl.h b/lib/yamlcpp/src/regeximpl.h
new file mode 100644
index 0000000..709124f
--- /dev/null
+++ b/lib/yamlcpp/src/regeximpl.h
@@ -0,0 +1,186 @@
+#ifndef REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "stream.h"
+#include "stringsource.h"
+#include "streamcharsource.h"
+
+namespace YAML {
+// query matches
+inline bool RegEx::Matches(char ch) const {
+ std::string str;
+ str += ch;
+ return Matches(str);
+}
+
+inline bool RegEx::Matches(const std::string& str) const {
+ return Match(str) >= 0;
+}
+
+inline bool RegEx::Matches(const Stream& in) const { return Match(in) >= 0; }
+
+template <typename Source>
+inline bool RegEx::Matches(const Source& source) const {
+ return Match(source) >= 0;
+}
+
+// Match
+// . Matches the given string against this regular expression.
+// . Returns the number of characters matched.
+// . Returns -1 if no characters were matched (the reason for
+// not returning zero is that we may have an empty regex
+// which is ALWAYS successful at matching zero characters).
+// . REMEMBER that we only match from the start of the buffer!
+inline int RegEx::Match(const std::string& str) const {
+ StringCharSource source(str.c_str(), str.size());
+ return Match(source);
+}
+
+inline int RegEx::Match(const Stream& in) const {
+ StreamCharSource source(in);
+ return Match(source);
+}
+
+template <typename Source>
+inline bool RegEx::IsValidSource(const Source& source) const {
+ return source;
+}
+
+template <>
+inline bool RegEx::IsValidSource<StringCharSource>(
+ const StringCharSource& source) const {
+ switch (m_op) {
+ case REGEX_MATCH:
+ case REGEX_RANGE:
+ return source;
+ default:
+ return true;
+ }
+}
+
+template <typename Source>
+inline int RegEx::Match(const Source& source) const {
+ return IsValidSource(source) ? MatchUnchecked(source) : -1;
+}
+
+template <typename Source>
+inline int RegEx::MatchUnchecked(const Source& source) const {
+ switch (m_op) {
+ case REGEX_EMPTY:
+ return MatchOpEmpty(source);
+ case REGEX_MATCH:
+ return MatchOpMatch(source);
+ case REGEX_RANGE:
+ return MatchOpRange(source);
+ case REGEX_OR:
+ return MatchOpOr(source);
+ case REGEX_AND:
+ return MatchOpAnd(source);
+ case REGEX_NOT:
+ return MatchOpNot(source);
+ case REGEX_SEQ:
+ return MatchOpSeq(source);
+ }
+
+ return -1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Operators
+// Note: the convention MatchOp*<Source> is that we can assume
+// IsSourceValid(source).
+// So we do all our checks *before* we call these functions
+
+// EmptyOperator
+template <typename Source>
+inline int RegEx::MatchOpEmpty(const Source& source) const {
+ return source[0] == Stream::eof() ? 0 : -1;
+}
+
+template <>
+inline int RegEx::MatchOpEmpty<StringCharSource>(
+ const StringCharSource& source) const {
+ return !source
+ ? 0
+ : -1; // the empty regex only is successful on the empty string
+}
+
+// MatchOperator
+template <typename Source>
+inline int RegEx::MatchOpMatch(const Source& source) const {
+ if (source[0] != m_a)
+ return -1;
+ return 1;
+}
+
+// RangeOperator
+template <typename Source>
+inline int RegEx::MatchOpRange(const Source& source) const {
+ if (m_a > source[0] || m_z < source[0])
+ return -1;
+ return 1;
+}
+
+// OrOperator
+template <typename Source>
+inline int RegEx::MatchOpOr(const Source& source) const {
+ for (std::size_t i = 0; i < m_params.size(); i++) {
+ int n = m_params[i].MatchUnchecked(source);
+ if (n >= 0)
+ return n;
+ }
+ return -1;
+}
+
+// AndOperator
+// Note: 'AND' is a little funny, since we may be required to match things
+// of different lengths. If we find a match, we return the length of
+// the FIRST entry on the list.
+template <typename Source>
+inline int RegEx::MatchOpAnd(const Source& source) const {
+ int first = -1;
+ for (std::size_t i = 0; i < m_params.size(); i++) {
+ int n = m_params[i].MatchUnchecked(source);
+ if (n == -1)
+ return -1;
+ if (i == 0)
+ first = n;
+ }
+ return first;
+}
+
+// NotOperator
+template <typename Source>
+inline int RegEx::MatchOpNot(const Source& source) const {
+ if (m_params.empty())
+ return -1;
+ if (m_params[0].MatchUnchecked(source) >= 0)
+ return -1;
+ return 1;
+}
+
+// SeqOperator
+template <typename Source>
+inline int RegEx::MatchOpSeq(const Source& source) const {
+ int offset = 0;
+ for (std::size_t i = 0; i < m_params.size(); i++) {
+ int n = m_params[i].Match(source + offset); // note Match, not
+ // MatchUnchecked because we
+ // need to check validity after
+ // the offset
+ if (n == -1)
+ return -1;
+ offset += n;
+ }
+
+ return offset;
+}
+}
+
+#endif // REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/scanner.cpp b/lib/yamlcpp/src/scanner.cpp
new file mode 100644
index 0000000..b5cfcc1
--- /dev/null
+++ b/lib/yamlcpp/src/scanner.cpp
@@ -0,0 +1,386 @@
+#include <cassert>
+#include <memory>
+
+#include "exp.h"
+#include "scanner.h"
+#include "token.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+Scanner::Scanner(std::istream& in)
+ : INPUT(in),
+ m_startedStream(false),
+ m_endedStream(false),
+ m_simpleKeyAllowed(false),
+ m_canBeJSONFlow(false) {}
+
+Scanner::~Scanner() {}
+
+bool Scanner::empty() {
+ EnsureTokensInQueue();
+ return m_tokens.empty();
+}
+
+void Scanner::pop() {
+ EnsureTokensInQueue();
+ if (!m_tokens.empty())
+ m_tokens.pop();
+}
+
+Token& Scanner::peek() {
+ EnsureTokensInQueue();
+ assert(!m_tokens.empty()); // should we be asserting here? I mean, we really
+ // just be checking
+ // if it's empty before peeking.
+
+#if 0
+ static Token *pLast = 0;
+ if(pLast != &m_tokens.front())
+ std::cerr << "peek: " << m_tokens.front() << "\n";
+ pLast = &m_tokens.front();
+#endif
+
+ return m_tokens.front();
+}
+
+Mark Scanner::mark() const { return INPUT.mark(); }
+
+void Scanner::EnsureTokensInQueue() {
+ while (1) {
+ if (!m_tokens.empty()) {
+ Token& token = m_tokens.front();
+
+ // if this guy's valid, then we're done
+ if (token.status == Token::VALID) {
+ return;
+ }
+
+ // here's where we clean up the impossible tokens
+ if (token.status == Token::INVALID) {
+ m_tokens.pop();
+ continue;
+ }
+
+ // note: what's left are the unverified tokens
+ }
+
+ // no token? maybe we've actually finished
+ if (m_endedStream) {
+ return;
+ }
+
+ // no? then scan...
+ ScanNextToken();
+ }
+}
+
+void Scanner::ScanNextToken() {
+ if (m_endedStream) {
+ return;
+ }
+
+ if (!m_startedStream) {
+ return StartStream();
+ }
+
+ // get rid of whitespace, etc. (in between tokens it should be irrelevent)
+ ScanToNextToken();
+
+ // maybe need to end some blocks
+ PopIndentToHere();
+
+ // *****
+ // And now branch based on the next few characters!
+ // *****
+
+ // end of stream
+ if (!INPUT) {
+ return EndStream();
+ }
+
+ if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) {
+ return ScanDirective();
+ }
+
+ // document token
+ if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) {
+ return ScanDocStart();
+ }
+
+ if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) {
+ return ScanDocEnd();
+ }
+
+ // flow start/end/entry
+ if (INPUT.peek() == Keys::FlowSeqStart ||
+ INPUT.peek() == Keys::FlowMapStart) {
+ return ScanFlowStart();
+ }
+
+ if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) {
+ return ScanFlowEnd();
+ }
+
+ if (INPUT.peek() == Keys::FlowEntry) {
+ return ScanFlowEntry();
+ }
+
+ // block/map stuff
+ if (Exp::BlockEntry().Matches(INPUT)) {
+ return ScanBlockEntry();
+ }
+
+ if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) {
+ return ScanKey();
+ }
+
+ if (GetValueRegex().Matches(INPUT)) {
+ return ScanValue();
+ }
+
+ // alias/anchor
+ if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) {
+ return ScanAnchorOrAlias();
+ }
+
+ // tag
+ if (INPUT.peek() == Keys::Tag) {
+ return ScanTag();
+ }
+
+ // special scalars
+ if (InBlockContext() && (INPUT.peek() == Keys::LiteralScalar ||
+ INPUT.peek() == Keys::FoldedScalar)) {
+ return ScanBlockScalar();
+ }
+
+ if (INPUT.peek() == '\'' || INPUT.peek() == '\"') {
+ return ScanQuotedScalar();
+ }
+
+ // plain scalars
+ if ((InBlockContext() ? Exp::PlainScalar() : Exp::PlainScalarInFlow())
+ .Matches(INPUT)) {
+ return ScanPlainScalar();
+ }
+
+ // don't know what it is!
+ throw ParserException(INPUT.mark(), ErrorMsg::UNKNOWN_TOKEN);
+}
+
+void Scanner::ScanToNextToken() {
+ while (1) {
+ // first eat whitespace
+ while (INPUT && IsWhitespaceToBeEaten(INPUT.peek())) {
+ if (InBlockContext() && Exp::Tab().Matches(INPUT)) {
+ m_simpleKeyAllowed = false;
+ }
+ INPUT.eat(1);
+ }
+
+ // then eat a comment
+ if (Exp::Comment().Matches(INPUT)) {
+ // eat until line break
+ while (INPUT && !Exp::Break().Matches(INPUT)) {
+ INPUT.eat(1);
+ }
+ }
+
+ // if it's NOT a line break, then we're done!
+ if (!Exp::Break().Matches(INPUT)) {
+ break;
+ }
+
+ // otherwise, let's eat the line break and keep going
+ int n = Exp::Break().Match(INPUT);
+ INPUT.eat(n);
+
+ // oh yeah, and let's get rid of that simple key
+ InvalidateSimpleKey();
+
+ // new line - we may be able to accept a simple key now
+ if (InBlockContext()) {
+ m_simpleKeyAllowed = true;
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+// Misc. helpers
+
+// IsWhitespaceToBeEaten
+// . We can eat whitespace if it's a space or tab
+// . Note: originally tabs in block context couldn't be eaten
+// "where a simple key could be allowed
+// (i.e., not at the beginning of a line, or following '-', '?', or
+// ':')"
+// I think this is wrong, since tabs can be non-content whitespace; it's just
+// that they can't contribute to indentation, so once you've seen a tab in a
+// line, you can't start a simple key
+bool Scanner::IsWhitespaceToBeEaten(char ch) {
+ if (ch == ' ') {
+ return true;
+ }
+
+ if (ch == '\t') {
+ return true;
+ }
+
+ return false;
+}
+
+const RegEx& Scanner::GetValueRegex() const {
+ if (InBlockContext()) {
+ return Exp::Value();
+ }
+
+ return m_canBeJSONFlow ? Exp::ValueInJSONFlow() : Exp::ValueInFlow();
+}
+
+void Scanner::StartStream() {
+ m_startedStream = true;
+ m_simpleKeyAllowed = true;
+ std::unique_ptr<IndentMarker> pIndent(
+ new IndentMarker(-1, IndentMarker::NONE));
+ m_indentRefs.push_back(std::move(pIndent));
+ m_indents.push(&m_indentRefs.back());
+}
+
+void Scanner::EndStream() {
+ // force newline
+ if (INPUT.column() > 0) {
+ INPUT.ResetColumn();
+ }
+
+ PopAllIndents();
+ PopAllSimpleKeys();
+
+ m_simpleKeyAllowed = false;
+ m_endedStream = true;
+}
+
+Token* Scanner::PushToken(Token::TYPE type) {
+ m_tokens.push(Token(type, INPUT.mark()));
+ return &m_tokens.back();
+}
+
+Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const {
+ switch (type) {
+ case IndentMarker::SEQ:
+ return Token::BLOCK_SEQ_START;
+ case IndentMarker::MAP:
+ return Token::BLOCK_MAP_START;
+ case IndentMarker::NONE:
+ assert(false);
+ break;
+ }
+ assert(false);
+ throw std::runtime_error("yaml-cpp: internal error, invalid indent type");
+}
+
+Scanner::IndentMarker* Scanner::PushIndentTo(int column,
+ IndentMarker::INDENT_TYPE type) {
+ // are we in flow?
+ if (InFlowContext()) {
+ return 0;
+ }
+
+ std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type));
+ IndentMarker& indent = *pIndent;
+ const IndentMarker& lastIndent = *m_indents.top();
+
+ // is this actually an indentation?
+ if (indent.column < lastIndent.column) {
+ return 0;
+ }
+ if (indent.column == lastIndent.column &&
+ !(indent.type == IndentMarker::SEQ &&
+ lastIndent.type == IndentMarker::MAP)) {
+ return 0;
+ }
+
+ // push a start token
+ indent.pStartToken = PushToken(GetStartTokenFor(type));
+
+ // and then the indent
+ m_indents.push(&indent);
+ m_indentRefs.push_back(std::move(pIndent));
+ return &m_indentRefs.back();
+}
+
+void Scanner::PopIndentToHere() {
+ // are we in flow?
+ if (InFlowContext()) {
+ return;
+ }
+
+ // now pop away
+ while (!m_indents.empty()) {
+ const IndentMarker& indent = *m_indents.top();
+ if (indent.column < INPUT.column()) {
+ break;
+ }
+ if (indent.column == INPUT.column() &&
+ !(indent.type == IndentMarker::SEQ &&
+ !Exp::BlockEntry().Matches(INPUT))) {
+ break;
+ }
+
+ PopIndent();
+ }
+
+ while (!m_indents.empty() &&
+ m_indents.top()->status == IndentMarker::INVALID) {
+ PopIndent();
+ }
+}
+
+void Scanner::PopAllIndents() {
+ // are we in flow?
+ if (InFlowContext()) {
+ return;
+ }
+
+ // now pop away
+ while (!m_indents.empty()) {
+ const IndentMarker& indent = *m_indents.top();
+ if (indent.type == IndentMarker::NONE) {
+ break;
+ }
+
+ PopIndent();
+ }
+}
+
+void Scanner::PopIndent() {
+ const IndentMarker& indent = *m_indents.top();
+ m_indents.pop();
+
+ if (indent.status != IndentMarker::VALID) {
+ InvalidateSimpleKey();
+ return;
+ }
+
+ if (indent.type == IndentMarker::SEQ) {
+ m_tokens.push(Token(Token::BLOCK_SEQ_END, INPUT.mark()));
+ } else if (indent.type == IndentMarker::MAP) {
+ m_tokens.push(Token(Token::BLOCK_MAP_END, INPUT.mark()));
+ }
+}
+
+int Scanner::GetTopIndent() const {
+ if (m_indents.empty()) {
+ return 0;
+ }
+ return m_indents.top()->column;
+}
+
+void Scanner::ThrowParserException(const std::string& msg) const {
+ Mark mark = Mark::null_mark();
+ if (!m_tokens.empty()) {
+ const Token& token = m_tokens.front();
+ mark = token.mark;
+ }
+ throw ParserException(mark, msg);
+}
+} // namespace YAML
diff --git a/lib/yamlcpp/src/scanner.h b/lib/yamlcpp/src/scanner.h
new file mode 100644
index 0000000..7bb2ccc
--- /dev/null
+++ b/lib/yamlcpp/src/scanner.h
@@ -0,0 +1,190 @@
+#ifndef SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+#include <ios>
+#include <map>
+#include <queue>
+#include <set>
+#include <stack>
+#include <string>
+
+#include "ptr_vector.h"
+#include "stream.h"
+#include "token.h"
+#include "yaml-cpp/mark.h"
+
+namespace YAML {
+class Node;
+class RegEx;
+
+/**
+ * A scanner transforms a stream of characters into a stream of tokens.
+ */
+class Scanner {
+ public:
+ explicit Scanner(std::istream &in);
+ ~Scanner();
+
+ /** Returns true if there are no more tokens to be read. */
+ bool empty();
+
+ /** Removes the next token in the queue. */
+ void pop();
+
+ /** Returns, but does not remove, the next token in the queue. */
+ Token &peek();
+
+ /** Returns the current mark in the input stream. */
+ Mark mark() const;
+
+ private:
+ struct IndentMarker {
+ enum INDENT_TYPE { MAP, SEQ, NONE };
+ enum STATUS { VALID, INVALID, UNKNOWN };
+ IndentMarker(int column_, INDENT_TYPE type_)
+ : column(column_), type(type_), status(VALID), pStartToken(0) {}
+
+ int column;
+ INDENT_TYPE type;
+ STATUS status;
+ Token *pStartToken;
+ };
+
+ enum FLOW_MARKER { FLOW_MAP, FLOW_SEQ };
+
+ private:
+ // scanning
+
+ /**
+ * Scans until there's a valid token at the front of the queue, or the queue
+ * is empty. The state can be checked by {@link #empty}, and the next token
+ * retrieved by {@link #peek}.
+ */
+ void EnsureTokensInQueue();
+
+ /**
+ * The main scanning function; this method branches out to scan whatever the
+ * next token should be.
+ */
+ void ScanNextToken();
+
+ /** Eats the input stream until it reaches the next token-like thing. */
+ void ScanToNextToken();
+
+ /** Sets the initial conditions for starting a stream. */
+ void StartStream();
+
+ /** Closes out the stream, finish up, etc. */
+ void EndStream();
+
+ Token *PushToken(Token::TYPE type);
+
+ bool InFlowContext() const { return !m_flows.empty(); }
+ bool InBlockContext() const { return m_flows.empty(); }
+ std::size_t GetFlowLevel() const { return m_flows.size(); }
+
+ Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const;
+
+ /**
+ * Pushes an indentation onto the stack, and enqueues the proper token
+ * (sequence start or mapping start).
+ *
+ * @return the indent marker it generates (if any).
+ */
+ IndentMarker *PushIndentTo(int column, IndentMarker::INDENT_TYPE type);
+
+ /**
+ * Pops indentations off the stack until it reaches the current indentation
+ * level, and enqueues the proper token each time. Then pops all invalid
+ * indentations off.
+ */
+ void PopIndentToHere();
+
+ /**
+ * Pops all indentations (except for the base empty one) off the stack, and
+ * enqueues the proper token each time.
+ */
+ void PopAllIndents();
+
+ /** Pops a single indent, pushing the proper token. */
+ void PopIndent();
+ int GetTopIndent() const;
+
+ // checking input
+ bool CanInsertPotentialSimpleKey() const;
+ bool ExistsActiveSimpleKey() const;
+ void InsertPotentialSimpleKey();
+ void InvalidateSimpleKey();
+ bool VerifySimpleKey();
+ void PopAllSimpleKeys();
+
+ /**
+ * Throws a ParserException with the current token location (if available),
+ * and does not parse any more tokens.
+ */
+ void ThrowParserException(const std::string &msg) const;
+
+ bool IsWhitespaceToBeEaten(char ch);
+
+ /**
+ * Returns the appropriate regex to check if the next token is a value token.
+ */
+ const RegEx &GetValueRegex() const;
+
+ struct SimpleKey {
+ SimpleKey(const Mark &mark_, std::size_t flowLevel_);
+
+ void Validate();
+ void Invalidate();
+
+ Mark mark;
+ std::size_t flowLevel;
+ IndentMarker *pIndent;
+ Token *pMapStart, *pKey;
+ };
+
+ // and the tokens
+ void ScanDirective();
+ void ScanDocStart();
+ void ScanDocEnd();
+ void ScanBlockSeqStart();
+ void ScanBlockMapSTart();
+ void ScanBlockEnd();
+ void ScanBlockEntry();
+ void ScanFlowStart();
+ void ScanFlowEnd();
+ void ScanFlowEntry();
+ void ScanKey();
+ void ScanValue();
+ void ScanAnchorOrAlias();
+ void ScanTag();
+ void ScanPlainScalar();
+ void ScanQuotedScalar();
+ void ScanBlockScalar();
+
+ private:
+ // the stream
+ Stream INPUT;
+
+ // the output (tokens)
+ std::queue<Token> m_tokens;
+
+ // state info
+ bool m_startedStream, m_endedStream;
+ bool m_simpleKeyAllowed;
+ bool m_canBeJSONFlow;
+ std::stack<SimpleKey> m_simpleKeys;
+ std::stack<IndentMarker *> m_indents;
+ ptr_vector<IndentMarker> m_indentRefs; // for "garbage collection"
+ std::stack<FLOW_MARKER> m_flows;
+};
+}
+
+#endif // SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/lib/yamlcpp/src/scanscalar.cpp b/lib/yamlcpp/src/scanscalar.cpp
new file mode 100644
index 0000000..10e359d
--- /dev/null
+++ b/lib/yamlcpp/src/scanscalar.cpp
@@ -0,0 +1,250 @@
+#include "scanscalar.h"
+
+#include <algorithm>
+
+#include "exp.h"
+#include "regeximpl.h"
+#include "stream.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+// ScanScalar
+// . This is where the scalar magic happens.
+//
+// . We do the scanning in three phases:
+// 1. Scan until newline
+// 2. Eat newline
+// 3. Scan leading blanks.
+//
... 18889 lines suppressed ...
--
To stop receiving notification emails like this one, please contact
bcall@apache.org.