diff --git a/.gitignore b/.gitignore index 56f67529..63adbb7e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ settingsUI/ *.log .vs .vscode -.vcxproj.* +*.vcxproj.user diff --git a/Release/com.ctytler.dcs.streamDeckPlugin b/Release/com.ctytler.dcs.streamDeckPlugin index 440a6a12..5e292792 100644 Binary files a/Release/com.ctytler.dcs.streamDeckPlugin and b/Release/com.ctytler.dcs.streamDeckPlugin differ diff --git a/Sources/backend-cpp/ElgatoSD/EPLJSONUtils.h b/Sources/backend-cpp/ElgatoSD/EPLJSONUtils.h index 1cd80394..aad98bf4 100644 --- a/Sources/backend-cpp/ElgatoSD/EPLJSONUtils.h +++ b/Sources/backend-cpp/ElgatoSD/EPLJSONUtils.h @@ -17,7 +17,7 @@ // Includes //------------------------------------------------------------------------------ -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; class EPLJSONUtils diff --git a/Sources/backend-cpp/ElgatoSD/ESDBasePlugin.h b/Sources/backend-cpp/ElgatoSD/ESDBasePlugin.h index 8df4b80a..0454bce6 100644 --- a/Sources/backend-cpp/ElgatoSD/ESDBasePlugin.h +++ b/Sources/backend-cpp/ElgatoSD/ESDBasePlugin.h @@ -12,7 +12,7 @@ #pragma once -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; class ESDConnectionManager; diff --git a/Sources/backend-cpp/ElgatoSD/ElgatoSD.vcxproj b/Sources/backend-cpp/ElgatoSD/ElgatoSD.vcxproj index eeadd562..ec11b55f 100644 --- a/Sources/backend-cpp/ElgatoSD/ElgatoSD.vcxproj +++ b/Sources/backend-cpp/ElgatoSD/ElgatoSD.vcxproj @@ -29,26 +29,26 @@ StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode @@ -164,8 +164,7 @@ true - + @@ -182,7 +181,19 @@ <_WildCardClInclude Include="*.h" /> + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/ElgatoSD/packages.config b/Sources/backend-cpp/ElgatoSD/packages.config new file mode 100644 index 00000000..871bd0ad --- /dev/null +++ b/Sources/backend-cpp/ElgatoSD/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.h b/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.h index 39abb567..79b9e4a2 100644 --- a/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.h +++ b/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.h @@ -4,7 +4,7 @@ #include "Utilities/Decimal.h" #include "Utilities/UdpSocket.h" -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; #include diff --git a/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.vcxproj b/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.vcxproj index 14875135..37336a92 100644 --- a/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.vcxproj +++ b/Sources/backend-cpp/SimulatorInterface/SimulatorInterface.vcxproj @@ -29,26 +29,26 @@ StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode @@ -152,8 +152,7 @@ true - + @@ -172,7 +171,19 @@ <_WildCardClInclude Include="Protocols/*.h" /> <_WildCardClInclude Include="*.h" /> + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/SimulatorInterface/packages.config b/Sources/backend-cpp/SimulatorInterface/packages.config new file mode 100644 index 00000000..871bd0ad --- /dev/null +++ b/Sources/backend-cpp/SimulatorInterface/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/StreamdeckContext/BackwardsCompatibilityHandler.h b/Sources/backend-cpp/StreamdeckContext/BackwardsCompatibilityHandler.h index 62421fd9..5f2e21a6 100644 --- a/Sources/backend-cpp/StreamdeckContext/BackwardsCompatibilityHandler.h +++ b/Sources/backend-cpp/StreamdeckContext/BackwardsCompatibilityHandler.h @@ -1,6 +1,6 @@ // Copyright 2022 Charles Tytler -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; json backwardsCompatibilityHandler(const json &prevVersionPayload); diff --git a/Sources/backend-cpp/StreamdeckContext/StreamdeckContext.vcxproj b/Sources/backend-cpp/StreamdeckContext/StreamdeckContext.vcxproj index 359dd17d..133c0f01 100644 --- a/Sources/backend-cpp/StreamdeckContext/StreamdeckContext.vcxproj +++ b/Sources/backend-cpp/StreamdeckContext/StreamdeckContext.vcxproj @@ -29,26 +29,26 @@ StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode @@ -154,8 +154,7 @@ true - + @@ -176,7 +175,19 @@ <_WildCardClInclude Include="SendActions\*.h" /> <_WildCardClInclude Include="*.h" /> + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/StreamdeckContext/packages.config b/Sources/backend-cpp/StreamdeckContext/packages.config new file mode 100644 index 00000000..871bd0ad --- /dev/null +++ b/Sources/backend-cpp/StreamdeckContext/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.cpp b/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.cpp index 2bea5277..a144de6a 100644 --- a/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.cpp +++ b/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.cpp @@ -21,7 +21,7 @@ #include "Utilities/JsonReader.h" #include "Utilities/LuaReader.h" -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; class CallBackTimer diff --git a/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.vcxproj b/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.vcxproj index 0027ab89..9df4d45f 100644 --- a/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.vcxproj +++ b/Sources/backend-cpp/StreamdeckInterface/StreamdeckInterface.vcxproj @@ -29,26 +29,26 @@ Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode @@ -95,6 +95,9 @@ $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ $(SolutionDir)..\;$(SolutionDir)../Vendor/asio/include;$(SolutionDir)../Vendor/websocketpp;$(IncludePath) streamdeck_dcs_interface + + + true @@ -192,11 +195,22 @@ {329f64ac-6346-46d2-a671-9b5dd626b485} - - {59eec206-84e0-4842-b89e-2025fd78e589} - + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/StreamdeckInterface/packages.config b/Sources/backend-cpp/StreamdeckInterface/packages.config new file mode 100644 index 00000000..8e59cd3d --- /dev/null +++ b/Sources/backend-cpp/StreamdeckInterface/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Test/Test.vcxproj b/Sources/backend-cpp/Test/Test.vcxproj index f5706d18..32872401 100644 --- a/Sources/backend-cpp/Test/Test.vcxproj +++ b/Sources/backend-cpp/Test/Test.vcxproj @@ -21,9 +21,9 @@ {81582f07-e000-4049-b302-bf98d6ed1b41} Win32Proj - 10.0.18362.0 + 10.0 Application - v142 + v143 Unicode @@ -75,20 +75,19 @@ {329f64ac-6346-46d2-a671-9b5dd626b485} - - {59eec206-84e0-4842-b89e-2025fd78e589} - - + - + - + + + @@ -164,6 +163,8 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Test/packages.config b/Sources/backend-cpp/Test/packages.config index 6c6422e8..8e59cd3d 100644 --- a/Sources/backend-cpp/Test/packages.config +++ b/Sources/backend-cpp/Test/packages.config @@ -1,4 +1,6 @@  - + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Utilities/JsonReader.h b/Sources/backend-cpp/Utilities/JsonReader.h index c230bdbd..e6404e3e 100644 --- a/Sources/backend-cpp/Utilities/JsonReader.h +++ b/Sources/backend-cpp/Utilities/JsonReader.h @@ -5,7 +5,7 @@ #include #include -#include "Vendor/json/src/json.hpp" +#include "nlohmann\json.hpp" using json = nlohmann::json; std::optional get_module_list(const std::string &path); diff --git a/Sources/backend-cpp/Utilities/LuaReader.cpp b/Sources/backend-cpp/Utilities/LuaReader.cpp index 30bf6aec..2a4af4e5 100644 --- a/Sources/backend-cpp/Utilities/LuaReader.cpp +++ b/Sources/backend-cpp/Utilities/LuaReader.cpp @@ -2,7 +2,7 @@ #include "LuaReader.h" -#include "Vendor/lua-5.1.5/etc/lua.hpp" +#include "lua.hpp" #include #include diff --git a/Sources/backend-cpp/Utilities/LuaReader.h b/Sources/backend-cpp/Utilities/LuaReader.h index 28288806..a1068a8d 100644 --- a/Sources/backend-cpp/Utilities/LuaReader.h +++ b/Sources/backend-cpp/Utilities/LuaReader.h @@ -2,7 +2,7 @@ #pragma once -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; diff --git a/Sources/backend-cpp/Utilities/Utilities.vcxproj b/Sources/backend-cpp/Utilities/Utilities.vcxproj index f3ad7f73..f79059d3 100644 --- a/Sources/backend-cpp/Utilities/Utilities.vcxproj +++ b/Sources/backend-cpp/Utilities/Utilities.vcxproj @@ -29,26 +29,26 @@ StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode @@ -91,6 +91,7 @@ false $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ $(SolutionDir)..\;$(IncludePath) + static @@ -152,8 +153,7 @@ true - + @@ -170,7 +170,21 @@ <_WildCardClInclude Include="*.h" /> + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Utilities/packages.config b/Sources/backend-cpp/Utilities/packages.config new file mode 100644 index 00000000..8e59cd3d --- /dev/null +++ b/Sources/backend-cpp/Utilities/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Utilities/test/LuaReaderTest.cpp b/Sources/backend-cpp/Utilities/test/LuaReaderTest.cpp index 1680a8bb..fd9ab445 100644 --- a/Sources/backend-cpp/Utilities/test/LuaReaderTest.cpp +++ b/Sources/backend-cpp/Utilities/test/LuaReaderTest.cpp @@ -4,7 +4,7 @@ #include "Utilities/LuaReader.h" -#include "Vendor/json/src/json.hpp" +#include "nlohmann/json.hpp" using json = nlohmann::json; namespace test diff --git a/Sources/backend-cpp/Vendor/json/ChangeLog.md b/Sources/backend-cpp/Vendor/json/ChangeLog.md deleted file mode 100644 index 9a92b9f1..00000000 --- a/Sources/backend-cpp/Vendor/json/ChangeLog.md +++ /dev/null @@ -1,2705 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). - -## [3.10.5](https://github.com/nlohmann/json/releases/tag/3.10.5) (2022-01-02) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.10.4...3.10.5) - -- \#include \ doesn't work with gcc-7 when `-std=c++17` is specified. [\#3203](https://github.com/nlohmann/json/issues/3203) -- Not able to use nlohmann json with c++ code built using emscripten to wasm [\#3200](https://github.com/nlohmann/json/issues/3200) -- Warning for shadowed variables [\#3188](https://github.com/nlohmann/json/issues/3188) -- Accessing missing keys on const json object leads to assert [\#3183](https://github.com/nlohmann/json/issues/3183) -- Data member is available, but null is reported, and program throws error [\#3173](https://github.com/nlohmann/json/issues/3173) -- serialization problem, from\_json need construct new object [\#3169](https://github.com/nlohmann/json/issues/3169) -- std::filesystem unavailable on macOS lower deployment targets [\#3156](https://github.com/nlohmann/json/issues/3156) -- \[json.exception.type\_error.305\] cannot use operator\[\] with a string argument with string [\#3151](https://github.com/nlohmann/json/issues/3151) -- json::dump\(\) is not compatible with C++ standards [\#3147](https://github.com/nlohmann/json/issues/3147) -- Issue with json::parse decoding codepoints [\#3142](https://github.com/nlohmann/json/issues/3142) -- Simple parse of json object thinks it should be an array [\#3136](https://github.com/nlohmann/json/issues/3136) -- How to properly read a Json string that may be null in some cases? [\#3135](https://github.com/nlohmann/json/issues/3135) -- Deadlock on create json - windows only [\#3129](https://github.com/nlohmann/json/issues/3129) -- Wrong parsing of int64 values nearest of limit [\#3126](https://github.com/nlohmann/json/issues/3126) -- ordered\_json doesn't support range based erase [\#3108](https://github.com/nlohmann/json/issues/3108) -- Apple build failed with json/single\_include/nlohmann/json.hpp:4384:57: 'path' is unavailable [\#3097](https://github.com/nlohmann/json/issues/3097) -- GCC 7.5.0 with --std=c++17: filesystem: No such file or directory [\#3090](https://github.com/nlohmann/json/issues/3090) -- Drop Travis CI [\#3087](https://github.com/nlohmann/json/issues/3087) -- ordered\_json::reset\(\) compile error with nvcc [\#3013](https://github.com/nlohmann/json/issues/3013) -- Support for unordered\_map as object\_t [\#2932](https://github.com/nlohmann/json/issues/2932) -- Compiler warning with Intel compiler, same as \#755 [\#2712](https://github.com/nlohmann/json/issues/2712) -- Compiler warnings with NVCC 11.2 [\#2676](https://github.com/nlohmann/json/issues/2676) -- some static analysis warning at line 11317 [\#1390](https://github.com/nlohmann/json/issues/1390) -- Compiling with icpc [\#755](https://github.com/nlohmann/json/issues/755) - -- Fix compilation error with NVCC [\#3234](https://github.com/nlohmann/json/pull/3234) ([nlohmann](https://github.com/nlohmann)) -- Remove Travis CI [\#3233](https://github.com/nlohmann/json/pull/3233) ([nlohmann](https://github.com/nlohmann)) -- Add build step for NVCC and fix a warning [\#3227](https://github.com/nlohmann/json/pull/3227) ([nlohmann](https://github.com/nlohmann)) -- Update cpplint [\#3225](https://github.com/nlohmann/json/pull/3225) ([nlohmann](https://github.com/nlohmann)) -- Fix: Warning for shadowed variables \(\#3188\) [\#3193](https://github.com/nlohmann/json/pull/3193) ([kernie](https://github.com/kernie)) -- Fix FAQ hyperlink typo in readme [\#3148](https://github.com/nlohmann/json/pull/3148) ([Prince-Mendiratta](https://github.com/Prince-Mendiratta)) -- Docs: Update `skip_comments` to `ignore_comments` [\#3145](https://github.com/nlohmann/json/pull/3145) ([daniel-kun](https://github.com/daniel-kun)) -- fix typos in documentation [\#3140](https://github.com/nlohmann/json/pull/3140) ([striezel](https://github.com/striezel)) -- Fix spelling [\#3125](https://github.com/nlohmann/json/pull/3125) ([axic](https://github.com/axic)) -- Extend std specializations [\#3121](https://github.com/nlohmann/json/pull/3121) ([nlohmann](https://github.com/nlohmann)) -- Add missing erase\(first, last\) function to ordered\_map [\#3109](https://github.com/nlohmann/json/pull/3109) ([nlohmann](https://github.com/nlohmann)) -- Fix typos in operator\[\] documentation [\#3102](https://github.com/nlohmann/json/pull/3102) ([axnsan12](https://github.com/axnsan12)) -- Add C++17 copies of the test binaries [\#3101](https://github.com/nlohmann/json/pull/3101) ([nlohmann](https://github.com/nlohmann)) -- Add examples for parsing from iterator pair [\#3100](https://github.com/nlohmann/json/pull/3100) ([nlohmann](https://github.com/nlohmann)) -- Update CI [\#3088](https://github.com/nlohmann/json/pull/3088) ([nlohmann](https://github.com/nlohmann)) -- Revert invalid fix [\#3082](https://github.com/nlohmann/json/pull/3082) ([nlohmann](https://github.com/nlohmann)) -- Allow to use get with explicit constructor [\#3079](https://github.com/nlohmann/json/pull/3079) ([nlohmann](https://github.com/nlohmann)) -- fix std::filesystem::path regression [\#3073](https://github.com/nlohmann/json/pull/3073) ([theodelrieu](https://github.com/theodelrieu)) -- Consolidate documentation [\#3071](https://github.com/nlohmann/json/pull/3071) ([nlohmann](https://github.com/nlohmann)) -- Add recursive update function [\#3069](https://github.com/nlohmann/json/pull/3069) ([nlohmann](https://github.com/nlohmann)) -- Fix Clang version [\#3040](https://github.com/nlohmann/json/pull/3040) ([nlohmann](https://github.com/nlohmann)) -- Fix assertion failure for JSON\_DIAGNOSTICS [\#3037](https://github.com/nlohmann/json/pull/3037) ([carlsmedstad](https://github.com/carlsmedstad)) -- meta: fix is\_compatible/constructible traits [\#3020](https://github.com/nlohmann/json/pull/3020) ([theodelrieu](https://github.com/theodelrieu)) -- Set parent pointers for values inserted via update\(\) \(fixes \#3007\). [\#3008](https://github.com/nlohmann/json/pull/3008) ([AnthonyVH](https://github.com/AnthonyVH)) -- Allow allocators for output\_vector\_adapter [\#2989](https://github.com/nlohmann/json/pull/2989) ([nlohmann](https://github.com/nlohmann)) -- Re-add Clang 12 [\#2986](https://github.com/nlohmann/json/pull/2986) ([nlohmann](https://github.com/nlohmann)) -- Use new Docker image [\#2981](https://github.com/nlohmann/json/pull/2981) ([nlohmann](https://github.com/nlohmann)) -- Fix -Wunused warnings on JSON\_DIAGNOSTICS [\#2976](https://github.com/nlohmann/json/pull/2976) ([gcerretani](https://github.com/gcerretani)) -- Update docset generation script [\#2967](https://github.com/nlohmann/json/pull/2967) ([nlohmann](https://github.com/nlohmann)) - -## [v3.10.4](https://github.com/nlohmann/json/releases/tag/v3.10.4) (2021-10-16) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.10.3...v3.10.4) - -- Compiler error in output serializer due to 'incompatible initializer' [\#3081](https://github.com/nlohmann/json/issues/3081) -- Strange behaviour when using std::sort on std::vector\ [\#3080](https://github.com/nlohmann/json/issues/3080) -- Unhandled exception: nlohmann::detail::parse\_error [\#3078](https://github.com/nlohmann/json/issues/3078) -- explicit constructor with default does not compile [\#3077](https://github.com/nlohmann/json/issues/3077) -- Parse an object but get an array using GCC [\#3076](https://github.com/nlohmann/json/issues/3076) -- Version 3.10.3 breaks backward-compatibility with 3.10.2 [\#3070](https://github.com/nlohmann/json/issues/3070) -- Feature request, Add to\_json/from\_json to align with other to/from binary api. [\#3067](https://github.com/nlohmann/json/issues/3067) -- vcpkg is out of date [\#3066](https://github.com/nlohmann/json/issues/3066) - -## [v3.10.3](https://github.com/nlohmann/json/releases/tag/v3.10.3) (2021-10-08) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.10.2...v3.10.3) - -- Parsing an emtpy string returns a string with size 1 instead of expected 0 [\#3057](https://github.com/nlohmann/json/issues/3057) -- Linking error "duplicate symbol: std::type\_info::operator==" on static build with MinGW [\#3042](https://github.com/nlohmann/json/issues/3042) -- Yet another assertion failure when inserting into arrays with JSON\_DIAGNOSTICS set [\#3032](https://github.com/nlohmann/json/issues/3032) -- accept and parse function not work well with a pure number string [\#3029](https://github.com/nlohmann/json/issues/3029) -- push\_back doesn't work for serializing containers [\#3027](https://github.com/nlohmann/json/issues/3027) -- Strange behaviour when creating array with single element [\#3025](https://github.com/nlohmann/json/issues/3025) -- Input ordered\_json doesn't work [\#3023](https://github.com/nlohmann/json/issues/3023) -- Issue iterating through 'items' [\#3021](https://github.com/nlohmann/json/issues/3021) -- Cannot spell the namespace right [\#3015](https://github.com/nlohmann/json/issues/3015) -- JSON Parse error when reading json object from file [\#3011](https://github.com/nlohmann/json/issues/3011) -- Parent pointer not properly set when using update\(\) [\#3007](https://github.com/nlohmann/json/issues/3007) -- Overwriting terminated null character [\#3001](https://github.com/nlohmann/json/issues/3001) -- 'operator =' is ambiguous on VS2017 [\#2997](https://github.com/nlohmann/json/issues/2997) -- JSON Patch for Array Elements [\#2994](https://github.com/nlohmann/json/issues/2994) -- JSON Parse throwing error [\#2983](https://github.com/nlohmann/json/issues/2983) -- to\_{binary format} does not provide a mechanism for specifying a custom allocator for the returned type. [\#2982](https://github.com/nlohmann/json/issues/2982) -- 3.10.1 zip json.hpp has version number 3.10.0 instead of 3.10.1 [\#2973](https://github.com/nlohmann/json/issues/2973) -- Assertion failure when serializing array with JSON\_DIAGNOSTICS set [\#2926](https://github.com/nlohmann/json/issues/2926) - -## [v3.10.2](https://github.com/nlohmann/json/releases/tag/v3.10.2) (2021-08-26) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.10.1...v3.10.2) - -- Annoying -Wundef on new JSON\_DIAGNOSTICS macro [\#2975](https://github.com/nlohmann/json/issues/2975) -- += issue with multiple redirection. [\#2970](https://github.com/nlohmann/json/issues/2970) -- "incomplete type ‘nlohmann::detail::wide\_string\_input\_helper" compilation error [\#2969](https://github.com/nlohmann/json/issues/2969) - -## [v3.10.1](https://github.com/nlohmann/json/releases/tag/v3.10.1) (2021-08-24) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.10.0...v3.10.1) - -- JSON\_DIAGNOSTICS assertion for ordered\_json [\#2962](https://github.com/nlohmann/json/issues/2962) -- Inserting in unordered json using a pointer retains the leading slash [\#2958](https://github.com/nlohmann/json/issues/2958) -- Test \#9: test-cbor test case sample.json fails in debug mode - Stack overflow [\#2955](https://github.com/nlohmann/json/issues/2955) -- 3.10.0 broke at least the Bear project [\#2953](https://github.com/nlohmann/json/issues/2953) -- 2 tests fail in 3.10.0: cmake\_fetch\_content\_configure, cmake\_fetch\_content\_build [\#2951](https://github.com/nlohmann/json/issues/2951) -- ctest \(58+60,/67 cmake\_import\_configure\) fails when build with -D JSON\_Install:BOOL=OFF because of missing nlohmann\_jsonTargets.cmake [\#2946](https://github.com/nlohmann/json/issues/2946) -- Document vcpkg usage [\#2944](https://github.com/nlohmann/json/issues/2944) -- Linker error LNK2005 when compiling \(x64\) json-3.10.0.zip with Visual Studio 2019 16.11.1 [\#2941](https://github.com/nlohmann/json/issues/2941) -- Move Travis jobs to travis-ci.com [\#2938](https://github.com/nlohmann/json/issues/2938) - -- Fixed typo in docs/api/basic\_json/parse.md [\#2968](https://github.com/nlohmann/json/pull/2968) ([mb0202](https://github.com/mb0202)) -- Add link to Homebrew package [\#2966](https://github.com/nlohmann/json/pull/2966) ([nlohmann](https://github.com/nlohmann)) -- Fix parent update for diagnostics with ordered\_json [\#2963](https://github.com/nlohmann/json/pull/2963) ([nlohmann](https://github.com/nlohmann)) -- Set stack size for some unit tests when using MSVC [\#2961](https://github.com/nlohmann/json/pull/2961) ([nlohmann](https://github.com/nlohmann)) -- Add regression test [\#2960](https://github.com/nlohmann/json/pull/2960) ([nlohmann](https://github.com/nlohmann)) -- Update Travis badge [\#2959](https://github.com/nlohmann/json/pull/2959) ([nlohmann](https://github.com/nlohmann)) -- Fix some extra ";" clang warnings [\#2957](https://github.com/nlohmann/json/pull/2957) ([Hallot](https://github.com/Hallot)) -- Add documentation for integration via vcpkg [\#2954](https://github.com/nlohmann/json/pull/2954) ([nlohmann](https://github.com/nlohmann)) -- Avoid duplicate AppVeyor builds [\#2952](https://github.com/nlohmann/json/pull/2952) ([nlohmann](https://github.com/nlohmann)) -- 🚨 fix gdb\_pretty\_printer failure on basic types [\#2950](https://github.com/nlohmann/json/pull/2950) ([senyai](https://github.com/senyai)) -- Add header to use value\_t [\#2948](https://github.com/nlohmann/json/pull/2948) ([nlohmann](https://github.com/nlohmann)) -- Skip some tests if JSON\_Install is not set [\#2947](https://github.com/nlohmann/json/pull/2947) ([nlohmann](https://github.com/nlohmann)) -- Remove outdated json\_unit test binary [\#2945](https://github.com/nlohmann/json/pull/2945) ([nlohmann](https://github.com/nlohmann)) -- Updating the Homebrew Command [\#2943](https://github.com/nlohmann/json/pull/2943) ([amirmasoudabdol](https://github.com/amirmasoudabdol)) - -## [v3.10.0](https://github.com/nlohmann/json/releases/tag/v3.10.0) (2021-08-17) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.9.1...v3.10.0) - -- Latest version 3.9.1 uses throw instead of JSON\_THROW in the amalgamated json.hpp file [\#2934](https://github.com/nlohmann/json/issues/2934) -- Copy to a variable inside a Structure [\#2933](https://github.com/nlohmann/json/issues/2933) -- warning C4068: unknown pragma 'GCC' on MSVC/cl [\#2924](https://github.com/nlohmann/json/issues/2924) -- Errors during ninja test [\#2918](https://github.com/nlohmann/json/issues/2918) -- compiler warning: "not return a value" [\#2917](https://github.com/nlohmann/json/issues/2917) -- Comparison floating points causes warning [\#2909](https://github.com/nlohmann/json/issues/2909) -- Why can't I have std::vector\ testList? [\#2900](https://github.com/nlohmann/json/issues/2900) -- \[json.hpp\] from releases doesnt work [\#2897](https://github.com/nlohmann/json/issues/2897) -- g++ \(11\) -Wuseless-cast gives lots of warnings [\#2893](https://github.com/nlohmann/json/issues/2893) -- Cannot serialize and immediatly deserialize json to/from bson [\#2892](https://github.com/nlohmann/json/issues/2892) -- Floating-point precision conversion error [\#2876](https://github.com/nlohmann/json/issues/2876) -- How to avoid escaping for an already escaped string in .dump\(\) [\#2870](https://github.com/nlohmann/json/issues/2870) -- can't parse std::vector\ [\#2869](https://github.com/nlohmann/json/issues/2869) -- ASAN detects memory leaks [\#2865](https://github.com/nlohmann/json/issues/2865) -- Binary subtype field cannot represent all CBOR tags [\#2863](https://github.com/nlohmann/json/issues/2863) -- string literals possibly being parsed as another type due to the presence of only digits and full-stops [\#2852](https://github.com/nlohmann/json/issues/2852) -- json::parse\(\) works only with absolute paths [\#2851](https://github.com/nlohmann/json/issues/2851) -- Compiler Warnings on Raspberry Pi OS [\#2850](https://github.com/nlohmann/json/issues/2850) -- Braced initialization and aggregate initialization behavior is different for `json::array()` function call. [\#2848](https://github.com/nlohmann/json/issues/2848) -- 3.9.1: test suite is failing [\#2845](https://github.com/nlohmann/json/issues/2845) -- Documentation for macro JSON\_NO\_IO is missing [\#2842](https://github.com/nlohmann/json/issues/2842) -- Assertion failure when inserting into arrays with JSON\_DIAGNOSTICS set [\#2838](https://github.com/nlohmann/json/issues/2838) -- HELP! There is a memory leak in the code?! [\#2837](https://github.com/nlohmann/json/issues/2837) -- Elegant conversion of a 2-D-json array to a standard C++ array [\#2805](https://github.com/nlohmann/json/issues/2805) -- Swift Package Manager support [\#2802](https://github.com/nlohmann/json/issues/2802) -- Referencing a subkey which doesn't exist gives crash [\#2797](https://github.com/nlohmann/json/issues/2797) -- Failed benchmark due to renamed branch [\#2796](https://github.com/nlohmann/json/issues/2796) -- Build Errors with VS 2019 and json Version 3.9.1 when attempting to replicate SAX Example [\#2782](https://github.com/nlohmann/json/issues/2782) -- Value with spaces cannot be parsed [\#2781](https://github.com/nlohmann/json/issues/2781) -- \[Question\] CBOR rfc support. [\#2779](https://github.com/nlohmann/json/issues/2779) -- Using JSON.hpp header file in Visual Studio 2013 \(C++ Project\) [\#2775](https://github.com/nlohmann/json/issues/2775) -- compilation error on clang-8 + C++17 [\#2759](https://github.com/nlohmann/json/issues/2759) -- Undefined symbol EOF [\#2755](https://github.com/nlohmann/json/issues/2755) -- Parsing a string into json object behaves differently under g++ and MinGW compilers. [\#2746](https://github.com/nlohmann/json/issues/2746) -- big git history size [\#2742](https://github.com/nlohmann/json/issues/2742) -- How to get reference of std::vector\ [\#2735](https://github.com/nlohmann/json/issues/2735) -- CMake failure in VS2019 Community [\#2734](https://github.com/nlohmann/json/issues/2734) -- Possibility to use with custom c++ version to use in intel sgx enclaves [\#2730](https://github.com/nlohmann/json/issues/2730) -- Possibility to use without the dependency to file io and streams to use in intel sgx enclaves [\#2728](https://github.com/nlohmann/json/issues/2728) -- error C2784& error C2839... in my visual studio 2015 compiler [\#2726](https://github.com/nlohmann/json/issues/2726) -- `-fno-expection` not respected anymore in 3.9.1 [\#2725](https://github.com/nlohmann/json/issues/2725) -- When exceptions disabled with JSON\_NOEXCEPTION, lib just aborts without any message [\#2724](https://github.com/nlohmann/json/issues/2724) -- Critical error detected c0000374 on windows10 msvc 2019 16.8.5 [\#2710](https://github.com/nlohmann/json/issues/2710) -- unused parameter error/warning [\#2706](https://github.com/nlohmann/json/issues/2706) -- How to store data into a Map from json file [\#2691](https://github.com/nlohmann/json/issues/2691) -- Tests do not compile with pre-release glibc [\#2686](https://github.com/nlohmann/json/issues/2686) -- compile errors .... chromium-style [\#2680](https://github.com/nlohmann/json/issues/2680) -- .dump\(\) not allowing compact form [\#2678](https://github.com/nlohmann/json/issues/2678) -- error: no matching function for call to ‘nlohmann::basic\_json\<\>::value\(int, std::set\&\)’ [\#2671](https://github.com/nlohmann/json/issues/2671) -- Compiler warning: unused parameter [\#2668](https://github.com/nlohmann/json/issues/2668) -- Deserializing to a struct as shown on the project homepage throws compile time errors [\#2665](https://github.com/nlohmann/json/issues/2665) -- Unable to compile on MSVC 2019 with SDL checking enabled: This function or variable may be unsafe [\#2664](https://github.com/nlohmann/json/issues/2664) -- terminating with uncaught exception of type nlohmann::detail::type\_error: \[json.exception.type\_error.302\] type must be array, but is object [\#2661](https://github.com/nlohmann/json/issues/2661) -- unused-parameter on OSX when Diagnostics is off [\#2658](https://github.com/nlohmann/json/issues/2658) -- std::pair wrong serialization [\#2655](https://github.com/nlohmann/json/issues/2655) -- The result of json is\_number\_integer\(\) function is wrong when read a json file [\#2653](https://github.com/nlohmann/json/issues/2653) -- 2 backslash cause problem [\#2652](https://github.com/nlohmann/json/issues/2652) -- No support for using an external/system copy of Hedley [\#2651](https://github.com/nlohmann/json/issues/2651) -- error: incomplete type 'qfloat16' used in type trait expression [\#2650](https://github.com/nlohmann/json/issues/2650) -- Unused variable in exception class when not using improved diagnostics [\#2646](https://github.com/nlohmann/json/issues/2646) -- I am trying to do this - converting from wstring works incorrectly! [\#2642](https://github.com/nlohmann/json/issues/2642) -- Exception 207 On ARM Processor During Literal String Parsing [\#2634](https://github.com/nlohmann/json/issues/2634) -- double free or corruption \(!prev\) error on Json push\_back and write [\#2632](https://github.com/nlohmann/json/issues/2632) -- nlohmann::detail::parse\_error: syntax error while parsing CBOR string: expected length specification \(0x60-0x7B\) or indefinite string type \(0x7F\) [\#2629](https://github.com/nlohmann/json/issues/2629) -- please allow disabling implicit conversions in non-single-file use [\#2621](https://github.com/nlohmann/json/issues/2621) -- Preserve decimal formatting [\#2618](https://github.com/nlohmann/json/issues/2618) -- Visual Studio Visual Assist code issues reported by VA code inspection of file json.hpp [\#2615](https://github.com/nlohmann/json/issues/2615) -- Missing get function and no viable overloaded '=' on mac [\#2610](https://github.com/nlohmann/json/issues/2610) -- corruption when parse from string [\#2603](https://github.com/nlohmann/json/issues/2603) -- Parse from byte-vector results in compile error [\#2602](https://github.com/nlohmann/json/issues/2602) -- Memory leak when working on ARM Linux [\#2601](https://github.com/nlohmann/json/issues/2601) -- Unhandled exception in test-cbor.exe Stack overflow when debugging project with Visual Studio 2019 16.7.7 compiled with c++17 or c++latest [\#2598](https://github.com/nlohmann/json/issues/2598) -- Error in download\_test\_data.vcxproj when compiling with Visual Studio 2019 16.7.7 Professional msbuild on Windows 10 2004 Professional [\#2594](https://github.com/nlohmann/json/issues/2594) -- Warnings C4715 and C4127 when building json-3.9.1 with Visual Studio 2019 16.7.7 [\#2592](https://github.com/nlohmann/json/issues/2592) -- I tried some change to dump\(\) for \[1,2,3...\] [\#2584](https://github.com/nlohmann/json/issues/2584) -- try/catch block does not catch parsing error [\#2579](https://github.com/nlohmann/json/issues/2579) -- Serializing uint64\_t is broken for large values [\#2578](https://github.com/nlohmann/json/issues/2578) -- deserializing arrays should be part of the library [\#2575](https://github.com/nlohmann/json/issues/2575) -- Deserialization to std::array with non-default constructable types fails [\#2574](https://github.com/nlohmann/json/issues/2574) -- Compilation error when trying to use same type for number\_integer\_t and number\_unsigned\_t in basic\_json template specification. [\#2573](https://github.com/nlohmann/json/issues/2573) -- compiler error: directive output may be truncated writing between 2 and 8 bytes [\#2572](https://github.com/nlohmann/json/issues/2572) -- Incorrect convert map to json when key cannot construct an string i.e. int [\#2564](https://github.com/nlohmann/json/issues/2564) -- no matching function for call to ‘nlohmann::basic\_json\<\>::basic\_json\(\\)’ [\#2559](https://github.com/nlohmann/json/issues/2559) -- type\_error factory creates a dangling pointer \(in VisualStudio 2019\) [\#2535](https://github.com/nlohmann/json/issues/2535) -- Cannot assign from ordered\_json vector\ to value in not ordered json [\#2528](https://github.com/nlohmann/json/issues/2528) -- Qt6: Break changes [\#2519](https://github.com/nlohmann/json/issues/2519) -- valgrind memcheck Illegal instruction when use nlohmann::json::parse [\#2518](https://github.com/nlohmann/json/issues/2518) -- Buffer overflow [\#2515](https://github.com/nlohmann/json/issues/2515) -- Including CTest in the top-level CMakeLists.txt sets BUILD\_TESTING=ON for parent projects [\#2513](https://github.com/nlohmann/json/issues/2513) -- Compilation error when using NLOHMANN\_JSON\_SERIALIZE\_ENUM ordered\_json on libc++ [\#2491](https://github.com/nlohmann/json/issues/2491) -- Missing "void insert\( InputIt first, InputIt last \);" overload in nlohmann::ordered\_map [\#2490](https://github.com/nlohmann/json/issues/2490) -- Could not find a package configuration file provided by "nlohmann\_json" [\#2482](https://github.com/nlohmann/json/issues/2482) -- json becomes empty for unknown reason [\#2470](https://github.com/nlohmann/json/issues/2470) -- Using std::wstring as StringType fails compiling [\#2459](https://github.com/nlohmann/json/issues/2459) -- Sample code in GIF slide outdated \(cannot use emplace\(\) with array\) [\#2457](https://github.com/nlohmann/json/issues/2457) -- from\_json\ is treated as an array on latest MSVC [\#2453](https://github.com/nlohmann/json/issues/2453) -- MemorySanitizer: use-of-uninitialized-value [\#2449](https://github.com/nlohmann/json/issues/2449) -- I need help [\#2441](https://github.com/nlohmann/json/issues/2441) -- type conversion failing with clang ext\_vector\_type [\#2436](https://github.com/nlohmann/json/issues/2436) -- json::parse\(\) can't be resolved under specific circumstances [\#2427](https://github.com/nlohmann/json/issues/2427) -- from\_\*\(ptr, len\) deprecation [\#2426](https://github.com/nlohmann/json/issues/2426) -- Error ONLY in release mode [\#2425](https://github.com/nlohmann/json/issues/2425) -- "Custom data source" exemple make no sense [\#2423](https://github.com/nlohmann/json/issues/2423) -- Compile errors [\#2421](https://github.com/nlohmann/json/issues/2421) -- Refuses to compile in project [\#2419](https://github.com/nlohmann/json/issues/2419) -- Compilation failure of tests with C++20 standard \(caused by change of u8 literals\) [\#2413](https://github.com/nlohmann/json/issues/2413) -- No matching function for call to 'input\_adapter' under Xcode of with nlohmann version 3.9.1 [\#2412](https://github.com/nlohmann/json/issues/2412) -- Git tags are not valid semvers [\#2409](https://github.com/nlohmann/json/issues/2409) -- after dump, stderr output disappear [\#2403](https://github.com/nlohmann/json/issues/2403) -- Using custom string. [\#2398](https://github.com/nlohmann/json/issues/2398) -- value\(\) throws unhandled exception for partially specified json object [\#2393](https://github.com/nlohmann/json/issues/2393) -- assertion on runtime causes program to stop when accessing const json with missing key [\#2392](https://github.com/nlohmann/json/issues/2392) -- Usage with -fno-elide-constructors causes dump\(\) output to be array of `null`s [\#2387](https://github.com/nlohmann/json/issues/2387) -- Build fails with clang-cl due to override of CMAKE\_CXX\_COMPILER\(?\) [\#2384](https://github.com/nlohmann/json/issues/2384) -- std::optional not working with primitive types [\#2383](https://github.com/nlohmann/json/issues/2383) -- Unexpected array when initializing a json const& on gcc 4.8.5 using uniform syntax [\#2370](https://github.com/nlohmann/json/issues/2370) -- setprecision support [\#2362](https://github.com/nlohmann/json/issues/2362) -- json::parse\(allow\_exceptions = false\) documentation is misleading. [\#2360](https://github.com/nlohmann/json/issues/2360) -- std::begin and std::end usage without specifying std namespace [\#2359](https://github.com/nlohmann/json/issues/2359) -- Custom object conversion to json hangs in background thread [\#2358](https://github.com/nlohmann/json/issues/2358) -- Add support of nullable fields to NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE and NLOHMANN\_DEFINE\_TYPE\_INTRUSIVE [\#2356](https://github.com/nlohmann/json/issues/2356) -- the portfile for the vcpkg is not working. [\#2351](https://github.com/nlohmann/json/issues/2351) -- Compiler warns of implicit fallthrough when defining preprocessor macro NDEBUG [\#2348](https://github.com/nlohmann/json/issues/2348) -- Compile error on Intel compiler running in Windows [\#2346](https://github.com/nlohmann/json/issues/2346) -- Build error caused by overwriting CMAKE\_CXX\_COMPILER [\#2343](https://github.com/nlohmann/json/issues/2343) -- Error: an attribute list cannot appear here JSON\_HEDLEY\_DEPRECATED\_FOR [\#2342](https://github.com/nlohmann/json/issues/2342) -- compiler warning [\#2341](https://github.com/nlohmann/json/issues/2341) -- 3.9.0: tests make build non-reproducible [\#2324](https://github.com/nlohmann/json/issues/2324) -- Initialization different between gcc/clang [\#2311](https://github.com/nlohmann/json/issues/2311) -- Attempt to `get()` a numeric value as a type which cannot represent it should throw [\#2310](https://github.com/nlohmann/json/issues/2310) -- Surprising behaviour with overloaded operators [\#2256](https://github.com/nlohmann/json/issues/2256) -- ADL issue in input\_adapter [\#2248](https://github.com/nlohmann/json/issues/2248) -- Output adapters should be templated. [\#2172](https://github.com/nlohmann/json/issues/2172) -- error when using nlohmann::json, std::function and std::bind [\#2147](https://github.com/nlohmann/json/issues/2147) -- Remove undefined behavior for const operator\[\] [\#2111](https://github.com/nlohmann/json/issues/2111) -- json\({}\) gives null instead of empty object with GCC and -std=c++17 [\#2046](https://github.com/nlohmann/json/issues/2046) -- GDB pretty printing support [\#1952](https://github.com/nlohmann/json/issues/1952) -- Always compile tests with all warnings enabled and error out on warnings [\#1798](https://github.com/nlohmann/json/issues/1798) -- Fixes Cppcheck warnings [\#1759](https://github.com/nlohmann/json/issues/1759) -- How to get position info or parser context with custom from\_json\(\) that may throw exceptions? [\#1508](https://github.com/nlohmann/json/issues/1508) -- Suggestion to improve value\(\) accessors with respect to move semantics [\#1275](https://github.com/nlohmann/json/issues/1275) -- Add Key name to Exception [\#932](https://github.com/nlohmann/json/issues/932) - -- Overwork warning flags [\#2936](https://github.com/nlohmann/json/pull/2936) ([nlohmann](https://github.com/nlohmann)) -- Treat MSVC warnings as errors [\#2930](https://github.com/nlohmann/json/pull/2930) ([nlohmann](https://github.com/nlohmann)) -- All: fix warnings when compiling with -Wswitch-enum [\#2927](https://github.com/nlohmann/json/pull/2927) ([fhuberts](https://github.com/fhuberts)) -- Guard GCC pragmas [\#2925](https://github.com/nlohmann/json/pull/2925) ([nlohmann](https://github.com/nlohmann)) -- Supress -Wfloat-equal on intended float comparisions [\#2911](https://github.com/nlohmann/json/pull/2911) ([Finkman](https://github.com/Finkman)) -- Fix binary subtypes [\#2908](https://github.com/nlohmann/json/pull/2908) ([nlohmann](https://github.com/nlohmann)) -- Fix useless-cast warnings [\#2902](https://github.com/nlohmann/json/pull/2902) ([nlohmann](https://github.com/nlohmann)) -- Add regression test [\#2898](https://github.com/nlohmann/json/pull/2898) ([nlohmann](https://github.com/nlohmann)) -- Refactor Unicode tests [\#2889](https://github.com/nlohmann/json/pull/2889) ([nlohmann](https://github.com/nlohmann)) -- CMake cleanup [\#2885](https://github.com/nlohmann/json/pull/2885) ([nlohmann](https://github.com/nlohmann)) -- Avoid string in case of empty CBOR objects [\#2879](https://github.com/nlohmann/json/pull/2879) ([nlohmann](https://github.com/nlohmann)) -- Suppress C4127 warning in unit-json\_pointer.cpp [\#2875](https://github.com/nlohmann/json/pull/2875) ([nlohmann](https://github.com/nlohmann)) -- Fix truncation warning [\#2874](https://github.com/nlohmann/json/pull/2874) ([nlohmann](https://github.com/nlohmann)) -- Fix memory leak in to\_json [\#2872](https://github.com/nlohmann/json/pull/2872) ([nlohmann](https://github.com/nlohmann)) -- Fix assertion failure in diagnostics [\#2866](https://github.com/nlohmann/json/pull/2866) ([nlohmann](https://github.com/nlohmann)) -- Update documentation [\#2861](https://github.com/nlohmann/json/pull/2861) ([nlohmann](https://github.com/nlohmann)) -- Consistency with `using` in README.md [\#2826](https://github.com/nlohmann/json/pull/2826) ([justanotheranonymoususer](https://github.com/justanotheranonymoususer)) -- Properly constrain the basic\_json conversion operator [\#2825](https://github.com/nlohmann/json/pull/2825) ([ldionne](https://github.com/ldionne)) -- Fix CI [\#2817](https://github.com/nlohmann/json/pull/2817) ([nlohmann](https://github.com/nlohmann)) -- Specified git branch for google benchmark fetch in benchmark test [\#2795](https://github.com/nlohmann/json/pull/2795) ([grafail](https://github.com/grafail)) -- Add C++ standards to macOS matrix [\#2790](https://github.com/nlohmann/json/pull/2790) ([nlohmann](https://github.com/nlohmann)) -- Update URLs to HTTPS [\#2789](https://github.com/nlohmann/json/pull/2789) ([TotalCaesar659](https://github.com/TotalCaesar659)) -- Link to Conan Center package added [\#2771](https://github.com/nlohmann/json/pull/2771) ([offa](https://github.com/offa)) -- Keep consistent formatting [\#2770](https://github.com/nlohmann/json/pull/2770) ([jasmcaus](https://github.com/jasmcaus)) -- Add a cmake option to use SYSTEM in target\_include\_directories [\#2762](https://github.com/nlohmann/json/pull/2762) ([jpl-mac](https://github.com/jpl-mac)) -- replace EOF with std::char\_traits\::eof\(\) [\#2756](https://github.com/nlohmann/json/pull/2756) ([nlohmann](https://github.com/nlohmann)) -- Fix typo in README [\#2754](https://github.com/nlohmann/json/pull/2754) ([mortenfyhn](https://github.com/mortenfyhn)) -- Update documentation [\#2749](https://github.com/nlohmann/json/pull/2749) ([nlohmann](https://github.com/nlohmann)) -- Add documentation for numbers [\#2747](https://github.com/nlohmann/json/pull/2747) ([nlohmann](https://github.com/nlohmann)) -- Use Clang 12 in CI [\#2737](https://github.com/nlohmann/json/pull/2737) ([nlohmann](https://github.com/nlohmann)) -- Fixes \#2730 [\#2731](https://github.com/nlohmann/json/pull/2731) ([theShmoo](https://github.com/theShmoo)) -- Possibility to use without the dependency to file io and streams to use in intel sgx enclaves [\#2729](https://github.com/nlohmann/json/pull/2729) ([theShmoo](https://github.com/theShmoo)) -- Update json.hpp [\#2707](https://github.com/nlohmann/json/pull/2707) ([raduteo](https://github.com/raduteo)) -- pkg-config.pc.in: Don't concatenate paths [\#2690](https://github.com/nlohmann/json/pull/2690) ([doronbehar](https://github.com/doronbehar)) -- add more CI steps [\#2689](https://github.com/nlohmann/json/pull/2689) ([nlohmann](https://github.com/nlohmann)) -- Update doctest from 2.4.4 to 2.4.6 \(fixes \#2686\) [\#2687](https://github.com/nlohmann/json/pull/2687) ([musicinmybrain](https://github.com/musicinmybrain)) -- License fix [\#2683](https://github.com/nlohmann/json/pull/2683) ([nlohmann](https://github.com/nlohmann)) -- Update parse\_exceptions.md - correct `json::exception::parse_error` [\#2679](https://github.com/nlohmann/json/pull/2679) ([frasermarlow](https://github.com/frasermarlow)) -- Remove HEDLEY annotation from exception::what\(\) [\#2673](https://github.com/nlohmann/json/pull/2673) ([remyjette](https://github.com/remyjette)) -- Fix amount of entries in the json object [\#2659](https://github.com/nlohmann/json/pull/2659) ([abbaswasim](https://github.com/abbaswasim)) -- Fix missing 1.78 in example in README.md [\#2625](https://github.com/nlohmann/json/pull/2625) ([wawiesel](https://github.com/wawiesel)) -- Add GDB pretty printer [\#2607](https://github.com/nlohmann/json/pull/2607) ([nlohmann](https://github.com/nlohmann)) -- readme: fix tilde character display [\#2582](https://github.com/nlohmann/json/pull/2582) ([bl-ue](https://github.com/bl-ue)) -- Add support for deserialization of STL containers of non-default constructable types \(fixes \#2574\). [\#2576](https://github.com/nlohmann/json/pull/2576) ([AnthonyVH](https://github.com/AnthonyVH)) -- Better diagnostics [\#2562](https://github.com/nlohmann/json/pull/2562) ([nlohmann](https://github.com/nlohmann)) -- CI targets [\#2561](https://github.com/nlohmann/json/pull/2561) ([nlohmann](https://github.com/nlohmann)) -- Add switch to skip non-reproducible tests. [\#2560](https://github.com/nlohmann/json/pull/2560) ([nlohmann](https://github.com/nlohmann)) -- Fix compilation of input\_adapter\(container\) in edge cases [\#2553](https://github.com/nlohmann/json/pull/2553) ([jasujm](https://github.com/jasujm)) -- Allow parsing from std::byte containers [\#2550](https://github.com/nlohmann/json/pull/2550) ([nlohmann](https://github.com/nlohmann)) -- Travis doesn't run any tests in C++17 mode [\#2540](https://github.com/nlohmann/json/pull/2540) ([karzhenkov](https://github.com/karzhenkov)) -- Doctest is updated to v2.4.3 [\#2538](https://github.com/nlohmann/json/pull/2538) ([YarikTH](https://github.com/YarikTH)) -- Fix warnings [\#2537](https://github.com/nlohmann/json/pull/2537) ([nlohmann](https://github.com/nlohmann)) -- Fix a shadowing warning [\#2536](https://github.com/nlohmann/json/pull/2536) ([nlohmann](https://github.com/nlohmann)) -- Clarify license of is\_complete\_type implementation [\#2534](https://github.com/nlohmann/json/pull/2534) ([nlohmann](https://github.com/nlohmann)) -- Do not unconditionally redefine C++14 constructs [\#2533](https://github.com/nlohmann/json/pull/2533) ([nlohmann](https://github.com/nlohmann)) -- Doctest is updated to v2.4.1 [\#2525](https://github.com/nlohmann/json/pull/2525) ([YarikTH](https://github.com/YarikTH)) -- Add MAIN\_PROJECT check for test and install options [\#2514](https://github.com/nlohmann/json/pull/2514) ([globberwops](https://github.com/globberwops)) -- Ranged insert test section is added in unit-ordered\_json.cpp [\#2512](https://github.com/nlohmann/json/pull/2512) ([YarikTH](https://github.com/YarikTH)) -- Add asserts to suppress C28020 [\#2447](https://github.com/nlohmann/json/pull/2447) ([jbzdarkid](https://github.com/jbzdarkid)) -- Change argument name "subtype" in byte\_container\_with\_subtype [\#2444](https://github.com/nlohmann/json/pull/2444) ([linev](https://github.com/linev)) -- 📝 add CPM.Cmake example [\#2406](https://github.com/nlohmann/json/pull/2406) ([leozz37](https://github.com/leozz37)) -- Fix move constructor of json\_ref [\#2405](https://github.com/nlohmann/json/pull/2405) ([karzhenkov](https://github.com/karzhenkov)) -- Properly select "Release" build for Travis [\#2375](https://github.com/nlohmann/json/pull/2375) ([karzhenkov](https://github.com/karzhenkov)) -- Update Hedley [\#2367](https://github.com/nlohmann/json/pull/2367) ([nlohmann](https://github.com/nlohmann)) -- Fix and extend documentation of discarded values [\#2363](https://github.com/nlohmann/json/pull/2363) ([nlohmann](https://github.com/nlohmann)) -- Fix typos in documentation [\#2354](https://github.com/nlohmann/json/pull/2354) ([rbuch](https://github.com/rbuch)) -- Remove "\#define private public" from tests [\#2352](https://github.com/nlohmann/json/pull/2352) ([nlohmann](https://github.com/nlohmann)) -- Remove -Wimplicit-fallthrough warning [\#2349](https://github.com/nlohmann/json/pull/2349) ([nlohmann](https://github.com/nlohmann)) -- Fix code to work without exceptions [\#2347](https://github.com/nlohmann/json/pull/2347) ([nlohmann](https://github.com/nlohmann)) -- fix cmake script overwriting compiler path [\#2344](https://github.com/nlohmann/json/pull/2344) ([ongjunjie](https://github.com/ongjunjie)) - -## [v3.9.1](https://github.com/nlohmann/json/releases/tag/v3.9.1) (2020-08-06) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.9.0...v3.9.1) - -- Can't parse not formatted JSON. [\#2340](https://github.com/nlohmann/json/issues/2340) -- parse returns desired array contained in array when JSON text begins with square bracket on gcc 7.5.0 [\#2339](https://github.com/nlohmann/json/issues/2339) -- Unexpected deserialization difference between Mac and Linux [\#2338](https://github.com/nlohmann/json/issues/2338) -- Reading ordered\_json from file causes compile error [\#2331](https://github.com/nlohmann/json/issues/2331) -- ignore\_comment=true fails on multiple consecutive lines starting with comments [\#2330](https://github.com/nlohmann/json/issues/2330) -- Update documentation about Homebrew installation and CMake integration - Homebrew [\#2326](https://github.com/nlohmann/json/issues/2326) -- Chinese character initialize error [\#2325](https://github.com/nlohmann/json/issues/2325) -- json.update and vector\does not work with ordered\_json [\#2315](https://github.com/nlohmann/json/issues/2315) -- Ambiguous call to overloaded function [\#2210](https://github.com/nlohmann/json/issues/2210) - -- Fix fallthrough warning [\#2333](https://github.com/nlohmann/json/pull/2333) ([nlohmann](https://github.com/nlohmann)) -- Fix lexer to properly cope with repeated comments [\#2332](https://github.com/nlohmann/json/pull/2332) ([nlohmann](https://github.com/nlohmann)) -- Fix name of Homebrew formula in documentation [\#2327](https://github.com/nlohmann/json/pull/2327) ([nlohmann](https://github.com/nlohmann)) -- fix typo [\#2320](https://github.com/nlohmann/json/pull/2320) ([wx257osn2](https://github.com/wx257osn2)) -- Fix a bug due to missing overloads in ordered\_map container [\#2319](https://github.com/nlohmann/json/pull/2319) ([nlohmann](https://github.com/nlohmann)) -- cmake: install pkg-config file relative to current\_binary\_dir [\#2318](https://github.com/nlohmann/json/pull/2318) ([eli-schwartz](https://github.com/eli-schwartz)) -- Fixed installation of pkg-config file on other than Ubuntu [\#2314](https://github.com/nlohmann/json/pull/2314) ([xvitaly](https://github.com/xvitaly)) - -## [v3.9.0](https://github.com/nlohmann/json/releases/tag/v3.9.0) (2020-07-27) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.8.0...v3.9.0) - -- Unknown Type Name clang error when using NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE [\#2313](https://github.com/nlohmann/json/issues/2313) -- Clang 10.0 / GCC 10.1 warnings on disabled exceptions [\#2304](https://github.com/nlohmann/json/issues/2304) -- Application stalls indefinitely with message byte size 10 [\#2293](https://github.com/nlohmann/json/issues/2293) -- linker error [\#2292](https://github.com/nlohmann/json/issues/2292) -- Add support for high-precision numbers in UBJSON encoding [\#2286](https://github.com/nlohmann/json/issues/2286) -- NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE fails if the length of the argument is 10 [\#2280](https://github.com/nlohmann/json/issues/2280) -- Custom types : MACRO expansion bug [\#2267](https://github.com/nlohmann/json/issues/2267) -- to/from\_json Failing To Convert String [\#2238](https://github.com/nlohmann/json/issues/2238) -- clang 9.0 report warning: unused type alias 'size\_type' \[-Wunused-local-typedef\] [\#2221](https://github.com/nlohmann/json/issues/2221) -- Enormous array created when working with map\ [\#2220](https://github.com/nlohmann/json/issues/2220) -- Can I disable sorting of json values [\#2219](https://github.com/nlohmann/json/issues/2219) -- Getting Qt types to work [\#2217](https://github.com/nlohmann/json/issues/2217) -- Convert to Qt QVariant [\#2216](https://github.com/nlohmann/json/issues/2216) -- How to custom serialize same data type of vector? [\#2215](https://github.com/nlohmann/json/issues/2215) -- json constructor does not support std::optional [\#2214](https://github.com/nlohmann/json/issues/2214) -- Failing to Parse Valid JSON [\#2209](https://github.com/nlohmann/json/issues/2209) -- \(De-\)Serialization of std::variant with namespaces [\#2208](https://github.com/nlohmann/json/issues/2208) -- Addint support for complex type [\#2207](https://github.com/nlohmann/json/issues/2207) -- array\_index possible out of range [\#2205](https://github.com/nlohmann/json/issues/2205) -- Object deserialized as array [\#2204](https://github.com/nlohmann/json/issues/2204) -- Sending to a function a reference to a sub-branch [\#2200](https://github.com/nlohmann/json/issues/2200) -- How to Serialize derived class to JSON object? [\#2199](https://github.com/nlohmann/json/issues/2199) -- JSON incorrectly serialized [\#2198](https://github.com/nlohmann/json/issues/2198) -- Exception Unhandled out\_of\_range error [\#2197](https://github.com/nlohmann/json/issues/2197) -- msgpack serialisation : float is treated as 64bit float, not 32bit float. [\#2196](https://github.com/nlohmann/json/issues/2196) -- Is it possible to use compile-time type guarantees for JSON structures? [\#2195](https://github.com/nlohmann/json/issues/2195) -- Question : performance against python dict [\#2194](https://github.com/nlohmann/json/issues/2194) -- vs2017 compile error [\#2192](https://github.com/nlohmann/json/issues/2192) -- Check if a key exists [\#2191](https://github.com/nlohmann/json/issues/2191) -- Failed to run tests due to missing test data on builders without Internet access [\#2190](https://github.com/nlohmann/json/issues/2190) -- 3.8.0: unit-cbor.cpp test failures [\#2189](https://github.com/nlohmann/json/issues/2189) -- 'nlohmann/json.hpp' file not found [\#2188](https://github.com/nlohmann/json/issues/2188) -- How to send json data over the wire? [\#2185](https://github.com/nlohmann/json/issues/2185) -- Ubuntu 16 not supporting nlohmann/json? [\#2184](https://github.com/nlohmann/json/issues/2184) -- .get\ causing emdash errors [\#2180](https://github.com/nlohmann/json/issues/2180) -- Object properties should not be re-sorted alphabetically [\#2179](https://github.com/nlohmann/json/issues/2179) -- Custom type registration : instrusive API [\#2175](https://github.com/nlohmann/json/issues/2175) -- Many version of the function "void to\_json\(json& j, const MyStruct& struct\)" [\#2171](https://github.com/nlohmann/json/issues/2171) -- How should strings be escaped? [\#2155](https://github.com/nlohmann/json/issues/2155) -- Adding a value to an existing json puts it at the beginning instead of the end [\#2149](https://github.com/nlohmann/json/issues/2149) -- The header file is big, can we use what we need. [\#2134](https://github.com/nlohmann/json/issues/2134) -- Changing the default format for unordered\_map \(or other set\) [\#2132](https://github.com/nlohmann/json/issues/2132) -- Getting size of deserialized bson document [\#2131](https://github.com/nlohmann/json/issues/2131) -- implicit conversion failure [\#2128](https://github.com/nlohmann/json/issues/2128) -- Error thrown when parsing in a subclass [\#2124](https://github.com/nlohmann/json/issues/2124) -- explicit conversion to string not considered for std::map keys in GCC8 [\#2096](https://github.com/nlohmann/json/issues/2096) -- Add support for JSONC [\#2061](https://github.com/nlohmann/json/issues/2061) -- Library provides template arg for string\_type but assumes std::string in some places [\#2059](https://github.com/nlohmann/json/issues/2059) -- incremental parsing with sax\_parser [\#2030](https://github.com/nlohmann/json/issues/2030) -- Question about flatten and unflatten [\#1989](https://github.com/nlohmann/json/issues/1989) -- CBOR parser doesn't skip tags [\#1968](https://github.com/nlohmann/json/issues/1968) -- Compilation failure using Clang on Windows [\#1898](https://github.com/nlohmann/json/issues/1898) -- Fail to build when including json.hpp as a system include [\#1818](https://github.com/nlohmann/json/issues/1818) -- Parsing string into json doesn't preserve the order correctly. [\#1817](https://github.com/nlohmann/json/issues/1817) -- \[C++17\] Allow std::optional to convert to nlohmann::json [\#1749](https://github.com/nlohmann/json/issues/1749) -- How can I save json object in file in order? [\#1717](https://github.com/nlohmann/json/issues/1717) -- Support for Comments [\#1513](https://github.com/nlohmann/json/issues/1513) -- clang compiler: error : unknown type name 'not' [\#1119](https://github.com/nlohmann/json/issues/1119) -- dump\(\) without alphabetical order [\#1106](https://github.com/nlohmann/json/issues/1106) -- operator T\(\) considered harmful [\#958](https://github.com/nlohmann/json/issues/958) -- Order of the elements in JSON object [\#952](https://github.com/nlohmann/json/issues/952) -- How to prevent alphabetical sorting of data? [\#727](https://github.com/nlohmann/json/issues/727) -- Why is an object ordering values by Alphabetical Order? [\#660](https://github.com/nlohmann/json/issues/660) -- Feature request: Comments [\#597](https://github.com/nlohmann/json/issues/597) -- Head Elements Sorting [\#543](https://github.com/nlohmann/json/issues/543) -- Automatic ordered JSON [\#424](https://github.com/nlohmann/json/issues/424) -- Support for comments. [\#376](https://github.com/nlohmann/json/issues/376) -- Optional comment support. [\#363](https://github.com/nlohmann/json/issues/363) -- Strip comments / Minify [\#294](https://github.com/nlohmann/json/issues/294) -- maintaining order of keys during iteration [\#106](https://github.com/nlohmann/json/issues/106) - -- Update documentation [\#2312](https://github.com/nlohmann/json/pull/2312) ([nlohmann](https://github.com/nlohmann)) -- Fix bug in CBOR tag handling [\#2308](https://github.com/nlohmann/json/pull/2308) ([nlohmann](https://github.com/nlohmann)) -- added inline to NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE macro [\#2306](https://github.com/nlohmann/json/pull/2306) ([jwittbrodt](https://github.com/jwittbrodt)) -- fixes unused variable 'ex' for \#2304 [\#2305](https://github.com/nlohmann/json/pull/2305) ([AODQ](https://github.com/AODQ)) -- Cleanup [\#2303](https://github.com/nlohmann/json/pull/2303) ([nlohmann](https://github.com/nlohmann)) -- Add test with multiple translation units [\#2301](https://github.com/nlohmann/json/pull/2301) ([nlohmann](https://github.com/nlohmann)) -- Merge GitHub actions [\#2300](https://github.com/nlohmann/json/pull/2300) ([nlohmann](https://github.com/nlohmann)) -- Fix unused parameter [\#2299](https://github.com/nlohmann/json/pull/2299) ([nlohmann](https://github.com/nlohmann)) -- Add support for high-precision numbers in UBJSON encoding [\#2297](https://github.com/nlohmann/json/pull/2297) ([nlohmann](https://github.com/nlohmann)) -- fix eof for get\_binary and get\_string [\#2294](https://github.com/nlohmann/json/pull/2294) ([jprochazk](https://github.com/jprochazk)) -- Serialisation macros: increase upper bound on number of member variables [\#2287](https://github.com/nlohmann/json/pull/2287) ([pfeatherstone](https://github.com/pfeatherstone)) -- add inline specifier for detail::combine [\#2285](https://github.com/nlohmann/json/pull/2285) ([T0b1-iOS](https://github.com/T0b1-iOS)) -- Add static assertion for missing binary function in SAX interface [\#2282](https://github.com/nlohmann/json/pull/2282) ([nlohmann](https://github.com/nlohmann)) -- Add test for target\_include\_directories [\#2279](https://github.com/nlohmann/json/pull/2279) ([nlohmann](https://github.com/nlohmann)) -- Clean up maintainer Makefiles and fix some linter warnings [\#2274](https://github.com/nlohmann/json/pull/2274) ([nlohmann](https://github.com/nlohmann)) -- Add option to ignore CBOR tags [\#2273](https://github.com/nlohmann/json/pull/2273) ([nlohmann](https://github.com/nlohmann)) -- Hash function without allocation [\#2269](https://github.com/nlohmann/json/pull/2269) ([nlohmann](https://github.com/nlohmann)) -- Add ClangCL for MSVC [\#2268](https://github.com/nlohmann/json/pull/2268) ([t-b](https://github.com/t-b)) -- Makefile: Always use SED variable [\#2264](https://github.com/nlohmann/json/pull/2264) ([t-b](https://github.com/t-b)) -- Add Xcode 12 CI [\#2262](https://github.com/nlohmann/json/pull/2262) ([nlohmann](https://github.com/nlohmann)) -- Make library work with Clang on Windows [\#2259](https://github.com/nlohmann/json/pull/2259) ([nlohmann](https://github.com/nlohmann)) -- Add ordered\_json specialization with ordered object keys [\#2258](https://github.com/nlohmann/json/pull/2258) ([nlohmann](https://github.com/nlohmann)) -- Add pkg-config file [\#2253](https://github.com/nlohmann/json/pull/2253) ([ericonr](https://github.com/ericonr)) -- Fix regression from \#2181 [\#2251](https://github.com/nlohmann/json/pull/2251) ([nlohmann](https://github.com/nlohmann)) -- Tag binary values in cbor if set [\#2244](https://github.com/nlohmann/json/pull/2244) ([matthewbauer](https://github.com/matthewbauer)) -- Make assert configurable via JSON\_ASSERT [\#2242](https://github.com/nlohmann/json/pull/2242) ([nlohmann](https://github.com/nlohmann)) -- Add specialization of get\_to [\#2233](https://github.com/nlohmann/json/pull/2233) ([nlohmann](https://github.com/nlohmann)) -- Refine documentation of error\_handler parameter [\#2232](https://github.com/nlohmann/json/pull/2232) ([nlohmann](https://github.com/nlohmann)) -- Simplify conversion from/to custom types [\#2225](https://github.com/nlohmann/json/pull/2225) ([nlohmann](https://github.com/nlohmann)) -- Remove unused typedefs [\#2224](https://github.com/nlohmann/json/pull/2224) ([nlohmann](https://github.com/nlohmann)) -- Enable CMake policy CMP0077 [\#2222](https://github.com/nlohmann/json/pull/2222) ([alexreinking](https://github.com/alexreinking)) -- Add option to ignore comments in parse/accept functions [\#2212](https://github.com/nlohmann/json/pull/2212) ([nlohmann](https://github.com/nlohmann)) -- Fix Clang-Tidy warnings [\#2211](https://github.com/nlohmann/json/pull/2211) ([nlohmann](https://github.com/nlohmann)) -- Simple ordered\_json that works on all supported compilers [\#2206](https://github.com/nlohmann/json/pull/2206) ([gatopeich](https://github.com/gatopeich)) -- Use unsigned indizies for array index in json pointer [\#2203](https://github.com/nlohmann/json/pull/2203) ([t-b](https://github.com/t-b)) -- Add option to not rely on Internet connectivity during test stage [\#2202](https://github.com/nlohmann/json/pull/2202) ([nlohmann](https://github.com/nlohmann)) -- Serialize floating-point numbers with 32 bit when possible \(MessagePack\) [\#2201](https://github.com/nlohmann/json/pull/2201) ([nlohmann](https://github.com/nlohmann)) -- Fix consistency in function `int_to_string()` [\#2193](https://github.com/nlohmann/json/pull/2193) ([dota17](https://github.com/dota17)) -- Fix issue\#1275 [\#2181](https://github.com/nlohmann/json/pull/2181) ([dota17](https://github.com/dota17)) -- C++20 support by removing swap specialization [\#2176](https://github.com/nlohmann/json/pull/2176) ([gracicot](https://github.com/gracicot)) -- Feat/explicit conversion operator [\#1559](https://github.com/nlohmann/json/pull/1559) ([theodelrieu](https://github.com/theodelrieu)) - -## [v3.8.0](https://github.com/nlohmann/json/releases/tag/v3.8.0) (2020-06-14) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.7.3...v3.8.0) - -- sorry delete this issue, i'm stupid [\#2187](https://github.com/nlohmann/json/issues/2187) -- Append to a std::nlohmann::json type [\#2186](https://github.com/nlohmann/json/issues/2186) -- Some troubles to compile the last revision [\#2177](https://github.com/nlohmann/json/issues/2177) -- ​\#​ Top level CMakeLists.txt​ -​project​\(FOO\) -... -​option​\(FOO\_USE\_EXTERNAL\_JSON ​"Use an external JSON library"​ ​OFF​\) -... -​add\_subdirectory​\(thirdparty\) -... -​add\_library​\(foo ...\) -... -​\#​ Note that the namespaced target will always be available regardless of the​ -​\#​ import method​ -​target\_link\_libraries​\(foo ​PRIVATE​ nlohmann\_json::nlohmann\_json\) [\#2170](https://github.com/nlohmann/json/issues/2170) -- https://www.github.com/nlohmann/json/tree/develop/include%2Fnlohmann%2Fjson\_fwd.hpp [\#2169](https://github.com/nlohmann/json/issues/2169) -- templated from\_json of non primitive types causes gcc error [\#2168](https://github.com/nlohmann/json/issues/2168) -- few warnings/errors in copy assignment [\#2167](https://github.com/nlohmann/json/issues/2167) -- Different output when upgrading from clang 9 to clang 10 [\#2166](https://github.com/nlohmann/json/issues/2166) -- Cannot build with VS 2019 / C++17 [\#2163](https://github.com/nlohmann/json/issues/2163) -- Q: When I received an illegal string,How the program knows? [\#2162](https://github.com/nlohmann/json/issues/2162) -- Problem while reading a json file [\#2161](https://github.com/nlohmann/json/issues/2161) -- converting std::chrono::system\_clock::time\_point to json. [\#2159](https://github.com/nlohmann/json/issues/2159) -- how to parse vector\ format [\#2157](https://github.com/nlohmann/json/issues/2157) -- nlohmann::json and =nullptr [\#2156](https://github.com/nlohmann/json/issues/2156) -- test-cbor fails [\#2154](https://github.com/nlohmann/json/issues/2154) -- Accessing array inside array syntax? [\#2151](https://github.com/nlohmann/json/issues/2151) -- Best way to catch errors when querying json [\#2150](https://github.com/nlohmann/json/issues/2150) -- JSON Data Mapping Key-Value from other Key-Value [\#2148](https://github.com/nlohmann/json/issues/2148) -- Conflicts with std \ compiling with GCC 10 [\#2146](https://github.com/nlohmann/json/issues/2146) -- Incorrect CMake FetchContent example [\#2142](https://github.com/nlohmann/json/issues/2142) -- Help for a Beginner? [\#2141](https://github.com/nlohmann/json/issues/2141) -- Read Json from File [\#2139](https://github.com/nlohmann/json/issues/2139) -- How to feed a predefined integer value into json string [\#2138](https://github.com/nlohmann/json/issues/2138) -- getting json array inside json object [\#2135](https://github.com/nlohmann/json/issues/2135) -- Add .contains example to doc [\#2133](https://github.com/nlohmann/json/issues/2133) -- Is it safe to return string.c\_str\(\) received from get\(\)? [\#2130](https://github.com/nlohmann/json/issues/2130) -- GCC 10: Compilation error when including any before including json header in C++17 mode [\#2129](https://github.com/nlohmann/json/issues/2129) -- Intersection of two json files [\#2127](https://github.com/nlohmann/json/issues/2127) -- App crashes when dump method called for non ascii chars. [\#2126](https://github.com/nlohmann/json/issues/2126) -- iterator based erase method [\#2122](https://github.com/nlohmann/json/issues/2122) -- quick and convenient api to get/set nested json values [\#2120](https://github.com/nlohmann/json/issues/2120) -- assigning nullptr to std::string [\#2118](https://github.com/nlohmann/json/issues/2118) -- usless\_cast warnings with gcc 9.3 and 10.1 \(C++17\) [\#2114](https://github.com/nlohmann/json/issues/2114) -- clang 10 warning [\#2113](https://github.com/nlohmann/json/issues/2113) -- Possible incorrect \_MSC\_VER reference [\#2112](https://github.com/nlohmann/json/issues/2112) -- warning under gcc 10.1 [\#2110](https://github.com/nlohmann/json/issues/2110) -- Wdeprecated-declarations from GCC v10.1.0 [\#2109](https://github.com/nlohmann/json/issues/2109) -- Global std::vector from json [\#2108](https://github.com/nlohmann/json/issues/2108) -- heap-buffer-overflow when using nlohmann/json, ASAN, and gtest [\#2107](https://github.com/nlohmann/json/issues/2107) -- exception 0x770DC5AF when i read an special char in json file [\#2106](https://github.com/nlohmann/json/issues/2106) -- json::parse\(\) fails to parse a dump\(2,' '\) output, yet does successfully parse dump\(\) [\#2105](https://github.com/nlohmann/json/issues/2105) -- run test-udt error in MSVC 19.16.27034.0 [\#2103](https://github.com/nlohmann/json/issues/2103) -- Unable to dump to stringstream [\#2102](https://github.com/nlohmann/json/issues/2102) -- Can't ad an object in another objet [\#2101](https://github.com/nlohmann/json/issues/2101) -- Implicit conversion causes "cannot use operator\[\] with a string argument with string" [\#2098](https://github.com/nlohmann/json/issues/2098) -- C++20: char8\_t [\#2097](https://github.com/nlohmann/json/issues/2097) -- Compilation issues when included in project [\#2094](https://github.com/nlohmann/json/issues/2094) -- string value with null character causes infinite loop [\#2093](https://github.com/nlohmann/json/issues/2093) -- corrupted size vs. prev\_size \(aborted\) [\#2092](https://github.com/nlohmann/json/issues/2092) -- Get string field content without return std::string copy [\#2091](https://github.com/nlohmann/json/issues/2091) -- JSON Comments \(JSON 5\) [\#2090](https://github.com/nlohmann/json/issues/2090) -- Remove \#include \ [\#2089](https://github.com/nlohmann/json/issues/2089) -- JSON library as a git submodule [\#2088](https://github.com/nlohmann/json/issues/2088) -- Apple Clang 11.0.3 on MacOS Catalina 10.15.4 not compiling [\#2087](https://github.com/nlohmann/json/issues/2087) -- Value function return empty object even if it exist [\#2086](https://github.com/nlohmann/json/issues/2086) -- Cannot debug but Run works [\#2085](https://github.com/nlohmann/json/issues/2085) -- Question about serialization. [\#2084](https://github.com/nlohmann/json/issues/2084) -- How to include in an external project [\#2083](https://github.com/nlohmann/json/issues/2083) -- Missing tests for binary values [\#2082](https://github.com/nlohmann/json/issues/2082) -- How to override default string serialization? [\#2079](https://github.com/nlohmann/json/issues/2079) -- Can't have a json type as a property in an arbitrary type [\#2078](https://github.com/nlohmann/json/issues/2078) -- New release? [\#2075](https://github.com/nlohmann/json/issues/2075) -- CMake FetchContent \> Updating the documentation? [\#2073](https://github.com/nlohmann/json/issues/2073) -- How to convert STL Vector \(of user defined type\) to Json [\#2072](https://github.com/nlohmann/json/issues/2072) -- how to make an array of objects [\#2070](https://github.com/nlohmann/json/issues/2070) -- ‘\_\_int64’ was not declared [\#2068](https://github.com/nlohmann/json/issues/2068) -- \[json.exception.type\_error.317\] cannot serialize binary data to text JSON [\#2067](https://github.com/nlohmann/json/issues/2067) -- Unexpected end of input; expected '\[', '{', or a literal [\#2066](https://github.com/nlohmann/json/issues/2066) -- Json structure can be nested? [\#2065](https://github.com/nlohmann/json/issues/2065) -- Bug: returning reference to local temporary object [\#2064](https://github.com/nlohmann/json/issues/2064) -- Allow to use non strict parsing [\#2063](https://github.com/nlohmann/json/issues/2063) -- Crashing on json::at [\#2062](https://github.com/nlohmann/json/issues/2062) -- How to convert a const std::vector\ message to a json, to be able to parse it and extract information from it? Can you point to any examples? [\#2058](https://github.com/nlohmann/json/issues/2058) -- Nice library [\#2057](https://github.com/nlohmann/json/issues/2057) -- json.hpp:15372:22: error: expected unqualified-id if \(not std::isfinite\(x\)\): Started getting this bug after updating my XCode [\#2056](https://github.com/nlohmann/json/issues/2056) -- Confused as how I can extract the values from the JSON object. [\#2055](https://github.com/nlohmann/json/issues/2055) -- Warnings with GCC 10 [\#2052](https://github.com/nlohmann/json/issues/2052) -- Warnings with Clang 10 [\#2049](https://github.com/nlohmann/json/issues/2049) -- Update doctest [\#2048](https://github.com/nlohmann/json/issues/2048) -- Unclear error message: "cannot use operator\[\] with a string argument with array" [\#2047](https://github.com/nlohmann/json/issues/2047) -- Serializing std::variant\\> [\#2045](https://github.com/nlohmann/json/issues/2045) -- Crash when parse big jsonfile [\#2042](https://github.com/nlohmann/json/issues/2042) -- How to check if a key exists without silently generating null objects on the path [\#2041](https://github.com/nlohmann/json/issues/2041) -- Crash when traversing over items\(\) of temporary json objects [\#2040](https://github.com/nlohmann/json/issues/2040) -- How to parse multiple line value ? [\#2039](https://github.com/nlohmann/json/issues/2039) -- SAX API uses unsigned std::size\_t but -1 if element size is not known; [\#2037](https://github.com/nlohmann/json/issues/2037) -- How to parse big decimal data [\#2036](https://github.com/nlohmann/json/issues/2036) -- how use template \ struct adl\_serializer [\#2035](https://github.com/nlohmann/json/issues/2035) -- auto iterator returned by find to handle value depending if is string or numeric. [\#2032](https://github.com/nlohmann/json/issues/2032) -- pass find returned iterator to numeric variable. [\#2031](https://github.com/nlohmann/json/issues/2031) -- Parse error on valid json file [\#2029](https://github.com/nlohmann/json/issues/2029) -- Is here any elegant way to combine serialization and deserialization code? [\#2028](https://github.com/nlohmann/json/issues/2028) -- Notes about dump function [\#2027](https://github.com/nlohmann/json/issues/2027) -- Different JSON printouts for empty dictionary on Linux and Mac. [\#2026](https://github.com/nlohmann/json/issues/2026) -- easier way to get exception reason out of json\_sax\_dom\_callback\_parser without exceptions [\#2024](https://github.com/nlohmann/json/issues/2024) -- Using fifo\_map with base class and derived class [\#2023](https://github.com/nlohmann/json/issues/2023) -- Error reading JSON File [\#2022](https://github.com/nlohmann/json/issues/2022) -- Parse causing crash on android. Cannot catch. [\#2021](https://github.com/nlohmann/json/issues/2021) -- Extra backslashes in nested json [\#2020](https://github.com/nlohmann/json/issues/2020) -- How to create patch for merge\_patch input ? [\#2018](https://github.com/nlohmann/json/issues/2018) -- CppUTest/include/CppUTestExt/MockSupport.h:40: error: default argument for ‘MockFailureReporter\* failureReporterForThisCall’ has type ‘void\*’ [\#2017](https://github.com/nlohmann/json/issues/2017) -- including another file [\#2016](https://github.com/nlohmann/json/issues/2016) -- GNU PREREQ Error with gcc 9.3.0 [\#2015](https://github.com/nlohmann/json/issues/2015) -- Parse error: json.exception.parse\_error.101 - invalid string: ill-formed UTF-8 byte [\#2014](https://github.com/nlohmann/json/issues/2014) -- Add more flexibility to basic\_json's ObjectType \(and ArrayType\) [\#2013](https://github.com/nlohmann/json/issues/2013) -- afl persistent mode [\#2012](https://github.com/nlohmann/json/issues/2012) -- Compiler Errors under VS2019 in Appveyor CI [\#2009](https://github.com/nlohmann/json/issues/2009) -- Another compilation failure with Visual Studio [\#2007](https://github.com/nlohmann/json/issues/2007) -- Implicit cast to std::string broken again with VS2019 16.5.0 [\#2006](https://github.com/nlohmann/json/issues/2006) -- error: no matching member function for call to 'AddRaw' [\#2005](https://github.com/nlohmann/json/issues/2005) -- When I re-create an object again after the network request, an error is reported [\#2003](https://github.com/nlohmann/json/issues/2003) -- How to merge \(and not replace\) different Json::Value objects in jsoncpp [\#2001](https://github.com/nlohmann/json/issues/2001) -- scalar transforms to list [\#2000](https://github.com/nlohmann/json/issues/2000) -- Dump JSON containing multibyte characters [\#1999](https://github.com/nlohmann/json/issues/1999) -- Build error when modify value [\#1998](https://github.com/nlohmann/json/issues/1998) -- How do i include a vector of pointers in my json? [\#1997](https://github.com/nlohmann/json/issues/1997) -- Compiler error wrt incomplete types changed in gcc8.3.0-26 [\#1996](https://github.com/nlohmann/json/issues/1996) -- NaN-like comparison behavior of discarded is inconvenient [\#1988](https://github.com/nlohmann/json/issues/1988) -- Maintaining JSON package in my CMake [\#1987](https://github.com/nlohmann/json/issues/1987) -- reading int number and string number [\#1986](https://github.com/nlohmann/json/issues/1986) -- Build error: keyword is hidden by macro definition! [\#1985](https://github.com/nlohmann/json/issues/1985) -- JSON patch diff for op=add formation is not as per standard \(RFC 6902\) [\#1983](https://github.com/nlohmann/json/issues/1983) -- json\_pointer.contains\(\) exception is incorrectly raised [\#1982](https://github.com/nlohmann/json/issues/1982) -- Error with non existing key [\#1981](https://github.com/nlohmann/json/issues/1981) -- Closed [\#1978](https://github.com/nlohmann/json/issues/1978) -- Where is the library built and what is the name? [\#1977](https://github.com/nlohmann/json/issues/1977) -- The cmake\_import example does not build [\#1976](https://github.com/nlohmann/json/issues/1976) -- Dumping core when reading invalid file [\#1975](https://github.com/nlohmann/json/issues/1975) -- Abort in dump\(\) method [\#1973](https://github.com/nlohmann/json/issues/1973) -- Unclear docs regarding parser\_callback\_t callbacks [\#1972](https://github.com/nlohmann/json/issues/1972) -- Possible memory leak on push\_back [\#1971](https://github.com/nlohmann/json/issues/1971) -- Is it possible to get a safe mutable reference/pointer to internal variant used in nlohmann json? [\#1970](https://github.com/nlohmann/json/issues/1970) -- Getting a flatten json to map\ [\#1957](https://github.com/nlohmann/json/issues/1957) -- forced type conversion or lexical cast without exception. [\#1955](https://github.com/nlohmann/json/issues/1955) -- Add json\_view type support to avoid excessive copying [\#1954](https://github.com/nlohmann/json/issues/1954) -- Adding "examples" section for real-life usages [\#1953](https://github.com/nlohmann/json/issues/1953) -- Add nlohmann::json::key\_type [\#1951](https://github.com/nlohmann/json/issues/1951) -- cannot use operator\[\] with a string argument with string [\#1949](https://github.com/nlohmann/json/issues/1949) -- std::ifstream \>\> json error [\#1948](https://github.com/nlohmann/json/issues/1948) -- Cannot update json data in an iterator? [\#1947](https://github.com/nlohmann/json/issues/1947) -- How can i build this library in VS 2017? [\#1943](https://github.com/nlohmann/json/issues/1943) -- json\_pointer.contains\(\) exceptions when path not found [\#1942](https://github.com/nlohmann/json/issues/1942) -- Nested objects serialize/deserialize [\#1941](https://github.com/nlohmann/json/issues/1941) -- Compile warning on architectures that are not x86 [\#1939](https://github.com/nlohmann/json/issues/1939) -- Version of nlohmann-json-dev in debian packages [\#1938](https://github.com/nlohmann/json/issues/1938) -- Create a json object for every cycle [\#1937](https://github.com/nlohmann/json/issues/1937) -- How to get the object name? [\#1936](https://github.com/nlohmann/json/issues/1936) -- Reserve and resize function for basic json [\#1935](https://github.com/nlohmann/json/issues/1935) -- How to use json parse in tsl::ordread\_map? [\#1934](https://github.com/nlohmann/json/issues/1934) -- C++14 support is not enabled with msvc2015 [\#1932](https://github.com/nlohmann/json/issues/1932) -- Need help with to\_json for derived class, keep getting "cannot use operator" [\#1931](https://github.com/nlohmann/json/issues/1931) -- How to handle std::vector\ [\#1930](https://github.com/nlohmann/json/issues/1930) -- Heap corruption issue [\#1929](https://github.com/nlohmann/json/issues/1929) -- Add `std::wistream` support. [\#1928](https://github.com/nlohmann/json/issues/1928) -- This i can write and read any file thanks [\#1927](https://github.com/nlohmann/json/issues/1927) -- How can I get this simple example working? [\#1926](https://github.com/nlohmann/json/issues/1926) -- emplace\_back does not seems to work with the int 0 [\#1925](https://github.com/nlohmann/json/issues/1925) -- Why nlohmann does not release memory [\#1924](https://github.com/nlohmann/json/issues/1924) -- Is it possible to have template `json::parse` with `noexcept` specifier? [\#1922](https://github.com/nlohmann/json/issues/1922) -- JSON to wstring? [\#1921](https://github.com/nlohmann/json/issues/1921) -- GCC 10 tests build failure [\#1920](https://github.com/nlohmann/json/issues/1920) -- Size of binary json representations [\#1919](https://github.com/nlohmann/json/issues/1919) -- Accessing strings \(for example in keys or values\) without having the lib create a copy of it. [\#1916](https://github.com/nlohmann/json/issues/1916) -- operator== documentation should show how to apply custom comparison function [\#1915](https://github.com/nlohmann/json/issues/1915) -- char8\_t and std::u8string support [\#1914](https://github.com/nlohmann/json/issues/1914) -- std::is\_pod is deprecated in C++20 [\#1913](https://github.com/nlohmann/json/issues/1913) -- Incomplete types reported by \(experimental\) GCC10 [\#1912](https://github.com/nlohmann/json/issues/1912) -- Compile warnings on MSVC 14.2 [\#1911](https://github.com/nlohmann/json/issues/1911) -- How to parse json file with type composition of std::optional and std::variant [\#1910](https://github.com/nlohmann/json/issues/1910) -- why root\_schema be implemented as unique\_ptr in json-validator.cpp,could I use it as shared\_ptr? [\#1908](https://github.com/nlohmann/json/issues/1908) -- compile error in gcc-6.3.0 [\#1906](https://github.com/nlohmann/json/issues/1906) -- Scalar constexpr is odr-used when used as json initializer [\#1905](https://github.com/nlohmann/json/issues/1905) -- install Slack app [\#1904](https://github.com/nlohmann/json/issues/1904) -- typo in a comment [\#1903](https://github.com/nlohmann/json/issues/1903) -- Watch JSON variables in Debug [\#1902](https://github.com/nlohmann/json/issues/1902) -- does Json sdk cares about dfc dfd utf8 issue? [\#1901](https://github.com/nlohmann/json/issues/1901) -- Allow multiple line string value in JSON [\#1897](https://github.com/nlohmann/json/issues/1897) -- Writing map to json file [\#1896](https://github.com/nlohmann/json/issues/1896) -- Small documentation mistake [\#1895](https://github.com/nlohmann/json/issues/1895) -- why static function `parse` cann't find in visual studio 2019 [\#1894](https://github.com/nlohmann/json/issues/1894) -- Best way to handle json files with missing key value pairs. [\#1893](https://github.com/nlohmann/json/issues/1893) -- accessing json object as multimap [\#1892](https://github.com/nlohmann/json/issues/1892) -- What is the best way to parse vec3s into glm::vec3 [\#1891](https://github.com/nlohmann/json/issues/1891) -- Get array of items without using vector [\#1890](https://github.com/nlohmann/json/issues/1890) -- Build errors \(clang 11.0.0\) on macOS 10.15.2 [\#1889](https://github.com/nlohmann/json/issues/1889) -- Multiple arrays to vectors help [\#1888](https://github.com/nlohmann/json/issues/1888) -- json::parse\(begin, end\) parse error on first character using uchar\* [\#1887](https://github.com/nlohmann/json/issues/1887) -- issue in free\(\) [\#1886](https://github.com/nlohmann/json/issues/1886) -- is\_number\_unsigned\(\) returns false for positive integers \(int or 0 or 1 literals\) [\#1885](https://github.com/nlohmann/json/issues/1885) -- MSVC build failure with /Zc:\_\_cplusplus and C++17 [\#1883](https://github.com/nlohmann/json/issues/1883) -- RFC 6901 op:replace & arrays [\#1882](https://github.com/nlohmann/json/issues/1882) -- Problem with serialization of my custom template doubly-linked list [\#1881](https://github.com/nlohmann/json/issues/1881) -- is\_array\(\) is True, but raise 'cannot use operator\[\] for object iterators' [\#1880](https://github.com/nlohmann/json/issues/1880) -- Serialize dynamic array [\#1879](https://github.com/nlohmann/json/issues/1879) -- Serialization of struct object. [\#1877](https://github.com/nlohmann/json/issues/1877) -- warning:c4503 [\#1875](https://github.com/nlohmann/json/issues/1875) -- Why are flattened empty objects/arrays not representable? [\#1874](https://github.com/nlohmann/json/issues/1874) -- Container Overflow \(ASAN\) when using operator \>\> on an ifs [\#1873](https://github.com/nlohmann/json/issues/1873) -- Sub-array to vector or map object? [\#1870](https://github.com/nlohmann/json/issues/1870) -- WIP: QT \(cute\) type supports [\#1869](https://github.com/nlohmann/json/issues/1869) -- Compiler flags to disable features and shrink code size [\#1868](https://github.com/nlohmann/json/issues/1868) -- null strings [\#1867](https://github.com/nlohmann/json/issues/1867) -- Struct with array of struct and \_\_attribute\_\_\(\(packed\)\) [\#1866](https://github.com/nlohmann/json/issues/1866) -- Best way to extract numbers in the string? [\#1865](https://github.com/nlohmann/json/issues/1865) -- Displaying \\?\Volume{guid} from string to json giving error [\#1864](https://github.com/nlohmann/json/issues/1864) -- not working when compiling as x86 [\#1863](https://github.com/nlohmann/json/issues/1863) -- Skipping evaluation of log line expressions with a macro, is it possible? [\#1862](https://github.com/nlohmann/json/issues/1862) -- Suppress warnings [\#1861](https://github.com/nlohmann/json/issues/1861) -- conflit with g++ compile option -mwindows [\#1860](https://github.com/nlohmann/json/issues/1860) -- How to serialize nested classes to semi-flat JSON object? [\#1859](https://github.com/nlohmann/json/issues/1859) -- Memory Requirement for large json file [\#1858](https://github.com/nlohmann/json/issues/1858) -- Query a binary format \(BSON, CBOR, MessagePack, UBJSON\) [\#1856](https://github.com/nlohmann/json/issues/1856) -- Documentation on operator\[\] behavior with missing keys [\#1855](https://github.com/nlohmann/json/issues/1855) -- Problem in converting string into JSON; Can't parse successfully. [\#1854](https://github.com/nlohmann/json/issues/1854) -- json.at\_or\_default\(key, defaultval\) [\#1852](https://github.com/nlohmann/json/issues/1852) -- please improve the enum conversion documentation \(my example gist provided\) [\#1851](https://github.com/nlohmann/json/issues/1851) -- Default value returned on ValueType nlohmann::basic\_json::value \(const typename object\_t::key\_type& key, const ValueType& default\_value\) [\#1850](https://github.com/nlohmann/json/issues/1850) -- Accounting for arbitrary precision numerical literals [\#1849](https://github.com/nlohmann/json/issues/1849) -- While trying to make a simple array, I get a nested array instead [\#1848](https://github.com/nlohmann/json/issues/1848) -- How to reuse the parser and serializer intermediate storage? [\#1847](https://github.com/nlohmann/json/issues/1847) -- Too much content in json.hpp leads to slow compilation [\#1845](https://github.com/nlohmann/json/issues/1845) -- Cannot read some data in json file [\#1843](https://github.com/nlohmann/json/issues/1843) -- Precompiled JSON library? [\#1842](https://github.com/nlohmann/json/issues/1842) -- Please change assert into throw\(maybe\) in line 17946 [\#1841](https://github.com/nlohmann/json/issues/1841) -- JSON for modern C++ ECCN information [\#1840](https://github.com/nlohmann/json/issues/1840) -- CI: reduce build time for Travis valgrind [\#1836](https://github.com/nlohmann/json/issues/1836) -- How do I traverse a json object and add new elements into the hierarchy [\#1834](https://github.com/nlohmann/json/issues/1834) -- Invalid UTF-8 byte at index 1: 0x65 [\#1831](https://github.com/nlohmann/json/issues/1831) -- Serialize big data in json [\#1828](https://github.com/nlohmann/json/issues/1828) -- Backslash '\' in value causes exception [\#1827](https://github.com/nlohmann/json/issues/1827) -- from\_json for non default constructible class with dependency injection [\#1819](https://github.com/nlohmann/json/issues/1819) -- Semi-frequent timeouts in `test-unicode_all` with 3.6.1 \(aarch64\) [\#1816](https://github.com/nlohmann/json/issues/1816) -- input\_adapter not user extensible [\#1813](https://github.com/nlohmann/json/issues/1813) -- crash at json::destroy on android [\#1812](https://github.com/nlohmann/json/issues/1812) -- Logs are repeating while cmake [\#1809](https://github.com/nlohmann/json/issues/1809) -- Add a the possibility to add dynamic json objects [\#1795](https://github.com/nlohmann/json/issues/1795) -- Unnecessary test data file in the release [\#1790](https://github.com/nlohmann/json/issues/1790) -- Add support for parse stack limiting [\#1788](https://github.com/nlohmann/json/issues/1788) -- GCC -Wuseless-cast warnings [\#1777](https://github.com/nlohmann/json/issues/1777) -- compilation issue with NVCC 9.0 [\#1773](https://github.com/nlohmann/json/issues/1773) -- Unexpected behavior with fifo\_map json when copy and append [\#1763](https://github.com/nlohmann/json/issues/1763) -- Parse error [\#1761](https://github.com/nlohmann/json/issues/1761) -- Assignment \(using value\(\)\) to nonexistent element behaves differently on Xcode 8 vs Xcode 10 [\#1758](https://github.com/nlohmann/json/issues/1758) -- Readme out of date [\#1756](https://github.com/nlohmann/json/issues/1756) -- cmake\_\* tests don't use the build system's compiler [\#1747](https://github.com/nlohmann/json/issues/1747) -- Static assertions for template type properties required [\#1729](https://github.com/nlohmann/json/issues/1729) -- Use float and possibly half in json::to\_cbor [\#1719](https://github.com/nlohmann/json/issues/1719) -- json::from\_cbor does not respect allow\_exceptions = false when input is string literal [\#1715](https://github.com/nlohmann/json/issues/1715) -- /Zc:\_\_cplusplus leads to C2416 [\#1695](https://github.com/nlohmann/json/issues/1695) -- `unflatten` vs objects with number-ish keys [\#1575](https://github.com/nlohmann/json/issues/1575) -- A "thinner" source code tar as part of release? [\#1572](https://github.com/nlohmann/json/issues/1572) -- Repository is almost 450MB [\#1497](https://github.com/nlohmann/json/issues/1497) -- Substantial performance penalty caused by polymorphic input adapter [\#1457](https://github.com/nlohmann/json/issues/1457) -- Move tests to a separate repo [\#1235](https://github.com/nlohmann/json/issues/1235) -- reduce repos size [\#1185](https://github.com/nlohmann/json/issues/1185) -- CMakeLists.txt in release zips? [\#1184](https://github.com/nlohmann/json/issues/1184) -- Minimal branch? [\#1066](https://github.com/nlohmann/json/issues/1066) -- Move test blobs to a submodule? [\#732](https://github.com/nlohmann/json/issues/732) -- \[Question\] When using this as git submodule, will it clone the whole thing include test data and benchmark? [\#620](https://github.com/nlohmann/json/issues/620) -- Need to improve ignores.. [\#567](https://github.com/nlohmann/json/issues/567) -- Minimal repository \(current size very large\) [\#556](https://github.com/nlohmann/json/issues/556) -- For a header-only library you have to clone 214MB [\#482](https://github.com/nlohmann/json/issues/482) -- 17 MB / 90 MB repo size!? [\#96](https://github.com/nlohmann/json/issues/96) - -- Improve parse\_ubjson\_fuzzer [\#2182](https://github.com/nlohmann/json/pull/2182) ([tanuj208](https://github.com/tanuj208)) -- Add input adapter tests [\#2178](https://github.com/nlohmann/json/pull/2178) ([nlohmann](https://github.com/nlohmann)) -- Fix warnings [\#2174](https://github.com/nlohmann/json/pull/2174) ([nlohmann](https://github.com/nlohmann)) -- Fix PR\#1006 [\#2158](https://github.com/nlohmann/json/pull/2158) ([dota17](https://github.com/dota17)) -- Fix issue\#1972 [\#2153](https://github.com/nlohmann/json/pull/2153) ([dota17](https://github.com/dota17)) -- Update URLs to HTTPS [\#2152](https://github.com/nlohmann/json/pull/2152) ([TotalCaesar659](https://github.com/TotalCaesar659)) -- Fix Issue\#1813: user defined input adapters [\#2145](https://github.com/nlohmann/json/pull/2145) ([FrancoisChabot](https://github.com/FrancoisChabot)) -- Fix issue\#1939: Cast character to unsigned for comparison [\#2144](https://github.com/nlohmann/json/pull/2144) ([XyFreak](https://github.com/XyFreak)) -- Fix issue\#2142: readme: fix typo in CMake FetchContent example [\#2143](https://github.com/nlohmann/json/pull/2143) ([quentin-dev](https://github.com/quentin-dev)) -- Respect allow\_exceptions=false for binary formats [\#2140](https://github.com/nlohmann/json/pull/2140) ([nlohmann](https://github.com/nlohmann)) -- Fix issue 2112 [\#2137](https://github.com/nlohmann/json/pull/2137) ([dota17](https://github.com/dota17)) -- Add bleeding edge GCC to CI [\#2136](https://github.com/nlohmann/json/pull/2136) ([aokellermann](https://github.com/aokellermann)) -- Clean up implementation of binary type [\#2125](https://github.com/nlohmann/json/pull/2125) ([nlohmann](https://github.com/nlohmann)) -- Fixed a compilation error in MSVC [\#2121](https://github.com/nlohmann/json/pull/2121) ([gistrec](https://github.com/gistrec)) -- Overwork CI [\#2119](https://github.com/nlohmann/json/pull/2119) ([nlohmann](https://github.com/nlohmann)) -- Fix warnings from Clang 10 and GCC 9 [\#2116](https://github.com/nlohmann/json/pull/2116) ([nlohmann](https://github.com/nlohmann)) -- Do not include \ when using C++17 [\#2115](https://github.com/nlohmann/json/pull/2115) ([nlohmann](https://github.com/nlohmann)) -- Fix issue\#2086: disallow json::value\_t type parameter in value\(\) [\#2104](https://github.com/nlohmann/json/pull/2104) ([dota17](https://github.com/dota17)) -- Fix Coveralls integration [\#2100](https://github.com/nlohmann/json/pull/2100) ([nlohmann](https://github.com/nlohmann)) -- Add tests for binary values [\#2099](https://github.com/nlohmann/json/pull/2099) ([nlohmann](https://github.com/nlohmann)) -- Use external test data [\#2081](https://github.com/nlohmann/json/pull/2081) ([nlohmann](https://github.com/nlohmann)) -- Remove Doozer CI [\#2080](https://github.com/nlohmann/json/pull/2080) ([nlohmann](https://github.com/nlohmann)) -- Fix README.md. Missing ``` [\#2077](https://github.com/nlohmann/json/pull/2077) ([ArthurSonzogni](https://github.com/ArthurSonzogni)) -- Fix error message about invalid surrogate pairs [\#2076](https://github.com/nlohmann/json/pull/2076) ([rmisev](https://github.com/rmisev)) -- Add CMake fetchcontent documentation and tests [\#2074](https://github.com/nlohmann/json/pull/2074) ([ArthurSonzogni](https://github.com/ArthurSonzogni)) -- Properly pass serialize\_binary to dump function [\#2071](https://github.com/nlohmann/json/pull/2071) ([nlohmann](https://github.com/nlohmann)) -- Fix returning reference to local temporary object [\#2069](https://github.com/nlohmann/json/pull/2069) ([nlohmann](https://github.com/nlohmann)) -- updated wandbox link [\#2060](https://github.com/nlohmann/json/pull/2060) ([alexandermyasnikov](https://github.com/alexandermyasnikov)) -- Fix bug in diff function [\#2054](https://github.com/nlohmann/json/pull/2054) ([nlohmann](https://github.com/nlohmann)) -- Fix GCC compiler warnings [\#2053](https://github.com/nlohmann/json/pull/2053) ([nlohmann](https://github.com/nlohmann)) -- Fix Clang compiler warnings [\#2051](https://github.com/nlohmann/json/pull/2051) ([nlohmann](https://github.com/nlohmann)) -- Update doctest to 2.3.7 [\#2050](https://github.com/nlohmann/json/pull/2050) ([nlohmann](https://github.com/nlohmann)) -- Fix issue\#1719 [\#2044](https://github.com/nlohmann/json/pull/2044) ([dota17](https://github.com/dota17)) -- Add missing testcase about NaN in unit-constructor1.cpp [\#2043](https://github.com/nlohmann/json/pull/2043) ([dota17](https://github.com/dota17)) -- Templatize basic\_json constructor from json\_ref [\#2034](https://github.com/nlohmann/json/pull/2034) ([ArtemSarmini](https://github.com/ArtemSarmini)) -- Replace deprecated std::is\_pod [\#2033](https://github.com/nlohmann/json/pull/2033) ([nlohmann](https://github.com/nlohmann)) -- Fixes \#1971 \(memory leak in basic\_json::push\_back\) [\#2025](https://github.com/nlohmann/json/pull/2025) ([ArtemSarmini](https://github.com/ArtemSarmini)) -- fix \#1982:json\_pointer.contains\(\) exception is incorrectly raised [\#2019](https://github.com/nlohmann/json/pull/2019) ([dota17](https://github.com/dota17)) -- Update LICENSE.MIT [\#2010](https://github.com/nlohmann/json/pull/2010) ([magamig](https://github.com/magamig)) -- PR for \#2006 to test in AppVeyor. [\#2008](https://github.com/nlohmann/json/pull/2008) ([garethsb](https://github.com/garethsb)) -- Added wsjcpp.yml [\#2004](https://github.com/nlohmann/json/pull/2004) ([sea-kg](https://github.com/sea-kg)) -- fix error 'setw' is not a member of 'std' in Wandbox example [\#2002](https://github.com/nlohmann/json/pull/2002) ([alexandermyasnikov](https://github.com/alexandermyasnikov)) -- catch exceptions for json\_pointer : ..../+99 [\#1990](https://github.com/nlohmann/json/pull/1990) ([dota17](https://github.com/dota17)) -- Modify the document about operator== [\#1984](https://github.com/nlohmann/json/pull/1984) ([dota17](https://github.com/dota17)) -- Rename argument array\_index to array\_indx in json\_pointer methods [\#1980](https://github.com/nlohmann/json/pull/1980) ([linev](https://github.com/linev)) -- README: Fix string representation of `dump`ed `json` [\#1979](https://github.com/nlohmann/json/pull/1979) ([alexweej](https://github.com/alexweej)) -- fix warnings in serializer.hpp for VS2019 [\#1969](https://github.com/nlohmann/json/pull/1969) ([dota17](https://github.com/dota17)) -- Fix C26451 warnnings in to\_chars.hpp [\#1967](https://github.com/nlohmann/json/pull/1967) ([dota17](https://github.com/dota17)) -- appveyor.yml: Compile and test with latest version for \_\_cplusplus ma… [\#1958](https://github.com/nlohmann/json/pull/1958) ([t-b](https://github.com/t-b)) -- Fix typo in examples [\#1956](https://github.com/nlohmann/json/pull/1956) ([dota17](https://github.com/dota17)) -- templated input adapters [\#1950](https://github.com/nlohmann/json/pull/1950) ([FrancoisChabot](https://github.com/FrancoisChabot)) -- Update README.md : add a FAQ about memory release [\#1933](https://github.com/nlohmann/json/pull/1933) ([dota17](https://github.com/dota17)) -- Some typos [\#1923](https://github.com/nlohmann/json/pull/1923) ([Coeur](https://github.com/Coeur)) -- Fix link to parse function in README [\#1918](https://github.com/nlohmann/json/pull/1918) ([kastiglione](https://github.com/kastiglione)) -- Readme: Updated links to hunter repo & docs [\#1917](https://github.com/nlohmann/json/pull/1917) ([jothepro](https://github.com/jothepro)) -- Adds instruction for using Build2's package manager [\#1909](https://github.com/nlohmann/json/pull/1909) ([Klaim](https://github.com/Klaim)) -- Update README.md [\#1907](https://github.com/nlohmann/json/pull/1907) ([pauljurczak](https://github.com/pauljurczak)) -- Fix warning: ignoring return value [\#1871](https://github.com/nlohmann/json/pull/1871) ([sonulohani](https://github.com/sonulohani)) -- docs: add central repository as conan source to readme [\#1857](https://github.com/nlohmann/json/pull/1857) ([gocarlos](https://github.com/gocarlos)) -- README: Package in MSYS2 renamed to nlohmann-json [\#1853](https://github.com/nlohmann/json/pull/1853) ([podsvirov](https://github.com/podsvirov)) -- Fix msvc warnings [\#1846](https://github.com/nlohmann/json/pull/1846) ([MBalszun](https://github.com/MBalszun)) -- Update tests that generate CMake projects to use main project's C++ compiler [\#1844](https://github.com/nlohmann/json/pull/1844) ([Tridacnid](https://github.com/Tridacnid)) -- make CMake's version config file architecture-independent [\#1746](https://github.com/nlohmann/json/pull/1746) ([uhoreg](https://github.com/uhoreg)) -- Add binary type support to all binary file formats, as well as an internally represented binary type [\#1662](https://github.com/nlohmann/json/pull/1662) ([OmnipotentEntity](https://github.com/OmnipotentEntity)) - -## [v3.7.3](https://github.com/nlohmann/json/releases/tag/v3.7.3) (2019-11-17) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.7.2...v3.7.3) - -- Project branches [\#1839](https://github.com/nlohmann/json/issues/1839) -- Quadratic destruction complexity introduced in \#1436 [\#1837](https://github.com/nlohmann/json/issues/1837) -- Trying to open a file [\#1814](https://github.com/nlohmann/json/issues/1814) -- Comparing data type with value\_t::number\_integer fails [\#1783](https://github.com/nlohmann/json/issues/1783) -- CMake version config file is architecture-dependent [\#1697](https://github.com/nlohmann/json/issues/1697) - -- Fix quadratic destruction complexity [\#1838](https://github.com/nlohmann/json/pull/1838) ([nickaein](https://github.com/nickaein)) - -## [v3.7.2](https://github.com/nlohmann/json/releases/tag/v3.7.2) (2019-11-10) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.7.1...v3.7.2) - -- Segmentation fault in destructor in case of large inputs [\#1835](https://github.com/nlohmann/json/issues/1835) -- type\_name\(\) is not consistent with type\(\) [\#1833](https://github.com/nlohmann/json/issues/1833) -- json::parse is not a member [\#1832](https://github.com/nlohmann/json/issues/1832) -- How do you deal with json\* ? [\#1829](https://github.com/nlohmann/json/issues/1829) -- Combined find\_package/add\_subdirectory not linking libraries [\#1771](https://github.com/nlohmann/json/issues/1771) -- example code for ifstream reading a json file results in no operator error [\#1766](https://github.com/nlohmann/json/issues/1766) -- Warning: unsequenced modification and access to 'range' [\#1674](https://github.com/nlohmann/json/issues/1674) -- Segmentation fault \(stack overflow\) due to unbounded recursion [\#1419](https://github.com/nlohmann/json/issues/1419) -- Stack-overflow \(OSS-Fuzz 4234\) [\#832](https://github.com/nlohmann/json/issues/832) - -- Configure WhiteSource Bolt for GitHub [\#1830](https://github.com/nlohmann/json/pull/1830) ([whitesource-bolt-for-github[bot]](https://github.com/apps/whitesource-bolt-for-github)) -- Prevent stackoverflow caused by recursive deconstruction [\#1436](https://github.com/nlohmann/json/pull/1436) ([nickaein](https://github.com/nickaein)) - -## [v3.7.1](https://github.com/nlohmann/json/releases/tag/v3.7.1) (2019-11-06) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.7.0...v3.7.1) - -- std::is\_constructible is always true with tuple [\#1825](https://github.com/nlohmann/json/issues/1825) -- Can't compile from\_json\(std::valarray\\). [\#1824](https://github.com/nlohmann/json/issues/1824) -- json class should have a get\_or member function [\#1823](https://github.com/nlohmann/json/issues/1823) -- NLOHMANN\_JSON\_SERIALIZE\_ENUM macro capture's json objects by value [\#1822](https://github.com/nlohmann/json/issues/1822) -- Parse fails when number literals start with zero [\#1820](https://github.com/nlohmann/json/issues/1820) -- Weird behaviour of `contains` with `json_pointer` [\#1815](https://github.com/nlohmann/json/issues/1815) -- strange behaviour with json\_pointer and .contains\(\) [\#1811](https://github.com/nlohmann/json/issues/1811) -- Can \#1695 be re-opened? [\#1808](https://github.com/nlohmann/json/issues/1808) -- Merge two json objects [\#1807](https://github.com/nlohmann/json/issues/1807) -- std::is\_constructible\\> when to\_json not defined [\#1805](https://github.com/nlohmann/json/issues/1805) -- Private data on parsing [\#1802](https://github.com/nlohmann/json/issues/1802) -- Capturing Line and Position when querying [\#1800](https://github.com/nlohmann/json/issues/1800) -- json error on parsing DBL\_MAX from string [\#1796](https://github.com/nlohmann/json/issues/1796) -- De/Serialisation of vector of tupple object with nested obect need Help please [\#1794](https://github.com/nlohmann/json/issues/1794) -- Output json is corrupted [\#1793](https://github.com/nlohmann/json/issues/1793) -- variable name byte sometimes used as a \#define [\#1792](https://github.com/nlohmann/json/issues/1792) -- Can't read json file [\#1791](https://github.com/nlohmann/json/issues/1791) -- Problems with special German letters [\#1789](https://github.com/nlohmann/json/issues/1789) -- Support for trailing commas [\#1787](https://github.com/nlohmann/json/issues/1787) -- json\_pointer construction bug [\#1786](https://github.com/nlohmann/json/issues/1786) -- Visual Studio 2017 warning [\#1784](https://github.com/nlohmann/json/issues/1784) -- ciso646 header become obsolete [\#1782](https://github.com/nlohmann/json/issues/1782) -- Migrate LGTM.com installation from OAuth to GitHub App [\#1781](https://github.com/nlohmann/json/issues/1781) -- JSON comparison, contains and operator& [\#1778](https://github.com/nlohmann/json/issues/1778) -- pass a json object to a class contructor adds an array around the object [\#1776](https://github.com/nlohmann/json/issues/1776) -- 'Float' number\_float\_function\_t template parameter name conflicts with C '\#define Float float' [\#1775](https://github.com/nlohmann/json/issues/1775) -- A weird building problem :-\( [\#1774](https://github.com/nlohmann/json/issues/1774) -- What is this json\_ref? [\#1772](https://github.com/nlohmann/json/issues/1772) -- Interoperability with other languages [\#1770](https://github.com/nlohmann/json/issues/1770) -- Json dump [\#1768](https://github.com/nlohmann/json/issues/1768) -- json\_pointer\<\>::back\(\) should be const [\#1764](https://github.com/nlohmann/json/issues/1764) -- How to get value from array [\#1762](https://github.com/nlohmann/json/issues/1762) -- Merge two jsons [\#1757](https://github.com/nlohmann/json/issues/1757) -- Unable to locate nlohmann\_jsonConfig.cmake [\#1755](https://github.com/nlohmann/json/issues/1755) -- json.hpp won;t compile VS2019 CLR/CLI app but does in console app [\#1754](https://github.com/nlohmann/json/issues/1754) -- \[Nested Json Objects\] Segmentation fault [\#1753](https://github.com/nlohmann/json/issues/1753) -- remove/replace assert with exceptions [\#1752](https://github.com/nlohmann/json/issues/1752) -- Add array support for update\(\) function [\#1751](https://github.com/nlohmann/json/issues/1751) -- Is there a reason the `get_to` method is defined in `include/nlohmann/json.hpp` but not in `single_include/nlohmann/json.hpp`? [\#1750](https://github.com/nlohmann/json/issues/1750) -- how to validate json object before calling dump\(\) [\#1748](https://github.com/nlohmann/json/issues/1748) -- Unable to invoke accessors on json objects in lldb [\#1745](https://github.com/nlohmann/json/issues/1745) -- Escaping string before parsing [\#1743](https://github.com/nlohmann/json/issues/1743) -- Construction in a member initializer list using curly braces is set as 'array' [\#1742](https://github.com/nlohmann/json/issues/1742) -- Read a subkey from json object [\#1740](https://github.com/nlohmann/json/issues/1740) -- Serialize vector of glm:vec2 [\#1739](https://github.com/nlohmann/json/issues/1739) -- Support nlohmann::basic\_json::value with JSON\_NOEXCEPTION [\#1738](https://github.com/nlohmann/json/issues/1738) -- how to know the parse is error [\#1737](https://github.com/nlohmann/json/issues/1737) -- How to check if a given key exists in a JSON object [\#1736](https://github.com/nlohmann/json/issues/1736) -- Allow The Colon Key-Value Delimiter To Have A Space Before It \[@ READ ONLY\] [\#1735](https://github.com/nlohmann/json/issues/1735) -- Allow Tail { "Key": "Value" } Comma \[@ READ ONLY\] [\#1734](https://github.com/nlohmann/json/issues/1734) -- No-throw json::value\(\) [\#1733](https://github.com/nlohmann/json/issues/1733) -- JsonObject.dump\(\) [\#1732](https://github.com/nlohmann/json/issues/1732) -- basic\_json has no member "parse" [\#1731](https://github.com/nlohmann/json/issues/1731) -- Exception "type must be string, but is array" [\#1730](https://github.com/nlohmann/json/issues/1730) -- json::contains usage to find a path [\#1727](https://github.com/nlohmann/json/issues/1727) -- How to create JSON Object from my Structures of Data and Json File from that Object [\#1726](https://github.com/nlohmann/json/issues/1726) -- please provide an API to read JSON from file directly. [\#1725](https://github.com/nlohmann/json/issues/1725) -- How to modify a value stored at a key? [\#1723](https://github.com/nlohmann/json/issues/1723) -- CMake not correctly finding the configuration package for 3.7.0 [\#1721](https://github.com/nlohmann/json/issues/1721) -- name typo in the "spack package management" section of README.md [\#1720](https://github.com/nlohmann/json/issues/1720) -- How to add json to another json? [\#1718](https://github.com/nlohmann/json/issues/1718) -- json::parse\(\) ubsan regression with v3.7.0 [\#1716](https://github.com/nlohmann/json/issues/1716) -- What I am doing wrong?!? [\#1714](https://github.com/nlohmann/json/issues/1714) -- Potential memory leak detected by Valgrind [\#1713](https://github.com/nlohmann/json/issues/1713) -- json::parse is not thread safe? [\#1712](https://github.com/nlohmann/json/issues/1712) -- static analysis alarm by cppcheck [\#1711](https://github.com/nlohmann/json/issues/1711) -- The compilation time is slow [\#1710](https://github.com/nlohmann/json/issues/1710) -- not linking properly with cmake [\#1709](https://github.com/nlohmann/json/issues/1709) -- Error in dump\(\) with int64\_t minimum value [\#1708](https://github.com/nlohmann/json/issues/1708) -- Crash on trying to deserialize json string on 3ds homebrew [\#1707](https://github.com/nlohmann/json/issues/1707) -- Can't compile VS2019. 13 Errors [\#1706](https://github.com/nlohmann/json/issues/1706) -- find an object that matches the search criteria [\#1705](https://github.com/nlohmann/json/issues/1705) -- IntelliSense goes crazy on VS2019 [\#1704](https://github.com/nlohmann/json/issues/1704) -- Installing on Ubuntu 16.04 [\#1703](https://github.com/nlohmann/json/issues/1703) -- Where is json::parse now? [\#1702](https://github.com/nlohmann/json/issues/1702) -- Forward header should't be amalgamated [\#1700](https://github.com/nlohmann/json/issues/1700) -- Json support for Cmake version 2.8.12 [\#1699](https://github.com/nlohmann/json/issues/1699) -- Intruisive scientific notation when using .dump\(\); [\#1698](https://github.com/nlohmann/json/issues/1698) -- Is there support for automatic serialization/deserialization? [\#1696](https://github.com/nlohmann/json/issues/1696) -- on MSVC dump\(\) will hard crash for larger json [\#1693](https://github.com/nlohmann/json/issues/1693) -- puzzled implicit conversions [\#1692](https://github.com/nlohmann/json/issues/1692) -- Information: My project uses this awesome library [\#1691](https://github.com/nlohmann/json/issues/1691) -- Consider listing files explicitly instead of using GLOB [\#1686](https://github.com/nlohmann/json/issues/1686) -- Failing tests on MSVC with VS2019 15.9.13 x64 [\#1685](https://github.com/nlohmann/json/issues/1685) -- Consider putting the user-defined literals in a namespace [\#1682](https://github.com/nlohmann/json/issues/1682) -- Change from v2 to v3. Encoding with cp1252 [\#1680](https://github.com/nlohmann/json/issues/1680) -- How to add Fifo\_map into json using Cmake [\#1679](https://github.com/nlohmann/json/issues/1679) -- include.zip should contain meson.build [\#1672](https://github.com/nlohmann/json/issues/1672) -- \[Question\] How do I parse JSON into custom types? [\#1669](https://github.com/nlohmann/json/issues/1669) -- Binary \(0x05\) data type for BSON to JSON conversion [\#1668](https://github.com/nlohmann/json/issues/1668) -- Possible to call dump from lldb? [\#1666](https://github.com/nlohmann/json/issues/1666) -- Segmentation fault when linked with libunwind [\#1665](https://github.com/nlohmann/json/issues/1665) -- Should I include single-header after my to\_json and from\_json custom functions declaration? Why not? [\#1663](https://github.com/nlohmann/json/issues/1663) -- Errors/Warnings in VS 2019 when Including Header File [\#1659](https://github.com/nlohmann/json/issues/1659) -- Return null object from object's const operator\[\] as well. [\#1658](https://github.com/nlohmann/json/issues/1658) -- Can't stream json object in to std::basic\_stringstream\ [\#1656](https://github.com/nlohmann/json/issues/1656) -- C2440 in vs2015 cannot convert from 'initializer-list' to nlohmann::basic\_json [\#1655](https://github.com/nlohmann/json/issues/1655) -- Issues around get and pointers [\#1653](https://github.com/nlohmann/json/issues/1653) -- Non-member operator== breaks enum \(de\)serialization [\#1647](https://github.com/nlohmann/json/issues/1647) -- Valgrind: bytes in 1 blocks are definitely lost [\#1646](https://github.com/nlohmann/json/issues/1646) -- Convenient way to make 'basic\_json' accept 'QString' as an key type as well? [\#1640](https://github.com/nlohmann/json/issues/1640) -- mongodb: nan, inf [\#1599](https://github.com/nlohmann/json/issues/1599) -- Error in adl\_serializer [\#1590](https://github.com/nlohmann/json/issues/1590) -- Injecting class during serialization [\#1584](https://github.com/nlohmann/json/issues/1584) -- output\_adapter not user extensible [\#1534](https://github.com/nlohmann/json/issues/1534) -- Inclusion of nlohmann/json.hpp causes OS/ABI to change on Linux [\#1410](https://github.com/nlohmann/json/issues/1410) -- Add library versioning using inline namespaces [\#1394](https://github.com/nlohmann/json/issues/1394) -- CBOR byte string support [\#1129](https://github.com/nlohmann/json/issues/1129) -- How to deserialize array with derived objects [\#716](https://github.com/nlohmann/json/issues/716) - -- Add restriction for tuple specialization of to\_json [\#1826](https://github.com/nlohmann/json/pull/1826) ([cbegue](https://github.com/cbegue)) -- Fix for \#1647 [\#1821](https://github.com/nlohmann/json/pull/1821) ([AnthonyVH](https://github.com/AnthonyVH)) -- Fix issue \#1805 [\#1806](https://github.com/nlohmann/json/pull/1806) ([cbegue](https://github.com/cbegue)) -- Fix some spelling errors - mostly in comments & documentation. [\#1803](https://github.com/nlohmann/json/pull/1803) ([flopp](https://github.com/flopp)) -- Update Hedley to v11. [\#1799](https://github.com/nlohmann/json/pull/1799) ([nemequ](https://github.com/nemequ)) -- iteration\_proxy: Fix integer truncation from std::size\_t to int [\#1797](https://github.com/nlohmann/json/pull/1797) ([t-b](https://github.com/t-b)) -- appveyor.yml: Add MSVC 16 2019 support [\#1780](https://github.com/nlohmann/json/pull/1780) ([t-b](https://github.com/t-b)) -- test/CMakeLists.txt: Use an explicit list instead of GLOB [\#1779](https://github.com/nlohmann/json/pull/1779) ([t-b](https://github.com/t-b)) -- Make json\_pointer::back const \(resolves \#1764\) [\#1769](https://github.com/nlohmann/json/pull/1769) ([chris0x44](https://github.com/chris0x44)) -- did you mean 'serialization'? [\#1767](https://github.com/nlohmann/json/pull/1767) ([0xflotus](https://github.com/0xflotus)) -- Allow items\(\) to be used with custom string [\#1765](https://github.com/nlohmann/json/pull/1765) ([crazyjul](https://github.com/crazyjul)) -- Cppcheck fixes [\#1760](https://github.com/nlohmann/json/pull/1760) ([Xav83](https://github.com/Xav83)) -- Fix and add test's for SFINAE problem [\#1741](https://github.com/nlohmann/json/pull/1741) ([tete17](https://github.com/tete17)) -- Fix clang sanitizer invocation [\#1728](https://github.com/nlohmann/json/pull/1728) ([t-b](https://github.com/t-b)) -- Add gcc 9 and compile with experimental C++20 support [\#1724](https://github.com/nlohmann/json/pull/1724) ([t-b](https://github.com/t-b)) -- Fix int64 min issue [\#1722](https://github.com/nlohmann/json/pull/1722) ([t-b](https://github.com/t-b)) -- release: add singleinclude and meson.build to include.zip [\#1694](https://github.com/nlohmann/json/pull/1694) ([eli-schwartz](https://github.com/eli-schwartz)) - -## [v3.7.0](https://github.com/nlohmann/json/releases/tag/v3.7.0) (2019-07-28) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.6.1...v3.7.0) - -- How can I retrieve uknown strings from json file in my C++ program. [\#1684](https://github.com/nlohmann/json/issues/1684) -- contains\(\) is sometimes causing stack-based buffer overrun exceptions [\#1683](https://github.com/nlohmann/json/issues/1683) -- How to deserialize arrays from json [\#1681](https://github.com/nlohmann/json/issues/1681) -- Compilation failed in VS2015 [\#1678](https://github.com/nlohmann/json/issues/1678) -- Why the compiled object file is so huge? [\#1677](https://github.com/nlohmann/json/issues/1677) -- From Version 2.1.1 to 3.6.1 serialize std::set [\#1676](https://github.com/nlohmann/json/issues/1676) -- Qt deprecation model halting compiltion [\#1675](https://github.com/nlohmann/json/issues/1675) -- Build For Raspberry pi , Rapbery with new Compiler C++17 [\#1671](https://github.com/nlohmann/json/issues/1671) -- Build from Raspberry pi [\#1667](https://github.com/nlohmann/json/issues/1667) -- Can not translate map with integer key to dict string ? [\#1664](https://github.com/nlohmann/json/issues/1664) -- Double type converts to scientific notation [\#1661](https://github.com/nlohmann/json/issues/1661) -- Missing v3.6.1 tag on master branch [\#1657](https://github.com/nlohmann/json/issues/1657) -- Support Fleese Binary Data Format [\#1654](https://github.com/nlohmann/json/issues/1654) -- Suggestion: replace alternative tokens for !, && and || with their symbols [\#1652](https://github.com/nlohmann/json/issues/1652) -- Build failure test-allocator.vcxproj [\#1651](https://github.com/nlohmann/json/issues/1651) -- How to provide function json& to\_json\(\) which is similar as 'void to\_json\(json&j, const CObject& obj\)' ? [\#1650](https://github.com/nlohmann/json/issues/1650) -- Can't throw exception when starting file is a number [\#1649](https://github.com/nlohmann/json/issues/1649) -- to\_json / from\_json with nested type [\#1648](https://github.com/nlohmann/json/issues/1648) -- How to create a json object from a std::string, created by j.dump? [\#1645](https://github.com/nlohmann/json/issues/1645) -- Problem getting vector \(array\) of strings [\#1644](https://github.com/nlohmann/json/issues/1644) -- json.hpp compilation issue with other typedefs with same name [\#1642](https://github.com/nlohmann/json/issues/1642) -- nlohmann::adl\_serializer\::to\_json no matching overloaded function found [\#1641](https://github.com/nlohmann/json/issues/1641) -- overwrite adl\_serializer\ to change behaviour [\#1638](https://github.com/nlohmann/json/issues/1638) -- json.SelectToken\("Manufacturers.Products.Price"\); [\#1637](https://github.com/nlohmann/json/issues/1637) -- Add json type as value [\#1636](https://github.com/nlohmann/json/issues/1636) -- Unit conversion test error: conversion from 'nlohmann::json' to non-scalar type 'std::string\_view' requested [\#1634](https://github.com/nlohmann/json/issues/1634) -- nlohmann VS JsonCpp by C++17 [\#1633](https://github.com/nlohmann/json/issues/1633) -- To integrate an inline helper function that return type name as string [\#1632](https://github.com/nlohmann/json/issues/1632) -- Return JSON as reference [\#1631](https://github.com/nlohmann/json/issues/1631) -- Updating from an older version causes problems with assing a json object to a struct [\#1630](https://github.com/nlohmann/json/issues/1630) -- Can without default constructor function for user defined classes when only to\_json is needed? [\#1629](https://github.com/nlohmann/json/issues/1629) -- Compilation fails with clang 6.x-8.x in C++14 mode [\#1628](https://github.com/nlohmann/json/issues/1628) -- Treating floating point as string [\#1627](https://github.com/nlohmann/json/issues/1627) -- error parsing character å [\#1626](https://github.com/nlohmann/json/issues/1626) -- \[Help\] How to Improve Json Output Performance with Large Json Arrays [\#1624](https://github.com/nlohmann/json/issues/1624) -- Suggested link changes for reporting new issues \[blob/develop/REAME.md and blob/develop/.github/CONTRIBUTING.md\] [\#1623](https://github.com/nlohmann/json/issues/1623) -- Broken link to issue template in CONTRIBUTING.md [\#1622](https://github.com/nlohmann/json/issues/1622) -- Missing word in README.md file [\#1621](https://github.com/nlohmann/json/issues/1621) -- Package manager instructions in README for brew is incorrect [\#1620](https://github.com/nlohmann/json/issues/1620) -- Building with Visual Studio 2019 [\#1619](https://github.com/nlohmann/json/issues/1619) -- Precedence of to\_json and builtin harmful [\#1617](https://github.com/nlohmann/json/issues/1617) -- The type json is missing from the html documentation [\#1616](https://github.com/nlohmann/json/issues/1616) -- variant is not support in Release 3.6.1? [\#1615](https://github.com/nlohmann/json/issues/1615) -- Replace assert with throw for const operator\[\] [\#1614](https://github.com/nlohmann/json/issues/1614) -- Memory Overhead is Too High \(10x or more\) [\#1613](https://github.com/nlohmann/json/issues/1613) -- program crash everytime, when other data type incomming in json stream as expected [\#1612](https://github.com/nlohmann/json/issues/1612) -- Improved Enum Support [\#1611](https://github.com/nlohmann/json/issues/1611) -- is it possible convert json object back to stl container ? [\#1610](https://github.com/nlohmann/json/issues/1610) -- Add C++17-like emplace.back\(\) for arrays. [\#1609](https://github.com/nlohmann/json/issues/1609) -- is\_nothrow\_copy\_constructible fails for json::const\_iterator on MSVC2015 x86 Debug build [\#1608](https://github.com/nlohmann/json/issues/1608) -- Reading and writing array elements [\#1607](https://github.com/nlohmann/json/issues/1607) -- Converting json::value to int [\#1605](https://github.com/nlohmann/json/issues/1605) -- I have a vector of keys and and a string of value and i want to create nested json array [\#1604](https://github.com/nlohmann/json/issues/1604) -- In compatible JSON object from nlohmann::json to nohman::json - unexpected end of input; expected '\[', '{', or a literal [\#1603](https://github.com/nlohmann/json/issues/1603) -- json parser crash if having a large number integer in message [\#1602](https://github.com/nlohmann/json/issues/1602) -- Value method with undocumented throwing 302 exception [\#1601](https://github.com/nlohmann/json/issues/1601) -- Accessing value with json pointer adds key if not existing [\#1600](https://github.com/nlohmann/json/issues/1600) -- README.md broken link to project documentation [\#1597](https://github.com/nlohmann/json/issues/1597) -- Random Kudos: Thanks for your work on this! [\#1596](https://github.com/nlohmann/json/issues/1596) -- json::parse return value and errors [\#1595](https://github.com/nlohmann/json/issues/1595) -- initializer list constructor makes curly brace initialization fragile [\#1594](https://github.com/nlohmann/json/issues/1594) -- trying to log message for missing keyword, difference between \["foo"\] and at\("foo"\) [\#1593](https://github.com/nlohmann/json/issues/1593) -- std::string and std::wstring `to_json` [\#1592](https://github.com/nlohmann/json/issues/1592) -- I have a C structure which I need to convert to a JSON. How do I do it? Haven't found proper examples so far. [\#1591](https://github.com/nlohmann/json/issues/1591) -- dump\_escaped possible error ? [\#1589](https://github.com/nlohmann/json/issues/1589) -- json::parse\(\) into a vector\ results in unhandled exception [\#1587](https://github.com/nlohmann/json/issues/1587) -- push\_back\(\)/emplace\_back\(\) on array invalidates pointers to existing array items [\#1586](https://github.com/nlohmann/json/issues/1586) -- Getting nlohmann::detail::parse\_error on JSON generated by nlohmann::json not sure why [\#1583](https://github.com/nlohmann/json/issues/1583) -- getting error terminate called after throwing an instance of 'std::domain\_error' what\(\): cannot use at\(\) with string [\#1582](https://github.com/nlohmann/json/issues/1582) -- how i create json file [\#1581](https://github.com/nlohmann/json/issues/1581) -- prevent rounding of double datatype values [\#1580](https://github.com/nlohmann/json/issues/1580) -- Documentation Container Overview Doesn't Reference Const Methods [\#1579](https://github.com/nlohmann/json/issues/1579) -- Writing an array into a nlohmann::json object [\#1578](https://github.com/nlohmann/json/issues/1578) -- compilation error when using with another library [\#1577](https://github.com/nlohmann/json/issues/1577) -- Homebrew on OSX doesn't install cmake config file [\#1576](https://github.com/nlohmann/json/issues/1576) -- JSON Parse Out of Range Error [\#1574](https://github.com/nlohmann/json/issues/1574) -- Integrating into existing CMake Project [\#1573](https://github.com/nlohmann/json/issues/1573) -- conversion to std::string failed [\#1571](https://github.com/nlohmann/json/issues/1571) -- jPtr operation does not throw [\#1569](https://github.com/nlohmann/json/issues/1569) -- How to generate dll file for this project [\#1568](https://github.com/nlohmann/json/issues/1568) -- how to pass variable data to json in c [\#1567](https://github.com/nlohmann/json/issues/1567) -- I want to achieve an upgraded function. [\#1566](https://github.com/nlohmann/json/issues/1566) -- How to determine the type of elements read from a JSON array? [\#1564](https://github.com/nlohmann/json/issues/1564) -- try\_get\_to [\#1563](https://github.com/nlohmann/json/issues/1563) -- example code compile error [\#1562](https://github.com/nlohmann/json/issues/1562) -- How to iterate over nested json object [\#1561](https://github.com/nlohmann/json/issues/1561) -- Build Option/Separate Function to Allow to Throw on Duplicate Keys [\#1560](https://github.com/nlohmann/json/issues/1560) -- Compiler Switches -Weffc++ & -Wshadow are throwing errors [\#1558](https://github.com/nlohmann/json/issues/1558) -- warning: use of the 'nodiscard' attribute is a C++17 extension [\#1557](https://github.com/nlohmann/json/issues/1557) -- Import/Export compressed JSON files [\#1556](https://github.com/nlohmann/json/issues/1556) -- GDB renderers for json library [\#1554](https://github.com/nlohmann/json/issues/1554) -- Is it possible to construct a json string object from a binary buffer? [\#1553](https://github.com/nlohmann/json/issues/1553) -- json objects in list [\#1552](https://github.com/nlohmann/json/issues/1552) -- Matrix output [\#1550](https://github.com/nlohmann/json/issues/1550) -- Using json merge\_patch on ordered non-alphanumeric datasets [\#1549](https://github.com/nlohmann/json/issues/1549) -- Invalid parsed value for big integer [\#1548](https://github.com/nlohmann/json/issues/1548) -- Integrating with android ndk issues. [\#1547](https://github.com/nlohmann/json/issues/1547) -- add noexcept json::value\("key", default\) method variant? [\#1546](https://github.com/nlohmann/json/issues/1546) -- Thank you! 🙌 [\#1545](https://github.com/nlohmann/json/issues/1545) -- Output and input matrix [\#1544](https://github.com/nlohmann/json/issues/1544) -- Add regression tests for MSVC [\#1543](https://github.com/nlohmann/json/issues/1543) -- \[Help Needed!\] Season of Docs [\#1542](https://github.com/nlohmann/json/issues/1542) -- program still abort\(\) or exit\(\) with try catch [\#1541](https://github.com/nlohmann/json/issues/1541) -- Have a json::type\_error exception because of JSON object [\#1540](https://github.com/nlohmann/json/issues/1540) -- Using versioned namespaces [\#1539](https://github.com/nlohmann/json/issues/1539) -- Quoted numbers [\#1538](https://github.com/nlohmann/json/issues/1538) -- Reading a JSON file into an object [\#1537](https://github.com/nlohmann/json/issues/1537) -- Releases 3.6.0 and 3.6.1 don't build on conda / windows [\#1536](https://github.com/nlohmann/json/issues/1536) -- \[Clang\] warning: use of the 'nodiscard' attribute is a C++17 extension \[-Wc++17-extensions\] [\#1535](https://github.com/nlohmann/json/issues/1535) -- wchar\_t/std::wstring json can be created but not accessed [\#1533](https://github.com/nlohmann/json/issues/1533) -- json stringify [\#1532](https://github.com/nlohmann/json/issues/1532) -- How can I use it from gcc on RPI [\#1528](https://github.com/nlohmann/json/issues/1528) -- std::pair treated as an array instead of key-value in `std::vector>` [\#1520](https://github.com/nlohmann/json/issues/1520) -- Excessive Memory Usage for Large Json File [\#1516](https://github.com/nlohmann/json/issues/1516) -- SAX dumper [\#1512](https://github.com/nlohmann/json/issues/1512) -- Conversion to user type containing a std::vector not working with documented approach [\#1511](https://github.com/nlohmann/json/issues/1511) -- Inconsistent use of type alias. [\#1507](https://github.com/nlohmann/json/issues/1507) -- Is there a current way to represent strings as json int? [\#1503](https://github.com/nlohmann/json/issues/1503) -- Intermittent issues with loadJSON [\#1484](https://github.com/nlohmann/json/issues/1484) -- use json construct std::string [\#1462](https://github.com/nlohmann/json/issues/1462) -- JSON Creation [\#1461](https://github.com/nlohmann/json/issues/1461) -- Null bytes in files are treated like EOF [\#1095](https://github.com/nlohmann/json/issues/1095) -- Feature: to\_string\(const json& j\); [\#916](https://github.com/nlohmann/json/issues/916) - -- Use GNUInstallDirs instead of hard-coded path. [\#1673](https://github.com/nlohmann/json/pull/1673) ([ghost](https://github.com/ghost)) -- Package Manager: MSYS2 \(pacman\) [\#1670](https://github.com/nlohmann/json/pull/1670) ([podsvirov](https://github.com/podsvirov)) -- Fix json.hpp compilation issue with other typedefs with same name \(Issue \#1642\) [\#1643](https://github.com/nlohmann/json/pull/1643) ([kevinlul](https://github.com/kevinlul)) -- Add explicit conversion from json to std::string\_view in conversion unit test [\#1639](https://github.com/nlohmann/json/pull/1639) ([taylorhoward92](https://github.com/taylorhoward92)) -- Minor fixes in docs [\#1625](https://github.com/nlohmann/json/pull/1625) ([nickaein](https://github.com/nickaein)) -- Fix broken links to documentation [\#1598](https://github.com/nlohmann/json/pull/1598) ([nickaein](https://github.com/nickaein)) -- Added to\_string and added basic tests [\#1585](https://github.com/nlohmann/json/pull/1585) ([Macr0Nerd](https://github.com/Macr0Nerd)) -- Regression tests for MSVC [\#1570](https://github.com/nlohmann/json/pull/1570) ([nickaein](https://github.com/nickaein)) -- Fix/1511 [\#1555](https://github.com/nlohmann/json/pull/1555) ([theodelrieu](https://github.com/theodelrieu)) -- Remove C++17 extension warning from clang; \#1535 [\#1551](https://github.com/nlohmann/json/pull/1551) ([heavywatal](https://github.com/heavywatal)) -- moved from Catch to doctest for unit tests [\#1439](https://github.com/nlohmann/json/pull/1439) ([onqtam](https://github.com/onqtam)) - -## [v3.6.1](https://github.com/nlohmann/json/releases/tag/v3.6.1) (2019-03-20) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.6.1...v3.6.1) - -## [3.6.1](https://github.com/nlohmann/json/releases/tag/3.6.1) (2019-03-20) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.6.0...3.6.1) - -- Failed to build with \ [\#1531](https://github.com/nlohmann/json/issues/1531) -- Compiling 3.6.0 with GCC \> 7, array vs std::array \#590 is back [\#1530](https://github.com/nlohmann/json/issues/1530) -- 3.6.0: warning: missing initializer for member 'std::array\::\_M\_elems' \[-Wmissing-field-initializers\] [\#1527](https://github.com/nlohmann/json/issues/1527) -- unable to parse json [\#1525](https://github.com/nlohmann/json/issues/1525) - -## [v3.6.0](https://github.com/nlohmann/json/releases/tag/v3.6.0) (2019-03-19) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.5.0...v3.6.0) - -- How can I turn a string of a json array into a json array? [\#1526](https://github.com/nlohmann/json/issues/1526) -- Minor: missing a std:: namespace tag [\#1521](https://github.com/nlohmann/json/issues/1521) -- how to precision to four decimal for double when use to\_json [\#1519](https://github.com/nlohmann/json/issues/1519) -- error parse [\#1518](https://github.com/nlohmann/json/issues/1518) -- Compile error: template argument deduction/substitution failed [\#1515](https://github.com/nlohmann/json/issues/1515) -- std::complex type [\#1510](https://github.com/nlohmann/json/issues/1510) -- CBOR byte string support [\#1509](https://github.com/nlohmann/json/issues/1509) -- Compilation error getting a std::pair\<\> on latest VS 2017 compiler [\#1506](https://github.com/nlohmann/json/issues/1506) -- "Integration" section of documentation needs update? [\#1505](https://github.com/nlohmann/json/issues/1505) -- Json object from string from a TCP socket [\#1504](https://github.com/nlohmann/json/issues/1504) -- MSVC warning C4946 \("reinterpret\_cast used between related classes"\) compiling json.hpp [\#1502](https://github.com/nlohmann/json/issues/1502) -- How to programmatically fill an n-th dimensional JSON object? [\#1501](https://github.com/nlohmann/json/issues/1501) -- Error compiling with clang and `JSON_NOEXCEPTION`: need to include `cstdlib` [\#1500](https://github.com/nlohmann/json/issues/1500) -- The code compiles unsuccessfully with android-ndk-r10e [\#1499](https://github.com/nlohmann/json/issues/1499) -- Cmake 3.1 in develop, when is it likely to make it into a stable release? [\#1498](https://github.com/nlohmann/json/issues/1498) -- Some Help please object inside array [\#1494](https://github.com/nlohmann/json/issues/1494) -- How to get data into vector of user-defined type from a Json object [\#1493](https://github.com/nlohmann/json/issues/1493) -- how to find subelement without loop [\#1490](https://github.com/nlohmann/json/issues/1490) -- json to std::map [\#1487](https://github.com/nlohmann/json/issues/1487) -- Type in README.md [\#1486](https://github.com/nlohmann/json/issues/1486) -- Error in parsing and reading msgpack-lite [\#1485](https://github.com/nlohmann/json/issues/1485) -- Compiling issues with libc 2.12 [\#1483](https://github.com/nlohmann/json/issues/1483) -- How do I use reference or pointer binding values? [\#1482](https://github.com/nlohmann/json/issues/1482) -- Compilation fails in MSVC with the Microsoft Language Extensions disabled [\#1481](https://github.com/nlohmann/json/issues/1481) -- Functional visit [\#1480](https://github.com/nlohmann/json/issues/1480) -- \[Question\] Unescaped dump [\#1479](https://github.com/nlohmann/json/issues/1479) -- Some Help please [\#1478](https://github.com/nlohmann/json/issues/1478) -- Global variables are stored within the JSON file, how do I declare them as global variables when I read them out in my C++ program? [\#1476](https://github.com/nlohmann/json/issues/1476) -- Unable to modify one of the values within the JSON file, and save it [\#1475](https://github.com/nlohmann/json/issues/1475) -- Documentation of parse function has two identical @pre causes [\#1473](https://github.com/nlohmann/json/issues/1473) -- GCC 9.0 build failure [\#1472](https://github.com/nlohmann/json/issues/1472) -- Can we have an `exists()` method? [\#1471](https://github.com/nlohmann/json/issues/1471) -- How to parse multi object json from file? [\#1470](https://github.com/nlohmann/json/issues/1470) -- How to returns the name of the upper object? [\#1467](https://github.com/nlohmann/json/issues/1467) -- Error: "tuple\_size" has already been declared in the current scope [\#1466](https://github.com/nlohmann/json/issues/1466) -- Checking keys of two jsons against eachother [\#1465](https://github.com/nlohmann/json/issues/1465) -- Disable installation when used as meson subproject [\#1463](https://github.com/nlohmann/json/issues/1463) -- Unpack list of integers to a std::vector\ [\#1460](https://github.com/nlohmann/json/issues/1460) -- Implement DRY definition of JSON representation of a c++ class [\#1459](https://github.com/nlohmann/json/issues/1459) -- json.exception.type\_error.305 with GCC 4.9 when using C++ {} initializer [\#1458](https://github.com/nlohmann/json/issues/1458) -- API to convert an "uninitialized" json into an empty object or empty array [\#1456](https://github.com/nlohmann/json/issues/1456) -- How to parse a vector of objects with const attributes [\#1453](https://github.com/nlohmann/json/issues/1453) -- NLOHMANN\_JSON\_SERIALIZE\_ENUM potentially requires duplicate definitions [\#1450](https://github.com/nlohmann/json/issues/1450) -- Question about making json object from file directory [\#1449](https://github.com/nlohmann/json/issues/1449) -- .get\(\) throws error if used with userdefined structs in unordered\_map [\#1448](https://github.com/nlohmann/json/issues/1448) -- Integer Overflow \(OSS-Fuzz 12506\) [\#1447](https://github.com/nlohmann/json/issues/1447) -- If a string has too many invalid UTF-8 characters, json::dump attempts to index an array out of bounds. [\#1445](https://github.com/nlohmann/json/issues/1445) -- Setting values of .JSON file [\#1444](https://github.com/nlohmann/json/issues/1444) -- alias object\_t::key\_type in basic\_json [\#1442](https://github.com/nlohmann/json/issues/1442) -- Latest Ubuntu package is 2.1.1 [\#1438](https://github.com/nlohmann/json/issues/1438) -- lexer.hpp\(1363\) '\_snprintf': is not a member | Visualstudio 2017 [\#1437](https://github.com/nlohmann/json/issues/1437) -- Static method invites inadvertent logic error. [\#1433](https://github.com/nlohmann/json/issues/1433) -- EOS compilation produces "fatal error: 'nlohmann/json.hpp' file not found" [\#1432](https://github.com/nlohmann/json/issues/1432) -- Support for bad commas [\#1429](https://github.com/nlohmann/json/issues/1429) -- Please have one base exception class for all json exceptions [\#1427](https://github.com/nlohmann/json/issues/1427) -- Compilation warning: 'tuple\_size' defined as a class template here but previously declared as a struct template [\#1426](https://github.com/nlohmann/json/issues/1426) -- Which version can be used with GCC 4.8.2 ? [\#1424](https://github.com/nlohmann/json/issues/1424) -- Ignore nullptr values on constructing json object from a container [\#1422](https://github.com/nlohmann/json/issues/1422) -- Support for custom float precision via unquoted strings [\#1421](https://github.com/nlohmann/json/issues/1421) -- It is possible to call `json::find` with a json\_pointer as argument. This causes runtime UB/crash. [\#1418](https://github.com/nlohmann/json/issues/1418) -- Dump throwing exception [\#1416](https://github.com/nlohmann/json/issues/1416) -- Build error [\#1415](https://github.com/nlohmann/json/issues/1415) -- Append version to include.zip [\#1412](https://github.com/nlohmann/json/issues/1412) -- error C2039: '\_snprintf': is not a member of 'std' - Windows [\#1408](https://github.com/nlohmann/json/issues/1408) -- Deserializing to vector [\#1407](https://github.com/nlohmann/json/issues/1407) -- Efficient way to set a `json` object as value into another `json` key [\#1406](https://github.com/nlohmann/json/issues/1406) -- Document return value of parse\(\) when allow\_exceptions == false and parsing fails [\#1405](https://github.com/nlohmann/json/issues/1405) -- Unexpected behaviour with structured binding [\#1404](https://github.com/nlohmann/json/issues/1404) -- Which native types does get\\(\) allow? [\#1403](https://github.com/nlohmann/json/issues/1403) -- Add something like Json::StaticString [\#1402](https://github.com/nlohmann/json/issues/1402) -- -Wmismatched-tags in 3.5.0? [\#1401](https://github.com/nlohmann/json/issues/1401) -- Coverity Scan reports an UNCAUGHT\_EXCEPT issue [\#1400](https://github.com/nlohmann/json/issues/1400) -- fff [\#1399](https://github.com/nlohmann/json/issues/1399) -- sorry this is not an issue, just a Question, How to change a key value in a file and save it ? [\#1398](https://github.com/nlohmann/json/issues/1398) -- appveyor x64 builds appear to be using Win32 toolset [\#1374](https://github.com/nlohmann/json/issues/1374) -- Serializing/Deserializing a Class containing a vector of itself [\#1373](https://github.com/nlohmann/json/issues/1373) -- Retrieving array elements. [\#1369](https://github.com/nlohmann/json/issues/1369) -- Deserialize [\#1366](https://github.com/nlohmann/json/issues/1366) -- call of overloaded for push\_back and operator+= is ambiguous [\#1352](https://github.com/nlohmann/json/issues/1352) -- got an error and cann't figure it out [\#1351](https://github.com/nlohmann/json/issues/1351) -- Improve number-to-string conversion [\#1334](https://github.com/nlohmann/json/issues/1334) -- Implicit type conversion error on MSVC [\#1333](https://github.com/nlohmann/json/issues/1333) -- NuGet Package [\#1132](https://github.com/nlohmann/json/issues/1132) - -- Change macros to numeric\_limits [\#1514](https://github.com/nlohmann/json/pull/1514) ([naszta](https://github.com/naszta)) -- fix GCC 7.1.1 - 7.2.1 on CentOS [\#1496](https://github.com/nlohmann/json/pull/1496) ([lieff](https://github.com/lieff)) -- Update Buckaroo instructions in README.md [\#1495](https://github.com/nlohmann/json/pull/1495) ([njlr](https://github.com/njlr)) -- Fix gcc9 build error test/src/unit-allocator.cpp \(Issue \#1472\) [\#1492](https://github.com/nlohmann/json/pull/1492) ([stac47](https://github.com/stac47)) -- Fix typo in README.md [\#1491](https://github.com/nlohmann/json/pull/1491) ([nickaein](https://github.com/nickaein)) -- Do proper endian conversions [\#1489](https://github.com/nlohmann/json/pull/1489) ([andreas-schwab](https://github.com/andreas-schwab)) -- Fix documentation [\#1477](https://github.com/nlohmann/json/pull/1477) ([nickaein](https://github.com/nickaein)) -- Implement contains\(\) member function [\#1474](https://github.com/nlohmann/json/pull/1474) ([nickaein](https://github.com/nickaein)) -- Add operator/= and operator/ to construct a JSON pointer by appending two JSON pointers [\#1469](https://github.com/nlohmann/json/pull/1469) ([garethsb](https://github.com/garethsb)) -- Disable Clang -Wmismatched-tags warning on tuple\_size / tuple\_element [\#1468](https://github.com/nlohmann/json/pull/1468) ([past-due](https://github.com/past-due)) -- Disable installation when used as meson subproject. \#1463 [\#1464](https://github.com/nlohmann/json/pull/1464) ([elvisoric](https://github.com/elvisoric)) -- docs: README typo [\#1455](https://github.com/nlohmann/json/pull/1455) ([wythe](https://github.com/wythe)) -- remove extra semicolon from readme [\#1451](https://github.com/nlohmann/json/pull/1451) ([Afforix](https://github.com/Afforix)) -- attempt to fix \#1445, flush buffer in serializer::dump\_escaped in UTF8\_REJECT case. [\#1446](https://github.com/nlohmann/json/pull/1446) ([scinart](https://github.com/scinart)) -- Use C++11 features supported by CMake 3.1. [\#1441](https://github.com/nlohmann/json/pull/1441) ([iwanders](https://github.com/iwanders)) -- :rotating\_light: fixed unused variable warning [\#1435](https://github.com/nlohmann/json/pull/1435) ([pboettch](https://github.com/pboettch)) -- allow push\_back\(\) and pop\_back\(\) calls on json\_pointer [\#1434](https://github.com/nlohmann/json/pull/1434) ([pboettch](https://github.com/pboettch)) -- Add instructions about using nlohmann/json with the conda package manager [\#1430](https://github.com/nlohmann/json/pull/1430) ([nicoddemus](https://github.com/nicoddemus)) -- Updated year in README.md [\#1425](https://github.com/nlohmann/json/pull/1425) ([jef](https://github.com/jef)) -- Fixed broken links in the README file [\#1423](https://github.com/nlohmann/json/pull/1423) ([skypjack](https://github.com/skypjack)) -- Fixed broken links in the README file [\#1420](https://github.com/nlohmann/json/pull/1420) ([skypjack](https://github.com/skypjack)) -- docs: typo in README [\#1417](https://github.com/nlohmann/json/pull/1417) ([wythe](https://github.com/wythe)) -- Fix x64 target platform for appveyor [\#1414](https://github.com/nlohmann/json/pull/1414) ([nickaein](https://github.com/nickaein)) -- Improve dump\_integer performance [\#1411](https://github.com/nlohmann/json/pull/1411) ([nickaein](https://github.com/nickaein)) -- buildsystem: relax requirement on cmake version [\#1409](https://github.com/nlohmann/json/pull/1409) ([yann-morin-1998](https://github.com/yann-morin-1998)) -- CMake: Optional Install if Embedded [\#1330](https://github.com/nlohmann/json/pull/1330) ([ax3l](https://github.com/ax3l)) - -## [v3.5.0](https://github.com/nlohmann/json/releases/tag/v3.5.0) (2018-12-21) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.4.0...v3.5.0) - -- Copyconstructor inserts original into array with single element [\#1397](https://github.com/nlohmann/json/issues/1397) -- Get value without explicit typecasting [\#1395](https://github.com/nlohmann/json/issues/1395) -- Big file parsing [\#1393](https://github.com/nlohmann/json/issues/1393) -- Adding Structured Binding Support [\#1388](https://github.com/nlohmann/json/issues/1388) -- map\ exhibits unexpected behavior [\#1387](https://github.com/nlohmann/json/issues/1387) -- Error Code Return [\#1386](https://github.com/nlohmann/json/issues/1386) -- using unordered\_map as object type [\#1385](https://github.com/nlohmann/json/issues/1385) -- float precision [\#1384](https://github.com/nlohmann/json/issues/1384) -- \[json.exception.type\_error.316\] invalid UTF-8 byte at index 1: 0xC3 [\#1383](https://github.com/nlohmann/json/issues/1383) -- Inconsistent Constructor \(GCC vs. Clang\) [\#1381](https://github.com/nlohmann/json/issues/1381) -- \#define or || [\#1379](https://github.com/nlohmann/json/issues/1379) -- How to iterate inside the values ? [\#1377](https://github.com/nlohmann/json/issues/1377) -- items\(\) unable to get the elements [\#1375](https://github.com/nlohmann/json/issues/1375) -- conversion json to std::map doesn't work for types \ [\#1372](https://github.com/nlohmann/json/issues/1372) -- A minor issue in the build instructions [\#1371](https://github.com/nlohmann/json/issues/1371) -- Using this library without stream ? [\#1370](https://github.com/nlohmann/json/issues/1370) -- Writing and reading BSON data [\#1368](https://github.com/nlohmann/json/issues/1368) -- Retrieving array elements from object type iterator. [\#1367](https://github.com/nlohmann/json/issues/1367) -- json::dump\(\) silently crashes if items contain accented letters [\#1365](https://github.com/nlohmann/json/issues/1365) -- warnings in MSVC \(2015\) in 3.4.0 related to bool... [\#1364](https://github.com/nlohmann/json/issues/1364) -- Cant compile with -C++17 and beyond compiler options [\#1362](https://github.com/nlohmann/json/issues/1362) -- json to concrete type conversion through reference or pointer fails [\#1361](https://github.com/nlohmann/json/issues/1361) -- the first attributes of JSON string is misplaced [\#1360](https://github.com/nlohmann/json/issues/1360) -- Copy-construct using initializer-list converts objects to arrays [\#1359](https://github.com/nlohmann/json/issues/1359) -- About value\(key, default\_value\) and operator\[\]\(key\) [\#1358](https://github.com/nlohmann/json/issues/1358) -- Problem with printing json response object [\#1356](https://github.com/nlohmann/json/issues/1356) -- Serializing pointer segfaults [\#1355](https://github.com/nlohmann/json/issues/1355) -- Read `long long int` data as a number. [\#1354](https://github.com/nlohmann/json/issues/1354) -- eclipse oxygen in ubuntu get\ is ambiguous [\#1353](https://github.com/nlohmann/json/issues/1353) -- Can't build on Visual Studio 2017 v15.8.9 [\#1350](https://github.com/nlohmann/json/issues/1350) -- cannot parse from string? [\#1349](https://github.com/nlohmann/json/issues/1349) -- Error: out\_of\_range [\#1348](https://github.com/nlohmann/json/issues/1348) -- expansion pattern 'CompatibleObjectType' contains no argument packs, with CUDA 10 [\#1347](https://github.com/nlohmann/json/issues/1347) -- Unable to update a value for a nested\(multi-level\) json file [\#1344](https://github.com/nlohmann/json/issues/1344) -- Fails to compile when std::iterator\_traits is not SFINAE friendly. [\#1341](https://github.com/nlohmann/json/issues/1341) -- EOF flag not set on exhausted input streams. [\#1340](https://github.com/nlohmann/json/issues/1340) -- Shadowed Member in merge\_patch [\#1339](https://github.com/nlohmann/json/issues/1339) -- Periods/literal dots in keys? [\#1338](https://github.com/nlohmann/json/issues/1338) -- Protect macro expansion of commonly defined macros [\#1337](https://github.com/nlohmann/json/issues/1337) -- How to validate an input before parsing? [\#1336](https://github.com/nlohmann/json/issues/1336) -- Non-verifying dump\(\) alternative for debugging/logging needed [\#1335](https://github.com/nlohmann/json/issues/1335) -- Json Libarary is not responding for me in c++ [\#1332](https://github.com/nlohmann/json/issues/1332) -- Question - how to find an object in an array [\#1331](https://github.com/nlohmann/json/issues/1331) -- Nesting additional data in json object [\#1328](https://github.com/nlohmann/json/issues/1328) -- can to\_json\(\) be defined inside a class? [\#1324](https://github.com/nlohmann/json/issues/1324) -- CodeBlocks IDE can't find `json.hpp` header [\#1318](https://github.com/nlohmann/json/issues/1318) -- Change json\_pointer to provide an iterator begin/end/etc, don't use vectors, and also enable string\_view [\#1312](https://github.com/nlohmann/json/issues/1312) -- Xcode - adding it to library [\#1300](https://github.com/nlohmann/json/issues/1300) -- unicode: accept char16\_t, char32\_t sequences [\#1298](https://github.com/nlohmann/json/issues/1298) -- unicode: char16\_t\* is compiler error, but char16\_t\[\] is accepted [\#1297](https://github.com/nlohmann/json/issues/1297) -- Dockerfile Project Help Needed [\#1296](https://github.com/nlohmann/json/issues/1296) -- Comparisons between large unsigned and negative signed integers [\#1295](https://github.com/nlohmann/json/issues/1295) -- CMake alias to `nlohmann::json` [\#1291](https://github.com/nlohmann/json/issues/1291) -- Release zips without tests [\#1285](https://github.com/nlohmann/json/issues/1285) -- separate object\_t::key\_type from basic\_json::key\_type, and use an allocator which returns object\_t::key\_type [\#1274](https://github.com/nlohmann/json/issues/1274) -- Is there a nice way to associate external values with json elements? [\#1256](https://github.com/nlohmann/json/issues/1256) -- Delete by json\_pointer [\#1248](https://github.com/nlohmann/json/issues/1248) -- Expose lexer, as a StAX parser [\#1219](https://github.com/nlohmann/json/issues/1219) -- Subclassing json\(\) & error on recursive load [\#1201](https://github.com/nlohmann/json/issues/1201) -- Check value for existence by json\_pointer [\#1194](https://github.com/nlohmann/json/issues/1194) - -- Feature/add file input adapter [\#1392](https://github.com/nlohmann/json/pull/1392) ([dumarjo](https://github.com/dumarjo)) -- Added Support for Structured Bindings [\#1391](https://github.com/nlohmann/json/pull/1391) ([pratikpc](https://github.com/pratikpc)) -- Link to issue \#958 broken [\#1382](https://github.com/nlohmann/json/pull/1382) ([kjpus](https://github.com/kjpus)) -- readme: fix typo [\#1380](https://github.com/nlohmann/json/pull/1380) ([manu-chroma](https://github.com/manu-chroma)) -- recommend using explicit from JSON conversions [\#1363](https://github.com/nlohmann/json/pull/1363) ([theodelrieu](https://github.com/theodelrieu)) -- Fix merge\_patch shadow warning [\#1346](https://github.com/nlohmann/json/pull/1346) ([ax3l](https://github.com/ax3l)) -- Allow installation via Meson [\#1345](https://github.com/nlohmann/json/pull/1345) ([mpoquet](https://github.com/mpoquet)) -- Set eofbit on exhausted input stream. [\#1343](https://github.com/nlohmann/json/pull/1343) ([mefyl](https://github.com/mefyl)) -- Add a SFINAE friendly iterator\_traits and use that instead. [\#1342](https://github.com/nlohmann/json/pull/1342) ([dgavedissian](https://github.com/dgavedissian)) -- Fix EOL Whitespaces & CMake Spelling [\#1329](https://github.com/nlohmann/json/pull/1329) ([ax3l](https://github.com/ax3l)) - -## [v3.4.0](https://github.com/nlohmann/json/releases/tag/v3.4.0) (2018-10-30) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.3.0...v3.4.0) - -- Big uint64\_t values are serialized wrong [\#1327](https://github.com/nlohmann/json/issues/1327) -- \[Question\] Efficient check for equivalency? [\#1325](https://github.com/nlohmann/json/issues/1325) -- Can't use ifstream and .clear\(\) [\#1321](https://github.com/nlohmann/json/issues/1321) -- \[Warning\] -Wparentheses on line 555 on single\_include [\#1319](https://github.com/nlohmann/json/issues/1319) -- Compilation error using at and find with enum struct [\#1316](https://github.com/nlohmann/json/issues/1316) -- Parsing JSON from a web address [\#1311](https://github.com/nlohmann/json/issues/1311) -- How to convert JSON to Struct with embeded subject [\#1310](https://github.com/nlohmann/json/issues/1310) -- Null safety/coalescing function? [\#1309](https://github.com/nlohmann/json/issues/1309) -- Building fails using single include file: json.hpp [\#1308](https://github.com/nlohmann/json/issues/1308) -- json::parse\(std::string\) Exception inside packaged Lib [\#1306](https://github.com/nlohmann/json/issues/1306) -- Problem in Dockerfile with installation of library [\#1304](https://github.com/nlohmann/json/issues/1304) -- compile error in from\_json converting to container with std::pair [\#1299](https://github.com/nlohmann/json/issues/1299) -- Json that I am trying to parse, and I am lost Structure Array below top level [\#1293](https://github.com/nlohmann/json/issues/1293) -- Serializing std::variant causes stack overflow [\#1292](https://github.com/nlohmann/json/issues/1292) -- How do I go about customising from\_json to support \_\_int128\_t/\_\_uint128\_t? [\#1290](https://github.com/nlohmann/json/issues/1290) -- merge\_patch: inconsistent behaviour merging empty sub-object [\#1289](https://github.com/nlohmann/json/issues/1289) -- Buffer over/underrun using UBJson? [\#1288](https://github.com/nlohmann/json/issues/1288) -- Enable the latest C++ standard with Visual Studio [\#1287](https://github.com/nlohmann/json/issues/1287) -- truncation of constant value in to\_cbor\(\) [\#1286](https://github.com/nlohmann/json/issues/1286) -- eosio.wasmsdk error [\#1284](https://github.com/nlohmann/json/issues/1284) -- use the same interface for writing arrays and non-arrays [\#1283](https://github.com/nlohmann/json/issues/1283) -- How to read json file with optional entries and entries with different types [\#1281](https://github.com/nlohmann/json/issues/1281) -- merge result not as espected [\#1279](https://github.com/nlohmann/json/issues/1279) -- how to get only "name" from below json [\#1278](https://github.com/nlohmann/json/issues/1278) -- syntax error on right json string [\#1276](https://github.com/nlohmann/json/issues/1276) -- Parsing JSON Array where members have no key, using custom types [\#1267](https://github.com/nlohmann/json/issues/1267) -- I get a json exception periodically from json::parse for the same json [\#1263](https://github.com/nlohmann/json/issues/1263) -- serialize std::variant\<...\> [\#1261](https://github.com/nlohmann/json/issues/1261) -- GCC 8.2.1. Compilation error: invalid conversion from... [\#1246](https://github.com/nlohmann/json/issues/1246) -- BSON support [\#1244](https://github.com/nlohmann/json/issues/1244) -- enum to json mapping [\#1208](https://github.com/nlohmann/json/issues/1208) -- Soften the landing when dumping non-UTF8 strings \(type\_error.316 exception\) [\#1198](https://github.com/nlohmann/json/issues/1198) - -- Add macro to define enum/JSON mapping [\#1323](https://github.com/nlohmann/json/pull/1323) ([nlohmann](https://github.com/nlohmann)) -- Add BSON support [\#1320](https://github.com/nlohmann/json/pull/1320) ([nlohmann](https://github.com/nlohmann)) -- Properly convert constants to CharType [\#1315](https://github.com/nlohmann/json/pull/1315) ([nlohmann](https://github.com/nlohmann)) -- Allow to set error handler for decoding errors [\#1314](https://github.com/nlohmann/json/pull/1314) ([nlohmann](https://github.com/nlohmann)) -- Add Meson related info to README [\#1305](https://github.com/nlohmann/json/pull/1305) ([koponomarenko](https://github.com/koponomarenko)) -- Improve diagnostic messages for binary formats [\#1303](https://github.com/nlohmann/json/pull/1303) ([nlohmann](https://github.com/nlohmann)) -- add new is\_constructible\_\* traits used in from\_json [\#1301](https://github.com/nlohmann/json/pull/1301) ([theodelrieu](https://github.com/theodelrieu)) -- add constraints for variadic json\_ref constructors [\#1294](https://github.com/nlohmann/json/pull/1294) ([theodelrieu](https://github.com/theodelrieu)) -- Improve diagnostic messages [\#1282](https://github.com/nlohmann/json/pull/1282) ([nlohmann](https://github.com/nlohmann)) -- Removed linter warnings [\#1280](https://github.com/nlohmann/json/pull/1280) ([nlohmann](https://github.com/nlohmann)) -- Thirdparty benchmark: Fix Clang detection. [\#1277](https://github.com/nlohmann/json/pull/1277) ([Lord-Kamina](https://github.com/Lord-Kamina)) - -## [v3.3.0](https://github.com/nlohmann/json/releases/tag/v3.3.0) (2018-10-05) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.3.0...v3.3.0) - -- Fix warning C4127: conditional expression is constant [\#1272](https://github.com/nlohmann/json/pull/1272) ([antonioborondo](https://github.com/antonioborondo)) -- Turn off additional deprecation warnings for GCC. [\#1271](https://github.com/nlohmann/json/pull/1271) ([chuckatkins](https://github.com/chuckatkins)) -- docs: Add additional CMake documentation [\#1270](https://github.com/nlohmann/json/pull/1270) ([chuckatkins](https://github.com/chuckatkins)) -- unit-testsuites.cpp: fix hangup if file not found [\#1262](https://github.com/nlohmann/json/pull/1262) ([knilch0r](https://github.com/knilch0r)) -- Fix broken cmake imported target alias [\#1260](https://github.com/nlohmann/json/pull/1260) ([chuckatkins](https://github.com/chuckatkins)) -- GCC 48 [\#1257](https://github.com/nlohmann/json/pull/1257) ([henryiii](https://github.com/henryiii)) -- Add version and license to meson.build [\#1252](https://github.com/nlohmann/json/pull/1252) ([koponomarenko](https://github.com/koponomarenko)) -- \#1179 Reordered the code. It seems to stop clang 3.4.2 in RHEL 7 from crash… [\#1249](https://github.com/nlohmann/json/pull/1249) ([LEgregius](https://github.com/LEgregius)) -- Use a version check to provide backwards comatible CMake imported target names [\#1245](https://github.com/nlohmann/json/pull/1245) ([chuckatkins](https://github.com/chuckatkins)) -- Fix issue \#1237 [\#1238](https://github.com/nlohmann/json/pull/1238) ([theodelrieu](https://github.com/theodelrieu)) -- Add a get overload taking a parameter. [\#1231](https://github.com/nlohmann/json/pull/1231) ([theodelrieu](https://github.com/theodelrieu)) -- Move lambda out of unevaluated context [\#1230](https://github.com/nlohmann/json/pull/1230) ([mandreyel](https://github.com/mandreyel)) -- Remove static asserts [\#1228](https://github.com/nlohmann/json/pull/1228) ([theodelrieu](https://github.com/theodelrieu)) -- Better error 305 [\#1221](https://github.com/nlohmann/json/pull/1221) ([rivertam](https://github.com/rivertam)) -- Fix \#1213 [\#1214](https://github.com/nlohmann/json/pull/1214) ([simnalamburt](https://github.com/simnalamburt)) -- Export package to allow builds without installing [\#1202](https://github.com/nlohmann/json/pull/1202) ([dennisfischer](https://github.com/dennisfischer)) - -## [3.3.0](https://github.com/nlohmann/json/releases/tag/3.3.0) (2018-10-05) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.2.0...3.3.0) - -- When key is not found print the key name into error too [\#1273](https://github.com/nlohmann/json/issues/1273) -- Visual Studio 2017 15.8.5 "conditional expression is constant" warning on Line 1851 in json.hpp [\#1268](https://github.com/nlohmann/json/issues/1268) -- how can we get this working on WSL? [\#1264](https://github.com/nlohmann/json/issues/1264) -- Help needed [\#1259](https://github.com/nlohmann/json/issues/1259) -- A way to get to a JSON values "key" [\#1258](https://github.com/nlohmann/json/issues/1258) -- While compiling got 76 errors [\#1255](https://github.com/nlohmann/json/issues/1255) -- Two blackslashes on json output file [\#1253](https://github.com/nlohmann/json/issues/1253) -- Including nlohmann the badwrong way. [\#1250](https://github.com/nlohmann/json/issues/1250) -- how to build with clang? [\#1247](https://github.com/nlohmann/json/issues/1247) -- Cmake target\_link\_libraries unable to find nlohmann\_json since version 3.2.0 [\#1243](https://github.com/nlohmann/json/issues/1243) -- \[Question\] Access to end\(\) iterator reference [\#1242](https://github.com/nlohmann/json/issues/1242) -- Parsing different json format [\#1241](https://github.com/nlohmann/json/issues/1241) -- Parsing Multiple JSON Files [\#1240](https://github.com/nlohmann/json/issues/1240) -- Doesn't compile under C++17 [\#1239](https://github.com/nlohmann/json/issues/1239) -- Conversion operator for nlohmann::json is not SFINAE friendly [\#1237](https://github.com/nlohmann/json/issues/1237) -- Custom deserialization of number\_float\_t [\#1236](https://github.com/nlohmann/json/issues/1236) -- deprecated-declarations warnings when compiling tests with GCC 8.2.1. [\#1233](https://github.com/nlohmann/json/issues/1233) -- Incomplete type with json\_fwd.hpp [\#1232](https://github.com/nlohmann/json/issues/1232) -- Parse Error [\#1229](https://github.com/nlohmann/json/issues/1229) -- json::get function with argument [\#1227](https://github.com/nlohmann/json/issues/1227) -- questions regarding from\_json [\#1226](https://github.com/nlohmann/json/issues/1226) -- Lambda in unevaluated context [\#1225](https://github.com/nlohmann/json/issues/1225) -- NLohmann doesn't compile when enabling strict warning policies [\#1224](https://github.com/nlohmann/json/issues/1224) -- Creating array of objects [\#1223](https://github.com/nlohmann/json/issues/1223) -- Somewhat unhelpful error message "cannot use operator\[\] with object" [\#1220](https://github.com/nlohmann/json/issues/1220) -- single\_include json.hpp [\#1218](https://github.com/nlohmann/json/issues/1218) -- Maps with enum class keys which are convertible to JSON strings should be converted to JSON dictionaries [\#1217](https://github.com/nlohmann/json/issues/1217) -- Adding JSON Array to the Array [\#1216](https://github.com/nlohmann/json/issues/1216) -- Best way to output a vector of a given type to json [\#1215](https://github.com/nlohmann/json/issues/1215) -- compiler warning: double definition of macro JSON\_INTERNAL\_CATCH [\#1213](https://github.com/nlohmann/json/issues/1213) -- Compilation error when using MOCK\_METHOD1 from GMock and nlohmann::json [\#1212](https://github.com/nlohmann/json/issues/1212) -- Issues parsing a previously encoded binary \(non-UTF8\) string. [\#1211](https://github.com/nlohmann/json/issues/1211) -- Yet another ordering question: char \* and parse\(\) [\#1209](https://github.com/nlohmann/json/issues/1209) -- Error using gcc 8.1.0 on Ubuntu 14.04 [\#1207](https://github.com/nlohmann/json/issues/1207) -- "type must be string, but is " std::string\(j.type\_name\(\) [\#1206](https://github.com/nlohmann/json/issues/1206) -- Returning empty json object from a function of type const json& ? [\#1205](https://github.com/nlohmann/json/issues/1205) -- VS2017 compiler suggests using constexpr if [\#1204](https://github.com/nlohmann/json/issues/1204) -- Template instatiation error on compiling [\#1203](https://github.com/nlohmann/json/issues/1203) -- BUG - json dump field with unicode -\> array of ints \(instead of string\) [\#1197](https://github.com/nlohmann/json/issues/1197) -- Compile error using Code::Blocks // mingw-w64 GCC 8.1.0 - "Incomplete Type" [\#1193](https://github.com/nlohmann/json/issues/1193) -- SEGFAULT on arm target [\#1190](https://github.com/nlohmann/json/issues/1190) -- Compiler crash with old Clang [\#1179](https://github.com/nlohmann/json/issues/1179) -- Custom Precision on floating point numbers [\#1170](https://github.com/nlohmann/json/issues/1170) -- Can we have a json\_view class like std::string\_view? [\#1158](https://github.com/nlohmann/json/issues/1158) -- improve error handling [\#1152](https://github.com/nlohmann/json/issues/1152) -- We should remove static\_asserts [\#960](https://github.com/nlohmann/json/issues/960) - -## [v3.2.0](https://github.com/nlohmann/json/releases/tag/v3.2.0) (2018-08-20) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.2.0...v3.2.0) - -- Fix -Wno-sometimes-uninitialized by initializing "result" in parse\_sax [\#1200](https://github.com/nlohmann/json/pull/1200) ([thyu](https://github.com/thyu)) -- \[RFC\] Introduce a new macro function: JSON\_INTERNAL\_CATCH [\#1187](https://github.com/nlohmann/json/pull/1187) ([simnalamburt](https://github.com/simnalamburt)) -- Fix unit tests that were silently skipped or crashed \(depending on the compiler\) [\#1176](https://github.com/nlohmann/json/pull/1176) ([grembo](https://github.com/grembo)) -- Refactor/no virtual sax [\#1153](https://github.com/nlohmann/json/pull/1153) ([theodelrieu](https://github.com/theodelrieu)) -- Fixed compiler error in VS 2015 for debug mode [\#1151](https://github.com/nlohmann/json/pull/1151) ([sonulohani](https://github.com/sonulohani)) -- Fix links to cppreference named requirements \(formerly concepts\) [\#1144](https://github.com/nlohmann/json/pull/1144) ([jrakow](https://github.com/jrakow)) -- meson: fix include directory [\#1142](https://github.com/nlohmann/json/pull/1142) ([jrakow](https://github.com/jrakow)) -- Feature/unordered map conversion [\#1138](https://github.com/nlohmann/json/pull/1138) ([theodelrieu](https://github.com/theodelrieu)) -- fixed compile error for \#1045 [\#1134](https://github.com/nlohmann/json/pull/1134) ([Daniel599](https://github.com/Daniel599)) -- test \(non\)equality for alt\_string implementation [\#1130](https://github.com/nlohmann/json/pull/1130) ([agrianius](https://github.com/agrianius)) -- remove stringstream dependency [\#1117](https://github.com/nlohmann/json/pull/1117) ([TinyTinni](https://github.com/TinyTinni)) -- Provide a from\_json overload for std::map [\#1089](https://github.com/nlohmann/json/pull/1089) ([theodelrieu](https://github.com/theodelrieu)) -- fix typo in README [\#1078](https://github.com/nlohmann/json/pull/1078) ([martin-mfg](https://github.com/martin-mfg)) -- Fix typo [\#1058](https://github.com/nlohmann/json/pull/1058) ([dns13](https://github.com/dns13)) -- Misc cmake packaging enhancements [\#1048](https://github.com/nlohmann/json/pull/1048) ([chuckatkins](https://github.com/chuckatkins)) -- Fixed incorrect LLVM version number in README [\#1047](https://github.com/nlohmann/json/pull/1047) ([jammehcow](https://github.com/jammehcow)) -- Fix trivial typo in comment. [\#1043](https://github.com/nlohmann/json/pull/1043) ([coryan](https://github.com/coryan)) -- Package Manager: Spack [\#1041](https://github.com/nlohmann/json/pull/1041) ([ax3l](https://github.com/ax3l)) -- CMake: 3.8+ is Sufficient [\#1040](https://github.com/nlohmann/json/pull/1040) ([ax3l](https://github.com/ax3l)) -- Added support for string\_view in C++17 [\#1028](https://github.com/nlohmann/json/pull/1028) ([gracicot](https://github.com/gracicot)) -- Added public target\_compile\_features for auto and constexpr [\#1026](https://github.com/nlohmann/json/pull/1026) ([ktonon](https://github.com/ktonon)) - -## [3.2.0](https://github.com/nlohmann/json/releases/tag/3.2.0) (2018-08-20) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.1.2...3.2.0) - -- Am I doing this wrong? Getting an empty string [\#1199](https://github.com/nlohmann/json/issues/1199) -- Incompatible Pointer Type [\#1196](https://github.com/nlohmann/json/issues/1196) -- json.exception.type\_error.316 [\#1195](https://github.com/nlohmann/json/issues/1195) -- Strange warnings in Code::Blocks 17.12, GNU GCC [\#1192](https://github.com/nlohmann/json/issues/1192) -- \[Question\] Current place in code to change floating point resolution [\#1191](https://github.com/nlohmann/json/issues/1191) -- Add key name when throwing type error [\#1189](https://github.com/nlohmann/json/issues/1189) -- Not able to include in visual studio code? [\#1188](https://github.com/nlohmann/json/issues/1188) -- Get an Index or row number of an element [\#1186](https://github.com/nlohmann/json/issues/1186) -- Difference between `merge_patch` and `update` [\#1183](https://github.com/nlohmann/json/issues/1183) -- Is there a way to get an element from a JSON without throwing an exception on failure? [\#1182](https://github.com/nlohmann/json/issues/1182) -- to\_string? [\#1181](https://github.com/nlohmann/json/issues/1181) -- How to cache a json object's pointer into a map? [\#1180](https://github.com/nlohmann/json/issues/1180) -- Can this library work within a Qt project for Android using Qt Creator? [\#1178](https://github.com/nlohmann/json/issues/1178) -- How to get all keys of one object? [\#1177](https://github.com/nlohmann/json/issues/1177) -- How can I only parse the first level and get the value as string? [\#1175](https://github.com/nlohmann/json/issues/1175) -- I have a query regarding nlohmann::basic\_json::basic\_json [\#1174](https://github.com/nlohmann/json/issues/1174) -- unordered\_map with vectors won't convert to json? [\#1173](https://github.com/nlohmann/json/issues/1173) -- return json objects from functions [\#1172](https://github.com/nlohmann/json/issues/1172) -- Problem when exporting to CBOR [\#1171](https://github.com/nlohmann/json/issues/1171) -- Roundtripping null to nullptr does not work [\#1169](https://github.com/nlohmann/json/issues/1169) -- MSVC fails to compile std::swap specialization for nlohmann::json [\#1168](https://github.com/nlohmann/json/issues/1168) -- Unexpected behaviour of is\_null - Part II [\#1167](https://github.com/nlohmann/json/issues/1167) -- Floating point imprecision [\#1166](https://github.com/nlohmann/json/issues/1166) -- Combine json objects into one? [\#1165](https://github.com/nlohmann/json/issues/1165) -- Is there any way to know if the object has changed? [\#1164](https://github.com/nlohmann/json/issues/1164) -- Value throws on null string [\#1163](https://github.com/nlohmann/json/issues/1163) -- Weird template issue in large project [\#1162](https://github.com/nlohmann/json/issues/1162) -- \_json returns a different result vs ::parse [\#1161](https://github.com/nlohmann/json/issues/1161) -- Showing difference between two json objects [\#1160](https://github.com/nlohmann/json/issues/1160) -- no instance of overloaded function "std::swap" matches the specified type [\#1159](https://github.com/nlohmann/json/issues/1159) -- resize\(...\)? [\#1157](https://github.com/nlohmann/json/issues/1157) -- Issue with struct nested in class' to\_json [\#1155](https://github.com/nlohmann/json/issues/1155) -- Deserialize std::map with std::nan [\#1154](https://github.com/nlohmann/json/issues/1154) -- Parse throwing errors [\#1149](https://github.com/nlohmann/json/issues/1149) -- cocoapod integration [\#1148](https://github.com/nlohmann/json/issues/1148) -- wstring parsing [\#1147](https://github.com/nlohmann/json/issues/1147) -- Is it possible to dump a two-dimensional array to "\[\[null\],\[1,2,3\]\]"? [\#1146](https://github.com/nlohmann/json/issues/1146) -- Want to write a class member variable and a struct variable \( this structure is inside the class\) to the json file [\#1145](https://github.com/nlohmann/json/issues/1145) -- Does json support converting an instance of a struct into json string? [\#1143](https://github.com/nlohmann/json/issues/1143) -- \#Most efficient way to search for child parameters \(recursive find?\) [\#1141](https://github.com/nlohmann/json/issues/1141) -- could not find to\_json\(\) method in T's namespace [\#1140](https://github.com/nlohmann/json/issues/1140) -- chars get treated as JSON numbers not JSON strings [\#1139](https://github.com/nlohmann/json/issues/1139) -- How do I count number of objects in array? [\#1137](https://github.com/nlohmann/json/issues/1137) -- Serializing a vector of classes? [\#1136](https://github.com/nlohmann/json/issues/1136) -- Compile error. Unable convert form nullptr to nullptr&& [\#1135](https://github.com/nlohmann/json/issues/1135) -- std::unordered\_map in struct, serialization [\#1133](https://github.com/nlohmann/json/issues/1133) -- dump\(\) can't handle umlauts [\#1131](https://github.com/nlohmann/json/issues/1131) -- Add a way to get a key reference from the iterator [\#1127](https://github.com/nlohmann/json/issues/1127) -- can't not parse "\\“ string [\#1123](https://github.com/nlohmann/json/issues/1123) -- if json file contain Internationalization chars , get exception [\#1122](https://github.com/nlohmann/json/issues/1122) -- How to use a json::iterator dereferenced value in code? [\#1120](https://github.com/nlohmann/json/issues/1120) -- Disable implicit conversions from json to std::initializer\_list\ for any T [\#1118](https://github.com/nlohmann/json/issues/1118) -- Implicit conversions to complex types can lead to surprising and confusing errors [\#1116](https://github.com/nlohmann/json/issues/1116) -- How can I write from\_json for a complex datatype that is not default constructible? [\#1115](https://github.com/nlohmann/json/issues/1115) -- Compile error in VS2015 when compiling unit-conversions.cpp [\#1114](https://github.com/nlohmann/json/issues/1114) -- ADL Serializer for std::any / boost::any [\#1113](https://github.com/nlohmann/json/issues/1113) -- Unexpected behaviour of is\_null [\#1112](https://github.com/nlohmann/json/issues/1112) -- How to resolve " undefined reference to `std::\_\_throw\_bad\_cast\(\)'" [\#1111](https://github.com/nlohmann/json/issues/1111) -- cannot compile on ubuntu 18.04 and 16.04 [\#1110](https://github.com/nlohmann/json/issues/1110) -- JSON representation for floating point values has too many digits [\#1109](https://github.com/nlohmann/json/issues/1109) -- Not working for classes containing "\_declspec\(dllimport\)" in their declaration [\#1108](https://github.com/nlohmann/json/issues/1108) -- Get keys from json object [\#1107](https://github.com/nlohmann/json/issues/1107) -- Cannot deserialize types using std::ratio [\#1105](https://github.com/nlohmann/json/issues/1105) -- i want to learn json [\#1104](https://github.com/nlohmann/json/issues/1104) -- Type checking during compile [\#1103](https://github.com/nlohmann/json/issues/1103) -- Iterate through sub items [\#1102](https://github.com/nlohmann/json/issues/1102) -- cppcheck failing for version 3.1.2 [\#1101](https://github.com/nlohmann/json/issues/1101) -- Deserializing std::map [\#1100](https://github.com/nlohmann/json/issues/1100) -- accessing key by reference [\#1098](https://github.com/nlohmann/json/issues/1098) -- clang 3.8.0 croaks while trying to compile with debug symbols [\#1097](https://github.com/nlohmann/json/issues/1097) -- Serialize a list of class objects with json [\#1096](https://github.com/nlohmann/json/issues/1096) -- Small question [\#1094](https://github.com/nlohmann/json/issues/1094) -- Upgrading to 3.x: to\_/from\_json with enum class [\#1093](https://github.com/nlohmann/json/issues/1093) -- Q: few questions about json construction [\#1092](https://github.com/nlohmann/json/issues/1092) -- general crayCC compilation failure [\#1091](https://github.com/nlohmann/json/issues/1091) -- Merge Patch clears original data [\#1090](https://github.com/nlohmann/json/issues/1090) -- \[Question\] how to use nlohmann/json in c++? [\#1088](https://github.com/nlohmann/json/issues/1088) -- C++17 decomposition declaration support [\#1087](https://github.com/nlohmann/json/issues/1087) -- \[Question\] Access multi-level json objects [\#1086](https://github.com/nlohmann/json/issues/1086) -- Serializing vector [\#1085](https://github.com/nlohmann/json/issues/1085) -- update nested value in multi hierarchy json object [\#1084](https://github.com/nlohmann/json/issues/1084) -- Overriding default values? [\#1083](https://github.com/nlohmann/json/issues/1083) -- detail namespace collision with Cereal? [\#1082](https://github.com/nlohmann/json/issues/1082) -- Error using json.dump\(\); [\#1081](https://github.com/nlohmann/json/issues/1081) -- Consuming TCP Stream [\#1080](https://github.com/nlohmann/json/issues/1080) -- Compilation error with strong typed enums in map in combination with namespaces [\#1079](https://github.com/nlohmann/json/issues/1079) -- cassert error [\#1076](https://github.com/nlohmann/json/issues/1076) -- Valid json data not being parsed [\#1075](https://github.com/nlohmann/json/issues/1075) -- Feature request :: Better testing for key existance without try/catch [\#1074](https://github.com/nlohmann/json/issues/1074) -- Hi, I have input like a.b.c and want to convert it to \"a\"{\"b\": \"c\"} form. Any suggestions how do I do this? Thanks. [\#1073](https://github.com/nlohmann/json/issues/1073) -- ADL deserializer not picked up for non default-constructible type [\#1072](https://github.com/nlohmann/json/issues/1072) -- Deserializing std::array doesn't compiler \(no insert\(\)\) [\#1071](https://github.com/nlohmann/json/issues/1071) -- Serializing OpenCV Mat problem [\#1070](https://github.com/nlohmann/json/issues/1070) -- Compilation error with ICPC compiler [\#1068](https://github.com/nlohmann/json/issues/1068) -- Not existing value, crash [\#1065](https://github.com/nlohmann/json/issues/1065) -- cyryllic symbols [\#1064](https://github.com/nlohmann/json/issues/1064) -- newbie usage question [\#1063](https://github.com/nlohmann/json/issues/1063) -- Trying j\["strTest"\] = "%A" produces "strTest": "-0X1.CCCCCCCCCCCCCP+205" [\#1062](https://github.com/nlohmann/json/issues/1062) -- convert json value to std::string??? [\#1061](https://github.com/nlohmann/json/issues/1061) -- Commented out test cases, should they be removed? [\#1060](https://github.com/nlohmann/json/issues/1060) -- different behaviour between clang and gcc with braced initialization [\#1059](https://github.com/nlohmann/json/issues/1059) -- json array: initialize with prescribed size and `resize` method. [\#1057](https://github.com/nlohmann/json/issues/1057) -- Is it possible to use exceptions istead of assertions? [\#1056](https://github.com/nlohmann/json/issues/1056) -- when using assign operator in with json object a static assertion fails.. [\#1055](https://github.com/nlohmann/json/issues/1055) -- Iterate over leafs of a JSON data structure: enrich the JSON pointer API [\#1054](https://github.com/nlohmann/json/issues/1054) -- \[Feature request\] Access by path [\#1053](https://github.com/nlohmann/json/issues/1053) -- document that implicit js -\> primitive conversion does not work for std::string::value\_type and why [\#1052](https://github.com/nlohmann/json/issues/1052) -- error: ‘BasicJsonType’ in namespace ‘::’ does not name a type [\#1051](https://github.com/nlohmann/json/issues/1051) -- Destructor is called when filling object through assignement [\#1050](https://github.com/nlohmann/json/issues/1050) -- Is this thing thread safe for reads? [\#1049](https://github.com/nlohmann/json/issues/1049) -- clang-tidy: Call to virtual function during construction [\#1046](https://github.com/nlohmann/json/issues/1046) -- Using STL algorithms with JSON containers with expected results? [\#1045](https://github.com/nlohmann/json/issues/1045) -- Usage with gtest/gmock not working as expected [\#1044](https://github.com/nlohmann/json/issues/1044) -- Consequences of from\_json / to\_json being in namespace of data struct. [\#1042](https://github.com/nlohmann/json/issues/1042) -- const\_reference operator\[\]\(const typename object\_t::key\_type& key\) const throw instead of assert [\#1039](https://github.com/nlohmann/json/issues/1039) -- Trying to retrieve data from nested objects [\#1038](https://github.com/nlohmann/json/issues/1038) -- Direct download link for json\_fwd.hpp? [\#1037](https://github.com/nlohmann/json/issues/1037) -- I know the library supports UTF-8, but failed to dump the value [\#1036](https://github.com/nlohmann/json/issues/1036) -- Putting a Vec3-like vector into a json object [\#1035](https://github.com/nlohmann/json/issues/1035) -- Ternary operator crash [\#1034](https://github.com/nlohmann/json/issues/1034) -- Issued with Clion Inspection Resolution since 2018.1 [\#1033](https://github.com/nlohmann/json/issues/1033) -- Some testcases fail and one never finishes [\#1032](https://github.com/nlohmann/json/issues/1032) -- Can this class work with wchar\_t / std::wstring? [\#1031](https://github.com/nlohmann/json/issues/1031) -- Makefile: Valgrind flags have no effect [\#1030](https://github.com/nlohmann/json/issues/1030) -- 「==」 Should be 「\>」 [\#1029](https://github.com/nlohmann/json/issues/1029) -- HOCON reader? [\#1027](https://github.com/nlohmann/json/issues/1027) -- add json string in previous string?? [\#1025](https://github.com/nlohmann/json/issues/1025) -- RFC: fluent parsing interface [\#1023](https://github.com/nlohmann/json/issues/1023) -- Does it support chinese character? [\#1022](https://github.com/nlohmann/json/issues/1022) -- to/from\_msgpack only works with standard typization [\#1021](https://github.com/nlohmann/json/issues/1021) -- Build failure using latest clang and GCC compilers [\#1020](https://github.com/nlohmann/json/issues/1020) -- can two json objects be concatenated? [\#1019](https://github.com/nlohmann/json/issues/1019) -- Erase by integer index [\#1018](https://github.com/nlohmann/json/issues/1018) -- Function find overload taking a json\_pointer [\#1017](https://github.com/nlohmann/json/issues/1017) -- I think should implement an parser function [\#1016](https://github.com/nlohmann/json/issues/1016) -- Readme gif [\#1015](https://github.com/nlohmann/json/issues/1015) -- Python bindings [\#1014](https://github.com/nlohmann/json/issues/1014) -- how to add two json string in single object?? [\#1012](https://github.com/nlohmann/json/issues/1012) -- how to serialize class Object \(convert data in object into json\)?? [\#1011](https://github.com/nlohmann/json/issues/1011) -- Enable forward declaration of json by making json a class instead of a using declaration [\#997](https://github.com/nlohmann/json/issues/997) -- compilation error while using intel c++ compiler 2018 [\#994](https://github.com/nlohmann/json/issues/994) -- How to create a json variable? [\#990](https://github.com/nlohmann/json/issues/990) -- istream \>\> json --- 1st character skipped in stream [\#976](https://github.com/nlohmann/json/issues/976) -- Add a SAX parser [\#971](https://github.com/nlohmann/json/issues/971) -- How to solve large json file? [\#927](https://github.com/nlohmann/json/issues/927) -- json\_pointer public push\_back, pop\_back [\#837](https://github.com/nlohmann/json/issues/837) -- Using input\_adapter in a slightly unexpected way [\#834](https://github.com/nlohmann/json/issues/834) - -## [v3.1.2](https://github.com/nlohmann/json/releases/tag/v3.1.2) (2018-03-14) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.1.2...v3.1.2) - -- Allowing for user-defined string type in lexer/parser [\#1009](https://github.com/nlohmann/json/pull/1009) ([nlohmann](https://github.com/nlohmann)) -- dump to alternative string type, as defined in basic\_json template [\#1006](https://github.com/nlohmann/json/pull/1006) ([agrianius](https://github.com/agrianius)) -- Fix memory leak during parser callback [\#1001](https://github.com/nlohmann/json/pull/1001) ([nlohmann](https://github.com/nlohmann)) -- fixed misprinted condition detected by PVS Studio. [\#992](https://github.com/nlohmann/json/pull/992) ([bogemic](https://github.com/bogemic)) -- Fix/basic json conversion [\#986](https://github.com/nlohmann/json/pull/986) ([theodelrieu](https://github.com/theodelrieu)) -- Make integration section concise [\#981](https://github.com/nlohmann/json/pull/981) ([wla80](https://github.com/wla80)) - -## [3.1.2](https://github.com/nlohmann/json/releases/tag/3.1.2) (2018-03-14) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.1.1...3.1.2) - -- STL containers are always serialized to a nested array like \[\[1,2,3\]\] [\#1013](https://github.com/nlohmann/json/issues/1013) -- The library doesn't want to insert an unordered\_map [\#1010](https://github.com/nlohmann/json/issues/1010) -- Convert Json to uint8\_t [\#1008](https://github.com/nlohmann/json/issues/1008) -- How to compare two JSON objects? [\#1007](https://github.com/nlohmann/json/issues/1007) -- Syntax checking [\#1003](https://github.com/nlohmann/json/issues/1003) -- more than one operator '=' matches these operands [\#1002](https://github.com/nlohmann/json/issues/1002) -- How to check if key existed [\#1000](https://github.com/nlohmann/json/issues/1000) -- nlohmann::json::parse exhaust memory in go binding [\#999](https://github.com/nlohmann/json/issues/999) -- Range-based iteration over a non-array object [\#998](https://github.com/nlohmann/json/issues/998) -- get\ for types that are not default constructible [\#996](https://github.com/nlohmann/json/issues/996) -- Prevent Null values to appear in .dump\(\) [\#995](https://github.com/nlohmann/json/issues/995) -- number parsing [\#993](https://github.com/nlohmann/json/issues/993) -- C2664 \(C++/CLR\) cannot convert 'nullptr' to 'nullptr &&' [\#987](https://github.com/nlohmann/json/issues/987) -- Uniform initialization from another json object differs between gcc and clang. [\#985](https://github.com/nlohmann/json/issues/985) -- Problem with adding the lib as a submodule [\#983](https://github.com/nlohmann/json/issues/983) -- UTF-8/Unicode error [\#982](https://github.com/nlohmann/json/issues/982) -- "forcing MSVC stacktrace to show which T we're talking about." error [\#980](https://github.com/nlohmann/json/issues/980) -- reverse order of serialization [\#979](https://github.com/nlohmann/json/issues/979) -- Assigning between different json types [\#977](https://github.com/nlohmann/json/issues/977) -- Support serialisation of `unique_ptr<>` and `shared_ptr<>` [\#975](https://github.com/nlohmann/json/issues/975) -- Unexpected end of input \(not same as one before\) [\#974](https://github.com/nlohmann/json/issues/974) -- Segfault on direct initializing json object [\#973](https://github.com/nlohmann/json/issues/973) -- Segmentation fault on G++ when trying to assign json string literal to custom json type. [\#972](https://github.com/nlohmann/json/issues/972) -- os\_defines.h:44:19: error: missing binary operator before token "\(" [\#970](https://github.com/nlohmann/json/issues/970) -- Passing an iteration object by reference to a function [\#967](https://github.com/nlohmann/json/issues/967) -- Json and fmt::lib's format\_arg\(\) [\#964](https://github.com/nlohmann/json/issues/964) - -## [v3.1.1](https://github.com/nlohmann/json/releases/tag/v3.1.1) (2018-02-13) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.1.0...v3.1.1) - -- Updation of child object isn't reflected in parent Object [\#968](https://github.com/nlohmann/json/issues/968) -- How to add user defined C++ path to sublime text [\#966](https://github.com/nlohmann/json/issues/966) -- fast number parsing [\#965](https://github.com/nlohmann/json/issues/965) -- With non-unique keys, later stored entries are not taken into account anymore [\#963](https://github.com/nlohmann/json/issues/963) -- Timeout \(OSS-Fuzz 6034\) [\#962](https://github.com/nlohmann/json/issues/962) -- Incorrect parsing of indefinite length CBOR strings. [\#961](https://github.com/nlohmann/json/issues/961) -- Reload a json file at runtime without emptying my std::ifstream [\#959](https://github.com/nlohmann/json/issues/959) -- Split headers should be part of the release [\#956](https://github.com/nlohmann/json/issues/956) -- Coveralls shows no coverage data [\#953](https://github.com/nlohmann/json/issues/953) -- Feature request: Implicit conversion to bool [\#951](https://github.com/nlohmann/json/issues/951) -- converting json to vector of type with templated constructor [\#924](https://github.com/nlohmann/json/issues/924) -- No structured bindings support? [\#901](https://github.com/nlohmann/json/issues/901) -- \[Request\] Macro generating from\_json\(\) and to\_json\(\) [\#895](https://github.com/nlohmann/json/issues/895) -- basic\_json::value throws exception instead of returning default value [\#871](https://github.com/nlohmann/json/issues/871) - -- Fix constraints on from\_json\(CompatibleArrayType\) [\#969](https://github.com/nlohmann/json/pull/969) ([theodelrieu](https://github.com/theodelrieu)) -- Make coveralls watch the include folder [\#957](https://github.com/nlohmann/json/pull/957) ([theodelrieu](https://github.com/theodelrieu)) -- Fix links in README.md [\#955](https://github.com/nlohmann/json/pull/955) ([patrikhuber](https://github.com/patrikhuber)) -- Add a note about installing the library with cget [\#954](https://github.com/nlohmann/json/pull/954) ([pfultz2](https://github.com/pfultz2)) - -## [v3.1.0](https://github.com/nlohmann/json/releases/tag/v3.1.0) (2018-02-01) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.1.0...v3.1.0) - -- Templatize std::string in binary\_reader \#941 [\#950](https://github.com/nlohmann/json/pull/950) ([kaidokert](https://github.com/kaidokert)) -- fix cmake install directory \(for real this time\) [\#944](https://github.com/nlohmann/json/pull/944) ([theodelrieu](https://github.com/theodelrieu)) -- Allow overriding THROW/CATCH/TRY macros with no-exceptions \#938 [\#940](https://github.com/nlohmann/json/pull/940) ([kaidokert](https://github.com/kaidokert)) -- Removed compiler warning about unused variable 'kMinExp' [\#936](https://github.com/nlohmann/json/pull/936) ([zerodefect](https://github.com/zerodefect)) -- Fix a typo in README.md [\#930](https://github.com/nlohmann/json/pull/930) ([Pipeliner](https://github.com/Pipeliner)) -- Howto installation of json\_fwd.hpp \(fixes \#923\) [\#925](https://github.com/nlohmann/json/pull/925) ([zerodefect](https://github.com/zerodefect)) -- fix sfinae on basic\_json UDT constructor [\#919](https://github.com/nlohmann/json/pull/919) ([theodelrieu](https://github.com/theodelrieu)) -- Floating-point formatting [\#915](https://github.com/nlohmann/json/pull/915) ([abolz](https://github.com/abolz)) -- Fix/cmake install [\#911](https://github.com/nlohmann/json/pull/911) ([theodelrieu](https://github.com/theodelrieu)) -- fix link to the documentation of the emplace function [\#900](https://github.com/nlohmann/json/pull/900) ([Dobiasd](https://github.com/Dobiasd)) -- JSON Merge Patch \(RFC 7396\) [\#876](https://github.com/nlohmann/json/pull/876) ([nlohmann](https://github.com/nlohmann)) -- Refactor/split it [\#700](https://github.com/nlohmann/json/pull/700) ([theodelrieu](https://github.com/theodelrieu)) - -## [3.1.0](https://github.com/nlohmann/json/releases/tag/3.1.0) (2018-02-01) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.0.1...3.1.0) - -- I have a proposal [\#949](https://github.com/nlohmann/json/issues/949) -- VERSION define\(s\) [\#948](https://github.com/nlohmann/json/issues/948) -- v3.0.1 compile error in icc 16.0.4 [\#947](https://github.com/nlohmann/json/issues/947) -- Use in VS2017 15.5.5 [\#946](https://github.com/nlohmann/json/issues/946) -- Process for reporting Security Bugs? [\#945](https://github.com/nlohmann/json/issues/945) -- Please expose a NLOHMANN\_JSON\_VERSION macro [\#943](https://github.com/nlohmann/json/issues/943) -- Change header include directory to nlohmann/json [\#942](https://github.com/nlohmann/json/issues/942) -- string\_type in binary\_reader [\#941](https://github.com/nlohmann/json/issues/941) -- compile error with clang 5.0 -std=c++1z and no string\_view [\#939](https://github.com/nlohmann/json/issues/939) -- Allow overriding JSON\_THROW to something else than abort\(\) [\#938](https://github.com/nlohmann/json/issues/938) -- Handle invalid string in Json file [\#937](https://github.com/nlohmann/json/issues/937) -- Unused variable 'kMinExp' [\#935](https://github.com/nlohmann/json/issues/935) -- yytext is already defined [\#933](https://github.com/nlohmann/json/issues/933) -- Equality operator fails [\#931](https://github.com/nlohmann/json/issues/931) -- use in visual studio 2015 [\#929](https://github.com/nlohmann/json/issues/929) -- Relative includes of json\_fwd.hpp in detail/meta.hpp. \[Develop branch\] [\#928](https://github.com/nlohmann/json/issues/928) -- GCC 7.x issue [\#926](https://github.com/nlohmann/json/issues/926) -- json\_fwd.hpp not installed [\#923](https://github.com/nlohmann/json/issues/923) -- Use Google Benchmarks [\#921](https://github.com/nlohmann/json/issues/921) -- Move class json\_pointer to separate file [\#920](https://github.com/nlohmann/json/issues/920) -- Unable to locate 'to\_json\(\)' and 'from\_json\(\)' methods in the same namespace [\#917](https://github.com/nlohmann/json/issues/917) -- \[answered\]Read key1 from .value example [\#914](https://github.com/nlohmann/json/issues/914) -- Don't use `define private public` in test files [\#913](https://github.com/nlohmann/json/issues/913) -- value\(\) template argument type deduction [\#912](https://github.com/nlohmann/json/issues/912) -- Installation path is incorrect [\#910](https://github.com/nlohmann/json/issues/910) -- H [\#909](https://github.com/nlohmann/json/issues/909) -- Build failure using clang 5 [\#908](https://github.com/nlohmann/json/issues/908) -- Amalgate [\#907](https://github.com/nlohmann/json/issues/907) -- Update documentation and tests wrt. split headers [\#906](https://github.com/nlohmann/json/issues/906) -- Lib not working on ubuntu 16.04 [\#905](https://github.com/nlohmann/json/issues/905) -- Problem when writing to file. [\#904](https://github.com/nlohmann/json/issues/904) -- C2864 error when compiling with VS2015 and VS 2017 [\#903](https://github.com/nlohmann/json/issues/903) -- \[json.exception.type\_error.304\] cannot use at\(\) with object [\#902](https://github.com/nlohmann/json/issues/902) -- How do I forward nlohmann::json declaration? [\#899](https://github.com/nlohmann/json/issues/899) -- How to effectively store binary data? [\#898](https://github.com/nlohmann/json/issues/898) -- How to get the length of a JSON string without retrieving its std::string? [\#897](https://github.com/nlohmann/json/issues/897) -- Regression Tests Failure using "ctest" [\#887](https://github.com/nlohmann/json/issues/887) -- Discuss: add JSON Merge Patch \(RFC 7396\)? [\#877](https://github.com/nlohmann/json/issues/877) -- Discuss: replace static "iterator\_wrapper" function with "items" member function [\#874](https://github.com/nlohmann/json/issues/874) -- Make optional user-data available in from\_json [\#864](https://github.com/nlohmann/json/issues/864) -- Casting to std::string not working in VS2015 [\#861](https://github.com/nlohmann/json/issues/861) -- Sequential reading of JSON arrays [\#851](https://github.com/nlohmann/json/issues/851) -- Idea: Handle Multimaps Better [\#816](https://github.com/nlohmann/json/issues/816) -- Floating point rounding [\#777](https://github.com/nlohmann/json/issues/777) -- Loss of precision when serializing \ [\#360](https://github.com/nlohmann/json/issues/360) - -## [v3.0.1](https://github.com/nlohmann/json/releases/tag/v3.0.1) (2017-12-29) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.0.1...v3.0.1) - -- Includes CTest module/adds BUILD\_TESTING option [\#885](https://github.com/nlohmann/json/pull/885) ([TinyTinni](https://github.com/TinyTinni)) -- Fix MSVC warning C4819 [\#882](https://github.com/nlohmann/json/pull/882) ([erengy](https://github.com/erengy)) -- Merge branch 'develop' into coverity\_scan [\#880](https://github.com/nlohmann/json/pull/880) ([nlohmann](https://github.com/nlohmann)) -- :wrench: Fix up a few more effc++ items [\#858](https://github.com/nlohmann/json/pull/858) ([mattismyname](https://github.com/mattismyname)) - -## [3.0.1](https://github.com/nlohmann/json/releases/tag/3.0.1) (2017-12-29) - -[Full Changelog](https://github.com/nlohmann/json/compare/v3.0.0...3.0.1) - -- Problem parsing array to global vector [\#896](https://github.com/nlohmann/json/issues/896) -- Invalid RFC6902 copy operation succeeds [\#894](https://github.com/nlohmann/json/issues/894) -- How to rename a key during looping? [\#893](https://github.com/nlohmann/json/issues/893) -- clang++-6.0 \(6.0.0-svn321357-1\) warning [\#892](https://github.com/nlohmann/json/issues/892) -- Make json.hpp aware of the modules TS? [\#891](https://github.com/nlohmann/json/issues/891) -- All enum values not handled in switch cases. \( -Wswitch-enum \) [\#889](https://github.com/nlohmann/json/issues/889) -- JSON Pointer resolve failure resulting in incorrect exception code [\#888](https://github.com/nlohmann/json/issues/888) -- Unexpected nested arrays from std::vector [\#886](https://github.com/nlohmann/json/issues/886) -- erase multiple elements from a json object [\#884](https://github.com/nlohmann/json/issues/884) -- Container function overview in Doxygen is not updated [\#883](https://github.com/nlohmann/json/issues/883) -- How to use this for binary file uploads [\#881](https://github.com/nlohmann/json/issues/881) -- Allow setting JSON\_BuildTests=OFF from parent CMakeLists.txt [\#846](https://github.com/nlohmann/json/issues/846) -- Unit test fails for local-independent str-to-num [\#845](https://github.com/nlohmann/json/issues/845) -- Another idea about type support [\#774](https://github.com/nlohmann/json/issues/774) - -## [v3.0.0](https://github.com/nlohmann/json/releases/tag/v3.0.0) (2017-12-17) - -[Full Changelog](https://github.com/nlohmann/json/compare/3.0.0...v3.0.0) - -- :white\_check\_mark: re-added tests for algorithms [\#879](https://github.com/nlohmann/json/pull/879) ([nlohmann](https://github.com/nlohmann)) -- Overworked library toward 3.0.0 release [\#875](https://github.com/nlohmann/json/pull/875) ([nlohmann](https://github.com/nlohmann)) -- :rotating\_light: remove C4996 warnings \#872 [\#873](https://github.com/nlohmann/json/pull/873) ([nlohmann](https://github.com/nlohmann)) -- :boom: throwing an exception in case dump encounters a non-UTF-8 string \#838 [\#870](https://github.com/nlohmann/json/pull/870) ([nlohmann](https://github.com/nlohmann)) -- :memo: fixing documentation \#867 [\#868](https://github.com/nlohmann/json/pull/868) ([nlohmann](https://github.com/nlohmann)) -- iter\_impl template conformance with C++17 [\#860](https://github.com/nlohmann/json/pull/860) ([bogemic](https://github.com/bogemic)) -- Std allocator conformance cpp17 [\#856](https://github.com/nlohmann/json/pull/856) ([bogemic](https://github.com/bogemic)) -- cmake: use BUILD\_INTERFACE/INSTALL\_INTERFACE [\#855](https://github.com/nlohmann/json/pull/855) ([theodelrieu](https://github.com/theodelrieu)) -- to/from\_json: add a MSVC-specific static\_assert to force a stacktrace [\#854](https://github.com/nlohmann/json/pull/854) ([theodelrieu](https://github.com/theodelrieu)) -- Add .natvis for MSVC debug view [\#844](https://github.com/nlohmann/json/pull/844) ([TinyTinni](https://github.com/TinyTinni)) -- Updated hunter package links [\#829](https://github.com/nlohmann/json/pull/829) ([jowr](https://github.com/jowr)) -- Typos README [\#811](https://github.com/nlohmann/json/pull/811) ([Itja](https://github.com/Itja)) -- add forwarding references to json\_ref constructor [\#807](https://github.com/nlohmann/json/pull/807) ([theodelrieu](https://github.com/theodelrieu)) -- Add transparent comparator and perfect forwarding support to find\(\) and count\(\) [\#795](https://github.com/nlohmann/json/pull/795) ([jseward](https://github.com/jseward)) -- Error : 'identifier "size\_t" is undefined' in linux [\#793](https://github.com/nlohmann/json/pull/793) ([sonulohani](https://github.com/sonulohani)) -- Fix Visual Studio 2017 warnings [\#788](https://github.com/nlohmann/json/pull/788) ([jseward](https://github.com/jseward)) -- Fix warning C4706 on Visual Studio 2017 [\#785](https://github.com/nlohmann/json/pull/785) ([jseward](https://github.com/jseward)) -- Set GENERATE\_TAGFILE in Doxyfile [\#783](https://github.com/nlohmann/json/pull/783) ([eld00d](https://github.com/eld00d)) -- using more CMake [\#765](https://github.com/nlohmann/json/pull/765) ([nlohmann](https://github.com/nlohmann)) -- Simplified istream handing \#367 [\#764](https://github.com/nlohmann/json/pull/764) ([pjkundert](https://github.com/pjkundert)) -- Add info for the vcpkg package. [\#753](https://github.com/nlohmann/json/pull/753) ([gregmarr](https://github.com/gregmarr)) -- fix from\_json implementation for pair/tuple [\#708](https://github.com/nlohmann/json/pull/708) ([theodelrieu](https://github.com/theodelrieu)) -- Update json.hpp [\#686](https://github.com/nlohmann/json/pull/686) ([GoWebProd](https://github.com/GoWebProd)) -- Remove duplicate word [\#685](https://github.com/nlohmann/json/pull/685) ([daixtrose](https://github.com/daixtrose)) -- To fix compilation issue for intel OSX compiler [\#682](https://github.com/nlohmann/json/pull/682) ([kbthomp1](https://github.com/kbthomp1)) -- Digraph warning [\#679](https://github.com/nlohmann/json/pull/679) ([traits](https://github.com/traits)) -- massage -\> message [\#678](https://github.com/nlohmann/json/pull/678) ([DmitryKuk](https://github.com/DmitryKuk)) -- Fix "not constraint" grammar in docs [\#674](https://github.com/nlohmann/json/pull/674) ([wincent](https://github.com/wincent)) -- Add documentation for integration with CMake and hunter [\#671](https://github.com/nlohmann/json/pull/671) ([dan-42](https://github.com/dan-42)) -- REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse [\#669](https://github.com/nlohmann/json/pull/669) ([dan-42](https://github.com/dan-42)) -- enable\_testing only if the JSON\_BuildTests is ON [\#666](https://github.com/nlohmann/json/pull/666) ([effolkronium](https://github.com/effolkronium)) -- Support moving from rvalues in std::initializer\_list [\#663](https://github.com/nlohmann/json/pull/663) ([himikof](https://github.com/himikof)) -- add ensure\_ascii parameter to dump. \#330 [\#654](https://github.com/nlohmann/json/pull/654) ([ryanjmulder](https://github.com/ryanjmulder)) -- Rename BuildTests to JSON\_BuildTests [\#652](https://github.com/nlohmann/json/pull/652) ([olegendo](https://github.com/olegendo)) -- Don't include \, use std::make\_shared [\#650](https://github.com/nlohmann/json/pull/650) ([olegendo](https://github.com/olegendo)) -- Refacto/split basic json [\#643](https://github.com/nlohmann/json/pull/643) ([theodelrieu](https://github.com/theodelrieu)) -- fix typo in operator\_\_notequal example [\#630](https://github.com/nlohmann/json/pull/630) ([Chocobo1](https://github.com/Chocobo1)) -- Fix MSVC warning C4819 [\#629](https://github.com/nlohmann/json/pull/629) ([Chocobo1](https://github.com/Chocobo1)) -- \[BugFix\] Add parentheses around std::min [\#626](https://github.com/nlohmann/json/pull/626) ([koemeet](https://github.com/koemeet)) -- add pair/tuple conversions [\#624](https://github.com/nlohmann/json/pull/624) ([theodelrieu](https://github.com/theodelrieu)) -- remove std::pair support [\#615](https://github.com/nlohmann/json/pull/615) ([theodelrieu](https://github.com/theodelrieu)) -- Add pair support, fix CompatibleObject conversions \(fixes \#600\) [\#609](https://github.com/nlohmann/json/pull/609) ([theodelrieu](https://github.com/theodelrieu)) -- \#550 Fix iterator related compiling issues for Intel icc [\#598](https://github.com/nlohmann/json/pull/598) ([HenryRLee](https://github.com/HenryRLee)) -- Issue \#593 Fix the arithmetic operators in the iterator and reverse iterator [\#595](https://github.com/nlohmann/json/pull/595) ([HenryRLee](https://github.com/HenryRLee)) -- fix doxygen error of basic\_json::get\(\) [\#583](https://github.com/nlohmann/json/pull/583) ([zhaohuaxishi](https://github.com/zhaohuaxishi)) -- Fixing assignement for iterator wrapper second, and adding unit test [\#579](https://github.com/nlohmann/json/pull/579) ([Type1J](https://github.com/Type1J)) -- Adding first and second properties to iteration\_proxy\_internal [\#578](https://github.com/nlohmann/json/pull/578) ([Type1J](https://github.com/Type1J)) -- Adding support for Meson. [\#576](https://github.com/nlohmann/json/pull/576) ([Type1J](https://github.com/Type1J)) -- add enum class default conversions [\#545](https://github.com/nlohmann/json/pull/545) ([theodelrieu](https://github.com/theodelrieu)) -- Properly pop diagnostics [\#540](https://github.com/nlohmann/json/pull/540) ([tinloaf](https://github.com/tinloaf)) -- Add Visual Studio 17 image to appveyor build matrix [\#536](https://github.com/nlohmann/json/pull/536) ([vpetrigo](https://github.com/vpetrigo)) -- UTF8 encoding enhancement [\#534](https://github.com/nlohmann/json/pull/534) ([TedLyngmo](https://github.com/TedLyngmo)) -- Fix typo [\#530](https://github.com/nlohmann/json/pull/530) ([berkus](https://github.com/berkus)) -- Make exception base class visible in basic\_json [\#526](https://github.com/nlohmann/json/pull/526) ([krzysztofwos](https://github.com/krzysztofwos)) -- :art: Namespace `uint8_t` from the C++ stdlib [\#510](https://github.com/nlohmann/json/pull/510) ([alexweej](https://github.com/alexweej)) -- add to\_json method for C arrays [\#508](https://github.com/nlohmann/json/pull/508) ([theodelrieu](https://github.com/theodelrieu)) -- Fix -Weffc++ warnings \(GNU 6.3.1\) [\#496](https://github.com/nlohmann/json/pull/496) ([TedLyngmo](https://github.com/TedLyngmo)) - -## [3.0.0](https://github.com/nlohmann/json/releases/tag/3.0.0) (2017-12-17) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.1.1...3.0.0) - -- unicode strings [\#878](https://github.com/nlohmann/json/issues/878) -- Visual Studio 2017 15.5 C++17 std::allocator deprecations [\#872](https://github.com/nlohmann/json/issues/872) -- Typo "excpetion" [\#869](https://github.com/nlohmann/json/issues/869) -- Explicit array example in README.md incorrect [\#867](https://github.com/nlohmann/json/issues/867) -- why don't you release this from Feb. ? [\#865](https://github.com/nlohmann/json/issues/865) -- json::parse throws std::invalid\_argument when processing string generated by json::dump\(\) [\#863](https://github.com/nlohmann/json/issues/863) -- code analysis: potential bug? [\#859](https://github.com/nlohmann/json/issues/859) -- MSVC2017, 15.5 new issues. [\#857](https://github.com/nlohmann/json/issues/857) -- very basic: fetching string value/content without quotes [\#853](https://github.com/nlohmann/json/issues/853) -- Ambiguous function call to get with pointer type and constant json object in VS2015 \(15.4.4\) [\#852](https://github.com/nlohmann/json/issues/852) -- How to put object in the array as a member? [\#850](https://github.com/nlohmann/json/issues/850) -- misclick, please ignore [\#849](https://github.com/nlohmann/json/issues/849) -- Make XML great again. [\#847](https://github.com/nlohmann/json/issues/847) -- Converting to array not working [\#843](https://github.com/nlohmann/json/issues/843) -- Iteration weirdness [\#842](https://github.com/nlohmann/json/issues/842) -- Use reference or pointer as Object value [\#841](https://github.com/nlohmann/json/issues/841) -- Ambiguity in parsing nested maps [\#840](https://github.com/nlohmann/json/issues/840) -- could not find from\_json\(\) method in T's namespace [\#839](https://github.com/nlohmann/json/issues/839) -- Incorrect parse error with binary data in keys? [\#838](https://github.com/nlohmann/json/issues/838) -- using dump\(\) when std::wstring is StringType with VS2017 [\#836](https://github.com/nlohmann/json/issues/836) -- Show the path of the currently parsed value when an error occurs [\#835](https://github.com/nlohmann/json/issues/835) -- Repetitive data type while reading [\#833](https://github.com/nlohmann/json/issues/833) -- Storing multiple types inside map [\#831](https://github.com/nlohmann/json/issues/831) -- Application terminating [\#830](https://github.com/nlohmann/json/issues/830) -- Missing CMake hunter package? [\#828](https://github.com/nlohmann/json/issues/828) -- std::map\ from json object yields C2665: 'std::pair\::pair': none of the 2 overloads could convert all the argument types [\#827](https://github.com/nlohmann/json/issues/827) -- object.dump gives quoted string, want to use .dump\(\) to generate javascripts. [\#826](https://github.com/nlohmann/json/issues/826) -- Assertion failed on \["NoExistKey"\] of an not existing key of const json& [\#825](https://github.com/nlohmann/json/issues/825) -- vs2015 error : static member will remain uninitialized at runtime but use in constant-expressions is supported [\#824](https://github.com/nlohmann/json/issues/824) -- Code Checking Warnings from json.hpp on VS2017 Community [\#821](https://github.com/nlohmann/json/issues/821) -- Missing iostream in try online [\#820](https://github.com/nlohmann/json/issues/820) -- Floating point value loses decimal point during dump [\#818](https://github.com/nlohmann/json/issues/818) -- Conan package for the library [\#817](https://github.com/nlohmann/json/issues/817) -- stream error [\#815](https://github.com/nlohmann/json/issues/815) -- Link error when using find\(\) on the latest commit [\#814](https://github.com/nlohmann/json/issues/814) -- ABI issue with json object between 2 shared libraries [\#813](https://github.com/nlohmann/json/issues/813) -- scan\_string\(\) return token\_type::parse\_error; when parse ansi file [\#812](https://github.com/nlohmann/json/issues/812) -- segfault when using fifo\_map with json [\#810](https://github.com/nlohmann/json/issues/810) -- This shit is shit [\#809](https://github.com/nlohmann/json/issues/809) -- \_finite and \_isnan are no members of "std" [\#808](https://github.com/nlohmann/json/issues/808) -- how to print out the line which causing exception? [\#806](https://github.com/nlohmann/json/issues/806) -- {} uses copy constructor, while = does not [\#805](https://github.com/nlohmann/json/issues/805) -- json.hpp:8955: multiple definition of function that is not defined twice or more. [\#804](https://github.com/nlohmann/json/issues/804) -- \[question\] to\_json for base and derived class [\#803](https://github.com/nlohmann/json/issues/803) -- Misleading error message - unexpected '"' - on incorrect utf-8 symbol [\#802](https://github.com/nlohmann/json/issues/802) -- json data = std::string\_view\("hi"\); doesn't work? [\#801](https://github.com/nlohmann/json/issues/801) -- Thread safety of parse\(\) [\#800](https://github.com/nlohmann/json/issues/800) -- Numbers as strings [\#799](https://github.com/nlohmann/json/issues/799) -- Tests failing on arm [\#797](https://github.com/nlohmann/json/issues/797) -- Using your library \(without modification\) in another library [\#796](https://github.com/nlohmann/json/issues/796) -- Iterating over sub-object [\#794](https://github.com/nlohmann/json/issues/794) -- how to get the json object again from which printed by the method of dump\(\) [\#792](https://github.com/nlohmann/json/issues/792) -- ppa to include source [\#791](https://github.com/nlohmann/json/issues/791) -- Different include paths in macOS and Ubuntu [\#790](https://github.com/nlohmann/json/issues/790) -- Missing break after line 12886 in switch/case [\#789](https://github.com/nlohmann/json/issues/789) -- All unit tests fail? [\#787](https://github.com/nlohmann/json/issues/787) -- More use of move semantics in deserialization [\#786](https://github.com/nlohmann/json/issues/786) -- warning C4706 - Visual Studio 2017 \(/W4\) [\#784](https://github.com/nlohmann/json/issues/784) -- Compile error in clang 5.0 [\#782](https://github.com/nlohmann/json/issues/782) -- Error Installing appium\_lib with Ruby v2.4.2 Due to JSON [\#781](https://github.com/nlohmann/json/issues/781) -- ::get\\(\) fails in new\(er\) release \[MSVC\] [\#780](https://github.com/nlohmann/json/issues/780) -- Type Conversion [\#779](https://github.com/nlohmann/json/issues/779) -- Segfault on nested parsing [\#778](https://github.com/nlohmann/json/issues/778) -- Build warnings: shadowing exception id [\#776](https://github.com/nlohmann/json/issues/776) -- multi-level JSON support. [\#775](https://github.com/nlohmann/json/issues/775) -- SIGABRT on dump\(\) [\#773](https://github.com/nlohmann/json/issues/773) -- \[Question\] Custom StringType template parameter \(possibility for a KeyType template parameter\) [\#772](https://github.com/nlohmann/json/issues/772) -- constexpr ALL the Things! [\#771](https://github.com/nlohmann/json/issues/771) -- error: ‘BasicJsonType’ in namespace ‘::’ does not name a type [\#770](https://github.com/nlohmann/json/issues/770) -- Program calls abort function [\#769](https://github.com/nlohmann/json/issues/769) -- \[Question\] Floating point resolution config during dump\(\) ? [\#768](https://github.com/nlohmann/json/issues/768) -- make check - no test ran [\#767](https://github.com/nlohmann/json/issues/767) -- The library cannot work properly with custom allocator based containers [\#766](https://github.com/nlohmann/json/issues/766) -- Documentation or feature request. [\#763](https://github.com/nlohmann/json/issues/763) -- warnings in msvc about mix/max macro while windows.h is used in the project [\#762](https://github.com/nlohmann/json/issues/762) -- std::signbit ambiguous [\#761](https://github.com/nlohmann/json/issues/761) -- How to use value for std::experimental::optional type? [\#760](https://github.com/nlohmann/json/issues/760) -- Cannot load json file properly [\#759](https://github.com/nlohmann/json/issues/759) -- Compilation error with unordered\_map\< int, int \> [\#758](https://github.com/nlohmann/json/issues/758) -- CBOR string [\#757](https://github.com/nlohmann/json/issues/757) -- Proposal: out\_of\_range should be a subclass of std::out\_of\_range [\#756](https://github.com/nlohmann/json/issues/756) -- Getter is setting the value to null if the key does not exist [\#754](https://github.com/nlohmann/json/issues/754) -- parsing works sometimes and crashes others [\#752](https://github.com/nlohmann/json/issues/752) -- Static\_assert failed "incompatible pointer type" with Xcode [\#751](https://github.com/nlohmann/json/issues/751) -- user-defined literal operator not found [\#750](https://github.com/nlohmann/json/issues/750) -- getting clean string from it.key\(\) [\#748](https://github.com/nlohmann/json/issues/748) -- Best method for exploring and obtaining values of nested json objects when the names are not known beforehand? [\#747](https://github.com/nlohmann/json/issues/747) -- null char at the end of string [\#746](https://github.com/nlohmann/json/issues/746) -- Incorrect sample for operator \>\> in docs [\#745](https://github.com/nlohmann/json/issues/745) -- User-friendly documentation [\#744](https://github.com/nlohmann/json/issues/744) -- Retrieve all values that match a json path [\#743](https://github.com/nlohmann/json/issues/743) -- Compilation issue with gcc 7.2 [\#742](https://github.com/nlohmann/json/issues/742) -- CMake target nlohmann\_json does not have src into its interface includes [\#741](https://github.com/nlohmann/json/issues/741) -- Error when serializing empty json: type must be string, but is object [\#740](https://github.com/nlohmann/json/issues/740) -- Conversion error for std::map\ [\#739](https://github.com/nlohmann/json/issues/739) -- Dumping Json to file as array [\#738](https://github.com/nlohmann/json/issues/738) -- nesting json objects [\#737](https://github.com/nlohmann/json/issues/737) -- where to find general help? [\#736](https://github.com/nlohmann/json/issues/736) -- Compilation Error on Clang 5.0 Upgrade [\#735](https://github.com/nlohmann/json/issues/735) -- Compilation error with std::map\ on vs 2015 [\#734](https://github.com/nlohmann/json/issues/734) -- Benchmarks for Binary formats [\#733](https://github.com/nlohmann/json/issues/733) -- Support \n symbols in json string. [\#731](https://github.com/nlohmann/json/issues/731) -- Project's name is too generic and hard to search for [\#730](https://github.com/nlohmann/json/issues/730) -- Visual Studio 2015 IntelliTrace problems [\#729](https://github.com/nlohmann/json/issues/729) -- How to erase nested objects inside other objects? [\#728](https://github.com/nlohmann/json/issues/728) -- Serialization for CBOR [\#726](https://github.com/nlohmann/json/issues/726) -- Using json Object as value in a map [\#725](https://github.com/nlohmann/json/issues/725) -- std::regex and nlohmann::json value [\#724](https://github.com/nlohmann/json/issues/724) -- Warnings when compiling with VisualStudio 2015 [\#723](https://github.com/nlohmann/json/issues/723) -- Has this lib the unicode \(wstring\) support? [\#722](https://github.com/nlohmann/json/issues/722) -- When will be 3.0 in master? [\#721](https://github.com/nlohmann/json/issues/721) -- Determine the type from error message. [\#720](https://github.com/nlohmann/json/issues/720) -- Compile-Error C2100 \(MS VS2015\) in line 887 json.hpp [\#719](https://github.com/nlohmann/json/issues/719) -- from\_json not working for boost::optional example [\#718](https://github.com/nlohmann/json/issues/718) -- about from\_json and to\_json function [\#717](https://github.com/nlohmann/json/issues/717) -- How to detect parse failure? [\#715](https://github.com/nlohmann/json/issues/715) -- Parse throw std::ios\_base::failure exception when failbit set to true [\#714](https://github.com/nlohmann/json/issues/714) -- Is there a way of format just making a pretty print without changing the key's orders ? [\#713](https://github.com/nlohmann/json/issues/713) -- Serialization of array of not same model items [\#712](https://github.com/nlohmann/json/issues/712) -- pointer to json parse vector [\#711](https://github.com/nlohmann/json/issues/711) -- Gtest SEH Exception [\#709](https://github.com/nlohmann/json/issues/709) -- broken from\_json implementation for pair and tuple [\#707](https://github.com/nlohmann/json/issues/707) -- Unevaluated lambda in assert breaks gcc 7 build [\#705](https://github.com/nlohmann/json/issues/705) -- Issues when adding values to firebase database [\#704](https://github.com/nlohmann/json/issues/704) -- Floating point equality - revisited [\#703](https://github.com/nlohmann/json/issues/703) -- Conversion from valarray\ to json fails to build [\#702](https://github.com/nlohmann/json/issues/702) -- internal compiler error \(gcc7\) [\#701](https://github.com/nlohmann/json/issues/701) -- One build system to rule them all [\#698](https://github.com/nlohmann/json/issues/698) -- Generated nlohmann\_jsonConfig.cmake does not set JSON\_INCLUDE\_DIR [\#695](https://github.com/nlohmann/json/issues/695) -- support the Chinese language in json string [\#694](https://github.com/nlohmann/json/issues/694) -- NaN problem within develop branch [\#693](https://github.com/nlohmann/json/issues/693) -- Please post example of specialization for boost::filesystem [\#692](https://github.com/nlohmann/json/issues/692) -- Impossible to do an array of composite objects [\#691](https://github.com/nlohmann/json/issues/691) -- How to save json to file? [\#690](https://github.com/nlohmann/json/issues/690) -- my simple json parser [\#689](https://github.com/nlohmann/json/issues/689) -- problem with new struct parsing syntax [\#688](https://github.com/nlohmann/json/issues/688) -- Parse error while parse the json string contains UTF 8 encoded document bytes string [\#684](https://github.com/nlohmann/json/issues/684) -- \[question\] how to get a string value by pointer [\#683](https://github.com/nlohmann/json/issues/683) -- create json object from string variable [\#681](https://github.com/nlohmann/json/issues/681) -- adl\_serializer and CRTP [\#680](https://github.com/nlohmann/json/issues/680) -- Is there a way to control the precision of serialized floating point numbers? [\#677](https://github.com/nlohmann/json/issues/677) -- Is there a way to get the path of a value? [\#676](https://github.com/nlohmann/json/issues/676) -- Could the parser locate errors to line? [\#675](https://github.com/nlohmann/json/issues/675) -- There is performance inefficiency found by coverity tool json2.1.1/include/nlohmann/json.hpp [\#673](https://github.com/nlohmann/json/issues/673) -- include problem, when cmake on osx [\#672](https://github.com/nlohmann/json/issues/672) -- Operator= ambiguous in C++1z and GCC 7.1.1 [\#670](https://github.com/nlohmann/json/issues/670) -- should't the cmake install target be to nlohman/json.hpp [\#668](https://github.com/nlohmann/json/issues/668) -- deserialise from `std::vector` [\#667](https://github.com/nlohmann/json/issues/667) -- How to iterate? [\#665](https://github.com/nlohmann/json/issues/665) -- could this json lib work on windows? [\#664](https://github.com/nlohmann/json/issues/664) -- How does from\_json work? [\#662](https://github.com/nlohmann/json/issues/662) -- insert\(or merge\) object should replace same key , not ignore [\#661](https://github.com/nlohmann/json/issues/661) -- Parse method doesn't handle newlines. [\#659](https://github.com/nlohmann/json/issues/659) -- Compilation "note" on GCC 6 ARM [\#658](https://github.com/nlohmann/json/issues/658) -- Adding additional push\_back/operator+= rvalue overloads for JSON object [\#657](https://github.com/nlohmann/json/issues/657) -- dump's parameter "ensure\_ascii" creates too long sequences [\#656](https://github.com/nlohmann/json/issues/656) -- Question: parsing `void *` [\#655](https://github.com/nlohmann/json/issues/655) -- how should I check a string is valid JSON string ? [\#653](https://github.com/nlohmann/json/issues/653) -- Question: thread safety of read only accesses [\#651](https://github.com/nlohmann/json/issues/651) -- Eclipse: Method 'size' could not be resolved [\#649](https://github.com/nlohmann/json/issues/649) -- Update/Add object fields [\#648](https://github.com/nlohmann/json/issues/648) -- No exception raised for Out Of Range input of numbers [\#647](https://github.com/nlohmann/json/issues/647) -- Package Name [\#646](https://github.com/nlohmann/json/issues/646) -- What is the meaning of operator\[\]\(T\* key\) [\#645](https://github.com/nlohmann/json/issues/645) -- Which is the correct way to json objects as parameters to functions? [\#644](https://github.com/nlohmann/json/issues/644) -- Method to get string representations of values [\#642](https://github.com/nlohmann/json/issues/642) -- CBOR serialization of a given JSON value does not serialize [\#641](https://github.com/nlohmann/json/issues/641) -- Are we forced to use "-fexceptions" flag in android ndk project [\#640](https://github.com/nlohmann/json/issues/640) -- Comparison of objects containing floats [\#639](https://github.com/nlohmann/json/issues/639) -- 'localeconv' is not supported by NDK for SDK \<=20 [\#638](https://github.com/nlohmann/json/issues/638) -- \[Question\] cLion integration [\#637](https://github.com/nlohmann/json/issues/637) -- How to construct an iteratable usage in nlohmann json? [\#636](https://github.com/nlohmann/json/issues/636) -- \[Question\] copy assign json-container to vector [\#635](https://github.com/nlohmann/json/issues/635) -- Get size without .dump\(\) [\#634](https://github.com/nlohmann/json/issues/634) -- Segmentation fault when parsing invalid json file [\#633](https://github.com/nlohmann/json/issues/633) -- How to serialize from json to vector\? [\#632](https://github.com/nlohmann/json/issues/632) -- no member named 'thousands\_sep' in 'lconv' [\#631](https://github.com/nlohmann/json/issues/631) -- \[Question\] Any fork for \(the unsupported\) Visual Studio 2012 version? [\#628](https://github.com/nlohmann/json/issues/628) -- Dependency injection in serializer [\#627](https://github.com/nlohmann/json/issues/627) -- from\_json for std::array [\#625](https://github.com/nlohmann/json/issues/625) -- Discussion: How to structure the parsing function families [\#623](https://github.com/nlohmann/json/issues/623) -- Question: How to erase subtree [\#622](https://github.com/nlohmann/json/issues/622) -- Insertion into nested json field [\#621](https://github.com/nlohmann/json/issues/621) -- Question: return static json object from function [\#618](https://github.com/nlohmann/json/issues/618) -- icc16 error [\#617](https://github.com/nlohmann/json/issues/617) -- \[-Wdeprecated-declarations\] in row `j >> ss;` in file `json.hpp:7405:26` and FAILED unit tests with MinGWx64! [\#616](https://github.com/nlohmann/json/issues/616) -- to\_json for pairs, tuples [\#614](https://github.com/nlohmann/json/issues/614) -- Using uninitialized memory 'buf' in line 11173 v2.1.1? [\#613](https://github.com/nlohmann/json/issues/613) -- How to parse multiple same Keys of JSON and save them? [\#612](https://github.com/nlohmann/json/issues/612) -- "Multiple declarations" error when using types defined with `typedef` [\#611](https://github.com/nlohmann/json/issues/611) -- 2.1.1+ breaks compilation of shared\_ptr\ == 0 [\#610](https://github.com/nlohmann/json/issues/610) -- a bug of inheritance ? [\#608](https://github.com/nlohmann/json/issues/608) -- std::map key conversion with to\_json [\#607](https://github.com/nlohmann/json/issues/607) -- json.hpp:6384:62: error: wrong number of template arguments \(1, should be 2\) [\#606](https://github.com/nlohmann/json/issues/606) -- Incremental parsing: Where's the push version? [\#605](https://github.com/nlohmann/json/issues/605) -- Is there a way to validate the structure of a json object ? [\#604](https://github.com/nlohmann/json/issues/604) -- \[Question\] Issue when using Appveyor when compiling library [\#603](https://github.com/nlohmann/json/issues/603) -- BOM not skipped when using json:parse\(iterator\) [\#602](https://github.com/nlohmann/json/issues/602) -- Use of the binary type in CBOR and Message Pack [\#601](https://github.com/nlohmann/json/issues/601) -- Newbie issue: how does one convert a map in Json back to std::map? [\#600](https://github.com/nlohmann/json/issues/600) -- Plugin system [\#599](https://github.com/nlohmann/json/issues/599) -- Using custom types for scalars? [\#596](https://github.com/nlohmann/json/issues/596) -- Issues with the arithmetic in iterator and reverse iterator [\#593](https://github.com/nlohmann/json/issues/593) -- not enough examples [\#592](https://github.com/nlohmann/json/issues/592) -- in-class initialization for type 'const T' is not yet implemented [\#591](https://github.com/nlohmann/json/issues/591) -- compiling with gcc 7 -\> error on bool operator \< [\#590](https://github.com/nlohmann/json/issues/590) -- Parsing from stream leads to an array [\#589](https://github.com/nlohmann/json/issues/589) -- Buggy support for binary string data [\#587](https://github.com/nlohmann/json/issues/587) -- C++17's ambiguous conversion [\#586](https://github.com/nlohmann/json/issues/586) -- How does the messagepack encoding/decoding compare to msgpack-cpp in terms of performance? [\#585](https://github.com/nlohmann/json/issues/585) -- is it possible to check existence of a value deep in hierarchy? [\#584](https://github.com/nlohmann/json/issues/584) -- loading from a stream and exceptions [\#582](https://github.com/nlohmann/json/issues/582) -- Visual Studio seems not to have all min\(\) function versions [\#581](https://github.com/nlohmann/json/issues/581) -- Supporting of the json schema [\#580](https://github.com/nlohmann/json/issues/580) -- Stack-overflow \(OSS-Fuzz 1444\) [\#577](https://github.com/nlohmann/json/issues/577) -- Heap-buffer-overflow \(OSS-Fuzz 1400\) [\#575](https://github.com/nlohmann/json/issues/575) -- JSON escape quotes [\#574](https://github.com/nlohmann/json/issues/574) -- error: static\_assert failed [\#573](https://github.com/nlohmann/json/issues/573) -- Storing floats, and round trip serialisation/deserialisation diffs [\#572](https://github.com/nlohmann/json/issues/572) -- JSON.getLong produces inconsistent results [\#571](https://github.com/nlohmann/json/issues/571) -- Request: Object.at\(\) with default return value [\#570](https://github.com/nlohmann/json/issues/570) -- Internal structure gets corrupted while parsing [\#569](https://github.com/nlohmann/json/issues/569) -- create template \ basic\_json from\_cbor\(Iter begin, Iter end\) [\#568](https://github.com/nlohmann/json/issues/568) -- Conan.io [\#566](https://github.com/nlohmann/json/issues/566) -- contradictory documentation regarding json::find [\#565](https://github.com/nlohmann/json/issues/565) -- Unexpected '\"' in middle of array [\#564](https://github.com/nlohmann/json/issues/564) -- Support parse std::pair to Json object [\#563](https://github.com/nlohmann/json/issues/563) -- json and Microsoft Visual c++ Compiler Nov 2012 CTP [\#562](https://github.com/nlohmann/json/issues/562) -- from\_json declaration order and exceptions [\#561](https://github.com/nlohmann/json/issues/561) -- Tip: Don't upgrade to VS2017 if using json initializer list constructs [\#559](https://github.com/nlohmann/json/issues/559) -- parse error - unexpected end of input [\#558](https://github.com/nlohmann/json/issues/558) -- Cant modify existing numbers inside a json object [\#557](https://github.com/nlohmann/json/issues/557) -- Better support for SAX style serialize and deserialize in new version? [\#554](https://github.com/nlohmann/json/issues/554) -- Cannot convert from json array to std::array [\#553](https://github.com/nlohmann/json/issues/553) -- Do not define an unnamed namespace in a header file \(DCL59-CPP\) [\#552](https://github.com/nlohmann/json/issues/552) -- Parse error on known good json file [\#551](https://github.com/nlohmann/json/issues/551) -- Warning on Intel compiler \(icc 17\) [\#550](https://github.com/nlohmann/json/issues/550) -- multiple versions of 'vsnprintf' [\#549](https://github.com/nlohmann/json/issues/549) -- illegal indirection [\#548](https://github.com/nlohmann/json/issues/548) -- Ambiguous compare operators with clang-5.0 [\#547](https://github.com/nlohmann/json/issues/547) -- Using tsl::ordered\_map [\#546](https://github.com/nlohmann/json/issues/546) -- Compiler support errors are inconvenient [\#544](https://github.com/nlohmann/json/issues/544) -- Duplicate symbols error happens while to\_json/from\_json method implemented inside entity definition header file [\#542](https://github.com/nlohmann/json/issues/542) -- consider adding a bool json::is\_valid\(std::string const&\) non-member function [\#541](https://github.com/nlohmann/json/issues/541) -- Help request [\#539](https://github.com/nlohmann/json/issues/539) -- How to deal with missing keys in `from_json`? [\#538](https://github.com/nlohmann/json/issues/538) -- recursive from\_msgpack implementation will stack overflow [\#537](https://github.com/nlohmann/json/issues/537) -- Exception objects must be nothrow copy constructible \(ERR60-CPP\) [\#531](https://github.com/nlohmann/json/issues/531) -- Support for multiple root elements [\#529](https://github.com/nlohmann/json/issues/529) -- Port has\_shape from dropbox/json11 [\#528](https://github.com/nlohmann/json/issues/528) -- dump\_float: truncation from ptrdiff\_t to long [\#527](https://github.com/nlohmann/json/issues/527) -- Make exception base class visible in basic\_json [\#525](https://github.com/nlohmann/json/issues/525) -- msgpack unit test failures on ppc64 arch [\#524](https://github.com/nlohmann/json/issues/524) -- How about split the implementation out, and only leave the interface? [\#523](https://github.com/nlohmann/json/issues/523) -- VC++2017 not enough actual parameters for macro 'max' [\#522](https://github.com/nlohmann/json/issues/522) -- crash on empty ifstream [\#521](https://github.com/nlohmann/json/issues/521) -- Suggestion: Support tabs for indentation when serializing to stream. [\#520](https://github.com/nlohmann/json/issues/520) -- Abrt in get\_number \(OSS-Fuzz 885\) [\#519](https://github.com/nlohmann/json/issues/519) -- Abrt on unknown address \(OSS-Fuzz 884\) [\#518](https://github.com/nlohmann/json/issues/518) -- Stack-overflow \(OSS-Fuzz 869\) [\#517](https://github.com/nlohmann/json/issues/517) -- Assertion error \(OSS-Fuzz 868\) [\#516](https://github.com/nlohmann/json/issues/516) -- NaN to json and back [\#515](https://github.com/nlohmann/json/issues/515) -- Comparison of NaN [\#514](https://github.com/nlohmann/json/issues/514) -- why it's not possible to serialize c++11 enums directly [\#513](https://github.com/nlohmann/json/issues/513) -- clang compile error: use of overloaded operator '\<=' is ambiguous with \(nlohmann::json{{"a", 5}}\)\["a"\] \<= 10 [\#512](https://github.com/nlohmann/json/issues/512) -- Why not also look inside the type for \(static\) to\_json and from\_json funtions? [\#511](https://github.com/nlohmann/json/issues/511) -- Parser issues [\#509](https://github.com/nlohmann/json/issues/509) -- I may not understand [\#507](https://github.com/nlohmann/json/issues/507) -- VS2017 min / max problem for 2.1.1 [\#506](https://github.com/nlohmann/json/issues/506) -- CBOR/MessagePack is not read until the end [\#505](https://github.com/nlohmann/json/issues/505) -- Assertion error \(OSS-Fuzz 856\) [\#504](https://github.com/nlohmann/json/issues/504) -- Return position in parse error exceptions [\#503](https://github.com/nlohmann/json/issues/503) -- conversion from/to C array is not supported [\#502](https://github.com/nlohmann/json/issues/502) -- error C2338: could not find to\_json\(\) method in T's namespace [\#501](https://github.com/nlohmann/json/issues/501) -- Test suite fails in en\_GB.UTF-8 [\#500](https://github.com/nlohmann/json/issues/500) -- cannot use operator\[\] with number [\#499](https://github.com/nlohmann/json/issues/499) -- consider using \_\_cpp\_exceptions and/or \_\_EXCEPTIONS to disable/enable exception support [\#498](https://github.com/nlohmann/json/issues/498) -- Stack-overflow \(OSS-Fuzz issue 814\) [\#497](https://github.com/nlohmann/json/issues/497) -- Using in Unreal Engine - handling custom types conversion [\#495](https://github.com/nlohmann/json/issues/495) -- Conversion from vector\ to json fails to build [\#494](https://github.com/nlohmann/json/issues/494) -- fill\_line\_buffer incorrectly tests m\_stream for eof but not fail or bad bits [\#493](https://github.com/nlohmann/json/issues/493) -- Compiling with \_GLIBCXX\_DEBUG yields iterator-comparison warnings during tests [\#492](https://github.com/nlohmann/json/issues/492) -- crapy interface [\#491](https://github.com/nlohmann/json/issues/491) -- Fix Visual Studo 2013 builds. [\#490](https://github.com/nlohmann/json/issues/490) -- Failed to compile with -D\_GLIBCXX\_PARALLEL [\#489](https://github.com/nlohmann/json/issues/489) -- Input several field with the same name [\#488](https://github.com/nlohmann/json/issues/488) -- read in .json file yields strange sizes [\#487](https://github.com/nlohmann/json/issues/487) -- json::value\_t can't be a map's key type in VC++ 2015 [\#486](https://github.com/nlohmann/json/issues/486) -- Using fifo\_map [\#485](https://github.com/nlohmann/json/issues/485) -- Cannot get float pointer for value stored as `0` [\#484](https://github.com/nlohmann/json/issues/484) -- byte string support [\#483](https://github.com/nlohmann/json/issues/483) -- https://github.com/nlohmann/json\#execute-unit-tests [\#481](https://github.com/nlohmann/json/issues/481) -- Remove deprecated constructor basic\_json\(std::istream&\) [\#480](https://github.com/nlohmann/json/issues/480) -- writing the binary json file? [\#479](https://github.com/nlohmann/json/issues/479) -- CBOR/MessagePack from uint8\_t \* and size [\#478](https://github.com/nlohmann/json/issues/478) -- Streaming binary representations [\#477](https://github.com/nlohmann/json/issues/477) -- Reuse memory in to\_cbor and to\_msgpack functions [\#476](https://github.com/nlohmann/json/issues/476) -- Error Using JSON Library with arrays C++ [\#475](https://github.com/nlohmann/json/issues/475) -- Moving forward to version 3.0.0 [\#474](https://github.com/nlohmann/json/issues/474) -- Inconsistent behavior in conversion to array type [\#473](https://github.com/nlohmann/json/issues/473) -- Create a \[key:member\_pointer\] map to ease parsing custom types [\#471](https://github.com/nlohmann/json/issues/471) -- MSVC 2015 update 2 [\#469](https://github.com/nlohmann/json/issues/469) -- VS2017 implicit to std::string conversion fix. [\#464](https://github.com/nlohmann/json/issues/464) -- How to make sure a string or string literal is a valid JSON? [\#458](https://github.com/nlohmann/json/issues/458) -- basic\_json templated on a "policy" class [\#456](https://github.com/nlohmann/json/issues/456) -- json::value\(const json\_pointer&, ValueType\) requires exceptions to return the default value. [\#440](https://github.com/nlohmann/json/issues/440) -- is it possible merge two json object [\#428](https://github.com/nlohmann/json/issues/428) -- Is it possible to turn this into a shared library? [\#420](https://github.com/nlohmann/json/issues/420) -- Further thoughts on performance improvements [\#418](https://github.com/nlohmann/json/issues/418) -- nan number stored as null [\#388](https://github.com/nlohmann/json/issues/388) -- Behavior of operator\>\> should more closely resemble that of built-in overloads. [\#367](https://github.com/nlohmann/json/issues/367) -- Request: range-based-for over a json-object to expose .first/.second [\#350](https://github.com/nlohmann/json/issues/350) -- feature wish: JSONPath [\#343](https://github.com/nlohmann/json/issues/343) -- UTF-8/Unicode escape and dump [\#330](https://github.com/nlohmann/json/issues/330) -- Serialized value not always can be parsed. [\#329](https://github.com/nlohmann/json/issues/329) -- Is there a way to forward declare nlohmann::json? [\#314](https://github.com/nlohmann/json/issues/314) -- Exception line [\#301](https://github.com/nlohmann/json/issues/301) -- Do not throw exception when default\_value's type does not match the actual type [\#278](https://github.com/nlohmann/json/issues/278) -- dump\(\) method doesn't work with a custom allocator [\#268](https://github.com/nlohmann/json/issues/268) -- Readme documentation enhancements [\#248](https://github.com/nlohmann/json/issues/248) -- Use user-defined exceptions [\#244](https://github.com/nlohmann/json/issues/244) -- Incorrect C++11 allocator model support [\#161](https://github.com/nlohmann/json/issues/161) - -## [v2.1.1](https://github.com/nlohmann/json/releases/tag/v2.1.1) (2017-02-25) - -[Full Changelog](https://github.com/nlohmann/json/compare/2.1.1...v2.1.1) - -- Speedup CI builds using cotire [\#461](https://github.com/nlohmann/json/pull/461) ([tusharpm](https://github.com/tusharpm)) -- TurpentineDistillery feature/locale independent str to num [\#450](https://github.com/nlohmann/json/pull/450) ([nlohmann](https://github.com/nlohmann)) -- README: adjust boost::optional example [\#439](https://github.com/nlohmann/json/pull/439) ([jaredgrubb](https://github.com/jaredgrubb)) -- fix \#414 - comparing to 0 literal [\#415](https://github.com/nlohmann/json/pull/415) ([stanmihai4](https://github.com/stanmihai4)) -- locale-independent num-to-str [\#378](https://github.com/nlohmann/json/pull/378) ([TurpentineDistillery](https://github.com/TurpentineDistillery)) - -## [2.1.1](https://github.com/nlohmann/json/releases/tag/2.1.1) (2017-02-25) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.1.0...2.1.1) - -- warning in the library [\#472](https://github.com/nlohmann/json/issues/472) -- How to create an array of Objects? [\#470](https://github.com/nlohmann/json/issues/470) -- \[Bug?\] Cannot get int pointer, but int64\_t works [\#468](https://github.com/nlohmann/json/issues/468) -- Illegal indirection [\#467](https://github.com/nlohmann/json/issues/467) -- in vs can't find linkageId [\#466](https://github.com/nlohmann/json/issues/466) -- Roundtrip error while parsing "1000000000000000010E5" [\#465](https://github.com/nlohmann/json/issues/465) -- C4996 error and warning with Visual Studio [\#463](https://github.com/nlohmann/json/issues/463) -- Support startIndex for from\_cbor/from\_msgpack [\#462](https://github.com/nlohmann/json/issues/462) -- question: monospace font used in feature slideshow? [\#460](https://github.com/nlohmann/json/issues/460) -- Object.keys\(\) [\#459](https://github.com/nlohmann/json/issues/459) -- Use “, “ as delimiter for json-objects. [\#457](https://github.com/nlohmann/json/issues/457) -- Enum -\> string during serialization and vice versa [\#455](https://github.com/nlohmann/json/issues/455) -- doubles are printed as integers [\#454](https://github.com/nlohmann/json/issues/454) -- Warnings with Visual Studio c++ \(VS2015 Update 3\) [\#453](https://github.com/nlohmann/json/issues/453) -- Heap-buffer-overflow \(OSS-Fuzz issue 585\) [\#452](https://github.com/nlohmann/json/issues/452) -- use of undeclared identifier 'UINT8\_MAX' [\#451](https://github.com/nlohmann/json/issues/451) -- Question on the lifetime managment of objects at the lower levels [\#449](https://github.com/nlohmann/json/issues/449) -- Json should not be constructible with 'json\*' [\#448](https://github.com/nlohmann/json/issues/448) -- Move value\_t to namespace scope [\#447](https://github.com/nlohmann/json/issues/447) -- Typo in README.md [\#446](https://github.com/nlohmann/json/issues/446) -- make check compilation is unneccesarily slow [\#445](https://github.com/nlohmann/json/issues/445) -- Problem in dump\(\) in json.h caused by ss.imbue [\#444](https://github.com/nlohmann/json/issues/444) -- I want to create Windows Application in Visual Studio 2015 c++, and i have a problem [\#443](https://github.com/nlohmann/json/issues/443) -- Implicit conversion issues [\#442](https://github.com/nlohmann/json/issues/442) -- Parsing of floats locale dependent [\#302](https://github.com/nlohmann/json/issues/302) - -## [v2.1.0](https://github.com/nlohmann/json/releases/tag/v2.1.0) (2017-01-28) - -[Full Changelog](https://github.com/nlohmann/json/compare/2.1.0...v2.1.0) - -- conversion from/to user-defined types [\#435](https://github.com/nlohmann/json/pull/435) ([nlohmann](https://github.com/nlohmann)) -- Fix documentation error [\#430](https://github.com/nlohmann/json/pull/430) ([vjon](https://github.com/vjon)) - -## [2.1.0](https://github.com/nlohmann/json/releases/tag/2.1.0) (2017-01-28) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.10...2.1.0) - -- Parsing multiple JSON objects from a string or stream [\#438](https://github.com/nlohmann/json/issues/438) -- Use-of-uninitialized-value \(OSS-Fuzz issue 477\) [\#437](https://github.com/nlohmann/json/issues/437) -- add `reserve` function for array to reserve memory before adding json values into it [\#436](https://github.com/nlohmann/json/issues/436) -- Typo in examples page [\#434](https://github.com/nlohmann/json/issues/434) -- avoid malformed json [\#433](https://github.com/nlohmann/json/issues/433) -- How to add json objects to a map? [\#432](https://github.com/nlohmann/json/issues/432) -- create json instance from raw json \(unsigned char\*\) [\#431](https://github.com/nlohmann/json/issues/431) -- Getting std::invalid\_argument: stream error when following example [\#429](https://github.com/nlohmann/json/issues/429) -- Forward declare-only header? [\#427](https://github.com/nlohmann/json/issues/427) -- Implicit conversion from array to object [\#425](https://github.com/nlohmann/json/issues/425) -- error C4996: 'strerror' when reading file [\#422](https://github.com/nlohmann/json/issues/422) -- Get an error - JSON pointer must be empty or begin with '/' [\#421](https://github.com/nlohmann/json/issues/421) -- size parameter for parse\(\) [\#419](https://github.com/nlohmann/json/issues/419) -- json.hpp forcibly defines GCC\_VERSION [\#417](https://github.com/nlohmann/json/issues/417) -- Use-of-uninitialized-value \(OSS-Fuzz issue 377\) [\#416](https://github.com/nlohmann/json/issues/416) -- comparing to 0 literal [\#414](https://github.com/nlohmann/json/issues/414) -- Single char converted to ASCII code instead of string [\#413](https://github.com/nlohmann/json/issues/413) -- How to know if a string was parsed as utf-8? [\#406](https://github.com/nlohmann/json/issues/406) -- Overloaded += to add objects to an array makes no sense? [\#404](https://github.com/nlohmann/json/issues/404) -- Finding a value in an array [\#399](https://github.com/nlohmann/json/issues/399) -- add release information in static function [\#397](https://github.com/nlohmann/json/issues/397) -- Optimize memory usage of json objects in combination with binary serialization [\#373](https://github.com/nlohmann/json/issues/373) -- Conversion operators not considered [\#369](https://github.com/nlohmann/json/issues/369) -- Append ".0" to serialized floating\_point values that are digits-only. [\#362](https://github.com/nlohmann/json/issues/362) -- Add a customization point for user-defined types [\#328](https://github.com/nlohmann/json/issues/328) -- Conformance report for reference [\#307](https://github.com/nlohmann/json/issues/307) -- Document the best way to serialize/deserialize user defined types to json [\#298](https://github.com/nlohmann/json/issues/298) -- Add StringView template typename to basic\_json [\#297](https://github.com/nlohmann/json/issues/297) -- \[Improvement\] Add option to remove exceptions [\#296](https://github.com/nlohmann/json/issues/296) -- Performance in miloyip/nativejson-benchmark [\#202](https://github.com/nlohmann/json/issues/202) - -## [v2.0.10](https://github.com/nlohmann/json/releases/tag/v2.0.10) (2017-01-02) - -[Full Changelog](https://github.com/nlohmann/json/compare/2.0.10...v2.0.10) - -- Feature/clang sanitize [\#410](https://github.com/nlohmann/json/pull/410) ([Daniel599](https://github.com/Daniel599)) -- Add Doozer build badge [\#400](https://github.com/nlohmann/json/pull/400) ([andoma](https://github.com/andoma)) - -## [2.0.10](https://github.com/nlohmann/json/releases/tag/2.0.10) (2017-01-02) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.9...2.0.10) - -- Heap-buffer-overflow \(OSS-Fuzz issue 367\) [\#412](https://github.com/nlohmann/json/issues/412) -- Heap-buffer-overflow \(OSS-Fuzz issue 366\) [\#411](https://github.com/nlohmann/json/issues/411) -- Use-of-uninitialized-value \(OSS-Fuzz issue 347\) [\#409](https://github.com/nlohmann/json/issues/409) -- Heap-buffer-overflow \(OSS-Fuzz issue 344\) [\#408](https://github.com/nlohmann/json/issues/408) -- Heap-buffer-overflow \(OSS-Fuzz issue 343\) [\#407](https://github.com/nlohmann/json/issues/407) -- Heap-buffer-overflow \(OSS-Fuzz issue 342\) [\#405](https://github.com/nlohmann/json/issues/405) -- strerror throwing error in compiler VS2015 [\#403](https://github.com/nlohmann/json/issues/403) -- json::parse of std::string being underlined by Visual Studio [\#402](https://github.com/nlohmann/json/issues/402) -- Explicitly getting string without .dump\(\) [\#401](https://github.com/nlohmann/json/issues/401) -- Possible to speed up json::parse? [\#398](https://github.com/nlohmann/json/issues/398) -- the alphabetic order in the code influence console\_output. [\#396](https://github.com/nlohmann/json/issues/396) -- Execute tests with clang sanitizers [\#394](https://github.com/nlohmann/json/issues/394) -- Check if library can be used with ETL [\#361](https://github.com/nlohmann/json/issues/361) - -## [v2.0.9](https://github.com/nlohmann/json/releases/tag/v2.0.9) (2016-12-16) - -[Full Changelog](https://github.com/nlohmann/json/compare/2.0.9...v2.0.9) - -- Replace class iterator and const\_iterator by using a single template class to reduce code. [\#395](https://github.com/nlohmann/json/pull/395) ([Bosswestfalen](https://github.com/Bosswestfalen)) -- Clang: quiet a warning [\#391](https://github.com/nlohmann/json/pull/391) ([jaredgrubb](https://github.com/jaredgrubb)) -- Fix issue \#380: Signed integer overflow check [\#390](https://github.com/nlohmann/json/pull/390) ([qwename](https://github.com/qwename)) - -## [2.0.9](https://github.com/nlohmann/json/releases/tag/2.0.9) (2016-12-16) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.8...2.0.9) - -- \#pragma GCC diagnostic ignored "-Wdocumentation" [\#393](https://github.com/nlohmann/json/issues/393) -- How to parse this json file and write separate sub object as json files? [\#392](https://github.com/nlohmann/json/issues/392) -- Integer-overflow \(OSS-Fuzz issue 267\) [\#389](https://github.com/nlohmann/json/issues/389) -- Implement indefinite-length types from RFC 7049 [\#387](https://github.com/nlohmann/json/issues/387) -- template parameter "T" is not used in declaring the parameter types of function template [\#386](https://github.com/nlohmann/json/issues/386) -- Serializing json instances containing already serialized string values without escaping [\#385](https://github.com/nlohmann/json/issues/385) -- Add test cases from RFC 7049 [\#384](https://github.com/nlohmann/json/issues/384) -- Add a table of contents to the README file [\#383](https://github.com/nlohmann/json/issues/383) -- Update FAQ section in the guidelines for contributing [\#382](https://github.com/nlohmann/json/issues/382) -- Allow for forward declaring nlohmann::json [\#381](https://github.com/nlohmann/json/issues/381) -- Bug in overflow detection when parsing integers [\#380](https://github.com/nlohmann/json/issues/380) -- A unique name to mention the library? [\#377](https://github.com/nlohmann/json/issues/377) -- Non-unique keys in objects. [\#375](https://github.com/nlohmann/json/issues/375) -- Request: binary serialization/deserialization [\#358](https://github.com/nlohmann/json/issues/358) - -## [v2.0.8](https://github.com/nlohmann/json/releases/tag/v2.0.8) (2016-12-02) - -[Full Changelog](https://github.com/nlohmann/json/compare/2.0.8...v2.0.8) - -## [2.0.8](https://github.com/nlohmann/json/releases/tag/2.0.8) (2016-12-02) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.7...2.0.8) - -- Reading from file [\#374](https://github.com/nlohmann/json/issues/374) -- Compiler warnings? [\#372](https://github.com/nlohmann/json/issues/372) -- docs: how to release a json object in memory? [\#371](https://github.com/nlohmann/json/issues/371) -- crash in dump [\#370](https://github.com/nlohmann/json/issues/370) -- Coverity issue \(FORWARD\_NULL\) in lexer\(std::istream& s\) [\#368](https://github.com/nlohmann/json/issues/368) -- json::parse on failed stream gets stuck [\#366](https://github.com/nlohmann/json/issues/366) -- Performance improvements [\#365](https://github.com/nlohmann/json/issues/365) -- 'to\_string' is not a member of 'std' [\#364](https://github.com/nlohmann/json/issues/364) -- Crash in dump\(\) from a static object [\#359](https://github.com/nlohmann/json/issues/359) -- json::parse\(...\) vs json j; j.parse\(...\) [\#357](https://github.com/nlohmann/json/issues/357) -- Hi, is there any method to dump json to string with the insert order rather than alphabets [\#356](https://github.com/nlohmann/json/issues/356) -- Provide an example of reading from an json with only a key that has an array of strings. [\#354](https://github.com/nlohmann/json/issues/354) -- Request: access with default value. [\#353](https://github.com/nlohmann/json/issues/353) -- {} and \[\] causes parser error. [\#352](https://github.com/nlohmann/json/issues/352) -- Reading a JSON file into a JSON object [\#351](https://github.com/nlohmann/json/issues/351) -- Request: 'emplace\_back' [\#349](https://github.com/nlohmann/json/issues/349) -- Is it possible to stream data through the json parser without storing everything in memory? [\#347](https://github.com/nlohmann/json/issues/347) -- pure virtual conversion operator [\#346](https://github.com/nlohmann/json/issues/346) -- Floating point precision lost [\#345](https://github.com/nlohmann/json/issues/345) -- unit-conversions SIGSEGV on armv7hl [\#303](https://github.com/nlohmann/json/issues/303) -- Coverity scan fails [\#299](https://github.com/nlohmann/json/issues/299) -- Using QString as string type [\#274](https://github.com/nlohmann/json/issues/274) - -## [v2.0.7](https://github.com/nlohmann/json/releases/tag/v2.0.7) (2016-11-02) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.6...v2.0.7) - -- JSON5 [\#348](https://github.com/nlohmann/json/issues/348) -- Check "Parsing JSON is a Minefield" [\#344](https://github.com/nlohmann/json/issues/344) -- Allow hex numbers [\#342](https://github.com/nlohmann/json/issues/342) -- Convert strings to numbers [\#341](https://github.com/nlohmann/json/issues/341) -- ""-operators ignore the length parameter [\#340](https://github.com/nlohmann/json/issues/340) -- JSON into std::tuple [\#339](https://github.com/nlohmann/json/issues/339) -- JSON into vector [\#335](https://github.com/nlohmann/json/issues/335) -- Installing with Homebrew on Mac Errors \(El Capitan\) [\#331](https://github.com/nlohmann/json/issues/331) -- g++ make check results in error [\#312](https://github.com/nlohmann/json/issues/312) -- Cannot convert from 'json' to 'char' [\#276](https://github.com/nlohmann/json/issues/276) -- Please add a Pretty-Print option for arrays to stay always in one line [\#229](https://github.com/nlohmann/json/issues/229) -- Conversion to STL map\\> gives error [\#220](https://github.com/nlohmann/json/issues/220) -- std::unorderd\_map cannot be used as ObjectType [\#164](https://github.com/nlohmann/json/issues/164) - -- fix minor grammar/style issue in README.md [\#336](https://github.com/nlohmann/json/pull/336) ([seeekr](https://github.com/seeekr)) - -## [v2.0.6](https://github.com/nlohmann/json/releases/tag/v2.0.6) (2016-10-15) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.5...v2.0.6) - -- How to handle json files? [\#333](https://github.com/nlohmann/json/issues/333) -- This file requires compiler and library support .... [\#332](https://github.com/nlohmann/json/issues/332) -- Segmentation fault on saving json to file [\#326](https://github.com/nlohmann/json/issues/326) -- parse error - unexpected \ with 2.0.5 [\#325](https://github.com/nlohmann/json/issues/325) -- Add nested object capability to pointers [\#323](https://github.com/nlohmann/json/issues/323) -- Fix usage examples' comments for std::multiset [\#322](https://github.com/nlohmann/json/issues/322) -- json\_unit runs forever when executed in build directory [\#319](https://github.com/nlohmann/json/issues/319) -- Visual studio 2015 update3 true != TRUE [\#317](https://github.com/nlohmann/json/issues/317) -- releasing single header file in compressed format [\#316](https://github.com/nlohmann/json/issues/316) -- json object from std::ifstream [\#315](https://github.com/nlohmann/json/issues/315) - -- make has\_mapped\_type struct friendly [\#324](https://github.com/nlohmann/json/pull/324) ([vpetrigo](https://github.com/vpetrigo)) -- Fix usage examples' comments for std::multiset [\#321](https://github.com/nlohmann/json/pull/321) ([vasild](https://github.com/vasild)) -- Include dir relocation [\#318](https://github.com/nlohmann/json/pull/318) ([ChristophJud](https://github.com/ChristophJud)) -- trivial documentation fix [\#313](https://github.com/nlohmann/json/pull/313) ([5tefan](https://github.com/5tefan)) - -## [v2.0.5](https://github.com/nlohmann/json/releases/tag/v2.0.5) (2016-09-14) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.4...v2.0.5) - -- \[feature request\]: schema validator and comments [\#311](https://github.com/nlohmann/json/issues/311) -- make json\_benchmarks no longer working in 2.0.4 [\#310](https://github.com/nlohmann/json/issues/310) -- Segmentation fault \(core dumped\) [\#309](https://github.com/nlohmann/json/issues/309) -- No matching member function for call to 'get\_impl' [\#308](https://github.com/nlohmann/json/issues/308) - -## [v2.0.4](https://github.com/nlohmann/json/releases/tag/v2.0.4) (2016-09-11) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.3...v2.0.4) - -- Parsing fails without space at end of file [\#306](https://github.com/nlohmann/json/issues/306) -- json schema validator [\#305](https://github.com/nlohmann/json/issues/305) -- Unused variable warning [\#304](https://github.com/nlohmann/json/issues/304) - -## [v2.0.3](https://github.com/nlohmann/json/releases/tag/v2.0.3) (2016-08-31) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.2...v2.0.3) - -- warning C4706: assignment within conditional expression [\#295](https://github.com/nlohmann/json/issues/295) -- Q: Is it possible to build json tree from already UTF8 encoded values? [\#293](https://github.com/nlohmann/json/issues/293) -- Equality operator results in array when assigned object [\#292](https://github.com/nlohmann/json/issues/292) -- Support for integers not from the range \[-\(2\*\*53\)+1, \(2\*\*53\)-1\] in parser [\#291](https://github.com/nlohmann/json/issues/291) -- Support for iterator-range parsing [\#290](https://github.com/nlohmann/json/issues/290) -- Horribly inconsistent behavior between const/non-const reference in operator \[\] \(\) [\#289](https://github.com/nlohmann/json/issues/289) -- Silently get numbers into smaller types [\#288](https://github.com/nlohmann/json/issues/288) -- Incorrect parsing of large int64\_t numbers [\#287](https://github.com/nlohmann/json/issues/287) -- \[question\]: macro to disable floating point support [\#284](https://github.com/nlohmann/json/issues/284) - -- unit-constructor1.cpp: Fix floating point truncation warning [\#300](https://github.com/nlohmann/json/pull/300) ([t-b](https://github.com/t-b)) - -## [v2.0.2](https://github.com/nlohmann/json/releases/tag/v2.0.2) (2016-07-31) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...v2.0.2) - -- can function dump\(\) return string in the order I push in the json object ? [\#286](https://github.com/nlohmann/json/issues/286) -- Error on the Mac: Undefined symbols for architecture x86\_64 [\#285](https://github.com/nlohmann/json/issues/285) -- value\(\) does not work with \_json\_pointer types [\#283](https://github.com/nlohmann/json/issues/283) -- Build error for std::int64 [\#282](https://github.com/nlohmann/json/issues/282) -- strings can't be accessed after dump\(\)-\>parse\(\) - type is lost [\#281](https://github.com/nlohmann/json/issues/281) -- Easy serialization of classes [\#280](https://github.com/nlohmann/json/issues/280) -- recursive data structures [\#277](https://github.com/nlohmann/json/issues/277) -- hexify\(\) function emits conversion warning [\#270](https://github.com/nlohmann/json/issues/270) - -- let the makefile choose the correct sed [\#279](https://github.com/nlohmann/json/pull/279) ([murinicanor](https://github.com/murinicanor)) -- Update hexify to use array lookup instead of ternary \(\#270\) [\#275](https://github.com/nlohmann/json/pull/275) ([dtoma](https://github.com/dtoma)) - -## [v2.0.1](https://github.com/nlohmann/json/releases/tag/v2.0.1) (2016-06-28) - -[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.0...v2.0.1) - -- Compilation error. [\#273](https://github.com/nlohmann/json/issues/273) -- dump\(\) performance degradation in v2 [\#272](https://github.com/nlohmann/json/issues/272) - -- fixed a tiny typo [\#271](https://github.com/nlohmann/json/pull/271) ([feroldi](https://github.com/feroldi)) - -## [v2.0.0](https://github.com/nlohmann/json/releases/tag/v2.0.0) (2016-06-23) - -[Full Changelog](https://github.com/nlohmann/json/compare/v1.1.0...v2.0.0) - -- json::diff generates incorrect patch when removing multiple array elements. [\#269](https://github.com/nlohmann/json/issues/269) -- Docs - What does Json\[key\] return? [\#267](https://github.com/nlohmann/json/issues/267) -- Compiler Errors With JSON.hpp [\#265](https://github.com/nlohmann/json/issues/265) -- Ambiguous push\_back and operator+= overloads [\#263](https://github.com/nlohmann/json/issues/263) -- Preseving order of items in json [\#262](https://github.com/nlohmann/json/issues/262) -- '\' char problem in strings [\#261](https://github.com/nlohmann/json/issues/261) -- VS2015 compile fail [\#260](https://github.com/nlohmann/json/issues/260) -- -Wconversion warning [\#259](https://github.com/nlohmann/json/issues/259) -- Maybe a bug [\#258](https://github.com/nlohmann/json/issues/258) -- Few tests failed on Visual C++ 2015 [\#257](https://github.com/nlohmann/json/issues/257) -- Access keys when iteration with new for loop C++11 [\#256](https://github.com/nlohmann/json/issues/256) -- multiline text values [\#255](https://github.com/nlohmann/json/issues/255) -- Error when using json in g++ [\#254](https://github.com/nlohmann/json/issues/254) -- is the release 2.0? [\#253](https://github.com/nlohmann/json/issues/253) -- concatenate objects [\#252](https://github.com/nlohmann/json/issues/252) -- Encoding [\#251](https://github.com/nlohmann/json/issues/251) -- Unable to build example for constructing json object with stringstreams [\#250](https://github.com/nlohmann/json/issues/250) -- Hexadecimal support [\#249](https://github.com/nlohmann/json/issues/249) -- Update long-term goals [\#246](https://github.com/nlohmann/json/issues/246) -- Contribution To This Json Project [\#245](https://github.com/nlohmann/json/issues/245) -- Trouble using parser with initial dictionary [\#243](https://github.com/nlohmann/json/issues/243) -- Unit test fails when doing a CMake out-of-tree build [\#241](https://github.com/nlohmann/json/issues/241) -- -Wconversion warnings [\#239](https://github.com/nlohmann/json/issues/239) -- Additional integration options [\#237](https://github.com/nlohmann/json/issues/237) -- .get\\(\) works for non spaced string but returns as array for spaced/longer strings [\#236](https://github.com/nlohmann/json/issues/236) -- ambiguous overload for 'push\_back' and 'operator+=' [\#235](https://github.com/nlohmann/json/issues/235) -- Can't use basic\_json::iterator as a base iterator for std::move\_iterator [\#233](https://github.com/nlohmann/json/issues/233) -- json object's creation can freezes execution [\#231](https://github.com/nlohmann/json/issues/231) -- Incorrect dumping of parsed numbers with exponents, but without decimal places [\#230](https://github.com/nlohmann/json/issues/230) -- double values are serialized with commas as decimal points [\#228](https://github.com/nlohmann/json/issues/228) -- Move semantics with std::initializer\_list [\#225](https://github.com/nlohmann/json/issues/225) -- replace emplace [\#224](https://github.com/nlohmann/json/issues/224) -- abort during getline in yyfill [\#223](https://github.com/nlohmann/json/issues/223) -- free\(\): invalid pointer error in GCC 5.2.1 [\#221](https://github.com/nlohmann/json/issues/221) -- Error compile Android NDK error: 'strtof' is not a member of 'std' [\#219](https://github.com/nlohmann/json/issues/219) -- Wrong link in the README.md [\#217](https://github.com/nlohmann/json/issues/217) -- Wide character strings not supported [\#216](https://github.com/nlohmann/json/issues/216) -- Memory allocations using range-based for loops [\#214](https://github.com/nlohmann/json/issues/214) -- would you like to support gcc 4.8.1? [\#211](https://github.com/nlohmann/json/issues/211) -- Reading concatenated json's from an istream [\#210](https://github.com/nlohmann/json/issues/210) -- Conflicting typedef of ssize\_t on Windows 32 bit when using Boost.Python [\#204](https://github.com/nlohmann/json/issues/204) -- Inconsistency between operator\[\] and push\_back [\#203](https://github.com/nlohmann/json/issues/203) -- Small bugs in json.hpp \(get\_number\) and unit.cpp \(non-standard integer type test\) [\#199](https://github.com/nlohmann/json/issues/199) -- GCC/clang floating point parsing bug in strtod\(\) [\#195](https://github.com/nlohmann/json/issues/195) -- What is within scope? [\#192](https://github.com/nlohmann/json/issues/192) -- Bugs in miloyip/nativejson-benchmark: roundtrips [\#187](https://github.com/nlohmann/json/issues/187) -- Floating point exceptions [\#181](https://github.com/nlohmann/json/issues/181) -- Integer conversion to unsigned [\#178](https://github.com/nlohmann/json/issues/178) -- map string string fails to compile [\#176](https://github.com/nlohmann/json/issues/176) -- In basic\_json::basic\_json\(const CompatibleArrayType& val\), the requirement of CompatibleArrayType is not strict enough. [\#174](https://github.com/nlohmann/json/issues/174) -- Provide a FAQ [\#163](https://github.com/nlohmann/json/issues/163) -- Implicit assignment to std::string fails [\#144](https://github.com/nlohmann/json/issues/144) - -- Fix Issue \#265 [\#266](https://github.com/nlohmann/json/pull/266) ([06needhamt](https://github.com/06needhamt)) -- Define CMake/CTest tests [\#247](https://github.com/nlohmann/json/pull/247) ([robertmrk](https://github.com/robertmrk)) -- Out of tree builds and a few other miscellaneous CMake cleanups. [\#242](https://github.com/nlohmann/json/pull/242) ([ChrisKitching](https://github.com/ChrisKitching)) -- Implement additional integration options [\#238](https://github.com/nlohmann/json/pull/238) ([robertmrk](https://github.com/robertmrk)) -- make serialization locale-independent [\#232](https://github.com/nlohmann/json/pull/232) ([nlohmann](https://github.com/nlohmann)) -- fixes \#223 by updating README.md [\#227](https://github.com/nlohmann/json/pull/227) ([kevin--](https://github.com/kevin--)) -- Use namespace std for int64\_t and uint64\_t [\#226](https://github.com/nlohmann/json/pull/226) ([lv-zheng](https://github.com/lv-zheng)) -- Added missing cerrno header to fix ERANGE compile error on android [\#222](https://github.com/nlohmann/json/pull/222) ([Teemperor](https://github.com/Teemperor)) -- Corrected readme [\#218](https://github.com/nlohmann/json/pull/218) ([Annihil](https://github.com/Annihil)) -- Create PULL\_REQUEST\_TEMPLATE.md [\#213](https://github.com/nlohmann/json/pull/213) ([whackashoe](https://github.com/whackashoe)) -- fixed noexcept; added constexpr [\#208](https://github.com/nlohmann/json/pull/208) ([nlohmann](https://github.com/nlohmann)) -- Add support for afl-fuzz testing [\#207](https://github.com/nlohmann/json/pull/207) ([mykter](https://github.com/mykter)) -- replaced ssize\_t occurrences with auto \(addresses \#204\) [\#205](https://github.com/nlohmann/json/pull/205) ([nlohmann](https://github.com/nlohmann)) -- Fixed issue \#199 - Small bugs in json.hpp \(get\_number\) and unit.cpp \(non-standard integer type test\) [\#200](https://github.com/nlohmann/json/pull/200) ([twelsby](https://github.com/twelsby)) -- Fix broken link [\#197](https://github.com/nlohmann/json/pull/197) ([vog](https://github.com/vog)) -- Issue \#195 - update Travis to Trusty due to gcc/clang strtod\(\) bug [\#196](https://github.com/nlohmann/json/pull/196) ([twelsby](https://github.com/twelsby)) -- Issue \#178 - Extending support to full uint64\_t/int64\_t range and unsigned type \(updated\) [\#193](https://github.com/nlohmann/json/pull/193) ([twelsby](https://github.com/twelsby)) - -## [v1.1.0](https://github.com/nlohmann/json/releases/tag/v1.1.0) (2016-01-24) - -[Full Changelog](https://github.com/nlohmann/json/compare/v1.0.0...v1.1.0) - -- Small error in pull \#185 [\#194](https://github.com/nlohmann/json/issues/194) -- Bugs in miloyip/nativejson-benchmark: floating-point parsing [\#186](https://github.com/nlohmann/json/issues/186) -- Floating point equality [\#185](https://github.com/nlohmann/json/issues/185) -- Unused variables in catch [\#180](https://github.com/nlohmann/json/issues/180) -- Typo in documentation [\#179](https://github.com/nlohmann/json/issues/179) -- JSON performance benchmark comparision [\#177](https://github.com/nlohmann/json/issues/177) -- Since re2c is often ignored in pull requests, it may make sense to make a contributing.md file [\#175](https://github.com/nlohmann/json/issues/175) -- Question about exceptions [\#173](https://github.com/nlohmann/json/issues/173) -- Android? [\#172](https://github.com/nlohmann/json/issues/172) -- Cannot index by key of type static constexpr const char\* [\#171](https://github.com/nlohmann/json/issues/171) -- Add assertions [\#168](https://github.com/nlohmann/json/issues/168) -- MSVC 2015 build fails when attempting to compare object\_t [\#167](https://github.com/nlohmann/json/issues/167) -- Member detector is not portable [\#166](https://github.com/nlohmann/json/issues/166) -- Unnecessary const\_cast [\#162](https://github.com/nlohmann/json/issues/162) -- Question about get\_ref\(\) [\#128](https://github.com/nlohmann/json/issues/128) -- range based for loop for objects [\#83](https://github.com/nlohmann/json/issues/83) -- Consider submitting this to the Boost Library Incubator [\#66](https://github.com/nlohmann/json/issues/66) - -- Fixed Issue \#186 - add strto\(f|d|ld\) overload wrappers, "-0.0" special case and FP trailing zero [\#191](https://github.com/nlohmann/json/pull/191) ([twelsby](https://github.com/twelsby)) -- Issue \#185 - remove approx\(\) and use \#pragma to kill warnings [\#190](https://github.com/nlohmann/json/pull/190) ([twelsby](https://github.com/twelsby)) -- Fixed Issue \#171 - added two extra template overloads of operator\[\] for T\* arguments [\#189](https://github.com/nlohmann/json/pull/189) ([twelsby](https://github.com/twelsby)) -- Fixed issue \#167 - removed operator ValueType\(\) condition for VS2015 [\#188](https://github.com/nlohmann/json/pull/188) ([twelsby](https://github.com/twelsby)) -- Implementation of get\_ref\(\) [\#184](https://github.com/nlohmann/json/pull/184) ([dariomt](https://github.com/dariomt)) -- Fixed some typos in CONTRIBUTING.md [\#182](https://github.com/nlohmann/json/pull/182) ([nibroc](https://github.com/nibroc)) - -## [v1.0.0](https://github.com/nlohmann/json/releases/tag/v1.0.0) (2015-12-27) - -[Full Changelog](https://github.com/nlohmann/json/compare/v1.0.0-rc1...v1.0.0) - -- add key name to exception [\#160](https://github.com/nlohmann/json/issues/160) -- Getting member discarding qualifyer [\#159](https://github.com/nlohmann/json/issues/159) -- basic\_json::iterator::value\(\) output includes quotes while basic\_json::iterator::key\(\) doesn't [\#158](https://github.com/nlohmann/json/issues/158) -- Indexing `const basic_json<>` with `const basic_string` [\#157](https://github.com/nlohmann/json/issues/157) -- token\_type\_name\(token\_type t\): not all control paths return a value [\#156](https://github.com/nlohmann/json/issues/156) -- prevent json.hpp from emitting compiler warnings [\#154](https://github.com/nlohmann/json/issues/154) -- json::parse\(string\) does not check utf8 bom [\#152](https://github.com/nlohmann/json/issues/152) -- unsigned 64bit values output as signed [\#151](https://github.com/nlohmann/json/issues/151) -- Wish feature: json5 [\#150](https://github.com/nlohmann/json/issues/150) -- Unable to compile on MSVC 2015 with SDL checking enabled: This function or variable may be unsafe. [\#149](https://github.com/nlohmann/json/issues/149) -- "Json Object" type does not keep object order [\#148](https://github.com/nlohmann/json/issues/148) -- dump\(\) convert strings encoded by utf-8 to shift-jis on windows 10. [\#147](https://github.com/nlohmann/json/issues/147) -- Unable to get field names in a json object [\#145](https://github.com/nlohmann/json/issues/145) -- Question: Is the use of incomplete type correct? [\#138](https://github.com/nlohmann/json/issues/138) -- json.hpp:5746:32: error: 'to\_string' is not a member of 'std' [\#136](https://github.com/nlohmann/json/issues/136) -- Bug in basic\_json::operator\[\] const overload [\#135](https://github.com/nlohmann/json/issues/135) -- wrong enable\_if for const pointer \(instead of pointer-to-const\) [\#134](https://github.com/nlohmann/json/issues/134) -- overload of at\(\) with default value [\#133](https://github.com/nlohmann/json/issues/133) -- Splitting source [\#132](https://github.com/nlohmann/json/issues/132) -- Question about get\_ptr\(\) [\#127](https://github.com/nlohmann/json/issues/127) -- Visual Studio 14 Debug assertion failed [\#125](https://github.com/nlohmann/json/issues/125) -- Memory leak in face of exceptions [\#118](https://github.com/nlohmann/json/issues/118) -- Find and Count for arrays [\#117](https://github.com/nlohmann/json/issues/117) -- dynamically constructing an arbitrarily nested object [\#114](https://github.com/nlohmann/json/issues/114) -- Returning any data type [\#113](https://github.com/nlohmann/json/issues/113) -- Compile error with g++ 4.9.3 cygwin 64-bit [\#112](https://github.com/nlohmann/json/issues/112) -- insert json array issue with gcc4.8.2 [\#110](https://github.com/nlohmann/json/issues/110) -- error: unterminated raw string [\#109](https://github.com/nlohmann/json/issues/109) -- vector\ copy constructor really weird [\#108](https://github.com/nlohmann/json/issues/108) -- \[clang-3.6.2\] string/sstream with number to json issue [\#107](https://github.com/nlohmann/json/issues/107) -- object field accessors [\#103](https://github.com/nlohmann/json/issues/103) -- v8pp and json [\#95](https://github.com/nlohmann/json/issues/95) -- Wishlist [\#65](https://github.com/nlohmann/json/issues/65) -- Windows/Visual Studio \(through 2013\) is unsupported [\#62](https://github.com/nlohmann/json/issues/62) - -- Replace sprintf with hex function, this fixes \#149 [\#153](https://github.com/nlohmann/json/pull/153) ([whackashoe](https://github.com/whackashoe)) -- Fix character skipping after a surrogate pair [\#146](https://github.com/nlohmann/json/pull/146) ([robertmrk](https://github.com/robertmrk)) -- Detect correctly pointer-to-const [\#137](https://github.com/nlohmann/json/pull/137) ([dariomt](https://github.com/dariomt)) -- disabled "CopyAssignable" test for MSVC in Debug mode, see \#125 [\#131](https://github.com/nlohmann/json/pull/131) ([dariomt](https://github.com/dariomt)) -- removed stream operator for iterator, resolution for \#125 [\#130](https://github.com/nlohmann/json/pull/130) ([dariomt](https://github.com/dariomt)) -- fixed typos in comments for examples [\#129](https://github.com/nlohmann/json/pull/129) ([dariomt](https://github.com/dariomt)) -- Remove superfluous inefficiency [\#126](https://github.com/nlohmann/json/pull/126) ([d-frey](https://github.com/d-frey)) -- remove invalid parameter '-stdlib=libc++' in CMakeLists.txt [\#124](https://github.com/nlohmann/json/pull/124) ([emvivre](https://github.com/emvivre)) -- exception-safe object creation, fixes \#118 [\#122](https://github.com/nlohmann/json/pull/122) ([d-frey](https://github.com/d-frey)) -- Fix small oversight. [\#121](https://github.com/nlohmann/json/pull/121) ([ColinH](https://github.com/ColinH)) -- Overload parse\(\) to accept an rvalue reference [\#120](https://github.com/nlohmann/json/pull/120) ([silverweed](https://github.com/silverweed)) -- Use the right variable name in doc string [\#115](https://github.com/nlohmann/json/pull/115) ([whoshuu](https://github.com/whoshuu)) - -## [v1.0.0-rc1](https://github.com/nlohmann/json/releases/tag/v1.0.0-rc1) (2015-07-26) - -[Full Changelog](https://github.com/nlohmann/json/compare/4502e7e51c0569419c26e75fbdd5748170603e54...v1.0.0-rc1) - -- Finish documenting the public interface in Doxygen [\#102](https://github.com/nlohmann/json/issues/102) -- Binary string causes numbers to be dumped as hex [\#101](https://github.com/nlohmann/json/issues/101) -- failed to iterator json object with reverse\_iterator [\#100](https://github.com/nlohmann/json/issues/100) -- 'noexcept' : unknown override specifier [\#99](https://github.com/nlohmann/json/issues/99) -- json float parsing problem [\#98](https://github.com/nlohmann/json/issues/98) -- Adjust wording to JSON RFC [\#97](https://github.com/nlohmann/json/issues/97) -- static analysis warnings [\#94](https://github.com/nlohmann/json/issues/94) -- reverse\_iterator operator inheritance problem [\#93](https://github.com/nlohmann/json/issues/93) -- init error [\#92](https://github.com/nlohmann/json/issues/92) -- access by \(const\) reference [\#91](https://github.com/nlohmann/json/issues/91) -- is\_integer and is\_float tests [\#90](https://github.com/nlohmann/json/issues/90) -- Nonstandard integer type [\#89](https://github.com/nlohmann/json/issues/89) -- static library build [\#84](https://github.com/nlohmann/json/issues/84) -- lexer::get\_number return NAN [\#82](https://github.com/nlohmann/json/issues/82) -- MinGW have no std::to\_string [\#80](https://github.com/nlohmann/json/issues/80) -- Incorrect behaviour of basic\_json::count method [\#78](https://github.com/nlohmann/json/issues/78) -- Invoking is\_array\(\) function creates "null" value [\#77](https://github.com/nlohmann/json/issues/77) -- dump\(\) / parse\(\) not idempotent [\#76](https://github.com/nlohmann/json/issues/76) -- Handle infinity and NaN cases [\#70](https://github.com/nlohmann/json/issues/70) -- errors in g++-4.8.1 [\#68](https://github.com/nlohmann/json/issues/68) -- Keys when iterating over objects [\#67](https://github.com/nlohmann/json/issues/67) -- Compilation results in tons of warnings [\#64](https://github.com/nlohmann/json/issues/64) -- Complete brief documentation [\#61](https://github.com/nlohmann/json/issues/61) -- Double quotation mark is not parsed correctly [\#60](https://github.com/nlohmann/json/issues/60) -- Get coverage back to 100% [\#58](https://github.com/nlohmann/json/issues/58) -- erase elements using iterators [\#57](https://github.com/nlohmann/json/issues/57) -- Removing item from array [\#56](https://github.com/nlohmann/json/issues/56) -- Serialize/Deserialize like PHP? [\#55](https://github.com/nlohmann/json/issues/55) -- Numbers as keys [\#54](https://github.com/nlohmann/json/issues/54) -- Why are elements alphabetized on key while iterating? [\#53](https://github.com/nlohmann/json/issues/53) -- Document erase, count, and iterators key and value [\#52](https://github.com/nlohmann/json/issues/52) -- Do not use std::to\_string [\#51](https://github.com/nlohmann/json/issues/51) -- Supported compilers [\#50](https://github.com/nlohmann/json/issues/50) -- Confused about iterating through json objects [\#49](https://github.com/nlohmann/json/issues/49) -- Use non-member begin/end [\#48](https://github.com/nlohmann/json/issues/48) -- Erase key [\#47](https://github.com/nlohmann/json/issues/47) -- Key iterator [\#46](https://github.com/nlohmann/json/issues/46) -- Add count member function [\#45](https://github.com/nlohmann/json/issues/45) -- Problem getting vector \(array\) of strings [\#44](https://github.com/nlohmann/json/issues/44) -- Compilation error due to assuming that private=public [\#43](https://github.com/nlohmann/json/issues/43) -- Use of deprecated implicit copy constructor [\#42](https://github.com/nlohmann/json/issues/42) -- Printing attribute names [\#39](https://github.com/nlohmann/json/issues/39) -- dumping a small number\_float just outputs 0.000000 [\#37](https://github.com/nlohmann/json/issues/37) -- find is error [\#32](https://github.com/nlohmann/json/issues/32) -- Avoid using spaces when encoding without pretty print [\#31](https://github.com/nlohmann/json/issues/31) -- Cannot encode long numbers [\#30](https://github.com/nlohmann/json/issues/30) -- segmentation fault when iterating over empty arrays/objects [\#28](https://github.com/nlohmann/json/issues/28) -- Creating an empty array [\#27](https://github.com/nlohmann/json/issues/27) -- Custom allocator support [\#25](https://github.com/nlohmann/json/issues/25) -- make the type of the used string container customizable [\#20](https://github.com/nlohmann/json/issues/20) -- Improper parsing of JSON string "\\" [\#17](https://github.com/nlohmann/json/issues/17) -- create a header-only version [\#16](https://github.com/nlohmann/json/issues/16) -- Don't return "const values" [\#15](https://github.com/nlohmann/json/issues/15) -- Add to\_string overload for indentation [\#13](https://github.com/nlohmann/json/issues/13) -- string parser does not recognize uncompliant strings [\#12](https://github.com/nlohmann/json/issues/12) -- possible double-free in find function [\#11](https://github.com/nlohmann/json/issues/11) -- UTF-8 encoding/deconding/testing [\#10](https://github.com/nlohmann/json/issues/10) -- move code into namespace [\#9](https://github.com/nlohmann/json/issues/9) -- free functions for explicit objects and arrays in initializer lists [\#8](https://github.com/nlohmann/json/issues/8) -- unique\_ptr for ownership [\#7](https://github.com/nlohmann/json/issues/7) -- Add unit tests [\#4](https://github.com/nlohmann/json/issues/4) -- Drop C++98 support [\#3](https://github.com/nlohmann/json/issues/3) -- Test case coverage [\#2](https://github.com/nlohmann/json/issues/2) -- Runtime error in Travis job [\#1](https://github.com/nlohmann/json/issues/1) - -- Keyword 'inline' is useless when member functions are defined in headers [\#87](https://github.com/nlohmann/json/pull/87) ([ahamez](https://github.com/ahamez)) -- Remove useless typename [\#86](https://github.com/nlohmann/json/pull/86) ([ahamez](https://github.com/ahamez)) -- Avoid warning with Xcode's clang [\#85](https://github.com/nlohmann/json/pull/85) ([ahamez](https://github.com/ahamez)) -- Fix typos [\#73](https://github.com/nlohmann/json/pull/73) ([aqnouch](https://github.com/aqnouch)) -- Replace `default_callback` function with `nullptr` and check for null… [\#72](https://github.com/nlohmann/json/pull/72) ([aburgh](https://github.com/aburgh)) -- support enum [\#71](https://github.com/nlohmann/json/pull/71) ([likebeta](https://github.com/likebeta)) -- Fix performance regression introduced with the parsing callback feature. [\#69](https://github.com/nlohmann/json/pull/69) ([aburgh](https://github.com/aburgh)) -- Improve the implementations of the comparission-operators [\#63](https://github.com/nlohmann/json/pull/63) ([Florianjw](https://github.com/Florianjw)) -- Fix compilation of json\_unit with GCC 5 [\#59](https://github.com/nlohmann/json/pull/59) ([dkopecek](https://github.com/dkopecek)) -- Parse streams incrementally. [\#40](https://github.com/nlohmann/json/pull/40) ([aburgh](https://github.com/aburgh)) -- Feature/small float serialization [\#38](https://github.com/nlohmann/json/pull/38) ([jrandall](https://github.com/jrandall)) -- template version with re2c scanner [\#36](https://github.com/nlohmann/json/pull/36) ([nlohmann](https://github.com/nlohmann)) -- more descriptive documentation in example [\#33](https://github.com/nlohmann/json/pull/33) ([luxe](https://github.com/luxe)) -- Fix string conversion under Clang [\#26](https://github.com/nlohmann/json/pull/26) ([wancw](https://github.com/wancw)) -- Fixed dumping of strings [\#24](https://github.com/nlohmann/json/pull/24) ([Teemperor](https://github.com/Teemperor)) -- Added a remark to the readme that coverage is GCC only for now [\#23](https://github.com/nlohmann/json/pull/23) ([Teemperor](https://github.com/Teemperor)) -- Unicode escaping [\#22](https://github.com/nlohmann/json/pull/22) ([Teemperor](https://github.com/Teemperor)) -- Implemented the JSON spec for string parsing for everything but the \uXXXX escaping [\#21](https://github.com/nlohmann/json/pull/21) ([Teemperor](https://github.com/Teemperor)) -- add the std iterator typedefs to iterator and const\_iterator [\#19](https://github.com/nlohmann/json/pull/19) ([kirkshoop](https://github.com/kirkshoop)) -- Fixed escaped quotes [\#18](https://github.com/nlohmann/json/pull/18) ([Teemperor](https://github.com/Teemperor)) -- Fix double delete on std::bad\_alloc exception [\#14](https://github.com/nlohmann/json/pull/14) ([elliotgoodrich](https://github.com/elliotgoodrich)) -- Added CMake and lcov [\#6](https://github.com/nlohmann/json/pull/6) ([Teemperor](https://github.com/Teemperor)) -- Version 2.0 [\#5](https://github.com/nlohmann/json/pull/5) ([nlohmann](https://github.com/nlohmann)) - - - -\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/Sources/backend-cpp/Vendor/json/README.md b/Sources/backend-cpp/Vendor/json/README.md deleted file mode 100644 index 31329632..00000000 --- a/Sources/backend-cpp/Vendor/json/README.md +++ /dev/null @@ -1,1716 +0,0 @@ -[![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)](https://github.com/nlohmann/json/releases) - -[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk/branch/develop?svg=true)](https://ci.appveyor.com/project/nlohmann/json) -[![Ubuntu](https://github.com/nlohmann/json/workflows/Ubuntu/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AUbuntu) -[![macOS](https://github.com/nlohmann/json/workflows/macOS/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AmacOS) -[![Windows](https://github.com/nlohmann/json/workflows/Windows/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AWindows) -[![Coverage Status](https://coveralls.io/repos/github/nlohmann/json/badge.svg?branch=develop)](https://coveralls.io/github/nlohmann/json?branch=develop) -[![Coverity Scan Build Status](https://scan.coverity.com/projects/5550/badge.svg)](https://scan.coverity.com/projects/nlohmann-json) -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/e0d1a9d5d6fd46fcb655c4cb930bb3e8)](https://www.codacy.com/gh/nlohmann/json/dashboard?utm_source=github.com&utm_medium=referral&utm_content=nlohmann/json&utm_campaign=Badge_Grade) -[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/nlohmann/json.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/nlohmann/json/context:cpp) -[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/json.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json) -[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/1mp10JbaANo6FUc7) -[![Documentation](https://img.shields.io/badge/docs-doxygen-blue.svg)](https://nlohmann.github.io/json/doxygen/index.html) -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT) -[![GitHub Releases](https://img.shields.io/github/release/nlohmann/json.svg)](https://github.com/nlohmann/json/releases) -[![GitHub Downloads](https://img.shields.io/github/downloads/nlohmann/json/total)](https://github.com/nlohmann/json/releases) -[![GitHub Issues](https://img.shields.io/github/issues/nlohmann/json.svg)](https://github.com/nlohmann/json/issues) -[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/nlohmann/json.svg)](https://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue") -[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/289/badge)](https://bestpractices.coreinfrastructure.org/projects/289) -[![GitHub Sponsors](https://img.shields.io/badge/GitHub-Sponsors-ff69b4)](https://github.com/sponsors/nlohmann) - -- [Design goals](#design-goals) -- [Sponsors](#sponsors) -- [Support](#support) ([documentation](https://json.nlohmann.me), [FAQ](https://json.nlohmann.me/home/faq/), [discussions](https://github.com/nlohmann/json/discussions), [API](https://json.nlohmann.me/api/basic_json/), [bug issues](https://github.com/nlohmann/json/issues)) -- [Examples](#examples) - - [JSON as first-class data type](#json-as-first-class-data-type) - - [Serialization / Deserialization](#serialization--deserialization) - - [STL-like access](#stl-like-access) - - [Conversion from STL containers](#conversion-from-stl-containers) - - [JSON Pointer and JSON Patch](#json-pointer-and-json-patch) - - [JSON Merge Patch](#json-merge-patch) - - [Implicit conversions](#implicit-conversions) - - [Conversions to/from arbitrary types](#arbitrary-types-conversions) - - [Specializing enum conversion](#specializing-enum-conversion) - - [Binary formats (BSON, CBOR, MessagePack, and UBJSON)](#binary-formats-bson-cbor-messagepack-and-ubjson) -- [Supported compilers](#supported-compilers) -- [Integration](#integration) - - [CMake](#cmake) - - [Package Managers](#package-managers) - - [Pkg-config](#pkg-config) -- [License](#license) -- [Contact](#contact) -- [Thanks](#thanks) -- [Used third-party tools](#used-third-party-tools) -- [Projects using JSON for Modern C++](#projects-using-json-for-modern-c) -- [Notes](#notes) -- [Execute unit tests](#execute-unit-tests) - -## Design goals - -There are myriads of [JSON](https://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals: - -- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the [examples below](#examples) and you'll know what I mean. - -- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. - -- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/test/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289). - -Other aspects were not so important to us: - -- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs. - -- **Speed**. There are certainly [faster JSON libraries](https://github.com/miloyip/nativejson-benchmark#parsing-time) out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a `std::vector` or `std::map`, you are already set. - -See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information. - - -## Sponsors - -You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/nlohmann). - -### :label: Named Sponsors - -- [Michael Hartmann](https://github.com/reFX-Mike) -- [Stefan Hagen](https://github.com/sthagen) -- [Steve Sperandeo](https://github.com/homer6) -- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe) -- [Steve Wagner](https://github.com/ciroque) - -Thanks everyone! - -## Support - -:question: If you have a **question**, please check if it is already answered in the [**FAQ**](https://json.nlohmann.me/home/faq/) or the [**Q&A**](https://github.com/nlohmann/json/discussions/categories/q-a) section. If not, please [**ask a new question**](https://github.com/nlohmann/json/discussions/new) there. - -:books: If you want to **learn more** about how to use the library, check out the rest of the [**README**](#examples), have a look at [**code examples**](https://github.com/nlohmann/json/tree/develop/doc/examples), or browse through the [**help pages**](https://json.nlohmann.me). - -:construction: If you want to understand the **API** better, check out the [**API Reference**](https://json.nlohmann.me/api/basic_json/) or the [**Doxygen documentation**](https://json.nlohmann.me/doxygen/index.html). - -:bug: If you found a **bug**, please check the [**FAQ**](https://json.nlohmann.me/home/faq/) if it is a known issue or the result of a design decision. Please also have a look at the [**issue list**](https://github.com/nlohmann/json/issues) before you [**create a new issue**](https://github.com/nlohmann/json/issues/new/choose). Please provide as much information as possible to help us understand and reproduce your issue. - -There is also a [**docset**](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B) for the documentation browsers [Dash](https://kapeli.com/dash), [Velocity](https://velocity.silverlakesoftware.com), and [Zeal](https://zealdocs.org) that contains the full [documentation](https://json.nlohmann.me) as offline resource. - -## Examples - -Beside the examples below, you may want to check the [documentation](https://nlohmann.github.io/json/) where each function contains a separate code example (e.g., check out [`emplace()`](https://nlohmann.github.io/json/api/basic_json/emplace/)). All [example files](https://github.com/nlohmann/json/tree/develop/doc/examples) can be compiled and executed on their own (e.g., file [emplace.cpp](https://github.com/nlohmann/json/blob/develop/doc/examples/emplace.cpp)). - -### JSON as first-class data type - -Here are some examples to give you an idea how to use the class. - -Assume you want to create the JSON object - -```json -{ - "pi": 3.141, - "happy": true, - "name": "Niels", - "nothing": null, - "answer": { - "everything": 42 - }, - "list": [1, 0, 2], - "object": { - "currency": "USD", - "value": 42.99 - } -} -``` - -With this library, you could write: - -```cpp -// create an empty structure (null) -json j; - -// add a number that is stored as double (note the implicit conversion of j to an object) -j["pi"] = 3.141; - -// add a Boolean that is stored as bool -j["happy"] = true; - -// add a string that is stored as std::string -j["name"] = "Niels"; - -// add another null object by passing nullptr -j["nothing"] = nullptr; - -// add an object inside the object -j["answer"]["everything"] = 42; - -// add an array that is stored as std::vector (using an initializer list) -j["list"] = { 1, 0, 2 }; - -// add another object (using an initializer list of pairs) -j["object"] = { {"currency", "USD"}, {"value", 42.99} }; - -// instead, you could also write (which looks very similar to the JSON above) -json j2 = { - {"pi", 3.141}, - {"happy", true}, - {"name", "Niels"}, - {"nothing", nullptr}, - {"answer", { - {"everything", 42} - }}, - {"list", {1, 0, 2}}, - {"object", { - {"currency", "USD"}, - {"value", 42.99} - }} -}; -``` - -Note that in all these cases, you never need to "tell" the compiler which JSON value type you want to use. If you want to be explicit or express some edge cases, the functions [`json::array()`](https://nlohmann.github.io/json/api/basic_json/array/) and [`json::object()`](https://nlohmann.github.io/json/api/basic_json/object/) will help: - -```cpp -// a way to express the empty array [] -json empty_array_explicit = json::array(); - -// ways to express the empty object {} -json empty_object_implicit = json({}); -json empty_object_explicit = json::object(); - -// a way to express an _array_ of key/value pairs [["currency", "USD"], ["value", 42.99]] -json array_not_object = json::array({ {"currency", "USD"}, {"value", 42.99} }); -``` - -### Serialization / Deserialization - -#### To/from strings - -You can create a JSON value (deserialization) by appending `_json` to a string literal: - -```cpp -// create object from string literal -json j = "{ \"happy\": true, \"pi\": 3.141 }"_json; - -// or even nicer with a raw string literal -auto j2 = R"( - { - "happy": true, - "pi": 3.141 - } -)"_json; -``` - -Note that without appending the `_json` suffix, the passed string literal is not parsed, but just used as JSON string value. That is, `json j = "{ \"happy\": true, \"pi\": 3.141 }"` would just store the string `"{ "happy": true, "pi": 3.141 }"` rather than parsing the actual object. - -The above example can also be expressed explicitly using [`json::parse()`](https://nlohmann.github.io/json/api/basic_json/parse/): - -```cpp -// parse explicitly -auto j3 = json::parse(R"({"happy": true, "pi": 3.141})"); -``` - -You can also get a string representation of a JSON value (serialize): - -```cpp -// explicit conversion to string -std::string s = j.dump(); // {"happy":true,"pi":3.141} - -// serialization with pretty printing -// pass in the amount of spaces to indent -std::cout << j.dump(4) << std::endl; -// { -// "happy": true, -// "pi": 3.141 -// } -``` - -Note the difference between serialization and assignment: - -```cpp -// store a string in a JSON value -json j_string = "this is a string"; - -// retrieve the string value -auto cpp_string = j_string.get(); -// retrieve the string value (alternative when a variable already exists) -std::string cpp_string2; -j_string.get_to(cpp_string2); - -// retrieve the serialized value (explicit JSON serialization) -std::string serialized_string = j_string.dump(); - -// output of original string -std::cout << cpp_string << " == " << cpp_string2 << " == " << j_string.get() << '\n'; -// output of serialized value -std::cout << j_string << " == " << serialized_string << std::endl; -``` - -[`.dump()`](https://nlohmann.github.io/json/api/basic_json/dump/) returns the originally stored string value. - -Note the library only supports UTF-8. When you store strings with different encodings in the library, calling [`dump()`](https://nlohmann.github.io/json/api/basic_json/dump/) may throw an exception unless `json::error_handler_t::replace` or `json::error_handler_t::ignore` are used as error handlers. - -#### To/from streams (e.g. files, string streams) - -You can also use streams to serialize and deserialize: - -```cpp -// deserialize from standard input -json j; -std::cin >> j; - -// serialize to standard output -std::cout << j; - -// the setw manipulator was overloaded to set the indentation for pretty printing -std::cout << std::setw(4) << j << std::endl; -``` - -These operators work for any subclasses of `std::istream` or `std::ostream`. Here is the same example with files: - -```cpp -// read a JSON file -std::ifstream i("file.json"); -json j; -i >> j; - -// write prettified JSON to another file -std::ofstream o("pretty.json"); -o << std::setw(4) << j << std::endl; -``` - -Please note that setting the exception bit for `failbit` is inappropriate for this use case. It will result in program termination due to the `noexcept` specifier in use. - -#### Read from iterator range - -You can also parse JSON from an iterator range; that is, from any container accessible by iterators whose `value_type` is an integral type of 1, 2 or 4 bytes, which will be interpreted as UTF-8, UTF-16 and UTF-32 respectively. For instance, a `std::vector`, or a `std::list`: - -```cpp -std::vector v = {'t', 'r', 'u', 'e'}; -json j = json::parse(v.begin(), v.end()); -``` - -You may leave the iterators for the range [begin, end): - -```cpp -std::vector v = {'t', 'r', 'u', 'e'}; -json j = json::parse(v); -``` - -#### Custom data source - -Since the parse function accepts arbitrary iterator ranges, you can provide your own data sources by implementing the `LegacyInputIterator` concept. - -```cpp -struct MyContainer { - void advance(); - const char& get_current(); -}; - -struct MyIterator { - using difference_type = std::ptrdiff_t; - using value_type = char; - using pointer = const char*; - using reference = const char&; - using iterator_category = std::input_iterator_tag; - - MyIterator& operator++() { - MyContainer.advance(); - return *this; - } - - bool operator!=(const MyIterator& rhs) const { - return rhs.target != target; - } - - reference operator*() const { - return target.get_current(); - } - - MyContainer* target = nullptr; -}; - -MyIterator begin(MyContainer& tgt) { - return MyIterator{&tgt}; -} - -MyIterator end(const MyContainer&) { - return {}; -} - -void foo() { - MyContainer c; - json j = json::parse(c); -} -``` - -#### SAX interface - -The library uses a SAX-like interface with the following functions: - -```cpp -// called when null is parsed -bool null(); - -// called when a boolean is parsed; value is passed -bool boolean(bool val); - -// called when a signed or unsigned integer number is parsed; value is passed -bool number_integer(number_integer_t val); -bool number_unsigned(number_unsigned_t val); - -// called when a floating-point number is parsed; value and original string is passed -bool number_float(number_float_t val, const string_t& s); - -// called when a string is parsed; value is passed and can be safely moved away -bool string(string_t& val); -// called when a binary value is parsed; value is passed and can be safely moved away -bool binary(binary_t& val); - -// called when an object or array begins or ends, resp. The number of elements is passed (or -1 if not known) -bool start_object(std::size_t elements); -bool end_object(); -bool start_array(std::size_t elements); -bool end_array(); -// called when an object key is parsed; value is passed and can be safely moved away -bool key(string_t& val); - -// called when a parse error occurs; byte position, the last token, and an exception is passed -bool parse_error(std::size_t position, const std::string& last_token, const detail::exception& ex); -``` - -The return value of each function determines whether parsing should proceed. - -To implement your own SAX handler, proceed as follows: - -1. Implement the SAX interface in a class. You can use class `nlohmann::json_sax` as base class, but you can also use any class where the functions described above are implemented and public. -2. Create an object of your SAX interface class, e.g. `my_sax`. -3. Call `bool json::sax_parse(input, &my_sax)`; where the first parameter can be any input like a string or an input stream and the second parameter is a pointer to your SAX interface. - -Note the `sax_parse` function only returns a `bool` indicating the result of the last executed SAX event. It does not return a `json` value - it is up to you to decide what to do with the SAX events. Furthermore, no exceptions are thrown in case of a parse error - it is up to you what to do with the exception object passed to your `parse_error` implementation. Internally, the SAX interface is used for the DOM parser (class `json_sax_dom_parser`) as well as the acceptor (`json_sax_acceptor`), see file [`json_sax.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/detail/input/json_sax.hpp). - -### STL-like access - -We designed the JSON class to behave just like an STL container. In fact, it satisfies the [**ReversibleContainer**](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) requirement. - -```cpp -// create an array using push_back -json j; -j.push_back("foo"); -j.push_back(1); -j.push_back(true); - -// also use emplace_back -j.emplace_back(1.78); - -// iterate the array -for (json::iterator it = j.begin(); it != j.end(); ++it) { - std::cout << *it << '\n'; -} - -// range-based for -for (auto& element : j) { - std::cout << element << '\n'; -} - -// getter/setter -const auto tmp = j[0].get(); -j[1] = 42; -bool foo = j.at(2); - -// comparison -j == R"(["foo", 1, true, 1.78])"_json; // true - -// other stuff -j.size(); // 4 entries -j.empty(); // false -j.type(); // json::value_t::array -j.clear(); // the array is empty again - -// convenience type checkers -j.is_null(); -j.is_boolean(); -j.is_number(); -j.is_object(); -j.is_array(); -j.is_string(); - -// create an object -json o; -o["foo"] = 23; -o["bar"] = false; -o["baz"] = 3.141; - -// also use emplace -o.emplace("weather", "sunny"); - -// special iterator member functions for objects -for (json::iterator it = o.begin(); it != o.end(); ++it) { - std::cout << it.key() << " : " << it.value() << "\n"; -} - -// the same code as range for -for (auto& el : o.items()) { - std::cout << el.key() << " : " << el.value() << "\n"; -} - -// even easier with structured bindings (C++17) -for (auto& [key, value] : o.items()) { - std::cout << key << " : " << value << "\n"; -} - -// find an entry -if (o.contains("foo")) { - // there is an entry with key "foo" -} - -// or via find and an iterator -if (o.find("foo") != o.end()) { - // there is an entry with key "foo" -} - -// or simpler using count() -int foo_present = o.count("foo"); // 1 -int fob_present = o.count("fob"); // 0 - -// delete an entry -o.erase("foo"); -``` - - -### Conversion from STL containers - -Any sequence container (`std::array`, `std::vector`, `std::deque`, `std::forward_list`, `std::list`) whose values can be used to construct JSON values (e.g., integers, floating point numbers, Booleans, string types, or again STL containers described in this section) can be used to create a JSON array. The same holds for similar associative containers (`std::set`, `std::multiset`, `std::unordered_set`, `std::unordered_multiset`), but in these cases the order of the elements of the array depends on how the elements are ordered in the respective STL container. - -```cpp -std::vector c_vector {1, 2, 3, 4}; -json j_vec(c_vector); -// [1, 2, 3, 4] - -std::deque c_deque {1.2, 2.3, 3.4, 5.6}; -json j_deque(c_deque); -// [1.2, 2.3, 3.4, 5.6] - -std::list c_list {true, true, false, true}; -json j_list(c_list); -// [true, true, false, true] - -std::forward_list c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543}; -json j_flist(c_flist); -// [12345678909876, 23456789098765, 34567890987654, 45678909876543] - -std::array c_array {{1, 2, 3, 4}}; -json j_array(c_array); -// [1, 2, 3, 4] - -std::set c_set {"one", "two", "three", "four", "one"}; -json j_set(c_set); // only one entry for "one" is used -// ["four", "one", "three", "two"] - -std::unordered_set c_uset {"one", "two", "three", "four", "one"}; -json j_uset(c_uset); // only one entry for "one" is used -// maybe ["two", "three", "four", "one"] - -std::multiset c_mset {"one", "two", "one", "four"}; -json j_mset(c_mset); // both entries for "one" are used -// maybe ["one", "two", "one", "four"] - -std::unordered_multiset c_umset {"one", "two", "one", "four"}; -json j_umset(c_umset); // both entries for "one" are used -// maybe ["one", "two", "one", "four"] -``` - -Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON values (see examples above) can be used to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container. - -```cpp -std::map c_map { {"one", 1}, {"two", 2}, {"three", 3} }; -json j_map(c_map); -// {"one": 1, "three": 3, "two": 2 } - -std::unordered_map c_umap { {"one", 1.2}, {"two", 2.3}, {"three", 3.4} }; -json j_umap(c_umap); -// {"one": 1.2, "two": 2.3, "three": 3.4} - -std::multimap c_mmap { {"one", true}, {"two", true}, {"three", false}, {"three", true} }; -json j_mmap(c_mmap); // only one entry for key "three" is used -// maybe {"one": true, "two": true, "three": true} - -std::unordered_multimap c_ummap { {"one", true}, {"two", true}, {"three", false}, {"three", true} }; -json j_ummap(c_ummap); // only one entry for key "three" is used -// maybe {"one": true, "two": true, "three": true} -``` - -### JSON Pointer and JSON Patch - -The library supports **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) as alternative means to address structured values. On top of this, **JSON Patch** ([RFC 6902](https://tools.ietf.org/html/rfc6902)) allows describing differences between two JSON values - effectively allowing patch and diff operations known from Unix. - -```cpp -// a JSON value -json j_original = R"({ - "baz": ["one", "two", "three"], - "foo": "bar" -})"_json; - -// access members with a JSON pointer (RFC 6901) -j_original["/baz/1"_json_pointer]; -// "two" - -// a JSON patch (RFC 6902) -json j_patch = R"([ - { "op": "replace", "path": "/baz", "value": "boo" }, - { "op": "add", "path": "/hello", "value": ["world"] }, - { "op": "remove", "path": "/foo"} -])"_json; - -// apply the patch -json j_result = j_original.patch(j_patch); -// { -// "baz": "boo", -// "hello": ["world"] -// } - -// calculate a JSON patch from two JSON values -json::diff(j_result, j_original); -// [ -// { "op":" replace", "path": "/baz", "value": ["one", "two", "three"] }, -// { "op": "remove","path": "/hello" }, -// { "op": "add", "path": "/foo", "value": "bar" } -// ] -``` - -### JSON Merge Patch - -The library supports **JSON Merge Patch** ([RFC 7386](https://tools.ietf.org/html/rfc7386)) as a patch format. Instead of using JSON Pointer (see above) to specify values to be manipulated, it describes the changes using a syntax that closely mimics the document being modified. - -```cpp -// a JSON value -json j_document = R"({ - "a": "b", - "c": { - "d": "e", - "f": "g" - } -})"_json; - -// a patch -json j_patch = R"({ - "a":"z", - "c": { - "f": null - } -})"_json; - -// apply the patch -j_document.merge_patch(j_patch); -// { -// "a": "z", -// "c": { -// "d": "e" -// } -// } -``` - -### Implicit conversions - -Supported types can be implicitly converted to JSON values. - -It is recommended to **NOT USE** implicit conversions **FROM** a JSON value. -You can find more details about this recommendation [here](https://www.github.com/nlohmann/json/issues/958). -You can switch off implicit conversions by defining `JSON_USE_IMPLICIT_CONVERSIONS` to `0` before including the `json.hpp` header. When using CMake, you can also achieve this by setting the option `JSON_ImplicitConversions` to `OFF`. - -```cpp -// strings -std::string s1 = "Hello, world!"; -json js = s1; -auto s2 = js.get(); -// NOT RECOMMENDED -std::string s3 = js; -std::string s4; -s4 = js; - -// Booleans -bool b1 = true; -json jb = b1; -auto b2 = jb.get(); -// NOT RECOMMENDED -bool b3 = jb; -bool b4; -b4 = jb; - -// numbers -int i = 42; -json jn = i; -auto f = jn.get(); -// NOT RECOMMENDED -double f2 = jb; -double f3; -f3 = jb; - -// etc. -``` - -Note that `char` types are not automatically converted to JSON strings, but to integer numbers. A conversion to a string must be specified explicitly: - -```cpp -char ch = 'A'; // ASCII value 65 -json j_default = ch; // stores integer number 65 -json j_string = std::string(1, ch); // stores string "A" -``` - -### Arbitrary types conversions - -Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines: - -```cpp -namespace ns { - // a simple struct to model a person - struct person { - std::string name; - std::string address; - int age; - }; -} - -ns::person p = {"Ned Flanders", "744 Evergreen Terrace", 60}; - -// convert to JSON: copy each value into the JSON object -json j; -j["name"] = p.name; -j["address"] = p.address; -j["age"] = p.age; - -// ... - -// convert from JSON: copy each value from the JSON object -ns::person p { - j["name"].get(), - j["address"].get(), - j["age"].get() -}; -``` - -It works, but that's quite a lot of boilerplate... Fortunately, there's a better way: - -```cpp -// create a person -ns::person p {"Ned Flanders", "744 Evergreen Terrace", 60}; - -// conversion: person -> json -json j = p; - -std::cout << j << std::endl; -// {"address":"744 Evergreen Terrace","age":60,"name":"Ned Flanders"} - -// conversion: json -> person -auto p2 = j.get(); - -// that's it -assert(p == p2); -``` - -#### Basic usage - -To make this work with one of your types, you only need to provide two functions: - -```cpp -using json = nlohmann::json; - -namespace ns { - void to_json(json& j, const person& p) { - j = json{{"name", p.name}, {"address", p.address}, {"age", p.age}}; - } - - void from_json(const json& j, person& p) { - j.at("name").get_to(p.name); - j.at("address").get_to(p.address); - j.at("age").get_to(p.age); - } -} // namespace ns -``` - -That's all! When calling the `json` constructor with your type, your custom `to_json` method will be automatically called. -Likewise, when calling `get()` or `get_to(your_type&)`, the `from_json` method will be called. - -Some important things: - -* Those methods **MUST** be in your type's namespace (which can be the global namespace), or the library will not be able to locate them (in this example, they are in namespace `ns`, where `person` is defined). -* Those methods **MUST** be available (e.g., proper headers must be included) everywhere you use these conversions. Look at [issue 1108](https://github.com/nlohmann/json/issues/1108) for errors that may occur otherwise. -* When using `get()`, `your_type` **MUST** be [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). (There is a way to bypass this requirement described later.) -* In function `from_json`, use function [`at()`](https://nlohmann.github.io/json/api/basic_json/at/) to access the object values rather than `operator[]`. In case a key does not exist, `at` throws an exception that you can handle, whereas `operator[]` exhibits undefined behavior. -* You do not need to add serializers or deserializers for STL types like `std::vector`: the library already implements these. - -#### Simplify your life with macros - -If you just want to serialize/deserialize some structs, the `to_json`/`from_json` functions can be a lot of boilerplate. - -There are two macros to make your life easier as long as you (1) want to use a JSON object as serialization and (2) want to use the member variable names as object keys in that object: - -- `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(name, member1, member2, ...)` is to be defined inside the namespace of the class/struct to create code for. -- `NLOHMANN_DEFINE_TYPE_INTRUSIVE(name, member1, member2, ...)` is to be defined inside the class/struct to create code for. This macro can also access private members. - -In both macros, the first parameter is the name of the class/struct, and all remaining parameters name the members. - -##### Examples - -The `to_json`/`from_json` functions for the `person` struct above can be created with: - -```cpp -namespace ns { - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age) -} -``` - -Here is an example with private members, where `NLOHMANN_DEFINE_TYPE_INTRUSIVE` is needed: - -```cpp -namespace ns { - class address { - private: - std::string street; - int housenumber; - int postcode; - - public: - NLOHMANN_DEFINE_TYPE_INTRUSIVE(address, street, housenumber, postcode) - }; -} -``` - -#### How do I convert third-party types? - -This requires a bit more advanced technique. But first, let's see how this conversion mechanism works: - -The library uses **JSON Serializers** to convert types to json. -The default serializer for `nlohmann::json` is `nlohmann::adl_serializer` (ADL means [Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)). - -It is implemented like this (simplified): - -```cpp -template -struct adl_serializer { - static void to_json(json& j, const T& value) { - // calls the "to_json" method in T's namespace - } - - static void from_json(const json& j, T& value) { - // same thing, but with the "from_json" method - } -}; -``` - -This serializer works fine when you have control over the type's namespace. However, what about `boost::optional` or `std::filesystem::path` (C++17)? Hijacking the `boost` namespace is pretty bad, and it's illegal to add something other than template specializations to `std`... - -To solve this, you need to add a specialization of `adl_serializer` to the `nlohmann` namespace, here's an example: - -```cpp -// partial specialization (full specialization works too) -namespace nlohmann { - template - struct adl_serializer> { - static void to_json(json& j, const boost::optional& opt) { - if (opt == boost::none) { - j = nullptr; - } else { - j = *opt; // this will call adl_serializer::to_json which will - // find the free function to_json in T's namespace! - } - } - - static void from_json(const json& j, boost::optional& opt) { - if (j.is_null()) { - opt = boost::none; - } else { - opt = j.get(); // same as above, but with - // adl_serializer::from_json - } - } - }; -} -``` - -#### How can I use `get()` for non-default constructible/non-copyable types? - -There is a way, if your type is [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload: - -```cpp -struct move_only_type { - move_only_type() = delete; - move_only_type(int ii): i(ii) {} - move_only_type(const move_only_type&) = delete; - move_only_type(move_only_type&&) = default; - - int i; -}; - -namespace nlohmann { - template <> - struct adl_serializer { - // note: the return type is no longer 'void', and the method only takes - // one argument - static move_only_type from_json(const json& j) { - return {j.get()}; - } - - // Here's the catch! You must provide a to_json method! Otherwise, you - // will not be able to convert move_only_type to json, since you fully - // specialized adl_serializer on that type - static void to_json(json& j, move_only_type t) { - j = t.i; - } - }; -} -``` - -#### Can I write my own serializer? (Advanced use) - -Yes. You might want to take a look at [`unit-udt.cpp`](https://github.com/nlohmann/json/blob/develop/test/src/unit-udt.cpp) in the test suite, to see a few examples. - -If you write your own serializer, you'll need to do a few things: - -- use a different `basic_json` alias than `nlohmann::json` (the last template parameter of `basic_json` is the `JSONSerializer`) -- use your `basic_json` alias (or a template parameter) in all your `to_json`/`from_json` methods -- use `nlohmann::to_json` and `nlohmann::from_json` when you need ADL - -Here is an example, without simplifications, that only accepts types with a size <= 32, and uses ADL. - -```cpp -// You should use void as a second template argument -// if you don't need compile-time checks on T -template::type> -struct less_than_32_serializer { - template - static void to_json(BasicJsonType& j, T value) { - // we want to use ADL, and call the correct to_json overload - using nlohmann::to_json; // this method is called by adl_serializer, - // this is where the magic happens - to_json(j, value); - } - - template - static void from_json(const BasicJsonType& j, T& value) { - // same thing here - using nlohmann::from_json; - from_json(j, value); - } -}; -``` - -Be **very** careful when reimplementing your serializer, you can stack overflow if you don't pay attention: - -```cpp -template -struct bad_serializer -{ - template - static void to_json(BasicJsonType& j, const T& value) { - // this calls BasicJsonType::json_serializer::to_json(j, value); - // if BasicJsonType::json_serializer == bad_serializer ... oops! - j = value; - } - - template - static void to_json(const BasicJsonType& j, T& value) { - // this calls BasicJsonType::json_serializer::from_json(j, value); - // if BasicJsonType::json_serializer == bad_serializer ... oops! - value = j.template get(); // oops! - } -}; -``` - -### Specializing enum conversion - -By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be undefined or a different enum value than was originally intended. - -It is possible to more precisely specify how a given enum is mapped to and from JSON as shown below: - -```cpp -// example enum type declaration -enum TaskState { - TS_STOPPED, - TS_RUNNING, - TS_COMPLETED, - TS_INVALID=-1, -}; - -// map TaskState values to JSON as strings -NLOHMANN_JSON_SERIALIZE_ENUM( TaskState, { - {TS_INVALID, nullptr}, - {TS_STOPPED, "stopped"}, - {TS_RUNNING, "running"}, - {TS_COMPLETED, "completed"}, -}) -``` - -The `NLOHMANN_JSON_SERIALIZE_ENUM()` macro declares a set of `to_json()` / `from_json()` functions for type `TaskState` while avoiding repetition and boilerplate serialization code. - -**Usage:** - -```cpp -// enum to JSON as string -json j = TS_STOPPED; -assert(j == "stopped"); - -// json string to enum -json j3 = "running"; -assert(j3.get() == TS_RUNNING); - -// undefined json value to enum (where the first map entry above is the default) -json jPi = 3.14; -assert(jPi.get() == TS_INVALID ); -``` - -Just as in [Arbitrary Type Conversions](#arbitrary-types-conversions) above, -- `NLOHMANN_JSON_SERIALIZE_ENUM()` MUST be declared in your enum type's namespace (which can be the global namespace), or the library will not be able to locate it, and it will default to integer serialization. -- It MUST be available (e.g., proper headers must be included) everywhere you use the conversions. - -Other Important points: -- When using `get()`, undefined JSON values will default to the first pair specified in your map. Select this default pair carefully. -- If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the map will be returned when converting to or from JSON. - -### Binary formats (BSON, CBOR, MessagePack, and UBJSON) - -Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](https://bsonspec.org) (Binary JSON), [CBOR](https://cbor.io) (Concise Binary Object Representation), [MessagePack](https://msgpack.org), and [UBJSON](https://ubjson.org) (Universal Binary JSON Specification) to efficiently encode JSON values to byte vectors and to decode such vectors. - -```cpp -// create a JSON value -json j = R"({"compact": true, "schema": 0})"_json; - -// serialize to BSON -std::vector v_bson = json::to_bson(j); - -// 0x1B, 0x00, 0x00, 0x00, 0x08, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0x00, 0x01, 0x10, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - -// roundtrip -json j_from_bson = json::from_bson(v_bson); - -// serialize to CBOR -std::vector v_cbor = json::to_cbor(j); - -// 0xA2, 0x67, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0xF5, 0x66, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x00 - -// roundtrip -json j_from_cbor = json::from_cbor(v_cbor); - -// serialize to MessagePack -std::vector v_msgpack = json::to_msgpack(j); - -// 0x82, 0xA7, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0xC3, 0xA6, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x00 - -// roundtrip -json j_from_msgpack = json::from_msgpack(v_msgpack); - -// serialize to UBJSON -std::vector v_ubjson = json::to_ubjson(j); - -// 0x7B, 0x69, 0x07, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0x54, 0x69, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x69, 0x00, 0x7D - -// roundtrip -json j_from_ubjson = json::from_ubjson(v_ubjson); -``` - -The library also supports binary types from BSON, CBOR (byte strings), and MessagePack (bin, ext, fixext). They are stored by default as `std::vector` to be processed outside the library. - -```cpp -// CBOR byte string with payload 0xCAFE -std::vector v = {0x42, 0xCA, 0xFE}; - -// read value -json j = json::from_cbor(v); - -// the JSON value has type binary -j.is_binary(); // true - -// get reference to stored binary value -auto& binary = j.get_binary(); - -// the binary value has no subtype (CBOR has no binary subtypes) -binary.has_subtype(); // false - -// access std::vector member functions -binary.size(); // 2 -binary[0]; // 0xCA -binary[1]; // 0xFE - -// set subtype to 0x10 -binary.set_subtype(0x10); - -// serialize to MessagePack -auto cbor = json::to_msgpack(j); // 0xD5 (fixext2), 0x10, 0xCA, 0xFE -``` - - -## Supported compilers - -Though it's 2022 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work: - -- GCC 4.8 - 11.0 (and possibly later) -- Clang 3.4 - 13.0 (and possibly later) -- Apple Clang 9.1 - 13.0 (and possibly later) -- Intel C++ Compiler 17.0.2 (and possibly later) -- Nvidia CUDA Compiler 11.0.221 (and possibly later) -- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later) -- Microsoft Visual C++ 2017 / Build Tools 15.5.180.51428 (and possibly later) -- Microsoft Visual C++ 2019 / Build Tools 16.3.1+1def00d3d (and possibly later) - -I would be happy to learn about other compilers/versions. - -Please note: - -- GCC 4.8 has a bug [57824](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824)): multiline raw strings cannot be the arguments to macros. Don't use multiline raw strings directly in macros with this compiler. -- Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your `Application.mk`. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default. - - ``` - APP_STL := c++_shared - NDK_TOOLCHAIN_VERSION := clang3.6 - APP_CPPFLAGS += -frtti -fexceptions - ``` - - The code compiles successfully with [Android NDK](https://developer.android.com/ndk/index.html?hl=ml), Revision 9 - 11 (and possibly later) and [CrystaX's Android NDK](https://www.crystax.net/en/android/ndk) version 10. - -- For GCC running on MinGW or Android SDK, the error `'to_string' is not a member of 'std'` (or similarly, for `strtod` or `strtof`) may occur. Note this is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to [this site](https://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219). - -- Unsupported versions of GCC and Clang are rejected by `#error` directives. This can be switched off by defining `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`. Note that you can expect no support in this case. - -The following compilers are currently used in continuous integration at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [Drone CI](https://cloud.drone.io/nlohmann/json), and [GitHub Actions](https://github.com/nlohmann/json/actions): - -| Compiler | Operating System | CI Provider | -|--------------------------------------------------------------------------------------------------------|--------------------|----------------| -| Apple Clang 10.0.1 (clang-1001.0.46.4); Xcode 10.3 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 11.0.0 (clang-1100.0.33.12); Xcode 11.2.1 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 11.0.0 (clang-1100.0.33.17); Xcode 11.3.1 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 11.0.3 (clang-1103.0.32.59); Xcode 11.4.1 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.5 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.6 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.7 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 12.0.0 (clang-1200.0.32.2); Xcode 12 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 12.0.0 (clang-1200.0.32.21); Xcode 12.1 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 12.0.0 (clang-1200.0.32.21); Xcode 12.1.1 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 12.0.0 (clang-1200.0.32.27); Xcode 12.2 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 12.0.0 (clang-1200.0.32.28); Xcode 12.3 | macOS 10.15.7 | GitHub Actions | -| Apple Clang 12.0.0 (clang-1200.0.32.29); Xcode 12.4 | macOS 10.15.7 | GitHub Actions | -| GCC 4.8.5 (Ubuntu 4.8.5-4ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 4.9.3 (Ubuntu 4.9.3-13ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 6.4.0 (Ubuntu 6.4.0-17ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 7.5.0 (Ubuntu 7.5.0-6ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) | Windows-10.0.17763 | GitHub Actions | -| GCC 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project) | Windows-10.0.17763 | GitHub Actions | -| GCC 8.4.0 (Ubuntu 8.4.0-3ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 11.0.1 20210321 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions | -| GCC 11.1.0 | Ubuntu (aarch64) | Drone CI | -| Clang 3.5.2 (3.5.2-3ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 3.6.2 (3.6.2-3ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 3.7.1 (3.7.1-2ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 3.8.0 (3.8.0-2ubuntu4) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 3.9.1 (3.9.1-4ubuntu3\~16.04.2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 4.0.0 (4.0.0-1ubuntu1\~16.04.2) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 5.0.0 (5.0.0-3\~16.04.1) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 6.0.1 (6.0.1-14) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 7.0.1 (7.0.1-12) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 8.0.1 (8.0.1-9) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 9.0.1 (9.0.1-12) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 10.0.0 (10.0.0-4ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 10.0.0 with GNU-like command-line | Windows-10.0.17763 | GitHub Actions | -| Clang 11.0.0 with GNU-like command-line | Windows-10.0.17763 | GitHub Actions | -| Clang 11.0.0 with MSVC-like command-line | Windows-10.0.17763 | GitHub Actions | -| Clang 11.0.0 (11.0.0-2~ubuntu20.04.1) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 12.0.0 (12.0.0-3ubuntu1~20.04.3) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 13.0.1 (13.0.1-++20211015123032+cf15ccdeb6d5-1exp120211015003613.5) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 14.0.0 (14.0.0-++20211221052852+55c71c9eac9b-1exp120211221172954.95) | Ubuntu 20.04.3 LTS | GitHub Actions | -| NVCC 11.0.221 | Ubuntu 20.04.3 LTS | GitHub Actions | -| Visual Studio 14 2015 MSVC 19.0.24241.7 (Build Engine version 14.0.25420.1) | Windows-6.3.9600 | AppVeyor | -| Visual Studio 15 2017 MSVC 19.16.27035.0 (Build Engine version 15.9.21+g9802d43bc3 for .NET Framework) | Windows-10.0.14393 | AppVeyor | -| Visual Studio 15 2017 MSVC 19.16.27045.0 (Build Engine version 15.9.21+g9802d43bc3 for .NET Framework) | Windows-10.0.14393 | GitHub Actions | -| Visual Studio 16 2019 MSVC 19.28.29912.0 (Build Engine version 16.9.0+57a23d249 for .NET Framework) | Windows-10.0.17763 | GitHub Actions | -| Visual Studio 16 2019 MSVC 19.28.29912.0 (Build Engine version 16.9.0+57a23d249 for .NET Framework) | Windows-10.0.17763 | AppVeyor | - - -## Integration - -[`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is the single required file in `single_include/nlohmann` or [released here](https://github.com/nlohmann/json/releases). You need to add - -```cpp -#include - -// for convenience -using json = nlohmann::json; -``` - -to the files you want to process JSON and set the necessary switches to enable C++11 (e.g., `-std=c++11` for GCC and Clang). - -You can further use file [`include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/json_fwd.hpp) for forward-declarations. The installation of json_fwd.hpp (as part of cmake's install step), can be achieved by setting `-DJSON_MultipleHeaders=ON`. - -### CMake - -You can also use the `nlohmann_json::nlohmann_json` interface target in CMake. This target populates the appropriate usage requirements for `INTERFACE_INCLUDE_DIRECTORIES` to point to the appropriate include directories and `INTERFACE_COMPILE_FEATURES` for the necessary C++11 flags. - -#### External - -To use this library from a CMake project, you can locate it directly with `find_package()` and use the namespaced imported target from the generated package configuration: - -```cmake -# CMakeLists.txt -find_package(nlohmann_json 3.2.0 REQUIRED) -... -add_library(foo ...) -... -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` - -The package configuration file, `nlohmann_jsonConfig.cmake`, can be used either from an install tree or directly out of the build tree. - -#### Embedded - -To embed the library directly into an existing CMake project, place the entire source tree in a subdirectory and call `add_subdirectory()` in your `CMakeLists.txt` file: - -```cmake -# Typically you don't care so much for a third party library's tests to be -# run from your own project's code. -set(JSON_BuildTests OFF CACHE INTERNAL "") - -# If you only include this third party in PRIVATE source files, you do not -# need to install it when your main project gets installed. -# set(JSON_Install OFF CACHE INTERNAL "") - -# Don't use include(nlohmann_json/CMakeLists.txt) since that carries with it -# unintended consequences that will break the build. It's generally -# discouraged (although not necessarily well documented as such) to use -# include(...) for pulling in other CMake projects anyways. -add_subdirectory(nlohmann_json) -... -add_library(foo ...) -... -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` - -##### Embedded (FetchContent) - -Since CMake v3.11, -[FetchContent](https://cmake.org/cmake/help/v3.11/module/FetchContent.html) can -be used to automatically download the repository as a dependency at configure time. - -Example: -```cmake -include(FetchContent) - -FetchContent_Declare(json - GIT_REPOSITORY https://github.com/nlohmann/json.git - GIT_TAG v3.7.3) - -FetchContent_GetProperties(json) -if(NOT json_POPULATED) - FetchContent_Populate(json) - add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) -endif() - -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` - -**Note**: The repository https://github.com/nlohmann/json download size is huge. -It contains all the dataset used for the benchmarks. You might want to depend on -a smaller repository. For instance, you might want to replace the URL above by -https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent - -#### Supporting Both - -To allow your project to support either an externally supplied or an embedded JSON library, you can use a pattern akin to the following: - -``` cmake -# Top level CMakeLists.txt -project(FOO) -... -option(FOO_USE_EXTERNAL_JSON "Use an external JSON library" OFF) -... -add_subdirectory(thirdparty) -... -add_library(foo ...) -... -# Note that the namespaced target will always be available regardless of the -# import method -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` -```cmake -# thirdparty/CMakeLists.txt -... -if(FOO_USE_EXTERNAL_JSON) - find_package(nlohmann_json 3.2.0 REQUIRED) -else() - set(JSON_BuildTests OFF CACHE INTERNAL "") - add_subdirectory(nlohmann_json) -endif() -... -``` - -`thirdparty/nlohmann_json` is then a complete copy of this source tree. - -### Package Managers - -:beer: If you are using OS X and [Homebrew](https://brew.sh), just type `brew install nlohmann-json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann-json --HEAD`. See [nlohmann-json](https://formulae.brew.sh/formula/nlohmann-json) for more information. - -If you are using the [Meson Build System](https://mesonbuild.com), add this source tree as a [meson subproject](https://mesonbuild.com/Subprojects.html#using-a-subproject). You may also use the `include.zip` published in this project's [Releases](https://github.com/nlohmann/json/releases) to reduce the size of the vendored source tree. Alternatively, you can get a wrap file by downloading it from [Meson WrapDB](https://wrapdb.mesonbuild.com/nlohmann_json), or simply use `meson wrap install nlohmann_json`. Please see the meson project for any issues regarding the packaging. - -The provided `meson.build` can also be used as an alternative to cmake for installing `nlohmann_json` system-wide in which case a pkg-config file is installed. To use it, simply have your build system require the `nlohmann_json` pkg-config dependency. In Meson, it is preferred to use the [`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a subproject fallback, rather than using the subproject directly. - -If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add [`nlohmann_json/x.y.z`](https://conan.io/center/nlohmann_json) to your `conanfile`'s requires, where `x.y.z` is the release version you want to use. Please file issues [here](https://github.com/conan-io/conan-center-index/issues) if you experience problems with the packages. - -If you are using [Spack](https://www.spack.io/) to manage your dependencies, you can use the [`nlohmann-json` package](https://spack.readthedocs.io/en/latest/package_list.html#nlohmann-json). Please see the [spack project](https://github.com/spack/spack) for any issues regarding the packaging. - -If you are using [hunter](https://github.com/cpp-pm/hunter) on your project for external dependencies, then you can use the [nlohmann_json package](https://hunter.readthedocs.io/en/latest/packages/pkg/nlohmann_json.html). Please see the hunter project for any issues regarding the packaging. - -If you are using [Buckaroo](https://buckaroo.pm), you can install this library's module with `buckaroo add github.com/buckaroo-pm/nlohmann-json`. Please file issues [here](https://github.com/buckaroo-pm/nlohmann-json). There is a demo repo [here](https://github.com/njlr/buckaroo-nholmann-json-example). - -If you are using [vcpkg](https://github.com/Microsoft/vcpkg/) on your project for external dependencies, then you can install the [nlohmann-json package](https://github.com/Microsoft/vcpkg/tree/master/ports/nlohmann-json) with `vcpkg install nlohmann-json` and follow the then displayed descriptions. Please see the vcpkg project for any issues regarding the packaging. - -If you are using [cget](https://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install nlohmann/json`. A specific version can be installed with `cget install nlohmann/json@v3.1.0`. Also, the multiple header version can be installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nlohmann/json -DJSON_MultipleHeaders=ON`). - -If you are using [CocoaPods](https://cocoapods.org), you can use the library by adding pod `"nlohmann_json", '~>3.1.2'` to your podfile (see [an example](https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/)). Please file issues [here](https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open). - -If you are using [NuGet](https://www.nuget.org), you can use the package [nlohmann.json](https://www.nuget.org/packages/nlohmann.json/). Please check [this extensive description](https://github.com/nlohmann/json/issues/1132#issuecomment-452250255) on how to use the package. Please file issues [here](https://github.com/hnkb/nlohmann-json-nuget/issues). - -If you are using [conda](https://conda.io/), you can use the package [nlohmann_json](https://github.com/conda-forge/nlohmann_json-feedstock) from [conda-forge](https://conda-forge.org) executing `conda install -c conda-forge nlohmann_json`. Please file issues [here](https://github.com/conda-forge/nlohmann_json-feedstock/issues). - -If you are using [MSYS2](https://www.msys2.org/), you can use the [mingw-w64-nlohmann-json](https://packages.msys2.org/base/mingw-w64-nlohmann-json) package, just type `pacman -S mingw-w64-i686-nlohmann-json` or `pacman -S mingw-w64-x86_64-nlohmann-json` for installation. Please file issues [here](https://github.com/msys2/MINGW-packages/issues/new?title=%5Bnlohmann-json%5D) if you experience problems with the packages. - -If you are using [MacPorts](https://ports.macports.org), execute `sudo port install nlohmann-json` to install the [nlohmann-json](https://ports.macports.org/port/nlohmann-json/) package. - -If you are using [`build2`](https://build2.org), you can use the [`nlohmann-json`](https://cppget.org/nlohmann-json) package from the public repository https://cppget.org or directly from the [package's sources repository](https://github.com/build2-packaging/nlohmann-json). In your project's `manifest` file, just add `depends: nlohmann-json` (probably with some [version constraints](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps)). If you are not familiar with using dependencies in `build2`, [please read this introduction](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml). -Please file issues [here](https://github.com/build2-packaging/nlohmann-json) if you experience problems with the packages. - -If you are using [`wsjcpp`](https://wsjcpp.org), you can use the command `wsjcpp install "https://github.com/nlohmann/json:develop"` to get the latest version. Note you can change the branch ":develop" to an existing tag or another branch. - -If you are using [`CPM.cmake`](https://github.com/TheLartians/CPM.cmake), you can check this [`example`](https://github.com/TheLartians/CPM.cmake/tree/master/examples/json). After [adding CPM script](https://github.com/TheLartians/CPM.cmake#adding-cpm) to your project, implement the following snippet to your CMake: - -```cmake -CPMAddPackage( - NAME nlohmann_json - GITHUB_REPOSITORY nlohmann/json - VERSION 3.9.1) -``` - -### Pkg-config - -If you are using bare Makefiles, you can use `pkg-config` to generate the include flags that point to where the library is installed: - -```sh -pkg-config nlohmann_json --cflags -``` - -Users of the Meson build system will also be able to use a system-wide library, which will be found by `pkg-config`: - -```meson -json = dependency('nlohmann_json', required: true) -``` - - -## License - - - -The class is licensed under the [MIT License](https://opensource.org/licenses/MIT): - -Copyright © 2013-2022 [Niels Lohmann](https://nlohmann.me) - -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. - -* * * - -The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the [MIT License](https://opensource.org/licenses/MIT) (see above). Copyright © 2008-2009 [Björn Hoehrmann](https://bjoern.hoehrmann.de/) - -The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](https://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](https://florian.loitsch.com/) - -The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/). - -The class contains parts of [Google Abseil](https://github.com/abseil/abseil-cpp) which is licensed under the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0). - -## Contact - -If you have questions regarding the library, I would like to invite you to [open an issue at GitHub](https://github.com/nlohmann/json/issues/new/choose). Please describe your request, problem, or question as detailed as possible, and also mention the version of the library you are using as well as the version of your compiler and operating system. Opening an issue at GitHub allows other users and contributors to this library to collaborate. For instance, I have little experience with MSVC, and most issues in this regard have been solved by a growing community. If you have a look at the [closed issues](https://github.com/nlohmann/json/issues?q=is%3Aissue+is%3Aclosed), you will see that we react quite timely in most cases. - -Only if your request would contain confidential information, please [send me an email](mailto:mail@nlohmann.me). For encrypted messages, please use [this key](https://keybase.io/nlohmann/pgp_keys.asc). - -## Security - -[Commits by Niels Lohmann](https://github.com/nlohmann/json/commits) and [releases](https://github.com/nlohmann/json/releases) are signed with this [PGP Key](https://keybase.io/nlohmann/pgp_keys.asc?fingerprint=797167ae41c0a6d9232e48457f3cea63ae251b69). - -## Thanks - -I deeply appreciate the help of the following people. - - - -- [Teemperor](https://github.com/Teemperor) implemented CMake support and lcov integration, realized escape and Unicode handling in the string parser, and fixed the JSON serialization. -- [elliotgoodrich](https://github.com/elliotgoodrich) fixed an issue with double deletion in the iterator classes. -- [kirkshoop](https://github.com/kirkshoop) made the iterators of the class composable to other libraries. -- [wancw](https://github.com/wanwc) fixed a bug that hindered the class to compile with Clang. -- Tomas Åblad found a bug in the iterator implementation. -- [Joshua C. Randall](https://github.com/jrandall) fixed a bug in the floating-point serialization. -- [Aaron Burghardt](https://github.com/aburgh) implemented code to parse streams incrementally. Furthermore, he greatly improved the parser class by allowing the definition of a filter function to discard undesired elements while parsing. -- [Daniel Kopeček](https://github.com/dkopecek) fixed a bug in the compilation with GCC 5.0. -- [Florian Weber](https://github.com/Florianjw) fixed a bug in and improved the performance of the comparison operators. -- [Eric Cornelius](https://github.com/EricMCornelius) pointed out a bug in the handling with NaN and infinity values. He also improved the performance of the string escaping. -- [易思龙](https://github.com/likebeta) implemented a conversion from anonymous enums. -- [kepkin](https://github.com/kepkin) patiently pushed forward the support for Microsoft Visual studio. -- [gregmarr](https://github.com/gregmarr) simplified the implementation of reverse iterators and helped with numerous hints and improvements. In particular, he pushed forward the implementation of user-defined types. -- [Caio Luppi](https://github.com/caiovlp) fixed a bug in the Unicode handling. -- [dariomt](https://github.com/dariomt) fixed some typos in the examples. -- [Daniel Frey](https://github.com/d-frey) cleaned up some pointers and implemented exception-safe memory allocation. -- [Colin Hirsch](https://github.com/ColinH) took care of a small namespace issue. -- [Huu Nguyen](https://github.com/whoshuu) correct a variable name in the documentation. -- [Silverweed](https://github.com/silverweed) overloaded `parse()` to accept an rvalue reference. -- [dariomt](https://github.com/dariomt) fixed a subtlety in MSVC type support and implemented the `get_ref()` function to get a reference to stored values. -- [ZahlGraf](https://github.com/ZahlGraf) added a workaround that allows compilation using Android NDK. -- [whackashoe](https://github.com/whackashoe) replaced a function that was marked as unsafe by Visual Studio. -- [406345](https://github.com/406345) fixed two small warnings. -- [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function. -- [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines. -- [twelsby](https://github.com/twelsby) fixed the array subscript operator, an issue that failed the MSVC build, and floating-point parsing/dumping. He further added support for unsigned integer numbers and implemented better roundtrip support for parsed numbers. -- [Volker Diels-Grabsch](https://github.com/vog) fixed a link in the README file. -- [msm-](https://github.com/msm-) added support for American Fuzzy Lop. -- [Annihil](https://github.com/Annihil) fixed an example in the README file. -- [Themercee](https://github.com/Themercee) noted a wrong URL in the README file. -- [Lv Zheng](https://github.com/lv-zheng) fixed a namespace issue with `int64_t` and `uint64_t`. -- [abc100m](https://github.com/abc100m) analyzed the issues with GCC 4.8 and proposed a [partial solution](https://github.com/nlohmann/json/pull/212). -- [zewt](https://github.com/zewt) added useful notes to the README file about Android. -- [Róbert Márki](https://github.com/robertmrk) added a fix to use move iterators and improved the integration via CMake. -- [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files. -- [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal). -- [Mário Feroldi](https://github.com/thelostt) fixed a small typo. -- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release. -- [Damien](https://github.com/dtoma) fixed one of the last conversion warnings. -- [Thomas Braun](https://github.com/t-b) fixed a warning in a test case and adjusted MSVC calls in the CI. -- [Théo DELRIEU](https://github.com/theodelrieu) patiently and constructively oversaw the long way toward [iterator-range parsing](https://github.com/nlohmann/json/issues/290). He also implemented the magic behind the serialization/deserialization of user-defined types and split the single header file into smaller chunks. -- [Stefan](https://github.com/5tefan) fixed a minor issue in the documentation. -- [Vasil Dimov](https://github.com/vasild) fixed the documentation regarding conversions from `std::multiset`. -- [ChristophJud](https://github.com/ChristophJud) overworked the CMake files to ease project inclusion. -- [Vladimir Petrigo](https://github.com/vpetrigo) made a SFINAE hack more readable and added Visual Studio 17 to the build matrix. -- [Denis Andrejew](https://github.com/seeekr) fixed a grammar issue in the README file. -- [Pierre-Antoine Lacaze](https://github.com/palacaze) found a subtle bug in the `dump()` function. -- [TurpentineDistillery](https://github.com/TurpentineDistillery) pointed to [`std::locale::classic()`](https://en.cppreference.com/w/cpp/locale/locale/classic) to avoid too much locale joggling, found some nice performance improvements in the parser, improved the benchmarking code, and realized locale-independent number parsing and printing. -- [cgzones](https://github.com/cgzones) had an idea how to fix the Coverity scan. -- [Jared Grubb](https://github.com/jaredgrubb) silenced a nasty documentation warning. -- [Yixin Zhang](https://github.com/qwename) fixed an integer overflow check. -- [Bosswestfalen](https://github.com/Bosswestfalen) merged two iterator classes into a smaller one. -- [Daniel599](https://github.com/Daniel599) helped to get Travis execute the tests with Clang's sanitizers. -- [Jonathan Lee](https://github.com/vjon) fixed an example in the README file. -- [gnzlbg](https://github.com/gnzlbg) supported the implementation of user-defined types. -- [Alexej Harm](https://github.com/qis) helped to get the user-defined types working with Visual Studio. -- [Jared Grubb](https://github.com/jaredgrubb) supported the implementation of user-defined types. -- [EnricoBilla](https://github.com/EnricoBilla) noted a typo in an example. -- [Martin Hořeňovský](https://github.com/horenmar) found a way for a 2x speedup for the compilation time of the test suite. -- [ukhegg](https://github.com/ukhegg) found proposed an improvement for the examples section. -- [rswanson-ihi](https://github.com/rswanson-ihi) noted a typo in the README. -- [Mihai Stan](https://github.com/stanmihai4) fixed a bug in the comparison with `nullptr`s. -- [Tushar Maheshwari](https://github.com/tusharpm) added [cotire](https://github.com/sakra/cotire) support to speed up the compilation. -- [TedLyngmo](https://github.com/TedLyngmo) noted a typo in the README, removed unnecessary bit arithmetic, and fixed some `-Weffc++` warnings. -- [Krzysztof Woś](https://github.com/krzysztofwos) made exceptions more visible. -- [ftillier](https://github.com/ftillier) fixed a compiler warning. -- [tinloaf](https://github.com/tinloaf) made sure all pushed warnings are properly popped. -- [Fytch](https://github.com/Fytch) found a bug in the documentation. -- [Jay Sistar](https://github.com/Type1J) implemented a Meson build description. -- [Henry Lee](https://github.com/HenryRLee) fixed a warning in ICC and improved the iterator implementation. -- [Vincent Thiery](https://github.com/vthiery) maintains a package for the Conan package manager. -- [Steffen](https://github.com/koemeet) fixed a potential issue with MSVC and `std::min`. -- [Mike Tzou](https://github.com/Chocobo1) fixed some typos. -- [amrcode](https://github.com/amrcode) noted a misleading documentation about comparison of floats. -- [Oleg Endo](https://github.com/olegendo) reduced the memory consumption by replacing `` with ``. -- [dan-42](https://github.com/dan-42) cleaned up the CMake files to simplify including/reusing of the library. -- [Nikita Ofitserov](https://github.com/himikof) allowed for moving values from initializer lists. -- [Greg Hurrell](https://github.com/wincent) fixed a typo. -- [Dmitry Kukovinets](https://github.com/DmitryKuk) fixed a typo. -- [kbthomp1](https://github.com/kbthomp1) fixed an issue related to the Intel OSX compiler. -- [Markus Werle](https://github.com/daixtrose) fixed a typo. -- [WebProdPP](https://github.com/WebProdPP) fixed a subtle error in a precondition check. -- [Alex](https://github.com/leha-bot) noted an error in a code sample. -- [Tom de Geus](https://github.com/tdegeus) reported some warnings with ICC and helped to fix them. -- [Perry Kundert](https://github.com/pjkundert) simplified reading from input streams. -- [Sonu Lohani](https://github.com/sonulohani) fixed a small compilation error. -- [Jamie Seward](https://github.com/jseward) fixed all MSVC warnings. -- [Nate Vargas](https://github.com/eld00d) added a Doxygen tag file. -- [pvleuven](https://github.com/pvleuven) helped to fix a warning in ICC. -- [Pavel](https://github.com/crea7or) helped to fix some warnings in MSVC. -- [Jamie Seward](https://github.com/jseward) avoided unnecessary string copies in `find()` and `count()`. -- [Mitja](https://github.com/Itja) fixed some typos. -- [Jorrit Wronski](https://github.com/jowr) updated the Hunter package links. -- [Matthias Möller](https://github.com/TinyTinni) added a `.natvis` for the MSVC debug view. -- [bogemic](https://github.com/bogemic) fixed some C++17 deprecation warnings. -- [Eren Okka](https://github.com/erengy) fixed some MSVC warnings. -- [abolz](https://github.com/abolz) integrated the Grisu2 algorithm for proper floating-point formatting, allowing more roundtrip checks to succeed. -- [Vadim Evard](https://github.com/Pipeliner) fixed a Markdown issue in the README. -- [zerodefect](https://github.com/zerodefect) fixed a compiler warning. -- [Kert](https://github.com/kaidokert) allowed to template the string type in the serialization and added the possibility to override the exceptional behavior. -- [mark-99](https://github.com/mark-99) helped fixing an ICC error. -- [Patrik Huber](https://github.com/patrikhuber) fixed links in the README file. -- [johnfb](https://github.com/johnfb) found a bug in the implementation of CBOR's indefinite length strings. -- [Paul Fultz II](https://github.com/pfultz2) added a note on the cget package manager. -- [Wilson Lin](https://github.com/wla80) made the integration section of the README more concise. -- [RalfBielig](https://github.com/ralfbielig) detected and fixed a memory leak in the parser callback. -- [agrianius](https://github.com/agrianius) allowed to dump JSON to an alternative string type. -- [Kevin Tonon](https://github.com/ktonon) overworked the C++11 compiler checks in CMake. -- [Axel Huebl](https://github.com/ax3l) simplified a CMake check and added support for the [Spack package manager](https://spack.io). -- [Carlos O'Ryan](https://github.com/coryan) fixed a typo. -- [James Upjohn](https://github.com/jammehcow) fixed a version number in the compilers section. -- [Chuck Atkins](https://github.com/chuckatkins) adjusted the CMake files to the CMake packaging guidelines and provided documentation for the CMake integration. -- [Jan Schöppach](https://github.com/dns13) fixed a typo. -- [martin-mfg](https://github.com/martin-mfg) fixed a typo. -- [Matthias Möller](https://github.com/TinyTinni) removed the dependency from `std::stringstream`. -- [agrianius](https://github.com/agrianius) added code to use alternative string implementations. -- [Daniel599](https://github.com/Daniel599) allowed to use more algorithms with the `items()` function. -- [Julius Rakow](https://github.com/jrakow) fixed the Meson include directory and fixed the links to [cppreference.com](cppreference.com). -- [Sonu Lohani](https://github.com/sonulohani) fixed the compilation with MSVC 2015 in debug mode. -- [grembo](https://github.com/grembo) fixed the test suite and re-enabled several test cases. -- [Hyeon Kim](https://github.com/simnalamburt) introduced the macro `JSON_INTERNAL_CATCH` to control the exception handling inside the library. -- [thyu](https://github.com/thyu) fixed a compiler warning. -- [David Guthrie](https://github.com/LEgregius) fixed a subtle compilation error with Clang 3.4.2. -- [Dennis Fischer](https://github.com/dennisfischer) allowed to call `find_package` without installing the library. -- [Hyeon Kim](https://github.com/simnalamburt) fixed an issue with a double macro definition. -- [Ben Berman](https://github.com/rivertam) made some error messages more understandable. -- [zakalibit](https://github.com/zakalibit) fixed a compilation problem with the Intel C++ compiler. -- [mandreyel](https://github.com/mandreyel) fixed a compilation problem. -- [Kostiantyn Ponomarenko](https://github.com/koponomarenko) added version and license information to the Meson build file. -- [Henry Schreiner](https://github.com/henryiii) added support for GCC 4.8. -- [knilch](https://github.com/knilch0r) made sure the test suite does not stall when run in the wrong directory. -- [Antonio Borondo](https://github.com/antonioborondo) fixed an MSVC 2017 warning. -- [Dan Gendreau](https://github.com/dgendreau) implemented the `NLOHMANN_JSON_SERIALIZE_ENUM` macro to quickly define an enum/JSON mapping. -- [efp](https://github.com/efp) added line and column information to parse errors. -- [julian-becker](https://github.com/julian-becker) added BSON support. -- [Pratik Chowdhury](https://github.com/pratikpc) added support for structured bindings. -- [David Avedissian](https://github.com/davedissian) added support for Clang 5.0.1 (PS4 version). -- [Jonathan Dumaresq](https://github.com/dumarjo) implemented an input adapter to read from `FILE*`. -- [kjpus](https://github.com/kjpus) fixed a link in the documentation. -- [Manvendra Singh](https://github.com/manu-chroma) fixed a typo in the documentation. -- [ziggurat29](https://github.com/ziggurat29) fixed an MSVC warning. -- [Sylvain Corlay](https://github.com/SylvainCorlay) added code to avoid an issue with MSVC. -- [mefyl](https://github.com/mefyl) fixed a bug when JSON was parsed from an input stream. -- [Millian Poquet](https://github.com/mpoquet) allowed to install the library via Meson. -- [Michael Behrns-Miller](https://github.com/moodboom) found an issue with a missing namespace. -- [Nasztanovics Ferenc](https://github.com/naszta) fixed a compilation issue with libc 2.12. -- [Andreas Schwab](https://github.com/andreas-schwab) fixed the endian conversion. -- [Mark-Dunning](https://github.com/Mark-Dunning) fixed a warning in MSVC. -- [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) added `operator/` for JSON Pointers. -- [John-Mark](https://github.com/johnmarkwayve) noted a missing header. -- [Vitaly Zaitsev](https://github.com/xvitaly) fixed compilation with GCC 9.0. -- [Laurent Stacul](https://github.com/stac47) fixed compilation with GCC 9.0. -- [Ivor Wanders](https://github.com/iwanders) helped to reduce the CMake requirement to version 3.1. -- [njlr](https://github.com/njlr) updated the Buckaroo instructions. -- [Lion](https://github.com/lieff) fixed a compilation issue with GCC 7 on CentOS. -- [Isaac Nickaein](https://github.com/nickaein) improved the integer serialization performance and implemented the `contains()` function. -- [past-due](https://github.com/past-due) suppressed an unfixable warning. -- [Elvis Oric](https://github.com/elvisoric) improved Meson support. -- [Matěj Plch](https://github.com/Afforix) fixed an example in the README. -- [Mark Beckwith](https://github.com/wythe) fixed a typo. -- [scinart](https://github.com/scinart) fixed bug in the serializer. -- [Patrick Boettcher](https://github.com/pboettch) implemented `push_back()` and `pop_back()` for JSON Pointers. -- [Bruno Oliveira](https://github.com/nicoddemus) added support for Conda. -- [Michele Caini](https://github.com/skypjack) fixed links in the README. -- [Hani](https://github.com/hnkb) documented how to install the library with NuGet. -- [Mark Beckwith](https://github.com/wythe) fixed a typo. -- [yann-morin-1998](https://github.com/yann-morin-1998) helped to reduce the CMake requirement to version 3.1. -- [Konstantin Podsvirov](https://github.com/podsvirov) maintains a package for the MSYS2 software distro. -- [remyabel](https://github.com/remyabel) added GNUInstallDirs to the CMake files. -- [Taylor Howard](https://github.com/taylorhoward92) fixed a unit test. -- [Gabe Ron](https://github.com/Macr0Nerd) implemented the `to_string` method. -- [Watal M. Iwasaki](https://github.com/heavywatal) fixed a Clang warning. -- [Viktor Kirilov](https://github.com/onqtam) switched the unit tests from [Catch](https://github.com/philsquared/Catch) to [doctest](https://github.com/onqtam/doctest) -- [Juncheng E](https://github.com/ejcjason) fixed a typo. -- [tete17](https://github.com/tete17) fixed a bug in the `contains` function. -- [Xav83](https://github.com/Xav83) fixed some cppcheck warnings. -- [0xflotus](https://github.com/0xflotus) fixed some typos. -- [Christian Deneke](https://github.com/chris0x44) added a const version of `json_pointer::back`. -- [Julien Hamaide](https://github.com/crazyjul) made the `items()` function work with custom string types. -- [Evan Nemerson](https://github.com/nemequ) updated fixed a bug in Hedley and updated this library accordingly. -- [Florian Pigorsch](https://github.com/flopp) fixed a lot of typos. -- [Camille Bégué](https://github.com/cbegue) fixed an issue in the conversion from `std::pair` and `std::tuple` to `json`. -- [Anthony VH](https://github.com/AnthonyVH) fixed a compile error in an enum deserialization. -- [Yuriy Vountesmery](https://github.com/ua-code-dragon) noted a subtle bug in a preprocessor check. -- [Chen](https://github.com/dota17) fixed numerous issues in the library. -- [Antony Kellermann](https://github.com/aokellermann) added a CI step for GCC 10.1. -- [Alex](https://github.com/gistrec) fixed an MSVC warning. -- [Rainer](https://github.com/rvjr) proposed an improvement in the floating-point serialization in CBOR. -- [Francois Chabot](https://github.com/FrancoisChabot) made performance improvements in the input adapters. -- [Arthur Sonzogni](https://github.com/ArthurSonzogni) documented how the library can be included via `FetchContent`. -- [Rimas Misevičius](https://github.com/rmisev) fixed an error message. -- [Alexander Myasnikov](https://github.com/alexandermyasnikov) fixed some examples and a link in the README. -- [Hubert Chathi](https://github.com/uhoreg) made CMake's version config file architecture-independent. -- [OmnipotentEntity](https://github.com/OmnipotentEntity) implemented the binary values for CBOR, MessagePack, BSON, and UBJSON. -- [ArtemSarmini](https://github.com/ArtemSarmini) fixed a compilation issue with GCC 10 and fixed a leak. -- [Evgenii Sopov](https://github.com/sea-kg) integrated the library to the wsjcpp package manager. -- [Sergey Linev](https://github.com/linev) fixed a compiler warning. -- [Miguel Magalhães](https://github.com/magamig) fixed the year in the copyright. -- [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) fixed a compilation issue with MSVC. -- [Alexander “weej” Jones](https://github.com/alex-weej) fixed an example in the README. -- [Antoine Cœur](https://github.com/Coeur) fixed some typos in the documentation. -- [jothepro](https://github.com/jothepro) updated links to the Hunter package. -- [Dave Lee](https://github.com/kastiglione) fixed link in the README. -- [Joël Lamotte](https://github.com/Klaim) added instruction for using Build2's package manager. -- [Paul Jurczak](https://github.com/pauljurczak) fixed an example in the README. -- [Sonu Lohani](https://github.com/sonulohani) fixed a warning. -- [Carlos Gomes Martinho](https://github.com/gocarlos) updated the Conan package source. -- [Konstantin Podsvirov](https://github.com/podsvirov) fixed the MSYS2 package documentation. -- [Tridacnid](https://github.com/Tridacnid) improved the CMake tests. -- [Michael](https://github.com/MBalszun) fixed MSVC warnings. -- [Quentin Barbarat](https://github.com/quentin-dev) fixed an example in the documentation. -- [XyFreak](https://github.com/XyFreak) fixed a compiler warning. -- [TotalCaesar659](https://github.com/TotalCaesar659) fixed links in the README. -- [Tanuj Garg](https://github.com/tanuj208) improved the fuzzer coverage for UBSAN input. -- [AODQ](https://github.com/AODQ) fixed a compiler warning. -- [jwittbrodt](https://github.com/jwittbrodt) made `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE` inline. -- [pfeatherstone](https://github.com/pfeatherstone) improved the upper bound of arguments of the `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`/`NLOHMANN_DEFINE_TYPE_INTRUSIVE` macros. -- [Jan Procházka](https://github.com/jprochazk) fixed a bug in the CBOR parser for binary and string values. -- [T0b1-iOS](https://github.com/T0b1-iOS) fixed a bug in the new hash implementation. -- [Matthew Bauer](https://github.com/matthewbauer) adjusted the CBOR writer to create tags for binary subtypes. -- [gatopeich](https://github.com/gatopeich) implemented an ordered map container for `nlohmann::ordered_json`. -- [Érico Nogueira Rolim](https://github.com/ericonr) added support for pkg-config. -- [KonanM](https://github.com/KonanM) proposed an implementation for the `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`/`NLOHMANN_DEFINE_TYPE_INTRUSIVE` macros. -- [Guillaume Racicot](https://github.com/gracicot) implemented `string_view` support and allowed C++20 support. -- [Alex Reinking](https://github.com/alexreinking) improved CMake support for `FetchContent`. -- [Hannes Domani](https://github.com/ssbssa) provided a GDB pretty printer. -- Lars Wirzenius reviewed the README file. -- [Jun Jie](https://github.com/ongjunjie) fixed a compiler path in the CMake scripts. -- [Ronak Buch](https://github.com/rbuch) fixed typos in the documentation. -- [Alexander Karzhenkov](https://github.com/karzhenkov) fixed a move constructor and the Travis builds. -- [Leonardo Lima](https://github.com/leozz37) added CPM.Cmake support. -- [Joseph Blackman](https://github.com/jbzdarkid) fixed a warning. -- [Yaroslav](https://github.com/YarikTH) updated doctest and implemented unit tests. -- [Martin Stump](https://github.com/globberwops) fixed a bug in the CMake files. -- [Jaakko Moisio](https://github.com/jasujm) fixed a bug in the input adapters. -- [bl-ue](https://github.com/bl-ue) fixed some Markdown issues in the README file. -- [William A. Wieselquist](https://github.com/wawiesel) fixed an example from the README. -- [abbaswasim](https://github.com/abbaswasim) fixed an example from the README. -- [Remy Jette](https://github.com/remyjette) fixed a warning. -- [Fraser](https://github.com/frasermarlow) fixed the documentation. -- [Ben Beasley](https://github.com/musicinmybrain) updated doctest. -- [Doron Behar](https://github.com/doronbehar) fixed pkg-config.pc. -- [raduteo](https://github.com/raduteo) fixed a warning. -- [David Pfahler](https://github.com/theShmoo) added the possibility to compile the library without I/O support. -- [Morten Fyhn Amundsen](https://github.com/mortenfyhn) fixed a typo. -- [jpl-mac](https://github.com/jpl-mac) allowed to treat the library as a system header in CMake. -- [Jason Dsouza](https://github.com/jasmcaus) fixed the indentation of the CMake file. -- [offa](https://github.com/offa) added a link to Conan Center to the documentation. -- [TotalCaesar659](https://github.com/TotalCaesar659) updated the links in the documentation to use HTTPS. -- [Rafail Giavrimis](https://github.com/grafail) fixed the Google Benchmark default branch. -- [Louis Dionne](https://github.com/ldionne) fixed a conversion operator. -- [justanotheranonymoususer](https://github.com/justanotheranonymoususer) made the examples in the README more consistent. -- [Finkman](https://github.com/Finkman) suppressed some `-Wfloat-equal` warnings. -- [Ferry Huberts](https://github.com/fhuberts) fixed `-Wswitch-enum` warnings. -- [Arseniy Terekhin](https://github.com/senyai) made the GDB pretty-printer robust against unset variable names. -- [Amir Masoud Abdol](https://github.com/amirmasoudabdol) updated the Homebrew command as nlohmann/json is now in homebrew-core. -- [Hallot](https://github.com/Hallot) fixed some `-Wextra-semi-stmt warnings`. -- [Giovanni Cerretani](https://github.com/gcerretani) fixed `-Wunused` warnings on `JSON_DIAGNOSTICS`. -- [Bogdan Popescu](https://github.com/Kapeli) hosts the [docset](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B) for offline documentation viewers. -- [Carl Smedstad](https://github.com/carlsmedstad) fixed an assertion error when using `JSON_DIAGNOSTICS`. -- [miikka75](https://github.com/miikka75) provided an important fix to compile C++17 code with Clang 9. -- [Maarten Becker](https://github.com/kernie) fixed a warning for shadowed variables. -- [Cristi Vîjdea](https://github.com/axnsan12) fixed typos in the `operator[]` documentation. -- [Alex Beregszaszi](https://github.com/axic) fixed spelling mistakes in comments. -- [Dirk Stolle](https://github.com/striezel) fixed typos in documentation. -- [Daniel Albuschat](https://github.com/daniel-kun) corrected the parameter name in the `parse` documentation. -- [Prince Mendiratta](https://github.com/Prince-Mendiratta) fixed a link to the FAQ. - -Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone. - - -## Used third-party tools - -The library itself consists of a single header file licensed under the MIT license. However, it is built, tested, documented, and whatnot using a lot of third-party tools and services. Thanks a lot! - -- [**amalgamate.py - Amalgamate C source and header files**](https://github.com/edlund/amalgamate) to create a single header file -- [**American fuzzy lop**](https://lcamtuf.coredump.cx/afl/) for fuzz testing -- [**AppVeyor**](https://www.appveyor.com) for [continuous integration](https://ci.appveyor.com/project/nlohmann/json) on Windows -- [**Artistic Style**](http://astyle.sourceforge.net) for automatic source code indentation -- [**Clang**](https://clang.llvm.org) for compilation with code sanitizers -- [**CMake**](https://cmake.org) for build automation -- [**Codacity**](https://www.codacy.com) for further [code analysis](https://www.codacy.com/app/nlohmann/json) -- [**Coveralls**](https://coveralls.io) to measure [code coverage](https://coveralls.io/github/nlohmann/json) -- [**Coverity Scan**](https://scan.coverity.com) for [static analysis](https://scan.coverity.com/projects/nlohmann-json) -- [**cppcheck**](http://cppcheck.sourceforge.net) for static analysis -- [**doctest**](https://github.com/onqtam/doctest) for the unit tests -- [**Doxygen**](https://www.doxygen.nl/index.html) to generate [documentation](https://nlohmann.github.io/json/doxygen/index.html) -- [**git-update-ghpages**](https://github.com/rstacruz/git-update-ghpages) to upload the documentation to gh-pages -- [**GitHub Changelog Generator**](https://github.com/skywinder/github-changelog-generator) to generate the [ChangeLog](https://github.com/nlohmann/json/blob/develop/ChangeLog.md) -- [**Google Benchmark**](https://github.com/google/benchmark) to implement the benchmarks -- [**Hedley**](https://nemequ.github.io/hedley/) to avoid re-inventing several compiler-agnostic feature macros -- [**lcov**](http://ltp.sourceforge.net/coverage/lcov.php) to process coverage information and create an HTML view -- [**libFuzzer**](https://llvm.org/docs/LibFuzzer.html) to implement fuzz testing for OSS-Fuzz -- [**OSS-Fuzz**](https://github.com/google/oss-fuzz) for continuous fuzz testing of the library ([project repository](https://github.com/google/oss-fuzz/tree/master/projects/json)) -- [**Probot**](https://probot.github.io) for automating maintainer tasks such as closing stale issues, requesting missing information, or detecting toxic comments. -- [**Valgrind**](https://valgrind.org) to check for correct memory management - - -## Projects using JSON for Modern C++ - -The library is currently used in Apple macOS Sierra and iOS 10. I am not sure what they are using the library for, but I am happy that it runs on so many devices. - - -## Notes - -### Character encoding - -The library supports **Unicode input** as follows: - -- Only **UTF-8** encoded input is supported which is the default encoding for JSON according to [RFC 8259](https://tools.ietf.org/html/rfc8259.html#section-8.1). -- `std::u16string` and `std::u32string` can be parsed, assuming UTF-16 and UTF-32 encoding, respectively. These encodings are not supported when reading from files or other input containers. -- Other encodings such as Latin-1 or ISO 8859-1 are **not** supported and will yield parse or serialization errors. -- [Unicode noncharacters](https://www.unicode.org/faq/private_use.html#nonchar1) will not be replaced by the library. -- Invalid surrogates (e.g., incomplete pairs such as `\uDEAD`) will yield parse errors. -- The strings stored in the library are UTF-8 encoded. When using the default string type (`std::string`), note that its length/size functions return the number of stored bytes rather than the number of characters or glyphs. -- When you store strings with different encodings in the library, calling [`dump()`](https://nlohmann.github.io/json/api/basic_json/dump/) may throw an exception unless `json::error_handler_t::replace` or `json::error_handler_t::ignore` are used as error handlers. -- To store wide strings (e.g., `std::wstring`), you need to convert them to a UTF-8 encoded `std::string` before, see [an example](https://json.nlohmann.me/home/faq/#wide-string-handling). - -### Comments in JSON - -This library does not support comments by default. It does so for three reasons: - -1. Comments are not part of the [JSON specification](https://tools.ietf.org/html/rfc8259). You may argue that `//` or `/* */` are allowed in JavaScript, but JSON is not JavaScript. -2. This was not an oversight: Douglas Crockford [wrote on this](https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr) in May 2012: - - > I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't. - - > Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser. - -3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this. - -However, you can pass set parameter `ignore_comments` to true in the `parse` function to ignore `//` or `/* */` comments. Comments will then be treated as whitespace. - -### Order of object keys - -By default, the library does not preserve the **insertion order of object elements**. This is standards-compliant, as the [JSON standard](https://tools.ietf.org/html/rfc8259.html) defines objects as "an unordered collection of zero or more name/value pairs". - -If you do want to preserve the insertion order, you can try the type [`nlohmann::ordered_json`](https://github.com/nlohmann/json/issues/2179). Alternatively, you can use a more sophisticated ordered map like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) ([integration](https://github.com/nlohmann/json/issues/546#issuecomment-304447518)) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map) ([integration](https://github.com/nlohmann/json/issues/485#issuecomment-333652309)). - -### Memory Release - -We checked with Valgrind and the Address Sanitizer (ASAN) that there are no memory leaks. - -If you find that a parsing program with this library does not release memory, please consider the following case, and it may be unrelated to this library. - -**Your program is compiled with glibc.** There is a tunable threshold that glibc uses to decide whether to actually return memory to the system or whether to cache it for later reuse. If in your program you make lots of small allocations and those small allocations are not a contiguous block and are presumably below the threshold, then they will not get returned to the OS. -Here is a related issue [#1924](https://github.com/nlohmann/json/issues/1924). - -### Further notes - -- The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](https://en.cppreference.com/w/cpp/error/assert). In particular, note [`operator[]`](https://nlohmann.github.io/json/api/basic_json/operator%5B%5D/) implements **unchecked access** for const objects: If the given key is not present, the behavior is undefined (think of a dereferenced null pointer) and yields an [assertion failure](https://github.com/nlohmann/json/issues/289) if assertions are switched on. If you are not sure whether an element in an object exists, use checked access with the [`at()` function](https://nlohmann.github.io/json/api/basic_json/at/). Furthermore, you can define `JSON_ASSERT(x)` to replace calls to `assert(x)`. -- As the exact number type is not defined in the [JSON specification](https://tools.ietf.org/html/rfc8259.html), this library tries to choose the best fitting C++ number type automatically. As a result, the type `double` may be used to store numbers which may yield [**floating-point exceptions**](https://github.com/nlohmann/json/issues/181) in certain rare situations if floating-point exceptions have been unmasked in the calling code. These exceptions are not caused by the library and need to be fixed in the calling code, such as by re-masking the exceptions prior to calling library functions. -- The code can be compiled without C++ **runtime type identification** features; that is, you can use the `-fno-rtti` compiler flag. -- **Exceptions** are used widely within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by `abort()` calls. You can further control this behavior by defining `JSON_THROW_USER` (overriding `throw`), `JSON_TRY_USER` (overriding `try`), and `JSON_CATCH_USER` (overriding `catch`). Note that `JSON_THROW_USER` should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield undefined behavior. Note the explanatory [`what()`](https://en.cppreference.com/w/cpp/error/exception/what) string of exceptions is not available for MSVC if exceptions are disabled, see [#2824](https://github.com/nlohmann/json/discussions/2824). - -## Execute unit tests - -To compile and run the tests, you need to execute - -```sh -$ mkdir build -$ cd build -$ cmake .. -DJSON_BuildTests=On -$ cmake --build . -$ ctest --output-on-failure -``` - -Note that during the `ctest` stage, several JSON test files are downloaded from an [external repository](https://github.com/nlohmann/json_test_data). If policies forbid downloading artifacts during testing, you can download the files yourself and pass the directory with the test files via `-DJSON_TestDataDirectory=path` to CMake. Then, no Internet connectivity is required. See [issue #2189](https://github.com/nlohmann/json/issues/2189) for more information. - -In case you have downloaded the library rather than checked out the code via Git, test `cmake_fetch_content_configure` will fail. Please execute `ctest -LE git_required` to skip these tests. See [issue #2189](https://github.com/nlohmann/json/issues/2189) for more information. - -Some tests change the installed files and hence make the whole process not reproducible. Please execute `ctest -LE not_reproducible` to skip these tests. See [issue #2324](https://github.com/nlohmann/json/issues/2324) for more information. - -Note you need to call `cmake -LE "not_reproducible|git_required"` to exclude both labels. See [issue #2596](https://github.com/nlohmann/json/issues/2596) for more information. - -As Intel compilers use unsafe floating point optimization by default, the unit tests may fail. Use flag [`/fp:precise`](https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html) then. diff --git a/Sources/backend-cpp/Vendor/json/doc/Makefile b/Sources/backend-cpp/Vendor/json/doc/Makefile deleted file mode 100644 index 0de57e00..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -SRCDIR = ../single_include - -all: create_output - -########################################################################## -# example files -########################################################################## - -# where are the example cpp files -EXAMPLES = $(wildcard examples/*.cpp) - -# create output from a stand-alone example file -%.output: %.cpp - make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11" - ./$(<:.cpp=) > $@ - rm $(<:.cpp=) - -# compare created output with current output of the example files -%.test: %.cpp - make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11" - ./$(<:.cpp=) > $@ - diff $@ $(<:.cpp=.output) - rm $(<:.cpp=) $@ - -# create output from all stand-alone example files -create_output: $(EXAMPLES:.cpp=.output) - -# check output of all stand-alone example files -check_output: $(EXAMPLES:.cpp=.test) - -clean: - rm -fr $(EXAMPLES:.cpp=) - $(MAKE) clean -C docset - $(MAKE) clean -C mkdocs diff --git a/Sources/backend-cpp/Vendor/json/doc/README.md b/Sources/backend-cpp/Vendor/json/doc/README.md deleted file mode 100644 index ec5c25d4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Documentation - -## Generate documentation - -Note on documentation: The source files contain links to the online documentation at https://json.nlohmann.me. This URL -contains the most recent documentation and should also be applicable to previous versions; documentation for deprecated -functions is not removed, but marked deprecated. - -If you want to see the documentation for a specific tag or commit hash, you can generate it as follows (here for tag -`v3.10.2`): - -```shell -git clone https://github.com/nlohmann/json.git -cd json -git checkout v3.10.2 -make install_venv serve -C doc/mkdocs -``` - -Open URL in your browser. Replace from any URL from the source code `https://json.nlohmann.me` -with `http://127.0.0.1:8000` to see the documentation for your tag or commit hash. diff --git a/Sources/backend-cpp/Vendor/json/doc/avatars.png b/Sources/backend-cpp/Vendor/json/doc/avatars.png deleted file mode 100644 index 51243580..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/avatars.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/Info.plist b/Sources/backend-cpp/Vendor/json/doc/docset/Info.plist deleted file mode 100644 index 772ec08a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/docset/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleIdentifier - nlohmann_json - CFBundleName - JSON for Modern C++ - DocSetPlatformFamily - json - isDashDocset - - dashIndexFilePath - index.html - DashDocSetFallbackURL - https://nlohmann.github.io/json/ - isJavaScriptEnabled - - - diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/Makefile b/Sources/backend-cpp/Vendor/json/doc/docset/Makefile deleted file mode 100644 index e538661e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/docset/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -JSON_for_Modern_C++.docset: Info.plist docSet.sql - $(MAKE) clean - mkdir -p JSON_for_Modern_C++.docset/Contents/Resources/Documents/ - cp icon*.png JSON_for_Modern_C++.docset - cp Info.plist JSON_for_Modern_C++.docset/Contents - # build and copy documentation - $(MAKE) build -C ../mkdocs - cp -r ../mkdocs/site/* JSON_for_Modern_C++.docset/Contents/Resources/Documents - # patch CSS to hide navigation items - echo "\n\nheader, footer, navi, div.md-sidebar--primary, nav.md-tabs--active, a.md-content__button { display: none; }" >> "$$(ls JSON_for_Modern_C++.docset/Contents/Resources/Documents/assets/stylesheets/main.*.min.css)" - # fix spacing - echo "\n\ndiv.md-sidebar div.md-sidebar--secondary, div.md-main__inner { top: 0; margin-top: 0 }" >> "$$(ls JSON_for_Modern_C++.docset/Contents/Resources/Documents/assets/stylesheets/main.*.min.css)" - # remove "JSON for Modern C++" from page titles - find JSON_for_Modern_C++.docset/Contents/Resources/Documents -type f -exec gsed -i 's| - JSON for Modern C++||' {} + - # clean up - rm JSON_for_Modern_C++.docset/Contents/Resources/Documents/hooks.py - rm JSON_for_Modern_C++.docset/Contents/Resources/Documents/sitemap.* - # generate index - sqlite3 JSON_for_Modern_C++.docset/Contents/Resources/docSet.dsidx < docSet.sql - -JSON_for_Modern_C++.tgz: JSON_for_Modern_C++.docset - tar --exclude='.DS_Store' -cvzf JSON_for_Modern_C++.tgz JSON_for_Modern_C++.docset - -clean: - rm -fr JSON_for_Modern_C++.docset JSON_for_Modern_C++.tgz diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/README.md b/Sources/backend-cpp/Vendor/json/doc/docset/README.md deleted file mode 100644 index 79a778eb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/docset/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# docset - -The folder contains the required files to create a [docset](https://kapeli.com/docsets) which can be used in -documentation browsers like [Dash](https://kapeli.com/dash), [Velocity](https://velocity.silverlakesoftware.com), or -[Zeal](https://zealdocs.org). - -The docset can be created with - -```sh -make nlohmann_json.docset -``` - -The generated folder `nlohmann_json.docset` can then be opened in the documentation browser. - -A recent version is also part of the [Dash user contributions](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B). - -## Licenses - -The [JSON logo](https://commons.wikimedia.org/wiki/File:JSON_vector_logo.svg) is public domain. diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/docSet.sql b/Sources/backend-cpp/Vendor/json/doc/docset/docSet.sql deleted file mode 100644 index 8bd4e067..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/docset/docSet.sql +++ /dev/null @@ -1,155 +0,0 @@ -DROP TABLE IF EXISTS searchIndex; -CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT); -CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path); - --- API -INSERT INTO searchIndex(name, type, path) VALUES ('accept', 'Function', 'api/basic_json/accept/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('adl_serializer', 'Class', 'api/adl_serializer/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('array', 'Function', 'api/basic_json/array/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('array_t', 'Type', 'api/basic_json/array_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('at', 'Method', 'api/basic_json/at/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('back', 'Method', 'api/basic_json/back/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('basic_json', 'Class', 'api/basic_json/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('basic_json', 'Constructor', 'api/basic_json/basic_json/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('begin', 'Method', 'api/basic_json/begin/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('binary', 'Function', 'api/basic_json/binary/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('binary_t', 'Type', 'api/basic_json/binary_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('boolean_t', 'Type', 'api/basic_json/boolean_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('cbegin', 'Method', 'api/basic_json/cbegin/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('cbor_tag_handler_t', 'Enum', 'api/basic_json/cbor_tag_handler_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('cend', 'Method', 'api/basic_json/cend/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('clear', 'Method', 'api/basic_json/clear/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('contains', 'Method', 'api/basic_json/contains/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('count', 'Method', 'api/basic_json/count/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('crbegin', 'Method', 'api/basic_json/crbegin/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('crend', 'Method', 'api/basic_json/crend/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('diff', 'Function', 'api/basic_json/diff/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('dump', 'Method', 'api/basic_json/dump/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('emplace', 'Method', 'api/basic_json/emplace/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('emplace_back', 'Method', 'api/basic_json/emplace_back/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('empty', 'Method', 'api/basic_json/empty/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('end', 'Method', 'api/basic_json/end/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('erase', 'Method', 'api/basic_json/erase/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('error_handler_t', 'Enum', 'api/basic_json/error_handler_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('exception', 'Class', 'api/basic_json/exception/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('find', 'Method', 'api/basic_json/find/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('flatten', 'Method', 'api/basic_json/flatten/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('from_bson', 'Function', 'api/basic_json/from_bson/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('from_cbor', 'Function', 'api/basic_json/from_cbor/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('from_msgpack', 'Function', 'api/basic_json/from_msgpack/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('from_ubjson', 'Function', 'api/basic_json/from_ubjson/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('front', 'Method', 'api/basic_json/front/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('get', 'Method', 'api/basic_json/get/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('get_allocator', 'Function', 'api/basic_json/get_allocator/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('get_binary', 'Method', 'api/basic_json/get_binary/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('get_ptr', 'Method', 'api/basic_json/get_ptr/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('get_ref', 'Method', 'api/basic_json/get_ref/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('get_to', 'Method', 'api/basic_json/get_to/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('input_format_t', 'Enum', 'api/basic_json/input_format_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('insert', 'Method', 'api/basic_json/insert/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('invalid_iterator', 'Class', 'api/basic_json/invalid_iterator/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_array', 'Method', 'api/basic_json/is_array/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_binary', 'Method', 'api/basic_json/is_binary/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_boolean', 'Method', 'api/basic_json/is_boolean/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_discarded', 'Method', 'api/basic_json/is_discarded/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_null', 'Method', 'api/basic_json/is_null/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_number', 'Method', 'api/basic_json/is_number/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_number_float', 'Method', 'api/basic_json/is_number_float/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_number_integer', 'Method', 'api/basic_json/is_number_integer/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_number_unsigned', 'Method', 'api/basic_json/is_number_unsigned/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_object', 'Method', 'api/basic_json/is_object/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_primitive', 'Method', 'api/basic_json/is_primitive/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_string', 'Method', 'api/basic_json/is_string/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('is_structured', 'Method', 'api/basic_json/is_structured/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('items', 'Method', 'api/basic_json/items/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('json', 'Class', 'api/json/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer', 'Class', 'api/json_pointer/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('json_serializer', 'Type', 'api/basic_json/json_serializer/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('max_size', 'Method', 'api/basic_json/max_size/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('merge_patch', 'Method', 'api/basic_json/merge_patch/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('meta', 'Function', 'api/basic_json/meta/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('number_float_t', 'Type', 'api/basic_json/number_float_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('number_integer_t', 'Type', 'api/basic_json/number_integer_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('number_unsigned_t', 'Type', 'api/basic_json/number_unsigned_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('object', 'Function', 'api/basic_json/object/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('object_comparator_t', 'Type', 'api/basic_json/object_comparator_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('object_t', 'Type', 'api/basic_json/object_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator!=', 'Operator', 'api/basic_json/operator_ne/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator+=', 'Operator', 'api/basic_json/operator+=/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator=', 'Operator', 'api/basic_json/operator=/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator==', 'Operator', 'api/basic_json/operator_eq/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator<', 'Operator', 'api/basic_json/operator_lt/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator<=', 'Operator', 'api/basic_json/operator_le/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator>', 'Operator', 'api/basic_json/operator_gt/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator>=', 'Operator', 'api/basic_json/operator_ge/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator[]', 'Operator', 'api/basic_json/operator[]/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator""_json', 'Literal', 'api/basic_json/operator_literal_json/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator""_json_pointer', 'Literal', 'api/basic_json/operator_literal_json_pointer/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator ValueType', 'Operator', 'api/basic_json/operator_ValueType/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('operator value_t', 'Operator', 'api/basic_json/operator_value_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('ordered_json', 'Class', 'api/ordered_json/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('ordered_map', 'Class', 'api/ordered_map/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('out_of_range', 'Class', 'api/basic_json/out_of_range/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('other_error', 'Class', 'api/basic_json/other_error/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('parse', 'Function', 'api/basic_json/parse/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('parse_error', 'Class', 'api/basic_json/parse_error/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('parse_event_t', 'Enum', 'api/basic_json/parse_event_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('parser_callback_t', 'Type', 'api/basic_json/parser_callback_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('patch', 'Method', 'api/basic_json/patch/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('push_back', 'Method', 'api/basic_json/push_back/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('rbegin', 'Method', 'api/basic_json/rbegin/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('rend', 'Method', 'api/basic_json/rend/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('sax_parse', 'Function', 'api/basic_json/sax_parse/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('size', 'Method', 'api/basic_json/size/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('string_t', 'Type', 'api/basic_json/string_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('type', 'Method', 'api/basic_json/type/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('type_error', 'Class', 'api/basic_json/type_error/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('type_name', 'Method', 'api/basic_json/type_name/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('unflatten', 'Method', 'api/basic_json/unflatten/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('update', 'Method', 'api/basic_json/update/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('to_bson', 'Function', 'api/basic_json/to_bson/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('to_cbor', 'Function', 'api/basic_json/to_cbor/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('to_msgpack', 'Function', 'api/basic_json/to_msgpack/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('to_ubjson', 'Function', 'api/basic_json/to_ubjson/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('value', 'Method', 'api/basic_json/value/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('value_t', 'Enum', 'api/basic_json/value_t/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('~basic_json', 'Method', 'api/basic_json/~basic_json/index.html'); - --- Features -INSERT INTO searchIndex(name, type, path) VALUES ('Binary Formats', 'Guide', 'features/binary_formats/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('BSON', 'Guide', 'features/binary_formats/bson/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('CBOR', 'Guide', 'features/binary_formats/cbor/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('MessagePack', 'Guide', 'features/binary_formats/messagepack/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('UBJSON', 'Guide', 'features/binary_formats/ubjson/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Supported Macros', 'Guide', 'features/macros/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Binary Values', 'Guide', 'features/binary_values/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Comments', 'Guide', 'features/comments/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Iterators', 'Guide', 'features/iterators/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Types', 'Guide', 'features/types/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Number Handling', 'Guide', 'features/types/number_handling/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Element Access', 'Guide', 'features/element_access/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON Pointer', 'Guide', 'features/json_pointer/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON Patch and Diff', 'Guide', 'features/json_patch/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON Merge Patch', 'Guide', 'features/merge_patch/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Object Order', 'Guide', 'features/object_order/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Parsing and Exceptions', 'Guide', 'features/parsing/parse_exceptions/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('Parser Callbacks', 'Guide', 'features/parsing/parser_callbacks/index.html'); -INSERT INTO searchIndex(name, type, path) VALUES ('SAX Interface', 'Guide', 'features/parsing/sax_interface/index.html'); - --- Macros -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_ASSERT', 'Macro', 'features/macros/index.html#json_assertx'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_CATCH_USER', 'Macro', 'features/macros/index.html#json_catch_userexception'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_DIAGNOSTICS', 'Macro', 'features/macros/index.html#json_diagnostics'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_11', 'Macro', 'features/macros/index.html#json_has_cpp_11-json_has_cpp_14-json_has_cpp_17-json_has_cpp_20'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_14', 'Macro', 'features/macros/index.html#json_has_cpp_11-json_has_cpp_14-json_has_cpp_17-json_has_cpp_20'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_17', 'Macro', 'features/macros/index.html#json_has_cpp_11-json_has_cpp_14-json_has_cpp_17-json_has_cpp_20'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_HAS_CPP_20', 'Macro', 'features/macros/index.html#json_has_cpp_11-json_has_cpp_14-json_has_cpp_17-json_has_cpp_20'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_NOEXCEPTION', 'Macro', 'features/macros/index.html#json_noexception'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_NO_IO', 'Macro', 'features/macros/index.html#json_no_io'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_SKIP_UNSUPPORTED_COMPILER_CHECK', 'Macro', 'features/macros/index.html#json_skip_unsupported_compiler_check'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_THROW_USER', 'Macro', 'features/macros/index.html#json_throw_userexception'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_TRY_USER', 'Macro', 'features/macros/index.html#json_try_user'); -INSERT INTO searchIndex(name, type, path) VALUES ('JSON_USE_IMPLICIT_CONVERSIONS', 'Macro', 'features/macros/index.html#json_use_implicit_conversions'); -INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_INTRUSIVE', 'Macro', 'features/macros/index.html#nlohmann_define_type_intrusivetype-member'); -INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE', 'Macro', 'features/macros/index.html#nlohmann_define_type_non_intrusivetype-member'); -INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_SERIALIZE_ENUM', 'Macro', 'features/macros/index.html#nlohmann_json_serialize_enumtype'); diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/docset.json b/Sources/backend-cpp/Vendor/json/doc/docset/docset.json deleted file mode 100644 index f8d47830..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/docset/docset.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "JSON for Modern C++", - "version": "3.10.0", - "archive": "JSON_for_Modern_C++.tgz", - "author": { - "name": "Niels Lohmann", - "link": "https://twitter.com/nlohmann" - }, - "aliases": ["nlohmann/json"] -} diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/icon.png b/Sources/backend-cpp/Vendor/json/doc/docset/icon.png deleted file mode 100644 index 7197d0a7..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/docset/icon.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/docset/icon@2x.png b/Sources/backend-cpp/Vendor/json/doc/docset/icon@2x.png deleted file mode 100644 index 5f2fac87..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/docset/icon@2x.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/README.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/README.cpp deleted file mode 100644 index 2d641e58..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/README.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object - json j = - { - {"pi", 3.141}, - {"happy", true}, - {"name", "Niels"}, - {"nothing", nullptr}, - { - "answer", { - {"everything", 42} - } - }, - {"list", {1, 0, 2}}, - { - "object", { - {"currency", "USD"}, - {"value", 42.99} - } - } - }; - - // add new values - j["new"]["key"]["value"] = {"another", "list"}; - - // count elements - auto s = j.size(); - j["size"] = s; - - // pretty print with indent of 4 spaces - std::cout << std::setw(4) << j << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/README.output b/Sources/backend-cpp/Vendor/json/doc/examples/README.output deleted file mode 100644 index 31188d45..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/README.output +++ /dev/null @@ -1,27 +0,0 @@ -{ - "answer": { - "everything": 42 - }, - "happy": true, - "list": [ - 1, - 0, - 2 - ], - "name": "Niels", - "new": { - "key": { - "value": [ - "another", - "list" - ] - } - }, - "nothing": null, - "object": { - "currency": "USD", - "value": 42.99 - }, - "pi": 3.141, - "size": 8 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/accept__string.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/accept__string.cpp deleted file mode 100644 index 8eb3d9b7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/accept__string.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a valid JSON text - auto valid_text = R"( - { - "numbers": [1, 2, 3] - } - )"; - - // an invalid JSON text - auto invalid_text = R"( - { - "strings": ["extra", "comma", ] - } - )"; - - std::cout << std::boolalpha - << json::accept(valid_text) << ' ' - << json::accept(invalid_text) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/accept__string.output b/Sources/backend-cpp/Vendor/json/doc/examples/accept__string.output deleted file mode 100644 index 836a5934..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/accept__string.output +++ /dev/null @@ -1 +0,0 @@ -true false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/array.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/array.cpp deleted file mode 100644 index 139b5ef1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/array.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON arrays - json j_no_init_list = json::array(); - json j_empty_init_list = json::array({}); - json j_nonempty_init_list = json::array({1, 2, 3, 4}); - json j_list_of_pairs = json::array({ {"one", 1}, {"two", 2} }); - - // serialize the JSON arrays - std::cout << j_no_init_list << '\n'; - std::cout << j_empty_init_list << '\n'; - std::cout << j_nonempty_init_list << '\n'; - std::cout << j_list_of_pairs << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/array.output b/Sources/backend-cpp/Vendor/json/doc/examples/array.output deleted file mode 100644 index 4e75a1b6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/array.output +++ /dev/null @@ -1,4 +0,0 @@ -[] -[] -[1,2,3,4] -[["one",1],["two",2]] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/array_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/array_t.cpp deleted file mode 100644 index 0964857b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/array_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same, json::array_t>::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/array_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/array_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/array_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type.cpp deleted file mode 100644 index 202f8a2e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON object - json object = - { - {"the good", "il buono"}, - {"the bad", "il cattivo"}, - {"the ugly", "il brutto"} - }; - - // output element with key "the ugly" - std::cout << object.at("the ugly") << '\n'; - - // change element with key "the bad" - object.at("the bad") = "il cattivo"; - - // output changed array - std::cout << object << '\n'; - - - // exception type_error.304 - try - { - // use at() on a non-object type - json str = "I am a string"; - str.at("the good") = "Another string"; - } - catch (json::type_error& e) - { - std::cout << e.what() << '\n'; - } - - // exception out_of_range.401 - try - { - // try to write at a nonexisting key - object.at("the fast") = "il rapido"; - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type.output deleted file mode 100644 index b544b729..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type.output +++ /dev/null @@ -1,4 +0,0 @@ -"il brutto" -{"the bad":"il cattivo","the good":"il buono","the ugly":"il brutto"} -[json.exception.type_error.304] cannot use at() with string -[json.exception.out_of_range.403] key 'the fast' not found diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type_const.cpp deleted file mode 100644 index e5244f3f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type_const.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON object - const json object = - { - {"the good", "il buono"}, - {"the bad", "il cattivo"}, - {"the ugly", "il brutto"} - }; - - // output element with key "the ugly" - std::cout << object.at("the ugly") << '\n'; - - - // exception type_error.304 - try - { - // use at() on a non-object type - const json str = "I am a string"; - std::cout << str.at("the good") << '\n'; - } - catch (json::type_error& e) - { - std::cout << e.what() << '\n'; - } - - // exception out_of_range.401 - try - { - // try to read from a nonexisting key - std::cout << object.at("the fast") << '\n'; - } - catch (json::out_of_range) - { - std::cout << "out of range" << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type_const.output deleted file mode 100644 index 40ca3f09..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__object_t_key_type_const.output +++ /dev/null @@ -1,3 +0,0 @@ -"il brutto" -[json.exception.type_error.304] cannot use at() with string -out of range diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type.cpp deleted file mode 100644 index 65baeddc..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON array - json array = {"first", "2nd", "third", "fourth"}; - - // output element at index 2 (third element) - std::cout << array.at(2) << '\n'; - - // change element at index 1 (second element) to "second" - array.at(1) = "second"; - - // output changed array - std::cout << array << '\n'; - - - // exception type_error.304 - try - { - // use at() on a non-array type - json str = "I am a string"; - str.at(0) = "Another string"; - } - catch (json::type_error& e) - { - std::cout << e.what() << '\n'; - } - - // exception out_of_range.401 - try - { - // try to write beyond the array limit - array.at(5) = "sixth"; - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type.output deleted file mode 100644 index 54026436..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type.output +++ /dev/null @@ -1,4 +0,0 @@ -"third" -["first","second","third","fourth"] -[json.exception.type_error.304] cannot use at() with string -[json.exception.out_of_range.401] array index 5 is out of range diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type_const.cpp deleted file mode 100644 index faa4cffd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type_const.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON array - const json array = {"first", "2nd", "third", "fourth"}; - - // output element at index 2 (third element) - std::cout << array.at(2) << '\n'; - - - // exception type_error.304 - try - { - // use at() on a non-array type - const json str = "I am a string"; - std::cout << str.at(0) << '\n'; - } - catch (json::type_error& e) - { - std::cout << e.what() << '\n'; - } - - // exception out_of_range.401 - try - { - // try to read beyond the array limit - std::cout << array.at(5) << '\n'; - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type_const.output deleted file mode 100644 index 8135a27a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at__size_type_const.output +++ /dev/null @@ -1,3 +0,0 @@ -"third" -[json.exception.type_error.304] cannot use at() with string -[json.exception.out_of_range.401] array index 5 is out of range diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer.cpp deleted file mode 100644 index f554d853..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json j = - { - {"number", 1}, {"string", "foo"}, {"array", {1, 2}} - }; - - // read-only access - - // output element with JSON pointer "/number" - std::cout << j.at("/number"_json_pointer) << '\n'; - // output element with JSON pointer "/string" - std::cout << j.at("/string"_json_pointer) << '\n'; - // output element with JSON pointer "/array" - std::cout << j.at("/array"_json_pointer) << '\n'; - // output element with JSON pointer "/array/1" - std::cout << j.at("/array/1"_json_pointer) << '\n'; - - // writing access - - // change the string - j.at("/string"_json_pointer) = "bar"; - // output the changed string - std::cout << j["string"] << '\n'; - - // change an array element - j.at("/array/1"_json_pointer) = 21; - // output the changed array - std::cout << j["array"] << '\n'; - - - // out_of_range.106 - try - { - // try to use an array index with leading '0' - json::reference ref = j.at("/array/01"_json_pointer); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.109 - try - { - // try to use an array index that is not a number - json::reference ref = j.at("/array/one"_json_pointer); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.401 - try - { - // try to use an invalid array index - json::reference ref = j.at("/array/4"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.402 - try - { - // try to use the array index '-' - json::reference ref = j.at("/array/-"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.403 - try - { - // try to use a JSON pointer to a nonexistent object key - json::const_reference ref = j.at("/foo"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.404 - try - { - // try to use a JSON pointer that cannot be resolved - json::reference ref = j.at("/number/foo"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer.output b/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer.output deleted file mode 100644 index 1d29893e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer.output +++ /dev/null @@ -1,12 +0,0 @@ -1 -"foo" -[1,2] -2 -"bar" -[1,21] -[json.exception.parse_error.106] parse error: array index '01' must not begin with '0' -[json.exception.parse_error.109] parse error: array index 'one' is not a number -[json.exception.out_of_range.401] array index 4 is out of range -[json.exception.out_of_range.402] array index '-' (2) is out of range -[json.exception.out_of_range.403] key 'foo' not found -[json.exception.out_of_range.404] unresolved reference token 'foo' diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer_const.cpp deleted file mode 100644 index 3ac232b9..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer_const.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - const json j = - { - {"number", 1}, {"string", "foo"}, {"array", {1, 2}} - }; - - // read-only access - - // output element with JSON pointer "/number" - std::cout << j.at("/number"_json_pointer) << '\n'; - // output element with JSON pointer "/string" - std::cout << j.at("/string"_json_pointer) << '\n'; - // output element with JSON pointer "/array" - std::cout << j.at("/array"_json_pointer) << '\n'; - // output element with JSON pointer "/array/1" - std::cout << j.at("/array/1"_json_pointer) << '\n'; - - // out_of_range.109 - try - { - // try to use an array index that is not a number - json::const_reference ref = j.at("/array/one"_json_pointer); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.401 - try - { - // try to use an invalid array index - json::const_reference ref = j.at("/array/4"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.402 - try - { - // try to use the array index '-' - json::const_reference ref = j.at("/array/-"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.403 - try - { - // try to use a JSON pointer to a nonexistent object key - json::const_reference ref = j.at("/foo"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } - - // out_of_range.404 - try - { - // try to use a JSON pointer that cannot be resolved - json::const_reference ref = j.at("/number/foo"_json_pointer); - } - catch (json::out_of_range& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer_const.output deleted file mode 100644 index aaf8f187..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/at_json_pointer_const.output +++ /dev/null @@ -1,9 +0,0 @@ -1 -"foo" -[1,2] -2 -[json.exception.parse_error.109] parse error: array index 'one' is not a number -[json.exception.out_of_range.401] array index 4 is out of range -[json.exception.out_of_range.402] array index '-' (2) is out of range -[json.exception.out_of_range.403] key 'foo' not found -[json.exception.out_of_range.404] unresolved reference token 'foo' diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/back.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/back.cpp deleted file mode 100644 index 1439a821..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/back.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_object_empty(json::value_t::object); - json j_array = {1, 2, 4, 8, 16}; - json j_array_empty(json::value_t::array); - json j_string = "Hello, world"; - - // call back() - std::cout << j_boolean.back() << '\n'; - std::cout << j_number_integer.back() << '\n'; - std::cout << j_number_float.back() << '\n'; - std::cout << j_object.back() << '\n'; - //std::cout << j_object_empty.back() << '\n'; // undefined behavior - std::cout << j_array.back() << '\n'; - //std::cout << j_array_empty.back() << '\n'; // undefined behavior - std::cout << j_string.back() << '\n'; - - // back() called on a null value - try - { - json j_null; - j_null.back(); - } - catch (json::invalid_iterator& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/back.output b/Sources/backend-cpp/Vendor/json/doc/examples/back.output deleted file mode 100644 index 2990dbf0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/back.output +++ /dev/null @@ -1,7 +0,0 @@ -true -17 -23.42 -2 -16 -"Hello, world" -[json.exception.invalid_iterator.214] cannot get value diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__CompatibleType.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__CompatibleType.cpp deleted file mode 100644 index e2f01aa6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__CompatibleType.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // ============ - // object types - // ============ - - // create an object from an object_t value - json::object_t object_value = { {"one", 1}, {"two", 2} }; - json j_object_t(object_value); - - // create an object from std::map - std::map c_map - { - {"one", 1}, {"two", 2}, {"three", 3} - }; - json j_map(c_map); - - // create an object from std::unordered_map - std::unordered_map c_umap - { - {"one", 1.2}, {"two", 2.3}, {"three", 3.4} - }; - json j_umap(c_umap); - - // create an object from std::multimap - std::multimap c_mmap - { - {"one", true}, {"two", true}, {"three", false}, {"three", true} - }; - json j_mmap(c_mmap); // only one entry for key "three" is used - - // create an object from std::unordered_multimap - std::unordered_multimap c_ummap - { - {"one", true}, {"two", true}, {"three", false}, {"three", true} - }; - json j_ummap(c_ummap); // only one entry for key "three" is used - - // serialize the JSON objects - std::cout << j_object_t << '\n'; - std::cout << j_map << '\n'; - std::cout << j_umap << '\n'; - std::cout << j_mmap << '\n'; - std::cout << j_ummap << "\n\n"; - - - // =========== - // array types - // =========== - - // create an array from an array_t value - json::array_t array_value = {"one", "two", 3, 4.5, false}; - json j_array_t(array_value); - - // create an array from std::vector - std::vector c_vector {1, 2, 3, 4}; - json j_vec(c_vector); - - // create an array from std::valarray - std::valarray c_valarray {10, 9, 8, 7}; - json j_valarray(c_valarray); - - // create an array from std::deque - std::deque c_deque {1.2, 2.3, 3.4, 5.6}; - json j_deque(c_deque); - - // create an array from std::list - std::list c_list {true, true, false, true}; - json j_list(c_list); - - // create an array from std::forward_list - std::forward_list c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543}; - json j_flist(c_flist); - - // create an array from std::array - std::array c_array {{1, 2, 3, 4}}; - json j_array(c_array); - - // create an array from std::set - std::set c_set {"one", "two", "three", "four", "one"}; - json j_set(c_set); // only one entry for "one" is used - - // create an array from std::unordered_set - std::unordered_set c_uset {"one", "two", "three", "four", "one"}; - json j_uset(c_uset); // only one entry for "one" is used - - // create an array from std::multiset - std::multiset c_mset {"one", "two", "one", "four"}; - json j_mset(c_mset); // both entries for "one" are used - - // create an array from std::unordered_multiset - std::unordered_multiset c_umset {"one", "two", "one", "four"}; - json j_umset(c_umset); // both entries for "one" are used - - // serialize the JSON arrays - std::cout << j_array_t << '\n'; - std::cout << j_vec << '\n'; - std::cout << j_valarray << '\n'; - std::cout << j_deque << '\n'; - std::cout << j_list << '\n'; - std::cout << j_flist << '\n'; - std::cout << j_array << '\n'; - std::cout << j_set << '\n'; - std::cout << j_uset << '\n'; - std::cout << j_mset << '\n'; - std::cout << j_umset << "\n\n"; - - - // ============ - // string types - // ============ - - // create string from a string_t value - json::string_t string_value = "The quick brown fox jumps over the lazy dog."; - json j_string_t(string_value); - - // create a JSON string directly from a string literal - json j_string_literal("The quick brown fox jumps over the lazy dog."); - - // create string from std::string - std::string s_stdstring = "The quick brown fox jumps over the lazy dog."; - json j_stdstring(s_stdstring); - - // serialize the JSON strings - std::cout << j_string_t << '\n'; - std::cout << j_string_literal << '\n'; - std::cout << j_stdstring << "\n\n"; - - - // ============ - // number types - // ============ - - // create a JSON number from number_integer_t - json::number_integer_t value_integer_t = -42; - json j_integer_t(value_integer_t); - - // create a JSON number from number_unsigned_t - json::number_integer_t value_unsigned_t = 17; - json j_unsigned_t(value_unsigned_t); - - // create a JSON number from an anonymous enum - enum { enum_value = 17 }; - json j_enum(enum_value); - - // create values of different integer types - short n_short = 42; - int n_int = -23; - long n_long = 1024; - int_least32_t n_int_least32_t = -17; - uint8_t n_uint8_t = 8; - - // create (integer) JSON numbers - json j_short(n_short); - json j_int(n_int); - json j_long(n_long); - json j_int_least32_t(n_int_least32_t); - json j_uint8_t(n_uint8_t); - - // create values of different floating-point types - json::number_float_t v_ok = 3.141592653589793; - json::number_float_t v_nan = NAN; - json::number_float_t v_infinity = INFINITY; - - // create values of different floating-point types - float n_float = 42.23; - float n_float_nan = 1.0f / 0.0f; - double n_double = 23.42; - - // create (floating point) JSON numbers - json j_ok(v_ok); - json j_nan(v_nan); - json j_infinity(v_infinity); - json j_float(n_float); - json j_float_nan(n_float_nan); - json j_double(n_double); - - // serialize the JSON numbers - std::cout << j_integer_t << '\n'; - std::cout << j_unsigned_t << '\n'; - std::cout << j_enum << '\n'; - std::cout << j_short << '\n'; - std::cout << j_int << '\n'; - std::cout << j_long << '\n'; - std::cout << j_int_least32_t << '\n'; - std::cout << j_uint8_t << '\n'; - std::cout << j_ok << '\n'; - std::cout << j_nan << '\n'; - std::cout << j_infinity << '\n'; - std::cout << j_float << '\n'; - std::cout << j_float_nan << '\n'; - std::cout << j_double << "\n\n"; - - - // ============= - // boolean types - // ============= - - // create boolean values - json j_truth = true; - json j_falsity = false; - - // serialize the JSON booleans - std::cout << j_truth << '\n'; - std::cout << j_falsity << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__CompatibleType.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__CompatibleType.output deleted file mode 100644 index 2337e81f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__CompatibleType.output +++ /dev/null @@ -1,39 +0,0 @@ -{"one":1,"two":2} -{"one":1,"three":3,"two":2} -{"one":1.2,"three":3.4,"two":2.3} -{"one":true,"three":false,"two":true} -{"one":true,"three":false,"two":true} - -["one","two",3,4.5,false] -[1,2,3,4] -[10,9,8,7] -[1.2,2.3,3.4,5.6] -[true,true,false,true] -[12345678909876,23456789098765,34567890987654,45678909876543] -[1,2,3,4] -["four","one","three","two"] -["four","three","two","one"] -["four","one","one","two"] -["four","two","one","one"] - -"The quick brown fox jumps over the lazy dog." -"The quick brown fox jumps over the lazy dog." -"The quick brown fox jumps over the lazy dog." - --42 -17 -17 -42 --23 -1024 --17 -8 -3.141592653589793 -null -null -42.22999954223633 -null -23.42 - -true -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__InputIt_InputIt.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__InputIt_InputIt.cpp deleted file mode 100644 index ed5aff9a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__InputIt_InputIt.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_array = {"alpha", "bravo", "charly", "delta", "easy"}; - json j_number = 42; - json j_object = {{"one", "eins"}, {"two", "zwei"}}; - - // create copies using iterators - json j_array_range(j_array.begin() + 1, j_array.end() - 2); - json j_number_range(j_number.begin(), j_number.end()); - json j_object_range(j_object.begin(), j_object.find("two")); - - // serialize the values - std::cout << j_array_range << '\n'; - std::cout << j_number_range << '\n'; - std::cout << j_object_range << '\n'; - - // example for an exception - try - { - json j_invalid(j_number.begin() + 1, j_number.end()); - } - catch (json::invalid_iterator& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__InputIt_InputIt.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__InputIt_InputIt.output deleted file mode 100644 index bfb01778..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__InputIt_InputIt.output +++ /dev/null @@ -1,4 +0,0 @@ -["bravo","charly"] -42 -{"one":"eins"} -[json.exception.invalid_iterator.204] iterators out of range diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__basic_json.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__basic_json.cpp deleted file mode 100644 index 17136f43..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__basic_json.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json j1 = {"one", "two", 3, 4.5, false}; - - // create a copy - json j2(j1); - - // serialize the JSON array - std::cout << j1 << " = " << j2 << '\n'; - std::cout << std::boolalpha << (j1 == j2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__basic_json.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__basic_json.output deleted file mode 100644 index ee93a41c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__basic_json.output +++ /dev/null @@ -1,2 +0,0 @@ -["one","two",3,4.5,false] = ["one","two",3,4.5,false] -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__copyassignment.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__copyassignment.cpp deleted file mode 100644 index 2d865740..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__copyassignment.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json a = 23; - json b = 42; - - // copy-assign a to b - b = a; - - // serialize the JSON arrays - std::cout << a << '\n'; - std::cout << b << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__copyassignment.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__copyassignment.output deleted file mode 100644 index c1eee210..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__copyassignment.output +++ /dev/null @@ -1,2 +0,0 @@ -23 -23 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__list_init_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__list_init_t.cpp deleted file mode 100644 index 78611e1a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__list_init_t.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_empty_init_list = json({}); - json j_object = { {"one", 1}, {"two", 2} }; - json j_array = {1, 2, 3, 4}; - json j_nested_object = { {"one", {1}}, {"two", {1, 2}} }; - json j_nested_array = { {{1}, "one"}, {{1, 2}, "two"} }; - - // serialize the JSON value - std::cout << j_empty_init_list << '\n'; - std::cout << j_object << '\n'; - std::cout << j_array << '\n'; - std::cout << j_nested_object << '\n'; - std::cout << j_nested_array << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__list_init_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__list_init_t.output deleted file mode 100644 index d38f5b84..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__list_init_t.output +++ /dev/null @@ -1,5 +0,0 @@ -{} -{"one":1,"two":2} -[1,2,3,4] -{"one":[1],"two":[1,2]} -[[[1],"one"],[[1,2],"two"]] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__moveconstructor.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__moveconstructor.cpp deleted file mode 100644 index 48b68f61..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__moveconstructor.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json a = 23; - - // move contents of a to b - json b(std::move(a)); - - // serialize the JSON arrays - std::cout << a << '\n'; - std::cout << b << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__moveconstructor.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__moveconstructor.output deleted file mode 100644 index 911b5b1a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__moveconstructor.output +++ /dev/null @@ -1,2 +0,0 @@ -null -23 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__nullptr_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__nullptr_t.cpp deleted file mode 100644 index 7a436665..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__nullptr_t.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // implicitly create a JSON null value - json j1; - - // explicitly create a JSON null value - json j2(nullptr); - - // serialize the JSON null value - std::cout << j1 << '\n' << j2 << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__nullptr_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__nullptr_t.output deleted file mode 100644 index c1e4b6c1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__nullptr_t.output +++ /dev/null @@ -1,2 +0,0 @@ -null -null diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__size_type_basic_json.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__size_type_basic_json.cpp deleted file mode 100644 index 9ec76772..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__size_type_basic_json.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array by creating copies of a JSON value - json value = "Hello"; - json array_0 = json(0, value); - json array_1 = json(1, value); - json array_5 = json(5, value); - - // serialize the JSON arrays - std::cout << array_0 << '\n'; - std::cout << array_1 << '\n'; - std::cout << array_5 << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__size_type_basic_json.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__size_type_basic_json.output deleted file mode 100644 index f4c59b34..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__size_type_basic_json.output +++ /dev/null @@ -1,3 +0,0 @@ -[] -["Hello"] -["Hello","Hello","Hello","Hello","Hello"] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value.cpp deleted file mode 100644 index 9488d30e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object with different entry types - json j = - { - {"integer", 1}, - {"floating", 42.23}, - {"string", "hello world"}, - {"boolean", true}, - {"object", {{"key1", 1}, {"key2", 2}}}, - {"array", {1, 2, 3}} - }; - - // access existing values - int v_integer = j.value("integer", 0); - double v_floating = j.value("floating", 47.11); - - // access nonexisting values and rely on default value - std::string v_string = j.value("nonexisting", "oops"); - bool v_boolean = j.value("nonexisting", false); - - // output values - std::cout << std::boolalpha << v_integer << " " << v_floating - << " " << v_string << " " << v_boolean << "\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value.output deleted file mode 100644 index dfc40e58..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value.output +++ /dev/null @@ -1 +0,0 @@ -1 42.23 oops false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_ptr.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_ptr.cpp deleted file mode 100644 index f25b7736..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_ptr.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object with different entry types - json j = - { - {"integer", 1}, - {"floating", 42.23}, - {"string", "hello world"}, - {"boolean", true}, - {"object", {{"key1", 1}, {"key2", 2}}}, - {"array", {1, 2, 3}} - }; - - // access existing values - int v_integer = j.value("/integer"_json_pointer, 0); - double v_floating = j.value("/floating"_json_pointer, 47.11); - - // access nonexisting values and rely on default value - std::string v_string = j.value("/nonexisting"_json_pointer, "oops"); - bool v_boolean = j.value("/nonexisting"_json_pointer, false); - - // output values - std::cout << std::boolalpha << v_integer << " " << v_floating - << " " << v_string << " " << v_boolean << "\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_ptr.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_ptr.output deleted file mode 100644 index dfc40e58..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_ptr.output +++ /dev/null @@ -1 +0,0 @@ -1 42.23 oops false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_t.cpp deleted file mode 100644 index c306731a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_t.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create the different JSON values with default values - json j_null(json::value_t::null); - json j_boolean(json::value_t::boolean); - json j_number_integer(json::value_t::number_integer); - json j_number_float(json::value_t::number_float); - json j_object(json::value_t::object); - json j_array(json::value_t::array); - json j_string(json::value_t::string); - - // serialize the JSON values - std::cout << j_null << '\n'; - std::cout << j_boolean << '\n'; - std::cout << j_number_integer << '\n'; - std::cout << j_number_float << '\n'; - std::cout << j_object << '\n'; - std::cout << j_array << '\n'; - std::cout << j_string << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_t.output deleted file mode 100644 index ea542cae..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/basic_json__value_t.output +++ /dev/null @@ -1,7 +0,0 @@ -null -false -0 -0.0 -{} -[] -"" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/begin.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/begin.cpp deleted file mode 100644 index 654835b0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/begin.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to the first element - json::iterator it = array.begin(); - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/begin.output b/Sources/backend-cpp/Vendor/json/doc/examples/begin.output deleted file mode 100644 index d00491fd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/begin.output +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/binary.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/binary.cpp deleted file mode 100644 index 617ce609..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/binary.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a binary vector - std::vector vec = {0xCA, 0xFE, 0xBA, 0xBE}; - - // create a binary JSON value with subtype 42 - json j = json::binary(vec, 42); - - // output type and subtype - std::cout << "type: " << j.type_name() << ", subtype: " << j.get_binary().subtype() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/binary.output b/Sources/backend-cpp/Vendor/json/doc/examples/binary.output deleted file mode 100644 index 74b05d23..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/binary.output +++ /dev/null @@ -1 +0,0 @@ -type: binary, subtype: 42 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/binary_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/binary_t.cpp deleted file mode 100644 index bfaee5ca..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/binary_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same>, json::binary_t>::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/binary_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/binary_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/binary_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/boolean_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/boolean_t.cpp deleted file mode 100644 index 75b8c99f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/boolean_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/boolean_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/boolean_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/boolean_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/cbegin.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/cbegin.cpp deleted file mode 100644 index bed2b372..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/cbegin.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - const json array = {1, 2, 3, 4, 5}; - - // get an iterator to the first element - json::const_iterator it = array.cbegin(); - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/cbegin.output b/Sources/backend-cpp/Vendor/json/doc/examples/cbegin.output deleted file mode 100644 index d00491fd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/cbegin.output +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/cend.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/cend.cpp deleted file mode 100644 index 3050f500..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/cend.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to one past the last element - json::const_iterator it = array.cend(); - - // decrement the iterator to point to the last element - --it; - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/cend.output b/Sources/backend-cpp/Vendor/json/doc/examples/cend.output deleted file mode 100644 index 7ed6ff82..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/cend.output +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/clear.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/clear.cpp deleted file mode 100644 index f081e7ed..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/clear.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call clear() - j_null.clear(); - j_boolean.clear(); - j_number_integer.clear(); - j_number_float.clear(); - j_object.clear(); - j_array.clear(); - j_string.clear(); - - // serialize the cleared values() - std::cout << j_null << '\n'; - std::cout << j_boolean << '\n'; - std::cout << j_number_integer << '\n'; - std::cout << j_number_float << '\n'; - std::cout << j_object << '\n'; - std::cout << j_array << '\n'; - std::cout << j_string << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/clear.output b/Sources/backend-cpp/Vendor/json/doc/examples/clear.output deleted file mode 100644 index ea542cae..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/clear.output +++ /dev/null @@ -1,7 +0,0 @@ -null -false -0 -0.0 -{} -[] -"" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/contains.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/contains.cpp deleted file mode 100644 index df8201c3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/contains.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create some JSON values - json j_object = R"( {"key": "value"} )"_json; - json j_array = R"( [1, 2, 3] )"_json; - - // call contains - std::cout << std::boolalpha << - "j_object contains 'key': " << j_object.contains("key") << '\n' << - "j_object contains 'another': " << j_object.contains("another") << '\n' << - "j_array contains 'key': " << j_array.contains("key") << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/contains.output b/Sources/backend-cpp/Vendor/json/doc/examples/contains.output deleted file mode 100644 index 14ad177b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/contains.output +++ /dev/null @@ -1,3 +0,0 @@ -j_object contains 'key': true -j_object contains 'another': false -j_array contains 'key': false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/contains_json_pointer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/contains_json_pointer.cpp deleted file mode 100644 index 54bcaa9e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/contains_json_pointer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json j = - { - {"number", 1}, {"string", "foo"}, {"array", {1, 2}} - }; - - std::cout << std::boolalpha - << j.contains("/number"_json_pointer) << '\n' - << j.contains("/string"_json_pointer) << '\n' - << j.contains("/array"_json_pointer) << '\n' - << j.contains("/array/1"_json_pointer) << '\n' - << j.contains("/array/-"_json_pointer) << '\n' - << j.contains("/array/4"_json_pointer) << '\n' - << j.contains("/baz"_json_pointer) << std::endl; - - try - { - // try to use an array index with leading '0' - j.contains("/array/01"_json_pointer); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } - - try - { - // try to use an array index that is not a number - j.contains("/array/one"_json_pointer); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/contains_json_pointer.output b/Sources/backend-cpp/Vendor/json/doc/examples/contains_json_pointer.output deleted file mode 100644 index dd1eb38c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/contains_json_pointer.output +++ /dev/null @@ -1,7 +0,0 @@ -true -true -true -true -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/count.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/count.cpp deleted file mode 100644 index a8d54b9d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/count.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object - json j_object = {{"one", 1}, {"two", 2}}; - - // call count() - auto count_two = j_object.count("two"); - auto count_three = j_object.count("three"); - - // print values - std::cout << "number of elements with key \"two\": " << count_two << '\n'; - std::cout << "number of elements with key \"three\": " << count_three << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/count.output b/Sources/backend-cpp/Vendor/json/doc/examples/count.output deleted file mode 100644 index d816fcb2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/count.output +++ /dev/null @@ -1,2 +0,0 @@ -number of elements with key "two": 1 -number of elements with key "three": 0 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/crbegin.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/crbegin.cpp deleted file mode 100644 index dc3209cf..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/crbegin.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to the reverse-beginning - json::const_reverse_iterator it = array.crbegin(); - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/crbegin.output b/Sources/backend-cpp/Vendor/json/doc/examples/crbegin.output deleted file mode 100644 index 7ed6ff82..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/crbegin.output +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/crend.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/crend.cpp deleted file mode 100644 index dff26093..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/crend.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to the reverse-end - json::const_reverse_iterator it = array.crend(); - - // increment the iterator to point to the first element - --it; - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/crend.output b/Sources/backend-cpp/Vendor/json/doc/examples/crend.output deleted file mode 100644 index d00491fd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/crend.output +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_extended.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_extended.cpp deleted file mode 100644 index f4c43f05..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_extended.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -# define JSON_DIAGNOSTICS 1 -#include - -using json = nlohmann::json; - -int main() -{ - json j; - j["address"]["street"] = "Fake Street"; - j["address"]["housenumber"] = "12"; - - try - { - int housenumber = j["address"]["housenumber"]; - } - catch (json::exception& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_extended.output b/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_extended.output deleted file mode 100644 index f142927a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_extended.output +++ /dev/null @@ -1 +0,0 @@ -[json.exception.type_error.302] (/address/housenumber) type must be number, but is string diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_standard.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_standard.cpp deleted file mode 100644 index 575c409e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_standard.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - json j; - j["address"]["street"] = "Fake Street"; - j["address"]["housenumber"] = "12"; - - try - { - int housenumber = j["address"]["housenumber"]; - } - catch (json::exception& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_standard.output b/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_standard.output deleted file mode 100644 index 79707a0c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/diagnostics_standard.output +++ /dev/null @@ -1 +0,0 @@ -[json.exception.type_error.302] type must be number, but is string diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/diff.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/diff.cpp deleted file mode 100644 index 71b19be6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/diff.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // the source document - json source = R"( - { - "baz": "qux", - "foo": "bar" - } - )"_json; - - // the target document - json target = R"( - { - "baz": "boo", - "hello": [ - "world" - ] - } - )"_json; - - // create the patch - json patch = json::diff(source, target); - - // roundtrip - json patched_source = source.patch(patch); - - // output patch and roundtrip result - std::cout << std::setw(4) << patch << "\n\n" - << std::setw(4) << patched_source << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/diff.output b/Sources/backend-cpp/Vendor/json/doc/examples/diff.output deleted file mode 100644 index 7dc79791..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/diff.output +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "op": "replace", - "path": "/baz", - "value": "boo" - }, - { - "op": "remove", - "path": "/foo" - }, - { - "op": "add", - "path": "/hello", - "value": [ - "world" - ] - } -] - -{ - "baz": "boo", - "hello": [ - "world" - ] -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/dump.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/dump.cpp deleted file mode 100644 index eb2d71f0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/dump.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hellö 😀!"; - - // call dump() - std::cout << "objects:" << '\n' - << j_object.dump() << "\n\n" - << j_object.dump(-1) << "\n\n" - << j_object.dump(0) << "\n\n" - << j_object.dump(4) << "\n\n" - << j_object.dump(1, '\t') << "\n\n"; - - std::cout << "arrays:" << '\n' - << j_array.dump() << "\n\n" - << j_array.dump(-1) << "\n\n" - << j_array.dump(0) << "\n\n" - << j_array.dump(4) << "\n\n" - << j_array.dump(1, '\t') << "\n\n"; - - std::cout << "strings:" << '\n' - << j_string.dump() << '\n' - << j_string.dump(-1, ' ', true) << '\n'; - - // create JSON value with invalid UTF-8 byte sequence - json j_invalid = "ä\xA9ü"; - try - { - std::cout << j_invalid.dump() << std::endl; - } - catch (json::type_error& e) - { - std::cout << e.what() << std::endl; - } - - std::cout << "string with replaced invalid characters: " - << j_invalid.dump(-1, ' ', false, json::error_handler_t::replace) - << "\nstring with ignored invalid characters: " - << j_invalid.dump(-1, ' ', false, json::error_handler_t::ignore) - << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/dump.output b/Sources/backend-cpp/Vendor/json/doc/examples/dump.output deleted file mode 100644 index 43009fe6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/dump.output +++ /dev/null @@ -1,55 +0,0 @@ -objects: -{"one":1,"two":2} - -{"one":1,"two":2} - -{ -"one": 1, -"two": 2 -} - -{ - "one": 1, - "two": 2 -} - -{ - "one": 1, - "two": 2 -} - -arrays: -[1,2,4,8,16] - -[1,2,4,8,16] - -[ -1, -2, -4, -8, -16 -] - -[ - 1, - 2, - 4, - 8, - 16 -] - -[ - 1, - 2, - 4, - 8, - 16 -] - -strings: -"Hellö 😀!" -"Hell\u00f6 \ud83d\ude00!" -[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9 -string with replaced invalid characters: "ä�ü" -string with ignored invalid characters: "äü" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/emplace.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/emplace.cpp deleted file mode 100644 index a5314910..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/emplace.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json object = {{"one", 1}, {"two", 2}}; - json null; - - // print values - std::cout << object << '\n'; - std::cout << null << '\n'; - - // add values - auto res1 = object.emplace("three", 3); - null.emplace("A", "a"); - null.emplace("B", "b"); - - // the following call will not add an object, because there is already - // a value stored at key "B" - auto res2 = null.emplace("B", "c"); - - // print values - std::cout << object << '\n'; - std::cout << *res1.first << " " << std::boolalpha << res1.second << '\n'; - - std::cout << null << '\n'; - std::cout << *res2.first << " " << std::boolalpha << res2.second << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/emplace.output b/Sources/backend-cpp/Vendor/json/doc/examples/emplace.output deleted file mode 100644 index 83d6f773..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/emplace.output +++ /dev/null @@ -1,6 +0,0 @@ -{"one":1,"two":2} -null -{"one":1,"three":3,"two":2} -3 true -{"A":"a","B":"b"} -"b" false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/emplace_back.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/emplace_back.cpp deleted file mode 100644 index e979a945..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/emplace_back.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json array = {1, 2, 3, 4, 5}; - json null; - - // print values - std::cout << array << '\n'; - std::cout << null << '\n'; - - // add values - array.emplace_back(6); - null.emplace_back("first"); - null.emplace_back(3, "second"); - - // print values - std::cout << array << '\n'; - std::cout << null << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/emplace_back.output b/Sources/backend-cpp/Vendor/json/doc/examples/emplace_back.output deleted file mode 100644 index bdd80d82..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/emplace_back.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3,4,5] -null -[1,2,3,4,5,6] -["first",["second","second","second"]] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/empty.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/empty.cpp deleted file mode 100644 index 6ef6e40e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/empty.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_object_empty(json::value_t::object); - json j_array = {1, 2, 4, 8, 16}; - json j_array_empty(json::value_t::array); - json j_string = "Hello, world"; - - // call empty() - std::cout << std::boolalpha; - std::cout << j_null.empty() << '\n'; - std::cout << j_boolean.empty() << '\n'; - std::cout << j_number_integer.empty() << '\n'; - std::cout << j_number_float.empty() << '\n'; - std::cout << j_object.empty() << '\n'; - std::cout << j_object_empty.empty() << '\n'; - std::cout << j_array.empty() << '\n'; - std::cout << j_array_empty.empty() << '\n'; - std::cout << j_string.empty() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/empty.output b/Sources/backend-cpp/Vendor/json/doc/examples/empty.output deleted file mode 100644 index d071a398..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/empty.output +++ /dev/null @@ -1,9 +0,0 @@ -true -false -false -false -false -true -false -true -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/end.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/end.cpp deleted file mode 100644 index 47beedb7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/end.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to one past the last element - json::iterator it = array.end(); - - // decrement the iterator to point to the last element - --it; - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/end.output b/Sources/backend-cpp/Vendor/json/doc/examples/end.output deleted file mode 100644 index 7ed6ff82..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/end.output +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType.cpp deleted file mode 100644 index f0d4ec6f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call erase() - j_boolean.erase(j_boolean.begin()); - j_number_integer.erase(j_number_integer.begin()); - j_number_float.erase(j_number_float.begin()); - j_object.erase(j_object.find("two")); - j_array.erase(j_array.begin() + 2); - j_string.erase(j_string.begin()); - - // print values - std::cout << j_boolean << '\n'; - std::cout << j_number_integer << '\n'; - std::cout << j_number_float << '\n'; - std::cout << j_object << '\n'; - std::cout << j_array << '\n'; - std::cout << j_string << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType.output b/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType.output deleted file mode 100644 index e392f8ea..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType.output +++ /dev/null @@ -1,6 +0,0 @@ -null -null -null -{"one":1} -[1,2,8,16] -null diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType_IteratorType.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType_IteratorType.cpp deleted file mode 100644 index 392511ff..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType_IteratorType.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call erase() - j_boolean.erase(j_boolean.begin(), j_boolean.end()); - j_number_integer.erase(j_number_integer.begin(), j_number_integer.end()); - j_number_float.erase(j_number_float.begin(), j_number_float.end()); - j_object.erase(j_object.find("two"), j_object.end()); - j_array.erase(j_array.begin() + 1, j_array.begin() + 3); - j_string.erase(j_string.begin(), j_string.end()); - - // print values - std::cout << j_boolean << '\n'; - std::cout << j_number_integer << '\n'; - std::cout << j_number_float << '\n'; - std::cout << j_object << '\n'; - std::cout << j_array << '\n'; - std::cout << j_string << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType_IteratorType.output b/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType_IteratorType.output deleted file mode 100644 index 5d01f008..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__IteratorType_IteratorType.output +++ /dev/null @@ -1,6 +0,0 @@ -null -null -null -{"one":1} -[1,8,16] -null diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__key_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/erase__key_type.cpp deleted file mode 100644 index 2fd84c86..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__key_type.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object - json j_object = {{"one", 1}, {"two", 2}}; - - // call erase() - auto count_one = j_object.erase("one"); - auto count_three = j_object.erase("three"); - - // print values - std::cout << j_object << '\n'; - std::cout << count_one << " " << count_three << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__key_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/erase__key_type.output deleted file mode 100644 index 28d79391..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__key_type.output +++ /dev/null @@ -1,2 +0,0 @@ -{"two":2} -1 0 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__size_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/erase__size_type.cpp deleted file mode 100644 index 81006238..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__size_type.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json j_array = {0, 1, 2, 3, 4, 5}; - - // call erase() - j_array.erase(2); - - // print values - std::cout << j_array << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/erase__size_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/erase__size_type.output deleted file mode 100644 index 4ad74061..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/erase__size_type.output +++ /dev/null @@ -1 +0,0 @@ -[0,1,3,4,5] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/exception.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/exception.cpp deleted file mode 100644 index 82696e61..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/exception.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - try - { - // calling at() for a non-existing key - json j = {{"foo", "bar"}}; - json k = j.at("non-existing"); - } - catch (json::exception& e) - { - // output exception information - std::cout << "message: " << e.what() << '\n' - << "exception id: " << e.id << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/exception.output b/Sources/backend-cpp/Vendor/json/doc/examples/exception.output deleted file mode 100644 index fa20df6e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/exception.output +++ /dev/null @@ -1,2 +0,0 @@ -message: [json.exception.out_of_range.403] key 'non-existing' not found -exception id: 403 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/find__key_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/find__key_type.cpp deleted file mode 100644 index 685ba776..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/find__key_type.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object - json j_object = {{"one", 1}, {"two", 2}}; - - // call find - auto it_two = j_object.find("two"); - auto it_three = j_object.find("three"); - - // print values - std::cout << std::boolalpha; - std::cout << "\"two\" was found: " << (it_two != j_object.end()) << '\n'; - std::cout << "value at key \"two\": " << *it_two << '\n'; - std::cout << "\"three\" was found: " << (it_three != j_object.end()) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/find__key_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/find__key_type.output deleted file mode 100644 index 509bb42d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/find__key_type.output +++ /dev/null @@ -1,3 +0,0 @@ -"two" was found: true -value at key "two": 2 -"three" was found: false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/flatten.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/flatten.cpp deleted file mode 100644 index 83f3ff6c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/flatten.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON value - json j = - { - {"pi", 3.141}, - {"happy", true}, - {"name", "Niels"}, - {"nothing", nullptr}, - { - "answer", { - {"everything", 42} - } - }, - {"list", {1, 0, 2}}, - { - "object", { - {"currency", "USD"}, - {"value", 42.99} - } - } - }; - - // call flatten() - std::cout << std::setw(4) << j.flatten() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/flatten.output b/Sources/backend-cpp/Vendor/json/doc/examples/flatten.output deleted file mode 100644 index 33bd4c4b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/flatten.output +++ /dev/null @@ -1,12 +0,0 @@ -{ - "/answer/everything": 42, - "/happy": true, - "/list/0": 1, - "/list/1": 0, - "/list/2": 2, - "/name": "Niels", - "/nothing": null, - "/object/currency": "USD", - "/object/value": 42.99, - "/pi": 3.141 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_bson.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/from_bson.cpp deleted file mode 100644 index c9d9fdfa..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_bson.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create byte vector - std::vector v = {0x1b, 0x00, 0x00, 0x00, 0x08, 0x63, 0x6f, 0x6d, - 0x70, 0x61, 0x63, 0x74, 0x00, 0x01, 0x10, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 - }; - - // deserialize it with BSON - json j = json::from_bson(v); - - // print the deserialized JSON value - std::cout << std::setw(2) << j << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_bson.output b/Sources/backend-cpp/Vendor/json/doc/examples/from_bson.output deleted file mode 100644 index 259f63bd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_bson.output +++ /dev/null @@ -1,4 +0,0 @@ -{ - "compact": true, - "schema": 0 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_cbor.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/from_cbor.cpp deleted file mode 100644 index e685329e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_cbor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create byte vector - std::vector v = {0xa2, 0x67, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, - 0x74, 0xf5, 0x66, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x00 - }; - - // deserialize it with CBOR - json j = json::from_cbor(v); - - // print the deserialized JSON value - std::cout << std::setw(2) << j << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_cbor.output b/Sources/backend-cpp/Vendor/json/doc/examples/from_cbor.output deleted file mode 100644 index 259f63bd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_cbor.output +++ /dev/null @@ -1,4 +0,0 @@ -{ - "compact": true, - "schema": 0 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_msgpack.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/from_msgpack.cpp deleted file mode 100644 index 5c2183f1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_msgpack.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create byte vector - std::vector v = {0x82, 0xa7, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, - 0x74, 0xc3, 0xa6, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x00 - }; - - // deserialize it with MessagePack - json j = json::from_msgpack(v); - - // print the deserialized JSON value - std::cout << std::setw(2) << j << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_msgpack.output b/Sources/backend-cpp/Vendor/json/doc/examples/from_msgpack.output deleted file mode 100644 index 259f63bd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_msgpack.output +++ /dev/null @@ -1,4 +0,0 @@ -{ - "compact": true, - "schema": 0 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_ubjson.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/from_ubjson.cpp deleted file mode 100644 index 1e85e4e3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_ubjson.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create byte vector - std::vector v = {0x7B, 0x69, 0x07, 0x63, 0x6F, 0x6D, 0x70, 0x61, - 0x63, 0x74, 0x54, 0x69, 0x06, 0x73, 0x63, 0x68, - 0x65, 0x6D, 0x61, 0x69, 0x00, 0x7D - }; - - // deserialize it with UBJSON - json j = json::from_ubjson(v); - - // print the deserialized JSON value - std::cout << std::setw(2) << j << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/from_ubjson.output b/Sources/backend-cpp/Vendor/json/doc/examples/from_ubjson.output deleted file mode 100644 index 259f63bd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/from_ubjson.output +++ /dev/null @@ -1,4 +0,0 @@ -{ - "compact": true, - "schema": 0 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/front.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/front.cpp deleted file mode 100644 index a0f63068..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/front.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_object_empty(json::value_t::object); - json j_array = {1, 2, 4, 8, 16}; - json j_array_empty(json::value_t::array); - json j_string = "Hello, world"; - - // call front() - //std::cout << j_null.front() << '\n'; // would throw - std::cout << j_boolean.front() << '\n'; - std::cout << j_number_integer.front() << '\n'; - std::cout << j_number_float.front() << '\n'; - std::cout << j_object.front() << '\n'; - //std::cout << j_object_empty.front() << '\n'; // undefined behavior - std::cout << j_array.front() << '\n'; - //std::cout << j_array_empty.front() << '\n'; // undefined behavior - std::cout << j_string.front() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/front.output b/Sources/backend-cpp/Vendor/json/doc/examples/front.output deleted file mode 100644 index 6301db53..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/front.output +++ /dev/null @@ -1,6 +0,0 @@ -true -17 -23.42 -1 -1 -"Hello, world" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get__PointerType.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/get__PointerType.cpp deleted file mode 100644 index 2f32ed7a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get__PointerType.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON number - json value = 17; - - // explicitly getting pointers - auto p1 = value.get(); - auto p2 = value.get(); - auto p3 = value.get(); - auto p4 = value.get(); - auto p5 = value.get(); - - // print the pointees - std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n'; - std::cout << std::boolalpha << (p5 == nullptr) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get__PointerType.output b/Sources/backend-cpp/Vendor/json/doc/examples/get__PointerType.output deleted file mode 100644 index a15dd774..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get__PointerType.output +++ /dev/null @@ -1,2 +0,0 @@ -17 17 17 17 -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get__ValueType_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/get__ValueType_const.cpp deleted file mode 100644 index 7a703aae..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get__ValueType_const.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value with different types - json json_types = - { - {"boolean", true}, - { - "number", { - {"integer", 42}, - {"floating-point", 17.23} - } - }, - {"string", "Hello, world!"}, - {"array", {1, 2, 3, 4, 5}}, - {"null", nullptr} - }; - - // use explicit conversions - auto v1 = json_types["boolean"].get(); - auto v2 = json_types["number"]["integer"].get(); - auto v3 = json_types["number"]["integer"].get(); - auto v4 = json_types["number"]["floating-point"].get(); - auto v5 = json_types["number"]["floating-point"].get(); - auto v6 = json_types["string"].get(); - auto v7 = json_types["array"].get>(); - auto v8 = json_types.get>(); - - // print the conversion results - std::cout << v1 << '\n'; - std::cout << v2 << ' ' << v3 << '\n'; - std::cout << v4 << ' ' << v5 << '\n'; - std::cout << v6 << '\n'; - - for (auto i : v7) - { - std::cout << i << ' '; - } - std::cout << "\n\n"; - - for (auto i : v8) - { - std::cout << i.first << ": " << i.second << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get__ValueType_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/get__ValueType_const.output deleted file mode 100644 index 5cd9cd3a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get__ValueType_const.output +++ /dev/null @@ -1,11 +0,0 @@ -1 -42 42 -17.23 17 -Hello, world! -1 2 3 4 5 - -string: "Hello, world!" -number: {"floating-point":17.23,"integer":42} -null: null -boolean: true -array: [1,2,3,4,5] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_binary.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/get_binary.cpp deleted file mode 100644 index 617ce609..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_binary.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a binary vector - std::vector vec = {0xCA, 0xFE, 0xBA, 0xBE}; - - // create a binary JSON value with subtype 42 - json j = json::binary(vec, 42); - - // output type and subtype - std::cout << "type: " << j.type_name() << ", subtype: " << j.get_binary().subtype() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_binary.output b/Sources/backend-cpp/Vendor/json/doc/examples/get_binary.output deleted file mode 100644 index 74b05d23..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_binary.output +++ /dev/null @@ -1 +0,0 @@ -type: binary, subtype: 42 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_ptr.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/get_ptr.cpp deleted file mode 100644 index 564ce0f4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_ptr.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON number - json value = 17; - - // explicitly getting pointers - auto p1 = value.get_ptr(); - auto p2 = value.get_ptr(); - auto p3 = value.get_ptr(); - auto p4 = value.get_ptr(); - auto p5 = value.get_ptr(); - - // print the pointees - std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n'; - std::cout << std::boolalpha << (p5 == nullptr) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_ptr.output b/Sources/backend-cpp/Vendor/json/doc/examples/get_ptr.output deleted file mode 100644 index a15dd774..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_ptr.output +++ /dev/null @@ -1,2 +0,0 @@ -17 17 17 17 -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_ref.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/get_ref.cpp deleted file mode 100644 index ab25946b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_ref.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON number - json value = 17; - - // explicitly getting references - auto r1 = value.get_ref(); - auto r2 = value.get_ref(); - - // print the values - std::cout << r1 << ' ' << r2 << '\n'; - - // incompatible type throws exception - try - { - auto r3 = value.get_ref(); - } - catch (json::type_error& ex) - { - std::cout << ex.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_ref.output b/Sources/backend-cpp/Vendor/json/doc/examples/get_ref.output deleted file mode 100644 index 3811afa2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_ref.output +++ /dev/null @@ -1,2 +0,0 @@ -17 17 -[json.exception.type_error.303] incompatible ReferenceType for get_ref, actual type is number diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_to.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/get_to.cpp deleted file mode 100644 index 4705b172..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_to.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value with different types - json json_types = - { - {"boolean", true}, - { - "number", { - {"integer", 42}, - {"floating-point", 17.23} - } - }, - {"string", "Hello, world!"}, - {"array", {1, 2, 3, 4, 5}}, - {"null", nullptr} - }; - - bool v1; - int v2; - short v3; - float v4; - int v5; - std::string v6; - std::vector v7; - std::unordered_map v8; - - - // use explicit conversions - json_types["boolean"].get_to(v1); - json_types["number"]["integer"].get_to(v2); - json_types["number"]["integer"].get_to(v3); - json_types["number"]["floating-point"].get_to(v4); - json_types["number"]["floating-point"].get_to(v5); - json_types["string"].get_to(v6); - json_types["array"].get_to(v7); - json_types.get_to(v8); - - // print the conversion results - std::cout << v1 << '\n'; - std::cout << v2 << ' ' << v3 << '\n'; - std::cout << v4 << ' ' << v5 << '\n'; - std::cout << v6 << '\n'; - - for (auto i : v7) - { - std::cout << i << ' '; - } - std::cout << "\n\n"; - - for (auto i : v8) - { - std::cout << i.first << ": " << i.second << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/get_to.output b/Sources/backend-cpp/Vendor/json/doc/examples/get_to.output deleted file mode 100644 index 5cd9cd3a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/get_to.output +++ /dev/null @@ -1,11 +0,0 @@ -1 -42 42 -17.23 17 -Hello, world! -1 2 3 4 5 - -string: "Hello, world!" -number: {"floating-point":17.23,"integer":42} -null: null -boolean: true -array: [1,2,3,4,5] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/insert.cpp deleted file mode 100644 index 4ee60987..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json v = {1, 2, 3, 4}; - - // insert number 10 before number 3 - auto new_pos = v.insert(v.begin() + 2, 10); - - // output new array and result of insert call - std::cout << *new_pos << '\n'; - std::cout << v << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert.output b/Sources/backend-cpp/Vendor/json/doc/examples/insert.output deleted file mode 100644 index ed5cab1d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert.output +++ /dev/null @@ -1,2 +0,0 @@ -10 -[1,2,10,3,4] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__count.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/insert__count.cpp deleted file mode 100644 index ce33b93e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__count.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json v = {1, 2, 3, 4}; - - // insert number 7 copies of number 7 before number 3 - auto new_pos = v.insert(v.begin() + 2, 7, 7); - - // output new array and result of insert call - std::cout << *new_pos << '\n'; - std::cout << v << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__count.output b/Sources/backend-cpp/Vendor/json/doc/examples/insert__count.output deleted file mode 100644 index 294685ac..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__count.output +++ /dev/null @@ -1,2 +0,0 @@ -7 -[1,2,7,7,7,7,7,7,7,3,4] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__ilist.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/insert__ilist.cpp deleted file mode 100644 index a20766a1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__ilist.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json v = {1, 2, 3, 4}; - - // insert range from v2 before the end of array v - auto new_pos = v.insert(v.end(), {7, 8, 9}); - - // output new array and result of insert call - std::cout << *new_pos << '\n'; - std::cout << v << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__ilist.output b/Sources/backend-cpp/Vendor/json/doc/examples/insert__ilist.output deleted file mode 100644 index b2fc7eeb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__ilist.output +++ /dev/null @@ -1,2 +0,0 @@ -7 -[1,2,3,4,7,8,9] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/insert__range.cpp deleted file mode 100644 index 92fe63b0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json v = {1, 2, 3, 4}; - - // create a JSON array to copy values from - json v2 = {"one", "two", "three", "four"}; - - // insert range from v2 before the end of array v - auto new_pos = v.insert(v.end(), v2.begin(), v2.end()); - - // output new array and result of insert call - std::cout << *new_pos << '\n'; - std::cout << v << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range.output b/Sources/backend-cpp/Vendor/json/doc/examples/insert__range.output deleted file mode 100644 index d50e9f63..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range.output +++ /dev/null @@ -1,2 +0,0 @@ -"one" -[1,2,3,4,"one","two","three","four"] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range_object.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/insert__range_object.cpp deleted file mode 100644 index 97373d3b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range_object.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create two JSON objects - json j1 = {{"one", "eins"}, {"two", "zwei"}}; - json j2 = {{"eleven", "elf"}, {"seventeen", "siebzehn"}}; - - // output objects - std::cout << j1 << '\n'; - std::cout << j2 << '\n'; - - // insert range from j2 to j1 - j1.insert(j2.begin(), j2.end()); - - // output result of insert call - std::cout << j1 << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range_object.output b/Sources/backend-cpp/Vendor/json/doc/examples/insert__range_object.output deleted file mode 100644 index a5985158..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/insert__range_object.output +++ /dev/null @@ -1,3 +0,0 @@ -{"one":"eins","two":"zwei"} -{"eleven":"elf","seventeen":"siebzehn"} -{"eleven":"elf","one":"eins","seventeen":"siebzehn","two":"zwei"} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/invalid_iterator.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/invalid_iterator.cpp deleted file mode 100644 index 5d3e622e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/invalid_iterator.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - try - { - // calling iterator::key() on non-object iterator - json j = "string"; - json::iterator it = j.begin(); - auto k = it.key(); - } - catch (json::invalid_iterator& e) - { - // output exception information - std::cout << "message: " << e.what() << '\n' - << "exception id: " << e.id << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/invalid_iterator.output b/Sources/backend-cpp/Vendor/json/doc/examples/invalid_iterator.output deleted file mode 100644 index 8668c16d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/invalid_iterator.output +++ /dev/null @@ -1,2 +0,0 @@ -message: [json.exception.invalid_iterator.207] cannot use key() for non-object iterators -exception id: 207 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_array.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_array.cpp deleted file mode 100644 index 8ecc4503..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_array.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_array() - std::cout << std::boolalpha; - std::cout << j_null.is_array() << '\n'; - std::cout << j_boolean.is_array() << '\n'; - std::cout << j_number_integer.is_array() << '\n'; - std::cout << j_number_unsigned_integer.is_array() << '\n'; - std::cout << j_number_float.is_array() << '\n'; - std::cout << j_object.is_array() << '\n'; - std::cout << j_array.is_array() << '\n'; - std::cout << j_string.is_array() << '\n'; - std::cout << j_binary.is_array() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_array.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_array.output deleted file mode 100644 index 7b7ef3f1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_array.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -false -false -true -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_binary.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_binary.cpp deleted file mode 100644 index d7f049ec..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_binary.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_binary() - std::cout << std::boolalpha; - std::cout << j_null.is_binary() << '\n'; - std::cout << j_boolean.is_binary() << '\n'; - std::cout << j_number_integer.is_binary() << '\n'; - std::cout << j_number_unsigned_integer.is_binary() << '\n'; - std::cout << j_number_float.is_binary() << '\n'; - std::cout << j_object.is_binary() << '\n'; - std::cout << j_array.is_binary() << '\n'; - std::cout << j_string.is_binary() << '\n'; - std::cout << j_binary.is_binary() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_binary.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_binary.output deleted file mode 100644 index 505e76e4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_binary.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -false -false -false -false -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_boolean.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_boolean.cpp deleted file mode 100644 index 0b798195..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_boolean.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_boolean() - std::cout << std::boolalpha; - std::cout << j_null.is_boolean() << '\n'; - std::cout << j_boolean.is_boolean() << '\n'; - std::cout << j_number_integer.is_boolean() << '\n'; - std::cout << j_number_unsigned_integer.is_boolean() << '\n'; - std::cout << j_number_float.is_boolean() << '\n'; - std::cout << j_object.is_boolean() << '\n'; - std::cout << j_array.is_boolean() << '\n'; - std::cout << j_string.is_boolean() << '\n'; - std::cout << j_binary.is_boolean() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_boolean.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_boolean.output deleted file mode 100644 index eace89d2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_boolean.output +++ /dev/null @@ -1,9 +0,0 @@ -false -true -false -false -false -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_discarded.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_discarded.cpp deleted file mode 100644 index 09016655..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_discarded.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_discarded() - std::cout << std::boolalpha; - std::cout << j_null.is_discarded() << '\n'; - std::cout << j_boolean.is_discarded() << '\n'; - std::cout << j_number_integer.is_discarded() << '\n'; - std::cout << j_number_unsigned_integer.is_discarded() << '\n'; - std::cout << j_number_float.is_discarded() << '\n'; - std::cout << j_object.is_discarded() << '\n'; - std::cout << j_array.is_discarded() << '\n'; - std::cout << j_string.is_discarded() << '\n'; - std::cout << j_binary.is_discarded() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_discarded.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_discarded.output deleted file mode 100644 index 14718f64..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_discarded.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -false -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_null.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_null.cpp deleted file mode 100644 index 8a843326..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_null.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_null() - std::cout << std::boolalpha; - std::cout << j_null.is_null() << '\n'; - std::cout << j_boolean.is_null() << '\n'; - std::cout << j_number_integer.is_null() << '\n'; - std::cout << j_number_unsigned_integer.is_null() << '\n'; - std::cout << j_number_float.is_null() << '\n'; - std::cout << j_object.is_null() << '\n'; - std::cout << j_array.is_null() << '\n'; - std::cout << j_string.is_null() << '\n'; - std::cout << j_binary.is_null() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_null.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_null.output deleted file mode 100644 index 42bbee2a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_null.output +++ /dev/null @@ -1,9 +0,0 @@ -true -false -false -false -false -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_number.cpp deleted file mode 100644 index f107a048..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_number() - std::cout << std::boolalpha; - std::cout << j_null.is_number() << '\n'; - std::cout << j_boolean.is_number() << '\n'; - std::cout << j_number_integer.is_number() << '\n'; - std::cout << j_number_unsigned_integer.is_number() << '\n'; - std::cout << j_number_float.is_number() << '\n'; - std::cout << j_object.is_number() << '\n'; - std::cout << j_array.is_number() << '\n'; - std::cout << j_string.is_number() << '\n'; - std::cout << j_binary.is_number() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_number.output deleted file mode 100644 index 53ef340b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -true -true -true -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_float.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_number_float.cpp deleted file mode 100644 index bba2b446..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_float.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_number_float() - std::cout << std::boolalpha; - std::cout << j_null.is_number_float() << '\n'; - std::cout << j_boolean.is_number_float() << '\n'; - std::cout << j_number_integer.is_number_float() << '\n'; - std::cout << j_number_unsigned_integer.is_number_float() << '\n'; - std::cout << j_number_float.is_number_float() << '\n'; - std::cout << j_object.is_number_float() << '\n'; - std::cout << j_array.is_number_float() << '\n'; - std::cout << j_string.is_number_float() << '\n'; - std::cout << j_binary.is_number_float() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_float.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_number_float.output deleted file mode 100644 index 0e64601a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_float.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -true -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_integer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_number_integer.cpp deleted file mode 100644 index 8d6a5ae1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_integer.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_number_integer() - std::cout << std::boolalpha; - std::cout << j_null.is_number_integer() << '\n'; - std::cout << j_boolean.is_number_integer() << '\n'; - std::cout << j_number_integer.is_number_integer() << '\n'; - std::cout << j_number_unsigned_integer.is_number_integer() << '\n'; - std::cout << j_number_float.is_number_integer() << '\n'; - std::cout << j_object.is_number_integer() << '\n'; - std::cout << j_array.is_number_integer() << '\n'; - std::cout << j_string.is_number_integer() << '\n'; - std::cout << j_binary.is_number_integer() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_integer.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_number_integer.output deleted file mode 100644 index c1df310f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_integer.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -true -true -false -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_unsigned.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_number_unsigned.cpp deleted file mode 100644 index b52ac6b3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_unsigned.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_unsigned_integer = 12345678987654321u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_number_unsigned() - std::cout << std::boolalpha; - std::cout << j_null.is_number_unsigned() << '\n'; - std::cout << j_boolean.is_number_unsigned() << '\n'; - std::cout << j_number_integer.is_number_unsigned() << '\n'; - std::cout << j_number_unsigned_integer.is_number_unsigned() << '\n'; - std::cout << j_number_float.is_number_unsigned() << '\n'; - std::cout << j_object.is_number_unsigned() << '\n'; - std::cout << j_array.is_number_unsigned() << '\n'; - std::cout << j_string.is_number_unsigned() << '\n'; - std::cout << j_binary.is_number_unsigned() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_unsigned.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_number_unsigned.output deleted file mode 100644 index e6059d48..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_number_unsigned.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -true -false -false -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_object.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_object.cpp deleted file mode 100644 index a0216fd2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_object.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_number_unsigned_integer = 12345678987654321u; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_object() - std::cout << std::boolalpha; - std::cout << j_null.is_object() << '\n'; - std::cout << j_boolean.is_object() << '\n'; - std::cout << j_number_integer.is_object() << '\n'; - std::cout << j_number_unsigned_integer.is_object() << '\n'; - std::cout << j_number_float.is_object() << '\n'; - std::cout << j_object.is_object() << '\n'; - std::cout << j_array.is_object() << '\n'; - std::cout << j_string.is_object() << '\n'; - std::cout << j_binary.is_object() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_object.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_object.output deleted file mode 100644 index d9a429f8..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_object.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -false -true -false -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_primitive.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_primitive.cpp deleted file mode 100644 index af3968e8..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_primitive.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_number_unsigned_integer = 12345678987654321u; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_primitive() - std::cout << std::boolalpha; - std::cout << j_null.is_primitive() << '\n'; - std::cout << j_boolean.is_primitive() << '\n'; - std::cout << j_number_integer.is_primitive() << '\n'; - std::cout << j_number_unsigned_integer.is_primitive() << '\n'; - std::cout << j_number_float.is_primitive() << '\n'; - std::cout << j_object.is_primitive() << '\n'; - std::cout << j_array.is_primitive() << '\n'; - std::cout << j_string.is_primitive() << '\n'; - std::cout << j_binary.is_primitive() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_primitive.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_primitive.output deleted file mode 100644 index 77af24c0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_primitive.output +++ /dev/null @@ -1,9 +0,0 @@ -true -true -true -true -true -false -false -true -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_string.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_string.cpp deleted file mode 100644 index c89f550b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_string.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_number_unsigned_integer = 12345678987654321u; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_string() - std::cout << std::boolalpha; - std::cout << j_null.is_string() << '\n'; - std::cout << j_boolean.is_string() << '\n'; - std::cout << j_number_integer.is_string() << '\n'; - std::cout << j_number_unsigned_integer.is_string() << '\n'; - std::cout << j_number_float.is_string() << '\n'; - std::cout << j_object.is_string() << '\n'; - std::cout << j_array.is_string() << '\n'; - std::cout << j_string.is_string() << '\n'; - std::cout << j_binary.is_string() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_string.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_string.output deleted file mode 100644 index 6446f187..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_string.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -false -false -false -true -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_structured.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/is_structured.cpp deleted file mode 100644 index 41947b1b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_structured.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_number_unsigned_integer = 12345678987654321u; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - json j_binary = json::binary({1, 2, 3}); - - // call is_structured() - std::cout << std::boolalpha; - std::cout << j_null.is_structured() << '\n'; - std::cout << j_boolean.is_structured() << '\n'; - std::cout << j_number_integer.is_structured() << '\n'; - std::cout << j_number_unsigned_integer.is_structured() << '\n'; - std::cout << j_number_float.is_structured() << '\n'; - std::cout << j_object.is_structured() << '\n'; - std::cout << j_array.is_structured() << '\n'; - std::cout << j_string.is_structured() << '\n'; - std::cout << j_binary.is_structured() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/is_structured.output b/Sources/backend-cpp/Vendor/json/doc/examples/is_structured.output deleted file mode 100644 index 625c124b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/is_structured.output +++ /dev/null @@ -1,9 +0,0 @@ -false -false -false -false -false -true -true -false -false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/items.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/items.cpp deleted file mode 100644 index 9cd2b51b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/items.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - - // example for an object - for (auto& x : j_object.items()) - { - std::cout << "key: " << x.key() << ", value: " << x.value() << '\n'; - } - - // example for an array - for (auto& x : j_array.items()) - { - std::cout << "key: " << x.key() << ", value: " << x.value() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/items.output b/Sources/backend-cpp/Vendor/json/doc/examples/items.output deleted file mode 100644 index 89b09f52..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/items.output +++ /dev/null @@ -1,7 +0,0 @@ -key: one, value: 1 -key: two, value: 2 -key: 0, value: 1 -key: 1, value: 2 -key: 2, value: 4 -key: 3, value: 8 -key: 4, value: 16 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/iterator_wrapper.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/iterator_wrapper.cpp deleted file mode 100644 index 84d37254..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/iterator_wrapper.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - - ////////////////////////////////////////////////////////////////////////// - // The static function iterator_wrapper was deprecated in version 3.1.0 - // and will be removed in version 4.0.0. Please replace all occurrences - // of iterator_wrapper(j) with j.items(). - ////////////////////////////////////////////////////////////////////////// - - // example for an object - for (auto& x : json::iterator_wrapper(j_object)) - { - std::cout << "key: " << x.key() << ", value: " << x.value() << '\n'; - } - - // example for an array - for (auto& x : json::iterator_wrapper(j_array)) - { - std::cout << "key: " << x.key() << ", value: " << x.value() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/iterator_wrapper.output b/Sources/backend-cpp/Vendor/json/doc/examples/iterator_wrapper.output deleted file mode 100644 index 89b09f52..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/iterator_wrapper.output +++ /dev/null @@ -1,7 +0,0 @@ -key: one, value: 1 -key: two, value: 2 -key: 0, value: 1 -key: 1, value: 2 -key: 2, value: 4 -key: 3, value: 8 -key: 4, value: 16 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer.cpp deleted file mode 100644 index 75b97175..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // correct JSON pointers - json::json_pointer p1; - json::json_pointer p2(""); - json::json_pointer p3("/"); - json::json_pointer p4("//"); - json::json_pointer p5("/foo/bar"); - json::json_pointer p6("/foo/bar/-"); - json::json_pointer p7("/foo/~0"); - json::json_pointer p8("/foo/~1"); - - // error: JSON pointer does not begin with a slash - try - { - json::json_pointer p9("foo"); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } - - // error: JSON pointer uses escape symbol ~ not followed by 0 or 1 - try - { - json::json_pointer p10("/foo/~"); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } - - // error: JSON pointer uses escape symbol ~ not followed by 0 or 1 - try - { - json::json_pointer p11("/foo/~3"); - } - catch (json::parse_error& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer.output deleted file mode 100644 index 9e027d6d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer.output +++ /dev/null @@ -1,3 +0,0 @@ -[json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'foo' -[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1' -[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1' diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__back.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__back.cpp deleted file mode 100644 index 3d57c589..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__back.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // different JSON Pointers - json::json_pointer ptr1("/foo"); - json::json_pointer ptr2("/foo/0"); - - // call empty() - std::cout << "last reference token of " << ptr1 << " is " << ptr1.back() << '\n' - << "last reference token of " << ptr2 << " is " << ptr2.back() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__back.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__back.output deleted file mode 100644 index da4d0279..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__back.output +++ /dev/null @@ -1,2 +0,0 @@ -last reference token of "/foo" is foo -last reference token of "/foo/0" is 0 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__empty.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__empty.cpp deleted file mode 100644 index 5daaadc6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__empty.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // different JSON Pointers - json::json_pointer ptr0; - json::json_pointer ptr1(""); - json::json_pointer ptr2("/foo"); - json::json_pointer ptr3("/foo/0"); - - // call empty() - std::cout << std::boolalpha - << ptr0 << ": " << ptr0.empty() << '\n' - << ptr1 << ": " << ptr1.empty() << '\n' - << ptr2 << ": " << ptr2.empty() << '\n' - << ptr3 << ": " << ptr3.empty() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__empty.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__empty.output deleted file mode 100644 index a7ee49c1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__empty.output +++ /dev/null @@ -1,4 +0,0 @@ -"": true -"": true -"/foo": false -"/foo/0": false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add.cpp deleted file mode 100644 index a2bbf59e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON pointer - json::json_pointer ptr("/foo"); - std::cout << ptr << '\n'; - - // append a JSON Pointer - ptr /= json::json_pointer("/bar/baz"); - std::cout << ptr << '\n'; - - // append a string - ptr /= "fob"; - std::cout << ptr << '\n'; - - // append an array index - ptr /= 42; - std::cout << ptr << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add.output deleted file mode 100644 index ae13afe2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add.output +++ /dev/null @@ -1,4 +0,0 @@ -"/foo" -"/foo/bar/baz" -"/foo/bar/baz/fob" -"/foo/bar/baz/fob/42" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add_binary.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add_binary.cpp deleted file mode 100644 index 89e0a6a5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add_binary.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON pointer - json::json_pointer ptr("/foo"); - - // append a JSON Pointer - std::cout << ptr / json::json_pointer("/bar/baz") << '\n'; - - // append a string - std::cout << ptr / "fob" << '\n'; - - // append an array index - std::cout << ptr / 42 << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add_binary.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add_binary.output deleted file mode 100644 index 7536042c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__operator_add_binary.output +++ /dev/null @@ -1,3 +0,0 @@ -"/foo/bar/baz" -"/foo/fob" -"/foo/42" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__parent_pointer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__parent_pointer.cpp deleted file mode 100644 index 6021463a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__parent_pointer.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // different JSON Pointers - json::json_pointer ptr1(""); - json::json_pointer ptr2("/foo"); - json::json_pointer ptr3("/foo/0"); - - // call parent_pointer() - std::cout << std::boolalpha - << "parent of " << ptr1 << " is " << ptr1.parent_pointer() << '\n' - << "parent of " << ptr2 << " is " << ptr2.parent_pointer() << '\n' - << "parent of " << ptr3 << " is " << ptr3.parent_pointer() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__parent_pointer.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__parent_pointer.output deleted file mode 100644 index 4cc6f3f1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__parent_pointer.output +++ /dev/null @@ -1,3 +0,0 @@ -parent of "" is "" -parent of "/foo" is "" -parent of "/foo/0" is "/foo" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__pop_back.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__pop_back.cpp deleted file mode 100644 index ed3417ec..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__pop_back.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create empty JSON Pointer - json::json_pointer ptr("/foo/bar/baz"); - std::cout << ptr << '\n'; - - // call pop_back() - ptr.pop_back(); - std::cout << ptr << '\n'; - - ptr.pop_back(); - std::cout << ptr << '\n'; - - ptr.pop_back(); - std::cout << ptr << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__pop_back.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__pop_back.output deleted file mode 100644 index b0468dc5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__pop_back.output +++ /dev/null @@ -1,4 +0,0 @@ -"/foo/bar/baz" -"/foo/bar" -"/foo" -"" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__push_back.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__push_back.cpp deleted file mode 100644 index d6536b3f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__push_back.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create empty JSON Pointer - json::json_pointer ptr; - std::cout << ptr << '\n'; - - // call push_back() - ptr.push_back("foo"); - std::cout << ptr << '\n'; - - ptr.push_back("0"); - std::cout << ptr << '\n'; - - ptr.push_back("bar"); - std::cout << ptr << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__push_back.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__push_back.output deleted file mode 100644 index 92c019cd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__push_back.output +++ /dev/null @@ -1,4 +0,0 @@ -"" -"/foo" -"/foo/0" -"/foo/0/bar" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__to_string.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__to_string.cpp deleted file mode 100644 index da397cdf..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__to_string.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // different JSON Pointers - json::json_pointer ptr1(""); - json::json_pointer ptr2("/foo"); - json::json_pointer ptr3("/foo/0"); - json::json_pointer ptr4("/"); - json::json_pointer ptr5("/a~1b"); - json::json_pointer ptr6("/c%d"); - json::json_pointer ptr7("/e^f"); - json::json_pointer ptr8("/g|h"); - json::json_pointer ptr9("/i\\j"); - json::json_pointer ptr10("/k\"l"); - json::json_pointer ptr11("/ "); - json::json_pointer ptr12("/m~0n"); - - - std::cout << ptr1.to_string() << '\n' - << ptr2.to_string() << '\n' - << ptr3.to_string() << '\n' - << ptr4.to_string() << '\n' - << ptr5.to_string() << '\n' - << ptr6.to_string() << '\n' - << ptr7.to_string() << '\n' - << ptr8.to_string() << '\n' - << ptr9.to_string() << '\n' - << ptr10.to_string() << '\n' - << ptr11.to_string() << '\n' - << ptr12.to_string() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__to_string.output b/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__to_string.output deleted file mode 100644 index c4b5ea8f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/json_pointer__to_string.output +++ /dev/null @@ -1,12 +0,0 @@ - -/foo -/foo/0 -/ -/a~1b -/c%d -/e^f -/g|h -/i\j -/k"l -/ -/m~0n diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/max_size.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/max_size.cpp deleted file mode 100644 index c2ffc546..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/max_size.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call max_size() - std::cout << j_null.max_size() << '\n'; - std::cout << j_boolean.max_size() << '\n'; - std::cout << j_number_integer.max_size() << '\n'; - std::cout << j_number_float.max_size() << '\n'; - std::cout << j_object.max_size() << '\n'; - std::cout << j_array.max_size() << '\n'; - std::cout << j_string.max_size() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/max_size.output b/Sources/backend-cpp/Vendor/json/doc/examples/max_size.output deleted file mode 100644 index 8c79995b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/max_size.output +++ /dev/null @@ -1,7 +0,0 @@ -0 -1 -1 -1 -256204778801521550 -1152921504606846975 -1 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/merge_patch.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/merge_patch.cpp deleted file mode 100644 index b8804d7c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/merge_patch.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include // for std::setw - -using json = nlohmann::json; - -int main() -{ - // the original document - json document = R"({ - "title": "Goodbye!", - "author": { - "givenName": "John", - "familyName": "Doe" - }, - "tags": [ - "example", - "sample" - ], - "content": "This will be unchanged" - })"_json; - - // the patch - json patch = R"({ - "title": "Hello!", - "phoneNumber": "+01-123-456-7890", - "author": { - "familyName": null - }, - "tags": [ - "example" - ] - })"_json; - - // apply the patch - document.merge_patch(patch); - - // output original and patched document - std::cout << std::setw(4) << document << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/merge_patch.output b/Sources/backend-cpp/Vendor/json/doc/examples/merge_patch.output deleted file mode 100644 index 96adb7b3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/merge_patch.output +++ /dev/null @@ -1,11 +0,0 @@ -{ - "author": { - "givenName": "John" - }, - "content": "This will be unchanged", - "phoneNumber": "+01-123-456-7890", - "tags": [ - "example" - ], - "title": "Hello!" -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/meta.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/meta.cpp deleted file mode 100644 index a051575b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/meta.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // call meta() - std::cout << std::setw(4) << json::meta() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/meta.output b/Sources/backend-cpp/Vendor/json/doc/examples/meta.output deleted file mode 100644 index c35a3200..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/meta.output +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compiler": { - "c++": "201103", - "family": "clang", - "version": "13.0.0 (clang-1300.0.29.30)" - }, - "copyright": "(C) 2013-2022 Niels Lohmann", - "name": "JSON for Modern C++", - "platform": "apple", - "url": "https://github.com/nlohmann/json", - "version": { - "major": 3, - "minor": 10, - "patch": 5, - "string": "3.10.5" - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/number_float_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/number_float_t.cpp deleted file mode 100644 index 21211dc5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/number_float_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/number_float_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/number_float_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/number_float_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/number_integer_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/number_integer_t.cpp deleted file mode 100644 index 75ee57b6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/number_integer_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/number_integer_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/number_integer_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/number_integer_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/number_unsigned_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/number_unsigned_t.cpp deleted file mode 100644 index ff3b86df..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/number_unsigned_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/number_unsigned_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/number_unsigned_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/number_unsigned_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/object.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/object.cpp deleted file mode 100644 index 733b89b5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/object.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON objects - json j_no_init_list = json::object(); - json j_empty_init_list = json::object({}); - json j_list_of_pairs = json::object({ {"one", 1}, {"two", 2} }); - - // serialize the JSON objects - std::cout << j_no_init_list << '\n'; - std::cout << j_empty_init_list << '\n'; - std::cout << j_list_of_pairs << '\n'; - - // example for an exception - try - { - // can only create an object from a list of pairs - json j_invalid_object = json::object({{ "one", 1, 2 }}); - } - catch (json::type_error& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/object.output b/Sources/backend-cpp/Vendor/json/doc/examples/object.output deleted file mode 100644 index 1a1d8140..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/object.output +++ /dev/null @@ -1,4 +0,0 @@ -{} -{} -{"one":1,"two":2} -[json.exception.type_error.301] cannot create object from initializer list diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/object_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/object_t.cpp deleted file mode 100644 index 85cfa3e3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/object_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same, json::object_t>::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/object_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/object_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/object_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__ValueType.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__ValueType.cpp deleted file mode 100644 index 66fcf310..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__ValueType.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value with different types - json json_types = - { - {"boolean", true}, - { - "number", { - {"integer", 42}, - {"floating-point", 17.23} - } - }, - {"string", "Hello, world!"}, - {"array", {1, 2, 3, 4, 5}}, - {"null", nullptr} - }; - - // use implicit conversions - bool v1 = json_types["boolean"]; - int v2 = json_types["number"]["integer"]; - short v3 = json_types["number"]["integer"]; - float v4 = json_types["number"]["floating-point"]; - int v5 = json_types["number"]["floating-point"]; - std::string v6 = json_types["string"]; - std::vector v7 = json_types["array"]; - std::unordered_map v8 = json_types; - - // print the conversion results - std::cout << v1 << '\n'; - std::cout << v2 << ' ' << v3 << '\n'; - std::cout << v4 << ' ' << v5 << '\n'; - std::cout << v6 << '\n'; - - for (auto i : v7) - { - std::cout << i << ' '; - } - std::cout << "\n\n"; - - for (auto i : v8) - { - std::cout << i.first << ": " << i.second << '\n'; - } - - // example for an exception - try - { - bool v1 = json_types["string"]; - } - catch (json::type_error& e) - { - std::cout << e.what() << '\n'; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__ValueType.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__ValueType.output deleted file mode 100644 index a3bd9fff..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__ValueType.output +++ /dev/null @@ -1,12 +0,0 @@ -1 -42 42 -17.23 17 -Hello, world! -1 2 3 4 5 - -string: "Hello, world!" -number: {"floating-point":17.23,"integer":42} -null: null -boolean: true -array: [1,2,3,4,5] -[json.exception.type_error.302] type must be boolean, but is string diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal.cpp deleted file mode 100644 index 1426f489..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array_1 = {1, 2, 3}; - json array_2 = {1, 2, 4}; - json object_1 = {{"A", "a"}, {"B", "b"}}; - json object_2 = {{"B", "b"}, {"A", "a"}}; - json number_1 = 17; - json number_2 = 17.000000000000001L; - json string_1 = "foo"; - json string_2 = "bar"; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array_1 << " == " << array_2 << " " << (array_1 == array_2) << '\n'; - std::cout << object_1 << " == " << object_2 << " " << (object_1 == object_2) << '\n'; - std::cout << number_1 << " == " << number_2 << " " << (number_1 == number_2) << '\n'; - std::cout << string_1 << " == " << string_2 << " " << (string_1 == string_2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal.output deleted file mode 100644 index 78067355..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3] == [1,2,4] false -{"A":"a","B":"b"} == {"A":"a","B":"b"} true -17 == 17.0 true -"foo" == "bar" false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal__nullptr_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal__nullptr_t.cpp deleted file mode 100644 index dbb21037..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal__nullptr_t.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array = {1, 2, 3}; - json object = {{"A", "a"}, {"B", "b"}}; - json number = 17; - json string = "foo"; - json null; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array << " == nullptr " << (array == nullptr) << '\n'; - std::cout << object << " == nullptr " << (object == nullptr) << '\n'; - std::cout << number << " == nullptr " << (number == nullptr) << '\n'; - std::cout << string << " == nullptr " << (string == nullptr) << '\n'; - std::cout << null << " == nullptr " << (null == nullptr) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal__nullptr_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal__nullptr_t.output deleted file mode 100644 index b7128e13..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__equal__nullptr_t.output +++ /dev/null @@ -1,5 +0,0 @@ -[1,2,3] == nullptr false -{"A":"a","B":"b"} == nullptr false -17 == nullptr false -"foo" == nullptr false -null == nullptr true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greater.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__greater.cpp deleted file mode 100644 index 65bb9c04..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greater.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array_1 = {1, 2, 3}; - json array_2 = {1, 2, 4}; - json object_1 = {{"A", "a"}, {"B", "b"}}; - json object_2 = {{"B", "b"}, {"A", "a"}}; - json number_1 = 17; - json number_2 = 17.0000000000001L; - json string_1 = "foo"; - json string_2 = "bar"; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array_1 << " > " << array_2 << " " << (array_1 > array_2) << '\n'; - std::cout << object_1 << " > " << object_2 << " " << (object_1 > object_2) << '\n'; - std::cout << number_1 << " > " << number_2 << " " << (number_1 > number_2) << '\n'; - std::cout << string_1 << " > " << string_2 << " " << (string_1 > string_2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greater.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__greater.output deleted file mode 100644 index 910c48e3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greater.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3] > [1,2,4] false -{"A":"a","B":"b"} > {"A":"a","B":"b"} false -17 > 17.0000000000001 false -"foo" > "bar" true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greaterequal.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__greaterequal.cpp deleted file mode 100644 index f8659ee0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greaterequal.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array_1 = {1, 2, 3}; - json array_2 = {1, 2, 4}; - json object_1 = {{"A", "a"}, {"B", "b"}}; - json object_2 = {{"B", "b"}, {"A", "a"}}; - json number_1 = 17; - json number_2 = 17.0000000000001L; - json string_1 = "foo"; - json string_2 = "bar"; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array_1 << " >= " << array_2 << " " << (array_1 >= array_2) << '\n'; - std::cout << object_1 << " >= " << object_2 << " " << (object_1 >= object_2) << '\n'; - std::cout << number_1 << " >= " << number_2 << " " << (number_1 >= number_2) << '\n'; - std::cout << string_1 << " >= " << string_2 << " " << (string_1 >= string_2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greaterequal.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__greaterequal.output deleted file mode 100644 index c7b91514..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__greaterequal.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3] >= [1,2,4] false -{"A":"a","B":"b"} >= {"A":"a","B":"b"} true -17 >= 17.0000000000001 false -"foo" >= "bar" true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__less.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__less.cpp deleted file mode 100644 index 64209a22..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__less.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array_1 = {1, 2, 3}; - json array_2 = {1, 2, 4}; - json object_1 = {{"A", "a"}, {"B", "b"}}; - json object_2 = {{"B", "b"}, {"A", "a"}}; - json number_1 = 17; - json number_2 = 17.0000000000001L; - json string_1 = "foo"; - json string_2 = "bar"; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array_1 << " == " << array_2 << " " << (array_1 < array_2) << '\n'; - std::cout << object_1 << " == " << object_2 << " " << (object_1 < object_2) << '\n'; - std::cout << number_1 << " == " << number_2 << " " << (number_1 < number_2) << '\n'; - std::cout << string_1 << " == " << string_2 << " " << (string_1 < string_2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__less.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__less.output deleted file mode 100644 index abbbc455..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__less.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3] == [1,2,4] true -{"A":"a","B":"b"} == {"A":"a","B":"b"} false -17 == 17.0000000000001 true -"foo" == "bar" false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__lessequal.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__lessequal.cpp deleted file mode 100644 index 543b9543..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__lessequal.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array_1 = {1, 2, 3}; - json array_2 = {1, 2, 4}; - json object_1 = {{"A", "a"}, {"B", "b"}}; - json object_2 = {{"B", "b"}, {"A", "a"}}; - json number_1 = 17; - json number_2 = 17.0000000000001L; - json string_1 = "foo"; - json string_2 = "bar"; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array_1 << " <= " << array_2 << " " << (array_1 <= array_2) << '\n'; - std::cout << object_1 << " <= " << object_2 << " " << (object_1 <= object_2) << '\n'; - std::cout << number_1 << " <= " << number_2 << " " << (number_1 <= number_2) << '\n'; - std::cout << string_1 << " <= " << string_2 << " " << (string_1 <= string_2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__lessequal.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__lessequal.output deleted file mode 100644 index f7f0327e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__lessequal.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3] <= [1,2,4] true -{"A":"a","B":"b"} <= {"A":"a","B":"b"} true -17 <= 17.0000000000001 true -"foo" <= "bar" false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal.cpp deleted file mode 100644 index 43e89509..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array_1 = {1, 2, 3}; - json array_2 = {1, 2, 4}; - json object_1 = {{"A", "a"}, {"B", "b"}}; - json object_2 = {{"B", "b"}, {"A", "a"}}; - json number_1 = 17; - json number_2 = 17.000000000000001L; - json string_1 = "foo"; - json string_2 = "bar"; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array_1 << " != " << array_2 << " " << (array_1 != array_2) << '\n'; - std::cout << object_1 << " != " << object_2 << " " << (object_1 != object_2) << '\n'; - std::cout << number_1 << " != " << number_2 << " " << (number_1 != number_2) << '\n'; - std::cout << string_1 << " != " << string_2 << " " << (string_1 != string_2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal.output deleted file mode 100644 index 6cbc0e8e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3] != [1,2,4] true -{"A":"a","B":"b"} != {"A":"a","B":"b"} false -17 != 17.0 false -"foo" != "bar" true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal__nullptr_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal__nullptr_t.cpp deleted file mode 100644 index dc7e6ac4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal__nullptr_t.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create several JSON values - json array = {1, 2, 3}; - json object = {{"A", "a"}, {"B", "b"}}; - json number = 17; - json string = "foo"; - json null; - - // output values and comparisons - std::cout << std::boolalpha; - std::cout << array << " != nullptr " << (array != nullptr) << '\n'; - std::cout << object << " != nullptr " << (object != nullptr) << '\n'; - std::cout << number << " != nullptr " << (number != nullptr) << '\n'; - std::cout << string << " != nullptr " << (string != nullptr) << '\n'; - std::cout << null << " != nullptr " << (null != nullptr) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal__nullptr_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal__nullptr_t.output deleted file mode 100644 index 0fc36dcf..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__notequal__nullptr_t.output +++ /dev/null @@ -1,5 +0,0 @@ -[1,2,3] != nullptr true -{"A":"a","B":"b"} != nullptr true -17 != nullptr true -"foo" != nullptr true -null != nullptr false diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__value_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator__value_t.cpp deleted file mode 100644 index d9aac797..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__value_t.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = -17; - json j_number_unsigned = 42u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call operator value_t() - json::value_t t_null = j_null; - json::value_t t_boolean = j_boolean; - json::value_t t_number_integer = j_number_integer; - json::value_t t_number_unsigned = j_number_unsigned; - json::value_t t_number_float = j_number_float; - json::value_t t_object = j_object; - json::value_t t_array = j_array; - json::value_t t_string = j_string; - - // print types - std::cout << std::boolalpha; - std::cout << (t_null == json::value_t::null) << '\n'; - std::cout << (t_boolean == json::value_t::boolean) << '\n'; - std::cout << (t_number_integer == json::value_t::number_integer) << '\n'; - std::cout << (t_number_unsigned == json::value_t::number_unsigned) << '\n'; - std::cout << (t_number_float == json::value_t::number_float) << '\n'; - std::cout << (t_object == json::value_t::object) << '\n'; - std::cout << (t_array == json::value_t::array) << '\n'; - std::cout << (t_string == json::value_t::string) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator__value_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator__value_t.output deleted file mode 100644 index 310e632a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator__value_t.output +++ /dev/null @@ -1,8 +0,0 @@ -true -true -true -true -true -true -true -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_deserialize.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator_deserialize.cpp deleted file mode 100644 index 8e3d8bd8..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_deserialize.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create stream with serialized JSON - std::stringstream ss; - ss << R"({ - "number": 23, - "string": "Hello, world!", - "array": [1, 2, 3, 4, 5], - "boolean": false, - "null": null - })"; - - // create JSON value and read the serialization from the stream - json j; - ss >> j; - - // serialize JSON - std::cout << std::setw(2) << j << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_deserialize.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator_deserialize.output deleted file mode 100644 index 81a203fb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_deserialize.output +++ /dev/null @@ -1,13 +0,0 @@ -{ - "array": [ - 1, - 2, - 3, - 4, - 5 - ], - "boolean": false, - "null": null, - "number": 23, - "string": "Hello, world!" -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json.cpp deleted file mode 100644 index 2ec008eb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - json j = R"( {"hello": "world", "answer": 42} )"_json; - - std::cout << std::setw(2) << j << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json.output deleted file mode 100644 index 6c0a7b34..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json.output +++ /dev/null @@ -1,4 +0,0 @@ -{ - "answer": 42, - "hello": "world" -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json_pointer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json_pointer.cpp deleted file mode 100644 index bbdb974a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json_pointer.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - json j = R"( {"hello": "world", "answer": 42} )"_json; - auto val = j["/hello"_json_pointer]; - - std::cout << std::setw(2) << val << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json_pointer.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json_pointer.output deleted file mode 100644 index b0fcd347..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_literal_json_pointer.output +++ /dev/null @@ -1 +0,0 @@ -"world" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_serialize.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operator_serialize.cpp deleted file mode 100644 index 3bd4ad57..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_serialize.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - - // serialize without indentation - std::cout << j_object << "\n\n"; - std::cout << j_array << "\n\n"; - - // serialize with indentation - std::cout << std::setw(4) << j_object << "\n\n"; - std::cout << std::setw(2) << j_array << "\n\n"; - std::cout << std::setw(1) << std::setfill('\t') << j_object << "\n\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operator_serialize.output b/Sources/backend-cpp/Vendor/json/doc/examples/operator_serialize.output deleted file mode 100644 index 7e86bfa2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operator_serialize.output +++ /dev/null @@ -1,22 +0,0 @@ -{"one":1,"two":2} - -[1,2,4,8,16] - -{ - "one": 1, - "two": 2 -} - -[ - 1, - 2, - 4, - 8, - 16 -] - -{ - "one": 1, - "two": 2 -} - diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type.cpp deleted file mode 100644 index f9b7f731..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object - json object = - { - {"one", 1}, {"two", 2}, {"three", 2.9} - }; - - // output element with key "two" - std::cout << object["two"] << "\n\n"; - - // change element with key "three" - object["three"] = 3; - - // output changed array - std::cout << std::setw(4) << object << "\n\n"; - - // mention nonexisting key - object["four"]; - - // write to nonexisting key - object["five"]["really"]["nested"] = true; - - // output changed object - std::cout << std::setw(4) << object << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type.output deleted file mode 100644 index b643587f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type.output +++ /dev/null @@ -1,19 +0,0 @@ -2 - -{ - "one": 1, - "three": 3, - "two": 2 -} - -{ - "five": { - "really": { - "nested": true - } - }, - "four": null, - "one": 1, - "three": 3, - "two": 2 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type_const.cpp deleted file mode 100644 index 1bdb3402..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type_const.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON object - const json object = - { - {"one", 1}, {"two", 2}, {"three", 2.9} - }; - - // output element with key "two" - std::cout << object["two"] << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type_const.output deleted file mode 100644 index 0cfbf088..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__key_type_const.output +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type.cpp deleted file mode 100644 index d6f3e153..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON array - json array = {1, 2, 3, 4, 5}; - - // output element at index 3 (fourth element) - std::cout << array[3] << '\n'; - - // change last element to 6 - array[array.size() - 1] = 6; - - // output changed array - std::cout << array << '\n'; - - // write beyond array limit - array[10] = 11; - - // output changed array - std::cout << array << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type.output b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type.output deleted file mode 100644 index a91a1069..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type.output +++ /dev/null @@ -1,3 +0,0 @@ -4 -[1,2,3,4,6] -[1,2,3,4,6,null,null,null,null,null,11] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type_const.cpp deleted file mode 100644 index d56fa0a4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type_const.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON array - const json array = {"first", "2nd", "third", "fourth"}; - - // output element at index 2 (third element) - std::cout << array.at(2) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type_const.output deleted file mode 100644 index 4450c9f0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorarray__size_type_const.output +++ /dev/null @@ -1 +0,0 @@ -"third" diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer.cpp deleted file mode 100644 index 7a0353a1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json j = - { - {"number", 1}, {"string", "foo"}, {"array", {1, 2}} - }; - - // read-only access - - // output element with JSON pointer "/number" - std::cout << j["/number"_json_pointer] << '\n'; - // output element with JSON pointer "/string" - std::cout << j["/string"_json_pointer] << '\n'; - // output element with JSON pointer "/array" - std::cout << j["/array"_json_pointer] << '\n'; - // output element with JSON pointer "/array/1" - std::cout << j["/array/1"_json_pointer] << '\n'; - - // writing access - - // change the string - j["/string"_json_pointer] = "bar"; - // output the changed string - std::cout << j["string"] << '\n'; - - // "change" a nonexisting object entry - j["/boolean"_json_pointer] = true; - // output the changed object - std::cout << j << '\n'; - - // change an array element - j["/array/1"_json_pointer] = 21; - // "change" an array element with nonexisting index - j["/array/4"_json_pointer] = 44; - // output the changed array - std::cout << j["array"] << '\n'; - - // "change" the array element past the end - j["/array/-"_json_pointer] = 55; - // output the changed array - std::cout << j["array"] << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer.output b/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer.output deleted file mode 100644 index 1fd1b032..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer.output +++ /dev/null @@ -1,8 +0,0 @@ -1 -"foo" -[1,2] -2 -"bar" -{"array":[1,2],"boolean":true,"number":1,"string":"bar"} -[1,21,null,null,44] -[1,21,null,null,44,55] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer_const.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer_const.cpp deleted file mode 100644 index a5a437b4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer_const.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - const json j = - { - {"number", 1}, {"string", "foo"}, {"array", {1, 2}} - }; - - // read-only access - - // output element with JSON pointer "/number" - std::cout << j["/number"_json_pointer] << '\n'; - // output element with JSON pointer "/string" - std::cout << j["/string"_json_pointer] << '\n'; - // output element with JSON pointer "/array" - std::cout << j["/array"_json_pointer] << '\n'; - // output element with JSON pointer "/array/1" - std::cout << j["/array/1"_json_pointer] << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer_const.output b/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer_const.output deleted file mode 100644 index 7b9306bb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/operatorjson_pointer_const.output +++ /dev/null @@ -1,4 +0,0 @@ -1 -"foo" -[1,2] -2 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/ordered_map.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/ordered_map.cpp deleted file mode 100644 index dcc60cb5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/ordered_map.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -// simple output function -template -void output(const char* prefix, const Map& m) -{ - std::cout << prefix << " = { "; - for (auto& element : m) - { - std::cout << element.first << ":" << element.second << ' '; - } - std::cout << "}" << std::endl; -} - -int main() -{ - // create and fill two maps - nlohmann::ordered_map m_ordered; - m_ordered["one"] = "eins"; - m_ordered["two"] = "zwei"; - m_ordered["three"] = "drei"; - - std::map m_std; - m_std["one"] = "eins"; - m_std["two"] = "zwei"; - m_std["three"] = "drei"; - - // output: m_ordered is ordered by insertion order, m_std is ordered by key - output("m_ordered", m_ordered); - output("m_std", m_std); - - // erase and re-add "one" key - m_ordered.erase("one"); - m_ordered["one"] = "eins"; - - m_std.erase("one"); - m_std["one"] = "eins"; - - // output: m_ordered shows newly added key at the end; m_std is again ordered by key - output("m_ordered", m_ordered); - output("m_std", m_std); -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/ordered_map.output b/Sources/backend-cpp/Vendor/json/doc/examples/ordered_map.output deleted file mode 100644 index a4ffc454..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/ordered_map.output +++ /dev/null @@ -1,4 +0,0 @@ -m_ordered = { one:eins two:zwei three:drei } -m_std = { one:eins three:drei two:zwei } -m_ordered = { two:zwei three:drei one:eins } -m_std = { one:eins three:drei two:zwei } diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/other_error.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/other_error.cpp deleted file mode 100644 index 2e7ccfbb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/other_error.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - try - { - // executing a failing JSON Patch operation - json value = R"({ - "best_biscuit": { - "name": "Oreo" - } - })"_json; - json patch = R"([{ - "op": "test", - "path": "/best_biscuit/name", - "value": "Choco Leibniz" - }])"_json; - value.patch(patch); - } - catch (json::other_error& e) - { - // output exception information - std::cout << "message: " << e.what() << '\n' - << "exception id: " << e.id << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/other_error.output b/Sources/backend-cpp/Vendor/json/doc/examples/other_error.output deleted file mode 100644 index b80f1cb3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/other_error.output +++ /dev/null @@ -1,2 +0,0 @@ -message: [json.exception.other_error.501] unsuccessful: {"op":"test","path":"/best_biscuit/name","value":"Choco Leibniz"} -exception id: 501 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/out_of_range.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/out_of_range.cpp deleted file mode 100644 index e7116408..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/out_of_range.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - try - { - // calling at() for an invalid index - json j = {1, 2, 3, 4}; - j.at(4) = 10; - } - catch (json::out_of_range& e) - { - // output exception information - std::cout << "message: " << e.what() << '\n' - << "exception id: " << e.id << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/out_of_range.output b/Sources/backend-cpp/Vendor/json/doc/examples/out_of_range.output deleted file mode 100644 index 29ec76b3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/out_of_range.output +++ /dev/null @@ -1,2 +0,0 @@ -message: [json.exception.out_of_range.401] array index 4 is out of range -exception id: 401 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__allow_exceptions.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__allow_exceptions.cpp deleted file mode 100644 index 82449a52..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__allow_exceptions.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // an invalid JSON text - std::string text = R"( - { - "key": "value without closing quotes - } - )"; - - // parse with exceptions - try - { - json j = json::parse(text); - } - catch (json::parse_error& e) - { - std::cout << e.what() << std::endl; - } - - // parse without exceptions - json j = json::parse(text, nullptr, false); - - if (j.is_discarded()) - { - std::cout << "the input is invalid JSON" << std::endl; - } - else - { - std::cout << "the input is valid JSON: " << j << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__allow_exceptions.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__allow_exceptions.output deleted file mode 100644 index d650824d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__allow_exceptions.output +++ /dev/null @@ -1,2 +0,0 @@ -[json.exception.parse_error.101] parse error at line 4, column 0: syntax error while parsing value - invalid string: control character U+000A (LF) must be escaped to \u000A or \n; last read: '"value without closing quotes' -the input is invalid JSON diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__array__parser_callback_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__array__parser_callback_t.cpp deleted file mode 100644 index 63f0a0e4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__array__parser_callback_t.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a JSON text - char text[] = R"( - { - "Image": { - "Width": 800, - "Height": 600, - "Title": "View from 15th Floor", - "Thumbnail": { - "Url": "http://www.example.com/image/481989943", - "Height": 125, - "Width": 100 - }, - "Animated" : false, - "IDs": [116, 943, 234, 38793] - } - } - )"; - - // parse and serialize JSON - json j_complete = json::parse(text); - std::cout << std::setw(4) << j_complete << "\n\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__array__parser_callback_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__array__parser_callback_t.output deleted file mode 100644 index 62bb8586..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__array__parser_callback_t.output +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Image": { - "Animated": false, - "Height": 600, - "IDs": [ - 116, - 943, - 234, - 38793 - ], - "Thumbnail": { - "Height": 125, - "Url": "http://www.example.com/image/481989943", - "Width": 100 - }, - "Title": "View from 15th Floor", - "Width": 800 - } -} - diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__contiguouscontainer__parser_callback_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__contiguouscontainer__parser_callback_t.cpp deleted file mode 100644 index 6eb409bb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__contiguouscontainer__parser_callback_t.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a JSON text given as std::vector - std::vector text = {'[', '1', ',', '2', ',', '3', ']', '\0'}; - - // parse and serialize JSON - json j_complete = json::parse(text); - std::cout << std::setw(4) << j_complete << "\n\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__contiguouscontainer__parser_callback_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__contiguouscontainer__parser_callback_t.output deleted file mode 100644 index 74633e80..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__contiguouscontainer__parser_callback_t.output +++ /dev/null @@ -1,6 +0,0 @@ -[ - 1, - 2, - 3 -] - diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__istream__parser_callback_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__istream__parser_callback_t.cpp deleted file mode 100644 index afcaa39d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__istream__parser_callback_t.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a JSON text - auto text = R"( - { - "Image": { - "Width": 800, - "Height": 600, - "Title": "View from 15th Floor", - "Thumbnail": { - "Url": "http://www.example.com/image/481989943", - "Height": 125, - "Width": 100 - }, - "Animated" : false, - "IDs": [116, 943, 234, 38793] - } - } - )"; - - // fill a stream with JSON text - std::stringstream ss; - ss << text; - - // parse and serialize JSON - json j_complete = json::parse(ss); - std::cout << std::setw(4) << j_complete << "\n\n"; - - - // define parser callback - json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed) - { - // skip object elements with key "Thumbnail" - if (event == json::parse_event_t::key and parsed == json("Thumbnail")) - { - return false; - } - else - { - return true; - } - }; - - // fill a stream with JSON text - ss.clear(); - ss << text; - - // parse (with callback) and serialize JSON - json j_filtered = json::parse(ss, cb); - std::cout << std::setw(4) << j_filtered << '\n'; -} \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__istream__parser_callback_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__istream__parser_callback_t.output deleted file mode 100644 index 279a7ff7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__istream__parser_callback_t.output +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Image": { - "Animated": false, - "Height": 600, - "IDs": [ - 116, - 943, - 234, - 38793 - ], - "Thumbnail": { - "Height": 125, - "Url": "http://www.example.com/image/481989943", - "Width": 100 - }, - "Title": "View from 15th Floor", - "Width": 800 - } -} - -{ - "Image": { - "Animated": false, - "Height": 600, - "IDs": [ - 116, - 943, - 234, - 38793 - ], - "Title": "View from 15th Floor", - "Width": 800 - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.cpp deleted file mode 100644 index d0c30c1a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a JSON text given an input with other values - std::vector input = {'[', '1', ',', '2', ',', '3', ']', 'o', 't', 'h', 'e', 'r'}; - - // parse and serialize JSON - json j_complete = json::parse(input.begin(), input.begin() + 7); - std::cout << std::setw(4) << j_complete << "\n\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.link b/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.link deleted file mode 100644 index f464e54c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.output deleted file mode 100644 index 74633e80..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__iterator_pair.output +++ /dev/null @@ -1,6 +0,0 @@ -[ - 1, - 2, - 3 -] - diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.cpp deleted file mode 100644 index a5a16eea..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a JSON text given as string that is not null-terminated - const char* ptr = "[1,2,3]another value"; - - // parse and serialize JSON - json j_complete = json::parse(ptr, ptr + 7); - std::cout << std::setw(4) << j_complete << "\n\n"; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.link b/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.link deleted file mode 100644 index 9a93ef1c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.output deleted file mode 100644 index 74633e80..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__pointers.output +++ /dev/null @@ -1,6 +0,0 @@ -[ - 1, - 2, - 3 -] - diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__string__parser_callback_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse__string__parser_callback_t.cpp deleted file mode 100644 index 2ae4410a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__string__parser_callback_t.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // a JSON text - auto text = R"( - { - "Image": { - "Width": 800, - "Height": 600, - "Title": "View from 15th Floor", - "Thumbnail": { - "Url": "http://www.example.com/image/481989943", - "Height": 125, - "Width": 100 - }, - "Animated" : false, - "IDs": [116, 943, 234, 38793] - } - } - )"; - - // parse and serialize JSON - json j_complete = json::parse(text); - std::cout << std::setw(4) << j_complete << "\n\n"; - - - // define parser callback - json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed) - { - // skip object elements with key "Thumbnail" - if (event == json::parse_event_t::key and parsed == json("Thumbnail")) - { - return false; - } - else - { - return true; - } - }; - - // parse (with callback) and serialize JSON - json j_filtered = json::parse(text, cb); - std::cout << std::setw(4) << j_filtered << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse__string__parser_callback_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse__string__parser_callback_t.output deleted file mode 100644 index 279a7ff7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse__string__parser_callback_t.output +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Image": { - "Animated": false, - "Height": 600, - "IDs": [ - 116, - 943, - 234, - 38793 - ], - "Thumbnail": { - "Height": 125, - "Url": "http://www.example.com/image/481989943", - "Width": 100 - }, - "Title": "View from 15th Floor", - "Width": 800 - } -} - -{ - "Image": { - "Animated": false, - "Height": 600, - "IDs": [ - 116, - 943, - 234, - 38793 - ], - "Title": "View from 15th Floor", - "Width": 800 - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse_error.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/parse_error.cpp deleted file mode 100644 index 9b27b58f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse_error.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - try - { - // parsing input with a syntax error - json::parse("[1,2,3,]"); - } - catch (json::parse_error& e) - { - // output exception information - std::cout << "message: " << e.what() << '\n' - << "exception id: " << e.id << '\n' - << "byte position of error: " << e.byte << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/parse_error.output b/Sources/backend-cpp/Vendor/json/doc/examples/parse_error.output deleted file mode 100644 index fe366ff8..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/parse_error.output +++ /dev/null @@ -1,3 +0,0 @@ -message: [json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected ']'; expected '[', '{', or a literal -exception id: 101 -byte position of error: 8 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/patch.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/patch.cpp deleted file mode 100644 index b0896c79..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/patch.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // the original document - json doc = R"( - { - "baz": "qux", - "foo": "bar" - } - )"_json; - - // the patch - json patch = R"( - [ - { "op": "replace", "path": "/baz", "value": "boo" }, - { "op": "add", "path": "/hello", "value": ["world"] }, - { "op": "remove", "path": "/foo"} - ] - )"_json; - - // apply the patch - json patched_doc = doc.patch(patch); - - // output original and patched document - std::cout << std::setw(4) << doc << "\n\n" - << std::setw(4) << patched_doc << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/patch.output b/Sources/backend-cpp/Vendor/json/doc/examples/patch.output deleted file mode 100644 index eb558fe2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/patch.output +++ /dev/null @@ -1,11 +0,0 @@ -{ - "baz": "qux", - "foo": "bar" -} - -{ - "baz": "boo", - "hello": [ - "world" - ] -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/push_back.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/push_back.cpp deleted file mode 100644 index bbddf4f5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/push_back.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json array = {1, 2, 3, 4, 5}; - json null; - - // print values - std::cout << array << '\n'; - std::cout << null << '\n'; - - // add values - array.push_back(6); - array += 7; - null += "first"; - null += "second"; - - // print values - std::cout << array << '\n'; - std::cout << null << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/push_back.output b/Sources/backend-cpp/Vendor/json/doc/examples/push_back.output deleted file mode 100644 index 3306b60e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/push_back.output +++ /dev/null @@ -1,4 +0,0 @@ -[1,2,3,4,5] -null -[1,2,3,4,5,6,7] -["first","second"] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__initializer_list.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/push_back__initializer_list.cpp deleted file mode 100644 index e96645f1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__initializer_list.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json object = {{"one", 1}, {"two", 2}}; - json null; - - // print values - std::cout << object << '\n'; - std::cout << null << '\n'; - - // add values: - object.push_back({"three", 3}); // object is extended - object += {"four", 4}; // object is extended - null.push_back({"five", 5}); // null is converted to array - - // print values - std::cout << object << '\n'; - std::cout << null << '\n'; - - // would throw: - //object.push_back({1, 2, 3}); -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__initializer_list.output b/Sources/backend-cpp/Vendor/json/doc/examples/push_back__initializer_list.output deleted file mode 100644 index 668eb25d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__initializer_list.output +++ /dev/null @@ -1,4 +0,0 @@ -{"one":1,"two":2} -null -{"four":4,"one":1,"three":3,"two":2} -[["five",5]] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__object_t__value.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/push_back__object_t__value.cpp deleted file mode 100644 index 5d694e93..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__object_t__value.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json object = {{"one", 1}, {"two", 2}}; - json null; - - // print values - std::cout << object << '\n'; - std::cout << null << '\n'; - - // add values - object.push_back(json::object_t::value_type("three", 3)); - object += json::object_t::value_type("four", 4); - null += json::object_t::value_type("A", "a"); - null += json::object_t::value_type("B", "b"); - - // print values - std::cout << object << '\n'; - std::cout << null << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__object_t__value.output b/Sources/backend-cpp/Vendor/json/doc/examples/push_back__object_t__value.output deleted file mode 100644 index b8a7d356..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/push_back__object_t__value.output +++ /dev/null @@ -1,4 +0,0 @@ -{"one":1,"two":2} -null -{"four":4,"one":1,"three":3,"two":2} -{"A":"a","B":"b"} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/rbegin.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/rbegin.cpp deleted file mode 100644 index 239f7a68..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/rbegin.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to the reverse-beginning - json::reverse_iterator it = array.rbegin(); - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/rbegin.output b/Sources/backend-cpp/Vendor/json/doc/examples/rbegin.output deleted file mode 100644 index 7ed6ff82..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/rbegin.output +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/rend.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/rend.cpp deleted file mode 100644 index adadbbdc..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/rend.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create an array value - json array = {1, 2, 3, 4, 5}; - - // get an iterator to the reverse-end - json::reverse_iterator it = array.rend(); - - // increment the iterator to point to the first element - --it; - - // serialize the element that the iterator points to - std::cout << *it << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/rend.output b/Sources/backend-cpp/Vendor/json/doc/examples/rend.output deleted file mode 100644 index d00491fd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/rend.output +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/sax_parse.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/sax_parse.cpp deleted file mode 100644 index 45273eb6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/sax_parse.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#include -#include -#include -#include - -using json = nlohmann::json; - -// a simple event consumer that collects string representations of the passed -// values; not inheriting from json::json_sax_t is not required, but can -// help not to forget a required function -class sax_event_consumer : public json::json_sax_t -{ - public: - std::vector events; - - bool null() override - { - events.push_back("value: null"); - return true; - } - - bool boolean(bool val) override - { - events.push_back("value: " + std::string(val ? "true" : "false")); - return true; - } - - bool number_integer(number_integer_t val) override - { - events.push_back("value: " + std::to_string(val)); - return true; - } - - bool number_unsigned(number_unsigned_t val) override - { - events.push_back("value: " + std::to_string(val)); - return true; - } - - bool number_float(number_float_t val, const string_t& s) override - { - events.push_back("value: " + s); - return true; - } - - bool string(string_t& val) override - { - events.push_back("value: " + val); - return true; - } - - bool start_object(std::size_t elements) override - { - events.push_back("start: object"); - return true; - } - - bool end_object() override - { - events.push_back("end: object"); - return true; - } - - bool start_array(std::size_t elements) override - { - events.push_back("start: array"); - return true; - } - - bool end_array() override - { - events.push_back("end: array"); - return true; - } - - bool key(string_t& val) override - { - events.push_back("key: " + val); - return true; - } - - bool binary(json::binary_t& val) override - { - events.push_back("binary"); - return true; - } - - bool parse_error(std::size_t position, const std::string& last_token, const json::exception& ex) override - { - events.push_back("error: " + std::string(ex.what())); - return false; - } -}; - -int main() -{ - // a JSON text - auto text = R"( - { - "Image": { - "Width": 800, - "Height": 600, - "Title": "View from 15th Floor", - "Thumbnail": { - "Url": "http://www.example.com/image/481989943", - "Height": 125, - "Width": 100 - }, - "Animated" : false, - "IDs": [116, 943, 234, 38793], - "Distance": 12.723374634 - } - } - )"; - - // create a SAX event consumer object - sax_event_consumer sec; - - // parse and serialize JSON - bool result = json::sax_parse(text, &sec); - - // output the recorded events - for (auto& event : sec.events) - { - std::cout << "(" << event << ") "; - } - - // output the result of sax_parse - std::cout << "\nresult: " << std::boolalpha << result << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/sax_parse.output b/Sources/backend-cpp/Vendor/json/doc/examples/sax_parse.output deleted file mode 100644 index e16c2c4d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/sax_parse.output +++ /dev/null @@ -1,2 +0,0 @@ -(start: object) (key: Image) (start: object) (key: Width) (value: 800) (key: Height) (value: 600) (key: Title) (value: View from 15th Floor) (key: Thumbnail) (start: object) (key: Url) (value: http://www.example.com/image/481989943) (key: Height) (value: 125) (key: Width) (value: 100) (end: object) (key: Animated) (value: false) (key: IDs) (start: array) (value: 116) (value: 943) (value: 234) (value: 38793) (end: array) (key: Distance) (value: 12.723374634) (end: object) (end: object) -result: true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/size.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/size.cpp deleted file mode 100644 index 23754837..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/size.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = 17; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_object_empty(json::value_t::object); - json j_array = {1, 2, 4, 8, 16}; - json j_array_empty(json::value_t::array); - json j_string = "Hello, world"; - - // call size() - std::cout << j_null.size() << '\n'; - std::cout << j_boolean.size() << '\n'; - std::cout << j_number_integer.size() << '\n'; - std::cout << j_number_float.size() << '\n'; - std::cout << j_object.size() << '\n'; - std::cout << j_object_empty.size() << '\n'; - std::cout << j_array.size() << '\n'; - std::cout << j_array_empty.size() << '\n'; - std::cout << j_string.size() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/size.output b/Sources/backend-cpp/Vendor/json/doc/examples/size.output deleted file mode 100644 index 3831387b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/size.output +++ /dev/null @@ -1,9 +0,0 @@ -0 -1 -1 -1 -2 -0 -5 -0 -1 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/std_hash.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/std_hash.cpp deleted file mode 100644 index eee0fad0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/std_hash.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << "hash(null) = " << std::hash {}(json(nullptr)) << '\n' - << "hash(false) = " << std::hash {}(json(false)) << '\n' - << "hash(0) = " << std::hash {}(json(0)) << '\n' - << "hash(0U) = " << std::hash {}(json(0U)) << '\n' - << "hash(\"\") = " << std::hash {}(json("")) << '\n' - << "hash({}) = " << std::hash {}(json::object()) << '\n' - << "hash([]) = " << std::hash {}(json::array()) << '\n' - << "hash({\"hello\": \"world\"}) = " << std::hash {}("{\"hello\": \"world\"}"_json) - << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/std_hash.output b/Sources/backend-cpp/Vendor/json/doc/examples/std_hash.output deleted file mode 100644 index d1b1b48b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/std_hash.output +++ /dev/null @@ -1,8 +0,0 @@ -hash(null) = 2654435769 -hash(false) = 2654436030 -hash(0) = 2654436095 -hash(0U) = 2654436156 -hash("") = 11160318156688833227 -hash({}) = 2654435832 -hash([]) = 2654435899 -hash({"hello": "world"}) = 3701319991624763853 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/std_swap.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/std_swap.cpp deleted file mode 100644 index 36ab3ce6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/std_swap.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j1 = {{"one", 1}, {"two", 2}}; - json j2 = {1, 2, 4, 8, 16}; - - std::cout << "j1 = " << j1 << " | j2 = " << j2 << '\n'; - - // swap values - std::swap(j1, j2); - - std::cout << "j1 = " << j1 << " | j2 = " << j2 << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/std_swap.output b/Sources/backend-cpp/Vendor/json/doc/examples/std_swap.output deleted file mode 100644 index 5ae6db78..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/std_swap.output +++ /dev/null @@ -1,2 +0,0 @@ -j1 = {"one":1,"two":2} | j2 = [1,2,4,8,16] -j1 = [1,2,4,8,16] | j2 = {"one":1,"two":2} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/string_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/string_t.cpp deleted file mode 100644 index 77a9ea48..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/string_t.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << std::boolalpha << std::is_same::value << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/string_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/string_t.output deleted file mode 100644 index 27ba77dd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/string_t.output +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__array_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/swap__array_t.cpp deleted file mode 100644 index 2119dd55..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__array_t.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json value = {{"array", {1, 2, 3, 4}}}; - - // create an array_t - json::array_t array = {"Snap", "Crackle", "Pop"}; - - // swap the array stored in the JSON value - value["array"].swap(array); - - // output the values - std::cout << "value = " << value << '\n'; - std::cout << "array = " << array << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__array_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/swap__array_t.output deleted file mode 100644 index 365302cc..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__array_t.output +++ /dev/null @@ -1,2 +0,0 @@ -value = {"array":["Snap","Crackle","Pop"]} -array = [1,2,3,4] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__binary_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/swap__binary_t.cpp deleted file mode 100644 index 4b8fc3db..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__binary_t.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a binary value - json value = json::binary({1, 2, 3}); - - // create a binary_t - json::binary_t binary = {{4, 5, 6}}; - - // swap the object stored in the JSON value - value.swap(binary); - - // output the values - std::cout << "value = " << value << '\n'; - std::cout << "binary = " << json(binary) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__binary_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/swap__binary_t.output deleted file mode 100644 index 68cd7689..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__binary_t.output +++ /dev/null @@ -1,2 +0,0 @@ -value = {"bytes":[4,5,6],"subtype":null} -binary = {"bytes":[1,2,3],"subtype":null} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__object_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/swap__object_t.cpp deleted file mode 100644 index 301b558d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__object_t.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json value = { {"translation", {{"one", "eins"}, {"two", "zwei"}}} }; - - // create an object_t - json::object_t object = {{"cow", "Kuh"}, {"dog", "Hund"}}; - - // swap the object stored in the JSON value - value["translation"].swap(object); - - // output the values - std::cout << "value = " << value << '\n'; - std::cout << "object = " << object << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__object_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/swap__object_t.output deleted file mode 100644 index b5c9791b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__object_t.output +++ /dev/null @@ -1,2 +0,0 @@ -value = {"translation":{"cow":"Kuh","dog":"Hund"}} -object = {"one":"eins","two":"zwei"} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__reference.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/swap__reference.cpp deleted file mode 100644 index 34182ad2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__reference.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create two JSON values - json j1 = {1, 2, 3, 4, 5}; - json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}}; - - // swap the values - j1.swap(j2); - - // output the values - std::cout << "j1 = " << j1 << '\n'; - std::cout << "j2 = " << j2 << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__reference.output b/Sources/backend-cpp/Vendor/json/doc/examples/swap__reference.output deleted file mode 100644 index 96b07b09..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__reference.output +++ /dev/null @@ -1,2 +0,0 @@ -j1 = {"e":2.718281828459045,"pi":3.141592653589793} -j2 = [1,2,3,4,5] diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__string_t.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/swap__string_t.cpp deleted file mode 100644 index b5d58316..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__string_t.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json value = { "the good", "the bad", "the ugly" }; - - // create string_t - json::string_t string = "the fast"; - - // swap the object stored in the JSON value - value[1].swap(string); - - // output the values - std::cout << "value = " << value << '\n'; - std::cout << "string = " << string << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/swap__string_t.output b/Sources/backend-cpp/Vendor/json/doc/examples/swap__string_t.output deleted file mode 100644 index ae2a0976..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/swap__string_t.output +++ /dev/null @@ -1,2 +0,0 @@ -value = ["the good","the fast","the ugly"] -string = the bad diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_bson.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/to_bson.cpp deleted file mode 100644 index 2dd44876..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_bson.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json j = R"({"compact": true, "schema": 0})"_json; - - // serialize it to BSON - std::vector v = json::to_bson(j); - - // print the vector content - for (auto& byte : v) - { - std::cout << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int)byte << " "; - } - std::cout << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_bson.output b/Sources/backend-cpp/Vendor/json/doc/examples/to_bson.output deleted file mode 100644 index 379532a2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_bson.output +++ /dev/null @@ -1 +0,0 @@ -0x1b 0x00 0x00 0x00 0x08 0x63 0x6f 0x6d 0x70 0x61 0x63 0x74 0x00 0x01 0x10 0x73 0x63 0x68 0x65 0x6d 0x61 0x00 0x00 0x00 0x00 0x00 0x00 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_cbor.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/to_cbor.cpp deleted file mode 100644 index 3d85deb5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_cbor.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json j = R"({"compact": true, "schema": 0})"_json; - - // serialize it to CBOR - std::vector v = json::to_cbor(j); - - // print the vector content - for (auto& byte : v) - { - std::cout << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int)byte << " "; - } - std::cout << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_cbor.output b/Sources/backend-cpp/Vendor/json/doc/examples/to_cbor.output deleted file mode 100644 index 02c9adab..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_cbor.output +++ /dev/null @@ -1 +0,0 @@ -0xa2 0x67 0x63 0x6f 0x6d 0x70 0x61 0x63 0x74 0xf5 0x66 0x73 0x63 0x68 0x65 0x6d 0x61 0x00 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_msgpack.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/to_msgpack.cpp deleted file mode 100644 index 76bb22f1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_msgpack.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create a JSON value - json j = R"({"compact": true, "schema": 0})"_json; - - // serialize it to MessagePack - std::vector v = json::to_msgpack(j); - - // print the vector content - for (auto& byte : v) - { - std::cout << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int)byte << " "; - } - std::cout << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_msgpack.output b/Sources/backend-cpp/Vendor/json/doc/examples/to_msgpack.output deleted file mode 100644 index 4d6c40ab..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_msgpack.output +++ /dev/null @@ -1 +0,0 @@ -0x82 0xa7 0x63 0x6f 0x6d 0x70 0x61 0x63 0x74 0xc3 0xa6 0x73 0x63 0x68 0x65 0x6d 0x61 0x00 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_string.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/to_string.cpp deleted file mode 100644 index ee44283f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_string.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; -using std::to_string; - -int main() -{ - // create values - json j = {{"one", 1}, {"two", 2}}; - int i = 42; - - // use ADL to select best to_string function - auto j_str = to_string(j); // calling nlohmann::to_string - auto i_str = to_string(i); // calling std::to_string - - // serialize without indentation - std::cout << j_str << "\n\n" - << i_str << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_string.output b/Sources/backend-cpp/Vendor/json/doc/examples/to_string.output deleted file mode 100644 index b261f35e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_string.output +++ /dev/null @@ -1,3 +0,0 @@ -{"one":1,"two":2} - -42 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_ubjson.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/to_ubjson.cpp deleted file mode 100644 index 2329cdd0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_ubjson.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -// function to print UBJSON's diagnostic format -void print_byte(uint8_t byte) -{ - if (32 < byte and byte < 128) - { - std::cout << (char)byte; - } - else - { - std::cout << (int)byte; - } -} - -int main() -{ - // create a JSON value - json j = R"({"compact": true, "schema": false})"_json; - - // serialize it to UBJSON - std::vector v = json::to_ubjson(j); - - // print the vector content - for (auto& byte : v) - { - print_byte(byte); - } - std::cout << std::endl; - - // create an array of numbers - json array = {1, 2, 3, 4, 5, 6, 7, 8}; - - // serialize it to UBJSON using default representation - std::vector v_array = json::to_ubjson(array); - // serialize it to UBJSON using size optimization - std::vector v_array_size = json::to_ubjson(array, true); - // serialize it to UBJSON using type optimization - std::vector v_array_size_and_type = json::to_ubjson(array, true, true); - - // print the vector contents - for (auto& byte : v_array) - { - print_byte(byte); - } - std::cout << std::endl; - - for (auto& byte : v_array_size) - { - print_byte(byte); - } - std::cout << std::endl; - - for (auto& byte : v_array_size_and_type) - { - print_byte(byte); - } - std::cout << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/to_ubjson.output b/Sources/backend-cpp/Vendor/json/doc/examples/to_ubjson.output deleted file mode 100644 index 087980cb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/to_ubjson.output +++ /dev/null @@ -1,4 +0,0 @@ -{i7compactTi6schemaF} -[i1i2i3i4i5i6i7i8] -[#i8i1i2i3i4i5i6i7i8 -[$i#i812345678 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/type.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/type.cpp deleted file mode 100644 index 68fba3a9..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/type.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = -17; - json j_number_unsigned = 42u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call type() - std::cout << std::boolalpha; - std::cout << (j_null.type() == json::value_t::null) << '\n'; - std::cout << (j_boolean.type() == json::value_t::boolean) << '\n'; - std::cout << (j_number_integer.type() == json::value_t::number_integer) << '\n'; - std::cout << (j_number_unsigned.type() == json::value_t::number_unsigned) << '\n'; - std::cout << (j_number_float.type() == json::value_t::number_float) << '\n'; - std::cout << (j_object.type() == json::value_t::object) << '\n'; - std::cout << (j_array.type() == json::value_t::array) << '\n'; - std::cout << (j_string.type() == json::value_t::string) << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/type.output b/Sources/backend-cpp/Vendor/json/doc/examples/type.output deleted file mode 100644 index 310e632a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/type.output +++ /dev/null @@ -1,8 +0,0 @@ -true -true -true -true -true -true -true -true diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/type_error.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/type_error.cpp deleted file mode 100644 index d4f18b18..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/type_error.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - try - { - // calling push_back() on a string value - json j = "string"; - j.push_back("another string"); - } - catch (json::type_error& e) - { - // output exception information - std::cout << "message: " << e.what() << '\n' - << "exception id: " << e.id << std::endl; - } -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/type_error.output b/Sources/backend-cpp/Vendor/json/doc/examples/type_error.output deleted file mode 100644 index 1a673390..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/type_error.output +++ /dev/null @@ -1,2 +0,0 @@ -message: [json.exception.type_error.308] cannot use push_back() with string -exception id: 308 diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/type_name.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/type_name.cpp deleted file mode 100644 index 32d3590c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/type_name.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON values - json j_null; - json j_boolean = true; - json j_number_integer = -17; - json j_number_unsigned = 42u; - json j_number_float = 23.42; - json j_object = {{"one", 1}, {"two", 2}}; - json j_array = {1, 2, 4, 8, 16}; - json j_string = "Hello, world"; - - // call type_name() - std::cout << j_null << " is a " << j_null.type_name() << '\n'; - std::cout << j_boolean << " is a " << j_boolean.type_name() << '\n'; - std::cout << j_number_integer << " is a " << j_number_integer.type_name() << '\n'; - std::cout << j_number_unsigned << " is a " << j_number_unsigned.type_name() << '\n'; - std::cout << j_number_float << " is a " << j_number_float.type_name() << '\n'; - std::cout << j_object << " is an " << j_object.type_name() << '\n'; - std::cout << j_array << " is an " << j_array.type_name() << '\n'; - std::cout << j_string << " is a " << j_string.type_name() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/type_name.output b/Sources/backend-cpp/Vendor/json/doc/examples/type_name.output deleted file mode 100644 index f394e819..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/type_name.output +++ /dev/null @@ -1,8 +0,0 @@ -null is a null -true is a boolean --17 is a number -42 is a number -23.42 is a number -{"one":1,"two":2} is an object -[1,2,4,8,16] is an array -"Hello, world" is a string diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/unflatten.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/unflatten.cpp deleted file mode 100644 index 75fb02d0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/unflatten.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create JSON value - json j_flattened = - { - {"/answer/everything", 42}, - {"/happy", true}, - {"/list/0", 1}, - {"/list/1", 0}, - {"/list/2", 2}, - {"/name", "Niels"}, - {"/nothing", nullptr}, - {"/object/currency", "USD"}, - {"/object/value", 42.99}, - {"/pi", 3.141} - }; - - // call unflatten() - std::cout << std::setw(4) << j_flattened.unflatten() << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/unflatten.output b/Sources/backend-cpp/Vendor/json/doc/examples/unflatten.output deleted file mode 100644 index ed48385a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/unflatten.output +++ /dev/null @@ -1,18 +0,0 @@ -{ - "answer": { - "everything": 42 - }, - "happy": true, - "list": [ - 1, - 0, - 2 - ], - "name": "Niels", - "nothing": null, - "object": { - "currency": "USD", - "value": 42.99 - }, - "pi": 3.141 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/update.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/update.cpp deleted file mode 100644 index 8f8b3bf8..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/update.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create two JSON objects - json o1 = R"( {"color": "red", "price": 17.99, "names": {"de": "Flugzeug"}} )"_json; - json o2 = R"( {"color": "blue", "speed": 100, "names": {"en": "plane"}} )"_json; - json o3 = o1; - - // add all keys from o2 to o1 (updating "color", replacing "names") - o1.update(o2); - - // add all keys from o2 to o1 (updating "color", merging "names") - o3.update(o2, true); - - // output updated object o1 and o3 - std::cout << std::setw(2) << o1 << '\n'; - std::cout << std::setw(2) << o3 << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/update.output b/Sources/backend-cpp/Vendor/json/doc/examples/update.output deleted file mode 100644 index c35a7451..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/update.output +++ /dev/null @@ -1,17 +0,0 @@ -{ - "color": "blue", - "names": { - "en": "plane" - }, - "price": 17.99, - "speed": 100 -} -{ - "color": "blue", - "names": { - "de": "Flugzeug", - "en": "plane" - }, - "price": 17.99, - "speed": 100 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/update__range.cpp b/Sources/backend-cpp/Vendor/json/doc/examples/update__range.cpp deleted file mode 100644 index 98a39042..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/update__range.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -using json = nlohmann::json; - -int main() -{ - // create two JSON objects - json o1 = R"( {"color": "red", "price": 17.99, "names": {"de": "Flugzeug"}} )"_json; - json o2 = R"( {"color": "blue", "speed": 100, "names": {"en": "plane"}} )"_json; - json o3 = o1; - - // add all keys from o2 to o1 (updating "color", replacing "names") - o1.update(o2.begin(), o2.end()); - - // add all keys from o2 to o1 (updating "color", merging "names") - o3.update(o2.begin(), o2.end(), true); - - // output updated object o1 and o3 - std::cout << std::setw(2) << o1 << '\n'; - std::cout << std::setw(2) << o3 << '\n'; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/examples/update__range.output b/Sources/backend-cpp/Vendor/json/doc/examples/update__range.output deleted file mode 100644 index c35a7451..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/examples/update__range.output +++ /dev/null @@ -1,17 +0,0 @@ -{ - "color": "blue", - "names": { - "en": "plane" - }, - "price": 17.99, - "speed": 100 -} -{ - "color": "blue", - "names": { - "de": "Flugzeug", - "en": "plane" - }, - "price": 17.99, - "speed": 100 -} diff --git a/Sources/backend-cpp/Vendor/json/doc/index.md b/Sources/backend-cpp/Vendor/json/doc/index.md deleted file mode 100644 index cb782e7d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/index.md +++ /dev/null @@ -1,335 +0,0 @@ -# JSON for Modern C++ - -These pages contain the API documentation of JSON for Modern C++, a C++11 header-only JSON class. - -# Contents - -- Classes - - @link nlohmann::basic_json `basic_json`@endlink -- class template for JSON values - - @link nlohmann::json `json`@endlink -- the default specialization of `basic_json`, defined as `basic_json<>` -- [Functions](functions_func.html) - - object inspection - - @link nlohmann::basic_json::dump dump @endlink -- value serialization - - @link nlohmann::basic_json::type type @endlink -- type of the value - - @link nlohmann::basic_json::is_primitive is_primitive @endlink, - @link nlohmann::basic_json::is_structured is_structured @endlink, - @link nlohmann::basic_json::is_null is_null @endlink, - @link nlohmann::basic_json::is_boolean is_boolean @endlink, - @link nlohmann::basic_json::is_number is_number @endlink, - @link nlohmann::basic_json::is_number_integer is_number_integer @endlink, - @link nlohmann::basic_json::is_number_unsigned is_number_unsigned @endlink, - @link nlohmann::basic_json::is_number_float is_number_float @endlink, - @link nlohmann::basic_json::is_object is_object @endlink, - @link nlohmann::basic_json::is_array is_array @endlink, - @link nlohmann::basic_json::is_string is_string @endlink, - @link nlohmann::basic_json::is_discarded is_discarded @endlink, - @link nlohmann::basic_json::is_binary is_binary @endlink -- check for value type - - @link nlohmann::basic_json::operator value_t() const operator value_t @endlink -- type of the value (implicit conversion) - - value access - - @link nlohmann::basic_json::get get @endlink -- get a value - - @link nlohmann::basic_json::get_ptr get_ptr @endlink -- get a value pointer - - @link nlohmann::basic_json::get_ref get_ref @endlink -- get a value reference - - @link nlohmann::basic_json::get_binary get_binary @endlink -- get a binary value - - @link nlohmann::basic_json::operator ValueType() const operator ValueType @endlink -- get a value (implicit conversion) - - @link nlohmann::basic_json::value value @endlink -- get a value from an object and return default value if key is not present - - exceptions - - @link nlohmann::basic_json::parse_error parse_error @endlink for exceptions indicating a parse error - - @link nlohmann::basic_json::invalid_iterator invalid_iterator @endlink for exceptions indicating errors with iterators - - @link nlohmann::basic_json::type_error type_error @endlink for exceptions indicating executing a member function with a wrong type - - @link nlohmann::basic_json::out_of_range out_of_range @endlink for exceptions indicating access out of the defined range - - @link nlohmann::basic_json::other_error other_error @endlink for exceptions indicating other library errors - - lexicographical comparison operators - - @link nlohmann::basic_json::operator== operator== @endlink - - @link nlohmann::basic_json::operator!= operator!= @endlink - - @link nlohmann::basic_json::operator< operator<= @endlink - - @link nlohmann::basic_json::operator<= operator< @endlink - - @link nlohmann::basic_json::operator> operator> @endlink - - @link nlohmann::basic_json::operator>= operator>= @endlink - - serialization - - @link nlohmann::basic_json::dump dump @endlink serialize to string - - @link nlohmann::basic_json::operator<<(std::ostream&, const basic_json &) operator<< @endlink serialize to stream - - deserialization / parsing - - @link nlohmann::basic_json::parse parse @endlink parse from input (string, file, etc.) and return JSON value - - @link nlohmann::basic_json::sax_parse sax_parse @endlink parse from input (string, file, etc.) and generate SAX events - - @link nlohmann::basic_json::operator>>(std::istream&, basic_json&) operator>> @endlink parse from stream - - @link nlohmann::basic_json::accept accept @endlink check for syntax errors without parsing - - @link nlohmann::json_sax SAX interface @endlink define a user-defined SAX event consumer - - @link nlohmann::basic_json::parser_callback_t callback interface @endlink register a callback to the parse function - - [binary formats](binary_formats.md): - - CBOR: @link nlohmann::basic_json::from_cbor from_cbor @endlink / @link nlohmann::basic_json::to_cbor to_cbor @endlink - - MessagePack: @link nlohmann::basic_json::from_msgpack from_msgpack @endlink / @link nlohmann::basic_json::to_msgpack to_msgpack @endlink - - UBJSON: @link nlohmann::basic_json::from_ubjson from_ubjson @endlink / @link nlohmann::basic_json::to_ubjson to_ubjson @endlink - - BSON: @link nlohmann::basic_json::from_bson from_bson @endlink / @link nlohmann::basic_json::to_bson to_bson @endlink -- Types - - @link nlohmann::basic_json::array_t arrays @endlink - - @link nlohmann::basic_json::object_t objects @endlink - - @link nlohmann::basic_json::string_t strings @endlink - - @link nlohmann::basic_json::boolean_t booleans @endlink - - numbers - - @link nlohmann::basic_json::number_integer_t signed integers @endlink - - @link nlohmann::basic_json::number_unsigned_t unsigned integers @endlink - - @link nlohmann::basic_json::number_float_t floating-point @endlink - - @link nlohmann::basic_json::binary_t binary values @endlink -- further JSON standards - - @link nlohmann::json_pointer JSON Pointer @endlink (RFC 6901) - - @link nlohmann::basic_json::patch JSON Patch @endlink (RFC 6902) - - @link nlohmann::basic_json::merge_patch JSON Merge Patch @endlink (RFC 7396) - -# Container function overview - -The container functions known from STL have been extended to support the different value types from JSON. However, not all functions can be applied to all value types. Note that the signature of some functions differ between the types; for instance, `at` may be called with either a string to address a key in an object or with an integer to address a value in an array. - -Note that this table only lists those exceptions thrown due to the type. For instance, the @link nlohmann::basic_json::at(const typename object_t::key_type & key) `at` @endlink function will always throw a @link nlohmann::basic_json::type_error `json::type_error` @endlink exception when called for a string type. When called for an array, it *may* throw an @link nlohmann::basic_json::out_of_range `json::out_of_range` @endlink exception if the passed index is invalid. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
groupfunctionJSON value type
objectarraystringnumberbooleannull
iterators`begin`@link nlohmann::basic_json::begin `begin` @endlink@link nlohmann::basic_json::begin `begin` @endlink@link nlohmann::basic_json::begin `begin` @endlink@link nlohmann::basic_json::begin `begin` @endlink@link nlohmann::basic_json::begin `begin` @endlink@link nlohmann::basic_json::begin `begin` @endlink (returns `end()`)
`cbegin`@link nlohmann::basic_json::cbegin `cbegin` @endlink@link nlohmann::basic_json::cbegin `cbegin` @endlink@link nlohmann::basic_json::cbegin `cbegin` @endlink@link nlohmann::basic_json::cbegin `cbegin` @endlink@link nlohmann::basic_json::cbegin `cbegin` @endlink@link nlohmann::basic_json::cbegin `cbegin` @endlink (returns `cend()`)
`end`@link nlohmann::basic_json::end `end` @endlink@link nlohmann::basic_json::end `end` @endlink@link nlohmann::basic_json::end `end` @endlink@link nlohmann::basic_json::end `end` @endlink@link nlohmann::basic_json::end `end` @endlink@link nlohmann::basic_json::end `end` @endlink
`cend`@link nlohmann::basic_json::cend `cend` @endlink@link nlohmann::basic_json::cend `cend` @endlink@link nlohmann::basic_json::cend `cend` @endlink@link nlohmann::basic_json::cend `cend` @endlink@link nlohmann::basic_json::cend `cend` @endlink@link nlohmann::basic_json::cend `cend` @endlink
`rbegin`@link nlohmann::basic_json::rbegin `rbegin` @endlink@link nlohmann::basic_json::rbegin `rbegin` @endlink@link nlohmann::basic_json::rbegin `rbegin` @endlink@link nlohmann::basic_json::rbegin `rbegin` @endlink@link nlohmann::basic_json::rbegin `rbegin` @endlink@link nlohmann::basic_json::rbegin `rbegin` @endlink
`crbegin`@link nlohmann::basic_json::crbegin `crbegin` @endlink@link nlohmann::basic_json::crbegin `crbegin` @endlink@link nlohmann::basic_json::crbegin `crbegin` @endlink@link nlohmann::basic_json::crbegin `crbegin` @endlink@link nlohmann::basic_json::crbegin `crbegin` @endlink@link nlohmann::basic_json::crbegin `crbegin` @endlink
`rend`@link nlohmann::basic_json::rend `rend` @endlink@link nlohmann::basic_json::rend `rend` @endlink@link nlohmann::basic_json::rend `rend` @endlink@link nlohmann::basic_json::rend `rend` @endlink@link nlohmann::basic_json::rend `rend` @endlink@link nlohmann::basic_json::rend `rend` @endlink
`crend`@link nlohmann::basic_json::crend `crend` @endlink@link nlohmann::basic_json::crend `crend` @endlink@link nlohmann::basic_json::crend `crend` @endlink@link nlohmann::basic_json::crend `crend` @endlink@link nlohmann::basic_json::crend `crend` @endlink@link nlohmann::basic_json::crend `crend` @endlink
element
access
`at`@link nlohmann::basic_json::at(const typename object_t::key_type & key) `at` @endlink@link nlohmann::basic_json::at(size_type) `at` @endlinkthrows @link nlohmann::basic_json::type_error `json::type_error` @endlink (304)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (304)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (304)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (304)
`operator[]`@link nlohmann::basic_json::operator[](const typename object_t::key_type &key) `operator[]` @endlink@link nlohmann::basic_json::operator[](size_type) `operator[]` @endlinkthrows @link nlohmann::basic_json::type_error `json::type_error` @endlink (305)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (305)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (305)@link nlohmann::basic_json::operator[](const typename object_t::key_type & key) `operator[]` @endlink (creates object)
@link nlohmann::basic_json::operator[](size_type) `operator[]` @endlink (creates array)
`front`@link nlohmann::basic_json::front `front` @endlink@link nlohmann::basic_json::front `front` @endlink@link nlohmann::basic_json::front `front` @endlink@link nlohmann::basic_json::front `front` @endlink@link nlohmann::basic_json::front `front` @endlinkthrows @link nlohmann::basic_json::invalid_iterator `json::invalid_iterator` @endlink (214)
`back`@link nlohmann::basic_json::back `back` @endlink@link nlohmann::basic_json::back `back` @endlink@link nlohmann::basic_json::back `back` @endlink@link nlohmann::basic_json::back `back` @endlink@link nlohmann::basic_json::back `back` @endlinkthrows @link nlohmann::basic_json::invalid_iterator `json::invalid_iterator` @endlink (214)
capacity`empty`@link nlohmann::basic_json::empty `empty` @endlink@link nlohmann::basic_json::empty `empty` @endlink@link nlohmann::basic_json::empty `empty` @endlink (returns `false`)@link nlohmann::basic_json::empty `empty` @endlink (returns `false`)@link nlohmann::basic_json::empty `empty` @endlink (returns `false`)@link nlohmann::basic_json::empty `empty` @endlink (returns `true`)
`size`@link nlohmann::basic_json::size `size` @endlink@link nlohmann::basic_json::size `size` @endlink@link nlohmann::basic_json::size `size` @endlink (returns `1`)@link nlohmann::basic_json::size `size` @endlink (returns `1`)@link nlohmann::basic_json::size `size` @endlink (returns `1`)@link nlohmann::basic_json::size `size` @endlink (returns `0`)
`max_size_`@link nlohmann::basic_json::max_size `max_size` @endlink@link nlohmann::basic_json::max_size `max_size` @endlink@link nlohmann::basic_json::max_size `max_size` @endlink (returns `1`)@link nlohmann::basic_json::max_size `max_size` @endlink (returns `1`)@link nlohmann::basic_json::max_size `max_size` @endlink (returns `1`)@link nlohmann::basic_json::max_size `max_size` @endlink (returns `0`)
modifiers`clear`@link nlohmann::basic_json::clear `clear` @endlink@link nlohmann::basic_json::clear `clear` @endlink@link nlohmann::basic_json::clear `clear` @endlink@link nlohmann::basic_json::clear `clear` @endlink@link nlohmann::basic_json::clear `clear` @endlink@link nlohmann::basic_json::clear `clear` @endlink
`insert`throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (309)@link nlohmann::basic_json::insert `insert` @endlinkthrows @link nlohmann::basic_json::type_error `json::type_error` @endlink (309)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (309)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (309)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (309)
`erase`@link nlohmann::basic_json::erase `erase` @endlink@link nlohmann::basic_json::erase `erase` @endlink@link nlohmann::basic_json::erase `erase` @endlink (converts to null)@link nlohmann::basic_json::erase `erase` @endlink (converts to null)@link nlohmann::basic_json::erase `erase` @endlink (converts to null)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (307)
`push_back`@link nlohmann::basic_json::push_back(const typename object_t::value_type & val) `push_back` @endlink@link nlohmann::basic_json::push_back(const nlohmann::basic_json &) `push_back` @endlinkthrows @link nlohmann::basic_json::type_error `json::type_error` @endlink (308)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (308)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (308)@link nlohmann::basic_json::push_back(const typename object_t::value_type & val) `push_back` @endlink (creates object)
@link nlohmann::basic_json::push_back(const nlohmann::basic_json &) `push_back` @endlink (creates array)
`emplace` / `emplace_back`@link nlohmann::basic_json::emplace() `emplace` @endlink@link nlohmann::basic_json::emplace_back() `emplace_back` @endlinkthrows @link nlohmann::basic_json::type_error `json::type_error` @endlink (311)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (311)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (311)@link nlohmann::basic_json::emplace() `emplace` @endlink (creates object)
@link nlohmann::basic_json::emplace_back() `emplace_back` @endlink (creates array)
`update`@link nlohmann::basic_json::update() `update` @endlinkthrows @link nlohmann::basic_json::type_error `json::type_error` @endlink (312)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (312)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (312)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (312)throws @link nlohmann::basic_json::type_error `json::type_error` @endlink (312)
`swap`@link nlohmann::basic_json::swap `swap` @endlink@link nlohmann::basic_json::swap `swap` @endlink@link nlohmann::basic_json::swap `swap` @endlink@link nlohmann::basic_json::swap `swap` @endlink@link nlohmann::basic_json::swap `swap` @endlink@link nlohmann::basic_json::swap `swap` @endlink
lookup`find`@link nlohmann::basic_json::find `find` @endlink@link nlohmann::basic_json::find `find` @endlink (returns `end()`)@link nlohmann::basic_json::find `find` @endlink (returns `end()`)@link nlohmann::basic_json::find `find` @endlink (returns `end()`)@link nlohmann::basic_json::find `find` @endlink (returns `end()`)@link nlohmann::basic_json::find `find` @endlink (returns `end()`)
`count`@link nlohmann::basic_json::count `count` @endlink@link nlohmann::basic_json::count `count` @endlink (returns `0`)@link nlohmann::basic_json::count `count` @endlink (returns `0`)@link nlohmann::basic_json::count `count` @endlink (returns `0`)@link nlohmann::basic_json::count `count` @endlink (returns `0`)@link nlohmann::basic_json::count `count` @endlink (returns `0`)
`contains`@link nlohmann::basic_json::contains `contains` @endlink@link nlohmann::basic_json::contains `contains` @endlink (returns `false`)@link nlohmann::basic_json::contains `contains` @endlink (returns `false`)@link nlohmann::basic_json::contains `contains` @endlink (returns `false`)@link nlohmann::basic_json::contains `contains` @endlink (returns `false`)@link nlohmann::basic_json::contains `contains` @endlink (returns `false`)
- -@copyright Copyright © 2013-2022 Niels Lohmann. The code is licensed under the [MIT License](http://opensource.org/licenses/MIT). - -@author [Niels Lohmann](http://nlohmann.me) -@see https://github.com/nlohmann/json to download the source code - -@version 3.10.5 diff --git a/Sources/backend-cpp/Vendor/json/doc/json.gif b/Sources/backend-cpp/Vendor/json/doc/json.gif deleted file mode 100644 index 9f0d8a2f..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/json.gif and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/Makefile b/Sources/backend-cpp/Vendor/json/doc/mkdocs/Makefile deleted file mode 100644 index 3d3d5e7c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# serve the site locally -serve: prepare_files - venv/bin/mkdocs serve - -build: prepare_files - venv/bin/mkdocs build - -# create files that are not versioned inside the mkdocs folder -prepare_files: clean - # create subfolders - mkdir docs/examples - # copy images - cp -vr ../json.gif docs/images - # copy examples - cp -vr ../examples/*.cpp ../examples/*.output docs/examples - -# clean subfolders -clean: - rm -fr docs/images/json.gif docs/examples - -# publish site to GitHub pages -publish: prepare_files - venv/bin/mkdocs gh-deploy --clean --force - -# install a Python virtual environment -install_venv: requirements.txt - python3 -mvenv venv - venv/bin/pip install wheel - venv/bin/pip install -r requirements.txt - -# uninstall the virtual environment -uninstall_venv: clean - rm -fr venv diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/from_json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/from_json.md deleted file mode 100644 index 7657855a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/from_json.md +++ /dev/null @@ -1,41 +0,0 @@ -# nlohmann::adl_serializer::from_json - -```cpp -// (1) -template -static auto from_json(BasicJsonType && j, TargetType& val) noexcept( - noexcept(::nlohmann::from_json(std::forward(j), val))) --> decltype(::nlohmann::from_json(std::forward(j), val), void()) - -// (2) -template -static auto from_json(BasicJsonType && j) noexcept( -noexcept(::nlohmann::from_json(std::forward(j), detail::identity_tag {}))) --> decltype(::nlohmann::from_json(std::forward(j), detail::identity_tag {})) -``` - -This function is usually called by the [`get()`](../basic_json/get.md) function of the -[basic_json](../basic_json) class (either explicit or via conversion operators). - -1. This function is chosen for default-constructible value types. -2. This function is chosen for value types which are not default-constructible. - -## Parameters - -`j` (in) -: JSON value to read from - -`val` (out) -: value to write to - -## Return value - -Copy of the JSON value, converted to `ValueType` - -!!! note - - This documentation page is a stub. - -## Version history - -- Added in version 2.1.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/index.md deleted file mode 100644 index 95f35cdd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/index.md +++ /dev/null @@ -1,35 +0,0 @@ -# nlohmann::adl_serializer - -```cpp -template -struct adl_serializer; -``` - -Serializer that uses ADL ([Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)) to choose -`to_json`/`from_json` functions from the types' namespaces. - -It is implemented similar to - -```cpp -template -struct adl_serializer { - template - static void to_json(BasicJsonType& j, const T& value) { - // calls the "to_json" method in T's namespace - } - - template - static void from_json(const BasicJsonType& j, T& value) { - // same thing, but with the "from_json" method - } -}; -``` - -## Member functions - -- [**from_json**](from_json.md) - convert a JSON value to any value type -- [**to_json**](to_json.md) - convert any value type to a JSON value - -## Version history - -- Added in version 2.1.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/to_json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/to_json.md deleted file mode 100644 index d39f7252..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/adl_serializer/to_json.md +++ /dev/null @@ -1,26 +0,0 @@ -# nlohmann::adl_serializer::to_json - -```cpp -template -static auto to_json(BasicJsonType& j, TargetType && val) noexcept( - noexcept(::nlohmann::to_json(j, std::forward(val)))) --> decltype(::nlohmann::to_json(j, std::forward(val)), void()) -``` - -This function is usually called by the constructors of the [basic_json](../basic_json) class. - -## Parameters - -`j` (out) -: JSON value to write to - -`val` (in) -: value to read from - -!!! note - - This documentation page is a stub. - -## Version history - -- Added in version 2.1.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/accept.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/accept.md deleted file mode 100644 index 8794c585..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/accept.md +++ /dev/null @@ -1,104 +0,0 @@ -# nlohmann::basic_json::accept - -```cpp -// (1) -template -static bool accept(InputType&& i, - const bool ignore_comments = false); - -// (2) -template -static bool accept(IteratorType first, IteratorType last, - const bool ignore_comments = false); -``` - -Checks whether the input is valid JSON. - -1. Reads from a compatible input. -2. Reads from a pair of character iterators - - The value_type of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted - respectively as UTF-8, UTF-16 and UTF-32. - -Unlike the [`parse`](parse.md) function, this function neither throws an exception in case of invalid JSON input -(i.e., a parse error) nor creates diagnostic information. - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators. - -`IteratorType` -: a compatible iterator type - -## Parameters - -`i` (in) -: Input to parse from. - -`ignore_comments` (in) -: whether comments should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error - (`#!cpp false`); (optional, `#!cpp false` by default) - -`first` (in) -: iterator to start of character range - -`last` (in) -: iterator to end of character range - -## Return value - -Whether the input is valid JSON. - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the length of the input. The parser is a predictive LL(1) parser. - -## Notes - -(1) A UTF-8 byte order mark is silently ignored. - -## Examples - -??? example - - The example below demonstrates the `accept()` function reading from a string. - - ```cpp - --8<-- "examples/accept__string.cpp" - ``` - - Output: - - ```json - --8<-- "examples/accept__string.output" - ``` - -## See also - -- [parse](parse.md) - deserialize from a compatible input -- [operator>>](operator_gtgt.md) - deserialize from stream - -## Version history - -- Added in version 3.0.0. -- Ignoring comments via `ignore_comments` added in version 3.9.0. - -!!! warning "Deprecation" - - Overload (2) replaces calls to `accept` with a pair of iterators as their first parameter which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp accept({ptr, ptr+len}, ...);` with `#!cpp accept(ptr, ptr+len, ...);`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/array.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/array.md deleted file mode 100644 index 22b2ee1d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/array.md +++ /dev/null @@ -1,60 +0,0 @@ -# nlohmann::basic_json::array - -```cpp -static basic_json array(initializer_list_t init = {}); -``` - -Creates a JSON array value from a given initializer list. That is, given a list of values `a, b, c`, creates the JSON -value `#!json [a, b, c]`. If the initializer list is empty, the empty array `#!json []` is created. - -## Parameters - -`init` (in) -: initializer list with JSON values to create an array from (optional) - -## Return value - -JSON array value - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the size of `init`. - -## Notes - -This function is only needed to express two edge cases that cannot be realized with the initializer list constructor -([`basic_json(initializer_list_t, bool, value_t)`](basic_json.md)). These cases are: - -1. creating an array whose elements are all pairs whose first element is a string -- in this case, the initializer list - constructor would create an object, taking the first elements as keys -2. creating an empty array -- passing the empty initializer list to the initializer list constructor yields an empty - object - -## Examples - -??? example - - The following code shows an example for the `array` function. - - ```cpp - --8<-- "examples/array.cpp" - ``` - - Output: - - ```json - --8<-- "examples/array.output" - ``` - -## See also - -- [`basic_json(initializer_list_t)`](basic_json.md) - create a JSON value from an initializer list -- [`object`](object.md) - create a JSON object value from an initializer list - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/array_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/array_t.md deleted file mode 100644 index dd2b901d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/array_t.md +++ /dev/null @@ -1,68 +0,0 @@ -# nlohmann::basic_json::array_t - -```cpp -using array_t = ArrayType>; -``` - -The type used to store JSON arrays. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON arrays as follows: -> An array is an ordered sequence of zero or more values. - -To store objects in C++, a type is defined by the template parameters explained below. - -## Template parameters - -`ArrayType` -: container type to store arrays (e.g., `std::vector` or `std::list`) - -`AllocatorType` -: the allocator to use for objects (e.g., `std::allocator`) - -## Notes - -#### Default type - -With the default values for `ArrayType` (`std::vector`) and `AllocatorType` (`std::allocator`), the default value for -`array_t` is: - -```cpp -std::vector< - basic_json, // value_type - std::allocator // allocator_type -> -``` - -#### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: -> An implementation may set limits on the maximum depth of nesting. - -In this class, the array's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be -introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the -[`max_size`](max_size.md) function of a JSON array. - -#### Storage - -Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of type -`#!cpp array_t*` must be dereferenced. - -## Examples - -??? example - - The following code shows that `array_t` is by default, a typedef to `#!cpp std::vector`. - - ```cpp - --8<-- "examples/array_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/array_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/at.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/at.md deleted file mode 100644 index 1ad66132..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/at.md +++ /dev/null @@ -1,176 +0,0 @@ -# nlohmann::basic_json::at - -```cpp -// (1) -reference at(size_type idx); -const_reference at(size_type idx) const; - -// (2) -reference at(const typename object_t::key_type& key); -const_reference at(const typename object_t::key_type& key) const; - -// (3) -reference at(const json_pointer& ptr); -const_reference at(const json_pointer& ptr) const; -``` - -1. Returns a reference to the array element at specified location `idx`, with bounds checking. -2. Returns a reference to the object element at with specified key `key`, with bounds checking. -3. Returns a reference to the element at with specified JSON pointer `ptr`, with bounds checking. - -## Parameters - -`idx` (in) -: index of the element to access - -`key` (in) -: object key of the elements to remove - -`ptr` (in) -: JSON pointer to the desired element - -## Return value - -1. reference to the element at index `idx` -2. reference to the element at key `key` -3. reference to the element pointed to by `ptr` - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an array; - in this case, calling `at` with an index makes no sense. See example below. - - Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if the index `idx` is out of - range of the array; that is, `idx >= size()`. See example below. -2. The function can throw the following exceptions: - - Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an object; - in this case, calling `at` with a key makes no sense. See example below. - - Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the key `key` is not - stored in the object; that is, `find(key) == end()`. See example below. -3. The function can throw the following exceptions: - - Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index in the passed - JSON pointer `ptr` begins with '0'. See example below. - - Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in the passed - JSON pointer `ptr` is not a number. See example below. - - Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if an array index in the passed - JSON pointer `ptr` is out of range. See example below. - - Throws [`out_of_range.402`](../../home/exceptions.md#jsonexceptionout_of_range402) if the array index '-' is used - in the passed JSON pointer `ptr`. As `at` provides checked access (and no elements are implicitly inserted), the - index '-' is always invalid. See example below. - - Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the JSON pointer describes a - key of an object which cannot be found. See example below. - - Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can - not be resolved. See example below. - -## Complexity - -1. Constant -2. Logarithmic in the size of the container. -3. Constant - -## Examples - -??? example "Example: (1) access specified array element with bounds checking" - - The example below shows how array elements can be read and written using `at()`. It also demonstrates the different - exceptions that can be thrown. - - ```cpp - --8<-- "examples/at__size_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/at__size_type.output" - ``` - -??? example "Example: (1) access specified array element with bounds checking" - - The example below shows how array elements can be read using `at()`. It also demonstrates the different exceptions - that can be thrown. - - ```cpp - --8<-- "examples/at__size_type_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/at__size_type_const.output" - ``` - -??? example "Example: (2) access specified object element with bounds checking" - - The example below shows how object elements can be read and written using `at()`. It also demonstrates the different - exceptions that can be thrown. - - ```cpp - --8<-- "examples/at__object_t_key_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/at__object_t_key_type.output" - ``` - -??? example "Example (2) access specified object element with bounds checking" - - The example below shows how object elements can be read using `at()`. It also demonstrates the different exceptions - that can be thrown. - - ```cpp - --8<-- "examples/at__object_t_key_type_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/at__object_t_key_type_const.output" - ``` - -??? example "Example (3) access specified element via JSON Pointer" - - The example below shows how object elements can be read and written using `at()`. It also demonstrates the different - exceptions that can be thrown. - - ```cpp - --8<-- "examples/at_json_pointer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/at_json_pointer.output" - ``` - -??? example "Example (3) access specified element via JSON Pointer" - - The example below shows how object elements can be read using `at()`. It also demonstrates the different exceptions - that can be thrown. - - ```cpp - --8<-- "examples/at_json_pointer_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/at_json_pointer_const.output" - ``` - -## See also - -- see [`operator[]`](operator%5B%5D.md) for unchecked access by reference -- see [`value`](value.md) for access with default value - -## Version history - -1. Added in version 1.0.0. -2. Added in version 1.0.0. -3. Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/back.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/back.md deleted file mode 100644 index 96e1dec7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/back.md +++ /dev/null @@ -1,65 +0,0 @@ -# nlohmann::basic_json::back - -```cpp -reference back(); - -const_reference back() const; -``` - -Returns a reference to the last element in the container. For a JSON container `c`, the expression `c.back()` is -equivalent to - -```cpp -auto tmp = c.end(); ---tmp; -return *tmp; -``` - -## Return value - -In case of a structured type (array or object), a reference to the last element is returned. In case of number, string, -boolean, or binary values, a reference to the value is returned. - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -If the JSON value is `#!json null`, exception -[`invalid_iterator.214`](../../home/exceptions.md#jsonexceptioninvalid_iterator214) is thrown. - -## Complexity - -Constant. - -## Notes - -!!! danger - - Calling `back` on an empty array or object is undefined behavior and is **guarded by an assertion**! - -## Examples - -??? example - - The following code shows an example for `back()`. - - ```cpp - --8<-- "examples/back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/back.output" - ``` - -## See also - -- [front](front.md) to access the first element - -## Version history - -- Added in version 1.0.0. -- Adjusted code to return reference to binary values in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/basic_json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/basic_json.md deleted file mode 100644 index ab3fea47..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/basic_json.md +++ /dev/null @@ -1,402 +0,0 @@ -# nlohmann::basic_json::basic_json - -```cpp -// (1) -basic_json(const value_t v); - -// (2) -basic_json(std::nullptr_t = nullptr) noexcept; - -// (3) -template -basic_json(CompatibleType&& val) noexcept(noexcept( - JSONSerializer::to_json(std::declval(), - std::forward(val)))); - -// (4) -template -basic_json(const BasicJsonType& val); - -// (5) -basic_json(initializer_list_t init, - bool type_deduction = true, - value_t manual_type = value_t::array); - -// (6) -basic_json(size_type cnt, const basic_json& val); - -// (7) -basic_json(iterator first, iterator last); -basic_json(const_iterator first, const_iterator last); - -// (8) -basic_json(const basic_json& other); - -// (9) -basic_json(basic_json&& other) noexcept; -``` - -1. Create an empty JSON value with a given type. The value will be default initialized with an empty value which depends - on the type: - - | Value type | initial value | - |------------|----------------| - | null | `#!json null` | - | boolean | `#!json false` | - | string | `#!json ""` | - | number | `#!json 0` | - | object | `#!json {}` | - | array | `#!json []` | - | binary | empty array | - - The postcondition of this constructor can be restored by calling [`clear()`](clear.md). - -2. Create a `#!json null` JSON value. It either takes a null pointer as parameter (explicitly creating `#!json null`) - or no parameter (implicitly creating `#!json null`). The passed null pointer itself is not read -- it is only used to - choose the right constructor. - -3. This is a "catch all" constructor for all compatible JSON types; that is, types for which a `to_json()` method - exists. The constructor forwards the parameter `val` to that method (to `json_serializer::to_json` method with - `U = uncvref_t`, to be exact). - - Template type `CompatibleType` includes, but is not limited to, the following types: - - - **arrays**: [`array_t`](array_t.md) and all kinds of compatible containers such as `std::vector`, `std::deque`, - `std::list`, `std::forward_list`, `std::array`, `std::valarray`, `std::set`, `std::unordered_set`, `std::multiset`, - and `std::unordered_multiset` with a `value_type` from which a `basic_json` value can be constructed. - - **objects**: [`object_t`](object_t.md) and all kinds of compatible associative containers such as `std::map`, - `std::unordered_map`, `std::multimap`, and `std::unordered_multimap` with a `key_type` compatible to `string_t` - and a `value_type` from which a `basic_json` value can be constructed. - - **strings**: `string_t`, string literals, and all compatible string containers can be used. - - **numbers**: [`number_integer_t`](number_integer_t.md), [`number_unsigned_t`](number_unsigned_t.md), - [`number_float_t`](number_float_t.md), and all convertible number types such as `int`, `size_t`, `int64_t`, `float` - or `double` can be used. - - **boolean**: `boolean_t` / `bool` can be used. - - **binary**: `binary_t` / `std::vector` may be used; unfortunately because string literals cannot be - distinguished from binary character arrays by the C++ type system, all types compatible with `const char*` will be - directed to the string constructor instead. This is both for backwards compatibility, and due to the fact that a - binary type is not a standard JSON type. - - See the examples below. - -4. This is a constructor for existing `basic_json` types. It does not hijack copy/move constructors, since the parameter - has different template arguments than the current ones. - - The constructor tries to convert the internal `m_value` of the parameter. - -5. Creates a JSON value of type array or object from the passed initializer list `init`. In case `type_deduction` is - `#!cpp true` (default), the type of the JSON value to be created is deducted from the initializer list `init` - according to the following rules: - - 1. If the list is empty, an empty JSON object value `{}` is created. - 2. If the list consists of pairs whose first element is a string, a JSON object value is created where the first - elements of the pairs are treated as keys and the second elements are as values. - 3. In all other cases, an array is created. - - The rules aim to create the best fit between a C++ initializer list and JSON values. The rationale is as follows: - - 1. The empty initializer list is written as `#!cpp {}` which is exactly an empty JSON object. - 2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be - of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an - object. - 3. In all other cases, the initializer list could not be interpreted as JSON object type, so interpreting it as JSON - array type is safe. - - With the rules described above, the following JSON values cannot be expressed by an initializer list: - - - the empty array (`#!json []`): use `array(initializer_list_t)` with an empty initializer list in this case - - arrays whose elements satisfy rule 2: use `array(initializer_list_t)` with the same initializer list in this case - - Function [`array()`](array.md) and [`object()`](object.md) force array and object creation from initializer lists, - respectively. - -6. Constructs a JSON array value by creating `cnt` copies of a passed value. In case `cnt` is `0`, an empty array is - created. - -7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depends on the different - types a JSON value can have: - - - In case of a `#!json null` type, [invalid_iterator.206](../../home/exceptions.md#jsonexceptioninvalid_iterator206) - is thrown. - - In case of other primitive types (number, boolean, or string), `first` must be `begin()` and `last` must be - `end()`. In this case, the value is copied. Otherwise, - [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) is thrown. - - In case of structured types (array, object), the constructor behaves as similar versions for `std::vector` or - `std::map`; that is, a JSON array or object is constructed from the values in the range. - -8. Creates a copy of a given JSON value. - -9. Move constructor. Constructs a JSON value with the contents of the given value `other` using move semantics. It - "steals" the resources from `other` and leaves it as JSON `#!json null` value. - -## Template parameters - -`CompatibleType` -: a type such that: - - - `CompatibleType` is not derived from `std::istream`, - - `CompatibleType` is not `basic_json` (to avoid hijacking copy/move constructors), - - `CompatibleType` is not a different `basic_json` type (i.e. with different template arguments) - - `CompatibleType` is not a `basic_json` nested type (e.g., `json_pointer`, `iterator`, etc.) - - `json_serializer` (with `U = uncvref_t`) has a `to_json(basic_json_t&, CompatibleType&&)` - method - -`BasicJsonType`: -: a type such that: - - - `BasicJsonType` is a `basic_json` type. - - `BasicJsonType` has different template arguments than `basic_json_t`. - -`U`: -: `uncvref_t` - -## Parameters - -`v` (in) -: the type of the value to create - -`val` (in) -: the value to be forwarded to the respective constructor - -`init` (in) -: initializer list with JSON values - -`type_deduction` (in) -: internal parameter; when set to `#!cpp true`, the type of the JSON value is deducted from the initializer list - `init`; when set to `#!cpp false`, the type provided via `manual_type` is forced. This mode is used by the functions - `array(initializer_list_t)` and `object(initializer_list_t)`. - -`manual_type` (in) -: internal parameter; when `type_deduction` is set to `#!cpp false`, the created JSON value will use the provided type - (only `value_t::array` and `value_t::object` are valid); when `type_deduction` is set to `#!cpp true`, this - parameter has no effect - -`cnt` (in) -: the number of JSON copies of `val` to create - -`first` (in) -: begin of the range to copy from (included) - -`last` (in) -: end of the range to copy from (excluded) - -`other` (in) -: the JSON value to copy/move - -## Exception safety - -1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. -2. No-throw guarantee: this constructor never throws exceptions. -3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no - `to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any - JSON value. -4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no - `to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any - JSON value. -5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. -6. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. -7. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. -8. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. -9. No-throw guarantee: this constructor never throws exceptions. - -## Exceptions - -1. / -2. The function does not throw exceptions. -3. / -4. / -5. The function can throw the following exceptions: - - Throws [`type_error.301`](../../home/exceptions.md#jsonexceptiontype_error301) if `type_deduction` is - `#!cpp false`, `manual_type` is `value_t::object`, but `init` contains an element which is not a pair whose first - element is a string. In this case, the constructor could not create an object. If `type_deduction` would have been - `#!cpp true`, an array would have been created. See `object(initializer_list_t)` for an example. -6. / -7. The function can throw the following exceptions: - - Throws [`invalid_iterator.201`](../../home/exceptions.md#jsonexceptioninvalid_iterator201) if iterators `first` - and `last` are not compatible (i.e., do not belong to the same JSON value). In this case, the range - `[first, last)` is undefined. - - Throws [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) if iterators `first` - and `last` belong to a primitive type (number, boolean, or string), but `first` does not point to the first - element anymore. In this case, the range `[first, last)` is undefined. See example code below. - - Throws [`invalid_iterator.206`](../../home/exceptions.md#jsonexceptioninvalid_iterator206) if iterators `first` - and `last` belong to a `#!json null` value. In this case, the range `[first, last)` is undefined. -8. / -9. The function does not throw exceptions. - -## Complexity - -1. Constant. -2. Constant. -3. Usually linear in the size of the passed `val`, also depending on the implementation of the called `to_json()` - method. -4. Usually linear in the size of the passed `val`, also depending on the implementation of the called `to_json()` - method. -5. Linear in the size of the initializer list `init`. -6. Linear in `cnt`. -7. Linear in distance between `first` and `last`. -8. Linear in the size of `other`. -9. Constant. - -## Notes - -- Overload 5: - - !!! note - - When used without parentheses around an empty initializer list, `basic_json()` is called instead of this - function, yielding the JSON `#!json null` value. - -- Overload 7: - - !!! info "Preconditions" - - - Iterators `first` and `last` must be initialized. **This precondition is enforced with an assertion (see - warning).** If assertions are switched off, a violation of this precondition yields undefined behavior. - - Range `[first, last)` is valid. Usually, this precondition cannot be checked efficiently. Only certain edge - cases are detected; see the description of the exceptions above. A violation of this precondition yields - undefined behavior. - - !!! warning - - A precondition is enforced with a runtime assertion that will result in calling `std::abort` if this - precondition is not met. Assertions can be disabled by defining `NDEBUG` at compile time. See - for more information. - -- Overload 8: - - !!! info "Postcondition" - - `#!cpp *this == other` - -- Overload 9: - - !!! info "Postconditions" - - - `#!cpp `*this` has the same value as `other` before the call. - - `other` is a JSON `#!json null` value - -## Examples - -??? example "Example: (1) create an empty value with a given type" - - The following code shows the constructor for different `value_t` values. - - ```cpp - --8<-- "examples/basic_json__value_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__value_t.output" - ``` - -??? example "Example: (2) create a `#!json null` object" - - The following code shows the constructor with and without a null pointer parameter. - - ```cpp - --8<-- "examples/basic_json__nullptr_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__nullptr_t.output" - ``` - -??? example "Example: (3) create a JSON value from compatible types" - - The following code shows the constructor with several compatible types. - - ```cpp - --8<-- "examples/basic_json__CompatibleType.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__CompatibleType.output" - ``` - -??? example "Example: (5) create a container (array or object) from an initializer list" - - The example below shows how JSON values are created from initializer lists. - - ```cpp - --8<-- "examples/basic_json__list_init_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__list_init_t.output" - ``` - -??? example "Example: (6) construct an array with count copies of given value" - - The following code shows examples for creating arrays with several copies of a given value. - - ```cpp - --8<-- "examples/basic_json__size_type_basic_json.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__size_type_basic_json.output" - ``` - -??? example "Example: (7) construct a JSON container given an iterator range" - - The example below shows several ways to create JSON values by specifying a subrange with iterators. - - ```cpp - --8<-- "examples/basic_json__InputIt_InputIt.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__InputIt_InputIt.output" - ``` - -??? example "Example: (8) copy constructor" - - The following code shows an example for the copy constructor. - - ```cpp - --8<-- "examples/basic_json__basic_json.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__basic_json.output" - ``` - -??? example "Example: (9) move constructor" - - The code below shows the move constructor explicitly called via `std::move`. - - ```cpp - --8<-- "examples/basic_json__moveconstructor.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__moveconstructor.output" - ``` - -## Version history - -1. Since version 1.0.0. -2. Since version 1.0.0. -3. Since version 2.1.0. -4. Since version 3.2.0. -5. Since version 1.0.0. -6. Since version 1.0.0. -7. Since version 1.0.0. -8. Since version 1.0.0. -9. Since version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/begin.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/begin.md deleted file mode 100644 index ef623a5f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/begin.md +++ /dev/null @@ -1,42 +0,0 @@ -# nlohmann::basic_json::begin - -```cpp -iterator begin() noexcept; -const_iterator begin() const noexcept; -``` - -Returns an iterator to the first element. - -![Illustration from cppreference.com](../../images/range-begin-end.svg) - -## Return value - -iterator to the first element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `begin()`. - - ```cpp - --8<-- "examples/begin.cpp" - ``` - - Output: - - ```json - --8<-- "examples/begin.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/binary.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/binary.md deleted file mode 100644 index ce45d8a0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/binary.md +++ /dev/null @@ -1,66 +0,0 @@ -# nlohmann::basic_json::binary - -```cpp -// (1) -static basic_json binary(const typename binary_t::container_type& init); -static basic_json binary(typename binary_t::container_type&& init); - -// (2) -static basic_json binary(const typename binary_t::container_type& init, - std::uint8_t subtype); -static basic_json binary(typename binary_t::container_type&& init, - std::uint8_t subtype); -``` - -1. Creates a JSON binary array value from a given binary container. -2. Creates a JSON binary array value from a given binary container with subtype. - -Binary values are part of various binary formats, such as CBOR, MessagePack, and BSON. This constructor is used to -create a value for serialization to those formats. - -## Parameters - -`init` (in) -: container containing bytes to use as binary type - -`subtype` (in) -: subtype to use in CBOR, MessagePack, and BSON - -## Return value - -JSON binary array value - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the size of `init`; constant for `typename binary_t::container_type&& init` versions. - -## Notes - -Note, this function exists because of the difficulty in correctly specifying the correct template overload in the -standard value ctor, as both JSON arrays and JSON binary arrays are backed with some form of a `std::vector`. Because -JSON binary arrays are a non-standard extension it was decided that it would be best to prevent automatic initialization -of a binary array type, for backwards compatibility and so it does not happen on accident. - -## Examples - -??? example - - The following code shows how to create a binary value. - - ```cpp - --8<-- "examples/binary.cpp" - ``` - - Output: - - ```json - --8<-- "examples/binary.output" - ``` - -## Version history - -- Added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/binary_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/binary_t.md deleted file mode 100644 index 705c92cb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/binary_t.md +++ /dev/null @@ -1,89 +0,0 @@ -# nlohmann::basic_json::binary_t - -```cpp -using binary_t = byte_container_with_subtype; -``` - -This type is a type designed to carry binary data that appears in various serialized formats, such as CBOR's Major Type -2, MessagePack's bin, and BSON's generic binary subtype. This type is NOT a part of standard JSON and exists solely for -compatibility with these binary types. As such, it is simply defined as an ordered sequence of zero or more byte values. - -Additionally, as an implementation detail, the subtype of the binary data is carried around as a `std::uint64_t`, which -is compatible with both of the binary data formats that use binary subtyping, (though the specific numbering is -incompatible with each other, and it is up to the user to translate between them). The subtype is added to `BinaryType` -via the helper type [byte_container_with_subtype](../byte_container_with_subtype/index.md). - -[CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type as: -> Major type 2: a byte string. The string's length in bytes is represented following the rules for positive integers -> (major type 0). - -[MessagePack's documentation on the bin type -family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family) describes this type as: -> Bin format family stores a byte array in 2, 3, or 5 bytes of extra bytes in addition to the size of the byte array. - -[BSON's specifications](http://bsonspec.org/spec.html) describe several binary types; however, this type is intended to -represent the generic binary type which has the description: -> Generic binary subtype - This is the most commonly used binary subtype and should be the 'default' for drivers and -> tools. - -None of these impose any limitations on the internal representation other than the basic unit of storage be some type of -array whose parts are decomposable into bytes. - -The default representation of this binary format is a `#!cpp std::vector`, which is a very common way to -represent a byte array in modern C++. - -## Template parameters - -`BinaryType` -: container type to store arrays - -## Notes - -#### Default type - -The default values for `BinaryType` is `#!cpp std::vector`. - -#### Storage - -Binary Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of the -type `#!cpp binary_t*` must be dereferenced. - -#### Notes on subtypes - -- CBOR - - Binary values are represented as byte strings. Subtypes are written as tags. - -- MessagePack - - If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1, - fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is - then added as signed 8-bit integer. - - If no subtype is given, the bin family (bin8, bin16, bin32) is used. - -- BSON - - If a subtype is given, it is used and added as unsigned 8-bit integer. - - If no subtype is given, the generic binary subtype 0x00 is used. - -## Examples - -??? example - - The following code shows that `binary_t` is by default, a typedef to - `#!cpp nlohmann::byte_container_with_subtype>`. - - ```cpp - --8<-- "examples/binary_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/binary_t.output" - ``` - -## See also - -- [byte_container_with_subtype](../byte_container_with_subtype/index.md) - -## Version history - -- Added in version 3.8.0. Changed type of subtype to `std::uint64_t` in version 3.10.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/boolean_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/boolean_t.md deleted file mode 100644 index 3ca61314..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/boolean_t.md +++ /dev/null @@ -1,42 +0,0 @@ -# nlohmann::basic_json::boolean_t - -```cpp -using boolean_t = BooleanType; -``` - -The type used to store JSON booleans. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) implicitly describes a boolean as a type which differentiates the two literals -`#!json true` and `#!json false`. - -To store objects in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use. - -## Notes - -#### Default type - -With the default values for `BooleanType` (`#!cpp bool`), the default value for `boolean_t` is `#!cpp bool`. - -#### Storage - -Boolean values are stored directly inside a `basic_json` type. - -## Examples - -??? example - - The following code shows that `boolean_t` is by default, a typedef to `#!cpp bool`. - - ```cpp - --8<-- "examples/boolean_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/boolean_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cbegin.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cbegin.md deleted file mode 100644 index 06504fee..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cbegin.md +++ /dev/null @@ -1,41 +0,0 @@ -# nlohmann::basic_json::cbegin - -```cpp -const_iterator cbegin() const noexcept; -``` - -Returns an iterator to the first element. - -![Illustration from cppreference.com](../../images/range-begin-end.svg) - -## Return value - -iterator to the first element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `cbegin()`. - - ```cpp - --8<-- "examples/cbegin.cpp" - ``` - - Output: - - ```json - --8<-- "examples/cbegin.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cbor_tag_handler_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cbor_tag_handler_t.md deleted file mode 100644 index 6622d8ac..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cbor_tag_handler_t.md +++ /dev/null @@ -1,25 +0,0 @@ -# nlohmann::basic_json::cbor_tag_handler_t - -```cpp -enum class cbor_tag_handler_t -{ - error, - ignore, - store -}; -``` - -This enumeration is used in the [`from_cbor`](from_cbor.md) function to choose how to treat tags: - -error -: throw a `parse_error` exception in case of a tag - -ignore -: ignore tags - -store -: store tagged values as binary container with subtype (for bytes 0xd8..0xdb) - -## Version history - -- Added in version 3.9.0. Added value `store` in 3.10.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cend.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cend.md deleted file mode 100644 index 3f3aa949..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/cend.md +++ /dev/null @@ -1,41 +0,0 @@ -# nlohmann::basic_json::cend - -```cpp -const_iterator cend() const noexcept; -``` - -Returns an iterator to one past the last element. - -![Illustration from cppreference.com](../../images/range-begin-end.svg) - -## Return value - -iterator one past the last element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `cend()`. - - ```cpp - --8<-- "examples/cend.cpp" - ``` - - Output: - - ```json - --8<-- "examples/cend.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/clear.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/clear.md deleted file mode 100644 index ff04b08e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/clear.md +++ /dev/null @@ -1,58 +0,0 @@ -# nlohmann::basic_json::clear - -```cpp -void clear() noexcept; -``` - -Clears the content of a JSON value and resets it to the default value as if [`basic_json(value_t)`](basic_json.md) would -have been called with the current value type from [`type()`](type.md): - -| Value type | initial value | -|------------|----------------------| -| null | `null` | -| boolean | `false` | -| string | `""` | -| number | `0` | -| binary | An empty byte vector | -| object | `{}` | -| array | `[]` | - -Has the same effect as calling - -```.cpp -*this = basic_json(type()); -``` - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear in the size of the JSON value. - -## Notes - -All iterators, pointers and references related to this container are invalidated. - -## Examples - -??? example - - The example below shows the effect of `clear()` to different - JSON types. - - ```cpp - --8<-- "examples/clear.cpp" - ``` - - Output: - - ```json - --8<-- "examples/clear.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Added support for binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/contains.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/contains.md deleted file mode 100644 index 8463f4ea..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/contains.md +++ /dev/null @@ -1,94 +0,0 @@ -# nlohmann::basic_json::contains - -```cpp -// (1) -template -bool contains(KeyT && key) const; - -// (2) -bool contains(const json_pointer& ptr) const; -``` - -1. Check whether an element exists in a JSON object with key equivalent to `key`. If the element is not found or the - JSON value is not an object, `#!cpp false` is returned. -2. Check whether the given JSON pointer `ptr` can be resolved in the current JSON value. - -## Template parameters - -`KeyT` -: A type for an object key other than `basic_json::json_pointer`. - -## Parameters - -`key` (in) -: key value to check its existence. - -`ptr` (in) -: JSON pointer to check its existence. - -## Return value - -1. `#!cpp true` if an element with specified `key` exists. If no such element with such key is found or the JSON value - is not an object, `#!cpp false` is returned. -2. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise. - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -1. The function does not throw exceptions. -2. The function can throw the following exceptions: - - Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index begins with - `0`. - - Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index was not a - number. - -## Complexity - -Logarithmic in the size of the JSON object. - -## Notes - -1. This method always returns `#!cpp false` when executed on a JSON type that is not an object. -2. This method can be executed on any JSON value type. - -!!! info "Postconditions" - - If `#!cpp j.contains(x)` returns `#!c true` for a key or JSON pointer `x`, then it is safe to call `j[x]`. - -## Examples - -??? example "Example (1) check with key" - - The example shows how `contains()` is used. - - ```cpp - --8<-- "examples/contains.cpp" - ``` - - Output: - - ```json - --8<-- "examples/contains.output" - ``` - -??? example "Example (1) check with JSON pointer" - - The example shows how `contains()` is used. - - ```cpp - --8<-- "examples/contains_json_pointer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/contains_json_pointer.output" - ``` - -## Version history - -1. Added in version 3.6.0. -2. Added in version 3.7.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/count.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/count.md deleted file mode 100644 index fcfef867..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/count.md +++ /dev/null @@ -1,55 +0,0 @@ -# nlohmann::basic_json::count - -```cpp -template -size_type count(KeyT&& key) const; -``` - -Returns the number of elements with key `key`. If `ObjectType` is the default `std::map` type, the return value will -always be `0` (`key` was not found) or `1` (`key` was found). - -## Template parameters - -`KeyT` -: A type for an object key. - -## Parameters - -`key` (in) -: key value of the element to count. - -## Return value - -Number of elements with key `key`. If the JSON value is not an object, the return value will be `0`. - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Complexity - -Logarithmic in the size of the JSON object. - -## Notes - -This method always returns `0` when executed on a JSON type that is not an object. - -## Examples - -??? example - - The example shows how `count()` is used. - - ```cpp - --8<-- "examples/count.cpp" - ``` - - Output: - - ```json - --8<-- "examples/count.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/crbegin.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/crbegin.md deleted file mode 100644 index 7af5ecae..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/crbegin.md +++ /dev/null @@ -1,41 +0,0 @@ -# nlohmann::basic_json::crbegin - -```cpp -const_reverse_iterator crbegin() const noexcept; -``` - -Returns an iterator to the reverse-beginning; that is, the last element. - -![Illustration from cppreference.com](../../images/range-rbegin-rend.svg) - -## Return value - -reverse iterator to the first element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `crbegin()`. - - ```cpp - --8<-- "examples/crbegin.cpp" - ``` - - Output: - - ```json - --8<-- "examples/crbegin.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/crend.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/crend.md deleted file mode 100644 index 0e6bc847..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/crend.md +++ /dev/null @@ -1,42 +0,0 @@ -# nlohmann::basic_json::crend - -```cpp -const_reverse_iterator crend() const noexcept; -``` - -Returns an iterator to the reverse-end; that is, one before the first element. This element acts as a placeholder, -attempting to access it results in undefined behavior. - -![Illustration from cppreference.com](../../images/range-rbegin-rend.svg) - -## Return value - -reverse iterator to the element following the last element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `eend()`. - - ```cpp - --8<-- "examples/crend.cpp" - ``` - - Output: - - ```json - --8<-- "examples/crend.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/diff.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/diff.md deleted file mode 100644 index 4e840684..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/diff.md +++ /dev/null @@ -1,62 +0,0 @@ -# nlohmann::basic_json::diff - -```cpp -static basic_json diff(const basic_json& source, - const basic_json& target); -``` - -Creates a [JSON Patch](http://jsonpatch.com) so that value `source` can be changed into the value `target` by calling -[`patch`](patch.md) function. - -For two JSON values `source` and `target`, the following code yields always `#!cpp true`: -```cpp -source.patch(diff(source, target)) == target; -``` - -## Parameters - -`source` (in) -: JSON value to compare from - -`target` (in) -: JSON value to compare against - -## Return value - -a JSON patch to convert the `source` to `target` - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the lengths of `source` and `target`. - -## Notes - -Currently, only `remove`, `add`, and `replace` operations are generated. - -## Examples - -??? example - - The following code shows how a JSON patch is created as a diff for two JSON values. - - ```cpp - --8<-- "examples/diff.cpp" - ``` - - Output: - - ```json - --8<-- "examples/diff.output" - ``` - -## See also - -- [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/dump.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/dump.md deleted file mode 100644 index 41adb154..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/dump.md +++ /dev/null @@ -1,79 +0,0 @@ -# nlohmann::basic_json::dump - -```cpp -string_t dump(const int indent = -1, - const char indent_char = ' ', - const bool ensure_ascii = false, - const error_handler_t error_handler = error_handler_t::strict) const; -``` - -Serialization function for JSON values. The function tries to mimic Python's -[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent` -and `ensure_ascii` parameters. - -## Parameters - -`indent` (in) -: If `indent` is nonnegative, then array elements and object members will be pretty-printed with that indent level. An - indent level of `0` will only insert newlines. `-1` (the default) selects the most compact representation. - -`indent_char` (in) -: The character to use for indentation if `indent` is greater than `0`. The default is ` ` (space). - -`ensure_ascii` (in) -: If `ensure_ascii` is true, all non-ASCII characters in the output are escaped with `\uXXXX` sequences, and the - result consists of ASCII characters only. - -`error_handler` (in) -: how to react on decoding errors; there are three possible values (see [`error_handler_t`](error_handler_t.md): - `strict` (throws and exception in case a decoding error occurs; default), `replace` (replace invalid UTF-8 sequences - with U+FFFD), and `ignore` (ignore invalid UTF-8 sequences during serialization; all bytes are copied to the output - unchanged)). - -## Return value - -string containing the serialization of the JSON value - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes to any JSON value. - -## Exceptions - -Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value -is not UTF-8 encoded and `error_handler` is set to `strict` - -## Complexity - -Linear. - -## Notes - -Binary values are serialized as object containing two keys: - -- "bytes": an array of bytes as integers -- "subtype": the subtype as integer or `#!json null` if the binary has no subtype - -## Examples - -??? example - - The following example shows the effect of different `indent`, `indent_char`, and `ensure_ascii` parameters to the - result of the serialization. - - ```cpp - --8<-- "examples/dump.cpp" - ``` - - Output: - - ```json - --8<-- "examples/dump.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Indentation character `indent_char`, option `ensure_ascii` and exceptions added in version 3.0.0. -- Error handlers added in version 3.4.0. -- Serialization of binary values added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/emplace.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/emplace.md deleted file mode 100644 index 6cc2c98d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/emplace.md +++ /dev/null @@ -1,56 +0,0 @@ -# nlohmann::basic_json::emplace - -```cpp -template -std::pair emplace(Args&& ... args); -``` - -Inserts a new element into a JSON object constructed in-place with the given `args` if there is no element with the key -in the container. If the function is called on a JSON null value, an empty object is created before appending the value -created from `args`. - -## Template parameters - -`Args` -: compatible types to create a `basic_json` object - -## Parameters - -`args` (in) -: arguments to forward to a constructor of `basic_json` - -## Return value - -a pair consisting of an iterator to the inserted element, or the already-existing element if no insertion happened, and -a `#!cpp bool` denoting whether the insertion took place. - -## Exceptions - -Throws [`type_error.311`](../../home/exceptions.md#jsonexceptiontype_error311) when called on a type other than JSON -object or `#!json null`; example: `"cannot use emplace() with number"` - -## Complexity - -Logarithmic in the size of the container, O(log(`size()`)). - -## Examples - -??? example - - The example shows how `emplace()` can be used to add elements to a JSON object. Note how the `#!json null` value was - silently converted to a JSON object. Further note how no value is added if there was already one value stored with - the same key. - - ```cpp - --8<-- "examples/emplace.cpp" - ``` - - Output: - - ```json - --8<-- "examples/emplace.output" - ``` - -## Version history - -- Since version 2.0.8. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/emplace_back.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/emplace_back.md deleted file mode 100644 index 597ad41e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/emplace_back.md +++ /dev/null @@ -1,54 +0,0 @@ -# nlohmann::basic_json::emplace_back - -```cpp -template -reference emplace_back(Args&& ... args); -``` - -Creates a JSON value from the passed parameters `args` to the end of the JSON value. If the function is called on a JSON -`#!json null` value, an empty array is created before appending the value created from `args`. - -## Template parameters - -`Args` -: compatible types to create a `basic_json` object - -## Parameters - -`args` (in) -: arguments to forward to a constructor of `basic_json` - -## Return value - -reference to the inserted element - -## Exceptions - -Throws [`type_error.311`](../../home/exceptions.md#jsonexceptiontype_error311) when called on a type other than JSON -array or `#!json null`; example: `"cannot use emplace_back() with number"` - -## Complexity - -Amortized constant. - -## Examples - -??? example - - The example shows how `emplace_back()` can be used to add elements to a JSON array. Note how the `null` value was - silently converted to a JSON array. - - ```cpp - --8<-- "examples/emplace_back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/emplace_back.output" - ``` - -## Version history - -- Since version 2.0.8. -- Returns reference since 3.7.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/empty.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/empty.md deleted file mode 100644 index 26bf6e9a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/empty.md +++ /dev/null @@ -1,66 +0,0 @@ -# nlohmann::basic_json::empty - -```cpp -bool empty() const noexcept; -``` - -Checks if a JSON value has no elements (i.e. whether its [`size()`](size.md) is `0`). - -## Return value - -The return value depends on the different types and is defined as follows: - -| Value type | return value | -|------------|----------------------------------------| -| null | `#!cpp true` | -| boolean | `#!cpp false` | -| string | `#!cpp false` | -| number | `#!cpp false` | -| binary | `#!cpp false` | -| object | result of function `object_t::empty()` | -| array | result of function `array_t::empty()` | - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant, as long as [`array_t`](array_t.md) and [`object_t`](object_t.md) satisfy the -[Container](https://en.cppreference.com/w/cpp/named_req/Container) concept; that is, their `empty()` functions have -constant complexity. - -## Possible implementation - -```cpp -bool empty() const noexcept -{ - return size() == 0; -} -``` - -## Notes - -This function does not return whether a string stored as JSON value is empty -- it returns whether the JSON container -itself is empty which is `#!cpp false` in the case of a string. - -## Examples - -??? example - - The following code uses `empty()` to check if a JSON object contains any elements. - - ```cpp - --8<-- "examples/empty.cpp" - ``` - - Output: - - ```json - --8<-- "examples/empty.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Extended to return `#!cpp false` for binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/end.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/end.md deleted file mode 100644 index 179ce9e6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/end.md +++ /dev/null @@ -1,42 +0,0 @@ -# nlohmann::basic_json::end - -```cpp -iterator end() noexcept; -const_iterator end() const noexcept; -``` - -Returns an iterator to one past the last element. - -![Illustration from cppreference.com](../../images/range-begin-end.svg) - -## Return value - -iterator one past the last element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `end()`. - - ```cpp - --8<-- "examples/end.cpp" - ``` - - Output: - - ```json - --8<-- "examples/end.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/erase.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/erase.md deleted file mode 100644 index d94c25b7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/erase.md +++ /dev/null @@ -1,176 +0,0 @@ -# nlohmann::basic_json::erase - -```cpp -// (1) -iterator erase(iterator pos); -const_iterator erase(const_iterator pos); - -// (2) -iterator erase(iterator first, iterator last); -const_iterator erase(const_iterator first, const_iterator last); - -// (3) -size_type erase(const typename object_t::key_type& key); - -// (4) -void erase(const size_type idx); -``` - -1. Removes an element from a JSON value specified by iterator `pos`. The iterator `pos` must be valid and - dereferenceable. Thus, the `end()` iterator (which is valid, but is not dereferenceable) cannot be used as a value for - `pos`. - - If called on a primitive type other than `#!json null`, the resulting JSON value will be `#!json null`. - -2. Remove an element range specified by `[first; last)` from a JSON value. The iterator `first` does not need to be - dereferenceable if `first == last`: erasing an empty range is a no-op. - - If called on a primitive type other than `#!json null`, the resulting JSON value will be `#!json null`. - -3. Removes an element from a JSON object by key. - -4. Removes an element from a JSON array by index. - -## Parameters - -`pos` (in) -: iterator to the element to remove - -`first` (in) -: iterator to the beginning of the range to remove - -`last` (in) -: iterator past the end of the range to remove - -`key` (in) -: object key of the elements to remove - -`idx` (in) -: array index of the element to remove - -## Return value - -1. Iterator following the last removed element. If the iterator `pos` refers to the last element, the `end()` iterator - is returned. -2. Iterator following the last removed element. If the iterator `last` refers to the last element, the `end()` iterator - is returned. -3. Number of elements removed. If `ObjectType` is the default `std::map` type, the return value will always be `0` - (`key` was not found) or `1` (`key` was found). -4. / - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.307`](../../home/exceptions.md#jsonexceptiontype_error307) if called on a `null` value; - example: `"cannot use erase() with null"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` - - Throws [`invalid_iterator.205`](../../home/exceptions.md#jsonexceptioninvalid_iterator205) if called on a - primitive type with invalid iterator (i.e., any iterator which is not `begin()`); example: `"iterator out of - range"` -2. The function can throw the following exceptions: - - Throws [`type_error.307`](../../home/exceptions.md#jsonexceptiontype_error307) if called on a `null` value; - example: `"cannot use erase() with null"` - - Throws [`invalid_iterator.203`](../../home/exceptions.md#jsonexceptioninvalid_iterator203) if called on iterators - which does not belong to the current JSON value; example: `"iterators do not fit current value"` - - Throws [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) if called on a - primitive type with invalid iterators (i.e., if `first != begin()` and `last != end()`); example: `"iterators out - of range"` -3. The function can throw the following exceptions: - - Throws [`type_error.307`](../../home/exceptions.md#jsonexceptiontype_error307) when called on a type other than - JSON object; example: `"cannot use erase() with null"` -4. The function can throw the following exceptions: - - Throws [`type_error.307`](../../home/exceptions.md#jsonexceptiontype_error307) when called on a type other than - JSON object; example: `"cannot use erase() with null"` - - Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) when `idx >= size()`; example: - `"array index 17 is out of range"` - -## Complexity - -1. The complexity depends on the type: - - objects: amortized constant - - arrays: linear in distance between `pos` and the end of the container - - strings and binary: linear in the length of the member - - other types: constant -2. The complexity depends on the type: - - objects: `log(size()) + std::distance(first, last)` - - arrays: linear in the distance between `first` and `last`, plus linear - in the distance between `last` and end of the container - - strings and binary: linear in the length of the member - - other types: constant -3. `log(size()) + count(key)` -4. Linear in distance between `idx` and the end of the container. - -## Notes - -1. Invalidates iterators and references at or after the point of the `erase`, including the `end()` iterator. -2. / -3. References and iterators to the erased elements are invalidated. Other references and iterators are not affected. -4. / - -## Examples - -??? example "Example: (1) remove element given an iterator" - - The example shows the effect of `erase()` for different JSON types using an iterator. - - ```cpp - --8<-- "examples/erase__IteratorType.cpp" - ``` - - Output: - - ```json - --8<-- "examples/erase__IteratorType.output" - ``` - -??? example "Example: (2) remove elements given an iterator range" - - The example shows the effect of `erase()` for different JSON types using an iterator range. - - ```cpp - --8<-- "examples/erase__IteratorType_IteratorType.cpp" - ``` - - Output: - - ```json - --8<-- "examples/erase__IteratorType_IteratorType.output" - ``` - -??? example "Example: (3) remove element from a JSON object given a key" - - The example shows the effect of `erase()` for different JSON types using an object key. - - ```cpp - --8<-- "examples/erase__key_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/erase__key_type.output" - ``` - -??? example "Example: (4) remove element from a JSON array given an index" - - The example shows the effect of `erase()` using an array index. - - ```cpp - --8<-- "examples/erase__size_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/erase__size_type.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Added support for binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/error_handler_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/error_handler_t.md deleted file mode 100644 index afd20f89..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/error_handler_t.md +++ /dev/null @@ -1,25 +0,0 @@ -# nlohmann::basic_json::error_handler_t - -```cpp -enum class error_handler_t { - strict, - replace, - ignore -}; -``` - -This enumeration is used in the [`dump`](dump.md) function to choose how to treat decoding errors while serializing a -`basic_json` value. Three values are differentiated: - -strict -: throw a `type_error` exception in case of invalid UTF-8 - -replace -: replace invalid UTF-8 sequences with U+FFFD (� REPLACEMENT CHARACTER) - -ignore -: ignore invalid UTF-8 sequences; all bytes are copied to the output unchanged - -## Version history - -- Added in version 3.4.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/exception.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/exception.md deleted file mode 100644 index b492666d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/exception.md +++ /dev/null @@ -1,75 +0,0 @@ -# nlohmann::basic_json::exception - -```cpp -class exception : public std::exception; -``` - -This class is an extension of [`std::exception`](https://en.cppreference.com/w/cpp/error/exception) objects with a -member `id` for exception ids. It is used as the base class for all exceptions thrown by the `basic_json` class. This -class can hence be used as "wildcard" to catch exceptions, see example below. - -```plantuml -std::exception <|-- basic_json::exception -basic_json::exception <|-- basic_json::parse_error -basic_json::exception <|-- basic_json::invalid_iterator -basic_json::exception <|-- basic_json::type_error -basic_json::exception <|-- basic_json::out_of_range -basic_json::exception <|-- basic_json::other_error - -interface std::exception {} - -class basic_json::exception #FFFF00 { - + const int id - + const char* what() const -} - -class basic_json::parse_error { - + const std::size_t byte -} -``` - -Subclasses: - -- [`parse_error`](parse_error.md) for exceptions indicating a parse error -- [`invalid_iterator`](invalid_iterator.md) for exceptions indicating errors with iterators -- [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type -- [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range -- [`other_error`](other_error.md) for exceptions indicating other library errors - -## Member functions - -- **what** - returns explanatory string - -## Member variables - -- **id** - the id of the exception - -## Notes - -To have nothrow-copy-constructible exceptions, we internally use `std::runtime_error` which can cope with -arbitrary-length error messages. Intermediate strings are built with static functions and then passed to the actual -constructor. - -## Examples - -??? example - - The following code shows how arbitrary library exceptions can be caught. - - ```cpp - --8<-- "examples/exception.cpp" - ``` - - Output: - - ```json - --8<-- "examples/exception.output" - ``` - -## See also - -[List of exceptions](127.0.0.1:8000/home/exceptions/) - -## Version history - -- Since version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/find.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/find.md deleted file mode 100644 index af4cb297..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/find.md +++ /dev/null @@ -1,63 +0,0 @@ -# nlohmann::basic_json::find - -```cpp -template -iterator find(KeyT&& key); - -template -const_iterator find(KeyT&& key) const; -``` - -Finds an element in a JSON object with key equivalent to `key`. If the element is not found or the JSON value is not an -object, `end()` is returned. - -## Template parameters - -`KeyT` -: A type for an object key. - -## Parameters - -`key` (in) -: key value of the element to search for. - -## Return value - -Iterator to an element with key equivalent to `key`. If no such element is found or the JSON value is not an object, -past-the-end (see `end()`) iterator is returned. - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Complexity - -Logarithmic in the size of the JSON object. - -## Notes - -This method always returns `end()` when executed on a JSON type that is not an object. - -## Examples - -??? example - - The example shows how `find()` is used. - - ```cpp - --8<-- "examples/find__key_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/find__key_type.output" - ``` - -## See also - -- [contains](contains.md) checks whether a key exists - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/flatten.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/flatten.md deleted file mode 100644 index 8703e86d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/flatten.md +++ /dev/null @@ -1,50 +0,0 @@ -# nlohmann::basic_json::flatten - -```cpp -basic_json flatten() const; -``` - -The function creates a JSON object whose keys are JSON pointers (see [RFC 6901](https://tools.ietf.org/html/rfc6901)) -and whose values are all primitive (see [`is_primitive()`](is_primitive.md) for more information). The original JSON -value can be restored using the [`unflatten()`](unflatten.md) function. - -## Return value - -an object that maps JSON pointers to primitive values - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Complexity - -Linear in the size the JSON value. - -## Notes - -Empty objects and arrays are flattened to `#!json null` and will not be reconstructed correctly by the -[`unflatten()`](unflatten.md) function. - -## Examples - -??? example - - The following code shows how a JSON object is flattened to an object whose keys consist of JSON pointers. - - ```cpp - --8<-- "examples/flatten.cpp" - ``` - - Output: - - ```json - --8<-- "examples/flatten.output" - ``` - -## See also - -- [unflatten](unflatten.md) the reverse function - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_bson.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_bson.md deleted file mode 100644 index 77549370..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_bson.md +++ /dev/null @@ -1,110 +0,0 @@ -# nlohmann::basic_json::from_bson - -```cpp -// (1) -template -static basic_json from_bson(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true); -// (2) -template -static basic_json from_bson(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true); -``` - -Deserializes a given input to a JSON value using the BSON (Binary JSON) serialization format. - -1. Reads from a compatible input. -2. Reads from an iterator range. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bson.md). - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators. - -`IteratorType` -: a compatible iterator type - -## Parameters - -`i` (in) -: an input in BSON format convertible to an input adapter - -`first` (in) -: iterator to start of the input - -`last` (in) -: iterator to end of the input - -`strict` (in) -: whether to expect the input to be consumed until EOF (`#!cpp true` by default) - -`allow_exceptions` (in) -: whether to throw exceptions in case of a parse error (optional, `#!cpp true` by default) - -## Return value - -deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be -`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -Throws [`parse_error.114`](../../home/exceptions.md#jsonexceptionparse_error114) if an unsupported BSON record type is -encountered. - -## Complexity - -Linear in the size of the input. - -## Examples - -??? example - - The example shows the deserialization of a byte vector in BSON format to a JSON value. - - ```cpp - --8<-- "examples/from_bson.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_bson.output" - ``` - -## See also - -- [BSON specification](http://bsonspec.org/spec.html) -- [to_bson](to_bson.md) for the analogous serialization -- [from_cbor](from_cbor.md) for the related CBOR format -- [from_msgpack](from_msgpack.md) for the related MessagePack format -- [from_ubjson](from_ubjson.md) for the related UBJSON format - -## Version history - -- Added in version 3.4.0. - -!!! warning "Deprecation" - - - Overload (2) replaces calls to `from_bson` with a pointer and a length as first two parameters, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_bson(ptr, len, ...);` with `#!cpp from_bson(ptr, ptr+len, ...);`. - - Overload (2) replaces calls to `from_bson` with a pair of iterators as their first parameter, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_bson({ptr, ptr+len}, ...);` with `#!cpp from_bson(ptr, ptr+len, ...);`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_cbor.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_cbor.md deleted file mode 100644 index 3aa57b9e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_cbor.md +++ /dev/null @@ -1,117 +0,0 @@ -# nlohmann::basic_json::from_cbor - -```cpp -// (1) -template -static basic_json from_cbor(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error); - -// (2) -template -static basic_json from_cbor(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error); -``` - -Deserializes a given input to a JSON value using the CBOR (Concise Binary Object Representation) serialization format. - -1. Reads from a compatible input. -2. Reads from an iterator range. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/cbor.md). - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators. - -`IteratorType` -: a compatible iterator type - -## Parameters - -`i` (in) -: an input in CBOR format convertible to an input adapter - -`first` (in) -: iterator to start of the input - -`last` (in) -: iterator to end of the input - -`strict` (in) -: whether to expect the input to be consumed until EOF (`#!cpp true` by default) - -`allow_exceptions` (in) -: whether to throw exceptions in case of a parse error (optional, `#!cpp true` by default) - -`tag_handler` (in) -: how to treat CBOR tags (optional, `error` by default); see [`cbor_tag_handler_t`](cbor_tag_handler_t.md) for more - information - -## Return value - -deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be -`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true -- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from CBOR were - used in the given input or if the input is not valid CBOR -- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key, - but not found - -## Complexity - -Linear in the size of the input. - -## Examples - -??? example - - The example shows the deserialization of a byte vector in CBOR format to a JSON value. - - ```cpp - --8<-- "examples/from_cbor.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_cbor.output" - ``` - -## Version history - -- Added in version 2.0.9. -- Parameter `start_index` since version 2.1.1. -- Changed to consume input adapters, removed `start_index` parameter, and added `strict` parameter in version 3.0.0. -- Added `allow_exceptions` parameter in version 3.2.0. -- Added `tag_handler` parameter in version 3.9.0. - -!!! warning "Deprecation" - - - Overload (2) replaces calls to `from_cbor` with a pointer and a length as first two parameters, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_cbor(ptr, len, ...);` with `#!cpp from_cbor(ptr, ptr+len, ...);`. - - Overload (2) replaces calls to `from_cbor` with a pair of iterators as their first parameter, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_cbor({ptr, ptr+len}, ...);` with `#!cpp from_cbor(ptr, ptr+len, ...);`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_msgpack.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_msgpack.md deleted file mode 100644 index 117c3865..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_msgpack.md +++ /dev/null @@ -1,109 +0,0 @@ -# nlohmann::basic_json::from_msgpack - -```cpp -// (1) -template -static basic_json from_msgpack(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true); -// (2) -template -static basic_json from_msgpack(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true); -``` - -Deserializes a given input to a JSON value using the MessagePack serialization format. - -1. Reads from a compatible input. -2. Reads from an iterator range. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/messagepack.md). - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators. - -`IteratorType` -: a compatible iterator type - -## Parameters - -`i` (in) -: an input in MessagePack format convertible to an input adapter - -`first` (in) -: iterator to start of the input - -`last` (in) -: iterator to end of the input - -`strict` (in) -: whether to expect the input to be consumed until EOF (`#!cpp true` by default) - -`allow_exceptions` (in) -: whether to throw exceptions in case of a parse error (optional, `#!cpp true` by default) - -## Return value - -deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be -`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true -- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from - MessagePack were used in the given input or if the input is not valid MessagePack -- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key, - but not found - -## Complexity - -Linear in the size of the input. - -## Examples - -??? example - - The example shows the deserialization of a byte vector in MessagePack format to a JSON value. - - ```cpp - --8<-- "examples/from_msgpack.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_msgpack.output" - ``` - -## Version history - -- Added in version 2.0.9. -- Parameter `start_index` since version 2.1.1. -- Changed to consume input adapters, removed `start_index` parameter, and added `strict` parameter in version 3.0.0. -- Added `allow_exceptions` parameter in version 3.2.0. - -!!! warning "Deprecation" - - - Overload (2) replaces calls to `from_msgpack` with a pointer and a length as first two parameters, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_msgpack(ptr, len, ...);` with `#!cpp from_msgpack(ptr, ptr+len, ...);`. - - Overload (2) replaces calls to `from_cbor` with a pair of iterators as their first parameter, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_msgpack({ptr, ptr+len}, ...);` with `#!cpp from_msgpack(ptr, ptr+len, ...);`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_ubjson.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_ubjson.md deleted file mode 100644 index 08117e89..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/from_ubjson.md +++ /dev/null @@ -1,106 +0,0 @@ -# nlohmann::basic_json::from_ubjson - -```cpp -// (1) -template -static basic_json from_ubjson(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true); -// (2) -template -static basic_json from_ubjson(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true); -``` - -Deserializes a given input to a JSON value using the UBJSON (Universal Binary JSON) serialization format. - -1. Reads from a compatible input. -2. Reads from an iterator range. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/ubjson.md). - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators. - -`IteratorType` -: a compatible iterator type - -## Parameters - -`i` (in) -: an input in UBJSON format convertible to an input adapter - -`first` (in) -: iterator to start of the input - -`last` (in) -: iterator to end of the input - -`strict` (in) -: whether to expect the input to be consumed until EOF (`#!cpp true` by default) - -`allow_exceptions` (in) -: whether to throw exceptions in case of a parse error (optional, `#!cpp true` by default) - -## Return value - -deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be -`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -- Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true -- Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if a parse error occurs -- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed - successfully - -## Complexity - -Linear in the size of the input. - -## Examples - -??? example - - The example shows the deserialization of a byte vector in UBJSON format to a JSON value. - - ```cpp - --8<-- "examples/from_ubjson.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_ubjson.output" - ``` - -## Version history - -- Added in version 3.1.0. -- Added `allow_exceptions` parameter in version 3.2.0. - -!!! warning "Deprecation" - - - Overload (2) replaces calls to `from_ubjson` with a pointer and a length as first two parameters, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_ubjson(ptr, len, ...);` with `#!cpp from_ubjson(ptr, ptr+len, ...);`. - - Overload (2) replaces calls to `from_ubjson` with a pair of iterators as their first parameter, which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp from_ubjson({ptr, ptr+len}, ...);` with `#!cpp from_ubjson(ptr, ptr+len, ...);`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/front.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/front.md deleted file mode 100644 index 909f0b59..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/front.md +++ /dev/null @@ -1,58 +0,0 @@ -# nlohmann::basic_json::front - -```cpp -reference front(); -const_reference front() const; -``` - -Returns a reference to the first element in the container. For a JSON container `#!cpp c`, the expression -`#!cpp c.front()` is equivalent to `#!cpp *c.begin()`. - -## Return value - -In case of a structured type (array or object), a reference to the first element is returned. In case of number, string, -boolean, or binary values, a reference to the value is returned. - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -If the JSON value is `#!json null`, exception -[`invalid_iterator.214`](../../home/exceptions.md#jsonexceptioninvalid_iterator214) is thrown. - -## Complexity - -Constant. - -## Notes - -!!! danger - - Calling `front` on an empty array or object is undefined behavior and is **guarded by an assertion**! - -## Examples - -??? example - - The following code shows an example for `front()`. - - ```cpp - --8<-- "examples/front.cpp" - ``` - - Output: - - ```json - --8<-- "examples/front.output" - ``` - -## See also - -- [back](back.md) to access the last element - -## Version history - -- Added in version 1.0.0. -- Adjusted code to return reference to binary values in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get.md deleted file mode 100644 index 0a0bc3ba..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get.md +++ /dev/null @@ -1,136 +0,0 @@ -# nlohmann::basic_json::get - -```cpp -// (1) -template -ValueType get() const noexcept( - noexcept(JSONSerializer::from_json( - std::declval(), std::declval()))); - -// (2) -template -BasicJsonType get() const; - -// (3) -template -PointerType get_ptr(); - -template -constexpr const PointerType get_ptr() const noexcept; -``` - -1. Explicit type conversion between the JSON value and a compatible value which is - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) and - [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). The value is converted by - calling the `json_serializer` `from_json()` method. - - The function is equivalent to executing - ```cpp - ValueType ret; - JSONSerializer::from_json(*this, ret); - return ret; - ``` - - This overload is chosen if: - - - `ValueType` is not `basic_json`, - - `json_serializer` has a `from_json()` method of the form - `void from_json(const basic_json&, ValueType&)`, and - - `json_serializer` does not have a `from_json()` method of the form - `ValueType from_json(const basic_json&)` - - If the type is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) and - **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible), the value is - converted by calling the `json_serializer` `from_json()` method. - - The function is then equivalent to executing - ```cpp - return JSONSerializer::from_json(*this); - ``` - - This overload is chosen if: - - - `ValueType` is not `basic_json` and - - `json_serializer` has a `from_json()` method of the form - `ValueType from_json(const basic_json&)` - - If `json_serializer` has both overloads of `from_json()`, the latter one is chosen. - -2. Overload for `basic_json` specializations. The function is equivalent to executing - ```cpp - return *this; - ``` - -3. Explicit pointer access to the internally stored JSON value. No copies are made. - -## Template parameters - -`ValueType` -: the value type to return - -`BasicJsonType` -: a specialization of `basic_json` - -`PointerType` -: pointer type; must be a pointer to [`array_t`](array_t.md), [`object_t`](object_t.md), [`string_t`](string_t.md), - [`boolean_t`](boolean_t.md), [`number_integer_t`](number_integer_t.md), or - [`number_unsigned_t`](number_unsigned_t.md), [`number_float_t`](number_float_t.md), or [`binary_t`](binary_t.md). - Other types will not compile. - -## Return value - -1. copy of the JSON value, converted to `ValueType` -2. a copy of `#!cpp *this`, converted into `BasicJsonType` -3. pointer to the internally stored JSON value if the requested pointer type fits to the JSON value; `#!cpp nullptr` - otherwise - -## Exceptions - -Depends on what `json_serializer` `from_json()` method throws - -## Notes - -!!! warning - - Writing data to the pointee (overload 3) of the result yields an undefined state. - -## Examples - -??? example - - The example below shows several conversions from JSON values - to other types. There a few things to note: (1) Floating-point numbers can - be converted to integers, (2) A JSON array can be converted to a standard - `std::vector`, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`. - - ```cpp - --8<-- "examples/get__ValueType_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/get__ValueType_const.output" - ``` - -??? example - - The example below shows how pointers to internal values of a JSON value can be requested. Note that no type - conversions are made and a `#cpp nullptr` is returned if the value and the requested pointer type does not match. - - ```cpp - --8<-- "examples/get__PointerType.cpp" - ``` - - Output: - - ```json - --8<-- "examples/get__PointerType.output" - ``` - -## Version history - -1. Since version 2.1.0. -2. Since version 2.1.0. Extended to work with other specializations of `basic_json` in version 3.2.0. -3. Since version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_allocator.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_allocator.md deleted file mode 100644 index 1b7700c7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_allocator.md +++ /dev/null @@ -1,19 +0,0 @@ -# nlohmann::basic_json::get_allocator - -```cpp -static allocator_type get_allocator(); -``` - -Returns the allocator associated with the container. - -## Return value - -associated allocator - -## Version history - -- Unknown. - -!!! note - - This documentation page is a stub. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_binary.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_binary.md deleted file mode 100644 index a910f3aa..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_binary.md +++ /dev/null @@ -1,45 +0,0 @@ -# nlohmann::basic_json::get_binary - -```cpp -binary_t& get_binary(); - -const binary_t& get_binary() const; -``` - -Returns a reference to the stored binary value. - -## Return value - -Reference to binary value. - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -Throws [`type_error.302`](../../home/exceptions.md#jsonexceptiontype_error302) if the value is not binary - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows how to query a binary value. - - ```cpp - --8<-- "examples/get_binary.cpp" - ``` - - Output: - - ```json - --8<-- "examples/get_binary.output" - ``` - -## Version history - -- Added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_ptr.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_ptr.md deleted file mode 100644 index 72517cd7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_ptr.md +++ /dev/null @@ -1,60 +0,0 @@ -# nlohmann::basic_json::get_ptr - -```cpp -template -PointerType get_ptr() noexcept; - -template -constexpr const PointerType get_ptr() const noexcept; -``` - -Implicit pointer access to the internally stored JSON value. No copies are made. - -## Template parameters - -`PointerType` -: pointer type; must be a pointer to [`array_t`](array_t.md), [`object_t`](object_t.md), [`string_t`](string_t.md), - [`boolean_t`](boolean_t.md), [`number_integer_t`](number_integer_t.md), or - [`number_unsigned_t`](number_unsigned_t.md), [`number_float_t`](number_float_t.md), or [`binary_t`](binary_t.md). - Other types will not compile. - -## Return value - -pointer to the internally stored JSON value if the requested pointer type fits to the JSON value; `#!cpp nullptr` -otherwise - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant. - -## Notes - -!!! warning - - Writing data to the pointee of the result yields an undefined state. - -## Examples - -??? example - - The example below shows how pointers to internal values of a JSON value can be requested. Note that no type - conversions are made and a `#!cpp nullptr` is returned if the value and the requested pointer type does not match. - - ```cpp - --8<-- "examples/get_ptr.cpp" - ``` - - Output: - - ```json - --8<-- "examples/get_ptr.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Extended to binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_ref.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_ref.md deleted file mode 100644 index 1140836e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_ref.md +++ /dev/null @@ -1,64 +0,0 @@ -# nlohmann::basic_json::get_ref - -```cpp -template -ReferenceType get_ref(); - -template -const ReferenceType get_ref() const; -``` - -Implicit reference access to the internally stored JSON value. No copies are made. - -## Template parameters - -`ReferenceType` -: reference type; must be a reference to [`array_t`](array_t.md), [`object_t`](object_t.md), - [`string_t`](string_t.md), [`boolean_t`](boolean_t.md), [`number_integer_t`](number_integer_t.md), or - [`number_unsigned_t`](number_unsigned_t.md), [`number_float_t`](number_float_t.md), or [`binary_t`](binary_t.md). - Enforced by static assertion. - -## Return value - -reference to the internally stored JSON value if the requested reference type fits to the JSON value; throws -[`type_error.303`](../../home/exceptions.md#jsonexceptiontype_error303) otherwise - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -Throws [`type_error.303`](../../home/exceptions.md#jsonexceptiontype_error303) if the requested reference type does not -match the stored JSON value type; example: `"incompatible ReferenceType for get_ref, actual type is binary"`. - -## Complexity - -Constant. - -## Notes - -!!! warning - - Writing data to the referee of the result yields an undefined state. - -## Examples - -??? example - - The example shows several calls to `get_ref()`. - - ```cpp - --8<-- "examples/get_ref.cpp" - ``` - - Output: - - ```json - --8<-- "examples/get_ref.output" - ``` - -## Version history - -- Added in version 1.1.0. -- Extended to binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_to.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_to.md deleted file mode 100644 index 6af6d212..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/get_to.md +++ /dev/null @@ -1,58 +0,0 @@ -# nlohmann::basic_json::get_to - -```cpp -template -ValueType& get_to(ValueType& v) const noexcept( - noexcept(JSONSerializer::from_json( - std::declval(), v))); -``` - -Explicit type conversion between the JSON value and a compatible value. The value is filled into the input parameter by -calling the `json_serializer` `from_json()` method. - -The function is equivalent to executing -```cpp -ValueType v; -JSONSerializer::from_json(*this, v); -``` - -This overload is chosen if: - -- `ValueType` is not `basic_json`, -- `json_serializer` has a `from_json()` method of the form `void from_json(const basic_json&, ValueType&)` - -## Template parameters - -`ValueType` -: the value type to return - -## Return value - -the input parameter, allowing chaining calls - -## Exceptions - -Depends on what `json_serializer` `from_json()` method throws - -## Examples - -??? example - - The example below shows several conversions from JSON values to other types. There a few things to note: (1) - Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard - `#!cpp std::vector`, (3) A JSON object can be converted to C++ associative containers such as - `#cpp std::unordered_map`. - - ```cpp - --8<-- "examples/get_to.cpp" - ``` - - Output: - - ```json - --8<-- "examples/get_to.output" - ``` - -## Version history - -- Since version 3.3.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/index.md deleted file mode 100644 index eb90ac6e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/index.md +++ /dev/null @@ -1,317 +0,0 @@ -# nlohmann::basic_json - -Defined in header `` - -```cpp -template< - template class ObjectType = std::map, - template class ArrayType = std::vector, - class StringType = std::string, - class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = adl_serializer, - class BinaryType = std::vector -> -class basic_json; -``` - -## Template parameters - -| Template parameter | Description | Derived type | -|----------------------|---------------------------------------------------------------------------|---------------------------------------------| -| `ObjectType` | type for JSON objects | [`object_t`](object_t.md) | -| `ArrayType` | type for JSON arrays | [`array_t`](array_t.md) | -| `StringType` | type for JSON strings and object keys | [`string_t`](string_t.md) | -| `BooleanType` | type for JSON booleans | [`boolean_t`](boolean_t.md) | -| `NumberIntegerType` | type for JSON integer numbers | [`number_integer_t`](number_integer_t.md) | -| `NumberUnsignedType` | type for JSON unsigned integer numbers | [`number_unsigned_t`](number_unsigned_t.md) | -| `NumberFloatType` | type for JSON floating-point numbers | [`number_float_t`](number_float_t.md) | -| `AllocatorType` | type of the allocator to use | | -| `JSONSerializer` | the serializer to resolve internal calls to `to_json()` and `from_json()` | [`json_serializer`](json_serializer.md) | -| `BinaryType` | type for binary arrays | [`binary_t`](binary_t.md) | - -## Specializations - -- [**json**](../json.md) - default specialization -- [**ordered_json**](../ordered_json.md) - specialization that maintains the insertion order of object keys - -## Iterator invalidation - -Todo - -## Requirements - -The class satisfies the following concept requirements: - -### Basic - -- [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): JSON values can be default - constructed. The result will be a JSON null value. -- [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible): A JSON value can be constructed - from an rvalue argument. -- [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible): A JSON value can be - copy-constructed from an lvalue expression. -- [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable): A JSON value van be assigned from an - rvalue argument. -- [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable): A JSON value can be copy-assigned from - an lvalue expression. -- [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible): JSON values can be destructed. - -### Layout - -- [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType): JSON values have - [standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout): All non-static data - members are private and standard layout types, the class has no virtual functions or (virtual) base classes. - -### Library-wide - -- [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): JSON values can be compared with - `==`, see [`operator==`](operator_eq.md). -- [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): JSON values can be compared with - `<`, see [`operator<`](operator_le). -- [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): Any JSON lvalue or rvalue of can be swapped with - any lvalue or rvalue of other compatible types, using unqualified function `swap`. -- [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): JSON values can be compared against - `std::nullptr_t` objects which are used to model the `null` value. - -### Container - -- [Container](https://en.cppreference.com/w/cpp/named_req/Container): JSON values can be used like STL containers and - provide iterator access. -- [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer): JSON values can be used like - STL containers and provide reverse iterator access. - -## Member types - -- [**adl_serializer**](../adl_serializer) - the default serializer -- [**value_t**](value_t.md) - the JSON type enumeration -- [**json_pointer**](../json_pointer/index.md) - JSON Pointer implementation -- [**json_serializer**](json_serializer.md) - type of the serializer to for conversions from/to JSON -- [**error_handler_t**](error_handler_t.md) - type to choose behavior on decoding errors -- [**cbor_tag_handler_t**](cbor_tag_handler_t.md) - type to choose how to handle CBOR tags -- **initializer_list_t** - type for initializer lists of `basic_json` values -- [**input_format_t**](input_format_t.md) - type to choose the format to parse -- [**json_sax_t**](../json_sax/index.md) - type for SAX events - -### Exceptions - -- [**exception**](exception.md) - general exception of the `basic_json` class - - [**parse_error**](parse_error.md) - exception indicating a parse error - - [**invalid_iterator**](invalid_iterator.md) - exception indicating errors with iterators - - [**type_error**](type_error.md) - exception indicating executing a member function with a wrong type - - [**out_of_range**](out_of_range.md) - exception indicating access out of the defined range - - [**other_error**](other_error.md) - exception indicating other library errors - -### Container types - -| Type | Definition | -|--------------------------|-----------------------------------------------------------------------------------------------------------| -| `value_type` | `#!cpp basic_json` | -| `reference` | `#!cpp value_type&` | -| `const_reference` | `#!cpp const value_type&` | -| `difference_type` | `#!cpp std::ptrdiff_t` | -| `size_type` | `#!cpp std::size_t` | -| `allocator_type` | `#!cpp AllocatorType` | -| `pointer` | `#!cpp std::allocator_traits::pointer` | -| `const_pointer` | `#!cpp std::allocator_traits::const_pointer` | -| `iterator` | [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator) | -| `const_iterator` | constant [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator) | -| `reverse_iterator` | reverse iterator, derived from `iterator` | -| `const_reverse_iterator` | reverse iterator, derived from `const_iterator` | -| `iteration_proxy` | helper type for [`items`](items.md) function | - -### JSON value data types - -- [**array_t**](array_t.md) - type for arrays -- [**binary_t**](binary_t.md) - type for binary arrays -- [**boolean_t**](boolean_t.md) - type for booleans -- [**number_float_t**](number_float_t.md) - type for numbers (floating-point) -- [**number_integer_t**](number_integer_t.md) - type for numbers (integer) -- [**number_unsigned_t**](number_unsigned_t.md) - type for numbers (unsigned) -- [**object_comparator_t**](object_comparator_t.md) - comparator for objects -- [**object_t**](object_t.md) - type for objects -- [**string_t**](string_t.md) - type for strings - -### Parser callback - -- [**parse_event_t**](parse_event_t.md) - parser event types -- [**parser_callback_t**](parser_callback_t.md) - per-element parser callback type - -## Member functions - -- [(constructor)](basic_json.md) -- [(destructor)](~basic_json.md) -- [**operator=**](operator=.md) - copy assignment -- [**array**](array_t.md) (_static_) - explicitly create an array -- [**binary**](binary.md) (_static_) - explicitly create a binary array -- [**object**](object_t.md) (_static_) - explicitly create an object - -### Object inspection - -Functions to inspect the type of a JSON value. - -- [**type**](type.md) - return the type of the JSON value -- [**operator value_t**](operator_value_t.md) - return the type of the JSON value -- [**type_name**](type_name.md) - return the type as string -- [**is_primitive**](is_primitive.md) - return whether type is primitive -- [**is_structured**](is_structured.md) - return whether type is structured -- [**is_null**](is_null.md) - return whether value is null -- [**is_boolean**](is_boolean.md) - return whether value is a boolean -- [**is_number**](is_number.md) - return whether value is a number -- [**is_number_integer**](is_number_integer.md) - return whether value is an integer number -- [**is_number_unsigned**](is_number_unsigned.md) - return whether value is an unsigned integer number -- [**is_number_float**](is_number_float.md) - return whether value is a floating-point number -- [**is_object**](is_object.md) - return whether value is an object -- [**is_array**](is_array.md) - return whether value is an array -- [**is_string**](is_string.md) - return whether value is a string -- [**is_binary**](is_binary.md) - return whether value is a binary array -- [**is_discarded**](is_discarded.md) - return whether value is discarded - -### Value access - -Direct access to the stored value of a JSON value. - -- [**get**](get.md) - get a value -- [**get_to**](get_to.md) - get a value and write it to a destination -- [**get_ptr**](get_ptr.md) - get a pointer value -- [**get_ref**](get_ref.md) - get a reference value -- [**operator ValueType**](operator_ValueType.md) - get a value -- [**get_binary**](get_binary.md) - get a binary value - -### Element access - -Access to the JSON value - -- [**at**](at.md) - access specified element with bounds checking -- [**operator[]**](operator[].md) - access specified element -- [**value**](value.md) - access specified object element with default value -- [**front**](front.md) - access the first element -- [**back**](back.md) - access the last element - -### Lookup - -- [**find**](find.md) - find an element in a JSON object -- [**count**](count.md) - returns the number of occurrences of a key in a JSON object -- [**contains**](contains.md) - check the existence of an element in a JSON object - -### Iterators - -- [**begin**](begin.md) - returns an iterator to the first element -- [**cbegin**](cbegin.md) - returns a const iterator to the first element -- [**end**](end.md) - returns an iterator to one past the last element -- [**cend**](cend.md) - returns a const iterator to one past the last element -- [**rbegin**](rbegin.md) - returns an iterator to the reverse-beginning -- [**rend**](rend.md) - returns an iterator to the reverse-end -- [**crbegin**](crbegin.md) - returns a const iterator to the reverse-beginning -- [**crend**](crend.md) - returns a const iterator to the reverse-end -- [**items**](items.md) - wrapper to access iterator member functions in range-based for - -### Capacity - -- [**empty**](empty.md) - checks whether the container is empty -- [**size**](size.md) - returns the number of elements -- [**max_size**](max_size.md) - returns the maximum possible number of elements - -### Modifiers - -- [**clear**](clear.md) - clears the contents -- [**push_back**](push_back.md) - add a value to an array/object -- [**operator+=**](operator+=.md) - add a value to an array/object -- [**emplace_back**](emplace_back.md) - add a value to an array -- [**emplace**](emplace.md) - add a value to an object if key does not exist -- [**erase**](erase.md) - remove elements -- [**insert**](insert.md) - inserts elements -- [**update**](update.md) - updates a JSON object from another object, overwriting existing keys -- [**swap**](swap.md) - exchanges the values - -### Lexicographical comparison operators - -- [**operator==**](operator_eq.md) - comparison: equal -- [**operator!=**](operator_ne.md) - comparison: not equal -- [**operator<**](operator_lt.md) - comparison: less than -- [**operator<=**](operator_le.md) - comparison: less than or equal -- [**operator>**](operator_gt.md) - comparison: greater than -- [**operator>=**](operator_ge.md) - comparison: greater than or equal - -### Serialization / Dumping - -- [**dump**](dump.md) - serialization - -### Deserialization / Parsing - -- [**parse**](parse.md) (_static_) - deserialize from a compatible input -- [**accept**](accept.md) (_static_) - check if the input is valid JSON -- [**sax_parse**](sax_parse.md) (_static_) - generate SAX events - -### JSON Pointer functions - -- [**flatten**](flatten.md) - return flattened JSON value -- [**unflatten**](unflatten.md) - unflatten a previously flattened JSON value - -### JSON Patch functions - -- [**patch**](patch.md) - applies a JSON patch -- [**diff**](diff.md) (_static_) - creates a diff as a JSON patch - -### JSON Merge Patch functions - -- [**merge_patch**](merge_patch.md) - applies a JSON Merge Patch - -## Static functions - -- [**meta**](meta.md) - returns version information on the library -- [**get_allocator**](get_allocator.md) - returns the allocator associated with the container - -### Binary formats - -- [**from_bson**](from_bson.md) (_static_) - create a JSON value from an input in BSON format -- [**from_cbor**](from_cbor.md) (_static_) - create a JSON value from an input in CBOR format -- [**from_msgpack**](from_msgpack.md) (_static_) - create a JSON value from an input in MessagePack format -- [**from_ubjson**](from_ubjson.md) (_static_) - create a JSON value from an input in UBJSON format -- [**to_bson**](to_bson.md) (_static_) - create a BSON serialization of a given JSON value -- [**to_cbor**](to_cbor.md) (_static_) - create a CBOR serialization of a given JSON value -- [**to_msgpack**](to_msgpack.md) (_static_) - create a MessagePack serialization of a given JSON value -- [**to_ubjson**](to_ubjson.md) (_static_) - create a UBJSON serialization of a given JSON value - -## Non-member functions - -- [**operator<<(std::ostream&)**](operator_ltlt.md) - serialize to stream -- [**operator>>(std::istream&)**](operator_gtgt.md) - deserialize from stream -- [**to_string**](to_string.md) - user-defined `to_string` function for JSON values - -## Literals - -- [**operator""_json**](operator_literal_json.md) - user-defined string literal for JSON values -- [**operator""_json_pointer**](operator_literal_json_pointer.md) - user-defined string literal for JSON pointers - -## Helper classes - -- [**std::hash<basic_json>**](std_hash.md) - return a hash value for a JSON object -- [**std::swap<basic_json>**](std_swap.md) - exchanges the values of two JSON objects - -## Example - -??? example - - The example shows how the library is used. - - ```cpp - --8<-- "examples/README.cpp" - ``` - - Output: - - ```json - --8<-- "examples/README.output" - ``` - -## See also - -- [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc8259) - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/input_format_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/input_format_t.md deleted file mode 100644 index 4accf6de..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/input_format_t.md +++ /dev/null @@ -1,32 +0,0 @@ -# nlohmann::basic_json::input_format_t - -```cpp -enum class input_format_t { - json, - cbor, - msgpack, - ubjson, - bson -}; -``` - -This enumeration is used in the [`sax_parse`](sax_parse.md) function to choose the input format to parse: - -json -: JSON (JavaScript Object Notation) - -cbor -: CBOR (Concise Binary Object Representation) - -msgpack -: MessagePack - -ubjson -: UBJSON (Universal Binary JSON) - -bson -: BSON (Binary JSON) - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/insert.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/insert.md deleted file mode 100644 index fdd8fe6b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/insert.md +++ /dev/null @@ -1,179 +0,0 @@ -# nlohmann::basic_json::insert - -```cpp -// (1) -iterator insert(const_iterator pos, const basic_json& val); -iterator insert(const_iterator pos, basic_json&& val); - -// (2) -iterator insert(const_iterator pos, size_type cnt, const basic_json& val); - -// (3) -iterator insert(const_iterator pos, const_iterator first, const_iterator last); - -// (4) -iterator insert(const_iterator pos, initializer_list_t ilist); - -// (5) -void insert(const_iterator first, const_iterator last); -``` - -1. Inserts element `val` into array before iterator `pos`. -2. Inserts `cnt` copies of `val` into array before iterator `pos`. -3. Inserts elements from range `[first, last)` into array before iterator `pos`. -4. Inserts elements from initializer list `ilist` into array before iterator `pos`. -5. Inserts elements from range `[first, last)` into object. - -## Parameters - -`pos` (in) -: iterator before which the content will be inserted; may be the `end()` iterator - -`val` (in) -: value to insert - -`cnt` (in) -: number of copies of `val` to insert - -`first` (in) -: begin of the range of elements to insert - -`last` (in) -: end of the range of elements to insert - -`ilist` (in) -: initializer list to insert the values from - -## Return value - -1. iterator pointing to the inserted `val`. -2. iterator pointing to the first element inserted, or `pos` if `#!cpp cnt==0` -3. iterator pointing to the first element inserted, or `pos` if `#!cpp first==last` -4. iterator pointing to the first element inserted, or `pos` if `ilist` is empty -5. / - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than - arrays; example: `"cannot use insert() with string"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` -2. The function can throw the following exceptions: - - Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than - arrays; example: `"cannot use insert() with string"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` -3. The function can throw the following exceptions: - - Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than - arrays; example: `"cannot use insert() with string"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` - - Throws [`invalid_iterator.210`](../../home/exceptions.md#jsonexceptioninvalid_iterator210) if `first` and `last` - do not belong to the same JSON value; example: `"iterators do not fit"` - - Throws [`invalid_iterator.211`](../../home/exceptions.md#jsonexceptioninvalid_iterator211) if `first` or `last` - are iterators into container for which insert is called; example: `"passed iterators may not belong to container"` -4. The function can throw the following exceptions: - - Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than - arrays; example: `"cannot use insert() with string"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` -5. The function can throw the following exceptions: - - Throws [`type_error.309`](../../home/exceptions.md#jsonexceptiontype_error309) if called on JSON values other than - objects; example: `"cannot use insert() with string"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` - - Throws [`invalid_iterator.210`](../../home/exceptions.md#jsonexceptioninvalid_iterator210) if `first` and `last` - do not belong to the same JSON value; example: `"iterators do not fit"` - -## Complexity - -1. Constant plus linear in the distance between `pos` and end of the container. -2. Linear in `cnt` plus linear in the distance between `pos` and end of the container. -3. Linear in `#!cpp std::distance(first, last)` plus linear in the distance between `pos` and end of the container. -4. Linear in `ilist.size()` plus linear in the distance between `pos` and end of the container. -5. Logarithmic: `O(N*log(size() + N))`, where `N` is the number of elements to insert. - -## Examples - -??? example "Example (1): insert element into array" - - The example shows how `insert()` is used. - - ```cpp - --8<-- "examples/insert.cpp" - ``` - - Output: - - ```json - --8<-- "examples/insert.output" - ``` - -??? example "Example (2): insert copies of element into array" - - The example shows how `insert()` is used. - - ```cpp - --8<-- "examples/insert__count.cpp" - ``` - - Output: - - ```json - --8<-- "examples/insert__count.output" - ``` - -??? example "Example (3): insert range of elements into array" - - The example shows how `insert()` is used. - - ```cpp - --8<-- "examples/insert__range.cpp" - ``` - - Output: - - ```json - --8<-- "examples/insert__range.output" - ``` - -??? example "Example (4): insert elements from initializer list into array" - - The example shows how `insert()` is used. - - ```cpp - --8<-- "examples/insert__ilist.cpp" - ``` - - Output: - - ```json - --8<-- "examples/insert__ilist.output" - ``` - -??? example "Example (5): insert range of elements into object" - - The example shows how `insert()` is used. - - ```cpp - --8<-- "examples/insert__range_object.cpp" - ``` - - Output: - - ```json - --8<-- "examples/insert__range_object.output" - ``` - -## Version history - -1. Added in version 1.0.0. -2. Added in version 1.0.0. -3. Added in version 1.0.0. -4. Added in version 1.0.0. -5. Added in version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/invalid_iterator.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/invalid_iterator.md deleted file mode 100644 index f9fdce5b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/invalid_iterator.md +++ /dev/null @@ -1,67 +0,0 @@ -# nlohmann::basic_json::invalid_iterator - -```cpp -class invalid_iterator : public exception; -``` - -This exception is thrown if iterators passed to a library function do not match the expected semantics. - -Exceptions have ids 2xx (see [list of iterator errors](../../home/exceptions.md#iterator-errors)). - -```plantuml -std::exception <|-- basic_json::exception -basic_json::exception <|-- basic_json::parse_error -basic_json::exception <|-- basic_json::invalid_iterator -basic_json::exception <|-- basic_json::type_error -basic_json::exception <|-- basic_json::out_of_range -basic_json::exception <|-- basic_json::other_error - -interface std::exception {} - -class basic_json::exception { - + const int id - + const char* what() const -} - -class basic_json::parse_error { - + const std::size_t byte -} - -class basic_json::invalid_iterator #FFFF00 {} -``` - -## Member functions - -- **what** - returns explanatory string - -## Member variables - -- **id** - the id of the exception - -## Examples - -??? example - - The following code shows how a `invalid_iterator` exception can be caught. - - ```cpp - --8<-- "examples/invalid_iterator.cpp" - ``` - - Output: - - ```json - --8<-- "examples/invalid_iterator.output" - ``` - -## See also - -- [List of iterator errors](../../home/exceptions.md#iterator-errors) -- [`parse_error`](parse_error.md) for exceptions indicating a parse error -- [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type -- [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range -- [`other_error`](other_error.md) for exceptions indicating other library errors - -## Version history - -- Since version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_array.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_array.md deleted file mode 100644 index 64468c35..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_array.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::basic_json::is_array - -```cpp -constexpr bool is_array() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is an array. - -## Return value - -`#!cpp true` if type is an array, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_array()` for all JSON types. - - ```cpp - --8<-- "examples/is_array.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_array.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_binary.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_binary.md deleted file mode 100644 index ea48d745..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_binary.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::basic_json::is_binary - -```cpp -constexpr bool is_binary() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is binary array. - -## Return value - -`#!cpp true` if type is binary, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_binary()` for all JSON types. - - ```cpp - --8<-- "examples/is_binary.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_binary.output" - ``` - -## Version history - -- Added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_boolean.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_boolean.md deleted file mode 100644 index dc41d84b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_boolean.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::basic_json::is_boolean - -```cpp -constexpr bool is_boolean() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is `#!json true` or `#!json false`. - -## Return value - -`#!cpp true` if type is boolean, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_boolean()` for all JSON types. - - ```cpp - --8<-- "examples/is_boolean.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_boolean.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_discarded.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_discarded.md deleted file mode 100644 index 405ae6c1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_discarded.md +++ /dev/null @@ -1,72 +0,0 @@ -# nlohmann::basic_json::is_discarded - -```cpp -constexpr bool is_discarded() const noexcept; -``` - -This function returns `#!cpp true` for a JSON value if either: - -- the value was discarded during parsing with a callback function (see [`parser_callback_t`](parser_callback_t.md)), or -- the value is the result of parsing invalid JSON with parameter `allow_exceptions` set to `#!cpp false`; see - [`parse`](parse.md) for more information. - -## Return value - -`#!cpp true` if type is discarded, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Notes - -!!! note - - Discarded values are never compared equal with [`operator==`](operator_eq.md). That is, checking whether a JSON - value `j` is discarded will only work via: - - ```cpp - j.is_discarded() - ``` - - because - - ```cpp - j == json::value_t::discarded - ``` - - will always be `#!cpp false`. - -!!! note - - When a value is discarded by a callback function (see [`parser_callback_t`](parser_callback_t.md)) during parsing, - then it is removed when it is part of a structured value. For instance, if the second value of an array is discared, - instead of `#!json [null, discarded, false]`, the array `#!json [null, false]` is returned. Only if the top-level - value is discarded, the return value of the `parse` call is discarded. - -This function will always be `#!cpp false` for JSON values after parsing. That is, discarded values can only occur -during parsing, but will be removed when inside a structured value or replaced by null in other cases. - -## Examples - -??? example - - The following code exemplifies `is_discarded()` for all JSON types. - - ```cpp - --8<-- "examples/is_discarded.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_discarded.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_null.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_null.md deleted file mode 100644 index d080ad32..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_null.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::basic_json::is_null - -```cpp -constexpr bool is_null() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is `#!json null`. - -## Return value - -`#!cpp true` if type is `#!json null`, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_null()` for all JSON types. - - ```cpp - --8<-- "examples/is_null.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_null.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number.md deleted file mode 100644 index 9807911b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number.md +++ /dev/null @@ -1,56 +0,0 @@ -# nlohmann::basic_json::is_number - -```cpp -constexpr bool is_number() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is a number. This includes both integer (signed and -unsigned) and floating-point values. - -## Return value - -`#!cpp true` if type is number (regardless whether integer, unsigned integer or floating-type), `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Possible implementation - -```cpp -constexpr bool is_number() const noexcept -{ - return is_number_integer() || is_number_float(); -} -``` - -## Examples - -??? example - - The following code exemplifies `is_number()` for all JSON types. - - ```cpp - --8<-- "examples/is_number.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_number.output" - ``` - -## See also - -- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number -- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number -- [is_number_float()](is_number_float.md) check if value is a floating-point number - -## Version history - -- Added in version 1.0.0. -- Extended to also return `#!cpp true` for unsigned integers in 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_float.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_float.md deleted file mode 100644 index 68d0cfb0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_float.md +++ /dev/null @@ -1,46 +0,0 @@ -# nlohmann::basic_json::is_number_float - -```cpp -constexpr bool is_number_float() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is a floating-point number. This excludes signed and -unsigned integer values. - -## Return value - -`#!cpp true` if type is a floating-point number, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_number_float()` for all JSON types. - - ```cpp - --8<-- "examples/is_number_float.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_number_float.output" - ``` - -## See also - -- [is_number()](is_number.md) check if value is a number -- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number -- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_integer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_integer.md deleted file mode 100644 index 8ca214ae..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_integer.md +++ /dev/null @@ -1,47 +0,0 @@ -# nlohmann::basic_json::is_number_integer - -```cpp -constexpr bool is_number_integer() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is a signed or unsigned integer number. This excludes -floating-point values. - -## Return value - -`#!cpp true` if type is an integer or unsigned integer number, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_number_integer()` for all JSON types. - - ```cpp - --8<-- "examples/is_number_integer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_number_integer.output" - ``` - -## See also - -- [is_number()](is_number.md) check if value is a number -- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number -- [is_number_float()](is_number_float.md) check if value is a floating-point number - -## Version history - -- Added in version 1.0.0. -- Extended to also return `#!cpp true` for unsigned integers in 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md deleted file mode 100644 index 2ac98a5f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md +++ /dev/null @@ -1,46 +0,0 @@ -# nlohmann::basic_json::is_number_unsigned - -```cpp -constexpr bool is_number_unsigned() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is an unsigned integer number. This excludes -floating-point and signed integer values. - -## Return value - -`#!cpp true` if type is an unsigned integer number, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_number_unsigned()` for all JSON types. - - ```cpp - --8<-- "examples/is_number_unsigned.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_number_unsigned.output" - ``` - -## See also - -- [is_number()](is_number.md) check if value is a number -- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number -- [is_number_float()](is_number_float.md) check if value is a floating-point number - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_object.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_object.md deleted file mode 100644 index 04457013..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_object.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::basic_json::is_object - -```cpp -constexpr bool is_object() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is an object. - -## Return value - -`#!cpp true` if type is an object, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_object()` for all JSON types. - - ```cpp - --8<-- "examples/is_object.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_object.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_primitive.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_primitive.md deleted file mode 100644 index cf6cbbd4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_primitive.md +++ /dev/null @@ -1,69 +0,0 @@ -# nlohmann::basic_json::is_primitive - -```cpp -constexpr bool is_primitive() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON type is primitive (string, number, boolean, `#!json null`, -binary). - -## Return value - -`#!cpp true` if type is primitive (string, number, boolean, `#!json null`, or binary), `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Possible implementation - -```cpp -constexpr bool is_primitive() const noexcept -{ - return is_null() || is_string() || is_boolean() || is_number() || is_binary(); -} -``` - -## Notes - -The term *primitive* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259): - -> JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and -> arrays). - -This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence, -`is_primitive()` returns `#!cpp true` for binary values. - -## Examples - -??? example - - The following code exemplifies `is_primitive()` for all JSON types. - - ```cpp - --8<-- "examples/is_primitive.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_primitive.output" - ``` - -## See also - -- [is_structured()](is_structured.md) returns whether JSON value is structured -- [is_null()](is_null.md) returns whether JSON value is `null` -- [is_string()](is_string.md) returns whether JSON value is a string -- [is_boolean()](is_boolean.md) returns whether JSON value is a boolean -- [is_number()](is_number.md) returns whether JSON value is a number -- [is_binary()](is_binary.md) returns whether JSON value is a binary array - -## Version history - -- Added in version 1.0.0. -- Extended to return `#!cpp true` for binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_string.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_string.md deleted file mode 100644 index b82c9246..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_string.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::basic_json::is_string - -```cpp -constexpr bool is_string() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON value is a string. - -## Return value - -`#!cpp true` if type is a string, `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `is_string()` for all JSON types. - - ```cpp - --8<-- "examples/is_string.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_string.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_structured.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_structured.md deleted file mode 100644 index f8fe4dcb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/is_structured.md +++ /dev/null @@ -1,63 +0,0 @@ -# nlohmann::basic_json::is_structured - -```cpp -constexpr bool is_structured() const noexcept; -``` - -This function returns `#!cpp true` if and only if the JSON type is structured (array or object). - -## Return value - -`#!cpp true` if type is structured (array or object), `#!cpp false` otherwise. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Possible implementation - -```cpp -constexpr bool is_primitive() const noexcept -{ - return is_array() || is_object(); -} -``` - -## Notes - -The term *structured* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259): - -> JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and -> arrays). - -Note that though strings are containers in C++, they are treated as primitive values in JSON. - -## Examples - -??? example - - The following code exemplifies `is_structured()` for all JSON types. - - ```cpp - --8<-- "examples/is_structured.cpp" - ``` - - Output: - - ```json - --8<-- "examples/is_structured.output" - ``` - -## See also - -- [is_primitive()](is_primitive.md) returns whether JSON value is primitive -- [is_array()](is_array.md) returns whether value is an array -- [is_object()](is_object.md) returns whether value is an object - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/items.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/items.md deleted file mode 100644 index b388824f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/items.md +++ /dev/null @@ -1,100 +0,0 @@ -# nlohmann::basic_json::items - -```cpp -iteration_proxy items() noexcept; -iteration_proxy items() const noexcept; -``` - -This function allows accessing `iterator::key()` and `iterator::value()` during range-based for loops. In these loops, a -reference to the JSON values is returned, so there is no access to the underlying iterator. - -For loop without `items()` function: - -```cpp -for (auto it = j_object.begin(); it != j_object.end(); ++it) -{ - std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; -} -``` - -Range-based for loop without `items()` function: - -```cpp -for (auto it : j_object) -{ - // "it" is of type json::reference and has no key() member - std::cout << "value: " << it << '\n'; -} -``` - -Range-based for loop with `items()` function: - -```cpp -for (auto& el : j_object.items()) -{ - std::cout << "key: " << el.key() << ", value:" << el.value() << '\n'; -} -``` - -The `items()` function also allows using -[structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding) (C++17): - -```cpp -for (auto& [key, val] : j_object.items()) -{ - std::cout << "key: " << key << ", value:" << val << '\n'; -} -``` - -## Return value - -iteration proxy object wrapping the current value with an interface to use in range-based for loops - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Constant. - -## Notes - -When iterating over an array, `key()` will return the index of the element as string (see example). For primitive types -(e.g., numbers), `key()` returns an empty string. - -!!! warning - - Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exceeds the iteration. See - for more information. - -## Examples - -??? example - - The following code shows an example for `items()`. - - ```cpp - --8<-- "examples/items.cpp" - ``` - - Output: - - ```json - --8<-- "examples/items.output" - ``` - -## Version history - -- Added `iterator_wrapper` in version 3.0.0. -- Added `items` and deprecated `iterator_wrapper` in version 3.1.0. -- Added structured binding support in version 3.5.0. - -!!! warning "Deprecation" - - This function replaces the static function `iterator_wrapper` which was introduced in version 1.0.0, but has been - deprecated in version 3.1.0. Function `iterator_wrapper` will be removed in version 4.0.0. Please replace all - occurrences of `#!cpp iterator_wrapper(j)` with `#!cpp j.items()`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/json_serializer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/json_serializer.md deleted file mode 100644 index f0911556..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/json_serializer.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::basic_json::json_serializer - -```cpp -template -using json_serializer = JSONSerializer; -``` - -## Template parameters - -`T` -: type to convert; will be used in the `to_json`/`from_json` functions - -`SFINAE` -: type to add compile type checks via SFINAE; usually `#!cpp void` - -## Notes - -#### Default type - -The default values for `json_serializer` is [`adl_serializer`](../adl_serializer). - -## Version history - -- Since version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/max_size.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/max_size.md deleted file mode 100644 index 31339dbe..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/max_size.md +++ /dev/null @@ -1,58 +0,0 @@ -# nlohmann::basic_json::max_size - -```cpp -size_type max_size() const noexcept; -``` - -Returns the maximum number of elements a JSON value is able to hold due to system or library implementation limitations, -i.e. `std::distance(begin(), end())` for the JSON value. - -## Return value - -The return value depends on the different types and is defined as follows: - -| Value type | return value | -|------------|-------------------------------------------| -| null | `0` (same as [`size()`](size.md)) | -| boolean | `1` (same as [`size()`](size.md)) | -| string | `1` (same as [`size()`](size.md)) | -| number | `1` (same as [`size()`](size.md)) | -| binary | `1` (same as [`size()`](size.md)) | -| object | result of function `object_t::max_size()` | -| array | result of function `array_t::max_size()` | - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant, as long as [`array_t`](array_t.md) and [`object_t`](object_t.md) satisfy the -[Container](https://en.cppreference.com/w/cpp/named_req/Container) concept; that is, their `max_size()` functions have -constant complexity. - -## Notes - -This function does not return the maximal length of a string stored as JSON value -- it returns the maximal number of -string elements the JSON value can store which is `1`. - -## Examples - -??? example - - The following code calls `max_size()` on the different value types. Note the output is implementation specific. - - ```cpp - --8<-- "examples/max_size.cpp" - ``` - - Output: - - ```json - --8<-- "examples/max_size.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Extended to return `1` for binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/merge_patch.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/merge_patch.md deleted file mode 100644 index 1718c922..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/merge_patch.md +++ /dev/null @@ -1,63 +0,0 @@ -# nlohmann::basic_json::merge_patch - -```cpp -void merge_patch(const basic_json& apply_patch); -``` - -The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of -modifications to a target resource's content. This function applies a merge patch to the current JSON value. - -The function implements the following algorithm from Section 2 of -[RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396): - -```python -define MergePatch(Target, Patch): - if Patch is an Object: - if Target is not an Object: - Target = {} // Ignore the contents and set it to an empty Object - for each Name/Value pair in Patch: - if Value is null: - if Name exists in Target: - remove the Name/Value pair from Target - else: - Target[Name] = MergePatch(Target[Name], Value) - return Target - else: - return Patch -``` - -Thereby, `Target` is the current object; that is, the patch is applied to the current value. - -## Parameters - -`apply_patch` (in) -: the patch to apply - -## Complexity - -Linear in the lengths of `apply_patch`. - -## Examples - -??? example - - The following code shows how a JSON Merge Patch is applied to a JSON document. - - ```cpp - --8<-- "examples/merge_patch.cpp" - ``` - - Output: - - ```json - --8<-- "examples/merge_patch.output" - ``` - -## See also - -- [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396) -- [patch](patch.md) apply a JSON patch - -## Version history - -- Added in version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/meta.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/meta.md deleted file mode 100644 index e2b312e0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/meta.md +++ /dev/null @@ -1,50 +0,0 @@ -# nlohmann::basic_json::meta - -```cpp -static basic_json meta(); -``` - -This function returns a JSON object with information about the library, including the version number and information on -the platform and compiler. - -## Return value - -JSON object holding version information - -| key | description | -|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version). | -| `copyright` | The copyright line for the library as string. | -| `name` | The name of the library as string. | -| `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`. | -| `url` | The URL of the project as string. | -| `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string). | - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes to any JSON value. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example output of the `meta()` - function. - - ```cpp - --8<-- "examples/meta.cpp" - ``` - - Output: - - ```json - --8<-- "examples/meta.output" - ``` - -## Version history - -- Added in version 2.1.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_float_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_float_t.md deleted file mode 100644 index 50aa43b4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_float_t.md +++ /dev/null @@ -1,70 +0,0 @@ -# nlohmann::basic_json::number_float_t - -```cpp -using number_float_t = NumberFloatType; -``` - -The type used to store JSON numbers (floating-point). - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes numbers as follows: -> The representation of numbers is similar to that used in most programming languages. A number is represented in base -> 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may -> be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that -> cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. - -This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is -known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different -types, [`number_integer_t`](number_integer_t.md), [`number_unsigned_t`](number_unsigned_t.md) and `number_float_t` are -used. - -To store floating-point numbers in C++, a type is defined by the template parameter `NumberFloatType` which chooses the -type to use. - -## Notes - -#### Default type - -With the default values for `NumberFloatType` (`double`), the default value for `number_float_t` is `#!cpp double`. - -#### Default behavior - -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in floating-point literals will be - ignored. Internally, the value will be stored as decimal number. For instance, the C++ floating-point literal `01.2` - will be serialized to `1.2`. During deserialization, leading zeros yield an error. -- Not-a-number (NaN) values will be serialized to `null`. - -#### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) states: -> This specification allows implementations to set limits on the range and precision of numbers accepted. Since software -> that implements IEEE 754-2008 binary64 (double precision) numbers is generally available and widely used, good -> interoperability can be achieved by implementations that expect no more precision or range than these provide, in the -> sense that implementations will approximate JSON numbers within the expected precision. - -This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values -smaller than `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` will be stored as NaN internally -and be serialized to `null`. - -#### Storage - -Floating-point number values are stored directly inside a `basic_json` type. - -## Examples - -??? example - - The following code shows that `number_float_t` is by default, a typedef to `#!cpp double`. - - ```cpp - --8<-- "examples/number_float_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/number_float_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_integer_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_integer_t.md deleted file mode 100644 index 9bb3835a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_integer_t.md +++ /dev/null @@ -1,76 +0,0 @@ -# nlohmann::basic_json::number_integer_t - -```cpp -using number_integer_t = NumberIntegerType; -``` - -The type used to store JSON numbers (integers). - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes numbers as follows: -> The representation of numbers is similar to that used in most programming languages. A number is represented in base -> 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may -> be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that -> cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. - -This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is -known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different -types, `number_integer_t`, [`number_unsigned_t`](number_unsigned_t.md) and [`number_float_t`](number_float_t.md) are -used. - -To store integer numbers in C++, a type is defined by the template parameter `NumberIntegerType` which chooses the type -to use. - -## Notes - -#### Default type - -With the default values for `NumberIntegerType` (`std::int64_t`), the default value for `number_integer_t` is -`#!cpp std::int64_t`. - -#### Default behavior - -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an - interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer - literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. -- Not-a-number (NaN) values will be serialized to `null`. - -#### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: -> An implementation may set limits on the range and precision of numbers. - -When the default type is used, the maximal integer number that can be stored is `9223372036854775807` (INT64_MAX) and -the minimal integer number that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers that are out of -range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers -will be automatically be stored as [`number_unsigned_t`](number_unsigned_t.md) or [`number_float_t`](number_float_t.md). - -[RFC 8259](https://tools.ietf.org/html/rfc8259) further states: -> Note that when such software is used, numbers that are integers and are in the range $[-2^{53}+1, 2^{53}-1]$ are -> interoperable in the sense that implementations will agree exactly on their numeric values. - -As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is -interoperable. - -#### Storage - -Integer number values are stored directly inside a `basic_json` type. - -## Examples - -??? example - - The following code shows that `number_integer_t` is by default, a typedef to `#!cpp std::int64_t`. - - ```cpp - --8<-- "examples/number_integer_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/number_integer_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_unsigned_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_unsigned_t.md deleted file mode 100644 index 8a1540a5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/number_unsigned_t.md +++ /dev/null @@ -1,76 +0,0 @@ -# nlohmann::basic_json::number_unsigned_t - -```cpp -using number_unsigned_t = NumberUnsignedType; -``` - -The type used to store JSON numbers (unsigned). - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes numbers as follows: -> The representation of numbers is similar to that used in most programming languages. A number is represented in base -> 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may -> be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that -> cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. - -This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is -known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different -types, [`number_integer_t`](number_integer_t.md), `number_unsigned_t` and [`number_float_t`](number_float_t.md) are -used. - -To store unsigned integer numbers in C++, a type is defined by the template parameter `NumberUnsignedType` which chooses -the type to use. - -## Notes - -#### Default type - -With the default values for `NumberUnsignedType` (`std::uint64_t`), the default value for `number_unsigned_t` is -`#!cpp std::uint64_t`. - -#### Default behavior - -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an - interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer - literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. -- Not-a-number (NaN) values will be serialized to `null`. - -#### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: -> An implementation may set limits on the range and precision of numbers. - -When the default type is used, the maximal integer number that can be stored is `18446744073709551615` (UINT64_MAX) and -the minimal integer number that can be stored is `0`. Integer numbers that are out of range will yield over/underflow -when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored -as [`number_integer_t`](number_integer_t.md) or [`number_float_t`](number_float_t.md). - -[RFC 8259](https://tools.ietf.org/html/rfc8259) further states: -> Note that when such software is used, numbers that are integers and are in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are -> interoperable in the sense that implementations will agree exactly on their numeric values. - -As this range is a subrange (when considered in conjunction with the `number_integer_t` type) of the exactly supported -range [0, UINT64_MAX], this class's integer type is interoperable. - -#### Storage - -Integer number values are stored directly inside a `basic_json` type. - -## Examples - -??? example - - The following code shows that `number_unsigned_t` is by default, a typedef to `#!cpp std::uint64_t`. - - ```cpp - --8<-- "examples/number_unsigned_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/number_unsigned_t.output" - ``` - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object.md deleted file mode 100644 index 9bdbddb6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object.md +++ /dev/null @@ -1,63 +0,0 @@ -# nlohmann::basic_json::object - -```cpp -static basic_json object(initializer_list_t init = {}); -``` - -Creates a JSON object value from a given initializer list. The initializer lists elements must be pairs, and their first -elements must be strings. If the initializer list is empty, the empty object `#!json {}` is created. - -## Parameters - -`init` (in) -: initializer list with JSON values to create an object from (optional) - -## Return value - -JSON object value - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -Throws [`type_error.301`](../../home/exceptions.md#jsonexceptiontype_error301) if `init` is not a list of pairs whose -first elements are strings. In this case, no object can be created. When such a value is passed to -`basic_json(initializer_list_t, bool, value_t)`, an array would have been created from the passed initializer list -`init`. See example below. - -## Complexity - -Linear in the size of `init`. - -## Notes - -This function is only added for symmetry reasons. In contrast to the related function `array(initializer_list_t)`, there -are no cases which can only be expressed by this function. That is, any initializer list `init` can also be passed to -the initializer list constructor `basic_json(initializer_list_t, bool, value_t)`. - -## Examples - -??? example - - The following code shows an example for the `object` function. - - ```cpp - --8<-- "examples/object.cpp" - ``` - - Output: - - ```json - --8<-- "examples/object.output" - ``` - -## See also - -- [`basic_json(initializer_list_t)`](basic_json.md) - create a JSON value from an initializer list -- [`array`](array.md) - create a JSON array value from an initializer list - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object_comparator_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object_comparator_t.md deleted file mode 100644 index 44509a94..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object_comparator_t.md +++ /dev/null @@ -1,16 +0,0 @@ -# nlohmann::basic_json::object_comparator_t - -```cpp -using object_comparator_t = std::less; // until C++14 - -using object_comparator_t = std::less<>; // since C++14 -``` - -The comparator used in [`object_t`](object_t.md). - -When C++14 is detected, a transparent com parator is used which, when combined with perfect forwarding on find() and -count() calls, prevents unnecessary string construction. - -## Version history - -- Unknown. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object_t.md deleted file mode 100644 index d4bea15a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/object_t.md +++ /dev/null @@ -1,113 +0,0 @@ -# nlohmann::basic_json::object_t - -```cpp -using object_t = ObjectType>>; -``` - -The type used to store JSON objects. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON objects as follows: -> An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a -> string, number, boolean, null, object, or array. - -To store objects in C++, a type is defined by the template parameters described below. - -## Template parameters - -`ObjectType` -: the container to store objects (e.g., `std::map` or `std::unordered_map`) - -`StringType` -: the type of the keys or names (e.g., `std::string`). The comparison function `std::less` is used to - order elements inside the container. - -`AllocatorType` -: the allocator to use for objects (e.g., `std::allocator`) - -## Notes - -#### Default type - -With the default values for `ObjectType` (`std::map`), `StringType` (`std::string`), and `AllocatorType` -(`std::allocator`), the default value for `object_t` is: - -```cpp -// until C++14 -std::map< - std::string, // key_type - basic_json, // value_type - std::less, // key_compare - std::allocator> // allocator_type -> - -// since C++14 -std::map< - std::string, // key_type - basic_json, // value_type - std::less<>, // key_compare - std::allocator> // allocator_type -> -``` - -See [`object_comparator_t`](object_comparator_t.md) for more information. - -#### Behavior - -The choice of `object_t` influences the behavior of the JSON class. With the default type, objects have the following -behavior: - -- When all names are unique, objects will be interoperable in the sense that all software implementations receiving that - object will agree on the name-value mappings. -- When the names within an object are not unique, it is unspecified which one of the values for a given key will be - chosen. For instance, `#!json {"key": 2, "key": 1}` could be equal to either `#!json {"key": 1}` or - `#!json {"key": 2}`. -- Internally, name/value pairs are stored in lexicographical order of the names. Objects will also be serialized (see - [`dump`](dump.md)) in this order. For instance, `#!json {"b": 1, "a": 2}` and `#!json {"a": 2, "b": 1}` will be stored - and serialized as `#!json {"a": 2, "b": 1}`. -- When comparing objects, the order of the name/value pairs is irrelevant. This makes objects interoperable in the sense - that they will not be affected by these differences. For instance, `#!json {"b": 1, "a": 2}` and - `#!json {"a": 2, "b": 1}` will be treated as equal. - -#### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: -> An implementation may set limits on the maximum depth of nesting. - -In this class, the object's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be -introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the -[`max_size`](max_size.md) function of a JSON object. - -#### Storage - -Objects are stored as pointers in a `basic_json` type. That is, for any access to object values, a pointer of type -`object_t*` must be dereferenced. - -#### Object key order - -The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may -return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in -alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to -[RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON objects. - -## Examples - -??? example - - The following code shows that `object_t` is by default, a typedef to `#!cpp std::map`. - - ```cpp - --8<-- "examples/object_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/object_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator+=.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator+=.md deleted file mode 100644 index 074b3000..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator+=.md +++ /dev/null @@ -1,113 +0,0 @@ -# nlohmann::basic_json::operator+= - -```cpp -// (1) -reference operator+=(basic_json&& val); -reference operator+=(const basic_json& val); - -// (2) -reference operator+=(const typename object_t::value_type& val); - -// (3) -reference operator+=(initializer_list_t init); -``` - -1. Appends the given element `val` to the end of the JSON array. If the function is called on a JSON null value, an - empty array is created before appending `val`. - -2. Inserts the given element `val` to the JSON object. If the function is called on a JSON null value, an empty object - is created before inserting `val`. - -3. This function allows using `operator+=` with an initializer list. In case - - 1. the current value is an object, - 2. the initializer list `init` contains only two elements, and - 3. the first element of `init` is a string, - - `init` is converted into an object element and added using `operator+=(const typename object_t::value_type&)`. - Otherwise, `init` is converted to a JSON value and added using `operator+=(basic_json&&)`. - -## Parameters - -`val` (in) -: the value to add to the JSON array/object - -`init` (in) -: an initializer list - -## Return value - -`#!cpp *this` - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.308`](../../home/exceptions.md#jsonexceptiontype_error308) when called on a type other than - JSON array or null; example: `"cannot use operator+=() with number"` -2. The function can throw the following exceptions: - - Throws [`type_error.308`](../../home/exceptions.md#jsonexceptiontype_error308) when called on a type other than - JSON object or null; example: `"cannot use operator+=() with number"` - -## Complexity - -1. Amortized constant. -2. Logarithmic in the size of the container, O(log(`size()`)). -3. Linear in the size of the initializer list `init`. - -## Notes - -(3) This function is required to resolve an ambiguous overload error, because pairs like `{"key", "value"}` can be both -interpreted as `object_t::value_type` or `std::initializer_list`, see -[#235](https://github.com/nlohmann/json/issues/235) for more information. - -## Examples - -??? example "Example: (1) add element to array" - - The example shows how `push_back()` and `+=` can be used to add elements to a JSON array. Note how the `null` value - was silently converted to a JSON array. - - ```cpp - --8<-- "examples/push_back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/push_back.output" - ``` - -??? example "Example: (2) add element to object" - - The example shows how `push_back()` and `+=` can be used to add elements to a JSON object. Note how the `null` value - was silently converted to a JSON object. - - ```cpp - --8<-- "examples/push_back__object_t__value.cpp" - ``` - - Output: - - ```json - --8<-- "examples/push_back__object_t__value.output" - ``` - -??? example "Example: (3) add to object from initializer list" - - The example shows how initializer lists are treated as objects when possible. - - ```cpp - --8<-- "examples/push_back__initializer_list.cpp" - ``` - - Output: - - ```json - --8<-- "examples/push_back__initializer_list.output" - ``` - -## Version history - -1. Since version 1.0.0. -2. Since version 1.0.0. -2. Since version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator=.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator=.md deleted file mode 100644 index 4e0b9144..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator=.md +++ /dev/null @@ -1,43 +0,0 @@ -# nlohmann::basic_json::operator= - -```cpp -basic_json& operator=(basic_json other) noexcept ( - std::is_nothrow_move_constructible::value && - std::is_nothrow_move_assignable::value && - std::is_nothrow_move_constructible::value && - std::is_nothrow_move_assignable::value -); -``` - -Copy assignment operator. Copies a JSON value via the "copy and swap" strategy: It is expressed in terms of the copy -constructor, destructor, and the `swap()` member function. - -## Parameters - -`other` (in) -: value to copy from - -## Complexity - -Linear. - -## Examples - -??? example - - The code below shows and example for the copy assignment. It creates a copy of value `a` which is then swapped with - `b`. Finally, the copy of `a` (which is the null value after the swap) is destroyed. - - ```cpp - --8<-- "examples/basic_json__copyassignment.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__copyassignment.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator[].md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator[].md deleted file mode 100644 index 5b6512a2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator[].md +++ /dev/null @@ -1,196 +0,0 @@ -# nlohmann::basic_json::operator[] - -```cpp -// (1) -reference operator[](size_type idx); -const_reference operator[](size_type idx) const; - -// (2) -reference operator[](const typename object_t::key_type& key); -const_reference operator[](const typename object_t::key_type& key) const; -template -reference operator[](T* key); -template -const_reference operator[](T* key) const; - -// (3) -reference operator[](const json_pointer& ptr); -const_reference operator[](const json_pointer& ptr) const; -``` - -1. Returns a reference to the array element at specified location `idx`. -2. Returns a reference to the object element at with specified key `key`. -3. Returns a reference to the element at with specified JSON pointer `ptr`. - -## Template parameters - -`T` -: string literal convertible to `object_t::key_type` - -## Parameters - -`idx` (in) -: index of the element to access - -`key` (in) -: object key of the element to access - -`ptr` (in) -: JSON pointer to the desired element - -## Return value - -1. reference to the element at index `idx` -2. reference to the element at key `key` -3. reference to the element pointed to by `ptr` - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.305`](../../home/exceptions.md#jsonexceptiontype_error305) if the JSON value is not an array - or null; in that case, using the `[]` operator with an index makes no sense. -2. The function can throw the following exceptions: - - Throws [`type_error.305`](../../home/exceptions.md#jsonexceptiontype_error305) if the JSON value is not an object - or null; in that case, using the `[]` operator with a key makes no sense. -3. The function can throw the following exceptions: - - Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index in the passed - JSON pointer `ptr` begins with '0'. - - Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in the passed - JSON pointer `ptr` is not a number. - - Throws [`out_of_range.402`](../../home/exceptions.md#jsonexceptionout_of_range402) if the array index '-' is used - in the passed JSON pointer `ptr` for the const version. - - Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can - not be resolved. - -## Complexity - -1. Constant if `idx` is in the range of the array. Otherwise, linear in `idx - size()`. -2. Logarithmic in the size of the container. -3. Constant - -## Notes - -!!! danger - - 1. If the element with key `idx` does not exist, the behavior is undefined. - 2. If the element with key `key` does not exist, the behavior is undefined and is **guarded by an assertion**! - -1. The non-const version may add values: If `idx` is beyond the range of the array (i.e., `idx >= size()`), then the - array is silently filled up with `#!json null` values to make `idx` a valid reference to the last stored element. In - case the value was `#!json null` before, it is converted to an array. - -2. If `key` is not found in the object, then it is silently added to the object and filled with a `#!json null` value to - make `key` a valid reference. In case the value was `#!json null` before, it is converted to an object. - -3. `null` values are created in arrays and objects if necessary. - - In particular: - - - If the JSON pointer points to an object key that does not exist, it is created and filled with a `#!json null` - value before a reference to it is returned. - - If the JSON pointer points to an array index that does not exist, it is created and filled with a `#!json null` - value before a reference to it is returned. All indices between the current maximum and the given index are also - filled with `#!json null`. - - The special value `-` is treated as a synonym for the index past the end. - -## Examples - -??? example "Example (1): access specified array element" - - The example below shows how array elements can be read and written using `[]` operator. Note the addition of - `#!json null` values. - - ```cpp - --8<-- "examples/operatorarray__size_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operatorarray__size_type.output" - ``` - -??? example "Example (1): access specified array element" - - The example below shows how array elements can be read using the `[]` operator. - - ```cpp - --8<-- "examples/operatorarray__size_type_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operatorarray__size_type_const.output" - ``` - -??? example "Example (2): access specified object element" - - The example below shows how object elements can be read and written using the `[]` operator. - - ```cpp - --8<-- "examples/operatorarray__key_type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operatorarray__key_type.output" - ``` - -??? example "Example (2): access specified object element" - - The example below shows how object elements can be read using the `[]` operator. - - ```cpp - --8<-- "examples/operatorarray__key_type_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operatorarray__key_type_const.output" - ``` - -??? example "Example (3): access specified element via JSON Pointer" - - The example below shows how values can be read and written using JSON Pointers. - - ```cpp - --8<-- "examples/operatorjson_pointer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operatorjson_pointer.output" - ``` - -??? example "Example (3): access specified element via JSON Pointer" - - The example below shows how values can be read using JSON Pointers. - - ```cpp - --8<-- "examples/operatorjson_pointer_const.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operatorjson_pointer_const.output" - ``` - -## See also - -- see [`at`](at.md) for access by reference with range checking -- see [`value`](value.md) for access with default value - -## Version history - -1. Added in version 1.0.0. -2. Added in version 1.0.0. Overloads for `T* key` added in version 1.1.0. -3. Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ValueType.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ValueType.md deleted file mode 100644 index 1eec1355..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ValueType.md +++ /dev/null @@ -1,72 +0,0 @@ -# nlohmann::basic_json::operator ValueType - -```cpp -template -JSON_EXPLICIT operator ValueType() const; -``` - -Implicit type conversion between the JSON value and a compatible value. The call is realized by calling -[`get()`](get.md). See [Notes](#notes) for the meaning of `JSON_EXPLICIT`. - -## Template parameters - -`ValueType` -: the value type to return - -## Return value - -copy of the JSON value, converted to `ValueType` - -## Exceptions - -Depends on what `json_serializer` `from_json()` method throws - -## Complexity - -Linear in the size of the JSON value. - -## Notes - -By default `JSON_EXPLICIT` defined to the empty string, so the signature is: - -```cpp -template -operator ValueType() const; -``` - -If [`JSON_USE_IMPLICIT_CONVERSIONS`](../../features/macros.md#json_use_implicit_conversions) is set to `0`, -`JSON_EXPLICIT` is defined to `#!cpp explicit`: - -```cpp -template -explicit operator ValueType() const; -``` - -That is, implicit conversions can be switched off by defining -[`JSON_USE_IMPLICIT_CONVERSIONS`](../../features/macros.md#json_use_implicit_conversions) to `0`. - -## Examples - -??? example - - The example below shows several conversions from JSON values - to other types. There a few things to note: (1) Floating-point numbers can - be converted to integers, (2) A JSON array can be converted to a standard - `std::vector`, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`. - - ```cpp - --8<-- "examples/operator__ValueType.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__ValueType.output" - ``` - -## Version history - -- Since version 1.0.0. -- Macros `JSON_EXPLICIT`/[`JSON_USE_IMPLICIT_CONVERSIONS`](../../features/macros.md#json_use_implicit_conversions) added - in version 3.9.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_eq.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_eq.md deleted file mode 100644 index 49f96b1c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_eq.md +++ /dev/null @@ -1,120 +0,0 @@ -# nlohmann::basic_json::operator== - -```cpp -bool operator==(const_reference lhs, const_reference rhs) noexcept; - -template -bool operator==(const_reference lhs, const ScalarType rhs) noexcept; - -template -bool operator==(ScalarType lhs, const const_reference rhs) noexcept; -``` - -Compares two JSON values for equality according to the following rules: - -- Two JSON values are equal if (1) they are not discarded, (2) they are from the same type, and (3) their stored values - are the same according to their respective `operator==`. -- Integer and floating-point numbers are automatically converted before comparison. Note that two NaN values are always - treated as unequal. - -## Template parameters - -`ScalarType` -: a scalar type according to `std::is_scalar::value` - -## Parameters - -`lhs` (in) -: first value to consider - -`rhs` (in) -: second value to consider - -## Return value - -whether the values `lhs` and `rhs` are equal - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear. - -## Notes - -!!! note - - - NaN values never compare equal to themselves or to other NaN values. - - JSON `#!cpp null` values are all equal. - - Discarded values never compare equal to themselves. - -!!! note - - Floating-point numbers inside JSON values numbers are compared with `json::number_float_t::operator==` which is - `double::operator==` by default. To compare floating-point while respecting an epsilon, an alternative - [comparison function](https://github.com/mariokonrad/marnav/blob/master/include/marnav/math/floatingpoint.hpp#L34-#L39) - could be used, for instance - - ```cpp - template::value, T>::type> - inline bool is_same(T a, T b, T epsilon = std::numeric_limits::epsilon()) noexcept - { - return std::abs(a - b) <= epsilon; - } - ``` - - Or you can self-defined operator equal function like this: - - ```cpp - bool my_equal(const_reference lhs, const_reference rhs) - { - const auto lhs_type lhs.type(); - const auto rhs_type rhs.type(); - if (lhs_type == rhs_type) - { - switch(lhs_type) - // self_defined case - case value_t::number_float: - return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); - // other cases remain the same with the original - ... - } - ... - } - ``` - -## Examples - -??? example - - The example demonstrates comparing several JSON types. - - ```cpp - --8<-- "examples/operator__equal.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__equal.output" - ``` - -??? example - - The example demonstrates comparing several JSON types against the null pointer (JSON `#!json null`). - - ```cpp - --8<-- "examples/operator__equal__nullptr_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__equal__nullptr_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ge.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ge.md deleted file mode 100644 index 68aac655..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ge.md +++ /dev/null @@ -1,59 +0,0 @@ -# nlohmann::basic_json::operator>= - -```cpp -bool operator>=(const_reference lhs, const_reference rhs) noexcept, - -template -bool operator>=(const_reference lhs, const ScalarType rhs) noexcept; - -template -bool operator>=(ScalarType lhs, const const_reference rhs) noexcept; -``` - -Compares whether one JSON value `lhs` is greater than or equal to another JSON value `rhs` by calculating -`#!cpp !(lhs < rhs)`. - -## Template parameters - -`ScalarType` -: a scalar type according to `std::is_scalar::value` - -## Parameters - -`lhs` (in) -: first value to consider - -`rhs` (in) -: second value to consider - -## Return value - -whether `lhs` is less than or equal to `rhs` - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear. - -## Examples - -??? example - - The example demonstrates comparing several JSON types. - - ```cpp - --8<-- "examples/operator__greaterequal.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__greaterequal.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_gt.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_gt.md deleted file mode 100644 index 92ec3059..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_gt.md +++ /dev/null @@ -1,58 +0,0 @@ -# nlohmann::basic_json::operator> - -```cpp -bool operator>(const_reference lhs, const_reference rhs) noexcept, - -template -bool operator>(const_reference lhs, const ScalarType rhs) noexcept; - -template -bool operator>(ScalarType lhs, const const_reference rhs) noexcept; -``` - -Compares whether one JSON value `lhs` is greater than another JSON value `rhs` by calculating `#!cpp !(lhs <= rhs)`. - -## Template parameters - -`ScalarType` -: a scalar type according to `std::is_scalar::value` - -## Parameters - -`lhs` (in) -: first value to consider - -`rhs` (in) -: second value to consider - -## Return value - -whether `lhs` is greater than `rhs` - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear. - -## Examples - -??? example - - The example demonstrates comparing several JSON types. - - ```cpp - --8<-- "examples/operator__greater.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__greater.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_gtgt.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_gtgt.md deleted file mode 100644 index 97c2f0b4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_gtgt.md +++ /dev/null @@ -1,65 +0,0 @@ -# operator>>(basic_json) - -```cpp -std::istream& operator>>(std::istream& i, basic_json& j); -``` - -Deserializes an input stream to a JSON value. - -## Parameters - -`i` (in, out) -: input stream to read a serialized JSON value from - -`j` (in, out) -: JSON value to write the deserialized input to - -## Return value - -the stream `i` - -## Exceptions - -- Throws [`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101) in case of an unexpected token. -- Throws [`parse_error.102`](../../home/exceptions.md#jsonexceptionparse_error102) if to_unicode fails or surrogate - error. -- Throws [`parse_error.103`](../../home/exceptions.md#jsonexceptionparse_error103) if to_unicode fails. - -## Complexity - -Linear in the length of the input. The parser is a predictive LL(1) parser. - -## Notes - -A UTF-8 byte order mark is silently ignored. - -## Examples - -??? example - - The example below shows how a JSON value is constructed by reading a serialization from a stream. - - ```cpp - --8<-- "examples/operator_deserialize.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator_deserialize.output" - ``` - -## See also - -- [accept](accept.md) - check if the input is valid JSON -- [parse](parse.md) - deserialize from a compatible input - -## Version history - -- Added in version 1.0.0 - -!!! warning "Deprecation" - - This function replaces function `#!cpp std::istream& operator<<(basic_json& j, std::istream& i)` which has - been deprecated in version 3.0.0. It will be removed in version 4.0.0. Please replace calls like `#!cpp j << i;` - with `#!cpp i >> j;`. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_le.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_le.md deleted file mode 100644 index 54f9a280..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_le.md +++ /dev/null @@ -1,59 +0,0 @@ -# nlohmann::basic_json::operator<= - -```cpp -bool operator<=(const_reference lhs, const_reference rhs) noexcept, - -template -bool operator<=(const_reference lhs, const ScalarType rhs) noexcept; - -template -bool operator<=(ScalarType lhs, const const_reference rhs) noexcept; -``` - -Compares whether one JSON value `lhs` is less than or equal to another JSON value `rhs` by calculating -`#cpp !(rhs < lhs)`. - -## Template parameters - -`ScalarType` -: a scalar type according to `std::is_scalar::value` - -## Parameters - -`lhs` (in) -: first value to consider - -`rhs` (in) -: second value to consider - -## Return value - -whether `lhs` is less than or equal to `rhs` - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear. - -## Examples - -??? example - - The example demonstrates comparing several JSON types. - - ```cpp - --8<-- "examples/operator__lessequal.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__lessequal.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_literal_json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_literal_json.md deleted file mode 100644 index 8e0c65df..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_literal_json.md +++ /dev/null @@ -1,48 +0,0 @@ -# nlohmann::basic_json::operator""_json - -```cpp -json operator "" _json(const char* s, std::size_t n); -``` - -This operator implements a user-defined string literal for JSON objects. It can be used by adding `#!cpp _json` to a -string literal and returns a [`json`](../json.md) object if no parse error occurred. - -## Parameters - -`s` (in) -: a string representation of a JSON object - -`n` (in) -: length of string `s` - -## Return value - -[`json`](../json.md) value parsed from `s` - -## Exceptions - -The function can throw anything that [`parse(s, s+n)`](parse.md) would throw. - -## Complexity - -Linear. - -## Examples - -??? example - - The following code shows how to create JSON values from string literals. - - ```cpp - --8<-- "examples/operator_literal_json.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator_literal_json.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_literal_json_pointer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_literal_json_pointer.md deleted file mode 100644 index 38c957e6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_literal_json_pointer.md +++ /dev/null @@ -1,48 +0,0 @@ -# nlohmann::basic_json::operator""_json_pointer - -```cpp -json_pointer operator "" _json_pointer(const char* s, std::size_t n); -``` - -This operator implements a user-defined string literal for JSON Pointers. It can be used by adding `#!cpp _json_pointer` -to a string literal and returns a [`json_pointer`](../json_pointer/index.md) object if no parse error occurred. - -## Parameters - -`s` (in) -: a string representation of a JSON Pointer - -`n` (in) -: length of string `s` - -## Return value - -[`json_pointer`](../json_pointer/index.md) value parsed from `s` - -## Exceptions - -The function can throw anything that [`json_pointer::json_pointer`](../json_pointer/index.md) would throw. - -## Complexity - -Linear. - -## Examples - -??? example - - The following code shows how to create JSON Pointers from string literals. - - ```cpp - --8<-- "examples/operator_literal_json_pointer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator_literal_json_pointer.output" - ``` - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_lt.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_lt.md deleted file mode 100644 index d1a4999b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_lt.md +++ /dev/null @@ -1,73 +0,0 @@ -# nlohmann::basic_json::operator< - -```cpp -bool operator<(const_reference lhs, const_reference rhs) noexcept; - -template -bool operator<(const_reference lhs, const ScalarType rhs) noexcept; - -template -bool operator<(ScalarType lhs, const const_reference rhs) noexcept; -``` - -Compares whether one JSON value `lhs` is less than another JSON value `rhs` according to the following rules: - -- If `lhs` and `rhs` have the same type, the values are compared using the default `<` operator. -- Integer and floating-point numbers are automatically converted before comparison -- Discarded values a -- In case `lhs` and `rhs` have different types, the values are ignored and the order of the types is considered, which - is: - 1. null - 2. boolean - 3. number (all types) - 4. object - 5. array - 6. string - 7. binary - - For instance, any boolean value is considered less than any string. - -## Template parameters - -`ScalarType` -: a scalar type according to `std::is_scalar::value` - -## Parameters - -`lhs` (in) -: first value to consider - -`rhs` (in) -: second value to consider - -## Return value - -whether `lhs` is less than `rhs` - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear. - -## Examples - -??? example - - The example demonstrates comparing several JSON types. - - ```cpp - --8<-- "examples/operator__less.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__less.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ltlt.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ltlt.md deleted file mode 100644 index 0cba5ea3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ltlt.md +++ /dev/null @@ -1,62 +0,0 @@ -# operator<<(basic_json) - -```cpp -std::ostream& operator<<(std::ostream& o, const basic_json& j); -``` - -Serialize the given JSON value `j` to the output stream `o`. The JSON value will be serialized using the -[`dump`](dump.md) member function. - -- The indentation of the output can be controlled with the member variable `width` of the output stream `o`. For - instance, using the manipulator `std::setw(4)` on `o` sets the indentation level to `4` and the serialization result - is the same as calling `dump(4)`. -- The indentation character can be controlled with the member variable `fill` of the output stream `o`. For instance, - the manipulator `std::setfill('\\t')` sets indentation to use a tab character rather than the default space character. - -## Parameters - -`o` (in, out) -: stream to serialize to - -`j` (in) -: JSON value to serialize - -## Return value - -the stream `o` - -## Exceptions - -Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value -is not UTF-8 encoded. Note that unlike the [`dump`](dump.md) member functions, no `error_handler` can be set. - -## Complexity - -Linear. - -## Examples - -??? example - - The example below shows the serialization with different parameters to `width` to adjust the indentation level. - - ```cpp - --8<-- "examples/operator_serialize.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator_serialize.output" - ``` - -## Version history - -- Added in version 1.0.0 -- Support for indentation character added in version 3.0.0. - -!!! warning "Deprecation" - - This function replaces function `#!cpp std::ostream& operator>>(const basic_json& j, std::ostream& o)` which has - been deprecated in version 3.0.0. It will be removed in version 4.0.0. Please replace calls like `#!cpp j >> o;` - with `#!cpp o << j;`. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ne.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ne.md deleted file mode 100644 index e94da9b7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_ne.md +++ /dev/null @@ -1,72 +0,0 @@ -# nlohmann::basic_json::operator!= - -```cpp -bool operator!=(const_reference lhs, const_reference rhs) noexcept; - -template -bool operator!=(const_reference lhs, const ScalarType rhs) noexcept; - -template -bool operator!=(ScalarType lhs, const const_reference rhs) noexcept; -``` - -Compares two JSON values for inequality by calculating `#!cpp !(lhs == rhs)`. - -## Template parameters - -`ScalarType` -: a scalar type according to `std::is_scalar::value` - -## Parameters - -`lhs` (in) -: first value to consider - -`rhs` (in) -: second value to consider - -## Return value - -whether the values `lhs` and `rhs` are not equal - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Linear. - -## Examples - -??? example - - The example demonstrates comparing several JSON types. - - ```cpp - --8<-- "examples/operator__notequal.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__notequal.output" - ``` - -??? example - - The example demonstrates comparing several JSON types against the null pointer (JSON `#!json null`). - - ```cpp - --8<-- "examples/operator__notequal__nullptr_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__notequal__nullptr_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_value_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_value_t.md deleted file mode 100644 index 0f08f42b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/operator_value_t.md +++ /dev/null @@ -1,54 +0,0 @@ -# nlohmann::basic_json::operator value_t - -```cpp -constexpr operator value_t() const noexcept; -``` - -Return the type of the JSON value as a value from the [`value_t`](value_t.md) enumeration. - -## Return value - -the type of the JSON value - -| Value type | return value | -|---------------------------|----------------------------| -| `#!json null` | `value_t::null` | -| boolean | `value_t::boolean` | -| string | `value_t::string` | -| number (integer) | `value_t::number_integer` | -| number (unsigned integer) | `value_t::number_unsigned` | -| number (floating-point) | `value_t::number_float` | -| object | `value_t::object` | -| array | `value_t::array` | -| binary | `value_t::binary` | -| discarded | `value_t::discarded` | - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `operator value_t()` for all JSON types. - - ```cpp - --8<-- "examples/operator__value_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/operator__value_t.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Added unsigned integer type in version 2.0.0. -- Added binary type in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/other_error.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/other_error.md deleted file mode 100644 index 9a83340a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/other_error.md +++ /dev/null @@ -1,67 +0,0 @@ -# nlohmann::basic_json::other_error - -```cpp -class other_error : public exception; -``` - -This exception is thrown in case of errors that cannot be classified with the other exception types. - -Exceptions have ids 5xx (see [list of other errors](../../home/exceptions.md#further-exceptions)). - -```plantuml -std::exception <|-- basic_json::exception -basic_json::exception <|-- basic_json::parse_error -basic_json::exception <|-- basic_json::invalid_iterator -basic_json::exception <|-- basic_json::type_error -basic_json::exception <|-- basic_json::out_of_range -basic_json::exception <|-- basic_json::other_error - -interface std::exception {} - -class basic_json::exception { - + const int id - + const char* what() const -} - -class basic_json::parse_error { - + const std::size_t byte -} - -class basic_json::other_error #FFFF00 {} -``` - -## Member functions - -- **what** - returns explanatory string - -## Member variables - -- **id** - the id of the exception - -## Examples - -??? example - - The following code shows how a `other_error` exception can be caught. - - ```cpp - --8<-- "examples/other_error.cpp" - ``` - - Output: - - ```json - --8<-- "examples/other_error.output" - ``` - -## See also - -- [List of other errors](../../home/exceptions.md#further-exceptions) -- [`parse_error`](parse_error.md) for exceptions indicating a parse error -- [`invalid_iterator`](invalid_iterator.md) for exceptions indicating errors with iterators -- [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type -- [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range - -## Version history - -- Since version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/out_of_range.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/out_of_range.md deleted file mode 100644 index 6c1f0dfb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/out_of_range.md +++ /dev/null @@ -1,68 +0,0 @@ -# nlohmann::basic_json::out_of_range - -```cpp -class out_of_range : public exception; -``` - -This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for -instance in case of array indices or nonexisting object keys. - -Exceptions have ids 4xx (see [list of out-of-range errors](../../home/exceptions.md#out-of-range)). - -```plantuml -std::exception <|-- basic_json::exception -basic_json::exception <|-- basic_json::parse_error -basic_json::exception <|-- basic_json::invalid_iterator -basic_json::exception <|-- basic_json::type_error -basic_json::exception <|-- basic_json::out_of_range -basic_json::exception <|-- basic_json::other_error - -interface std::exception {} - -class basic_json::exception { - + const int id - + const char* what() const -} - -class basic_json::parse_error { - + const std::size_t byte -} - -class basic_json::out_of_range #FFFF00 {} -``` - -## Member functions - -- **what** - returns explanatory string - -## Member variables - -- **id** - the id of the exception - -## Examples - -??? example - - The following code shows how a `out_of_range` exception can be caught. - - ```cpp - --8<-- "examples/out_of_range.cpp" - ``` - - Output: - - ```json - --8<-- "examples/out_of_range.output" - ``` - -## See also - -- [List of out-of-range errors](../../home/exceptions.md#out-of-range) -- [`parse_error`](parse_error.md) for exceptions indicating a parse error -- [`invalid_iterator`](invalid_iterator.md) for exceptions indicating errors with iterators -- [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type -- [`other_error`](other_error.md) for exceptions indicating other library errors - -## Version history - -- Since version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse.md deleted file mode 100644 index 95d876b0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse.md +++ /dev/null @@ -1,201 +0,0 @@ -# nlohmann::basic_json::parse - -```cpp -// (1) -template -static basic_json parse(InputType&& i, - const parser_callback_t cb = nullptr, - const bool allow_exceptions = true, - const bool ignore_comments = false); - -// (2) -template -static basic_json parse(IteratorType first, IteratorType last, - const parser_callback_t cb = nullptr, - const bool allow_exceptions = true, - const bool ignore_comments = false); -``` - -1. Deserialize from a compatible input. -2. Deserialize from a pair of character iterators - - The `value_type` of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted - respectively as UTF-8, UTF-16 and UTF-32. - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators. - -`IteratorType` -: a compatible iterator type, for instance. - - - a pair of `std::string::iterator` or `std::vector::iterator` - - a pair of pointers such as `ptr` and `ptr + len` - -## Parameters - -`i` (in) -: Input to parse from. - -`cb` (in) -: a parser callback function of type [`parser_callback_t`](parser_callback_t.md) which is used to control the - deserialization by filtering unwanted values (optional) - -`allow_exceptions` (in) -: whether to throw exceptions in case of a parse error (optional, `#!cpp true` by default) - -`ignore_comments` (in) -: whether comments should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error - (`#!cpp false`); (optional, `#!cpp false` by default) - -`first` (in) -: iterator to start of character range - -`last` (in) -: iterator to end of character range - -## Return value - -Deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be -`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser -callback function `cb` or reading from (1) the input `i` or (2) the iterator range [`first`, `last`] has a -super-linear complexity. - -## Notes - -(1) A UTF-8 byte order mark is silently ignored. - -## Examples - -??? example "Parsing from a character array" - - The example below demonstrates the `parse()` function reading from an array. - - ```cpp - --8<-- "examples/parse__array__parser_callback_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__array__parser_callback_t.output" - ``` - -??? example "Parsing from a string" - - The example below demonstrates the `parse()` function with and without callback function. - - ```cpp - --8<-- "examples/parse__string__parser_callback_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__string__parser_callback_t.output" - ``` - -??? example "Parsing from an input stream" - - The example below demonstrates the `parse()` function with and without callback function. - - ```cpp - --8<-- "examples/parse__istream__parser_callback_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__istream__parser_callback_t.output" - ``` - -??? example "Parsing from a contiguous container" - - The example below demonstrates the `parse()` function reading from a contiguous container. - - ```cpp - --8<-- "examples/parse__contiguouscontainer__parser_callback_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__contiguouscontainer__parser_callback_t.output" - ``` - -??? example "Parsing from a non null-terminated string" - - The example below demonstrates the `parse()` function reading from a string that is not null-terminated. - - ```cpp - --8<-- "examples/parse__pointers.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__pointers.output" - ``` - -??? example "Parsing from an iterator pair" - - The example below demonstrates the `parse()` function reading from an iterator pair. - - ```cpp - --8<-- "examples/parse__iterator_pair.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__iterator_pair.output" - ``` - -??? example "Effect of `allow_exceptions` parameter" - - The example below demonstrates the effect of the `allow_exceptions` parameter in the ´parse()` function. - - ```cpp - --8<-- "examples/parse__allow_exceptions.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__allow_exceptions.output" - ``` - -## See also - -- [accept](accept.md) - check if the input is valid JSON -- [operator>>](operator_gtgt.md) - deserialize from stream - -## Version history - -- Added in version 1.0.0. -- Overload for contiguous containers (1) added in version 2.0.3. -- Ignoring comments via `ignore_comments` added in version 3.9.0. - -!!! warning "Deprecation" - - Overload (2) replaces calls to `parse` with a pair of iterators as their first parameter which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp parse({ptr, ptr+len}, ...);` with `#!cpp parse(ptr, ptr+len, ...);`. - - You should be warned by your compiler with a `-Wdeprecated-declarations` warning if you are using a deprecated - function. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse_error.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse_error.md deleted file mode 100644 index af3e1f0b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse_error.md +++ /dev/null @@ -1,74 +0,0 @@ -# nlohmann::basic_json::parse_error - -```cpp -class parse_error : public exception; -``` - -This exception is thrown by the library when a parse error occurs. Parse errors can occur during the deserialization of -JSON text, BSON, CBOR, MessagePack, UBJSON, as well as when using JSON Patch. - -Member `byte` holds the byte index of the last read character in the input file (see note below). - -Exceptions have ids 1xx (see [list of parse errors](../../home/exceptions.md#parse-errors)). - -```plantuml -std::exception <|-- basic_json::exception -basic_json::exception <|-- basic_json::parse_error -basic_json::exception <|-- basic_json::invalid_iterator -basic_json::exception <|-- basic_json::type_error -basic_json::exception <|-- basic_json::out_of_range -basic_json::exception <|-- basic_json::other_error - -interface std::exception {} - -class basic_json::exception { - + const int id - + const char* what() const -} - -class basic_json::parse_error #FFFF00 { - + const std::size_t byte -} -``` - -## Member functions - -- **what** - returns explanatory string - -## Member variables - -- **id** - the id of the exception -- **byte** - byte index of the parse error - -## Notes - -For an input with $n$ bytes, 1 is the index of the first character and $n+1$ is the index of the terminating null byte -or the end of file. This also holds true when reading a byte vector for binary formats. - -## Examples - -??? example - - The following code shows how a `parse_error` exception can be caught. - - ```cpp - --8<-- "examples/parse_error.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse_error.output" - ``` - -## See also - -- [List of parse errors](../../home/exceptions.md#parse-errors) -- [`invalid_iterator`](invalid_iterator.md) for exceptions indicating errors with iterators -- [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type -- [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range -- [`other_error`](other_error.md) for exceptions indicating other library errors - -## Version history - -- Since version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse_event_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse_event_t.md deleted file mode 100644 index 1a7c3903..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parse_event_t.md +++ /dev/null @@ -1,29 +0,0 @@ -# nlohmann::basic_json::parse_event_t - -```cpp -enum class parse_event_t : std::uint8_t { - object_start, - object_end, - array_start, - array_end, - key, - value -}; -``` - -The parser callback distinguishes the following events: - -- `object_start`: the parser read `{` and started to process a JSON object -- `key`: the parser read a key of a value in an object -- `object_end`: the parser read `}` and finished processing a JSON object -- `array_start`: the parser read `[` and started to process a JSON array -- `array_end`: the parser read `]` and finished processing a JSON array -- `value`: the parser finished reading a JSON value - -## Examples - -![Example when certain parse events are triggered](../../images/callback_events.png) - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parser_callback_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parser_callback_t.md deleted file mode 100644 index e10402ea..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/parser_callback_t.md +++ /dev/null @@ -1,73 +0,0 @@ -# nlohmann::basic_json::parser_callback_t - -```cpp -template -using parser_callback_t = - std::function; -``` - -With a parser callback function, the result of parsing a JSON text can be influenced. When passed to -[`parse`](parse.md), it is called on certain events (passed as [`parse_event_t`](parse_event_t.md) via parameter -`event`) with a set recursion depth `depth` and context JSON value `parsed`. The return value of the callback function -is a boolean indicating whether the element that emitted the callback shall be kept or not. - -We distinguish six scenarios (determined by the event type) in which the callback function can be called. The following -table describes the values of the parameters `depth`, `event`, and `parsed`. - -| parameter `event` | description | parameter `depth` | parameter `parsed` | -|-------------------------------|-----------------------------------------------------------|-------------------------------------------|----------------------------------| -| `parse_event_t::object_start` | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded | -| `parse_event_t::key` | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key | -| `parse_event_t::object_end` | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object | -| `parse_event_t::array_start` | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded | -| `parse_event_t::array_end` | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array | -| `parse_event_t::value` | the parser finished reading a JSON value | depth of the value | the parsed JSON value | - -![Example when certain parse events are triggered](../../images/callback_events.png) - -Discarding a value (i.e., returning `#!cpp false`) has different effects depending on the context in which function was -called: - -- Discarded values in structured types are skipped. That is, the parser will behave as if the discarded value was never - read. -- In case a value outside a structured type is skipped, it is replaced with `null`. This case happens if the top-level - element is skipped. - -## Parameters - -`depth` (in) -: the depth of the recursion during parsing - -`event` (in) -: an event of type [`parse_event_t`](parse_event_t.md) indicating the context in - the callback function has been called - -`parsed` (in, out) -: the current intermediate parse result; note that - writing to this value has no effect for `parse_event_t::key` events - -## Return value - -Whether the JSON value which called the function during parsing should be kept (`#!cpp true`) or not (`#!cpp false`). In -the latter case, it is either skipped completely or replaced by an empty discarded object. - -## Examples - -??? example - - The example below demonstrates the `parse()` function with - and without callback function. - - ```cpp - --8<-- "examples/parse__string__parser_callback_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__string__parser_callback_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/patch.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/patch.md deleted file mode 100644 index b3ef963f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/patch.md +++ /dev/null @@ -1,72 +0,0 @@ -# nlohmann::basic_json::patch - -```cpp -basic_json patch(const basic_json& json_patch) const; -``` - -[JSON Patch](http://jsonpatch.com) defines a JSON document structure for expressing a sequence of operations to apply to -a JSON document. With this function, a JSON Patch is applied to the current JSON value by executing all operations from -the patch. - -## Parameters - -`json_patch` (in) -: JSON patch document - -## Return value - -patched document - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Exceptions - -- Throws [`parse_error.104`](../../home/exceptions.md#jsonexceptionparse_error104) if the JSON patch does not consist of - an array of objects. -- Throws [`parse_error.105`](../../home/exceptions.md#jsonexceptionparse_error105) if the JSON patch is malformed (e.g., - mandatory attributes are missing); example: `"operation add must have member path"`. -- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if an array index is out of range. -- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if a JSON pointer inside the patch - could not be resolved successfully in the current JSON value; example: `"key baz not found"`. -- Throws [`out_of_range.405`](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent - ("add", "remove", "move") -- Throws [`out_of_range.501`](../../home/exceptions.md#jsonexceptionother_error501) if "test" operation was - unsuccessful. - -## Complexity - -Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is -affected by the patch, the complexity can usually be neglected. - -## Notes - -The application of a patch is atomic: Either all operations succeed and the patched document is returned or an exception -is thrown. In any case, the original value is not changed: the patch is applied to a copy of the value. - -## Examples - -??? example - - The following code shows how a JSON patch is applied to a value. - - ```cpp - --8<-- "examples/patch.cpp" - ``` - - Output: - - ```json - --8<-- "examples/patch.output" - ``` - -## See also - -- [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) -- [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901) -- [merge_patch](merge_patch.md) applies a JSON Merge Patch - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/push_back.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/push_back.md deleted file mode 100644 index 60bfed30..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/push_back.md +++ /dev/null @@ -1,109 +0,0 @@ -# nlohmann::basic_json::push_back - -```cpp -// (1) -void push_back(basic_json&& val); -void push_back(const basic_json& val); - -// (2) -void push_back(const typename object_t::value_type& val); - -// (3) -void push_back(initializer_list_t init); -``` - -1. Appends the given element `val` to the end of the JSON array. If the function is called on a JSON null value, an - empty array is created before appending `val`. - -2. Inserts the given element `val` to the JSON object. If the function is called on a JSON null value, an empty object - is created before inserting `val`. - -3. This function allows using `push_back` with an initializer list. In case - - 1. the current value is an object, - 2. the initializer list `init` contains only two elements, and - 3. the first element of `init` is a string, - - `init` is converted into an object element and added using `push_back(const typename object_t::value_type&)`. - Otherwise, `init` is converted to a JSON value and added using `push_back(basic_json&&)`. - -## Parameters - -`val` (in) -: the value to add to the JSON array/object - -`init` (in) -: an initializer list - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.308`](../../home/exceptions.md#jsonexceptiontype_error308) when called on a type other than - JSON array or null; example: `"cannot use push_back() with number"` -2. The function can throw the following exceptions: - - Throws [`type_error.308`](../../home/exceptions.md#jsonexceptiontype_error308) when called on a type other than - JSON object or null; example: `"cannot use push_back() with number"` - -## Complexity - -1. Amortized constant. -2. Logarithmic in the size of the container, O(log(`size()`)). -3. Linear in the size of the initializer list `init`. - -## Notes - -(3) This function is required to resolve an ambiguous overload error, because pairs like `{"key", "value"}` can be both - interpreted as `object_t::value_type` or `std::initializer_list`, see - [#235](https://github.com/nlohmann/json/issues/235) for more information. - -## Examples - -??? example "Example: (1) add element to array" - - The example shows how `push_back()` and `+=` can be used to add elements to a JSON array. Note how the `null` value - was silently converted to a JSON array. - - ```cpp - --8<-- "examples/push_back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/push_back.output" - ``` - -??? example "Example: (2) add element to object" - - The example shows how `push_back()` and `+=` can be used to add elements to a JSON object. Note how the `null` value - was silently converted to a JSON object. - - ```cpp - --8<-- "examples/push_back__object_t__value.cpp" - ``` - - Output: - - ```json - --8<-- "examples/push_back__object_t__value.output" - ``` - -??? example "Example: (3) add to object from initializer list" - - The example shows how initializer lists are treated as objects when possible. - - ```cpp - --8<-- "examples/push_back__initializer_list.cpp" - ``` - - Output: - - ```json - --8<-- "examples/push_back__initializer_list.output" - ``` - -## Version history - -1. Since version 1.0.0. -2. Since version 1.0.0. -2. Since version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/rbegin.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/rbegin.md deleted file mode 100644 index 126c4712..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/rbegin.md +++ /dev/null @@ -1,42 +0,0 @@ -# nlohmann::basic_json::rbegin - -```cpp -reverse_iterator rbegin() noexcept; -const_reverse_iterator rbegin() const noexcept; -``` - -Returns an iterator to the reverse-beginning; that is, the last element. - -![Illustration from cppreference.com](../../images/range-rbegin-rend.svg) - -## Return value - -reverse iterator to the first element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `rbegin()`. - - ```cpp - --8<-- "examples/rbegin.cpp" - ``` - - Output: - - ```json - --8<-- "examples/rbegin.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/rend.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/rend.md deleted file mode 100644 index 96da7a5f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/rend.md +++ /dev/null @@ -1,43 +0,0 @@ -# nlohmann::basic_json::rend - -```cpp -reverse_iterator rend() noexcept; -const_reverse_iterator rend() const noexcept; -``` - -Returns an iterator to the reverse-end; that is, one before the first element. This element acts as a placeholder, -attempting to access it results in undefined behavior. - -![Illustration from cppreference.com](../../images/range-rbegin-rend.svg) - -## Return value - -reverse iterator to the element following the last element - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code shows an example for `eend()`. - - ```cpp - --8<-- "examples/rend.cpp" - ``` - - Output: - - ```json - --8<-- "examples/rend.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/sax_parse.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/sax_parse.md deleted file mode 100644 index e2ac1b41..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/sax_parse.md +++ /dev/null @@ -1,115 +0,0 @@ -# nlohmann::basic_json::sax_parse - -```cpp -// (1) -template -static bool sax_parse(InputType&& i, - SAX* sax, - input_format_t format = input_format_t::json, - const bool strict = true, - const bool ignore_comments = false); - -// (2) -template -static bool sax_parse(IteratorType first, IteratorType last, - SAX* sax, - input_format_t format = input_format_t::json, - const bool strict = true, - const bool ignore_comments = false); -``` - -Read from input and generate SAX events - -1. Read from a compatible input. -2. Read from a pair of character iterators - - The value_type of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted - respectively as UTF-8, UTF-16 and UTF-32. - -The SAX event lister must follow the interface of [`json_sax`](../json_sax/index.md). - -## Template parameters - -`InputType` -: A compatible input, for instance: - - - an `std::istream` object - - a `FILE` pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of - iterators. - -`IteratorType` -: Description - -`SAX` -: Description - -## Parameters - -`i` (in) -: Input to parse from. - -`sax` (in) -: SAX event listener - -`format` (in) -: the format to parse (JSON, CBOR, MessagePack, or UBJSON) (optional, `input_format_t::json` by default), see - [`input_format_t`](input_format_t.md) for more information - -`strict` (in) -: whether the input has to be consumed completely (optional, `#!cpp true` by default) - -`ignore_comments` (in) -: whether comments should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error - (`#!cpp false`); (optional, `#!cpp false` by default) - -`first` (in) -: iterator to start of character range - -`last` (in) -: iterator to end of character range - -## Return value - -return value of the last processed SAX event - -## Exception safety - -## Complexity - -Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the SAX -consumer `sax` has a super-linear complexity. - -## Notes - -A UTF-8 byte order mark is silently ignored. - -## Examples - -??? example - - The example below demonstrates the `sax_parse()` function reading from string and processing the events with a - user-defined SAX event consumer. - - ```cpp - --8<-- "examples/sax_parse.cpp" - ``` - - Output: - - ```json - --8<-- "examples/sax_parse.output" - ``` - -## Version history - -- Added in version 3.2.0. -- Ignoring comments via `ignore_comments` added in version 3.9.0. - -!!! warning "Deprecation" - - Overload (2) replaces calls to `sax_parse` with a pair of iterators as their first parameter which has been - deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like - `#!cpp sax_parse({ptr, ptr+len});` with `#!cpp sax_parse(ptr, ptr+len);`. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/size.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/size.md deleted file mode 100644 index 4ff582db..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/size.md +++ /dev/null @@ -1,57 +0,0 @@ -# nlohmann::basic_json::size - -```cpp -size_type size() const noexcept; -``` - -Returns the number of elements in a JSON value. - -## Return value - -The return value depends on the different types and is defined as follows: - -| Value type | return value | -|------------|-------------------------------------| -| null | `0` | -| boolean | `1` | -| string | `1` | -| number | `1` | -| binary | `1` | -| object | result of function object_t::size() | -| array | result of function array_t::size() | - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant, as long as [`array_t`](array_t.md) and [`object_t`](object_t.md) satisfy the -[Container](https://en.cppreference.com/w/cpp/named_req/Container) concept; that is, their `size()` functions have -constant complexity. - -## Notes - -This function does not return the length of a string stored as JSON value -- it returns the number of elements in the -JSON value which is `1` in the case of a string. - -## Examples - -??? example - - The following code calls `size()` on the different value types. - - ```cpp - --8<-- "examples/size.cpp" - ``` - - Output: - - ```json - --8<-- "examples/size.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Extended to return `1` for binary types in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/std_hash.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/std_hash.md deleted file mode 100644 index b66515d5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/std_hash.md +++ /dev/null @@ -1,32 +0,0 @@ -# std::hash - -```cpp -namespace std { - struct hash; -} -``` - -Return a hash value for a JSON object. The hash function tries to rely on `std::hash` where possible. Furthermore, the -type of the JSON value is taken into account to have different hash values for `#!json null`, `#!cpp 0`, `#!cpp 0U`, and -`#!cpp false`, etc. - -## Examples - -??? example - - The example shows how to calculate hash values for different JSON values. - - ```cpp - --8<-- "examples/std_hash.cpp" - ``` - - Output: - - ```json - --8<-- "examples/std_hash.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Extended for arbitrary basic_json types in version 3.10.5. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/std_swap.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/std_swap.md deleted file mode 100644 index d30f3bcc..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/std_swap.md +++ /dev/null @@ -1,51 +0,0 @@ -# std::swap - -```cpp -namespace std { - void swap(nlohmann::basic_json& j1, nlohmann::basic_json& j2); -} -``` - -Exchanges the values of two JSON objects. - -## Parameters - -`j1` (in, out) -: value to be replaced by `j2` - -`j2` (in, out) -: value to be replaced by `j1` - -## Possible implementation - -```cpp -void swap(nlohmann::basic_json& j1, nlohmann::basic_json& j2) -{ - j1.swap(j2); -} -``` - -## Examples - -??? example - - The following code shows how two values are swapped with `std::swap`. - - ```cpp - --8<-- "examples/std_swap.cpp" - ``` - - Output: - - ```json - --8<-- "examples/std_swap.output" - ``` - -## See also - -- [swap](swap.md) - -## Version history - -- Added in version 1.0.0. -- Extended for arbitrary basic_json types in version 3.10.5. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/string_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/string_t.md deleted file mode 100644 index 3ab4412d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/string_t.md +++ /dev/null @@ -1,66 +0,0 @@ -# nlohmann::basic_json::string_t - -```cpp -using string_t = StringType; -``` - -The type used to store JSON strings. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON strings as follows: -> A string is a sequence of zero or more Unicode characters. - -To store objects in C++, a type is defined by the template parameter described below. Unicode values are split by the -JSON class into byte-sized characters during deserialization. - -## Template parameters - -`StringType` -: the container to store strings (e.g., `std::string`). Note this container is used for keys/names in objects, see - [object_t](object_t.md). - -## Notes - -#### Default type - -With the default values for `StringType` (`std::string`), the default value for `string_t` is `#!cpp std::string`. - -#### Encoding - -Strings are stored in UTF-8 encoding. Therefore, functions like `std::string::size()` or `std::string::length()` return -the number of bytes in the string rather than the number of characters or glyphs. - -#### String comparison - -[RFC 8259](https://tools.ietf.org/html/rfc8259) states: -> Software implementations are typically required to test names of object members for equality. Implementations that -> transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, -> code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or -> inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may -> incorrectly find that `"a\\b"` and `"a\u005Cb"` are not equal. - -This implementation is interoperable as it does compare strings code unit by code unit. - -#### Storage - -String values are stored as pointers in a `basic_json` type. That is, for any access to string values, a pointer of type -`string_t*` must be dereferenced. - -## Examples - -??? example - - The following code shows that `string_t` is by default, a typedef to `#!cpp std::string`. - - ```cpp - --8<-- "examples/string_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/string_t.output" - ``` - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/swap.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/swap.md deleted file mode 100644 index a5730ffa..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/swap.md +++ /dev/null @@ -1,157 +0,0 @@ -# nlohmann::basic_json::swap - -```cpp -// (1) -void swap(reference other) noexcept; - -// (2) -void swap(reference left, reference right) noexcept; - -// (3) -void swap(array_t& other); - -// (4) -void swap(object_t& other); - -// (5) -void swap(string_t& other); - -// (6) -void swap(binary_t& other); - -// (7) -void swap(typename binary_t::container_type& other); -``` - -1. Exchanges the contents of the JSON value with those of `other`. Does not invoke any move, copy, or swap operations on - individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. -2. Exchanges the contents of the JSON value from `left` with those of `right`. Does not invoke any move, copy, or swap - operations on individual elements. All iterators and references remain valid. The past-the-end iterator is - invalidated. Implemented as a friend function callable via ADL. -3. Exchanges the contents of a JSON array with those of `other`. Does not invoke any move, copy, or swap operations on - individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. -4. Exchanges the contents of a JSON object with those of `other`. Does not invoke any move, copy, or swap operations on - individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. -5. Exchanges the contents of a JSON string with those of `other`. Does not invoke any move, copy, or swap operations on - individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. -6. Exchanges the contents of a binary value with those of `other`. Does not invoke any move, copy, or swap operations on - individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. -7. Exchanges the contents of a binary value with those of `other`. Does not invoke any move, copy, or swap operations on - individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. Unlike - version (6), no binary subtype is involved. - -## Parameters - -`other` (in, out) -: value to exchange the contents with - -`left` (in, out) -: value to exchange the contents with - -`right` (in, out) -: value to exchange the contents with - -## Exceptions - -1. No-throw guarantee: this function never throws exceptions. -2. No-throw guarantee: this function never throws exceptions. -3. Throws [`type_error.310`](../../home/exceptions.md#jsonexceptiontype_error310) if called on JSON values other than - arrays; example: `"cannot use swap() with boolean"` -4. Throws [`type_error.310`](../../home/exceptions.md#jsonexceptiontype_error310) if called on JSON values other than - objects; example: `"cannot use swap() with boolean"` -5. Throws [`type_error.310`](../../home/exceptions.md#jsonexceptiontype_error310) if called on JSON values other than - strings; example: `"cannot use swap() with boolean"` -6. Throws [`type_error.310`](../../home/exceptions.md#jsonexceptiontype_error310) if called on JSON values other than - binaries; example: `"cannot use swap() with boolean"` -7. Throws [`type_error.310`](../../home/exceptions.md#jsonexceptiontype_error310) if called on JSON values other than - binaries; example: `"cannot use swap() with boolean"` - -## Complexity - -Constant. - -## Examples - -??? example "Example: Swap JSON value (1, 2)" - - The example below shows how JSON values can be swapped with `swap()`. - - ```cpp - --8<-- "examples/swap__reference.cpp" - ``` - - Output: - - ```json - --8<-- "examples/swap__reference.output" - ``` - -??? example "Example: Swap array (3)" - - The example below shows how arrays can be swapped with `swap()`. - - ```cpp - --8<-- "examples/swap__array_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/swap__array_t.output" - ``` - -??? example "Example: Swap object (4)" - - The example below shows how objects can be swapped with `swap()`. - - ```cpp - --8<-- "examples/swap__object_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/swap__object_t.output" - ``` - -??? example "Example: Swap string (5)" - - The example below shows how strings can be swapped with `swap()`. - - ```cpp - --8<-- "examples/swap__string_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/swap__string_t.output" - ``` - -??? example "Example: Swap string (6)" - - The example below shows how binary values can be swapped with `swap()`. - - ```cpp - --8<-- "examples/swap__binary_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/swap__binary_t.output" - ``` - -## See also - -- [std::swap](std_swap.md) - -## Version history - -1. Since version 1.0.0. -2. Since version 1.0.0. -3. Since version 1.0.0. -4. Since version 1.0.0. -5. Since version 1.0.0. -6. Since version 3.8.0. -7. Since version 3.8.0. \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_bson.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_bson.md deleted file mode 100644 index 664dd0e2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_bson.md +++ /dev/null @@ -1,59 +0,0 @@ -# nlohmann::basic_json::to_bson - -```cpp -// (1) -static std::vector to_bson(const basic_json& j); - -// (2) -static void to_bson(const basic_json& j, detail::output_adapter o); -static void to_bson(const basic_json& j, detail::output_adapter o); -``` - -BSON (Binary JSON) is a binary format in which zero or more ordered key/value pairs are stored as a single entity (a -so-called document). - -1. Returns a byte vector containing the BSON serialization. -2. Writes the BSON serialization to an output adapter. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bson.md). - -## Parameters - -`j` (in) -: JSON value to serialize - -`o` (in) -: output adapter to write serialization to - -## Return value - -1. BSON serialization as byte vector -2. / - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the size of the JSON value `j`. - -## Examples - -??? example - - The example shows the serialization of a JSON value to a byte vector in BSON format. - - ```cpp - --8<-- "examples/to_bson.cpp" - ``` - - Output: - - ```json - --8<-- "examples/to_bson.output" - ``` - -## Version history - -- Added in version 3.4.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_cbor.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_cbor.md deleted file mode 100644 index 05d85ed8..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_cbor.md +++ /dev/null @@ -1,61 +0,0 @@ -# nlohmann::basic_json::to_cbor - -```cpp -// (1) -static std::vector to_cbor(const basic_json& j); - -// (2) -static void to_cbor(const basic_json& j, detail::output_adapter o); -static void to_cbor(const basic_json& j, detail::output_adapter o); -``` - -Serializes a given JSON value `j` to a byte vector using the CBOR (Concise Binary Object Representation) serialization -format. CBOR is a binary serialization format which aims to be more compact than JSON itself, yet more efficient to -parse. - -1. Returns a byte vector containing the CBOR serialization. -2. Writes the CBOR serialization to an output adapter. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/cbor.md). - -## Parameters - -`j` (in) -: JSON value to serialize - -`o` (in) -: output adapter to write serialization to - -## Return value - -1. CBOR serialization as byte vector -2. / - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the size of the JSON value `j`. - -## Examples - -??? example - - The example shows the serialization of a JSON value to a byte vector in CBOR format. - - ```cpp - --8<-- "examples/to_cbor.cpp" - ``` - - Output: - - ```json - --8<-- "examples/to_cbor.output" - ``` - -## Version history - -- Added in version 2.0.9. -- Compact representation of floating-point numbers added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_msgpack.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_msgpack.md deleted file mode 100644 index fb4b40bd..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_msgpack.md +++ /dev/null @@ -1,59 +0,0 @@ -# nlohmann::basic_json::to_msgpack - -```cpp -// (1) -static std::vector to_msgpack(const basic_json& j); - -// (2) -static void to_msgpack(const basic_json& j, detail::output_adapter o); -static void to_msgpack(const basic_json& j, detail::output_adapter o); -``` - -Serializes a given JSON value `j` to a byte vector using the MessagePack serialization format. MessagePack is a binary -serialization format which aims to be more compact than JSON itself, yet more efficient to parse. - -1. Returns a byte vector containing the MessagePack serialization. -2. Writes the MessagePack serialization to an output adapter. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/messagepack.md). - -## Parameters - -`j` (in) -: JSON value to serialize - -`o` (in) -: output adapter to write serialization to - -## Return value - -1. MessagePack serialization as byte vector -2. / - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the size of the JSON value `j`. - -## Examples - -??? example - - The example shows the serialization of a JSON value to a byte vector in MessagePack format. - - ```cpp - --8<-- "examples/to_msgpack.cpp" - ``` - - Output: - - ```json - --8<-- "examples/to_msgpack.output" - ``` - -## Version history - -- Added in version 2.0.9. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_string.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_string.md deleted file mode 100644 index 2b907e21..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_string.md +++ /dev/null @@ -1,65 +0,0 @@ -# to_string(basic_json) - -```cpp -template -std::string to_string(const BasicJsonType& j); -``` - -This function implements a user-defined to_string for JSON objects. - -## Template parameters - -`BasicJsonType` -: a specialization of [`basic_json`](index.md) - -## Return value - -string containing the serialization of the JSON value - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes to any JSON value. - -## Exceptions - -Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value -is not UTF-8 encoded - -## Complexity - -Linear. - -## Possible implementation - -```cpp -template -std::string to_string(const BasicJsonType& j) -{ - return j.dump(); -} -``` - -## Examples - -??? example - - The following code shows how the library's `to_string()` function integrates with others, allowing - argument-dependent lookup. - - ```cpp - --8<-- "examples/to_string.cpp" - ``` - - Output: - - ```json - --8<-- "examples/to_string.output" - ``` - -## See also - -- [dump](dump.md) - -## Version history - -Added in version 3.7.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_ubjson.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_ubjson.md deleted file mode 100644 index 0a3d87e5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/to_ubjson.md +++ /dev/null @@ -1,70 +0,0 @@ -# nlohmann::basic_json::to_ubjson - -```cpp -// (1) -static std::vector to_ubjson(const basic_json& j, - const bool use_size = false, - const bool use_type = false); - -// (2) -static void to_ubjson(const basic_json& j, detail::output_adapter o, - const bool use_size = false, const bool use_type = false); -static void to_ubjson(const basic_json& j, detail::output_adapter o, - const bool use_size = false, const bool use_type = false); -``` - -Serializes a given JSON value `j` to a byte vector using the UBJSON (Universal Binary JSON) serialization format. UBJSON -aims to be more compact than JSON itself, yet more efficient to parse. - -1. Returns a byte vector containing the UBJSON serialization. -2. Writes the UBJSON serialization to an output adapter. - -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/ubjson.md). - -## Parameters - -`j` (in) -: JSON value to serialize - -`o` (in) -: output adapter to write serialization to - -`use_size` (in) -: whether to add size annotations to container types; optional, `#!cpp false` by default. - -`use_type` (in) -: whether to add type annotations to container types (must be combined with `#!cpp use_size = true`); optional, - `#!cpp false` by default. - -## Return value - -1. UBJSON serialization as byte vector -2. / - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no changes in the JSON value. - -## Complexity - -Linear in the size of the JSON value `j`. - -## Examples - -??? example - - The example shows the serialization of a JSON value to a byte vector in UBJSON format. - - ```cpp - --8<-- "examples/to_ubjson.cpp" - ``` - - Output: - - ```json - --8<-- "examples/to_ubjson.output" - ``` - -## Version history - -- Added in version 3.1.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type.md deleted file mode 100644 index deedd6b6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type.md +++ /dev/null @@ -1,54 +0,0 @@ -# nlohmann::basic_json::type - -```cpp -constexpr value_t type() const noexcept; -``` - -Return the type of the JSON value as a value from the [`value_t`](value_t.md) enumeration. - -## Return value - -the type of the JSON value - -| Value type | return value | -|---------------------------|----------------------------| -| `#!json null` | `value_t::null` | -| boolean | `value_t::boolean` | -| string | `value_t::string` | -| number (integer) | `value_t::number_integer` | -| number (unsigned integer) | `value_t::number_unsigned` | -| number (floating-point) | `value_t::number_float` | -| object | `value_t::object` | -| array | `value_t::array` | -| binary | `value_t::binary` | -| discarded | `value_t::discarded` | - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `type()` for all JSON types. - - ```cpp - --8<-- "examples/type.cpp" - ``` - - Output: - - ```json - --8<-- "examples/type.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Added unsigned integer type in version 2.0.0. -- Added binary type in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type_error.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type_error.md deleted file mode 100644 index cda54c08..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type_error.md +++ /dev/null @@ -1,68 +0,0 @@ -# nlohmann::basic_json::type_error - -```cpp -class type_error : public exception; -``` - -This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type -does not match the expected semantics. - -Exceptions have ids 3xx (see [list of type errors](../../home/exceptions.md#type-errors)). - -```plantuml -std::exception <|-- basic_json::exception -basic_json::exception <|-- basic_json::parse_error -basic_json::exception <|-- basic_json::invalid_iterator -basic_json::exception <|-- basic_json::type_error -basic_json::exception <|-- basic_json::out_of_range -basic_json::exception <|-- basic_json::other_error - -interface std::exception {} - -class basic_json::exception { - + const int id - + const char* what() const -} - -class basic_json::parse_error { - + const std::size_t byte -} - -class basic_json::type_error #FFFF00 {} -``` - -## Member functions - -- **what** - returns explanatory string - -## Member variables - -- **id** - the id of the exception - -## Examples - -??? example - - The following code shows how a `type_error` exception can be caught. - - ```cpp - --8<-- "examples/type_error.cpp" - ``` - - Output: - - ```json - --8<-- "examples/type_error.output" - ``` - -## See also - -- [List of type errors](../../home/exceptions.md#type-errors) -- [`parse_error`](parse_error.md) for exceptions indicating a parse error -- [`invalid_iterator`](invalid_iterator.md) for exceptions indicating errors with iterators -- [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range -- [`other_error`](other_error.md) for exceptions indicating other library errors - -## Version history - -- Since version 3.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type_name.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type_name.md deleted file mode 100644 index 389c2b1d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/type_name.md +++ /dev/null @@ -1,54 +0,0 @@ -# nlohmann::basic_json::type_name - -```cpp -const char* type_name() const noexcept; -``` - -Returns the type name as string to be used in error messages -- usually to indicate that a function was called on a -wrong JSON type. - -## Return value - -a string representation of the type ([`value_t`](value_t.md)): - -| Value type | return value | -|----------------------------------------------------|---------------| -| `#!json null` | `"null"` | -| boolean | `"boolean"` | -| string | `"string"` | -| number (integer, unsigned integer, floating-point) | `"number"` | -| object | `"object"` | -| array | `"array"` | -| binary | `"binary"` | -| discarded | `"discarded"` | - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The following code exemplifies `type_name()` for all JSON types. - - ```cpp - --8<-- "examples/type_name.cpp" - ``` - - Output: - - ```json - --8<-- "examples/type_name.output" - ``` - -## Version history - -- Added in version 1.0.0. -- Part of the public API version since 2.1.0. -- Changed return value to `const char*` and added `noexcept` in version 3.0.0. -- Added support for binary type in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/unflatten.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/unflatten.md deleted file mode 100644 index d9778036..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/unflatten.md +++ /dev/null @@ -1,61 +0,0 @@ -# nlohmann::basic_json::unflatten - -```cpp -basic_json unflatten() const; -``` - -The function restores the arbitrary nesting of a JSON value that has been flattened before using the -[`flatten()`](flatten.md) function. The JSON value must meet certain constraints: - -1. The value must be an object. -2. The keys must be JSON pointers (see [RFC 6901](https://tools.ietf.org/html/rfc6901)) -3. The mapped values must be primitive JSON types. - -## Return value - -the original JSON from a flattened version - -## Exception safety - -Strong exception safety: if an exception occurs, the original value stays intact. - -## Exceptions - -The function can throw the following exceptions: - -- Throws [`type_error.314`](../../home/exceptions.md#jsonexceptiontype_error314) if value is not an object -- Throws [`type_error.315`](../../home/exceptions.md#jsonexceptiontype_error315) if object values are not primitive - -## Complexity - -Linear in the size the JSON value. - -## Notes - -Empty objects and arrays are flattened by [`flatten()`](flatten.md) to `#!json null` values and can not unflattened to -their original type. Apart from this example, for a JSON value `j`, the following is always true: -`#!cpp j == j.flatten().unflatten()`. - -## Examples - -??? example - - The following code shows how a flattened JSON object is unflattened into the original nested JSON object. - - ```cpp - --8<-- "examples/unflatten.cpp" - ``` - - Output: - - ```json - --8<-- "examples/unflatten.output" - ``` - -## See also - -- [flatten](flatten.md) the reverse function - -## Version history - -- Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/update.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/update.md deleted file mode 100644 index 9eeec407..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/update.md +++ /dev/null @@ -1,142 +0,0 @@ -# nlohmann::basic_json::update - -```cpp -// (1) -void update(const_reference j, bool merge_objects = false); - -// (2) -void update(const_iterator first, const_iterator last, bool merge_objects = false); -``` - -1. Inserts all values from JSON object `j`. -2. Inserts all values from range `[first, last)` - -When `merge_objects` is `#!c false` (default), existing keys are overwritten. When `merge_objects` is `#!c true`, -recursively merges objects with common keys. - -The function is motivated by Python's [dict.update](https://docs.python.org/3.6/library/stdtypes.html#dict.update) -function. - -## Parameters - -`j` (in) -: JSON object to read values from - -`merge_objects` (in) -: when `#!c true`, existing keys are not overwritten, but contents of objects are merged recursively (default: - `#!c false`) - -`first` (in) -: begin of the range of elements to insert - -`last` (in) -: end of the range of elements to insert - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.312`](../../home/exceptions.md#jsonexceptiontype_error312) if called on JSON values other than - objects; example: `"cannot use update() with string"` -2. The function can throw the following exceptions: - - Throws [`type_error.312`](../../home/exceptions.md#jsonexceptiontype_error312) if called on JSON values other than - objects; example: `"cannot use update() with string"` - - Throws [`invalid_iterator.202`](../../home/exceptions.md#jsonexceptioninvalid_iterator202) if called on an - iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` - - Throws [`invalid_iterator.210`](../../home/exceptions.md#jsonexceptioninvalid_iterator210) if `first` and `last` - do not belong to the same JSON value; example: `"iterators do not fit"` - -## Complexity - -1. O(N*log(size() + N)), where N is the number of elements to insert. -2. O(N*log(size() + N)), where N is the number of elements to insert. - -## Examples - -??? example - - The example shows how `update()` is used. - - ```cpp - --8<-- "examples/update.cpp" - ``` - - Output: - - ```json - --8<-- "examples/update.output" - ``` - -??? example - - The example shows how `update()` is used. - - ```cpp - --8<-- "examples/update__range.cpp" - ``` - - Output: - - ```json - --8<-- "examples/update__range.output" - ``` - -??? example - - One common usecase for this function is the handling of user settings. Assume your application can configured in - some aspects: - - ```json - { - "color": "red", - "active": true, - "name": {"de": "Maus", "en": "mouse"} - } - ``` - - The user may override the default settings selectively: - - ```json - { - "color": "blue", - "name": {"es": "ratón"}, - } - ``` - - Then `update` manages the merging of default settings and user settings: - - ```cpp - auto user_settings = json::parse("config.json"); - auto effective_settings = get_default_settings(); - effective_settings.update(user_settings); - ``` - - Now `effective_settings` contains the default settings, but those keys set by the user are overwritten: - - ```json - { - "color": "blue", - "active": true, - "name": {"es": "ratón"} - } - ``` - - Note existing keys were just overwritten. To merge objects, `merge_objects` setting should be set to `#!c true`: - - ```cpp - auto user_settings = json::parse("config.json"); - auto effective_settings = get_default_settings(); - effective_settings.update(user_settings, true); - ``` - - ```json - { - "color": "blue", - "active": true, - "name": {"de": "Maus", "en": "mouse", "es": "ratón"} - } - ``` - -## Version history - -- Added in version 3.0.0. -- Added `merge_objects` parameter in 3.10.4. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/value.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/value.md deleted file mode 100644 index 0b4f1cc1..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/value.md +++ /dev/null @@ -1,129 +0,0 @@ -# nlohmann::basic_json::value - -```cpp -// (1) -template -ValueType value(const typename object_t::key_type& key, - const ValueType& default_value) const; - -// (2) -template -ValueType value(const json_pointer& ptr, - const ValueType& default_value) const; -``` - -1. Returns either a copy of an object's element at the specified key `key` or a given default value if no element with - key `key` exists. - - The function is basically equivalent to executing - ```cpp - try { - return at(key); - } catch(out_of_range) { - return default_value; - } - ``` - -2. Returns either a copy of an object's element at the specified JSON pointer `ptr` or a given default value if no value - at `ptr` exists. - - The function is basically equivalent to executing - ```cpp - try { - return at(ptr); - } catch(out_of_range) { - return default_value; - } - ``` - -!!! note - - - Unlike [`at`](at.md), this function does not throw if the given `key`/`ptr` was not found. - - Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by - `key`/`ptr` key. This function is furthermore also applicable to const objects. - -## Template parameters - -`ValueType` -: type compatible to JSON values, for instance `#!cpp int` for JSON integer numbers, `#!cpp bool` for JSON booleans, - or `#!cpp std::vector` types for JSON arrays. Note the type of the expected value at `key`/`ptr` and the default - value `default_value` must be compatible. - -## Parameters - -`key` (in) -: key of the element to access - -`default_value` (in) -: the value to return if key/ptr found no value - -`ptr` (in) -: a JSON pointer to the element to access - -## Return value - -1. copy of the element at key `key` or `default_value` if `key` is not found -1. copy of the element at JSON Pointer `ptr` or `default_value` if no value for `ptr` is found - -## Exception safety - -Strong guarantee: if an exception is thrown, there are no -changes to any JSON value. - -## Exceptions - -1. The function can throw the following exceptions: - - Throws [`type_error.302`](../../home/exceptions.md#jsonexceptiontype_error302) if `default_value` does not match - the type of the value at `key` - - Throws [`type_error.306`](../../home/exceptions.md#jsonexceptiontype_error306) if the JSON value is not an object; - in that case, using `value()` with a key makes no sense. -2. The function can throw the following exceptions: - - Throws [`type_error.302`](../../home/exceptions.md#jsonexceptiontype_error302) if `default_value` does not match - the type of the value at `ptr` - - Throws [`type_error.306`](../../home/exceptions.md#jsonexceptiontype_error306) if the JSON value is not an object; - in that case, using `value()` with a key makes no sense. - -## Complexity - -1. Logarithmic in the size of the container. -2. Logarithmic in the size of the container. - -## Examples - -??? example "Example (1): access specified object element with default value" - - The example below shows how object elements can be queried with a default value. - - ```cpp - --8<-- "examples/basic_json__value.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__value.output" - ``` - -??? example "Example (2): access specified object element via JSON Pointer with default value" - - The example below shows how object elements can be queried with a default value. - - ```cpp - --8<-- "examples/basic_json__value_ptr.cpp" - ``` - - Output: - - ```json - --8<-- "examples/basic_json__value_ptr.output" - ``` - -## See also - -- see [`at`](at.md) for access by reference with range checking -- see [`operator[]`](operator%5B%5D.md) for unchecked access by reference - -## Version history - -1. Added in version 1.0.0. -2. Added in version 2.0.2. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/value_t.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/value_t.md deleted file mode 100644 index 768b13ca..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/value_t.md +++ /dev/null @@ -1,36 +0,0 @@ -# nlohmann::basic_json::value_t - -```cpp -enum class value_t : std::uint8_t { - null, - object, - array, - string, - boolean, - number_integer, - number_unsigned, - number_float, - binary, - discarded -}; -``` - -This enumeration collects the different JSON types. It is internally used to distinguish the stored values, and the -functions [`is_null`](is_null.md), [`is_object`](is_object.md), [`is_array`](is_array.md), [`is_string`](is_string.md), -[`is_boolean`](is_boolean.md), [`is_number`](is_number.md) (with [`is_number_integer`](is_number_integer.md), -[`is_number_unsigned`](is_number_unsigned.md), and [`is_number_float`](is_number_float.md)), -[`is_discarded`](is_discarded.md), [`is_binary`](is_binary.md), [`is_primitive`](is_primitive.md), and -[`is_structured`](is_structured.md) rely on it. - -## Notes - -There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library -distinguishes these three types for numbers: [`number_unsigned_t`](number_unsigned_t.md) is used for unsigned integers, -[`number_integer_t`](number_integer_t.md) is used for signed integers, and [`number_float_t`](number_float_t.md) is used -for floating-point numbers or to approximate integers which do not fit in the limits of their respective type. - -## Version history - -- Added in version 1.0.0. -- Added unsigned integer type in version 2.0.0. -- Added binary type in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/~basic_json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/~basic_json.md deleted file mode 100644 index c5c74a52..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/basic_json/~basic_json.md +++ /dev/null @@ -1,19 +0,0 @@ -# nlohmann::basic_json::~basic_json - -```cpp -~basic_json() noexcept; -``` - -Destroys the JSON value and frees all allocated memory. - -## Exception safety - -No-throw guarantee: this member function never throws exceptions. - -## Complexity - -Linear. - -## Version history - -- Added in version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md deleted file mode 100644 index caa273df..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md +++ /dev/null @@ -1,30 +0,0 @@ -# nlohmann::byte_container_with_subtype::byte_container_with_subtype - -```cpp -// (1) -byte_container_with_subtype(); - -// (2) -byte_container_with_subtype(const container_type& container); -byte_container_with_subtype(container_type&& container); - -// (3) -byte_container_with_subtype(const container_type& container, subtype_type subtype); -byte_container_with_subtype(container_type&& container, subtype_type subtype); -``` - -1. Create empty binary container without subtype. -2. Create binary container without subtype. -3. Create binary container with subtype. - -## Parameters - -`container` (in) -: binary container - -`subtype` (in) -: subtype - -## Version history - -Since version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md deleted file mode 100644 index 56f8ee0c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md +++ /dev/null @@ -1,20 +0,0 @@ -# nlohmann::byte_container_with_subtype::clear_subtype - -```cpp -void clear_subtype() noexcept; -``` - -Clears the binary subtype and flags the value as not having a subtype, which has implications for serialization; for -instance MessagePack will prefer the bin family over the ext family. - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant. - -## Version history - -Since version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/has_subtype.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/has_subtype.md deleted file mode 100644 index 2fe41813..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/has_subtype.md +++ /dev/null @@ -1,23 +0,0 @@ -# nlohmann::byte_container_with_subtype::has_subtype - -```cpp -constexpr bool has_subtype() const noexcept; -``` - -Returns whether the value has a subtype. - -## Return value - -whether the value has a subtype - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant. - -## Version history - -Since version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/index.md deleted file mode 100644 index 277fffa3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/index.md +++ /dev/null @@ -1,35 +0,0 @@ -# nlohmann::byte_container_with_subtype - -```cpp -template -class byte_container_with_subtype : public BinaryType; -``` - -This type extends the template parameter `BinaryType` provided to [`basic_json`](../basic_json/index.md) with a subtype -used by BSON and MessagePack. This type exists so that the user does not have to specify a type themselves with a -specific naming scheme in order to override the binary type. - -## Template parameters - -`BinaryType` -: container to store bytes (`#!cpp std::vector` by default) - -## Member types - -- **container_type** - the type of the underlying container (`BinaryType`) -- **subtype_type** - the type of the subtype (`#!cpp std::uint64_t`) - -## Member functions - -- [(constructor)](byte_container_with_subtype.md) -- **operator==** - comparison: equal -- **operator!=** - comparison: not equal -- [**set_subtype**](subtype.md) - sets the binary subtype -- [**subtype**](subtype.md) - return the binary subtype -- [**has_subtype**](has_subtype.md) - return whether the value has a subtype -- [**clear_subtype**](clear_subtype.md) - clears the binary subtype - -## Version history - -- Added in version 3.8.0. -- Changed type of subtypes to `#!cpp std::uint64_t` in 3.10.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/set_subtype.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/set_subtype.md deleted file mode 100644 index 40cc2722..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/set_subtype.md +++ /dev/null @@ -1,25 +0,0 @@ -# nlohmann::byte_container_with_subtype::set_subtype - -```cpp -void set_subtype(subtype_type subtype) noexcept; -``` - -Sets the binary subtype of the value, also flags a binary JSON value as having a subtype, which has implications for -serialization. - -## Parameters - -`subtype` (in) -: subtype to set - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant. - -## Version history - -Since version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/subtype.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/subtype.md deleted file mode 100644 index e78654b3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/byte_container_with_subtype/subtype.md +++ /dev/null @@ -1,25 +0,0 @@ -# nlohmann::byte_container_with_subtype::subtype - -```cpp -constexpr subtype_type subtype() const noexcept; -``` - -Returns the numerical subtype of the value if it has a subtype. If it does not have a subtype, this function will return -`subtype_type(-1)` as a sentinel value. - -## Return value - -the numerical subtype of the binary value, or `subtype_type(-1)` if no subtype is set - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant. - -## Version history - -- Added in version 3.8.0 -- Fixed return value to properly return `subtype_type(-1)` as documented in version 3.10.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json.md deleted file mode 100644 index 48d34418..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json.md +++ /dev/null @@ -1,12 +0,0 @@ -# nlohmann::json - -```cpp -using json = basic_json<>; -``` - -This type is the default specialization of the [basic_json](basic_json/index.md) class which uses the standard template -types. - -## Version history - -Since version 1.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/back.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/back.md deleted file mode 100644 index 2b267bc5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/back.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::json_pointer::back - -```cpp -const std::string& back() const; -``` - -Return last reference token. - -## Return value - -Last reference token. - -## Exceptions - -Throws [out_of_range.405](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent. - -## Complexity - -Constant. - -## Examples - -??? example - - The example shows the usage of `back`. - - ```cpp - --8<-- "examples/json_pointer__back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__back.output" - ``` - -## Version history - -Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/empty.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/empty.md deleted file mode 100644 index 346364ad..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/empty.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::json_pointer::empty - -```cpp -bool empty() const noexcept; -``` - -Return whether pointer points to the root document. - -## Return value - -`#!cpp true` iff the JSON pointer points to the root document. - -## Exception safety - -No-throw guarantee: this function never throws exceptions. - -## Complexity - -Constant. - -## Examples - -??? example - - The example shows the result of `empty` for different JSON Pointers. - - ```cpp - --8<-- "examples/json_pointer__empty.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__empty.output" - ``` - -## Version history - -Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/index.md deleted file mode 100644 index 6ef9435f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/index.md +++ /dev/null @@ -1,36 +0,0 @@ -# nlohmann::json_pointer - -```cpp -template -class json_pointer; -``` - -A JSON pointer defines a string syntax for identifying a specific value within a JSON document. It can be used with -functions [`at`](../basic_json/at.md) and [`operator[]`](../basic_json/operator%5B%5D.md). Furthermore, JSON pointers -are the base for JSON patches. - -## Template parameters - -`BasicJsonType` -: a specialization of [`basic_json`](../basic_json/index.md) - -## Member functions - -- [(constructor)](json_pointer.md) -- [**to_string**](to_string.md) - return a string representation of the JSON pointer -- [**operator std::string**](operator_string.md) - return a string representation of the JSON pointer -- [**operator/=**](operator_slasheq.md) - append to the end of the JSON pointer -- [**operator/**](operator_slash.md) - create JSON Pointer by appending -- [**parent_pointer**](parent_pointer.md) - returns the parent of this JSON pointer -- [**pop_back**](pop_back.md) - remove last reference token -- [**back**](back.md) - return last reference token -- [**push_back**](push_back.md) - append an unescaped token at the end of the pointer -- [**empty**](empty.md) - return whether pointer points to the root document - -## See also - -- [RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901) - -## Version history - -Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/json_pointer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/json_pointer.md deleted file mode 100644 index 1e68a28f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/json_pointer.md +++ /dev/null @@ -1,40 +0,0 @@ -# nlohmann::json_pointer::json_pointer - -```cpp -explicit json_pointer(const std::string& s = ""); -``` - -Create a JSON pointer according to the syntax described in -[Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3). - -## Parameters - -`s` (in) -: string representing the JSON pointer; if omitted, the empty string is assumed which references the whole JSON value - -## Exceptions - -- Throws [parse_error.107](../../home/exceptions.md#jsonexceptionparse_error107) if the given JSON pointer `s` is - nonempty and does not begin with a slash (`/`); see example below. -- Throws [parse_error.108](../../home/exceptions.md#jsonexceptionparse_error108) if a tilde (`~`) in the given JSON - pointer `s` is not followed by `0` (representing `~`) or `1` (representing `/`); see example below. - -## Examples - -??? example - - The example shows the construction several valid JSON pointers as well as the exceptional behavior. - - ```cpp - --8<-- "examples/json_pointer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer.output" - ``` - -## Version history - -Added in version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_slash.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_slash.md deleted file mode 100644 index c9287543..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_slash.md +++ /dev/null @@ -1,64 +0,0 @@ -# nlohmann::json_pointer::operator/ - -```cpp -// (1) -json_pointer operator/(const json_pointer& lhs, const json_pointer& rhs); - -// (2) -json_pointer operator/(const json_pointer& lhs, std::string token); - -// (3) -json_pointer operator/(const json_pointer& lhs, std::size_t array_idx); -``` - -1. create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer -2. create a new JSON pointer by appending the unescaped token at the end of the JSON pointer -3. create a new JSON pointer by appending the array-index-token at the end of the JSON pointer - -## Parameters - -`lhs` (in) -: JSON pointer - -`rhs` (in) -: JSON pointer to append - -`token` (in) -: reference token to append - -`array_idx` (in) -: array index to append - -## Return value - -1. a new JSON pointer with `rhs` appended to `lhs` -2. a new JSON pointer with unescaped `token` appended to `lhs` -3. a new JSON pointer with `array_idx` appended to `lhs` - -## Complexity - -1. Linear in the length of `lhs` and `rhs`. -2. Linear in the length of `lhs`. -3. Linear in the length of `lhs`. - -## Examples - -??? example - - The example shows the usage of `operator/`. - - ```cpp - --8<-- "examples/json_pointer__operator_add_binary.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__operator_add_binary.output" - ``` - -## Version history - -1. Added in version 3.6.0. -2. Added in version 3.6.0. -3. Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_slasheq.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_slasheq.md deleted file mode 100644 index eb6c3086..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_slasheq.md +++ /dev/null @@ -1,61 +0,0 @@ -# nlohmann::json_pointer::operator/= - -```cpp -// (1) -json_pointer& operator/=(const json_pointer& ptr); - -// (2) -json_pointer& operator/=(std::string token); - -// (3) -json_pointer& operator/=(std::size_t array_idx) -``` - -1. append another JSON pointer at the end of this JSON pointer -2. append an unescaped reference token at the end of this JSON pointer -3. append an array index at the end of this JSON pointer - -## Parameters - -`ptr` (in) -: JSON pointer to append - -`token` (in) -: reference token to append - -`array_idx` (in) -: array index to append - -## Return value - -1. JSON pointer with `ptr` appended -2. JSON pointer with `token` appended without escaping `token` -3. JSON pointer with `array_idx` appended - -## Complexity - -1. Linear in the length of `ptr`. -2. Amortized constant. -3. Amortized constant. - -## Examples - -??? example - - The example shows the usage of `operator/=`. - - ```cpp - --8<-- "examples/json_pointer__operator_add.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__operator_add.output" - ``` - -## Version history - -1. Added in version 3.6.0. -2. Added in version 3.6.0. -3. Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_string.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_string.md deleted file mode 100644 index 56d8eebe..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/operator_string.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::json_pointer::operator std::string - -```cpp -operator std::string() const -``` - -Return a string representation of the JSON pointer. - -## Return value - -A string representation of the JSON pointer - -## Possible implementation - -```cpp -operator std::string() const -{ - return to_string(); -} -``` - -## Version history - -Since version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/parent_pointer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/parent_pointer.md deleted file mode 100644 index 13987307..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/parent_pointer.md +++ /dev/null @@ -1,35 +0,0 @@ -# nlohmann::json_pointer::parent_pointer - -```cpp -json_pointer parent_pointer() const; -``` - -Returns the parent of this JSON pointer. - -## Return value - -Parent of this JSON pointer; in case this JSON pointer is the root, the root itself is returned. - -## Complexity - -Linear in the length of the JSON pointer. - -## Examples - -??? example - - The example shows the result of `parent_pointer` for different JSON Pointers. - - ```cpp - --8<-- "examples/json_pointer__parent_pointer.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__parent_pointer.output" - ``` - -## Version history - -Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/pop_back.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/pop_back.md deleted file mode 100644 index 3c79f363..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/pop_back.md +++ /dev/null @@ -1,35 +0,0 @@ -# nlohmann::json_pointer::pop_back - -```cpp -void pop_back(); -``` - -Remove last reference token. - -## Exceptions - -Throws [out_of_range.405](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent. - -## Complexity - -Constant. - -## Examples - -??? example - - The example shows the usage of `pop_back`. - - ```cpp - --8<-- "examples/json_pointer__pop_back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__pop_back.output" - ``` - -## Version history - -Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/push_back.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/push_back.md deleted file mode 100644 index 3ebcdbc5..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/push_back.md +++ /dev/null @@ -1,38 +0,0 @@ -# nlohmann::json_pointer::push_back - -```cpp -void push_back(const std::string& token); - -void push_back(std::string&& token); -``` - -Append an unescaped token at the end of the reference pointer. - -## Parameters - -`token` (in) -: token to add - -## Complexity - -Amortized constant. - -## Examples - -??? example - - The example shows the result of `push_back` for different JSON Pointers. - - ```cpp - --8<-- "examples/json_pointer__push_back.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__push_back.output" - ``` - -## Version history - -Added in version 3.6.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/to_string.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/to_string.md deleted file mode 100644 index 9287436e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_pointer/to_string.md +++ /dev/null @@ -1,39 +0,0 @@ -# nlohmann::json_pointer::to_string - -```cpp -std::string to_string() const; -``` - -Return a string representation of the JSON pointer. - -## Return value - -A string representation of the JSON pointer - -## Notes - -For each JSON pointer `ptr`, it holds: - -```cpp -ptr == json_pointer(ptr.to_string()); -``` - -## Examples - -??? example - - The example shows the result of `to_string`. - - ```cpp - --8<-- "examples/json_pointer__to_string.cpp" - ``` - - Output: - - ```json - --8<-- "examples/json_pointer__to_string.output" - ``` - -## Version history - -Since version 2.0.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/binary.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/binary.md deleted file mode 100644 index e9a1d397..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/binary.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::json_sax::binary - -```cpp -virtual bool binary(binary_t& val) = 0; -``` - -A binary value was read. - -## Parameters - -`val` (in) -: binary value - -## Return value - -Whether parsing should proceed. - -## Notes - -It is safe to move the passed binary value. - -## Version history - -- Added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/boolean.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/boolean.md deleted file mode 100644 index a5a8ddcb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/boolean.md +++ /dev/null @@ -1,20 +0,0 @@ -# nlohmann::json_sax::boolean - -```cpp -virtual bool boolean(bool val) = 0; -``` - -A boolean value was read. - -## Parameters - -`val` (in) -: boolean value - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/end_array.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/end_array.md deleted file mode 100644 index 245cf974..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/end_array.md +++ /dev/null @@ -1,15 +0,0 @@ -# nlohmann::json_sax::end_array - -```cpp -virtual bool end_array() = 0; -``` - -The end of an array was read. - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/end_object.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/end_object.md deleted file mode 100644 index 5654e262..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/end_object.md +++ /dev/null @@ -1,15 +0,0 @@ -# nlohmann::json_sax::end_object - -```cpp -virtual bool end_object() = 0; -``` - -The end of an object was read. - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/index.md deleted file mode 100644 index f63e85c9..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/index.md +++ /dev/null @@ -1,44 +0,0 @@ -# nlohmann::json_sax - -```cpp -template -struct json_sax; -``` - -This class describes the SAX interface used by [sax_parse](../basic_json/sax_parse.md). Each function is called in -different situations while the input is parsed. The boolean return value informs the parser whether to continue -processing the input. - -## Template parameters - -`BasicJsonType` -: a specialization of [`basic_json`](../basic_json/index.md) - -## Member types - -- [**number_integer_t**](../basic_json/number_integer_t.md) - `BasicJsonType`'s type for numbers (integer) -- [**number_unsigned_t**](../basic_json/number_unsigned_t.md) - `BasicJsonType`'s type for numbers (unsigned) -- [**number_float_t**](../basic_json/number_float_t.md) - `BasicJsonType`'s type for numbers (floating-point) -- [**string_t**](../basic_json/string_t.md) - `BasicJsonType`'s type for strings -- [**binary_t**](../basic_json/binary_t.md) - `BasicJsonType`'s type for binary arrays - -## Member functions - -- [**binary**](binary.md) (_virtual_) - a binary value was read -- [**boolean**](boolean.md) (_virtual_) - a boolean value was read -- [**end_array**](end_array.md) (_virtual_) - the end of an array was read -- [**end_object**](end_object.md) (_virtual_) - the end of an object was read -- [**key**](key.md) (_virtual_) - an object key was read -- [**null**](null.md) (_virtual_) - a null value was read -- [**number_float**](number_float.md) (_virtual_) - a floating-point number was read -- [**number_integer**](number_integer.md) (_virtual_) - an integer number was read -- [**number_unsigned**](number_unsigned.md) (_virtual_) - an unsigned integer number was read -- [**parse_error**](parse_error.md) (_virtual_) - a parse error occurred -- [**start_array**](start_array.md) (_virtual_) - the beginning of an array was read -- [**start_object**](start_object.md) (_virtual_) - the beginning of an object was read -- [**string**](string.md) (_virtual_) - a string value was read - -## Version history - -- Added in version 3.2.0. -- Support for binary values (`binary_t`, `binary`) added in version 3.8.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/key.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/key.md deleted file mode 100644 index 5e792725..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/key.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::json_sax::key - -```cpp -virtual bool key(string_t& val) = 0; -``` - -An object key was read. - -## Parameters - -`val` (in) -: object key - -## Return value - -Whether parsing should proceed. - -## Notes - -It is safe to move the passed object key value. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/null.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/null.md deleted file mode 100644 index bcbb4a34..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/null.md +++ /dev/null @@ -1,15 +0,0 @@ -# nlohmann::json_sax::null - -```cpp -virtual bool null() = 0; -``` - -A null value was read. - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_float.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_float.md deleted file mode 100644 index 94193280..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_float.md +++ /dev/null @@ -1,23 +0,0 @@ -# nlohmann::json_sax::number_float - -```cpp -virtual bool number_float(number_float_t val, const string_t& s) = 0; -``` - -A floating-point number was read. - -## Parameters - -`val` (in) -: floating-point value - -`s` (in) -: string representation of the original input - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_integer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_integer.md deleted file mode 100644 index 00ff2eaa..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_integer.md +++ /dev/null @@ -1,20 +0,0 @@ -# nlohmann::json_sax::number_integer - -```cpp -virtual bool number_integer(number_integer_t val) = 0; -``` - -An integer number was read. - -## Parameters - -`val` (in) -: integer value - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_unsigned.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_unsigned.md deleted file mode 100644 index 66d0bdac..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/number_unsigned.md +++ /dev/null @@ -1,20 +0,0 @@ -# nlohmann::json_sax::number_unsigned - -```cpp -virtual bool number_unsigned(number_unsigned_t val) = 0; -``` - -An unsigned integer number was read. - -## Parameters - -`val` (in) -: unsigned integer value - -## Return value - -Whether parsing should proceed. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/parse_error.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/parse_error.md deleted file mode 100644 index 00f1aa95..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/parse_error.md +++ /dev/null @@ -1,28 +0,0 @@ -# nlohmann::json_sax::parse_error - -```cpp -virtual bool parse_error(std::size_t position, - const std::string& last_token, - const detail::exception& ex) = 0; -``` - -A parse error occurred. - -## Parameters - -`position` (in) -: the position in the input where the error occurs - -`last_token` (in) -: the last read token - -`ex` (in) -: an exception object describing the error - -## Return value - -Whether parsing should proceed (**must return `#!cpp false`**). - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/start_array.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/start_array.md deleted file mode 100644 index d10a6e5a..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/start_array.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::json_sax::start_array - -```cpp -virtual bool start_array(std::size_t elements) = 0; -``` - -The beginning of an array was read. - -## Parameters - -`elements` (in) -: number of object elements or `#!cpp -1` if unknown - -## Return value - -Whether parsing should proceed. - -## Notes - -Binary formats may report the number of elements. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/start_object.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/start_object.md deleted file mode 100644 index fd90f194..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/start_object.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::json_sax::start_object - -```cpp -virtual bool start_object(std::size_t elements) = 0; -``` - -The beginning of an object was read. - -## Parameters - -`elements` (in) -: number of object elements or `#!cpp -1` if unknown - -## Return value - -Whether parsing should proceed. - -## Notes - -Binary formats may report the number of elements. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/string.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/string.md deleted file mode 100644 index 113fe139..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/json_sax/string.md +++ /dev/null @@ -1,24 +0,0 @@ -# nlohmann::json_sax::string - -```cpp -virtual bool string(string_t& val) = 0; -``` - -A string value was read. - -## Parameters - -`val` (in) -: string value - -## Return value - -Whether parsing should proceed. - -## Notes - -It is safe to move the passed string value. - -## Version history - -- Added in version 3.2.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/macros/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/macros/index.md deleted file mode 100644 index 9c390d55..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/macros/index.md +++ /dev/null @@ -1,18 +0,0 @@ -# Macros - -Some aspects of the library can be configured by defining preprocessor macros before including the `json.hpp` header. - -- [`JSON_ASSERT(x)`](json_assert.md) -- `JSON_CATCH_USER(exception)` -- `JSON_DIAGNOSTICS` -- `JSON_HAS_CPP_11`, `JSON_HAS_CPP_14`, `JSON_HAS_CPP_17`, `JSON_HAS_CPP_20` -- `JSON_NOEXCEPTION` -- `JSON_NO_IO` -- `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK` -- `JSON_THROW_USER(exception)` -- `JSON_TRY_USER` -- `JSON_USE_IMPLICIT_CONVERSIONS` -- `NLOHMANN_DEFINE_TYPE_INTRUSIVE(type, member...)` -- `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(type, member...)` -- `NLOHMANN_JSON_SERIALIZE_ENUM(type, ...)` -- `NLOHMANN_JSON_VERSION_MAJOR`, `NLOHMANN_JSON_VERSION_MINOR`, `NLOHMANN_JSON_VERSION_PATCH` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/macros/json_assert.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/macros/json_assert.md deleted file mode 100644 index 63d4ae07..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/macros/json_assert.md +++ /dev/null @@ -1,11 +0,0 @@ -# JSON_ASSERT(x) - -```cpp -JSON_ASSERT(x) -``` - -## Default implementation - -```cpp -assert(x); -``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/ordered_json.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/ordered_json.md deleted file mode 100644 index 8b122f90..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/ordered_json.md +++ /dev/null @@ -1,15 +0,0 @@ -# nlohmann::ordered_json - -```cpp -using ordered_json = basic_json; -``` - -This type preserves the insertion order of object keys. - -## See also - -- [ordered_map](ordered_map.md) - -## Version history - -Since version 3.9.0. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/ordered_map.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/ordered_map.md deleted file mode 100644 index 74b248ff..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/api/ordered_map.md +++ /dev/null @@ -1,70 +0,0 @@ -# nlohmann::ordered_map - -```cpp -template, - class Allocator = std::allocator>> -struct ordered_map : std::vector, Allocator>; -``` - -A minimal map-like container that preserves insertion order for use within [`nlohmann::ordered_json`](ordered_json.md) -(`nlohmann::basic_json`). - -## Template parameters - -`Key` -: key type - -`T` -: mapped type - -`IgnoredLess` -: comparison function (ignored and only added to ensure compatibility with `#!cpp std::map`) - -`Allocator` -: allocator type - -## Member types - -- **key_type** - key type (`Key`) -- **mapped_type** - mapped type (`T`) -- **Container** - base container type (`#!cpp std::vector, Allocator>`) -- **iterator** -- **const_iterator** -- **size_type** -- **value_type** - -## Member functions - -- (constructor) -- (destructor) -- **emplace** -- **operator\[\]** -- **at** -- **erase** -- **count** -- **find** -- **insert** - -## Examples - -??? example - - The example shows the different behavior of `std::map` and `nlohmann::ordered_map`. - - ```cpp - --8<-- "examples/ordered_map.cpp" - ``` - - Output: - - ```json - --8<-- "examples/ordered_map.output" - ``` - -## See also - -- [ordered_json](ordered_json.md) - -## Version history - -- Added in version 3.9.0 to implement [`nlohmann::ordered_json`](ordered_json.md). diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/arbitrary_types.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/arbitrary_types.md deleted file mode 100644 index fe80dc70..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/arbitrary_types.md +++ /dev/null @@ -1,264 +0,0 @@ -# Arbitrary Types Conversions - -Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines: - -```cpp -namespace ns { - // a simple struct to model a person - struct person { - std::string name; - std::string address; - int age; - }; -} - -ns::person p = {"Ned Flanders", "744 Evergreen Terrace", 60}; - -// convert to JSON: copy each value into the JSON object -json j; -j["name"] = p.name; -j["address"] = p.address; -j["age"] = p.age; - -// ... - -// convert from JSON: copy each value from the JSON object -ns::person p { - j["name"].get(), - j["address"].get(), - j["age"].get() -}; -``` - -It works, but that's quite a lot of boilerplate... Fortunately, there's a better way: - -```cpp -// create a person -ns::person p {"Ned Flanders", "744 Evergreen Terrace", 60}; - -// conversion: person -> json -json j = p; - -std::cout << j << std::endl; -// {"address":"744 Evergreen Terrace","age":60,"name":"Ned Flanders"} - -// conversion: json -> person -auto p2 = j.get(); - -// that's it -assert(p == p2); -``` - -## Basic usage - -To make this work with one of your types, you only need to provide two functions: - -```cpp -using json = nlohmann::json; - -namespace ns { - void to_json(json& j, const person& p) { - j = json{ {"name", p.name}, {"address", p.address}, {"age", p.age} }; - } - - void from_json(const json& j, person& p) { - j.at("name").get_to(p.name); - j.at("address").get_to(p.address); - j.at("age").get_to(p.age); - } -} // namespace ns -``` - -That's all! When calling the `json` constructor with your type, your custom `to_json` method will be automatically called. -Likewise, when calling `get()` or `get_to(your_type&)`, the `from_json` method will be called. - -Some important things: - -* Those methods **MUST** be in your type's namespace (which can be the global namespace), or the library will not be able to locate them (in this example, they are in namespace `ns`, where `person` is defined). -* Those methods **MUST** be available (e.g., proper headers must be included) everywhere you use these conversions. Look at [issue 1108](https://github.com/nlohmann/json/issues/1108) for errors that may occur otherwise. -* When using `get()`, `your_type` **MUST** be [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). (There is a way to bypass this requirement described later.) -* In function `from_json`, use function [`at()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a93403e803947b86f4da2d1fb3345cf2c.html#a93403e803947b86f4da2d1fb3345cf2c) to access the object values rather than `operator[]`. In case a key does not exist, `at` throws an exception that you can handle, whereas `operator[]` exhibits undefined behavior. -* You do not need to add serializers or deserializers for STL types like `std::vector`: the library already implements these. - - -## Simplify your life with macros - -If you just want to serialize/deserialize some structs, the `to_json`/`from_json` functions can be a lot of boilerplate. - -There are two macros to make your life easier as long as you (1) want to use a JSON object as serialization and (2) want to use the member variable names as object keys in that object: - -- `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(name, member1, member2, ...)` is to be defined inside the namespace of the class/struct to create code for. -- `NLOHMANN_DEFINE_TYPE_INTRUSIVE(name, member1, member2, ...)` is to be defined inside the class/struct to create code for. This macro can also access private members. - -In both macros, the first parameter is the name of the class/struct, and all remaining parameters name the members. - -!!! note - - At most 64 member variables can be passed to `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE` or `NLOHMANN_DEFINE_TYPE_INTRUSIVE`. - -??? example - - The `to_json`/`from_json` functions for the `person` struct above can be created with: - - ```cpp - namespace ns { - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age) - } - ``` - - Here is an example with private members, where `NLOHMANN_DEFINE_TYPE_INTRUSIVE` is needed: - - ```cpp - namespace ns { - class address { - private: - std::string street; - int housenumber; - int postcode; - - public: - NLOHMANN_DEFINE_TYPE_INTRUSIVE(address, street, housenumber, postcode) - }; - } - ``` - -## How do I convert third-party types? - -This requires a bit more advanced technique. But first, let's see how this conversion mechanism works: - -The library uses **JSON Serializers** to convert types to json. -The default serializer for `nlohmann::json` is `nlohmann::adl_serializer` (ADL means [Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)). - -It is implemented like this (simplified): - -```cpp -template -struct adl_serializer { - static void to_json(json& j, const T& value) { - // calls the "to_json" method in T's namespace - } - - static void from_json(const json& j, T& value) { - // same thing, but with the "from_json" method - } -}; -``` - -This serializer works fine when you have control over the type's namespace. However, what about `boost::optional` or `std::filesystem::path` (C++17)? Hijacking the `boost` namespace is pretty bad, and it's illegal to add something other than template specializations to `std`... - -To solve this, you need to add a specialization of `adl_serializer` to the `nlohmann` namespace, here's an example: - -```cpp -// partial specialization (full specialization works too) -namespace nlohmann { - template - struct adl_serializer> { - static void to_json(json& j, const boost::optional& opt) { - if (opt == boost::none) { - j = nullptr; - } else { - j = *opt; // this will call adl_serializer::to_json which will - // find the free function to_json in T's namespace! - } - } - - static void from_json(const json& j, boost::optional& opt) { - if (j.is_null()) { - opt = boost::none; - } else { - opt = j.get(); // same as above, but with - // adl_serializer::from_json - } - } - }; -} -``` - -## How can I use `get()` for non-default constructible/non-copyable types? - -There is a way, if your type is [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload: - -```cpp -struct move_only_type { - move_only_type() = delete; - move_only_type(int ii): i(ii) {} - move_only_type(const move_only_type&) = delete; - move_only_type(move_only_type&&) = default; - - int i; -}; - -namespace nlohmann { - template <> - struct adl_serializer { - // note: the return type is no longer 'void', and the method only takes - // one argument - static move_only_type from_json(const json& j) { - return {j.get()}; - } - - // Here's the catch! You must provide a to_json method! Otherwise, you - // will not be able to convert move_only_type to json, since you fully - // specialized adl_serializer on that type - static void to_json(json& j, move_only_type t) { - j = t.i; - } - }; -} -``` - -## Can I write my own serializer? (Advanced use) - -Yes. You might want to take a look at [`unit-udt.cpp`](https://github.com/nlohmann/json/blob/develop/test/src/unit-udt.cpp) in the test suite, to see a few examples. - -If you write your own serializer, you'll need to do a few things: - -- use a different `basic_json` alias than `nlohmann::json` (the last template parameter of `basic_json` is the `JSONSerializer`) -- use your `basic_json` alias (or a template parameter) in all your `to_json`/`from_json` methods -- use `nlohmann::to_json` and `nlohmann::from_json` when you need ADL - -Here is an example, without simplifications, that only accepts types with a size <= 32, and uses ADL. - -```cpp -// You should use void as a second template argument -// if you don't need compile-time checks on T -template::type> -struct less_than_32_serializer { - template - static void to_json(BasicJsonType& j, T value) { - // we want to use ADL, and call the correct to_json overload - using nlohmann::to_json; // this method is called by adl_serializer, - // this is where the magic happens - to_json(j, value); - } - - template - static void from_json(const BasicJsonType& j, T& value) { - // same thing here - using nlohmann::from_json; - from_json(j, value); - } -}; -``` - -Be **very** careful when reimplementing your serializer, you can stack overflow if you don't pay attention: - -```cpp -template -struct bad_serializer -{ - template - static void to_json(BasicJsonType& j, const T& value) { - // this calls BasicJsonType::json_serializer::to_json(j, value); - // if BasicJsonType::json_serializer == bad_serializer ... oops! - j = value; - } - - template - static void to_json(const BasicJsonType& j, T& value) { - // this calls BasicJsonType::json_serializer::from_json(j, value); - // if BasicJsonType::json_serializer == bad_serializer ... oops! - value = j.template get(); // oops! - } -}; -``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/bson.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/bson.md deleted file mode 100644 index 8c7716d9..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/bson.md +++ /dev/null @@ -1,96 +0,0 @@ -# BSON - -BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the -embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow -representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type. - -!!! abstract "References" - - - [BSON Website](http://bsonspec.org) - the main source on BSON - - [BSON Specification](http://bsonspec.org/spec.html) - the specification - - -## Serialization - -The library uses the following mapping from JSON values types to BSON types: - -| JSON value type | value/range | BSON type | marker | -|-----------------|-------------------------------------------|-----------|--------| -| null | `null` | null | 0x0A | -| boolean | `true`, `false` | boolean | 0x08 | -| number_integer | -9223372036854775808..-2147483649 | int64 | 0x12 | -| number_integer | -2147483648..2147483647 | int32 | 0x10 | -| number_integer | 2147483648..9223372036854775807 | int64 | 0x12 | -| number_unsigned | 0..2147483647 | int32 | 0x10 | -| number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 | -| number_unsigned | 9223372036854775808..18446744073709551615 | -- | -- | -| number_float | *any value* | double | 0x01 | -| string | *any value* | string | 0x02 | -| array | *any value* | document | 0x04 | -| object | *any value* | document | 0x03 | -| binary | *any value* | binary | 0x05 | - -!!! warning "Incomplete mapping" - - The mapping is **incomplete**, since only JSON-objects (and things - contained therein) can be serialized to BSON. - Also, integers larger than 9223372036854775807 cannot be serialized to BSON, - and the keys may not contain U+0000, since they are serialized a - zero-terminated c-strings. - -??? example - - ```cpp - --8<-- "examples/to_bson.cpp" - ``` - - Output: - - ```c - --8<-- "examples/to_bson.output" - ``` - - -## Deserialization - -The library maps BSON record types to JSON value types as follows: - -| BSON type | BSON marker byte | JSON value type | -|-----------------------|------------------|-----------------| -| double | 0x01 | number_float | -| string | 0x02 | string | -| document | 0x03 | object | -| array | 0x04 | array | -| binary | 0x05 | binary | -| undefined | 0x06 | *unsupported* | -| ObjectId | 0x07 | *unsupported* | -| boolean | 0x08 | boolean | -| UTC Date-Time | 0x09 | *unsupported* | -| null | 0x0A | null | -| Regular Expr. | 0x0B | *unsupported* | -| DB Pointer | 0x0C | *unsupported* | -| JavaScript Code | 0x0D | *unsupported* | -| Symbol | 0x0E | *unsupported* | -| JavaScript Code | 0x0F | *unsupported* | -| int32 | 0x10 | number_integer | -| Timestamp | 0x11 | *unsupported* | -| 128-bit decimal float | 0x13 | *unsupported* | -| Max Key | 0x7F | *unsupported* | -| Min Key | 0xFF | *unsupported* | - -!!! warning "Incomplete mapping" - - The mapping is **incomplete**. The unsupported mappings are indicated in the table above. - - -??? example - - ```cpp - --8<-- "examples/from_bson.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_bson.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/cbor.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/cbor.md deleted file mode 100644 index 280bf577..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/cbor.md +++ /dev/null @@ -1,180 +0,0 @@ -# CBOR - -The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely -small code size, fairly small message size, and extensibility without the need for version negotiation. - -!!! abstract "References" - - - [CBOR Website](http://cbor.io) - the main source on CBOR - - [CBOR Playground](http://cbor.me) - an interactive webpage to translate between JSON and CBOR - - [RFC 7049](https://tools.ietf.org/html/rfc7049) - the CBOR specification - -## Serialization - -The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification (RFC 7049): - -| JSON value type | value/range | CBOR type | first byte | -|-----------------|--------------------------------------------|-----------------------------------|------------| -| null | `null` | Null | 0xF6 | -| boolean | `true` | True | 0xF5 | -| boolean | `false` | False | 0xF4 | -| number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3B | -| number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3A | -| number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39 | -| number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38 | -| number_integer | -24..-1 | Negative integer | 0x20..0x37 | -| number_integer | 0..23 | Integer | 0x00..0x17 | -| number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18 | -| number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 | -| number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A | -| number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B | -| number_unsigned | 0..23 | Integer | 0x00..0x17 | -| number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18 | -| number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 | -| number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A | -| number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B | -| number_float | *any value representable by a float* | Single-Precision Float | 0xFA | -| number_float | *any value NOT representable by a float* | Double-Precision Float | 0xFB | -| string | *length*: 0..23 | UTF-8 string | 0x60..0x77 | -| string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78 | -| string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79 | -| string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7A | -| string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7B | -| array | *size*: 0..23 | array | 0x80..0x97 | -| array | *size*: 23..255 | array (1 byte follow) | 0x98 | -| array | *size*: 256..65535 | array (2 bytes follow) | 0x99 | -| array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9A | -| array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9B | -| object | *size*: 0..23 | map | 0xA0..0xB7 | -| object | *size*: 23..255 | map (1 byte follow) | 0xB8 | -| object | *size*: 256..65535 | map (2 bytes follow) | 0xB9 | -| object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xBA | -| object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xBB | -| binary | *size*: 0..23 | byte string | 0x40..0x57 | -| binary | *size*: 23..255 | byte string (1 byte follow) | 0x58 | -| binary | *size*: 256..65535 | byte string (2 bytes follow) | 0x59 | -| binary | *size*: 65536..4294967295 | byte string (4 bytes follow) | 0x5A | -| binary | *size*: 4294967296..18446744073709551615 | byte string (8 bytes follow) | 0x5B | - -Binary values with subtype are mapped to tagged values (0xD8..0xDB) depending on the subtype, followed by a byte string, -see "binary" cells in the table above. - -!!! success "Complete mapping" - - The mapping is **complete** in the sense that any JSON value type can be converted to a CBOR value. - -!!! info "NaN/infinity handling" - - If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the normal JSON serialization which serializes NaN or Infinity to `null`. - -!!! info "Unused CBOR types" - - The following CBOR types are not used in the conversion: - - - UTF-8 strings terminated by "break" (0x7F) - - arrays terminated by "break" (0x9F) - - maps terminated by "break" (0xBF) - - byte strings terminated by "break" (0x5F) - - date/time (0xC0..0xC1) - - bignum (0xC2..0xC3) - - decimal fraction (0xC4) - - bigfloat (0xC5) - - expected conversions (0xD5..0xD7) - - simple values (0xE0..0xF3, 0xF8) - - undefined (0xF7) - - half-precision floats (0xF9) - - break (0xFF) - -!!! info "Tagged items" - - Binary subtypes will be serialized as tagged items. See [binary values](../binary_values.md#cbor) for an example. - -??? example - - ```cpp - --8<-- "examples/to_cbor.cpp" - ``` - - Output: - - ```c - --8<-- "examples/to_cbor.output" - ``` - -## Deserialization - -The library maps CBOR types to JSON value types as follows: - -| CBOR type | JSON value type | first byte | -|------------------------|-----------------|------------| -| Integer | number_unsigned | 0x00..0x17 | -| Unsigned integer | number_unsigned | 0x18 | -| Unsigned integer | number_unsigned | 0x19 | -| Unsigned integer | number_unsigned | 0x1A | -| Unsigned integer | number_unsigned | 0x1B | -| Negative integer | number_integer | 0x20..0x37 | -| Negative integer | number_integer | 0x38 | -| Negative integer | number_integer | 0x39 | -| Negative integer | number_integer | 0x3A | -| Negative integer | number_integer | 0x3B | -| Byte string | binary | 0x40..0x57 | -| Byte string | binary | 0x58 | -| Byte string | binary | 0x59 | -| Byte string | binary | 0x5A | -| Byte string | binary | 0x5B | -| UTF-8 string | string | 0x60..0x77 | -| UTF-8 string | string | 0x78 | -| UTF-8 string | string | 0x79 | -| UTF-8 string | string | 0x7A | -| UTF-8 string | string | 0x7B | -| UTF-8 string | string | 0x7F | -| array | array | 0x80..0x97 | -| array | array | 0x98 | -| array | array | 0x99 | -| array | array | 0x9A | -| array | array | 0x9B | -| array | array | 0x9F | -| map | object | 0xA0..0xB7 | -| map | object | 0xB8 | -| map | object | 0xB9 | -| map | object | 0xBA | -| map | object | 0xBB | -| map | object | 0xBF | -| False | `false` | 0xF4 | -| True | `true` | 0xF5 | -| Null | `null` | 0xF6 | -| Half-Precision Float | number_float | 0xF9 | -| Single-Precision Float | number_float | 0xFA | -| Double-Precision Float | number_float | 0xFB | - -!!! warning "Incomplete mapping" - - The mapping is **incomplete** in the sense that not all CBOR types can be converted to a JSON value. The following CBOR types are not supported and will yield parse errors: - - - date/time (0xC0..0xC1) - - bignum (0xC2..0xC3) - - decimal fraction (0xC4) - - bigfloat (0xC5) - - expected conversions (0xD5..0xD7) - - simple values (0xE0..0xF3, 0xF8) - - undefined (0xF7) - -!!! warning "Object keys" - - CBOR allows map keys of any type, whereas JSON only allows strings as keys in object values. Therefore, CBOR maps with keys other than UTF-8 strings are rejected. - -!!! warning "Tagged items" - - Tagged items will throw a parse error by default. They can be ignored by passing `cbor_tag_handler_t::ignore` to function `from_cbor`. They can be stored by passing `cbor_tag_handler_t::store` to function `from_cbor`. - -??? example - - ```cpp - --8<-- "examples/from_cbor.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_cbor.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/index.md deleted file mode 100644 index 3a969a5d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/index.md +++ /dev/null @@ -1,45 +0,0 @@ -# Binary Formats - -Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports - -- [BSON](bson.md) (Binary JSON), -- [CBOR](cbor.md) (Concise Binary Object Representation), -- [MessagePack](messagepack.md), and -- [UBJSON](ubjson.md) (Universal Binary JSON) - -to efficiently encode JSON values to byte vectors and to decode such vectors. - -## Comparison - -### Completeness - -| Format | Serialization | Deserialization | -|-------------|-----------------------------------------------|----------------------------------------------| -| BSON | incomplete: top-level value must be an object | incomplete, but all JSON types are supported | -| CBOR | complete | incomplete, but all JSON types are supported | -| MessagePack | complete | complete | -| UBJSON | complete | complete | - -### Binary values - -| Format | Binary values | Binary subtypes | -|-------------|---------------|-----------------| -| BSON | supported | supported | -| CBOR | supported | supported | -| MessagePack | supported | supported | -| UBJSON | not supported | not supported | - -See [binary values](../binary_values.md) for more information. - -### Sizes - -| Format | canada.json | twitter.json | citm_catalog.json | jeopardy.json | -|--------------------|-------------|--------------|-------------------|---------------| -| BSON | 85,8 % | 95,2 % | 95,8 % | 106,7 % | -| CBOR | 50,5 % | 86,3 % | 68,4 % | 88,0 % | -| MessagePack | 50,6 % | 86,0 % | 68,5 % | 87,9 % | -| UBJSON | 53,2 % | 91,3 % | 78,2 % | 96,6 % | -| UBJSON (size) | 58,6 % | 92,3 % | 86,8 % | 97,4 % | -| UBJSON (size+type) | 55,9 % | 92,3 % | 85,0 % | 95,0 % | - -Sizes compared to minified JSON value. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/messagepack.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/messagepack.md deleted file mode 100644 index b0139b40..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/messagepack.md +++ /dev/null @@ -1,139 +0,0 @@ -# MessagePack - -MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves. - -!!! abstract "References" - - - [MessagePack website](https://msgpack.org) - - [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md) - -## Serialization - -The library uses the following mapping from JSON values types to MessagePack types according to the MessagePack specification: - -| JSON value type | value/range | MessagePack type | first byte | -|-----------------|------------------------------------------|------------------|------------| -| null | `null` | nil | 0xC0 | -| boolean | `true` | true | 0xC3 | -| boolean | `false` | false | 0xC2 | -| number_integer | -9223372036854775808..-2147483649 | int64 | 0xD3 | -| number_integer | -2147483648..-32769 | int32 | 0xD2 | -| number_integer | -32768..-129 | int16 | 0xD1 | -| number_integer | -128..-33 | int8 | 0xD0 | -| number_integer | -32..-1 | negative fixint | 0xE0..0xFF | -| number_integer | 0..127 | positive fixint | 0x00..0x7F | -| number_integer | 128..255 | uint 8 | 0xCC | -| number_integer | 256..65535 | uint 16 | 0xCD | -| number_integer | 65536..4294967295 | uint 32 | 0xCE | -| number_integer | 4294967296..18446744073709551615 | uint 64 | 0xCF | -| number_unsigned | 0..127 | positive fixint | 0x00..0x7F | -| number_unsigned | 128..255 | uint 8 | 0xCC | -| number_unsigned | 256..65535 | uint 16 | 0xCD | -| number_unsigned | 65536..4294967295 | uint 32 | 0xCE | -| number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xCF | -| number_float | *any value representable by a float* | float 32 | 0xCA | -| number_float | *any value NOT representable by a float* | float 64 | 0xCB | -| string | *length*: 0..31 | fixstr | 0xA0..0xBF | -| string | *length*: 32..255 | str 8 | 0xD9 | -| string | *length*: 256..65535 | str 16 | 0xDA | -| string | *length*: 65536..4294967295 | str 32 | 0xDB | -| array | *size*: 0..15 | fixarray | 0x90..0x9F | -| array | *size*: 16..65535 | array 16 | 0xDC | -| array | *size*: 65536..4294967295 | array 32 | 0xDD | -| object | *size*: 0..15 | fix map | 0x80..0x8F | -| object | *size*: 16..65535 | map 16 | 0xDE | -| object | *size*: 65536..4294967295 | map 32 | 0xDF | -| binary | *size*: 0..255 | bin 8 | 0xC4 | -| binary | *size*: 256..65535 | bin 16 | 0xC5 | -| binary | *size*: 65536..4294967295 | bin 32 | 0xC6 | - -!!! success "Complete mapping" - - The mapping is **complete** in the sense that any JSON value type can be converted to a MessagePack value. - - Any MessagePack output created by `to_msgpack` can be successfully parsed by `from_msgpack`. - -!!! warning "Size constraints" - - The following values can **not** be converted to a MessagePack value: - - - strings with more than 4294967295 bytes - - byte strings with more than 4294967295 bytes - - arrays with more than 4294967295 elements - - objects with more than 4294967295 elements - -!!! info "NaN/infinity handling" - - If NaN or Infinity are stored inside a JSON number, they are serialized properly. function which serializes NaN or Infinity to `null`. - -??? example - - ```cpp - --8<-- "examples/to_msgpack.cpp" - ``` - - Output: - - ```c - --8<-- "examples/to_msgpack.output" - ``` - -## Deserialization - -The library maps MessagePack types to JSON value types as follows: - -| MessagePack type | JSON value type | first byte | -|------------------|-----------------|------------| -| positive fixint | number_unsigned | 0x00..0x7F | -| fixmap | object | 0x80..0x8F | -| fixarray | array | 0x90..0x9F | -| fixstr | string | 0xA0..0xBF | -| nil | `null` | 0xC0 | -| false | `false` | 0xC2 | -| true | `true` | 0xC3 | -| float 32 | number_float | 0xCA | -| float 64 | number_float | 0xCB | -| uint 8 | number_unsigned | 0xCC | -| uint 16 | number_unsigned | 0xCD | -| uint 32 | number_unsigned | 0xCE | -| uint 64 | number_unsigned | 0xCF | -| int 8 | number_integer | 0xD0 | -| int 16 | number_integer | 0xD1 | -| int 32 | number_integer | 0xD2 | -| int 64 | number_integer | 0xD3 | -| str 8 | string | 0xD9 | -| str 16 | string | 0xDA | -| str 32 | string | 0xDB | -| array 16 | array | 0xDC | -| array 32 | array | 0xDD | -| map 16 | object | 0xDE | -| map 32 | object | 0xDF | -| bin 8 | binary | 0xC4 | -| bin 16 | binary | 0xC5 | -| bin 32 | binary | 0xC6 | -| ext 8 | binary | 0xC7 | -| ext 16 | binary | 0xC8 | -| ext 32 | binary | 0xC9 | -| fixext 1 | binary | 0xD4 | -| fixext 2 | binary | 0xD5 | -| fixext 4 | binary | 0xD6 | -| fixext 8 | binary | 0xD7 | -| fixext 16 | binary | 0xD8 | -| negative fixint | number_integer | 0xE0-0xFF | - -!!! info - - Any MessagePack output created by `to_msgpack` can be successfully parsed by `from_msgpack`. - - -??? example - - ```cpp - --8<-- "examples/from_msgpack.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_msgpack.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/ubjson.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/ubjson.md deleted file mode 100644 index 509d9f57..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_formats/ubjson.md +++ /dev/null @@ -1,133 +0,0 @@ -# UBJSON - -Universal Binary JSON (UBJSON) is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON. - -!!! abstract "References" - - - [UBJSON Website](http://ubjson.org) - -## Serialization - -The library uses the following mapping from JSON values types to UBJSON types according to the UBJSON specification: - -| JSON value type | value/range | UBJSON type | marker | -|-----------------|-----------------------------------|----------------|--------| -| null | `null` | null | `Z` | -| boolean | `true` | true | `T` | -| boolean | `false` | false | `F` | -| number_integer | -9223372036854775808..-2147483649 | int64 | `L` | -| number_integer | -2147483648..-32769 | int32 | `l` | -| number_integer | -32768..-129 | int16 | `I` | -| number_integer | -128..127 | int8 | `i` | -| number_integer | 128..255 | uint8 | `U` | -| number_integer | 256..32767 | int16 | `I` | -| number_integer | 32768..2147483647 | int32 | `l` | -| number_integer | 2147483648..9223372036854775807 | int64 | `L` | -| number_unsigned | 0..127 | int8 | `i` | -| number_unsigned | 128..255 | uint8 | `U` | -| number_unsigned | 256..32767 | int16 | `I` | -| number_unsigned | 32768..2147483647 | int32 | `l` | -| number_unsigned | 2147483648..9223372036854775807 | int64 | `L` | -| number_unsigned | 2147483649..18446744073709551615 | high-precision | `H` | -| number_float | *any value* | float64 | `D` | -| string | *with shortest length indicator* | string | `S` | -| array | *see notes on optimized format* | array | `[` | -| object | *see notes on optimized format* | map | `{` | - -!!! success "Complete mapping" - - The mapping is **complete** in the sense that any JSON value type can be converted to a UBJSON value. - - Any UBJSON output created by `to_ubjson` can be successfully parsed by `from_ubjson`. - -!!! warning "Size constraints" - - The following values can **not** be converted to a UBJSON value: - - - strings with more than 9223372036854775807 bytes (theoretical) - -!!! info "Unused UBJSON markers" - - The following markers are not used in the conversion: - - - `Z`: no-op values are not created. - - `C`: single-byte strings are serialized with `S` markers. - -!!! info "NaN/infinity handling" - - If NaN or Infinity are stored inside a JSON number, they are - serialized properly. This behavior differs from the `dump()` - function which serializes NaN or Infinity to `null`. - -!!! info "Optimized formats" - - The optimized formats for containers are supported: Parameter - `use_size` adds size information to the beginning of a container and - removes the closing marker. Parameter `use_type` further checks - whether all elements of a container have the same type and adds the - type marker to the beginning of the container. The `use_type` - parameter must only be used together with `use_size = true`. - - Note that `use_size = true` alone may result in larger representations - - the benefit of this parameter is that the receiving side is - immediately informed on the number of elements of the container. - -!!! info "Binary values" - - If the JSON data contains the binary type, the value stored is a list - of integers, as suggested by the UBJSON documentation. In particular, - this means that serialization and the deserialization of a JSON - containing binary values into UBJSON and back will result in a - different JSON object. - - -??? example - - ```cpp - --8<-- "examples/to_ubjson.cpp" - ``` - - Output: - - ```c - --8<-- "examples/to_ubjson.output" - ``` - -## Deserialization - -The library maps UBJSON types to JSON value types as follows: - -| UBJSON type | JSON value type | marker | -|-------------|-----------------------------------------|--------| -| no-op | *no value, next value is read* | `N` | -| null | `null` | `Z` | -| false | `false` | `F` | -| true | `true` | `T` | -| float32 | number_float | `d` | -| float64 | number_float | `D` | -| uint8 | number_unsigned | `U` | -| int8 | number_integer | `i` | -| int16 | number_integer | `I` | -| int32 | number_integer | `l` | -| int64 | number_integer | `L` | -| string | string | `S` | -| char | string | `C` | -| array | array (optimized values are supported) | `[` | -| object | object (optimized values are supported) | `{` | - -!!! success "Complete mapping" - - The mapping is **complete** in the sense that any UBJSON value can be converted to a JSON value. - - -??? example - - ```cpp - --8<-- "examples/from_ubjson.cpp" - ``` - - Output: - - ```json - --8<-- "examples/from_ubjson.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_values.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_values.md deleted file mode 100644 index c58834c0..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/binary_values.md +++ /dev/null @@ -1,296 +0,0 @@ -# Binary Values - -The library implements several [binary formats](binary_formats/index.md) that encode JSON in an efficient way. Most of these formats support binary values; that is, values that have semantics define outside the library and only define a sequence of bytes to be stored. - -JSON itself does not have a binary value. As such, binary values are an extension that this library implements to store values received by a binary format. Binary values are never created by the JSON parser, and are only part of a serialized JSON text if they have been created manually or via a binary format. - -## API for binary values - -```plantuml -class json::binary_t { - -- setters -- - +void set_subtype(std::uint64_t subtype) - +void clear_subtype() - -- getters -- - +std::uint64_t subtype() const - +bool has_subtype() const -} - -"std::vector" <|-- json::binary_t -``` - -By default, binary values are stored as `std::vector`. This type can be changed by providing a template parameter to the `basic_json` type. To store binary subtypes, the storage type is extended and exposed as `json::binary_t`: - -```cpp -auto binary = json::binary_t({0xCA, 0xFE, 0xBA, 0xBE}); -auto binary_with_subtype = json::binary_t({0xCA, 0xFE, 0xBA, 0xBE}, 42); -``` - -There are several convenience functions to check and set the subtype: - -```cpp -binary.has_subtype(); // returns false -binary_with_subtype.has_subtype(); // returns true - -binary_with_subtype.clear_subtype(); -binary_with_subtype.has_subtype(); // returns true - -binary_with_subtype.set_subtype(42); -binary.set_subtype(23); - -binary.subtype(); // returns 23 -``` - -As `json::binary_t` is subclassing `std::vector`, all member functions are available: - -```cpp -binary.size(); // returns 4 -binary[1]; // returns 0xFE -``` - -JSON values can be constructed from `json::binary_t`: - -```cpp -json j = binary; -``` - -Binary values are primitive values just like numbers or strings: - -```cpp -j.is_binary(); // returns true -j.is_primitive(); // returns true -``` - -Given a binary JSON value, the `binary_t` can be accessed by reference as via `get_binary()`: - -```cpp -j.get_binary().has_subtype(); // returns true -j.get_binary().size(); // returns 4 -``` - -For convenience, binary JSON values can be constructed via `json::binary`: - -```cpp -auto j2 = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 23); -auto j3 = json::binary({0xCA, 0xFE, 0xBA, 0xBE}); - -j2 == j; // returns true -j3.get_binary().has_subtype(); // returns false -j3.get_binary().subtype(); // returns std::uint64_t(-1) as j3 has no subtype -``` - - - -## Serialization - -Binary values are serialized differently according to the formats. - -### JSON - -JSON does not have a binary type, and this library does not introduce a new type as this would break conformance. Instead, binary values are serialized as an object with two keys: `bytes` holds an array of integers, and `subtype` is an integer or `null`. - -??? example - - Code: - - ```cpp - // create a binary value of subtype 42 - json j; - j["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42); - - // serialize to standard output - std::cout << j.dump(2) << std::endl; - ``` - - Output: - - ```json - { - "binary": { - "bytes": [202, 254, 186, 190], - "subtype": 42 - } - } - ``` - -!!! warning "No roundtrip for binary values" - - The JSON parser will not parse the objects generated by binary values back to binary values. This is by design to remain standards compliant. Serializing binary values to JSON is only implemented for debugging purposes. - -### BSON - -[BSON](binary_formats/bson.md) supports binary values and subtypes. If a subtype is given, it is used and added as unsigned 8-bit integer. If no subtype is given, the generic binary subtype 0x00 is used. - -??? example - - Code: - - ```cpp - // create a binary value of subtype 42 - json j; - j["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42); - - // convert to BSON - auto v = json::to_bson(j); - ``` - - `v` is a `std::vector` with the following 22 elements: - - ```c - 0x16 0x00 0x00 0x00 // number of bytes in the document - 0x05 // binary value - 0x62 0x69 0x6E 0x61 0x72 0x79 0x00 // key "binary" + null byte - 0x04 0x00 0x00 0x00 // number of bytes - 0x2a // subtype - 0xCA 0xFE 0xBA 0xBE // content - 0x00 // end of the document - ``` - - Note that the serialization preserves the subtype, and deserializing `v` would yield the following value: - - ```json - { - "binary": { - "bytes": [202, 254, 186, 190], - "subtype": 42 - } - } - ``` - -### CBOR - -[CBOR](binary_formats/cbor.md) supports binary values, but no subtypes. Subtypes will be serialized as tags. Any binary value will be serialized as byte strings. The library will choose the smallest representation using the length of the byte array. - -??? example - - Code: - - ```cpp - // create a binary value of subtype 42 - json j; - j["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42); - - // convert to CBOR - auto v = json::to_cbor(j); - ``` - - `v` is a `std::vector` with the following 15 elements: - - ```c - 0xA1 // map(1) - 0x66 // text(6) - 0x62 0x69 0x6E 0x61 0x72 0x79 // "binary" - 0xD8 0x2A // tag(42) - 0x44 // bytes(4) - 0xCA 0xFE 0xBA 0xBE // content - ``` - - Note that the subtype is serialized as tag. However, parsing tagged values yield a parse error unless `json::cbor_tag_handler_t::ignore` or `json::cbor_tag_handler_t::store` is passed to `json::from_cbor`. - - ```json - { - "binary": { - "bytes": [202, 254, 186, 190], - "subtype": null - } - } - ``` - -### MessagePack - -[MessagePack](binary_formats/messagepack.md) supports binary values and subtypes. If a subtype is given, the ext family is used. The library will choose the smallest representation among fixext1, fixext2, fixext4, fixext8, ext8, ext16, and ext32. The subtype is then added as signed 8-bit integer. - -If no subtype is given, the bin family (bin8, bin16, bin32) is used. - -??? example - - Code: - - ```cpp - // create a binary value of subtype 42 - json j; - j["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42); - - // convert to MessagePack - auto v = json::to_msgpack(j); - ``` - - `v` is a `std::vector` with the following 14 elements: - - ```c - 0x81 // fixmap1 - 0xA6 // fixstr6 - 0x62 0x69 0x6E 0x61 0x72 0x79 // "binary" - 0xD6 // fixext4 - 0x2A // subtype - 0xCA 0xFE 0xBA 0xBE // content - ``` - - Note that the serialization preserves the subtype, and deserializing `v` would yield the following value: - - ```json - { - "binary": { - "bytes": [202, 254, 186, 190], - "subtype": 42 - } - } - ``` - -### UBJSON - -[UBJSON](binary_formats/ubjson.md) neither supports binary values nor subtypes, and proposes to serialize binary values as array of uint8 values. This translation is implemented by the library. - -??? example - - Code: - - ```cpp - // create a binary value of subtype 42 (will be ignored in UBJSON) - json j; - j["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42); - - // convert to UBJSON - auto v = json::to_msgpack(j); - ``` - - `v` is a `std::vector` with the following 20 elements: - - ```c - 0x7B // '{' - 0x69 0x06 // i 6 (length of the key) - 0x62 0x69 0x6E 0x61 0x72 0x79 // "binary" - 0x5B // '[' - 0x55 0xCA 0x55 0xFE 0x55 0xBA 0x55 0xBE // content (each byte prefixed with 'U') - 0x5D // ']' - 0x7D // '}' - ``` - - The following code uses the type and size optimization for UBJSON: - - ```cpp - // convert to UBJSON using the size and type optimization - auto v = json::to_ubjson(j, true, true); - ``` - - The resulting vector has 23 elements; the optimization is not effective for examples with few values: - - ```c - 0x7B // '{' - 0x24 // '$' type of the object elements - 0x5B // '[' array - 0x23 0x69 0x01 // '#' i 1 number of object elements - 0x69 0x06 // i 6 (length of the key) - 0x62 0x69 0x6E 0x61 0x72 0x79 // "binary" - 0x24 0x55 // '$' 'U' type of the array elements: unsigned integers - 0x23 0x69 0x04 // '#' i 4 number of array elements - 0xCA 0xFE 0xBA 0xBE // content - ``` - - Note that subtype (42) is **not** serialized and that UBJSON has **no binary type**, and deserializing `v` would yield the following value: - - ```json - { - "binary": [202, 254, 186, 190] - } - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/comments.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/comments.md deleted file mode 100644 index c5874c9f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/comments.md +++ /dev/null @@ -1,83 +0,0 @@ -# Comments - -This library does not support comments *by default*. It does so for three reasons: - -1. Comments are not part of the [JSON specification](https://tools.ietf.org/html/rfc8259). You may argue that `//` or `/* */` are allowed in JavaScript, but JSON is not JavaScript. -2. This was not an oversight: Douglas Crockford [wrote on this](https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr) in May 2012: - - > I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't. - - > Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser. - -3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this. - -However, you can pass set parameter `ignore_comments` to `#!c true` in the parse function to ignore `//` or `/* */` comments. Comments will then be treated as whitespace. - -!!! example - - Consider the following JSON with comments. - - ```json - { - // update in 2006: removed Pluto - "planets": ["Mercury", "Venus", "Earth", "Mars", - "Jupiter", "Uranus", "Neptune" /*, "Pluto" */] - } - ``` - - When calling `parse` without additional argument, a parse error exception is thrown. If `ignore_comments` is set to `#! true`, the comments are ignored during parsing: - - ```cpp - #include - #include "json.hpp" - - using json = nlohmann::json; - - int main() - { - std::string s = R"( - { - // update in 2006: removed Pluto - "planets": ["Mercury", "Venus", "Earth", "Mars", - "Jupiter", "Uranus", "Neptune" /*, "Pluto" */] - } - )"; - - try - { - json j = json::parse(s); - } - catch (json::exception &e) - { - std::cout << e.what() << std::endl; - } - - json j = json::parse(s, - /* callback */ nullptr, - /* allow exceptions */ true, - /* ignore_comments */ true); - std::cout << j.dump(2) << '\n'; - } - ``` - - Output: - - ``` - [json.exception.parse_error.101] parse error at line 3, column 9: - syntax error while parsing object key - invalid literal; - last read: ' { /'; expected string literal - ``` - - ```json - { - "planets": [ - "Mercury", - "Venus", - "Earth", - "Mars", - "Jupiter", - "Uranus", - "Neptune" - ] - } - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/checked_access.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/checked_access.md deleted file mode 100644 index fd444beb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/checked_access.md +++ /dev/null @@ -1,77 +0,0 @@ -# Checked access: at - -## Overview - -The `#!cpp at()` member function performs checked access; that is, it returns a reference to the desired value if it exists and throws a [`basic_json::out_of_range` exception](../../home/exceptions.md#out-of-range) otherwise. - -??? example - - Consider the following JSON value: - - ```json - { - "name": "Mary Smith", - "age": 42, - "hobbies": ["hiking", "reading"] - } - ``` - - Assume the value is parsed to a `json` variable `j`. - - | expression | value | - | ---------- | ----- | - | `#!cpp j` | `#!json {"name": "Mary Smith", "age": 42, "hobbies": ["hiking", "reading"]}` | - | `#!cpp j.at("name")` | `#!json "Mary Smith"` | - | `#!cpp j.at("age")` | `#!json 42` | - | `#!cpp j.at("hobbies")` | `#!json ["hiking", "reading"]` | - | `#!cpp j.at("hobbies").at(0)` | `#!json "hiking"` | - | `#!cpp j.at("hobbies").at(1)` | `#!json "reading"` | - -The return value is a reference, so it can be modified by the original value. - -??? example - - ```cpp - j.at("name") = "John Smith"; - ``` - - This code produces the following JSON value: - - ```json - { - "name": "John Smith", - "age": 42, - "hobbies": ["hiking", "reading"] - } - ``` - -When accessing an invalid index (i.e., an index greater than or equal to the array size) or the passed object key is non-existing, an exception is thrown. - -??? example - - ```cpp - j.at("hobbies").at(3) = "cooking"; - ``` - - This code produces the following exception: - - ``` - [json.exception.out_of_range.401] array index 3 is out of range - ``` - -## Notes - - -!!! failure "Exceptions" - - - `at` can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a [`basic_json::type_error`](../../home/exceptions.md#jsonexceptiontype_error304) is thrown. - - [`basic_json::out_of_range` exception](../../home/exceptions.md#out-of-range) exceptions are thrown if the provided key is not found in an object or the provided index is invalid. - -## Summary - -| scenario | non-const value | const value | -|-----------------------------------|------------------------------------------------|------------------------------------------------| -| access to existing object key | reference to existing value is returned | const reference to existing value is returned | -| access to valid array index | reference to existing value is returned | const reference to existing value is returned | -| access to non-existing object key | `basic_json::out_of_range` exception is thrown | `basic_json::out_of_range` exception is thrown | -| access to invalid array index | `basic_json::out_of_range` exception is thrown | `basic_json::out_of_range` exception is thrown | diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/default_value.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/default_value.md deleted file mode 100644 index 02b4fea3..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/default_value.md +++ /dev/null @@ -1,32 +0,0 @@ -# Access with default value: value - -## Overview - -In many situations such as configuration files, missing values are not exceptional, but may be treated as if a default value was present. - -??? example - - Consider the following JSON value: - - ```json - { - "logOutput": "result.log", - "append": true - } - ``` - - Assume the value is parsed to a `json` variable `j`. - - | expression | value | - | ---------- | ----- | - | `#!cpp j` | `#!json {"logOutput": "result.log", "append": true}` | - | `#!cpp j.value("logOutput", "logfile.log")` | `#!json "result.log"` | - | `#!cpp j.value("append", true)` | `#!json true` | - | `#!cpp j.value("append", false)` | `#!json true` | - | `#!cpp j.value("logLevel", "verbose")` | `#!json "verbose"` | - -## Note - -!!! failure "Exceptions" - - - `value` can only be used with objects. For other types, a [`basic_json::type_error`](../../home/exceptions.md#jsonexceptiontype_error306) is thrown. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/index.md deleted file mode 100644 index 0b39547e..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/index.md +++ /dev/null @@ -1,9 +0,0 @@ -# Element Access - -There are many ways elements in a JSON value can be accessed: - -- unchecked access via [`operator[]`](unchecked_access.md) -- checked access via [`at`](checked_access.md) -- access with default value via [`value`](default_value.md) -- iterators -- JSON pointers diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/unchecked_access.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/unchecked_access.md deleted file mode 100644 index bb722877..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/element_access/unchecked_access.md +++ /dev/null @@ -1,102 +0,0 @@ -# Unchecked access: operator[] - -## Overview - -Elements in a JSON object and a JSON array can be accessed via `#!cpp operator[]` similar to a `#!cpp std::map` and a `#!cpp std::vector`, respectively. - -??? example - - Consider the following JSON value: - - ```json - { - "name": "Mary Smith", - "age": 42, - "hobbies": ["hiking", "reading"] - } - ``` - - Assume the value is parsed to a `json` variable `j`. - - | expression | value | - | ---------- | ----- | - | `#!cpp j` | `#!json {"name": "Mary Smith", "age": 42, "hobbies": ["hiking", "reading"]}` | - | `#!cpp j["name"]` | `#!json "Mary Smith"` | - | `#!cpp j["age"]` | `#!json 42` | - | `#!cpp j["hobbies"]` | `#!json ["hiking", "reading"]` | - | `#!cpp j["hobbies"][0]` | `#!json "hiking"` | - | `#!cpp j["hobbies"][1]` | `#!json "reading"` | - -The return value is a reference, so it can modify the original value. In case the passed object key is non-existing, a `#!json null` value is inserted which can be immediately be overwritten. - -??? example - - ```cpp - j["name"] = "John Smith"; - j["maidenName"] = "Jones"; - ``` - - This code produces the following JSON value: - - ```json - { - "name": "John Smith", - "maidenName": "Jones", - "age": 42, - "hobbies": ["hiking", "reading"] - } - ``` - -When accessing an invalid index (i.e., an index greater than or equal to the array size), the JSON array is resized such that the passed index is the new maximal index. Intermediate values are filled with `#!json null`. - -??? example - - ```cpp - j["hobbies"][0] = "running"; - j["hobbies"][3] = "cooking"; - ``` - - This code produces the following JSON value: - - ```json - { - "name": "John Smith", - "maidenName": "Jones", - "age": 42, - "hobbies": ["running", "reading", null, "cooking"] - } - ``` - -## Notes - -!!! info "Design rationale" - - The library behaves differently to `#!cpp std::vector` and `#!cpp std::map`: - - - `#!cpp std::vector::operator[]` never inserts a new element. - - `#!cpp std::map::operator[]` is not available for const values. - - The type `#!cpp json` wraps all JSON value types. It would be impossible to remove `operator[]` for const objects. At the same time, inserting elements for non-const objects is really convenient as it avoids awkward `insert` calls. To this end, we decided to have an inserting non-const behavior for both arrays and objects. - -!!! info - - The access is unchecked. In case the passed object key does not exist or the passed array index is invalid, no exception is thrown. - -!!! danger - - - It is **undefined behavior** to access a const object with a non-existing key. - - It is **undefined behavior** to access a const array with an invalid index. - - In debug mode, an **assertion** will fire in both cases. You can disable assertions by defining the preprocessor symbol `#!cpp NDEBUG` or redefine the macro [`JSON_ASSERT(x)`](../macros.md#json_assertx). - -!!! failure "Exceptions" - - `operator[]` can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a [`basic_json::type_error`](../../home/exceptions.md#jsonexceptiontype_error305) is thrown. - -## Summary - -| scenario | non-const value | const value | -|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------| -| access to existing object key | reference to existing value is returned | const reference to existing value is returned | -| access to valid array index | reference to existing value is returned | const reference to existing value is returned | -| access to non-existing object key | reference to newly inserted `#!json null` value is returned | **undefined behavior**; assertion in debug mode | -| access to invalid array index | reference to newly inserted `#!json null` value is returned; any index between previous maximal index and passed index are filled with `#!json null` | **undefined behavior**; assertion in debug mode | diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/enum_conversion.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/enum_conversion.md deleted file mode 100644 index 8f474a70..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/enum_conversion.md +++ /dev/null @@ -1,59 +0,0 @@ -# Specializing enum conversion - -By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an -enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be -undefined or a different enum value than was originally intended. - -It is possible to more precisely specify how a given enum is mapped to and from JSON as shown below: - -```cpp -// example enum type declaration -enum TaskState { - TS_STOPPED, - TS_RUNNING, - TS_COMPLETED, - TS_INVALID=-1, -}; - -// map TaskState values to JSON as strings -NLOHMANN_JSON_SERIALIZE_ENUM( TaskState, { - {TS_INVALID, nullptr}, - {TS_STOPPED, "stopped"}, - {TS_RUNNING, "running"}, - {TS_COMPLETED, "completed"}, -}) -``` - -The `NLOHMANN_JSON_SERIALIZE_ENUM()` macro declares a set of `to_json()` / `from_json()` functions for type `TaskState` -while avoiding repetition and boilerplate serialization code. - -## Usage - -```cpp -// enum to JSON as string -json j = TS_STOPPED; -assert(j == "stopped"); - -// json string to enum -json j3 = "running"; -assert(j3.get() == TS_RUNNING); - -// undefined json value to enum (where the first map entry above is the default) -json jPi = 3.14; -assert(jPi.get() == TS_INVALID ); -``` - -## Notes - -Just as in [Arbitrary Type Conversions](#arbitrary-types-conversions) above, - -- `NLOHMANN_JSON_SERIALIZE_ENUM()` MUST be declared in your enum type's namespace (which can be the global namespace), - or the library will not be able to locate it, and it will default to integer serialization. -- It MUST be available (e.g., proper headers must be included) everywhere you use the conversions. - -Other Important points: - -- When using `get()`, undefined JSON values will default to the first pair specified in your map. Select this - default pair carefully. -- If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the - map will be returned when converting to or from JSON. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/iterators.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/iterators.md deleted file mode 100644 index 46f28f18..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/iterators.md +++ /dev/null @@ -1,155 +0,0 @@ -# Iterators - -## Overview - -A `basic_json` value is a container and allows access via iterators. Depending on the value type, `basic_json` stores zero or more values. - -As for other containers, `begin()` returns an iterator to the first value and `end()` returns an iterator to the value following the last value. The latter iterator is a placeholder and cannot be dereferenced. In case of null values, empty arrays, or empty objects, `begin()` will return `end()`. - -![Illustration from cppreference.com](../images/range-begin-end.svg) - -### Iteration order for objects - -When iterating over objects, values are ordered with respect to the `object_comparator_t` type which defaults to `std::less`. See the [types documentation](types/index.md#key-order) for more information. - -??? example - - ```cpp - // create JSON object {"one": 1, "two": 2, "three": 3} - json j; - j["one"] = 1; - j["two"] = 2; - j["three"] = 3; - - for (auto it = j.begin(); it != j.end(); ++it) - { - std::cout << *it << std::endl; - } - ``` - - Output: - - ```json - 1 - 3 - 2 - ``` - - The reason for the order is the lexicographic ordering of the object keys "one", "three", "two". - -### Access object key during iteration - -The JSON iterators have two member functions, `key()` and `value()` to access the object key and stored value, respectively. When calling `key()` on a non-object iterator, an [invalid_iterator.207](../home/exceptions.md#jsonexceptioninvalid_iterator207) exception is thrown. - -??? example - - ```cpp - // create JSON object {"one": 1, "two": 2, "three": 3} - json j; - j["one"] = 1; - j["two"] = 2; - j["three"] = 3; - - for (auto it = j.begin(); it != j.end(); ++it) - { - std::cout << it.key() << " : " << it.value() << std::endl; - } - ``` - - Output: - - ```json - one : 1 - three : 3 - two : 2 - ``` - -### Range-based for loops - -C++11 allows using range-based for loops to iterate over a container. - -```cpp -for (auto it : j_object) -{ - // "it" is of type json::reference and has no key() member - std::cout << "value: " << it << '\n'; -} -``` - -For this reason, the `items()` function allows accessing `iterator::key()` and `iterator::value()` during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator. - -```cpp -for (auto& el : j_object.items()) -{ - std::cout << "key: " << el.key() << ", value:" << el.value() << '\n'; -} -``` - -The items() function also allows using structured bindings (C++17): - -```cpp -for (auto& [key, val] : j_object.items()) -{ - std::cout << "key: " << key << ", value:" << val << '\n'; -} -``` - -!!! note - - When iterating over an array, `key()` will return the index of the element as string. For primitive types (e.g., numbers), `key()` returns an empty string. - -!!! warning - - Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exceeds the iteration. See for more information. - -### Reverse iteration order - -`rbegin()` and `rend()` return iterators in the reverse sequence. - -![Illustration from cppreference.com](../images/range-rbegin-rend.svg) - -??? example - - ```cpp - json j = {1, 2, 3, 4}; - - for (auto it = j.begin(); it != j.end(); ++it) - { - std::cout << *it << std::endl; - } - ``` - - Output: - - ```json - 4 - 3 - 2 - 1 - ``` - -### Iterating strings and binary values - -Note that "value" means a JSON value in this setting, not values stored in the underlying containers. That is, `*begin()` returns the complete string or binary array and is also safe the underlying string or binary array is empty. - -??? example - - ```cpp - json j = "Hello, world"; - for (auto it = j.begin(); it != j.end(); ++it) - { - std::cout << *it << std::endl; - } - ``` - - Output: - - ```json - "Hello, world" - ``` - -## Iterator invalidation - -| Operations | invalidated iterators | -|------------|-----------------------| -| `clear` | all | diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/json_patch.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/json_patch.md deleted file mode 100644 index 88c731a2..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/json_patch.md +++ /dev/null @@ -1,47 +0,0 @@ -# JSON Patch and Diff - -## Patches - -JSON Patch ([RFC 6902](https://tools.ietf.org/html/rfc6902)) defines a JSON document structure for expressing a sequence -of operations to apply to a JSON document. With the `patch` function, a JSON Patch is applied to the current JSON value -by executing all operations from the patch. - -??? example - - The following code shows how a JSON patch is applied to a value. - - ```cpp - --8<-- "examples/patch.cpp" - ``` - - Output: - - ```json - --8<-- "examples/patch.output" - ``` - -## Diff - -The library can also calculate a JSON patch (i.e., a **diff**) given two JSON values. - -!!! success "Invariant" - - For two JSON values *source* and *target*, the following code yields always true: - - ```cüü - source.patch(diff(source, target)) == target; - ``` - -??? example - - The following code shows how a JSON patch is created as a diff for two JSON values. - - ```cpp - --8<-- "examples/diff.cpp" - ``` - - Output: - - ```json - --8<-- "examples/diff.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/json_pointer.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/json_pointer.md deleted file mode 100644 index 8f5d60ec..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/json_pointer.md +++ /dev/null @@ -1,19 +0,0 @@ -# JSON Pointer - -The library supports **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) as alternative means to address structured values. - -```cpp -// a JSON value -json j_original = R"({ - "baz": ["one", "two", "three"], - "foo": "bar" -})"_json; - -// access members with a JSON pointer (RFC 6901) -j_original["/baz/1"_json_pointer]; -// "two" -``` - -## See also - -- Class [`json_pointer`](../api/json_pointer/index.md) diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/macros.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/macros.md deleted file mode 100644 index d324a132..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/macros.md +++ /dev/null @@ -1,134 +0,0 @@ -# Supported Macros - -Some aspects of the library can be configured by defining preprocessor macros before including the `json.hpp` header. - -## `JSON_ASSERT(x)` - -The default value is `#!cpp assert(x)`. - -## `JSON_CATCH_USER(exception)` - -This macro overrides `#!cpp catch` calls inside the library. The argument is the type of the exception to catch. As of -version 3.8.0, the library only catches `std::out_of_range` exceptions internally to rethrow them as -[`json::out_of_range`](../home/exceptions.md#out-of-range) exceptions. The macro is always followed by a scope. - -See [Switch off exceptions](../home/exceptions.md#switch-off-exceptions) for an example. - -## `JSON_DIAGNOSTICS` - -This macro enables extended diagnostics for exception messages. Possible values are `1` to enable or `0` to disable -(default). - -When enabled, exception messages contain a [JSON Pointer](json_pointer.md) to the JSON value that triggered the -exception, see [Extended diagnostic messages](../home/exceptions.md#extended-diagnostic-messages) for an example. Note -that enabling this macro increases the size of every JSON value by one pointer and adds some runtime overhead. - -The diagnostics messages can also be controlled with the CMake option `JSON_Diagnostics` (`OFF` by default) which sets -`JSON_DIAGNOSTICS` accordingly. - -## `JSON_HAS_CPP_11`, `JSON_HAS_CPP_14`, `JSON_HAS_CPP_17`, `JSON_HAS_CPP_20` - -The library targets C++11, but also supports some features introduced in later C++ versions (e.g., `std::string_view` -support for C++17). For these new features, the library implements some preprocessor checks to determine the C++ -standard. By defining any of these symbols, the internal check is overridden and the provided C++ version is -unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and would be -detected incorrectly. - -## `JSON_HAS_FILESYSTEM`, `JSON_HAS_EXPERIMENTAL_FILESYSTEM` - -When compiling with C++17, the library provides conversions from and to `std::filesystem::path`. As compiler support -for filesystem is limited, the library tries to detect whether ``/`std::filesystem` (`JSON_HAS_FILESYSTEM`) -or ``/`std::experimental::filesystem` (`JSON_HAS_EXPERIMENTAL_FILESYSTEM`) should be used. -To override the built-in check, define `JSON_HAS_FILESYSTEM` or `JSON_HAS_EXPERIMENTAL_FILESYSTEM` to `1`. - -## `JSON_NOEXCEPTION` - -Exceptions can be switched off by defining the symbol `JSON_NOEXCEPTION`. When defining `JSON_NOEXCEPTION`, `#!cpp try` -is replaced by `#!cpp if (true)`, `#!cpp catch` is replaced by `#!cpp if (false)`, and `#!cpp throw` is replaced by -`#!cpp std::abort()`. - -The same effect is achieved by setting the compiler flag `-fno-exceptions`. - -Note the explanatory [`what()`](https://en.cppreference.com/w/cpp/error/exception/what) string of exceptions is not -available for MSVC if exceptions are disabled, see [#2824](https://github.com/nlohmann/json/discussions/2824). - -## `JSON_NO_IO` - -When defined, headers ``, ``, ``, ``, and `` are not included and parse functions -relying on these headers are excluded. This is relevant for environment where these I/O functions are disallowed for -security reasons (e.g., Intel Software Guard Extensions (SGX)). - -## `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK` - -When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to -use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used. - -## `JSON_THROW_USER(exception)` - -This macro overrides `#!cpp throw` calls inside the library. The argument is the exception to be thrown. Note that -`JSON_THROW_USER` should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield -undefined behavior. - -See [Switch off exceptions](../home/exceptions.md#switch-off-exceptions) for an example. - -## `JSON_TRY_USER` - -This macro overrides `#!cpp try` calls inside the library. It has no arguments and is always followed by a scope. - -See [Switch off exceptions](../home/exceptions.md#switch-off-exceptions) for an example. - -## `JSON_USE_IMPLICIT_CONVERSIONS` - -When defined to `0`, implicit conversions are switched off. By default, implicit conversions are switched on. - -??? example - - This is an example for an implicit conversion: - - ```cpp - json j = "Hello, world!"; - std::string s = j; - ``` - - When `JSON_USE_IMPLICIT_CONVERSIONS` is defined to `0`, the code above does no longer compile. Instead, it must be - written like this: - - ```cpp - json j = "Hello, world!"; - auto s = j.get(); - ``` - -Implicit conversions can also be controlled with the CMake option `JSON_ImplicitConversions` (`ON` by default) which -sets `JSON_USE_IMPLICIT_CONVERSIONS` accordingly. - -## `NLOHMANN_DEFINE_TYPE_INTRUSIVE(type, member...)` - -This macro can be used to simplify the serialization/deserialization of types if (1) want to use a JSON object as -serialization and (2) want to use the member variable names as object keys in that object. - -The macro is to be defined inside the class/struct to create code for. Unlike -[`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](#nlohmann_define_type_non_intrusivetype-member), it can access private members. -The first parameter is the name of the class/struct, and all remaining parameters name the members. - -See [Simplify your life with macros](arbitrary_types.md#simplify-your-life-with-macros) for an example. - -## `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(type, member...)` - -This macro can be used to simplify the serialization/deserialization of types if (1) want to use a JSON object as -serialization and (2) want to use the member variable names as object keys in that object. - -The macro is to be defined inside the namespace of the class/struct to create code for. Private members cannot be -accessed. Use [`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](#nlohmann_define_type_intrusivetype-member) in these scenarios. The -first parameter is the name of the class/struct, and all remaining parameters name the members. - -See [Simplify your life with macros](arbitrary_types.md#simplify-your-life-with-macros) for an example. - -## `NLOHMANN_JSON_SERIALIZE_ENUM(type, ...)` - -This macro simplifies the serialization/deserialization of enum types. See -[Specializing enum conversion](enum_conversion.md) for more information. - -## `NLOHMANN_JSON_VERSION_MAJOR`, `NLOHMANN_JSON_VERSION_MINOR`, `NLOHMANN_JSON_VERSION_PATCH` - -These macros are defined by the library and contain the version numbers according to -[Semantic Versioning 2.0.0](https://semver.org). diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/merge_patch.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/merge_patch.md deleted file mode 100644 index 84e0ab02..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/merge_patch.md +++ /dev/null @@ -1,20 +0,0 @@ -# JSON Merge Patch - -The library supports JSON Merge Patch ([RFC 7386](https://tools.ietf.org/html/rfc7386)) as a patch format. -The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value. - -Instead of using [JSON Pointer](json_pointer.md) to specify values to be manipulated, it describes the changes using a syntax that closely mimics the document being modified. - -??? example - - The following code shows how a JSON Merge Patch is applied to a JSON document. - - ```cpp - --8<-- "examples/merge_patch.cpp" - ``` - - Output: - - ```json - --8<-- "examples/merge_patch.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/object_order.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/object_order.md deleted file mode 100644 index 86bb253b..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/object_order.md +++ /dev/null @@ -1,67 +0,0 @@ -# Object Order - -The [JSON standard](https://tools.ietf.org/html/rfc8259.html) defines objects as "an unordered collection of zero or more name/value pairs". As such, an implementation does not need to preserve any specific order of object keys. - -The default type `nlohmann::json` uses a `std::map` to store JSON objects, and thus stores object keys **sorted alphabetically**. - -??? example - - ```cpp - #include - #include "json.hpp" - - using json = nlohmann::json; - - int main() - { - json j; - j["one"] = 1; - j["two"] = 2; - j["three"] = 3; - - std::cout << j.dump(2) << '\n'; - } - ``` - - Output: - - ```json - { - "one": 1, - "three": 3, - "two": 2 - } - ``` - -If you do want to preserve the **insertion order**, you can try the type [`nlohmann::ordered_json`](https://github.com/nlohmann/json/issues/2179). - -??? example - - ```cpp - #include - #include - - using ordered_json = nlohmann::ordered_json; - - int main() - { - ordered_json j; - j["one"] = 1; - j["two"] = 2; - j["three"] = 3; - - std::cout << j.dump(2) << '\n'; - } - ``` - - Output: - - ```json - { - "one": 1, - "two": 2, - "three": 3 - } - ``` - -Alternatively, you can use a more sophisticated ordered map like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) ([integration](https://github.com/nlohmann/json/issues/546#issuecomment-304447518)) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map) ([integration](https://github.com/nlohmann/json/issues/485#issuecomment-333652309)). diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/index.md deleted file mode 100644 index 29493520..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# Parsing - -!!! note - - This page is under construction. - -## Input - -## SAX vs. DOM parsing - -## Exceptions - -See [parsing and exceptions](parse_exceptions.md). diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/parse_exceptions.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/parse_exceptions.md deleted file mode 100644 index 879dab0d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/parse_exceptions.md +++ /dev/null @@ -1,114 +0,0 @@ -# Parsing and Exceptions - -When the input is not valid JSON, an exception of type [`parse_error`](../../home/exceptions.md#parse-errors) is thrown. This exception contains the position in the input where the error occurred, together with a diagnostic message and the last read input token. The exceptions page contains a [list of examples for parse error exceptions](../../home/exceptions.md#parse-errors). In case you process untrusted input, always enclose your code with a `#!cpp try`/`#!cpp catch` block, like - -```cpp -json j; -try -{ - j = json::parse(my_input); -} -catch (json::parse_error& ex) -{ - std::cerr << "parse error at byte " << ex.byte << std::endl; -} -``` - -In case exceptions are undesired or not supported by the environment, there are different ways to proceed: - - -## Switch off exceptions - -The `parse()` function accepts as last parameter a `#!cpp bool` variable `allow_exceptions` which controls whether an exception is thrown when a parse error occurs (`#!cpp true`, default) or whether a discarded value should be returned (`#!cpp false`). - -```cpp -json j = json::parse(my_input, nullptr, false); -if (j.is_discarded()) -{ - std::cerr << "parse error" << std::endl; -} -``` - -Note there is no diagnostic information available in this scenario. - -## Use accept() function - -Alternatively, function `accept()` can be used which does not return a `json` value, but a `#!cpp bool` indicating whether the input is valid JSON. - -```cpp -if (!json::accept(my_input)) -{ - std::cerr << "parse error" << std::endl; -} -``` - -Again, there is no diagnostic information available. - - -## User-defined SAX interface - -Finally, you can implement the [SAX interface](sax_interface.md) and decide what should happen in case of a parse error. - -This function has the following interface: - -```cpp -bool parse_error(std::size_t position, - const std::string& last_token, - const json::exception& ex); -``` - -The return value indicates whether the parsing should continue, so the function should usually return `#!cpp false`. - -??? example - - ```cpp - #include - #include "json.hpp" - - using json = nlohmann::json; - - class sax_no_exception : public nlohmann::detail::json_sax_dom_parser - { - public: - sax_no_exception(json& j) - : nlohmann::detail::json_sax_dom_parser(j, false) - {} - - bool parse_error(std::size_t position, - const std::string& last_token, - const json::exception& ex) - { - std::cerr << "parse error at input byte " << position << "\n" - << ex.what() << "\n" - << "last read: \"" << last_token << "\"" - << std::endl; - return false; - } - }; - - int main() - { - std::string myinput = "[1,2,3,]"; - - json result; - sax_no_exception sax(result); - - bool parse_result = json::sax_parse(myinput, &sax); - if (!parse_result) - { - std::cerr << "parsing unsuccessful!" << std::endl; - } - - std::cout << "parsed value: " << result << std::endl; - } - ``` - - Output: - - ``` - parse error at input byte 8 - [json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected ']'; expected '[', '{', or a literal - last read: "3,]" - parsing unsuccessful! - parsed value: [1,2,3] - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/parser_callbacks.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/parser_callbacks.md deleted file mode 100644 index 12136f57..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/parser_callbacks.md +++ /dev/null @@ -1,79 +0,0 @@ -# Parser Callbacks - -## Overview - -With a parser callback function, the result of parsing a JSON text can be influenced. When passed to `parse`, it is called on certain events -(passed as `parse_event_t` via parameter `event`) with a set recursion depth `depth` and context JSON value `parsed`. The return value of the -callback function is a boolean indicating whether the element that emitted the callback shall be kept or not. - -The type of the callback function is: - -```cpp -template -using parser_callback_t = - std::function; -``` - - -## Callback event types - -We distinguish six scenarios (determined by the event type) in which the callback function can be called. The following table describes the values -of the parameters `depth`, `event`, and `parsed`. - -| parameter `event` | description | parameter `depth` | parameter `parsed` | -|-------------------------------|-----------------------------------------------------------|-------------------------------------------|----------------------------------| -| `parse_event_t::object_start` | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded | -| `parse_event_t::key` | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key | -| `parse_event_t::object_end` | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object | -| `parse_event_t::array_start` | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded | -| `parse_event_t::array_end` | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array | -| `parse_event_t::value` | the parser finished reading a JSON value | depth of the value | the parsed JSON value | - -??? example - - When parsing the following JSON text, - - ```json - { - "name": "Berlin", - "location": [ - 52.519444, - 13.406667 - ] - } - ``` - - these calls are made to the callback function: - - | event | depth | parsed | - | -------------- | ----- | ------ | - | `object_start` | 0 | *discarded* | - | `key` | 1 | `#!json "name"` | - | `value` | 1 | `#!json "Berlin"` | - | `key` | 1 | `#!json "location"` | - | `array_start` | 1 | *discarded* | - | `value` | 2 | `#!json 52.519444` | - | `value` | 2 | `#!json 13.406667` | - | `array_end` | 1 | `#!json [52.519444,13.406667]` | - | `object_end` | 0 | `#!json {"location":[52.519444,13.406667],"name":"Berlin"}` | - -## Return value - -Discarding a value (i.e., returning `#!c false`) has different effects depending on the context in which function was called: - -- Discarded values in structured types are skipped. That is, the parser will behave as if the discarded value was never read. -- In case a value outside a structured type is skipped, it is replaced with `#!json null`. This case happens if the top-level element is skipped. - -??? example - - The example below demonstrates the `parse()` function with and without callback function. - - ```cpp - --8<-- "examples/parse__string__parser_callback_t.cpp" - ``` - - Output: - - ```json - --8<-- "examples/parse__string__parser_callback_t.output" - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/sax_interface.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/sax_interface.md deleted file mode 100644 index 0796a55f..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/parsing/sax_interface.md +++ /dev/null @@ -1,73 +0,0 @@ -# SAX Interface - -The library uses a SAX-like interface with the following functions: - -```plantuml -interface json::sax_t { - + {abstract} bool null() - - + {abstract} bool boolean(bool val) - - + {abstract} bool number_integer(number_integer_t val) - + {abstract} bool number_unsigned(number_unsigned_t val) - - + {abstract} bool number_float(number_float_t val, const string_t& s) - - + {abstract} bool string(string_t& val) - + {abstract} bool binary(binary_t& val) - - + {abstract} bool start_object(std::size_t elements) - + {abstract} bool end_object() - + {abstract} bool start_array(std::size_t elements) - + {abstract} bool end_array() - + {abstract} bool key(string_t& val) - - + {abstract} bool parse_error(std::size_t position, const std::string& last_token, const json::exception& ex) -} -``` - -```cpp -// called when null is parsed -bool null(); - -// called when a boolean is parsed; value is passed -bool boolean(bool val); - -// called when a signed or unsigned integer number is parsed; value is passed -bool number_integer(number_integer_t val); -bool number_unsigned(number_unsigned_t val); - -// called when a floating-point number is parsed; value and original string is passed -bool number_float(number_float_t val, const string_t& s); - -// called when a string is parsed; value is passed and can be safely moved away -bool string(string_t& val); -// called when a binary value is parsed; value is passed and can be safely moved away -bool binary(binary& val); - -// called when an object or array begins or ends, resp. The number of elements is passed (or -1 if not known) -bool start_object(std::size_t elements); -bool end_object(); -bool start_array(std::size_t elements); -bool end_array(); -// called when an object key is parsed; value is passed and can be safely moved away -bool key(string_t& val); - -// called when a parse error occurs; byte position, the last token, and an exception is passed -bool parse_error(std::size_t position, const std::string& last_token, const json::exception& ex); -``` - -The return value of each function determines whether parsing should proceed. - -To implement your own SAX handler, proceed as follows: - -1. Implement the SAX interface in a class. You can use class `nlohmann::json_sax` as base class, but you can also use any class where the functions described above are implemented and public. -2. Create an object of your SAX interface class, e.g. `my_sax`. -3. Call `#!cpp bool json::sax_parse(input, &my_sax);` where the first parameter can be any input like a string or an input stream and the second parameter is a pointer to your SAX interface. - -Note the `sax_parse` function only returns a `#!cpp bool` indicating the result of the last executed SAX event. It does not return `json` value - it is up to you to decide what to do with the SAX events. Furthermore, no exceptions are thrown in case of a parse error - it is up to you what to do with the exception object passed to your `parse_error` implementation. Internally, the SAX interface is used for the DOM parser (class `json_sax_dom_parser`) as well as the acceptor (`json_sax_acceptor`), see file `json_sax.hpp`. - -## See also - -- [json_sax](../../api/json_sax/index.md) - documentation of the SAX interface -- [sax_parse](../../api/basic_json/sax_parse.md) - SAX parser diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/types/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/types/index.md deleted file mode 100644 index d9dfcc29..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/types/index.md +++ /dev/null @@ -1,269 +0,0 @@ -# Types - -This page gives an overview how JSON values are stored and how this can be configured. - -## Overview - -By default, JSON values are stored as follows: - -| JSON type | C++ type | -|-----------|-----------------------------------------------| -| object | `std::map` | -| array | `std::vector` | -| null | `std::nullptr_t` | -| string | `std::string` | -| boolean | `bool` | -| number | `std::int64_t`, `std::uint64_t`, and `double` | - -Note there are three different types for numbers - when parsing JSON text, the best fitting type is chosen. - -## Storage - -```plantuml -enum value_t { - null - object - array - string - boolean - number_integer - number_unsigned - number_float - binary - discarded -} - -class json_value << (U,orchid) >> { - object_t* object - array_t* array - string_t* string - binary_t* binary - boolean_t boolean - number_integer_t number_integer - number_unsigned_t number_unsigned - number_float_t number_float -} - -class basic_json { - -- type and value -- - value_t m_type - json_value m_value - -- derived types -- - + typedef object_t - + typedef array_t - + typedef binary_t - + typedef boolean_t - + typedef number_integer_t - + typedef number_unsigned_t - + typedef number_float_t -} - -basic_json .. json_value -basic_json .. value_t -``` - -## Template arguments - -The data types to store a JSON value are derived from the template arguments passed to class `basic_json`: - -```cpp -template< - template class ObjectType = std::map, - template class ArrayType = std::vector, - class StringType = std::string, - class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = adl_serializer, - class BinaryType = std::vector -> -class basic_json; -``` - -Type `json` is an alias for `basic_json<>` and uses the default types. - -From the template arguments, the following types are derived: - -```cpp -using object_comparator_t = std::less<>; -using object_t = ObjectType>>; - -using array_t = ArrayType>; - -using string_t = StringType; - -using boolean_t = BooleanType; - -using number_integer_t = NumberIntegerType; -using number_unsigned_t = NumberUnsignedType; -using number_float_t = NumberFloatType; - -using binary_t = nlohmann::byte_container_with_subtype; -``` - - -## Objects - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON objects as follows: - -> An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array. - -### Default type - -With the default values for *ObjectType* (`std::map`), *StringType* (`std::string`), and *AllocatorType* (`std::allocator`), the default value for `object_t` is: - -```cpp -std::map< - std::string, // key_type - basic_json, // value_type - std::less<>, // key_compare - std::allocator> // allocator_type -> -``` - -### Behavior - -The choice of `object_t` influences the behavior of the JSON class. With the default type, objects have the following behavior: - -- When all names are unique, objects will be interoperable in the sense that all software implementations receiving that object will agree on the name-value mappings. -- When the names within an object are not unique, it is unspecified which one of the values for a given key will be chosen. For instance, `#!json {"key": 2, "key": 1}` could be equal to either `#!json {"key": 1}` or `#!json {"key": 2}`. -- Internally, name/value pairs are stored in lexicographical order of the names. Objects will also be serialized (see `dump`) in this order. For instance, both `#!json {"b": 1, "a": 2}` and `#!json {"a": 2, "b": 1}` will be stored and serialized as `#!json {"a": 2, "b": 1}`. -- When comparing objects, the order of the name/value pairs is irrelevant. This makes objects interoperable in the sense that they will not be affected by these differences. For instance, `#!json {"b": 1, "a": 2}` and `#!json {"a": 2, "b": 1}` will be treated as equal. - -### Key order - -The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to [RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON objects. - -### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: - -> An implementation may set limits on the maximum depth of nesting. - -In this class, the object's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the `max_size` function of a JSON object. - -### Storage - -Objects are stored as pointers in a `basic_json` type. That is, for any access to object values, a pointer of type `object_t*` must be dereferenced. - - -## Arrays - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON arrays as follows: - -> An array is an ordered sequence of zero or more values. - -### Default type - -With the default values for *ArrayType* (`std::vector`) and *AllocatorType* (`std::allocator`), the default value for `array_t` is: - -```cpp -std::vector< - basic_json, // value_type - std::allocator // allocator_type -> -``` - -### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: - -> An implementation may set limits on the maximum depth of nesting. - -In this class, the array's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the `max_size` function of a JSON array. - -### Storage - -Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of type `array_t*` must be dereferenced. - - -## Strings - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON strings as follows: - -> A string is a sequence of zero or more Unicode characters. - -Unicode values are split by the JSON class into byte-sized characters during deserialization. - -### Default type - -With the default values for *StringType* (`std::string`), the default value for `string_t` is `#!cpp std::string`. - -### Encoding - -Strings are stored in UTF-8 encoding. Therefore, functions like `std::string::size()` or `std::string::length()` return the number of **bytes** in the string rather than the number of characters or glyphs. - -### String comparison - -[RFC 8259](https://tools.ietf.org/html/rfc8259) states: - -> Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that `"a\\b"` and `"a\u005Cb"` are not equal. - -This implementation is interoperable as it does compare strings code unit by code unit. - -### Storage - -String values are stored as pointers in a `basic_json` type. That is, for any access to string values, a pointer of type `string_t*` must be dereferenced. - - -## Booleans - -[RFC 8259](https://tools.ietf.org/html/rfc8259) implicitly describes a boolean as a type which differentiates the two literals `true` and `false`. - -### Default type - -With the default values for *BooleanType* (`#!cpp bool`), the default value for `boolean_t` is `#!cpp bool`. - -### Storage - -Boolean values are stored directly inside a `basic_json` type. - -## Numbers - -See the [number handling](number_handling.md) article for a detailed discussion on how numbers are handled by this library. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) describes numbers as follows: - -> The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. - -This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, `number_integer_t`, `number_unsigned_t`, and `number_float_t` are used. - -### Default types - -With the default values for *NumberIntegerType* (`std::int64_t`), the default value for `number_integer_t` is `std::int64_t`. -With the default values for *NumberUnsignedType* (`std::uint64_t`), the default value for `number_unsigned_t` is `std::uint64_t`. -With the default values for *NumberFloatType* (`#!cpp double`), the default value for `number_float_t` is `#!cpp double`. - -### Default behavior - -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal `#!c 010` will be serialized to `#!c 8`. During deserialization, leading zeros yield an error. -- Not-a-number (NaN) values will be serialized to `#!json null`. - -### Limits - -[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: - -> An implementation may set limits on the range and precision of numbers. - -When the default type is used, the maximal integer number that can be stored is `#!c 9223372036854775807` (`INT64_MAX`) and the minimal integer number that can be stored is `#!c -9223372036854775808` (`INT64_MIN`). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as `number_unsigned_t` or `number_float_t`. - -When the default type is used, the maximal unsigned integer number that can be stored is `#!c 18446744073709551615` (`UINT64_MAX`) and the minimal integer number that can be stored is `#!c 0`. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as `number_integer_t` or `number_float_t`. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) further states: - -> Note that when such software is used, numbers that are integers and are in the range $[-2^{53}+1, 2^{53}-1]$ are interoperable in the sense that implementations will agree exactly on their numeric values. - -As this range is a subrange of the exactly supported range [`INT64_MIN`, `INT64_MAX`], this class's integer type is interoperable. - -[RFC 8259](https://tools.ietf.org/html/rfc8259) states: - -> This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754-2008 binary64 (double precision) numbers is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision. - -This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than `#!c -1.79769313486232e+308` and values greater than `#!c 1.79769313486232e+308` will be stored as NaN internally and be serialized to `#!json null`. - -### Storage - -Integer number values, unsigned integer number values, and floating-point number values are stored directly inside a `basic_json` type. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/types/number_handling.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/types/number_handling.md deleted file mode 100644 index dd650735..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/features/types/number_handling.md +++ /dev/null @@ -1,328 +0,0 @@ -# Number Handling - -This document describes how the library is handling numbers. - -## Background - -This section briefly summarizes how the JSON specification describes how numbers should be handled. - -### JSON number syntax - -JSON defines the syntax of numbers as follows: - -!!! quote "[RFC 8259](https://tools.ietf.org/html/rfc8259#section-6), Section 6" - - The representation of numbers is similar to that used in most - programming languages. A number is represented in base 10 using - decimal digits. It contains an integer component that may be - prefixed with an optional minus sign, which may be followed by a - fraction part and/or an exponent part. Leading zeros are not - allowed. - - A fraction part is a decimal point followed by one or more digits. - - An exponent part begins with the letter E in uppercase or lowercase, - which may be followed by a plus or minus sign. The E and optional - sign are followed by one or more digits. - -The following railroad diagram from [json.org](https://json.org) visualizes the number syntax: - -![Syntax for JSON numbers](../../images/json_syntax_number.png) - -### Number interoperability - -On number interoperability, the following remarks are made: - -!!! quote "[RFC 8259](https://tools.ietf.org/html/rfc8259#section-6), Section 6" - - This specification allows implementations to set limits on the range - and precision of numbers accepted. Since software that implements - IEEE 754 binary64 (double precision) numbers [IEEE754] is generally - available and widely used, good interoperability can be achieved by - implementations that expect no more precision or range than these - provide, in the sense that implementations will approximate JSON - numbers within the expected precision. A JSON number such as 1E400 - or 3.141592653589793238462643383279 may indicate potential - interoperability problems, since it suggests that the software that - created it expects receiving software to have greater capabilities - for numeric magnitude and precision than is widely available. - - Note that when such software is used, numbers that are integers and - are in the range $[-2^{53}+1, 2^{53}-1]$ are interoperable in the - sense that implementations will agree exactly on their numeric - values. - -## Library implementation - -This section describes how the above number specification is implemented by this library. - -### Number storage - -In the default [`json`](../../api/json.md) type, numbers are stored as `#!c std::uint64_t`, `#!c std::int64_t`, and -`#!c double`, respectively. Thereby, `#!c std::uint64_t` and `#!c std::int64_t` are used only if they can store the -number without loss of precision. If this is impossible (e.g., if the number is too large), the number is stored as -`#!c double`. - -!!! info "Notes" - - - Numbers with a decimal digit or scientific notation are always stored as `#!c double`. - - The number types can be changed, see [Template number types](#template-number-types). - - As of version 3.9.1, the conversion is realized by - [`std::strtoull`](https://en.cppreference.com/w/cpp/string/byte/strtoul), - [`std::strtoll`](https://en.cppreference.com/w/cpp/string/byte/strtol), and - [`std::strtod`](https://en.cppreference.com/w/cpp/string/byte/strtof), respectively. - -!!! example "Examples" - - - Integer `#!c -12345678912345789123456789` is smaller than `#!c INT64_MIN` and will be stored as floating-point - number `#!c -1.2345678912345788e+25`. - - Integer `#!c 1E3` will be stored as floating-point number `#!c 1000.0`. - -### Number limits - -- Any 64-bit signed or unsigned integer can be stored without loss of precision. -- Numbers exceeding the limits of `#!c double` (i.e., numbers that after conversion via -[`std::strtod`](https://en.cppreference.com/w/cpp/string/byte/strtof) are not satisfying -[`std::isfinite`](https://en.cppreference.com/w/cpp/numeric/math/isfinite) such as `#!c 1E400`) will throw exception -[`json.exception.out_of_range.406`](../../home/exceptions.md#jsonexceptionout_of_range406) during parsing. -- Floating-point numbers are rounded to the next number representable as `double`. For instance -`#!c 3.141592653589793238462643383279` is stored as [`0x400921fb54442d18`](https://float.exposed/0x400921fb54442d18). -This is the same behavior as the code `#!c double x = 3.141592653589793238462643383279;`. - -!!! success "Interoperability" - - - The library interoperable with respect to the specification, because its supported range $[-2^{63}, 2^{64}-1]$ is - larger than the described range $[-2^{53}+1, 2^{53}-1]$. - - All integers outside the range $[-2^{63}, 2^{64}-1]$, as well as floating-point numbers are stored as `double`. - This also concurs with the specification above. - -### Zeros - -The JSON number grammar allows for different ways to express zero, and this library will store zeros differently: - -| Literal | Stored value and type | Serialization | -|---------|------------------------|---------------| -| `0` | `#!c std::uint64_t(0)` | `0` | -| `-0` | `#!c std::int64_t(0)` | `0` | -| `0.0` | `#!c double(0.0)` | `0.0` | -| `-0.0` | `#!c double(-0.0)` | `-0.0` | -| `0E0` | `#!c double(0.0)` | `0.0` | -| `-0E0` | `#!c double(-0.0)` | `-0.0` | - -That is, `-0` is stored as a signed integer, but the serialization does not reproduce the `-`. - -### Number serialization - -- Integer numbers are serialized as is; that is, no scientific notation is used. -- Floating-point numbers are serialized as specified by the `#!c %g` printf modifier with - [`std::numeric_limits::max_digits10`](https://en.cppreference.com/w/cpp/types/numeric_limits/max_digits10) - significant digits. The rationale is to use the shortest representation while still allow round-tripping. - -!!! hint "Notes regarding precision of floating-point numbers" - - As described above, floating-point numbers are rounded to the nearest double and serialized with the shortest - representation to allow round-tripping. This can yield confusing examples: - - - The serialization can have fewer decimal places than the input: `#!c 2555.5599999999999` will be serialized as - `#!c 2555.56`. The reverse can also be true. - - The serialization can be in scientific notation even if the input is not: `#!c 0.0000972439793401814` will be - serialized as `#!c 9.72439793401814e-05`. The reverse can also be true: `#!c 12345E-5` will be serialized as - `#!c 0.12345`. - - Conversions from `#!c float` to `#!c double` can also introduce rounding errors: - ```cpp - float f = 0.3; - json j = f; - std::cout << j << '\n'; - ``` - yields `#!c 0.30000001192092896`. - - All examples here can be reproduced by passing the original double value to - - ```cpp - std::printf("%.*g\n", std::numeric_limits::max_digits10, double_value); - ``` - -#### NaN handling - -NaN (not-a-number) cannot be expressed with the number syntax described above and are in fact explicitly excluded: - -!!! quote "[RFC 8259](https://tools.ietf.org/html/rfc8259#section-6), Section 6" - - Numeric values that cannot be represented in the grammar below (such - as Infinity and NaN) are not permitted. - -That is, there is no way to *parse* a NaN value. However, NaN values can be stored in a JSON value by assignment. - -This library serializes NaN values as `#!js null`. This corresponds to the behavior of JavaScript's -[`JSON.stringify`](https://www.w3schools.com/js/js_json_stringify.asp) function. - -!!! example - - The following example shows how a NaN value is stored in a `json` value. - - ```cpp - int main() - { - double val = std::numeric_limits::quiet_NaN(); - std::cout << "val=" << val << std::endl; - json j = val; - std::cout << "j=" << j.dump() << std::endl; - val = j; - std::cout << "val=" << val << std::endl; - } - ``` - - output: - - ``` - val=nan - j=null - val=nan - ``` - -### Number comparison - -Floating-point inside JSON values numbers are compared with `#!c json::number_float_t::operator==` which is -`#!c double::operator==` by default. - -!!! example "Alternative comparison functions" - - To compare floating-point while respecting an epsilon, an alternative - [comparison function](https://github.com/mariokonrad/marnav/blob/master/include/marnav/math/floatingpoint.hpp#L34-#L39) - could be used, for instance - - ```cpp - template::value, T>::type> - inline bool is_same(T a, T b, T epsilon = std::numeric_limits::epsilon()) noexcept - { - return std::abs(a - b) <= epsilon; - } - ``` - Or you can self-define an operator equal function like this: - - ```cpp - bool my_equal(const_reference lhs, const_reference rhs) - { - const auto lhs_type lhs.type(); - const auto rhs_type rhs.type(); - if (lhs_type == rhs_type) - { - switch(lhs_type) - { - // self_defined case - case value_t::number_float: - return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); - - // other cases remain the same with the original - ... - } - } - ... - } - ``` - - (see [#703](https://github.com/nlohmann/json/issues/703) for more information.) - -!!! note - - NaN values never compare equal to themselves or to other NaN values. See [#514](https://github.com/nlohmann/json/issues/514). - -### Number conversion - -Just like the C++ language itself, the `get` family of functions allows conversions between unsigned and signed -integers, and between integers and floating-point values to integers. This behavior may be surprising. - -!!! warning "Unconditional number conversions" - - ```cpp hl_lines="3" - double d = 42.3; // non-integer double value 42.3 - json jd = d; // stores double value 42.3 - std::int64_t i = jd.get(); // now i==42; no warning or error is produced - ``` - - Note the last line with throw a [`json.exception.type_error.302`](../../home/exceptions.md#jsonexceptiontype_error302) - exception if `jd` is not a numerical type, for instance a string. - -The rationale is twofold: - -1. JSON does not define a number type or precision (see [#json-specification](above)). -2. C++ also allows to silently convert between number types. - -!!! success "Conditional number conversion" - - The code above can be solved by explicitly checking the nature of the value with members such as - [`is_number_integer()`](../../api/basic_json/is_number_integer.md) or - [`is_number_unsigned()`](../../api/basic_json/is_number_unsigned.md): - - ```cpp hl_lines="2" - // check if jd is really integer-valued - if (jd.is_number_integer()) - { - // if so, do the conversion and use i - std::int64_t i = jd.get(); - // ... - } - else - { - // otherwise, take appropriate action - // ... - } - ``` - - Note this approach also has the advantage that it can react on non-numerical JSON value types such as strings. - - (Example taken from [#777](https://github.com/nlohmann/json/issues/777#issuecomment-459968458).) - -### Determine number types - -As the example in [Number conversion](#number_conversion) shows, there are different functions to determine the type of -the stored number: - -- [`is_number()`](../../api/basic_json/is_number.md) returns `#!c true` for any number type -- [`is_number_integer()`](../../api/basic_json/is_number_integer.md) returns `#!c true` for signed and unsigned integers -- [`is_number_unsigned()`](../../api/basic_json/is_number_unsigned.md) returns `#!c true` for unsigned integers only -- [`is_number_float()`](../../api/basic_json/is_number_float.md) returns `#!c true` for floating-point numbers -- [`type_name()`](../../api/basic_json/type_name.md) returns `#!c "number"` for any number type -- [`type()`](../../api/basic_json/type.md) returns a different enumerator of - [`value_t`](../../api/basic_json/value_t.md) for all number types - -| function | unsigned integer | signed integer | floating-point | string | -|----------------------------------------------------------------------|-------------------|------------------|----------------|----------------| -| [`is_number()`](../../api/basic_json/is_number.md) | `#!c true` | `#!c true` | `#!c true` | `#!c false` | -| [`is_number_integer()`](../../api/basic_json/is_number_integer.md) | `#!c true` | `#!c true` | `#!c false` | `#!c false` | -| [`is_number_unsigned()`](../../api/basic_json/is_number_unsigned.md) | `#!c true` | `#!c false` | `#!c false` | `#!c false` | -| [`is_number_float()`](../../api/basic_json/is_number_float.md) | `#!c false` | `#!c false` | `#!c true` | `#!c false` | -| [`type_name()`](../../api/basic_json/type_name.md) | `#!c "number"` | `#!c "number"` | `#!c "number"` | `#!c "string"` | -| [`type()`](../../api/basic_json/type.md) | `number_unsigned` | `number_integer` | `number_float` | `string` | - -### Template number types - -The number types can be changed with template parameters. - -| position | number type | default type | possible values | -|----------|-------------------|---------------------|------------------------------------------------| -| 5 | signed integers | `#!c std::int64_t` | `#!c std::int32_t`, `#!c std::int16_t`, etc. | -| 6 | unsigned integers | `#!c std::uint64_t` | `#!c std::uint32_t`, `#!c std::uint16_t`, etc. | -| 7 | floating-point | `#!c double` | `#!c float`, `#!c long double` | - -!!! info "Constraints on number types" - - - The type for signed integers must be convertible from `#!c long long`. The type for floating-point numbers is used - in case of overflow. - - The type for unsigned integers must be convertible from `#!c unsigned long long`. The type for floating-point - numbers is used in case of overflow. - - The types for signed and unsigned integers must be distinct, see - [#2573](https://github.com/nlohmann/json/issues/2573). - - Only `#!c double`, `#!c float`, and `#!c long double` are supported for floating-point numbers. - -!!! example - - A `basic_json` type that uses `#!c long double` as floating-point type. - - ```cpp hl_lines="2" - using json_ld = nlohmann::basic_json; - ``` - - Note values should then be parsed with `json_ld::parse` rather than `json::parse` as the latter would parse - floating-point values to `#!c double` before then converting them to `#!c long double`. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/code_of_conduct.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/code_of_conduct.md deleted file mode 100644 index 770b8173..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/code_of_conduct.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@nlohmann.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/design_goals.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/design_goals.md deleted file mode 100644 index b80551fe..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/design_goals.md +++ /dev/null @@ -1,17 +0,0 @@ -# Design goals - -There are myriads of [JSON](https://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals: - -- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the [examples below](#examples), and you'll know what I mean. - -- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. - -- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/test/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](http://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289). - -Other aspects were not so important to us: - -- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs. - -- **Speed**. There are certainly [faster JSON libraries](https://github.com/miloyip/nativejson-benchmark#parsing-time) out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a `std::vector` or `std::map`, you are already set. - -See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/exceptions.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/exceptions.md deleted file mode 100644 index 1241926c..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/exceptions.md +++ /dev/null @@ -1,878 +0,0 @@ -# Exceptions - -## Overview - -### Base type - -All exceptions inherit from class `json::exception` (which in turn inherits from `std::exception`). It is used as the base class for all exceptions thrown by the `basic_json` class. This class can hence be used as "wildcard" to catch exceptions. - -```plantuml -std::exception <|-- json::exception -json::exception <|-- json::parse_error -json::exception <|-- json::invalid_iterator -json::exception <|-- json::type_error -json::exception <|-- json::out_of_range -json::exception <|-- json::other_error - -interface std::exception {} - -class json::exception { - + const int id - + const char* what() const -} - -class json::parse_error { - + const std::size_t byte -} -``` - -### Switch off exceptions - -Exceptions are used widely within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by `abort()` calls. You can further control this behavior by defining `JSON_THROW_USER` (overriding `#!cpp throw`), `JSON_TRY_USER` (overriding `#!cpp try`), and `JSON_CATCH_USER` (overriding `#!cpp catch`). - -Note that `JSON_THROW_USER` should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield undefined behavior. - -??? example - - The code below switches off exceptions and creates a log entry with a detailed error message in case of errors. - - ```cpp - #include - - #define JSON_TRY_USER if(true) - #define JSON_CATCH_USER(exception) if(false) - #define JSON_THROW_USER(exception) \ - {std::clog << "Error in " << __FILE__ << ":" << __LINE__ \ - << " (function " << __FUNCTION__ << ") - " \ - << (exception).what() << std::endl; \ - std::abort();} - - #include - ``` - -Note the explanatory [`what()`](https://en.cppreference.com/w/cpp/error/exception/what) string of exceptions is not available for MSVC if exceptions are disabled, see [#2824](https://github.com/nlohmann/json/discussions/2824). - -### Extended diagnostic messages - -Exceptions in the library are thrown in the local context of the JSON value they are detected. This makes detailed diagnostics messages, and hence debugging, difficult. - -??? example - - ```cpp - --8<-- "examples/diagnostics_standard.cpp" - ``` - - Output: - - ``` - --8<-- "examples/diagnostics_standard.output" - ``` - - This exception can be hard to debug if storing the value `#!c "12"` and accessing it is further apart. - -To create better diagnostics messages, each JSON value needs a pointer to its parent value such that a global context (i.e., a path from the root value to the value that lead to the exception) can be created. That global context is provided as [JSON Pointer](../features/json_pointer.md). - -As this global context comes at the price of storing one additional pointer per JSON value and runtime overhead to maintain the parent relation, extended diagnostics are disabled by default. They can, however, be enabled by defining the preprocessor symbol [`JSON_DIAGNOSTICS`](../features/macros.md#json_diagnostics) to `1` before including `json.hpp`. - -??? example - - ```cpp - --8<-- "examples/diagnostics_extended.cpp" - ``` - - Output: - - ``` - --8<-- "examples/diagnostics_extended.output" - ``` - - Now the exception message contains a JSON Pointer `/address/housenumber` that indicates which value has the wrong type. - - -## Parse errors - -This exception is thrown by the library when a parse error occurs. Parse errors -can occur during the deserialization of JSON text, CBOR, MessagePack, as well -as when using JSON Patch. - -Exceptions have ids 1xx. - -!!! info "Byte index" - - Member `byte` holds the byte index of the last read character in the input - file. - - For an input with n bytes, 1 is the index of the first character and n+1 - is the index of the terminating null byte or the end of file. This also - holds true when reading a byte vector (CBOR or MessagePack). - -??? example - - The following code shows how a `parse_error` exception can be caught. - - ```cpp - --8<-- "examples/parse_error.cpp" - ``` - - Output: - - ``` - --8<-- "examples/parse_error.output" - ``` - - -### json.exception.parse_error.101 - -This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member `byte` indicates the error position. - -!!! failure "Example message" - - Input ended prematurely: - - ``` - [json.exception.parse_error.101] parse error at 2: unexpected end of input; expected string literal - ``` - - No input: - - ``` - [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal - ``` - - Control character was not escaped: - - ``` - [json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0009 (HT) must be escaped to \u0009 or \\; last read: '"'" - ``` - - String was not closed: - - ``` - [json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: missing closing quote; last read: '"' - ``` - - Invalid number format: - - ``` - [json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1E' - ``` - - `\u` was not be followed by four hex digits: - - ``` - [json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing value - invalid string: '\u' must be followed by 4 hex digits; last read: '"\u01"' - ``` - - Invalid UTF-8 surrogate pair: - - ``` - [json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing value - invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF; last read: '"\uD7FF\uDC00'" - ``` - - Invalid UTF-8 byte: - - ``` - [json.exception.parse_error.101] parse error at line 3, column 24: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '"vous \352t' - ``` - -!!! tip - - - Make sure the input is correctly read. Try to write the input to standard output to check if, for instance, the input file was successfully opened. - - Paste the input to a JSON validator like or a tool like [jq](https://stedolan.github.io/jq/). - -### json.exception.parse_error.102 - -JSON uses the `\uxxxx` format to describe Unicode characters. Code points above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. - -!!! failure "Example message" - - ``` - parse error at 14: missing or wrong low surrogate - ``` - -!!! note - - This exception is not used any more. Instead [json.exception.parse_error.101](#jsonexceptionparse_error101) with a more detailed description is used. - -### json.exception.parse_error.103 - -Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. - -!!! failure "Example message" - - ``` - parse error: code points above 0x10FFFF are invalid - ``` - -!!! note - - This exception is not used any more. Instead [json.exception.parse_error.101](#jsonexceptionparse_error101) with a more detailed description is used. - -### json.exception.parse_error.104 - -[RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.104] parse error: JSON patch must be an array of objects - ``` - -### json.exception.parse_error.105 - -An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.105] parse error: operation 'add' must have member 'value' - ``` - ``` - [json.exception.parse_error.105] parse error: operation 'copy' must have string member 'from' - ``` - ``` - [json.exception.parse_error.105] parse error: operation value 'foo' is invalid - ``` - -### json.exception.parse_error.106 - -An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.106] parse error: array index '01' must not begin with '0' - ``` - -### json.exception.parse_error.107 - -A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'foo' - ``` - -### json.exception.parse_error.108 - -In a JSON Pointer, only `~0` and `~1` are valid escape sequences. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1' - ``` - -### json.exception.parse_error.109 - -A JSON Pointer array index must be a number. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.109] parse error: array index 'one' is not a number - ``` - ``` - [json.exception.parse_error.109] parse error: array index '+1' is not a number - ``` - -### json.exception.parse_error.110 - -When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.110] parse error at byte 5: syntax error while parsing CBOR string: unexpected end of input - ``` - ``` - [json.exception.parse_error.110] parse error at byte 2: syntax error while parsing UBJSON value: expected end of input; last byte: 0x5A - ``` - -### json.exception.parse_error.112 - -Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.112] parse error at byte 1: syntax error while parsing CBOR value: invalid byte: 0x1C - ``` - -### json.exception.parse_error.113 - -While parsing a map key, a value that is not a string has been read. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.113] parse error at byte 2: syntax error while parsing CBOR string: expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0xFF - ``` - ``` - [json.exception.parse_error.113] parse error at byte 2: syntax error while parsing MessagePack string: expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0xFF - ``` - ``` - [json.exception.parse_error.113] parse error at byte 2: syntax error while parsing UBJSON char: byte after 'C' must be in range 0x00..0x7F; last byte: 0x82 - ``` - -### json.exception.parse_error.114 - -The parsing of the corresponding BSON record type is not implemented (yet). - -!!! failure "Example message" - - ``` - [json.exception.parse_error.114] parse error at byte 5: Unsupported BSON record type 0xFF - ``` - -### json.exception.parse_error.115 - -A UBJSON high-precision number could not be parsed. - -!!! failure "Example message" - - ``` - [json.exception.parse_error.115] parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A - ``` - -## Iterator errors - -This exception is thrown if iterators passed to a library function do not match -the expected semantics. - -Exceptions have ids 2xx. - -??? example - - The following code shows how an `invalid_iterator` exception can be caught. - - ```cpp - --8<-- "examples/invalid_iterator.cpp" - ``` - - Output: - - ``` - --8<-- "examples/invalid_iterator.output" - ``` - -### json.exception.invalid_iterator.201 - -The iterators passed to constructor `basic_json(InputIT first, InputIT last)` are not compatible, meaning they do not belong to the same container. Therefore, the range (`first`, `last`) is invalid. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.201] iterators are not compatible - ``` - -### json.exception.invalid_iterator.202 - -In the [erase](../api/basic_json/erase.md) or insert function, the passed iterator `pos` does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.202] iterator does not fit current value - ``` - ``` - [json.exception.invalid_iterator.202] iterators first and last must point to objects - ``` - -### json.exception.invalid_iterator.203 - -Either iterator passed to function [`erase(IteratorType first, IteratorType last`)](../api/basic_json/erase.md) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.203] iterators do not fit current value - ``` - -### json.exception.invalid_iterator.204 - -When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an [erase](../api/basic_json/erase.md) function, this range has to be exactly (`begin(),` `end()),` because this is the only way the single stored value is expressed. All other ranges are invalid. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.204] iterators out of range - ``` - -### json.exception.invalid_iterator.205 - -When an iterator for a primitive type (number, boolean, or string) is passed to an [erase](../api/basic_json/erase.md) function, the iterator has to be the `begin()` iterator, because it is the only way to address the stored value. All other iterators are invalid. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.205] iterator out of range - ``` - -### json.exception.invalid_iterator.206 - -The iterators passed to constructor `basic_json(InputIT first, InputIT last)` belong to a JSON null value and hence to not define a valid range. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.206] cannot construct with iterators from null - ``` - -### json.exception.invalid_iterator.207 - -The `key()` member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.207] cannot use key() for non-object iterators - ``` - - -### json.exception.invalid_iterator.208 - -The `operator[]` to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.208] cannot use operator[] for object iterators - ``` - -### json.exception.invalid_iterator.209 - -The offset operators (`+`, `-`, `+=`, `-=`) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.209] cannot use offsets with object iterators - ``` - -### json.exception.invalid_iterator.210 - -The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (`first`, `last`) is invalid. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.210] iterators do not fit - ``` - -### json.exception.invalid_iterator.211 - -The iterator range passed to the insert function must not be a subrange of the container to insert to. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.211] passed iterators may not belong to container - ``` - -### json.exception.invalid_iterator.212 - -When two iterators are compared, they must belong to the same container. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.212] cannot compare iterators of different containers - ``` - -### json.exception.invalid_iterator.213 - -The order of object iterators cannot be compared, because JSON objects are unordered. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.213] cannot compare order of object iterators - ``` - -### json.exception.invalid_iterator.214 - -Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to `begin()`. - -!!! failure "Example message" - - ``` - [json.exception.invalid_iterator.214] cannot get value - ``` - -## Type errors - -This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type does not match the expected semantics. - -Exceptions have ids 3xx. - -??? example - - The following code shows how a `type_error` exception can be caught. - - ```cpp - --8<-- "examples/type_error.cpp" - ``` - - Output: - - ``` - --8<-- "examples/type_error.output" - ``` - -### json.exception.type_error.301 - -To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. - -!!! failure "Example message" - - ``` - [json.exception.type_error.301] cannot create object from initializer list - ``` - -### json.exception.type_error.302 - -During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.302] type must be object, but is null - ``` - ``` - [json.exception.type_error.302] type must be string, but is object - ``` - -### json.exception.type_error.303 - -To retrieve a reference to a value stored in a `basic_json` object with `get_ref`, the type of the reference must match the value type. For instance, for a JSON array, the `ReferenceType` must be `array_t &`. - -!!! failure "Example message" - - ``` - [json.exception.type_error.303] incompatible ReferenceType for get_ref, actual type is object - ``` - ``` - [json.exception.type_error.303] incompatible ReferenceType for get_ref, actual type is number" - ``` - -### json.exception.type_error.304 - -The `at()` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.304] cannot use at() with string - ``` - ``` - [json.exception.type_error.304] cannot use at() with number - ``` - -### json.exception.type_error.305 - -The `operator[]` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.305] cannot use operator[] with a string argument with array - ``` - ``` - [json.exception.type_error.305] cannot use operator[] with a numeric argument with object - ``` - -### json.exception.type_error.306 - -The `value()` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.306] cannot use value() with number - ``` - -### json.exception.type_error.307 - -The [`erase()`](../api/basic_json/erase.md) member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.307] cannot use erase() with string - ``` - -### json.exception.type_error.308 - -The `push_back()` and `operator+=` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.308] cannot use push_back() with string - ``` - -### json.exception.type_error.309 - -The `insert()` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.309] cannot use insert() with array - ``` - ``` - [json.exception.type_error.309] cannot use insert() with number - ``` - -### json.exception.type_error.310 - -The `swap()` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.310] cannot use swap() with number - ``` - -### json.exception.type_error.311 - -The `emplace()` and `emplace_back()` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.311] cannot use emplace() with number - ``` - ``` - [json.exception.type_error.311] cannot use emplace_back() with number - ``` - -### json.exception.type_error.312 - -The `update()` member functions can only be executed for certain JSON types. - -!!! failure "Example message" - - ``` - [json.exception.type_error.312] cannot use update() with array - ``` - -### json.exception.type_error.313 - -The `unflatten` function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well-defined. - -!!! failure "Example message" - - ``` - [json.exception.type_error.313] invalid value to unflatten - ``` - -### json.exception.type_error.314 - -The `unflatten` function only works for an object whose keys are JSON Pointers. - -!!! failure "Example message" - - Calling `unflatten()` on an array `#!json [1,2,3]`: - - ``` - [json.exception.type_error.314] only objects can be unflattened - ``` - -### json.exception.type_error.315 - -The `unflatten()` function only works for an object whose keys are JSON Pointers and whose values are primitive. - -!!! failure "Example message" - - Calling `unflatten()` on an object `#!json {"/1", [1,2,3]}`: - - ``` - [json.exception.type_error.315] values in object must be primitive - ``` - -### json.exception.type_error.316 - -The `dump()` function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. - -!!! failure "Example message" - - Calling `dump()` on a JSON value containing an ISO 8859-1 encoded string: - ``` - [json.exception.type_error.316] invalid UTF-8 byte at index 15: 0x6F - ``` - -!!! tip - - - Store the source file with UTF-8 encoding. - - Pass an error handler as last parameter to the `dump()` function to avoid this exception: - - `json::error_handler_t::replace` will replace invalid bytes sequences with `U+FFFD` - - `json::error_handler_t::ignore` will silently ignore invalid byte sequences - -### json.exception.type_error.317 - -The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) - -!!! failure "Example message" - - Serializing `#!json null` to BSON: - ``` - [json.exception.type_error.317] to serialize to BSON, top-level type must be object, but is null - ``` - Serializing `#!json [1,2,3]` to BSON: - ``` - [json.exception.type_error.317] to serialize to BSON, top-level type must be object, but is array - ``` - -!!! tip - - Encapsulate the JSON value in an object. That is, instead of serializing `#!json true`, serialize `#!json {"value": true}` - -## Out of range - -This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance in case of array indices or nonexisting object keys. - -Exceptions have ids 4xx. - -??? example - - The following code shows how an `out_of_range` exception can be caught. - - ```cpp - --8<-- "examples/out_of_range.cpp" - ``` - - Output: - - ``` - --8<-- "examples/out_of_range.output" - ``` - -### json.exception.out_of_range.401 - -The provided array index `i` is larger than `size-1`. - -!!! failure "Example message" - - ``` - array index 3 is out of range - ``` - -### json.exception.out_of_range.402 - -The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. - -!!! failure "Example message" - - ``` - array index '-' (3) is out of range - ``` - -### json.exception.out_of_range.403 - -The provided key was not found in the JSON object. - -!!! failure "Example message" - - ``` - key 'foo' not found - ``` - -### json.exception.out_of_range.404 - -A reference token in a JSON Pointer could not be resolved. - -!!! failure "Example message" - - ``` - unresolved reference token 'foo' - ``` - -### json.exception.out_of_range.405 - -The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. - -!!! failure "Example message" - - ``` - JSON pointer has no parent - ``` - -### json.exception.out_of_range.406 - -A parsed number could not be stored as without changing it to NaN or INF. - -!!! failure "Example message" - - ``` - number overflow parsing '10E1000' - ``` - -### json.exception.out_of_range.407 - -UBJSON and BSON only support integer numbers up to 9223372036854775807. - -!!! failure "Example message" - - ``` - number overflow serializing '9223372036854775808' - ``` - -!!! note - - Since version 3.9.0, integer numbers beyond int64 are serialized as high-precision UBJSON numbers, and this exception does not further occur. - -### json.exception.out_of_range.408 - -The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. - -!!! failure "Example message" - - ``` - excessive array size: 8658170730974374167 - ``` - -### json.exception.out_of_range.409 - -Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string. - -!!! failure "Example message" - - ``` - BSON key cannot contain code point U+0000 (at byte 2) - ``` - -## Further exceptions - -This exception is thrown in case of errors that cannot be classified with the -other exception types. - -Exceptions have ids 5xx. - -??? example - - The following code shows how an `other_error` exception can be caught. - - ```cpp - --8<-- "examples/other_error.cpp" - ``` - - Output: - - ``` - --8<-- "examples/other_error.output" - ``` - -### json.exception.other_error.501 - -A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. - -!!! failure "Example message" - - Executing `#!json {"op":"test", "path":"/baz", "value":"bar"}` on `#!json {"baz": "qux"}`: - - ``` - [json.exception.other_error.501] unsuccessful: {"op":"test","path":"/baz","value":"bar"} - ``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/faq.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/faq.md deleted file mode 100644 index c6a283bc..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/faq.md +++ /dev/null @@ -1,180 +0,0 @@ -# Frequently Asked Questions (FAQ) - -## Known bugs - -### Brace initialization yields arrays - -!!! question - - Why does - - ```cpp - json j{true}; - ``` - - and - - ```cpp - json j(true); - ``` - - yield different results (`#!json [true]` vs. `#!json true`)? - -This is a known issue, and -- even worse -- the behavior differs between GCC and Clang. The "culprit" for this is the library's constructor overloads for initializer lists to allow syntax like - -```cpp -json array = {1, 2, 3, 4}; -``` - -for arrays and - -```cpp -json object = {{"one", 1}, {"two", 2}}; -``` - -for objects. - -!!! tip - - To avoid any confusion and ensure portable code, **do not** use brace initialization with the types `basic_json`, `json`, or `ordered_json` unless you want to create an object or array as shown in the examples above. - -## Limitations - -### Relaxed parsing - -!!! question - - Can you add an option to ignore trailing commas? - -This library does not support any feature which would jeopardize interoperability. - - -### Parse errors reading non-ASCII characters - -!!! question "Questions" - - - Why is the parser complaining about a Chinese character? - - Does the library support Unicode? - - I get an exception `[json.exception.parse_error.101] parse error at line 1, column 53: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '"Testé$')"` - -The library supports **Unicode input** as follows: - -- Only **UTF-8** encoded input is supported which is the default encoding for JSON according to [RFC 8259](https://tools.ietf.org/html/rfc8259.html#section-8.1). -- `std::u16string` and `std::u32string` can be parsed, assuming UTF-16 and UTF-32 encoding, respectively. These encodings are not supported when reading from files or other input containers. -- Other encodings such as Latin-1 or ISO 8859-1 are **not** supported and will yield parse or serialization errors. -- [Unicode noncharacters](http://www.unicode.org/faq/private_use.html#nonchar1) will not be replaced by the library. -- Invalid surrogates (e.g., incomplete pairs such as `\uDEAD`) will yield parse errors. -- The strings stored in the library are UTF-8 encoded. When using the default string type (`std::string`), note that its length/size functions return the number of stored bytes rather than the number of characters or glyphs. -- When you store strings with different encodings in the library, calling [`dump()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a50ec80b02d0f3f51130d4abb5d1cfdc5.html#a50ec80b02d0f3f51130d4abb5d1cfdc5) may throw an exception unless `json::error_handler_t::replace` or `json::error_handler_t::ignore` are used as error handlers. - -In most cases, the parser is right to complain, because the input is not UTF-8 encoded. This is especially true for Microsoft Windows where Latin-1 or ISO 8859-1 is often the standard encoding. - - -### Wide string handling - -!!! question - - Why are wide strings (e.g., `std::wstring`) dumped as arrays of numbers? - -As described [above](#parse-errors-reading-non-ascii-characters), the library assumes UTF-8 as encoding. To store a wide string, you need to change the encoding. - -!!! example - - ```cpp - #include // codecvt_utf8 - #include // wstring_convert - - // encoding function - std::string to_utf8(std::wstring& wide_string) - { - static std::wstring_convert> utf8_conv; - return utf8_conv.to_bytes(wide_string); - } - - json j; - std::wstring ws = L"車B1234 こんにちは"; - - j["original"] = ws; - j["encoded"] = to_utf8(ws); - - std::cout << j << std::endl; - ``` - - The result is: - - ```json - { - "encoded": "車B1234 こんにちは", - "original": [36554, 66, 49, 50, 51, 52, 32, 12371, 12435, 12395, 12385, 12399] - } - ``` - -## Exceptions - -### Parsing without exceptions - -!!! question - - Is it possible to indicate a parse error without throwing an exception? - -Yes, see [Parsing and exceptions](../features/parsing/parse_exceptions.md). - - -### Key name in exceptions - -!!! question - - Can I get the key of the object item that caused an exception? - -Yes, you can. Please define the symbol [`JSON_DIAGNOSTICS`](../features/macros.md#json_diagnostics) to get [extended diagnostics messages](exceptions.md#extended-diagnostic-messages). - - -## Serialization issues - - -### Number precision - -!!! question - - - It seems that precision is lost when serializing a double. - - Can I change the precision for floating-point serialization? - -The library uses `std::numeric_limits::digits10` (15 for IEEE `double`s) digits for serialization. This value is sufficient to guarantee roundtripping. If one uses more than this number of digits of precision, then string -> value -> string is not guaranteed to round-trip. - -!!! quote "[cppreference.com](https://en.cppreference.com/w/cpp/types/numeric_limits/digits10)" - - The value of `std::numeric_limits::digits10` is the number of base-10 digits that can be represented by the type T without change, that is, any number with this many significant decimal digits can be converted to a value of type T and back to decimal form, without change due to rounding or overflow. - -!!! tip - - The website https://float.exposed gives a good insight into the internal storage of floating-point numbers. - -See [this section](../features/types/number_handling.md#number-serialization) on the library's number handling for more information. - -## Compilation issues - -### Android SDK - -!!! question - - Why does the code not compile with Android SDK? - -Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your `Application.mk`. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default. - -```ini -APP_STL := c++_shared -NDK_TOOLCHAIN_VERSION := clang3.6 -APP_CPPFLAGS += -frtti -fexceptions -``` - -The code compiles successfully with [Android NDK](https://developer.android.com/ndk/index.html?hl=ml), Revision 9 - 11 (and possibly later) and [CrystaX's Android NDK](https://www.crystax.net/en/android/ndk) version 10. - - -### Missing STL function - -!!! question "Questions" - - - Why do I get a compilation error `'to_string' is not a member of 'std'` (or similarly, for `strtod` or `strtof`)? - - Why does the code not compile with MinGW or Android SDK? - -This is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219). diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/license.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/license.md deleted file mode 100644 index baef2f51..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/license.md +++ /dev/null @@ -1,21 +0,0 @@ -# License - - - -The class is licensed under the [MIT License](https://opensource.org/licenses/MIT): - -Copyright © 2013-2022 [Niels Lohmann](https://nlohmann.me) - -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. - -* * * - -The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the [MIT License](https://opensource.org/licenses/MIT) (see above). Copyright © 2008-2009 [Björn Hoehrmann](http://bjoern.hoehrmann.de/) - -The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](https://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](https://florian.loitsch.com/) - -The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/releases.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/releases.md deleted file mode 100644 index 2cf5b3c6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/releases.md +++ /dev/null @@ -1,1225 +0,0 @@ -# Releases - -## v3.7.3 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip) (274 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.7.3/json.hpp) (791 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.7.3/json.hpp.asc) (1 KB) - -Release date: 2019-11-17 -SHA-256: 3b5d2b8f8282b80557091514d8ab97e27f9574336c804ee666fda673a9b59926 (json.hpp), 87b5884741427220d3a33df1363ae0e8b898099fbc59f1c451113f6732891014 (include.zip) - -### Summary - -This release fixes a bug introduced in release 3.7.2 which could yield quadratic complexity in destructor calls. All changes are backward-compatible. - -### :bug: Bug Fixes - -- Removed `reserve()` calls from the destructor which could lead to quadratic complexity. #1837 #1838 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - - -## v3.7.2 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.7.2/include.zip) (274 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.7.2/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.7.2/json.hpp) (791 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.7.2/json.hpp.asc) (1 KB) - -Release date: 2019-11-10 -SHA-256: 0a65fcbbe1b334d3f45c9498e5ee28c3f3b2428aea98557da4a3ff12f0f14ad6 (json.hpp), 67f69c9a93b7fa0612dc1b6273119d2c560317333581845f358aaa68bff8f087 (include.zip) - -### Summary - -Project [bad_json_parsers](https://github.com/lovasoa/bad_json_parsers) tested how JSON parser libraries react on **deeply nested inputs**. It turns out that this library segfaulted at a certain nesting depth. This bug was fixed with this release. **Now the parsing is only bounded by the available memory.** All changes are backward-compatible. - -### :bug: Bug Fixes - -* Fixed a bug that lead to stack overflow for deeply nested JSON values (objects, array) by changing the implementation of the destructor from a recursive to an iterative approach. #832, #1419, #1835 - -### :hammer: Further Changes - -* Added WhiteStone Bolt. #1830 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.7.1 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.7.1/include.zip) (273 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.7.1/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.7.1/json.hpp) (789 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.7.1/json.hpp.asc) (1 KB) - -Release date: 2019-11-06 -SHA-256: b5ba7228f3c22a882d379e93d08eab4349458ee16fbf45291347994eac7dc7ce (json.hpp), 77b9f54b34e7989e6f402afb516f7ff2830df551c3a36973085e2c7a6b1045fe (include.zip) - -### Summary - -This release fixes several small bugs in the library. All changes are backward-compatible. - -### :bug: Bug Fixes - -- Fixed a segmentation fault when serializing `std::int64_t` minimum value. #1708 #1722 -- Fixed the [`contains()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_ab23b04802eb9da97dc3f664e54e09cb3.html#ab23b04802eb9da97dc3f664e54e09cb3) function for JSON Pointers. #1727 #1741 -- Fixed too lax SFINAE guard for conversion from `std::pair` and `std::tuple` to `json`. #1805 #1806 #1825 #1826 -- Fixed some regressions detected by UBSAN. Updated CI to use Clang-Tidy 7.1.0. #1716 #1728 -- Fixed integer truncation in `iteration_proxy`. #1797 -- Updated [Hedley](https://github.com/nemequ/hedley) to v11 to [fix a E2512 error](https://github.com/nemequ/hedley/issues/28) in MSVC. #1799 -- Fixed a compile error in enum deserialization of non non-default-constructible types. #1647 #1821 -- Fixed the conversion from `json` to `std::valarray`. - -### :zap: Improvements - -- The [`items()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) function can now be used with a custom string type. #1765 -- Made [`json_pointer::back`](https://nlohmann.github.io/json/classnlohmann_1_1json__pointer_a213bc67c32a30c68ac6bf06f5195d482.html#a213bc67c32a30c68ac6bf06f5195d482) `const`. #1764 #1769 -- Meson is part of the release archive. #1672 #1694 -- Improved documentation on the Meson and Spack package manager. #1694 #1720 - -### :hammer: Further Changes - -- Added GitHub Workflow with `ubuntu-latest`/GCC 7.4.0 as CI step. -- Added GCC 9 to Travis CI to compile with C++20 support. #1724 -- Added MSVC 2019 to the AppVeyor CI. #1780 -- Added badge to [fuzzing status](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json). -- Fixed some cppcheck warnings. #1760 -- Fixed several typos in the documentation. #1720 #1767 #1803 -- Added documentation on the `JSON_THROW_USER`, `JSON_TRY_USER`, and `JSON_CATCH_USER` macros to control user-defined exception handling. -- Used GitHub's [CODEOWNERS](https://github.com/nlohmann/json/blob/develop/.github/CODEOWNERS) and [SECURITY](https://github.com/nlohmann/json/blob/develop/.github/SECURITY.md) feature. -- Removed `GLOB` from CMake files. #1779 -- Updated to [Doctest](https://github.com/onqtam/doctest) 2.3.5. - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.7.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.7.0/include.zip) (143 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.7.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.7.0/json.hpp) (782 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.7.0/json.hpp.asc) (1 KB) - -Release date: 2019-07-28 -SHA-256: a503214947952b69f0062f572cb74c17582a495767446347ce2e452963fc2ca4 (json.hpp), 541c34438fd54182e9cdc68dd20c898d766713ad6d901fb2c6e28ff1f1e7c10d (include.zip) - -### Summary - -This release introduces a few convenience functions and performs a lot of house keeping (bug fixes and small improvements). All changes are backward-compatible. - -### :sparkles: New Features - -- Add overload of the **[`contains`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab23b04802eb9da97dc3f664e54e09cb3.html#ab23b04802eb9da97dc3f664e54e09cb3) function** to check if a JSON pointer is valid without throwing exceptions, just like its [counterpart for object keys](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9286acdc0578fc66e9346323e69fc0e3.html#a9286acdc0578fc66e9346323e69fc0e3). #1600 -- Add a function **[`to_string`](http://nlohmann.github.io/json/doxygen/namespacenlohmann_a6ce645a0b8717757e096a5b5773b7a16.html#a6ce645a0b8717757e096a5b5773b7a16)** to allow for generic conversion to strings. #916 #1585 -- Add **return value for the [`emplace_back`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_abf29131f898b05aad2c01a9c80e7a002.html#abf29131f898b05aad2c01a9c80e7a002) function**, returning a reference to the added element just like C++17 is [introducing this](https://en.cppreference.com/w/cpp/container/vector/emplace_back) for `std::vector`. #1609 -- Add info how to use the library with the **[pacman](https://wiki.archlinux.org/index.php/pacman) package manager** on MSYS2. #1670 - -### :bug: Bug Fixes - -- Fix an issue where typedefs with certain names yielded a compilation error. #1642 #1643 -- Fix a conversion to `std::string_view` in the unit tests. #1634 #1639 -- Fix MSVC Debug build. #1536 #1570 #1608 -- Fix [`get_to`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a65753c68f06639eda0d355f919564e01.html#a65753c68f06639eda0d355f919564e01) method to clear existing content before writing. #1511 #1555 -- Fix a `-Wc++17-extensions` warning. `nodiscard` attributes are now only used with Clang when `-std=c++17` is used. #1535 #1551 - -### :zap: Improvements - -- Switch from [Catch](https://github.com/philsquared/Catch) to **[doctest](https://github.com/onqtam/doctest)** for the unit tests which speeds up compilation and runtime of the 112,112,308 tests. -- Add an explicit section to the [README](https://github.com/nlohmann/json/blob/develop/README.md) about the **frequently addressed topics** [character encoding](https://github.com/nlohmann/json#character-encoding), [comments in JSON](https://github.com/nlohmann/json#comments-in-json), and the [order of object keys](https://github.com/nlohmann/json#order-of-object-keys). - -### :hammer: Further Changes - -- Use [`GNUInstallDirs`](https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html) to set library install directories. #1673 -- Fix links in the [README](https://github.com/nlohmann/json/blob/develop/README.md). #1620 #1621 #1622 #1623 #1625 -- Mention [`json` type](http://nlohmann.github.io/json/doxygen/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html#a2bfd99e845a2e5cd90aeaf1b1431f474) on the [documentation start page](http://nlohmann.github.io/json/doxygen/index.html). #1616 -- Complete documentation of [`value()` function](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_adcf8ca5079f5db993820bf50036bf45d.html#adcf8ca5079f5db993820bf50036bf45d) with respect to `type_error.302` exception. #1601 -- Fix links in the documentation. #1598 -- Add regression tests for MSVC. #1543 #1570 -- Use **[CircleCI](http://circleci.com)** for [continuous integration](https://circleci.com/gh/nlohmann/json). -- Use **[Doozer](https://doozer.io)** for [continuous integration](https://doozer.io/nlohmann/json) on Linux (CentOS, Raspbian, Fedora) -- Add tests to check each CMake flag (`JSON_BuildTests`, `JSON_Install`, `JSON_MultipleHeaders`, `JSON_Sanitizer`, `JSON_Valgrind`, `JSON_NoExceptions`, `JSON_Coverage`). -- Use [Hedley](https://nemequ.github.io/hedley/) to avoid re-inventing several compiler-agnostic feature macros like `JSON_DEPRECATED`, `JSON_NODISCARD`, `JSON_LIKELY`, `JSON_UNLIKELY`, `JSON_HAS_CPP_14`, or `JSON_HAS_CPP_17`. Functions taking or returning pointers are annotated accordingly when a pointer will not be null. -- Build and run tests on [AppVeyor](https://ci.appveyor.com/project/nlohmann/json) in DEBUG and RELEASE mode. - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.6.1 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip) (136 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.6.1/json.hpp) (711 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.6.1/json.hpp.asc) (1 KB) - -Release date: 2019-03-20 -SHA-256: d2eeb25d2e95bffeb08ebb7704cdffd2e8fca7113eba9a0b38d60a5c391ea09a (json.hpp), 69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf (include.zip) - -### Summary - -This release **fixes a regression and a bug** introduced by the earlier 3.6.0 release. All changes are backward-compatible. - -### :bug: Bug Fixes - -- Fixed regression of #590 which could lead to compilation errors with GCC 7 and GCC 8. #1530 -- Fixed a compilation error when `` was included. #1531 - -### :hammer: Further Changes - -- Fixed a warning for missing field initializers. #1527 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.6.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.6.0/include.zip) (136 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.6.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.6.0/json.hpp) (711 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.6.0/json.hpp.asc) (1 KB) - -Release date: 2019-03-20 -SHA-256: ce9839370f28094c71107c405affb3b08c4a098154988014cbb0800b1c44a831 (json.hpp), 237c5e66e7f8186a02804ce9dbd5f69ce89fe7424ef84adf6142e973bd9532f4 (include.zip) - -ℹ️ **This release introduced a regression. Please update to [version 3.6.1](https://github.com/nlohmann/json/releases/tag/v3.6.1)!** - -### Summary - -This release adds some **convenience functions for JSON Pointers**, introduces a [`contains`]( -http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a0a45fc740637123fdf05fef970f8be47.html#a0a45fc740637123fdf05fef970f8be47) function to check if a key is present in an object, and improves the **performance of integer serialization**. Furthermore, a lot of small bug fixes and improvements have been made. All changes are backward-compatible. - -### :sparkles: New Features - -- Overworked the public interface for JSON Pointers. The creation of JSON Pointers is simplified with [`operator/`]( -http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_a90a11fe6c7f37b1746a3ff9cb24b0d53.html#a90a11fe6c7f37b1746a3ff9cb24b0d53) and [`operator/=`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_a7395bd0af29ac23fd3f21543c935cdfa.html#a7395bd0af29ac23fd3f21543c935cdfa). JSON Pointers can be inspected with [`empty`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_a649252bda4a2e75a0915b11a25d8bcc3.html#a649252bda4a2e75a0915b11a25d8bcc3), [`back`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_a6bd5b554c10f15672135c216893eef31.html#a6bd5b554c10f15672135c216893eef31), and [`parent_pointer`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_afdaacce1edb7145e0434e014f0e8685a.html#afdaacce1edb7145e0434e014f0e8685a), and manipulated with [`push_back`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_a697d12b5bd6205f8866691b166b7c7dc.html#a697d12b5bd6205f8866691b166b7c7dc) and [`pop_back`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1json__pointer_a4b1ee4d511ca195bed896a3da47e264c.html#a4b1ee4d511ca195bed896a3da47e264c). #1434 -- Added a boolean method [`contains`]( -http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a0a45fc740637123fdf05fef970f8be47.html#a0a45fc740637123fdf05fef970f8be47) to check whether an element exists in a JSON object with a given key. Returns false when called on non-object types. #1471 #1474 - -### :bug: Bug Fixes - -- Fixed a compilation issues with libc 2.12. #1483 #1514 -- Fixed endian conversion on PPC64. #1489 -- Fixed library to compile with GCC 9. #1472 #1492 -- Fixed a compilation issue with GCC 7 on CentOS. #1496 -- Fixed an integer overflow. #1447 -- Fixed buffer flushing in serializer. #1445 #1446 - -### :zap: Improvements - -- The performance of dumping integers has been greatly improved. #1411 -- Added CMake parameter `JSON_Install` to control whether the library should be installed (default: on). #1330 -- Fixed a lot of compiler and linter warnings. #1400 #1435 #1502 -- Reduced required CMake version from 3.8 to 3.1. #1409 #1428 #1441 #1498 -- Added `nodiscard` attribute to `meta()`, `array()`, `object()`, `from_cbor`, `from_msgpack`, `from_ubjson`, `from_bson`, and `parse`. #1433 - -### :hammer: Further Changes - -- Added missing headers. #1500 -- Fixed typos and broken links in README. #1417 #1423 #1425 #1451 #1455 #1491 -- Fixed documentation of parse function. #1473 -- Suppressed warning that cannot be fixed inside the library. #1401 #1468 -- Imroved package manager suppert: - - Updated Buckaroo instructions. #1495 - - Improved Meson support. #1463 - - Added Conda package manager documentation. #1430 - - Added NuGet package manager documentation. #1132 -- Continuous Integration - - Removed unstable or deprecated Travis builders (Xcode 6.4 - 8.2) and added Xcode 10.1 builder. - - Added Clang 7 to Travis CI. - - Fixed AppVeyor x64 builds. #1374 #1414 -- Updated thirdparty libraries: - - Catch 1.12.0 -> 1.12.2 - - Google Benchmark 1.3.0 -> 1.4.1 - - Doxygen 1.8.15 -> 1.8.16 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.5.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.5.0/include.zip) (133 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.5.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.5.0/json.hpp) (693 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.5.0/json.hpp.asc) (1 KB) - -Release date: 2018-12-22 -SHA-256: 8a6dbf3bf01156f438d0ca7e78c2971bca50eec4ca6f0cf59adf3464c43bb9d5 (json.hpp), 3564da9c5b0cf2e032f97c69baedf10ddbc98030c337d0327a215ea72259ea21 (include.zip) - -### Summary - -This release introduces the support for **structured bindings** and reading from **`FILE*`**. Besides, a few bugs have been fixed. All changes are backward-compatible. - -### :sparkles: New Features - -- **Structured bindings** are now supported for JSON objects and arrays via the [`items()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) member function, so finally this code is possible: - ```cpp - for (auto& [key, val] : j.items()) { - std::cout << key << ':' << val << '\n'; - } - ``` - #1388 #1391 - -- Added support for **reading from `FILE*`** to support situations in which streams are nit available or would require too much RAM. #1370 #1392 - -### :bug: Bug Fixes - -- The `eofbit` was not set for input streams when the end of a stream was reached while parsing. #1340 #1343 -- Fixed a bug in the SAX parser for BSON arrays. - -### :zap: Improvements - -- Added support for Clang 5.0.1 (PS4 version). #1341 #1342 - -### :hammer: Further Changes - -- Added a warning for implicit conversions to the documentation: It is not recommended to use implicit conversions when reading **from** a JSON value. Details about this recommendation can be found [here](https://www.github.com/nlohmann/json/issues/958). #1363 -- Fixed typos in the documentation. #1329 #1380 #1382 -- Fixed a C4800 warning. #1364 -- Fixed a `-Wshadow` warning #1346 -- Wrapped `std::snprintf` calls to avoid error in MSVC. #1337 -- Added code to allow installation via Meson. #1345 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.4.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.4.0/include.zip) (132 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.4.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.4.0/json.hpp) (689 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.4.0/json.hpp.asc) (1 KB) - -Release date: 2018-10-30 -SHA-256: 63da6d1f22b2a7bb9e4ff7d6b255cf691a161ff49532dcc45d398a53e295835f (json.hpp), bfec46fc0cee01c509cf064d2254517e7fa80d1e7647fea37cf81d97c5682bdc (include.zip) - -### Summary - -This release introduces three new features: - -- **BSON (Binary JSON)** is next to CBOR, MessagePack, and UBJSON the fourth binary (de)serialization format supported by the library. -- **Adjustable error handlers for invalid Unicode** allows to specify the behavior when invalid byte sequences are serialized. -- **Simplified enum/JSON mapping** with a macro in case the default mapping to integers is not desired. - -Furthermore, some effort has been invested in improving the **parse error messages**. Besides, a few bugs have been fixed. All changes are backward-compatible. - -### :sparkles: New Features - -- The library can read and write a subset of **[BSON](http://bsonspec.org/) (Binary JSON)**. All data types known from JSON are supported, whereas other types more tied to MongoDB such as timestamps, object ids, or binary data are currently not implemented. See [the README](https://github.com/nlohmann/json#binary-formats-bson-cbor-messagepack-and-ubjson) for examples. #1244 #1320 -- The behavior when the library encounters an invalid Unicode sequence during serialization can now be controlled by defining one of three **Unicode error handlers**: (1) throw an exception (default behavior), (2) replace invalid sequences by the Unicode replacement character (U+FFFD), or (3) ignore/filter invalid sequences. See the [documentation of the `dump` function](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a50ec80b02d0f3f51130d4abb5d1cfdc5.html#a50ec80b02d0f3f51130d4abb5d1cfdc5) for examples. #1198 #1314 -- To easily specify a user-defined **enum/JSON mapping**, a macro `NLOHMANN_JSON_SERIALIZE_ENUM` has been introduced. See the [README section](https://github.com/nlohmann/json#specializing-enum-conversion) for more information. #1208 #1323 - -### :bug: Bug Fixes - -- fixed truncation #1286 #1315 -- fixed an issue with std::pair #1299 #1301 -- fixed an issue with std::variant #1292 #1294 -- fixed a bug in the JSON Pointer parser - -### :zap: Improvements - -- The **diagnosis messages for parse errors** have been improved: error messages now indicated line/column positions where possible (in addition to a byte count) and also the context in which the error occurred (e.g., "while parsing a JSON string"). Example: error `parse error at 2: syntax error - invalid string: control character must be escaped; last read: ''` is now reported as `parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0009 (HT) must be escaped to \u0009 or \t; last read: ''`. #1280 #1288 #1303 - -### :hammer: Further Changes - -- improved Meson documentation #1305 -- fixed some more linter warnings #1280 -- fixed Clang detection for third-party Google Benchmark library #1277 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.3.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.3.0/include.zip) (123 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.3.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.3.0/json.hpp) (635 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.3.0/json.hpp.asc) (1 KB) - -Release date: 2018-10-05 -SHA-256: f1327bb60c58757a3dd2b0c9c45d49503d571337681d950ec621f8374bcc14d4 (json.hpp), 9588d63557333aaa485e92221ec38014a85a6134e7486fe3441e0541a5a89576 (include.zip) - -### Summary - -This release adds support for **GCC 4.8**. Furthermore, it adds a function [**`get_to`**](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a8a3db7d78f74232d3a6fb8f1abf69709.html#a8a3db7d78f74232d3a6fb8f1abf69709) to write a JSON value to a passed reference. Another topic of this release was the **CMake support** which has been overworked and documented. - -Besides, a lot of bugs have been fixed and slight improvements have been made. All changes are backward-compatible. - -### :sparkles: New Features - -- The library can now also built with **GCC 4.8**. Though this compiler does not fully support C++11, it can successfully compile and run the test suite. Note that bug [57824](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824) in GCC 4.8 still forbids to use multiline raw strings in arguments to macros. #1257 -- Added new function [**`get_to`**](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a8a3db7d78f74232d3a6fb8f1abf69709.html#a8a3db7d78f74232d3a6fb8f1abf69709) to write a JSON value to a passed reference. The destination type is automatically derived which allows more succinct code compared to the `get` function. #1227 #1231 - -### :bug: Bug Fixes - -- Fixed a bug in the CMake file that made `target_link_libraries` to not properly include `nlohmann_json`. #1243 #1245 #1260 -- Fixed a warning in MSVC 2017 complaining about a constexpr if. #1204 #1268 #1272 -- Fixed a bug that prevented compilation with ICPC. #755 #1222 -- Improved the SFINAE correctness to fix a bug in the conversion operator. #1237 #1238 -- Fixed a `-Wctor-dtor-privacy` warning. #1224 -- Fixed a warning on a lambda in unevaluated context. #1225 #1230 -- Fixed a bug introduced in version 3.2.0 where defining `JSON_CATCH_USER` led to duplicate macro definition of `JSON_INTERNAL_CATCH`. #1213 #1214 -- Fixed a bug that prevented compilation with Clang 3.4.2 in RHEL 7. #1179 #1249 - -### :zap: Improvements - -- Added [documentation on CMake integration](https://github.com/nlohmann/json#cmake) of the library. #1270 -- Changed the CMake file to use `find_package(nlohmann_json)` without installing the library. #1202 -- Improved error messages in case `operator[]` is used with the wrong combination (json.exception.type_error.305) of JSON container type and argument type. Example: "cannot use operator[] with a string argument". #1220 #1221 -- Added a license and version information to the Meson build file. #1252 -- Removed static assertions to indicated missing `to_json` or `from_json` functions as such assertions do not play well with SFINAE. These assertions also led to problems with GMock. #960 #1212 #1228 -- The test suite now does not wait forever if run in a wrong directory and input files are not found. #1262 -- The test suite does not show deprecation warnings for deprecated functions which frequently led to confusion. #1271 - -### :hammer: Further Changes - -- GCC 4.8 and Xcode 10 were added to the [continuous integration suite](https://travis-ci.org/nlohmann/json) at Travis. -- Added [lgtm](https://lgtm.com/projects/g/nlohmann/json/context:cpp) checks to pull requests. -- Added tests for CMake integration. #1260 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - - -## v3.2.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.2.0/include.zip) (124 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.2.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.2.0/json.hpp) (636 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.2.0/json.hpp.asc) (1 KB) - -Release date: 2018-08-20 -SHA-256: ce6b5610a051ec6795fa11c33854abebb086f0fd67c311f5921c3c07f9531b44 (json.hpp), 35ee642558b90e2f9bc758995c4788c4b4d4dec54eef95fb8f38cb4d49c8fc7c (include.zip) - -### Summary - -This release introduces a [**SAX interface**](https://nlohmann.github.io/json/structnlohmann_1_1json__sax.html) to the library. While this may be a very special feature used by only few people, it allowed to unify all functions that consumed input and created some kind of JSON value. Internally, now all existing functions like `parse`, `accept`, `from_cbor`, `from_msgpack`, and `from_ubjson` use the SAX interface with different event processors. This allowed to separate the input processing from the value generation. Furthermore, throwing an exception in case of a parse error is now optional and up to the event processor. Finally, the JSON parser is now non-recursive (meaning it does not use the call stack, but `std::vector` to track the hierarchy of structured values) which allows to process nested input more efficiently. - -Furthermore, the library finally is able to parse from **wide string types**. This is the first step toward opening the library from UTF-8 to UTF-16 and UTF-32. - -This release further fixes several bugs in the library. All changes are backward-compatible. - -### :sparkles: New Features - -- added a parser with a **SAX interface** (#971, #1153) -- support to parse from **wide string types** `std::wstring`, `std::u16string`, and `std::u32string`; the input will be converted to UTF-8 (#1031) -- added support for **`std::string_view`** when using C++17 (#1028) -- allow to **roundtrip `std::map` and `std::unordered_map`** from JSON if key type is not convertible to string; in these cases, values are serialized to arrays of pairs (#1079, #1089, #1133, #1138) - -### :bug: Bug Fixes - -- allow to create `nullptr_t` from JSON allowing to properly roundtrip `null` values (#1169) -- allow compare user-defined string types (#1130) -- better support for algorithms using iterators from `items()` (#1045, #1134) -- added parameter to avoid compilation error with MSVC 2015 debug builds (#1114) -- re-added accidentally skipped unit tests (#1176) -- fixed MSVC issue with `std::swap` (#1168) - -### :zap: Improvements - -- `key()` function for iterators returns a const reference rather than a string copy (#1098) -- binary formats CBOR, MessagePack, and UBJSON now supports `float` as type for floating-point numbers (#1021) - -### :hammer: Further Changes - -- changed issue templates -- improved continuous integration: added builders for Xcode 9.3 and 9.4, added builders for GCC 8 and Clang 6, added builder for MinGW, added builders for MSVC targeting x86 -- required CMake version is now at least 3.8 (#1040) -- overworked CMake file wrt. packaging (#1048) -- added package managers: Spack (#1041) and CocoaPods (#1148) -- fixed Meson include directory (#1142) -- preprocessor macro `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK` can skip the rejection of unsupported compilers - use at your own risk! (#1128) -- preprocessor macro `JSON_INTERNAL_CATCH`/`JSON_INTERNAL_CATCH_USER` allows to control the behavior of exception handling inside the library (#1187) -- added note on `char` to JSON conversion -- added note how to send security-related issue via encrypted email -- removed dependency to `std::stringstream` (#1117) -- added SPDX-License-Identifier -- added updated JSON Parsing Test Suite, described in [Parsing JSON is a Minefield 💣](http://seriot.ch/parsing_json.php) -- updated to Catch 1.12.0 - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - - - -## v3.1.2 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.1.2/include.zip) (115 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.1.2/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.1.2/json.hpp) (582 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.1.2/json.hpp.asc) (1 KB) - -Release date: 2018-03-14 -SHA-256: fbdfec4b4cf63b3b565d09f87e6c3c183bdd45c5be1864d3fcb338f6f02c1733 (json.hpp), 495362ee1b9d03d9526ba9ccf1b4a9c37691abe3a642ddbced13e5778c16660c (include.zip) - -### Summary - -This release fixes several bugs in the library. All changes are backward-compatible. - -### :bug: Bug Fixes - -- Fixed a **memory leak** occurring in the parser callback (#1001). -- Different **specializations of `basic_json`** (e.g., using different template arguments for strings or objects) can now be used in assignments (#972, #977, #986). -- Fixed a logical error in an iterator range check (#992). - -### :zap: Improvements - -- The parser and the serialization now support **user-defined string types** (#1006, #1009). - -### :hammer: Further Changes - -- **[Clang Analyzer](http://clang-analyzer.llvm.org)** is now used as additional static analyzer; see `make clang_analyze`. -- Overworked [README](https://github.com/nlohmann/json/blob/develop/README.md) by adding links to the [documentation](https://nlohmann.github.io/json/) (#981). - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - - -## v3.1.1 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.1.1/include.zip) (114 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.1.1/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.1.1/json.hpp) (577 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.1.1/json.hpp.asc) (1 KB) - -Release date: 2018-02-13 -SHA-256: e14ce5e33d6a2daf748026bd4947f3d9686ca4cfd53d10c3da46a0a9aceb7f2e (json.hpp), fde771d4b9e4f222965c00758a2bdd627d04fb7b59e09b7f3d1965abdc848505 (include.zip) - -### Summary - -This release fixes several bugs in the library. All changes are backward-compatible. - -### :bug: Bug Fixes - -- Fixed parsing of **CBOR strings with indefinite length** (#961). Earlier versions of this library misinterpreted the CBOR standard and rejected input with the `0x7F` start byte. -- Fixed user-defined **conversion to vector type** (#924, #969). A wrong SFINAE check rejected code though a user-defined conversion was provided. -- Fixed documentation of the parser behavior for **objects with duplicate keys** (#963). The exact behavior is not specified by [RFC 8259](https://tools.ietf.org/html/rfc8259) and the library now also provides no guarantee which object key is stored. -- Added check to detect memory **overflow when parsing UBJSON containers** (#962). The optimized UBJSON format allowed for specifying an array with billions of `null` elements with a few bytes and the library did not check whether this size exceeded `max_size()`. - -### :hammer: Further Changes - -- [Code coverage](https://coveralls.io/github/nlohmann/json) is now calculated for the individual header files, allowing to find uncovered lines more quickly than by browsing through the single header version (#953, #957). -- A Makefile target `run_benchmarks` was added to quickly build and run the benchmark suite. -- The documentation was harmonized with respect to the header inclusion (#955). Now all examples and the README use `#include ` to allow for selecting `single_include` or `include` or whatever installation folder as include directory. -- Added note on how to use the library with the [cget](http://cget.readthedocs.io/en/latest/) package manager (#954). - -### :fire: Deprecated functions - -This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0): - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) are deprecated. Please use the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) instead. -- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.1.0 - -!!! summary "Files" - - - [include.zip](https://github.com/nlohmann/json/releases/download/v3.1.0/include.zip) (114 KB) - - [include.zip.asc](https://github.com/nlohmann/json/releases/download/v3.1.0/include.zip.asc) (1 KB) - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.1.0/json.hpp) (577 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.1.0/json.hpp.asc) (1 KB) - -Release date: 2018-02-01 -SHA-256: d40f614d10a6e4e4e80dca9463da905285f20e93116c36d97d4dc1aa63d10ba4 (json.hpp), 2b7234fca394d1e27b7e017117ed80b7518fafbb4f4c13a7c069624f6f924673 (include.zip) - -### Summary - -This release adds support for the [**UBJSON**](http://ubjson.org) format and [**JSON Merge Patch**](https://tools.ietf.org/html/rfc7386). It also contains some minor changes and bug fixes. All changes are backward-compatible. - -### :sparkles: New features - -- The library now supports [**UBJSON**](http://ubjson.org) (Universal Binary JSON Specification) as binary format to read and write JSON values space-efficiently. See the [documentation overview](https://github.com/nlohmann/json/blob/develop/doc/binary_formats.md) for a comparison of the different formats CBOR, MessagePack, and UBJSON. -- [**JSON Merge Patch**](https://tools.ietf.org/html/rfc7386) (RFC 7386) offers an intuitive means to describe patches between JSON values (#876, #877). See the documentation of [`merge_patch`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a0ec0cd19cce42ae6071f3cc6870ea295.html#a0ec0cd19cce42ae6071f3cc6870ea295) for more information. - -### :zap: Improvements - -- The library now uses the **Grisu2 algorithm** for printing floating-point numbers (based on the reference implementation by Florian Loitsch) which produces a short representation which is guaranteed to round-trip (#360, #935, #936). -- The **UTF-8 handling** was further simplified by using the decoder of Björn Hoehrmann in more scenarios. - -### :truck: Reorganization - -- Though the library is released as a single header, its development got more and more complicated. With this release, the header is **split into several files** and the single-header file `json.hpp` can be generated from these development sources. In the repository, folder `include` contains the development sources and `single_include` contains the single `json.hpp` header (#700, #906, #907, #910, #911, #915, #920, #924, #925, #928, #944). -- The split further allowed for a **forward declaration header** `include/nlohmann/json_fwd.hpp` to speed up compilation times (#314). - -### :hammer: Further changes - -- [Google Benchmark](https://github.com/google/benchmark) is now used for micro benchmarks (see `benchmarks` folder, #921). -- The serialization (JSON and binary formats) now properly work with the libraries string template parameter, allowing for optimized string implementations to be used in constraint environments such as embedded software (#941, #950). -- The exceptional behavior can now be overridden by defining macros `JSON_THROW_USER`, `JSON_TRY_USER`, and `JSON_CATCH_USER`, defining the behavior of `throw`, `try` and `catch`, respectively. This allows to switch off C++'s exception mechanism yet still execute user-defined code in case an error condition occurs (#938). -- To facilitate the interplay with [flex](https://github.com/westes/flex) and [Bison](https://www.gnu.org/software/bison/), the library does not use the variable name `yytext` any more as it could clash with macro definitions (#933). -- The library now defines `NLOHMANN_JSON_VERSION_MAJOR`, `NLOHMANN_JSON_VERSION_MINOR`, and `NLOHMANN_JSON_VERSION_PATCH` to allow for conditional compilation based on the included library version (#943, #948). -- A compilation error with ICC has been fixed (#947). -- Typos and links in the documentation have been fixed (#900, #930). -- A compiler error related to incomplete types has been fixed (#919). -- The tests form the [UTF-8 decoder stress test](http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt) have been added to the test suite. - -### :fire: Deprecated functions - -- Function [`iterator_wrapper`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e) has been deprecated (#874). Since its introduction, the name was up for discussion, as it was too technical. We now introduced the member function [`items()`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd) with the same semantics. `iterator_wrapper` will be removed in the next major version (i.e., 4.0.0). - -Furthermore, the following functions are deprecated since version 3.0.0 and will be removed in the next major version (i.e., 4.0.0): - -- [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) -- [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) - -Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.0.1 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.0.1/json.hpp) (502 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.0.1/json.hpp.asc) (1 KB) - -Release date: 2017-12-29 -SHA-256: c9b3591f1bb94e723a0cd7be861733a3a555b234ef132be1e9027a0364118c4c - -### Summary - -This release fixes small issues in the implementation of **JSON Pointer** and **JSON Patch**. All changes are backward-compatible. - -### Changes - -- :bug: The **"copy" operation of JSON Patch** ([RFC 6902](https://tools.ietf.org/html/rfc6902)) requests that it is an error if the target path points into a non-existing array or object (see #894 for a detailed description). This release fixes the implementation to detect such invalid target paths and throw an exception. -- :bug: An **array index in a JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) must be an integer. This release fixes the implementation to throw an exception in case invalid array indices such as `10e2` are used. -- :white_check_mark: Added the [JSON Patch tests](https://github.com/json-patch/json-patch-tests) from Byron Ruth and Mike McCabe. -- :memo: Fixed the documentation of the [`at(ptr)` function with JSON Pointers](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a8ab61397c10f18b305520da7073b2b45.html#a8ab61397c10f18b305520da7073b2b45) to list all possible exceptions (see #888). -- :memo: Updated the [container overview documentation](https://nlohmann.github.io/json/) (see #883). -- :wrench: The CMake files now respect the [`BUILD_TESTING`](https://cmake.org/cmake/help/latest/module/CTest.html?highlight=build_testing) option (see #846, #885) -- :rotating_light: Fixed some compiler warnings (see #858, #882). - -### Deprecated functions - -:fire: To unify the interfaces and to improve similarity with the STL, the following functions are deprecated since version 3.0.0 and will be removed in the next major version (i.e., 4.0.0): - -- [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) -- [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) - -Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -## v3.0.0 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v3.0.0/json.hpp) (501 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v3.0.0/json.hpp.asc) (1 KB) - -Release date: 2017-12-17 -SHA-256: 076d4a0cb890a3c3d389c68421a11c3d77c64bd788e85d50f1b77ed252f2a462 - -### Summary - - - -After almost a year, here is finally a new release of JSON for Modern C++, and it is a major one! As we adhere to [semantic versioning](https://semver.org), this means the release includes some breaking changes, so please read the next section carefully before you update. But don't worry, we also added a few new features and put a lot of effort into fixing a lot of bugs and straighten out a few inconsistencies. - -### :boom: Breaking changes - -This section describes changes that change the public API of the library and may require changes in code using a previous version of the library. In section "Moving from 2.x.x to 3.0.0" at the end of the release notes, we describe in detail how existing code needs to be changed. - -- The library now uses [**user-defined exceptions**](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9a0aced019cb1d65bb49703406c84970.html#a9a0aced019cb1d65bb49703406c84970) instead of re-using those defined in `` (#244). This not only allows to add more information to the exceptions (every exception now has an identifier, and parse errors contain the position of the error), but also to easily catch all library exceptions with a single `catch(json::exception)`. -- When strings with a different encoding as UTF-8 were stored in JSON values, their serialization could not be parsed by the library itself, as only UTF-8 is supported. To enforce this library limitation and improve consistency, **non-UTF-8 encoded strings now yield a `json::type_error` exception during serialization** (#838). The check for valid UTF-8 is realized with code from [Björn Hoehrmann](http://bjoern.hoehrmann.de/). -- **NaN and infinity values can now be stored inside the JSON value** without throwing an exception. They are, however, still serialized as `null` (#388). -- The library's iterator tag was changed from RandomAccessIterator to **[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator)** (#593). Supporting RandomAccessIterator was incorrect as it assumed an ordering of values in a JSON objects which are unordered by definition. -- The library does not include the standard headers ``, ``, and `` any more. You may need to add these headers to code relying on them. -- Removed constructor `explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr)` which was deprecated in version 2.0.0 (#480). - -### :fire: Deprecated functions - -To unify the interfaces and to improve similarity with the STL, the following functions are now deprecated and will be removed in the next major version (i.e., 4.0.0): - -- [`friend std::istream& operator<<(basic_json&, std::istream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3) -- [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983) - -Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead. - -### :sparkles: New features - -With all this breaking and deprecation out of the way, let's talk about features! - -- We improved the **diagnostic information for syntax errors** (#301). Now, an exception [`json::parse_error`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1efc2468e6022be6e35fc2944cabe4d.html#af1efc2468e6022be6e35fc2944cabe4d) is thrown which contains a detailed message on the error, but also a member `byte` to indicate the byte offset in the input where the error occurred. -- We added a **non-throwing syntax check** (#458): The new `accept` function returns a Boolean indicating whether the input is proper JSON. We also added a Boolean parameter `allow_exceptions` to the existing [`parse`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aa9676414f2e36383c4b181fe856aa3c0.html#aa9676414f2e36383c4b181fe856aa3c0) functions to return a `discarded` value in case a syntax error occurs instead of throwing an exception. -- An [`update`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a1cfa9ae5e7c2434cab4cfe69bffffe11.html#a1cfa9ae5e7c2434cab4cfe69bffffe11) function was added to **merge two JSON objects** (#428). In case you are wondering: the name was inspired by [Python](https://docs.python.org/2/library/stdtypes.html#dict.update). -- The [`insert`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a1b0a4e60d56f1fe80501ed941e122892.html#a1b0a4e60d56f1fe80501ed941e122892) function now also supports an iterator range to add elements to an object. -- The binary exchange formats **CBOR and MessagePack can now be parsed from input streams and written to output streams** (#477). -- Input streams are now only read until the end of a JSON value instead of the end of the input (#367). -- The serialization function [`dump`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5adea76fedba9898d404fef8598aa663.html#a5adea76fedba9898d404fef8598aa663) now has two optional parameters `ensure_ascii` to **escape all non-ASCII characters** with `\uxxxx` and an `indent_char` parameter to choose whether to **indent with spaces or tabs** (#654). -- Added **built-in type support** for C arrays (#502), `std::pair` and `std::tuple` (#563, #614), `enum` and `enum class` (#545), `std::vector` (#494). Fixed support for `std::valarray` (#702), `std::array` (#553), and `std::map` (#600, #607). - -### :hammer: Further changes - -Furthermore, there have been a lot of changes under the hood: - -- Replaced the [re2c](http://re2c.org) generated scanner by a self-coded version which allows for a better modularization of the parser and better diagnostics. To test the new scanner, we added millions (8,860,608 to be exact) of unit tests to check all valid and invalid byte sequences of the Unicode standard. -- Google's OSS-Fuzz is still constantly fuzz-testing the library and found several issues that were fixed in this release (#497, #504, #514, #516, #518, #519, #575). -- We now also ignore UTF-8 byte order marks when parsing from an iterator range (#602). -- Values can be now moved from initializer lists (#663). -- Updated to [Catch](https://github.com/catchorg/Catch2) 1.9.7. Unfortunately, Catch2 currently has some performance issues. -- The non-exceptional paths of the library are now annotated with `__builtin_expect` to optimize branch prediction as long as no error occurs. -- MSVC now produces a stack trace in MSVC if a `from_json` or `to_json` function was not found for a user-defined type. We also added a debug visualizer [`nlohmann_json.natvis`](https://github.com/nlohmann/json/blob/develop/nlohmann_json.natvis) for better debugging in MSVC (#844). -- Overworked the documentation and added even more examples. -- The build workflow now relies on CMake and CTest. Special flags can be chosen with CMake, including coverage (`JSON_Coverage`), compilation without exceptions (`JSON_NoExceptions`), LLVM sanitizers (`JSON_Sanitizer`), or execution with Valgrind (`JSON_Valgrind`). -- Added support for package managers Meson (#576), Conan (#566), Hunter (#671, #829), and vcpkg (#753). -- Added CI builders: Xcode 8.3, 9.0, 9.1, and 9.2; GCC 7.2; Clang 3.8, 3.9, 4.0, and 5.0; Visual Studio 2017. The library is further built with C++17 settings on the latest Clang, GCC, and MSVC version to quickly detect new issues. - -### Moving from 2.x.x to 3.0.0 - -#### User-defined Exceptions - -There are five different exceptions inheriting from [`json::exception`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9a0aced019cb1d65bb49703406c84970.html#a9a0aced019cb1d65bb49703406c84970): - -- [`json::parse_error`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1efc2468e6022be6e35fc2944cabe4d.html#af1efc2468e6022be6e35fc2944cabe4d) for syntax errors (including the binary formats), -- [`json::invalid_iterator`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ac13d32f7cbd02d616e71d8dc30dadcbf.html#ac13d32f7cbd02d616e71d8dc30dadcbf) for errors related to iterators, -- [`json::type_error`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a4010e8e268fefd86da773c10318f2902.html#a4010e8e268fefd86da773c10318f2902) for errors where functions were called with the wrong JSON type, -- [`json::out_of_range`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a28f7c2f087274a0012eb7a2333ee1580.html#a28f7c2f087274a0012eb7a2333ee1580) for range errors, and -- [`json::other_error`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a3333a5a8714912adda33a35b369f7b3d.html#a3333a5a8714912adda33a35b369f7b3d) for miscellaneous errors. - -To support these exception, the `try`/`catch` blocks of your code need to be adjusted: - -| new exception | previous exception | -|:--|:--| -| parse_error.101 | invalid_argument | -| parse_error.102 | invalid_argument | -| parse_error.103 | invalid_argument | -| parse_error.104 | invalid_argument | -| parse_error.105 | invalid_argument | -| parse_error.106 | domain_error | -| parse_error.107 | domain_error | -| parse_error.108 | domain_error | -| parse_error.109 | invalid_argument | -| parse_error.110 | out_of_range | -| parse_error.111 | invalid_argument | -| parse_error.112 | invalid_argument | -| invalid_iterator.201 | domain_error | -| invalid_iterator.202 | domain_error | -| invalid_iterator.203 | domain_error | -| invalid_iterator.204 | out_of_range | -| invalid_iterator.205 | out_of_range | -| invalid_iterator.206 | domain_error | -| invalid_iterator.207 | domain_error | -| invalid_iterator.208 | domain_error | -| invalid_iterator.209 | domain_error | -| invalid_iterator.210 | domain_error | -| invalid_iterator.211 | domain_error | -| invalid_iterator.212 | domain_error | -| invalid_iterator.213 | domain_error | -| invalid_iterator.214 | out_of_range | -| type_error.301 | domain_error | -| type_error.302 | domain_error | -| type_error.303 | domain_error | -| type_error.304 | domain_error | -| type_error.305 | domain_error | -| type_error.306 | domain_error | -| type_error.307 | domain_error | -| type_error.308 | domain_error | -| type_error.309 | domain_error | -| type_error.310 | domain_error | -| type_error.311 | domain_error | -| type_error.313 | domain_error | -| type_error.314 | domain_error | -| type_error.315 | domain_error | -| out_of_range.401 | out_of_range | -| out_of_range.402 | out_of_range | -| out_of_range.403 | out_of_range | -| out_of_range.404 | out_of_range | -| out_of_range.405 | domain_error | -| other_error.501 | domain_error | - -#### Handling of NaN and INF - -- If an overflow occurs during parsing a number from a JSON text, an exception [`json::out_of_range`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a28f7c2f087274a0012eb7a2333ee1580.html#a28f7c2f087274a0012eb7a2333ee1580) is thrown so that the overflow is detected early and roundtripping is guaranteed. - -- NaN and INF floating-point values can be stored in a JSON value and are not replaced by null. That is, the basic_json class behaves like `double` in this regard (no exception occurs). However, NaN and INF are serialized to `null`. - -#### Removal of deprecated functions - -Function `explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr)` should be replaced by the `parse` function: Let `ss` be a stream and `cb` be a parse callback function. - -Old code: - -```cpp -json j(ss, cb); -``` - -New code: - -```cpp -json j = json::parse(ss, cb); -``` - -If no callback function is used, also the following code works: - -```cpp -json j; -j << ss; -``` - -or - -```cpp -json j; -ss >> j; -``` - -## v2.1.1 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.1.1/json.hpp) (437 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.1.1/json.hpp.asc) (1 KB) - -Release date: 2017-02-25 -SHA-256: faa2321beb1aa7416d035e7417fcfa59692ac3d8c202728f9bcc302e2d558f57 - -### Summary - -This release **fixes a locale-related bug in the parser**. To do so, the whole number handling (lexer, parser, and also the serialization) have been overworked. Furthermore, a lot of small changes added up that were added to this release. All changes are backward-compatible. - -### Changes -- :bug: Locales that have a different character than `.` as decimal separator (e.g., the Norwegian locale `nb_NO.UTF-8`) led to truncated number parsing or parse errors. The library now has been fixed to work with **any locale**. Note that `.` is still the only valid decimal separator for JSON input. -- :bug: Numbers like `1.0` were correctly parsed as floating-point number, but serialized as integer (`1`). Now, **floating-point numbers correctly round trip**. -- :bug: Parsing incorrect JSON numbers with leading 0 (`0123`) could yield a [buffer overflow](https://github.com/nlohmann/json/issues/452). This is fixed now by detecting such errors directly by the lexer. -- :bug: Constructing a JSON value from a pointer was incorrectly interpreted as a Boolean; such code will now yield a compiler error. -- :bug: Comparing a JSON number with `0` led to a comparison with `null`. This is fixed now. -- :bug: All throw calls are now wrapped in macros. -- :lock: Starting during the preparation of this release (since 8 February 2017), commits and released files are **cryptographically signed** with [this GPG key](https://keybase.io/nlohmann/pgp_keys.asc?fingerprint=797167ae41c0a6d9232e48457f3cea63ae251b69). Previous releases have also been signed. -- :sparkles: The parser for MessagePack and CBOR now supports an optional start index parameter to define a byte offset for the parser. -- :rotating_light: Some more warnings have been fixed. With Clang, the code compiles **without warnings** with `-Weverything` (well, it needs `-Wno-documentation-unknown-command` and `-Wno-deprecated-declarations`, but you get the point). -- :hammer: The code can be compiled easier with many Android NDKs by avoiding macros like `UINT8_MAX` which previously required defining a preprocessor macro for compilation. -- :zap: The unit tests now compile two times faster. -- :heavy_plus_sign: [Cotire](https://github.com/sakra/cotire) is used to speed up the build. -- :pencil2: Fixed a lot of typos in the documentation. -- :memo: Added a section to the README file that lists all used [third-party code/tools](https://github.com/nlohmann/json#used-third-party-tools). -- :memo: Added a note on constructing a string value vs. parsing. -- :white_check_mark: The test suite now contains 11202597 unit tests. -- :memo: Improved the [Doxygen documentation](https://nlohmann.github.io/json/) by shortening the template parameters of class `basic_json`. -- :construction_worker: Removed Doozer. -- :construction_worker: Added Codacity. -- :arrow_up: Upgraded Catch to version 1.7.2. - - -## v2.1.0 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.1.0/json.hpp) (426 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.1.0/json.hpp.asc) (1 KB) - -- Release date: 2017-01-28 -- SHA-256: a571dee92515b685784fd527e38405cf3f5e13e96edbfe3f03d6df2e363a767b - -### Summary - -This release introduces a means to convert from/to user-defined types. The release is backwards compatible. - -![conversion](https://cloud.githubusercontent.com/assets/159488/22399173/aebe8f7a-e597-11e6-930f-7494ee615827.png) - -### Changes -- :sparkles: The library now offers an elegant way to **convert from and to arbitrary value types**. All you need to do is to implement two functions: `to_json` and `from_json`. Then, a conversion is as simple as putting a `=` between variables. See the [README](https://github.com/nlohmann/json#arbitrary-types-conversions) for more information and examples. -- :sparkles: **Exceptions can now be switched off.** This can be done by defining the preprocessor symbol `JSON_NOEXCEPTION` or by passing `-fno-exceptions` to your compiler. In case the code would usually thrown an exception, `abort()` is now called. -- :sparkles: **Information on the library** can be queried with the new (static) function `meta()` which returns a JSON object with information on the version, compiler, and platform. See the [documentation]() for an example. -- :bug: A bug in the CBOR parser was fixed which led to a buffer overflow. -- :sparkles: The function [`type_name()`]() is now public. It allows to query the type of a JSON value as string. -- :white_check_mark: Added the [Big List of Naughty Strings](https://github.com/minimaxir/big-list-of-naughty-strings) as test case. -- :arrow_up: Updated to [Catch v1.6.0](https://github.com/philsquared/Catch/releases/tag/v1.6.0). -- :memo: Some typos in the documentation have been fixed. - - -## v2.0.10 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.10/json.hpp) (409 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.10/json.hpp.asc) (1 KB) - -- Release date: 2017-01-02 -- SHA-256: ec27d4e74e9ce0f78066389a70724afd07f10761009322dc020656704ad5296d - -### Summary - -This release fixes several security-relevant bugs in the MessagePack and CBOR parsers. The fixes are backwards compatible. - -### Changes -- :bug: Fixed a lot of **bugs in the CBOR and MesssagePack parsers**. These bugs occurred if invalid input was parsed and then could lead in buffer overflows. These bugs were found with Google's [OSS-Fuzz](https://github.com/google/oss-fuzz), see #405, #407, #408, #409, #411, and #412 for more information. -- :construction_worker: We now also use the **[Doozer](https://doozer.io) continuous integration platform**. -- :construction_worker: The complete test suite is now also run with **Clang's address sanitizer and undefined-behavior sanitizer**. -- :white_check_mark: Overworked **fuzz testing**; CBOR and MessagePack implementations are now fuzz-tested. Furthermore, all fuzz tests now include a round trip which ensures created output can again be properly parsed and yields the same JSON value. -- :memo: Clarified documentation of `find()` function to always return `end()` when called on non-object value types. -- :hammer: Moved thirdparty test code to `test/thirdparty` directory. - -## v2.0.9 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.9/json.hpp) (406 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.9/json.hpp.asc) (1 KB) - -- Release date: 2016-12-16 -- SHA-256: fbf3396f13e187d6c214c297bddc742d918ea9b55e10bfb3d9f458b9bfdc22e5 - -### Summary - -This release implements with **[CBOR](http://cbor.io)** and **[MessagePack](http://msgpack.org)** two **binary serialization/deserialization formats**. It further contains some small fixes and improvements. The fixes are backwards compatible. - -![cbor](https://cloud.githubusercontent.com/assets/159488/22399181/d4d60d32-e597-11e6-8dcb-825abcf9ac2a.png) - -### Changes -- :sparkles: The library can now read and write the binary formats **[CBOR](http://cbor.io)** (Concise Binary Object Representation) and **[MessagePack](http://msgpack.org)**. Both formats are aimed to produce a very compact representation of JSON which can be parsed very efficiently. See the [README file](https://github.com/nlohmann/json#binary-formats-cbor-and-messagepack) for more information and examples. -- :fire: simplified the iteration implementation allowing to remove dozens of lines of code -- :bug: fixed an [integer overflow error](https://github.com/nlohmann/json/issues/389) detected by [Google's OSS-Fuzz](https://github.com/google/oss-fuzz) -- :bug: suppressed documentation warnings inside the library to facilitate compilation with `-Wdocumentation` -- :bug: fixed an overflow detection error in the number parser -- :memo: updated [contribution guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) to a list of frequentely asked features that will most likely be never added to the library -- :memo: added a **table of contents** to the [README file](https://github.com/nlohmann/json/blob/develop/README.md) to add some structure -- :memo: mentioned the many [examples](https://github.com/nlohmann/json/tree/develop/doc/examples) and the [documentation](https://nlohmann.github.io/json/) in the [README file]() -- :hammer: split [unit tests](https://github.com/nlohmann/json/tree/develop/test/src) into individual independent binaries to speed up compilation and testing -- :white_check_mark: the test suite now contains **11201886** tests - -## v2.0.8 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.8/json.hpp) (360 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.8/json.hpp.asc) (1 KB) - -- Release date: 2016-12-02 -- SHA-256: b70db0ad34f8e0e61dc3f0cbab88099336c9674c193d8a3439d93d6aca2d7120 - -### Summary - -This release combines a lot of small fixes and improvements. The fixes are backwards compatible. - -### Changes -- :bug: fixed a bug that froze the parser if a passed file was not found (now, `std::invalid_argument` is thrown) -- :bug: fixed a bug that lead to an error of a file at EOF was parsed again (now, `std::invalid_argument` is thrown) -- :sparkles: the well known functions [`emplace`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a602f275f0359ab181221384989810604.html#a602f275f0359ab181221384989810604) and [`emplace_back`](http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af8a435033327d9237da414afc1cce513.html#af8a435033327d9237da414afc1cce513) have been added to JSON values and work as expected -- :zap: improved the performance of the serialization (`dump` function) -- :zap: improved the performance of the deserialization (parser) -- :construction_worker: some continuous integration images at [Travis](https://travis-ci.org/nlohmann/json) were added and retired; see [here](https://github.com/nlohmann/json#supported-compilers) for the current continuous integration setup -- :construction_worker: the [Coverity scan](https://scan.coverity.com/projects/nlohmann-json) works again -- :chart_with_upwards_trend: the benchmarking code has been improved to produce more stable results -- :memo: the [README](https://github.com/nlohmann/json/blob/develop/README.md) file has been extended and includes more frequently asked examples -- :white_check_mark: the test suite now contains 8905518 tests -- :arrow_up: updated [Catch](https://github.com/philsquared/Catch) to version 1.5.8 - -## v2.0.7 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.7/json.hpp) (355 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.7/json.hpp.asc) (1 KB) - -- Release date: 2016-11-02 -- SHA-256: 5545c323670f8165bae90b9dc6078825e86ec310d96cc4e5b47233ea43715bbf - -### Summary - -This release fixes a few bugs in the JSON parser found in the [Parsing JSON is a Minefield 💣](http://seriot.ch/parsing_json.html) article. The fixes are backwards compatible. - -### Changes -- The article [Parsing JSON is a Minefield 💣](http://seriot.ch/parsing_json.html) discusses a lot of pitfalls of the JSON specification. When investigating the published test cases, a few bugs in the library were found and fixed: - - Files with less than 5 bytes can now be parsed without error. - - The library now properly rejects any file encoding other than UTF-8. Furthermore, incorrect surrogate pairs are properly detected and rejected. - - The library now accepts all but one "yes" test (y_string_utf16.json): UTF-16 is not supported. - - The library rejects all but one "no" test (n_number_then_00.json): Null bytes are treated as end of file instead of an error. This allows to parse input from null-terminated strings. -- The string length passed to a user-defined string literal is now exploited to choose a more efficient constructor. -- A few grammar mistakes in the README file have been fixed. - -## v2.0.6 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.6/json.hpp) (349 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.6/json.hpp.asc) (1 KB) - -- Release date: 2016-10-15 -- SHA256: 459cc93d5e2f503e50c6d5876eb86bfea7daf405f5a567c5a2c9abc2383756ae - -### Summary - -This release fixes the semantics of `operator[]` for JSON Pointers (see below). This fix is backwards compatible. - -### Changes -- **`operator[]` for JSON Pointers** now behaves like the other versions of `operator[]` and transforms `null` values into objects or arrays if required. This allows to created nested structures like `j["/foo/bar/2"] = 17` (yielding `{"foo": "bar": [null, null, 17]}`) without problems. -- overworked a helper SFINAE function -- fixed some documentation issues -- fixed the CMake files to allow to run the test suite outside the main project directory -- restored test coverage to 100%. - -## v2.0.5 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.5/json.hpp) (347 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.5/json.hpp.asc) (1 KB) - -- Release date: 2016-09-14 -- SHA-256: 8b7565263a44e2b7d3b89808bc73d2d639037ff0c1f379e3d56dbd77e00b98d9 - -### Summary - -This release fixes a regression bug in the stream parser (function `parse()` and the `<<`/`>>` operators). This fix is backwards compatible. - -### Changes -- **Bug fix**: The end of a file stream was not detected properly which led to parse errors. This bug should have been fixed with 2.0.4, but there was still a flaw in the code. - -## v2.0.4 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.4/json.hpp) (347 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.4/json.hpp.asc) (1 KB) - -- Release date: 2016-09-11 -- SHA-256: 632ceec4c25c4e2153f71470d3a2b992c8355f6d8b4d627d05dd16095cd3aeda - -### Summary - -This release fixes a bug in the stream parser (function `parse()` and the `<<`/`>>` operators). This fix is backwards compatible. - -### Changes -- **Bug fix**: The end of a file stream was not detected properly which led to parse errors. -- Fixed a compiler warning about an unused variable. - -## v2.0.3 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.3/json.hpp) (347 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.3/json.hpp.asc) (1 KB) - -- Release date: 2016-08-31 -- SHA-256: 535b73efe5546fde9e763c14aeadfc7b58183c0b3cd43c29741025aba6cf6bd3 - -### Summary - -This release combines a lot of small fixes and improvements. The release is backwards compatible. - -### Changes -- The **parser/deserialization functions have been generalized** to process any contiguous sequence of 1-byte elements (e.g., `char`, `unsigned char`, `uint8_t`). This includes all kind of string representations (string literals, char arrays, `std::string`, `const char*`), contiguous containers (C-style arrays, `std::vector`, `std::array`, `std::valarray`, `std::initializer_list`). User-defined containers providing random-access iterator access via `std::begin` and `std::end` can be used as well. See the documentation ([1](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_ace63ac4eb1dd7251a259d32e397461a3.html#ace63ac4eb1dd7251a259d32e397461a3), [2](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a90f05d55d9d0702c075cd281fd0d85ae.html#a90f05d55d9d0702c075cd281fd0d85ae), [3](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_aeffd70f622f8f2a51fd3d95af64b63a7.html#aeffd70f622f8f2a51fd3d95af64b63a7), [4](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_aa8dca2e91a6301c36890f844e64f0023.html#aa8dca2e91a6301c36890f844e64f0023)) for more information. Note that contiguous storage cannot be checked at compile time; if any of the parse functions are called with a noncompliant container, the behavior is undefined and will most likely yield segmentation violation. The preconditions are enforced by an assertion unless the library is compiled with preprocessor symbol `NDEBUG`. -- As a general remark on **assertions**: The library uses assertions to preclude undefined behavior. A [prominent example](https://github.com/nlohmann/json/issues/289) for this is the `operator[]` for const JSON objects. The behavior of this const version of the operator is undefined if the given key does not exist in the JSON object, because unlike the non-const version, it cannot add a `null` value at the given key. Assertions can be switched of by defining the preprocessor symbol `NDEBUG`. See the [documentation of `assert`](http://en.cppreference.com/w/cpp/error/assert) for more information. -- In the course of cleaning up the parser/deserialization functions, the constructor [`basic_json(std::istream&, const parser_callback_t)`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a32350263eb105764844c5a85e156a255.html#a32350263eb105764844c5a85e156a255) has been **deprecated** and will be deleted with the next major release 3.0.0 to unify the interface of the library. Deserialization will be done by stream operators or by calling one of the `parse` functions. That is, calls like `json j(i);` for an input stream `i` need to be replaced by `json j = json::parse(i);`. Compilers will produce a deprecation warning if client code uses this function. -- Minor improvements: - - Improved the performance of the serialization by avoiding the re-creation of a locale object. - - Fixed two MSVC warnings. Compiling the test suite with `/Wall` now only warns about non-inlined functions (C4710) and the deprecation of the constructor from input-stream (C4996). -- Some project internals: - - The project has qualified for the [Core Infrastructure Initiative Best Practices Badge](https://bestpractices.coreinfrastructure.org/projects/289). While most requirements where already satisfied, some led to a more explicit documentation of quality-ensuring procedures. For instance, static analysis is now executed with every commit on the build server. Furthermore, the [contribution guidelines document](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) how to communicate security issues privately. - - The test suite has been overworked and split into several files to allow for faster compilation and analysis. The execute the test suite, simply execute `make check`. - - The continuous integration with [Travis](https://travis-ci.org/nlohmann/json) was extended with Clang versions 3.6.0 to 3.8.1 and now includes 18 different compiler/OS combinations. - - An 11-day run of [American fuzzy lop](http://lcamtuf.coredump.cx/afl/) checked 962 million inputs on the parser and found no issue. - -## v2.0.2 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.2/json.hpp) (338 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.2/json.hpp.asc) (1 KB) - -- Release date: 2016-07-31 -- SHA-256: 8e97b7965b4594b00998d6704465412360e1a0ed927badb51ded8b82291a8f3d - -### Summary - -This release combines a lot of small fixes and improvements. The release is backwards compatible. - -### Changes -- The **parser** has been overworked, and a lot of small issues have been fixed: - - Improved parser performance by avoiding recursion and using move semantics for the return value. - - Unescaped control characters `\x10`-`\x1f` are not accepted any more. - - Fixed a bug in the parser when reading from an input stream. - - Improved test case coverage for UTF-8 parsing: now, all valid Unicode code points are tested both escaped and unescaped. - - The precision of output streams is now preserved by the parser. -- Started to check the **code correctness** by proving termination of important loops. Furthermore, individual assertions have been replaced by a more systematic function which checks the class invariants. Note that assertions should be switched off in production by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](http://en.cppreference.com/w/cpp/error/assert). -- A lot of **code cleanup**: removed unused headers, fixed some compiler warnings, and fixed a build error for Windows-based Clang builds. -- Added some compile-time checks: - - Unsupported compilers are rejected during compilation with an `#error` command. - - Static assertion prohibits code with incompatible pointer types used in `get_ptr()`. -- Improved the [documentation](https://nlohmann.github.io/json/), and adjusted the documentation script to choose the correct version of `sed`. -- Replaced a lot of "raw loops" by STL functions like `std::all_of`, `std::for_each`, or `std::accumulate`. This facilitates reasoning about termination of loops and sometimes allowed to simplify functions to a single return statement. -- Implemented a `value()` function for JSON pointers (similar to `at` function). -- The Homebrew formula (see [Integration](https://github.com/nlohmann/json#integration)) is now tested for all Xcode builds (6.1 - 8.x) with Travis. -- Avoided output to `std::cout` in the test cases. - -## v2.0.1 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.1/json.hpp) (321 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.1/json.hpp.asc) (1 KB) - -- Release date: 2016-06-28 -- SHA-256: ef550fcd7df572555bf068e9ec4e9d3b9e4cdd441cecb0dcea9ea7fd313f72dd - -### Summary - -This release fixes a performance regression in the JSON serialization (function `dump()`). This fix is backwards compatible. - -### Changes -- The locale of the output stream (or the internal string stream if a JSON value is serialized to a string) is now adjusted once for the whole serialization instead of for each floating-point number. -- The locale of an output stream is now correctly reset to the previous value by the JSON library. - - -## v2.0.0 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v2.0.0/json.hpp) (321 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v2.0.0/json.hpp.asc) (1 KB) - -- Release date: 2016-06-24 -- SHA-256: ac9e1fb25c2ac9ca5fc501fcd2fe3281fe04f07018a1b48820e7b1b11491bb6c - -### Summary - -This release adds several features such as JSON Pointers, JSON Patch, or support for 64 bit unsigned integers. Furthermore, several (subtle) bugs have been fixed. - -As `noexcept` and `constexpr` specifier have been added to several functions, the public API has effectively been changed in a (potential) non-backwards compatible manner. As we adhere to [Semantic Versioning](http://semver.org), this calls for a new major version, so say hello to 2️⃣.0️⃣.0️⃣. - -### Changes -- 🔟 A JSON value now uses `uint64_t` (default value for template parameter `NumberUnsignedType`) as data type for **unsigned integer** values. This type is used automatically when an unsigned number is parsed. Furthermore, constructors, conversion operators and an `is_number_unsigned()` test have been added. -- 👉 **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) support: A JSON Pointer is a string (similar to an XPath expression) to address a value inside a structured JSON value. JSON Pointers can be used in `at()` and `operator[]` functions. Furthermore, JSON values can be “flattened” to key/value pairs using `flatten()` where each key is a JSON Pointer. The original value can be restored by “unflattening” the flattened value using `unflatten()`. -- 🏥 **JSON Patch** ([RFC 6902](https://tools.ietf.org/html/rfc6902)) support. A JSON Patch is a JSON value that describes the required edit operations (add, change, remove, …) to transform a JSON value into another one. A JSON Patch can be created with function `diff(const basic_json&)` and applied with `patch(const basic_json&)`. Note the created patches use a rather primitive algorithm so far and leave room for improvement. -- 🇪🇺 The code is now **locale-independent**: Floating-point numbers are always serialized with a period (`.`) as decimal separator and ignores different settings from the locale. -- 🍺 **Homebrew** support: Install the library with `brew tap nlohmann/json && brew install nlohmann_json`. -- Added constructor to create a JSON value by parsing a `std::istream` (e.g., `std::stringstream` or `std::ifstream`). -- Added **`noexcept`** specifier to `basic_json(boolean_t)`, `basic_json(const number_integer_t)`, `basic_json(const int)`, `basic_json(const number_float_t)`, iterator functions (`begin()`, `end()`, etc.) -- When parsing numbers, the sign of `0.0` (vs. `-0.0`) is preserved. -- Improved MSVC 2015, Android, and MinGW support. See [README](https://github.com/nlohmann/json#supported-compilers) for more information. -- Improved test coverage (added 2,225,386 tests). -- Removed some misuses of `std::move`. -- Fixed several compiler warnings. -- Improved error messages from JSON parser. -- Updated to [`re2c`](http://re2c.org) to version 0.16 to use a minimal DFAs for the lexer. -- Updated test suite to use [Catch](https://github.com/philsquared/Catch) version 1.5.6. -- Made type getters (`is_number`, etc.) and const value access `constexpr`. -- Functions `push_back` and `operator+=` now work with key/value pairs passed as initializer list, e.g. `j_object += {"key", 1}`. -- Overworked `CMakeLists.txt` to make it easier to integrate the library into other projects. - -### Notes -- Parser error messages are still very vague and contain no information on the error location. -- The implemented `diff` function is rather primitive and does not create minimal diffs. -- The name of function `iteration_wrapper` may change in the future and the function will be deprecated in the next release. -- Roundtripping (i.e., parsing a JSON value from a string, serializing it, and comparing the strings) of floating-point numbers is not 100% accurate. Note that [RFC 8259](https://tools.ietf.org/html/rfc8259) defines no format to internally represent numbers and states not requirement for roundtripping. Nevertheless, benchmarks like [Native JSON Benchmark](https://github.com/miloyip/nativejson-benchmark) treat roundtripping deviations as conformance errors. - - -## v1.1.0 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v1.1.0/json.hpp) (257 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v1.1.0/json.hpp.asc) (1 KB) - -- Release date: 2016-01-24 -- SHA-256: c0cf0e3017798ca6bb18e757ebc570d21a3bdac877845e2b9e9573d183ed2f05 - -### Summary - -This release fixes several small bugs and adds functionality in a backwards-compatible manner. Compared to the [last version (1.0.0)](https://github.com/nlohmann/json/releases/tag/v1.0.0), the following changes have been made: - -### Changes -- _Fixed_: **Floating-point numbers** are now serialized and deserialized properly such that rountripping works in more cases. [#185, #186, #190, #191, #194] -- _Added_: The code now contains **assertions** to detect undefined behavior during development. As the standard function `assert` is used, the assertions can be switched off by defining the preprocessor symbol `NDEBUG` during compilation. [#168] -- _Added_: It is now possible to get a **reference** to the stored values via the newly added function `get_ref()`. [#128, #184] -- _Fixed_: Access to object values via keys (**`operator[]`**) now works with all kind of string representations. [#171, #189] -- _Fixed_: The code now compiles again with **Microsoft Visual Studio 2015**. [#144, #167, #188] -- _Fixed_: All required headers are now included. -- _Fixed_: Typos and other small issues. [#162, #166, #175, #177, #179, #180] - -### Notes - -There are still known open issues (#178, #187) which will be fixed in version 2.0.0. However, these fixes will require a small API change and will not be entirely backwards-compatible. - - -## v1.0.0 - -!!! summary "Files" - - - [json.hpp](https://github.com/nlohmann/json/releases/download/v1.0.0/json.hpp) (243 KB) - - [json.hpp.asc](https://github.com/nlohmann/json/releases/download/v1.0.0/json.hpp.asc) (1 KB) - -- Release date: 2015-12-28 -- SHA-256: 767dc2fab1819d7b9e19b6e456d61e38d21ef7182606ecf01516e3f5230446de - -### Summary - -This is the first official release. Compared to the [prerelease version 1.0.0-rc1](https://github.com/nlohmann/json/releases/tag/v1.0.0-rc1), only a few minor improvements have been made: - -### Changes -- _Changed_: A **UTF-8 byte order mark** is silently ignored. -- _Changed_: `sprintf` is no longer used. -- _Changed_: `iterator_wrapper` also works for const objects; note: the name may change! -- _Changed_: **Error messages** during deserialization have been improved. -- _Added_: The `parse` function now also works with type `std::istream&&`. -- _Added_: Function `value(key, default_value)` returns either a copy of an object's element at the specified key or a given default value if no element with the key exists. -- _Added_: Public functions are tagged with the version they were introduced. This shall allow for better **versioning** in the future. -- _Added_: All public functions and types are **documented** (see http://nlohmann.github.io/json/doxygen/) including executable examples. -- _Added_: Allocation of all types (in particular arrays, strings, and objects) is now exception-safe. -- _Added_: They descriptions of thrown exceptions have been overworked and are part of the tests suite and documentation. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/sponsors.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/sponsors.md deleted file mode 100644 index 9097049d..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/home/sponsors.md +++ /dev/null @@ -1,13 +0,0 @@ -# Sponsors - -You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/nlohmann). - -## Named Sponsors - -- [Michael Hartmann](https://github.com/reFX-Mike) -- [Stefan Hagen](https://github.com/sthagen) -- [Steve Sperandeo](https://github.com/homer6) -- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe) -- [Steve Wagner](https://github.com/ciroque) - -Thanks everyone! diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/callback_events.png b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/callback_events.png deleted file mode 100644 index 09aa2b38..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/callback_events.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/json_syntax_number.png b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/json_syntax_number.png deleted file mode 100644 index be23ffa6..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/json_syntax_number.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/range-begin-end.svg b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/range-begin-end.svg deleted file mode 100644 index 8e2b2fb6..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/range-begin-end.svg +++ /dev/null @@ -1,435 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - Past-the-last element - - - - begin - - - - end - - - - - diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/range-rbegin-rend.svg b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/range-rbegin-rend.svg deleted file mode 100644 index dc6045fc..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/images/range-rbegin-rend.svg +++ /dev/null @@ -1,1232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - Past-the-last element - - - - begin - - - - end - - - - - - - - - - - - - - - - - - - - - - - - - Reversed sequence - - Reverse past-the-last element - - - - - - - - rend - - - - rbegin - - - Reverse iterator stores an iterator to the nextelement than the one it actually refers to - - - - - - - - - diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/index.md deleted file mode 100644 index 0e49c836..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/index.md +++ /dev/null @@ -1,3 +0,0 @@ -# JSON for Modern C++ - -![](images/json.gif) diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/cmake.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/cmake.md deleted file mode 100644 index 9f1ecc95..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/cmake.md +++ /dev/null @@ -1,138 +0,0 @@ -# CMake - -## Integration - -You can also use the `nlohmann_json::nlohmann_json` interface target in CMake. This target populates the appropriate usage requirements for `INTERFACE_INCLUDE_DIRECTORIES` to point to the appropriate include directories and `INTERFACE_COMPILE_FEATURES` for the necessary C++11 flags. - -### External - -To use this library from a CMake project, you can locate it directly with `find_package()` and use the namespaced imported target from the generated package configuration: - -```cmake -# CMakeLists.txt -find_package(nlohmann_json 3.2.0 REQUIRED) -... -add_library(foo ...) -... -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` - -The package configuration file, `nlohmann_jsonConfig.cmake`, can be used either from an install tree or directly out of the build tree. - -### Embedded - -To embed the library directly into an existing CMake project, place the entire source tree in a subdirectory and call `add_subdirectory()` in your `CMakeLists.txt` file: - -```cmake -# If you only include this third party in PRIVATE source files, you do not -# need to install it when your main project gets installed. -# set(JSON_Install OFF CACHE INTERNAL "") - -# Don't use include(nlohmann_json/CMakeLists.txt) since that carries with it -# unintended consequences that will break the build. It's generally -# discouraged (although not necessarily well documented as such) to use -# include(...) for pulling in other CMake projects anyways. -add_subdirectory(nlohmann_json) -... -add_library(foo ...) -... -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` - -### Embedded (FetchContent) - -Since CMake v3.11, -[FetchContent](https://cmake.org/cmake/help/v3.11/module/FetchContent.html) can -be used to automatically download the repository as a dependency at configure type. - -Example: -```cmake -include(FetchContent) - -FetchContent_Declare(json - GIT_REPOSITORY https://github.com/nlohmann/json - GIT_TAG v3.7.3) - -FetchContent_GetProperties(json) -if(NOT json_POPULATED) - FetchContent_Populate(json) - add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) -endif() - -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` - -!!! Note - The repository download size is quite large. - You might want to depend on a smaller repository. For instance, you might want to replace the URL above by - . - -### Supporting Both - -To allow your project to support either an externally supplied or an embedded JSON library, you can use a pattern akin to the following: - -``` cmake -# Top level CMakeLists.txt -project(FOO) -... -option(FOO_USE_EXTERNAL_JSON "Use an external JSON library" OFF) -... -add_subdirectory(thirdparty) -... -add_library(foo ...) -... -# Note that the namespaced target will always be available regardless of the -# import method -target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) -``` -```cmake -# thirdparty/CMakeLists.txt -... -if(FOO_USE_EXTERNAL_JSON) - find_package(nlohmann_json 3.2.0 REQUIRED) -else() - set(JSON_BuildTests OFF CACHE INTERNAL "") - add_subdirectory(nlohmann_json) -endif() -... -``` - -`thirdparty/nlohmann_json` is then a complete copy of this source tree. - -## CMake Options - -### `JSON_BuildTests` - -Build the unit tests when [`BUILD_TESTING`](https://cmake.org/cmake/help/latest/command/enable_testing.html) is enabled. This option is `ON` by default if the library's CMake project is the top project. That is, when integrating the library as described above, the test suite is not built unless explicitly switched on with this option. - -### `JSON_CI` - -Enable CI build targets. The exact targets are used during the several CI steps and are subject to change without notice. This option is `OFF` by default. - -### `JSON_Diagnostics` - -Enable [extended diagnostic messages](../home/exceptions.md#extended-diagnostic-messages) by defining macro [`JSON_DIAGNOSTICS`](../features/macros.md#json_diagnostics). This option is `OFF` by default. - -### `JSON_FastTests` - -Skip expensive/slow test suites. This option is `OFF` by default. Depends on `JSON_BuildTests`. - -### `JSON_ImplicitConversions` - -Enable implicit conversions by defining macro [`JSON_USE_IMPLICIT_CONVERSIONS`](../features/macros.md#json_use_implicit_conversions). This option is `ON` by default. - -### `JSON_Install` - -Install CMake targets during install step. This option is `ON` by default if the library's CMake project is the top project. - -### `JSON_MultipleHeaders` - -Use non-amalgamated version of the library. This option is `OFF` by default. - -### `JSON_SystemInclude` - -Treat the library headers like system headers (i.e., adding `SYSTEM` to the [`target_include_directories`](https://cmake.org/cmake/help/latest/command/target_include_directories.html) call) to checks for this library by tools like Clang-Tidy. This option is `OFF` by default. - -### `JSON_Valgrind` - -Execute test suite with [Valgrind](https://valgrind.org). This option is `OFF` by default. Depends on `JSON_BuildTests`. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/CMakeLists.txt b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/CMakeLists.txt deleted file mode 100644 index fd3e9ca7..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -project(json_example) -cmake_minimum_required(VERSION 2.8.12) -add_definitions("-std=c++11") - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(json_example example.cpp) -target_link_libraries(json_example ${CONAN_LIBS}) diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/Conanfile.txt b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/Conanfile.txt deleted file mode 100644 index a8a3e703..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/Conanfile.txt +++ /dev/null @@ -1,5 +0,0 @@ -[requires] -nlohmann_json/3.7.3 - -[generators] -cmake diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/example.cpp b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/example.cpp deleted file mode 100644 index e5a31be4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/conan/example.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << json::meta() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/example.cpp b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/example.cpp deleted file mode 100644 index e5a31be4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/example.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << json::meta() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/index.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/index.md deleted file mode 100644 index 5ee4ff72..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/index.md +++ /dev/null @@ -1,14 +0,0 @@ -# Header only - -[`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is the single required file in `single_include/nlohmann` or [released here](https://github.com/nlohmann/json/releases). You need to add - -```cpp -#include - -// for convenience -using json = nlohmann::json; -``` - -to the files you want to process JSON and set the necessary switches to enable C++11 (e.g., `-std=c++11` for GCC and Clang). - -You can further use file [`include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/json_fwd.hpp) for forward-declarations. The installation of `json_fwd.hpp` (as part of CMake's install step), can be achieved by setting `-DJSON_MultipleHeaders=ON`. diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/package_managers.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/package_managers.md deleted file mode 100644 index d98005da..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/package_managers.md +++ /dev/null @@ -1,187 +0,0 @@ -# Package Managers - -Throughout this page, we will describe how to compile the example file `example.cpp` below. - -```cpp ---8<-- "integration/example.cpp" -``` - -## Homebrew - -If you are using OS X and [Homebrew](http://brew.sh), just type - -```sh -brew install nlohmann-json -``` - -and you're set. If you want the bleeding edge rather than the latest release, use - -```sh -brew install nlohmann-json --HEAD -``` - -instead. See [nlohmann-json](https://formulae.brew.sh/formula/nlohmann-json) for more information. - -??? example - - 1. Create the following file: - - === "example.cpp" - - ```cpp - --8<-- "integration/example.cpp" - ``` - - 2. Install the package - - ```sh - brew install nlohmann-json - ``` - - 3. Determine the include path, which defaults to `/usr/local/Cellar/nlohmann-json/$version/include`, where `$version` is the version of the library, e.g. `3.7.3`. The path of the library can be determined with - - ```sh - brew list nlohmann-json - ``` - - 4. Compile the code. For instance, the code can be compiled using Clang with - - ```sh - clang++ example.cpp -I/usr/local/Cellar/nlohmann-json/3.7.3/include -std=c++11 -o example - ``` - -## Meson - -If you are using the [Meson Build System](http://mesonbuild.com), add this source tree as a [meson subproject](https://mesonbuild.com/Subprojects.html#using-a-subproject). You may also use the `include.zip` published in this project's [Releases](https://github.com/nlohmann/json/releases) to reduce the size of the vendored source tree. Alternatively, you can get a wrap file by downloading it from [Meson WrapDB](https://wrapdb.mesonbuild.com/nlohmann_json), or simply use `meson wrap install nlohmann_json`. Please see the meson project for any issues regarding the packaging. - -The provided `meson.build` can also be used as an alternative to cmake for installing `nlohmann_json` system-wide in which case a pkg-config file is installed. To use it, simply have your build system require the `nlohmann_json` pkg-config dependency. In Meson, it is preferred to use the [`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a subproject fallback, rather than using the subproject directly. - -## Conan - -If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add `nlohmann_json/x.y.z` to your `conanfile`'s requires, where `x.y.z` is the release version you want to use. Please file issues [here](https://github.com/conan-io/conan-center-index/issues) if you experience problems with the packages. - -??? example - - 1. Create the following files: - - === "Conanfile.txt" - - ```ini - --8<-- "integration/conan/Conanfile.txt" - ``` - - === "CMakeLists.txt" - - ```cmake - --8<-- "integration/conan/CMakeLists.txt" - ``` - - === "example.cpp" - - ```cpp - --8<-- "integration/conan/example.cpp" - ``` - - - 2. Build: - - ```sh - mkdir build - cd build - conan install .. - cmake .. - cmake --build . - ``` - -## Spack - -If you are using [Spack](https://www.spack.io/) to manage your dependencies, you can use the [`nlohmann-json` package](https://spack.readthedocs.io/en/latest/package_list.html#nlohmann-json). Please see the [spack project](https://github.com/spack/spack) for any issues regarding the packaging. - -## Hunter - -If you are using [hunter](https://github.com/cpp-pm/hunter) on your project for external dependencies, then you can use the [nlohmann_json package](https://hunter.readthedocs.io/en/latest/packages/pkg/nlohmann_json.html). Please see the hunter project for any issues regarding the packaging. - -## Buckaroo - -If you are using [Buckaroo](https://buckaroo.pm), you can install this library's module with `buckaroo add github.com/buckaroo-pm/nlohmann-json`. Please file issues [here](https://github.com/buckaroo-pm/nlohmann-json). There is a demo repo [here](https://github.com/njlr/buckaroo-nholmann-json-example). - -## vcpkg - -If you are using [vcpkg](https://github.com/Microsoft/vcpkg/) on your project for external dependencies, then you can install the [nlohmann-json package](https://github.com/Microsoft/vcpkg/tree/master/ports/nlohmann-json) with `vcpkg install nlohmann-json` and follow the then displayed descriptions. Please see the vcpkg project for any issues regarding the packaging. - -??? example - - 1. Create the following files: - - === "CMakeLists.txt" - - ```cmake - --8<-- "integration/vcpkg/CMakeLists.txt" - ``` - - === "example.cpp" - - ```cpp - --8<-- "integration/vcpkg/example.cpp" - ``` - - 2. Install package: - - ```sh - vcpkg install nlohmann-json - ``` - - 3. Build: - - ```sh - mkdir build - cd build - cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake - cmake --build . - ``` - - Note you need to adjust `/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake` to your system. - -## cget - -If you are using [cget](http://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install nlohmann/json`. A specific version can be installed with `cget install nlohmann/json@v3.1.0`. Also, the multiple header version can be installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nlohmann/json -DJSON_MultipleHeaders=ON`). - -## CocoaPods - -If you are using [CocoaPods](https://cocoapods.org), you can use the library by adding pod `"nlohmann_json", '~>3.1.2'` to your podfile (see [an example](https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/)). Please file issues [here](https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open). - -## NuGet - -If you are using [NuGet](https://www.nuget.org), you can use the package [nlohmann.json](https://www.nuget.org/packages/nlohmann.json/). Please check [this extensive description](https://github.com/nlohmann/json/issues/1132#issuecomment-452250255) on how to use the package. Please file issues [here](https://github.com/hnkb/nlohmann-json-nuget/issues). - -## Conda - -If you are using [conda](https://conda.io/), you can use the package [nlohmann_json](https://github.com/conda-forge/nlohmann_json-feedstock) from [conda-forge](https://conda-forge.org) executing `conda install -c conda-forge nlohmann_json`. Please file issues [here](https://github.com/conda-forge/nlohmann_json-feedstock/issues). - -## MSYS2 - -If you are using [MSYS2](http://www.msys2.org/), you can use the [mingw-w64-nlohmann-json](https://packages.msys2.org/base/mingw-w64-nlohmann-json) package, just type `pacman -S mingw-w64-i686-nlohmann-json` or `pacman -S mingw-w64-x86_64-nlohmann-json` for installation. Please file issues [here](https://github.com/msys2/MINGW-packages/issues/new?title=%5Bnlohmann-json%5D) if you experience problems with the packages. - -## MacPorts - -If you are using [MacPorts](https://ports.macports.org), execute `sudo port install nlohmann-json` to install the [nlohmann-json](https://ports.macports.org/port/nlohmann-json/) package. - -## build2 - -If you are using [`build2`](https://build2.org), you can use the [`nlohmann-json`](https://cppget.org/nlohmann-json) package from the public repository http://cppget.org or directly from the [package's sources repository](https://github.com/build2-packaging/nlohmann-json). In your project's `manifest` file, just add `depends: nlohmann-json` (probably with some [version constraints](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps)). If you are not familiar with using dependencies in `build2`, [please read this introduction](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml). -Please file issues [here](https://github.com/build2-packaging/nlohmann-json) if you experience problems with the packages. - -## wsjcpp - -If you are using [`wsjcpp`](http://wsjcpp.org), you can use the command `wsjcpp install "https://github.com/nlohmann/json:develop"` to get the latest version. Note you can change the branch ":develop" to an existing tag or another branch. - -## CPM.cmake - -If you are using [`CPM.cmake`](https://github.com/TheLartians/CPM.cmake), you can check this [`example`](https://github.com/TheLartians/CPM.cmake/tree/master/examples/json). After [adding CPM script](https://github.com/TheLartians/CPM.cmake#adding-cpm) to your project, implement the following snippet to your CMake: - -```cmake -CPMAddPackage( - NAME nlohmann_json - GITHUB_REPOSITORY nlohmann/json - VERSION 3.9.1) -``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/pkg-config.md b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/pkg-config.md deleted file mode 100644 index 429d0dea..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/pkg-config.md +++ /dev/null @@ -1,13 +0,0 @@ -# Pkg-config - -If you are using bare Makefiles, you can use `pkg-config` to generate the include flags that point to where the library is installed: - -```sh -pkg-config nlohmann_json --cflags -``` - -Users of the [Meson build system](package_managers.md#meson) will also be able to use a system-wide library, which will be found by `pkg-config`: - -```meson -json = dependency('nlohmann_json', required: true) -``` diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/vcpkg/CMakeLists.txt b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/vcpkg/CMakeLists.txt deleted file mode 100644 index d31f4e83..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/vcpkg/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -project(json_example) -cmake_minimum_required(VERSION 2.8.12) - -find_package(nlohmann_json CONFIG REQUIRED) - -add_executable(json_example example.cpp) -target_link_libraries(json_example PRIVATE nlohmann_json::nlohmann_json) diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/vcpkg/example.cpp b/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/vcpkg/example.cpp deleted file mode 100644 index e5a31be4..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/docs/integration/vcpkg/example.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -using json = nlohmann::json; - -int main() -{ - std::cout << json::meta() << std::endl; -} diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/mkdocs.yml b/Sources/backend-cpp/Vendor/json/doc/mkdocs/mkdocs.yml deleted file mode 100644 index 542d4f17..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/mkdocs.yml +++ /dev/null @@ -1,292 +0,0 @@ -# Project information -site_name: JSON for Modern C++ -site_author: Niels Lohmann -site_url: https://json.nlohmann.me/ - -# Repository -repo_name: nlohmann/json -repo_url: https://github.com/nlohmann/json -edit_uri: edit/develop/doc/mkdocs/docs - -# Copyright -copyright: Copyright © 2013 - 2022 Niels Lohmann - -# Configuration -theme: - name: material - language: en - palette: - primary: indigo - accent: indigo - font: - text: Roboto - code: JetBrains Mono - features: - - navigation.instant - - navigation.tracking - - navigation.tabs - - navigation.indexes - - navigation.top - -nav: - - Home: - - index.md - - home/license.md - - "Code of Conduct": home/code_of_conduct.md - - "FAQ": home/faq.md - - home/exceptions.md - - home/releases.md - - home/design_goals.md - - home/sponsors.md - - Features: - - features/arbitrary_types.md - - Binary Formats: - - features/binary_formats/index.md - - features/binary_formats/bson.md - - features/binary_formats/cbor.md - - features/binary_formats/messagepack.md - - features/binary_formats/ubjson.md - - features/binary_values.md - - features/comments.md - - Element Access: - - features/element_access/index.md - - features/element_access/unchecked_access.md - - features/element_access/checked_access.md - - features/element_access/default_value.md - - features/iterators.md - - features/json_pointer.md - - features/json_patch.md - - features/merge_patch.md - - features/object_order.md - - Parsing: - - features/parsing/index.md - - features/parsing/parse_exceptions.md - - features/parsing/parser_callbacks.md - - features/parsing/sax_interface.md - - features/enum_conversion.md - - features/macros.md - - Types: - - features/types/index.md - - features/types/number_handling.md - - Integration: - - integration/index.md - - integration/cmake.md - - integration/package_managers.md - - integration/pkg-config.md - - API Documentation: - - basic_json: - - 'Overview': api/basic_json/index.md - - '(Constructor)': api/basic_json/basic_json.md - - '(Destructor)': api/basic_json/~basic_json.md - - 'accept': api/basic_json/accept.md - - 'array': api/basic_json/array.md - - 'array_t': api/basic_json/array_t.md - - 'at': api/basic_json/at.md - - 'back': api/basic_json/back.md - - 'begin': api/basic_json/begin.md - - 'binary': api/basic_json/binary.md - - 'binary_t': api/basic_json/binary_t.md - - 'boolean_t': api/basic_json/boolean_t.md - - 'cbegin': api/basic_json/cbegin.md - - 'cbor_tag_handler_t': api/basic_json/cbor_tag_handler_t.md - - 'cend': api/basic_json/cend.md - - 'clear': api/basic_json/clear.md - - 'contains': api/basic_json/contains.md - - 'count': api/basic_json/count.md - - 'crbegin': api/basic_json/crbegin.md - - 'crend': api/basic_json/crend.md - - 'diff': api/basic_json/diff.md - - 'dump': api/basic_json/dump.md - - 'emplace': api/basic_json/emplace.md - - 'emplace_back': api/basic_json/emplace_back.md - - 'empty': api/basic_json/empty.md - - 'end': api/basic_json/end.md - - 'erase': api/basic_json/erase.md - - 'error_handler_t': api/basic_json/error_handler_t.md - - 'exception': api/basic_json/exception.md - - 'find': api/basic_json/find.md - - 'flatten': api/basic_json/flatten.md - - 'from_bson': api/basic_json/from_bson.md - - 'from_cbor': api/basic_json/from_cbor.md - - 'from_msgpack': api/basic_json/from_msgpack.md - - 'from_ubjson': api/basic_json/from_ubjson.md - - 'front': api/basic_json/front.md - - 'get': api/basic_json/get.md - - 'get_allocator': api/basic_json/get_allocator.md - - 'get_binary': api/basic_json/get_binary.md - - 'get_ptr': api/basic_json/get_ptr.md - - 'get_ref': api/basic_json/get_ref.md - - 'get_to': api/basic_json/get_to.md - - 'std::hash<basic_json>': api/basic_json/std_hash.md - - 'input_format_t': api/basic_json/input_format_t.md - - 'insert': api/basic_json/insert.md - - 'invalid_iterator': api/basic_json/invalid_iterator.md - - 'is_array': api/basic_json/is_array.md - - 'is_binary': api/basic_json/is_binary.md - - 'is_boolean': api/basic_json/is_boolean.md - - 'is_discarded': api/basic_json/is_discarded.md - - 'is_null': api/basic_json/is_null.md - - 'is_number': api/basic_json/is_number.md - - 'is_number_float': api/basic_json/is_number_float.md - - 'is_number_integer': api/basic_json/is_number_integer.md - - 'is_number_unsigned': api/basic_json/is_number_unsigned.md - - 'is_object': api/basic_json/is_object.md - - 'is_primitive': api/basic_json/is_primitive.md - - 'is_string': api/basic_json/is_string.md - - 'is_structured': api/basic_json/is_structured.md - - 'items': api/basic_json/items.md - - 'json_serializer': api/basic_json/json_serializer.md - - 'max_size': api/basic_json/max_size.md - - 'meta': api/basic_json/meta.md - - 'merge_patch': api/basic_json/merge_patch.md - - 'number_float_t': api/basic_json/number_float_t.md - - 'number_integer_t': api/basic_json/number_integer_t.md - - 'number_unsigned_t': api/basic_json/number_unsigned_t.md - - 'object': api/basic_json/object.md - - 'object_comparator_t': api/basic_json/object_comparator_t.md - - 'object_t': api/basic_json/object_t.md - - 'operator ValueType': api/basic_json/operator_ValueType.md - - 'operator value_t': api/basic_json/operator_value_t.md - - 'operator[]': api/basic_json/operator[].md - - 'operator=': api/basic_json/operator=.md - - 'operator==': api/basic_json/operator_eq.md - - 'operator!=': api/basic_json/operator_ne.md - - 'operator<': api/basic_json/operator_lt.md - - 'operator<<': api/basic_json/operator_ltlt.md - - 'operator<=': api/basic_json/operator_le.md - - 'operator>': api/basic_json/operator_gt.md - - 'operator>>': api/basic_json/operator_gtgt.md - - 'operator>=': api/basic_json/operator_ge.md - - 'operator+=': api/basic_json/operator+=.md - - 'operator""_json': api/basic_json/operator_literal_json.md - - 'operator""_json_pointer': api/basic_json/operator_literal_json_pointer.md - - 'out_of_range': api/basic_json/out_of_range.md - - 'other_error': api/basic_json/other_error.md - - 'parse': api/basic_json/parse.md - - 'parse_error': api/basic_json/parse_error.md - - 'parse_event_t': api/basic_json/parse_event_t.md - - 'parser_callback_t': api/basic_json/parser_callback_t.md - - 'patch': api/basic_json/patch.md - - 'push_back': api/basic_json/push_back.md - - 'rbegin': api/basic_json/rbegin.md - - 'rend': api/basic_json/rend.md - - 'sax_parse': api/basic_json/sax_parse.md - - 'size': api/basic_json/size.md - - 'string_t': api/basic_json/string_t.md - - 'swap': api/basic_json/swap.md - - 'std::swap<basic_json>': api/basic_json/std_swap.md - - 'to_bson': api/basic_json/to_bson.md - - 'to_cbor': api/basic_json/to_cbor.md - - 'to_msgpack': api/basic_json/to_msgpack.md - - 'to_string': api/basic_json/to_string.md - - 'to_ubjson': api/basic_json/to_ubjson.md - - 'type': api/basic_json/type.md - - 'type_error': api/basic_json/type_error.md - - 'type_name': api/basic_json/type_name.md - - 'unflatten': api/basic_json/unflatten.md - - 'update': api/basic_json/update.md - - 'value': api/basic_json/value.md - - 'value_t': api/basic_json/value_t.md - - byte_container_with_subtype: - - 'Overview': api/byte_container_with_subtype/index.md - - '(constructor)': api/byte_container_with_subtype/byte_container_with_subtype.md - - 'clear_subtype': api/byte_container_with_subtype/clear_subtype.md - - 'has_subtype': api/byte_container_with_subtype/has_subtype.md - - 'set_subtype': api/byte_container_with_subtype/set_subtype.md - - 'subtype': api/byte_container_with_subtype/subtype.md - - adl_serializer: - - 'Overview': api/adl_serializer/index.md - - 'from_json': api/adl_serializer/from_json.md - - 'to_json': api/adl_serializer/to_json.md - - 'json': api/json.md - - json_pointer: - - 'Overview': api/json_pointer/index.md - - '(Constructor)': api/json_pointer/json_pointer.md - - 'back': api/json_pointer/back.md - - 'empty': api/json_pointer/empty.md - - 'operator std::string': api/json_pointer/operator_string.md - - 'operator/': api/json_pointer/operator_slash.md - - 'operator/=': api/json_pointer/operator_slasheq.md - - 'parent_pointer': api/json_pointer/parent_pointer.md - - 'pop_back': api/json_pointer/pop_back.md - - 'push_back': api/json_pointer/push_back.md - - 'to_string': api/json_pointer/to_string.md - - json_sax: - - 'Overview': api/json_sax/index.md - - 'binary': api/json_sax/binary.md - - 'boolean': api/json_sax/boolean.md - - 'end_array': api/json_sax/end_array.md - - 'end_object': api/json_sax/end_object.md - - 'key': api/json_sax/key.md - - 'null': api/json_sax/null.md - - 'number_float': api/json_sax/number_float.md - - 'number_integer': api/json_sax/number_integer.md - - 'number_unsigned': api/json_sax/number_unsigned.md - - 'parse_error': api/json_sax/parse_error.md - - 'start_array': api/json_sax/start_array.md - - 'start_object': api/json_sax/start_object.md - - 'string': api/json_sax/string.md - - 'ordered_json': api/ordered_json.md - - 'ordered_map': api/ordered_map.md - - macros: - - 'Overview': api/macros/index.md - - 'JSON_ASSERT(x)': api/macros/json_assert.md - -# Extras -extra: - social: - - icon: fontawesome/brands/github - link: https://github.com/nlohmann - - icon: fontawesome/brands/twitter - link: https://twitter.com/nlohmann - - icon: fontawesome/brands/linkedin - link: https://www.linkedin.com/in/nielslohmann/ - - icon: fontawesome/brands/xing - link: https://www.xing.com/profile/Niels_Lohmann - - icon: fontawesome/brands/paypal - link: https://www.paypal.me/nlohmann - generator: false - -# Extensions -markdown_extensions: - - abbr - - admonition - - attr_list - - def_list - - codehilite: - guess_lang: false - - toc: - permalink: true - - pymdownx.arithmatex - - pymdownx.betterem: - smart_enable: all - - pymdownx.caret - - pymdownx.critic - - pymdownx.details - - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg - - pymdownx.inlinehilite - - pymdownx.magiclink - - pymdownx.mark - #- pymdownx.smartsymbols - - pymdownx.superfences - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.tabbed - - pymdownx.tilde - - pymdownx.snippets: - base_path: docs - check_paths: true - - plantuml_markdown: - format: svg - -plugins: - - search: - separator: '[\s\-\.]' - lang: en - - minify: - minify_html: true - -extra_javascript: - - https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/requirements.txt b/Sources/backend-cpp/Vendor/json/doc/mkdocs/requirements.txt deleted file mode 100644 index b64e9b87..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/requirements.txt +++ /dev/null @@ -1,29 +0,0 @@ -click>=7.1.2 -future>=0.18.2 -htmlmin>=0.1.12 -httplib2>=0.18.1 -importlib-metadata>=1.6.0 -Jinja2>=2.11.2 -joblib>=0.15.1 -jsmin>=2.2.2 -livereload>=2.6.1 -lunr>=0.5.8 -Markdown>=3.2.2 -markdown-include>=0.5.1 -MarkupSafe>=1.1.1 -mkdocs>=1.1.2 -mkdocs-material>=5.2.1 -mkdocs-material-extensions>=1.0 -mkdocs-minify-plugin>=0.3.0 -mkdocs-simple-hooks>=0.1.1 -nltk>=3.5 -plantuml>=0.3.0 -plantuml-markdown>=3.2.2 -Pygments>=2.6.1 -pymdown-extensions>=7.1 -PyYAML>=5.3.1 -regex>=2020.5.14 -six>=1.15.0 -tornado>=6.0.4 -tqdm>=4.46.0 -zipp>=3.1.0 diff --git a/Sources/backend-cpp/Vendor/json/doc/mkdocs/scripts/check_structure.py b/Sources/backend-cpp/Vendor/json/doc/mkdocs/scripts/check_structure.py deleted file mode 100644 index cacc51cb..00000000 --- a/Sources/backend-cpp/Vendor/json/doc/mkdocs/scripts/check_structure.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python - -import glob -import os.path - - -def check_structure(): - expected_headers = [ - 'Template parameters', - 'Specializations', - 'Iterator invalidation', - 'Requirements', - 'Member types', - 'Member functions', - 'Member variables', - 'Static functions', - 'Non-member functions', - 'Literals', - 'Helper classes', - 'Parameters', - 'Return value', - 'Exception safety', - 'Exceptions', - 'Complexity', - 'Possible implementation', - 'Notes', - 'Examples', - 'See also', - 'Version history' - ] - - required_headers = [ - 'Examples', - 'Version history' - ] - - files = sorted(glob.glob('api/**/*.md', recursive=True)) - for file in files: - with open(file) as file_content: - header_idx = -1 - existing_headers = [] - in_initial_code_example = False - previous_line = None - h1sections = 0 - - for lineno, line in enumerate(file_content.readlines()): - line = line.strip() - - if line.startswith('# '): - h1sections += 1 - - # there should only be one top-level title - if h1sections > 1: - print(f'{file}:{lineno+1}: Error: unexpected top-level title "{line}"!') - h1sections = 1 - - # Overview pages should have a better title - if line == '# Overview': - print(f'{file}:{lineno+1}: Error: overview pages should have a better title!') - - # lines longer than 160 characters are bad (unless they are tables) - if len(line) > 160 and '|' not in line: - print(f'{file}:{lineno+1}: Error: line is too long ({len(line)} vs. 160 chars)!') - - # check if headers are correct - if line.startswith('## '): - header = line.strip('## ') - existing_headers.append(header) - - if header in expected_headers: - idx = expected_headers.index(header) - if idx <= header_idx: - print(f'{file}:{lineno+1}: Error: header "{header}" is in an unexpected order (should be before "{expected_headers[header_idx]}")!') - header_idx = idx - else: - print(f'{file}:{lineno+1}: Error: header "{header}" is not part of the expected headers!') - - # code example - if line == '```cpp' and header_idx == -1: - in_initial_code_example = True - - if in_initial_code_example and line.startswith('//'): - if any(map(str.isdigit, line)) and '(' not in line: - print(f'{file}:{lineno+1}: Number should be in parentheses: {line}') - - if line == '```' and in_initial_code_example: - in_initial_code_example = False - - # consecutive blank lines are bad - if line == '' and previous_line == '': - print(f'{file}:{lineno}-{lineno+1}: Error: Consecutive blank lines!') - - previous_line = line - - for required_header in required_headers: - if required_header not in existing_headers: - print(f'{file}:{lineno+1}: Error: required header "{required_header}" was not found!') - - -def check_examples(): - example_files = sorted(glob.glob('../../examples/*.cpp')) - markdown_files = sorted(glob.glob('**/*.md', recursive=True)) - - # check if every example file is used in at least one markdown file - for example_file in example_files: - example_file = os.path.join('examples', os.path.basename(example_file)) - - found = False - for markdown_file in markdown_files: - content = ' '.join(open(markdown_file).readlines()) - if example_file in content: - found = True - break - - if not found: - print(f'{example_file}: Error: example file is not used in any documentation file!') - - -if __name__ == '__main__': - check_structure() - check_examples() diff --git a/Sources/backend-cpp/Vendor/json/doc/usages/ios.png b/Sources/backend-cpp/Vendor/json/doc/usages/ios.png deleted file mode 100644 index 1d2c1b80..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/usages/ios.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/json/doc/usages/macos.png b/Sources/backend-cpp/Vendor/json/doc/usages/macos.png deleted file mode 100644 index 107b5f07..00000000 Binary files a/Sources/backend-cpp/Vendor/json/doc/usages/macos.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/COPYRIGHT b/Sources/backend-cpp/Vendor/lua-5.1.5/COPYRIGHT deleted file mode 100644 index a8602680..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/COPYRIGHT +++ /dev/null @@ -1,34 +0,0 @@ -Lua License ------------ - -Lua is licensed under the terms of the MIT license reproduced below. -This means that Lua is free software and can be used for both academic -and commercial purposes at absolutely no cost. - -For details and rationale, see http://www.lua.org/license.html . - -=============================================================================== - -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. - -=============================================================================== - -(end of COPYRIGHT) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/HISTORY b/Sources/backend-cpp/Vendor/lua-5.1.5/HISTORY deleted file mode 100644 index ce0c95bc..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/HISTORY +++ /dev/null @@ -1,183 +0,0 @@ -HISTORY for Lua 5.1 - -* Changes from version 5.0 to 5.1 - ------------------------------- - Language: - + new module system. - + new semantics for control variables of fors. - + new semantics for setn/getn. - + new syntax/semantics for varargs. - + new long strings and comments. - + new `mod' operator (`%') - + new length operator #t - + metatables for all types - API: - + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. - + user supplies memory allocator (lua_open becomes lua_newstate). - + luaopen_* functions must be called through Lua. - Implementation: - + new configuration scheme via luaconf.h. - + incremental garbage collection. - + better handling of end-of-line in the lexer. - + fully reentrant parser (new Lua function `load') - + better support for 64-bit machines. - + native loadlib support for Mac OS X. - + standard distribution in only one library (lualib.a merged into lua.a) - -* Changes from version 4.0 to 5.0 - ------------------------------- - Language: - + lexical scoping. - + Lua coroutines. - + standard libraries now packaged in tables. - + tags replaced by metatables and tag methods replaced by metamethods, - stored in metatables. - + proper tail calls. - + each function can have its own global table, which can be shared. - + new __newindex metamethod, called when we insert a new key into a table. - + new block comments: --[[ ... ]]. - + new generic for. - + new weak tables. - + new boolean type. - + new syntax "local function". - + (f()) returns the first value returned by f. - + {f()} fills a table with all values returned by f. - + \n ignored in [[\n . - + fixed and-or priorities. - + more general syntax for function definition (e.g. function a.x.y:f()...end). - + more general syntax for function calls (e.g. (print or write)(9)). - + new functions (time/date, tmpfile, unpack, require, load*, etc.). - API: - + chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer. - + introduced lightweight userdata, a simple "void*" without a metatable. - + new error handling protocol: the core no longer prints error messages; - all errors are reported to the caller on the stack. - + new lua_atpanic for host cleanup. - + new, signal-safe, hook scheme. - Implementation: - + new license: MIT. - + new, faster, register-based virtual machine. - + support for external multithreading and coroutines. - + new and consistent error message format. - + the core no longer needs "stdio.h" for anything (except for a single - use of sprintf to convert numbers to strings). - + lua.c now runs the environment variable LUA_INIT, if present. It can - be "@filename", to run a file, or the chunk itself. - + support for user extensions in lua.c. - sample implementation given for command line editing. - + new dynamic loading library, active by default on several platforms. - + safe garbage-collector metamethods. - + precompiled bytecodes checked for integrity (secure binary dostring). - + strings are fully aligned. - + position capture in string.find. - + read('*l') can read lines with embedded zeros. - -* Changes from version 3.2 to 4.0 - ------------------------------- - Language: - + new "break" and "for" statements (both numerical and for tables). - + uniform treatment of globals: globals are now stored in a Lua table. - + improved error messages. - + no more '$debug': full speed *and* full debug information. - + new read form: read(N) for next N bytes. - + general read patterns now deprecated. - (still available with -DCOMPAT_READPATTERNS.) - + all return values are passed as arguments for the last function - (old semantics still available with -DLUA_COMPAT_ARGRET) - + garbage collection tag methods for tables now deprecated. - + there is now only one tag method for order. - API: - + New API: fully re-entrant, simpler, and more efficient. - + New debug API. - Implementation: - + faster than ever: cleaner virtual machine and new hashing algorithm. - + non-recursive garbage-collector algorithm. - + reduced memory usage for programs with many strings. - + improved treatment for memory allocation errors. - + improved support for 16-bit machines (we hope). - + code now compiles unmodified as both ANSI C and C++. - + numbers in bases other than 10 are converted using strtoul. - + new -f option in Lua to support #! scripts. - + luac can now combine text and binaries. - -* Changes from version 3.1 to 3.2 - ------------------------------- - + redirected all output in Lua's core to _ERRORMESSAGE and _ALERT. - + increased limit on the number of constants and globals per function - (from 2^16 to 2^24). - + debugging info (lua_debug and hooks) moved into lua_state and new API - functions provided to get and set this info. - + new debug lib gives full debugging access within Lua. - + new table functions "foreachi", "sort", "tinsert", "tremove", "getn". - + new io functions "flush", "seek". - -* Changes from version 3.0 to 3.1 - ------------------------------- - + NEW FEATURE: anonymous functions with closures (via "upvalues"). - + new syntax: - - local variables in chunks. - - better scope control with DO block END. - - constructors can now be also written: { record-part; list-part }. - - more general syntax for function calls and lvalues, e.g.: - f(x).y=1 - o:f(x,y):g(z) - f"string" is sugar for f("string") - + strings may now contain arbitrary binary data (e.g., embedded zeros). - + major code re-organization and clean-up; reduced module interdependecies. - + no arbitrary limits on the total number of constants and globals. - + support for multiple global contexts. - + better syntax error messages. - + new traversal functions "foreach" and "foreachvar". - + the default for numbers is now double. - changing it to use floats or longs is easy. - + complete debug information stored in pre-compiled chunks. - + sample interpreter now prompts user when run interactively, and also - handles control-C interruptions gracefully. - -* Changes from version 2.5 to 3.0 - ------------------------------- - + NEW CONCEPT: "tag methods". - Tag methods replace fallbacks as the meta-mechanism for extending the - semantics of Lua. Whereas fallbacks had a global nature, tag methods - work on objects having the same tag (e.g., groups of tables). - Existing code that uses fallbacks should work without change. - + new, general syntax for constructors {[exp] = exp, ... }. - + support for handling variable number of arguments in functions (varargs). - + support for conditional compilation ($if ... $else ... $end). - + cleaner semantics in API simplifies host code. - + better support for writing libraries (auxlib.h). - + better type checking and error messages in the standard library. - + luac can now also undump. - -* Changes from version 2.4 to 2.5 - ------------------------------- - + io and string libraries are now based on pattern matching; - the old libraries are still available for compatibility - + dofile and dostring can now return values (via return statement) - + better support for 16- and 64-bit machines - + expanded documentation, with more examples - -* Changes from version 2.2 to 2.4 - ------------------------------- - + external compiler creates portable binary files that can be loaded faster - + interface for debugging and profiling - + new "getglobal" fallback - + new functions for handling references to Lua objects - + new functions in standard lib - + only one copy of each string is stored - + expanded documentation, with more examples - -* Changes from version 2.1 to 2.2 - ------------------------------- - + functions now may be declared with any "lvalue" as a name - + garbage collection of functions - + support for pipes - -* Changes from version 1.1 to 2.1 - ------------------------------- - + object-oriented support - + fallbacks - + simplified syntax for tables - + many internal improvements - -(end of HISTORY) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/INSTALL b/Sources/backend-cpp/Vendor/lua-5.1.5/INSTALL deleted file mode 100644 index 17eb8aee..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/INSTALL +++ /dev/null @@ -1,99 +0,0 @@ -INSTALL for Lua 5.1 - -* Building Lua - ------------ - Lua is built in the src directory, but the build process can be - controlled from the top-level Makefile. - - Building Lua on Unix systems should be very easy. First do "make" and - see if your platform is listed. If so, just do "make xxx", where xxx - is your platform name. The platforms currently supported are: - aix ansi bsd freebsd generic linux macosx mingw posix solaris - - If your platform is not listed, try the closest one or posix, generic, - ansi, in this order. - - See below for customization instructions and for instructions on how - to build with other Windows compilers. - - If you want to check that Lua has been built correctly, do "make test" - after building Lua. Also, have a look at the example programs in test. - -* Installing Lua - -------------- - Once you have built Lua, you may want to install it in an official - place in your system. In this case, do "make install". The official - place and the way to install files are defined in Makefile. You must - have the right permissions to install files. - - If you want to build and install Lua in one step, do "make xxx install", - where xxx is your platform name. - - If you want to install Lua locally, then do "make local". This will - create directories bin, include, lib, man, and install Lua there as - follows: - - bin: lua luac - include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp - lib: liblua.a - man/man1: lua.1 luac.1 - - These are the only directories you need for development. - - There are man pages for lua and luac, in both nroff and html, and a - reference manual in html in doc, some sample code in test, and some - useful stuff in etc. You don't need these directories for development. - - If you want to install Lua locally, but in some other directory, do - "make install INSTALL_TOP=xxx", where xxx is your chosen directory. - - See below for instructions for Windows and other systems. - -* Customization - ------------- - Three things can be customized by editing a file: - - Where and how to install Lua -- edit Makefile. - - How to build Lua -- edit src/Makefile. - - Lua features -- edit src/luaconf.h. - - You don't actually need to edit the Makefiles because you may set the - relevant variables when invoking make. - - On the other hand, if you need to select some Lua features, you'll need - to edit src/luaconf.h. The edited file will be the one installed, and - it will be used by any Lua clients that you build, to ensure consistency. - - We strongly recommend that you enable dynamic loading. This is done - automatically for all platforms listed above that have this feature - (and also Windows). See src/luaconf.h and also src/Makefile. - -* Building Lua on Windows and other systems - ----------------------------------------- - If you're not using the usual Unix tools, then the instructions for - building Lua depend on the compiler you use. You'll need to create - projects (or whatever your compiler uses) for building the library, - the interpreter, and the compiler, as follows: - - library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c - lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c - ltable.c ltm.c lundump.c lvm.c lzio.c - lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c - ltablib.c lstrlib.c loadlib.c linit.c - - interpreter: library, lua.c - - compiler: library, luac.c print.c - - If you use Visual Studio .NET, you can use etc/luavs.bat in its - "Command Prompt". - - If all you want is to build the Lua interpreter, you may put all .c files - in a single project, except for luac.c and print.c. Or just use etc/all.c. - - To use Lua as a library in your own programs, you'll need to know how to - create and use libraries with your compiler. - - As mentioned above, you may edit luaconf.h to select some features before - building Lua. - -(end of INSTALL) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.sln b/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.sln deleted file mode 100644 index ad2174d5..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29806.167 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua", "Lua.vcxproj", "{0A54C4AD-E08E-44A2-9484-C0B566527B82}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Debug|x64.ActiveCfg = Debug|x64 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Debug|x64.Build.0 = Debug|x64 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Debug|x86.ActiveCfg = Debug|Win32 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Debug|x86.Build.0 = Debug|Win32 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Release|x64.ActiveCfg = Release|x64 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Release|x64.Build.0 = Release|x64 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Release|x86.ActiveCfg = Release|Win32 - {0A54C4AD-E08E-44A2-9484-C0B566527B82}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {4938E26C-AEAA-45E0-8950-FBEFC3E65E2B} - EndGlobalSection -EndGlobal diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj b/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj deleted file mode 100644 index 188d602a..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - {59EEC206-84E0-4842-B89E-2025FD78E589} - Lua - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - false - $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS - true - stdcpp17 - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS - true - stdcpp17 - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj.filters b/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj.filters deleted file mode 100644 index 9744920e..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj.filters +++ /dev/null @@ -1,182 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj.user b/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj.user deleted file mode 100644 index 88a55094..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/Lua.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/Makefile b/Sources/backend-cpp/Vendor/lua-5.1.5/Makefile deleted file mode 100644 index 209a1324..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -# makefile for installing Lua -# see INSTALL for installation instructions -# see src/Makefile and src/luaconf.h for further customization - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -# Where to install. The installation starts in the src and doc directories, -# so take care if INSTALL_TOP is not an absolute path. -INSTALL_TOP= /usr/local -INSTALL_BIN= $(INSTALL_TOP)/bin -INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_MAN= $(INSTALL_TOP)/man/man1 -# -# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with -# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc). -INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V - -# How to install. If your install program does not support "-p", then you -# may have to run ranlib on the installed liblua.a (do "make ranlib"). -INSTALL= install -p -INSTALL_EXEC= $(INSTALL) -m 0755 -INSTALL_DATA= $(INSTALL) -m 0644 -# -# If you don't have install you can use cp instead. -# INSTALL= cp -p -# INSTALL_EXEC= $(INSTALL) -# INSTALL_DATA= $(INSTALL) - -# Utilities. -MKDIR= mkdir -p -RANLIB= ranlib - -# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= - -# Convenience platforms targets. -PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - -# What to install. -TO_BIN= lua luac -TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp -TO_LIB= liblua.a -TO_MAN= lua.1 luac.1 - -# Lua version and release. -V= 5.1 -R= 5.1.5 - -all: $(PLAT) - -$(PLATS) clean: - cd src && $(MAKE) $@ - -test: dummy - src/lua test/hello.lua - -install: dummy - cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) - cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) - cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) - -ranlib: - cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB) - -local: - $(MAKE) install INSTALL_TOP=.. - -none: - @echo "Please do" - @echo " make PLATFORM" - @echo "where PLATFORM is one of these:" - @echo " $(PLATS)" - @echo "See INSTALL for complete instructions." - -# make may get confused with test/ and INSTALL in a case-insensitive OS -dummy: - -# echo config parameters -echo: - @echo "" - @echo "These are the parameters currently set in src/Makefile to build Lua $R:" - @echo "" - @cd src && $(MAKE) -s echo - @echo "" - @echo "These are the parameters currently set in Makefile to install Lua $R:" - @echo "" - @echo "PLAT = $(PLAT)" - @echo "INSTALL_TOP = $(INSTALL_TOP)" - @echo "INSTALL_BIN = $(INSTALL_BIN)" - @echo "INSTALL_INC = $(INSTALL_INC)" - @echo "INSTALL_LIB = $(INSTALL_LIB)" - @echo "INSTALL_MAN = $(INSTALL_MAN)" - @echo "INSTALL_LMOD = $(INSTALL_LMOD)" - @echo "INSTALL_CMOD = $(INSTALL_CMOD)" - @echo "INSTALL_EXEC = $(INSTALL_EXEC)" - @echo "INSTALL_DATA = $(INSTALL_DATA)" - @echo "" - @echo "See also src/luaconf.h ." - @echo "" - -# echo private config parameters -pecho: - @echo "V = $(V)" - @echo "R = $(R)" - @echo "TO_BIN = $(TO_BIN)" - @echo "TO_INC = $(TO_INC)" - @echo "TO_LIB = $(TO_LIB)" - @echo "TO_MAN = $(TO_MAN)" - -# echo config parameters as Lua code -# uncomment the last sed expression if you want nil instead of empty strings -lecho: - @echo "-- installation parameters for Lua $R" - @echo "VERSION = '$V'" - @echo "RELEASE = '$R'" - @$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/' - @echo "-- EOF" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho - -# (end of Makefile) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/README b/Sources/backend-cpp/Vendor/lua-5.1.5/README deleted file mode 100644 index 11b4dff7..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/README +++ /dev/null @@ -1,37 +0,0 @@ -README for Lua 5.1 - -See INSTALL for installation instructions. -See HISTORY for a summary of changes since the last released version. - -* What is Lua? - ------------ - Lua is a powerful, light-weight programming language designed for extending - applications. Lua is also frequently used as a general-purpose, stand-alone - language. Lua is free software. - - For complete information, visit Lua's web site at http://www.lua.org/ . - For an executive summary, see http://www.lua.org/about.html . - - Lua has been used in many different projects around the world. - For a short list, see http://www.lua.org/uses.html . - -* Availability - ------------ - Lua is freely available for both academic and commercial purposes. - See COPYRIGHT and http://www.lua.org/license.html for details. - Lua can be downloaded at http://www.lua.org/download.html . - -* Installation - ------------ - Lua is implemented in pure ANSI C, and compiles unmodified in all known - platforms that have an ANSI C compiler. In most Unix-like platforms, simply - do "make" with a suitable target. See INSTALL for detailed instructions. - -* Origin - ------ - Lua is developed at Lua.org, a laboratory of the Department of Computer - Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro - in Brazil). - For more information about the authors, see http://www.lua.org/authors.html . - -(end of README) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/contents.html b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/contents.html deleted file mode 100644 index 3d83da98..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/contents.html +++ /dev/null @@ -1,497 +0,0 @@ - - - -Lua 5.1 Reference Manual - contents - - - - - - - -
-

- -Lua 5.1 Reference Manual -

- -

-The reference manual is the official definition of the Lua language. -For a complete introduction to Lua programming, see the book -Programming in Lua. - -

-This manual is also available as a book: -

- - - -Lua 5.1 Reference Manual -
by R. Ierusalimschy, L. H. de Figueiredo, W. Celes -
Lua.org, August 2006 -
ISBN 85-903798-3-3 -
-
- -

-Buy a copy -of this book and -help to support -the Lua project. - -

-start -· -contents -· -index -· -other versions -


- -Copyright © 2006–2012 Lua.org, PUC-Rio. -Freely available under the terms of the -Lua license. - - -

Contents

- - -

Index

- - - - - - - -
-

Lua functions

-_G
-_VERSION
-

- -assert
-collectgarbage
-dofile
-error
-getfenv
-getmetatable
-ipairs
-load
-loadfile
-loadstring
-module
-next
-pairs
-pcall
-print
-rawequal
-rawget
-rawset
-require
-select
-setfenv
-setmetatable
-tonumber
-tostring
-type
-unpack
-xpcall
-

- -coroutine.create
-coroutine.resume
-coroutine.running
-coroutine.status
-coroutine.wrap
-coroutine.yield
-

- -debug.debug
-debug.getfenv
-debug.gethook
-debug.getinfo
-debug.getlocal
-debug.getmetatable
-debug.getregistry
-debug.getupvalue
-debug.setfenv
-debug.sethook
-debug.setlocal
-debug.setmetatable
-debug.setupvalue
-debug.traceback
- -

-

 

-file:close
-file:flush
-file:lines
-file:read
-file:seek
-file:setvbuf
-file:write
-

- -io.close
-io.flush
-io.input
-io.lines
-io.open
-io.output
-io.popen
-io.read
-io.stderr
-io.stdin
-io.stdout
-io.tmpfile
-io.type
-io.write
-

- -math.abs
-math.acos
-math.asin
-math.atan
-math.atan2
-math.ceil
-math.cos
-math.cosh
-math.deg
-math.exp
-math.floor
-math.fmod
-math.frexp
-math.huge
-math.ldexp
-math.log
-math.log10
-math.max
-math.min
-math.modf
-math.pi
-math.pow
-math.rad
-math.random
-math.randomseed
-math.sin
-math.sinh
-math.sqrt
-math.tan
-math.tanh
-

- -os.clock
-os.date
-os.difftime
-os.execute
-os.exit
-os.getenv
-os.remove
-os.rename
-os.setlocale
-os.time
-os.tmpname
-

- -package.cpath
-package.loaded
-package.loaders
-package.loadlib
-package.path
-package.preload
-package.seeall
-

- -string.byte
-string.char
-string.dump
-string.find
-string.format
-string.gmatch
-string.gsub
-string.len
-string.lower
-string.match
-string.rep
-string.reverse
-string.sub
-string.upper
-

- -table.concat
-table.insert
-table.maxn
-table.remove
-table.sort
- -

-

C API

-lua_Alloc
-lua_CFunction
-lua_Debug
-lua_Hook
-lua_Integer
-lua_Number
-lua_Reader
-lua_State
-lua_Writer
-

- -lua_atpanic
-lua_call
-lua_checkstack
-lua_close
-lua_concat
-lua_cpcall
-lua_createtable
-lua_dump
-lua_equal
-lua_error
-lua_gc
-lua_getallocf
-lua_getfenv
-lua_getfield
-lua_getglobal
-lua_gethook
-lua_gethookcount
-lua_gethookmask
-lua_getinfo
-lua_getlocal
-lua_getmetatable
-lua_getstack
-lua_gettable
-lua_gettop
-lua_getupvalue
-lua_insert
-lua_isboolean
-lua_iscfunction
-lua_isfunction
-lua_islightuserdata
-lua_isnil
-lua_isnone
-lua_isnoneornil
-lua_isnumber
-lua_isstring
-lua_istable
-lua_isthread
-lua_isuserdata
-lua_lessthan
-lua_load
-lua_newstate
-lua_newtable
-lua_newthread
-lua_newuserdata
-lua_next
-lua_objlen
-lua_pcall
-lua_pop
-lua_pushboolean
-lua_pushcclosure
-lua_pushcfunction
-lua_pushfstring
-lua_pushinteger
-lua_pushlightuserdata
-lua_pushliteral
-lua_pushlstring
-lua_pushnil
-lua_pushnumber
-lua_pushstring
-lua_pushthread
-lua_pushvalue
-lua_pushvfstring
-lua_rawequal
-lua_rawget
-lua_rawgeti
-lua_rawset
-lua_rawseti
-lua_register
-lua_remove
-lua_replace
-lua_resume
-lua_setallocf
-lua_setfenv
-lua_setfield
-lua_setglobal
-lua_sethook
-lua_setlocal
-lua_setmetatable
-lua_settable
-lua_settop
-lua_setupvalue
-lua_status
-lua_toboolean
-lua_tocfunction
-lua_tointeger
-lua_tolstring
-lua_tonumber
-lua_topointer
-lua_tostring
-lua_tothread
-lua_touserdata
-lua_type
-lua_typename
-lua_upvalueindex
-lua_xmove
-lua_yield
- -

-

auxiliary library

-luaL_Buffer
-luaL_Reg
-

- -luaL_addchar
-luaL_addlstring
-luaL_addsize
-luaL_addstring
-luaL_addvalue
-luaL_argcheck
-luaL_argerror
-luaL_buffinit
-luaL_callmeta
-luaL_checkany
-luaL_checkint
-luaL_checkinteger
-luaL_checklong
-luaL_checklstring
-luaL_checknumber
-luaL_checkoption
-luaL_checkstack
-luaL_checkstring
-luaL_checktype
-luaL_checkudata
-luaL_dofile
-luaL_dostring
-luaL_error
-luaL_getmetafield
-luaL_getmetatable
-luaL_gsub
-luaL_loadbuffer
-luaL_loadfile
-luaL_loadstring
-luaL_newmetatable
-luaL_newstate
-luaL_openlibs
-luaL_optint
-luaL_optinteger
-luaL_optlong
-luaL_optlstring
-luaL_optnumber
-luaL_optstring
-luaL_prepbuffer
-luaL_pushresult
-luaL_ref
-luaL_register
-luaL_typename
-luaL_typerror
-luaL_unref
-luaL_where
- -

-

- -


- -Last update: -Mon Feb 13 18:53:32 BRST 2012 - - - - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/cover.png b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/cover.png deleted file mode 100644 index 2dbb1981..00000000 Binary files a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/cover.png and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/logo.gif b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/logo.gif deleted file mode 100644 index 2f5e4ac2..00000000 Binary files a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/logo.gif and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.1 b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.1 deleted file mode 100644 index 24809cc6..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.1 +++ /dev/null @@ -1,163 +0,0 @@ -.\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -.TH LUA 1 "$Date: 2006/01/06 16:03:34 $" -.SH NAME -lua \- Lua interpreter -.SH SYNOPSIS -.B lua -[ -.I options -] -[ -.I script -[ -.I args -] -] -.SH DESCRIPTION -.B lua -is the stand-alone Lua interpreter. -It loads and executes Lua programs, -either in textual source form or -in precompiled binary form. -(Precompiled binaries are output by -.BR luac , -the Lua compiler.) -.B lua -can be used as a batch interpreter and also interactively. -.LP -The given -.I options -(see below) -are executed and then -the Lua program in file -.I script -is loaded and executed. -The given -.I args -are available to -.I script -as strings in a global table named -.BR arg . -If these arguments contain spaces or other characters special to the shell, -then they should be quoted -(but note that the quotes will be removed by the shell). -The arguments in -.B arg -start at 0, -which contains the string -.RI ' script '. -The index of the last argument is stored in -.BR arg.n . -The arguments given in the command line before -.IR script , -including the name of the interpreter, -are available in negative indices in -.BR arg . -.LP -At the very start, -before even handling the command line, -.B lua -executes the contents of the environment variable -.BR LUA_INIT , -if it is defined. -If the value of -.B LUA_INIT -is of the form -.RI '@ filename ', -then -.I filename -is executed. -Otherwise, the string is assumed to be a Lua statement and is executed. -.LP -Options start with -.B '\-' -and are described below. -You can use -.B "'\--'" -to signal the end of options. -.LP -If no arguments are given, -then -.B "\-v \-i" -is assumed when the standard input is a terminal; -otherwise, -.B "\-" -is assumed. -.LP -In interactive mode, -.B lua -prompts the user, -reads lines from the standard input, -and executes them as they are read. -If a line does not contain a complete statement, -then a secondary prompt is displayed and -lines are read until a complete statement is formed or -a syntax error is found. -So, one way to interrupt the reading of an incomplete statement is -to force a syntax error: -adding a -.B ';' -in the middle of a statement is a sure way of forcing a syntax error -(except inside multiline strings and comments; these must be closed explicitly). -If a line starts with -.BR '=' , -then -.B lua -displays the values of all the expressions in the remainder of the -line. The expressions must be separated by commas. -The primary prompt is the value of the global variable -.BR _PROMPT , -if this value is a string; -otherwise, the default prompt is used. -Similarly, the secondary prompt is the value of the global variable -.BR _PROMPT2 . -So, -to change the prompts, -set the corresponding variable to a string of your choice. -You can do that after calling the interpreter -or on the command line -(but in this case you have to be careful with quotes -if the prompt string contains a space; otherwise you may confuse the shell.) -The default prompts are "> " and ">> ". -.SH OPTIONS -.TP -.B \- -load and execute the standard input as a file, -that is, -not interactively, -even when the standard input is a terminal. -.TP -.BI \-e " stat" -execute statement -.IR stat . -You need to quote -.I stat -if it contains spaces, quotes, -or other characters special to the shell. -.TP -.B \-i -enter interactive mode after -.I script -is executed. -.TP -.BI \-l " name" -call -.BI require(' name ') -before executing -.IR script . -Typically used to load libraries. -.TP -.B \-v -show version information. -.SH "SEE ALSO" -.BR luac (1) -.br -http://www.lua.org/ -.SH DIAGNOSTICS -Error messages should be self explanatory. -.SH AUTHORS -R. Ierusalimschy, -L. H. de Figueiredo, -and -W. Celes -.\" EOF diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.css b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.css deleted file mode 100644 index 7fafbb1b..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.css +++ /dev/null @@ -1,83 +0,0 @@ -body { - color: #000000 ; - background-color: #FFFFFF ; - font-family: Helvetica, Arial, sans-serif ; - text-align: justify ; - margin-right: 30px ; - margin-left: 30px ; -} - -h1, h2, h3, h4 { - font-family: Verdana, Geneva, sans-serif ; - font-weight: normal ; - font-style: italic ; -} - -h2 { - padding-top: 0.4em ; - padding-bottom: 0.4em ; - padding-left: 30px ; - padding-right: 30px ; - margin-left: -30px ; - background-color: #E0E0FF ; -} - -h3 { - padding-left: 0.5em ; - border-left: solid #E0E0FF 1em ; -} - -table h3 { - padding-left: 0px ; - border-left: none ; -} - -a:link { - color: #000080 ; - background-color: inherit ; - text-decoration: none ; -} - -a:visited { - background-color: inherit ; - text-decoration: none ; -} - -a:link:hover, a:visited:hover { - color: #000080 ; - background-color: #E0E0FF ; -} - -a:link:active, a:visited:active { - color: #FF0000 ; -} - -hr { - border: 0 ; - height: 1px ; - color: #a0a0a0 ; - background-color: #a0a0a0 ; -} - -:target { - background-color: #F8F8F8 ; - padding: 8px ; - border: solid #a0a0a0 2px ; -} - -.footer { - color: gray ; - font-size: small ; -} - -input[type=text] { - border: solid #a0a0a0 2px ; - border-radius: 2em ; - -moz-border-radius: 2em ; - background-image: url('images/search.png') ; - background-repeat: no-repeat; - background-position: 4px center ; - padding-left: 20px ; - height: 2em ; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.html b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.html deleted file mode 100644 index 1d435ab0..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/lua.html +++ /dev/null @@ -1,172 +0,0 @@ - - - -LUA man page - - - - - -

NAME

-lua - Lua interpreter -

SYNOPSIS

-lua -[ -options -] -[ -script -[ -args -] -] -

DESCRIPTION

-lua -is the stand-alone Lua interpreter. -It loads and executes Lua programs, -either in textual source form or -in precompiled binary form. -(Precompiled binaries are output by -luac, -the Lua compiler.) -lua -can be used as a batch interpreter and also interactively. -

-The given -options -(see below) -are executed and then -the Lua program in file -script -is loaded and executed. -The given -args -are available to -script -as strings in a global table named -arg. -If these arguments contain spaces or other characters special to the shell, -then they should be quoted -(but note that the quotes will be removed by the shell). -The arguments in -arg -start at 0, -which contains the string -'script'. -The index of the last argument is stored in -arg.n. -The arguments given in the command line before -script, -including the name of the interpreter, -are available in negative indices in -arg. -

-At the very start, -before even handling the command line, -lua -executes the contents of the environment variable -LUA_INIT, -if it is defined. -If the value of -LUA_INIT -is of the form -'@filename', -then -filename -is executed. -Otherwise, the string is assumed to be a Lua statement and is executed. -

-Options start with -'-' -and are described below. -You can use -'--' -to signal the end of options. -

-If no arguments are given, -then -"-v -i" -is assumed when the standard input is a terminal; -otherwise, -"-" -is assumed. -

-In interactive mode, -lua -prompts the user, -reads lines from the standard input, -and executes them as they are read. -If a line does not contain a complete statement, -then a secondary prompt is displayed and -lines are read until a complete statement is formed or -a syntax error is found. -So, one way to interrupt the reading of an incomplete statement is -to force a syntax error: -adding a -';' -in the middle of a statement is a sure way of forcing a syntax error -(except inside multiline strings and comments; these must be closed explicitly). -If a line starts with -'=', -then -lua -displays the values of all the expressions in the remainder of the -line. The expressions must be separated by commas. -The primary prompt is the value of the global variable -_PROMPT, -if this value is a string; -otherwise, the default prompt is used. -Similarly, the secondary prompt is the value of the global variable -_PROMPT2. -So, -to change the prompts, -set the corresponding variable to a string of your choice. -You can do that after calling the interpreter -or on the command line -(but in this case you have to be careful with quotes -if the prompt string contains a space; otherwise you may confuse the shell.) -The default prompts are "> " and ">> ". -

OPTIONS

-

-- -load and execute the standard input as a file, -that is, -not interactively, -even when the standard input is a terminal. -

--e stat -execute statement -stat. -You need to quote -stat -if it contains spaces, quotes, -or other characters special to the shell. -

--i -enter interactive mode after -script -is executed. -

--l name -call -require('name') -before executing -script. -Typically used to load libraries. -

--v -show version information. -

SEE ALSO

-luac(1) -
-http://www.lua.org/ -

DIAGNOSTICS

-Error messages should be self explanatory. -

AUTHORS

-R. Ierusalimschy, -L. H. de Figueiredo, -and -W. Celes - - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/luac.html b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/luac.html deleted file mode 100644 index 179ffe82..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/luac.html +++ /dev/null @@ -1,145 +0,0 @@ - - - -LUAC man page - - - - - -

NAME

-luac - Lua compiler -

SYNOPSIS

-luac -[ -options -] [ -filenames -] -

DESCRIPTION

-luac -is the Lua compiler. -It translates programs written in the Lua programming language -into binary files that can be later loaded and executed. -

-The main advantages of precompiling chunks are: -faster loading, -protecting source code from accidental user changes, -and -off-line syntax checking. -

-Precompiling does not imply faster execution -because in Lua chunks are always compiled into bytecodes before being executed. -luac -simply allows those bytecodes to be saved in a file for later execution. -

-Precompiled chunks are not necessarily smaller than the corresponding source. -The main goal in precompiling is faster loading. -

-The binary files created by -luac -are portable only among architectures with the same word size and byte order. -

-luac -produces a single output file containing the bytecodes -for all source files given. -By default, -the output file is named -luac.out, -but you can change this with the --o -option. -

-In the command line, -you can mix -text files containing Lua source and -binary files containing precompiled chunks. -This is useful because several precompiled chunks, -even from different (but compatible) platforms, -can be combined into a single precompiled chunk. -

-You can use -'-' -to indicate the standard input as a source file -and -'--' -to signal the end of options -(that is, -all remaining arguments will be treated as files even if they start with -'-'). -

-The internal format of the binary files produced by -luac -is likely to change when a new version of Lua is released. -So, -save the source files of all Lua programs that you precompile. -

-

OPTIONS

-Options must be separate. -

--l -produce a listing of the compiled bytecode for Lua's virtual machine. -Listing bytecodes is useful to learn about Lua's virtual machine. -If no files are given, then -luac -loads -luac.out -and lists its contents. -

--o file -output to -file, -instead of the default -luac.out. -(You can use -'-' -for standard output, -but not on platforms that open standard output in text mode.) -The output file may be a source file because -all files are loaded before the output file is written. -Be careful not to overwrite precious files. -

--p -load files but do not generate any output file. -Used mainly for syntax checking and for testing precompiled chunks: -corrupted files will probably generate errors when loaded. -Lua always performs a thorough integrity test on precompiled chunks. -Bytecode that passes this test is completely safe, -in the sense that it will not break the interpreter. -However, -there is no guarantee that such code does anything sensible. -(None can be given, because the halting problem is unsolvable.) -If no files are given, then -luac -loads -luac.out -and tests its contents. -No messages are displayed if the file passes the integrity test. -

--s -strip debug information before writing the output file. -This saves some space in very large chunks, -but if errors occur when running a stripped chunk, -then the error messages may not contain the full information they usually do. -For instance, -line numbers and names of local variables are lost. -

--v -show version information. -

FILES

-

-luac.out -default output file -

SEE ALSO

-lua(1) -
-http://www.lua.org/ -

DIAGNOSTICS

-Error messages should be self explanatory. -

AUTHORS

-L. H. de Figueiredo, -R. Ierusalimschy and -W. Celes - - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/manual.html b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/manual.html deleted file mode 100644 index 4e41683d..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/manual.html +++ /dev/null @@ -1,8804 +0,0 @@ - - - - -Lua 5.1 Reference Manual - - - - - - - -
-

- -Lua 5.1 Reference Manual -

- -by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes -

- -Copyright © 2006–2012 Lua.org, PUC-Rio. -Freely available under the terms of the -Lua license. - -


-

- -contents -· -index -· -other versions - - -

- - - - - - -

1 - Introduction

- -

-Lua is an extension programming language designed to support -general procedural programming with data description -facilities. -It also offers good support for object-oriented programming, -functional programming, and data-driven programming. -Lua is intended to be used as a powerful, light-weight -scripting language for any program that needs one. -Lua is implemented as a library, written in clean C -(that is, in the common subset of ANSI C and C++). - - -

-Being an extension language, Lua has no notion of a "main" program: -it only works embedded in a host client, -called the embedding program or simply the host. -This host program can invoke functions to execute a piece of Lua code, -can write and read Lua variables, -and can register C functions to be called by Lua code. -Through the use of C functions, Lua can be augmented to cope with -a wide range of different domains, -thus creating customized programming languages sharing a syntactical framework. -The Lua distribution includes a sample host program called lua, -which uses the Lua library to offer a complete, stand-alone Lua interpreter. - - -

-Lua is free software, -and is provided as usual with no guarantees, -as stated in its license. -The implementation described in this manual is available -at Lua's official web site, www.lua.org. - - -

-Like any other reference manual, -this document is dry in places. -For a discussion of the decisions behind the design of Lua, -see the technical papers available at Lua's web site. -For a detailed introduction to programming in Lua, -see Roberto's book, Programming in Lua (Second Edition). - - - -

2 - The Language

- -

-This section describes the lexis, the syntax, and the semantics of Lua. -In other words, -this section describes -which tokens are valid, -how they can be combined, -and what their combinations mean. - - -

-The language constructs will be explained using the usual extended BNF notation, -in which -{a} means 0 or more a's, and -[a] means an optional a. -Non-terminals are shown like non-terminal, -keywords are shown like kword, -and other terminal symbols are shown like `=´. -The complete syntax of Lua can be found in §8 -at the end of this manual. - - - -

2.1 - Lexical Conventions

- -

-Names -(also called identifiers) -in Lua can be any string of letters, -digits, and underscores, -not beginning with a digit. -This coincides with the definition of names in most languages. -(The definition of letter depends on the current locale: -any character considered alphabetic by the current locale -can be used in an identifier.) -Identifiers are used to name variables and table fields. - - -

-The following keywords are reserved -and cannot be used as names: - - -

-     and       break     do        else      elseif
-     end       false     for       function  if
-     in        local     nil       not       or
-     repeat    return    then      true      until     while
-
- -

-Lua is a case-sensitive language: -and is a reserved word, but And and AND -are two different, valid names. -As a convention, names starting with an underscore followed by -uppercase letters (such as _VERSION) -are reserved for internal global variables used by Lua. - - -

-The following strings denote other tokens: - -

-     +     -     *     /     %     ^     #
-     ==    ~=    <=    >=    <     >     =
-     (     )     {     }     [     ]
-     ;     :     ,     .     ..    ...
-
- -

-Literal strings -can be delimited by matching single or double quotes, -and can contain the following C-like escape sequences: -'\a' (bell), -'\b' (backspace), -'\f' (form feed), -'\n' (newline), -'\r' (carriage return), -'\t' (horizontal tab), -'\v' (vertical tab), -'\\' (backslash), -'\"' (quotation mark [double quote]), -and '\'' (apostrophe [single quote]). -Moreover, a backslash followed by a real newline -results in a newline in the string. -A character in a string can also be specified by its numerical value -using the escape sequence \ddd, -where ddd is a sequence of up to three decimal digits. -(Note that if a numerical escape is to be followed by a digit, -it must be expressed using exactly three digits.) -Strings in Lua can contain any 8-bit value, including embedded zeros, -which can be specified as '\0'. - - -

-Literal strings can also be defined using a long format -enclosed by long brackets. -We define an opening long bracket of level n as an opening -square bracket followed by n equal signs followed by another -opening square bracket. -So, an opening long bracket of level 0 is written as [[, -an opening long bracket of level 1 is written as [=[, -and so on. -A closing long bracket is defined similarly; -for instance, a closing long bracket of level 4 is written as ]====]. -A long string starts with an opening long bracket of any level and -ends at the first closing long bracket of the same level. -Literals in this bracketed form can run for several lines, -do not interpret any escape sequences, -and ignore long brackets of any other level. -They can contain anything except a closing bracket of the proper level. - - -

-For convenience, -when the opening long bracket is immediately followed by a newline, -the newline is not included in the string. -As an example, in a system using ASCII -(in which 'a' is coded as 97, -newline is coded as 10, and '1' is coded as 49), -the five literal strings below denote the same string: - -

-     a = 'alo\n123"'
-     a = "alo\n123\""
-     a = '\97lo\10\04923"'
-     a = [[alo
-     123"]]
-     a = [==[
-     alo
-     123"]==]
-
- -

-A numerical constant can be written with an optional decimal part -and an optional decimal exponent. -Lua also accepts integer hexadecimal constants, -by prefixing them with 0x. -Examples of valid numerical constants are - -

-     3   3.0   3.1416   314.16e-2   0.31416E1   0xff   0x56
-
- -

-A comment starts with a double hyphen (--) -anywhere outside a string. -If the text immediately after -- is not an opening long bracket, -the comment is a short comment, -which runs until the end of the line. -Otherwise, it is a long comment, -which runs until the corresponding closing long bracket. -Long comments are frequently used to disable code temporarily. - - - - - -

2.2 - Values and Types

- -

-Lua is a dynamically typed language. -This means that -variables do not have types; only values do. -There are no type definitions in the language. -All values carry their own type. - - -

-All values in Lua are first-class values. -This means that all values can be stored in variables, -passed as arguments to other functions, and returned as results. - - -

-There are eight basic types in Lua: -nil, boolean, number, -string, function, userdata, -thread, and table. -Nil is the type of the value nil, -whose main property is to be different from any other value; -it usually represents the absence of a useful value. -Boolean is the type of the values false and true. -Both nil and false make a condition false; -any other value makes it true. -Number represents real (double-precision floating-point) numbers. -(It is easy to build Lua interpreters that use other -internal representations for numbers, -such as single-precision float or long integers; -see file luaconf.h.) -String represents arrays of characters. - -Lua is 8-bit clean: -strings can contain any 8-bit character, -including embedded zeros ('\0') (see §2.1). - - -

-Lua can call (and manipulate) functions written in Lua and -functions written in C -(see §2.5.8). - - -

-The type userdata is provided to allow arbitrary C data to -be stored in Lua variables. -This type corresponds to a block of raw memory -and has no pre-defined operations in Lua, -except assignment and identity test. -However, by using metatables, -the programmer can define operations for userdata values -(see §2.8). -Userdata values cannot be created or modified in Lua, -only through the C API. -This guarantees the integrity of data owned by the host program. - - -

-The type thread represents independent threads of execution -and it is used to implement coroutines (see §2.11). -Do not confuse Lua threads with operating-system threads. -Lua supports coroutines on all systems, -even those that do not support threads. - - -

-The type table implements associative arrays, -that is, arrays that can be indexed not only with numbers, -but with any value (except nil). -Tables can be heterogeneous; -that is, they can contain values of all types (except nil). -Tables are the sole data structuring mechanism in Lua; -they can be used to represent ordinary arrays, -symbol tables, sets, records, graphs, trees, etc. -To represent records, Lua uses the field name as an index. -The language supports this representation by -providing a.name as syntactic sugar for a["name"]. -There are several convenient ways to create tables in Lua -(see §2.5.7). - - -

-Like indices, -the value of a table field can be of any type (except nil). -In particular, -because functions are first-class values, -table fields can contain functions. -Thus tables can also carry methods (see §2.5.9). - - -

-Tables, functions, threads, and (full) userdata values are objects: -variables do not actually contain these values, -only references to them. -Assignment, parameter passing, and function returns -always manipulate references to such values; -these operations do not imply any kind of copy. - - -

-The library function type returns a string describing the type -of a given value. - - - -

2.2.1 - Coercion

- -

-Lua provides automatic conversion between -string and number values at run time. -Any arithmetic operation applied to a string tries to convert -this string to a number, following the usual conversion rules. -Conversely, whenever a number is used where a string is expected, -the number is converted to a string, in a reasonable format. -For complete control over how numbers are converted to strings, -use the format function from the string library -(see string.format). - - - - - - - -

2.3 - Variables

- -

-Variables are places that store values. - -There are three kinds of variables in Lua: -global variables, local variables, and table fields. - - -

-A single name can denote a global variable or a local variable -(or a function's formal parameter, -which is a particular kind of local variable): - -

-	var ::= Name
-

-Name denotes identifiers, as defined in §2.1. - - -

-Any variable is assumed to be global unless explicitly declared -as a local (see §2.4.7). -Local variables are lexically scoped: -local variables can be freely accessed by functions -defined inside their scope (see §2.6). - - -

-Before the first assignment to a variable, its value is nil. - - -

-Square brackets are used to index a table: - -

-	var ::= prefixexp `[´ exp `]´
-

-The meaning of accesses to global variables -and table fields can be changed via metatables. -An access to an indexed variable t[i] is equivalent to -a call gettable_event(t,i). -(See §2.8 for a complete description of the -gettable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

-The syntax var.Name is just syntactic sugar for -var["Name"]: - -

-	var ::= prefixexp `.´ Name
-
- -

-All global variables live as fields in ordinary Lua tables, -called environment tables or simply -environments (see §2.9). -Each function has its own reference to an environment, -so that all global variables in this function -will refer to this environment table. -When a function is created, -it inherits the environment from the function that created it. -To get the environment table of a Lua function, -you call getfenv. -To replace it, -you call setfenv. -(You can only manipulate the environment of C functions -through the debug library; (see §5.9).) - - -

-An access to a global variable x -is equivalent to _env.x, -which in turn is equivalent to - -

-     gettable_event(_env, "x")
-

-where _env is the environment of the running function. -(See §2.8 for a complete description of the -gettable_event function. -This function is not defined or callable in Lua. -Similarly, the _env variable is not defined in Lua. -We use them here only for explanatory purposes.) - - - - - -

2.4 - Statements

- -

-Lua supports an almost conventional set of statements, -similar to those in Pascal or C. -This set includes -assignments, control structures, function calls, -and variable declarations. - - - -

2.4.1 - Chunks

- -

-The unit of execution of Lua is called a chunk. -A chunk is simply a sequence of statements, -which are executed sequentially. -Each statement can be optionally followed by a semicolon: - -

-	chunk ::= {stat [`;´]}
-

-There are no empty statements and thus ';;' is not legal. - - -

-Lua handles a chunk as the body of an anonymous function -with a variable number of arguments -(see §2.5.9). -As such, chunks can define local variables, -receive arguments, and return values. - - -

-A chunk can be stored in a file or in a string inside the host program. -To execute a chunk, -Lua first pre-compiles the chunk into instructions for a virtual machine, -and then it executes the compiled code -with an interpreter for the virtual machine. - - -

-Chunks can also be pre-compiled into binary form; -see program luac for details. -Programs in source and compiled forms are interchangeable; -Lua automatically detects the file type and acts accordingly. - - - - - - -

2.4.2 - Blocks

-A block is a list of statements; -syntactically, a block is the same as a chunk: - -

-	block ::= chunk
-
- -

-A block can be explicitly delimited to produce a single statement: - -

-	stat ::= do block end
-

-Explicit blocks are useful -to control the scope of variable declarations. -Explicit blocks are also sometimes used to -add a return or break statement in the middle -of another block (see §2.4.4). - - - - - -

2.4.3 - Assignment

- -

-Lua allows multiple assignments. -Therefore, the syntax for assignment -defines a list of variables on the left side -and a list of expressions on the right side. -The elements in both lists are separated by commas: - -

-	stat ::= varlist `=´ explist
-	varlist ::= var {`,´ var}
-	explist ::= exp {`,´ exp}
-

-Expressions are discussed in §2.5. - - -

-Before the assignment, -the list of values is adjusted to the length of -the list of variables. -If there are more values than needed, -the excess values are thrown away. -If there are fewer values than needed, -the list is extended with as many nil's as needed. -If the list of expressions ends with a function call, -then all values returned by that call enter the list of values, -before the adjustment -(except when the call is enclosed in parentheses; see §2.5). - - -

-The assignment statement first evaluates all its expressions -and only then are the assignments performed. -Thus the code - -

-     i = 3
-     i, a[i] = i+1, 20
-

-sets a[3] to 20, without affecting a[4] -because the i in a[i] is evaluated (to 3) -before it is assigned 4. -Similarly, the line - -

-     x, y = y, x
-

-exchanges the values of x and y, -and - -

-     x, y, z = y, z, x
-

-cyclically permutes the values of x, y, and z. - - -

-The meaning of assignments to global variables -and table fields can be changed via metatables. -An assignment to an indexed variable t[i] = val is equivalent to -settable_event(t,i,val). -(See §2.8 for a complete description of the -settable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

-An assignment to a global variable x = val -is equivalent to the assignment -_env.x = val, -which in turn is equivalent to - -

-     settable_event(_env, "x", val)
-

-where _env is the environment of the running function. -(The _env variable is not defined in Lua. -We use it here only for explanatory purposes.) - - - - - -

2.4.4 - Control Structures

-The control structures -if, while, and repeat have the usual meaning and -familiar syntax: - - - - -

-	stat ::= while exp do block end
-	stat ::= repeat block until exp
-	stat ::= if exp then block {elseif exp then block} [else block] end
-

-Lua also has a for statement, in two flavors (see §2.4.5). - - -

-The condition expression of a -control structure can return any value. -Both false and nil are considered false. -All values different from nil and false are considered true -(in particular, the number 0 and the empty string are also true). - - -

-In the repeatuntil loop, -the inner block does not end at the until keyword, -but only after the condition. -So, the condition can refer to local variables -declared inside the loop block. - - -

-The return statement is used to return values -from a function or a chunk (which is just a function). - -Functions and chunks can return more than one value, -and so the syntax for the return statement is - -

-	stat ::= return [explist]
-
- -

-The break statement is used to terminate the execution of a -while, repeat, or for loop, -skipping to the next statement after the loop: - - -

-	stat ::= break
-

-A break ends the innermost enclosing loop. - - -

-The return and break -statements can only be written as the last statement of a block. -If it is really necessary to return or break in the -middle of a block, -then an explicit inner block can be used, -as in the idioms -do return end and do break end, -because now return and break are the last statements in -their (inner) blocks. - - - - - -

2.4.5 - For Statement

- -

- -The for statement has two forms: -one numeric and one generic. - - -

-The numeric for loop repeats a block of code while a -control variable runs through an arithmetic progression. -It has the following syntax: - -

-	stat ::= for Name `=´ exp `,´ exp [`,´ exp] do block end
-

-The block is repeated for name starting at the value of -the first exp, until it passes the second exp by steps of the -third exp. -More precisely, a for statement like - -

-     for v = e1, e2, e3 do block end
-

-is equivalent to the code: - -

-     do
-       local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
-       if not (var and limit and step) then error() end
-       while (step > 0 and var <= limit) or (step <= 0 and var >= limit) do
-         local v = var
-         block
-         var = var + step
-       end
-     end
-

-Note the following: - -

    - -
  • -All three control expressions are evaluated only once, -before the loop starts. -They must all result in numbers. -
  • - -
  • -var, limit, and step are invisible variables. -The names shown here are for explanatory purposes only. -
  • - -
  • -If the third expression (the step) is absent, -then a step of 1 is used. -
  • - -
  • -You can use break to exit a for loop. -
  • - -
  • -The loop variable v is local to the loop; -you cannot use its value after the for ends or is broken. -If you need this value, -assign it to another variable before breaking or exiting the loop. -
  • - -
- -

-The generic for statement works over functions, -called iterators. -On each iteration, the iterator function is called to produce a new value, -stopping when this new value is nil. -The generic for loop has the following syntax: - -

-	stat ::= for namelist in explist do block end
-	namelist ::= Name {`,´ Name}
-

-A for statement like - -

-     for var_1, ···, var_n in explist do block end
-

-is equivalent to the code: - -

-     do
-       local f, s, var = explist
-       while true do
-         local var_1, ···, var_n = f(s, var)
-         var = var_1
-         if var == nil then break end
-         block
-       end
-     end
-

-Note the following: - -

    - -
  • -explist is evaluated only once. -Its results are an iterator function, -a state, -and an initial value for the first iterator variable. -
  • - -
  • -f, s, and var are invisible variables. -The names are here for explanatory purposes only. -
  • - -
  • -You can use break to exit a for loop. -
  • - -
  • -The loop variables var_i are local to the loop; -you cannot use their values after the for ends. -If you need these values, -then assign them to other variables before breaking or exiting the loop. -
  • - -
- - - - -

2.4.6 - Function Calls as Statements

-To allow possible side-effects, -function calls can be executed as statements: - -

-	stat ::= functioncall
-

-In this case, all returned values are thrown away. -Function calls are explained in §2.5.8. - - - - - -

2.4.7 - Local Declarations

-Local variables can be declared anywhere inside a block. -The declaration can include an initial assignment: - -

-	stat ::= local namelist [`=´ explist]
-

-If present, an initial assignment has the same semantics -of a multiple assignment (see §2.4.3). -Otherwise, all variables are initialized with nil. - - -

-A chunk is also a block (see §2.4.1), -and so local variables can be declared in a chunk outside any explicit block. -The scope of such local variables extends until the end of the chunk. - - -

-The visibility rules for local variables are explained in §2.6. - - - - - - - -

2.5 - Expressions

- -

-The basic expressions in Lua are the following: - -

-	exp ::= prefixexp
-	exp ::= nil | false | true
-	exp ::= Number
-	exp ::= String
-	exp ::= function
-	exp ::= tableconstructor
-	exp ::= `...´
-	exp ::= exp binop exp
-	exp ::= unop exp
-	prefixexp ::= var | functioncall | `(´ exp `)´
-
- -

-Numbers and literal strings are explained in §2.1; -variables are explained in §2.3; -function definitions are explained in §2.5.9; -function calls are explained in §2.5.8; -table constructors are explained in §2.5.7. -Vararg expressions, -denoted by three dots ('...'), can only be used when -directly inside a vararg function; -they are explained in §2.5.9. - - -

-Binary operators comprise arithmetic operators (see §2.5.1), -relational operators (see §2.5.2), logical operators (see §2.5.3), -and the concatenation operator (see §2.5.4). -Unary operators comprise the unary minus (see §2.5.1), -the unary not (see §2.5.3), -and the unary length operator (see §2.5.5). - - -

-Both function calls and vararg expressions can result in multiple values. -If an expression is used as a statement -(only possible for function calls (see §2.4.6)), -then its return list is adjusted to zero elements, -thus discarding all returned values. -If an expression is used as the last (or the only) element -of a list of expressions, -then no adjustment is made -(unless the call is enclosed in parentheses). -In all other contexts, -Lua adjusts the result list to one element, -discarding all values except the first one. - - -

-Here are some examples: - -

-     f()                -- adjusted to 0 results
-     g(f(), x)          -- f() is adjusted to 1 result
-     g(x, f())          -- g gets x plus all results from f()
-     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
-     a,b = ...          -- a gets the first vararg parameter, b gets
-                        -- the second (both a and b can get nil if there
-                        -- is no corresponding vararg parameter)
-     
-     a,b,c = x, f()     -- f() is adjusted to 2 results
-     a,b,c = f()        -- f() is adjusted to 3 results
-     return f()         -- returns all results from f()
-     return ...         -- returns all received vararg parameters
-     return x,y,f()     -- returns x, y, and all results from f()
-     {f()}              -- creates a list with all results from f()
-     {...}              -- creates a list with all vararg parameters
-     {f(), nil}         -- f() is adjusted to 1 result
-
- -

-Any expression enclosed in parentheses always results in only one value. -Thus, -(f(x,y,z)) is always a single value, -even if f returns several values. -(The value of (f(x,y,z)) is the first value returned by f -or nil if f does not return any values.) - - - -

2.5.1 - Arithmetic Operators

-Lua supports the usual arithmetic operators: -the binary + (addition), -- (subtraction), * (multiplication), -/ (division), % (modulo), and ^ (exponentiation); -and unary - (negation). -If the operands are numbers, or strings that can be converted to -numbers (see §2.2.1), -then all operations have the usual meaning. -Exponentiation works for any exponent. -For instance, x^(-0.5) computes the inverse of the square root of x. -Modulo is defined as - -

-     a % b == a - math.floor(a/b)*b
-

-That is, it is the remainder of a division that rounds -the quotient towards minus infinity. - - - - - -

2.5.2 - Relational Operators

-The relational operators in Lua are - -

-     ==    ~=    <     >     <=    >=
-

-These operators always result in false or true. - - -

-Equality (==) first compares the type of its operands. -If the types are different, then the result is false. -Otherwise, the values of the operands are compared. -Numbers and strings are compared in the usual way. -Objects (tables, userdata, threads, and functions) -are compared by reference: -two objects are considered equal only if they are the same object. -Every time you create a new object -(a table, userdata, thread, or function), -this new object is different from any previously existing object. - - -

-You can change the way that Lua compares tables and userdata -by using the "eq" metamethod (see §2.8). - - -

-The conversion rules of §2.2.1 -do not apply to equality comparisons. -Thus, "0"==0 evaluates to false, -and t[0] and t["0"] denote different -entries in a table. - - -

-The operator ~= is exactly the negation of equality (==). - - -

-The order operators work as follows. -If both arguments are numbers, then they are compared as such. -Otherwise, if both arguments are strings, -then their values are compared according to the current locale. -Otherwise, Lua tries to call the "lt" or the "le" -metamethod (see §2.8). -A comparison a > b is translated to b < a -and a >= b is translated to b <= a. - - - - - -

2.5.3 - Logical Operators

-The logical operators in Lua are -and, or, and not. -Like the control structures (see §2.4.4), -all logical operators consider both false and nil as false -and anything else as true. - - -

-The negation operator not always returns false or true. -The conjunction operator and returns its first argument -if this value is false or nil; -otherwise, and returns its second argument. -The disjunction operator or returns its first argument -if this value is different from nil and false; -otherwise, or returns its second argument. -Both and and or use short-cut evaluation; -that is, -the second operand is evaluated only if necessary. -Here are some examples: - -

-     10 or 20            --> 10
-     10 or error()       --> 10
-     nil or "a"          --> "a"
-     nil and 10          --> nil
-     false and error()   --> false
-     false and nil       --> false
-     false or nil        --> nil
-     10 and 20           --> 20
-

-(In this manual, ---> indicates the result of the preceding expression.) - - - - - -

2.5.4 - Concatenation

-The string concatenation operator in Lua is -denoted by two dots ('..'). -If both operands are strings or numbers, then they are converted to -strings according to the rules mentioned in §2.2.1. -Otherwise, the "concat" metamethod is called (see §2.8). - - - - - -

2.5.5 - The Length Operator

- -

-The length operator is denoted by the unary operator #. -The length of a string is its number of bytes -(that is, the usual meaning of string length when each -character is one byte). - - -

-The length of a table t is defined to be any -integer index n -such that t[n] is not nil and t[n+1] is nil; -moreover, if t[1] is nil, n can be zero. -For a regular array, with non-nil values from 1 to a given n, -its length is exactly that n, -the index of its last value. -If the array has "holes" -(that is, nil values between other non-nil values), -then #t can be any of the indices that -directly precedes a nil value -(that is, it may consider any such nil value as the end of -the array). - - - - - -

2.5.6 - Precedence

-Operator precedence in Lua follows the table below, -from lower to higher priority: - -

-     or
-     and
-     <     >     <=    >=    ~=    ==
-     ..
-     +     -
-     *     /     %
-     not   #     - (unary)
-     ^
-

-As usual, -you can use parentheses to change the precedences of an expression. -The concatenation ('..') and exponentiation ('^') -operators are right associative. -All other binary operators are left associative. - - - - - -

2.5.7 - Table Constructors

-Table constructors are expressions that create tables. -Every time a constructor is evaluated, a new table is created. -A constructor can be used to create an empty table -or to create a table and initialize some of its fields. -The general syntax for constructors is - -

-	tableconstructor ::= `{´ [fieldlist] `}´
-	fieldlist ::= field {fieldsep field} [fieldsep]
-	field ::= `[´ exp `]´ `=´ exp | Name `=´ exp | exp
-	fieldsep ::= `,´ | `;´
-
- -

-Each field of the form [exp1] = exp2 adds to the new table an entry -with key exp1 and value exp2. -A field of the form name = exp is equivalent to -["name"] = exp. -Finally, fields of the form exp are equivalent to -[i] = exp, where i are consecutive numerical integers, -starting with 1. -Fields in the other formats do not affect this counting. -For example, - -

-     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
-

-is equivalent to - -

-     do
-       local t = {}
-       t[f(1)] = g
-       t[1] = "x"         -- 1st exp
-       t[2] = "y"         -- 2nd exp
-       t.x = 1            -- t["x"] = 1
-       t[3] = f(x)        -- 3rd exp
-       t[30] = 23
-       t[4] = 45          -- 4th exp
-       a = t
-     end
-
- -

-If the last field in the list has the form exp -and the expression is a function call or a vararg expression, -then all values returned by this expression enter the list consecutively -(see §2.5.8). -To avoid this, -enclose the function call or the vararg expression -in parentheses (see §2.5). - - -

-The field list can have an optional trailing separator, -as a convenience for machine-generated code. - - - - - -

2.5.8 - Function Calls

-A function call in Lua has the following syntax: - -

-	functioncall ::= prefixexp args
-

-In a function call, -first prefixexp and args are evaluated. -If the value of prefixexp has type function, -then this function is called -with the given arguments. -Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, -followed by the original call arguments -(see §2.8). - - -

-The form - -

-	functioncall ::= prefixexp `:´ Name args
-

-can be used to call "methods". -A call v:name(args) -is syntactic sugar for v.name(v,args), -except that v is evaluated only once. - - -

-Arguments have the following syntax: - -

-	args ::= `(´ [explist] `)´
-	args ::= tableconstructor
-	args ::= String
-

-All argument expressions are evaluated before the call. -A call of the form f{fields} is -syntactic sugar for f({fields}); -that is, the argument list is a single new table. -A call of the form f'string' -(or f"string" or f[[string]]) -is syntactic sugar for f('string'); -that is, the argument list is a single literal string. - - -

-As an exception to the free-format syntax of Lua, -you cannot put a line break before the '(' in a function call. -This restriction avoids some ambiguities in the language. -If you write - -

-     a = f
-     (g).x(a)
-

-Lua would see that as a single statement, a = f(g).x(a). -So, if you want two statements, you must add a semi-colon between them. -If you actually want to call f, -you must remove the line break before (g). - - -

-A call of the form return functioncall is called -a tail call. -Lua implements proper tail calls -(or proper tail recursion): -in a tail call, -the called function reuses the stack entry of the calling function. -Therefore, there is no limit on the number of nested tail calls that -a program can execute. -However, a tail call erases any debug information about the -calling function. -Note that a tail call only happens with a particular syntax, -where the return has one single function call as argument; -this syntax makes the calling function return exactly -the returns of the called function. -So, none of the following examples are tail calls: - -

-     return (f(x))        -- results adjusted to 1
-     return 2 * f(x)
-     return x, f(x)       -- additional results
-     f(x); return         -- results discarded
-     return x or f(x)     -- results adjusted to 1
-
- - - - -

2.5.9 - Function Definitions

- -

-The syntax for function definition is - -

-	function ::= function funcbody
-	funcbody ::= `(´ [parlist] `)´ block end
-
- -

-The following syntactic sugar simplifies function definitions: - -

-	stat ::= function funcname funcbody
-	stat ::= local function Name funcbody
-	funcname ::= Name {`.´ Name} [`:´ Name]
-

-The statement - -

-     function f () body end
-

-translates to - -

-     f = function () body end
-

-The statement - -

-     function t.a.b.c.f () body end
-

-translates to - -

-     t.a.b.c.f = function () body end
-

-The statement - -

-     local function f () body end
-

-translates to - -

-     local f; f = function () body end
-

-not to - -

-     local f = function () body end
-

-(This only makes a difference when the body of the function -contains references to f.) - - -

-A function definition is an executable expression, -whose value has type function. -When Lua pre-compiles a chunk, -all its function bodies are pre-compiled too. -Then, whenever Lua executes the function definition, -the function is instantiated (or closed). -This function instance (or closure) -is the final value of the expression. -Different instances of the same function -can refer to different external local variables -and can have different environment tables. - - -

-Parameters act as local variables that are -initialized with the argument values: - -

-	parlist ::= namelist [`,´ `...´] | `...´
-

-When a function is called, -the list of arguments is adjusted to -the length of the list of parameters, -unless the function is a variadic or vararg function, -which is -indicated by three dots ('...') at the end of its parameter list. -A vararg function does not adjust its argument list; -instead, it collects all extra arguments and supplies them -to the function through a vararg expression, -which is also written as three dots. -The value of this expression is a list of all actual extra arguments, -similar to a function with multiple results. -If a vararg expression is used inside another expression -or in the middle of a list of expressions, -then its return list is adjusted to one element. -If the expression is used as the last element of a list of expressions, -then no adjustment is made -(unless that last expression is enclosed in parentheses). - - -

-As an example, consider the following definitions: - -

-     function f(a, b) end
-     function g(a, b, ...) end
-     function r() return 1,2,3 end
-

-Then, we have the following mapping from arguments to parameters and -to the vararg expression: - -

-     CALL            PARAMETERS
-     
-     f(3)             a=3, b=nil
-     f(3, 4)          a=3, b=4
-     f(3, 4, 5)       a=3, b=4
-     f(r(), 10)       a=1, b=10
-     f(r())           a=1, b=2
-     
-     g(3)             a=3, b=nil, ... -->  (nothing)
-     g(3, 4)          a=3, b=4,   ... -->  (nothing)
-     g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8
-     g(5, r())        a=5, b=1,   ... -->  2  3
-
- -

-Results are returned using the return statement (see §2.4.4). -If control reaches the end of a function -without encountering a return statement, -then the function returns with no results. - - -

-The colon syntax -is used for defining methods, -that is, functions that have an implicit extra parameter self. -Thus, the statement - -

-     function t.a.b.c:f (params) body end
-

-is syntactic sugar for - -

-     t.a.b.c.f = function (self, params) body end
-
- - - - - - -

2.6 - Visibility Rules

- -

- -Lua is a lexically scoped language. -The scope of variables begins at the first statement after -their declaration and lasts until the end of the innermost block that -includes the declaration. -Consider the following example: - -

-     x = 10                -- global variable
-     do                    -- new block
-       local x = x         -- new 'x', with value 10
-       print(x)            --> 10
-       x = x+1
-       do                  -- another block
-         local x = x+1     -- another 'x'
-         print(x)          --> 12
-       end
-       print(x)            --> 11
-     end
-     print(x)              --> 10  (the global one)
-
- -

-Notice that, in a declaration like local x = x, -the new x being declared is not in scope yet, -and so the second x refers to the outside variable. - - -

-Because of the lexical scoping rules, -local variables can be freely accessed by functions -defined inside their scope. -A local variable used by an inner function is called -an upvalue, or external local variable, -inside the inner function. - - -

-Notice that each execution of a local statement -defines new local variables. -Consider the following example: - -

-     a = {}
-     local x = 20
-     for i=1,10 do
-       local y = 0
-       a[i] = function () y=y+1; return x+y end
-     end
-

-The loop creates ten closures -(that is, ten instances of the anonymous function). -Each of these closures uses a different y variable, -while all of them share the same x. - - - - - -

2.7 - Error Handling

- -

-Because Lua is an embedded extension language, -all Lua actions start from C code in the host program -calling a function from the Lua library (see lua_pcall). -Whenever an error occurs during Lua compilation or execution, -control returns to C, -which can take appropriate measures -(such as printing an error message). - - -

-Lua code can explicitly generate an error by calling the -error function. -If you need to catch errors in Lua, -you can use the pcall function. - - - - - -

2.8 - Metatables

- -

-Every value in Lua can have a metatable. -This metatable is an ordinary Lua table -that defines the behavior of the original value -under certain special operations. -You can change several aspects of the behavior -of operations over a value by setting specific fields in its metatable. -For instance, when a non-numeric value is the operand of an addition, -Lua checks for a function in the field "__add" in its metatable. -If it finds one, -Lua calls this function to perform the addition. - - -

-We call the keys in a metatable events -and the values metamethods. -In the previous example, the event is "add" -and the metamethod is the function that performs the addition. - - -

-You can query the metatable of any value -through the getmetatable function. - - -

-You can replace the metatable of tables -through the setmetatable -function. -You cannot change the metatable of other types from Lua -(except by using the debug library); -you must use the C API for that. - - -

-Tables and full userdata have individual metatables -(although multiple tables and userdata can share their metatables). -Values of all other types share one single metatable per type; -that is, there is one single metatable for all numbers, -one for all strings, etc. - - -

-A metatable controls how an object behaves in arithmetic operations, -order comparisons, concatenation, length operation, and indexing. -A metatable also can define a function to be called when a userdata -is garbage collected. -For each of these operations Lua associates a specific key -called an event. -When Lua performs one of these operations over a value, -it checks whether this value has a metatable with the corresponding event. -If so, the value associated with that key (the metamethod) -controls how Lua will perform the operation. - - -

-Metatables control the operations listed next. -Each operation is identified by its corresponding name. -The key for each operation is a string with its name prefixed by -two underscores, '__'; -for instance, the key for operation "add" is the -string "__add". -The semantics of these operations is better explained by a Lua function -describing how the interpreter executes the operation. - - -

-The code shown here in Lua is only illustrative; -the real behavior is hard coded in the interpreter -and it is much more efficient than this simulation. -All functions used in these descriptions -(rawget, tonumber, etc.) -are described in §5.1. -In particular, to retrieve the metamethod of a given object, -we use the expression - -

-     metatable(obj)[event]
-

-This should be read as - -

-     rawget(getmetatable(obj) or {}, event)
-

- -That is, the access to a metamethod does not invoke other metamethods, -and the access to objects with no metatables does not fail -(it simply results in nil). - - - -

    - -
  • "add": -the + operation. - - - -

    -The function getbinhandler below defines how Lua chooses a handler -for a binary operation. -First, Lua tries the first operand. -If its type does not define a handler for the operation, -then Lua tries the second operand. - -

    -     function getbinhandler (op1, op2, event)
    -       return metatable(op1)[event] or metatable(op2)[event]
    -     end
    -

    -By using this function, -the behavior of the op1 + op2 is - -

    -     function add_event (op1, op2)
    -       local o1, o2 = tonumber(op1), tonumber(op2)
    -       if o1 and o2 then  -- both operands are numeric?
    -         return o1 + o2   -- '+' here is the primitive 'add'
    -       else  -- at least one of the operands is not numeric
    -         local h = getbinhandler(op1, op2, "__add")
    -         if h then
    -           -- call the handler with both operands
    -           return (h(op1, op2))
    -         else  -- no handler available: default behavior
    -           error(···)
    -         end
    -       end
    -     end
    -

    -

  • - -
  • "sub": -the - operation. - -Behavior similar to the "add" operation. -
  • - -
  • "mul": -the * operation. - -Behavior similar to the "add" operation. -
  • - -
  • "div": -the / operation. - -Behavior similar to the "add" operation. -
  • - -
  • "mod": -the % operation. - -Behavior similar to the "add" operation, -with the operation -o1 - floor(o1/o2)*o2 as the primitive operation. -
  • - -
  • "pow": -the ^ (exponentiation) operation. - -Behavior similar to the "add" operation, -with the function pow (from the C math library) -as the primitive operation. -
  • - -
  • "unm": -the unary - operation. - - -
    -     function unm_event (op)
    -       local o = tonumber(op)
    -       if o then  -- operand is numeric?
    -         return -o  -- '-' here is the primitive 'unm'
    -       else  -- the operand is not numeric.
    -         -- Try to get a handler from the operand
    -         local h = metatable(op).__unm
    -         if h then
    -           -- call the handler with the operand
    -           return (h(op))
    -         else  -- no handler available: default behavior
    -           error(···)
    -         end
    -       end
    -     end
    -

    -

  • - -
  • "concat": -the .. (concatenation) operation. - - -
    -     function concat_event (op1, op2)
    -       if (type(op1) == "string" or type(op1) == "number") and
    -          (type(op2) == "string" or type(op2) == "number") then
    -         return op1 .. op2  -- primitive string concatenation
    -       else
    -         local h = getbinhandler(op1, op2, "__concat")
    -         if h then
    -           return (h(op1, op2))
    -         else
    -           error(···)
    -         end
    -       end
    -     end
    -

    -

  • - -
  • "len": -the # operation. - - -
    -     function len_event (op)
    -       if type(op) == "string" then
    -         return strlen(op)         -- primitive string length
    -       elseif type(op) == "table" then
    -         return #op                -- primitive table length
    -       else
    -         local h = metatable(op).__len
    -         if h then
    -           -- call the handler with the operand
    -           return (h(op))
    -         else  -- no handler available: default behavior
    -           error(···)
    -         end
    -       end
    -     end
    -

    -See §2.5.5 for a description of the length of a table. -

  • - -
  • "eq": -the == operation. - -The function getcomphandler defines how Lua chooses a metamethod -for comparison operators. -A metamethod only is selected when both objects -being compared have the same type -and the same metamethod for the selected operation. - -
    -     function getcomphandler (op1, op2, event)
    -       if type(op1) ~= type(op2) then return nil end
    -       local mm1 = metatable(op1)[event]
    -       local mm2 = metatable(op2)[event]
    -       if mm1 == mm2 then return mm1 else return nil end
    -     end
    -

    -The "eq" event is defined as follows: - -

    -     function eq_event (op1, op2)
    -       if type(op1) ~= type(op2) then  -- different types?
    -         return false   -- different objects
    -       end
    -       if op1 == op2 then   -- primitive equal?
    -         return true   -- objects are equal
    -       end
    -       -- try metamethod
    -       local h = getcomphandler(op1, op2, "__eq")
    -       if h then
    -         return (h(op1, op2))
    -       else
    -         return false
    -       end
    -     end
    -

    -a ~= b is equivalent to not (a == b). -

  • - -
  • "lt": -the < operation. - - -
    -     function lt_event (op1, op2)
    -       if type(op1) == "number" and type(op2) == "number" then
    -         return op1 < op2   -- numeric comparison
    -       elseif type(op1) == "string" and type(op2) == "string" then
    -         return op1 < op2   -- lexicographic comparison
    -       else
    -         local h = getcomphandler(op1, op2, "__lt")
    -         if h then
    -           return (h(op1, op2))
    -         else
    -           error(···)
    -         end
    -       end
    -     end
    -

    -a > b is equivalent to b < a. -

  • - -
  • "le": -the <= operation. - - -
    -     function le_event (op1, op2)
    -       if type(op1) == "number" and type(op2) == "number" then
    -         return op1 <= op2   -- numeric comparison
    -       elseif type(op1) == "string" and type(op2) == "string" then
    -         return op1 <= op2   -- lexicographic comparison
    -       else
    -         local h = getcomphandler(op1, op2, "__le")
    -         if h then
    -           return (h(op1, op2))
    -         else
    -           h = getcomphandler(op1, op2, "__lt")
    -           if h then
    -             return not h(op2, op1)
    -           else
    -             error(···)
    -           end
    -         end
    -       end
    -     end
    -

    -a >= b is equivalent to b <= a. -Note that, in the absence of a "le" metamethod, -Lua tries the "lt", assuming that a <= b is -equivalent to not (b < a). -

  • - -
  • "index": -The indexing access table[key]. - - -
    -     function gettable_event (table, key)
    -       local h
    -       if type(table) == "table" then
    -         local v = rawget(table, key)
    -         if v ~= nil then return v end
    -         h = metatable(table).__index
    -         if h == nil then return nil end
    -       else
    -         h = metatable(table).__index
    -         if h == nil then
    -           error(···)
    -         end
    -       end
    -       if type(h) == "function" then
    -         return (h(table, key))     -- call the handler
    -       else return h[key]           -- or repeat operation on it
    -       end
    -     end
    -

    -

  • - -
  • "newindex": -The indexing assignment table[key] = value. - - -
    -     function settable_event (table, key, value)
    -       local h
    -       if type(table) == "table" then
    -         local v = rawget(table, key)
    -         if v ~= nil then rawset(table, key, value); return end
    -         h = metatable(table).__newindex
    -         if h == nil then rawset(table, key, value); return end
    -       else
    -         h = metatable(table).__newindex
    -         if h == nil then
    -           error(···)
    -         end
    -       end
    -       if type(h) == "function" then
    -         h(table, key,value)           -- call the handler
    -       else h[key] = value             -- or repeat operation on it
    -       end
    -     end
    -

    -

  • - -
  • "call": -called when Lua calls a value. - - -
    -     function function_event (func, ...)
    -       if type(func) == "function" then
    -         return func(...)   -- primitive call
    -       else
    -         local h = metatable(func).__call
    -         if h then
    -           return h(func, ...)
    -         else
    -           error(···)
    -         end
    -       end
    -     end
    -

    -

  • - -
- - - - -

2.9 - Environments

- -

-Besides metatables, -objects of types thread, function, and userdata -have another table associated with them, -called their environment. -Like metatables, environments are regular tables and -multiple objects can share the same environment. - - -

-Threads are created sharing the environment of the creating thread. -Userdata and C functions are created sharing the environment -of the creating C function. -Non-nested Lua functions -(created by loadfile, loadstring or load) -are created sharing the environment of the creating thread. -Nested Lua functions are created sharing the environment of -the creating Lua function. - - -

-Environments associated with userdata have no meaning for Lua. -It is only a convenience feature for programmers to associate a table to -a userdata. - - -

-Environments associated with threads are called -global environments. -They are used as the default environment for threads and -non-nested Lua functions created by the thread -and can be directly accessed by C code (see §3.3). - - -

-The environment associated with a C function can be directly -accessed by C code (see §3.3). -It is used as the default environment for other C functions -and userdata created by the function. - - -

-Environments associated with Lua functions are used to resolve -all accesses to global variables within the function (see §2.3). -They are used as the default environment for nested Lua functions -created by the function. - - -

-You can change the environment of a Lua function or the -running thread by calling setfenv. -You can get the environment of a Lua function or the running thread -by calling getfenv. -To manipulate the environment of other objects -(userdata, C functions, other threads) you must -use the C API. - - - - - -

2.10 - Garbage Collection

- -

-Lua performs automatic memory management. -This means that -you have to worry neither about allocating memory for new objects -nor about freeing it when the objects are no longer needed. -Lua manages memory automatically by running -a garbage collector from time to time -to collect all dead objects -(that is, objects that are no longer accessible from Lua). -All memory used by Lua is subject to automatic management: -tables, userdata, functions, threads, strings, etc. - - -

-Lua implements an incremental mark-and-sweep collector. -It uses two numbers to control its garbage-collection cycles: -the garbage-collector pause and -the garbage-collector step multiplier. -Both use percentage points as units -(so that a value of 100 means an internal value of 1). - - -

-The garbage-collector pause -controls how long the collector waits before starting a new cycle. -Larger values make the collector less aggressive. -Values smaller than 100 mean the collector will not wait to -start a new cycle. -A value of 200 means that the collector waits for the total memory in use -to double before starting a new cycle. - - -

-The step multiplier -controls the relative speed of the collector relative to -memory allocation. -Larger values make the collector more aggressive but also increase -the size of each incremental step. -Values smaller than 100 make the collector too slow and -can result in the collector never finishing a cycle. -The default, 200, means that the collector runs at "twice" -the speed of memory allocation. - - -

-You can change these numbers by calling lua_gc in C -or collectgarbage in Lua. -With these functions you can also control -the collector directly (e.g., stop and restart it). - - - -

2.10.1 - Garbage-Collection Metamethods

- -

-Using the C API, -you can set garbage-collector metamethods for userdata (see §2.8). -These metamethods are also called finalizers. -Finalizers allow you to coordinate Lua's garbage collection -with external resource management -(such as closing files, network or database connections, -or freeing your own memory). - - -

-Garbage userdata with a field __gc in their metatables are not -collected immediately by the garbage collector. -Instead, Lua puts them in a list. -After the collection, -Lua does the equivalent of the following function -for each userdata in that list: - -

-     function gc_event (udata)
-       local h = metatable(udata).__gc
-       if h then
-         h(udata)
-       end
-     end
-
- -

-At the end of each garbage-collection cycle, -the finalizers for userdata are called in reverse -order of their creation, -among those collected in that cycle. -That is, the first finalizer to be called is the one associated -with the userdata created last in the program. -The userdata itself is freed only in the next garbage-collection cycle. - - - - - -

2.10.2 - Weak Tables

- -

-A weak table is a table whose elements are -weak references. -A weak reference is ignored by the garbage collector. -In other words, -if the only references to an object are weak references, -then the garbage collector will collect this object. - - -

-A weak table can have weak keys, weak values, or both. -A table with weak keys allows the collection of its keys, -but prevents the collection of its values. -A table with both weak keys and weak values allows the collection of -both keys and values. -In any case, if either the key or the value is collected, -the whole pair is removed from the table. -The weakness of a table is controlled by the -__mode field of its metatable. -If the __mode field is a string containing the character 'k', -the keys in the table are weak. -If __mode contains 'v', -the values in the table are weak. - - -

-After you use a table as a metatable, -you should not change the value of its __mode field. -Otherwise, the weak behavior of the tables controlled by this -metatable is undefined. - - - - - - - -

2.11 - Coroutines

- -

-Lua supports coroutines, -also called collaborative multithreading. -A coroutine in Lua represents an independent thread of execution. -Unlike threads in multithread systems, however, -a coroutine only suspends its execution by explicitly calling -a yield function. - - -

-You create a coroutine with a call to coroutine.create. -Its sole argument is a function -that is the main function of the coroutine. -The create function only creates a new coroutine and -returns a handle to it (an object of type thread); -it does not start the coroutine execution. - - -

-When you first call coroutine.resume, -passing as its first argument -a thread returned by coroutine.create, -the coroutine starts its execution, -at the first line of its main function. -Extra arguments passed to coroutine.resume are passed on -to the coroutine main function. -After the coroutine starts running, -it runs until it terminates or yields. - - -

-A coroutine can terminate its execution in two ways: -normally, when its main function returns -(explicitly or implicitly, after the last instruction); -and abnormally, if there is an unprotected error. -In the first case, coroutine.resume returns true, -plus any values returned by the coroutine main function. -In case of errors, coroutine.resume returns false -plus an error message. - - -

-A coroutine yields by calling coroutine.yield. -When a coroutine yields, -the corresponding coroutine.resume returns immediately, -even if the yield happens inside nested function calls -(that is, not in the main function, -but in a function directly or indirectly called by the main function). -In the case of a yield, coroutine.resume also returns true, -plus any values passed to coroutine.yield. -The next time you resume the same coroutine, -it continues its execution from the point where it yielded, -with the call to coroutine.yield returning any extra -arguments passed to coroutine.resume. - - -

-Like coroutine.create, -the coroutine.wrap function also creates a coroutine, -but instead of returning the coroutine itself, -it returns a function that, when called, resumes the coroutine. -Any arguments passed to this function -go as extra arguments to coroutine.resume. -coroutine.wrap returns all the values returned by coroutine.resume, -except the first one (the boolean error code). -Unlike coroutine.resume, -coroutine.wrap does not catch errors; -any error is propagated to the caller. - - -

-As an example, -consider the following code: - -

-     function foo (a)
-       print("foo", a)
-       return coroutine.yield(2*a)
-     end
-     
-     co = coroutine.create(function (a,b)
-           print("co-body", a, b)
-           local r = foo(a+1)
-           print("co-body", r)
-           local r, s = coroutine.yield(a+b, a-b)
-           print("co-body", r, s)
-           return b, "end"
-     end)
-            
-     print("main", coroutine.resume(co, 1, 10))
-     print("main", coroutine.resume(co, "r"))
-     print("main", coroutine.resume(co, "x", "y"))
-     print("main", coroutine.resume(co, "x", "y"))
-

-When you run it, it produces the following output: - -

-     co-body 1       10
-     foo     2
-     
-     main    true    4
-     co-body r
-     main    true    11      -9
-     co-body x       y
-     main    true    10      end
-     main    false   cannot resume dead coroutine
-
- - - - -

3 - The Application Program Interface

- -

- -This section describes the C API for Lua, that is, -the set of C functions available to the host program to communicate -with Lua. -All API functions and related types and constants -are declared in the header file lua.h. - - -

-Even when we use the term "function", -any facility in the API may be provided as a macro instead. -All such macros use each of their arguments exactly once -(except for the first argument, which is always a Lua state), -and so do not generate any hidden side-effects. - - -

-As in most C libraries, -the Lua API functions do not check their arguments for validity or consistency. -However, you can change this behavior by compiling Lua -with a proper definition for the macro luai_apicheck, -in file luaconf.h. - - - -

3.1 - The Stack

- -

-Lua uses a virtual stack to pass values to and from C. -Each element in this stack represents a Lua value -(nil, number, string, etc.). - - -

-Whenever Lua calls C, the called function gets a new stack, -which is independent of previous stacks and of stacks of -C functions that are still active. -This stack initially contains any arguments to the C function -and it is where the C function pushes its results -to be returned to the caller (see lua_CFunction). - - -

-For convenience, -most query operations in the API do not follow a strict stack discipline. -Instead, they can refer to any element in the stack -by using an index: -A positive index represents an absolute stack position -(starting at 1); -a negative index represents an offset relative to the top of the stack. -More specifically, if the stack has n elements, -then index 1 represents the first element -(that is, the element that was pushed onto the stack first) -and -index n represents the last element; -index -1 also represents the last element -(that is, the element at the top) -and index -n represents the first element. -We say that an index is valid -if it lies between 1 and the stack top -(that is, if 1 ≤ abs(index) ≤ top). - - - - - - -

3.2 - Stack Size

- -

-When you interact with Lua API, -you are responsible for ensuring consistency. -In particular, -you are responsible for controlling stack overflow. -You can use the function lua_checkstack -to grow the stack size. - - -

-Whenever Lua calls C, -it ensures that at least LUA_MINSTACK stack positions are available. -LUA_MINSTACK is defined as 20, -so that usually you do not have to worry about stack space -unless your code has loops pushing elements onto the stack. - - -

-Most query functions accept as indices any value inside the -available stack space, that is, indices up to the maximum stack size -you have set through lua_checkstack. -Such indices are called acceptable indices. -More formally, we define an acceptable index -as follows: - -

-     (index < 0 && abs(index) <= top) ||
-     (index > 0 && index <= stackspace)
-

-Note that 0 is never an acceptable index. - - - - - -

3.3 - Pseudo-Indices

- -

-Unless otherwise noted, -any function that accepts valid indices can also be called with -pseudo-indices, -which represent some Lua values that are accessible to C code -but which are not in the stack. -Pseudo-indices are used to access the thread environment, -the function environment, -the registry, -and the upvalues of a C function (see §3.4). - - -

-The thread environment (where global variables live) is -always at pseudo-index LUA_GLOBALSINDEX. -The environment of the running C function is always -at pseudo-index LUA_ENVIRONINDEX. - - -

-To access and change the value of global variables, -you can use regular table operations over an environment table. -For instance, to access the value of a global variable, do - -

-     lua_getfield(L, LUA_GLOBALSINDEX, varname);
-
- - - - -

3.4 - C Closures

- -

-When a C function is created, -it is possible to associate some values with it, -thus creating a C closure; -these values are called upvalues and are -accessible to the function whenever it is called -(see lua_pushcclosure). - - -

-Whenever a C function is called, -its upvalues are located at specific pseudo-indices. -These pseudo-indices are produced by the macro -lua_upvalueindex. -The first value associated with a function is at position -lua_upvalueindex(1), and so on. -Any access to lua_upvalueindex(n), -where n is greater than the number of upvalues of the -current function (but not greater than 256), -produces an acceptable (but invalid) index. - - - - - -

3.5 - Registry

- -

-Lua provides a registry, -a pre-defined table that can be used by any C code to -store whatever Lua value it needs to store. -This table is always located at pseudo-index -LUA_REGISTRYINDEX. -Any C library can store data into this table, -but it should take care to choose keys different from those used -by other libraries, to avoid collisions. -Typically, you should use as key a string containing your library name -or a light userdata with the address of a C object in your code. - - -

-The integer keys in the registry are used by the reference mechanism, -implemented by the auxiliary library, -and therefore should not be used for other purposes. - - - - - -

3.6 - Error Handling in C

- -

-Internally, Lua uses the C longjmp facility to handle errors. -(You can also choose to use exceptions if you use C++; -see file luaconf.h.) -When Lua faces any error -(such as memory allocation errors, type errors, syntax errors, -and runtime errors) -it raises an error; -that is, it does a long jump. -A protected environment uses setjmp -to set a recover point; -any error jumps to the most recent active recover point. - - -

-Most functions in the API can throw an error, -for instance due to a memory allocation error. -The documentation for each function indicates whether -it can throw errors. - - -

-Inside a C function you can throw an error by calling lua_error. - - - - - -

3.7 - Functions and Types

- -

-Here we list all functions and types from the C API in -alphabetical order. -Each function has an indicator like this: -[-o, +p, x] - - -

-The first field, o, -is how many elements the function pops from the stack. -The second field, p, -is how many elements the function pushes onto the stack. -(Any function always pushes its results after popping its arguments.) -A field in the form x|y means the function can push (or pop) -x or y elements, -depending on the situation; -an interrogation mark '?' means that -we cannot know how many elements the function pops/pushes -by looking only at its arguments -(e.g., they may depend on what is on the stack). -The third field, x, -tells whether the function may throw errors: -'-' means the function never throws any error; -'m' means the function may throw an error -only due to not enough memory; -'e' means the function may throw other kinds of errors; -'v' means the function may throw an error on purpose. - - - -


lua_Alloc

-
typedef void * (*lua_Alloc) (void *ud,
-                             void *ptr,
-                             size_t osize,
-                             size_t nsize);
- -

-The type of the memory-allocation function used by Lua states. -The allocator function must provide a -functionality similar to realloc, -but not exactly the same. -Its arguments are -ud, an opaque pointer passed to lua_newstate; -ptr, a pointer to the block being allocated/reallocated/freed; -osize, the original size of the block; -nsize, the new size of the block. -ptr is NULL if and only if osize is zero. -When nsize is zero, the allocator must return NULL; -if osize is not zero, -it should free the block pointed to by ptr. -When nsize is not zero, the allocator returns NULL -if and only if it cannot fill the request. -When nsize is not zero and osize is zero, -the allocator should behave like malloc. -When nsize and osize are not zero, -the allocator behaves like realloc. -Lua assumes that the allocator never fails when -osize >= nsize. - - -

-Here is a simple implementation for the allocator function. -It is used in the auxiliary library by luaL_newstate. - -

-     static void *l_alloc (void *ud, void *ptr, size_t osize,
-                                                size_t nsize) {
-       (void)ud;  (void)osize;  /* not used */
-       if (nsize == 0) {
-         free(ptr);
-         return NULL;
-       }
-       else
-         return realloc(ptr, nsize);
-     }
-

-This code assumes -that free(NULL) has no effect and that -realloc(NULL, size) is equivalent to malloc(size). -ANSI C ensures both behaviors. - - - - - -


lua_atpanic

-[-0, +0, -] -

lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
- -

-Sets a new panic function and returns the old one. - - -

-If an error happens outside any protected environment, -Lua calls a panic function -and then calls exit(EXIT_FAILURE), -thus exiting the host application. -Your panic function can avoid this exit by -never returning (e.g., doing a long jump). - - -

-The panic function can access the error message at the top of the stack. - - - - - -


lua_call

-[-(nargs + 1), +nresults, e] -

void lua_call (lua_State *L, int nargs, int nresults);
- -

-Calls a function. - - -

-To call a function you must use the following protocol: -first, the function to be called is pushed onto the stack; -then, the arguments to the function are pushed -in direct order; -that is, the first argument is pushed first. -Finally you call lua_call; -nargs is the number of arguments that you pushed onto the stack. -All arguments and the function value are popped from the stack -when the function is called. -The function results are pushed onto the stack when the function returns. -The number of results is adjusted to nresults, -unless nresults is LUA_MULTRET. -In this case, all results from the function are pushed. -Lua takes care that the returned values fit into the stack space. -The function results are pushed onto the stack in direct order -(the first result is pushed first), -so that after the call the last result is on the top of the stack. - - -

-Any error inside the called function is propagated upwards -(with a longjmp). - - -

-The following example shows how the host program can do the -equivalent to this Lua code: - -

-     a = f("how", t.x, 14)
-

-Here it is in C: - -

-     lua_getfield(L, LUA_GLOBALSINDEX, "f"); /* function to be called */
-     lua_pushstring(L, "how");                        /* 1st argument */
-     lua_getfield(L, LUA_GLOBALSINDEX, "t");   /* table to be indexed */
-     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
-     lua_remove(L, -2);                  /* remove 't' from the stack */
-     lua_pushinteger(L, 14);                          /* 3rd argument */
-     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
-     lua_setfield(L, LUA_GLOBALSINDEX, "a");        /* set global 'a' */
-

-Note that the code above is "balanced": -at its end, the stack is back to its original configuration. -This is considered good programming practice. - - - - - -


lua_CFunction

-
typedef int (*lua_CFunction) (lua_State *L);
- -

-Type for C functions. - - -

-In order to communicate properly with Lua, -a C function must use the following protocol, -which defines the way parameters and results are passed: -a C function receives its arguments from Lua in its stack -in direct order (the first argument is pushed first). -So, when the function starts, -lua_gettop(L) returns the number of arguments received by the function. -The first argument (if any) is at index 1 -and its last argument is at index lua_gettop(L). -To return values to Lua, a C function just pushes them onto the stack, -in direct order (the first result is pushed first), -and returns the number of results. -Any other value in the stack below the results will be properly -discarded by Lua. -Like a Lua function, a C function called by Lua can also return -many results. - - -

-As an example, the following function receives a variable number -of numerical arguments and returns their average and sum: - -

-     static int foo (lua_State *L) {
-       int n = lua_gettop(L);    /* number of arguments */
-       lua_Number sum = 0;
-       int i;
-       for (i = 1; i <= n; i++) {
-         if (!lua_isnumber(L, i)) {
-           lua_pushstring(L, "incorrect argument");
-           lua_error(L);
-         }
-         sum += lua_tonumber(L, i);
-       }
-       lua_pushnumber(L, sum/n);        /* first result */
-       lua_pushnumber(L, sum);         /* second result */
-       return 2;                   /* number of results */
-     }
-
- - - - -

lua_checkstack

-[-0, +0, m] -

int lua_checkstack (lua_State *L, int extra);
- -

-Ensures that there are at least extra free stack slots in the stack. -It returns false if it cannot grow the stack to that size. -This function never shrinks the stack; -if the stack is already larger than the new size, -it is left unchanged. - - - - - -


lua_close

-[-0, +0, -] -

void lua_close (lua_State *L);
- -

-Destroys all objects in the given Lua state -(calling the corresponding garbage-collection metamethods, if any) -and frees all dynamic memory used by this state. -On several platforms, you may not need to call this function, -because all resources are naturally released when the host program ends. -On the other hand, long-running programs, -such as a daemon or a web server, -might need to release states as soon as they are not needed, -to avoid growing too large. - - - - - -


lua_concat

-[-n, +1, e] -

void lua_concat (lua_State *L, int n);
- -

-Concatenates the n values at the top of the stack, -pops them, and leaves the result at the top. -If n is 1, the result is the single value on the stack -(that is, the function does nothing); -if n is 0, the result is the empty string. -Concatenation is performed following the usual semantics of Lua -(see §2.5.4). - - - - - -


lua_cpcall

-[-0, +(0|1), -] -

int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);
- -

-Calls the C function func in protected mode. -func starts with only one element in its stack, -a light userdata containing ud. -In case of errors, -lua_cpcall returns the same error codes as lua_pcall, -plus the error object on the top of the stack; -otherwise, it returns zero, and does not change the stack. -All values returned by func are discarded. - - - - - -


lua_createtable

-[-0, +1, m] -

void lua_createtable (lua_State *L, int narr, int nrec);
- -

-Creates a new empty table and pushes it onto the stack. -The new table has space pre-allocated -for narr array elements and nrec non-array elements. -This pre-allocation is useful when you know exactly how many elements -the table will have. -Otherwise you can use the function lua_newtable. - - - - - -


lua_dump

-[-0, +0, m] -

int lua_dump (lua_State *L, lua_Writer writer, void *data);
- -

-Dumps a function as a binary chunk. -Receives a Lua function on the top of the stack -and produces a binary chunk that, -if loaded again, -results in a function equivalent to the one dumped. -As it produces parts of the chunk, -lua_dump calls function writer (see lua_Writer) -with the given data -to write them. - - -

-The value returned is the error code returned by the last -call to the writer; -0 means no errors. - - -

-This function does not pop the Lua function from the stack. - - - - - -


lua_equal

-[-0, +0, e] -

int lua_equal (lua_State *L, int index1, int index2);
- -

-Returns 1 if the two values in acceptable indices index1 and -index2 are equal, -following the semantics of the Lua == operator -(that is, may call metamethods). -Otherwise returns 0. -Also returns 0 if any of the indices is non valid. - - - - - -


lua_error

-[-1, +0, v] -

int lua_error (lua_State *L);
- -

-Generates a Lua error. -The error message (which can actually be a Lua value of any type) -must be on the stack top. -This function does a long jump, -and therefore never returns. -(see luaL_error). - - - - - -


lua_gc

-[-0, +0, e] -

int lua_gc (lua_State *L, int what, int data);
- -

-Controls the garbage collector. - - -

-This function performs several tasks, -according to the value of the parameter what: - -

    - -
  • LUA_GCSTOP: -stops the garbage collector. -
  • - -
  • LUA_GCRESTART: -restarts the garbage collector. -
  • - -
  • LUA_GCCOLLECT: -performs a full garbage-collection cycle. -
  • - -
  • LUA_GCCOUNT: -returns the current amount of memory (in Kbytes) in use by Lua. -
  • - -
  • LUA_GCCOUNTB: -returns the remainder of dividing the current amount of bytes of -memory in use by Lua by 1024. -
  • - -
  • LUA_GCSTEP: -performs an incremental step of garbage collection. -The step "size" is controlled by data -(larger values mean more steps) in a non-specified way. -If you want to control the step size -you must experimentally tune the value of data. -The function returns 1 if the step finished a -garbage-collection cycle. -
  • - -
  • LUA_GCSETPAUSE: -sets data as the new value -for the pause of the collector (see §2.10). -The function returns the previous value of the pause. -
  • - -
  • LUA_GCSETSTEPMUL: -sets data as the new value for the step multiplier of -the collector (see §2.10). -The function returns the previous value of the step multiplier. -
  • - -
- - - - -

lua_getallocf

-[-0, +0, -] -

lua_Alloc lua_getallocf (lua_State *L, void **ud);
- -

-Returns the memory-allocation function of a given state. -If ud is not NULL, Lua stores in *ud the -opaque pointer passed to lua_newstate. - - - - - -


lua_getfenv

-[-0, +1, -] -

void lua_getfenv (lua_State *L, int index);
- -

-Pushes onto the stack the environment table of -the value at the given index. - - - - - -


lua_getfield

-[-0, +1, e] -

void lua_getfield (lua_State *L, int index, const char *k);
- -

-Pushes onto the stack the value t[k], -where t is the value at the given valid index. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.8). - - - - - -


lua_getglobal

-[-0, +1, e] -

void lua_getglobal (lua_State *L, const char *name);
- -

-Pushes onto the stack the value of the global name. -It is defined as a macro: - -

-     #define lua_getglobal(L,s)  lua_getfield(L, LUA_GLOBALSINDEX, s)
-
- - - - -

lua_getmetatable

-[-0, +(0|1), -] -

int lua_getmetatable (lua_State *L, int index);
- -

-Pushes onto the stack the metatable of the value at the given -acceptable index. -If the index is not valid, -or if the value does not have a metatable, -the function returns 0 and pushes nothing on the stack. - - - - - -


lua_gettable

-[-1, +1, e] -

void lua_gettable (lua_State *L, int index);
- -

-Pushes onto the stack the value t[k], -where t is the value at the given valid index -and k is the value at the top of the stack. - - -

-This function pops the key from the stack -(putting the resulting value in its place). -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.8). - - - - - -


lua_gettop

-[-0, +0, -] -

int lua_gettop (lua_State *L);
- -

-Returns the index of the top element in the stack. -Because indices start at 1, -this result is equal to the number of elements in the stack -(and so 0 means an empty stack). - - - - - -


lua_insert

-[-1, +1, -] -

void lua_insert (lua_State *L, int index);
- -

-Moves the top element into the given valid index, -shifting up the elements above this index to open space. -Cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_Integer

-
typedef ptrdiff_t lua_Integer;
- -

-The type used by the Lua API to represent integral values. - - -

-By default it is a ptrdiff_t, -which is usually the largest signed integral type the machine handles -"comfortably". - - - - - -


lua_isboolean

-[-0, +0, -] -

int lua_isboolean (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index has type boolean, -and 0 otherwise. - - - - - -


lua_iscfunction

-[-0, +0, -] -

int lua_iscfunction (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a C function, -and 0 otherwise. - - - - - -


lua_isfunction

-[-0, +0, -] -

int lua_isfunction (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a function -(either C or Lua), and 0 otherwise. - - - - - -


lua_islightuserdata

-[-0, +0, -] -

int lua_islightuserdata (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a light userdata, -and 0 otherwise. - - - - - -


lua_isnil

-[-0, +0, -] -

int lua_isnil (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is nil, -and 0 otherwise. - - - - - -


lua_isnone

-[-0, +0, -] -

int lua_isnone (lua_State *L, int index);
- -

-Returns 1 if the given acceptable index is not valid -(that is, it refers to an element outside the current stack), -and 0 otherwise. - - - - - -


lua_isnoneornil

-[-0, +0, -] -

int lua_isnoneornil (lua_State *L, int index);
- -

-Returns 1 if the given acceptable index is not valid -(that is, it refers to an element outside the current stack) -or if the value at this index is nil, -and 0 otherwise. - - - - - -


lua_isnumber

-[-0, +0, -] -

int lua_isnumber (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a number -or a string convertible to a number, -and 0 otherwise. - - - - - -


lua_isstring

-[-0, +0, -] -

int lua_isstring (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a string -or a number (which is always convertible to a string), -and 0 otherwise. - - - - - -


lua_istable

-[-0, +0, -] -

int lua_istable (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a table, -and 0 otherwise. - - - - - -


lua_isthread

-[-0, +0, -] -

int lua_isthread (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a thread, -and 0 otherwise. - - - - - -


lua_isuserdata

-[-0, +0, -] -

int lua_isuserdata (lua_State *L, int index);
- -

-Returns 1 if the value at the given acceptable index is a userdata -(either full or light), and 0 otherwise. - - - - - -


lua_lessthan

-[-0, +0, e] -

int lua_lessthan (lua_State *L, int index1, int index2);
- -

-Returns 1 if the value at acceptable index index1 is smaller -than the value at acceptable index index2, -following the semantics of the Lua < operator -(that is, may call metamethods). -Otherwise returns 0. -Also returns 0 if any of the indices is non valid. - - - - - -


lua_load

-[-0, +1, -] -

int lua_load (lua_State *L,
-              lua_Reader reader,
-              void *data,
-              const char *chunkname);
- -

-Loads a Lua chunk. -If there are no errors, -lua_load pushes the compiled chunk as a Lua -function on top of the stack. -Otherwise, it pushes an error message. -The return values of lua_load are: - -

    - -
  • 0: no errors;
  • - -
  • LUA_ERRSYNTAX: -syntax error during pre-compilation;
  • - -
  • LUA_ERRMEM: -memory allocation error.
  • - -
- -

-This function only loads a chunk; -it does not run it. - - -

-lua_load automatically detects whether the chunk is text or binary, -and loads it accordingly (see program luac). - - -

-The lua_load function uses a user-supplied reader function -to read the chunk (see lua_Reader). -The data argument is an opaque value passed to the reader function. - - -

-The chunkname argument gives a name to the chunk, -which is used for error messages and in debug information (see §3.8). - - - - - -


lua_newstate

-[-0, +0, -] -

lua_State *lua_newstate (lua_Alloc f, void *ud);
- -

-Creates a new, independent state. -Returns NULL if cannot create the state -(due to lack of memory). -The argument f is the allocator function; -Lua does all memory allocation for this state through this function. -The second argument, ud, is an opaque pointer that Lua -simply passes to the allocator in every call. - - - - - -


lua_newtable

-[-0, +1, m] -

void lua_newtable (lua_State *L);
- -

-Creates a new empty table and pushes it onto the stack. -It is equivalent to lua_createtable(L, 0, 0). - - - - - -


lua_newthread

-[-0, +1, m] -

lua_State *lua_newthread (lua_State *L);
- -

-Creates a new thread, pushes it on the stack, -and returns a pointer to a lua_State that represents this new thread. -The new state returned by this function shares with the original state -all global objects (such as tables), -but has an independent execution stack. - - -

-There is no explicit function to close or to destroy a thread. -Threads are subject to garbage collection, -like any Lua object. - - - - - -


lua_newuserdata

-[-0, +1, m] -

void *lua_newuserdata (lua_State *L, size_t size);
- -

-This function allocates a new block of memory with the given size, -pushes onto the stack a new full userdata with the block address, -and returns this address. - - -

-Userdata represent C values in Lua. -A full userdata represents a block of memory. -It is an object (like a table): -you must create it, it can have its own metatable, -and you can detect when it is being collected. -A full userdata is only equal to itself (under raw equality). - - -

-When Lua collects a full userdata with a gc metamethod, -Lua calls the metamethod and marks the userdata as finalized. -When this userdata is collected again then -Lua frees its corresponding memory. - - - - - -


lua_next

-[-1, +(2|0), e] -

int lua_next (lua_State *L, int index);
- -

-Pops a key from the stack, -and pushes a key-value pair from the table at the given index -(the "next" pair after the given key). -If there are no more elements in the table, -then lua_next returns 0 (and pushes nothing). - - -

-A typical traversal looks like this: - -

-     /* table is in the stack at index 't' */
-     lua_pushnil(L);  /* first key */
-     while (lua_next(L, t) != 0) {
-       /* uses 'key' (at index -2) and 'value' (at index -1) */
-       printf("%s - %s\n",
-              lua_typename(L, lua_type(L, -2)),
-              lua_typename(L, lua_type(L, -1)));
-       /* removes 'value'; keeps 'key' for next iteration */
-       lua_pop(L, 1);
-     }
-
- -

-While traversing a table, -do not call lua_tolstring directly on a key, -unless you know that the key is actually a string. -Recall that lua_tolstring changes -the value at the given index; -this confuses the next call to lua_next. - - - - - -


lua_Number

-
typedef double lua_Number;
- -

-The type of numbers in Lua. -By default, it is double, but that can be changed in luaconf.h. - - -

-Through the configuration file you can change -Lua to operate with another type for numbers (e.g., float or long). - - - - - -


lua_objlen

-[-0, +0, -] -

size_t lua_objlen (lua_State *L, int index);
- -

-Returns the "length" of the value at the given acceptable index: -for strings, this is the string length; -for tables, this is the result of the length operator ('#'); -for userdata, this is the size of the block of memory allocated -for the userdata; -for other values, it is 0. - - - - - -


lua_pcall

-[-(nargs + 1), +(nresults|1), -] -

int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
- -

-Calls a function in protected mode. - - -

-Both nargs and nresults have the same meaning as -in lua_call. -If there are no errors during the call, -lua_pcall behaves exactly like lua_call. -However, if there is any error, -lua_pcall catches it, -pushes a single value on the stack (the error message), -and returns an error code. -Like lua_call, -lua_pcall always removes the function -and its arguments from the stack. - - -

-If errfunc is 0, -then the error message returned on the stack -is exactly the original error message. -Otherwise, errfunc is the stack index of an -error handler function. -(In the current implementation, this index cannot be a pseudo-index.) -In case of runtime errors, -this function will be called with the error message -and its return value will be the message returned on the stack by lua_pcall. - - -

-Typically, the error handler function is used to add more debug -information to the error message, such as a stack traceback. -Such information cannot be gathered after the return of lua_pcall, -since by then the stack has unwound. - - -

-The lua_pcall function returns 0 in case of success -or one of the following error codes -(defined in lua.h): - -

    - -
  • LUA_ERRRUN: -a runtime error. -
  • - -
  • LUA_ERRMEM: -memory allocation error. -For such errors, Lua does not call the error handler function. -
  • - -
  • LUA_ERRERR: -error while running the error handler function. -
  • - -
- - - - -

lua_pop

-[-n, +0, -] -

void lua_pop (lua_State *L, int n);
- -

-Pops n elements from the stack. - - - - - -


lua_pushboolean

-[-0, +1, -] -

void lua_pushboolean (lua_State *L, int b);
- -

-Pushes a boolean value with value b onto the stack. - - - - - -


lua_pushcclosure

-[-n, +1, m] -

void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
- -

-Pushes a new C closure onto the stack. - - -

-When a C function is created, -it is possible to associate some values with it, -thus creating a C closure (see §3.4); -these values are then accessible to the function whenever it is called. -To associate values with a C function, -first these values should be pushed onto the stack -(when there are multiple values, the first value is pushed first). -Then lua_pushcclosure -is called to create and push the C function onto the stack, -with the argument n telling how many values should be -associated with the function. -lua_pushcclosure also pops these values from the stack. - - -

-The maximum value for n is 255. - - - - - -


lua_pushcfunction

-[-0, +1, m] -

void lua_pushcfunction (lua_State *L, lua_CFunction f);
- -

-Pushes a C function onto the stack. -This function receives a pointer to a C function -and pushes onto the stack a Lua value of type function that, -when called, invokes the corresponding C function. - - -

-Any function to be registered in Lua must -follow the correct protocol to receive its parameters -and return its results (see lua_CFunction). - - -

-lua_pushcfunction is defined as a macro: - -

-     #define lua_pushcfunction(L,f)  lua_pushcclosure(L,f,0)
-
- - - - -

lua_pushfstring

-[-0, +1, m] -

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
- -

-Pushes onto the stack a formatted string -and returns a pointer to this string. -It is similar to the C function sprintf, -but has some important differences: - -

    - -
  • -You do not have to allocate space for the result: -the result is a Lua string and Lua takes care of memory allocation -(and deallocation, through garbage collection). -
  • - -
  • -The conversion specifiers are quite restricted. -There are no flags, widths, or precisions. -The conversion specifiers can only be -'%%' (inserts a '%' in the string), -'%s' (inserts a zero-terminated string, with no size restrictions), -'%f' (inserts a lua_Number), -'%p' (inserts a pointer as a hexadecimal numeral), -'%d' (inserts an int), and -'%c' (inserts an int as a character). -
  • - -
- - - - -

lua_pushinteger

-[-0, +1, -] -

void lua_pushinteger (lua_State *L, lua_Integer n);
- -

-Pushes a number with value n onto the stack. - - - - - -


lua_pushlightuserdata

-[-0, +1, -] -

void lua_pushlightuserdata (lua_State *L, void *p);
- -

-Pushes a light userdata onto the stack. - - -

-Userdata represent C values in Lua. -A light userdata represents a pointer. -It is a value (like a number): -you do not create it, it has no individual metatable, -and it is not collected (as it was never created). -A light userdata is equal to "any" -light userdata with the same C address. - - - - - -


lua_pushliteral

-[-0, +1, m] -

void lua_pushliteral (lua_State *L, const char *s);
- -

-This macro is equivalent to lua_pushlstring, -but can be used only when s is a literal string. -In these cases, it automatically provides the string length. - - - - - -


lua_pushlstring

-[-0, +1, m] -

void lua_pushlstring (lua_State *L, const char *s, size_t len);
- -

-Pushes the string pointed to by s with size len -onto the stack. -Lua makes (or reuses) an internal copy of the given string, -so the memory at s can be freed or reused immediately after -the function returns. -The string can contain embedded zeros. - - - - - -


lua_pushnil

-[-0, +1, -] -

void lua_pushnil (lua_State *L);
- -

-Pushes a nil value onto the stack. - - - - - -


lua_pushnumber

-[-0, +1, -] -

void lua_pushnumber (lua_State *L, lua_Number n);
- -

-Pushes a number with value n onto the stack. - - - - - -


lua_pushstring

-[-0, +1, m] -

void lua_pushstring (lua_State *L, const char *s);
- -

-Pushes the zero-terminated string pointed to by s -onto the stack. -Lua makes (or reuses) an internal copy of the given string, -so the memory at s can be freed or reused immediately after -the function returns. -The string cannot contain embedded zeros; -it is assumed to end at the first zero. - - - - - -


lua_pushthread

-[-0, +1, -] -

int lua_pushthread (lua_State *L);
- -

-Pushes the thread represented by L onto the stack. -Returns 1 if this thread is the main thread of its state. - - - - - -


lua_pushvalue

-[-0, +1, -] -

void lua_pushvalue (lua_State *L, int index);
- -

-Pushes a copy of the element at the given valid index -onto the stack. - - - - - -


lua_pushvfstring

-[-0, +1, m] -

const char *lua_pushvfstring (lua_State *L,
-                              const char *fmt,
-                              va_list argp);
- -

-Equivalent to lua_pushfstring, except that it receives a va_list -instead of a variable number of arguments. - - - - - -


lua_rawequal

-[-0, +0, -] -

int lua_rawequal (lua_State *L, int index1, int index2);
- -

-Returns 1 if the two values in acceptable indices index1 and -index2 are primitively equal -(that is, without calling metamethods). -Otherwise returns 0. -Also returns 0 if any of the indices are non valid. - - - - - -


lua_rawget

-[-1, +1, -] -

void lua_rawget (lua_State *L, int index);
- -

-Similar to lua_gettable, but does a raw access -(i.e., without metamethods). - - - - - -


lua_rawgeti

-[-0, +1, -] -

void lua_rawgeti (lua_State *L, int index, int n);
- -

-Pushes onto the stack the value t[n], -where t is the value at the given valid index. -The access is raw; -that is, it does not invoke metamethods. - - - - - -


lua_rawset

-[-2, +0, m] -

void lua_rawset (lua_State *L, int index);
- -

-Similar to lua_settable, but does a raw assignment -(i.e., without metamethods). - - - - - -


lua_rawseti

-[-1, +0, m] -

void lua_rawseti (lua_State *L, int index, int n);
- -

-Does the equivalent of t[n] = v, -where t is the value at the given valid index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -The assignment is raw; -that is, it does not invoke metamethods. - - - - - -


lua_Reader

-
typedef const char * (*lua_Reader) (lua_State *L,
-                                    void *data,
-                                    size_t *size);
- -

-The reader function used by lua_load. -Every time it needs another piece of the chunk, -lua_load calls the reader, -passing along its data parameter. -The reader must return a pointer to a block of memory -with a new piece of the chunk -and set size to the block size. -The block must exist until the reader function is called again. -To signal the end of the chunk, -the reader must return NULL or set size to zero. -The reader function may return pieces of any size greater than zero. - - - - - -


lua_register

-[-0, +0, e] -

void lua_register (lua_State *L,
-                   const char *name,
-                   lua_CFunction f);
- -

-Sets the C function f as the new value of global name. -It is defined as a macro: - -

-     #define lua_register(L,n,f) \
-            (lua_pushcfunction(L, f), lua_setglobal(L, n))
-
- - - - -

lua_remove

-[-1, +0, -] -

void lua_remove (lua_State *L, int index);
- -

-Removes the element at the given valid index, -shifting down the elements above this index to fill the gap. -Cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_replace

-[-1, +0, -] -

void lua_replace (lua_State *L, int index);
- -

-Moves the top element into the given position (and pops it), -without shifting any element -(therefore replacing the value at the given position). - - - - - -


lua_resume

-[-?, +?, -] -

int lua_resume (lua_State *L, int narg);
- -

-Starts and resumes a coroutine in a given thread. - - -

-To start a coroutine, you first create a new thread -(see lua_newthread); -then you push onto its stack the main function plus any arguments; -then you call lua_resume, -with narg being the number of arguments. -This call returns when the coroutine suspends or finishes its execution. -When it returns, the stack contains all values passed to lua_yield, -or all values returned by the body function. -lua_resume returns -LUA_YIELD if the coroutine yields, -0 if the coroutine finishes its execution -without errors, -or an error code in case of errors (see lua_pcall). -In case of errors, -the stack is not unwound, -so you can use the debug API over it. -The error message is on the top of the stack. -To restart a coroutine, you put on its stack only the values to -be passed as results from yield, -and then call lua_resume. - - - - - -


lua_setallocf

-[-0, +0, -] -

void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
- -

-Changes the allocator function of a given state to f -with user data ud. - - - - - -


lua_setfenv

-[-1, +0, -] -

int lua_setfenv (lua_State *L, int index);
- -

-Pops a table from the stack and sets it as -the new environment for the value at the given index. -If the value at the given index is -neither a function nor a thread nor a userdata, -lua_setfenv returns 0. -Otherwise it returns 1. - - - - - -


lua_setfield

-[-1, +0, e] -

void lua_setfield (lua_State *L, int index, const char *k);
- -

-Does the equivalent to t[k] = v, -where t is the value at the given valid index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.8). - - - - - -


lua_setglobal

-[-1, +0, e] -

void lua_setglobal (lua_State *L, const char *name);
- -

-Pops a value from the stack and -sets it as the new value of global name. -It is defined as a macro: - -

-     #define lua_setglobal(L,s)   lua_setfield(L, LUA_GLOBALSINDEX, s)
-
- - - - -

lua_setmetatable

-[-1, +0, -] -

int lua_setmetatable (lua_State *L, int index);
- -

-Pops a table from the stack and -sets it as the new metatable for the value at the given -acceptable index. - - - - - -


lua_settable

-[-2, +0, e] -

void lua_settable (lua_State *L, int index);
- -

-Does the equivalent to t[k] = v, -where t is the value at the given valid index, -v is the value at the top of the stack, -and k is the value just below the top. - - -

-This function pops both the key and the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.8). - - - - - -


lua_settop

-[-?, +?, -] -

void lua_settop (lua_State *L, int index);
- -

-Accepts any acceptable index, or 0, -and sets the stack top to this index. -If the new top is larger than the old one, -then the new elements are filled with nil. -If index is 0, then all stack elements are removed. - - - - - -


lua_State

-
typedef struct lua_State lua_State;
- -

-Opaque structure that keeps the whole state of a Lua interpreter. -The Lua library is fully reentrant: -it has no global variables. -All information about a state is kept in this structure. - - -

-A pointer to this state must be passed as the first argument to -every function in the library, except to lua_newstate, -which creates a Lua state from scratch. - - - - - -


lua_status

-[-0, +0, -] -

int lua_status (lua_State *L);
- -

-Returns the status of the thread L. - - -

-The status can be 0 for a normal thread, -an error code if the thread finished its execution with an error, -or LUA_YIELD if the thread is suspended. - - - - - -


lua_toboolean

-[-0, +0, -] -

int lua_toboolean (lua_State *L, int index);
- -

-Converts the Lua value at the given acceptable index to a C boolean -value (0 or 1). -Like all tests in Lua, -lua_toboolean returns 1 for any Lua value -different from false and nil; -otherwise it returns 0. -It also returns 0 when called with a non-valid index. -(If you want to accept only actual boolean values, -use lua_isboolean to test the value's type.) - - - - - -


lua_tocfunction

-[-0, +0, -] -

lua_CFunction lua_tocfunction (lua_State *L, int index);
- -

-Converts a value at the given acceptable index to a C function. -That value must be a C function; -otherwise, returns NULL. - - - - - -


lua_tointeger

-[-0, +0, -] -

lua_Integer lua_tointeger (lua_State *L, int index);
- -

-Converts the Lua value at the given acceptable index -to the signed integral type lua_Integer. -The Lua value must be a number or a string convertible to a number -(see §2.2.1); -otherwise, lua_tointeger returns 0. - - -

-If the number is not an integer, -it is truncated in some non-specified way. - - - - - -


lua_tolstring

-[-0, +0, m] -

const char *lua_tolstring (lua_State *L, int index, size_t *len);
- -

-Converts the Lua value at the given acceptable index to a C string. -If len is not NULL, -it also sets *len with the string length. -The Lua value must be a string or a number; -otherwise, the function returns NULL. -If the value is a number, -then lua_tolstring also -changes the actual value in the stack to a string. -(This change confuses lua_next -when lua_tolstring is applied to keys during a table traversal.) - - -

-lua_tolstring returns a fully aligned pointer -to a string inside the Lua state. -This string always has a zero ('\0') -after its last character (as in C), -but can contain other zeros in its body. -Because Lua has garbage collection, -there is no guarantee that the pointer returned by lua_tolstring -will be valid after the corresponding value is removed from the stack. - - - - - -


lua_tonumber

-[-0, +0, -] -

lua_Number lua_tonumber (lua_State *L, int index);
- -

-Converts the Lua value at the given acceptable index -to the C type lua_Number (see lua_Number). -The Lua value must be a number or a string convertible to a number -(see §2.2.1); -otherwise, lua_tonumber returns 0. - - - - - -


lua_topointer

-[-0, +0, -] -

const void *lua_topointer (lua_State *L, int index);
- -

-Converts the value at the given acceptable index to a generic -C pointer (void*). -The value can be a userdata, a table, a thread, or a function; -otherwise, lua_topointer returns NULL. -Different objects will give different pointers. -There is no way to convert the pointer back to its original value. - - -

-Typically this function is used only for debug information. - - - - - -


lua_tostring

-[-0, +0, m] -

const char *lua_tostring (lua_State *L, int index);
- -

-Equivalent to lua_tolstring with len equal to NULL. - - - - - -


lua_tothread

-[-0, +0, -] -

lua_State *lua_tothread (lua_State *L, int index);
- -

-Converts the value at the given acceptable index to a Lua thread -(represented as lua_State*). -This value must be a thread; -otherwise, the function returns NULL. - - - - - -


lua_touserdata

-[-0, +0, -] -

void *lua_touserdata (lua_State *L, int index);
- -

-If the value at the given acceptable index is a full userdata, -returns its block address. -If the value is a light userdata, -returns its pointer. -Otherwise, returns NULL. - - - - - -


lua_type

-[-0, +0, -] -

int lua_type (lua_State *L, int index);
- -

-Returns the type of the value in the given acceptable index, -or LUA_TNONE for a non-valid index -(that is, an index to an "empty" stack position). -The types returned by lua_type are coded by the following constants -defined in lua.h: -LUA_TNIL, -LUA_TNUMBER, -LUA_TBOOLEAN, -LUA_TSTRING, -LUA_TTABLE, -LUA_TFUNCTION, -LUA_TUSERDATA, -LUA_TTHREAD, -and -LUA_TLIGHTUSERDATA. - - - - - -


lua_typename

-[-0, +0, -] -

const char *lua_typename  (lua_State *L, int tp);
- -

-Returns the name of the type encoded by the value tp, -which must be one the values returned by lua_type. - - - - - -


lua_Writer

-
typedef int (*lua_Writer) (lua_State *L,
-                           const void* p,
-                           size_t sz,
-                           void* ud);
- -

-The type of the writer function used by lua_dump. -Every time it produces another piece of chunk, -lua_dump calls the writer, -passing along the buffer to be written (p), -its size (sz), -and the data parameter supplied to lua_dump. - - -

-The writer returns an error code: -0 means no errors; -any other value means an error and stops lua_dump from -calling the writer again. - - - - - -


lua_xmove

-[-?, +?, -] -

void lua_xmove (lua_State *from, lua_State *to, int n);
- -

-Exchange values between different threads of the same global state. - - -

-This function pops n values from the stack from, -and pushes them onto the stack to. - - - - - -


lua_yield

-[-?, +?, -] -

int lua_yield  (lua_State *L, int nresults);
- -

-Yields a coroutine. - - -

-This function should only be called as the -return expression of a C function, as follows: - -

-     return lua_yield (L, nresults);
-

-When a C function calls lua_yield in that way, -the running coroutine suspends its execution, -and the call to lua_resume that started this coroutine returns. -The parameter nresults is the number of values from the stack -that are passed as results to lua_resume. - - - - - - - -

3.8 - The Debug Interface

- -

-Lua has no built-in debugging facilities. -Instead, it offers a special interface -by means of functions and hooks. -This interface allows the construction of different -kinds of debuggers, profilers, and other tools -that need "inside information" from the interpreter. - - - -


lua_Debug

-
typedef struct lua_Debug {
-  int event;
-  const char *name;           /* (n) */
-  const char *namewhat;       /* (n) */
-  const char *what;           /* (S) */
-  const char *source;         /* (S) */
-  int currentline;            /* (l) */
-  int nups;                   /* (u) number of upvalues */
-  int linedefined;            /* (S) */
-  int lastlinedefined;        /* (S) */
-  char short_src[LUA_IDSIZE]; /* (S) */
-  /* private part */
-  other fields
-} lua_Debug;
- -

-A structure used to carry different pieces of -information about an active function. -lua_getstack fills only the private part -of this structure, for later use. -To fill the other fields of lua_Debug with useful information, -call lua_getinfo. - - -

-The fields of lua_Debug have the following meaning: - -

    - -
  • source: -If the function was defined in a string, -then source is that string. -If the function was defined in a file, -then source starts with a '@' followed by the file name. -
  • - -
  • short_src: -a "printable" version of source, to be used in error messages. -
  • - -
  • linedefined: -the line number where the definition of the function starts. -
  • - -
  • lastlinedefined: -the line number where the definition of the function ends. -
  • - -
  • what: -the string "Lua" if the function is a Lua function, -"C" if it is a C function, -"main" if it is the main part of a chunk, -and "tail" if it was a function that did a tail call. -In the latter case, -Lua has no other information about the function. -
  • - -
  • currentline: -the current line where the given function is executing. -When no line information is available, -currentline is set to -1. -
  • - -
  • name: -a reasonable name for the given function. -Because functions in Lua are first-class values, -they do not have a fixed name: -some functions can be the value of multiple global variables, -while others can be stored only in a table field. -The lua_getinfo function checks how the function was -called to find a suitable name. -If it cannot find a name, -then name is set to NULL. -
  • - -
  • namewhat: -explains the name field. -The value of namewhat can be -"global", "local", "method", -"field", "upvalue", or "" (the empty string), -according to how the function was called. -(Lua uses the empty string when no other option seems to apply.) -
  • - -
  • nups: -the number of upvalues of the function. -
  • - -
- - - - -

lua_gethook

-[-0, +0, -] -

lua_Hook lua_gethook (lua_State *L);
- -

-Returns the current hook function. - - - - - -


lua_gethookcount

-[-0, +0, -] -

int lua_gethookcount (lua_State *L);
- -

-Returns the current hook count. - - - - - -


lua_gethookmask

-[-0, +0, -] -

int lua_gethookmask (lua_State *L);
- -

-Returns the current hook mask. - - - - - -


lua_getinfo

-[-(0|1), +(0|1|2), m] -

int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
- -

-Returns information about a specific function or function invocation. - - -

-To get information about a function invocation, -the parameter ar must be a valid activation record that was -filled by a previous call to lua_getstack or -given as argument to a hook (see lua_Hook). - - -

-To get information about a function you push it onto the stack -and start the what string with the character '>'. -(In that case, -lua_getinfo pops the function in the top of the stack.) -For instance, to know in which line a function f was defined, -you can write the following code: - -

-     lua_Debug ar;
-     lua_getfield(L, LUA_GLOBALSINDEX, "f");  /* get global 'f' */
-     lua_getinfo(L, ">S", &ar);
-     printf("%d\n", ar.linedefined);
-
- -

-Each character in the string what -selects some fields of the structure ar to be filled or -a value to be pushed on the stack: - -

    - -
  • 'n': fills in the field name and namewhat; -
  • - -
  • 'S': -fills in the fields source, short_src, -linedefined, lastlinedefined, and what; -
  • - -
  • 'l': fills in the field currentline; -
  • - -
  • 'u': fills in the field nups; -
  • - -
  • 'f': -pushes onto the stack the function that is -running at the given level; -
  • - -
  • 'L': -pushes onto the stack a table whose indices are the -numbers of the lines that are valid on the function. -(A valid line is a line with some associated code, -that is, a line where you can put a break point. -Non-valid lines include empty lines and comments.) -
  • - -
- -

-This function returns 0 on error -(for instance, an invalid option in what). - - - - - -


lua_getlocal

-[-0, +(0|1), -] -

const char *lua_getlocal (lua_State *L, lua_Debug *ar, int n);
- -

-Gets information about a local variable of a given activation record. -The parameter ar must be a valid activation record that was -filled by a previous call to lua_getstack or -given as argument to a hook (see lua_Hook). -The index n selects which local variable to inspect -(1 is the first parameter or active local variable, and so on, -until the last active local variable). -lua_getlocal pushes the variable's value onto the stack -and returns its name. - - -

-Variable names starting with '(' (open parentheses) -represent internal variables -(loop control variables, temporaries, and C function locals). - - -

-Returns NULL (and pushes nothing) -when the index is greater than -the number of active local variables. - - - - - -


lua_getstack

-[-0, +0, -] -

int lua_getstack (lua_State *L, int level, lua_Debug *ar);
- -

-Get information about the interpreter runtime stack. - - -

-This function fills parts of a lua_Debug structure with -an identification of the activation record -of the function executing at a given level. -Level 0 is the current running function, -whereas level n+1 is the function that has called level n. -When there are no errors, lua_getstack returns 1; -when called with a level greater than the stack depth, -it returns 0. - - - - - -


lua_getupvalue

-[-0, +(0|1), -] -

const char *lua_getupvalue (lua_State *L, int funcindex, int n);
- -

-Gets information about a closure's upvalue. -(For Lua functions, -upvalues are the external local variables that the function uses, -and that are consequently included in its closure.) -lua_getupvalue gets the index n of an upvalue, -pushes the upvalue's value onto the stack, -and returns its name. -funcindex points to the closure in the stack. -(Upvalues have no particular order, -as they are active through the whole function. -So, they are numbered in an arbitrary order.) - - -

-Returns NULL (and pushes nothing) -when the index is greater than the number of upvalues. -For C functions, this function uses the empty string "" -as a name for all upvalues. - - - - - -


lua_Hook

-
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
- -

-Type for debugging hook functions. - - -

-Whenever a hook is called, its ar argument has its field -event set to the specific event that triggered the hook. -Lua identifies these events with the following constants: -LUA_HOOKCALL, LUA_HOOKRET, -LUA_HOOKTAILRET, LUA_HOOKLINE, -and LUA_HOOKCOUNT. -Moreover, for line events, the field currentline is also set. -To get the value of any other field in ar, -the hook must call lua_getinfo. -For return events, event can be LUA_HOOKRET, -the normal value, or LUA_HOOKTAILRET. -In the latter case, Lua is simulating a return from -a function that did a tail call; -in this case, it is useless to call lua_getinfo. - - -

-While Lua is running a hook, it disables other calls to hooks. -Therefore, if a hook calls back Lua to execute a function or a chunk, -this execution occurs without any calls to hooks. - - - - - -


lua_sethook

-[-0, +0, -] -

int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);
- -

-Sets the debugging hook function. - - -

-Argument f is the hook function. -mask specifies on which events the hook will be called: -it is formed by a bitwise or of the constants -LUA_MASKCALL, -LUA_MASKRET, -LUA_MASKLINE, -and LUA_MASKCOUNT. -The count argument is only meaningful when the mask -includes LUA_MASKCOUNT. -For each event, the hook is called as explained below: - -

    - -
  • The call hook: is called when the interpreter calls a function. -The hook is called just after Lua enters the new function, -before the function gets its arguments. -
  • - -
  • The return hook: is called when the interpreter returns from a function. -The hook is called just before Lua leaves the function. -You have no access to the values to be returned by the function. -
  • - -
  • The line hook: is called when the interpreter is about to -start the execution of a new line of code, -or when it jumps back in the code (even to the same line). -(This event only happens while Lua is executing a Lua function.) -
  • - -
  • The count hook: is called after the interpreter executes every -count instructions. -(This event only happens while Lua is executing a Lua function.) -
  • - -
- -

-A hook is disabled by setting mask to zero. - - - - - -


lua_setlocal

-[-(0|1), +0, -] -

const char *lua_setlocal (lua_State *L, lua_Debug *ar, int n);
- -

-Sets the value of a local variable of a given activation record. -Parameters ar and n are as in lua_getlocal -(see lua_getlocal). -lua_setlocal assigns the value at the top of the stack -to the variable and returns its name. -It also pops the value from the stack. - - -

-Returns NULL (and pops nothing) -when the index is greater than -the number of active local variables. - - - - - -


lua_setupvalue

-[-(0|1), +0, -] -

const char *lua_setupvalue (lua_State *L, int funcindex, int n);
- -

-Sets the value of a closure's upvalue. -It assigns the value at the top of the stack -to the upvalue and returns its name. -It also pops the value from the stack. -Parameters funcindex and n are as in the lua_getupvalue -(see lua_getupvalue). - - -

-Returns NULL (and pops nothing) -when the index is greater than the number of upvalues. - - - - - - - -

4 - The Auxiliary Library

- -

- -The auxiliary library provides several convenient functions -to interface C with Lua. -While the basic API provides the primitive functions for all -interactions between C and Lua, -the auxiliary library provides higher-level functions for some -common tasks. - - -

-All functions from the auxiliary library -are defined in header file lauxlib.h and -have a prefix luaL_. - - -

-All functions in the auxiliary library are built on -top of the basic API, -and so they provide nothing that cannot be done with this API. - - -

-Several functions in the auxiliary library are used to -check C function arguments. -Their names are always luaL_check* or luaL_opt*. -All of these functions throw an error if the check is not satisfied. -Because the error message is formatted for arguments -(e.g., "bad argument #1"), -you should not use these functions for other stack values. - - - -

4.1 - Functions and Types

- -

-Here we list all functions and types from the auxiliary library -in alphabetical order. - - - -


luaL_addchar

-[-0, +0, m] -

void luaL_addchar (luaL_Buffer *B, char c);
- -

-Adds the character c to the buffer B -(see luaL_Buffer). - - - - - -


luaL_addlstring

-[-0, +0, m] -

void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
- -

-Adds the string pointed to by s with length l to -the buffer B -(see luaL_Buffer). -The string may contain embedded zeros. - - - - - -


luaL_addsize

-[-0, +0, m] -

void luaL_addsize (luaL_Buffer *B, size_t n);
- -

-Adds to the buffer B (see luaL_Buffer) -a string of length n previously copied to the -buffer area (see luaL_prepbuffer). - - - - - -


luaL_addstring

-[-0, +0, m] -

void luaL_addstring (luaL_Buffer *B, const char *s);
- -

-Adds the zero-terminated string pointed to by s -to the buffer B -(see luaL_Buffer). -The string may not contain embedded zeros. - - - - - -


luaL_addvalue

-[-1, +0, m] -

void luaL_addvalue (luaL_Buffer *B);
- -

-Adds the value at the top of the stack -to the buffer B -(see luaL_Buffer). -Pops the value. - - -

-This is the only function on string buffers that can (and must) -be called with an extra element on the stack, -which is the value to be added to the buffer. - - - - - -


luaL_argcheck

-[-0, +0, v] -

void luaL_argcheck (lua_State *L,
-                    int cond,
-                    int narg,
-                    const char *extramsg);
- -

-Checks whether cond is true. -If not, raises an error with the following message, -where func is retrieved from the call stack: - -

-     bad argument #<narg> to <func> (<extramsg>)
-
- - - - -

luaL_argerror

-[-0, +0, v] -

int luaL_argerror (lua_State *L, int narg, const char *extramsg);
- -

-Raises an error with the following message, -where func is retrieved from the call stack: - -

-     bad argument #<narg> to <func> (<extramsg>)
-
- -

-This function never returns, -but it is an idiom to use it in C functions -as return luaL_argerror(args). - - - - - -


luaL_Buffer

-
typedef struct luaL_Buffer luaL_Buffer;
- -

-Type for a string buffer. - - -

-A string buffer allows C code to build Lua strings piecemeal. -Its pattern of use is as follows: - -

    - -
  • First you declare a variable b of type luaL_Buffer.
  • - -
  • Then you initialize it with a call luaL_buffinit(L, &b).
  • - -
  • -Then you add string pieces to the buffer calling any of -the luaL_add* functions. -
  • - -
  • -You finish by calling luaL_pushresult(&b). -This call leaves the final string on the top of the stack. -
  • - -
- -

-During its normal operation, -a string buffer uses a variable number of stack slots. -So, while using a buffer, you cannot assume that you know where -the top of the stack is. -You can use the stack between successive calls to buffer operations -as long as that use is balanced; -that is, -when you call a buffer operation, -the stack is at the same level -it was immediately after the previous buffer operation. -(The only exception to this rule is luaL_addvalue.) -After calling luaL_pushresult the stack is back to its -level when the buffer was initialized, -plus the final string on its top. - - - - - -


luaL_buffinit

-[-0, +0, -] -

void luaL_buffinit (lua_State *L, luaL_Buffer *B);
- -

-Initializes a buffer B. -This function does not allocate any space; -the buffer must be declared as a variable -(see luaL_Buffer). - - - - - -


luaL_callmeta

-[-0, +(0|1), e] -

int luaL_callmeta (lua_State *L, int obj, const char *e);
- -

-Calls a metamethod. - - -

-If the object at index obj has a metatable and this -metatable has a field e, -this function calls this field and passes the object as its only argument. -In this case this function returns 1 and pushes onto the -stack the value returned by the call. -If there is no metatable or no metamethod, -this function returns 0 (without pushing any value on the stack). - - - - - -


luaL_checkany

-[-0, +0, v] -

void luaL_checkany (lua_State *L, int narg);
- -

-Checks whether the function has an argument -of any type (including nil) at position narg. - - - - - -


luaL_checkint

-[-0, +0, v] -

int luaL_checkint (lua_State *L, int narg);
- -

-Checks whether the function argument narg is a number -and returns this number cast to an int. - - - - - -


luaL_checkinteger

-[-0, +0, v] -

lua_Integer luaL_checkinteger (lua_State *L, int narg);
- -

-Checks whether the function argument narg is a number -and returns this number cast to a lua_Integer. - - - - - -


luaL_checklong

-[-0, +0, v] -

long luaL_checklong (lua_State *L, int narg);
- -

-Checks whether the function argument narg is a number -and returns this number cast to a long. - - - - - -


luaL_checklstring

-[-0, +0, v] -

const char *luaL_checklstring (lua_State *L, int narg, size_t *l);
- -

-Checks whether the function argument narg is a string -and returns this string; -if l is not NULL fills *l -with the string's length. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_checknumber

-[-0, +0, v] -

lua_Number luaL_checknumber (lua_State *L, int narg);
- -

-Checks whether the function argument narg is a number -and returns this number. - - - - - -


luaL_checkoption

-[-0, +0, v] -

int luaL_checkoption (lua_State *L,
-                      int narg,
-                      const char *def,
-                      const char *const lst[]);
- -

-Checks whether the function argument narg is a string and -searches for this string in the array lst -(which must be NULL-terminated). -Returns the index in the array where the string was found. -Raises an error if the argument is not a string or -if the string cannot be found. - - -

-If def is not NULL, -the function uses def as a default value when -there is no argument narg or if this argument is nil. - - -

-This is a useful function for mapping strings to C enums. -(The usual convention in Lua libraries is -to use strings instead of numbers to select options.) - - - - - -


luaL_checkstack

-[-0, +0, v] -

void luaL_checkstack (lua_State *L, int sz, const char *msg);
- -

-Grows the stack size to top + sz elements, -raising an error if the stack cannot grow to that size. -msg is an additional text to go into the error message. - - - - - -


luaL_checkstring

-[-0, +0, v] -

const char *luaL_checkstring (lua_State *L, int narg);
- -

-Checks whether the function argument narg is a string -and returns this string. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_checktype

-[-0, +0, v] -

void luaL_checktype (lua_State *L, int narg, int t);
- -

-Checks whether the function argument narg has type t. -See lua_type for the encoding of types for t. - - - - - -


luaL_checkudata

-[-0, +0, v] -

void *luaL_checkudata (lua_State *L, int narg, const char *tname);
- -

-Checks whether the function argument narg is a userdata -of the type tname (see luaL_newmetatable). - - - - - -


luaL_dofile

-[-0, +?, m] -

int luaL_dofile (lua_State *L, const char *filename);
- -

-Loads and runs the given file. -It is defined as the following macro: - -

-     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
-

-It returns 0 if there are no errors -or 1 in case of errors. - - - - - -


luaL_dostring

-[-0, +?, m] -

int luaL_dostring (lua_State *L, const char *str);
- -

-Loads and runs the given string. -It is defined as the following macro: - -

-     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
-

-It returns 0 if there are no errors -or 1 in case of errors. - - - - - -


luaL_error

-[-0, +0, v] -

int luaL_error (lua_State *L, const char *fmt, ...);
- -

-Raises an error. -The error message format is given by fmt -plus any extra arguments, -following the same rules of lua_pushfstring. -It also adds at the beginning of the message the file name and -the line number where the error occurred, -if this information is available. - - -

-This function never returns, -but it is an idiom to use it in C functions -as return luaL_error(args). - - - - - -


luaL_getmetafield

-[-0, +(0|1), m] -

int luaL_getmetafield (lua_State *L, int obj, const char *e);
- -

-Pushes onto the stack the field e from the metatable -of the object at index obj. -If the object does not have a metatable, -or if the metatable does not have this field, -returns 0 and pushes nothing. - - - - - -


luaL_getmetatable

-[-0, +1, -] -

void luaL_getmetatable (lua_State *L, const char *tname);
- -

-Pushes onto the stack the metatable associated with name tname -in the registry (see luaL_newmetatable). - - - - - -


luaL_gsub

-[-0, +1, m] -

const char *luaL_gsub (lua_State *L,
-                       const char *s,
-                       const char *p,
-                       const char *r);
- -

-Creates a copy of string s by replacing -any occurrence of the string p -with the string r. -Pushes the resulting string on the stack and returns it. - - - - - -


luaL_loadbuffer

-[-0, +1, m] -

int luaL_loadbuffer (lua_State *L,
-                     const char *buff,
-                     size_t sz,
-                     const char *name);
- -

-Loads a buffer as a Lua chunk. -This function uses lua_load to load the chunk in the -buffer pointed to by buff with size sz. - - -

-This function returns the same results as lua_load. -name is the chunk name, -used for debug information and error messages. - - - - - -


luaL_loadfile

-[-0, +1, m] -

int luaL_loadfile (lua_State *L, const char *filename);
- -

-Loads a file as a Lua chunk. -This function uses lua_load to load the chunk in the file -named filename. -If filename is NULL, -then it loads from the standard input. -The first line in the file is ignored if it starts with a #. - - -

-This function returns the same results as lua_load, -but it has an extra error code LUA_ERRFILE -if it cannot open/read the file. - - -

-As lua_load, this function only loads the chunk; -it does not run it. - - - - - -


luaL_loadstring

-[-0, +1, m] -

int luaL_loadstring (lua_State *L, const char *s);
- -

-Loads a string as a Lua chunk. -This function uses lua_load to load the chunk in -the zero-terminated string s. - - -

-This function returns the same results as lua_load. - - -

-Also as lua_load, this function only loads the chunk; -it does not run it. - - - - - -


luaL_newmetatable

-[-0, +1, m] -

int luaL_newmetatable (lua_State *L, const char *tname);
- -

-If the registry already has the key tname, -returns 0. -Otherwise, -creates a new table to be used as a metatable for userdata, -adds it to the registry with key tname, -and returns 1. - - -

-In both cases pushes onto the stack the final value associated -with tname in the registry. - - - - - -


luaL_newstate

-[-0, +0, -] -

lua_State *luaL_newstate (void);
- -

-Creates a new Lua state. -It calls lua_newstate with an -allocator based on the standard C realloc function -and then sets a panic function (see lua_atpanic) that prints -an error message to the standard error output in case of fatal -errors. - - -

-Returns the new state, -or NULL if there is a memory allocation error. - - - - - -


luaL_openlibs

-[-0, +0, m] -

void luaL_openlibs (lua_State *L);
- -

-Opens all standard Lua libraries into the given state. - - - - - -


luaL_optint

-[-0, +0, v] -

int luaL_optint (lua_State *L, int narg, int d);
- -

-If the function argument narg is a number, -returns this number cast to an int. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optinteger

-[-0, +0, v] -

lua_Integer luaL_optinteger (lua_State *L,
-                             int narg,
-                             lua_Integer d);
- -

-If the function argument narg is a number, -returns this number cast to a lua_Integer. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optlong

-[-0, +0, v] -

long luaL_optlong (lua_State *L, int narg, long d);
- -

-If the function argument narg is a number, -returns this number cast to a long. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optlstring

-[-0, +0, v] -

const char *luaL_optlstring (lua_State *L,
-                             int narg,
-                             const char *d,
-                             size_t *l);
- -

-If the function argument narg is a string, -returns this string. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - -

-If l is not NULL, -fills the position *l with the results's length. - - - - - -


luaL_optnumber

-[-0, +0, v] -

lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number d);
- -

-If the function argument narg is a number, -returns this number. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optstring

-[-0, +0, v] -

const char *luaL_optstring (lua_State *L,
-                            int narg,
-                            const char *d);
- -

-If the function argument narg is a string, -returns this string. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_prepbuffer

-[-0, +0, -] -

char *luaL_prepbuffer (luaL_Buffer *B);
- -

-Returns an address to a space of size LUAL_BUFFERSIZE -where you can copy a string to be added to buffer B -(see luaL_Buffer). -After copying the string into this space you must call -luaL_addsize with the size of the string to actually add -it to the buffer. - - - - - -


luaL_pushresult

-[-?, +1, m] -

void luaL_pushresult (luaL_Buffer *B);
- -

-Finishes the use of buffer B leaving the final string on -the top of the stack. - - - - - -


luaL_ref

-[-1, +0, m] -

int luaL_ref (lua_State *L, int t);
- -

-Creates and returns a reference, -in the table at index t, -for the object at the top of the stack (and pops the object). - - -

-A reference is a unique integer key. -As long as you do not manually add integer keys into table t, -luaL_ref ensures the uniqueness of the key it returns. -You can retrieve an object referred by reference r -by calling lua_rawgeti(L, t, r). -Function luaL_unref frees a reference and its associated object. - - -

-If the object at the top of the stack is nil, -luaL_ref returns the constant LUA_REFNIL. -The constant LUA_NOREF is guaranteed to be different -from any reference returned by luaL_ref. - - - - - -


luaL_Reg

-
typedef struct luaL_Reg {
-  const char *name;
-  lua_CFunction func;
-} luaL_Reg;
- -

-Type for arrays of functions to be registered by -luaL_register. -name is the function name and func is a pointer to -the function. -Any array of luaL_Reg must end with an sentinel entry -in which both name and func are NULL. - - - - - -


luaL_register

-[-(0|1), +1, m] -

void luaL_register (lua_State *L,
-                    const char *libname,
-                    const luaL_Reg *l);
- -

-Opens a library. - - -

-When called with libname equal to NULL, -it simply registers all functions in the list l -(see luaL_Reg) into the table on the top of the stack. - - -

-When called with a non-null libname, -luaL_register creates a new table t, -sets it as the value of the global variable libname, -sets it as the value of package.loaded[libname], -and registers on it all functions in the list l. -If there is a table in package.loaded[libname] or in -variable libname, -reuses this table instead of creating a new one. - - -

-In any case the function leaves the table -on the top of the stack. - - - - - -


luaL_typename

-[-0, +0, -] -

const char *luaL_typename (lua_State *L, int index);
- -

-Returns the name of the type of the value at the given index. - - - - - -


luaL_typerror

-[-0, +0, v] -

int luaL_typerror (lua_State *L, int narg, const char *tname);
- -

-Generates an error with a message like the following: - -

-     location: bad argument narg to 'func' (tname expected, got rt)
-

-where location is produced by luaL_where, -func is the name of the current function, -and rt is the type name of the actual argument. - - - - - -


luaL_unref

-[-0, +0, -] -

void luaL_unref (lua_State *L, int t, int ref);
- -

-Releases reference ref from the table at index t -(see luaL_ref). -The entry is removed from the table, -so that the referred object can be collected. -The reference ref is also freed to be used again. - - -

-If ref is LUA_NOREF or LUA_REFNIL, -luaL_unref does nothing. - - - - - -


luaL_where

-[-0, +1, m] -

void luaL_where (lua_State *L, int lvl);
- -

-Pushes onto the stack a string identifying the current position -of the control at level lvl in the call stack. -Typically this string has the following format: - -

-     chunkname:currentline:
-

-Level 0 is the running function, -level 1 is the function that called the running function, -etc. - - -

-This function is used to build a prefix for error messages. - - - - - - - -

5 - Standard Libraries

- -

-The standard Lua libraries provide useful functions -that are implemented directly through the C API. -Some of these functions provide essential services to the language -(e.g., type and getmetatable); -others provide access to "outside" services (e.g., I/O); -and others could be implemented in Lua itself, -but are quite useful or have critical performance requirements that -deserve an implementation in C (e.g., table.sort). - - -

-All libraries are implemented through the official C API -and are provided as separate C modules. -Currently, Lua has the following standard libraries: - -

    - -
  • basic library, which includes the coroutine sub-library;
  • - -
  • package library;
  • - -
  • string manipulation;
  • - -
  • table manipulation;
  • - -
  • mathematical functions (sin, log, etc.);
  • - -
  • input and output;
  • - -
  • operating system facilities;
  • - -
  • debug facilities.
  • - -

-Except for the basic and package libraries, -each library provides all its functions as fields of a global table -or as methods of its objects. - - -

-To have access to these libraries, -the C host program should call the luaL_openlibs function, -which opens all standard libraries. -Alternatively, -it can open them individually by calling -luaopen_base (for the basic library), -luaopen_package (for the package library), -luaopen_string (for the string library), -luaopen_table (for the table library), -luaopen_math (for the mathematical library), -luaopen_io (for the I/O library), -luaopen_os (for the Operating System library), -and luaopen_debug (for the debug library). -These functions are declared in lualib.h -and should not be called directly: -you must call them like any other Lua C function, -e.g., by using lua_call. - - - -

5.1 - Basic Functions

- -

-The basic library provides some core functions to Lua. -If you do not include this library in your application, -you should check carefully whether you need to provide -implementations for some of its facilities. - - -

-


assert (v [, message])

-Issues an error when -the value of its argument v is false (i.e., nil or false); -otherwise, returns all its arguments. -message is an error message; -when absent, it defaults to "assertion failed!" - - - - -

-


collectgarbage ([opt [, arg]])

- - -

-This function is a generic interface to the garbage collector. -It performs different functions according to its first argument, opt: - -

    - -
  • "collect": -performs a full garbage-collection cycle. -This is the default option. -
  • - -
  • "stop": -stops the garbage collector. -
  • - -
  • "restart": -restarts the garbage collector. -
  • - -
  • "count": -returns the total memory in use by Lua (in Kbytes). -
  • - -
  • "step": -performs a garbage-collection step. -The step "size" is controlled by arg -(larger values mean more steps) in a non-specified way. -If you want to control the step size -you must experimentally tune the value of arg. -Returns true if the step finished a collection cycle. -
  • - -
  • "setpause": -sets arg as the new value for the pause of -the collector (see §2.10). -Returns the previous value for pause. -
  • - -
  • "setstepmul": -sets arg as the new value for the step multiplier of -the collector (see §2.10). -Returns the previous value for step. -
  • - -
- - - -

-


dofile ([filename])

-Opens the named file and executes its contents as a Lua chunk. -When called without arguments, -dofile executes the contents of the standard input (stdin). -Returns all values returned by the chunk. -In case of errors, dofile propagates the error -to its caller (that is, dofile does not run in protected mode). - - - - -

-


error (message [, level])

-Terminates the last protected function called -and returns message as the error message. -Function error never returns. - - -

-Usually, error adds some information about the error position -at the beginning of the message. -The level argument specifies how to get the error position. -With level 1 (the default), the error position is where the -error function was called. -Level 2 points the error to where the function -that called error was called; and so on. -Passing a level 0 avoids the addition of error position information -to the message. - - - - -

-


_G

-A global variable (not a function) that -holds the global environment (that is, _G._G = _G). -Lua itself does not use this variable; -changing its value does not affect any environment, -nor vice-versa. -(Use setfenv to change environments.) - - - - -

-


getfenv ([f])

-Returns the current environment in use by the function. -f can be a Lua function or a number -that specifies the function at that stack level: -Level 1 is the function calling getfenv. -If the given function is not a Lua function, -or if f is 0, -getfenv returns the global environment. -The default for f is 1. - - - - -

-


getmetatable (object)

- - -

-If object does not have a metatable, returns nil. -Otherwise, -if the object's metatable has a "__metatable" field, -returns the associated value. -Otherwise, returns the metatable of the given object. - - - - -

-


ipairs (t)

- - -

-Returns three values: an iterator function, the table t, and 0, -so that the construction - -

-     for i,v in ipairs(t) do body end
-

-will iterate over the pairs (1,t[1]), (2,t[2]), ···, -up to the first integer key absent from the table. - - - - -

-


load (func [, chunkname])

- - -

-Loads a chunk using function func to get its pieces. -Each call to func must return a string that concatenates -with previous results. -A return of an empty string, nil, or no value signals the end of the chunk. - - -

-If there are no errors, -returns the compiled chunk as a function; -otherwise, returns nil plus the error message. -The environment of the returned function is the global environment. - - -

-chunkname is used as the chunk name for error messages -and debug information. -When absent, -it defaults to "=(load)". - - - - -

-


loadfile ([filename])

- - -

-Similar to load, -but gets the chunk from file filename -or from the standard input, -if no file name is given. - - - - -

-


loadstring (string [, chunkname])

- - -

-Similar to load, -but gets the chunk from the given string. - - -

-To load and run a given string, use the idiom - -

-     assert(loadstring(s))()
-
- -

-When absent, -chunkname defaults to the given string. - - - - -

-


next (table [, index])

- - -

-Allows a program to traverse all fields of a table. -Its first argument is a table and its second argument -is an index in this table. -next returns the next index of the table -and its associated value. -When called with nil as its second argument, -next returns an initial index -and its associated value. -When called with the last index, -or with nil in an empty table, -next returns nil. -If the second argument is absent, then it is interpreted as nil. -In particular, -you can use next(t) to check whether a table is empty. - - -

-The order in which the indices are enumerated is not specified, -even for numeric indices. -(To traverse a table in numeric order, -use a numerical for or the ipairs function.) - - -

-The behavior of next is undefined if, -during the traversal, -you assign any value to a non-existent field in the table. -You may however modify existing fields. -In particular, you may clear existing fields. - - - - -

-


pairs (t)

- - -

-Returns three values: the next function, the table t, and nil, -so that the construction - -

-     for k,v in pairs(t) do body end
-

-will iterate over all key–value pairs of table t. - - -

-See function next for the caveats of modifying -the table during its traversal. - - - - -

-


pcall (f, arg1, ···)

- - -

-Calls function f with -the given arguments in protected mode. -This means that any error inside f is not propagated; -instead, pcall catches the error -and returns a status code. -Its first result is the status code (a boolean), -which is true if the call succeeds without errors. -In such case, pcall also returns all results from the call, -after this first result. -In case of any error, pcall returns false plus the error message. - - - - -

-


print (···)

-Receives any number of arguments, -and prints their values to stdout, -using the tostring function to convert them to strings. -print is not intended for formatted output, -but only as a quick way to show a value, -typically for debugging. -For formatted output, use string.format. - - - - -

-


rawequal (v1, v2)

-Checks whether v1 is equal to v2, -without invoking any metamethod. -Returns a boolean. - - - - -

-


rawget (table, index)

-Gets the real value of table[index], -without invoking any metamethod. -table must be a table; -index may be any value. - - - - -

-


rawset (table, index, value)

-Sets the real value of table[index] to value, -without invoking any metamethod. -table must be a table, -index any value different from nil, -and value any Lua value. - - -

-This function returns table. - - - - -

-


select (index, ···)

- - -

-If index is a number, -returns all arguments after argument number index. -Otherwise, index must be the string "#", -and select returns the total number of extra arguments it received. - - - - -

-


setfenv (f, table)

- - -

-Sets the environment to be used by the given function. -f can be a Lua function or a number -that specifies the function at that stack level: -Level 1 is the function calling setfenv. -setfenv returns the given function. - - -

-As a special case, when f is 0 setfenv changes -the environment of the running thread. -In this case, setfenv returns no values. - - - - -

-


setmetatable (table, metatable)

- - -

-Sets the metatable for the given table. -(You cannot change the metatable of other types from Lua, only from C.) -If metatable is nil, -removes the metatable of the given table. -If the original metatable has a "__metatable" field, -raises an error. - - -

-This function returns table. - - - - -

-


tonumber (e [, base])

-Tries to convert its argument to a number. -If the argument is already a number or a string convertible -to a number, then tonumber returns this number; -otherwise, it returns nil. - - -

-An optional argument specifies the base to interpret the numeral. -The base may be any integer between 2 and 36, inclusive. -In bases above 10, the letter 'A' (in either upper or lower case) -represents 10, 'B' represents 11, and so forth, -with 'Z' representing 35. -In base 10 (the default), the number can have a decimal part, -as well as an optional exponent part (see §2.1). -In other bases, only unsigned integers are accepted. - - - - -

-


tostring (e)

-Receives an argument of any type and -converts it to a string in a reasonable format. -For complete control of how numbers are converted, -use string.format. - - -

-If the metatable of e has a "__tostring" field, -then tostring calls the corresponding value -with e as argument, -and uses the result of the call as its result. - - - - -

-


type (v)

-Returns the type of its only argument, coded as a string. -The possible results of this function are -"nil" (a string, not the value nil), -"number", -"string", -"boolean", -"table", -"function", -"thread", -and "userdata". - - - - -

-


unpack (list [, i [, j]])

-Returns the elements from the given table. -This function is equivalent to - -
-     return list[i], list[i+1], ···, list[j]
-

-except that the above code can be written only for a fixed number -of elements. -By default, i is 1 and j is the length of the list, -as defined by the length operator (see §2.5.5). - - - - -

-


_VERSION

-A global variable (not a function) that -holds a string containing the current interpreter version. -The current contents of this variable is "Lua 5.1". - - - - -

-


xpcall (f, err)

- - -

-This function is similar to pcall, -except that you can set a new error handler. - - -

-xpcall calls function f in protected mode, -using err as the error handler. -Any error inside f is not propagated; -instead, xpcall catches the error, -calls the err function with the original error object, -and returns a status code. -Its first result is the status code (a boolean), -which is true if the call succeeds without errors. -In this case, xpcall also returns all results from the call, -after this first result. -In case of any error, -xpcall returns false plus the result from err. - - - - - - - -

5.2 - Coroutine Manipulation

- -

-The operations related to coroutines comprise a sub-library of -the basic library and come inside the table coroutine. -See §2.11 for a general description of coroutines. - - -

-


coroutine.create (f)

- - -

-Creates a new coroutine, with body f. -f must be a Lua function. -Returns this new coroutine, -an object with type "thread". - - - - -

-


coroutine.resume (co [, val1, ···])

- - -

-Starts or continues the execution of coroutine co. -The first time you resume a coroutine, -it starts running its body. -The values val1, ··· are passed -as the arguments to the body function. -If the coroutine has yielded, -resume restarts it; -the values val1, ··· are passed -as the results from the yield. - - -

-If the coroutine runs without any errors, -resume returns true plus any values passed to yield -(if the coroutine yields) or any values returned by the body function -(if the coroutine terminates). -If there is any error, -resume returns false plus the error message. - - - - -

-


coroutine.running ()

- - -

-Returns the running coroutine, -or nil when called by the main thread. - - - - -

-


coroutine.status (co)

- - -

-Returns the status of coroutine co, as a string: -"running", -if the coroutine is running (that is, it called status); -"suspended", if the coroutine is suspended in a call to yield, -or if it has not started running yet; -"normal" if the coroutine is active but not running -(that is, it has resumed another coroutine); -and "dead" if the coroutine has finished its body function, -or if it has stopped with an error. - - - - -

-


coroutine.wrap (f)

- - -

-Creates a new coroutine, with body f. -f must be a Lua function. -Returns a function that resumes the coroutine each time it is called. -Any arguments passed to the function behave as the -extra arguments to resume. -Returns the same values returned by resume, -except the first boolean. -In case of error, propagates the error. - - - - -

-


coroutine.yield (···)

- - -

-Suspends the execution of the calling coroutine. -The coroutine cannot be running a C function, -a metamethod, or an iterator. -Any arguments to yield are passed as extra results to resume. - - - - - - - -

5.3 - Modules

- -

-The package library provides basic -facilities for loading and building modules in Lua. -It exports two of its functions directly in the global environment: -require and module. -Everything else is exported in a table package. - - -

-


module (name [, ···])

- - -

-Creates a module. -If there is a table in package.loaded[name], -this table is the module. -Otherwise, if there is a global table t with the given name, -this table is the module. -Otherwise creates a new table t and -sets it as the value of the global name and -the value of package.loaded[name]. -This function also initializes t._NAME with the given name, -t._M with the module (t itself), -and t._PACKAGE with the package name -(the full module name minus last component; see below). -Finally, module sets t as the new environment -of the current function and the new value of package.loaded[name], -so that require returns t. - - -

-If name is a compound name -(that is, one with components separated by dots), -module creates (or reuses, if they already exist) -tables for each component. -For instance, if name is a.b.c, -then module stores the module table in field c of -field b of global a. - - -

-This function can receive optional options after -the module name, -where each option is a function to be applied over the module. - - - - -

-


require (modname)

- - -

-Loads the given module. -The function starts by looking into the package.loaded table -to determine whether modname is already loaded. -If it is, then require returns the value stored -at package.loaded[modname]. -Otherwise, it tries to find a loader for the module. - - -

-To find a loader, -require is guided by the package.loaders array. -By changing this array, -we can change how require looks for a module. -The following explanation is based on the default configuration -for package.loaders. - - -

-First require queries package.preload[modname]. -If it has a value, -this value (which should be a function) is the loader. -Otherwise require searches for a Lua loader using the -path stored in package.path. -If that also fails, it searches for a C loader using the -path stored in package.cpath. -If that also fails, -it tries an all-in-one loader (see package.loaders). - - -

-Once a loader is found, -require calls the loader with a single argument, modname. -If the loader returns any value, -require assigns the returned value to package.loaded[modname]. -If the loader returns no value and -has not assigned any value to package.loaded[modname], -then require assigns true to this entry. -In any case, require returns the -final value of package.loaded[modname]. - - -

-If there is any error loading or running the module, -or if it cannot find any loader for the module, -then require signals an error. - - - - -

-


package.cpath

- - -

-The path used by require to search for a C loader. - - -

-Lua initializes the C path package.cpath in the same way -it initializes the Lua path package.path, -using the environment variable LUA_CPATH -or a default path defined in luaconf.h. - - - - -

- -


package.loaded

- - -

-A table used by require to control which -modules are already loaded. -When you require a module modname and -package.loaded[modname] is not false, -require simply returns the value stored there. - - - - -

-


package.loaders

- - -

-A table used by require to control how to load modules. - - -

-Each entry in this table is a searcher function. -When looking for a module, -require calls each of these searchers in ascending order, -with the module name (the argument given to require) as its -sole parameter. -The function can return another function (the module loader) -or a string explaining why it did not find that module -(or nil if it has nothing to say). -Lua initializes this table with four functions. - - -

-The first searcher simply looks for a loader in the -package.preload table. - - -

-The second searcher looks for a loader as a Lua library, -using the path stored at package.path. -A path is a sequence of templates separated by semicolons. -For each template, -the searcher will change each interrogation -mark in the template by filename, -which is the module name with each dot replaced by a -"directory separator" (such as "/" in Unix); -then it will try to open the resulting file name. -So, for instance, if the Lua path is the string - -

-     "./?.lua;./?.lc;/usr/local/?/init.lua"
-

-the search for a Lua file for module foo -will try to open the files -./foo.lua, ./foo.lc, and -/usr/local/foo/init.lua, in that order. - - -

-The third searcher looks for a loader as a C library, -using the path given by the variable package.cpath. -For instance, -if the C path is the string - -

-     "./?.so;./?.dll;/usr/local/?/init.so"
-

-the searcher for module foo -will try to open the files ./foo.so, ./foo.dll, -and /usr/local/foo/init.so, in that order. -Once it finds a C library, -this searcher first uses a dynamic link facility to link the -application with the library. -Then it tries to find a C function inside the library to -be used as the loader. -The name of this C function is the string "luaopen_" -concatenated with a copy of the module name where each dot -is replaced by an underscore. -Moreover, if the module name has a hyphen, -its prefix up to (and including) the first hyphen is removed. -For instance, if the module name is a.v1-b.c, -the function name will be luaopen_b_c. - - -

-The fourth searcher tries an all-in-one loader. -It searches the C path for a library for -the root name of the given module. -For instance, when requiring a.b.c, -it will search for a C library for a. -If found, it looks into it for an open function for -the submodule; -in our example, that would be luaopen_a_b_c. -With this facility, a package can pack several C submodules -into one single library, -with each submodule keeping its original open function. - - - - -

-


package.loadlib (libname, funcname)

- - -

-Dynamically links the host program with the C library libname. -Inside this library, looks for a function funcname -and returns this function as a C function. -(So, funcname must follow the protocol (see lua_CFunction)). - - -

-This is a low-level function. -It completely bypasses the package and module system. -Unlike require, -it does not perform any path searching and -does not automatically adds extensions. -libname must be the complete file name of the C library, -including if necessary a path and extension. -funcname must be the exact name exported by the C library -(which may depend on the C compiler and linker used). - - -

-This function is not supported by ANSI C. -As such, it is only available on some platforms -(Windows, Linux, Mac OS X, Solaris, BSD, -plus other Unix systems that support the dlfcn standard). - - - - -

-


package.path

- - -

-The path used by require to search for a Lua loader. - - -

-At start-up, Lua initializes this variable with -the value of the environment variable LUA_PATH or -with a default path defined in luaconf.h, -if the environment variable is not defined. -Any ";;" in the value of the environment variable -is replaced by the default path. - - - - -

-


package.preload

- - -

-A table to store loaders for specific modules -(see require). - - - - -

-


package.seeall (module)

- - -

-Sets a metatable for module with -its __index field referring to the global environment, -so that this module inherits values -from the global environment. -To be used as an option to function module. - - - - - - - -

5.4 - String Manipulation

- -

-This library provides generic functions for string manipulation, -such as finding and extracting substrings, and pattern matching. -When indexing a string in Lua, the first character is at position 1 -(not at 0, as in C). -Indices are allowed to be negative and are interpreted as indexing backwards, -from the end of the string. -Thus, the last character is at position -1, and so on. - - -

-The string library provides all its functions inside the table -string. -It also sets a metatable for strings -where the __index field points to the string table. -Therefore, you can use the string functions in object-oriented style. -For instance, string.byte(s, i) -can be written as s:byte(i). - - -

-The string library assumes one-byte character encodings. - - -

-


string.byte (s [, i [, j]])

-Returns the internal numerical codes of the characters s[i], -s[i+1], ···, s[j]. -The default value for i is 1; -the default value for j is i. - - -

-Note that numerical codes are not necessarily portable across platforms. - - - - -

-


string.char (···)

-Receives zero or more integers. -Returns a string with length equal to the number of arguments, -in which each character has the internal numerical code equal -to its corresponding argument. - - -

-Note that numerical codes are not necessarily portable across platforms. - - - - -

-


string.dump (function)

- - -

-Returns a string containing a binary representation of the given function, -so that a later loadstring on this string returns -a copy of the function. -function must be a Lua function without upvalues. - - - - -

-


string.find (s, pattern [, init [, plain]])

-Looks for the first match of -pattern in the string s. -If it finds a match, then find returns the indices of s -where this occurrence starts and ends; -otherwise, it returns nil. -A third, optional numerical argument init specifies -where to start the search; -its default value is 1 and can be negative. -A value of true as a fourth, optional argument plain -turns off the pattern matching facilities, -so the function does a plain "find substring" operation, -with no characters in pattern being considered "magic". -Note that if plain is given, then init must be given as well. - - -

-If the pattern has captures, -then in a successful match -the captured values are also returned, -after the two indices. - - - - -

-


string.format (formatstring, ···)

-Returns a formatted version of its variable number of arguments -following the description given in its first argument (which must be a string). -The format string follows the same rules as the printf family of -standard C functions. -The only differences are that the options/modifiers -*, l, L, n, p, -and h are not supported -and that there is an extra option, q. -The q option formats a string in a form suitable to be safely read -back by the Lua interpreter: -the string is written between double quotes, -and all double quotes, newlines, embedded zeros, -and backslashes in the string -are correctly escaped when written. -For instance, the call - -
-     string.format('%q', 'a string with "quotes" and \n new line')
-

-will produce the string: - -

-     "a string with \"quotes\" and \
-      new line"
-
- -

-The options c, d, E, e, f, -g, G, i, o, u, X, and x all -expect a number as argument, -whereas q and s expect a string. - - -

-This function does not accept string values -containing embedded zeros, -except as arguments to the q option. - - - - -

-


string.gmatch (s, pattern)

-Returns an iterator function that, -each time it is called, -returns the next captures from pattern over string s. -If pattern specifies no captures, -then the whole match is produced in each call. - - -

-As an example, the following loop - -

-     s = "hello world from Lua"
-     for w in string.gmatch(s, "%a+") do
-       print(w)
-     end
-

-will iterate over all the words from string s, -printing one per line. -The next example collects all pairs key=value from the -given string into a table: - -

-     t = {}
-     s = "from=world, to=Lua"
-     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
-       t[k] = v
-     end
-
- -

-For this function, a '^' at the start of a pattern does not -work as an anchor, as this would prevent the iteration. - - - - -

-


string.gsub (s, pattern, repl [, n])

-Returns a copy of s -in which all (or the first n, if given) -occurrences of the pattern have been -replaced by a replacement string specified by repl, -which can be a string, a table, or a function. -gsub also returns, as its second value, -the total number of matches that occurred. - - -

-If repl is a string, then its value is used for replacement. -The character % works as an escape character: -any sequence in repl of the form %n, -with n between 1 and 9, -stands for the value of the n-th captured substring (see below). -The sequence %0 stands for the whole match. -The sequence %% stands for a single %. - - -

-If repl is a table, then the table is queried for every match, -using the first capture as the key; -if the pattern specifies no captures, -then the whole match is used as the key. - - -

-If repl is a function, then this function is called every time a -match occurs, with all captured substrings passed as arguments, -in order; -if the pattern specifies no captures, -then the whole match is passed as a sole argument. - - -

-If the value returned by the table query or by the function call -is a string or a number, -then it is used as the replacement string; -otherwise, if it is false or nil, -then there is no replacement -(that is, the original match is kept in the string). - - -

-Here are some examples: - -

-     x = string.gsub("hello world", "(%w+)", "%1 %1")
-     --> x="hello hello world world"
-     
-     x = string.gsub("hello world", "%w+", "%0 %0", 1)
-     --> x="hello hello world"
-     
-     x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
-     --> x="world hello Lua from"
-     
-     x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
-     --> x="home = /home/roberto, user = roberto"
-     
-     x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
-           return loadstring(s)()
-         end)
-     --> x="4+5 = 9"
-     
-     local t = {name="lua", version="5.1"}
-     x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
-     --> x="lua-5.1.tar.gz"
-
- - - -

-


string.len (s)

-Receives a string and returns its length. -The empty string "" has length 0. -Embedded zeros are counted, -so "a\000bc\000" has length 5. - - - - -

-


string.lower (s)

-Receives a string and returns a copy of this string with all -uppercase letters changed to lowercase. -All other characters are left unchanged. -The definition of what an uppercase letter is depends on the current locale. - - - - -

-


string.match (s, pattern [, init])

-Looks for the first match of -pattern in the string s. -If it finds one, then match returns -the captures from the pattern; -otherwise it returns nil. -If pattern specifies no captures, -then the whole match is returned. -A third, optional numerical argument init specifies -where to start the search; -its default value is 1 and can be negative. - - - - -

-


string.rep (s, n)

-Returns a string that is the concatenation of n copies of -the string s. - - - - -

-


string.reverse (s)

-Returns a string that is the string s reversed. - - - - -

-


string.sub (s, i [, j])

-Returns the substring of s that -starts at i and continues until j; -i and j can be negative. -If j is absent, then it is assumed to be equal to -1 -(which is the same as the string length). -In particular, -the call string.sub(s,1,j) returns a prefix of s -with length j, -and string.sub(s, -i) returns a suffix of s -with length i. - - - - -

-


string.upper (s)

-Receives a string and returns a copy of this string with all -lowercase letters changed to uppercase. -All other characters are left unchanged. -The definition of what a lowercase letter is depends on the current locale. - - - -

5.4.1 - Patterns

- - -

Character Class:

-A character class is used to represent a set of characters. -The following combinations are allowed in describing a character class: - -

    - -
  • x: -(where x is not one of the magic characters -^$()%.[]*+-?) -represents the character x itself. -
  • - -
  • .: (a dot) represents all characters.
  • - -
  • %a: represents all letters.
  • - -
  • %c: represents all control characters.
  • - -
  • %d: represents all digits.
  • - -
  • %l: represents all lowercase letters.
  • - -
  • %p: represents all punctuation characters.
  • - -
  • %s: represents all space characters.
  • - -
  • %u: represents all uppercase letters.
  • - -
  • %w: represents all alphanumeric characters.
  • - -
  • %x: represents all hexadecimal digits.
  • - -
  • %z: represents the character with representation 0.
  • - -
  • %x: (where x is any non-alphanumeric character) -represents the character x. -This is the standard way to escape the magic characters. -Any punctuation character (even the non magic) -can be preceded by a '%' -when used to represent itself in a pattern. -
  • - -
  • [set]: -represents the class which is the union of all -characters in set. -A range of characters can be specified by -separating the end characters of the range with a '-'. -All classes %x described above can also be used as -components in set. -All other characters in set represent themselves. -For example, [%w_] (or [_%w]) -represents all alphanumeric characters plus the underscore, -[0-7] represents the octal digits, -and [0-7%l%-] represents the octal digits plus -the lowercase letters plus the '-' character. - - -

    -The interaction between ranges and classes is not defined. -Therefore, patterns like [%a-z] or [a-%%] -have no meaning. -

  • - -
  • [^set]: -represents the complement of set, -where set is interpreted as above. -
  • - -

-For all classes represented by single letters (%a, %c, etc.), -the corresponding uppercase letter represents the complement of the class. -For instance, %S represents all non-space characters. - - -

-The definitions of letter, space, and other character groups -depend on the current locale. -In particular, the class [a-z] may not be equivalent to %l. - - - - - -

Pattern Item:

-A pattern item can be - -

    - -
  • -a single character class, -which matches any single character in the class; -
  • - -
  • -a single character class followed by '*', -which matches 0 or more repetitions of characters in the class. -These repetition items will always match the longest possible sequence; -
  • - -
  • -a single character class followed by '+', -which matches 1 or more repetitions of characters in the class. -These repetition items will always match the longest possible sequence; -
  • - -
  • -a single character class followed by '-', -which also matches 0 or more repetitions of characters in the class. -Unlike '*', -these repetition items will always match the shortest possible sequence; -
  • - -
  • -a single character class followed by '?', -which matches 0 or 1 occurrence of a character in the class; -
  • - -
  • -%n, for n between 1 and 9; -such item matches a substring equal to the n-th captured string -(see below); -
  • - -
  • -%bxy, where x and y are two distinct characters; -such item matches strings that start with x, end with y, -and where the x and y are balanced. -This means that, if one reads the string from left to right, -counting +1 for an x and -1 for a y, -the ending y is the first y where the count reaches 0. -For instance, the item %b() matches expressions with -balanced parentheses. -
  • - -
- - - - -

Pattern:

-A pattern is a sequence of pattern items. -A '^' at the beginning of a pattern anchors the match at the -beginning of the subject string. -A '$' at the end of a pattern anchors the match at the -end of the subject string. -At other positions, -'^' and '$' have no special meaning and represent themselves. - - - - - -

Captures:

-A pattern can contain sub-patterns enclosed in parentheses; -they describe captures. -When a match succeeds, the substrings of the subject string -that match captures are stored (captured) for future use. -Captures are numbered according to their left parentheses. -For instance, in the pattern "(a*(.)%w(%s*))", -the part of the string matching "a*(.)%w(%s*)" is -stored as the first capture (and therefore has number 1); -the character matching "." is captured with number 2, -and the part matching "%s*" has number 3. - - -

-As a special case, the empty capture () captures -the current string position (a number). -For instance, if we apply the pattern "()aa()" on the -string "flaaap", there will be two captures: 3 and 5. - - -

-A pattern cannot contain embedded zeros. Use %z instead. - - - - - - - - - - - -

5.5 - Table Manipulation

-This library provides generic functions for table manipulation. -It provides all its functions inside the table table. - - -

-Most functions in the table library assume that the table -represents an array or a list. -For these functions, when we talk about the "length" of a table -we mean the result of the length operator. - - -

-


table.concat (table [, sep [, i [, j]]])

-Given an array where all elements are strings or numbers, -returns table[i]..sep..table[i+1] ··· sep..table[j]. -The default value for sep is the empty string, -the default for i is 1, -and the default for j is the length of the table. -If i is greater than j, returns the empty string. - - - - -

-


table.insert (table, [pos,] value)

- - -

-Inserts element value at position pos in table, -shifting up other elements to open space, if necessary. -The default value for pos is n+1, -where n is the length of the table (see §2.5.5), -so that a call table.insert(t,x) inserts x at the end -of table t. - - - - -

-


table.maxn (table)

- - -

-Returns the largest positive numerical index of the given table, -or zero if the table has no positive numerical indices. -(To do its job this function does a linear traversal of -the whole table.) - - - - -

-


table.remove (table [, pos])

- - -

-Removes from table the element at position pos, -shifting down other elements to close the space, if necessary. -Returns the value of the removed element. -The default value for pos is n, -where n is the length of the table, -so that a call table.remove(t) removes the last element -of table t. - - - - -

-


table.sort (table [, comp])

-Sorts table elements in a given order, in-place, -from table[1] to table[n], -where n is the length of the table. -If comp is given, -then it must be a function that receives two table elements, -and returns true -when the first is less than the second -(so that not comp(a[i+1],a[i]) will be true after the sort). -If comp is not given, -then the standard Lua operator < is used instead. - - -

-The sort algorithm is not stable; -that is, elements considered equal by the given order -may have their relative positions changed by the sort. - - - - - - - -

5.6 - Mathematical Functions

- -

-This library is an interface to the standard C math library. -It provides all its functions inside the table math. - - -

-


math.abs (x)

- - -

-Returns the absolute value of x. - - - - -

-


math.acos (x)

- - -

-Returns the arc cosine of x (in radians). - - - - -

-


math.asin (x)

- - -

-Returns the arc sine of x (in radians). - - - - -

-


math.atan (x)

- - -

-Returns the arc tangent of x (in radians). - - - - -

-


math.atan2 (y, x)

- - -

-Returns the arc tangent of y/x (in radians), -but uses the signs of both parameters to find the -quadrant of the result. -(It also handles correctly the case of x being zero.) - - - - -

-


math.ceil (x)

- - -

-Returns the smallest integer larger than or equal to x. - - - - -

-


math.cos (x)

- - -

-Returns the cosine of x (assumed to be in radians). - - - - -

-


math.cosh (x)

- - -

-Returns the hyperbolic cosine of x. - - - - -

-


math.deg (x)

- - -

-Returns the angle x (given in radians) in degrees. - - - - -

-


math.exp (x)

- - -

-Returns the value ex. - - - - -

-


math.floor (x)

- - -

-Returns the largest integer smaller than or equal to x. - - - - -

-


math.fmod (x, y)

- - -

-Returns the remainder of the division of x by y -that rounds the quotient towards zero. - - - - -

-


math.frexp (x)

- - -

-Returns m and e such that x = m2e, -e is an integer and the absolute value of m is -in the range [0.5, 1) -(or zero when x is zero). - - - - -

-


math.huge

- - -

-The value HUGE_VAL, -a value larger than or equal to any other numerical value. - - - - -

-


math.ldexp (m, e)

- - -

-Returns m2e (e should be an integer). - - - - -

-


math.log (x)

- - -

-Returns the natural logarithm of x. - - - - -

-


math.log10 (x)

- - -

-Returns the base-10 logarithm of x. - - - - -

-


math.max (x, ···)

- - -

-Returns the maximum value among its arguments. - - - - -

-


math.min (x, ···)

- - -

-Returns the minimum value among its arguments. - - - - -

-


math.modf (x)

- - -

-Returns two numbers, -the integral part of x and the fractional part of x. - - - - -

-


math.pi

- - -

-The value of pi. - - - - -

-


math.pow (x, y)

- - -

-Returns xy. -(You can also use the expression x^y to compute this value.) - - - - -

-


math.rad (x)

- - -

-Returns the angle x (given in degrees) in radians. - - - - -

-


math.random ([m [, n]])

- - -

-This function is an interface to the simple -pseudo-random generator function rand provided by ANSI C. -(No guarantees can be given for its statistical properties.) - - -

-When called without arguments, -returns a uniform pseudo-random real number -in the range [0,1). -When called with an integer number m, -math.random returns -a uniform pseudo-random integer in the range [1, m]. -When called with two integer numbers m and n, -math.random returns a uniform pseudo-random -integer in the range [m, n]. - - - - -

-


math.randomseed (x)

- - -

-Sets x as the "seed" -for the pseudo-random generator: -equal seeds produce equal sequences of numbers. - - - - -

-


math.sin (x)

- - -

-Returns the sine of x (assumed to be in radians). - - - - -

-


math.sinh (x)

- - -

-Returns the hyperbolic sine of x. - - - - -

-


math.sqrt (x)

- - -

-Returns the square root of x. -(You can also use the expression x^0.5 to compute this value.) - - - - -

-


math.tan (x)

- - -

-Returns the tangent of x (assumed to be in radians). - - - - -

-


math.tanh (x)

- - -

-Returns the hyperbolic tangent of x. - - - - - - - -

5.7 - Input and Output Facilities

- -

-The I/O library provides two different styles for file manipulation. -The first one uses implicit file descriptors; -that is, there are operations to set a default input file and a -default output file, -and all input/output operations are over these default files. -The second style uses explicit file descriptors. - - -

-When using implicit file descriptors, -all operations are supplied by table io. -When using explicit file descriptors, -the operation io.open returns a file descriptor -and then all operations are supplied as methods of the file descriptor. - - -

-The table io also provides -three predefined file descriptors with their usual meanings from C: -io.stdin, io.stdout, and io.stderr. -The I/O library never closes these files. - - -

-Unless otherwise stated, -all I/O functions return nil on failure -(plus an error message as a second result and -a system-dependent error code as a third result) -and some value different from nil on success. - - -

-


io.close ([file])

- - -

-Equivalent to file:close(). -Without a file, closes the default output file. - - - - -

-


io.flush ()

- - -

-Equivalent to file:flush over the default output file. - - - - -

-


io.input ([file])

- - -

-When called with a file name, it opens the named file (in text mode), -and sets its handle as the default input file. -When called with a file handle, -it simply sets this file handle as the default input file. -When called without parameters, -it returns the current default input file. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


io.lines ([filename])

- - -

-Opens the given file name in read mode -and returns an iterator function that, -each time it is called, -returns a new line from the file. -Therefore, the construction - -

-     for line in io.lines(filename) do body end
-

-will iterate over all lines of the file. -When the iterator function detects the end of file, -it returns nil (to finish the loop) and automatically closes the file. - - -

-The call io.lines() (with no file name) is equivalent -to io.input():lines(); -that is, it iterates over the lines of the default input file. -In this case it does not close the file when the loop ends. - - - - -

-


io.open (filename [, mode])

- - -

-This function opens a file, -in the mode specified in the string mode. -It returns a new file handle, -or, in case of errors, nil plus an error message. - - -

-The mode string can be any of the following: - -

    -
  • "r": read mode (the default);
  • -
  • "w": write mode;
  • -
  • "a": append mode;
  • -
  • "r+": update mode, all previous data is preserved;
  • -
  • "w+": update mode, all previous data is erased;
  • -
  • "a+": append update mode, previous data is preserved, - writing is only allowed at the end of file.
  • -

-The mode string can also have a 'b' at the end, -which is needed in some systems to open the file in binary mode. -This string is exactly what is used in the -standard C function fopen. - - - - -

-


io.output ([file])

- - -

-Similar to io.input, but operates over the default output file. - - - - -

-


io.popen (prog [, mode])

- - -

-Starts program prog in a separated process and returns -a file handle that you can use to read data from this program -(if mode is "r", the default) -or to write data to this program -(if mode is "w"). - - -

-This function is system dependent and is not available -on all platforms. - - - - -

-


io.read (···)

- - -

-Equivalent to io.input():read. - - - - -

-


io.tmpfile ()

- - -

-Returns a handle for a temporary file. -This file is opened in update mode -and it is automatically removed when the program ends. - - - - -

-


io.type (obj)

- - -

-Checks whether obj is a valid file handle. -Returns the string "file" if obj is an open file handle, -"closed file" if obj is a closed file handle, -or nil if obj is not a file handle. - - - - -

-


io.write (···)

- - -

-Equivalent to io.output():write. - - - - -

-


file:close ()

- - -

-Closes file. -Note that files are automatically closed when -their handles are garbage collected, -but that takes an unpredictable amount of time to happen. - - - - -

-


file:flush ()

- - -

-Saves any written data to file. - - - - -

-


file:lines ()

- - -

-Returns an iterator function that, -each time it is called, -returns a new line from the file. -Therefore, the construction - -

-     for line in file:lines() do body end
-

-will iterate over all lines of the file. -(Unlike io.lines, this function does not close the file -when the loop ends.) - - - - -

-


file:read (···)

- - -

-Reads the file file, -according to the given formats, which specify what to read. -For each format, -the function returns a string (or a number) with the characters read, -or nil if it cannot read data with the specified format. -When called without formats, -it uses a default format that reads the entire next line -(see below). - - -

-The available formats are - -

    - -
  • "*n": -reads a number; -this is the only format that returns a number instead of a string. -
  • - -
  • "*a": -reads the whole file, starting at the current position. -On end of file, it returns the empty string. -
  • - -
  • "*l": -reads the next line (skipping the end of line), -returning nil on end of file. -This is the default format. -
  • - -
  • number: -reads a string with up to this number of characters, -returning nil on end of file. -If number is zero, -it reads nothing and returns an empty string, -or nil on end of file. -
  • - -
- - - -

-


file:seek ([whence] [, offset])

- - -

-Sets and gets the file position, -measured from the beginning of the file, -to the position given by offset plus a base -specified by the string whence, as follows: - -

    -
  • "set": base is position 0 (beginning of the file);
  • -
  • "cur": base is current position;
  • -
  • "end": base is end of file;
  • -

-In case of success, function seek returns the final file position, -measured in bytes from the beginning of the file. -If this function fails, it returns nil, -plus a string describing the error. - - -

-The default value for whence is "cur", -and for offset is 0. -Therefore, the call file:seek() returns the current -file position, without changing it; -the call file:seek("set") sets the position to the -beginning of the file (and returns 0); -and the call file:seek("end") sets the position to the -end of the file, and returns its size. - - - - -

-


file:setvbuf (mode [, size])

- - -

-Sets the buffering mode for an output file. -There are three available modes: - -

    - -
  • "no": -no buffering; the result of any output operation appears immediately. -
  • - -
  • "full": -full buffering; output operation is performed only -when the buffer is full (or when you explicitly flush the file -(see io.flush)). -
  • - -
  • "line": -line buffering; output is buffered until a newline is output -or there is any input from some special files -(such as a terminal device). -
  • - -

-For the last two cases, size -specifies the size of the buffer, in bytes. -The default is an appropriate size. - - - - -

-


file:write (···)

- - -

-Writes the value of each of its arguments to -the file. -The arguments must be strings or numbers. -To write other values, -use tostring or string.format before write. - - - - - - - -

5.8 - Operating System Facilities

- -

-This library is implemented through table os. - - -

-


os.clock ()

- - -

-Returns an approximation of the amount in seconds of CPU time -used by the program. - - - - -

-


os.date ([format [, time]])

- - -

-Returns a string or a table containing date and time, -formatted according to the given string format. - - -

-If the time argument is present, -this is the time to be formatted -(see the os.time function for a description of this value). -Otherwise, date formats the current time. - - -

-If format starts with '!', -then the date is formatted in Coordinated Universal Time. -After this optional character, -if format is the string "*t", -then date returns a table with the following fields: -year (four digits), month (1--12), day (1--31), -hour (0--23), min (0--59), sec (0--61), -wday (weekday, Sunday is 1), -yday (day of the year), -and isdst (daylight saving flag, a boolean). - - -

-If format is not "*t", -then date returns the date as a string, -formatted according to the same rules as the C function strftime. - - -

-When called without arguments, -date returns a reasonable date and time representation that depends on -the host system and on the current locale -(that is, os.date() is equivalent to os.date("%c")). - - - - -

-


os.difftime (t2, t1)

- - -

-Returns the number of seconds from time t1 to time t2. -In POSIX, Windows, and some other systems, -this value is exactly t2-t1. - - - - -

-


os.execute ([command])

- - -

-This function is equivalent to the C function system. -It passes command to be executed by an operating system shell. -It returns a status code, which is system-dependent. -If command is absent, then it returns nonzero if a shell is available -and zero otherwise. - - - - -

-


os.exit ([code])

- - -

-Calls the C function exit, -with an optional code, -to terminate the host program. -The default value for code is the success code. - - - - -

-


os.getenv (varname)

- - -

-Returns the value of the process environment variable varname, -or nil if the variable is not defined. - - - - -

-


os.remove (filename)

- - -

-Deletes the file or directory with the given name. -Directories must be empty to be removed. -If this function fails, it returns nil, -plus a string describing the error. - - - - -

-


os.rename (oldname, newname)

- - -

-Renames file or directory named oldname to newname. -If this function fails, it returns nil, -plus a string describing the error. - - - - -

-


os.setlocale (locale [, category])

- - -

-Sets the current locale of the program. -locale is a string specifying a locale; -category is an optional string describing which category to change: -"all", "collate", "ctype", -"monetary", "numeric", or "time"; -the default category is "all". -The function returns the name of the new locale, -or nil if the request cannot be honored. - - -

-If locale is the empty string, -the current locale is set to an implementation-defined native locale. -If locale is the string "C", -the current locale is set to the standard C locale. - - -

-When called with nil as the first argument, -this function only returns the name of the current locale -for the given category. - - - - -

-


os.time ([table])

- - -

-Returns the current time when called without arguments, -or a time representing the date and time specified by the given table. -This table must have fields year, month, and day, -and may have fields hour, min, sec, and isdst -(for a description of these fields, see the os.date function). - - -

-The returned value is a number, whose meaning depends on your system. -In POSIX, Windows, and some other systems, this number counts the number -of seconds since some given start time (the "epoch"). -In other systems, the meaning is not specified, -and the number returned by time can be used only as an argument to -date and difftime. - - - - -

-


os.tmpname ()

- - -

-Returns a string with a file name that can -be used for a temporary file. -The file must be explicitly opened before its use -and explicitly removed when no longer needed. - - -

-On some systems (POSIX), -this function also creates a file with that name, -to avoid security risks. -(Someone else might create the file with wrong permissions -in the time between getting the name and creating the file.) -You still have to open the file to use it -and to remove it (even if you do not use it). - - -

-When possible, -you may prefer to use io.tmpfile, -which automatically removes the file when the program ends. - - - - - - - -

5.9 - The Debug Library

- -

-This library provides -the functionality of the debug interface to Lua programs. -You should exert care when using this library. -The functions provided here should be used exclusively for debugging -and similar tasks, such as profiling. -Please resist the temptation to use them as a -usual programming tool: -they can be very slow. -Moreover, several of these functions -violate some assumptions about Lua code -(e.g., that variables local to a function -cannot be accessed from outside or -that userdata metatables cannot be changed by Lua code) -and therefore can compromise otherwise secure code. - - -

-All functions in this library are provided -inside the debug table. -All functions that operate over a thread -have an optional first argument which is the -thread to operate over. -The default is always the current thread. - - -

-


debug.debug ()

- - -

-Enters an interactive mode with the user, -running each string that the user enters. -Using simple commands and other debug facilities, -the user can inspect global and local variables, -change their values, evaluate expressions, and so on. -A line containing only the word cont finishes this function, -so that the caller continues its execution. - - -

-Note that commands for debug.debug are not lexically nested -within any function, and so have no direct access to local variables. - - - - -

-


debug.getfenv (o)

-Returns the environment of object o. - - - - -

-


debug.gethook ([thread])

- - -

-Returns the current hook settings of the thread, as three values: -the current hook function, the current hook mask, -and the current hook count -(as set by the debug.sethook function). - - - - -

-


debug.getinfo ([thread,] function [, what])

- - -

-Returns a table with information about a function. -You can give the function directly, -or you can give a number as the value of function, -which means the function running at level function of the call stack -of the given thread: -level 0 is the current function (getinfo itself); -level 1 is the function that called getinfo; -and so on. -If function is a number larger than the number of active functions, -then getinfo returns nil. - - -

-The returned table can contain all the fields returned by lua_getinfo, -with the string what describing which fields to fill in. -The default for what is to get all information available, -except the table of valid lines. -If present, -the option 'f' -adds a field named func with the function itself. -If present, -the option 'L' -adds a field named activelines with the table of -valid lines. - - -

-For instance, the expression debug.getinfo(1,"n").name returns -a table with a name for the current function, -if a reasonable name can be found, -and the expression debug.getinfo(print) -returns a table with all available information -about the print function. - - - - -

-


debug.getlocal ([thread,] level, local)

- - -

-This function returns the name and the value of the local variable -with index local of the function at level level of the stack. -(The first parameter or local variable has index 1, and so on, -until the last active local variable.) -The function returns nil if there is no local -variable with the given index, -and raises an error when called with a level out of range. -(You can call debug.getinfo to check whether the level is valid.) - - -

-Variable names starting with '(' (open parentheses) -represent internal variables -(loop control variables, temporaries, and C function locals). - - - - -

-


debug.getmetatable (object)

- - -

-Returns the metatable of the given object -or nil if it does not have a metatable. - - - - -

-


debug.getregistry ()

- - -

-Returns the registry table (see §3.5). - - - - -

-


debug.getupvalue (func, up)

- - -

-This function returns the name and the value of the upvalue -with index up of the function func. -The function returns nil if there is no upvalue with the given index. - - - - -

-


debug.setfenv (object, table)

- - -

-Sets the environment of the given object to the given table. -Returns object. - - - - -

-


debug.sethook ([thread,] hook, mask [, count])

- - -

-Sets the given function as a hook. -The string mask and the number count describe -when the hook will be called. -The string mask may have the following characters, -with the given meaning: - -

    -
  • "c": the hook is called every time Lua calls a function;
  • -
  • "r": the hook is called every time Lua returns from a function;
  • -
  • "l": the hook is called every time Lua enters a new line of code.
  • -

-With a count different from zero, -the hook is called after every count instructions. - - -

-When called without arguments, -debug.sethook turns off the hook. - - -

-When the hook is called, its first parameter is a string -describing the event that has triggered its call: -"call", "return" (or "tail return", -when simulating a return from a tail call), -"line", and "count". -For line events, -the hook also gets the new line number as its second parameter. -Inside a hook, -you can call getinfo with level 2 to get more information about -the running function -(level 0 is the getinfo function, -and level 1 is the hook function), -unless the event is "tail return". -In this case, Lua is only simulating the return, -and a call to getinfo will return invalid data. - - - - -

-


debug.setlocal ([thread,] level, local, value)

- - -

-This function assigns the value value to the local variable -with index local of the function at level level of the stack. -The function returns nil if there is no local -variable with the given index, -and raises an error when called with a level out of range. -(You can call getinfo to check whether the level is valid.) -Otherwise, it returns the name of the local variable. - - - - -

-


debug.setmetatable (object, table)

- - -

-Sets the metatable for the given object to the given table -(which can be nil). - - - - -

-


debug.setupvalue (func, up, value)

- - -

-This function assigns the value value to the upvalue -with index up of the function func. -The function returns nil if there is no upvalue -with the given index. -Otherwise, it returns the name of the upvalue. - - - - -

-


debug.traceback ([thread,] [message [, level]])

- - -

-Returns a string with a traceback of the call stack. -An optional message string is appended -at the beginning of the traceback. -An optional level number tells at which level -to start the traceback -(default is 1, the function calling traceback). - - - - - - - -

6 - Lua Stand-alone

- -

-Although Lua has been designed as an extension language, -to be embedded in a host C program, -it is also frequently used as a stand-alone language. -An interpreter for Lua as a stand-alone language, -called simply lua, -is provided with the standard distribution. -The stand-alone interpreter includes -all standard libraries, including the debug library. -Its usage is: - -

-     lua [options] [script [args]]
-

-The options are: - -

    -
  • -e stat: executes string stat;
  • -
  • -l mod: "requires" mod;
  • -
  • -i: enters interactive mode after running script;
  • -
  • -v: prints version information;
  • -
  • --: stops handling options;
  • -
  • -: executes stdin as a file and stops handling options.
  • -

-After handling its options, lua runs the given script, -passing to it the given args as string arguments. -When called without arguments, -lua behaves as lua -v -i -when the standard input (stdin) is a terminal, -and as lua - otherwise. - - -

-Before running any argument, -the interpreter checks for an environment variable LUA_INIT. -If its format is @filename, -then lua executes the file. -Otherwise, lua executes the string itself. - - -

-All options are handled in order, except -i. -For instance, an invocation like - -

-     $ lua -e'a=1' -e 'print(a)' script.lua
-

-will first set a to 1, then print the value of a (which is '1'), -and finally run the file script.lua with no arguments. -(Here $ is the shell prompt. Your prompt may be different.) - - -

-Before starting to run the script, -lua collects all arguments in the command line -in a global table called arg. -The script name is stored at index 0, -the first argument after the script name goes to index 1, -and so on. -Any arguments before the script name -(that is, the interpreter name plus the options) -go to negative indices. -For instance, in the call - -

-     $ lua -la b.lua t1 t2
-

-the interpreter first runs the file a.lua, -then creates a table - -

-     arg = { [-2] = "lua", [-1] = "-la",
-             [0] = "b.lua",
-             [1] = "t1", [2] = "t2" }
-

-and finally runs the file b.lua. -The script is called with arg[1], arg[2], ··· -as arguments; -it can also access these arguments with the vararg expression '...'. - - -

-In interactive mode, -if you write an incomplete statement, -the interpreter waits for its completion -by issuing a different prompt. - - -

-If the global variable _PROMPT contains a string, -then its value is used as the prompt. -Similarly, if the global variable _PROMPT2 contains a string, -its value is used as the secondary prompt -(issued during incomplete statements). -Therefore, both prompts can be changed directly on the command line -or in any Lua programs by assigning to _PROMPT. -See the next example: - -

-     $ lua -e"_PROMPT='myprompt> '" -i
-

-(The outer pair of quotes is for the shell, -the inner pair is for Lua.) -Note the use of -i to enter interactive mode; -otherwise, -the program would just end silently -right after the assignment to _PROMPT. - - -

-To allow the use of Lua as a -script interpreter in Unix systems, -the stand-alone interpreter skips -the first line of a chunk if it starts with #. -Therefore, Lua scripts can be made into executable programs -by using chmod +x and the #! form, -as in - -

-     #!/usr/local/bin/lua
-

-(Of course, -the location of the Lua interpreter may be different in your machine. -If lua is in your PATH, -then - -

-     #!/usr/bin/env lua
-

-is a more portable solution.) - - - -

7 - Incompatibilities with the Previous Version

- -

-Here we list the incompatibilities that you may find when moving a program -from Lua 5.0 to Lua 5.1. -You can avoid most of the incompatibilities compiling Lua with -appropriate options (see file luaconf.h). -However, -all these compatibility options will be removed in the next version of Lua. - - - -

7.1 - Changes in the Language

-
    - -
  • -The vararg system changed from the pseudo-argument arg with a -table with the extra arguments to the vararg expression. -(See compile-time option LUA_COMPAT_VARARG in luaconf.h.) -
  • - -
  • -There was a subtle change in the scope of the implicit -variables of the for statement and for the repeat statement. -
  • - -
  • -The long string/long comment syntax ([[string]]) -does not allow nesting. -You can use the new syntax ([=[string]=]) in these cases. -(See compile-time option LUA_COMPAT_LSTR in luaconf.h.) -
  • - -
- - - - -

7.2 - Changes in the Libraries

-
    - -
  • -Function string.gfind was renamed string.gmatch. -(See compile-time option LUA_COMPAT_GFIND in luaconf.h.) -
  • - -
  • -When string.gsub is called with a function as its -third argument, -whenever this function returns nil or false the -replacement string is the whole match, -instead of the empty string. -
  • - -
  • -Function table.setn was deprecated. -Function table.getn corresponds -to the new length operator (#); -use the operator instead of the function. -(See compile-time option LUA_COMPAT_GETN in luaconf.h.) -
  • - -
  • -Function loadlib was renamed package.loadlib. -(See compile-time option LUA_COMPAT_LOADLIB in luaconf.h.) -
  • - -
  • -Function math.mod was renamed math.fmod. -(See compile-time option LUA_COMPAT_MOD in luaconf.h.) -
  • - -
  • -Functions table.foreach and table.foreachi are deprecated. -You can use a for loop with pairs or ipairs instead. -
  • - -
  • -There were substantial changes in function require due to -the new module system. -However, the new behavior is mostly compatible with the old, -but require gets the path from package.path instead -of from LUA_PATH. -
  • - -
  • -Function collectgarbage has different arguments. -Function gcinfo is deprecated; -use collectgarbage("count") instead. -
  • - -
- - - - -

7.3 - Changes in the API

-
    - -
  • -The luaopen_* functions (to open libraries) -cannot be called directly, -like a regular C function. -They must be called through Lua, -like a Lua function. -
  • - -
  • -Function lua_open was replaced by lua_newstate to -allow the user to set a memory-allocation function. -You can use luaL_newstate from the standard library to -create a state with a standard allocation function -(based on realloc). -
  • - -
  • -Functions luaL_getn and luaL_setn -(from the auxiliary library) are deprecated. -Use lua_objlen instead of luaL_getn -and nothing instead of luaL_setn. -
  • - -
  • -Function luaL_openlib was replaced by luaL_register. -
  • - -
  • -Function luaL_checkudata now throws an error when the given value -is not a userdata of the expected type. -(In Lua 5.0 it returned NULL.) -
  • - -
- - - - -

8 - The Complete Syntax of Lua

- -

-Here is the complete syntax of Lua in extended BNF. -(It does not describe operator precedences.) - - - - -

-
-	chunk ::= {stat [`;´]} [laststat [`;´]]
-
-	block ::= chunk
-
-	stat ::=  varlist `=´ explist | 
-		 functioncall | 
-		 do block end | 
-		 while exp do block end | 
-		 repeat block until exp | 
-		 if exp then block {elseif exp then block} [else block] end | 
-		 for Name `=´ exp `,´ exp [`,´ exp] do block end | 
-		 for namelist in explist do block end | 
-		 function funcname funcbody | 
-		 local function Name funcbody | 
-		 local namelist [`=´ explist] 
-
-	laststat ::= return [explist] | break
-
-	funcname ::= Name {`.´ Name} [`:´ Name]
-
-	varlist ::= var {`,´ var}
-
-	var ::=  Name | prefixexp `[´ exp `]´ | prefixexp `.´ Name 
-
-	namelist ::= Name {`,´ Name}
-
-	explist ::= {exp `,´} exp
-
-	exp ::=  nil | false | true | Number | String | `...´ | function | 
-		 prefixexp | tableconstructor | exp binop exp | unop exp 
-
-	prefixexp ::= var | functioncall | `(´ exp `)´
-
-	functioncall ::=  prefixexp args | prefixexp `:´ Name args 
-
-	args ::=  `(´ [explist] `)´ | tableconstructor | String 
-
-	function ::= function funcbody
-
-	funcbody ::= `(´ [parlist] `)´ block end
-
-	parlist ::= namelist [`,´ `...´] | `...´
-
-	tableconstructor ::= `{´ [fieldlist] `}´
-
-	fieldlist ::= field {fieldsep field} [fieldsep]
-
-	field ::= `[´ exp `]´ `=´ exp | Name `=´ exp | exp
-
-	fieldsep ::= `,´ | `;´
-
-	binop ::= `+´ | `-´ | `*´ | `/´ | `^´ | `%´ | `..´ | 
-		 `<´ | `<=´ | `>´ | `>=´ | `==´ | `~=´ | 
-		 and | or
-
-	unop ::= `-´ | not | `#´
-
-
- -

- - - - - - - -


- -Last update: -Mon Feb 13 18:54:19 BRST 2012 - - - - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/readme.html b/Sources/backend-cpp/Vendor/lua-5.1.5/doc/readme.html deleted file mode 100644 index 3ed6a818..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/readme.html +++ /dev/null @@ -1,40 +0,0 @@ - - -Lua documentation - - - - - -
-

-Lua -Documentation -

- -This is the documentation included in the source distribution of Lua 5.1.5. - - - -Lua's -official web site -contains updated documentation, -especially the -reference manual. -

- -


- -Last update: -Fri Feb 3 09:44:42 BRST 2012 - - - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/Makefile b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/Makefile deleted file mode 100644 index 6d00008d..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# makefile for Lua etc - -TOP= .. -LIB= $(TOP)/src -INC= $(TOP)/src -BIN= $(TOP)/src -SRC= $(TOP)/src -TST= $(TOP)/test - -CC= gcc -CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) -MYCFLAGS= -MYLDFLAGS= -Wl,-E -MYLIBS= -lm -#MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses -RM= rm -f - -default: - @echo 'Please choose a target: min noparser one strict clean' - -min: min.c - $(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS) - echo 'print"Hello there!"' | ./a.out - -noparser: noparser.o - $(CC) noparser.o $(SRC)/lua.o -L$(LIB) -llua $(MYLIBS) - $(BIN)/luac $(TST)/hello.lua - -./a.out luac.out - -./a.out -e'a=1' - -one: - $(CC) $(CFLAGS) all.c $(MYLIBS) - ./a.out $(TST)/hello.lua - -strict: - -$(BIN)/lua -e 'print(a);b=2' - -$(BIN)/lua -lstrict -e 'print(a)' - -$(BIN)/lua -e 'function f() b=2 end f()' - -$(BIN)/lua -lstrict -e 'function f() b=2 end f()' - -clean: - $(RM) a.out core core.* *.o luac.out - -.PHONY: default min noparser one strict clean diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/README b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/README deleted file mode 100644 index 5149fc91..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/README +++ /dev/null @@ -1,37 +0,0 @@ -This directory contains some useful files and code. -Unlike the code in ../src, everything here is in the public domain. - -If any of the makes fail, you're probably not using the same libraries -used to build Lua. Set MYLIBS in Makefile accordingly. - -all.c - Full Lua interpreter in a single file. - Do "make one" for a demo. - -lua.hpp - Lua header files for C++ using 'extern "C"'. - -lua.ico - A Lua icon for Windows (and web sites: save as favicon.ico). - Drawn by hand by Markus Gritsch . - -lua.pc - pkg-config data for Lua - -luavs.bat - Script to build Lua under "Visual Studio .NET Command Prompt". - Run it from the toplevel as etc\luavs.bat. - -min.c - A minimal Lua interpreter. - Good for learning and for starting your own. - Do "make min" for a demo. - -noparser.c - Linking with noparser.o avoids loading the parsing modules in lualib.a. - Do "make noparser" for a demo. - -strict.lua - Traps uses of undeclared global variables. - Do "make strict" for a demo. - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/all.c b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/all.c deleted file mode 100644 index dab68fac..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/all.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -* all.c -- Lua core, libraries and interpreter in a single file -*/ - -#define luaall_c - -#include "lapi.c" -#include "lcode.c" -#include "ldebug.c" -#include "ldo.c" -#include "ldump.c" -#include "lfunc.c" -#include "lgc.c" -#include "llex.c" -#include "lmem.c" -#include "lobject.c" -#include "lopcodes.c" -#include "lparser.c" -#include "lstate.c" -#include "lstring.c" -#include "ltable.c" -#include "ltm.c" -#include "lundump.c" -#include "lvm.c" -#include "lzio.c" - -#include "lauxlib.c" -#include "lbaselib.c" -#include "ldblib.c" -#include "liolib.c" -#include "linit.c" -#include "lmathlib.c" -#include "loadlib.c" -#include "loslib.c" -#include "lstrlib.c" -#include "ltablib.c" - -#include "lua.c" diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.ico b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.ico deleted file mode 100644 index ccbabc4e..00000000 Binary files a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.ico and /dev/null differ diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.pc b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.pc deleted file mode 100644 index 07e2852b..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.pc +++ /dev/null @@ -1,31 +0,0 @@ -# lua.pc -- pkg-config data for Lua - -# vars from install Makefile - -# grep '^V=' ../Makefile -V= 5.1 -# grep '^R=' ../Makefile -R= 5.1.5 - -# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' -prefix= /usr/local -INSTALL_BIN= ${prefix}/bin -INSTALL_INC= ${prefix}/include -INSTALL_LIB= ${prefix}/lib -INSTALL_MAN= ${prefix}/man/man1 -INSTALL_LMOD= ${prefix}/share/lua/${V} -INSTALL_CMOD= ${prefix}/lib/lua/${V} - -# canonical vars -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Lua -Description: An Extensible Extension Language -Version: ${R} -Requires: -Libs: -L${libdir} -llua -lm -Cflags: -I${includedir} - -# (end of lua.pc) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/luavs.bat b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/luavs.bat deleted file mode 100644 index 054b4625..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/luavs.bat +++ /dev/null @@ -1,28 +0,0 @@ -@rem Script to build Lua under "Visual Studio .NET Command Prompt". -@rem Do not run from this directory; run it from the toplevel: etc\luavs.bat . -@rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src. -@rem (contributed by David Manura and Mike Pall) - -@setlocal -@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE -@set MYLINK=link /nologo -@set MYMT=mt /nologo - -cd src -%MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c -del lua.obj luac.obj -%MYLINK% /DLL /out:lua51.dll l*.obj -if exist lua51.dll.manifest^ - %MYMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2 -%MYCOMPILE% /DLUA_BUILD_AS_DLL lua.c -%MYLINK% /out:lua.exe lua.obj lua51.lib -if exist lua.exe.manifest^ - %MYMT% -manifest lua.exe.manifest -outputresource:lua.exe -%MYCOMPILE% l*.c print.c -del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj^ - loslib.obj ltablib.obj lstrlib.obj loadlib.obj -%MYLINK% /out:luac.exe *.obj -if exist luac.exe.manifest^ - %MYMT% -manifest luac.exe.manifest -outputresource:luac.exe -del *.obj *.manifest -cd .. diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/min.c b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/min.c deleted file mode 100644 index 6a85a4d1..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/min.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -* min.c -- a minimal Lua interpreter -* loads stdin only with minimal error handling. -* no interaction, and no standard library, only a "print" function. -*/ - -#include - -#include "lua.h" -#include "lauxlib.h" - -static int print(lua_State *L) -{ - int n=lua_gettop(L); - int i; - for (i=1; i<=n; i++) - { - if (i>1) printf("\t"); - if (lua_isstring(L,i)) - printf("%s",lua_tostring(L,i)); - else if (lua_isnil(L,i)) - printf("%s","nil"); - else if (lua_isboolean(L,i)) - printf("%s",lua_toboolean(L,i) ? "true" : "false"); - else - printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i)); - } - printf("\n"); - return 0; -} - -int main(void) -{ - lua_State *L=lua_open(); - lua_register(L,"print",print); - if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1)); - lua_close(L); - return 0; -} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/noparser.c b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/noparser.c deleted file mode 100644 index 13ba5462..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/noparser.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -* The code below can be used to make a Lua core that does not contain the -* parsing modules (lcode, llex, lparser), which represent 35% of the total core. -* You'll only be able to load binary files and strings, precompiled with luac. -* (Of course, you'll have to build luac with the original parsing modules!) -* -* To use this module, simply compile it ("make noparser" does that) and list -* its object file before the Lua libraries. The linker should then not load -* the parsing modules. To try it, do "make luab". -* -* If you also want to avoid the dump module (ldump.o), define NODUMP. -* #define NODUMP -*/ - -#define LUA_CORE - -#include "llex.h" -#include "lparser.h" -#include "lzio.h" - -LUAI_FUNC void luaX_init (lua_State *L) { - UNUSED(L); -} - -LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { - UNUSED(z); - UNUSED(buff); - UNUSED(name); - lua_pushliteral(L,"parser not loaded"); - lua_error(L); - return NULL; -} - -#ifdef NODUMP -#include "lundump.h" - -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) { - UNUSED(f); - UNUSED(w); - UNUSED(data); - UNUSED(strip); -#if 1 - UNUSED(L); - return 0; -#else - lua_pushliteral(L,"dumper not loaded"); - lua_error(L); -#endif -} -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/strict.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/etc/strict.lua deleted file mode 100644 index 604619dd..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/strict.lua +++ /dev/null @@ -1,41 +0,0 @@ --- --- strict.lua --- checks uses of undeclared global variables --- All global variables must be 'declared' through a regular assignment --- (even assigning nil will do) in a main chunk before being used --- anywhere or assigned to inside a function. --- - -local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget - -local mt = getmetatable(_G) -if mt == nil then - mt = {} - setmetatable(_G, mt) -end - -mt.__declared = {} - -local function what () - local d = getinfo(3, "S") - return d and d.what or "C" -end - -mt.__newindex = function (t, n, v) - if not mt.__declared[n] then - local w = what() - if w ~= "main" and w ~= "C" then - error("assign to undeclared variable '"..n.."'", 2) - end - mt.__declared[n] = true - end - rawset(t, n, v) -end - -mt.__index = function (t, n) - if not mt.__declared[n] and what() ~= "C" then - error("variable '"..n.."' is not declared", 2) - end - return rawget(t, n) -end - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/Makefile b/Sources/backend-cpp/Vendor/lua-5.1.5/src/Makefile deleted file mode 100644 index e0d4c9fa..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/Makefile +++ /dev/null @@ -1,182 +0,0 @@ -# makefile for building Lua -# see ../INSTALL for installation instructions -# see ../Makefile and luaconf.h for further customization - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -CC= gcc -CFLAGS= -O2 -Wall $(MYCFLAGS) -AR= ar rcu -RANLIB= ranlib -RM= rm -f -LIBS= -lm $(MYLIBS) - -MYCFLAGS= -MYLDFLAGS= -MYLIBS= - -# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= - -PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - -LUA_A= liblua.a -CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ - lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ - lundump.o lvm.o lzio.o -LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ - lstrlib.o loadlib.o linit.o - -LUA_T= lua -LUA_O= lua.o - -LUAC_T= luac -LUAC_O= luac.o print.o - -ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -ALL_A= $(LUA_A) - -default: $(PLAT) - -all: $(ALL_T) - -o: $(ALL_O) - -a: $(ALL_A) - -$(LUA_A): $(CORE_O) $(LIB_O) - $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files - $(RANLIB) $@ - -$(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -$(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - -clean: - $(RM) $(ALL_T) $(ALL_O) - -depend: - @$(CC) $(CFLAGS) -MM l*.c print.c - -echo: - @echo "PLAT = $(PLAT)" - @echo "CC = $(CC)" - @echo "CFLAGS = $(CFLAGS)" - @echo "AR = $(AR)" - @echo "RANLIB = $(RANLIB)" - @echo "RM = $(RM)" - @echo "MYCFLAGS = $(MYCFLAGS)" - @echo "MYLDFLAGS = $(MYLDFLAGS)" - @echo "MYLIBS = $(MYLIBS)" - -# convenience targets for popular platforms - -none: - @echo "Please choose a platform:" - @echo " $(PLATS)" - -aix: - $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" - -ansi: - $(MAKE) all MYCFLAGS=-DLUA_ANSI - -bsd: - $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" - -freebsd: - $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" - -generic: - $(MAKE) all MYCFLAGS= - -linux: - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" - -macosx: - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" -# use this on Mac OS X 10.3- -# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX - -mingw: - $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ - "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe - $(MAKE) "LUAC_T=luac.exe" luac.exe - -posix: - $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX - -solaris: - $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) default o a clean depend echo none - -# DO NOT DELETE - -lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ - lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ - lundump.h lvm.h -lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h -lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h -lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ - lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ - ltable.h -ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h -ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ - llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ - lfunc.h lstring.h lgc.h ltable.h lvm.h -ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ - ltable.h lundump.h lvm.h -ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ - lzio.h lmem.h lundump.h -lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \ - lstate.h ltm.h lzio.h -lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h -linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h -liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h -llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ - lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h -lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h -lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h -loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h -lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \ - ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h -lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h -loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h -lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ - lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ - lfunc.h lstring.h lgc.h ltable.h -lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h -lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ - ltm.h lzio.h lstring.h lgc.h -lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h -ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h -ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h -ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ - lmem.h lstring.h lgc.h ltable.h -lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h -luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \ - lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \ - lundump.h -lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h -lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h -lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ - lzio.h -print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h lopcodes.h lundump.h - -# (end of Makefile) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lapi.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lapi.c deleted file mode 100644 index 5d5145d2..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lapi.c +++ /dev/null @@ -1,1087 +0,0 @@ -/* -** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ -** Lua API -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include -#include - -#define lapi_c -#define LUA_CORE - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" - - - -const char lua_ident[] = - "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" - "$Authors: " LUA_AUTHORS " $\n" - "$URL: www.lua.org $\n"; - - - -#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) - -#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) - -#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} - - - -static TValue *index2adr (lua_State *L, int idx) { - if (idx > 0) { - TValue *o = L->base + (idx - 1); - api_check(L, idx <= L->ci->top - L->base); - if (o >= L->top) return cast(TValue *, luaO_nilobject); - else return o; - } - else if (idx > LUA_REGISTRYINDEX) { - api_check(L, idx != 0 && -idx <= L->top - L->base); - return L->top + idx; - } - else switch (idx) { /* pseudo-indices */ - case LUA_REGISTRYINDEX: return registry(L); - case LUA_ENVIRONINDEX: { - Closure *func = curr_func(L); - sethvalue(L, &L->env, func->c.env); - return &L->env; - } - case LUA_GLOBALSINDEX: return gt(L); - default: { - Closure *func = curr_func(L); - idx = LUA_GLOBALSINDEX - idx; - return (idx <= func->c.nupvalues) - ? &func->c.upvalue[idx-1] - : cast(TValue *, luaO_nilobject); - } - } -} - - -static Table *getcurrenv (lua_State *L) { - if (L->ci == L->base_ci) /* no enclosing function? */ - return hvalue(gt(L)); /* use global table as environment */ - else { - Closure *func = curr_func(L); - return func->c.env; - } -} - - -void luaA_pushobject (lua_State *L, const TValue *o) { - setobj2s(L, L->top, o); - api_incr_top(L); -} - - -LUA_API int lua_checkstack (lua_State *L, int size) { - int res = 1; - lua_lock(L); - if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) - res = 0; /* stack overflow */ - else if (size > 0) { - luaD_checkstack(L, size); - if (L->ci->top < L->top + size) - L->ci->top = L->top + size; - } - lua_unlock(L); - return res; -} - - -LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { - int i; - if (from == to) return; - lua_lock(to); - api_checknelems(from, n); - api_check(from, G(from) == G(to)); - api_check(from, to->ci->top - to->top >= n); - from->top -= n; - for (i = 0; i < n; i++) { - setobj2s(to, to->top++, from->top + i); - } - lua_unlock(to); -} - - -LUA_API void lua_setlevel (lua_State *from, lua_State *to) { - to->nCcalls = from->nCcalls; -} - - -LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { - lua_CFunction old; - lua_lock(L); - old = G(L)->panic; - G(L)->panic = panicf; - lua_unlock(L); - return old; -} - - -LUA_API lua_State *lua_newthread (lua_State *L) { - lua_State *L1; - lua_lock(L); - luaC_checkGC(L); - L1 = luaE_newthread(L); - setthvalue(L, L->top, L1); - api_incr_top(L); - lua_unlock(L); - luai_userstatethread(L, L1); - return L1; -} - - - -/* -** basic stack manipulation -*/ - - -LUA_API int lua_gettop (lua_State *L) { - return cast_int(L->top - L->base); -} - - -LUA_API void lua_settop (lua_State *L, int idx) { - lua_lock(L); - if (idx >= 0) { - api_check(L, idx <= L->stack_last - L->base); - while (L->top < L->base + idx) - setnilvalue(L->top++); - L->top = L->base + idx; - } - else { - api_check(L, -(idx+1) <= (L->top - L->base)); - L->top += idx+1; /* `subtract' index (index is negative) */ - } - lua_unlock(L); -} - - -LUA_API void lua_remove (lua_State *L, int idx) { - StkId p; - lua_lock(L); - p = index2adr(L, idx); - api_checkvalidindex(L, p); - while (++p < L->top) setobjs2s(L, p-1, p); - L->top--; - lua_unlock(L); -} - - -LUA_API void lua_insert (lua_State *L, int idx) { - StkId p; - StkId q; - lua_lock(L); - p = index2adr(L, idx); - api_checkvalidindex(L, p); - for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); - setobjs2s(L, p, L->top); - lua_unlock(L); -} - - -LUA_API void lua_replace (lua_State *L, int idx) { - StkId o; - lua_lock(L); - /* explicit test for incompatible code */ - if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) - luaG_runerror(L, "no calling environment"); - api_checknelems(L, 1); - o = index2adr(L, idx); - api_checkvalidindex(L, o); - if (idx == LUA_ENVIRONINDEX) { - Closure *func = curr_func(L); - api_check(L, ttistable(L->top - 1)); - func->c.env = hvalue(L->top - 1); - luaC_barrier(L, func, L->top - 1); - } - else { - setobj(L, o, L->top - 1); - if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ - luaC_barrier(L, curr_func(L), L->top - 1); - } - L->top--; - lua_unlock(L); -} - - -LUA_API void lua_pushvalue (lua_State *L, int idx) { - lua_lock(L); - setobj2s(L, L->top, index2adr(L, idx)); - api_incr_top(L); - lua_unlock(L); -} - - - -/* -** access functions (stack -> C) -*/ - - -LUA_API int lua_type (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); -} - - -LUA_API const char *lua_typename (lua_State *L, int t) { - UNUSED(L); - return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; -} - - -LUA_API int lua_iscfunction (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - return iscfunction(o); -} - - -LUA_API int lua_isnumber (lua_State *L, int idx) { - TValue n; - const TValue *o = index2adr(L, idx); - return tonumber(o, &n); -} - - -LUA_API int lua_isstring (lua_State *L, int idx) { - int t = lua_type(L, idx); - return (t == LUA_TSTRING || t == LUA_TNUMBER); -} - - -LUA_API int lua_isuserdata (lua_State *L, int idx) { - const TValue *o = index2adr(L, idx); - return (ttisuserdata(o) || ttislightuserdata(o)); -} - - -LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { - StkId o1 = index2adr(L, index1); - StkId o2 = index2adr(L, index2); - return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 - : luaO_rawequalObj(o1, o2); -} - - -LUA_API int lua_equal (lua_State *L, int index1, int index2) { - StkId o1, o2; - int i; - lua_lock(L); /* may call tag method */ - o1 = index2adr(L, index1); - o2 = index2adr(L, index2); - i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); - lua_unlock(L); - return i; -} - - -LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { - StkId o1, o2; - int i; - lua_lock(L); /* may call tag method */ - o1 = index2adr(L, index1); - o2 = index2adr(L, index2); - i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 - : luaV_lessthan(L, o1, o2); - lua_unlock(L); - return i; -} - - - -LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { - TValue n; - const TValue *o = index2adr(L, idx); - if (tonumber(o, &n)) - return nvalue(o); - else - return 0; -} - - -LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { - TValue n; - const TValue *o = index2adr(L, idx); - if (tonumber(o, &n)) { - lua_Integer res; - lua_Number num = nvalue(o); - lua_number2integer(res, num); - return res; - } - else - return 0; -} - - -LUA_API int lua_toboolean (lua_State *L, int idx) { - const TValue *o = index2adr(L, idx); - return !l_isfalse(o); -} - - -LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { - StkId o = index2adr(L, idx); - if (!ttisstring(o)) { - lua_lock(L); /* `luaV_tostring' may create a new string */ - if (!luaV_tostring(L, o)) { /* conversion failed? */ - if (len != NULL) *len = 0; - lua_unlock(L); - return NULL; - } - luaC_checkGC(L); - o = index2adr(L, idx); /* previous call may reallocate the stack */ - lua_unlock(L); - } - if (len != NULL) *len = tsvalue(o)->len; - return svalue(o); -} - - -LUA_API size_t lua_objlen (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - switch (ttype(o)) { - case LUA_TSTRING: return tsvalue(o)->len; - case LUA_TUSERDATA: return uvalue(o)->len; - case LUA_TTABLE: return luaH_getn(hvalue(o)); - case LUA_TNUMBER: { - size_t l; - lua_lock(L); /* `luaV_tostring' may create a new string */ - l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); - lua_unlock(L); - return l; - } - default: return 0; - } -} - - -LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; -} - - -LUA_API void *lua_touserdata (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - switch (ttype(o)) { - case LUA_TUSERDATA: return (rawuvalue(o) + 1); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - -LUA_API lua_State *lua_tothread (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - return (!ttisthread(o)) ? NULL : thvalue(o); -} - - -LUA_API const void *lua_topointer (lua_State *L, int idx) { - StkId o = index2adr(L, idx); - switch (ttype(o)) { - case LUA_TTABLE: return hvalue(o); - case LUA_TFUNCTION: return clvalue(o); - case LUA_TTHREAD: return thvalue(o); - case LUA_TUSERDATA: - case LUA_TLIGHTUSERDATA: - return lua_touserdata(L, idx); - default: return NULL; - } -} - - - -/* -** push functions (C -> stack) -*/ - - -LUA_API void lua_pushnil (lua_State *L) { - lua_lock(L); - setnilvalue(L->top); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { - lua_lock(L); - setnvalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { - lua_lock(L); - setnvalue(L->top, cast_num(n)); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { - lua_lock(L); - luaC_checkGC(L); - setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushstring (lua_State *L, const char *s) { - if (s == NULL) - lua_pushnil(L); - else - lua_pushlstring(L, s, strlen(s)); -} - - -LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, - va_list argp) { - const char *ret; - lua_lock(L); - luaC_checkGC(L); - ret = luaO_pushvfstring(L, fmt, argp); - lua_unlock(L); - return ret; -} - - -LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { - const char *ret; - va_list argp; - lua_lock(L); - luaC_checkGC(L); - va_start(argp, fmt); - ret = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - lua_unlock(L); - return ret; -} - - -LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { - Closure *cl; - lua_lock(L); - luaC_checkGC(L); - api_checknelems(L, n); - cl = luaF_newCclosure(L, n, getcurrenv(L)); - cl->c.f = fn; - L->top -= n; - while (n--) - setobj2n(L, &cl->c.upvalue[n], L->top+n); - setclvalue(L, L->top, cl); - lua_assert(iswhite(obj2gco(cl))); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushboolean (lua_State *L, int b) { - lua_lock(L); - setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { - lua_lock(L); - setpvalue(L->top, p); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API int lua_pushthread (lua_State *L) { - lua_lock(L); - setthvalue(L, L->top, L); - api_incr_top(L); - lua_unlock(L); - return (G(L)->mainthread == L); -} - - - -/* -** get functions (Lua -> stack) -*/ - - -LUA_API void lua_gettable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2adr(L, idx); - api_checkvalidindex(L, t); - luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); -} - - -LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { - StkId t; - TValue key; - lua_lock(L); - t = index2adr(L, idx); - api_checkvalidindex(L, t); - setsvalue(L, &key, luaS_new(L, k)); - luaV_gettable(L, t, &key, L->top); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_rawget (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2adr(L, idx); - api_check(L, ttistable(t)); - setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); - lua_unlock(L); -} - - -LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { - StkId o; - lua_lock(L); - o = index2adr(L, idx); - api_check(L, ttistable(o)); - setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { - lua_lock(L); - luaC_checkGC(L); - sethvalue(L, L->top, luaH_new(L, narray, nrec)); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API int lua_getmetatable (lua_State *L, int objindex) { - const TValue *obj; - Table *mt = NULL; - int res; - lua_lock(L); - obj = index2adr(L, objindex); - switch (ttype(obj)) { - case LUA_TTABLE: - mt = hvalue(obj)->metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(obj)->metatable; - break; - default: - mt = G(L)->mt[ttype(obj)]; - break; - } - if (mt == NULL) - res = 0; - else { - sethvalue(L, L->top, mt); - api_incr_top(L); - res = 1; - } - lua_unlock(L); - return res; -} - - -LUA_API void lua_getfenv (lua_State *L, int idx) { - StkId o; - lua_lock(L); - o = index2adr(L, idx); - api_checkvalidindex(L, o); - switch (ttype(o)) { - case LUA_TFUNCTION: - sethvalue(L, L->top, clvalue(o)->c.env); - break; - case LUA_TUSERDATA: - sethvalue(L, L->top, uvalue(o)->env); - break; - case LUA_TTHREAD: - setobj2s(L, L->top, gt(thvalue(o))); - break; - default: - setnilvalue(L->top); - break; - } - api_incr_top(L); - lua_unlock(L); -} - - -/* -** set functions (stack -> Lua) -*/ - - -LUA_API void lua_settable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - api_checknelems(L, 2); - t = index2adr(L, idx); - api_checkvalidindex(L, t); - luaV_settable(L, t, L->top - 2, L->top - 1); - L->top -= 2; /* pop index and value */ - lua_unlock(L); -} - - -LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { - StkId t; - TValue key; - lua_lock(L); - api_checknelems(L, 1); - t = index2adr(L, idx); - api_checkvalidindex(L, t); - setsvalue(L, &key, luaS_new(L, k)); - luaV_settable(L, t, &key, L->top - 1); - L->top--; /* pop value */ - lua_unlock(L); -} - - -LUA_API void lua_rawset (lua_State *L, int idx) { - StkId t; - lua_lock(L); - api_checknelems(L, 2); - t = index2adr(L, idx); - api_check(L, ttistable(t)); - setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); - luaC_barriert(L, hvalue(t), L->top-1); - L->top -= 2; - lua_unlock(L); -} - - -LUA_API void lua_rawseti (lua_State *L, int idx, int n) { - StkId o; - lua_lock(L); - api_checknelems(L, 1); - o = index2adr(L, idx); - api_check(L, ttistable(o)); - setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); - luaC_barriert(L, hvalue(o), L->top-1); - L->top--; - lua_unlock(L); -} - - -LUA_API int lua_setmetatable (lua_State *L, int objindex) { - TValue *obj; - Table *mt; - lua_lock(L); - api_checknelems(L, 1); - obj = index2adr(L, objindex); - api_checkvalidindex(L, obj); - if (ttisnil(L->top - 1)) - mt = NULL; - else { - api_check(L, ttistable(L->top - 1)); - mt = hvalue(L->top - 1); - } - switch (ttype(obj)) { - case LUA_TTABLE: { - hvalue(obj)->metatable = mt; - if (mt) - luaC_objbarriert(L, hvalue(obj), mt); - break; - } - case LUA_TUSERDATA: { - uvalue(obj)->metatable = mt; - if (mt) - luaC_objbarrier(L, rawuvalue(obj), mt); - break; - } - default: { - G(L)->mt[ttype(obj)] = mt; - break; - } - } - L->top--; - lua_unlock(L); - return 1; -} - - -LUA_API int lua_setfenv (lua_State *L, int idx) { - StkId o; - int res = 1; - lua_lock(L); - api_checknelems(L, 1); - o = index2adr(L, idx); - api_checkvalidindex(L, o); - api_check(L, ttistable(L->top - 1)); - switch (ttype(o)) { - case LUA_TFUNCTION: - clvalue(o)->c.env = hvalue(L->top - 1); - break; - case LUA_TUSERDATA: - uvalue(o)->env = hvalue(L->top - 1); - break; - case LUA_TTHREAD: - sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); - break; - default: - res = 0; - break; - } - if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); - L->top--; - lua_unlock(L); - return res; -} - - -/* -** `load' and `call' functions (run Lua code) -*/ - - -#define adjustresults(L,nres) \ - { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } - - -#define checkresults(L,na,nr) \ - api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) - - -LUA_API void lua_call (lua_State *L, int nargs, int nresults) { - StkId func; - lua_lock(L); - api_checknelems(L, nargs+1); - checkresults(L, nargs, nresults); - func = L->top - (nargs+1); - luaD_call(L, func, nresults); - adjustresults(L, nresults); - lua_unlock(L); -} - - - -/* -** Execute a protected call. -*/ -struct CallS { /* data to `f_call' */ - StkId func; - int nresults; -}; - - -static void f_call (lua_State *L, void *ud) { - struct CallS *c = cast(struct CallS *, ud); - luaD_call(L, c->func, c->nresults); -} - - - -LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { - struct CallS c; - int status; - ptrdiff_t func; - lua_lock(L); - api_checknelems(L, nargs+1); - checkresults(L, nargs, nresults); - if (errfunc == 0) - func = 0; - else { - StkId o = index2adr(L, errfunc); - api_checkvalidindex(L, o); - func = savestack(L, o); - } - c.func = L->top - (nargs+1); /* function to be called */ - c.nresults = nresults; - status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); - adjustresults(L, nresults); - lua_unlock(L); - return status; -} - - -/* -** Execute a protected C call. -*/ -struct CCallS { /* data to `f_Ccall' */ - lua_CFunction func; - void *ud; -}; - - -static void f_Ccall (lua_State *L, void *ud) { - struct CCallS *c = cast(struct CCallS *, ud); - Closure *cl; - cl = luaF_newCclosure(L, 0, getcurrenv(L)); - cl->c.f = c->func; - setclvalue(L, L->top, cl); /* push function */ - api_incr_top(L); - setpvalue(L->top, c->ud); /* push only argument */ - api_incr_top(L); - luaD_call(L, L->top - 2, 0); -} - - -LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { - struct CCallS c; - int status; - lua_lock(L); - c.func = func; - c.ud = ud; - status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); - lua_unlock(L); - return status; -} - - -LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, - const char *chunkname) { - ZIO z; - int status; - lua_lock(L); - if (!chunkname) chunkname = "?"; - luaZ_init(L, &z, reader, data); - status = luaD_protectedparser(L, &z, chunkname); - lua_unlock(L); - return status; -} - - -LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { - int status; - TValue *o; - lua_lock(L); - api_checknelems(L, 1); - o = L->top - 1; - if (isLfunction(o)) - status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); - else - status = 1; - lua_unlock(L); - return status; -} - - -LUA_API int lua_status (lua_State *L) { - return L->status; -} - - -/* -** Garbage-collection function -*/ - -LUA_API int lua_gc (lua_State *L, int what, int data) { - int res = 0; - global_State *g; - lua_lock(L); - g = G(L); - switch (what) { - case LUA_GCSTOP: { - g->GCthreshold = MAX_LUMEM; - break; - } - case LUA_GCRESTART: { - g->GCthreshold = g->totalbytes; - break; - } - case LUA_GCCOLLECT: { - luaC_fullgc(L); - break; - } - case LUA_GCCOUNT: { - /* GC values are expressed in Kbytes: #bytes/2^10 */ - res = cast_int(g->totalbytes >> 10); - break; - } - case LUA_GCCOUNTB: { - res = cast_int(g->totalbytes & 0x3ff); - break; - } - case LUA_GCSTEP: { - lu_mem a = (cast(lu_mem, data) << 10); - if (a <= g->totalbytes) - g->GCthreshold = g->totalbytes - a; - else - g->GCthreshold = 0; - while (g->GCthreshold <= g->totalbytes) { - luaC_step(L); - if (g->gcstate == GCSpause) { /* end of cycle? */ - res = 1; /* signal it */ - break; - } - } - break; - } - case LUA_GCSETPAUSE: { - res = g->gcpause; - g->gcpause = data; - break; - } - case LUA_GCSETSTEPMUL: { - res = g->gcstepmul; - g->gcstepmul = data; - break; - } - default: res = -1; /* invalid option */ - } - lua_unlock(L); - return res; -} - - - -/* -** miscellaneous functions -*/ - - -LUA_API int lua_error (lua_State *L) { - lua_lock(L); - api_checknelems(L, 1); - luaG_errormsg(L); - lua_unlock(L); - return 0; /* to avoid warnings */ -} - - -LUA_API int lua_next (lua_State *L, int idx) { - StkId t; - int more; - lua_lock(L); - t = index2adr(L, idx); - api_check(L, ttistable(t)); - more = luaH_next(L, hvalue(t), L->top - 1); - if (more) { - api_incr_top(L); - } - else /* no more elements */ - L->top -= 1; /* remove key */ - lua_unlock(L); - return more; -} - - -LUA_API void lua_concat (lua_State *L, int n) { - lua_lock(L); - api_checknelems(L, n); - if (n >= 2) { - luaC_checkGC(L); - luaV_concat(L, n, cast_int(L->top - L->base) - 1); - L->top -= (n-1); - } - else if (n == 0) { /* push empty string */ - setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); - api_incr_top(L); - } - /* else n == 1; nothing to do */ - lua_unlock(L); -} - - -LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { - lua_Alloc f; - lua_lock(L); - if (ud) *ud = G(L)->ud; - f = G(L)->frealloc; - lua_unlock(L); - return f; -} - - -LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { - lua_lock(L); - G(L)->ud = ud; - G(L)->frealloc = f; - lua_unlock(L); -} - - -LUA_API void *lua_newuserdata (lua_State *L, size_t size) { - Udata *u; - lua_lock(L); - luaC_checkGC(L); - u = luaS_newudata(L, size, getcurrenv(L)); - setuvalue(L, L->top, u); - api_incr_top(L); - lua_unlock(L); - return u + 1; -} - - - - -static const char *aux_upvalue (StkId fi, int n, TValue **val) { - Closure *f; - if (!ttisfunction(fi)) return NULL; - f = clvalue(fi); - if (f->c.isC) { - if (!(1 <= n && n <= f->c.nupvalues)) return NULL; - *val = &f->c.upvalue[n-1]; - return ""; - } - else { - Proto *p = f->l.p; - if (!(1 <= n && n <= p->sizeupvalues)) return NULL; - *val = f->l.upvals[n-1]->v; - return getstr(p->upvalues[n-1]); - } -} - - -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val; - lua_lock(L); - name = aux_upvalue(index2adr(L, funcindex), n, &val); - if (name) { - setobj2s(L, L->top, val); - api_incr_top(L); - } - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val; - StkId fi; - lua_lock(L); - fi = index2adr(L, funcindex); - api_checknelems(L, 1); - name = aux_upvalue(fi, n, &val); - if (name) { - L->top--; - setobj(L, val, L->top); - luaC_barrier(L, clvalue(fi), L->top); - } - lua_unlock(L); - return name; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lapi.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lapi.h deleted file mode 100644 index 2c3fab24..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lapi.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ -** Auxiliary functions from Lua API -** See Copyright Notice in lua.h -*/ - -#ifndef lapi_h -#define lapi_h - - -#include "lobject.h" - - -LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lauxlib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lauxlib.c deleted file mode 100644 index 10f14e2c..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lauxlib.c +++ /dev/null @@ -1,652 +0,0 @@ -/* -** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include -#include -#include -#include - - -/* This file uses only the official API of Lua. -** Any function declared here could be written as an application function. -*/ - -#define lauxlib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" - - -#define FREELIST_REF 0 /* free list of references */ - - -/* convert a stack index to positive */ -#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ - lua_gettop(L) + (i) + 1) - - -/* -** {====================================================== -** Error-report functions -** ======================================================= -*/ - - -LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { - lua_Debug ar; - if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ - return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); - lua_getinfo(L, "n", &ar); - if (strcmp(ar.namewhat, "method") == 0) { - narg--; /* do not count `self' */ - if (narg == 0) /* error is in the self argument itself? */ - return luaL_error(L, "calling " LUA_QS " on bad self (%s)", - ar.name, extramsg); - } - if (ar.name == NULL) - ar.name = "?"; - return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", - narg, ar.name, extramsg); -} - - -LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { - const char *msg = lua_pushfstring(L, "%s expected, got %s", - tname, luaL_typename(L, narg)); - return luaL_argerror(L, narg, msg); -} - - -static void tag_error (lua_State *L, int narg, int tag) { - luaL_typerror(L, narg, lua_typename(L, tag)); -} - - -LUALIB_API void luaL_where (lua_State *L, int level) { - lua_Debug ar; - if (lua_getstack(L, level, &ar)) { /* check function at level */ - lua_getinfo(L, "Sl", &ar); /* get info about it */ - if (ar.currentline > 0) { /* is there info? */ - lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); - return; - } - } - lua_pushliteral(L, ""); /* else, no information available... */ -} - - -LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { - va_list argp; - va_start(argp, fmt); - luaL_where(L, 1); - lua_pushvfstring(L, fmt, argp); - va_end(argp); - lua_concat(L, 2); - return lua_error(L); -} - -/* }====================================================== */ - - -LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, - const char *const lst[]) { - const char *name = (def) ? luaL_optstring(L, narg, def) : - luaL_checkstring(L, narg); - int i; - for (i=0; lst[i]; i++) - if (strcmp(lst[i], name) == 0) - return i; - return luaL_argerror(L, narg, - lua_pushfstring(L, "invalid option " LUA_QS, name)); -} - - -LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { - lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ - if (!lua_isnil(L, -1)) /* name already in use? */ - return 0; /* leave previous value on top, but return 0 */ - lua_pop(L, 1); - lua_newtable(L); /* create metatable */ - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ - return 1; -} - - -LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { - void *p = lua_touserdata(L, ud); - if (p != NULL) { /* value is a userdata? */ - if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ - lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ - if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ - lua_pop(L, 2); /* remove both metatables */ - return p; - } - } - } - luaL_typerror(L, ud, tname); /* else error */ - return NULL; /* to avoid warnings */ -} - - -LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { - if (!lua_checkstack(L, space)) - luaL_error(L, "stack overflow (%s)", mes); -} - - -LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { - if (lua_type(L, narg) != t) - tag_error(L, narg, t); -} - - -LUALIB_API void luaL_checkany (lua_State *L, int narg) { - if (lua_type(L, narg) == LUA_TNONE) - luaL_argerror(L, narg, "value expected"); -} - - -LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { - const char *s = lua_tolstring(L, narg, len); - if (!s) tag_error(L, narg, LUA_TSTRING); - return s; -} - - -LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, - const char *def, size_t *len) { - if (lua_isnoneornil(L, narg)) { - if (len) - *len = (def ? strlen(def) : 0); - return def; - } - else return luaL_checklstring(L, narg, len); -} - - -LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { - lua_Number d = lua_tonumber(L, narg); - if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ - tag_error(L, narg, LUA_TNUMBER); - return d; -} - - -LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { - return luaL_opt(L, luaL_checknumber, narg, def); -} - - -LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { - lua_Integer d = lua_tointeger(L, narg); - if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ - tag_error(L, narg, LUA_TNUMBER); - return d; -} - - -LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, - lua_Integer def) { - return luaL_opt(L, luaL_checkinteger, narg, def); -} - - -LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { - if (!lua_getmetatable(L, obj)) /* no metatable? */ - return 0; - lua_pushstring(L, event); - lua_rawget(L, -2); - if (lua_isnil(L, -1)) { - lua_pop(L, 2); /* remove metatable and metafield */ - return 0; - } - else { - lua_remove(L, -2); /* remove only metatable */ - return 1; - } -} - - -LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { - obj = abs_index(L, obj); - if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ - return 0; - lua_pushvalue(L, obj); - lua_call(L, 1, 1); - return 1; -} - - -LUALIB_API void (luaL_register) (lua_State *L, const char *libname, - const luaL_Reg *l) { - luaI_openlib(L, libname, l, 0); -} - - -static int libsize (const luaL_Reg *l) { - int size = 0; - for (; l->name; l++) size++; - return size; -} - - -LUALIB_API void luaI_openlib (lua_State *L, const char *libname, - const luaL_Reg *l, int nup) { - if (libname) { - int size = libsize(l); - /* check whether lib already exists */ - luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); - lua_getfield(L, -1, libname); /* get _LOADED[libname] */ - if (!lua_istable(L, -1)) { /* not found? */ - lua_pop(L, 1); /* remove previous result */ - /* try global variable (and create one if it does not exist) */ - if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) - luaL_error(L, "name conflict for module " LUA_QS, libname); - lua_pushvalue(L, -1); - lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ - } - lua_remove(L, -2); /* remove _LOADED table */ - lua_insert(L, -(nup+1)); /* move library table to below upvalues */ - } - for (; l->name; l++) { - int i; - for (i=0; ifunc, nup); - lua_setfield(L, -(nup+2), l->name); - } - lua_pop(L, nup); /* remove upvalues */ -} - - - -/* -** {====================================================== -** getn-setn: size for arrays -** ======================================================= -*/ - -#if defined(LUA_COMPAT_GETN) - -static int checkint (lua_State *L, int topop) { - int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; - lua_pop(L, topop); - return n; -} - - -static void getsizes (lua_State *L) { - lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); - if (lua_isnil(L, -1)) { /* no `size' table? */ - lua_pop(L, 1); /* remove nil */ - lua_newtable(L); /* create it */ - lua_pushvalue(L, -1); /* `size' will be its own metatable */ - lua_setmetatable(L, -2); - lua_pushliteral(L, "kv"); - lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ - } -} - - -LUALIB_API void luaL_setn (lua_State *L, int t, int n) { - t = abs_index(L, t); - lua_pushliteral(L, "n"); - lua_rawget(L, t); - if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ - lua_pushliteral(L, "n"); /* use it */ - lua_pushinteger(L, n); - lua_rawset(L, t); - } - else { /* use `sizes' */ - getsizes(L); - lua_pushvalue(L, t); - lua_pushinteger(L, n); - lua_rawset(L, -3); /* sizes[t] = n */ - lua_pop(L, 1); /* remove `sizes' */ - } -} - - -LUALIB_API int luaL_getn (lua_State *L, int t) { - int n; - t = abs_index(L, t); - lua_pushliteral(L, "n"); /* try t.n */ - lua_rawget(L, t); - if ((n = checkint(L, 1)) >= 0) return n; - getsizes(L); /* else try sizes[t] */ - lua_pushvalue(L, t); - lua_rawget(L, -2); - if ((n = checkint(L, 2)) >= 0) return n; - return (int)lua_objlen(L, t); -} - -#endif - -/* }====================================================== */ - - - -LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, - const char *r) { - const char *wild; - size_t l = strlen(p); - luaL_Buffer b; - luaL_buffinit(L, &b); - while ((wild = strstr(s, p)) != NULL) { - luaL_addlstring(&b, s, wild - s); /* push prefix */ - luaL_addstring(&b, r); /* push replacement in place of pattern */ - s = wild + l; /* continue after `p' */ - } - luaL_addstring(&b, s); /* push last suffix */ - luaL_pushresult(&b); - return lua_tostring(L, -1); -} - - -LUALIB_API const char *luaL_findtable (lua_State *L, int idx, - const char *fname, int szhint) { - const char *e; - lua_pushvalue(L, idx); - do { - e = strchr(fname, '.'); - if (e == NULL) e = fname + strlen(fname); - lua_pushlstring(L, fname, e - fname); - lua_rawget(L, -2); - if (lua_isnil(L, -1)) { /* no such field? */ - lua_pop(L, 1); /* remove this nil */ - lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ - lua_pushlstring(L, fname, e - fname); - lua_pushvalue(L, -2); - lua_settable(L, -4); /* set new table into field */ - } - else if (!lua_istable(L, -1)) { /* field has a non-table value? */ - lua_pop(L, 2); /* remove table and value */ - return fname; /* return problematic part of the name */ - } - lua_remove(L, -2); /* remove previous table */ - fname = e + 1; - } while (*e == '.'); - return NULL; -} - - - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - - -#define bufflen(B) ((B)->p - (B)->buffer) -#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) - -#define LIMIT (LUA_MINSTACK/2) - - -static int emptybuffer (luaL_Buffer *B) { - size_t l = bufflen(B); - if (l == 0) return 0; /* put nothing on stack */ - else { - lua_pushlstring(B->L, B->buffer, l); - B->p = B->buffer; - B->lvl++; - return 1; - } -} - - -static void adjuststack (luaL_Buffer *B) { - if (B->lvl > 1) { - lua_State *L = B->L; - int toget = 1; /* number of levels to concat */ - size_t toplen = lua_strlen(L, -1); - do { - size_t l = lua_strlen(L, -(toget+1)); - if (B->lvl - toget + 1 >= LIMIT || toplen > l) { - toplen += l; - toget++; - } - else break; - } while (toget < B->lvl); - lua_concat(L, toget); - B->lvl = B->lvl - toget + 1; - } -} - - -LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { - if (emptybuffer(B)) - adjuststack(B); - return B->buffer; -} - - -LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { - while (l--) - luaL_addchar(B, *s++); -} - - -LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { - luaL_addlstring(B, s, strlen(s)); -} - - -LUALIB_API void luaL_pushresult (luaL_Buffer *B) { - emptybuffer(B); - lua_concat(B->L, B->lvl); - B->lvl = 1; -} - - -LUALIB_API void luaL_addvalue (luaL_Buffer *B) { - lua_State *L = B->L; - size_t vl; - const char *s = lua_tolstring(L, -1, &vl); - if (vl <= bufffree(B)) { /* fit into buffer? */ - memcpy(B->p, s, vl); /* put it there */ - B->p += vl; - lua_pop(L, 1); /* remove from stack */ - } - else { - if (emptybuffer(B)) - lua_insert(L, -2); /* put buffer before new value */ - B->lvl++; /* add new value into B stack */ - adjuststack(B); - } -} - - -LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { - B->L = L; - B->p = B->buffer; - B->lvl = 0; -} - -/* }====================================================== */ - - -LUALIB_API int luaL_ref (lua_State *L, int t) { - int ref; - t = abs_index(L, t); - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* remove from stack */ - return LUA_REFNIL; /* `nil' has a unique fixed reference */ - } - lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ - ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ - lua_pop(L, 1); /* remove it from stack */ - if (ref != 0) { /* any free element? */ - lua_rawgeti(L, t, ref); /* remove it from list */ - lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ - } - else { /* no free elements */ - ref = (int)lua_objlen(L, t); - ref++; /* create new reference */ - } - lua_rawseti(L, t, ref); - return ref; -} - - -LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { - if (ref >= 0) { - t = abs_index(L, t); - lua_rawgeti(L, t, FREELIST_REF); - lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ - lua_pushinteger(L, ref); - lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ - } -} - - - -/* -** {====================================================== -** Load functions -** ======================================================= -*/ - -typedef struct LoadF { - int extraline; - FILE *f; - char buff[LUAL_BUFFERSIZE]; -} LoadF; - - -static const char *getF (lua_State *L, void *ud, size_t *size) { - LoadF *lf = (LoadF *)ud; - (void)L; - if (lf->extraline) { - lf->extraline = 0; - *size = 1; - return "\n"; - } - if (feof(lf->f)) return NULL; - *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); - return (*size > 0) ? lf->buff : NULL; -} - - -static int errfile (lua_State *L, const char *what, int fnameindex) { - const char *serr = strerror(errno); - const char *filename = lua_tostring(L, fnameindex) + 1; - lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); - lua_remove(L, fnameindex); - return LUA_ERRFILE; -} - - -LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { - LoadF lf; - int status, readstatus; - int c; - int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ - lf.extraline = 0; - if (filename == NULL) { - lua_pushliteral(L, "=stdin"); - lf.f = stdin; - } - else { - lua_pushfstring(L, "@%s", filename); - lf.f = fopen(filename, "r"); - if (lf.f == NULL) return errfile(L, "open", fnameindex); - } - c = getc(lf.f); - if (c == '#') { /* Unix exec. file? */ - lf.extraline = 1; - while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ - if (c == '\n') c = getc(lf.f); - } - if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ - lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ - if (lf.f == NULL) return errfile(L, "reopen", fnameindex); - /* skip eventual `#!...' */ - while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; - lf.extraline = 0; - } - ungetc(c, lf.f); - status = lua_load(L, getF, &lf, lua_tostring(L, -1)); - readstatus = ferror(lf.f); - if (filename) fclose(lf.f); /* close file (even in case of errors) */ - if (readstatus) { - lua_settop(L, fnameindex); /* ignore results from `lua_load' */ - return errfile(L, "read", fnameindex); - } - lua_remove(L, fnameindex); - return status; -} - - -typedef struct LoadS { - const char *s; - size_t size; -} LoadS; - - -static const char *getS (lua_State *L, void *ud, size_t *size) { - LoadS *ls = (LoadS *)ud; - (void)L; - if (ls->size == 0) return NULL; - *size = ls->size; - ls->size = 0; - return ls->s; -} - - -LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, - const char *name) { - LoadS ls; - ls.s = buff; - ls.size = size; - return lua_load(L, getS, &ls, name); -} - - -LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { - return luaL_loadbuffer(L, s, strlen(s), s); -} - - - -/* }====================================================== */ - - -static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { - (void)ud; - (void)osize; - if (nsize == 0) { - free(ptr); - return NULL; - } - else - return realloc(ptr, nsize); -} - - -static int panic (lua_State *L) { - (void)L; /* to avoid warnings */ - fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", - lua_tostring(L, -1)); - return 0; -} - - -LUALIB_API lua_State *luaL_newstate (void) { - lua_State *L = lua_newstate(l_alloc, NULL); - if (L) lua_atpanic(L, &panic); - return L; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lauxlib.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lauxlib.h deleted file mode 100644 index 34258235..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lauxlib.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lauxlib_h -#define lauxlib_h - - -#include -#include - -#include "lua.h" - - -#if defined(LUA_COMPAT_GETN) -LUALIB_API int (luaL_getn) (lua_State *L, int t); -LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); -#else -#define luaL_getn(L,i) ((int)lua_objlen(L, i)) -#define luaL_setn(L,i,j) ((void)0) /* no op! */ -#endif - -#if defined(LUA_COMPAT_OPENLIB) -#define luaI_openlib luaL_openlib -#endif - - -/* extra error code for `luaL_load' */ -#define LUA_ERRFILE (LUA_ERRERR+1) - - -typedef struct luaL_Reg { - const char *name; - lua_CFunction func; -} luaL_Reg; - - - -LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, - const luaL_Reg *l, int nup); -LUALIB_API void (luaL_register) (lua_State *L, const char *libname, - const luaL_Reg *l); -LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); -LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); -LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); -LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); -LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, - size_t *l); -LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, - const char *def, size_t *l); -LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); -LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); - -LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); -LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, - lua_Integer def); - -LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); -LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); -LUALIB_API void (luaL_checkany) (lua_State *L, int narg); - -LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); -LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); - -LUALIB_API void (luaL_where) (lua_State *L, int lvl); -LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); - -LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, - const char *const lst[]); - -LUALIB_API int (luaL_ref) (lua_State *L, int t); -LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); - -LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); -LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, - const char *name); -LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); - -LUALIB_API lua_State *(luaL_newstate) (void); - - -LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, - const char *r); - -LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, - const char *fname, int szhint); - - - - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - -#define luaL_argcheck(L, cond,numarg,extramsg) \ - ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) -#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) -#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) -#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) -#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) - -#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) - -#define luaL_dofile(L, fn) \ - (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_dostring(L, s) \ - (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) - -#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - - - -typedef struct luaL_Buffer { - char *p; /* current position in buffer */ - int lvl; /* number of strings in the stack (level) */ - lua_State *L; - char buffer[LUAL_BUFFERSIZE]; -} luaL_Buffer; - -#define luaL_addchar(B,c) \ - ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ - (*(B)->p++ = (char)(c))) - -/* compatibility only */ -#define luaL_putchar(B,c) luaL_addchar(B,c) - -#define luaL_addsize(B,n) ((B)->p += (n)) - -LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); -LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); -LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); -LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); -LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); -LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); - - -/* }====================================================== */ - - -/* compatibility with ref system */ - -/* pre-defined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) - -#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ - (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) - -#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) - -#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) - - -#define luaL_reg luaL_Reg - -#endif - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lbaselib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lbaselib.c deleted file mode 100644 index 2ab550bd..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lbaselib.c +++ /dev/null @@ -1,653 +0,0 @@ -/* -** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ -** Basic library -** See Copyright Notice in lua.h -*/ - - - -#include -#include -#include -#include - -#define lbaselib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - - -/* -** If your system does not support `stdout', you can just remove this function. -** If you need, you can define your own `print' function, following this -** model but changing `fputs' to put the strings at a proper place -** (a console window or a log file, for instance). -*/ -static int luaB_print (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int i; - lua_getglobal(L, "tostring"); - for (i=1; i<=n; i++) { - const char *s; - lua_pushvalue(L, -1); /* function to be called */ - lua_pushvalue(L, i); /* value to print */ - lua_call(L, 1, 1); - s = lua_tostring(L, -1); /* get result */ - if (s == NULL) - return luaL_error(L, LUA_QL("tostring") " must return a string to " - LUA_QL("print")); - if (i>1) fputs("\t", stdout); - fputs(s, stdout); - lua_pop(L, 1); /* pop result */ - } - fputs("\n", stdout); - return 0; -} - - -static int luaB_tonumber (lua_State *L) { - int base = luaL_optint(L, 2, 10); - if (base == 10) { /* standard conversion */ - luaL_checkany(L, 1); - if (lua_isnumber(L, 1)) { - lua_pushnumber(L, lua_tonumber(L, 1)); - return 1; - } - } - else { - const char *s1 = luaL_checkstring(L, 1); - char *s2; - unsigned long n; - luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); - n = strtoul(s1, &s2, base); - if (s1 != s2) { /* at least one valid digit? */ - while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ - if (*s2 == '\0') { /* no invalid trailing characters? */ - lua_pushnumber(L, (lua_Number)n); - return 1; - } - } - } - lua_pushnil(L); /* else not a number */ - return 1; -} - - -static int luaB_error (lua_State *L) { - int level = luaL_optint(L, 2, 1); - lua_settop(L, 1); - if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ - luaL_where(L, level); - lua_pushvalue(L, 1); - lua_concat(L, 2); - } - return lua_error(L); -} - - -static int luaB_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); - return 1; /* no metatable */ - } - luaL_getmetafield(L, 1, "__metatable"); - return 1; /* returns either __metatable field (if present) or metatable */ -} - - -static int luaB_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_checktype(L, 1, LUA_TTABLE); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - if (luaL_getmetafield(L, 1, "__metatable")) - luaL_error(L, "cannot change a protected metatable"); - lua_settop(L, 2); - lua_setmetatable(L, 1); - return 1; -} - - -static void getfunc (lua_State *L, int opt) { - if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); - else { - lua_Debug ar; - int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); - luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); - if (lua_getstack(L, level, &ar) == 0) - luaL_argerror(L, 1, "invalid level"); - lua_getinfo(L, "f", &ar); - if (lua_isnil(L, -1)) - luaL_error(L, "no function environment for tail call at level %d", - level); - } -} - - -static int luaB_getfenv (lua_State *L) { - getfunc(L, 1); - if (lua_iscfunction(L, -1)) /* is a C function? */ - lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ - else - lua_getfenv(L, -1); - return 1; -} - - -static int luaB_setfenv (lua_State *L) { - luaL_checktype(L, 2, LUA_TTABLE); - getfunc(L, 0); - lua_pushvalue(L, 2); - if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { - /* change environment of current thread */ - lua_pushthread(L); - lua_insert(L, -2); - lua_setfenv(L, -2); - return 0; - } - else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) - luaL_error(L, - LUA_QL("setfenv") " cannot change environment of given object"); - return 1; -} - - -static int luaB_rawequal (lua_State *L) { - luaL_checkany(L, 1); - luaL_checkany(L, 2); - lua_pushboolean(L, lua_rawequal(L, 1, 2)); - return 1; -} - - -static int luaB_rawget (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_rawget(L, 1); - return 1; -} - -static int luaB_rawset (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - luaL_checkany(L, 3); - lua_settop(L, 3); - lua_rawset(L, 1); - return 1; -} - - -static int luaB_gcinfo (lua_State *L) { - lua_pushinteger(L, lua_getgccount(L)); - return 1; -} - - -static int luaB_collectgarbage (lua_State *L) { - static const char *const opts[] = {"stop", "restart", "collect", - "count", "step", "setpause", "setstepmul", NULL}; - static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, - LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; - int o = luaL_checkoption(L, 1, "collect", opts); - int ex = luaL_optint(L, 2, 0); - int res = lua_gc(L, optsnum[o], ex); - switch (optsnum[o]) { - case LUA_GCCOUNT: { - int b = lua_gc(L, LUA_GCCOUNTB, 0); - lua_pushnumber(L, res + ((lua_Number)b/1024)); - return 1; - } - case LUA_GCSTEP: { - lua_pushboolean(L, res); - return 1; - } - default: { - lua_pushnumber(L, res); - return 1; - } - } -} - - -static int luaB_type (lua_State *L) { - luaL_checkany(L, 1); - lua_pushstring(L, luaL_typename(L, 1)); - return 1; -} - - -static int luaB_next (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 2); /* create a 2nd argument if there isn't one */ - if (lua_next(L, 1)) - return 2; - else { - lua_pushnil(L); - return 1; - } -} - - -static int luaB_pairs (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ - lua_pushvalue(L, 1); /* state, */ - lua_pushnil(L); /* and initial value */ - return 3; -} - - -static int ipairsaux (lua_State *L) { - int i = luaL_checkint(L, 2); - luaL_checktype(L, 1, LUA_TTABLE); - i++; /* next value */ - lua_pushinteger(L, i); - lua_rawgeti(L, 1, i); - return (lua_isnil(L, -1)) ? 0 : 2; -} - - -static int luaB_ipairs (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ - lua_pushvalue(L, 1); /* state, */ - lua_pushinteger(L, 0); /* and initial value */ - return 3; -} - - -static int load_aux (lua_State *L, int status) { - if (status == 0) /* OK? */ - return 1; - else { - lua_pushnil(L); - lua_insert(L, -2); /* put before error message */ - return 2; /* return nil plus error message */ - } -} - - -static int luaB_loadstring (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - const char *chunkname = luaL_optstring(L, 2, s); - return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); -} - - -static int luaB_loadfile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - return load_aux(L, luaL_loadfile(L, fname)); -} - - -/* -** Reader for generic `load' function: `lua_load' uses the -** stack for internal stuff, so the reader cannot change the -** stack top. Instead, it keeps its resulting string in a -** reserved slot inside the stack. -*/ -static const char *generic_reader (lua_State *L, void *ud, size_t *size) { - (void)ud; /* to avoid warnings */ - luaL_checkstack(L, 2, "too many nested functions"); - lua_pushvalue(L, 1); /* get function */ - lua_call(L, 0, 1); /* call it */ - if (lua_isnil(L, -1)) { - *size = 0; - return NULL; - } - else if (lua_isstring(L, -1)) { - lua_replace(L, 3); /* save string in a reserved stack slot */ - return lua_tolstring(L, 3, size); - } - else luaL_error(L, "reader function must return a string"); - return NULL; /* to avoid warnings */ -} - - -static int luaB_load (lua_State *L) { - int status; - const char *cname = luaL_optstring(L, 2, "=(load)"); - luaL_checktype(L, 1, LUA_TFUNCTION); - lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ - status = lua_load(L, generic_reader, NULL, cname); - return load_aux(L, status); -} - - -static int luaB_dofile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - int n = lua_gettop(L); - if (luaL_loadfile(L, fname) != 0) lua_error(L); - lua_call(L, 0, LUA_MULTRET); - return lua_gettop(L) - n; -} - - -static int luaB_assert (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_toboolean(L, 1)) - return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); - return lua_gettop(L); -} - - -static int luaB_unpack (lua_State *L) { - int i, e, n; - luaL_checktype(L, 1, LUA_TTABLE); - i = luaL_optint(L, 2, 1); - e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); - if (i > e) return 0; /* empty range */ - n = e - i + 1; /* number of elements */ - if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ - return luaL_error(L, "too many results to unpack"); - lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ - while (i++ < e) /* push arg[i + 1...e] */ - lua_rawgeti(L, 1, i); - return n; -} - - -static int luaB_select (lua_State *L) { - int n = lua_gettop(L); - if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { - lua_pushinteger(L, n-1); - return 1; - } - else { - int i = luaL_checkint(L, 1); - if (i < 0) i = n + i; - else if (i > n) i = n; - luaL_argcheck(L, 1 <= i, 1, "index out of range"); - return n - i; - } -} - - -static int luaB_pcall (lua_State *L) { - int status; - luaL_checkany(L, 1); - status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); - lua_pushboolean(L, (status == 0)); - lua_insert(L, 1); - return lua_gettop(L); /* return status + all results */ -} - - -static int luaB_xpcall (lua_State *L) { - int status; - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_insert(L, 1); /* put error function under function to be called */ - status = lua_pcall(L, 0, LUA_MULTRET, 1); - lua_pushboolean(L, (status == 0)); - lua_replace(L, 1); - return lua_gettop(L); /* return status + all results */ -} - - -static int luaB_tostring (lua_State *L) { - luaL_checkany(L, 1); - if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ - return 1; /* use its value */ - switch (lua_type(L, 1)) { - case LUA_TNUMBER: - lua_pushstring(L, lua_tostring(L, 1)); - break; - case LUA_TSTRING: - lua_pushvalue(L, 1); - break; - case LUA_TBOOLEAN: - lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); - break; - case LUA_TNIL: - lua_pushliteral(L, "nil"); - break; - default: - lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); - break; - } - return 1; -} - - -static int luaB_newproxy (lua_State *L) { - lua_settop(L, 1); - lua_newuserdata(L, 0); /* create proxy */ - if (lua_toboolean(L, 1) == 0) - return 1; /* no metatable */ - else if (lua_isboolean(L, 1)) { - lua_newtable(L); /* create a new metatable `m' ... */ - lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ - lua_pushboolean(L, 1); - lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ - } - else { - int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ - if (lua_getmetatable(L, 1)) { - lua_rawget(L, lua_upvalueindex(1)); - validproxy = lua_toboolean(L, -1); - lua_pop(L, 1); /* remove value */ - } - luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); - lua_getmetatable(L, 1); /* metatable is valid; get it */ - } - lua_setmetatable(L, 2); - return 1; -} - - -static const luaL_Reg base_funcs[] = { - {"assert", luaB_assert}, - {"collectgarbage", luaB_collectgarbage}, - {"dofile", luaB_dofile}, - {"error", luaB_error}, - {"gcinfo", luaB_gcinfo}, - {"getfenv", luaB_getfenv}, - {"getmetatable", luaB_getmetatable}, - {"loadfile", luaB_loadfile}, - {"load", luaB_load}, - {"loadstring", luaB_loadstring}, - {"next", luaB_next}, - {"pcall", luaB_pcall}, - {"print", luaB_print}, - {"rawequal", luaB_rawequal}, - {"rawget", luaB_rawget}, - {"rawset", luaB_rawset}, - {"select", luaB_select}, - {"setfenv", luaB_setfenv}, - {"setmetatable", luaB_setmetatable}, - {"tonumber", luaB_tonumber}, - {"tostring", luaB_tostring}, - {"type", luaB_type}, - {"unpack", luaB_unpack}, - {"xpcall", luaB_xpcall}, - {NULL, NULL} -}; - - -/* -** {====================================================== -** Coroutine library -** ======================================================= -*/ - -#define CO_RUN 0 /* running */ -#define CO_SUS 1 /* suspended */ -#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ -#define CO_DEAD 3 - -static const char *const statnames[] = - {"running", "suspended", "normal", "dead"}; - -static int costatus (lua_State *L, lua_State *co) { - if (L == co) return CO_RUN; - switch (lua_status(co)) { - case LUA_YIELD: - return CO_SUS; - case 0: { - lua_Debug ar; - if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ - return CO_NOR; /* it is running */ - else if (lua_gettop(co) == 0) - return CO_DEAD; - else - return CO_SUS; /* initial state */ - } - default: /* some error occured */ - return CO_DEAD; - } -} - - -static int luaB_costatus (lua_State *L) { - lua_State *co = lua_tothread(L, 1); - luaL_argcheck(L, co, 1, "coroutine expected"); - lua_pushstring(L, statnames[costatus(L, co)]); - return 1; -} - - -static int auxresume (lua_State *L, lua_State *co, int narg) { - int status = costatus(L, co); - if (!lua_checkstack(co, narg)) - luaL_error(L, "too many arguments to resume"); - if (status != CO_SUS) { - lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); - return -1; /* error flag */ - } - lua_xmove(L, co, narg); - lua_setlevel(L, co); - status = lua_resume(co, narg); - if (status == 0 || status == LUA_YIELD) { - int nres = lua_gettop(co); - if (!lua_checkstack(L, nres + 1)) - luaL_error(L, "too many results to resume"); - lua_xmove(co, L, nres); /* move yielded values */ - return nres; - } - else { - lua_xmove(co, L, 1); /* move error message */ - return -1; /* error flag */ - } -} - - -static int luaB_coresume (lua_State *L) { - lua_State *co = lua_tothread(L, 1); - int r; - luaL_argcheck(L, co, 1, "coroutine expected"); - r = auxresume(L, co, lua_gettop(L) - 1); - if (r < 0) { - lua_pushboolean(L, 0); - lua_insert(L, -2); - return 2; /* return false + error message */ - } - else { - lua_pushboolean(L, 1); - lua_insert(L, -(r + 1)); - return r + 1; /* return true + `resume' returns */ - } -} - - -static int luaB_auxwrap (lua_State *L) { - lua_State *co = lua_tothread(L, lua_upvalueindex(1)); - int r = auxresume(L, co, lua_gettop(L)); - if (r < 0) { - if (lua_isstring(L, -1)) { /* error object is a string? */ - luaL_where(L, 1); /* add extra info */ - lua_insert(L, -2); - lua_concat(L, 2); - } - lua_error(L); /* propagate error */ - } - return r; -} - - -static int luaB_cocreate (lua_State *L) { - lua_State *NL = lua_newthread(L); - luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, - "Lua function expected"); - lua_pushvalue(L, 1); /* move function to top */ - lua_xmove(L, NL, 1); /* move function from L to NL */ - return 1; -} - - -static int luaB_cowrap (lua_State *L) { - luaB_cocreate(L); - lua_pushcclosure(L, luaB_auxwrap, 1); - return 1; -} - - -static int luaB_yield (lua_State *L) { - return lua_yield(L, lua_gettop(L)); -} - - -static int luaB_corunning (lua_State *L) { - if (lua_pushthread(L)) - lua_pushnil(L); /* main thread is not a coroutine */ - return 1; -} - - -static const luaL_Reg co_funcs[] = { - {"create", luaB_cocreate}, - {"resume", luaB_coresume}, - {"running", luaB_corunning}, - {"status", luaB_costatus}, - {"wrap", luaB_cowrap}, - {"yield", luaB_yield}, - {NULL, NULL} -}; - -/* }====================================================== */ - - -static void auxopen (lua_State *L, const char *name, - lua_CFunction f, lua_CFunction u) { - lua_pushcfunction(L, u); - lua_pushcclosure(L, f, 1); - lua_setfield(L, -2, name); -} - - -static void base_open (lua_State *L) { - /* set global _G */ - lua_pushvalue(L, LUA_GLOBALSINDEX); - lua_setglobal(L, "_G"); - /* open lib into global table */ - luaL_register(L, "_G", base_funcs); - lua_pushliteral(L, LUA_VERSION); - lua_setglobal(L, "_VERSION"); /* set global _VERSION */ - /* `ipairs' and `pairs' need auxiliary functions as upvalues */ - auxopen(L, "ipairs", luaB_ipairs, ipairsaux); - auxopen(L, "pairs", luaB_pairs, luaB_next); - /* `newproxy' needs a weaktable as upvalue */ - lua_createtable(L, 0, 1); /* new table `w' */ - lua_pushvalue(L, -1); /* `w' will be its own metatable */ - lua_setmetatable(L, -2); - lua_pushliteral(L, "kv"); - lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ - lua_pushcclosure(L, luaB_newproxy, 1); - lua_setglobal(L, "newproxy"); /* set global `newproxy' */ -} - - -LUALIB_API int luaopen_base (lua_State *L) { - base_open(L); - luaL_register(L, LUA_COLIBNAME, co_funcs); - return 2; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lcode.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lcode.c deleted file mode 100644 index 679cb9cf..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lcode.c +++ /dev/null @@ -1,831 +0,0 @@ -/* -** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $ -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - - -#include - -#define lcode_c -#define LUA_CORE - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "ltable.h" - - -#define hasjumps(e) ((e)->t != (e)->f) - - -static int isnumeral(expdesc *e) { - return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); -} - - -void luaK_nil (FuncState *fs, int from, int n) { - Instruction *previous; - if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ - if (fs->pc == 0) { /* function start? */ - if (from >= fs->nactvar) - return; /* positions are already clean */ - } - else { - previous = &fs->f->code[fs->pc-1]; - if (GET_OPCODE(*previous) == OP_LOADNIL) { - int pfrom = GETARG_A(*previous); - int pto = GETARG_B(*previous); - if (pfrom <= from && from <= pto+1) { /* can connect both? */ - if (from+n-1 > pto) - SETARG_B(*previous, from+n-1); - return; - } - } - } - } - luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ -} - - -int luaK_jump (FuncState *fs) { - int jpc = fs->jpc; /* save list of jumps to here */ - int j; - fs->jpc = NO_JUMP; - j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); - luaK_concat(fs, &j, jpc); /* keep them on hold */ - return j; -} - - -void luaK_ret (FuncState *fs, int first, int nret) { - luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); -} - - -static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { - luaK_codeABC(fs, op, A, B, C); - return luaK_jump(fs); -} - - -static void fixjump (FuncState *fs, int pc, int dest) { - Instruction *jmp = &fs->f->code[pc]; - int offset = dest-(pc+1); - lua_assert(dest != NO_JUMP); - if (abs(offset) > MAXARG_sBx) - luaX_syntaxerror(fs->ls, "control structure too long"); - SETARG_sBx(*jmp, offset); -} - - -/* -** returns current `pc' and marks it as a jump target (to avoid wrong -** optimizations with consecutive instructions not in the same basic block). -*/ -int luaK_getlabel (FuncState *fs) { - fs->lasttarget = fs->pc; - return fs->pc; -} - - -static int getjump (FuncState *fs, int pc) { - int offset = GETARG_sBx(fs->f->code[pc]); - if (offset == NO_JUMP) /* point to itself represents end of list */ - return NO_JUMP; /* end of list */ - else - return (pc+1)+offset; /* turn offset into absolute position */ -} - - -static Instruction *getjumpcontrol (FuncState *fs, int pc) { - Instruction *pi = &fs->f->code[pc]; - if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) - return pi-1; - else - return pi; -} - - -/* -** check whether list has any jump that do not produce a value -** (or produce an inverted value) -*/ -static int need_value (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) { - Instruction i = *getjumpcontrol(fs, list); - if (GET_OPCODE(i) != OP_TESTSET) return 1; - } - return 0; /* not found */ -} - - -static int patchtestreg (FuncState *fs, int node, int reg) { - Instruction *i = getjumpcontrol(fs, node); - if (GET_OPCODE(*i) != OP_TESTSET) - return 0; /* cannot patch other instructions */ - if (reg != NO_REG && reg != GETARG_B(*i)) - SETARG_A(*i, reg); - else /* no register to put value or register already has the value */ - *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); - - return 1; -} - - -static void removevalues (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) - patchtestreg(fs, list, NO_REG); -} - - -static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, - int dtarget) { - while (list != NO_JUMP) { - int next = getjump(fs, list); - if (patchtestreg(fs, list, reg)) - fixjump(fs, list, vtarget); - else - fixjump(fs, list, dtarget); /* jump to default target */ - list = next; - } -} - - -static void dischargejpc (FuncState *fs) { - patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); - fs->jpc = NO_JUMP; -} - - -void luaK_patchlist (FuncState *fs, int list, int target) { - if (target == fs->pc) - luaK_patchtohere(fs, list); - else { - lua_assert(target < fs->pc); - patchlistaux(fs, list, target, NO_REG, target); - } -} - - -void luaK_patchtohere (FuncState *fs, int list) { - luaK_getlabel(fs); - luaK_concat(fs, &fs->jpc, list); -} - - -void luaK_concat (FuncState *fs, int *l1, int l2) { - if (l2 == NO_JUMP) return; - else if (*l1 == NO_JUMP) - *l1 = l2; - else { - int list = *l1; - int next; - while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ - list = next; - fixjump(fs, list, l2); - } -} - - -void luaK_checkstack (FuncState *fs, int n) { - int newstack = fs->freereg + n; - if (newstack > fs->f->maxstacksize) { - if (newstack >= MAXSTACK) - luaX_syntaxerror(fs->ls, "function or expression too complex"); - fs->f->maxstacksize = cast_byte(newstack); - } -} - - -void luaK_reserveregs (FuncState *fs, int n) { - luaK_checkstack(fs, n); - fs->freereg += n; -} - - -static void freereg (FuncState *fs, int reg) { - if (!ISK(reg) && reg >= fs->nactvar) { - fs->freereg--; - lua_assert(reg == fs->freereg); - } -} - - -static void freeexp (FuncState *fs, expdesc *e) { - if (e->k == VNONRELOC) - freereg(fs, e->u.s.info); -} - - -static int addk (FuncState *fs, TValue *k, TValue *v) { - lua_State *L = fs->L; - TValue *idx = luaH_set(L, fs->h, k); - Proto *f = fs->f; - int oldsize = f->sizek; - if (ttisnumber(idx)) { - lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); - return cast_int(nvalue(idx)); - } - else { /* constant not found; create a new entry */ - setnvalue(idx, cast_num(fs->nk)); - luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, - MAXARG_Bx, "constant table overflow"); - while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); - setobj(L, &f->k[fs->nk], v); - luaC_barrier(L, f, v); - return fs->nk++; - } -} - - -int luaK_stringK (FuncState *fs, TString *s) { - TValue o; - setsvalue(fs->L, &o, s); - return addk(fs, &o, &o); -} - - -int luaK_numberK (FuncState *fs, lua_Number r) { - TValue o; - setnvalue(&o, r); - return addk(fs, &o, &o); -} - - -static int boolK (FuncState *fs, int b) { - TValue o; - setbvalue(&o, b); - return addk(fs, &o, &o); -} - - -static int nilK (FuncState *fs) { - TValue k, v; - setnilvalue(&v); - /* cannot use nil as key; instead use table itself to represent nil */ - sethvalue(fs->L, &k, fs->h); - return addk(fs, &k, &v); -} - - -void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { - if (e->k == VCALL) { /* expression is an open function call? */ - SETARG_C(getcode(fs, e), nresults+1); - } - else if (e->k == VVARARG) { - SETARG_B(getcode(fs, e), nresults+1); - SETARG_A(getcode(fs, e), fs->freereg); - luaK_reserveregs(fs, 1); - } -} - - -void luaK_setoneret (FuncState *fs, expdesc *e) { - if (e->k == VCALL) { /* expression is an open function call? */ - e->k = VNONRELOC; - e->u.s.info = GETARG_A(getcode(fs, e)); - } - else if (e->k == VVARARG) { - SETARG_B(getcode(fs, e), 2); - e->k = VRELOCABLE; /* can relocate its simple result */ - } -} - - -void luaK_dischargevars (FuncState *fs, expdesc *e) { - switch (e->k) { - case VLOCAL: { - e->k = VNONRELOC; - break; - } - case VUPVAL: { - e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); - e->k = VRELOCABLE; - break; - } - case VGLOBAL: { - e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); - e->k = VRELOCABLE; - break; - } - case VINDEXED: { - freereg(fs, e->u.s.aux); - freereg(fs, e->u.s.info); - e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); - e->k = VRELOCABLE; - break; - } - case VVARARG: - case VCALL: { - luaK_setoneret(fs, e); - break; - } - default: break; /* there is one value available (somewhere) */ - } -} - - -static int code_label (FuncState *fs, int A, int b, int jump) { - luaK_getlabel(fs); /* those instructions may be jump targets */ - return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); -} - - -static void discharge2reg (FuncState *fs, expdesc *e, int reg) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: { - luaK_nil(fs, reg, 1); - break; - } - case VFALSE: case VTRUE: { - luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); - break; - } - case VK: { - luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); - break; - } - case VKNUM: { - luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); - break; - } - case VRELOCABLE: { - Instruction *pc = &getcode(fs, e); - SETARG_A(*pc, reg); - break; - } - case VNONRELOC: { - if (reg != e->u.s.info) - luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); - break; - } - default: { - lua_assert(e->k == VVOID || e->k == VJMP); - return; /* nothing to do... */ - } - } - e->u.s.info = reg; - e->k = VNONRELOC; -} - - -static void discharge2anyreg (FuncState *fs, expdesc *e) { - if (e->k != VNONRELOC) { - luaK_reserveregs(fs, 1); - discharge2reg(fs, e, fs->freereg-1); - } -} - - -static void exp2reg (FuncState *fs, expdesc *e, int reg) { - discharge2reg(fs, e, reg); - if (e->k == VJMP) - luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ - if (hasjumps(e)) { - int final; /* position after whole expression */ - int p_f = NO_JUMP; /* position of an eventual LOAD false */ - int p_t = NO_JUMP; /* position of an eventual LOAD true */ - if (need_value(fs, e->t) || need_value(fs, e->f)) { - int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); - p_f = code_label(fs, reg, 0, 1); - p_t = code_label(fs, reg, 1, 0); - luaK_patchtohere(fs, fj); - } - final = luaK_getlabel(fs); - patchlistaux(fs, e->f, final, reg, p_f); - patchlistaux(fs, e->t, final, reg, p_t); - } - e->f = e->t = NO_JUMP; - e->u.s.info = reg; - e->k = VNONRELOC; -} - - -void luaK_exp2nextreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - freeexp(fs, e); - luaK_reserveregs(fs, 1); - exp2reg(fs, e, fs->freereg - 1); -} - - -int luaK_exp2anyreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - if (e->k == VNONRELOC) { - if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ - if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ - exp2reg(fs, e, e->u.s.info); /* put value on it */ - return e->u.s.info; - } - } - luaK_exp2nextreg(fs, e); /* default */ - return e->u.s.info; -} - - -void luaK_exp2val (FuncState *fs, expdesc *e) { - if (hasjumps(e)) - luaK_exp2anyreg(fs, e); - else - luaK_dischargevars(fs, e); -} - - -int luaK_exp2RK (FuncState *fs, expdesc *e) { - luaK_exp2val(fs, e); - switch (e->k) { - case VKNUM: - case VTRUE: - case VFALSE: - case VNIL: { - if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ - e->u.s.info = (e->k == VNIL) ? nilK(fs) : - (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : - boolK(fs, (e->k == VTRUE)); - e->k = VK; - return RKASK(e->u.s.info); - } - else break; - } - case VK: { - if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ - return RKASK(e->u.s.info); - else break; - } - default: break; - } - /* not a constant in the right range: put it in a register */ - return luaK_exp2anyreg(fs, e); -} - - -void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { - switch (var->k) { - case VLOCAL: { - freeexp(fs, ex); - exp2reg(fs, ex, var->u.s.info); - return; - } - case VUPVAL: { - int e = luaK_exp2anyreg(fs, ex); - luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); - break; - } - case VGLOBAL: { - int e = luaK_exp2anyreg(fs, ex); - luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); - break; - } - case VINDEXED: { - int e = luaK_exp2RK(fs, ex); - luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); - break; - } - default: { - lua_assert(0); /* invalid var kind to store */ - break; - } - } - freeexp(fs, ex); -} - - -void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { - int func; - luaK_exp2anyreg(fs, e); - freeexp(fs, e); - func = fs->freereg; - luaK_reserveregs(fs, 2); - luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); - freeexp(fs, key); - e->u.s.info = func; - e->k = VNONRELOC; -} - - -static void invertjump (FuncState *fs, expdesc *e) { - Instruction *pc = getjumpcontrol(fs, e->u.s.info); - lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && - GET_OPCODE(*pc) != OP_TEST); - SETARG_A(*pc, !(GETARG_A(*pc))); -} - - -static int jumponcond (FuncState *fs, expdesc *e, int cond) { - if (e->k == VRELOCABLE) { - Instruction ie = getcode(fs, e); - if (GET_OPCODE(ie) == OP_NOT) { - fs->pc--; /* remove previous OP_NOT */ - return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); - } - /* else go through */ - } - discharge2anyreg(fs, e); - freeexp(fs, e); - return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); -} - - -void luaK_goiftrue (FuncState *fs, expdesc *e) { - int pc; /* pc of last jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VK: case VKNUM: case VTRUE: { - pc = NO_JUMP; /* always true; do nothing */ - break; - } - case VJMP: { - invertjump(fs, e); - pc = e->u.s.info; - break; - } - default: { - pc = jumponcond(fs, e, 0); - break; - } - } - luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ - luaK_patchtohere(fs, e->t); - e->t = NO_JUMP; -} - - -static void luaK_goiffalse (FuncState *fs, expdesc *e) { - int pc; /* pc of last jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: case VFALSE: { - pc = NO_JUMP; /* always false; do nothing */ - break; - } - case VJMP: { - pc = e->u.s.info; - break; - } - default: { - pc = jumponcond(fs, e, 1); - break; - } - } - luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ - luaK_patchtohere(fs, e->f); - e->f = NO_JUMP; -} - - -static void codenot (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: case VFALSE: { - e->k = VTRUE; - break; - } - case VK: case VKNUM: case VTRUE: { - e->k = VFALSE; - break; - } - case VJMP: { - invertjump(fs, e); - break; - } - case VRELOCABLE: - case VNONRELOC: { - discharge2anyreg(fs, e); - freeexp(fs, e); - e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); - e->k = VRELOCABLE; - break; - } - default: { - lua_assert(0); /* cannot happen */ - break; - } - } - /* interchange true and false lists */ - { int temp = e->f; e->f = e->t; e->t = temp; } - removevalues(fs, e->f); - removevalues(fs, e->t); -} - - -void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { - t->u.s.aux = luaK_exp2RK(fs, k); - t->k = VINDEXED; -} - - -static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { - lua_Number v1, v2, r; - if (!isnumeral(e1) || !isnumeral(e2)) return 0; - v1 = e1->u.nval; - v2 = e2->u.nval; - switch (op) { - case OP_ADD: r = luai_numadd(v1, v2); break; - case OP_SUB: r = luai_numsub(v1, v2); break; - case OP_MUL: r = luai_nummul(v1, v2); break; - case OP_DIV: - if (v2 == 0) return 0; /* do not attempt to divide by 0 */ - r = luai_numdiv(v1, v2); break; - case OP_MOD: - if (v2 == 0) return 0; /* do not attempt to divide by 0 */ - r = luai_nummod(v1, v2); break; - case OP_POW: r = luai_numpow(v1, v2); break; - case OP_UNM: r = luai_numunm(v1); break; - case OP_LEN: return 0; /* no constant folding for 'len' */ - default: lua_assert(0); r = 0; break; - } - if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ - e1->u.nval = r; - return 1; -} - - -static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { - if (constfolding(op, e1, e2)) - return; - else { - int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; - int o1 = luaK_exp2RK(fs, e1); - if (o1 > o2) { - freeexp(fs, e1); - freeexp(fs, e2); - } - else { - freeexp(fs, e2); - freeexp(fs, e1); - } - e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); - e1->k = VRELOCABLE; - } -} - - -static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, - expdesc *e2) { - int o1 = luaK_exp2RK(fs, e1); - int o2 = luaK_exp2RK(fs, e2); - freeexp(fs, e2); - freeexp(fs, e1); - if (cond == 0 && op != OP_EQ) { - int temp; /* exchange args to replace by `<' or `<=' */ - temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ - cond = 1; - } - e1->u.s.info = condjump(fs, op, cond, o1, o2); - e1->k = VJMP; -} - - -void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { - expdesc e2; - e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; - switch (op) { - case OPR_MINUS: { - if (!isnumeral(e)) - luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ - codearith(fs, OP_UNM, e, &e2); - break; - } - case OPR_NOT: codenot(fs, e); break; - case OPR_LEN: { - luaK_exp2anyreg(fs, e); /* cannot operate on constants */ - codearith(fs, OP_LEN, e, &e2); - break; - } - default: lua_assert(0); - } -} - - -void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { - switch (op) { - case OPR_AND: { - luaK_goiftrue(fs, v); - break; - } - case OPR_OR: { - luaK_goiffalse(fs, v); - break; - } - case OPR_CONCAT: { - luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ - break; - } - case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: - case OPR_MOD: case OPR_POW: { - if (!isnumeral(v)) luaK_exp2RK(fs, v); - break; - } - default: { - luaK_exp2RK(fs, v); - break; - } - } -} - - -void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { - switch (op) { - case OPR_AND: { - lua_assert(e1->t == NO_JUMP); /* list must be closed */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->f, e1->f); - *e1 = *e2; - break; - } - case OPR_OR: { - lua_assert(e1->f == NO_JUMP); /* list must be closed */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->t, e1->t); - *e1 = *e2; - break; - } - case OPR_CONCAT: { - luaK_exp2val(fs, e2); - if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { - lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); - freeexp(fs, e1); - SETARG_B(getcode(fs, e2), e1->u.s.info); - e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; - } - else { - luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ - codearith(fs, OP_CONCAT, e1, e2); - } - break; - } - case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; - case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; - case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; - case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; - case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; - case OPR_POW: codearith(fs, OP_POW, e1, e2); break; - case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; - case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; - case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; - case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; - case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; - case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; - default: lua_assert(0); - } -} - - -void luaK_fixline (FuncState *fs, int line) { - fs->f->lineinfo[fs->pc - 1] = line; -} - - -static int luaK_code (FuncState *fs, Instruction i, int line) { - Proto *f = fs->f; - dischargejpc(fs); /* `pc' will change */ - /* put new instruction in code array */ - luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, - MAX_INT, "code size overflow"); - f->code[fs->pc] = i; - /* save corresponding line information */ - luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, - MAX_INT, "code size overflow"); - f->lineinfo[fs->pc] = line; - return fs->pc++; -} - - -int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { - lua_assert(getOpMode(o) == iABC); - lua_assert(getBMode(o) != OpArgN || b == 0); - lua_assert(getCMode(o) != OpArgN || c == 0); - return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); -} - - -int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { - lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); - lua_assert(getCMode(o) == OpArgN); - return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); -} - - -void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { - int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; - int b = (tostore == LUA_MULTRET) ? 0 : tostore; - lua_assert(tostore != 0); - if (c <= MAXARG_C) - luaK_codeABC(fs, OP_SETLIST, base, b, c); - else { - luaK_codeABC(fs, OP_SETLIST, base, b, 0); - luaK_code(fs, cast(Instruction, c), fs->ls->lastline); - } - fs->freereg = base + 1; /* free registers with list values */ -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lcode.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lcode.h deleted file mode 100644 index b941c607..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lcode.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lcode_h -#define lcode_h - -#include "llex.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" - - -/* -** Marks the end of a patch list. It is an invalid value both as an absolute -** address, and as a list link (would link an element to itself). -*/ -#define NO_JUMP (-1) - - -/* -** grep "ORDER OPR" if you change these enums -*/ -typedef enum BinOpr { - OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, - OPR_CONCAT, - OPR_NE, OPR_EQ, - OPR_LT, OPR_LE, OPR_GT, OPR_GE, - OPR_AND, OPR_OR, - OPR_NOBINOPR -} BinOpr; - - -typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; - - -#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) - -#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) - -#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) - -LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); -LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); -LUAI_FUNC void luaK_fixline (FuncState *fs, int line); -LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); -LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); -LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); -LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); -LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); -LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); -LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); -LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); -LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); -LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_jump (FuncState *fs); -LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); -LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); -LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); -LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); -LUAI_FUNC int luaK_getlabel (FuncState *fs); -LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); -LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); -LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); -LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldblib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldblib.c deleted file mode 100644 index 2027eda5..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldblib.c +++ /dev/null @@ -1,398 +0,0 @@ -/* -** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $ -** Interface from Lua to its debug API -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include - -#define ldblib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - -static int db_getregistry (lua_State *L) { - lua_pushvalue(L, LUA_REGISTRYINDEX); - return 1; -} - - -static int db_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); /* no metatable */ - } - return 1; -} - - -static int db_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - lua_settop(L, 2); - lua_pushboolean(L, lua_setmetatable(L, 1)); - return 1; -} - - -static int db_getfenv (lua_State *L) { - luaL_checkany(L, 1); - lua_getfenv(L, 1); - return 1; -} - - -static int db_setfenv (lua_State *L) { - luaL_checktype(L, 2, LUA_TTABLE); - lua_settop(L, 2); - if (lua_setfenv(L, 1) == 0) - luaL_error(L, LUA_QL("setfenv") - " cannot change environment of given object"); - return 1; -} - - -static void settabss (lua_State *L, const char *i, const char *v) { - lua_pushstring(L, v); - lua_setfield(L, -2, i); -} - - -static void settabsi (lua_State *L, const char *i, int v) { - lua_pushinteger(L, v); - lua_setfield(L, -2, i); -} - - -static lua_State *getthread (lua_State *L, int *arg) { - if (lua_isthread(L, 1)) { - *arg = 1; - return lua_tothread(L, 1); - } - else { - *arg = 0; - return L; - } -} - - -static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { - if (L == L1) { - lua_pushvalue(L, -2); - lua_remove(L, -3); - } - else - lua_xmove(L1, L, 1); - lua_setfield(L, -2, fname); -} - - -static int db_getinfo (lua_State *L) { - lua_Debug ar; - int arg; - lua_State *L1 = getthread(L, &arg); - const char *options = luaL_optstring(L, arg+2, "flnSu"); - if (lua_isnumber(L, arg+1)) { - if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { - lua_pushnil(L); /* level out of range */ - return 1; - } - } - else if (lua_isfunction(L, arg+1)) { - lua_pushfstring(L, ">%s", options); - options = lua_tostring(L, -1); - lua_pushvalue(L, arg+1); - lua_xmove(L, L1, 1); - } - else - return luaL_argerror(L, arg+1, "function or level expected"); - if (!lua_getinfo(L1, options, &ar)) - return luaL_argerror(L, arg+2, "invalid option"); - lua_createtable(L, 0, 2); - if (strchr(options, 'S')) { - settabss(L, "source", ar.source); - settabss(L, "short_src", ar.short_src); - settabsi(L, "linedefined", ar.linedefined); - settabsi(L, "lastlinedefined", ar.lastlinedefined); - settabss(L, "what", ar.what); - } - if (strchr(options, 'l')) - settabsi(L, "currentline", ar.currentline); - if (strchr(options, 'u')) - settabsi(L, "nups", ar.nups); - if (strchr(options, 'n')) { - settabss(L, "name", ar.name); - settabss(L, "namewhat", ar.namewhat); - } - if (strchr(options, 'L')) - treatstackoption(L, L1, "activelines"); - if (strchr(options, 'f')) - treatstackoption(L, L1, "func"); - return 1; /* return table */ -} - - -static int db_getlocal (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - const char *name; - if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ - return luaL_argerror(L, arg+1, "level out of range"); - name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); - if (name) { - lua_xmove(L1, L, 1); - lua_pushstring(L, name); - lua_pushvalue(L, -2); - return 2; - } - else { - lua_pushnil(L); - return 1; - } -} - - -static int db_setlocal (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ - return luaL_argerror(L, arg+1, "level out of range"); - luaL_checkany(L, arg+3); - lua_settop(L, arg+3); - lua_xmove(L, L1, 1); - lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); - return 1; -} - - -static int auxupvalue (lua_State *L, int get) { - const char *name; - int n = luaL_checkint(L, 2); - luaL_checktype(L, 1, LUA_TFUNCTION); - if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ - name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); - if (name == NULL) return 0; - lua_pushstring(L, name); - lua_insert(L, -(get+1)); - return get + 1; -} - - -static int db_getupvalue (lua_State *L) { - return auxupvalue(L, 1); -} - - -static int db_setupvalue (lua_State *L) { - luaL_checkany(L, 3); - return auxupvalue(L, 0); -} - - - -static const char KEY_HOOK = 'h'; - - -static void hookf (lua_State *L, lua_Debug *ar) { - static const char *const hooknames[] = - {"call", "return", "line", "count", "tail return"}; - lua_pushlightuserdata(L, (void *)&KEY_HOOK); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_pushlightuserdata(L, L); - lua_rawget(L, -2); - if (lua_isfunction(L, -1)) { - lua_pushstring(L, hooknames[(int)ar->event]); - if (ar->currentline >= 0) - lua_pushinteger(L, ar->currentline); - else lua_pushnil(L); - lua_assert(lua_getinfo(L, "lS", ar)); - lua_call(L, 2, 0); - } -} - - -static int makemask (const char *smask, int count) { - int mask = 0; - if (strchr(smask, 'c')) mask |= LUA_MASKCALL; - if (strchr(smask, 'r')) mask |= LUA_MASKRET; - if (strchr(smask, 'l')) mask |= LUA_MASKLINE; - if (count > 0) mask |= LUA_MASKCOUNT; - return mask; -} - - -static char *unmakemask (int mask, char *smask) { - int i = 0; - if (mask & LUA_MASKCALL) smask[i++] = 'c'; - if (mask & LUA_MASKRET) smask[i++] = 'r'; - if (mask & LUA_MASKLINE) smask[i++] = 'l'; - smask[i] = '\0'; - return smask; -} - - -static void gethooktable (lua_State *L) { - lua_pushlightuserdata(L, (void *)&KEY_HOOK); - lua_rawget(L, LUA_REGISTRYINDEX); - if (!lua_istable(L, -1)) { - lua_pop(L, 1); - lua_createtable(L, 0, 1); - lua_pushlightuserdata(L, (void *)&KEY_HOOK); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_REGISTRYINDEX); - } -} - - -static int db_sethook (lua_State *L) { - int arg, mask, count; - lua_Hook func; - lua_State *L1 = getthread(L, &arg); - if (lua_isnoneornil(L, arg+1)) { - lua_settop(L, arg+1); - func = NULL; mask = 0; count = 0; /* turn off hooks */ - } - else { - const char *smask = luaL_checkstring(L, arg+2); - luaL_checktype(L, arg+1, LUA_TFUNCTION); - count = luaL_optint(L, arg+3, 0); - func = hookf; mask = makemask(smask, count); - } - gethooktable(L); - lua_pushlightuserdata(L, L1); - lua_pushvalue(L, arg+1); - lua_rawset(L, -3); /* set new hook */ - lua_pop(L, 1); /* remove hook table */ - lua_sethook(L1, func, mask, count); /* set hooks */ - return 0; -} - - -static int db_gethook (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - char buff[5]; - int mask = lua_gethookmask(L1); - lua_Hook hook = lua_gethook(L1); - if (hook != NULL && hook != hookf) /* external hook? */ - lua_pushliteral(L, "external hook"); - else { - gethooktable(L); - lua_pushlightuserdata(L, L1); - lua_rawget(L, -2); /* get hook */ - lua_remove(L, -2); /* remove hook table */ - } - lua_pushstring(L, unmakemask(mask, buff)); - lua_pushinteger(L, lua_gethookcount(L1)); - return 3; -} - - -static int db_debug (lua_State *L) { - for (;;) { - char buffer[250]; - fputs("lua_debug> ", stderr); - if (fgets(buffer, sizeof(buffer), stdin) == 0 || - strcmp(buffer, "cont\n") == 0) - return 0; - if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || - lua_pcall(L, 0, 0, 0)) { - fputs(lua_tostring(L, -1), stderr); - fputs("\n", stderr); - } - lua_settop(L, 0); /* remove eventual returns */ - } -} - - -#define LEVELS1 12 /* size of the first part of the stack */ -#define LEVELS2 10 /* size of the second part of the stack */ - -static int db_errorfb (lua_State *L) { - int level; - int firstpart = 1; /* still before eventual `...' */ - int arg; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - if (lua_isnumber(L, arg+2)) { - level = (int)lua_tointeger(L, arg+2); - lua_pop(L, 1); - } - else - level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ - if (lua_gettop(L) == arg) - lua_pushliteral(L, ""); - else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ - else lua_pushliteral(L, "\n"); - lua_pushliteral(L, "stack traceback:"); - while (lua_getstack(L1, level++, &ar)) { - if (level > LEVELS1 && firstpart) { - /* no more than `LEVELS2' more levels? */ - if (!lua_getstack(L1, level+LEVELS2, &ar)) - level--; /* keep going */ - else { - lua_pushliteral(L, "\n\t..."); /* too many levels */ - while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ - level++; - } - firstpart = 0; - continue; - } - lua_pushliteral(L, "\n\t"); - lua_getinfo(L1, "Snl", &ar); - lua_pushfstring(L, "%s:", ar.short_src); - if (ar.currentline > 0) - lua_pushfstring(L, "%d:", ar.currentline); - if (*ar.namewhat != '\0') /* is there a name? */ - lua_pushfstring(L, " in function " LUA_QS, ar.name); - else { - if (*ar.what == 'm') /* main? */ - lua_pushfstring(L, " in main chunk"); - else if (*ar.what == 'C' || *ar.what == 't') - lua_pushliteral(L, " ?"); /* C function or tail call */ - else - lua_pushfstring(L, " in function <%s:%d>", - ar.short_src, ar.linedefined); - } - lua_concat(L, lua_gettop(L) - arg); - } - lua_concat(L, lua_gettop(L) - arg); - return 1; -} - - -static const luaL_Reg dblib[] = { - {"debug", db_debug}, - {"getfenv", db_getfenv}, - {"gethook", db_gethook}, - {"getinfo", db_getinfo}, - {"getlocal", db_getlocal}, - {"getregistry", db_getregistry}, - {"getmetatable", db_getmetatable}, - {"getupvalue", db_getupvalue}, - {"setfenv", db_setfenv}, - {"sethook", db_sethook}, - {"setlocal", db_setlocal}, - {"setmetatable", db_setmetatable}, - {"setupvalue", db_setupvalue}, - {"traceback", db_errorfb}, - {NULL, NULL} -}; - - -LUALIB_API int luaopen_debug (lua_State *L) { - luaL_register(L, LUA_DBLIBNAME, dblib); - return 1; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldebug.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldebug.c deleted file mode 100644 index 50ad3d38..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldebug.c +++ /dev/null @@ -1,638 +0,0 @@ -/* -** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ -** Debug Interface -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include - - -#define ldebug_c -#define LUA_CORE - -#include "lua.h" - -#include "lapi.h" -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - - -static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); - - -static int currentpc (lua_State *L, CallInfo *ci) { - if (!isLua(ci)) return -1; /* function is not a Lua function? */ - if (ci == L->ci) - ci->savedpc = L->savedpc; - return pcRel(ci->savedpc, ci_func(ci)->l.p); -} - - -static int currentline (lua_State *L, CallInfo *ci) { - int pc = currentpc(L, ci); - if (pc < 0) - return -1; /* only active lua functions have current-line information */ - else - return getline(ci_func(ci)->l.p, pc); -} - - -/* -** this function can be called asynchronous (e.g. during a signal) -*/ -LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { - if (func == NULL || mask == 0) { /* turn off hooks? */ - mask = 0; - func = NULL; - } - L->hook = func; - L->basehookcount = count; - resethookcount(L); - L->hookmask = cast_byte(mask); - return 1; -} - - -LUA_API lua_Hook lua_gethook (lua_State *L) { - return L->hook; -} - - -LUA_API int lua_gethookmask (lua_State *L) { - return L->hookmask; -} - - -LUA_API int lua_gethookcount (lua_State *L) { - return L->basehookcount; -} - - -LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { - int status; - CallInfo *ci; - lua_lock(L); - for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { - level--; - if (f_isLua(ci)) /* Lua function? */ - level -= ci->tailcalls; /* skip lost tail calls */ - } - if (level == 0 && ci > L->base_ci) { /* level found? */ - status = 1; - ar->i_ci = cast_int(ci - L->base_ci); - } - else if (level < 0) { /* level is of a lost tail call? */ - status = 1; - ar->i_ci = 0; - } - else status = 0; /* no such level */ - lua_unlock(L); - return status; -} - - -static Proto *getluaproto (CallInfo *ci) { - return (isLua(ci) ? ci_func(ci)->l.p : NULL); -} - - -static const char *findlocal (lua_State *L, CallInfo *ci, int n) { - const char *name; - Proto *fp = getluaproto(ci); - if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) - return name; /* is a local variable in a Lua function */ - else { - StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; - if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ - return "(*temporary)"; - else - return NULL; - } -} - - -LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { - CallInfo *ci = L->base_ci + ar->i_ci; - const char *name = findlocal(L, ci, n); - lua_lock(L); - if (name) - luaA_pushobject(L, ci->base + (n - 1)); - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { - CallInfo *ci = L->base_ci + ar->i_ci; - const char *name = findlocal(L, ci, n); - lua_lock(L); - if (name) - setobjs2s(L, ci->base + (n - 1), L->top - 1); - L->top--; /* pop value */ - lua_unlock(L); - return name; -} - - -static void funcinfo (lua_Debug *ar, Closure *cl) { - if (cl->c.isC) { - ar->source = "=[C]"; - ar->linedefined = -1; - ar->lastlinedefined = -1; - ar->what = "C"; - } - else { - ar->source = getstr(cl->l.p->source); - ar->linedefined = cl->l.p->linedefined; - ar->lastlinedefined = cl->l.p->lastlinedefined; - ar->what = (ar->linedefined == 0) ? "main" : "Lua"; - } - luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); -} - - -static void info_tailcall (lua_Debug *ar) { - ar->name = ar->namewhat = ""; - ar->what = "tail"; - ar->lastlinedefined = ar->linedefined = ar->currentline = -1; - ar->source = "=(tail call)"; - luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); - ar->nups = 0; -} - - -static void collectvalidlines (lua_State *L, Closure *f) { - if (f == NULL || f->c.isC) { - setnilvalue(L->top); - } - else { - Table *t = luaH_new(L, 0, 0); - int *lineinfo = f->l.p->lineinfo; - int i; - for (i=0; il.p->sizelineinfo; i++) - setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); - sethvalue(L, L->top, t); - } - incr_top(L); -} - - -static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, - Closure *f, CallInfo *ci) { - int status = 1; - if (f == NULL) { - info_tailcall(ar); - return status; - } - for (; *what; what++) { - switch (*what) { - case 'S': { - funcinfo(ar, f); - break; - } - case 'l': { - ar->currentline = (ci) ? currentline(L, ci) : -1; - break; - } - case 'u': { - ar->nups = f->c.nupvalues; - break; - } - case 'n': { - ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; - if (ar->namewhat == NULL) { - ar->namewhat = ""; /* not found */ - ar->name = NULL; - } - break; - } - case 'L': - case 'f': /* handled by lua_getinfo */ - break; - default: status = 0; /* invalid option */ - } - } - return status; -} - - -LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { - int status; - Closure *f = NULL; - CallInfo *ci = NULL; - lua_lock(L); - if (*what == '>') { - StkId func = L->top - 1; - luai_apicheck(L, ttisfunction(func)); - what++; /* skip the '>' */ - f = clvalue(func); - L->top--; /* pop function */ - } - else if (ar->i_ci != 0) { /* no tail call? */ - ci = L->base_ci + ar->i_ci; - lua_assert(ttisfunction(ci->func)); - f = clvalue(ci->func); - } - status = auxgetinfo(L, what, ar, f, ci); - if (strchr(what, 'f')) { - if (f == NULL) setnilvalue(L->top); - else setclvalue(L, L->top, f); - incr_top(L); - } - if (strchr(what, 'L')) - collectvalidlines(L, f); - lua_unlock(L); - return status; -} - - -/* -** {====================================================== -** Symbolic Execution and code checker -** ======================================================= -*/ - -#define check(x) if (!(x)) return 0; - -#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) - -#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) - - - -static int precheck (const Proto *pt) { - check(pt->maxstacksize <= MAXSTACK); - check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); - check(!(pt->is_vararg & VARARG_NEEDSARG) || - (pt->is_vararg & VARARG_HASARG)); - check(pt->sizeupvalues <= pt->nups); - check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); - check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); - return 1; -} - - -#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) - -int luaG_checkopenop (Instruction i) { - switch (GET_OPCODE(i)) { - case OP_CALL: - case OP_TAILCALL: - case OP_RETURN: - case OP_SETLIST: { - check(GETARG_B(i) == 0); - return 1; - } - default: return 0; /* invalid instruction after an open call */ - } -} - - -static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { - switch (mode) { - case OpArgN: check(r == 0); break; - case OpArgU: break; - case OpArgR: checkreg(pt, r); break; - case OpArgK: - check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); - break; - } - return 1; -} - - -static Instruction symbexec (const Proto *pt, int lastpc, int reg) { - int pc; - int last; /* stores position of last instruction that changed `reg' */ - last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ - check(precheck(pt)); - for (pc = 0; pc < lastpc; pc++) { - Instruction i = pt->code[pc]; - OpCode op = GET_OPCODE(i); - int a = GETARG_A(i); - int b = 0; - int c = 0; - check(op < NUM_OPCODES); - checkreg(pt, a); - switch (getOpMode(op)) { - case iABC: { - b = GETARG_B(i); - c = GETARG_C(i); - check(checkArgMode(pt, b, getBMode(op))); - check(checkArgMode(pt, c, getCMode(op))); - break; - } - case iABx: { - b = GETARG_Bx(i); - if (getBMode(op) == OpArgK) check(b < pt->sizek); - break; - } - case iAsBx: { - b = GETARG_sBx(i); - if (getBMode(op) == OpArgR) { - int dest = pc+1+b; - check(0 <= dest && dest < pt->sizecode); - if (dest > 0) { - int j; - /* check that it does not jump to a setlist count; this - is tricky, because the count from a previous setlist may - have the same value of an invalid setlist; so, we must - go all the way back to the first of them (if any) */ - for (j = 0; j < dest; j++) { - Instruction d = pt->code[dest-1-j]; - if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; - } - /* if 'j' is even, previous value is not a setlist (even if - it looks like one) */ - check((j&1) == 0); - } - } - break; - } - } - if (testAMode(op)) { - if (a == reg) last = pc; /* change register `a' */ - } - if (testTMode(op)) { - check(pc+2 < pt->sizecode); /* check skip */ - check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); - } - switch (op) { - case OP_LOADBOOL: { - if (c == 1) { /* does it jump? */ - check(pc+2 < pt->sizecode); /* check its jump */ - check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || - GETARG_C(pt->code[pc+1]) != 0); - } - break; - } - case OP_LOADNIL: { - if (a <= reg && reg <= b) - last = pc; /* set registers from `a' to `b' */ - break; - } - case OP_GETUPVAL: - case OP_SETUPVAL: { - check(b < pt->nups); - break; - } - case OP_GETGLOBAL: - case OP_SETGLOBAL: { - check(ttisstring(&pt->k[b])); - break; - } - case OP_SELF: { - checkreg(pt, a+1); - if (reg == a+1) last = pc; - break; - } - case OP_CONCAT: { - check(b < c); /* at least two operands */ - break; - } - case OP_TFORLOOP: { - check(c >= 1); /* at least one result (control variable) */ - checkreg(pt, a+2+c); /* space for results */ - if (reg >= a+2) last = pc; /* affect all regs above its base */ - break; - } - case OP_FORLOOP: - case OP_FORPREP: - checkreg(pt, a+3); - /* go through */ - case OP_JMP: { - int dest = pc+1+b; - /* not full check and jump is forward and do not skip `lastpc'? */ - if (reg != NO_REG && pc < dest && dest <= lastpc) - pc += b; /* do the jump */ - break; - } - case OP_CALL: - case OP_TAILCALL: { - if (b != 0) { - checkreg(pt, a+b-1); - } - c--; /* c = num. returns */ - if (c == LUA_MULTRET) { - check(checkopenop(pt, pc)); - } - else if (c != 0) - checkreg(pt, a+c-1); - if (reg >= a) last = pc; /* affect all registers above base */ - break; - } - case OP_RETURN: { - b--; /* b = num. returns */ - if (b > 0) checkreg(pt, a+b-1); - break; - } - case OP_SETLIST: { - if (b > 0) checkreg(pt, a + b); - if (c == 0) { - pc++; - check(pc < pt->sizecode - 1); - } - break; - } - case OP_CLOSURE: { - int nup, j; - check(b < pt->sizep); - nup = pt->p[b]->nups; - check(pc + nup < pt->sizecode); - for (j = 1; j <= nup; j++) { - OpCode op1 = GET_OPCODE(pt->code[pc + j]); - check(op1 == OP_GETUPVAL || op1 == OP_MOVE); - } - if (reg != NO_REG) /* tracing? */ - pc += nup; /* do not 'execute' these pseudo-instructions */ - break; - } - case OP_VARARG: { - check((pt->is_vararg & VARARG_ISVARARG) && - !(pt->is_vararg & VARARG_NEEDSARG)); - b--; - if (b == LUA_MULTRET) check(checkopenop(pt, pc)); - checkreg(pt, a+b-1); - break; - } - default: break; - } - } - return pt->code[last]; -} - -#undef check -#undef checkjump -#undef checkreg - -/* }====================================================== */ - - -int luaG_checkcode (const Proto *pt) { - return (symbexec(pt, pt->sizecode, NO_REG) != 0); -} - - -static const char *kname (Proto *p, int c) { - if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) - return svalue(&p->k[INDEXK(c)]); - else - return "?"; -} - - -static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, - const char **name) { - if (isLua(ci)) { /* a Lua function? */ - Proto *p = ci_func(ci)->l.p; - int pc = currentpc(L, ci); - Instruction i; - *name = luaF_getlocalname(p, stackpos+1, pc); - if (*name) /* is a local? */ - return "local"; - i = symbexec(p, pc, stackpos); /* try symbolic execution */ - lua_assert(pc != -1); - switch (GET_OPCODE(i)) { - case OP_GETGLOBAL: { - int g = GETARG_Bx(i); /* global index */ - lua_assert(ttisstring(&p->k[g])); - *name = svalue(&p->k[g]); - return "global"; - } - case OP_MOVE: { - int a = GETARG_A(i); - int b = GETARG_B(i); /* move from `b' to `a' */ - if (b < a) - return getobjname(L, ci, b, name); /* get name for `b' */ - break; - } - case OP_GETTABLE: { - int k = GETARG_C(i); /* key index */ - *name = kname(p, k); - return "field"; - } - case OP_GETUPVAL: { - int u = GETARG_B(i); /* upvalue index */ - *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; - return "upvalue"; - } - case OP_SELF: { - int k = GETARG_C(i); /* key index */ - *name = kname(p, k); - return "method"; - } - default: break; - } - } - return NULL; /* no useful name found */ -} - - -static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { - Instruction i; - if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) - return NULL; /* calling function is not Lua (or is unknown) */ - ci--; /* calling function */ - i = ci_func(ci)->l.p->code[currentpc(L, ci)]; - if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || - GET_OPCODE(i) == OP_TFORLOOP) - return getobjname(L, ci, GETARG_A(i), name); - else - return NULL; /* no useful name can be found */ -} - - -/* only ANSI way to check whether a pointer points to an array */ -static int isinstack (CallInfo *ci, const TValue *o) { - StkId p; - for (p = ci->base; p < ci->top; p++) - if (o == p) return 1; - return 0; -} - - -void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { - const char *name = NULL; - const char *t = luaT_typenames[ttype(o)]; - const char *kind = (isinstack(L->ci, o)) ? - getobjname(L, L->ci, cast_int(o - L->base), &name) : - NULL; - if (kind) - luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", - op, kind, name, t); - else - luaG_runerror(L, "attempt to %s a %s value", op, t); -} - - -void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { - if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; - lua_assert(!ttisstring(p1) && !ttisnumber(p1)); - luaG_typeerror(L, p1, "concatenate"); -} - - -void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { - TValue temp; - if (luaV_tonumber(p1, &temp) == NULL) - p2 = p1; /* first operand is wrong */ - luaG_typeerror(L, p2, "perform arithmetic on"); -} - - -int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { - const char *t1 = luaT_typenames[ttype(p1)]; - const char *t2 = luaT_typenames[ttype(p2)]; - if (t1[2] == t2[2]) - luaG_runerror(L, "attempt to compare two %s values", t1); - else - luaG_runerror(L, "attempt to compare %s with %s", t1, t2); - return 0; -} - - -static void addinfo (lua_State *L, const char *msg) { - CallInfo *ci = L->ci; - if (isLua(ci)) { /* is Lua code? */ - char buff[LUA_IDSIZE]; /* add file:line information */ - int line = currentline(L, ci); - luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); - luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); - } -} - - -void luaG_errormsg (lua_State *L) { - if (L->errfunc != 0) { /* is there an error handling function? */ - StkId errfunc = restorestack(L, L->errfunc); - if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); - setobjs2s(L, L->top, L->top - 1); /* move argument */ - setobjs2s(L, L->top - 1, errfunc); /* push function */ - incr_top(L); - luaD_call(L, L->top - 2, 1); /* call it */ - } - luaD_throw(L, LUA_ERRRUN); -} - - -void luaG_runerror (lua_State *L, const char *fmt, ...) { - va_list argp; - va_start(argp, fmt); - addinfo(L, luaO_pushvfstring(L, fmt, argp)); - va_end(argp); - luaG_errormsg(L); -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldebug.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldebug.h deleted file mode 100644 index ba28a972..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldebug.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ -** Auxiliary functions from Debug Interface module -** See Copyright Notice in lua.h -*/ - -#ifndef ldebug_h -#define ldebug_h - - -#include "lstate.h" - - -#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) - -#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) - -#define resethookcount(L) (L->hookcount = L->basehookcount) - - -LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, - const char *opname); -LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); -LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); -LUAI_FUNC void luaG_errormsg (lua_State *L); -LUAI_FUNC int luaG_checkcode (const Proto *pt); -LUAI_FUNC int luaG_checkopenop (Instruction i); - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldo.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldo.c deleted file mode 100644 index d1bf786c..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldo.c +++ /dev/null @@ -1,519 +0,0 @@ -/* -** $Id: ldo.c,v 2.38.1.4 2012/01/18 02:27:10 roberto Exp $ -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include - -#define ldo_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" -#include "lzio.h" - - - - -/* -** {====================================================== -** Error-recovery functions -** ======================================================= -*/ - - -/* chain list of long jump buffers */ -struct lua_longjmp { - struct lua_longjmp *previous; - luai_jmpbuf b; - volatile int status; /* error code */ -}; - - -void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { - switch (errcode) { - case LUA_ERRMEM: { - setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); - break; - } - case LUA_ERRERR: { - setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); - break; - } - case LUA_ERRSYNTAX: - case LUA_ERRRUN: { - setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ - break; - } - } - L->top = oldtop + 1; -} - - -static void restore_stack_limit (lua_State *L) { - lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); - if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ - int inuse = cast_int(L->ci - L->base_ci); - if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ - luaD_reallocCI(L, LUAI_MAXCALLS); - } -} - - -static void resetstack (lua_State *L, int status) { - L->ci = L->base_ci; - L->base = L->ci->base; - luaF_close(L, L->base); /* close eventual pending closures */ - luaD_seterrorobj(L, status, L->base); - L->nCcalls = L->baseCcalls; - L->allowhook = 1; - restore_stack_limit(L); - L->errfunc = 0; - L->errorJmp = NULL; -} - - -void luaD_throw (lua_State *L, int errcode) { - if (L->errorJmp) { - L->errorJmp->status = errcode; - LUAI_THROW(L, L->errorJmp); - } - else { - L->status = cast_byte(errcode); - if (G(L)->panic) { - resetstack(L, errcode); - lua_unlock(L); - G(L)->panic(L); - } - exit(EXIT_FAILURE); - } -} - - -int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { - struct lua_longjmp lj; - lj.status = 0; - lj.previous = L->errorJmp; /* chain new error handler */ - L->errorJmp = &lj; - LUAI_TRY(L, &lj, - (*f)(L, ud); - ); - L->errorJmp = lj.previous; /* restore old error handler */ - return lj.status; -} - -/* }====================================================== */ - - -static void correctstack (lua_State *L, TValue *oldstack) { - CallInfo *ci; - GCObject *up; - L->top = (L->top - oldstack) + L->stack; - for (up = L->openupval; up != NULL; up = up->gch.next) - gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; - for (ci = L->base_ci; ci <= L->ci; ci++) { - ci->top = (ci->top - oldstack) + L->stack; - ci->base = (ci->base - oldstack) + L->stack; - ci->func = (ci->func - oldstack) + L->stack; - } - L->base = (L->base - oldstack) + L->stack; -} - - -void luaD_reallocstack (lua_State *L, int newsize) { - TValue *oldstack = L->stack; - int realsize = newsize + 1 + EXTRA_STACK; - lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); - luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); - L->stacksize = realsize; - L->stack_last = L->stack+newsize; - correctstack(L, oldstack); -} - - -void luaD_reallocCI (lua_State *L, int newsize) { - CallInfo *oldci = L->base_ci; - luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); - L->size_ci = newsize; - L->ci = (L->ci - oldci) + L->base_ci; - L->end_ci = L->base_ci + L->size_ci - 1; -} - - -void luaD_growstack (lua_State *L, int n) { - if (n <= L->stacksize) /* double size is enough? */ - luaD_reallocstack(L, 2*L->stacksize); - else - luaD_reallocstack(L, L->stacksize + n); -} - - -static CallInfo *growCI (lua_State *L) { - if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ - luaD_throw(L, LUA_ERRERR); - else { - luaD_reallocCI(L, 2*L->size_ci); - if (L->size_ci > LUAI_MAXCALLS) - luaG_runerror(L, "stack overflow"); - } - return ++L->ci; -} - - -void luaD_callhook (lua_State *L, int event, int line) { - lua_Hook hook = L->hook; - if (hook && L->allowhook) { - ptrdiff_t top = savestack(L, L->top); - ptrdiff_t ci_top = savestack(L, L->ci->top); - lua_Debug ar; - ar.event = event; - ar.currentline = line; - if (event == LUA_HOOKTAILRET) - ar.i_ci = 0; /* tail call; no debug information about it */ - else - ar.i_ci = cast_int(L->ci - L->base_ci); - luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - L->ci->top = L->top + LUA_MINSTACK; - lua_assert(L->ci->top <= L->stack_last); - L->allowhook = 0; /* cannot call hooks inside a hook */ - lua_unlock(L); - (*hook)(L, &ar); - lua_lock(L); - lua_assert(!L->allowhook); - L->allowhook = 1; - L->ci->top = restorestack(L, ci_top); - L->top = restorestack(L, top); - } -} - - -static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { - int i; - int nfixargs = p->numparams; - Table *htab = NULL; - StkId base, fixed; - for (; actual < nfixargs; ++actual) - setnilvalue(L->top++); -#if defined(LUA_COMPAT_VARARG) - if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ - int nvar = actual - nfixargs; /* number of extra arguments */ - lua_assert(p->is_vararg & VARARG_HASARG); - luaC_checkGC(L); - luaD_checkstack(L, p->maxstacksize); - htab = luaH_new(L, nvar, 1); /* create `arg' table */ - for (i=0; itop - nvar + i); - /* store counter in field `n' */ - setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); - } -#endif - /* move fixed parameters to final position */ - fixed = L->top - actual; /* first fixed argument */ - base = L->top; /* final position of first argument */ - for (i=0; itop++, fixed+i); - setnilvalue(fixed+i); - } - /* add `arg' parameter */ - if (htab) { - sethvalue(L, L->top++, htab); - lua_assert(iswhite(obj2gco(htab))); - } - return base; -} - - -static StkId tryfuncTM (lua_State *L, StkId func) { - const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); - StkId p; - ptrdiff_t funcr = savestack(L, func); - if (!ttisfunction(tm)) - luaG_typeerror(L, func, "call"); - /* Open a hole inside the stack at `func' */ - for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); - incr_top(L); - func = restorestack(L, funcr); /* previous call may change stack */ - setobj2s(L, func, tm); /* tag method is the new function to be called */ - return func; -} - - - -#define inc_ci(L) \ - ((L->ci == L->end_ci) ? growCI(L) : \ - (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) - - -int luaD_precall (lua_State *L, StkId func, int nresults) { - LClosure *cl; - ptrdiff_t funcr; - if (!ttisfunction(func)) /* `func' is not a function? */ - func = tryfuncTM(L, func); /* check the `function' tag method */ - funcr = savestack(L, func); - cl = &clvalue(func)->l; - L->ci->savedpc = L->savedpc; - if (!cl->isC) { /* Lua function? prepare its call */ - CallInfo *ci; - StkId st, base; - Proto *p = cl->p; - luaD_checkstack(L, p->maxstacksize); - func = restorestack(L, funcr); - if (!p->is_vararg) { /* no varargs? */ - base = func + 1; - if (L->top > base + p->numparams) - L->top = base + p->numparams; - } - else { /* vararg function */ - int nargs = cast_int(L->top - func) - 1; - base = adjust_varargs(L, p, nargs); - func = restorestack(L, funcr); /* previous call may change the stack */ - } - ci = inc_ci(L); /* now `enter' new function */ - ci->func = func; - L->base = ci->base = base; - ci->top = L->base + p->maxstacksize; - lua_assert(ci->top <= L->stack_last); - L->savedpc = p->code; /* starting point */ - ci->tailcalls = 0; - ci->nresults = nresults; - for (st = L->top; st < ci->top; st++) - setnilvalue(st); - L->top = ci->top; - if (L->hookmask & LUA_MASKCALL) { - L->savedpc++; /* hooks assume 'pc' is already incremented */ - luaD_callhook(L, LUA_HOOKCALL, -1); - L->savedpc--; /* correct 'pc' */ - } - return PCRLUA; - } - else { /* if is a C function, call it */ - CallInfo *ci; - int n; - luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - ci = inc_ci(L); /* now `enter' new function */ - ci->func = restorestack(L, funcr); - L->base = ci->base = ci->func + 1; - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - ci->nresults = nresults; - if (L->hookmask & LUA_MASKCALL) - luaD_callhook(L, LUA_HOOKCALL, -1); - lua_unlock(L); - n = (*curr_func(L)->c.f)(L); /* do the actual call */ - lua_lock(L); - if (n < 0) /* yielding? */ - return PCRYIELD; - else { - luaD_poscall(L, L->top - n); - return PCRC; - } - } -} - - -static StkId callrethooks (lua_State *L, StkId firstResult) { - ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ - luaD_callhook(L, LUA_HOOKRET, -1); - if (f_isLua(L->ci)) { /* Lua function? */ - while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ - luaD_callhook(L, LUA_HOOKTAILRET, -1); - } - return restorestack(L, fr); -} - - -int luaD_poscall (lua_State *L, StkId firstResult) { - StkId res; - int wanted, i; - CallInfo *ci; - if (L->hookmask & LUA_MASKRET) - firstResult = callrethooks(L, firstResult); - ci = L->ci--; - res = ci->func; /* res == final position of 1st result */ - wanted = ci->nresults; - L->base = (ci - 1)->base; /* restore base */ - L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ - /* move results to correct place */ - for (i = wanted; i != 0 && firstResult < L->top; i--) - setobjs2s(L, res++, firstResult++); - while (i-- > 0) - setnilvalue(res++); - L->top = res; - return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ -} - - -/* -** Call a function (C or Lua). The function to be called is at *func. -** The arguments are on the stack, right after the function. -** When returns, all the results are on the stack, starting at the original -** function position. -*/ -void luaD_call (lua_State *L, StkId func, int nResults) { - if (++L->nCcalls >= LUAI_MAXCCALLS) { - if (L->nCcalls == LUAI_MAXCCALLS) - luaG_runerror(L, "C stack overflow"); - else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) - luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ - } - if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ - luaV_execute(L, 1); /* call it */ - L->nCcalls--; - luaC_checkGC(L); -} - - -static void resume (lua_State *L, void *ud) { - StkId firstArg = cast(StkId, ud); - CallInfo *ci = L->ci; - if (L->status == 0) { /* start coroutine? */ - lua_assert(ci == L->base_ci && firstArg > L->base); - if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) - return; - } - else { /* resuming from previous yield */ - lua_assert(L->status == LUA_YIELD); - L->status = 0; - if (!f_isLua(ci)) { /* `common' yield? */ - /* finish interrupted execution of `OP_CALL' */ - lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || - GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); - if (luaD_poscall(L, firstArg)) /* complete it... */ - L->top = L->ci->top; /* and correct top if not multiple results */ - } - else /* yielded inside a hook: just continue its execution */ - L->base = L->ci->base; - } - luaV_execute(L, cast_int(L->ci - L->base_ci)); -} - - -static int resume_error (lua_State *L, const char *msg) { - L->top = L->ci->base; - setsvalue2s(L, L->top, luaS_new(L, msg)); - incr_top(L); - lua_unlock(L); - return LUA_ERRRUN; -} - - -LUA_API int lua_resume (lua_State *L, int nargs) { - int status; - lua_lock(L); - if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) - return resume_error(L, "cannot resume non-suspended coroutine"); - if (L->nCcalls >= LUAI_MAXCCALLS) - return resume_error(L, "C stack overflow"); - luai_userstateresume(L, nargs); - lua_assert(L->errfunc == 0); - L->baseCcalls = ++L->nCcalls; - status = luaD_rawrunprotected(L, resume, L->top - nargs); - if (status != 0) { /* error? */ - L->status = cast_byte(status); /* mark thread as `dead' */ - luaD_seterrorobj(L, status, L->top); - L->ci->top = L->top; - } - else { - lua_assert(L->nCcalls == L->baseCcalls); - status = L->status; - } - --L->nCcalls; - lua_unlock(L); - return status; -} - - -LUA_API int lua_yield (lua_State *L, int nresults) { - luai_userstateyield(L, nresults); - lua_lock(L); - if (L->nCcalls > L->baseCcalls) - luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); - L->base = L->top - nresults; /* protect stack slots below */ - L->status = LUA_YIELD; - lua_unlock(L); - return -1; -} - - -int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t old_top, ptrdiff_t ef) { - int status; - unsigned short oldnCcalls = L->nCcalls; - ptrdiff_t old_ci = saveci(L, L->ci); - lu_byte old_allowhooks = L->allowhook; - ptrdiff_t old_errfunc = L->errfunc; - L->errfunc = ef; - status = luaD_rawrunprotected(L, func, u); - if (status != 0) { /* an error occurred? */ - StkId oldtop = restorestack(L, old_top); - luaF_close(L, oldtop); /* close eventual pending closures */ - luaD_seterrorobj(L, status, oldtop); - L->nCcalls = oldnCcalls; - L->ci = restoreci(L, old_ci); - L->base = L->ci->base; - L->savedpc = L->ci->savedpc; - L->allowhook = old_allowhooks; - restore_stack_limit(L); - } - L->errfunc = old_errfunc; - return status; -} - - - -/* -** Execute a protected parser. -*/ -struct SParser { /* data to `f_parser' */ - ZIO *z; - Mbuffer buff; /* buffer to be used by the scanner */ - const char *name; -}; - -static void f_parser (lua_State *L, void *ud) { - int i; - Proto *tf; - Closure *cl; - struct SParser *p = cast(struct SParser *, ud); - int c = luaZ_lookahead(p->z); - luaC_checkGC(L); - tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, - &p->buff, p->name); - cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); - cl->l.p = tf; - for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ - cl->l.upvals[i] = luaF_newupval(L); - setclvalue(L, L->top, cl); - incr_top(L); -} - - -int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { - struct SParser p; - int status; - p.z = z; p.name = name; - luaZ_initbuffer(L, &p.buff); - status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); - luaZ_freebuffer(L, &p.buff); - return status; -} - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldo.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldo.h deleted file mode 100644 index 98fddac5..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldo.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#ifndef ldo_h -#define ldo_h - - -#include "lobject.h" -#include "lstate.h" -#include "lzio.h" - - -#define luaD_checkstack(L,n) \ - if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ - luaD_growstack(L, n); \ - else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); - - -#define incr_top(L) {luaD_checkstack(L,1); L->top++;} - -#define savestack(L,p) ((char *)(p) - (char *)L->stack) -#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) - -#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) -#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) - - -/* results from luaD_precall */ -#define PCRLUA 0 /* initiated a call to a Lua function */ -#define PCRC 1 /* did a call to a C function */ -#define PCRYIELD 2 /* C funtion yielded */ - - -/* type of protected functions, to be ran by `runprotected' */ -typedef void (*Pfunc) (lua_State *L, void *ud); - -LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); -LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); -LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); -LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); -LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t oldtop, ptrdiff_t ef); -LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); -LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); -LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); -LUAI_FUNC void luaD_growstack (lua_State *L, int n); - -LUAI_FUNC void luaD_throw (lua_State *L, int errcode); -LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); - -LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); - -#endif - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldump.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldump.c deleted file mode 100644 index c9d3d487..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ldump.c +++ /dev/null @@ -1,164 +0,0 @@ -/* -** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ -** save precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#include - -#define ldump_c -#define LUA_CORE - -#include "lua.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - -typedef struct { - lua_State* L; - lua_Writer writer; - void* data; - int strip; - int status; -} DumpState; - -#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) -#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) - -static void DumpBlock(const void* b, size_t size, DumpState* D) -{ - if (D->status==0) - { - lua_unlock(D->L); - D->status=(*D->writer)(D->L,b,size,D->data); - lua_lock(D->L); - } -} - -static void DumpChar(int y, DumpState* D) -{ - char x=(char)y; - DumpVar(x,D); -} - -static void DumpInt(int x, DumpState* D) -{ - DumpVar(x,D); -} - -static void DumpNumber(lua_Number x, DumpState* D) -{ - DumpVar(x,D); -} - -static void DumpVector(const void* b, int n, size_t size, DumpState* D) -{ - DumpInt(n,D); - DumpMem(b,n,size,D); -} - -static void DumpString(const TString* s, DumpState* D) -{ - if (s==NULL || getstr(s)==NULL) - { - size_t size=0; - DumpVar(size,D); - } - else - { - size_t size=s->tsv.len+1; /* include trailing '\0' */ - DumpVar(size,D); - DumpBlock(getstr(s),size,D); - } -} - -#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) - -static void DumpFunction(const Proto* f, const TString* p, DumpState* D); - -static void DumpConstants(const Proto* f, DumpState* D) -{ - int i,n=f->sizek; - DumpInt(n,D); - for (i=0; ik[i]; - DumpChar(ttype(o),D); - switch (ttype(o)) - { - case LUA_TNIL: - break; - case LUA_TBOOLEAN: - DumpChar(bvalue(o),D); - break; - case LUA_TNUMBER: - DumpNumber(nvalue(o),D); - break; - case LUA_TSTRING: - DumpString(rawtsvalue(o),D); - break; - default: - lua_assert(0); /* cannot happen */ - break; - } - } - n=f->sizep; - DumpInt(n,D); - for (i=0; ip[i],f->source,D); -} - -static void DumpDebug(const Proto* f, DumpState* D) -{ - int i,n; - n= (D->strip) ? 0 : f->sizelineinfo; - DumpVector(f->lineinfo,n,sizeof(int),D); - n= (D->strip) ? 0 : f->sizelocvars; - DumpInt(n,D); - for (i=0; ilocvars[i].varname,D); - DumpInt(f->locvars[i].startpc,D); - DumpInt(f->locvars[i].endpc,D); - } - n= (D->strip) ? 0 : f->sizeupvalues; - DumpInt(n,D); - for (i=0; iupvalues[i],D); -} - -static void DumpFunction(const Proto* f, const TString* p, DumpState* D) -{ - DumpString((f->source==p || D->strip) ? NULL : f->source,D); - DumpInt(f->linedefined,D); - DumpInt(f->lastlinedefined,D); - DumpChar(f->nups,D); - DumpChar(f->numparams,D); - DumpChar(f->is_vararg,D); - DumpChar(f->maxstacksize,D); - DumpCode(f,D); - DumpConstants(f,D); - DumpDebug(f,D); -} - -static void DumpHeader(DumpState* D) -{ - char h[LUAC_HEADERSIZE]; - luaU_header(h); - DumpBlock(h,LUAC_HEADERSIZE,D); -} - -/* -** dump Lua function as precompiled chunk -*/ -int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) -{ - DumpState D; - D.L=L; - D.writer=w; - D.data=data; - D.strip=strip; - D.status=0; - DumpHeader(&D); - DumpFunction(f,NULL,&D); - return D.status; -} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lfunc.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lfunc.c deleted file mode 100644 index 813e88f5..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lfunc.c +++ /dev/null @@ -1,174 +0,0 @@ -/* -** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - - -#include - -#define lfunc_c -#define LUA_CORE - -#include "lua.h" - -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { - Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); - luaC_link(L, obj2gco(c), LUA_TFUNCTION); - c->c.isC = 1; - c->c.env = e; - c->c.nupvalues = cast_byte(nelems); - return c; -} - - -Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { - Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); - luaC_link(L, obj2gco(c), LUA_TFUNCTION); - c->l.isC = 0; - c->l.env = e; - c->l.nupvalues = cast_byte(nelems); - while (nelems--) c->l.upvals[nelems] = NULL; - return c; -} - - -UpVal *luaF_newupval (lua_State *L) { - UpVal *uv = luaM_new(L, UpVal); - luaC_link(L, obj2gco(uv), LUA_TUPVAL); - uv->v = &uv->u.value; - setnilvalue(uv->v); - return uv; -} - - -UpVal *luaF_findupval (lua_State *L, StkId level) { - global_State *g = G(L); - GCObject **pp = &L->openupval; - UpVal *p; - UpVal *uv; - while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { - lua_assert(p->v != &p->u.value); - if (p->v == level) { /* found a corresponding upvalue? */ - if (isdead(g, obj2gco(p))) /* is it dead? */ - changewhite(obj2gco(p)); /* ressurect it */ - return p; - } - pp = &p->next; - } - uv = luaM_new(L, UpVal); /* not found: create a new one */ - uv->tt = LUA_TUPVAL; - uv->marked = luaC_white(g); - uv->v = level; /* current value lives in the stack */ - uv->next = *pp; /* chain it in the proper position */ - *pp = obj2gco(uv); - uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ - uv->u.l.next = g->uvhead.u.l.next; - uv->u.l.next->u.l.prev = uv; - g->uvhead.u.l.next = uv; - lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); - return uv; -} - - -static void unlinkupval (UpVal *uv) { - lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); - uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ - uv->u.l.prev->u.l.next = uv->u.l.next; -} - - -void luaF_freeupval (lua_State *L, UpVal *uv) { - if (uv->v != &uv->u.value) /* is it open? */ - unlinkupval(uv); /* remove from open list */ - luaM_free(L, uv); /* free upvalue */ -} - - -void luaF_close (lua_State *L, StkId level) { - UpVal *uv; - global_State *g = G(L); - while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { - GCObject *o = obj2gco(uv); - lua_assert(!isblack(o) && uv->v != &uv->u.value); - L->openupval = uv->next; /* remove from `open' list */ - if (isdead(g, o)) - luaF_freeupval(L, uv); /* free upvalue */ - else { - unlinkupval(uv); - setobj(L, &uv->u.value, uv->v); - uv->v = &uv->u.value; /* now current value lives here */ - luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ - } - } -} - - -Proto *luaF_newproto (lua_State *L) { - Proto *f = luaM_new(L, Proto); - luaC_link(L, obj2gco(f), LUA_TPROTO); - f->k = NULL; - f->sizek = 0; - f->p = NULL; - f->sizep = 0; - f->code = NULL; - f->sizecode = 0; - f->sizelineinfo = 0; - f->sizeupvalues = 0; - f->nups = 0; - f->upvalues = NULL; - f->numparams = 0; - f->is_vararg = 0; - f->maxstacksize = 0; - f->lineinfo = NULL; - f->sizelocvars = 0; - f->locvars = NULL; - f->linedefined = 0; - f->lastlinedefined = 0; - f->source = NULL; - return f; -} - - -void luaF_freeproto (lua_State *L, Proto *f) { - luaM_freearray(L, f->code, f->sizecode, Instruction); - luaM_freearray(L, f->p, f->sizep, Proto *); - luaM_freearray(L, f->k, f->sizek, TValue); - luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); - luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); - luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); - luaM_free(L, f); -} - - -void luaF_freeclosure (lua_State *L, Closure *c) { - int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : - sizeLclosure(c->l.nupvalues); - luaM_freemem(L, c, size); -} - - -/* -** Look for n-th local variable at line `line' in function `func'. -** Returns NULL if not found. -*/ -const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { - int i; - for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { - if (pc < f->locvars[i].endpc) { /* is variable active? */ - local_number--; - if (local_number == 0) - return getstr(f->locvars[i].varname); - } - } - return NULL; /* not found */ -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lfunc.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lfunc.h deleted file mode 100644 index a68cf515..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lfunc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#ifndef lfunc_h -#define lfunc_h - - -#include "lobject.h" - - -#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ - cast(int, sizeof(TValue)*((n)-1))) - -#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ - cast(int, sizeof(TValue *)*((n)-1))) - - -LUAI_FUNC Proto *luaF_newproto (lua_State *L); -LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); -LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); -LUAI_FUNC UpVal *luaF_newupval (lua_State *L); -LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); -LUAI_FUNC void luaF_close (lua_State *L, StkId level); -LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); -LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); -LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); -LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, - int pc); - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lgc.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lgc.c deleted file mode 100644 index e909c79a..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lgc.c +++ /dev/null @@ -1,710 +0,0 @@ -/* -** $Id: lgc.c,v 2.38.1.2 2011/03/18 18:05:38 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#include - -#define lgc_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -#define GCSTEPSIZE 1024u -#define GCSWEEPMAX 40 -#define GCSWEEPCOST 10 -#define GCFINALIZECOST 100 - - -#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) - -#define makewhite(g,x) \ - ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) - -#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) -#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) - -#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) - - -#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) -#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) - - -#define KEYWEAK bitmask(KEYWEAKBIT) -#define VALUEWEAK bitmask(VALUEWEAKBIT) - - - -#define markvalue(g,o) { checkconsistency(o); \ - if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } - -#define markobject(g,t) { if (iswhite(obj2gco(t))) \ - reallymarkobject(g, obj2gco(t)); } - - -#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) - - -static void removeentry (Node *n) { - lua_assert(ttisnil(gval(n))); - if (iscollectable(gkey(n))) - setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ -} - - -static void reallymarkobject (global_State *g, GCObject *o) { - lua_assert(iswhite(o) && !isdead(g, o)); - white2gray(o); - switch (o->gch.tt) { - case LUA_TSTRING: { - return; - } - case LUA_TUSERDATA: { - Table *mt = gco2u(o)->metatable; - gray2black(o); /* udata are never gray */ - if (mt) markobject(g, mt); - markobject(g, gco2u(o)->env); - return; - } - case LUA_TUPVAL: { - UpVal *uv = gco2uv(o); - markvalue(g, uv->v); - if (uv->v == &uv->u.value) /* closed? */ - gray2black(o); /* open upvalues are never black */ - return; - } - case LUA_TFUNCTION: { - gco2cl(o)->c.gclist = g->gray; - g->gray = o; - break; - } - case LUA_TTABLE: { - gco2h(o)->gclist = g->gray; - g->gray = o; - break; - } - case LUA_TTHREAD: { - gco2th(o)->gclist = g->gray; - g->gray = o; - break; - } - case LUA_TPROTO: { - gco2p(o)->gclist = g->gray; - g->gray = o; - break; - } - default: lua_assert(0); - } -} - - -static void marktmu (global_State *g) { - GCObject *u = g->tmudata; - if (u) { - do { - u = u->gch.next; - makewhite(g, u); /* may be marked, if left from previous GC */ - reallymarkobject(g, u); - } while (u != g->tmudata); - } -} - - -/* move `dead' udata that need finalization to list `tmudata' */ -size_t luaC_separateudata (lua_State *L, int all) { - global_State *g = G(L); - size_t deadmem = 0; - GCObject **p = &g->mainthread->next; - GCObject *curr; - while ((curr = *p) != NULL) { - if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) - p = &curr->gch.next; /* don't bother with them */ - else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { - markfinalized(gco2u(curr)); /* don't need finalization */ - p = &curr->gch.next; - } - else { /* must call its gc method */ - deadmem += sizeudata(gco2u(curr)); - markfinalized(gco2u(curr)); - *p = curr->gch.next; - /* link `curr' at the end of `tmudata' list */ - if (g->tmudata == NULL) /* list is empty? */ - g->tmudata = curr->gch.next = curr; /* creates a circular list */ - else { - curr->gch.next = g->tmudata->gch.next; - g->tmudata->gch.next = curr; - g->tmudata = curr; - } - } - } - return deadmem; -} - - -static int traversetable (global_State *g, Table *h) { - int i; - int weakkey = 0; - int weakvalue = 0; - const TValue *mode; - if (h->metatable) - markobject(g, h->metatable); - mode = gfasttm(g, h->metatable, TM_MODE); - if (mode && ttisstring(mode)) { /* is there a weak mode? */ - weakkey = (strchr(svalue(mode), 'k') != NULL); - weakvalue = (strchr(svalue(mode), 'v') != NULL); - if (weakkey || weakvalue) { /* is really weak? */ - h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ - h->marked |= cast_byte((weakkey << KEYWEAKBIT) | - (weakvalue << VALUEWEAKBIT)); - h->gclist = g->weak; /* must be cleared after GC, ... */ - g->weak = obj2gco(h); /* ... so put in the appropriate list */ - } - } - if (weakkey && weakvalue) return 1; - if (!weakvalue) { - i = h->sizearray; - while (i--) - markvalue(g, &h->array[i]); - } - i = sizenode(h); - while (i--) { - Node *n = gnode(h, i); - lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); - if (ttisnil(gval(n))) - removeentry(n); /* remove empty entries */ - else { - lua_assert(!ttisnil(gkey(n))); - if (!weakkey) markvalue(g, gkey(n)); - if (!weakvalue) markvalue(g, gval(n)); - } - } - return weakkey || weakvalue; -} - - -/* -** All marks are conditional because a GC may happen while the -** prototype is still being created -*/ -static void traverseproto (global_State *g, Proto *f) { - int i; - if (f->source) stringmark(f->source); - for (i=0; isizek; i++) /* mark literals */ - markvalue(g, &f->k[i]); - for (i=0; isizeupvalues; i++) { /* mark upvalue names */ - if (f->upvalues[i]) - stringmark(f->upvalues[i]); - } - for (i=0; isizep; i++) { /* mark nested protos */ - if (f->p[i]) - markobject(g, f->p[i]); - } - for (i=0; isizelocvars; i++) { /* mark local-variable names */ - if (f->locvars[i].varname) - stringmark(f->locvars[i].varname); - } -} - - - -static void traverseclosure (global_State *g, Closure *cl) { - markobject(g, cl->c.env); - if (cl->c.isC) { - int i; - for (i=0; ic.nupvalues; i++) /* mark its upvalues */ - markvalue(g, &cl->c.upvalue[i]); - } - else { - int i; - lua_assert(cl->l.nupvalues == cl->l.p->nups); - markobject(g, cl->l.p); - for (i=0; il.nupvalues; i++) /* mark its upvalues */ - markobject(g, cl->l.upvals[i]); - } -} - - -static void checkstacksizes (lua_State *L, StkId max) { - int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ - int s_used = cast_int(max - L->stack); /* part of stack in use */ - if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ - return; /* do not touch the stacks */ - if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) - luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ - condhardstacktests(luaD_reallocCI(L, ci_used + 1)); - if (4*s_used < L->stacksize && - 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) - luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ - condhardstacktests(luaD_reallocstack(L, s_used)); -} - - -static void traversestack (global_State *g, lua_State *l) { - StkId o, lim; - CallInfo *ci; - markvalue(g, gt(l)); - lim = l->top; - for (ci = l->base_ci; ci <= l->ci; ci++) { - lua_assert(ci->top <= l->stack_last); - if (lim < ci->top) lim = ci->top; - } - for (o = l->stack; o < l->top; o++) - markvalue(g, o); - for (; o <= lim; o++) - setnilvalue(o); - checkstacksizes(l, lim); -} - - -/* -** traverse one gray object, turning it to black. -** Returns `quantity' traversed. -*/ -static l_mem propagatemark (global_State *g) { - GCObject *o = g->gray; - lua_assert(isgray(o)); - gray2black(o); - switch (o->gch.tt) { - case LUA_TTABLE: { - Table *h = gco2h(o); - g->gray = h->gclist; - if (traversetable(g, h)) /* table is weak? */ - black2gray(o); /* keep it gray */ - return sizeof(Table) + sizeof(TValue) * h->sizearray + - sizeof(Node) * sizenode(h); - } - case LUA_TFUNCTION: { - Closure *cl = gco2cl(o); - g->gray = cl->c.gclist; - traverseclosure(g, cl); - return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : - sizeLclosure(cl->l.nupvalues); - } - case LUA_TTHREAD: { - lua_State *th = gco2th(o); - g->gray = th->gclist; - th->gclist = g->grayagain; - g->grayagain = o; - black2gray(o); - traversestack(g, th); - return sizeof(lua_State) + sizeof(TValue) * th->stacksize + - sizeof(CallInfo) * th->size_ci; - } - case LUA_TPROTO: { - Proto *p = gco2p(o); - g->gray = p->gclist; - traverseproto(g, p); - return sizeof(Proto) + sizeof(Instruction) * p->sizecode + - sizeof(Proto *) * p->sizep + - sizeof(TValue) * p->sizek + - sizeof(int) * p->sizelineinfo + - sizeof(LocVar) * p->sizelocvars + - sizeof(TString *) * p->sizeupvalues; - } - default: lua_assert(0); return 0; - } -} - - -static size_t propagateall (global_State *g) { - size_t m = 0; - while (g->gray) m += propagatemark(g); - return m; -} - - -/* -** The next function tells whether a key or value can be cleared from -** a weak table. Non-collectable objects are never removed from weak -** tables. Strings behave as `values', so are never removed too. for -** other objects: if really collected, cannot keep them; for userdata -** being finalized, keep them in keys, but not in values -*/ -static int iscleared (const TValue *o, int iskey) { - if (!iscollectable(o)) return 0; - if (ttisstring(o)) { - stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ - return 0; - } - return iswhite(gcvalue(o)) || - (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); -} - - -/* -** clear collected entries from weaktables -*/ -static void cleartable (GCObject *l) { - while (l) { - Table *h = gco2h(l); - int i = h->sizearray; - lua_assert(testbit(h->marked, VALUEWEAKBIT) || - testbit(h->marked, KEYWEAKBIT)); - if (testbit(h->marked, VALUEWEAKBIT)) { - while (i--) { - TValue *o = &h->array[i]; - if (iscleared(o, 0)) /* value was collected? */ - setnilvalue(o); /* remove value */ - } - } - i = sizenode(h); - while (i--) { - Node *n = gnode(h, i); - if (!ttisnil(gval(n)) && /* non-empty entry? */ - (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* remove entry from table */ - } - } - l = h->gclist; - } -} - - -static void freeobj (lua_State *L, GCObject *o) { - switch (o->gch.tt) { - case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; - case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; - case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; - case LUA_TTABLE: luaH_free(L, gco2h(o)); break; - case LUA_TTHREAD: { - lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); - luaE_freethread(L, gco2th(o)); - break; - } - case LUA_TSTRING: { - G(L)->strt.nuse--; - luaM_freemem(L, o, sizestring(gco2ts(o))); - break; - } - case LUA_TUSERDATA: { - luaM_freemem(L, o, sizeudata(gco2u(o))); - break; - } - default: lua_assert(0); - } -} - - - -#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) - - -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { - GCObject *curr; - global_State *g = G(L); - int deadmask = otherwhite(g); - while ((curr = *p) != NULL && count-- > 0) { - if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ - sweepwholelist(L, &gco2th(curr)->openupval); - if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ - lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); - makewhite(g, curr); /* make it white (for next cycle) */ - p = &curr->gch.next; - } - else { /* must erase `curr' */ - lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); - *p = curr->gch.next; - if (curr == g->rootgc) /* is the first element of the list? */ - g->rootgc = curr->gch.next; /* adjust first */ - freeobj(L, curr); - } - } - return p; -} - - -static void checkSizes (lua_State *L) { - global_State *g = G(L); - /* check size of string hash */ - if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && - g->strt.size > MINSTRTABSIZE*2) - luaS_resize(L, g->strt.size/2); /* table is too big */ - /* check size of buffer */ - if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ - size_t newsize = luaZ_sizebuffer(&g->buff) / 2; - luaZ_resizebuffer(L, &g->buff, newsize); - } -} - - -static void GCTM (lua_State *L) { - global_State *g = G(L); - GCObject *o = g->tmudata->gch.next; /* get first element */ - Udata *udata = rawgco2u(o); - const TValue *tm; - /* remove udata from `tmudata' */ - if (o == g->tmudata) /* last element? */ - g->tmudata = NULL; - else - g->tmudata->gch.next = udata->uv.next; - udata->uv.next = g->mainthread->next; /* return it to `root' list */ - g->mainthread->next = o; - makewhite(g, o); - tm = fasttm(L, udata->uv.metatable, TM_GC); - if (tm != NULL) { - lu_byte oldah = L->allowhook; - lu_mem oldt = g->GCthreshold; - L->allowhook = 0; /* stop debug hooks during GC tag method */ - g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ - setobj2s(L, L->top, tm); - setuvalue(L, L->top+1, udata); - L->top += 2; - luaD_call(L, L->top - 2, 0); - L->allowhook = oldah; /* restore hooks */ - g->GCthreshold = oldt; /* restore threshold */ - } -} - - -/* -** Call all GC tag methods -*/ -void luaC_callGCTM (lua_State *L) { - while (G(L)->tmudata) - GCTM(L); -} - - -void luaC_freeall (lua_State *L) { - global_State *g = G(L); - int i; - g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ - sweepwholelist(L, &g->rootgc); - for (i = 0; i < g->strt.size; i++) /* free all string lists */ - sweepwholelist(L, &g->strt.hash[i]); -} - - -static void markmt (global_State *g) { - int i; - for (i=0; imt[i]) markobject(g, g->mt[i]); -} - - -/* mark root set */ -static void markroot (lua_State *L) { - global_State *g = G(L); - g->gray = NULL; - g->grayagain = NULL; - g->weak = NULL; - markobject(g, g->mainthread); - /* make global table be traversed before main stack */ - markvalue(g, gt(g->mainthread)); - markvalue(g, registry(L)); - markmt(g); - g->gcstate = GCSpropagate; -} - - -static void remarkupvals (global_State *g) { - UpVal *uv; - for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { - lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); - if (isgray(obj2gco(uv))) - markvalue(g, uv->v); - } -} - - -static void atomic (lua_State *L) { - global_State *g = G(L); - size_t udsize; /* total size of userdata to be finalized */ - /* remark occasional upvalues of (maybe) dead threads */ - remarkupvals(g); - /* traverse objects cautch by write barrier and by 'remarkupvals' */ - propagateall(g); - /* remark weak tables */ - g->gray = g->weak; - g->weak = NULL; - lua_assert(!iswhite(obj2gco(g->mainthread))); - markobject(g, L); /* mark running thread */ - markmt(g); /* mark basic metatables (again) */ - propagateall(g); - /* remark gray again */ - g->gray = g->grayagain; - g->grayagain = NULL; - propagateall(g); - udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ - marktmu(g); /* mark `preserved' userdata */ - udsize += propagateall(g); /* remark, to propagate `preserveness' */ - cleartable(g->weak); /* remove collected objects from weak tables */ - /* flip current white */ - g->currentwhite = cast_byte(otherwhite(g)); - g->sweepstrgc = 0; - g->sweepgc = &g->rootgc; - g->gcstate = GCSsweepstring; - g->estimate = g->totalbytes - udsize; /* first estimate */ -} - - -static l_mem singlestep (lua_State *L) { - global_State *g = G(L); - /*lua_checkmemory(L);*/ - switch (g->gcstate) { - case GCSpause: { - markroot(L); /* start a new collection */ - return 0; - } - case GCSpropagate: { - if (g->gray) - return propagatemark(g); - else { /* no more `gray' objects */ - atomic(L); /* finish mark phase */ - return 0; - } - } - case GCSsweepstring: { - lu_mem old = g->totalbytes; - sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); - if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ - g->gcstate = GCSsweep; /* end sweep-string phase */ - lua_assert(old >= g->totalbytes); - g->estimate -= old - g->totalbytes; - return GCSWEEPCOST; - } - case GCSsweep: { - lu_mem old = g->totalbytes; - g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); - if (*g->sweepgc == NULL) { /* nothing more to sweep? */ - checkSizes(L); - g->gcstate = GCSfinalize; /* end sweep phase */ - } - lua_assert(old >= g->totalbytes); - g->estimate -= old - g->totalbytes; - return GCSWEEPMAX*GCSWEEPCOST; - } - case GCSfinalize: { - if (g->tmudata) { - GCTM(L); - if (g->estimate > GCFINALIZECOST) - g->estimate -= GCFINALIZECOST; - return GCFINALIZECOST; - } - else { - g->gcstate = GCSpause; /* end collection */ - g->gcdept = 0; - return 0; - } - } - default: lua_assert(0); return 0; - } -} - - -void luaC_step (lua_State *L) { - global_State *g = G(L); - l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; - if (lim == 0) - lim = (MAX_LUMEM-1)/2; /* no limit */ - g->gcdept += g->totalbytes - g->GCthreshold; - do { - lim -= singlestep(L); - if (g->gcstate == GCSpause) - break; - } while (lim > 0); - if (g->gcstate != GCSpause) { - if (g->gcdept < GCSTEPSIZE) - g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ - else { - g->gcdept -= GCSTEPSIZE; - g->GCthreshold = g->totalbytes; - } - } - else { - setthreshold(g); - } -} - - -void luaC_fullgc (lua_State *L) { - global_State *g = G(L); - if (g->gcstate <= GCSpropagate) { - /* reset sweep marks to sweep all elements (returning them to white) */ - g->sweepstrgc = 0; - g->sweepgc = &g->rootgc; - /* reset other collector lists */ - g->gray = NULL; - g->grayagain = NULL; - g->weak = NULL; - g->gcstate = GCSsweepstring; - } - lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); - /* finish any pending sweep phase */ - while (g->gcstate != GCSfinalize) { - lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); - singlestep(L); - } - markroot(L); - while (g->gcstate != GCSpause) { - singlestep(L); - } - setthreshold(g); -} - - -void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { - global_State *g = G(L); - lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); - lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); - lua_assert(ttype(&o->gch) != LUA_TTABLE); - /* must keep invariant? */ - if (g->gcstate == GCSpropagate) - reallymarkobject(g, v); /* restore invariant */ - else /* don't mind */ - makewhite(g, o); /* mark as white just to avoid other barriers */ -} - - -void luaC_barrierback (lua_State *L, Table *t) { - global_State *g = G(L); - GCObject *o = obj2gco(t); - lua_assert(isblack(o) && !isdead(g, o)); - lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); - black2gray(o); /* make table gray (again) */ - t->gclist = g->grayagain; - g->grayagain = o; -} - - -void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { - global_State *g = G(L); - o->gch.next = g->rootgc; - g->rootgc = o; - o->gch.marked = luaC_white(g); - o->gch.tt = tt; -} - - -void luaC_linkupval (lua_State *L, UpVal *uv) { - global_State *g = G(L); - GCObject *o = obj2gco(uv); - o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ - g->rootgc = o; - if (isgray(o)) { - if (g->gcstate == GCSpropagate) { - gray2black(o); /* closed upvalues need barrier */ - luaC_barrier(L, uv, uv->v); - } - else { /* sweep phase: sweep it (turning it into white) */ - makewhite(g, o); - lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); - } - } -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lgc.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lgc.h deleted file mode 100644 index 5a8dc605..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lgc.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#ifndef lgc_h -#define lgc_h - - -#include "lobject.h" - - -/* -** Possible states of the Garbage Collector -*/ -#define GCSpause 0 -#define GCSpropagate 1 -#define GCSsweepstring 2 -#define GCSsweep 3 -#define GCSfinalize 4 - - -/* -** some userful bit tricks -*/ -#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) -#define setbits(x,m) ((x) |= (m)) -#define testbits(x,m) ((x) & (m)) -#define bitmask(b) (1<<(b)) -#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) -#define l_setbit(x,b) setbits(x, bitmask(b)) -#define resetbit(x,b) resetbits(x, bitmask(b)) -#define testbit(x,b) testbits(x, bitmask(b)) -#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) -#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) -#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) - - - -/* -** Layout for bit use in `marked' field: -** bit 0 - object is white (type 0) -** bit 1 - object is white (type 1) -** bit 2 - object is black -** bit 3 - for userdata: has been finalized -** bit 3 - for tables: has weak keys -** bit 4 - for tables: has weak values -** bit 5 - object is fixed (should not be collected) -** bit 6 - object is "super" fixed (only the main thread) -*/ - - -#define WHITE0BIT 0 -#define WHITE1BIT 1 -#define BLACKBIT 2 -#define FINALIZEDBIT 3 -#define KEYWEAKBIT 3 -#define VALUEWEAKBIT 4 -#define FIXEDBIT 5 -#define SFIXEDBIT 6 -#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) - - -#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) -#define isblack(x) testbit((x)->gch.marked, BLACKBIT) -#define isgray(x) (!isblack(x) && !iswhite(x)) - -#define otherwhite(g) (g->currentwhite ^ WHITEBITS) -#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) - -#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) -#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) - -#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) - -#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) - - -#define luaC_checkGC(L) { \ - condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ - if (G(L)->totalbytes >= G(L)->GCthreshold) \ - luaC_step(L); } - - -#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ - luaC_barrierf(L,obj2gco(p),gcvalue(v)); } - -#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ - luaC_barrierback(L,t); } - -#define luaC_objbarrier(L,p,o) \ - { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ - luaC_barrierf(L,obj2gco(p),obj2gco(o)); } - -#define luaC_objbarriert(L,t,o) \ - { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } - -LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); -LUAI_FUNC void luaC_callGCTM (lua_State *L); -LUAI_FUNC void luaC_freeall (lua_State *L); -LUAI_FUNC void luaC_step (lua_State *L); -LUAI_FUNC void luaC_fullgc (lua_State *L); -LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); -LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); -LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); -LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/linit.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/linit.c deleted file mode 100644 index c1f90dfa..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/linit.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ -** Initialization of libraries for lua.c -** See Copyright Notice in lua.h -*/ - - -#define linit_c -#define LUA_LIB - -#include "lua.h" - -#include "lualib.h" -#include "lauxlib.h" - - -static const luaL_Reg lualibs[] = { - {"", luaopen_base}, - {LUA_LOADLIBNAME, luaopen_package}, - {LUA_TABLIBNAME, luaopen_table}, - {LUA_IOLIBNAME, luaopen_io}, - {LUA_OSLIBNAME, luaopen_os}, - {LUA_STRLIBNAME, luaopen_string}, - {LUA_MATHLIBNAME, luaopen_math}, - {LUA_DBLIBNAME, luaopen_debug}, - {NULL, NULL} -}; - - -LUALIB_API void luaL_openlibs (lua_State *L) { - const luaL_Reg *lib = lualibs; - for (; lib->func; lib++) { - lua_pushcfunction(L, lib->func); - lua_pushstring(L, lib->name); - lua_call(L, 1, 0); - } -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/liolib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/liolib.c deleted file mode 100644 index 649f9a59..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/liolib.c +++ /dev/null @@ -1,556 +0,0 @@ -/* -** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $ -** Standard I/O (and system) library -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include -#include - -#define liolib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - -#define IO_INPUT 1 -#define IO_OUTPUT 2 - - -static const char *const fnames[] = {"input", "output"}; - - -static int pushresult (lua_State *L, int i, const char *filename) { - int en = errno; /* calls to Lua API may change this value */ - if (i) { - lua_pushboolean(L, 1); - return 1; - } - else { - lua_pushnil(L); - if (filename) - lua_pushfstring(L, "%s: %s", filename, strerror(en)); - else - lua_pushfstring(L, "%s", strerror(en)); - lua_pushinteger(L, en); - return 3; - } -} - - -static void fileerror (lua_State *L, int arg, const char *filename) { - lua_pushfstring(L, "%s: %s", filename, strerror(errno)); - luaL_argerror(L, arg, lua_tostring(L, -1)); -} - - -#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) - - -static int io_type (lua_State *L) { - void *ud; - luaL_checkany(L, 1); - ud = lua_touserdata(L, 1); - lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); - if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) - lua_pushnil(L); /* not a file */ - else if (*((FILE **)ud) == NULL) - lua_pushliteral(L, "closed file"); - else - lua_pushliteral(L, "file"); - return 1; -} - - -static FILE *tofile (lua_State *L) { - FILE **f = tofilep(L); - if (*f == NULL) - luaL_error(L, "attempt to use a closed file"); - return *f; -} - - - -/* -** When creating file handles, always creates a `closed' file handle -** before opening the actual file; so, if there is a memory error, the -** file is not left opened. -*/ -static FILE **newfile (lua_State *L) { - FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); - *pf = NULL; /* file handle is currently `closed' */ - luaL_getmetatable(L, LUA_FILEHANDLE); - lua_setmetatable(L, -2); - return pf; -} - - -/* -** function to (not) close the standard files stdin, stdout, and stderr -*/ -static int io_noclose (lua_State *L) { - lua_pushnil(L); - lua_pushliteral(L, "cannot close standard file"); - return 2; -} - - -/* -** function to close 'popen' files -*/ -static int io_pclose (lua_State *L) { - FILE **p = tofilep(L); - int ok = lua_pclose(L, *p); - *p = NULL; - return pushresult(L, ok, NULL); -} - - -/* -** function to close regular files -*/ -static int io_fclose (lua_State *L) { - FILE **p = tofilep(L); - int ok = (fclose(*p) == 0); - *p = NULL; - return pushresult(L, ok, NULL); -} - - -static int aux_close (lua_State *L) { - lua_getfenv(L, 1); - lua_getfield(L, -1, "__close"); - return (lua_tocfunction(L, -1))(L); -} - - -static int io_close (lua_State *L) { - if (lua_isnone(L, 1)) - lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); - tofile(L); /* make sure argument is a file */ - return aux_close(L); -} - - -static int io_gc (lua_State *L) { - FILE *f = *tofilep(L); - /* ignore closed files */ - if (f != NULL) - aux_close(L); - return 0; -} - - -static int io_tostring (lua_State *L) { - FILE *f = *tofilep(L); - if (f == NULL) - lua_pushliteral(L, "file (closed)"); - else - lua_pushfstring(L, "file (%p)", f); - return 1; -} - - -static int io_open (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); - FILE **pf = newfile(L); - *pf = fopen(filename, mode); - return (*pf == NULL) ? pushresult(L, 0, filename) : 1; -} - - -/* -** this function has a separated environment, which defines the -** correct __close for 'popen' files -*/ -static int io_popen (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); - FILE **pf = newfile(L); - *pf = lua_popen(L, filename, mode); - return (*pf == NULL) ? pushresult(L, 0, filename) : 1; -} - - -static int io_tmpfile (lua_State *L) { - FILE **pf = newfile(L); - *pf = tmpfile(); - return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; -} - - -static FILE *getiofile (lua_State *L, int findex) { - FILE *f; - lua_rawgeti(L, LUA_ENVIRONINDEX, findex); - f = *(FILE **)lua_touserdata(L, -1); - if (f == NULL) - luaL_error(L, "standard %s file is closed", fnames[findex - 1]); - return f; -} - - -static int g_iofile (lua_State *L, int f, const char *mode) { - if (!lua_isnoneornil(L, 1)) { - const char *filename = lua_tostring(L, 1); - if (filename) { - FILE **pf = newfile(L); - *pf = fopen(filename, mode); - if (*pf == NULL) - fileerror(L, 1, filename); - } - else { - tofile(L); /* check that it's a valid file handle */ - lua_pushvalue(L, 1); - } - lua_rawseti(L, LUA_ENVIRONINDEX, f); - } - /* return current value */ - lua_rawgeti(L, LUA_ENVIRONINDEX, f); - return 1; -} - - -static int io_input (lua_State *L) { - return g_iofile(L, IO_INPUT, "r"); -} - - -static int io_output (lua_State *L) { - return g_iofile(L, IO_OUTPUT, "w"); -} - - -static int io_readline (lua_State *L); - - -static void aux_lines (lua_State *L, int idx, int toclose) { - lua_pushvalue(L, idx); - lua_pushboolean(L, toclose); /* close/not close file when finished */ - lua_pushcclosure(L, io_readline, 2); -} - - -static int f_lines (lua_State *L) { - tofile(L); /* check that it's a valid file handle */ - aux_lines(L, 1, 0); - return 1; -} - - -static int io_lines (lua_State *L) { - if (lua_isnoneornil(L, 1)) { /* no arguments? */ - /* will iterate over default input */ - lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); - return f_lines(L); - } - else { - const char *filename = luaL_checkstring(L, 1); - FILE **pf = newfile(L); - *pf = fopen(filename, "r"); - if (*pf == NULL) - fileerror(L, 1, filename); - aux_lines(L, lua_gettop(L), 1); - return 1; - } -} - - -/* -** {====================================================== -** READ -** ======================================================= -*/ - - -static int read_number (lua_State *L, FILE *f) { - lua_Number d; - if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { - lua_pushnumber(L, d); - return 1; - } - else { - lua_pushnil(L); /* "result" to be removed */ - return 0; /* read fails */ - } -} - - -static int test_eof (lua_State *L, FILE *f) { - int c = getc(f); - ungetc(c, f); - lua_pushlstring(L, NULL, 0); - return (c != EOF); -} - - -static int read_line (lua_State *L, FILE *f) { - luaL_Buffer b; - luaL_buffinit(L, &b); - for (;;) { - size_t l; - char *p = luaL_prepbuffer(&b); - if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ - luaL_pushresult(&b); /* close buffer */ - return (lua_objlen(L, -1) > 0); /* check whether read something */ - } - l = strlen(p); - if (l == 0 || p[l-1] != '\n') - luaL_addsize(&b, l); - else { - luaL_addsize(&b, l - 1); /* do not include `eol' */ - luaL_pushresult(&b); /* close buffer */ - return 1; /* read at least an `eol' */ - } - } -} - - -static int read_chars (lua_State *L, FILE *f, size_t n) { - size_t rlen; /* how much to read */ - size_t nr; /* number of chars actually read */ - luaL_Buffer b; - luaL_buffinit(L, &b); - rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ - do { - char *p = luaL_prepbuffer(&b); - if (rlen > n) rlen = n; /* cannot read more than asked */ - nr = fread(p, sizeof(char), rlen, f); - luaL_addsize(&b, nr); - n -= nr; /* still have to read `n' chars */ - } while (n > 0 && nr == rlen); /* until end of count or eof */ - luaL_pushresult(&b); /* close buffer */ - return (n == 0 || lua_objlen(L, -1) > 0); -} - - -static int g_read (lua_State *L, FILE *f, int first) { - int nargs = lua_gettop(L) - 1; - int success; - int n; - clearerr(f); - if (nargs == 0) { /* no arguments? */ - success = read_line(L, f); - n = first+1; /* to return 1 result */ - } - else { /* ensure stack space for all results and for auxlib's buffer */ - luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); - success = 1; - for (n = first; nargs-- && success; n++) { - if (lua_type(L, n) == LUA_TNUMBER) { - size_t l = (size_t)lua_tointeger(L, n); - success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); - } - else { - const char *p = lua_tostring(L, n); - luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); - switch (p[1]) { - case 'n': /* number */ - success = read_number(L, f); - break; - case 'l': /* line */ - success = read_line(L, f); - break; - case 'a': /* file */ - read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ - success = 1; /* always success */ - break; - default: - return luaL_argerror(L, n, "invalid format"); - } - } - } - } - if (ferror(f)) - return pushresult(L, 0, NULL); - if (!success) { - lua_pop(L, 1); /* remove last result */ - lua_pushnil(L); /* push nil instead */ - } - return n - first; -} - - -static int io_read (lua_State *L) { - return g_read(L, getiofile(L, IO_INPUT), 1); -} - - -static int f_read (lua_State *L) { - return g_read(L, tofile(L), 2); -} - - -static int io_readline (lua_State *L) { - FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); - int sucess; - if (f == NULL) /* file is already closed? */ - luaL_error(L, "file is already closed"); - sucess = read_line(L, f); - if (ferror(f)) - return luaL_error(L, "%s", strerror(errno)); - if (sucess) return 1; - else { /* EOF */ - if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ - lua_settop(L, 0); - lua_pushvalue(L, lua_upvalueindex(1)); - aux_close(L); /* close it */ - } - return 0; - } -} - -/* }====================================================== */ - - -static int g_write (lua_State *L, FILE *f, int arg) { - int nargs = lua_gettop(L) - 1; - int status = 1; - for (; nargs--; arg++) { - if (lua_type(L, arg) == LUA_TNUMBER) { - /* optimization: could be done exactly as for strings */ - status = status && - fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; - } - else { - size_t l; - const char *s = luaL_checklstring(L, arg, &l); - status = status && (fwrite(s, sizeof(char), l, f) == l); - } - } - return pushresult(L, status, NULL); -} - - -static int io_write (lua_State *L) { - return g_write(L, getiofile(L, IO_OUTPUT), 1); -} - - -static int f_write (lua_State *L) { - return g_write(L, tofile(L), 2); -} - - -static int f_seek (lua_State *L) { - static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; - static const char *const modenames[] = {"set", "cur", "end", NULL}; - FILE *f = tofile(L); - int op = luaL_checkoption(L, 2, "cur", modenames); - long offset = luaL_optlong(L, 3, 0); - op = fseek(f, offset, mode[op]); - if (op) - return pushresult(L, 0, NULL); /* error */ - else { - lua_pushinteger(L, ftell(f)); - return 1; - } -} - - -static int f_setvbuf (lua_State *L) { - static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; - static const char *const modenames[] = {"no", "full", "line", NULL}; - FILE *f = tofile(L); - int op = luaL_checkoption(L, 2, NULL, modenames); - lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); - int res = setvbuf(f, NULL, mode[op], sz); - return pushresult(L, res == 0, NULL); -} - - - -static int io_flush (lua_State *L) { - return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); -} - - -static int f_flush (lua_State *L) { - return pushresult(L, fflush(tofile(L)) == 0, NULL); -} - - -static const luaL_Reg iolib[] = { - {"close", io_close}, - {"flush", io_flush}, - {"input", io_input}, - {"lines", io_lines}, - {"open", io_open}, - {"output", io_output}, - {"popen", io_popen}, - {"read", io_read}, - {"tmpfile", io_tmpfile}, - {"type", io_type}, - {"write", io_write}, - {NULL, NULL} -}; - - -static const luaL_Reg flib[] = { - {"close", io_close}, - {"flush", f_flush}, - {"lines", f_lines}, - {"read", f_read}, - {"seek", f_seek}, - {"setvbuf", f_setvbuf}, - {"write", f_write}, - {"__gc", io_gc}, - {"__tostring", io_tostring}, - {NULL, NULL} -}; - - -static void createmeta (lua_State *L) { - luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ - lua_pushvalue(L, -1); /* push metatable */ - lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ - luaL_register(L, NULL, flib); /* file methods */ -} - - -static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { - *newfile(L) = f; - if (k > 0) { - lua_pushvalue(L, -1); - lua_rawseti(L, LUA_ENVIRONINDEX, k); - } - lua_pushvalue(L, -2); /* copy environment */ - lua_setfenv(L, -2); /* set it */ - lua_setfield(L, -3, fname); -} - - -static void newfenv (lua_State *L, lua_CFunction cls) { - lua_createtable(L, 0, 1); - lua_pushcfunction(L, cls); - lua_setfield(L, -2, "__close"); -} - - -LUALIB_API int luaopen_io (lua_State *L) { - createmeta(L); - /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ - newfenv(L, io_fclose); - lua_replace(L, LUA_ENVIRONINDEX); - /* open library */ - luaL_register(L, LUA_IOLIBNAME, iolib); - /* create (and set) default files */ - newfenv(L, io_noclose); /* close function for default files */ - createstdfile(L, stdin, IO_INPUT, "stdin"); - createstdfile(L, stdout, IO_OUTPUT, "stdout"); - createstdfile(L, stderr, 0, "stderr"); - lua_pop(L, 1); /* pop environment for default files */ - lua_getfield(L, -1, "popen"); - newfenv(L, io_pclose); /* create environment for 'popen' */ - lua_setfenv(L, -2); /* set fenv for 'popen' */ - lua_pop(L, 1); /* pop 'popen' */ - return 1; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/llex.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/llex.c deleted file mode 100644 index 88c6790c..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/llex.c +++ /dev/null @@ -1,463 +0,0 @@ -/* -** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $ -** Lexical Analyzer -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include - -#define llex_c -#define LUA_CORE - -#include "lua.h" - -#include "ldo.h" -#include "llex.h" -#include "lobject.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "lzio.h" - - - -#define next(ls) (ls->current = zgetc(ls->z)) - - - - -#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') - - -/* ORDER RESERVED */ -const char *const luaX_tokens [] = { - "and", "break", "do", "else", "elseif", - "end", "false", "for", "function", "if", - "in", "local", "nil", "not", "or", "repeat", - "return", "then", "true", "until", "while", - "..", "...", "==", ">=", "<=", "~=", - "", "", "", "", - NULL -}; - - -#define save_and_next(ls) (save(ls, ls->current), next(ls)) - - -static void save (LexState *ls, int c) { - Mbuffer *b = ls->buff; - if (b->n + 1 > b->buffsize) { - size_t newsize; - if (b->buffsize >= MAX_SIZET/2) - luaX_lexerror(ls, "lexical element too long", 0); - newsize = b->buffsize * 2; - luaZ_resizebuffer(ls->L, b, newsize); - } - b->buffer[b->n++] = cast(char, c); -} - - -void luaX_init (lua_State *L) { - int i; - for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ - } -} - - -#define MAXSRC 80 - - -const char *luaX_token2str (LexState *ls, int token) { - if (token < FIRST_RESERVED) { - lua_assert(token == cast(unsigned char, token)); - return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : - luaO_pushfstring(ls->L, "%c", token); - } - else - return luaX_tokens[token-FIRST_RESERVED]; -} - - -static const char *txtToken (LexState *ls, int token) { - switch (token) { - case TK_NAME: - case TK_STRING: - case TK_NUMBER: - save(ls, '\0'); - return luaZ_buffer(ls->buff); - default: - return luaX_token2str(ls, token); - } -} - - -void luaX_lexerror (LexState *ls, const char *msg, int token) { - char buff[MAXSRC]; - luaO_chunkid(buff, getstr(ls->source), MAXSRC); - msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); - if (token) - luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); - luaD_throw(ls->L, LUA_ERRSYNTAX); -} - - -void luaX_syntaxerror (LexState *ls, const char *msg) { - luaX_lexerror(ls, msg, ls->t.token); -} - - -TString *luaX_newstring (LexState *ls, const char *str, size_t l) { - lua_State *L = ls->L; - TString *ts = luaS_newlstr(L, str, l); - TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ - if (ttisnil(o)) { - setbvalue(o, 1); /* make sure `str' will not be collected */ - luaC_checkGC(L); - } - return ts; -} - - -static void inclinenumber (LexState *ls) { - int old = ls->current; - lua_assert(currIsNewline(ls)); - next(ls); /* skip `\n' or `\r' */ - if (currIsNewline(ls) && ls->current != old) - next(ls); /* skip `\n\r' or `\r\n' */ - if (++ls->linenumber >= MAX_INT) - luaX_syntaxerror(ls, "chunk has too many lines"); -} - - -void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { - ls->decpoint = '.'; - ls->L = L; - ls->lookahead.token = TK_EOS; /* no look-ahead token */ - ls->z = z; - ls->fs = NULL; - ls->linenumber = 1; - ls->lastline = 1; - ls->source = source; - luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ - next(ls); /* read first char */ -} - - - -/* -** ======================================================= -** LEXICAL ANALYZER -** ======================================================= -*/ - - - -static int check_next (LexState *ls, const char *set) { - if (!strchr(set, ls->current)) - return 0; - save_and_next(ls); - return 1; -} - - -static void buffreplace (LexState *ls, char from, char to) { - size_t n = luaZ_bufflen(ls->buff); - char *p = luaZ_buffer(ls->buff); - while (n--) - if (p[n] == from) p[n] = to; -} - - -static void trydecpoint (LexState *ls, SemInfo *seminfo) { - /* format error: try to update decimal point separator */ - struct lconv *cv = localeconv(); - char old = ls->decpoint; - ls->decpoint = (cv ? cv->decimal_point[0] : '.'); - buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ - if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { - /* format error with correct decimal point: no more options */ - buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ - luaX_lexerror(ls, "malformed number", TK_NUMBER); - } -} - - -/* LUA_NUMBER */ -static void read_numeral (LexState *ls, SemInfo *seminfo) { - lua_assert(isdigit(ls->current)); - do { - save_and_next(ls); - } while (isdigit(ls->current) || ls->current == '.'); - if (check_next(ls, "Ee")) /* `E'? */ - check_next(ls, "+-"); /* optional exponent sign */ - while (isalnum(ls->current) || ls->current == '_') - save_and_next(ls); - save(ls, '\0'); - buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ - if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ - trydecpoint(ls, seminfo); /* try to update decimal point separator */ -} - - -static int skip_sep (LexState *ls) { - int count = 0; - int s = ls->current; - lua_assert(s == '[' || s == ']'); - save_and_next(ls); - while (ls->current == '=') { - save_and_next(ls); - count++; - } - return (ls->current == s) ? count : (-count) - 1; -} - - -static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { - int cont = 0; - (void)(cont); /* avoid warnings when `cont' is not used */ - save_and_next(ls); /* skip 2nd `[' */ - if (currIsNewline(ls)) /* string starts with a newline? */ - inclinenumber(ls); /* skip it */ - for (;;) { - switch (ls->current) { - case EOZ: - luaX_lexerror(ls, (seminfo) ? "unfinished long string" : - "unfinished long comment", TK_EOS); - break; /* to avoid warnings */ -#if defined(LUA_COMPAT_LSTR) - case '[': { - if (skip_sep(ls) == sep) { - save_and_next(ls); /* skip 2nd `[' */ - cont++; -#if LUA_COMPAT_LSTR == 1 - if (sep == 0) - luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); -#endif - } - break; - } -#endif - case ']': { - if (skip_sep(ls) == sep) { - save_and_next(ls); /* skip 2nd `]' */ -#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 - cont--; - if (sep == 0 && cont >= 0) break; -#endif - goto endloop; - } - break; - } - case '\n': - case '\r': { - save(ls, '\n'); - inclinenumber(ls); - if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ - break; - } - default: { - if (seminfo) save_and_next(ls); - else next(ls); - } - } - } endloop: - if (seminfo) - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), - luaZ_bufflen(ls->buff) - 2*(2 + sep)); -} - - -static void read_string (LexState *ls, int del, SemInfo *seminfo) { - save_and_next(ls); - while (ls->current != del) { - switch (ls->current) { - case EOZ: - luaX_lexerror(ls, "unfinished string", TK_EOS); - continue; /* to avoid warnings */ - case '\n': - case '\r': - luaX_lexerror(ls, "unfinished string", TK_STRING); - continue; /* to avoid warnings */ - case '\\': { - int c; - next(ls); /* do not save the `\' */ - switch (ls->current) { - case 'a': c = '\a'; break; - case 'b': c = '\b'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - case 'v': c = '\v'; break; - case '\n': /* go through */ - case '\r': save(ls, '\n'); inclinenumber(ls); continue; - case EOZ: continue; /* will raise an error next loop */ - default: { - if (!isdigit(ls->current)) - save_and_next(ls); /* handles \\, \", \', and \? */ - else { /* \xxx */ - int i = 0; - c = 0; - do { - c = 10*c + (ls->current-'0'); - next(ls); - } while (++i<3 && isdigit(ls->current)); - if (c > UCHAR_MAX) - luaX_lexerror(ls, "escape sequence too large", TK_STRING); - save(ls, c); - } - continue; - } - } - save(ls, c); - next(ls); - continue; - } - default: - save_and_next(ls); - } - } - save_and_next(ls); /* skip delimiter */ - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, - luaZ_bufflen(ls->buff) - 2); -} - - -static int llex (LexState *ls, SemInfo *seminfo) { - luaZ_resetbuffer(ls->buff); - for (;;) { - switch (ls->current) { - case '\n': - case '\r': { - inclinenumber(ls); - continue; - } - case '-': { - next(ls); - if (ls->current != '-') return '-'; - /* else is a comment */ - next(ls); - if (ls->current == '[') { - int sep = skip_sep(ls); - luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ - if (sep >= 0) { - read_long_string(ls, NULL, sep); /* long comment */ - luaZ_resetbuffer(ls->buff); - continue; - } - } - /* else short comment */ - while (!currIsNewline(ls) && ls->current != EOZ) - next(ls); - continue; - } - case '[': { - int sep = skip_sep(ls); - if (sep >= 0) { - read_long_string(ls, seminfo, sep); - return TK_STRING; - } - else if (sep == -1) return '['; - else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); - } - case '=': { - next(ls); - if (ls->current != '=') return '='; - else { next(ls); return TK_EQ; } - } - case '<': { - next(ls); - if (ls->current != '=') return '<'; - else { next(ls); return TK_LE; } - } - case '>': { - next(ls); - if (ls->current != '=') return '>'; - else { next(ls); return TK_GE; } - } - case '~': { - next(ls); - if (ls->current != '=') return '~'; - else { next(ls); return TK_NE; } - } - case '"': - case '\'': { - read_string(ls, ls->current, seminfo); - return TK_STRING; - } - case '.': { - save_and_next(ls); - if (check_next(ls, ".")) { - if (check_next(ls, ".")) - return TK_DOTS; /* ... */ - else return TK_CONCAT; /* .. */ - } - else if (!isdigit(ls->current)) return '.'; - else { - read_numeral(ls, seminfo); - return TK_NUMBER; - } - } - case EOZ: { - return TK_EOS; - } - default: { - if (isspace(ls->current)) { - lua_assert(!currIsNewline(ls)); - next(ls); - continue; - } - else if (isdigit(ls->current)) { - read_numeral(ls, seminfo); - return TK_NUMBER; - } - else if (isalpha(ls->current) || ls->current == '_') { - /* identifier or reserved word */ - TString *ts; - do { - save_and_next(ls); - } while (isalnum(ls->current) || ls->current == '_'); - ts = luaX_newstring(ls, luaZ_buffer(ls->buff), - luaZ_bufflen(ls->buff)); - if (ts->tsv.reserved > 0) /* reserved word? */ - return ts->tsv.reserved - 1 + FIRST_RESERVED; - else { - seminfo->ts = ts; - return TK_NAME; - } - } - else { - int c = ls->current; - next(ls); - return c; /* single-char tokens (+ - / ...) */ - } - } - } - } -} - - -void luaX_next (LexState *ls) { - ls->lastline = ls->linenumber; - if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ - ls->t = ls->lookahead; /* use this one */ - ls->lookahead.token = TK_EOS; /* and discharge it */ - } - else - ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ -} - - -void luaX_lookahead (LexState *ls) { - lua_assert(ls->lookahead.token == TK_EOS); - ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/llex.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/llex.h deleted file mode 100644 index a9201cee..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/llex.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ -** Lexical Analyzer -** See Copyright Notice in lua.h -*/ - -#ifndef llex_h -#define llex_h - -#include "lobject.h" -#include "lzio.h" - - -#define FIRST_RESERVED 257 - -/* maximum length of a reserved word */ -#define TOKEN_LEN (sizeof("function")/sizeof(char)) - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER RESERVED" -*/ -enum RESERVED { - /* terminal symbols denoted by reserved words */ - TK_AND = FIRST_RESERVED, TK_BREAK, - TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, - TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, - TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, - /* other terminal symbols */ - TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, - TK_NAME, TK_STRING, TK_EOS -}; - -/* number of reserved words */ -#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) - - -/* array with token `names' */ -LUAI_DATA const char *const luaX_tokens []; - - -typedef union { - lua_Number r; - TString *ts; -} SemInfo; /* semantics information */ - - -typedef struct Token { - int token; - SemInfo seminfo; -} Token; - - -typedef struct LexState { - int current; /* current character (charint) */ - int linenumber; /* input line counter */ - int lastline; /* line of last token `consumed' */ - Token t; /* current token */ - Token lookahead; /* look ahead token */ - struct FuncState *fs; /* `FuncState' is private to the parser */ - struct lua_State *L; - ZIO *z; /* input stream */ - Mbuffer *buff; /* buffer for tokens */ - TString *source; /* current source name */ - char decpoint; /* locale decimal point */ -} LexState; - - -LUAI_FUNC void luaX_init (lua_State *L); -LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, - TString *source); -LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); -LUAI_FUNC void luaX_next (LexState *ls); -LUAI_FUNC void luaX_lookahead (LexState *ls); -LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); -LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); -LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/llimits.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/llimits.h deleted file mode 100644 index ca8dcb72..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/llimits.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ -** Limits, basic types, and some other `installation-dependent' definitions -** See Copyright Notice in lua.h -*/ - -#ifndef llimits_h -#define llimits_h - - -#include -#include - - -#include "lua.h" - - -typedef LUAI_UINT32 lu_int32; - -typedef LUAI_UMEM lu_mem; - -typedef LUAI_MEM l_mem; - - - -/* chars used as small naturals (so that `char' is reserved for characters) */ -typedef unsigned char lu_byte; - - -#define MAX_SIZET ((size_t)(~(size_t)0)-2) - -#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) - - -#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ - -/* -** conversion of pointer to integer -** this is for hashing only; there is no problem if the integer -** cannot hold the whole pointer value -*/ -#define IntPoint(p) ((unsigned int)(lu_mem)(p)) - - - -/* type to ensure maximum alignment */ -typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; - - -/* result of a `usual argument conversion' over lua_Number */ -typedef LUAI_UACNUMBER l_uacNumber; - - -/* internal assertions for in-house debugging */ -#ifdef lua_assert - -#define check_exp(c,e) (lua_assert(c), (e)) -#define api_check(l,e) lua_assert(e) - -#else - -#define lua_assert(c) ((void)0) -#define check_exp(c,e) (e) -#define api_check luai_apicheck - -#endif - - -#ifndef UNUSED -#define UNUSED(x) ((void)(x)) /* to avoid warnings */ -#endif - - -#ifndef cast -#define cast(t, exp) ((t)(exp)) -#endif - -#define cast_byte(i) cast(lu_byte, (i)) -#define cast_num(i) cast(lua_Number, (i)) -#define cast_int(i) cast(int, (i)) - - - -/* -** type for virtual-machine instructions -** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) -*/ -typedef lu_int32 Instruction; - - - -/* maximum stack for a Lua function */ -#define MAXSTACK 250 - - - -/* minimum size for the string table (must be power of 2) */ -#ifndef MINSTRTABSIZE -#define MINSTRTABSIZE 32 -#endif - - -/* minimum size for string buffer */ -#ifndef LUA_MINBUFFER -#define LUA_MINBUFFER 32 -#endif - - -#ifndef lua_lock -#define lua_lock(L) ((void) 0) -#define lua_unlock(L) ((void) 0) -#endif - -#ifndef luai_threadyield -#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} -#endif - - -/* -** macro to control inclusion of some hard tests on stack reallocation -*/ -#ifndef HARDSTACKTESTS -#define condhardstacktests(x) ((void)0) -#else -#define condhardstacktests(x) x -#endif - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmathlib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmathlib.c deleted file mode 100644 index 441fbf73..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmathlib.c +++ /dev/null @@ -1,263 +0,0 @@ -/* -** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ -** Standard mathematical library -** See Copyright Notice in lua.h -*/ - - -#include -#include - -#define lmathlib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#undef PI -#define PI (3.14159265358979323846) -#define RADIANS_PER_DEGREE (PI/180.0) - - - -static int math_abs (lua_State *L) { - lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sin (lua_State *L) { - lua_pushnumber(L, sin(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sinh (lua_State *L) { - lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); - return 1; -} - -static int math_cos (lua_State *L) { - lua_pushnumber(L, cos(luaL_checknumber(L, 1))); - return 1; -} - -static int math_cosh (lua_State *L) { - lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tan (lua_State *L) { - lua_pushnumber(L, tan(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tanh (lua_State *L) { - lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); - return 1; -} - -static int math_asin (lua_State *L) { - lua_pushnumber(L, asin(luaL_checknumber(L, 1))); - return 1; -} - -static int math_acos (lua_State *L) { - lua_pushnumber(L, acos(luaL_checknumber(L, 1))); - return 1; -} - -static int math_atan (lua_State *L) { - lua_pushnumber(L, atan(luaL_checknumber(L, 1))); - return 1; -} - -static int math_atan2 (lua_State *L) { - lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); - return 1; -} - -static int math_ceil (lua_State *L) { - lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); - return 1; -} - -static int math_floor (lua_State *L) { - lua_pushnumber(L, floor(luaL_checknumber(L, 1))); - return 1; -} - -static int math_fmod (lua_State *L) { - lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); - return 1; -} - -static int math_modf (lua_State *L) { - double ip; - double fp = modf(luaL_checknumber(L, 1), &ip); - lua_pushnumber(L, ip); - lua_pushnumber(L, fp); - return 2; -} - -static int math_sqrt (lua_State *L) { - lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); - return 1; -} - -static int math_pow (lua_State *L) { - lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); - return 1; -} - -static int math_log (lua_State *L) { - lua_pushnumber(L, log(luaL_checknumber(L, 1))); - return 1; -} - -static int math_log10 (lua_State *L) { - lua_pushnumber(L, log10(luaL_checknumber(L, 1))); - return 1; -} - -static int math_exp (lua_State *L) { - lua_pushnumber(L, exp(luaL_checknumber(L, 1))); - return 1; -} - -static int math_deg (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); - return 1; -} - -static int math_rad (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); - return 1; -} - -static int math_frexp (lua_State *L) { - int e; - lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); - lua_pushinteger(L, e); - return 2; -} - -static int math_ldexp (lua_State *L) { - lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); - return 1; -} - - - -static int math_min (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - lua_Number dmin = luaL_checknumber(L, 1); - int i; - for (i=2; i<=n; i++) { - lua_Number d = luaL_checknumber(L, i); - if (d < dmin) - dmin = d; - } - lua_pushnumber(L, dmin); - return 1; -} - - -static int math_max (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - lua_Number dmax = luaL_checknumber(L, 1); - int i; - for (i=2; i<=n; i++) { - lua_Number d = luaL_checknumber(L, i); - if (d > dmax) - dmax = d; - } - lua_pushnumber(L, dmax); - return 1; -} - - -static int math_random (lua_State *L) { - /* the `%' avoids the (rare) case of r==1, and is needed also because on - some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ - lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; - switch (lua_gettop(L)) { /* check number of arguments */ - case 0: { /* no arguments */ - lua_pushnumber(L, r); /* Number between 0 and 1 */ - break; - } - case 1: { /* only upper limit */ - int u = luaL_checkint(L, 1); - luaL_argcheck(L, 1<=u, 1, "interval is empty"); - lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ - break; - } - case 2: { /* lower and upper limits */ - int l = luaL_checkint(L, 1); - int u = luaL_checkint(L, 2); - luaL_argcheck(L, l<=u, 2, "interval is empty"); - lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ - break; - } - default: return luaL_error(L, "wrong number of arguments"); - } - return 1; -} - - -static int math_randomseed (lua_State *L) { - srand(luaL_checkint(L, 1)); - return 0; -} - - -static const luaL_Reg mathlib[] = { - {"abs", math_abs}, - {"acos", math_acos}, - {"asin", math_asin}, - {"atan2", math_atan2}, - {"atan", math_atan}, - {"ceil", math_ceil}, - {"cosh", math_cosh}, - {"cos", math_cos}, - {"deg", math_deg}, - {"exp", math_exp}, - {"floor", math_floor}, - {"fmod", math_fmod}, - {"frexp", math_frexp}, - {"ldexp", math_ldexp}, - {"log10", math_log10}, - {"log", math_log}, - {"max", math_max}, - {"min", math_min}, - {"modf", math_modf}, - {"pow", math_pow}, - {"rad", math_rad}, - {"random", math_random}, - {"randomseed", math_randomseed}, - {"sinh", math_sinh}, - {"sin", math_sin}, - {"sqrt", math_sqrt}, - {"tanh", math_tanh}, - {"tan", math_tan}, - {NULL, NULL} -}; - - -/* -** Open math library -*/ -LUALIB_API int luaopen_math (lua_State *L) { - luaL_register(L, LUA_MATHLIBNAME, mathlib); - lua_pushnumber(L, PI); - lua_setfield(L, -2, "pi"); - lua_pushnumber(L, HUGE_VAL); - lua_setfield(L, -2, "huge"); -#if defined(LUA_COMPAT_MOD) - lua_getfield(L, -1, "fmod"); - lua_setfield(L, -2, "mod"); -#endif - return 1; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmem.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmem.c deleted file mode 100644 index ae7d8c96..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmem.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - - -#include - -#define lmem_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -/* -** About the realloc function: -** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); -** (`osize' is the old size, `nsize' is the new size) -** -** Lua ensures that (ptr == NULL) iff (osize == 0). -** -** * frealloc(ud, NULL, 0, x) creates a new block of size `x' -** -** * frealloc(ud, p, x, 0) frees the block `p' -** (in this specific case, frealloc must return NULL). -** particularly, frealloc(ud, NULL, 0, 0) does nothing -** (which is equivalent to free(NULL) in ANSI C) -** -** frealloc returns NULL if it cannot create or reallocate the area -** (any reallocation to an equal or smaller size cannot fail!) -*/ - - - -#define MINSIZEARRAY 4 - - -void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, - int limit, const char *errormsg) { - void *newblock; - int newsize; - if (*size >= limit/2) { /* cannot double it? */ - if (*size >= limit) /* cannot grow even a little? */ - luaG_runerror(L, errormsg); - newsize = limit; /* still have at least one free place */ - } - else { - newsize = (*size)*2; - if (newsize < MINSIZEARRAY) - newsize = MINSIZEARRAY; /* minimum size */ - } - newblock = luaM_reallocv(L, block, *size, newsize, size_elems); - *size = newsize; /* update only when everything else is OK */ - return newblock; -} - - -void *luaM_toobig (lua_State *L) { - luaG_runerror(L, "memory allocation error: block too big"); - return NULL; /* to avoid warnings */ -} - - - -/* -** generic allocation routine. -*/ -void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { - global_State *g = G(L); - lua_assert((osize == 0) == (block == NULL)); - block = (*g->frealloc)(g->ud, block, osize, nsize); - if (block == NULL && nsize > 0) - luaD_throw(L, LUA_ERRMEM); - lua_assert((nsize == 0) == (block == NULL)); - g->totalbytes = (g->totalbytes - osize) + nsize; - return block; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmem.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmem.h deleted file mode 100644 index 7c2dcb32..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lmem.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#ifndef lmem_h -#define lmem_h - - -#include - -#include "llimits.h" -#include "lua.h" - -#define MEMERRMSG "not enough memory" - - -#define luaM_reallocv(L,b,on,n,e) \ - ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ - luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ - luaM_toobig(L)) - -#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) -#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) -#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) - -#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) -#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) -#define luaM_newvector(L,n,t) \ - cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) - -#define luaM_growvector(L,v,nelems,size,t,limit,e) \ - if ((nelems)+1 > (size)) \ - ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) - -#define luaM_reallocvector(L, v,oldn,n,t) \ - ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) - - -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, - size_t size); -LUAI_FUNC void *luaM_toobig (lua_State *L); -LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, - size_t size_elem, int limit, - const char *errormsg); - -#endif - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/loadlib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/loadlib.c deleted file mode 100644 index 6158c535..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/loadlib.c +++ /dev/null @@ -1,666 +0,0 @@ -/* -** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $ -** Dynamic library loader for Lua -** See Copyright Notice in lua.h -** -** This module contains an implementation of loadlib for Unix systems -** that have dlfcn, an implementation for Darwin (Mac OS X), an -** implementation for Windows, and a stub for other systems. -*/ - - -#include -#include - - -#define loadlib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* prefix for open functions in C libraries */ -#define LUA_POF "luaopen_" - -/* separator for open functions in C libraries */ -#define LUA_OFSEP "_" - - -#define LIBPREFIX "LOADLIB: " - -#define POF LUA_POF -#define LIB_FAIL "open" - - -/* error codes for ll_loadfunc */ -#define ERRLIB 1 -#define ERRFUNC 2 - -#define setprogdir(L) ((void)0) - - -static void ll_unloadlib (void *lib); -static void *ll_load (lua_State *L, const char *path); -static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); - - - -#if defined(LUA_DL_DLOPEN) -/* -** {======================================================================== -** This is an implementation of loadlib based on the dlfcn interface. -** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, -** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least -** as an emulation layer on top of native functions. -** ========================================================================= -*/ - -#include - -static void ll_unloadlib (void *lib) { - dlclose(lib); -} - - -static void *ll_load (lua_State *L, const char *path) { - void *lib = dlopen(path, RTLD_NOW); - if (lib == NULL) lua_pushstring(L, dlerror()); - return lib; -} - - -static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = (lua_CFunction)dlsym(lib, sym); - if (f == NULL) lua_pushstring(L, dlerror()); - return f; -} - -/* }====================================================== */ - - - -#elif defined(LUA_DL_DLL) -/* -** {====================================================================== -** This is an implementation of loadlib for Windows using native functions. -** ======================================================================= -*/ - -#include - - -#undef setprogdir - -static void setprogdir (lua_State *L) { - char buff[MAX_PATH + 1]; - char *lb; - DWORD nsize = sizeof(buff)/sizeof(char); - DWORD n = GetModuleFileNameA(NULL, buff, nsize); - if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) - luaL_error(L, "unable to get ModuleFileName"); - else { - *lb = '\0'; - luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); - lua_remove(L, -2); /* remove original string */ - } -} - - -static void pusherror (lua_State *L) { - int error = GetLastError(); - char buffer[128]; - if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error, 0, buffer, sizeof(buffer), NULL)) - lua_pushstring(L, buffer); - else - lua_pushfstring(L, "system error %d\n", error); -} - -static void ll_unloadlib (void *lib) { - FreeLibrary((HINSTANCE)lib); -} - - -static void *ll_load (lua_State *L, const char *path) { - HINSTANCE lib = LoadLibraryA(path); - if (lib == NULL) pusherror(L); - return lib; -} - - -static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); - if (f == NULL) pusherror(L); - return f; -} - -/* }====================================================== */ - - - -#elif defined(LUA_DL_DYLD) -/* -** {====================================================================== -** Native Mac OS X / Darwin Implementation -** ======================================================================= -*/ - -#include - - -/* Mac appends a `_' before C function names */ -#undef POF -#define POF "_" LUA_POF - - -static void pusherror (lua_State *L) { - const char *err_str; - const char *err_file; - NSLinkEditErrors err; - int err_num; - NSLinkEditError(&err, &err_num, &err_file, &err_str); - lua_pushstring(L, err_str); -} - - -static const char *errorfromcode (NSObjectFileImageReturnCode ret) { - switch (ret) { - case NSObjectFileImageInappropriateFile: - return "file is not a bundle"; - case NSObjectFileImageArch: - return "library is for wrong CPU type"; - case NSObjectFileImageFormat: - return "bad format"; - case NSObjectFileImageAccess: - return "cannot access file"; - case NSObjectFileImageFailure: - default: - return "unable to load library"; - } -} - - -static void ll_unloadlib (void *lib) { - NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); -} - - -static void *ll_load (lua_State *L, const char *path) { - NSObjectFileImage img; - NSObjectFileImageReturnCode ret; - /* this would be a rare case, but prevents crashing if it happens */ - if(!_dyld_present()) { - lua_pushliteral(L, "dyld not present"); - return NULL; - } - ret = NSCreateObjectFileImageFromFile(path, &img); - if (ret == NSObjectFileImageSuccess) { - NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | - NSLINKMODULE_OPTION_RETURN_ON_ERROR); - NSDestroyObjectFileImage(img); - if (mod == NULL) pusherror(L); - return mod; - } - lua_pushstring(L, errorfromcode(ret)); - return NULL; -} - - -static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { - NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); - if (nss == NULL) { - lua_pushfstring(L, "symbol " LUA_QS " not found", sym); - return NULL; - } - return (lua_CFunction)NSAddressOfSymbol(nss); -} - -/* }====================================================== */ - - - -#else -/* -** {====================================================== -** Fallback for other systems -** ======================================================= -*/ - -#undef LIB_FAIL -#define LIB_FAIL "absent" - - -#define DLMSG "dynamic libraries not enabled; check your Lua installation" - - -static void ll_unloadlib (void *lib) { - (void)lib; /* to avoid warnings */ -} - - -static void *ll_load (lua_State *L, const char *path) { - (void)path; /* to avoid warnings */ - lua_pushliteral(L, DLMSG); - return NULL; -} - - -static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { - (void)lib; (void)sym; /* to avoid warnings */ - lua_pushliteral(L, DLMSG); - return NULL; -} - -/* }====================================================== */ -#endif - - - -static void **ll_register (lua_State *L, const char *path) { - void **plib; - lua_pushfstring(L, "%s%s", LIBPREFIX, path); - lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ - if (!lua_isnil(L, -1)) /* is there an entry? */ - plib = (void **)lua_touserdata(L, -1); - else { /* no entry yet; create one */ - lua_pop(L, 1); - plib = (void **)lua_newuserdata(L, sizeof(const void *)); - *plib = NULL; - luaL_getmetatable(L, "_LOADLIB"); - lua_setmetatable(L, -2); - lua_pushfstring(L, "%s%s", LIBPREFIX, path); - lua_pushvalue(L, -2); - lua_settable(L, LUA_REGISTRYINDEX); - } - return plib; -} - - -/* -** __gc tag method: calls library's `ll_unloadlib' function with the lib -** handle -*/ -static int gctm (lua_State *L) { - void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); - if (*lib) ll_unloadlib(*lib); - *lib = NULL; /* mark library as closed */ - return 0; -} - - -static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { - void **reg = ll_register(L, path); - if (*reg == NULL) *reg = ll_load(L, path); - if (*reg == NULL) - return ERRLIB; /* unable to load library */ - else { - lua_CFunction f = ll_sym(L, *reg, sym); - if (f == NULL) - return ERRFUNC; /* unable to find function */ - lua_pushcfunction(L, f); - return 0; /* return function */ - } -} - - -static int ll_loadlib (lua_State *L) { - const char *path = luaL_checkstring(L, 1); - const char *init = luaL_checkstring(L, 2); - int stat = ll_loadfunc(L, path, init); - if (stat == 0) /* no errors? */ - return 1; /* return the loaded function */ - else { /* error; error message is on stack top */ - lua_pushnil(L); - lua_insert(L, -2); - lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); - return 3; /* return nil, error message, and where */ - } -} - - - -/* -** {====================================================== -** 'require' function -** ======================================================= -*/ - - -static int readable (const char *filename) { - FILE *f = fopen(filename, "r"); /* try to open file */ - if (f == NULL) return 0; /* open failed */ - fclose(f); - return 1; -} - - -static const char *pushnexttemplate (lua_State *L, const char *path) { - const char *l; - while (*path == *LUA_PATHSEP) path++; /* skip separators */ - if (*path == '\0') return NULL; /* no more templates */ - l = strchr(path, *LUA_PATHSEP); /* find next separator */ - if (l == NULL) l = path + strlen(path); - lua_pushlstring(L, path, l - path); /* template */ - return l; -} - - -static const char *findfile (lua_State *L, const char *name, - const char *pname) { - const char *path; - name = luaL_gsub(L, name, ".", LUA_DIRSEP); - lua_getfield(L, LUA_ENVIRONINDEX, pname); - path = lua_tostring(L, -1); - if (path == NULL) - luaL_error(L, LUA_QL("package.%s") " must be a string", pname); - lua_pushliteral(L, ""); /* error accumulator */ - while ((path = pushnexttemplate(L, path)) != NULL) { - const char *filename; - filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); - lua_remove(L, -2); /* remove path template */ - if (readable(filename)) /* does file exist and is readable? */ - return filename; /* return that file name */ - lua_pushfstring(L, "\n\tno file " LUA_QS, filename); - lua_remove(L, -2); /* remove file name */ - lua_concat(L, 2); /* add entry to possible error message */ - } - return NULL; /* not found */ -} - - -static void loaderror (lua_State *L, const char *filename) { - luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", - lua_tostring(L, 1), filename, lua_tostring(L, -1)); -} - - -static int loader_Lua (lua_State *L) { - const char *filename; - const char *name = luaL_checkstring(L, 1); - filename = findfile(L, name, "path"); - if (filename == NULL) return 1; /* library not found in this path */ - if (luaL_loadfile(L, filename) != 0) - loaderror(L, filename); - return 1; /* library loaded successfully */ -} - - -static const char *mkfuncname (lua_State *L, const char *modname) { - const char *funcname; - const char *mark = strchr(modname, *LUA_IGMARK); - if (mark) modname = mark + 1; - funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); - funcname = lua_pushfstring(L, POF"%s", funcname); - lua_remove(L, -2); /* remove 'gsub' result */ - return funcname; -} - - -static int loader_C (lua_State *L) { - const char *funcname; - const char *name = luaL_checkstring(L, 1); - const char *filename = findfile(L, name, "cpath"); - if (filename == NULL) return 1; /* library not found in this path */ - funcname = mkfuncname(L, name); - if (ll_loadfunc(L, filename, funcname) != 0) - loaderror(L, filename); - return 1; /* library loaded successfully */ -} - - -static int loader_Croot (lua_State *L) { - const char *funcname; - const char *filename; - const char *name = luaL_checkstring(L, 1); - const char *p = strchr(name, '.'); - int stat; - if (p == NULL) return 0; /* is root */ - lua_pushlstring(L, name, p - name); - filename = findfile(L, lua_tostring(L, -1), "cpath"); - if (filename == NULL) return 1; /* root not found */ - funcname = mkfuncname(L, name); - if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { - if (stat != ERRFUNC) loaderror(L, filename); /* real error */ - lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, - name, filename); - return 1; /* function not found */ - } - return 1; -} - - -static int loader_preload (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - lua_getfield(L, LUA_ENVIRONINDEX, "preload"); - if (!lua_istable(L, -1)) - luaL_error(L, LUA_QL("package.preload") " must be a table"); - lua_getfield(L, -1, name); - if (lua_isnil(L, -1)) /* not found? */ - lua_pushfstring(L, "\n\tno field package.preload['%s']", name); - return 1; -} - - -static const int sentinel_ = 0; -#define sentinel ((void *)&sentinel_) - - -static int ll_require (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - int i; - lua_settop(L, 1); /* _LOADED table will be at index 2 */ - lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); - lua_getfield(L, 2, name); - if (lua_toboolean(L, -1)) { /* is it there? */ - if (lua_touserdata(L, -1) == sentinel) /* check loops */ - luaL_error(L, "loop or previous error loading module " LUA_QS, name); - return 1; /* package is already loaded */ - } - /* else must load it; iterate over available loaders */ - lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); - if (!lua_istable(L, -1)) - luaL_error(L, LUA_QL("package.loaders") " must be a table"); - lua_pushliteral(L, ""); /* error message accumulator */ - for (i=1; ; i++) { - lua_rawgeti(L, -2, i); /* get a loader */ - if (lua_isnil(L, -1)) - luaL_error(L, "module " LUA_QS " not found:%s", - name, lua_tostring(L, -2)); - lua_pushstring(L, name); - lua_call(L, 1, 1); /* call it */ - if (lua_isfunction(L, -1)) /* did it find module? */ - break; /* module loaded successfully */ - else if (lua_isstring(L, -1)) /* loader returned error message? */ - lua_concat(L, 2); /* accumulate it */ - else - lua_pop(L, 1); - } - lua_pushlightuserdata(L, sentinel); - lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ - lua_pushstring(L, name); /* pass name as argument to module */ - lua_call(L, 1, 1); /* run loaded module */ - if (!lua_isnil(L, -1)) /* non-nil return? */ - lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ - lua_getfield(L, 2, name); - if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ - lua_pushboolean(L, 1); /* use true as result */ - lua_pushvalue(L, -1); /* extra copy to be returned */ - lua_setfield(L, 2, name); /* _LOADED[name] = true */ - } - return 1; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** 'module' function -** ======================================================= -*/ - - -static void setfenv (lua_State *L) { - lua_Debug ar; - if (lua_getstack(L, 1, &ar) == 0 || - lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ - lua_iscfunction(L, -1)) - luaL_error(L, LUA_QL("module") " not called from a Lua function"); - lua_pushvalue(L, -2); - lua_setfenv(L, -2); - lua_pop(L, 1); -} - - -static void dooptions (lua_State *L, int n) { - int i; - for (i = 2; i <= n; i++) { - lua_pushvalue(L, i); /* get option (a function) */ - lua_pushvalue(L, -2); /* module */ - lua_call(L, 1, 0); - } -} - - -static void modinit (lua_State *L, const char *modname) { - const char *dot; - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_M"); /* module._M = module */ - lua_pushstring(L, modname); - lua_setfield(L, -2, "_NAME"); - dot = strrchr(modname, '.'); /* look for last dot in module name */ - if (dot == NULL) dot = modname; - else dot++; - /* set _PACKAGE as package name (full module name minus last part) */ - lua_pushlstring(L, modname, dot - modname); - lua_setfield(L, -2, "_PACKAGE"); -} - - -static int ll_module (lua_State *L) { - const char *modname = luaL_checkstring(L, 1); - int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ - lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); - lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ - if (!lua_istable(L, -1)) { /* not found? */ - lua_pop(L, 1); /* remove previous result */ - /* try global variable (and create one if it does not exist) */ - if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) - return luaL_error(L, "name conflict for module " LUA_QS, modname); - lua_pushvalue(L, -1); - lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ - } - /* check whether table already has a _NAME field */ - lua_getfield(L, -1, "_NAME"); - if (!lua_isnil(L, -1)) /* is table an initialized module? */ - lua_pop(L, 1); - else { /* no; initialize it */ - lua_pop(L, 1); - modinit(L, modname); - } - lua_pushvalue(L, -1); - setfenv(L); - dooptions(L, loaded - 1); - return 0; -} - - -static int ll_seeall (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - if (!lua_getmetatable(L, 1)) { - lua_createtable(L, 0, 1); /* create new metatable */ - lua_pushvalue(L, -1); - lua_setmetatable(L, 1); - } - lua_pushvalue(L, LUA_GLOBALSINDEX); - lua_setfield(L, -2, "__index"); /* mt.__index = _G */ - return 0; -} - - -/* }====================================================== */ - - - -/* auxiliary mark (for internal use) */ -#define AUXMARK "\1" - -static void setpath (lua_State *L, const char *fieldname, const char *envname, - const char *def) { - const char *path = getenv(envname); - if (path == NULL) /* no environment variable? */ - lua_pushstring(L, def); /* use default */ - else { - /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ - path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, - LUA_PATHSEP AUXMARK LUA_PATHSEP); - luaL_gsub(L, path, AUXMARK, def); - lua_remove(L, -2); - } - setprogdir(L); - lua_setfield(L, -2, fieldname); -} - - -static const luaL_Reg pk_funcs[] = { - {"loadlib", ll_loadlib}, - {"seeall", ll_seeall}, - {NULL, NULL} -}; - - -static const luaL_Reg ll_funcs[] = { - {"module", ll_module}, - {"require", ll_require}, - {NULL, NULL} -}; - - -static const lua_CFunction loaders[] = - {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; - - -LUALIB_API int luaopen_package (lua_State *L) { - int i; - /* create new type _LOADLIB */ - luaL_newmetatable(L, "_LOADLIB"); - lua_pushcfunction(L, gctm); - lua_setfield(L, -2, "__gc"); - /* create `package' table */ - luaL_register(L, LUA_LOADLIBNAME, pk_funcs); -#if defined(LUA_COMPAT_LOADLIB) - lua_getfield(L, -1, "loadlib"); - lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); -#endif - lua_pushvalue(L, -1); - lua_replace(L, LUA_ENVIRONINDEX); - /* create `loaders' table */ - lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0); - /* fill it with pre-defined loaders */ - for (i=0; loaders[i] != NULL; i++) { - lua_pushcfunction(L, loaders[i]); - lua_rawseti(L, -2, i+1); - } - lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ - setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ - setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ - /* store config information */ - lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" - LUA_EXECDIR "\n" LUA_IGMARK); - lua_setfield(L, -2, "config"); - /* set field `loaded' */ - luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); - lua_setfield(L, -2, "loaded"); - /* set field `preload' */ - lua_newtable(L); - lua_setfield(L, -2, "preload"); - lua_pushvalue(L, LUA_GLOBALSINDEX); - luaL_register(L, NULL, ll_funcs); /* open lib into global table */ - lua_pop(L, 1); - return 1; /* return 'package' table */ -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lobject.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lobject.c deleted file mode 100644 index 4ff50732..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lobject.c +++ /dev/null @@ -1,214 +0,0 @@ -/* -** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ -** Some generic functions over Lua objects -** See Copyright Notice in lua.h -*/ - -#include -#include -#include -#include -#include - -#define lobject_c -#define LUA_CORE - -#include "lua.h" - -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "lvm.h" - - - -const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; - - -/* -** converts an integer to a "floating point byte", represented as -** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if -** eeeee != 0 and (xxx) otherwise. -*/ -int luaO_int2fb (unsigned int x) { - int e = 0; /* expoent */ - while (x >= 16) { - x = (x+1) >> 1; - e++; - } - if (x < 8) return x; - else return ((e+1) << 3) | (cast_int(x) - 8); -} - - -/* converts back */ -int luaO_fb2int (int x) { - int e = (x >> 3) & 31; - if (e == 0) return x; - else return ((x & 7)+8) << (e - 1); -} - - -int luaO_log2 (unsigned int x) { - static const lu_byte log_2[256] = { - 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 - }; - int l = -1; - while (x >= 256) { l += 8; x >>= 8; } - return l + log_2[x]; - -} - - -int luaO_rawequalObj (const TValue *t1, const TValue *t2) { - if (ttype(t1) != ttype(t2)) return 0; - else switch (ttype(t1)) { - case LUA_TNIL: - return 1; - case LUA_TNUMBER: - return luai_numeq(nvalue(t1), nvalue(t2)); - case LUA_TBOOLEAN: - return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ - case LUA_TLIGHTUSERDATA: - return pvalue(t1) == pvalue(t2); - default: - lua_assert(iscollectable(t1)); - return gcvalue(t1) == gcvalue(t2); - } -} - - -int luaO_str2d (const char *s, lua_Number *result) { - char *endptr; - *result = lua_str2number(s, &endptr); - if (endptr == s) return 0; /* conversion failed */ - if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ - *result = cast_num(strtoul(s, &endptr, 16)); - if (*endptr == '\0') return 1; /* most common case */ - while (isspace(cast(unsigned char, *endptr))) endptr++; - if (*endptr != '\0') return 0; /* invalid trailing characters? */ - return 1; -} - - - -static void pushstr (lua_State *L, const char *str) { - setsvalue2s(L, L->top, luaS_new(L, str)); - incr_top(L); -} - - -/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ -const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { - int n = 1; - pushstr(L, ""); - for (;;) { - const char *e = strchr(fmt, '%'); - if (e == NULL) break; - setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); - incr_top(L); - switch (*(e+1)) { - case 's': { - const char *s = va_arg(argp, char *); - if (s == NULL) s = "(null)"; - pushstr(L, s); - break; - } - case 'c': { - char buff[2]; - buff[0] = cast(char, va_arg(argp, int)); - buff[1] = '\0'; - pushstr(L, buff); - break; - } - case 'd': { - setnvalue(L->top, cast_num(va_arg(argp, int))); - incr_top(L); - break; - } - case 'f': { - setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); - incr_top(L); - break; - } - case 'p': { - char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ - sprintf(buff, "%p", va_arg(argp, void *)); - pushstr(L, buff); - break; - } - case '%': { - pushstr(L, "%"); - break; - } - default: { - char buff[3]; - buff[0] = '%'; - buff[1] = *(e+1); - buff[2] = '\0'; - pushstr(L, buff); - break; - } - } - n += 2; - fmt = e+2; - } - pushstr(L, fmt); - luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); - L->top -= n; - return svalue(L->top - 1); -} - - -const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - return msg; -} - - -void luaO_chunkid (char *out, const char *source, size_t bufflen) { - if (*source == '=') { - strncpy(out, source+1, bufflen); /* remove first char */ - out[bufflen-1] = '\0'; /* ensures null termination */ - } - else { /* out = "source", or "...source" */ - if (*source == '@') { - size_t l; - source++; /* skip the `@' */ - bufflen -= sizeof(" '...' "); - l = strlen(source); - strcpy(out, ""); - if (l > bufflen) { - source += (l-bufflen); /* get last part of file name */ - strcat(out, "..."); - } - strcat(out, source); - } - else { /* out = [string "string"] */ - size_t len = strcspn(source, "\n\r"); /* stop at first newline */ - bufflen -= sizeof(" [string \"...\"] "); - if (len > bufflen) len = bufflen; - strcpy(out, "[string \""); - if (source[len] != '\0') { /* must truncate? */ - strncat(out, source, len); - strcat(out, "..."); - } - else - strcat(out, source); - strcat(out, "\"]"); - } - } -} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lobject.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lobject.h deleted file mode 100644 index f1e447ef..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lobject.h +++ /dev/null @@ -1,381 +0,0 @@ -/* -** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ -** Type definitions for Lua objects -** See Copyright Notice in lua.h -*/ - - -#ifndef lobject_h -#define lobject_h - - -#include - - -#include "llimits.h" -#include "lua.h" - - -/* tags for values visible from Lua */ -#define LAST_TAG LUA_TTHREAD - -#define NUM_TAGS (LAST_TAG+1) - - -/* -** Extra tags for non-values -*/ -#define LUA_TPROTO (LAST_TAG+1) -#define LUA_TUPVAL (LAST_TAG+2) -#define LUA_TDEADKEY (LAST_TAG+3) - - -/* -** Union of all collectable objects -*/ -typedef union GCObject GCObject; - - -/* -** Common Header for all collectable objects (in macro form, to be -** included in other objects) -*/ -#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked - - -/* -** Common header in struct form -*/ -typedef struct GCheader { - CommonHeader; -} GCheader; - - - - -/* -** Union of all Lua values -*/ -typedef union { - GCObject *gc; - void *p; - lua_Number n; - int b; -} Value; - - -/* -** Tagged Values -*/ - -#define TValuefields Value value; int tt - -typedef struct lua_TValue { - TValuefields; -} TValue; - - -/* Macros to test type */ -#define ttisnil(o) (ttype(o) == LUA_TNIL) -#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) -#define ttisstring(o) (ttype(o) == LUA_TSTRING) -#define ttistable(o) (ttype(o) == LUA_TTABLE) -#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) -#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) -#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) -#define ttisthread(o) (ttype(o) == LUA_TTHREAD) -#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) - -/* Macros to access values */ -#define ttype(o) ((o)->tt) -#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) -#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) -#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) -#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) -#define tsvalue(o) (&rawtsvalue(o)->tsv) -#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) -#define uvalue(o) (&rawuvalue(o)->uv) -#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) -#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) -#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) -#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) - -#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) - -/* -** for internal debug only -*/ -#define checkconsistency(obj) \ - lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) - -#define checkliveness(g,obj) \ - lua_assert(!iscollectable(obj) || \ - ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) - - -/* Macros to set values */ -#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) - -#define setnvalue(obj,x) \ - { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } - -#define setpvalue(obj,x) \ - { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } - -#define setbvalue(obj,x) \ - { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } - -#define setsvalue(L,obj,x) \ - { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ - checkliveness(G(L),i_o); } - -#define setuvalue(L,obj,x) \ - { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ - checkliveness(G(L),i_o); } - -#define setthvalue(L,obj,x) \ - { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ - checkliveness(G(L),i_o); } - -#define setclvalue(L,obj,x) \ - { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ - checkliveness(G(L),i_o); } - -#define sethvalue(L,obj,x) \ - { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ - checkliveness(G(L),i_o); } - -#define setptvalue(L,obj,x) \ - { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ - checkliveness(G(L),i_o); } - - - - -#define setobj(L,obj1,obj2) \ - { const TValue *o2=(obj2); TValue *o1=(obj1); \ - o1->value = o2->value; o1->tt=o2->tt; \ - checkliveness(G(L),o1); } - - -/* -** different types of sets, according to destination -*/ - -/* from stack to (same) stack */ -#define setobjs2s setobj -/* to stack (not from same stack) */ -#define setobj2s setobj -#define setsvalue2s setsvalue -#define sethvalue2s sethvalue -#define setptvalue2s setptvalue -/* from table to same table */ -#define setobjt2t setobj -/* to table */ -#define setobj2t setobj -/* to new object */ -#define setobj2n setobj -#define setsvalue2n setsvalue - -#define setttype(obj, tt) (ttype(obj) = (tt)) - - -#define iscollectable(o) (ttype(o) >= LUA_TSTRING) - - - -typedef TValue *StkId; /* index to stack elements */ - - -/* -** String headers for string table -*/ -typedef union TString { - L_Umaxalign dummy; /* ensures maximum alignment for strings */ - struct { - CommonHeader; - lu_byte reserved; - unsigned int hash; - size_t len; - } tsv; -} TString; - - -#define getstr(ts) cast(const char *, (ts) + 1) -#define svalue(o) getstr(rawtsvalue(o)) - - - -typedef union Udata { - L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ - struct { - CommonHeader; - struct Table *metatable; - struct Table *env; - size_t len; - } uv; -} Udata; - - - - -/* -** Function Prototypes -*/ -typedef struct Proto { - CommonHeader; - TValue *k; /* constants used by the function */ - Instruction *code; - struct Proto **p; /* functions defined inside the function */ - int *lineinfo; /* map from opcodes to source lines */ - struct LocVar *locvars; /* information about local variables */ - TString **upvalues; /* upvalue names */ - TString *source; - int sizeupvalues; - int sizek; /* size of `k' */ - int sizecode; - int sizelineinfo; - int sizep; /* size of `p' */ - int sizelocvars; - int linedefined; - int lastlinedefined; - GCObject *gclist; - lu_byte nups; /* number of upvalues */ - lu_byte numparams; - lu_byte is_vararg; - lu_byte maxstacksize; -} Proto; - - -/* masks for new-style vararg */ -#define VARARG_HASARG 1 -#define VARARG_ISVARARG 2 -#define VARARG_NEEDSARG 4 - - -typedef struct LocVar { - TString *varname; - int startpc; /* first point where variable is active */ - int endpc; /* first point where variable is dead */ -} LocVar; - - - -/* -** Upvalues -*/ - -typedef struct UpVal { - CommonHeader; - TValue *v; /* points to stack or to its own value */ - union { - TValue value; /* the value (when closed) */ - struct { /* double linked list (when open) */ - struct UpVal *prev; - struct UpVal *next; - } l; - } u; -} UpVal; - - -/* -** Closures -*/ - -#define ClosureHeader \ - CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ - struct Table *env - -typedef struct CClosure { - ClosureHeader; - lua_CFunction f; - TValue upvalue[1]; -} CClosure; - - -typedef struct LClosure { - ClosureHeader; - struct Proto *p; - UpVal *upvals[1]; -} LClosure; - - -typedef union Closure { - CClosure c; - LClosure l; -} Closure; - - -#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) -#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) - - -/* -** Tables -*/ - -typedef union TKey { - struct { - TValuefields; - struct Node *next; /* for chaining */ - } nk; - TValue tvk; -} TKey; - - -typedef struct Node { - TValue i_val; - TKey i_key; -} Node; - - -typedef struct Table { - CommonHeader; - lu_byte flags; /* 1<

lsizenode)) - - -#define luaO_nilobject (&luaO_nilobject_) - -LUAI_DATA const TValue luaO_nilobject_; - -#define ceillog2(x) (luaO_log2((x)-1) + 1) - -LUAI_FUNC int luaO_log2 (unsigned int x); -LUAI_FUNC int luaO_int2fb (unsigned int x); -LUAI_FUNC int luaO_fb2int (int x); -LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); -LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); -LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, - va_list argp); -LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); -LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); - - -#endif - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lopcodes.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lopcodes.c deleted file mode 100644 index 4cc74523..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lopcodes.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ -** See Copyright Notice in lua.h -*/ - - -#define lopcodes_c -#define LUA_CORE - - -#include "lopcodes.h" - - -/* ORDER OP */ - -const char *const luaP_opnames[NUM_OPCODES+1] = { - "MOVE", - "LOADK", - "LOADBOOL", - "LOADNIL", - "GETUPVAL", - "GETGLOBAL", - "GETTABLE", - "SETGLOBAL", - "SETUPVAL", - "SETTABLE", - "NEWTABLE", - "SELF", - "ADD", - "SUB", - "MUL", - "DIV", - "MOD", - "POW", - "UNM", - "NOT", - "LEN", - "CONCAT", - "JMP", - "EQ", - "LT", - "LE", - "TEST", - "TESTSET", - "CALL", - "TAILCALL", - "RETURN", - "FORLOOP", - "FORPREP", - "TFORLOOP", - "SETLIST", - "CLOSE", - "CLOSURE", - "VARARG", - NULL -}; - - -#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) - -const lu_byte luaP_opmodes[NUM_OPCODES] = { -/* T A B C mode opcode */ - opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ - ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ - ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ - ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ - ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ - ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ - ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ - ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ - ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ - ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ - ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ - ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ -}; - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lopcodes.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lopcodes.h deleted file mode 100644 index 41224d6e..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lopcodes.h +++ /dev/null @@ -1,268 +0,0 @@ -/* -** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lopcodes_h -#define lopcodes_h - -#include "llimits.h" - - -/*=========================================================================== - We assume that instructions are unsigned numbers. - All instructions have an opcode in the first 6 bits. - Instructions can have the following fields: - `A' : 8 bits - `B' : 9 bits - `C' : 9 bits - `Bx' : 18 bits (`B' and `C' together) - `sBx' : signed Bx - - A signed argument is represented in excess K; that is, the number - value is the unsigned value minus K. K is exactly the maximum value - for that argument (so that -max is represented by 0, and +max is - represented by 2*max), which is half the maximum for the corresponding - unsigned argument. -===========================================================================*/ - - -enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ - - -/* -** size and position of opcode arguments. -*/ -#define SIZE_C 9 -#define SIZE_B 9 -#define SIZE_Bx (SIZE_C + SIZE_B) -#define SIZE_A 8 - -#define SIZE_OP 6 - -#define POS_OP 0 -#define POS_A (POS_OP + SIZE_OP) -#define POS_C (POS_A + SIZE_A) -#define POS_B (POS_C + SIZE_C) -#define POS_Bx POS_C - - -/* -** limits for opcode arguments. -** we use (signed) int to manipulate most arguments, -** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) -*/ -#if SIZE_Bx < LUAI_BITSINT-1 -#define MAXARG_Bx ((1<>1) /* `sBx' is signed */ -#else -#define MAXARG_Bx MAX_INT -#define MAXARG_sBx MAX_INT -#endif - - -#define MAXARG_A ((1<>POS_OP) & MASK1(SIZE_OP,0))) -#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ - ((cast(Instruction, o)<>POS_A) & MASK1(SIZE_A,0))) -#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ - ((cast(Instruction, u)<>POS_B) & MASK1(SIZE_B,0))) -#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ - ((cast(Instruction, b)<>POS_C) & MASK1(SIZE_C,0))) -#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ - ((cast(Instruction, b)<>POS_Bx) & MASK1(SIZE_Bx,0))) -#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ - ((cast(Instruction, b)< C) then pc++ */ -OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ - -OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ - -OP_FORLOOP,/* A sBx R(A)+=R(A+2); - if R(A) =) R(A)*/ -OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ - -OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ -} OpCode; - - -#define NUM_OPCODES (cast(int, OP_VARARG) + 1) - - - -/*=========================================================================== - Notes: - (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, - and can be 0: OP_CALL then sets `top' to last_result+1, so - next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. - - (*) In OP_VARARG, if (B == 0) then use actual number of varargs and - set top (like in OP_CALL with C == 0). - - (*) In OP_RETURN, if (B == 0) then return up to `top' - - (*) In OP_SETLIST, if (B == 0) then B = `top'; - if (C == 0) then next `instruction' is real C - - (*) For comparisons, A specifies what condition the test should accept - (true or false). - - (*) All `skips' (pc++) assume that next instruction is a jump -===========================================================================*/ - - -/* -** masks for instruction properties. The format is: -** bits 0-1: op mode -** bits 2-3: C arg mode -** bits 4-5: B arg mode -** bit 6: instruction set register A -** bit 7: operator is a test -*/ - -enum OpArgMask { - OpArgN, /* argument is not used */ - OpArgU, /* argument is used */ - OpArgR, /* argument is a register or a jump offset */ - OpArgK /* argument is a constant or register/constant */ -}; - -LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; - -#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) -#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) -#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) -#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) -#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) - - -LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ - - -/* number of list items to accumulate before a SETLIST instruction */ -#define LFIELDS_PER_FLUSH 50 - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/loslib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/loslib.c deleted file mode 100644 index da06a572..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/loslib.c +++ /dev/null @@ -1,243 +0,0 @@ -/* -** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ -** Standard Operating System library -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include -#include -#include - -#define loslib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static int os_pushresult (lua_State *L, int i, const char *filename) { - int en = errno; /* calls to Lua API may change this value */ - if (i) { - lua_pushboolean(L, 1); - return 1; - } - else { - lua_pushnil(L); - lua_pushfstring(L, "%s: %s", filename, strerror(en)); - lua_pushinteger(L, en); - return 3; - } -} - - -static int os_execute (lua_State *L) { - lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); - return 1; -} - - -static int os_remove (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - return os_pushresult(L, remove(filename) == 0, filename); -} - - -static int os_rename (lua_State *L) { - const char *fromname = luaL_checkstring(L, 1); - const char *toname = luaL_checkstring(L, 2); - return os_pushresult(L, rename(fromname, toname) == 0, fromname); -} - - -static int os_tmpname (lua_State *L) { - char buff[LUA_TMPNAMBUFSIZE]; - int err; - lua_tmpnam(buff, err); - if (err) - return luaL_error(L, "unable to generate a unique filename"); - lua_pushstring(L, buff); - return 1; -} - - -static int os_getenv (lua_State *L) { - lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ - return 1; -} - - -static int os_clock (lua_State *L) { - lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); - return 1; -} - - -/* -** {====================================================== -** Time/Date operations -** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, -** wday=%w+1, yday=%j, isdst=? } -** ======================================================= -*/ - -static void setfield (lua_State *L, const char *key, int value) { - lua_pushinteger(L, value); - lua_setfield(L, -2, key); -} - -static void setboolfield (lua_State *L, const char *key, int value) { - if (value < 0) /* undefined? */ - return; /* does not set field */ - lua_pushboolean(L, value); - lua_setfield(L, -2, key); -} - -static int getboolfield (lua_State *L, const char *key) { - int res; - lua_getfield(L, -1, key); - res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); - lua_pop(L, 1); - return res; -} - - -static int getfield (lua_State *L, const char *key, int d) { - int res; - lua_getfield(L, -1, key); - if (lua_isnumber(L, -1)) - res = (int)lua_tointeger(L, -1); - else { - if (d < 0) - return luaL_error(L, "field " LUA_QS " missing in date table", key); - res = d; - } - lua_pop(L, 1); - return res; -} - - -static int os_date (lua_State *L) { - const char *s = luaL_optstring(L, 1, "%c"); - time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); - struct tm *stm; - if (*s == '!') { /* UTC? */ - stm = gmtime(&t); - s++; /* skip `!' */ - } - else - stm = localtime(&t); - if (stm == NULL) /* invalid date? */ - lua_pushnil(L); - else if (strcmp(s, "*t") == 0) { - lua_createtable(L, 0, 9); /* 9 = number of fields */ - setfield(L, "sec", stm->tm_sec); - setfield(L, "min", stm->tm_min); - setfield(L, "hour", stm->tm_hour); - setfield(L, "day", stm->tm_mday); - setfield(L, "month", stm->tm_mon+1); - setfield(L, "year", stm->tm_year+1900); - setfield(L, "wday", stm->tm_wday+1); - setfield(L, "yday", stm->tm_yday+1); - setboolfield(L, "isdst", stm->tm_isdst); - } - else { - char cc[3]; - luaL_Buffer b; - cc[0] = '%'; cc[2] = '\0'; - luaL_buffinit(L, &b); - for (; *s; s++) { - if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ - luaL_addchar(&b, *s); - else { - size_t reslen; - char buff[200]; /* should be big enough for any conversion result */ - cc[1] = *(++s); - reslen = strftime(buff, sizeof(buff), cc, stm); - luaL_addlstring(&b, buff, reslen); - } - } - luaL_pushresult(&b); - } - return 1; -} - - -static int os_time (lua_State *L) { - time_t t; - if (lua_isnoneornil(L, 1)) /* called without args? */ - t = time(NULL); /* get current time */ - else { - struct tm ts; - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 1); /* make sure table is at the top */ - ts.tm_sec = getfield(L, "sec", 0); - ts.tm_min = getfield(L, "min", 0); - ts.tm_hour = getfield(L, "hour", 12); - ts.tm_mday = getfield(L, "day", -1); - ts.tm_mon = getfield(L, "month", -1) - 1; - ts.tm_year = getfield(L, "year", -1) - 1900; - ts.tm_isdst = getboolfield(L, "isdst"); - t = mktime(&ts); - } - if (t == (time_t)(-1)) - lua_pushnil(L); - else - lua_pushnumber(L, (lua_Number)t); - return 1; -} - - -static int os_difftime (lua_State *L) { - lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), - (time_t)(luaL_optnumber(L, 2, 0)))); - return 1; -} - -/* }====================================================== */ - - -static int os_setlocale (lua_State *L) { - static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, - LC_NUMERIC, LC_TIME}; - static const char *const catnames[] = {"all", "collate", "ctype", "monetary", - "numeric", "time", NULL}; - const char *l = luaL_optstring(L, 1, NULL); - int op = luaL_checkoption(L, 2, "all", catnames); - lua_pushstring(L, setlocale(cat[op], l)); - return 1; -} - - -static int os_exit (lua_State *L) { - exit(luaL_optint(L, 1, EXIT_SUCCESS)); -} - -static const luaL_Reg syslib[] = { - {"clock", os_clock}, - {"date", os_date}, - {"difftime", os_difftime}, - {"execute", os_execute}, - {"exit", os_exit}, - {"getenv", os_getenv}, - {"remove", os_remove}, - {"rename", os_rename}, - {"setlocale", os_setlocale}, - {"time", os_time}, - {"tmpname", os_tmpname}, - {NULL, NULL} -}; - -/* }====================================================== */ - - - -LUALIB_API int luaopen_os (lua_State *L) { - luaL_register(L, LUA_OSLIBNAME, syslib); - return 1; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lparser.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lparser.c deleted file mode 100644 index dda7488d..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lparser.c +++ /dev/null @@ -1,1339 +0,0 @@ -/* -** $Id: lparser.c,v 2.42.1.4 2011/10/21 19:31:42 roberto Exp $ -** Lua Parser -** See Copyright Notice in lua.h -*/ - - -#include - -#define lparser_c -#define LUA_CORE - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" - - - -#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) - -#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) - -#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) - - -/* -** nodes for block list (list of active blocks) -*/ -typedef struct BlockCnt { - struct BlockCnt *previous; /* chain */ - int breaklist; /* list of jumps out of this loop */ - lu_byte nactvar; /* # active locals outside the breakable structure */ - lu_byte upval; /* true if some variable in the block is an upvalue */ - lu_byte isbreakable; /* true if `block' is a loop */ -} BlockCnt; - - - -/* -** prototypes for recursive non-terminal functions -*/ -static void chunk (LexState *ls); -static void expr (LexState *ls, expdesc *v); - - -static void anchor_token (LexState *ls) { - if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { - TString *ts = ls->t.seminfo.ts; - luaX_newstring(ls, getstr(ts), ts->tsv.len); - } -} - - -static void error_expected (LexState *ls, int token) { - luaX_syntaxerror(ls, - luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); -} - - -static void errorlimit (FuncState *fs, int limit, const char *what) { - const char *msg = (fs->f->linedefined == 0) ? - luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : - luaO_pushfstring(fs->L, "function at line %d has more than %d %s", - fs->f->linedefined, limit, what); - luaX_lexerror(fs->ls, msg, 0); -} - - -static int testnext (LexState *ls, int c) { - if (ls->t.token == c) { - luaX_next(ls); - return 1; - } - else return 0; -} - - -static void check (LexState *ls, int c) { - if (ls->t.token != c) - error_expected(ls, c); -} - -static void checknext (LexState *ls, int c) { - check(ls, c); - luaX_next(ls); -} - - -#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } - - - -static void check_match (LexState *ls, int what, int who, int where) { - if (!testnext(ls, what)) { - if (where == ls->linenumber) - error_expected(ls, what); - else { - luaX_syntaxerror(ls, luaO_pushfstring(ls->L, - LUA_QS " expected (to close " LUA_QS " at line %d)", - luaX_token2str(ls, what), luaX_token2str(ls, who), where)); - } - } -} - - -static TString *str_checkname (LexState *ls) { - TString *ts; - check(ls, TK_NAME); - ts = ls->t.seminfo.ts; - luaX_next(ls); - return ts; -} - - -static void init_exp (expdesc *e, expkind k, int i) { - e->f = e->t = NO_JUMP; - e->k = k; - e->u.s.info = i; -} - - -static void codestring (LexState *ls, expdesc *e, TString *s) { - init_exp(e, VK, luaK_stringK(ls->fs, s)); -} - - -static void checkname(LexState *ls, expdesc *e) { - codestring(ls, e, str_checkname(ls)); -} - - -static int registerlocalvar (LexState *ls, TString *varname) { - FuncState *fs = ls->fs; - Proto *f = fs->f; - int oldsize = f->sizelocvars; - luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, - LocVar, SHRT_MAX, "too many local variables"); - while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; - f->locvars[fs->nlocvars].varname = varname; - luaC_objbarrier(ls->L, f, varname); - return fs->nlocvars++; -} - - -#define new_localvarliteral(ls,v,n) \ - new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) - - -static void new_localvar (LexState *ls, TString *name, int n) { - FuncState *fs = ls->fs; - luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); - fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); -} - - -static void adjustlocalvars (LexState *ls, int nvars) { - FuncState *fs = ls->fs; - fs->nactvar = cast_byte(fs->nactvar + nvars); - for (; nvars; nvars--) { - getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; - } -} - - -static void removevars (LexState *ls, int tolevel) { - FuncState *fs = ls->fs; - while (fs->nactvar > tolevel) - getlocvar(fs, --fs->nactvar).endpc = fs->pc; -} - - -static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { - int i; - Proto *f = fs->f; - int oldsize = f->sizeupvalues; - for (i=0; inups; i++) { - if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { - lua_assert(f->upvalues[i] == name); - return i; - } - } - /* new one */ - luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); - luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, - TString *, MAX_INT, ""); - while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; - f->upvalues[f->nups] = name; - luaC_objbarrier(fs->L, f, name); - lua_assert(v->k == VLOCAL || v->k == VUPVAL); - fs->upvalues[f->nups].k = cast_byte(v->k); - fs->upvalues[f->nups].info = cast_byte(v->u.s.info); - return f->nups++; -} - - -static int searchvar (FuncState *fs, TString *n) { - int i; - for (i=fs->nactvar-1; i >= 0; i--) { - if (n == getlocvar(fs, i).varname) - return i; - } - return -1; /* not found */ -} - - -static void markupval (FuncState *fs, int level) { - BlockCnt *bl = fs->bl; - while (bl && bl->nactvar > level) bl = bl->previous; - if (bl) bl->upval = 1; -} - - -static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { - if (fs == NULL) { /* no more levels? */ - init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ - return VGLOBAL; - } - else { - int v = searchvar(fs, n); /* look up at current level */ - if (v >= 0) { - init_exp(var, VLOCAL, v); - if (!base) - markupval(fs, v); /* local will be used as an upval */ - return VLOCAL; - } - else { /* not found at current level; try upper one */ - if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) - return VGLOBAL; - var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ - var->k = VUPVAL; /* upvalue in this level */ - return VUPVAL; - } - } -} - - -static void singlevar (LexState *ls, expdesc *var) { - TString *varname = str_checkname(ls); - FuncState *fs = ls->fs; - if (singlevaraux(fs, varname, var, 1) == VGLOBAL) - var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ -} - - -static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { - FuncState *fs = ls->fs; - int extra = nvars - nexps; - if (hasmultret(e->k)) { - extra++; /* includes call itself */ - if (extra < 0) extra = 0; - luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ - if (extra > 1) luaK_reserveregs(fs, extra-1); - } - else { - if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ - if (extra > 0) { - int reg = fs->freereg; - luaK_reserveregs(fs, extra); - luaK_nil(fs, reg, extra); - } - } -} - - -static void enterlevel (LexState *ls) { - if (++ls->L->nCcalls > LUAI_MAXCCALLS) - luaX_lexerror(ls, "chunk has too many syntax levels", 0); -} - - -#define leavelevel(ls) ((ls)->L->nCcalls--) - - -static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { - bl->breaklist = NO_JUMP; - bl->isbreakable = isbreakable; - bl->nactvar = fs->nactvar; - bl->upval = 0; - bl->previous = fs->bl; - fs->bl = bl; - lua_assert(fs->freereg == fs->nactvar); -} - - -static void leaveblock (FuncState *fs) { - BlockCnt *bl = fs->bl; - fs->bl = bl->previous; - removevars(fs->ls, bl->nactvar); - if (bl->upval) - luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); - /* a block either controls scope or breaks (never both) */ - lua_assert(!bl->isbreakable || !bl->upval); - lua_assert(bl->nactvar == fs->nactvar); - fs->freereg = fs->nactvar; /* free registers */ - luaK_patchtohere(fs, bl->breaklist); -} - - -static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { - FuncState *fs = ls->fs; - Proto *f = fs->f; - int oldsize = f->sizep; - int i; - luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, - MAXARG_Bx, "constant table overflow"); - while (oldsize < f->sizep) f->p[oldsize++] = NULL; - f->p[fs->np++] = func->f; - luaC_objbarrier(ls->L, f, func->f); - init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); - for (i=0; if->nups; i++) { - OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; - luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); - } -} - - -static void open_func (LexState *ls, FuncState *fs) { - lua_State *L = ls->L; - Proto *f = luaF_newproto(L); - fs->f = f; - fs->prev = ls->fs; /* linked list of funcstates */ - fs->ls = ls; - fs->L = L; - ls->fs = fs; - fs->pc = 0; - fs->lasttarget = -1; - fs->jpc = NO_JUMP; - fs->freereg = 0; - fs->nk = 0; - fs->np = 0; - fs->nlocvars = 0; - fs->nactvar = 0; - fs->bl = NULL; - f->source = ls->source; - f->maxstacksize = 2; /* registers 0/1 are always valid */ - fs->h = luaH_new(L, 0, 0); - /* anchor table of constants and prototype (to avoid being collected) */ - sethvalue2s(L, L->top, fs->h); - incr_top(L); - setptvalue2s(L, L->top, f); - incr_top(L); -} - - -static void close_func (LexState *ls) { - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; - removevars(ls, 0); - luaK_ret(fs, 0, 0); /* final return */ - luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); - f->sizecode = fs->pc; - luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); - f->sizelineinfo = fs->pc; - luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); - f->sizek = fs->nk; - luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); - f->sizep = fs->np; - luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); - f->sizelocvars = fs->nlocvars; - luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); - f->sizeupvalues = f->nups; - lua_assert(luaG_checkcode(f)); - lua_assert(fs->bl == NULL); - ls->fs = fs->prev; - /* last token read was anchored in defunct function; must reanchor it */ - if (fs) anchor_token(ls); - L->top -= 2; /* remove table and prototype from the stack */ -} - - -Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { - struct LexState lexstate; - struct FuncState funcstate; - lexstate.buff = buff; - luaX_setinput(L, &lexstate, z, luaS_new(L, name)); - open_func(&lexstate, &funcstate); - funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ - luaX_next(&lexstate); /* read first token */ - chunk(&lexstate); - check(&lexstate, TK_EOS); - close_func(&lexstate); - lua_assert(funcstate.prev == NULL); - lua_assert(funcstate.f->nups == 0); - lua_assert(lexstate.fs == NULL); - return funcstate.f; -} - - - -/*============================================================*/ -/* GRAMMAR RULES */ -/*============================================================*/ - - -static void field (LexState *ls, expdesc *v) { - /* field -> ['.' | ':'] NAME */ - FuncState *fs = ls->fs; - expdesc key; - luaK_exp2anyreg(fs, v); - luaX_next(ls); /* skip the dot or colon */ - checkname(ls, &key); - luaK_indexed(fs, v, &key); -} - - -static void yindex (LexState *ls, expdesc *v) { - /* index -> '[' expr ']' */ - luaX_next(ls); /* skip the '[' */ - expr(ls, v); - luaK_exp2val(ls->fs, v); - checknext(ls, ']'); -} - - -/* -** {====================================================================== -** Rules for Constructors -** ======================================================================= -*/ - - -struct ConsControl { - expdesc v; /* last list item read */ - expdesc *t; /* table descriptor */ - int nh; /* total number of `record' elements */ - int na; /* total number of array elements */ - int tostore; /* number of array elements pending to be stored */ -}; - - -static void recfield (LexState *ls, struct ConsControl *cc) { - /* recfield -> (NAME | `['exp1`]') = exp1 */ - FuncState *fs = ls->fs; - int reg = ls->fs->freereg; - expdesc key, val; - int rkkey; - if (ls->t.token == TK_NAME) { - luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); - checkname(ls, &key); - } - else /* ls->t.token == '[' */ - yindex(ls, &key); - cc->nh++; - checknext(ls, '='); - rkkey = luaK_exp2RK(fs, &key); - expr(ls, &val); - luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); - fs->freereg = reg; /* free registers */ -} - - -static void closelistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->v.k == VVOID) return; /* there is no list item */ - luaK_exp2nextreg(fs, &cc->v); - cc->v.k = VVOID; - if (cc->tostore == LFIELDS_PER_FLUSH) { - luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ - cc->tostore = 0; /* no more items pending */ - } -} - - -static void lastlistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->tostore == 0) return; - if (hasmultret(cc->v.k)) { - luaK_setmultret(fs, &cc->v); - luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); - cc->na--; /* do not count last expression (unknown number of elements) */ - } - else { - if (cc->v.k != VVOID) - luaK_exp2nextreg(fs, &cc->v); - luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); - } -} - - -static void listfield (LexState *ls, struct ConsControl *cc) { - expr(ls, &cc->v); - luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); - cc->na++; - cc->tostore++; -} - - -static void constructor (LexState *ls, expdesc *t) { - /* constructor -> ?? */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); - struct ConsControl cc; - cc.na = cc.nh = cc.tostore = 0; - cc.t = t; - init_exp(t, VRELOCABLE, pc); - init_exp(&cc.v, VVOID, 0); /* no value (yet) */ - luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ - checknext(ls, '{'); - do { - lua_assert(cc.v.k == VVOID || cc.tostore > 0); - if (ls->t.token == '}') break; - closelistfield(fs, &cc); - switch(ls->t.token) { - case TK_NAME: { /* may be listfields or recfields */ - luaX_lookahead(ls); - if (ls->lookahead.token != '=') /* expression? */ - listfield(ls, &cc); - else - recfield(ls, &cc); - break; - } - case '[': { /* constructor_item -> recfield */ - recfield(ls, &cc); - break; - } - default: { /* constructor_part -> listfield */ - listfield(ls, &cc); - break; - } - } - } while (testnext(ls, ',') || testnext(ls, ';')); - check_match(ls, '}', '{', line); - lastlistfield(fs, &cc); - SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ - SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ -} - -/* }====================================================================== */ - - - -static void parlist (LexState *ls) { - /* parlist -> [ param { `,' param } ] */ - FuncState *fs = ls->fs; - Proto *f = fs->f; - int nparams = 0; - f->is_vararg = 0; - if (ls->t.token != ')') { /* is `parlist' not empty? */ - do { - switch (ls->t.token) { - case TK_NAME: { /* param -> NAME */ - new_localvar(ls, str_checkname(ls), nparams++); - break; - } - case TK_DOTS: { /* param -> `...' */ - luaX_next(ls); -#if defined(LUA_COMPAT_VARARG) - /* use `arg' as default name */ - new_localvarliteral(ls, "arg", nparams++); - f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; -#endif - f->is_vararg |= VARARG_ISVARARG; - break; - } - default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); - } - } while (!f->is_vararg && testnext(ls, ',')); - } - adjustlocalvars(ls, nparams); - f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); - luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ -} - - -static void body (LexState *ls, expdesc *e, int needself, int line) { - /* body -> `(' parlist `)' chunk END */ - FuncState new_fs; - open_func(ls, &new_fs); - new_fs.f->linedefined = line; - checknext(ls, '('); - if (needself) { - new_localvarliteral(ls, "self", 0); - adjustlocalvars(ls, 1); - } - parlist(ls); - checknext(ls, ')'); - chunk(ls); - new_fs.f->lastlinedefined = ls->linenumber; - check_match(ls, TK_END, TK_FUNCTION, line); - close_func(ls); - pushclosure(ls, &new_fs, e); -} - - -static int explist1 (LexState *ls, expdesc *v) { - /* explist1 -> expr { `,' expr } */ - int n = 1; /* at least one expression */ - expr(ls, v); - while (testnext(ls, ',')) { - luaK_exp2nextreg(ls->fs, v); - expr(ls, v); - n++; - } - return n; -} - - -static void funcargs (LexState *ls, expdesc *f) { - FuncState *fs = ls->fs; - expdesc args; - int base, nparams; - int line = ls->linenumber; - switch (ls->t.token) { - case '(': { /* funcargs -> `(' [ explist1 ] `)' */ - if (line != ls->lastline) - luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); - luaX_next(ls); - if (ls->t.token == ')') /* arg list is empty? */ - args.k = VVOID; - else { - explist1(ls, &args); - luaK_setmultret(fs, &args); - } - check_match(ls, ')', '(', line); - break; - } - case '{': { /* funcargs -> constructor */ - constructor(ls, &args); - break; - } - case TK_STRING: { /* funcargs -> STRING */ - codestring(ls, &args, ls->t.seminfo.ts); - luaX_next(ls); /* must use `seminfo' before `next' */ - break; - } - default: { - luaX_syntaxerror(ls, "function arguments expected"); - return; - } - } - lua_assert(f->k == VNONRELOC); - base = f->u.s.info; /* base register for call */ - if (hasmultret(args.k)) - nparams = LUA_MULTRET; /* open call */ - else { - if (args.k != VVOID) - luaK_exp2nextreg(fs, &args); /* close last argument */ - nparams = fs->freereg - (base+1); - } - init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); - luaK_fixline(fs, line); - fs->freereg = base+1; /* call remove function and arguments and leaves - (unless changed) one result */ -} - - - - -/* -** {====================================================================== -** Expression parsing -** ======================================================================= -*/ - - -static void prefixexp (LexState *ls, expdesc *v) { - /* prefixexp -> NAME | '(' expr ')' */ - switch (ls->t.token) { - case '(': { - int line = ls->linenumber; - luaX_next(ls); - expr(ls, v); - check_match(ls, ')', '(', line); - luaK_dischargevars(ls->fs, v); - return; - } - case TK_NAME: { - singlevar(ls, v); - return; - } - default: { - luaX_syntaxerror(ls, "unexpected symbol"); - return; - } - } -} - - -static void primaryexp (LexState *ls, expdesc *v) { - /* primaryexp -> - prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ - FuncState *fs = ls->fs; - prefixexp(ls, v); - for (;;) { - switch (ls->t.token) { - case '.': { /* field */ - field(ls, v); - break; - } - case '[': { /* `[' exp1 `]' */ - expdesc key; - luaK_exp2anyreg(fs, v); - yindex(ls, &key); - luaK_indexed(fs, v, &key); - break; - } - case ':': { /* `:' NAME funcargs */ - expdesc key; - luaX_next(ls); - checkname(ls, &key); - luaK_self(fs, v, &key); - funcargs(ls, v); - break; - } - case '(': case TK_STRING: case '{': { /* funcargs */ - luaK_exp2nextreg(fs, v); - funcargs(ls, v); - break; - } - default: return; - } - } -} - - -static void simpleexp (LexState *ls, expdesc *v) { - /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | - constructor | FUNCTION body | primaryexp */ - switch (ls->t.token) { - case TK_NUMBER: { - init_exp(v, VKNUM, 0); - v->u.nval = ls->t.seminfo.r; - break; - } - case TK_STRING: { - codestring(ls, v, ls->t.seminfo.ts); - break; - } - case TK_NIL: { - init_exp(v, VNIL, 0); - break; - } - case TK_TRUE: { - init_exp(v, VTRUE, 0); - break; - } - case TK_FALSE: { - init_exp(v, VFALSE, 0); - break; - } - case TK_DOTS: { /* vararg */ - FuncState *fs = ls->fs; - check_condition(ls, fs->f->is_vararg, - "cannot use " LUA_QL("...") " outside a vararg function"); - fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ - init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); - break; - } - case '{': { /* constructor */ - constructor(ls, v); - return; - } - case TK_FUNCTION: { - luaX_next(ls); - body(ls, v, 0, ls->linenumber); - return; - } - default: { - primaryexp(ls, v); - return; - } - } - luaX_next(ls); -} - - -static UnOpr getunopr (int op) { - switch (op) { - case TK_NOT: return OPR_NOT; - case '-': return OPR_MINUS; - case '#': return OPR_LEN; - default: return OPR_NOUNOPR; - } -} - - -static BinOpr getbinopr (int op) { - switch (op) { - case '+': return OPR_ADD; - case '-': return OPR_SUB; - case '*': return OPR_MUL; - case '/': return OPR_DIV; - case '%': return OPR_MOD; - case '^': return OPR_POW; - case TK_CONCAT: return OPR_CONCAT; - case TK_NE: return OPR_NE; - case TK_EQ: return OPR_EQ; - case '<': return OPR_LT; - case TK_LE: return OPR_LE; - case '>': return OPR_GT; - case TK_GE: return OPR_GE; - case TK_AND: return OPR_AND; - case TK_OR: return OPR_OR; - default: return OPR_NOBINOPR; - } -} - - -static const struct { - lu_byte left; /* left priority for each binary operator */ - lu_byte right; /* right priority */ -} priority[] = { /* ORDER OPR */ - {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ - {10, 9}, {5, 4}, /* power and concat (right associative) */ - {3, 3}, {3, 3}, /* equality and inequality */ - {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ - {2, 2}, {1, 1} /* logical (and/or) */ -}; - -#define UNARY_PRIORITY 8 /* priority for unary operators */ - - -/* -** subexpr -> (simpleexp | unop subexpr) { binop subexpr } -** where `binop' is any binary operator with a priority higher than `limit' -*/ -static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { - BinOpr op; - UnOpr uop; - enterlevel(ls); - uop = getunopr(ls->t.token); - if (uop != OPR_NOUNOPR) { - luaX_next(ls); - subexpr(ls, v, UNARY_PRIORITY); - luaK_prefix(ls->fs, uop, v); - } - else simpleexp(ls, v); - /* expand while operators have priorities higher than `limit' */ - op = getbinopr(ls->t.token); - while (op != OPR_NOBINOPR && priority[op].left > limit) { - expdesc v2; - BinOpr nextop; - luaX_next(ls); - luaK_infix(ls->fs, op, v); - /* read sub-expression with higher priority */ - nextop = subexpr(ls, &v2, priority[op].right); - luaK_posfix(ls->fs, op, v, &v2); - op = nextop; - } - leavelevel(ls); - return op; /* return first untreated operator */ -} - - -static void expr (LexState *ls, expdesc *v) { - subexpr(ls, v, 0); -} - -/* }==================================================================== */ - - - -/* -** {====================================================================== -** Rules for Statements -** ======================================================================= -*/ - - -static int block_follow (int token) { - switch (token) { - case TK_ELSE: case TK_ELSEIF: case TK_END: - case TK_UNTIL: case TK_EOS: - return 1; - default: return 0; - } -} - - -static void block (LexState *ls) { - /* block -> chunk */ - FuncState *fs = ls->fs; - BlockCnt bl; - enterblock(fs, &bl, 0); - chunk(ls); - lua_assert(bl.breaklist == NO_JUMP); - leaveblock(fs); -} - - -/* -** structure to chain all variables in the left-hand side of an -** assignment -*/ -struct LHS_assign { - struct LHS_assign *prev; - expdesc v; /* variable (global, local, upvalue, or indexed) */ -}; - - -/* -** check whether, in an assignment to a local variable, the local variable -** is needed in a previous assignment (to a table). If so, save original -** local value in a safe place and use this safe copy in the previous -** assignment. -*/ -static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { - FuncState *fs = ls->fs; - int extra = fs->freereg; /* eventual position to save local variable */ - int conflict = 0; - for (; lh; lh = lh->prev) { - if (lh->v.k == VINDEXED) { - if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ - conflict = 1; - lh->v.u.s.info = extra; /* previous assignment will use safe copy */ - } - if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ - conflict = 1; - lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ - } - } - } - if (conflict) { - luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ - luaK_reserveregs(fs, 1); - } -} - - -static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { - expdesc e; - check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, - "syntax error"); - if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ - struct LHS_assign nv; - nv.prev = lh; - primaryexp(ls, &nv.v); - if (nv.v.k == VLOCAL) - check_conflict(ls, lh, &nv.v); - luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, - "variables in assignment"); - assignment(ls, &nv, nvars+1); - } - else { /* assignment -> `=' explist1 */ - int nexps; - checknext(ls, '='); - nexps = explist1(ls, &e); - if (nexps != nvars) { - adjust_assign(ls, nvars, nexps, &e); - if (nexps > nvars) - ls->fs->freereg -= nexps - nvars; /* remove extra values */ - } - else { - luaK_setoneret(ls->fs, &e); /* close last expression */ - luaK_storevar(ls->fs, &lh->v, &e); - return; /* avoid default */ - } - } - init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ - luaK_storevar(ls->fs, &lh->v, &e); -} - - -static int cond (LexState *ls) { - /* cond -> exp */ - expdesc v; - expr(ls, &v); /* read condition */ - if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ - luaK_goiftrue(ls->fs, &v); - return v.f; -} - - -static void breakstat (LexState *ls) { - FuncState *fs = ls->fs; - BlockCnt *bl = fs->bl; - int upval = 0; - while (bl && !bl->isbreakable) { - upval |= bl->upval; - bl = bl->previous; - } - if (!bl) - luaX_syntaxerror(ls, "no loop to break"); - if (upval) - luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); - luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); -} - - -static void whilestat (LexState *ls, int line) { - /* whilestat -> WHILE cond DO block END */ - FuncState *fs = ls->fs; - int whileinit; - int condexit; - BlockCnt bl; - luaX_next(ls); /* skip WHILE */ - whileinit = luaK_getlabel(fs); - condexit = cond(ls); - enterblock(fs, &bl, 1); - checknext(ls, TK_DO); - block(ls); - luaK_patchlist(fs, luaK_jump(fs), whileinit); - check_match(ls, TK_END, TK_WHILE, line); - leaveblock(fs); - luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ -} - - -static void repeatstat (LexState *ls, int line) { - /* repeatstat -> REPEAT block UNTIL cond */ - int condexit; - FuncState *fs = ls->fs; - int repeat_init = luaK_getlabel(fs); - BlockCnt bl1, bl2; - enterblock(fs, &bl1, 1); /* loop block */ - enterblock(fs, &bl2, 0); /* scope block */ - luaX_next(ls); /* skip REPEAT */ - chunk(ls); - check_match(ls, TK_UNTIL, TK_REPEAT, line); - condexit = cond(ls); /* read condition (inside scope block) */ - if (!bl2.upval) { /* no upvalues? */ - leaveblock(fs); /* finish scope */ - luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ - } - else { /* complete semantics when there are upvalues */ - breakstat(ls); /* if condition then break */ - luaK_patchtohere(ls->fs, condexit); /* else... */ - leaveblock(fs); /* finish scope... */ - luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ - } - leaveblock(fs); /* finish loop */ -} - - -static int exp1 (LexState *ls) { - expdesc e; - int k; - expr(ls, &e); - k = e.k; - luaK_exp2nextreg(ls->fs, &e); - return k; -} - - -static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { - /* forbody -> DO block */ - BlockCnt bl; - FuncState *fs = ls->fs; - int prep, endfor; - adjustlocalvars(ls, 3); /* control variables */ - checknext(ls, TK_DO); - prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); - enterblock(fs, &bl, 0); /* scope for declared variables */ - adjustlocalvars(ls, nvars); - luaK_reserveregs(fs, nvars); - block(ls); - leaveblock(fs); /* end of scope for declared variables */ - luaK_patchtohere(fs, prep); - endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : - luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); - luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ - luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); -} - - -static void fornum (LexState *ls, TString *varname, int line) { - /* fornum -> NAME = exp1,exp1[,exp1] forbody */ - FuncState *fs = ls->fs; - int base = fs->freereg; - new_localvarliteral(ls, "(for index)", 0); - new_localvarliteral(ls, "(for limit)", 1); - new_localvarliteral(ls, "(for step)", 2); - new_localvar(ls, varname, 3); - checknext(ls, '='); - exp1(ls); /* initial value */ - checknext(ls, ','); - exp1(ls); /* limit */ - if (testnext(ls, ',')) - exp1(ls); /* optional step */ - else { /* default step = 1 */ - luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); - luaK_reserveregs(fs, 1); - } - forbody(ls, base, line, 1, 1); -} - - -static void forlist (LexState *ls, TString *indexname) { - /* forlist -> NAME {,NAME} IN explist1 forbody */ - FuncState *fs = ls->fs; - expdesc e; - int nvars = 0; - int line; - int base = fs->freereg; - /* create control variables */ - new_localvarliteral(ls, "(for generator)", nvars++); - new_localvarliteral(ls, "(for state)", nvars++); - new_localvarliteral(ls, "(for control)", nvars++); - /* create declared variables */ - new_localvar(ls, indexname, nvars++); - while (testnext(ls, ',')) - new_localvar(ls, str_checkname(ls), nvars++); - checknext(ls, TK_IN); - line = ls->linenumber; - adjust_assign(ls, 3, explist1(ls, &e), &e); - luaK_checkstack(fs, 3); /* extra space to call generator */ - forbody(ls, base, line, nvars - 3, 0); -} - - -static void forstat (LexState *ls, int line) { - /* forstat -> FOR (fornum | forlist) END */ - FuncState *fs = ls->fs; - TString *varname; - BlockCnt bl; - enterblock(fs, &bl, 1); /* scope for loop and control variables */ - luaX_next(ls); /* skip `for' */ - varname = str_checkname(ls); /* first variable name */ - switch (ls->t.token) { - case '=': fornum(ls, varname, line); break; - case ',': case TK_IN: forlist(ls, varname); break; - default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); - } - check_match(ls, TK_END, TK_FOR, line); - leaveblock(fs); /* loop scope (`break' jumps to this point) */ -} - - -static int test_then_block (LexState *ls) { - /* test_then_block -> [IF | ELSEIF] cond THEN block */ - int condexit; - luaX_next(ls); /* skip IF or ELSEIF */ - condexit = cond(ls); - checknext(ls, TK_THEN); - block(ls); /* `then' part */ - return condexit; -} - - -static void ifstat (LexState *ls, int line) { - /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ - FuncState *fs = ls->fs; - int flist; - int escapelist = NO_JUMP; - flist = test_then_block(ls); /* IF cond THEN block */ - while (ls->t.token == TK_ELSEIF) { - luaK_concat(fs, &escapelist, luaK_jump(fs)); - luaK_patchtohere(fs, flist); - flist = test_then_block(ls); /* ELSEIF cond THEN block */ - } - if (ls->t.token == TK_ELSE) { - luaK_concat(fs, &escapelist, luaK_jump(fs)); - luaK_patchtohere(fs, flist); - luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ - block(ls); /* `else' part */ - } - else - luaK_concat(fs, &escapelist, flist); - luaK_patchtohere(fs, escapelist); - check_match(ls, TK_END, TK_IF, line); -} - - -static void localfunc (LexState *ls) { - expdesc v, b; - FuncState *fs = ls->fs; - new_localvar(ls, str_checkname(ls), 0); - init_exp(&v, VLOCAL, fs->freereg); - luaK_reserveregs(fs, 1); - adjustlocalvars(ls, 1); - body(ls, &b, 0, ls->linenumber); - luaK_storevar(fs, &v, &b); - /* debug information will only see the variable after this point! */ - getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; -} - - -static void localstat (LexState *ls) { - /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ - int nvars = 0; - int nexps; - expdesc e; - do { - new_localvar(ls, str_checkname(ls), nvars++); - } while (testnext(ls, ',')); - if (testnext(ls, '=')) - nexps = explist1(ls, &e); - else { - e.k = VVOID; - nexps = 0; - } - adjust_assign(ls, nvars, nexps, &e); - adjustlocalvars(ls, nvars); -} - - -static int funcname (LexState *ls, expdesc *v) { - /* funcname -> NAME {field} [`:' NAME] */ - int needself = 0; - singlevar(ls, v); - while (ls->t.token == '.') - field(ls, v); - if (ls->t.token == ':') { - needself = 1; - field(ls, v); - } - return needself; -} - - -static void funcstat (LexState *ls, int line) { - /* funcstat -> FUNCTION funcname body */ - int needself; - expdesc v, b; - luaX_next(ls); /* skip FUNCTION */ - needself = funcname(ls, &v); - body(ls, &b, needself, line); - luaK_storevar(ls->fs, &v, &b); - luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ -} - - -static void exprstat (LexState *ls) { - /* stat -> func | assignment */ - FuncState *fs = ls->fs; - struct LHS_assign v; - primaryexp(ls, &v.v); - if (v.v.k == VCALL) /* stat -> func */ - SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ - else { /* stat -> assignment */ - v.prev = NULL; - assignment(ls, &v, 1); - } -} - - -static void retstat (LexState *ls) { - /* stat -> RETURN explist */ - FuncState *fs = ls->fs; - expdesc e; - int first, nret; /* registers with returned values */ - luaX_next(ls); /* skip RETURN */ - if (block_follow(ls->t.token) || ls->t.token == ';') - first = nret = 0; /* return no values */ - else { - nret = explist1(ls, &e); /* optional return values */ - if (hasmultret(e.k)) { - luaK_setmultret(fs, &e); - if (e.k == VCALL && nret == 1) { /* tail call? */ - SET_OPCODE(getcode(fs,&e), OP_TAILCALL); - lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); - } - first = fs->nactvar; - nret = LUA_MULTRET; /* return all values */ - } - else { - if (nret == 1) /* only one single value? */ - first = luaK_exp2anyreg(fs, &e); - else { - luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ - first = fs->nactvar; /* return all `active' values */ - lua_assert(nret == fs->freereg - first); - } - } - } - luaK_ret(fs, first, nret); -} - - -static int statement (LexState *ls) { - int line = ls->linenumber; /* may be needed for error messages */ - switch (ls->t.token) { - case TK_IF: { /* stat -> ifstat */ - ifstat(ls, line); - return 0; - } - case TK_WHILE: { /* stat -> whilestat */ - whilestat(ls, line); - return 0; - } - case TK_DO: { /* stat -> DO block END */ - luaX_next(ls); /* skip DO */ - block(ls); - check_match(ls, TK_END, TK_DO, line); - return 0; - } - case TK_FOR: { /* stat -> forstat */ - forstat(ls, line); - return 0; - } - case TK_REPEAT: { /* stat -> repeatstat */ - repeatstat(ls, line); - return 0; - } - case TK_FUNCTION: { - funcstat(ls, line); /* stat -> funcstat */ - return 0; - } - case TK_LOCAL: { /* stat -> localstat */ - luaX_next(ls); /* skip LOCAL */ - if (testnext(ls, TK_FUNCTION)) /* local function? */ - localfunc(ls); - else - localstat(ls); - return 0; - } - case TK_RETURN: { /* stat -> retstat */ - retstat(ls); - return 1; /* must be last statement */ - } - case TK_BREAK: { /* stat -> breakstat */ - luaX_next(ls); /* skip BREAK */ - breakstat(ls); - return 1; /* must be last statement */ - } - default: { - exprstat(ls); - return 0; /* to avoid warnings */ - } - } -} - - -static void chunk (LexState *ls) { - /* chunk -> { stat [`;'] } */ - int islast = 0; - enterlevel(ls); - while (!islast && !block_follow(ls->t.token)) { - islast = statement(ls); - testnext(ls, ';'); - lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && - ls->fs->freereg >= ls->fs->nactvar); - ls->fs->freereg = ls->fs->nactvar; /* free registers */ - } - leavelevel(ls); -} - -/* }====================================================================== */ diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lparser.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lparser.h deleted file mode 100644 index 18836afd..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lparser.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#ifndef lparser_h -#define lparser_h - -#include "llimits.h" -#include "lobject.h" -#include "lzio.h" - - -/* -** Expression descriptor -*/ - -typedef enum { - VVOID, /* no value */ - VNIL, - VTRUE, - VFALSE, - VK, /* info = index of constant in `k' */ - VKNUM, /* nval = numerical value */ - VLOCAL, /* info = local register */ - VUPVAL, /* info = index of upvalue in `upvalues' */ - VGLOBAL, /* info = index of table; aux = index of global name in `k' */ - VINDEXED, /* info = table register; aux = index register (or `k') */ - VJMP, /* info = instruction pc */ - VRELOCABLE, /* info = instruction pc */ - VNONRELOC, /* info = result register */ - VCALL, /* info = instruction pc */ - VVARARG /* info = instruction pc */ -} expkind; - -typedef struct expdesc { - expkind k; - union { - struct { int info, aux; } s; - lua_Number nval; - } u; - int t; /* patch list of `exit when true' */ - int f; /* patch list of `exit when false' */ -} expdesc; - - -typedef struct upvaldesc { - lu_byte k; - lu_byte info; -} upvaldesc; - - -struct BlockCnt; /* defined in lparser.c */ - - -/* state needed to generate code for a given function */ -typedef struct FuncState { - Proto *f; /* current function header */ - Table *h; /* table to find (and reuse) elements in `k' */ - struct FuncState *prev; /* enclosing function */ - struct LexState *ls; /* lexical state */ - struct lua_State *L; /* copy of the Lua state */ - struct BlockCnt *bl; /* chain of current blocks */ - int pc; /* next position to code (equivalent to `ncode') */ - int lasttarget; /* `pc' of last `jump target' */ - int jpc; /* list of pending jumps to `pc' */ - int freereg; /* first free register */ - int nk; /* number of elements in `k' */ - int np; /* number of elements in `p' */ - short nlocvars; /* number of elements in `locvars' */ - lu_byte nactvar; /* number of active local variables */ - upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ - unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ -} FuncState; - - -LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - const char *name); - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstate.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstate.c deleted file mode 100644 index 4313b83a..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstate.c +++ /dev/null @@ -1,214 +0,0 @@ -/* -** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ -** Global State -** See Copyright Notice in lua.h -*/ - - -#include - -#define lstate_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) -#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) -#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) - - -/* -** Main thread combines a thread state and the global state -*/ -typedef struct LG { - lua_State l; - global_State g; -} LG; - - - -static void stack_init (lua_State *L1, lua_State *L) { - /* initialize CallInfo array */ - L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); - L1->ci = L1->base_ci; - L1->size_ci = BASIC_CI_SIZE; - L1->end_ci = L1->base_ci + L1->size_ci - 1; - /* initialize stack array */ - L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); - L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; - L1->top = L1->stack; - L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; - /* initialize first ci */ - L1->ci->func = L1->top; - setnilvalue(L1->top++); /* `function' entry for this `ci' */ - L1->base = L1->ci->base = L1->top; - L1->ci->top = L1->top + LUA_MINSTACK; -} - - -static void freestack (lua_State *L, lua_State *L1) { - luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); - luaM_freearray(L, L1->stack, L1->stacksize, TValue); -} - - -/* -** open parts that may cause memory-allocation errors -*/ -static void f_luaopen (lua_State *L, void *ud) { - global_State *g = G(L); - UNUSED(ud); - stack_init(L, L); /* init stack */ - sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ - sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ - luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ - luaT_init(L); - luaX_init(L); - luaS_fix(luaS_newliteral(L, MEMERRMSG)); - g->GCthreshold = 4*g->totalbytes; -} - - -static void preinit_state (lua_State *L, global_State *g) { - G(L) = g; - L->stack = NULL; - L->stacksize = 0; - L->errorJmp = NULL; - L->hook = NULL; - L->hookmask = 0; - L->basehookcount = 0; - L->allowhook = 1; - resethookcount(L); - L->openupval = NULL; - L->size_ci = 0; - L->nCcalls = L->baseCcalls = 0; - L->status = 0; - L->base_ci = L->ci = NULL; - L->savedpc = NULL; - L->errfunc = 0; - setnilvalue(gt(L)); -} - - -static void close_state (lua_State *L) { - global_State *g = G(L); - luaF_close(L, L->stack); /* close all upvalues for this thread */ - luaC_freeall(L); /* collect all objects */ - lua_assert(g->rootgc == obj2gco(L)); - lua_assert(g->strt.nuse == 0); - luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); - luaZ_freebuffer(L, &g->buff); - freestack(L, L); - lua_assert(g->totalbytes == sizeof(LG)); - (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); -} - - -lua_State *luaE_newthread (lua_State *L) { - lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); - luaC_link(L, obj2gco(L1), LUA_TTHREAD); - preinit_state(L1, G(L)); - stack_init(L1, L); /* init stack */ - setobj2n(L, gt(L1), gt(L)); /* share table of globals */ - L1->hookmask = L->hookmask; - L1->basehookcount = L->basehookcount; - L1->hook = L->hook; - resethookcount(L1); - lua_assert(iswhite(obj2gco(L1))); - return L1; -} - - -void luaE_freethread (lua_State *L, lua_State *L1) { - luaF_close(L1, L1->stack); /* close all upvalues for this thread */ - lua_assert(L1->openupval == NULL); - luai_userstatefree(L1); - freestack(L, L1); - luaM_freemem(L, fromstate(L1), state_size(lua_State)); -} - - -LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { - int i; - lua_State *L; - global_State *g; - void *l = (*f)(ud, NULL, 0, state_size(LG)); - if (l == NULL) return NULL; - L = tostate(l); - g = &((LG *)L)->g; - L->next = NULL; - L->tt = LUA_TTHREAD; - g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); - L->marked = luaC_white(g); - set2bits(L->marked, FIXEDBIT, SFIXEDBIT); - preinit_state(L, g); - g->frealloc = f; - g->ud = ud; - g->mainthread = L; - g->uvhead.u.l.prev = &g->uvhead; - g->uvhead.u.l.next = &g->uvhead; - g->GCthreshold = 0; /* mark it as unfinished state */ - g->strt.size = 0; - g->strt.nuse = 0; - g->strt.hash = NULL; - setnilvalue(registry(L)); - luaZ_initbuffer(L, &g->buff); - g->panic = NULL; - g->gcstate = GCSpause; - g->rootgc = obj2gco(L); - g->sweepstrgc = 0; - g->sweepgc = &g->rootgc; - g->gray = NULL; - g->grayagain = NULL; - g->weak = NULL; - g->tmudata = NULL; - g->totalbytes = sizeof(LG); - g->gcpause = LUAI_GCPAUSE; - g->gcstepmul = LUAI_GCMUL; - g->gcdept = 0; - for (i=0; imt[i] = NULL; - if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { - /* memory allocation error: free partial state */ - close_state(L); - L = NULL; - } - else - luai_userstateopen(L); - return L; -} - - -static void callallgcTM (lua_State *L, void *ud) { - UNUSED(ud); - luaC_callGCTM(L); /* call GC metamethods for all udata */ -} - - -LUA_API void lua_close (lua_State *L) { - L = G(L)->mainthread; /* only the main thread can be closed */ - lua_lock(L); - luaF_close(L, L->stack); /* close all upvalues for this thread */ - luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ - L->errfunc = 0; /* no error function during GC metamethods */ - do { /* repeat until no more errors */ - L->ci = L->base_ci; - L->base = L->top = L->ci->base; - L->nCcalls = L->baseCcalls = 0; - } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); - lua_assert(G(L)->tmudata == NULL); - luai_userstateclose(L); - close_state(L); -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstate.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstate.h deleted file mode 100644 index 3bc575b6..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstate.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ -** Global State -** See Copyright Notice in lua.h -*/ - -#ifndef lstate_h -#define lstate_h - -#include "lua.h" - -#include "lobject.h" -#include "ltm.h" -#include "lzio.h" - - - -struct lua_longjmp; /* defined in ldo.c */ - - -/* table of globals */ -#define gt(L) (&L->l_gt) - -/* registry */ -#define registry(L) (&G(L)->l_registry) - - -/* extra stack space to handle TM calls and some other extras */ -#define EXTRA_STACK 5 - - -#define BASIC_CI_SIZE 8 - -#define BASIC_STACK_SIZE (2*LUA_MINSTACK) - - - -typedef struct stringtable { - GCObject **hash; - lu_int32 nuse; /* number of elements */ - int size; -} stringtable; - - -/* -** informations about a call -*/ -typedef struct CallInfo { - StkId base; /* base for this function */ - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ - const Instruction *savedpc; - int nresults; /* expected number of results from this function */ - int tailcalls; /* number of tail calls lost under this entry */ -} CallInfo; - - - -#define curr_func(L) (clvalue(L->ci->func)) -#define ci_func(ci) (clvalue((ci)->func)) -#define f_isLua(ci) (!ci_func(ci)->c.isC) -#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) - - -/* -** `global state', shared by all threads of this state -*/ -typedef struct global_State { - stringtable strt; /* hash table for strings */ - lua_Alloc frealloc; /* function to reallocate memory */ - void *ud; /* auxiliary data to `frealloc' */ - lu_byte currentwhite; - lu_byte gcstate; /* state of garbage collector */ - int sweepstrgc; /* position of sweep in `strt' */ - GCObject *rootgc; /* list of all collectable objects */ - GCObject **sweepgc; /* position of sweep in `rootgc' */ - GCObject *gray; /* list of gray objects */ - GCObject *grayagain; /* list of objects to be traversed atomically */ - GCObject *weak; /* list of weak tables (to be cleared) */ - GCObject *tmudata; /* last element of list of userdata to be GC */ - Mbuffer buff; /* temporary buffer for string concatentation */ - lu_mem GCthreshold; - lu_mem totalbytes; /* number of bytes currently allocated */ - lu_mem estimate; /* an estimate of number of bytes actually in use */ - lu_mem gcdept; /* how much GC is `behind schedule' */ - int gcpause; /* size of pause between successive GCs */ - int gcstepmul; /* GC `granularity' */ - lua_CFunction panic; /* to be called in unprotected errors */ - TValue l_registry; - struct lua_State *mainthread; - UpVal uvhead; /* head of double-linked list of all open upvalues */ - struct Table *mt[NUM_TAGS]; /* metatables for basic types */ - TString *tmname[TM_N]; /* array with tag-method names */ -} global_State; - - -/* -** `per thread' state -*/ -struct lua_State { - CommonHeader; - lu_byte status; - StkId top; /* first free slot in the stack */ - StkId base; /* base of current function */ - global_State *l_G; - CallInfo *ci; /* call info for current function */ - const Instruction *savedpc; /* `savedpc' of current function */ - StkId stack_last; /* last free slot in the stack */ - StkId stack; /* stack base */ - CallInfo *end_ci; /* points after end of ci array*/ - CallInfo *base_ci; /* array of CallInfo's */ - int stacksize; - int size_ci; /* size of array `base_ci' */ - unsigned short nCcalls; /* number of nested C calls */ - unsigned short baseCcalls; /* nested C calls when resuming coroutine */ - lu_byte hookmask; - lu_byte allowhook; - int basehookcount; - int hookcount; - lua_Hook hook; - TValue l_gt; /* table of globals */ - TValue env; /* temporary place for environments */ - GCObject *openupval; /* list of open upvalues in this stack */ - GCObject *gclist; - struct lua_longjmp *errorJmp; /* current error recover point */ - ptrdiff_t errfunc; /* current error handling function (stack index) */ -}; - - -#define G(L) (L->l_G) - - -/* -** Union of all collectable objects -*/ -union GCObject { - GCheader gch; - union TString ts; - union Udata u; - union Closure cl; - struct Table h; - struct Proto p; - struct UpVal uv; - struct lua_State th; /* thread */ -}; - - -/* macros to convert a GCObject into a specific value */ -#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) -#define gco2ts(o) (&rawgco2ts(o)->tsv) -#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) -#define gco2u(o) (&rawgco2u(o)->uv) -#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) -#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) -#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) -#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) -#define ngcotouv(o) \ - check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) -#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) - -/* macro to convert any Lua object into a GCObject */ -#define obj2gco(v) (cast(GCObject *, (v))) - - -LUAI_FUNC lua_State *luaE_newthread (lua_State *L); -LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); - -#endif - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstring.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstring.c deleted file mode 100644 index 49113151..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstring.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ -** String table (keeps all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - - -#include - -#define lstring_c -#define LUA_CORE - -#include "lua.h" - -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" - - - -void luaS_resize (lua_State *L, int newsize) { - GCObject **newhash; - stringtable *tb; - int i; - if (G(L)->gcstate == GCSsweepstring) - return; /* cannot resize during GC traverse */ - newhash = luaM_newvector(L, newsize, GCObject *); - tb = &G(L)->strt; - for (i=0; isize; i++) { - GCObject *p = tb->hash[i]; - while (p) { /* for each node in the list */ - GCObject *next = p->gch.next; /* save next */ - unsigned int h = gco2ts(p)->hash; - int h1 = lmod(h, newsize); /* new position */ - lua_assert(cast_int(h%newsize) == lmod(h, newsize)); - p->gch.next = newhash[h1]; /* chain it */ - newhash[h1] = p; - p = next; - } - } - luaM_freearray(L, tb->hash, tb->size, TString *); - tb->size = newsize; - tb->hash = newhash; -} - - -static TString *newlstr (lua_State *L, const char *str, size_t l, - unsigned int h) { - TString *ts; - stringtable *tb; - if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) - luaM_toobig(L); - ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); - ts->tsv.len = l; - ts->tsv.hash = h; - ts->tsv.marked = luaC_white(G(L)); - ts->tsv.tt = LUA_TSTRING; - ts->tsv.reserved = 0; - memcpy(ts+1, str, l*sizeof(char)); - ((char *)(ts+1))[l] = '\0'; /* ending 0 */ - tb = &G(L)->strt; - h = lmod(h, tb->size); - ts->tsv.next = tb->hash[h]; /* chain new entry */ - tb->hash[h] = obj2gco(ts); - tb->nuse++; - if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) - luaS_resize(L, tb->size*2); /* too crowded */ - return ts; -} - - -TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { - GCObject *o; - unsigned int h = cast(unsigned int, l); /* seed */ - size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ - size_t l1; - for (l1=l; l1>=step; l1-=step) /* compute hash */ - h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); - for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; - o != NULL; - o = o->gch.next) { - TString *ts = rawgco2ts(o); - if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { - /* string may be dead */ - if (isdead(G(L), o)) changewhite(o); - return ts; - } - } - return newlstr(L, str, l, h); /* not found */ -} - - -Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { - Udata *u; - if (s > MAX_SIZET - sizeof(Udata)) - luaM_toobig(L); - u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); - u->uv.marked = luaC_white(G(L)); /* is not finalized */ - u->uv.tt = LUA_TUSERDATA; - u->uv.len = s; - u->uv.metatable = NULL; - u->uv.env = e; - /* chain it on udata list (after main thread) */ - u->uv.next = G(L)->mainthread->next; - G(L)->mainthread->next = obj2gco(u); - return u; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstring.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstring.h deleted file mode 100644 index 73a2ff8b..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstring.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ -** String table (keep all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#ifndef lstring_h -#define lstring_h - - -#include "lgc.h" -#include "lobject.h" -#include "lstate.h" - - -#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) - -#define sizeudata(u) (sizeof(union Udata)+(u)->len) - -#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) -#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ - (sizeof(s)/sizeof(char))-1)) - -#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) - -LUAI_FUNC void luaS_resize (lua_State *L, int newsize); -LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstrlib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstrlib.c deleted file mode 100644 index 7a03489b..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lstrlib.c +++ /dev/null @@ -1,871 +0,0 @@ -/* -** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $ -** Standard library for string operations and pattern-matching -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include -#include -#include - -#define lstrlib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* macro to `unsign' a character */ -#define uchar(c) ((unsigned char)(c)) - - - -static int str_len (lua_State *L) { - size_t l; - luaL_checklstring(L, 1, &l); - lua_pushinteger(L, l); - return 1; -} - - -static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { - /* relative string position: negative means back from end */ - if (pos < 0) pos += (ptrdiff_t)len + 1; - return (pos >= 0) ? pos : 0; -} - - -static int str_sub (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); - ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); - if (start < 1) start = 1; - if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; - if (start <= end) - lua_pushlstring(L, s+start-1, end-start+1); - else lua_pushliteral(L, ""); - return 1; -} - - -static int str_reverse (lua_State *L) { - size_t l; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - luaL_buffinit(L, &b); - while (l--) luaL_addchar(&b, s[l]); - luaL_pushresult(&b); - return 1; -} - - -static int str_lower (lua_State *L) { - size_t l; - size_t i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - luaL_buffinit(L, &b); - for (i=0; i 0) - luaL_addlstring(&b, s, l); - luaL_pushresult(&b); - return 1; -} - - -static int str_byte (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); - ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); - int n, i; - if (posi <= 0) posi = 1; - if ((size_t)pose > l) pose = l; - if (posi > pose) return 0; /* empty interval; return no values */ - n = (int)(pose - posi + 1); - if (posi + n <= pose) /* overflow? */ - luaL_error(L, "string slice too long"); - luaL_checkstack(L, n, "string slice too long"); - for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) - return luaL_error(ms->L, "invalid capture index"); - return l; -} - - -static int capture_to_close (MatchState *ms) { - int level = ms->level; - for (level--; level>=0; level--) - if (ms->capture[level].len == CAP_UNFINISHED) return level; - return luaL_error(ms->L, "invalid pattern capture"); -} - - -static const char *classend (MatchState *ms, const char *p) { - switch (*p++) { - case L_ESC: { - if (*p == '\0') - luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); - return p+1; - } - case '[': { - if (*p == '^') p++; - do { /* look for a `]' */ - if (*p == '\0') - luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); - if (*(p++) == L_ESC && *p != '\0') - p++; /* skip escapes (e.g. `%]') */ - } while (*p != ']'); - return p+1; - } - default: { - return p; - } - } -} - - -static int match_class (int c, int cl) { - int res; - switch (tolower(cl)) { - case 'a' : res = isalpha(c); break; - case 'c' : res = iscntrl(c); break; - case 'd' : res = isdigit(c); break; - case 'l' : res = islower(c); break; - case 'p' : res = ispunct(c); break; - case 's' : res = isspace(c); break; - case 'u' : res = isupper(c); break; - case 'w' : res = isalnum(c); break; - case 'x' : res = isxdigit(c); break; - case 'z' : res = (c == 0); break; - default: return (cl == c); - } - return (islower(cl) ? res : !res); -} - - -static int matchbracketclass (int c, const char *p, const char *ec) { - int sig = 1; - if (*(p+1) == '^') { - sig = 0; - p++; /* skip the `^' */ - } - while (++p < ec) { - if (*p == L_ESC) { - p++; - if (match_class(c, uchar(*p))) - return sig; - } - else if ((*(p+1) == '-') && (p+2 < ec)) { - p+=2; - if (uchar(*(p-2)) <= c && c <= uchar(*p)) - return sig; - } - else if (uchar(*p) == c) return sig; - } - return !sig; -} - - -static int singlematch (int c, const char *p, const char *ep) { - switch (*p) { - case '.': return 1; /* matches any char */ - case L_ESC: return match_class(c, uchar(*(p+1))); - case '[': return matchbracketclass(c, p, ep-1); - default: return (uchar(*p) == c); - } -} - - -static const char *match (MatchState *ms, const char *s, const char *p); - - -static const char *matchbalance (MatchState *ms, const char *s, - const char *p) { - if (*p == 0 || *(p+1) == 0) - luaL_error(ms->L, "unbalanced pattern"); - if (*s != *p) return NULL; - else { - int b = *p; - int e = *(p+1); - int cont = 1; - while (++s < ms->src_end) { - if (*s == e) { - if (--cont == 0) return s+1; - } - else if (*s == b) cont++; - } - } - return NULL; /* string ends out of balance */ -} - - -static const char *max_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - ptrdiff_t i = 0; /* counts maximum expand for item */ - while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) - i++; - /* keeps trying to match with the maximum repetitions */ - while (i>=0) { - const char *res = match(ms, (s+i), ep+1); - if (res) return res; - i--; /* else didn't match; reduce 1 repetition to try again */ - } - return NULL; -} - - -static const char *min_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - for (;;) { - const char *res = match(ms, s, ep+1); - if (res != NULL) - return res; - else if (ssrc_end && singlematch(uchar(*s), p, ep)) - s++; /* try with one more repetition */ - else return NULL; - } -} - - -static const char *start_capture (MatchState *ms, const char *s, - const char *p, int what) { - const char *res; - int level = ms->level; - if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); - ms->capture[level].init = s; - ms->capture[level].len = what; - ms->level = level+1; - if ((res=match(ms, s, p)) == NULL) /* match failed? */ - ms->level--; /* undo capture */ - return res; -} - - -static const char *end_capture (MatchState *ms, const char *s, - const char *p) { - int l = capture_to_close(ms); - const char *res; - ms->capture[l].len = s - ms->capture[l].init; /* close capture */ - if ((res = match(ms, s, p)) == NULL) /* match failed? */ - ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ - return res; -} - - -static const char *match_capture (MatchState *ms, const char *s, int l) { - size_t len; - l = check_capture(ms, l); - len = ms->capture[l].len; - if ((size_t)(ms->src_end-s) >= len && - memcmp(ms->capture[l].init, s, len) == 0) - return s+len; - else return NULL; -} - - -static const char *match (MatchState *ms, const char *s, const char *p) { - init: /* using goto's to optimize tail recursion */ - switch (*p) { - case '(': { /* start capture */ - if (*(p+1) == ')') /* position capture? */ - return start_capture(ms, s, p+2, CAP_POSITION); - else - return start_capture(ms, s, p+1, CAP_UNFINISHED); - } - case ')': { /* end capture */ - return end_capture(ms, s, p+1); - } - case L_ESC: { - switch (*(p+1)) { - case 'b': { /* balanced string? */ - s = matchbalance(ms, s, p+2); - if (s == NULL) return NULL; - p+=4; goto init; /* else return match(ms, s, p+4); */ - } - case 'f': { /* frontier? */ - const char *ep; char previous; - p += 2; - if (*p != '[') - luaL_error(ms->L, "missing " LUA_QL("[") " after " - LUA_QL("%%f") " in pattern"); - ep = classend(ms, p); /* points to what is next */ - previous = (s == ms->src_init) ? '\0' : *(s-1); - if (matchbracketclass(uchar(previous), p, ep-1) || - !matchbracketclass(uchar(*s), p, ep-1)) return NULL; - p=ep; goto init; /* else return match(ms, s, ep); */ - } - default: { - if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ - s = match_capture(ms, s, uchar(*(p+1))); - if (s == NULL) return NULL; - p+=2; goto init; /* else return match(ms, s, p+2) */ - } - goto dflt; /* case default */ - } - } - } - case '\0': { /* end of pattern */ - return s; /* match succeeded */ - } - case '$': { - if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ - return (s == ms->src_end) ? s : NULL; /* check end of string */ - else goto dflt; - } - default: dflt: { /* it is a pattern item */ - const char *ep = classend(ms, p); /* points to what is next */ - int m = ssrc_end && singlematch(uchar(*s), p, ep); - switch (*ep) { - case '?': { /* optional */ - const char *res; - if (m && ((res=match(ms, s+1, ep+1)) != NULL)) - return res; - p=ep+1; goto init; /* else return match(ms, s, ep+1); */ - } - case '*': { /* 0 or more repetitions */ - return max_expand(ms, s, p, ep); - } - case '+': { /* 1 or more repetitions */ - return (m ? max_expand(ms, s+1, p, ep) : NULL); - } - case '-': { /* 0 or more repetitions (minimum) */ - return min_expand(ms, s, p, ep); - } - default: { - if (!m) return NULL; - s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ - } - } - } - } -} - - - -static const char *lmemfind (const char *s1, size_t l1, - const char *s2, size_t l2) { - if (l2 == 0) return s1; /* empty strings are everywhere */ - else if (l2 > l1) return NULL; /* avoids a negative `l1' */ - else { - const char *init; /* to search for a `*s2' inside `s1' */ - l2--; /* 1st char will be checked by `memchr' */ - l1 = l1-l2; /* `s2' cannot be found after that */ - while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { - init++; /* 1st char is already checked */ - if (memcmp(init, s2+1, l2) == 0) - return init-1; - else { /* correct `l1' and `s1' to try again */ - l1 -= init-s1; - s1 = init; - } - } - return NULL; /* not found */ - } -} - - -static void push_onecapture (MatchState *ms, int i, const char *s, - const char *e) { - if (i >= ms->level) { - if (i == 0) /* ms->level == 0, too */ - lua_pushlstring(ms->L, s, e - s); /* add whole match */ - else - luaL_error(ms->L, "invalid capture index"); - } - else { - ptrdiff_t l = ms->capture[i].len; - if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); - if (l == CAP_POSITION) - lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); - else - lua_pushlstring(ms->L, ms->capture[i].init, l); - } -} - - -static int push_captures (MatchState *ms, const char *s, const char *e) { - int i; - int nlevels = (ms->level == 0 && s) ? 1 : ms->level; - luaL_checkstack(ms->L, nlevels, "too many captures"); - for (i = 0; i < nlevels; i++) - push_onecapture(ms, i, s, e); - return nlevels; /* number of strings pushed */ -} - - -static int str_find_aux (lua_State *L, int find) { - size_t l1, l2; - const char *s = luaL_checklstring(L, 1, &l1); - const char *p = luaL_checklstring(L, 2, &l2); - ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; - if (init < 0) init = 0; - else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; - if (find && (lua_toboolean(L, 4) || /* explicit request? */ - strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ - /* do a plain search */ - const char *s2 = lmemfind(s+init, l1-init, p, l2); - if (s2) { - lua_pushinteger(L, s2-s+1); - lua_pushinteger(L, s2-s+l2); - return 2; - } - } - else { - MatchState ms; - int anchor = (*p == '^') ? (p++, 1) : 0; - const char *s1=s+init; - ms.L = L; - ms.src_init = s; - ms.src_end = s+l1; - do { - const char *res; - ms.level = 0; - if ((res=match(&ms, s1, p)) != NULL) { - if (find) { - lua_pushinteger(L, s1-s+1); /* start */ - lua_pushinteger(L, res-s); /* end */ - return push_captures(&ms, NULL, 0) + 2; - } - else - return push_captures(&ms, s1, res); - } - } while (s1++ < ms.src_end && !anchor); - } - lua_pushnil(L); /* not found */ - return 1; -} - - -static int str_find (lua_State *L) { - return str_find_aux(L, 1); -} - - -static int str_match (lua_State *L) { - return str_find_aux(L, 0); -} - - -static int gmatch_aux (lua_State *L) { - MatchState ms; - size_t ls; - const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); - const char *p = lua_tostring(L, lua_upvalueindex(2)); - const char *src; - ms.L = L; - ms.src_init = s; - ms.src_end = s+ls; - for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); - src <= ms.src_end; - src++) { - const char *e; - ms.level = 0; - if ((e = match(&ms, src, p)) != NULL) { - lua_Integer newstart = e-s; - if (e == src) newstart++; /* empty match? go at least one position */ - lua_pushinteger(L, newstart); - lua_replace(L, lua_upvalueindex(3)); - return push_captures(&ms, src, e); - } - } - return 0; /* not found */ -} - - -static int gmatch (lua_State *L) { - luaL_checkstring(L, 1); - luaL_checkstring(L, 2); - lua_settop(L, 2); - lua_pushinteger(L, 0); - lua_pushcclosure(L, gmatch_aux, 3); - return 1; -} - - -static int gfind_nodef (lua_State *L) { - return luaL_error(L, LUA_QL("string.gfind") " was renamed to " - LUA_QL("string.gmatch")); -} - - -static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e) { - size_t l, i; - const char *news = lua_tolstring(ms->L, 3, &l); - for (i = 0; i < l; i++) { - if (news[i] != L_ESC) - luaL_addchar(b, news[i]); - else { - i++; /* skip ESC */ - if (!isdigit(uchar(news[i]))) - luaL_addchar(b, news[i]); - else if (news[i] == '0') - luaL_addlstring(b, s, e - s); - else { - push_onecapture(ms, news[i] - '1', s, e); - luaL_addvalue(b); /* add capture to accumulated result */ - } - } - } -} - - -static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e) { - lua_State *L = ms->L; - switch (lua_type(L, 3)) { - case LUA_TNUMBER: - case LUA_TSTRING: { - add_s(ms, b, s, e); - return; - } - case LUA_TFUNCTION: { - int n; - lua_pushvalue(L, 3); - n = push_captures(ms, s, e); - lua_call(L, n, 1); - break; - } - case LUA_TTABLE: { - push_onecapture(ms, 0, s, e); - lua_gettable(L, 3); - break; - } - } - if (!lua_toboolean(L, -1)) { /* nil or false? */ - lua_pop(L, 1); - lua_pushlstring(L, s, e - s); /* keep original text */ - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); - luaL_addvalue(b); /* add result to accumulator */ -} - - -static int str_gsub (lua_State *L) { - size_t srcl; - const char *src = luaL_checklstring(L, 1, &srcl); - const char *p = luaL_checkstring(L, 2); - int tr = lua_type(L, 3); - int max_s = luaL_optint(L, 4, srcl+1); - int anchor = (*p == '^') ? (p++, 1) : 0; - int n = 0; - MatchState ms; - luaL_Buffer b; - luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || - tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, - "string/function/table expected"); - luaL_buffinit(L, &b); - ms.L = L; - ms.src_init = src; - ms.src_end = src+srcl; - while (n < max_s) { - const char *e; - ms.level = 0; - e = match(&ms, src, p); - if (e) { - n++; - add_value(&ms, &b, src, e); - } - if (e && e>src) /* non empty match? */ - src = e; /* skip it */ - else if (src < ms.src_end) - luaL_addchar(&b, *src++); - else break; - if (anchor) break; - } - luaL_addlstring(&b, src, ms.src_end-src); - luaL_pushresult(&b); - lua_pushinteger(L, n); /* number of substitutions */ - return 2; -} - -/* }====================================================== */ - - -/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ -#define MAX_ITEM 512 -/* valid flags in a format specification */ -#define FLAGS "-+ #0" -/* -** maximum size of each format specification (such as '%-099.99d') -** (+10 accounts for %99.99x plus margin of error) -*/ -#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) - - -static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { - size_t l; - const char *s = luaL_checklstring(L, arg, &l); - luaL_addchar(b, '"'); - while (l--) { - switch (*s) { - case '"': case '\\': case '\n': { - luaL_addchar(b, '\\'); - luaL_addchar(b, *s); - break; - } - case '\r': { - luaL_addlstring(b, "\\r", 2); - break; - } - case '\0': { - luaL_addlstring(b, "\\000", 4); - break; - } - default: { - luaL_addchar(b, *s); - break; - } - } - s++; - } - luaL_addchar(b, '"'); -} - -static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { - const char *p = strfrmt; - while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ - if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) - luaL_error(L, "invalid format (repeated flags)"); - if (isdigit(uchar(*p))) p++; /* skip width */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - if (*p == '.') { - p++; - if (isdigit(uchar(*p))) p++; /* skip precision */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - } - if (isdigit(uchar(*p))) - luaL_error(L, "invalid format (width or precision too long)"); - *(form++) = '%'; - strncpy(form, strfrmt, p - strfrmt + 1); - form += p - strfrmt + 1; - *form = '\0'; - return p; -} - - -static void addintlen (char *form) { - size_t l = strlen(form); - char spec = form[l - 1]; - strcpy(form + l - 1, LUA_INTFRMLEN); - form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; - form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; -} - - -static int str_format (lua_State *L) { - int top = lua_gettop(L); - int arg = 1; - size_t sfl; - const char *strfrmt = luaL_checklstring(L, arg, &sfl); - const char *strfrmt_end = strfrmt+sfl; - luaL_Buffer b; - luaL_buffinit(L, &b); - while (strfrmt < strfrmt_end) { - if (*strfrmt != L_ESC) - luaL_addchar(&b, *strfrmt++); - else if (*++strfrmt == L_ESC) - luaL_addchar(&b, *strfrmt++); /* %% */ - else { /* format item */ - char form[MAX_FORMAT]; /* to store the format (`%...') */ - char buff[MAX_ITEM]; /* to store the formatted item */ - if (++arg > top) - luaL_argerror(L, arg, "no value"); - strfrmt = scanformat(L, strfrmt, form); - switch (*strfrmt++) { - case 'c': { - sprintf(buff, form, (int)luaL_checknumber(L, arg)); - break; - } - case 'd': case 'i': { - addintlen(form); - sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); - break; - } - case 'o': case 'u': case 'x': case 'X': { - addintlen(form); - sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); - break; - } - case 'e': case 'E': case 'f': - case 'g': case 'G': { - sprintf(buff, form, (double)luaL_checknumber(L, arg)); - break; - } - case 'q': { - addquoted(L, &b, arg); - continue; /* skip the 'addsize' at the end */ - } - case 's': { - size_t l; - const char *s = luaL_checklstring(L, arg, &l); - if (!strchr(form, '.') && l >= 100) { - /* no precision and string is too long to be formatted; - keep original string */ - lua_pushvalue(L, arg); - luaL_addvalue(&b); - continue; /* skip the `addsize' at the end */ - } - else { - sprintf(buff, form, s); - break; - } - } - default: { /* also treat cases `pnLlh' */ - return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " - LUA_QL("format"), *(strfrmt - 1)); - } - } - luaL_addlstring(&b, buff, strlen(buff)); - } - } - luaL_pushresult(&b); - return 1; -} - - -static const luaL_Reg strlib[] = { - {"byte", str_byte}, - {"char", str_char}, - {"dump", str_dump}, - {"find", str_find}, - {"format", str_format}, - {"gfind", gfind_nodef}, - {"gmatch", gmatch}, - {"gsub", str_gsub}, - {"len", str_len}, - {"lower", str_lower}, - {"match", str_match}, - {"rep", str_rep}, - {"reverse", str_reverse}, - {"sub", str_sub}, - {"upper", str_upper}, - {NULL, NULL} -}; - - -static void createmetatable (lua_State *L) { - lua_createtable(L, 0, 1); /* create metatable for strings */ - lua_pushliteral(L, ""); /* dummy string */ - lua_pushvalue(L, -2); - lua_setmetatable(L, -2); /* set string metatable */ - lua_pop(L, 1); /* pop dummy string */ - lua_pushvalue(L, -2); /* string library... */ - lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ - lua_pop(L, 1); /* pop metatable */ -} - - -/* -** Open string library -*/ -LUALIB_API int luaopen_string (lua_State *L) { - luaL_register(L, LUA_STRLIBNAME, strlib); -#if defined(LUA_COMPAT_GFIND) - lua_getfield(L, -1, "gmatch"); - lua_setfield(L, -2, "gfind"); -#endif - createmetatable(L); - return 1; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltable.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltable.c deleted file mode 100644 index ec84f4fa..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltable.c +++ /dev/null @@ -1,588 +0,0 @@ -/* -** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - - -/* -** Implementation of tables (aka arrays, objects, or hash tables). -** Tables keep its elements in two parts: an array part and a hash part. -** Non-negative integer keys are all candidates to be kept in the array -** part. The actual size of the array is the largest `n' such that at -** least half the slots between 0 and n are in use. -** Hash uses a mix of chained scatter table with Brent's variation. -** A main invariant of these tables is that, if an element is not -** in its main position (i.e. the `original' position that its hash gives -** to it), then the colliding element is in its own main position. -** Hence even when the load factor reaches 100%, performance remains good. -*/ - -#include -#include - -#define ltable_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "ltable.h" - - -/* -** max size of array part is 2^MAXBITS -*/ -#if LUAI_BITSINT > 26 -#define MAXBITS 26 -#else -#define MAXBITS (LUAI_BITSINT-2) -#endif - -#define MAXASIZE (1 << MAXBITS) - - -#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) - -#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) -#define hashboolean(t,p) hashpow2(t, p) - - -/* -** for some types, it is better to avoid modulus by power of 2, as -** they tend to have many 2 factors. -*/ -#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) - - -#define hashpointer(t,p) hashmod(t, IntPoint(p)) - - -/* -** number of ints inside a lua_Number -*/ -#define numints cast_int(sizeof(lua_Number)/sizeof(int)) - - - -#define dummynode (&dummynode_) - -static const Node dummynode_ = { - {{NULL}, LUA_TNIL}, /* value */ - {{{NULL}, LUA_TNIL, NULL}} /* key */ -}; - - -/* -** hash for lua_Numbers -*/ -static Node *hashnum (const Table *t, lua_Number n) { - unsigned int a[numints]; - int i; - if (luai_numeq(n, 0)) /* avoid problems with -0 */ - return gnode(t, 0); - memcpy(a, &n, sizeof(a)); - for (i = 1; i < numints; i++) a[0] += a[i]; - return hashmod(t, a[0]); -} - - - -/* -** returns the `main' position of an element in a table (that is, the index -** of its hash value) -*/ -static Node *mainposition (const Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TNUMBER: - return hashnum(t, nvalue(key)); - case LUA_TSTRING: - return hashstr(t, rawtsvalue(key)); - case LUA_TBOOLEAN: - return hashboolean(t, bvalue(key)); - case LUA_TLIGHTUSERDATA: - return hashpointer(t, pvalue(key)); - default: - return hashpointer(t, gcvalue(key)); - } -} - - -/* -** returns the index for `key' if `key' is an appropriate key to live in -** the array part of the table, -1 otherwise. -*/ -static int arrayindex (const TValue *key) { - if (ttisnumber(key)) { - lua_Number n = nvalue(key); - int k; - lua_number2int(k, n); - if (luai_numeq(cast_num(k), n)) - return k; - } - return -1; /* `key' did not match some condition */ -} - - -/* -** returns the index of a `key' for table traversals. First goes all -** elements in the array part, then elements in the hash part. The -** beginning of a traversal is signalled by -1. -*/ -static int findindex (lua_State *L, Table *t, StkId key) { - int i; - if (ttisnil(key)) return -1; /* first iteration */ - i = arrayindex(key); - if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ - return i-1; /* yes; that's the index (corrected to C) */ - else { - Node *n = mainposition(t, key); - do { /* check whether `key' is somewhere in the chain */ - /* key may be dead already, but it is ok to use it in `next' */ - if (luaO_rawequalObj(key2tval(n), key) || - (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && - gcvalue(gkey(n)) == gcvalue(key))) { - i = cast_int(n - gnode(t, 0)); /* key index in hash table */ - /* hash elements are numbered after array ones */ - return i + t->sizearray; - } - else n = gnext(n); - } while (n); - luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ - return 0; /* to avoid warnings */ - } -} - - -int luaH_next (lua_State *L, Table *t, StkId key) { - int i = findindex(L, t, key); /* find original element */ - for (i++; i < t->sizearray; i++) { /* try first array part */ - if (!ttisnil(&t->array[i])) { /* a non-nil value? */ - setnvalue(key, cast_num(i+1)); - setobj2s(L, key+1, &t->array[i]); - return 1; - } - } - for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ - if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ - setobj2s(L, key, key2tval(gnode(t, i))); - setobj2s(L, key+1, gval(gnode(t, i))); - return 1; - } - } - return 0; /* no more elements */ -} - - -/* -** {============================================================= -** Rehash -** ============================================================== -*/ - - -static int computesizes (int nums[], int *narray) { - int i; - int twotoi; /* 2^i */ - int a = 0; /* number of elements smaller than 2^i */ - int na = 0; /* number of elements to go to array part */ - int n = 0; /* optimal size for array part */ - for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { - if (nums[i] > 0) { - a += nums[i]; - if (a > twotoi/2) { /* more than half elements present? */ - n = twotoi; /* optimal size (till now) */ - na = a; /* all elements smaller than n will go to array part */ - } - } - if (a == *narray) break; /* all elements already counted */ - } - *narray = n; - lua_assert(*narray/2 <= na && na <= *narray); - return na; -} - - -static int countint (const TValue *key, int *nums) { - int k = arrayindex(key); - if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ - nums[ceillog2(k)]++; /* count as such */ - return 1; - } - else - return 0; -} - - -static int numusearray (const Table *t, int *nums) { - int lg; - int ttlg; /* 2^lg */ - int ause = 0; /* summation of `nums' */ - int i = 1; /* count to traverse all array keys */ - for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ - int lc = 0; /* counter */ - int lim = ttlg; - if (lim > t->sizearray) { - lim = t->sizearray; /* adjust upper limit */ - if (i > lim) - break; /* no more elements to count */ - } - /* count elements in range (2^(lg-1), 2^lg] */ - for (; i <= lim; i++) { - if (!ttisnil(&t->array[i-1])) - lc++; - } - nums[lg] += lc; - ause += lc; - } - return ause; -} - - -static int numusehash (const Table *t, int *nums, int *pnasize) { - int totaluse = 0; /* total number of elements */ - int ause = 0; /* summation of `nums' */ - int i = sizenode(t); - while (i--) { - Node *n = &t->node[i]; - if (!ttisnil(gval(n))) { - ause += countint(key2tval(n), nums); - totaluse++; - } - } - *pnasize += ause; - return totaluse; -} - - -static void setarrayvector (lua_State *L, Table *t, int size) { - int i; - luaM_reallocvector(L, t->array, t->sizearray, size, TValue); - for (i=t->sizearray; iarray[i]); - t->sizearray = size; -} - - -static void setnodevector (lua_State *L, Table *t, int size) { - int lsize; - if (size == 0) { /* no elements to hash part? */ - t->node = cast(Node *, dummynode); /* use common `dummynode' */ - lsize = 0; - } - else { - int i; - lsize = ceillog2(size); - if (lsize > MAXBITS) - luaG_runerror(L, "table overflow"); - size = twoto(lsize); - t->node = luaM_newvector(L, size, Node); - for (i=0; ilsizenode = cast_byte(lsize); - t->lastfree = gnode(t, size); /* all positions are free */ -} - - -static void resize (lua_State *L, Table *t, int nasize, int nhsize) { - int i; - int oldasize = t->sizearray; - int oldhsize = t->lsizenode; - Node *nold = t->node; /* save old hash ... */ - if (nasize > oldasize) /* array part must grow? */ - setarrayvector(L, t, nasize); - /* create new hash part with appropriate size */ - setnodevector(L, t, nhsize); - if (nasize < oldasize) { /* array part must shrink? */ - t->sizearray = nasize; - /* re-insert elements from vanishing slice */ - for (i=nasize; iarray[i])) - setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); - } - /* shrink array */ - luaM_reallocvector(L, t->array, oldasize, nasize, TValue); - } - /* re-insert elements from hash part */ - for (i = twoto(oldhsize) - 1; i >= 0; i--) { - Node *old = nold+i; - if (!ttisnil(gval(old))) - setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); - } - if (nold != dummynode) - luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ -} - - -void luaH_resizearray (lua_State *L, Table *t, int nasize) { - int nsize = (t->node == dummynode) ? 0 : sizenode(t); - resize(L, t, nasize, nsize); -} - - -static void rehash (lua_State *L, Table *t, const TValue *ek) { - int nasize, na; - int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ - int i; - int totaluse; - for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ - nasize = numusearray(t, nums); /* count keys in array part */ - totaluse = nasize; /* all those keys are integer keys */ - totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ - /* count extra key */ - nasize += countint(ek, nums); - totaluse++; - /* compute new size for array part */ - na = computesizes(nums, &nasize); - /* resize the table to new computed sizes */ - resize(L, t, nasize, totaluse - na); -} - - - -/* -** }============================================================= -*/ - - -Table *luaH_new (lua_State *L, int narray, int nhash) { - Table *t = luaM_new(L, Table); - luaC_link(L, obj2gco(t), LUA_TTABLE); - t->metatable = NULL; - t->flags = cast_byte(~0); - /* temporary values (kept only if some malloc fails) */ - t->array = NULL; - t->sizearray = 0; - t->lsizenode = 0; - t->node = cast(Node *, dummynode); - setarrayvector(L, t, narray); - setnodevector(L, t, nhash); - return t; -} - - -void luaH_free (lua_State *L, Table *t) { - if (t->node != dummynode) - luaM_freearray(L, t->node, sizenode(t), Node); - luaM_freearray(L, t->array, t->sizearray, TValue); - luaM_free(L, t); -} - - -static Node *getfreepos (Table *t) { - while (t->lastfree-- > t->node) { - if (ttisnil(gkey(t->lastfree))) - return t->lastfree; - } - return NULL; /* could not find a free place */ -} - - - -/* -** inserts a new key into a hash table; first, check whether key's main -** position is free. If not, check whether colliding node is in its main -** position or not: if it is not, move colliding node to an empty place and -** put new key in its main position; otherwise (colliding node is in its main -** position), new key goes to an empty position. -*/ -static TValue *newkey (lua_State *L, Table *t, const TValue *key) { - Node *mp = mainposition(t, key); - if (!ttisnil(gval(mp)) || mp == dummynode) { - Node *othern; - Node *n = getfreepos(t); /* get a free place */ - if (n == NULL) { /* cannot find a free place? */ - rehash(L, t, key); /* grow table */ - return luaH_set(L, t, key); /* re-insert key into grown table */ - } - lua_assert(n != dummynode); - othern = mainposition(t, key2tval(mp)); - if (othern != mp) { /* is colliding node out of its main position? */ - /* yes; move colliding node into free position */ - while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ - gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ - *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ - gnext(mp) = NULL; /* now `mp' is free */ - setnilvalue(gval(mp)); - } - else { /* colliding node is in its own main position */ - /* new node will go into free position */ - gnext(n) = gnext(mp); /* chain new position */ - gnext(mp) = n; - mp = n; - } - } - gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; - luaC_barriert(L, t, key); - lua_assert(ttisnil(gval(mp))); - return gval(mp); -} - - -/* -** search function for integers -*/ -const TValue *luaH_getnum (Table *t, int key) { - /* (1 <= key && key <= t->sizearray) */ - if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) - return &t->array[key-1]; - else { - lua_Number nk = cast_num(key); - Node *n = hashnum(t, nk); - do { /* check whether `key' is somewhere in the chain */ - if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) - return gval(n); /* that's it */ - else n = gnext(n); - } while (n); - return luaO_nilobject; - } -} - - -/* -** search function for strings -*/ -const TValue *luaH_getstr (Table *t, TString *key) { - Node *n = hashstr(t, key); - do { /* check whether `key' is somewhere in the chain */ - if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) - return gval(n); /* that's it */ - else n = gnext(n); - } while (n); - return luaO_nilobject; -} - - -/* -** main search function -*/ -const TValue *luaH_get (Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TNIL: return luaO_nilobject; - case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); - case LUA_TNUMBER: { - int k; - lua_Number n = nvalue(key); - lua_number2int(k, n); - if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ - return luaH_getnum(t, k); /* use specialized version */ - /* else go through */ - } - default: { - Node *n = mainposition(t, key); - do { /* check whether `key' is somewhere in the chain */ - if (luaO_rawequalObj(key2tval(n), key)) - return gval(n); /* that's it */ - else n = gnext(n); - } while (n); - return luaO_nilobject; - } - } -} - - -TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { - const TValue *p = luaH_get(t, key); - t->flags = 0; - if (p != luaO_nilobject) - return cast(TValue *, p); - else { - if (ttisnil(key)) luaG_runerror(L, "table index is nil"); - else if (ttisnumber(key) && luai_numisnan(nvalue(key))) - luaG_runerror(L, "table index is NaN"); - return newkey(L, t, key); - } -} - - -TValue *luaH_setnum (lua_State *L, Table *t, int key) { - const TValue *p = luaH_getnum(t, key); - if (p != luaO_nilobject) - return cast(TValue *, p); - else { - TValue k; - setnvalue(&k, cast_num(key)); - return newkey(L, t, &k); - } -} - - -TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { - const TValue *p = luaH_getstr(t, key); - if (p != luaO_nilobject) - return cast(TValue *, p); - else { - TValue k; - setsvalue(L, &k, key); - return newkey(L, t, &k); - } -} - - -static int unbound_search (Table *t, unsigned int j) { - unsigned int i = j; /* i is zero or a present index */ - j++; - /* find `i' and `j' such that i is present and j is not */ - while (!ttisnil(luaH_getnum(t, j))) { - i = j; - j *= 2; - if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ - /* table was built with bad purposes: resort to linear search */ - i = 1; - while (!ttisnil(luaH_getnum(t, i))) i++; - return i - 1; - } - } - /* now do a binary search between them */ - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(luaH_getnum(t, m))) j = m; - else i = m; - } - return i; -} - - -/* -** Try to find a boundary in table `t'. A `boundary' is an integer index -** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). -*/ -int luaH_getn (Table *t) { - unsigned int j = t->sizearray; - if (j > 0 && ttisnil(&t->array[j - 1])) { - /* there is a boundary in the array part: (binary) search for it */ - unsigned int i = 0; - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(&t->array[m - 1])) j = m; - else i = m; - } - return i; - } - /* else must find a boundary in hash part */ - else if (t->node == dummynode) /* hash part is empty? */ - return j; /* that is easy... */ - else return unbound_search(t, j); -} - - - -#if defined(LUA_DEBUG) - -Node *luaH_mainposition (const Table *t, const TValue *key) { - return mainposition(t, key); -} - -int luaH_isdummy (Node *n) { return n == dummynode; } - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltable.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltable.h deleted file mode 100644 index f5b9d5ea..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltable.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#ifndef ltable_h -#define ltable_h - -#include "lobject.h" - - -#define gnode(t,i) (&(t)->node[i]) -#define gkey(n) (&(n)->i_key.nk) -#define gval(n) (&(n)->i_val) -#define gnext(n) ((n)->i_key.nk.next) - -#define key2tval(n) (&(n)->i_key.tvk) - - -LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); -LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); -LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); -LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); -LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); -LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); -LUAI_FUNC void luaH_free (lua_State *L, Table *t); -LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); -LUAI_FUNC int luaH_getn (Table *t); - - -#if defined(LUA_DEBUG) -LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); -LUAI_FUNC int luaH_isdummy (Node *n); -#endif - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltablib.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltablib.c deleted file mode 100644 index b6d9cb4a..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltablib.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ -** Library for Table Manipulation -** See Copyright Notice in lua.h -*/ - - -#include - -#define ltablib_c -#define LUA_LIB - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) - - -static int foreachi (lua_State *L) { - int i; - int n = aux_getn(L, 1); - luaL_checktype(L, 2, LUA_TFUNCTION); - for (i=1; i <= n; i++) { - lua_pushvalue(L, 2); /* function */ - lua_pushinteger(L, i); /* 1st argument */ - lua_rawgeti(L, 1, i); /* 2nd argument */ - lua_call(L, 2, 1); - if (!lua_isnil(L, -1)) - return 1; - lua_pop(L, 1); /* remove nil result */ - } - return 0; -} - - -static int foreach (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checktype(L, 2, LUA_TFUNCTION); - lua_pushnil(L); /* first key */ - while (lua_next(L, 1)) { - lua_pushvalue(L, 2); /* function */ - lua_pushvalue(L, -3); /* key */ - lua_pushvalue(L, -3); /* value */ - lua_call(L, 2, 1); - if (!lua_isnil(L, -1)) - return 1; - lua_pop(L, 2); /* remove value and result */ - } - return 0; -} - - -static int maxn (lua_State *L) { - lua_Number max = 0; - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushnil(L); /* first key */ - while (lua_next(L, 1)) { - lua_pop(L, 1); /* remove value */ - if (lua_type(L, -1) == LUA_TNUMBER) { - lua_Number v = lua_tonumber(L, -1); - if (v > max) max = v; - } - } - lua_pushnumber(L, max); - return 1; -} - - -static int getn (lua_State *L) { - lua_pushinteger(L, aux_getn(L, 1)); - return 1; -} - - -static int setn (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); -#ifndef luaL_setn - luaL_setn(L, 1, luaL_checkint(L, 2)); -#else - luaL_error(L, LUA_QL("setn") " is obsolete"); -#endif - lua_pushvalue(L, 1); - return 1; -} - - -static int tinsert (lua_State *L) { - int e = aux_getn(L, 1) + 1; /* first empty element */ - int pos; /* where to insert new element */ - switch (lua_gettop(L)) { - case 2: { /* called with only 2 arguments */ - pos = e; /* insert new element at the end */ - break; - } - case 3: { - int i; - pos = luaL_checkint(L, 2); /* 2nd argument is the position */ - if (pos > e) e = pos; /* `grow' array if necessary */ - for (i = e; i > pos; i--) { /* move up elements */ - lua_rawgeti(L, 1, i-1); - lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ - } - break; - } - default: { - return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); - } - } - luaL_setn(L, 1, e); /* new size */ - lua_rawseti(L, 1, pos); /* t[pos] = v */ - return 0; -} - - -static int tremove (lua_State *L) { - int e = aux_getn(L, 1); - int pos = luaL_optint(L, 2, e); - if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ - return 0; /* nothing to remove */ - luaL_setn(L, 1, e - 1); /* t.n = n-1 */ - lua_rawgeti(L, 1, pos); /* result = t[pos] */ - for ( ;pos= P */ - while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { - if (i>u) luaL_error(L, "invalid order function for sorting"); - lua_pop(L, 1); /* remove a[i] */ - } - /* repeat --j until a[j] <= P */ - while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { - if (j - -#define ltm_c -#define LUA_CORE - -#include "lua.h" - -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - - -const char *const luaT_typenames[] = { - "nil", "boolean", "userdata", "number", - "string", "table", "function", "userdata", "thread", - "proto", "upval" -}; - - -void luaT_init (lua_State *L) { - static const char *const luaT_eventname[] = { /* ORDER TM */ - "__index", "__newindex", - "__gc", "__mode", "__eq", - "__add", "__sub", "__mul", "__div", "__mod", - "__pow", "__unm", "__len", "__lt", "__le", - "__concat", "__call" - }; - int i; - for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); - luaS_fix(G(L)->tmname[i]); /* never collect these names */ - } -} - - -/* -** function to be used with macro "fasttm": optimized for absence of -** tag methods -*/ -const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { - const TValue *tm = luaH_getstr(events, ename); - lua_assert(event <= TM_EQ); - if (ttisnil(tm)) { /* no tag method? */ - events->flags |= cast_byte(1u<metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(o)->metatable; - break; - default: - mt = G(L)->mt[ttype(o)]; - } - return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltm.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltm.h deleted file mode 100644 index 64343b78..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/ltm.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ -** Tag methods -** See Copyright Notice in lua.h -*/ - -#ifndef ltm_h -#define ltm_h - - -#include "lobject.h" - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER TM" -*/ -typedef enum { - TM_INDEX, - TM_NEWINDEX, - TM_GC, - TM_MODE, - TM_EQ, /* last tag method with `fast' access */ - TM_ADD, - TM_SUB, - TM_MUL, - TM_DIV, - TM_MOD, - TM_POW, - TM_UNM, - TM_LEN, - TM_LT, - TM_LE, - TM_CONCAT, - TM_CALL, - TM_N /* number of elements in the enum */ -} TMS; - - - -#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ - ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) - -#define fasttm(l,et,e) gfasttm(G(l), et, e) - -LUAI_DATA const char *const luaT_typenames[]; - - -LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); -LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, - TMS event); -LUAI_FUNC void luaT_init (lua_State *L); - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lua.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lua.c deleted file mode 100644 index 3a466093..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lua.c +++ /dev/null @@ -1,392 +0,0 @@ -/* -** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $ -** Lua stand-alone interpreter -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include -#include - -#define lua_c - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - -static lua_State *globalL = NULL; - -static const char *progname = LUA_PROGNAME; - - - -static void lstop (lua_State *L, lua_Debug *ar) { - (void)ar; /* unused arg. */ - lua_sethook(L, NULL, 0, 0); - luaL_error(L, "interrupted!"); -} - - -static void laction (int i) { - signal(i, SIG_DFL); /* if another SIGINT happens before lstop, - terminate process (default action) */ - lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); -} - - -static void print_usage (void) { - fprintf(stderr, - "usage: %s [options] [script [args]].\n" - "Available options are:\n" - " -e stat execute string " LUA_QL("stat") "\n" - " -l name require library " LUA_QL("name") "\n" - " -i enter interactive mode after executing " LUA_QL("script") "\n" - " -v show version information\n" - " -- stop handling options\n" - " - execute stdin and stop handling options\n" - , - progname); - fflush(stderr); -} - - -static void l_message (const char *pname, const char *msg) { - if (pname) fprintf(stderr, "%s: ", pname); - fprintf(stderr, "%s\n", msg); - fflush(stderr); -} - - -static int report (lua_State *L, int status) { - if (status && !lua_isnil(L, -1)) { - const char *msg = lua_tostring(L, -1); - if (msg == NULL) msg = "(error object is not a string)"; - l_message(progname, msg); - lua_pop(L, 1); - } - return status; -} - - -static int traceback (lua_State *L) { - if (!lua_isstring(L, 1)) /* 'message' not a string? */ - return 1; /* keep it intact */ - lua_getfield(L, LUA_GLOBALSINDEX, "debug"); - if (!lua_istable(L, -1)) { - lua_pop(L, 1); - return 1; - } - lua_getfield(L, -1, "traceback"); - if (!lua_isfunction(L, -1)) { - lua_pop(L, 2); - return 1; - } - lua_pushvalue(L, 1); /* pass error message */ - lua_pushinteger(L, 2); /* skip this function and traceback */ - lua_call(L, 2, 1); /* call debug.traceback */ - return 1; -} - - -static int docall (lua_State *L, int narg, int clear) { - int status; - int base = lua_gettop(L) - narg; /* function index */ - lua_pushcfunction(L, traceback); /* push traceback function */ - lua_insert(L, base); /* put it under chunk and args */ - signal(SIGINT, laction); - status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); - signal(SIGINT, SIG_DFL); - lua_remove(L, base); /* remove traceback function */ - /* force a complete garbage collection in case of errors */ - if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); - return status; -} - - -static void print_version (void) { - l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); -} - - -static int getargs (lua_State *L, char **argv, int n) { - int narg; - int i; - int argc = 0; - while (argv[argc]) argc++; /* count total number of arguments */ - narg = argc - (n + 1); /* number of arguments to the script */ - luaL_checkstack(L, narg + 3, "too many arguments to script"); - for (i=n+1; i < argc; i++) - lua_pushstring(L, argv[i]); - lua_createtable(L, narg, n + 1); - for (i=0; i < argc; i++) { - lua_pushstring(L, argv[i]); - lua_rawseti(L, -2, i - n); - } - return narg; -} - - -static int dofile (lua_State *L, const char *name) { - int status = luaL_loadfile(L, name) || docall(L, 0, 1); - return report(L, status); -} - - -static int dostring (lua_State *L, const char *s, const char *name) { - int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); - return report(L, status); -} - - -static int dolibrary (lua_State *L, const char *name) { - lua_getglobal(L, "require"); - lua_pushstring(L, name); - return report(L, docall(L, 1, 1)); -} - - -static const char *get_prompt (lua_State *L, int firstline) { - const char *p; - lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); - p = lua_tostring(L, -1); - if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); - lua_pop(L, 1); /* remove global */ - return p; -} - - -static int incomplete (lua_State *L, int status) { - if (status == LUA_ERRSYNTAX) { - size_t lmsg; - const char *msg = lua_tolstring(L, -1, &lmsg); - const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); - if (strstr(msg, LUA_QL("")) == tp) { - lua_pop(L, 1); - return 1; - } - } - return 0; /* else... */ -} - - -static int pushline (lua_State *L, int firstline) { - char buffer[LUA_MAXINPUT]; - char *b = buffer; - size_t l; - const char *prmt = get_prompt(L, firstline); - if (lua_readline(L, b, prmt) == 0) - return 0; /* no input */ - l = strlen(b); - if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ - b[l-1] = '\0'; /* remove it */ - if (firstline && b[0] == '=') /* first line starts with `=' ? */ - lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ - else - lua_pushstring(L, b); - lua_freeline(L, b); - return 1; -} - - -static int loadline (lua_State *L) { - int status; - lua_settop(L, 0); - if (!pushline(L, 1)) - return -1; /* no input */ - for (;;) { /* repeat until gets a complete line */ - status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); - if (!incomplete(L, status)) break; /* cannot try to add lines? */ - if (!pushline(L, 0)) /* no more input? */ - return -1; - lua_pushliteral(L, "\n"); /* add a new line... */ - lua_insert(L, -2); /* ...between the two lines */ - lua_concat(L, 3); /* join them */ - } - lua_saveline(L, 1); - lua_remove(L, 1); /* remove line */ - return status; -} - - -static void dotty (lua_State *L) { - int status; - const char *oldprogname = progname; - progname = NULL; - while ((status = loadline(L)) != -1) { - if (status == 0) status = docall(L, 0, 0); - report(L, status); - if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ - lua_getglobal(L, "print"); - lua_insert(L, 1); - if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) - l_message(progname, lua_pushfstring(L, - "error calling " LUA_QL("print") " (%s)", - lua_tostring(L, -1))); - } - } - lua_settop(L, 0); /* clear stack */ - fputs("\n", stdout); - fflush(stdout); - progname = oldprogname; -} - - -static int handle_script (lua_State *L, char **argv, int n) { - int status; - const char *fname; - int narg = getargs(L, argv, n); /* collect arguments */ - lua_setglobal(L, "arg"); - fname = argv[n]; - if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) - fname = NULL; /* stdin */ - status = luaL_loadfile(L, fname); - lua_insert(L, -(narg+1)); - if (status == 0) - status = docall(L, narg, 0); - else - lua_pop(L, narg); - return report(L, status); -} - - -/* check that argument has no extra characters at the end */ -#define notail(x) {if ((x)[2] != '\0') return -1;} - - -static int collectargs (char **argv, int *pi, int *pv, int *pe) { - int i; - for (i = 1; argv[i] != NULL; i++) { - if (argv[i][0] != '-') /* not an option? */ - return i; - switch (argv[i][1]) { /* option */ - case '-': - notail(argv[i]); - return (argv[i+1] != NULL ? i+1 : 0); - case '\0': - return i; - case 'i': - notail(argv[i]); - *pi = 1; /* go through */ - case 'v': - notail(argv[i]); - *pv = 1; - break; - case 'e': - *pe = 1; /* go through */ - case 'l': - if (argv[i][2] == '\0') { - i++; - if (argv[i] == NULL) return -1; - } - break; - default: return -1; /* invalid option */ - } - } - return 0; -} - - -static int runargs (lua_State *L, char **argv, int n) { - int i; - for (i = 1; i < n; i++) { - if (argv[i] == NULL) continue; - lua_assert(argv[i][0] == '-'); - switch (argv[i][1]) { /* option */ - case 'e': { - const char *chunk = argv[i] + 2; - if (*chunk == '\0') chunk = argv[++i]; - lua_assert(chunk != NULL); - if (dostring(L, chunk, "=(command line)") != 0) - return 1; - break; - } - case 'l': { - const char *filename = argv[i] + 2; - if (*filename == '\0') filename = argv[++i]; - lua_assert(filename != NULL); - if (dolibrary(L, filename)) - return 1; /* stop if file fails */ - break; - } - default: break; - } - } - return 0; -} - - -static int handle_luainit (lua_State *L) { - const char *init = getenv(LUA_INIT); - if (init == NULL) return 0; /* status OK */ - else if (init[0] == '@') - return dofile(L, init+1); - else - return dostring(L, init, "=" LUA_INIT); -} - - -struct Smain { - int argc; - char **argv; - int status; -}; - - -static int pmain (lua_State *L) { - struct Smain *s = (struct Smain *)lua_touserdata(L, 1); - char **argv = s->argv; - int script; - int has_i = 0, has_v = 0, has_e = 0; - globalL = L; - if (argv[0] && argv[0][0]) progname = argv[0]; - lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ - luaL_openlibs(L); /* open libraries */ - lua_gc(L, LUA_GCRESTART, 0); - s->status = handle_luainit(L); - if (s->status != 0) return 0; - script = collectargs(argv, &has_i, &has_v, &has_e); - if (script < 0) { /* invalid args? */ - print_usage(); - s->status = 1; - return 0; - } - if (has_v) print_version(); - s->status = runargs(L, argv, (script > 0) ? script : s->argc); - if (s->status != 0) return 0; - if (script) - s->status = handle_script(L, argv, script); - if (s->status != 0) return 0; - if (has_i) - dotty(L); - else if (script == 0 && !has_e && !has_v) { - if (lua_stdin_is_tty()) { - print_version(); - dotty(L); - } - else dofile(L, NULL); /* executes stdin as a file */ - } - return 0; -} - - -int main (int argc, char **argv) { - int status; - struct Smain s; - lua_State *L = lua_open(); /* create state */ - if (L == NULL) { - l_message(argv[0], "cannot create state: not enough memory"); - return EXIT_FAILURE; - } - s.argc = argc; - s.argv = argv; - status = lua_cpcall(L, &pmain, &s); - report(L, status); - lua_close(L); - return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lua.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lua.h deleted file mode 100644 index a4b73e74..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lua.h +++ /dev/null @@ -1,388 +0,0 @@ -/* -** $Id: lua.h,v 1.218.1.7 2012/01/13 20:36:20 roberto Exp $ -** Lua - An Extensible Extension Language -** Lua.org, PUC-Rio, Brazil (http://www.lua.org) -** See Copyright Notice at the end of this file -*/ - - -#ifndef lua_h -#define lua_h - -#include -#include - - -#include "luaconf.h" - - -#define LUA_VERSION "Lua 5.1" -#define LUA_RELEASE "Lua 5.1.5" -#define LUA_VERSION_NUM 501 -#define LUA_COPYRIGHT "Copyright (C) 1994-2012 Lua.org, PUC-Rio" -#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" - - -/* mark for precompiled code (`Lua') */ -#define LUA_SIGNATURE "\033Lua" - -/* option for multiple returns in `lua_pcall' and `lua_call' */ -#define LUA_MULTRET (-1) - - -/* -** pseudo-indices -*/ -#define LUA_REGISTRYINDEX (-10000) -#define LUA_ENVIRONINDEX (-10001) -#define LUA_GLOBALSINDEX (-10002) -#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) - - -/* thread status; 0 is OK */ -#define LUA_YIELD 1 -#define LUA_ERRRUN 2 -#define LUA_ERRSYNTAX 3 -#define LUA_ERRMEM 4 -#define LUA_ERRERR 5 - - -typedef struct lua_State lua_State; - -typedef int (*lua_CFunction) (lua_State *L); - - -/* -** functions that read/write blocks when loading/dumping Lua chunks -*/ -typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); - -typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); - - -/* -** prototype for memory-allocation functions -*/ -typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); - - -/* -** basic types -*/ -#define LUA_TNONE (-1) - -#define LUA_TNIL 0 -#define LUA_TBOOLEAN 1 -#define LUA_TLIGHTUSERDATA 2 -#define LUA_TNUMBER 3 -#define LUA_TSTRING 4 -#define LUA_TTABLE 5 -#define LUA_TFUNCTION 6 -#define LUA_TUSERDATA 7 -#define LUA_TTHREAD 8 - - - -/* minimum Lua stack available to a C function */ -#define LUA_MINSTACK 20 - - -/* -** generic extra include file -*/ -#if defined(LUA_USER_H) -#include LUA_USER_H -#endif - - -/* type of numbers in Lua */ -typedef LUA_NUMBER lua_Number; - - -/* type for integer functions */ -typedef LUA_INTEGER lua_Integer; - - - -/* -** state manipulation -*/ -LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); -LUA_API void (lua_close) (lua_State *L); -LUA_API lua_State *(lua_newthread) (lua_State *L); - -LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); - - -/* -** basic stack manipulation -*/ -LUA_API int (lua_gettop) (lua_State *L); -LUA_API void (lua_settop) (lua_State *L, int idx); -LUA_API void (lua_pushvalue) (lua_State *L, int idx); -LUA_API void (lua_remove) (lua_State *L, int idx); -LUA_API void (lua_insert) (lua_State *L, int idx); -LUA_API void (lua_replace) (lua_State *L, int idx); -LUA_API int (lua_checkstack) (lua_State *L, int sz); - -LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); - - -/* -** access functions (stack -> C) -*/ - -LUA_API int (lua_isnumber) (lua_State *L, int idx); -LUA_API int (lua_isstring) (lua_State *L, int idx); -LUA_API int (lua_iscfunction) (lua_State *L, int idx); -LUA_API int (lua_isuserdata) (lua_State *L, int idx); -LUA_API int (lua_type) (lua_State *L, int idx); -LUA_API const char *(lua_typename) (lua_State *L, int tp); - -LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); -LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); -LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); - -LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); -LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); -LUA_API int (lua_toboolean) (lua_State *L, int idx); -LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); -LUA_API size_t (lua_objlen) (lua_State *L, int idx); -LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); -LUA_API void *(lua_touserdata) (lua_State *L, int idx); -LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); -LUA_API const void *(lua_topointer) (lua_State *L, int idx); - - -/* -** push functions (C -> stack) -*/ -LUA_API void (lua_pushnil) (lua_State *L); -LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); -LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); -LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); -LUA_API void (lua_pushstring) (lua_State *L, const char *s); -LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, - va_list argp); -LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); -LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); -LUA_API void (lua_pushboolean) (lua_State *L, int b); -LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); -LUA_API int (lua_pushthread) (lua_State *L); - - -/* -** get functions (Lua -> stack) -*/ -LUA_API void (lua_gettable) (lua_State *L, int idx); -LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); -LUA_API void (lua_rawget) (lua_State *L, int idx); -LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); -LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); -LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); -LUA_API int (lua_getmetatable) (lua_State *L, int objindex); -LUA_API void (lua_getfenv) (lua_State *L, int idx); - - -/* -** set functions (stack -> Lua) -*/ -LUA_API void (lua_settable) (lua_State *L, int idx); -LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); -LUA_API void (lua_rawset) (lua_State *L, int idx); -LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); -LUA_API int (lua_setmetatable) (lua_State *L, int objindex); -LUA_API int (lua_setfenv) (lua_State *L, int idx); - - -/* -** `load' and `call' functions (load and run Lua code) -*/ -LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); -LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); -LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); -LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, - const char *chunkname); - -LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); - - -/* -** coroutine functions -*/ -LUA_API int (lua_yield) (lua_State *L, int nresults); -LUA_API int (lua_resume) (lua_State *L, int narg); -LUA_API int (lua_status) (lua_State *L); - -/* -** garbage-collection function and options -*/ - -#define LUA_GCSTOP 0 -#define LUA_GCRESTART 1 -#define LUA_GCCOLLECT 2 -#define LUA_GCCOUNT 3 -#define LUA_GCCOUNTB 4 -#define LUA_GCSTEP 5 -#define LUA_GCSETPAUSE 6 -#define LUA_GCSETSTEPMUL 7 - -LUA_API int (lua_gc) (lua_State *L, int what, int data); - - -/* -** miscellaneous functions -*/ - -LUA_API int (lua_error) (lua_State *L); - -LUA_API int (lua_next) (lua_State *L, int idx); - -LUA_API void (lua_concat) (lua_State *L, int n); - -LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); -LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); - - - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - -#define lua_pop(L,n) lua_settop(L, -(n)-1) - -#define lua_newtable(L) lua_createtable(L, 0, 0) - -#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) - -#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) - -#define lua_strlen(L,i) lua_objlen(L, (i)) - -#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) -#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) -#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) -#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) -#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) -#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) -#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) -#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) - -#define lua_pushliteral(L, s) \ - lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) - -#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) -#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) - -#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) - - - -/* -** compatibility macros and functions -*/ - -#define lua_open() luaL_newstate() - -#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) - -#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) - -#define lua_Chunkreader lua_Reader -#define lua_Chunkwriter lua_Writer - - -/* hack */ -LUA_API void lua_setlevel (lua_State *from, lua_State *to); - - -/* -** {====================================================================== -** Debug API -** ======================================================================= -*/ - - -/* -** Event codes -*/ -#define LUA_HOOKCALL 0 -#define LUA_HOOKRET 1 -#define LUA_HOOKLINE 2 -#define LUA_HOOKCOUNT 3 -#define LUA_HOOKTAILRET 4 - - -/* -** Event masks -*/ -#define LUA_MASKCALL (1 << LUA_HOOKCALL) -#define LUA_MASKRET (1 << LUA_HOOKRET) -#define LUA_MASKLINE (1 << LUA_HOOKLINE) -#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) - -typedef struct lua_Debug lua_Debug; /* activation record */ - - -/* Functions to be called by the debuger in specific events */ -typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); - - -LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); -LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); -LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); - -LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); -LUA_API lua_Hook lua_gethook (lua_State *L); -LUA_API int lua_gethookmask (lua_State *L); -LUA_API int lua_gethookcount (lua_State *L); - - -struct lua_Debug { - int event; - const char *name; /* (n) */ - const char *namewhat; /* (n) `global', `local', `field', `method' */ - const char *what; /* (S) `Lua', `C', `main', `tail' */ - const char *source; /* (S) */ - int currentline; /* (l) */ - int nups; /* (u) number of upvalues */ - int linedefined; /* (S) */ - int lastlinedefined; /* (S) */ - char short_src[LUA_IDSIZE]; /* (S) */ - /* private part */ - int i_ci; /* active function */ -}; - -/* }====================================================================== */ - - -/****************************************************************************** -* Copyright (C) 1994-2012 Lua.org, PUC-Rio. 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. -******************************************************************************/ - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/luac.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/luac.c deleted file mode 100644 index d0701739..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/luac.c +++ /dev/null @@ -1,200 +0,0 @@ -/* -** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $ -** Lua compiler (saves bytecodes to files; also list bytecodes) -** See Copyright Notice in lua.h -*/ - -#include -#include -#include -#include - -#define luac_c -#define LUA_CORE - -#include "lua.h" -#include "lauxlib.h" - -#include "ldo.h" -#include "lfunc.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstring.h" -#include "lundump.h" - -#define PROGNAME "luac" /* default program name */ -#define OUTPUT PROGNAME ".out" /* default output file */ - -static int listing=0; /* list bytecodes? */ -static int dumping=1; /* dump bytecodes? */ -static int stripping=0; /* strip debug information? */ -static char Output[]={ OUTPUT }; /* default output file name */ -static const char* output=Output; /* actual output file name */ -static const char* progname=PROGNAME; /* actual program name */ - -static void fatal(const char* message) -{ - fprintf(stderr,"%s: %s\n",progname,message); - exit(EXIT_FAILURE); -} - -static void cannot(const char* what) -{ - fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); - exit(EXIT_FAILURE); -} - -static void usage(const char* message) -{ - if (*message=='-') - fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); - else - fprintf(stderr,"%s: %s\n",progname,message); - fprintf(stderr, - "usage: %s [options] [filenames].\n" - "Available options are:\n" - " - process stdin\n" - " -l list\n" - " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" - " -p parse only\n" - " -s strip debug information\n" - " -v show version information\n" - " -- stop handling options\n", - progname,Output); - exit(EXIT_FAILURE); -} - -#define IS(s) (strcmp(argv[i],s)==0) - -static int doargs(int argc, char* argv[]) -{ - int i; - int version=0; - if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; - for (i=1; itop+(i))->l.p) - -static const Proto* combine(lua_State* L, int n) -{ - if (n==1) - return toproto(L,-1); - else - { - int i,pc; - Proto* f=luaF_newproto(L); - setptvalue2s(L,L->top,f); incr_top(L); - f->source=luaS_newliteral(L,"=(" PROGNAME ")"); - f->maxstacksize=1; - pc=2*n+1; - f->code=luaM_newvector(L,pc,Instruction); - f->sizecode=pc; - f->p=luaM_newvector(L,n,Proto*); - f->sizep=n; - pc=0; - for (i=0; ip[i]=toproto(L,i-n-1); - f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i); - f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1); - } - f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0); - return f; - } -} - -static int writer(lua_State* L, const void* p, size_t size, void* u) -{ - UNUSED(L); - return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); -} - -struct Smain { - int argc; - char** argv; -}; - -static int pmain(lua_State* L) -{ - struct Smain* s = (struct Smain*)lua_touserdata(L, 1); - int argc=s->argc; - char** argv=s->argv; - const Proto* f; - int i; - if (!lua_checkstack(L,argc)) fatal("too many input files"); - for (i=0; i1); - if (dumping) - { - FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); - if (D==NULL) cannot("open"); - lua_lock(L); - luaU_dump(L,f,writer,D,stripping); - lua_unlock(L); - if (ferror(D)) cannot("write"); - if (fclose(D)) cannot("close"); - } - return 0; -} - -int main(int argc, char* argv[]) -{ - lua_State* L; - struct Smain s; - int i=doargs(argc,argv); - argc-=i; argv+=i; - if (argc<=0) usage("no input files given"); - L=lua_open(); - if (L==NULL) fatal("not enough memory for state"); - s.argc=argc; - s.argv=argv; - if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1)); - lua_close(L); - return EXIT_SUCCESS; -} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/luaconf.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/luaconf.h deleted file mode 100644 index e2cb2616..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/luaconf.h +++ /dev/null @@ -1,763 +0,0 @@ -/* -** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ -** Configuration file for Lua -** See Copyright Notice in lua.h -*/ - - -#ifndef lconfig_h -#define lconfig_h - -#include -#include - - -/* -** ================================================================== -** Search for "@@" to find all configurable definitions. -** =================================================================== -*/ - - -/* -@@ LUA_ANSI controls the use of non-ansi features. -** CHANGE it (define it) if you want Lua to avoid the use of any -** non-ansi feature or library. -*/ -#if defined(__STRICT_ANSI__) -#define LUA_ANSI -#endif - - -#if !defined(LUA_ANSI) && defined(_WIN32) -#define LUA_WIN -#endif - -#if defined(LUA_USE_LINUX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ -#define LUA_USE_READLINE /* needs some extra libraries */ -#endif - -#if defined(LUA_USE_MACOSX) -#define LUA_USE_POSIX -#define LUA_DL_DYLD /* does not need extra library */ -#endif - - - -/* -@@ LUA_USE_POSIX includes all functionallity listed as X/Open System -@* Interfaces Extension (XSI). -** CHANGE it (define it) if your system is XSI compatible. -*/ -#if defined(LUA_USE_POSIX) -#define LUA_USE_MKSTEMP -#define LUA_USE_ISATTY -#define LUA_USE_POPEN -#define LUA_USE_ULONGJMP -#endif - - -/* -@@ LUA_PATH and LUA_CPATH are the names of the environment variables that -@* Lua check to set its paths. -@@ LUA_INIT is the name of the environment variable that Lua -@* checks for initialization code. -** CHANGE them if you want different names. -*/ -#define LUA_PATH "LUA_PATH" -#define LUA_CPATH "LUA_CPATH" -#define LUA_INIT "LUA_INIT" - - -/* -@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for -@* Lua libraries. -@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for -@* C libraries. -** CHANGE them if your machine has a non-conventional directory -** hierarchy or if you want to install your libraries in -** non-conventional directories. -*/ -#if defined(_WIN32) -/* -** In Windows, any exclamation mark ('!') in the path is replaced by the -** path of the directory of the executable file of the current process. -*/ -#define LUA_LDIR "!\\lua\\" -#define LUA_CDIR "!\\" -#define LUA_PATH_DEFAULT \ - ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" -#define LUA_CPATH_DEFAULT \ - ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" - -#else -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/5.1/" -#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" -#define LUA_PATH_DEFAULT \ - "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" -#define LUA_CPATH_DEFAULT \ - "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" -#endif - - -/* -@@ LUA_DIRSEP is the directory separator (for submodules). -** CHANGE it if your machine does not use "/" as the directory separator -** and is not Windows. (On Windows Lua automatically uses "\".) -*/ -#if defined(_WIN32) -#define LUA_DIRSEP "\\" -#else -#define LUA_DIRSEP "/" -#endif - - -/* -@@ LUA_PATHSEP is the character that separates templates in a path. -@@ LUA_PATH_MARK is the string that marks the substitution points in a -@* template. -@@ LUA_EXECDIR in a Windows path is replaced by the executable's -@* directory. -@@ LUA_IGMARK is a mark to ignore all before it when bulding the -@* luaopen_ function name. -** CHANGE them if for some reason your system cannot use those -** characters. (E.g., if one of those characters is a common character -** in file/directory names.) Probably you do not need to change them. -*/ -#define LUA_PATHSEP ";" -#define LUA_PATH_MARK "?" -#define LUA_EXECDIR "!" -#define LUA_IGMARK "-" - - -/* -@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. -** CHANGE that if ptrdiff_t is not adequate on your machine. (On most -** machines, ptrdiff_t gives a good choice between int or long.) -*/ -#define LUA_INTEGER ptrdiff_t - - -/* -@@ LUA_API is a mark for all core API functions. -@@ LUALIB_API is a mark for all standard library functions. -** CHANGE them if you need to define those functions in some special way. -** For instance, if you want to create one Windows DLL with the core and -** the libraries, you may want to use the following definition (define -** LUA_BUILD_AS_DLL to get it). -*/ -#if defined(LUA_BUILD_AS_DLL) - -#if defined(LUA_CORE) || defined(LUA_LIB) -#define LUA_API __declspec(dllexport) -#else -#define LUA_API __declspec(dllimport) -#endif - -#else - -#define LUA_API extern - -#endif - -/* more often than not the libs go together with the core */ -#define LUALIB_API LUA_API - - -/* -@@ LUAI_FUNC is a mark for all extern functions that are not to be -@* exported to outside modules. -@@ LUAI_DATA is a mark for all extern (const) variables that are not to -@* be exported to outside modules. -** CHANGE them if you need to mark them in some special way. Elf/gcc -** (versions 3.2 and later) mark them as "hidden" to optimize access -** when Lua is compiled as a shared library. -*/ -#if defined(luaall_c) -#define LUAI_FUNC static -#define LUAI_DATA /* empty */ - -#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) -#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -#define LUAI_DATA LUAI_FUNC - -#else -#define LUAI_FUNC extern -#define LUAI_DATA extern -#endif - - - -/* -@@ LUA_QL describes how error messages quote program elements. -** CHANGE it if you want a different appearance. -*/ -#define LUA_QL(x) "'" x "'" -#define LUA_QS LUA_QL("%s") - - -/* -@@ LUA_IDSIZE gives the maximum size for the description of the source -@* of a function in debug information. -** CHANGE it if you want a different size. -*/ -#define LUA_IDSIZE 60 - - -/* -** {================================================================== -** Stand-alone configuration -** =================================================================== -*/ - -#if defined(lua_c) || defined(luaall_c) - -/* -@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that -@* is, whether we're running lua interactively). -** CHANGE it if you have a better definition for non-POSIX/non-Windows -** systems. -*/ -#if defined(LUA_USE_ISATTY) -#include -#define lua_stdin_is_tty() isatty(0) -#elif defined(LUA_WIN) -#include -#include -#define lua_stdin_is_tty() _isatty(_fileno(stdin)) -#else -#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ -#endif - - -/* -@@ LUA_PROMPT is the default prompt used by stand-alone Lua. -@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. -** CHANGE them if you want different prompts. (You can also change the -** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) -*/ -#define LUA_PROMPT "> " -#define LUA_PROMPT2 ">> " - - -/* -@@ LUA_PROGNAME is the default name for the stand-alone Lua program. -** CHANGE it if your stand-alone interpreter has a different name and -** your system is not able to detect that name automatically. -*/ -#define LUA_PROGNAME "lua" - - -/* -@@ LUA_MAXINPUT is the maximum length for an input line in the -@* stand-alone interpreter. -** CHANGE it if you need longer lines. -*/ -#define LUA_MAXINPUT 512 - - -/* -@@ lua_readline defines how to show a prompt and then read a line from -@* the standard input. -@@ lua_saveline defines how to "save" a read line in a "history". -@@ lua_freeline defines how to free a line read by lua_readline. -** CHANGE them if you want to improve this functionality (e.g., by using -** GNU readline and history facilities). -*/ -#if defined(LUA_USE_READLINE) -#include -#include -#include -#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) -#define lua_saveline(L,idx) \ - if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ - add_history(lua_tostring(L, idx)); /* add it to history */ -#define lua_freeline(L,b) ((void)L, free(b)) -#else -#define lua_readline(L,b,p) \ - ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ - fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ -#define lua_saveline(L,idx) { (void)L; (void)idx; } -#define lua_freeline(L,b) { (void)L; (void)b; } -#endif - -#endif - -/* }================================================================== */ - - -/* -@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles -@* as a percentage. -** CHANGE it if you want the GC to run faster or slower (higher values -** mean larger pauses which mean slower collection.) You can also change -** this value dynamically. -*/ -#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ - - -/* -@@ LUAI_GCMUL defines the default speed of garbage collection relative to -@* memory allocation as a percentage. -** CHANGE it if you want to change the granularity of the garbage -** collection. (Higher values mean coarser collections. 0 represents -** infinity, where each step performs a full collection.) You can also -** change this value dynamically. -*/ -#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ - - - -/* -@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. -** CHANGE it (define it) if you want exact compatibility with the -** behavior of setn/getn in Lua 5.0. -*/ -#undef LUA_COMPAT_GETN - -/* -@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. -** CHANGE it to undefined as soon as you do not need a global 'loadlib' -** function (the function is still available as 'package.loadlib'). -*/ -#undef LUA_COMPAT_LOADLIB - -/* -@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. -** CHANGE it to undefined as soon as your programs use only '...' to -** access vararg parameters (instead of the old 'arg' table). -*/ -#define LUA_COMPAT_VARARG - -/* -@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. -** CHANGE it to undefined as soon as your programs use 'math.fmod' or -** the new '%' operator instead of 'math.mod'. -*/ -#define LUA_COMPAT_MOD - -/* -@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting -@* facility. -** CHANGE it to 2 if you want the old behaviour, or undefine it to turn -** off the advisory error when nesting [[...]]. -*/ -#define LUA_COMPAT_LSTR 1 - -/* -@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. -** CHANGE it to undefined as soon as you rename 'string.gfind' to -** 'string.gmatch'. -*/ -#define LUA_COMPAT_GFIND - -/* -@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' -@* behavior. -** CHANGE it to undefined as soon as you replace to 'luaL_register' -** your uses of 'luaL_openlib' -*/ -#define LUA_COMPAT_OPENLIB - - - -/* -@@ luai_apicheck is the assert macro used by the Lua-C API. -** CHANGE luai_apicheck if you want Lua to perform some checks in the -** parameters it gets from API calls. This may slow down the interpreter -** a bit, but may be quite useful when debugging C code that interfaces -** with Lua. A useful redefinition is to use assert.h. -*/ -#if defined(LUA_USE_APICHECK) -#include -#define luai_apicheck(L,o) { (void)L; assert(o); } -#else -#define luai_apicheck(L,o) { (void)L; } -#endif - - -/* -@@ LUAI_BITSINT defines the number of bits in an int. -** CHANGE here if Lua cannot automatically detect the number of bits of -** your machine. Probably you do not need to change this. -*/ -/* avoid overflows in comparison */ -#if INT_MAX-20 < 32760 -#define LUAI_BITSINT 16 -#elif INT_MAX > 2147483640L -/* int has at least 32 bits */ -#define LUAI_BITSINT 32 -#else -#error "you must define LUA_BITSINT with number of bits in an integer" -#endif - - -/* -@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. -@@ LUAI_INT32 is an signed integer with at least 32 bits. -@@ LUAI_UMEM is an unsigned integer big enough to count the total -@* memory used by Lua. -@@ LUAI_MEM is a signed integer big enough to count the total memory -@* used by Lua. -** CHANGE here if for some weird reason the default definitions are not -** good enough for your machine. (The definitions in the 'else' -** part always works, but may waste space on machines with 64-bit -** longs.) Probably you do not need to change this. -*/ -#if LUAI_BITSINT >= 32 -#define LUAI_UINT32 unsigned int -#define LUAI_INT32 int -#define LUAI_MAXINT32 INT_MAX -#define LUAI_UMEM size_t -#define LUAI_MEM ptrdiff_t -#else -/* 16-bit ints */ -#define LUAI_UINT32 unsigned long -#define LUAI_INT32 long -#define LUAI_MAXINT32 LONG_MAX -#define LUAI_UMEM unsigned long -#define LUAI_MEM long -#endif - - -/* -@@ LUAI_MAXCALLS limits the number of nested calls. -** CHANGE it if you need really deep recursive calls. This limit is -** arbitrary; its only purpose is to stop infinite recursion before -** exhausting memory. -*/ -#define LUAI_MAXCALLS 20000 - - -/* -@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function -@* can use. -** CHANGE it if you need lots of (Lua) stack space for your C -** functions. This limit is arbitrary; its only purpose is to stop C -** functions to consume unlimited stack space. (must be smaller than -** -LUA_REGISTRYINDEX) -*/ -#define LUAI_MAXCSTACK 8000 - - - -/* -** {================================================================== -** CHANGE (to smaller values) the following definitions if your system -** has a small C stack. (Or you may want to change them to larger -** values if your system has a large C stack and these limits are -** too rigid for you.) Some of these constants control the size of -** stack-allocated arrays used by the compiler or the interpreter, while -** others limit the maximum number of recursive calls that the compiler -** or the interpreter can perform. Values too large may cause a C stack -** overflow for some forms of deep constructs. -** =================================================================== -*/ - - -/* -@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and -@* syntactical nested non-terminals in a program. -*/ -#define LUAI_MAXCCALLS 200 - - -/* -@@ LUAI_MAXVARS is the maximum number of local variables per function -@* (must be smaller than 250). -*/ -#define LUAI_MAXVARS 200 - - -/* -@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function -@* (must be smaller than 250). -*/ -#define LUAI_MAXUPVALUES 60 - - -/* -@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. -*/ -#define LUAL_BUFFERSIZE BUFSIZ - -/* }================================================================== */ - - - - -/* -** {================================================================== -@@ LUA_NUMBER is the type of numbers in Lua. -** CHANGE the following definitions only if you want to build Lua -** with a number type different from double. You may also need to -** change lua_number2int & lua_number2integer. -** =================================================================== -*/ - -#define LUA_NUMBER_DOUBLE -#define LUA_NUMBER double - -/* -@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' -@* over a number. -*/ -#define LUAI_UACNUMBER double - - -/* -@@ LUA_NUMBER_SCAN is the format for reading numbers. -@@ LUA_NUMBER_FMT is the format for writing numbers. -@@ lua_number2str converts a number to a string. -@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. -@@ lua_str2number converts a string to a number. -*/ -#define LUA_NUMBER_SCAN "%lf" -#define LUA_NUMBER_FMT "%.14g" -#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) -#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ -#define lua_str2number(s,p) strtod((s), (p)) - - -/* -@@ The luai_num* macros define the primitive operations over numbers. -*/ -#if defined(LUA_CORE) -#include -#define luai_numadd(a,b) ((a)+(b)) -#define luai_numsub(a,b) ((a)-(b)) -#define luai_nummul(a,b) ((a)*(b)) -#define luai_numdiv(a,b) ((a)/(b)) -#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) -#define luai_numpow(a,b) (pow(a,b)) -#define luai_numunm(a) (-(a)) -#define luai_numeq(a,b) ((a)==(b)) -#define luai_numlt(a,b) ((a)<(b)) -#define luai_numle(a,b) ((a)<=(b)) -#define luai_numisnan(a) (!luai_numeq((a), (a))) -#endif - - -/* -@@ lua_number2int is a macro to convert lua_Number to int. -@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. -** CHANGE them if you know a faster way to convert a lua_Number to -** int (with any rounding method and without throwing errors) in your -** system. In Pentium machines, a naive typecast from double to int -** in C is extremely slow, so any alternative is worth trying. -*/ - -/* On a Pentium, resort to a trick */ -#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ - (defined(__i386) || defined (_M_IX86) || defined(__i386__)) - -/* On a Microsoft compiler, use assembler */ -#if defined(_MSC_VER) - -#define lua_number2int(i,d) __asm fld d __asm fistp i -#define lua_number2integer(i,n) lua_number2int(i, n) - -/* the next trick should work on any Pentium, but sometimes clashes - with a DirectX idiosyncrasy */ -#else - -union luai_Cast { double l_d; long l_l; }; -#define lua_number2int(i,d) \ - { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } -#define lua_number2integer(i,n) lua_number2int(i, n) - -#endif - - -/* this option always works, but may be slow */ -#else -#define lua_number2int(i,d) ((i)=(int)(d)) -#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) - -#endif - -/* }================================================================== */ - - -/* -@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. -** CHANGE it if your system requires alignments larger than double. (For -** instance, if your system supports long doubles and they must be -** aligned in 16-byte boundaries, then you should add long double in the -** union.) Probably you do not need to change this. -*/ -#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } - - -/* -@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. -** CHANGE them if you prefer to use longjmp/setjmp even with C++ -** or if want/don't to use _longjmp/_setjmp instead of regular -** longjmp/setjmp. By default, Lua handles errors with exceptions when -** compiling as C++ code, with _longjmp/_setjmp when asked to use them, -** and with longjmp/setjmp otherwise. -*/ -#if defined(__cplusplus) -/* C++ exceptions */ -#define LUAI_THROW(L,c) throw(c) -#define LUAI_TRY(L,c,a) try { a } catch(...) \ - { if ((c)->status == 0) (c)->status = -1; } -#define luai_jmpbuf int /* dummy variable */ - -#elif defined(LUA_USE_ULONGJMP) -/* in Unix, try _longjmp/_setjmp (more efficient) */ -#define LUAI_THROW(L,c) _longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#else -/* default handling with long jumps */ -#define LUAI_THROW(L,c) longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#endif - - -/* -@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern -@* can do during pattern-matching. -** CHANGE it if you need more captures. This limit is arbitrary. -*/ -#define LUA_MAXCAPTURES 32 - - -/* -@@ lua_tmpnam is the function that the OS library uses to create a -@* temporary name. -@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. -** CHANGE them if you have an alternative to tmpnam (which is considered -** insecure) or if you want the original tmpnam anyway. By default, Lua -** uses tmpnam except when POSIX is available, where it uses mkstemp. -*/ -#if defined(loslib_c) || defined(luaall_c) - -#if defined(LUA_USE_MKSTEMP) -#include -#define LUA_TMPNAMBUFSIZE 32 -#define lua_tmpnam(b,e) { \ - strcpy(b, "/tmp/lua_XXXXXX"); \ - e = mkstemp(b); \ - if (e != -1) close(e); \ - e = (e == -1); } - -#else -#define LUA_TMPNAMBUFSIZE L_tmpnam -#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } -#endif - -#endif - - -/* -@@ lua_popen spawns a new process connected to the current one through -@* the file streams. -** CHANGE it if you have a way to implement it in your system. -*/ -#if defined(LUA_USE_POPEN) - -#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) -#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) - -#elif defined(LUA_WIN) - -#define lua_popen(L,c,m) ((void)L, _popen(c,m)) -#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) - -#else - -#define lua_popen(L,c,m) ((void)((void)c, m), \ - luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) -#define lua_pclose(L,file) ((void)((void)L, file), 0) - -#endif - -/* -@@ LUA_DL_* define which dynamic-library system Lua should use. -** CHANGE here if Lua has problems choosing the appropriate -** dynamic-library system for your platform (either Windows' DLL, Mac's -** dyld, or Unix's dlopen). If your system is some kind of Unix, there -** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for -** it. To use dlopen you also need to adapt the src/Makefile (probably -** adding -ldl to the linker options), so Lua does not select it -** automatically. (When you change the makefile to add -ldl, you must -** also add -DLUA_USE_DLOPEN.) -** If you do not want any kind of dynamic library, undefine all these -** options. -** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. -*/ -#if defined(LUA_USE_DLOPEN) -#define LUA_DL_DLOPEN -#endif - -#if defined(LUA_WIN) -#define LUA_DL_DLL -#endif - - -/* -@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State -@* (the data goes just *before* the lua_State pointer). -** CHANGE (define) this if you really need that. This value must be -** a multiple of the maximum alignment required for your machine. -*/ -#define LUAI_EXTRASPACE 0 - - -/* -@@ luai_userstate* allow user-specific actions on threads. -** CHANGE them if you defined LUAI_EXTRASPACE and need to do something -** extra when a thread is created/deleted/resumed/yielded. -*/ -#define luai_userstateopen(L) ((void)L) -#define luai_userstateclose(L) ((void)L) -#define luai_userstatethread(L,L1) ((void)L) -#define luai_userstatefree(L) ((void)L) -#define luai_userstateresume(L,n) ((void)L) -#define luai_userstateyield(L,n) ((void)L) - - -/* -@@ LUA_INTFRMLEN is the length modifier for integer conversions -@* in 'string.format'. -@@ LUA_INTFRM_T is the integer type correspoding to the previous length -@* modifier. -** CHANGE them if your system supports long long or does not support long. -*/ - -#if defined(LUA_USELONGLONG) - -#define LUA_INTFRMLEN "ll" -#define LUA_INTFRM_T long long - -#else - -#define LUA_INTFRMLEN "l" -#define LUA_INTFRM_T long - -#endif - - - -/* =================================================================== */ - -/* -** Local configuration. You can use this space to add your redefinitions -** without modifying the main part of the file. -*/ - - - -#endif - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lualib.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lualib.h deleted file mode 100644 index 469417f6..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lualib.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ -** Lua standard libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lualib_h -#define lualib_h - -#include "lua.h" - - -/* Key to file-handle type */ -#define LUA_FILEHANDLE "FILE*" - - -#define LUA_COLIBNAME "coroutine" -LUALIB_API int (luaopen_base) (lua_State *L); - -#define LUA_TABLIBNAME "table" -LUALIB_API int (luaopen_table) (lua_State *L); - -#define LUA_IOLIBNAME "io" -LUALIB_API int (luaopen_io) (lua_State *L); - -#define LUA_OSLIBNAME "os" -LUALIB_API int (luaopen_os) (lua_State *L); - -#define LUA_STRLIBNAME "string" -LUALIB_API int (luaopen_string) (lua_State *L); - -#define LUA_MATHLIBNAME "math" -LUALIB_API int (luaopen_math) (lua_State *L); - -#define LUA_DBLIBNAME "debug" -LUALIB_API int (luaopen_debug) (lua_State *L); - -#define LUA_LOADLIBNAME "package" -LUALIB_API int (luaopen_package) (lua_State *L); - - -/* open all previous libraries */ -LUALIB_API void (luaL_openlibs) (lua_State *L); - - - -#ifndef lua_assert -#define lua_assert(x) ((void)0) -#endif - - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lundump.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lundump.c deleted file mode 100644 index 8010a457..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lundump.c +++ /dev/null @@ -1,227 +0,0 @@ -/* -** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#include - -#define lundump_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstring.h" -#include "lundump.h" -#include "lzio.h" - -typedef struct { - lua_State* L; - ZIO* Z; - Mbuffer* b; - const char* name; -} LoadState; - -#ifdef LUAC_TRUST_BINARIES -#define IF(c,s) -#define error(S,s) -#else -#define IF(c,s) if (c) error(S,s) - -static void error(LoadState* S, const char* why) -{ - luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); - luaD_throw(S->L,LUA_ERRSYNTAX); -} -#endif - -#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) -#define LoadByte(S) (lu_byte)LoadChar(S) -#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) -#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) - -static void LoadBlock(LoadState* S, void* b, size_t size) -{ - size_t r=luaZ_read(S->Z,b,size); - IF (r!=0, "unexpected end"); -} - -static int LoadChar(LoadState* S) -{ - char x; - LoadVar(S,x); - return x; -} - -static int LoadInt(LoadState* S) -{ - int x; - LoadVar(S,x); - IF (x<0, "bad integer"); - return x; -} - -static lua_Number LoadNumber(LoadState* S) -{ - lua_Number x; - LoadVar(S,x); - return x; -} - -static TString* LoadString(LoadState* S) -{ - size_t size; - LoadVar(S,size); - if (size==0) - return NULL; - else - { - char* s=luaZ_openspace(S->L,S->b,size); - LoadBlock(S,s,size); - return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ - } -} - -static void LoadCode(LoadState* S, Proto* f) -{ - int n=LoadInt(S); - f->code=luaM_newvector(S->L,n,Instruction); - f->sizecode=n; - LoadVector(S,f->code,n,sizeof(Instruction)); -} - -static Proto* LoadFunction(LoadState* S, TString* p); - -static void LoadConstants(LoadState* S, Proto* f) -{ - int i,n; - n=LoadInt(S); - f->k=luaM_newvector(S->L,n,TValue); - f->sizek=n; - for (i=0; ik[i]); - for (i=0; ik[i]; - int t=LoadChar(S); - switch (t) - { - case LUA_TNIL: - setnilvalue(o); - break; - case LUA_TBOOLEAN: - setbvalue(o,LoadChar(S)!=0); - break; - case LUA_TNUMBER: - setnvalue(o,LoadNumber(S)); - break; - case LUA_TSTRING: - setsvalue2n(S->L,o,LoadString(S)); - break; - default: - error(S,"bad constant"); - break; - } - } - n=LoadInt(S); - f->p=luaM_newvector(S->L,n,Proto*); - f->sizep=n; - for (i=0; ip[i]=NULL; - for (i=0; ip[i]=LoadFunction(S,f->source); -} - -static void LoadDebug(LoadState* S, Proto* f) -{ - int i,n; - n=LoadInt(S); - f->lineinfo=luaM_newvector(S->L,n,int); - f->sizelineinfo=n; - LoadVector(S,f->lineinfo,n,sizeof(int)); - n=LoadInt(S); - f->locvars=luaM_newvector(S->L,n,LocVar); - f->sizelocvars=n; - for (i=0; ilocvars[i].varname=NULL; - for (i=0; ilocvars[i].varname=LoadString(S); - f->locvars[i].startpc=LoadInt(S); - f->locvars[i].endpc=LoadInt(S); - } - n=LoadInt(S); - f->upvalues=luaM_newvector(S->L,n,TString*); - f->sizeupvalues=n; - for (i=0; iupvalues[i]=NULL; - for (i=0; iupvalues[i]=LoadString(S); -} - -static Proto* LoadFunction(LoadState* S, TString* p) -{ - Proto* f; - if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); - f=luaF_newproto(S->L); - setptvalue2s(S->L,S->L->top,f); incr_top(S->L); - f->source=LoadString(S); if (f->source==NULL) f->source=p; - f->linedefined=LoadInt(S); - f->lastlinedefined=LoadInt(S); - f->nups=LoadByte(S); - f->numparams=LoadByte(S); - f->is_vararg=LoadByte(S); - f->maxstacksize=LoadByte(S); - LoadCode(S,f); - LoadConstants(S,f); - LoadDebug(S,f); - IF (!luaG_checkcode(f), "bad code"); - S->L->top--; - S->L->nCcalls--; - return f; -} - -static void LoadHeader(LoadState* S) -{ - char h[LUAC_HEADERSIZE]; - char s[LUAC_HEADERSIZE]; - luaU_header(h); - LoadBlock(S,s,LUAC_HEADERSIZE); - IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); -} - -/* -** load precompiled chunk -*/ -Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) -{ - LoadState S; - if (*name=='@' || *name=='=') - S.name=name+1; - else if (*name==LUA_SIGNATURE[0]) - S.name="binary string"; - else - S.name=name; - S.L=L; - S.Z=Z; - S.b=buff; - LoadHeader(&S); - return LoadFunction(&S,luaS_newliteral(L,"=?")); -} - -/* -* make header -*/ -void luaU_header (char* h) -{ - int x=1; - memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); - h+=sizeof(LUA_SIGNATURE)-1; - *h++=(char)LUAC_VERSION; - *h++=(char)LUAC_FORMAT; - *h++=(char)*(char*)&x; /* endianness */ - *h++=(char)sizeof(int); - *h++=(char)sizeof(size_t); - *h++=(char)sizeof(Instruction); - *h++=(char)sizeof(lua_Number); - *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ -} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lundump.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lundump.h deleted file mode 100644 index c80189db..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lundump.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#ifndef lundump_h -#define lundump_h - -#include "lobject.h" -#include "lzio.h" - -/* load one chunk; from lundump.c */ -LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); - -/* make header; from lundump.c */ -LUAI_FUNC void luaU_header (char* h); - -/* dump one chunk; from ldump.c */ -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); - -#ifdef luac_c -/* print one chunk; from print.c */ -LUAI_FUNC void luaU_print (const Proto* f, int full); -#endif - -/* for header of binary files -- this is Lua 5.1 */ -#define LUAC_VERSION 0x51 - -/* for header of binary files -- this is the official format */ -#define LUAC_FORMAT 0 - -/* size of header of binary files */ -#define LUAC_HEADERSIZE 12 - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lvm.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lvm.c deleted file mode 100644 index e0a0cd85..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lvm.c +++ /dev/null @@ -1,767 +0,0 @@ -/* -** $Id: lvm.c,v 2.63.1.5 2011/08/17 20:43:11 roberto Exp $ -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - - -#include -#include -#include - -#define lvm_c -#define LUA_CORE - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - - -/* limit for table tag-method chains (to avoid loops) */ -#define MAXTAGLOOP 100 - - -const TValue *luaV_tonumber (const TValue *obj, TValue *n) { - lua_Number num; - if (ttisnumber(obj)) return obj; - if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { - setnvalue(n, num); - return n; - } - else - return NULL; -} - - -int luaV_tostring (lua_State *L, StkId obj) { - if (!ttisnumber(obj)) - return 0; - else { - char s[LUAI_MAXNUMBER2STR]; - lua_Number n = nvalue(obj); - lua_number2str(s, n); - setsvalue2s(L, obj, luaS_new(L, s)); - return 1; - } -} - - -static void traceexec (lua_State *L, const Instruction *pc) { - lu_byte mask = L->hookmask; - const Instruction *oldpc = L->savedpc; - L->savedpc = pc; - if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { - resethookcount(L); - luaD_callhook(L, LUA_HOOKCOUNT, -1); - } - if (mask & LUA_MASKLINE) { - Proto *p = ci_func(L->ci)->l.p; - int npc = pcRel(pc, p); - int newline = getline(p, npc); - /* call linehook when enter a new function, when jump back (loop), - or when enter a new line */ - if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) - luaD_callhook(L, LUA_HOOKLINE, newline); - } -} - - -static void callTMres (lua_State *L, StkId res, const TValue *f, - const TValue *p1, const TValue *p2) { - ptrdiff_t result = savestack(L, res); - setobj2s(L, L->top, f); /* push function */ - setobj2s(L, L->top+1, p1); /* 1st argument */ - setobj2s(L, L->top+2, p2); /* 2nd argument */ - luaD_checkstack(L, 3); - L->top += 3; - luaD_call(L, L->top - 3, 1); - res = restorestack(L, result); - L->top--; - setobjs2s(L, res, L->top); -} - - - -static void callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, const TValue *p3) { - setobj2s(L, L->top, f); /* push function */ - setobj2s(L, L->top+1, p1); /* 1st argument */ - setobj2s(L, L->top+2, p2); /* 2nd argument */ - setobj2s(L, L->top+3, p3); /* 3th argument */ - luaD_checkstack(L, 4); - L->top += 4; - luaD_call(L, L->top - 4, 0); -} - - -void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { - int loop; - for (loop = 0; loop < MAXTAGLOOP; loop++) { - const TValue *tm; - if (ttistable(t)) { /* `t' is a table? */ - Table *h = hvalue(t); - const TValue *res = luaH_get(h, key); /* do a primitive get */ - if (!ttisnil(res) || /* result is no nil? */ - (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ - setobj2s(L, val, res); - return; - } - /* else will try the tag method */ - } - else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) - luaG_typeerror(L, t, "index"); - if (ttisfunction(tm)) { - callTMres(L, val, tm, t, key); - return; - } - t = tm; /* else repeat with `tm' */ - } - luaG_runerror(L, "loop in gettable"); -} - - -void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { - int loop; - TValue temp; - for (loop = 0; loop < MAXTAGLOOP; loop++) { - const TValue *tm; - if (ttistable(t)) { /* `t' is a table? */ - Table *h = hvalue(t); - TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ - if (!ttisnil(oldval) || /* result is no nil? */ - (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ - setobj2t(L, oldval, val); - h->flags = 0; - luaC_barriert(L, h, val); - return; - } - /* else will try the tag method */ - } - else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) - luaG_typeerror(L, t, "index"); - if (ttisfunction(tm)) { - callTM(L, tm, t, key, val); - return; - } - /* else repeat with `tm' */ - setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */ - t = &temp; - } - luaG_runerror(L, "loop in settable"); -} - - -static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ - if (ttisnil(tm)) - tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ - if (ttisnil(tm)) return 0; - callTMres(L, res, tm, p1, p2); - return 1; -} - - -static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, - TMS event) { - const TValue *tm1 = fasttm(L, mt1, event); - const TValue *tm2; - if (tm1 == NULL) return NULL; /* no metamethod */ - if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ - tm2 = fasttm(L, mt2, event); - if (tm2 == NULL) return NULL; /* no metamethod */ - if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ - return tm1; - return NULL; -} - - -static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, - TMS event) { - const TValue *tm1 = luaT_gettmbyobj(L, p1, event); - const TValue *tm2; - if (ttisnil(tm1)) return -1; /* no metamethod? */ - tm2 = luaT_gettmbyobj(L, p2, event); - if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ - return -1; - callTMres(L, L->top, tm1, p1, p2); - return !l_isfalse(L->top); -} - - -static int l_strcmp (const TString *ls, const TString *rs) { - const char *l = getstr(ls); - size_t ll = ls->tsv.len; - const char *r = getstr(rs); - size_t lr = rs->tsv.len; - for (;;) { - int temp = strcoll(l, r); - if (temp != 0) return temp; - else { /* strings are equal up to a `\0' */ - size_t len = strlen(l); /* index of first `\0' in both strings */ - if (len == lr) /* r is finished? */ - return (len == ll) ? 0 : 1; - else if (len == ll) /* l is finished? */ - return -1; /* l is smaller than r (because r is not finished) */ - /* both strings longer than `len'; go on comparing (after the `\0') */ - len++; - l += len; ll -= len; r += len; lr -= len; - } - } -} - - -int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { - int res; - if (ttype(l) != ttype(r)) - return luaG_ordererror(L, l, r); - else if (ttisnumber(l)) - return luai_numlt(nvalue(l), nvalue(r)); - else if (ttisstring(l)) - return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; - else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) - return res; - return luaG_ordererror(L, l, r); -} - - -static int lessequal (lua_State *L, const TValue *l, const TValue *r) { - int res; - if (ttype(l) != ttype(r)) - return luaG_ordererror(L, l, r); - else if (ttisnumber(l)) - return luai_numle(nvalue(l), nvalue(r)); - else if (ttisstring(l)) - return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; - else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ - return res; - else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ - return !res; - return luaG_ordererror(L, l, r); -} - - -int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { - const TValue *tm; - lua_assert(ttype(t1) == ttype(t2)); - switch (ttype(t1)) { - case LUA_TNIL: return 1; - case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); - case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ - case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); - case LUA_TUSERDATA: { - if (uvalue(t1) == uvalue(t2)) return 1; - tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, - TM_EQ); - break; /* will try TM */ - } - case LUA_TTABLE: { - if (hvalue(t1) == hvalue(t2)) return 1; - tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - default: return gcvalue(t1) == gcvalue(t2); - } - if (tm == NULL) return 0; /* no TM? */ - callTMres(L, L->top, tm, t1, t2); /* call TM */ - return !l_isfalse(L->top); -} - - -void luaV_concat (lua_State *L, int total, int last) { - do { - StkId top = L->base + last + 1; - int n = 2; /* number of elements handled in this pass (at least 2) */ - if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { - if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) - luaG_concaterror(L, top-2, top-1); - } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ - (void)tostring(L, top - 2); /* result is first op (as string) */ - else { - /* at least two string values; get as many as possible */ - size_t tl = tsvalue(top-1)->len; - char *buffer; - int i; - /* collect total length */ - for (n = 1; n < total && tostring(L, top-n-1); n++) { - size_t l = tsvalue(top-n-1)->len; - if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); - tl += l; - } - buffer = luaZ_openspace(L, &G(L)->buff, tl); - tl = 0; - for (i=n; i>0; i--) { /* concat all strings */ - size_t l = tsvalue(top-i)->len; - memcpy(buffer+tl, svalue(top-i), l); - tl += l; - } - setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); - } - total -= n-1; /* got `n' strings to create 1 new */ - last -= n-1; - } while (total > 1); /* repeat until only 1 result left */ -} - - -static void Arith (lua_State *L, StkId ra, const TValue *rb, - const TValue *rc, TMS op) { - TValue tempb, tempc; - const TValue *b, *c; - if ((b = luaV_tonumber(rb, &tempb)) != NULL && - (c = luaV_tonumber(rc, &tempc)) != NULL) { - lua_Number nb = nvalue(b), nc = nvalue(c); - switch (op) { - case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; - case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; - case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; - case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; - case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; - case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; - case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; - default: lua_assert(0); break; - } - } - else if (!call_binTM(L, rb, rc, ra, op)) - luaG_aritherror(L, rb, rc); -} - - - -/* -** some macros for common tasks in `luaV_execute' -*/ - -#define runtime_check(L, c) { if (!(c)) break; } - -#define RA(i) (base+GETARG_A(i)) -/* to be used after possible stack reallocation */ -#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) -#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) -#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) -#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) -#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) - - -#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} - - -#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } - - -#define arith_op(op,tm) { \ - TValue *rb = RKB(i); \ - TValue *rc = RKC(i); \ - if (ttisnumber(rb) && ttisnumber(rc)) { \ - lua_Number nb = nvalue(rb), nc = nvalue(rc); \ - setnvalue(ra, op(nb, nc)); \ - } \ - else \ - Protect(Arith(L, ra, rb, rc, tm)); \ - } - - - -void luaV_execute (lua_State *L, int nexeccalls) { - LClosure *cl; - StkId base; - TValue *k; - const Instruction *pc; - reentry: /* entry point */ - lua_assert(isLua(L->ci)); - pc = L->savedpc; - cl = &clvalue(L->ci->func)->l; - base = L->base; - k = cl->p->k; - /* main loop of interpreter */ - for (;;) { - const Instruction i = *pc++; - StkId ra; - if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && - (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { - traceexec(L, pc); - if (L->status == LUA_YIELD) { /* did hook yield? */ - L->savedpc = pc - 1; - return; - } - base = L->base; - } - /* warning!! several calls may realloc the stack and invalidate `ra' */ - ra = RA(i); - lua_assert(base == L->base && L->base == L->ci->base); - lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); - lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); - switch (GET_OPCODE(i)) { - case OP_MOVE: { - setobjs2s(L, ra, RB(i)); - continue; - } - case OP_LOADK: { - setobj2s(L, ra, KBx(i)); - continue; - } - case OP_LOADBOOL: { - setbvalue(ra, GETARG_B(i)); - if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ - continue; - } - case OP_LOADNIL: { - TValue *rb = RB(i); - do { - setnilvalue(rb--); - } while (rb >= ra); - continue; - } - case OP_GETUPVAL: { - int b = GETARG_B(i); - setobj2s(L, ra, cl->upvals[b]->v); - continue; - } - case OP_GETGLOBAL: { - TValue g; - TValue *rb = KBx(i); - sethvalue(L, &g, cl->env); - lua_assert(ttisstring(rb)); - Protect(luaV_gettable(L, &g, rb, ra)); - continue; - } - case OP_GETTABLE: { - Protect(luaV_gettable(L, RB(i), RKC(i), ra)); - continue; - } - case OP_SETGLOBAL: { - TValue g; - sethvalue(L, &g, cl->env); - lua_assert(ttisstring(KBx(i))); - Protect(luaV_settable(L, &g, KBx(i), ra)); - continue; - } - case OP_SETUPVAL: { - UpVal *uv = cl->upvals[GETARG_B(i)]; - setobj(L, uv->v, ra); - luaC_barrier(L, uv, ra); - continue; - } - case OP_SETTABLE: { - Protect(luaV_settable(L, ra, RKB(i), RKC(i))); - continue; - } - case OP_NEWTABLE: { - int b = GETARG_B(i); - int c = GETARG_C(i); - sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); - Protect(luaC_checkGC(L)); - continue; - } - case OP_SELF: { - StkId rb = RB(i); - setobjs2s(L, ra+1, rb); - Protect(luaV_gettable(L, rb, RKC(i), ra)); - continue; - } - case OP_ADD: { - arith_op(luai_numadd, TM_ADD); - continue; - } - case OP_SUB: { - arith_op(luai_numsub, TM_SUB); - continue; - } - case OP_MUL: { - arith_op(luai_nummul, TM_MUL); - continue; - } - case OP_DIV: { - arith_op(luai_numdiv, TM_DIV); - continue; - } - case OP_MOD: { - arith_op(luai_nummod, TM_MOD); - continue; - } - case OP_POW: { - arith_op(luai_numpow, TM_POW); - continue; - } - case OP_UNM: { - TValue *rb = RB(i); - if (ttisnumber(rb)) { - lua_Number nb = nvalue(rb); - setnvalue(ra, luai_numunm(nb)); - } - else { - Protect(Arith(L, ra, rb, rb, TM_UNM)); - } - continue; - } - case OP_NOT: { - int res = l_isfalse(RB(i)); /* next assignment may change this value */ - setbvalue(ra, res); - continue; - } - case OP_LEN: { - const TValue *rb = RB(i); - switch (ttype(rb)) { - case LUA_TTABLE: { - setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); - break; - } - case LUA_TSTRING: { - setnvalue(ra, cast_num(tsvalue(rb)->len)); - break; - } - default: { /* try metamethod */ - Protect( - if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) - luaG_typeerror(L, rb, "get length of"); - ) - } - } - continue; - } - case OP_CONCAT: { - int b = GETARG_B(i); - int c = GETARG_C(i); - Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); - setobjs2s(L, RA(i), base+b); - continue; - } - case OP_JMP: { - dojump(L, pc, GETARG_sBx(i)); - continue; - } - case OP_EQ: { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - Protect( - if (equalobj(L, rb, rc) == GETARG_A(i)) - dojump(L, pc, GETARG_sBx(*pc)); - ) - pc++; - continue; - } - case OP_LT: { - Protect( - if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) - dojump(L, pc, GETARG_sBx(*pc)); - ) - pc++; - continue; - } - case OP_LE: { - Protect( - if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) - dojump(L, pc, GETARG_sBx(*pc)); - ) - pc++; - continue; - } - case OP_TEST: { - if (l_isfalse(ra) != GETARG_C(i)) - dojump(L, pc, GETARG_sBx(*pc)); - pc++; - continue; - } - case OP_TESTSET: { - TValue *rb = RB(i); - if (l_isfalse(rb) != GETARG_C(i)) { - setobjs2s(L, ra, rb); - dojump(L, pc, GETARG_sBx(*pc)); - } - pc++; - continue; - } - case OP_CALL: { - int b = GETARG_B(i); - int nresults = GETARG_C(i) - 1; - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - L->savedpc = pc; - switch (luaD_precall(L, ra, nresults)) { - case PCRLUA: { - nexeccalls++; - goto reentry; /* restart luaV_execute over new Lua function */ - } - case PCRC: { - /* it was a C function (`precall' called it); adjust results */ - if (nresults >= 0) L->top = L->ci->top; - base = L->base; - continue; - } - default: { - return; /* yield */ - } - } - } - case OP_TAILCALL: { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - L->savedpc = pc; - lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); - switch (luaD_precall(L, ra, LUA_MULTRET)) { - case PCRLUA: { - /* tail call: put new frame in place of previous one */ - CallInfo *ci = L->ci - 1; /* previous frame */ - int aux; - StkId func = ci->func; - StkId pfunc = (ci+1)->func; /* previous function index */ - if (L->openupval) luaF_close(L, ci->base); - L->base = ci->base = ci->func + ((ci+1)->base - pfunc); - for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ - setobjs2s(L, func+aux, pfunc+aux); - ci->top = L->top = func+aux; /* correct top */ - lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); - ci->savedpc = L->savedpc; - ci->tailcalls++; /* one more call lost */ - L->ci--; /* remove new frame */ - goto reentry; - } - case PCRC: { /* it was a C function (`precall' called it) */ - base = L->base; - continue; - } - default: { - return; /* yield */ - } - } - } - case OP_RETURN: { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b-1; - if (L->openupval) luaF_close(L, base); - L->savedpc = pc; - b = luaD_poscall(L, ra); - if (--nexeccalls == 0) /* was previous function running `here'? */ - return; /* no: return */ - else { /* yes: continue its execution */ - if (b) L->top = L->ci->top; - lua_assert(isLua(L->ci)); - lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); - goto reentry; - } - } - case OP_FORLOOP: { - lua_Number step = nvalue(ra+2); - lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ - lua_Number limit = nvalue(ra+1); - if (luai_numlt(0, step) ? luai_numle(idx, limit) - : luai_numle(limit, idx)) { - dojump(L, pc, GETARG_sBx(i)); /* jump back */ - setnvalue(ra, idx); /* update internal index... */ - setnvalue(ra+3, idx); /* ...and external index */ - } - continue; - } - case OP_FORPREP: { - const TValue *init = ra; - const TValue *plimit = ra+1; - const TValue *pstep = ra+2; - L->savedpc = pc; /* next steps may throw errors */ - if (!tonumber(init, ra)) - luaG_runerror(L, LUA_QL("for") " initial value must be a number"); - else if (!tonumber(plimit, ra+1)) - luaG_runerror(L, LUA_QL("for") " limit must be a number"); - else if (!tonumber(pstep, ra+2)) - luaG_runerror(L, LUA_QL("for") " step must be a number"); - setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); - dojump(L, pc, GETARG_sBx(i)); - continue; - } - case OP_TFORLOOP: { - StkId cb = ra + 3; /* call base */ - setobjs2s(L, cb+2, ra+2); - setobjs2s(L, cb+1, ra+1); - setobjs2s(L, cb, ra); - L->top = cb+3; /* func. + 2 args (state and index) */ - Protect(luaD_call(L, cb, GETARG_C(i))); - L->top = L->ci->top; - cb = RA(i) + 3; /* previous call may change the stack */ - if (!ttisnil(cb)) { /* continue loop? */ - setobjs2s(L, cb-1, cb); /* save control variable */ - dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ - } - pc++; - continue; - } - case OP_SETLIST: { - int n = GETARG_B(i); - int c = GETARG_C(i); - int last; - Table *h; - if (n == 0) { - n = cast_int(L->top - ra) - 1; - L->top = L->ci->top; - } - if (c == 0) c = cast_int(*pc++); - runtime_check(L, ttistable(ra)); - h = hvalue(ra); - last = ((c-1)*LFIELDS_PER_FLUSH) + n; - if (last > h->sizearray) /* needs more space? */ - luaH_resizearray(L, h, last); /* pre-alloc it at once */ - for (; n > 0; n--) { - TValue *val = ra+n; - setobj2t(L, luaH_setnum(L, h, last--), val); - luaC_barriert(L, h, val); - } - continue; - } - case OP_CLOSE: { - luaF_close(L, ra); - continue; - } - case OP_CLOSURE: { - Proto *p; - Closure *ncl; - int nup, j; - p = cl->p->p[GETARG_Bx(i)]; - nup = p->nups; - ncl = luaF_newLclosure(L, nup, cl->env); - ncl->l.p = p; - for (j=0; jl.upvals[j] = cl->upvals[GETARG_B(*pc)]; - else { - lua_assert(GET_OPCODE(*pc) == OP_MOVE); - ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); - } - } - setclvalue(L, ra, ncl); - Protect(luaC_checkGC(L)); - continue; - } - case OP_VARARG: { - int b = GETARG_B(i) - 1; - int j; - CallInfo *ci = L->ci; - int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; - if (b == LUA_MULTRET) { - Protect(luaD_checkstack(L, n)); - ra = RA(i); /* previous call may change the stack */ - b = n; - L->top = ra + n; - } - for (j = 0; j < b; j++) { - if (j < n) { - setobjs2s(L, ra + j, ci->base - n + j); - } - else { - setnilvalue(ra + j); - } - } - continue; - } - } - } -} - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lvm.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lvm.h deleted file mode 100644 index bfe4f567..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lvm.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lvm_h -#define lvm_h - - -#include "ldo.h" -#include "lobject.h" -#include "ltm.h" - - -#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) - -#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ - (((o) = luaV_tonumber(o,n)) != NULL)) - -#define equalobj(L,o1,o2) \ - (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) - - -LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); -LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); -LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); -LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, - StkId val); -LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, - StkId val); -LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); -LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lzio.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lzio.c deleted file mode 100644 index 293edd59..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lzio.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ -** a generic input stream interface -** See Copyright Notice in lua.h -*/ - - -#include - -#define lzio_c -#define LUA_CORE - -#include "lua.h" - -#include "llimits.h" -#include "lmem.h" -#include "lstate.h" -#include "lzio.h" - - -int luaZ_fill (ZIO *z) { - size_t size; - lua_State *L = z->L; - const char *buff; - lua_unlock(L); - buff = z->reader(L, z->data, &size); - lua_lock(L); - if (buff == NULL || size == 0) return EOZ; - z->n = size - 1; - z->p = buff; - return char2int(*(z->p++)); -} - - -int luaZ_lookahead (ZIO *z) { - if (z->n == 0) { - if (luaZ_fill(z) == EOZ) - return EOZ; - else { - z->n++; /* luaZ_fill removed first byte; put back it */ - z->p--; - } - } - return char2int(*z->p); -} - - -void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { - z->L = L; - z->reader = reader; - z->data = data; - z->n = 0; - z->p = NULL; -} - - -/* --------------------------------------------------------------- read --- */ -size_t luaZ_read (ZIO *z, void *b, size_t n) { - while (n) { - size_t m; - if (luaZ_lookahead(z) == EOZ) - return n; /* return number of missing bytes */ - m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ - memcpy(b, z->p, m); - z->n -= m; - z->p += m; - b = (char *)b + m; - n -= m; - } - return 0; -} - -/* ------------------------------------------------------------------------ */ -char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { - if (n > buff->buffsize) { - if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; - luaZ_resizebuffer(L, buff, n); - } - return buff->buffer; -} - - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lzio.h b/Sources/backend-cpp/Vendor/lua-5.1.5/src/lzio.h deleted file mode 100644 index 51d695d8..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/lzio.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ -** Buffered streams -** See Copyright Notice in lua.h -*/ - - -#ifndef lzio_h -#define lzio_h - -#include "lua.h" - -#include "lmem.h" - - -#define EOZ (-1) /* end of stream */ - -typedef struct Zio ZIO; - -#define char2int(c) cast(int, cast(unsigned char, (c))) - -#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) - -typedef struct Mbuffer { - char *buffer; - size_t n; - size_t buffsize; -} Mbuffer; - -#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) - -#define luaZ_buffer(buff) ((buff)->buffer) -#define luaZ_sizebuffer(buff) ((buff)->buffsize) -#define luaZ_bufflen(buff) ((buff)->n) - -#define luaZ_resetbuffer(buff) ((buff)->n = 0) - - -#define luaZ_resizebuffer(L, buff, size) \ - (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ - (buff)->buffsize = size) - -#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) - - -LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); -LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, - void *data); -LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ -LUAI_FUNC int luaZ_lookahead (ZIO *z); - - - -/* --------- Private Part ------------------ */ - -struct Zio { - size_t n; /* bytes still unread */ - const char *p; /* current position in buffer */ - lua_Reader reader; - void* data; /* additional data */ - lua_State *L; /* Lua state (for reader) */ -}; - - -LUAI_FUNC int luaZ_fill (ZIO *z); - -#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/src/print.c b/Sources/backend-cpp/Vendor/lua-5.1.5/src/print.c deleted file mode 100644 index e240cfc3..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/src/print.c +++ /dev/null @@ -1,227 +0,0 @@ -/* -** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ -** print bytecodes -** See Copyright Notice in lua.h -*/ - -#include -#include - -#define luac_c -#define LUA_CORE - -#include "ldebug.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lundump.h" - -#define PrintFunction luaU_print - -#define Sizeof(x) ((int)sizeof(x)) -#define VOID(p) ((const void*)(p)) - -static void PrintString(const TString* ts) -{ - const char* s=getstr(ts); - size_t i,n=ts->tsv.len; - putchar('"'); - for (i=0; ik[i]; - switch (ttype(o)) - { - case LUA_TNIL: - printf("nil"); - break; - case LUA_TBOOLEAN: - printf(bvalue(o) ? "true" : "false"); - break; - case LUA_TNUMBER: - printf(LUA_NUMBER_FMT,nvalue(o)); - break; - case LUA_TSTRING: - PrintString(rawtsvalue(o)); - break; - default: /* cannot happen */ - printf("? type=%d",ttype(o)); - break; - } -} - -static void PrintCode(const Proto* f) -{ - const Instruction* code=f->code; - int pc,n=f->sizecode; - for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); - printf("%-9s\t",luaP_opnames[o]); - switch (getOpMode(o)) - { - case iABC: - printf("%d",a); - if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); - if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); - break; - case iABx: - if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); - break; - case iAsBx: - if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); - break; - } - switch (o) - { - case OP_LOADK: - printf("\t; "); PrintConstant(f,bx); - break; - case OP_GETUPVAL: - case OP_SETUPVAL: - printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); - break; - case OP_GETGLOBAL: - case OP_SETGLOBAL: - printf("\t; %s",svalue(&f->k[bx])); - break; - case OP_GETTABLE: - case OP_SELF: - if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABLE: - case OP_ADD: - case OP_SUB: - case OP_MUL: - case OP_DIV: - case OP_POW: - case OP_EQ: - case OP_LT: - case OP_LE: - if (ISK(b) || ISK(c)) - { - printf("\t; "); - if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); - printf(" "); - if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); - } - break; - case OP_JMP: - case OP_FORLOOP: - case OP_FORPREP: - printf("\t; to %d",sbx+pc+2); - break; - case OP_CLOSURE: - printf("\t; %p",VOID(f->p[bx])); - break; - case OP_SETLIST: - if (c==0) printf("\t; %d",(int)code[++pc]); - else printf("\t; %d",c); - break; - default: - break; - } - printf("\n"); - } -} - -#define SS(x) (x==1)?"":"s" -#define S(x) x,SS(x) - -static void PrintHeader(const Proto* f) -{ - const char* s=getstr(f->source); - if (*s=='@' || *s=='=') - s++; - else if (*s==LUA_SIGNATURE[0]) - s="(bstring)"; - else - s="(string)"; - printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", - (f->linedefined==0)?"main":"function",s, - f->linedefined,f->lastlinedefined, - S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); - printf("%d%s param%s, %d slot%s, %d upvalue%s, ", - f->numparams,f->is_vararg?"+":"",SS(f->numparams), - S(f->maxstacksize),S(f->nups)); - printf("%d local%s, %d constant%s, %d function%s\n", - S(f->sizelocvars),S(f->sizek),S(f->sizep)); -} - -static void PrintConstants(const Proto* f) -{ - int i,n=f->sizek; - printf("constants (%d) for %p:\n",n,VOID(f)); - for (i=0; isizelocvars; - printf("locals (%d) for %p:\n",n,VOID(f)); - for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); - } -} - -static void PrintUpvalues(const Proto* f) -{ - int i,n=f->sizeupvalues; - printf("upvalues (%d) for %p:\n",n,VOID(f)); - if (f->upvalues==NULL) return; - for (i=0; iupvalues[i])); - } -} - -void PrintFunction(const Proto* f, int full) -{ - int i,n=f->sizep; - PrintHeader(f); - PrintCode(f); - if (full) - { - PrintConstants(f); - PrintLocals(f); - PrintUpvalues(f); - } - for (i=0; ip[i],full); -} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/README b/Sources/backend-cpp/Vendor/lua-5.1.5/test/README deleted file mode 100644 index 0c7f38bc..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/README +++ /dev/null @@ -1,26 +0,0 @@ -These are simple tests for Lua. Some of them contain useful code. -They are meant to be run to make sure Lua is built correctly and also -to be read, to see how Lua programs look. - -Here is a one-line summary of each program: - - bisect.lua bisection method for solving non-linear equations - cf.lua temperature conversion table (celsius to farenheit) - echo.lua echo command line arguments - env.lua environment variables as automatic global variables - factorial.lua factorial without recursion - fib.lua fibonacci function with cache - fibfor.lua fibonacci numbers with coroutines and generators - globals.lua report global variable usage - hello.lua the first program in every language - life.lua Conway's Game of Life - luac.lua bare-bones luac - printf.lua an implementation of printf - readonly.lua make global variables readonly - sieve.lua the sieve of of Eratosthenes programmed with coroutines - sort.lua two implementations of a sort function - table.lua make table, grouping all data for the same item - trace-calls.lua trace calls - trace-globals.lua trace assigments to global variables - xd.lua hex dump - diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/bisect.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/bisect.lua deleted file mode 100644 index f91e69bf..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/bisect.lua +++ /dev/null @@ -1,27 +0,0 @@ --- bisection method for solving non-linear equations - -delta=1e-6 -- tolerance - -function bisect(f,a,b,fa,fb) - local c=(a+b)/2 - io.write(n," c=",c," a=",a," b=",b,"\n") - if c==a or c==b or math.abs(a-b) posted to lua-l --- modified to use ANSI terminal escape sequences --- modified to use for instead of while - -local write=io.write - -ALIVE="" DEAD="" -ALIVE="O" DEAD="-" - -function delay() -- NOTE: SYSTEM-DEPENDENT, adjust as necessary - for i=1,10000 do end - -- local i=os.clock()+1 while(os.clock() 0 do - local xm1,x,xp1,xi=self.w-1,self.w,1,self.w - while xi > 0 do - local sum = self[ym1][xm1] + self[ym1][x] + self[ym1][xp1] + - self[y][xm1] + self[y][xp1] + - self[yp1][xm1] + self[yp1][x] + self[yp1][xp1] - next[y][x] = ((sum==2) and self[y][x]) or ((sum==3) and 1) or 0 - xm1,x,xp1,xi = x,xp1,xp1+1,xi-1 - end - ym1,y,yp1,yi = y,yp1,yp1+1,yi-1 - end -end - --- output the array to screen -function _CELLS:draw() - local out="" -- accumulate to reduce flicker - for y=1,self.h do - for x=1,self.w do - out=out..(((self[y][x]>0) and ALIVE) or DEAD) - end - out=out.."\n" - end - write(out) -end - --- constructor -function CELLS(w,h) - local c = ARRAY2D(w,h) - c.spawn = _CELLS.spawn - c.evolve = _CELLS.evolve - c.draw = _CELLS.draw - return c -end - --- --- shapes suitable for use with spawn() above --- -HEART = { 1,0,1,1,0,1,1,1,1; w=3,h=3 } -GLIDER = { 0,0,1,1,0,1,0,1,1; w=3,h=3 } -EXPLODE = { 0,1,0,1,1,1,1,0,1,0,1,0; w=3,h=4 } -FISH = { 0,1,1,1,1,1,0,0,0,1,0,0,0,0,1,1,0,0,1,0; w=5,h=4 } -BUTTERFLY = { 1,0,0,0,1,0,1,1,1,0,1,0,0,0,1,1,0,1,0,1,1,0,0,0,1; w=5,h=5 } - --- the main routine -function LIFE(w,h) - -- create two arrays - local thisgen = CELLS(w,h) - local nextgen = CELLS(w,h) - - -- create some life - -- about 1000 generations of fun, then a glider steady-state - thisgen:spawn(GLIDER,5,4) - thisgen:spawn(EXPLODE,25,10) - thisgen:spawn(FISH,4,12) - - -- run until break - local gen=1 - write("\027[2J") -- ANSI clear screen - while 1 do - thisgen:evolve(nextgen) - thisgen,nextgen = nextgen,thisgen - write("\027[H") -- ANSI home cursor - thisgen:draw() - write("Life - generation ",gen,"\n") - gen=gen+1 - if gen>2000 then break end - --delay() -- no delay - end -end - -LIFE(40,20) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/luac.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/luac.lua deleted file mode 100644 index 96a0a97c..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/luac.lua +++ /dev/null @@ -1,7 +0,0 @@ --- bare-bones luac in Lua --- usage: lua luac.lua file.lua - -assert(arg[1]~=nil and arg[2]==nil,"usage: lua luac.lua file.lua") -f=assert(io.open("luac.out","wb")) -assert(f:write(string.dump(assert(loadfile(arg[1]))))) -assert(f:close()) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/printf.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/printf.lua deleted file mode 100644 index 58c63ff5..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/printf.lua +++ /dev/null @@ -1,7 +0,0 @@ --- an implementation of printf - -function printf(...) - io.write(string.format(...)) -end - -printf("Hello %s from %s on %s\n",os.getenv"USER" or "there",_VERSION,os.date()) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/readonly.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/readonly.lua deleted file mode 100644 index 85c0b4e0..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/readonly.lua +++ /dev/null @@ -1,12 +0,0 @@ --- make global variables readonly - -local f=function (t,i) error("cannot redefine global variable `"..i.."'",2) end -local g={} -local G=getfenv() -setmetatable(g,{__index=G,__newindex=f}) -setfenv(1,g) - --- an example -rawset(g,"x",3) -x=2 -y=1 -- cannot redefine `y' diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/sieve.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/sieve.lua deleted file mode 100644 index 0871bb21..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/sieve.lua +++ /dev/null @@ -1,29 +0,0 @@ --- the sieve of of Eratosthenes programmed with coroutines --- typical usage: lua -e N=1000 sieve.lua | column - --- generate all the numbers from 2 to n -function gen (n) - return coroutine.wrap(function () - for i=2,n do coroutine.yield(i) end - end) -end - --- filter the numbers generated by `g', removing multiples of `p' -function filter (p, g) - return coroutine.wrap(function () - while 1 do - local n = g() - if n == nil then return end - if math.mod(n, p) ~= 0 then coroutine.yield(n) end - end - end) -end - -N=N or 1000 -- from command line -x = gen(N) -- generate primes up to N -while 1 do - local n = x() -- pick a number until done - if n == nil then break end - print(n) -- must be a prime number - x = filter(n, x) -- now remove its multiples -end diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/sort.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/sort.lua deleted file mode 100644 index 0bcb15f8..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/sort.lua +++ /dev/null @@ -1,66 +0,0 @@ --- two implementations of a sort function --- this is an example only. Lua has now a built-in function "sort" - --- extracted from Programming Pearls, page 110 -function qsort(x,l,u,f) - if ly end) - show("after reverse selection sort",x) - qsort(x,1,n,function (x,y) return x>> ",string.rep(" ",level)) - if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end - t=debug.getinfo(2) - if event=="call" then - level=level+1 - else - level=level-1 if level<0 then level=0 end - end - if t.what=="main" then - if event=="call" then - io.write("begin ",t.short_src) - else - io.write("end ",t.short_src) - end - elseif t.what=="Lua" then --- table.foreach(t,print) - io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">") - else - io.write(event," ",t.name or "(C)"," [",t.what,"] ") - end - io.write("\n") -end - -debug.sethook(hook,"cr") -level=0 diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/trace-globals.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/trace-globals.lua deleted file mode 100644 index 295e670c..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/trace-globals.lua +++ /dev/null @@ -1,38 +0,0 @@ --- trace assigments to global variables - -do - -- a tostring that quotes strings. note the use of the original tostring. - local _tostring=tostring - local tostring=function(a) - if type(a)=="string" then - return string.format("%q",a) - else - return _tostring(a) - end - end - - local log=function (name,old,new) - local t=debug.getinfo(3,"Sl") - local line=t.currentline - io.write(t.short_src) - if line>=0 then io.write(":",line) end - io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n") - end - - local g={} - local set=function (t,name,value) - log(name,g[name],value) - g[name]=value - end - setmetatable(getfenv(),{__index=g,__newindex=set}) -end - --- an example - -a=1 -b=2 -a=10 -b=20 -b=nil -b=200 -print(a,b,c) diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/test/xd.lua b/Sources/backend-cpp/Vendor/lua-5.1.5/test/xd.lua deleted file mode 100644 index ebc3effc..00000000 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/test/xd.lua +++ /dev/null @@ -1,14 +0,0 @@ --- hex dump --- usage: lua xd.lua < file - -local offset=0 -while true do - local s=io.read(16) - if s==nil then return end - io.write(string.format("%08X ",offset)) - string.gsub(s,"(.)", - function (c) io.write(string.format("%02X ",string.byte(c))) end) - io.write(string.rep(" ",3*(16-string.len(s)))) - io.write(" ",string.gsub(s,"%c","."),"\n") - offset=offset+16 -end diff --git a/Sources/backend-cpp/Windows/com.ctytler.dcs.sdPlugin.sln b/Sources/backend-cpp/Windows/com.ctytler.dcs.sdPlugin.sln index aebd25f9..8b1973f0 100644 --- a/Sources/backend-cpp/Windows/com.ctytler.dcs.sdPlugin.sln +++ b/Sources/backend-cpp/Windows/com.ctytler.dcs.sdPlugin.sln @@ -1,24 +1,21 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "..\Test\Test.vcxproj", "{81582F07-E000-4049-B302-BF98D6ED1B41}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua", "..\Vendor\lua-5.1.5\Lua.vcxproj", "{59EEC206-84E0-4842-B89E-2025FD78E589}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StreamdeckContext", "..\StreamdeckContext\StreamdeckContext.vcxproj", "{36A2B3D3-C3FA-424C-9BB6-37D19EBE5A3E}" ProjectSection(ProjectDependencies) = postProject - {F60CA831-72E9-4992-BCFE-12B3387F646B} = {F60CA831-72E9-4992-BCFE-12B3387F646B} {2782D849-65F7-4B89-A856-964FD918269A} = {2782D849-65F7-4B89-A856-964FD918269A} {329F64AC-6346-46D2-A671-9B5DD626B485} = {329F64AC-6346-46D2-A671-9B5DD626B485} + {F60CA831-72E9-4992-BCFE-12B3387F646B} = {F60CA831-72E9-4992-BCFE-12B3387F646B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "..\Utilities\Utilities.vcxproj", "{329F64AC-6346-46D2-A671-9B5DD626B485}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimulatorInterface", "..\SimulatorInterface\SimulatorInterface.vcxproj", "{2782D849-65F7-4B89-A856-964FD918269A}" ProjectSection(ProjectDependencies) = postProject - {59EEC206-84E0-4842-B89E-2025FD78E589} = {59EEC206-84E0-4842-B89E-2025FD78E589} {329F64AC-6346-46D2-A671-9B5DD626B485} = {329F64AC-6346-46D2-A671-9B5DD626B485} EndProjectSection EndProject @@ -26,11 +23,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ElgatoSD", "..\ElgatoSD\Elg EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StreamdeckInterface", "..\StreamdeckInterface\StreamdeckInterface.vcxproj", "{63B5F7A0-B90D-4BBC-BBCB-C61B25054911}" ProjectSection(ProjectDependencies) = postProject - {59EEC206-84E0-4842-B89E-2025FD78E589} = {59EEC206-84E0-4842-B89E-2025FD78E589} - {F60CA831-72E9-4992-BCFE-12B3387F646B} = {F60CA831-72E9-4992-BCFE-12B3387F646B} {2782D849-65F7-4B89-A856-964FD918269A} = {2782D849-65F7-4B89-A856-964FD918269A} {329F64AC-6346-46D2-A671-9B5DD626B485} = {329F64AC-6346-46D2-A671-9B5DD626B485} {36A2B3D3-C3FA-424C-9BB6-37D19EBE5A3E} = {36A2B3D3-C3FA-424C-9BB6-37D19EBE5A3E} + {F60CA831-72E9-4992-BCFE-12B3387F646B} = {F60CA831-72E9-4992-BCFE-12B3387F646B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SocketTester", "..\..\..\Tools\SocketTester\SocketTester.vcxproj", "{58185760-BDC0-434C-AB8F-F6AF34A72714}" @@ -54,14 +50,6 @@ Global {81582F07-E000-4049-B302-BF98D6ED1B41}.Release|x64.Build.0 = Release|x64 {81582F07-E000-4049-B302-BF98D6ED1B41}.Release|x86.ActiveCfg = Release|Win32 {81582F07-E000-4049-B302-BF98D6ED1B41}.Release|x86.Build.0 = Release|Win32 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Debug|x64.ActiveCfg = Debug|x64 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Debug|x64.Build.0 = Debug|x64 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Debug|x86.ActiveCfg = Debug|Win32 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Debug|x86.Build.0 = Debug|Win32 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Release|x64.ActiveCfg = Release|x64 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Release|x64.Build.0 = Release|x64 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Release|x86.ActiveCfg = Release|Win32 - {59EEC206-84E0-4842-B89E-2025FD78E589}.Release|x86.Build.0 = Release|Win32 {36A2B3D3-C3FA-424C-9BB6-37D19EBE5A3E}.Debug|x64.ActiveCfg = Debug|x64 {36A2B3D3-C3FA-424C-9BB6-37D19EBE5A3E}.Debug|x64.Build.0 = Debug|x64 {36A2B3D3-C3FA-424C-9BB6-37D19EBE5A3E}.Debug|x86.ActiveCfg = Debug|Win32 diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3.nupkg b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3.nupkg deleted file mode 100644 index e97f6919..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3.nupkg and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets deleted file mode 100644 index a9b68215..00000000 --- a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets +++ /dev/null @@ -1,42 +0,0 @@ - - - true - - - true - - - - - - - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Debug\gtestd.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Debug\gtest_maind.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Release\gtest.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Release\gtest_main.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Debug\gtestd.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Debug\gtest_maind.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Release\gtest.lib;%(AdditionalDependencies) - $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Release\gtest_main.lib;%(AdditionalDependencies) - - - $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest.pdb deleted file mode 100644 index 94b89c3f..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest_main.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest_main.pdb deleted file mode 100644 index 9851a2e8..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest_main.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest_maind.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest_maind.lib deleted file mode 100644 index d6ea0b47..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtest_maind.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest.lib deleted file mode 100644 index 5bca1318..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest.pdb deleted file mode 100644 index ac783bdd..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest_main.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest_main.lib deleted file mode 100644 index b6c10d2a..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest_main.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest_main.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest_main.pdb deleted file mode 100644 index 08c35e11..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Release/gtest_main.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest.pdb deleted file mode 100644 index 84953027..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest_main.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest_main.pdb deleted file mode 100644 index 6f7a5f48..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest_main.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest_maind.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest_maind.lib deleted file mode 100644 index 26640d16..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtest_maind.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtestd.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtestd.lib deleted file mode 100644 index 36089fb7..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Debug/gtestd.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest.lib deleted file mode 100644 index 241e8b89..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest.pdb deleted file mode 100644 index e4b6ea27..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest_main.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest_main.lib deleted file mode 100644 index a745860c..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest_main.lib and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest_main.pdb b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest_main.pdb deleted file mode 100644 index 7f8e35b3..00000000 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x86/Release/gtest_main.pdb and /dev/null differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/.signature.p7s b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/.signature.p7s similarity index 74% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/.signature.p7s rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/.signature.p7s index 747da9f2..aae56bb5 100644 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/.signature.p7s and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/.signature.p7s differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7.nupkg b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7.nupkg new file mode 100644 index 00000000..f5687af1 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7.nupkg differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/ThirdPartyNotices.txt b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/ThirdPartyNotices.txt similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/ThirdPartyNotices.txt rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/ThirdPartyNotices.txt diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1028/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1028/googletest.propertiesui.xml new file mode 100644 index 00000000..ae604fd9 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1028/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1029/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1029/googletest.propertiesui.xml new file mode 100644 index 00000000..98aec392 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1029/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1031/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1031/googletest.propertiesui.xml new file mode 100644 index 00000000..9edb0579 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1031/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1033/googletest.propertiesui.xml similarity index 60% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.propertiesui.xml rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1033/googletest.propertiesui.xml index 33fdd4cf..830aa831 100644 --- a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.propertiesui.xml +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1033/googletest.propertiesui.xml @@ -1,13 +1,13 @@ - + - + diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1034/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1034/googletest.propertiesui.xml new file mode 100644 index 00000000..c506d040 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1034/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1036/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1036/googletest.propertiesui.xml new file mode 100644 index 00000000..a21c0568 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1036/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1040/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1040/googletest.propertiesui.xml new file mode 100644 index 00000000..19a3fd52 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1040/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1041/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1041/googletest.propertiesui.xml new file mode 100644 index 00000000..28926d99 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1041/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1042/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1042/googletest.propertiesui.xml new file mode 100644 index 00000000..e4afd116 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1042/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1045/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1045/googletest.propertiesui.xml new file mode 100644 index 00000000..640a4e96 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1045/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1046/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1046/googletest.propertiesui.xml new file mode 100644 index 00000000..39725f55 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1046/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1049/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1049/googletest.propertiesui.xml new file mode 100644 index 00000000..e478bebf --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1049/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1055/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1055/googletest.propertiesui.xml new file mode 100644 index 00000000..7679dbd9 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/1055/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/2052/googletest.propertiesui.xml b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/2052/googletest.propertiesui.xml new file mode 100644 index 00000000..40879859 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/2052/googletest.propertiesui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets new file mode 100644 index 00000000..4dfa68ce --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets @@ -0,0 +1,66 @@ + + + true + + + true + + + + + + + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Debug\gtestd.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Debug\gtest_maind.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Release\gtest.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x64\Release\gtest_main.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Debug\gtestd.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Debug\gtest_maind.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Release\gtest.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86\Release\gtest_main.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm64\Debug\gtestd.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm64\Debug\gtest_maind.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm64\Release\gtest.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm64\Release\gtest_main.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm\Debug\gtestd.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm\Debug\gtest_maind.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm\Release\gtest.lib;%(AdditionalDependencies) + $(MSBuildThisFileDirectory)..\..\lib\native\v140\windesktop\msvcstl\static\rt-dyn\arm\Release\gtest_main.lib;%(AdditionalDependencies) + + + $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-death-test.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-death-test.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-death-test.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-death-test.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-message.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-message.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-message.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-message.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-param-test.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-param-test.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-param-test.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-param-test.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-param-test.h.pump b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-param-test.h.pump similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-param-test.h.pump rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-param-test.h.pump diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-printers.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-printers.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-printers.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-printers.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-spi.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-spi.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-spi.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-spi.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-test-part.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-test-part.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-test-part.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-test-part.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-typed-test.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-typed-test.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest-typed-test.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest-typed-test.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest_pred_impl.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest_pred_impl.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest_pred_impl.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest_pred_impl.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest_prod.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest_prod.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/gtest_prod.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/gtest_prod.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/README.md b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/README.md similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/README.md rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/README.md diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/gtest-port.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/gtest-port.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/gtest-port.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/gtest-port.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/gtest-printers.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/gtest-printers.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/gtest-printers.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/gtest-printers.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/gtest.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/gtest.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/custom/gtest.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/custom/gtest.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-death-test-internal.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-death-test-internal.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-death-test-internal.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-death-test-internal.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-filepath.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-filepath.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-filepath.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-filepath.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-internal.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-internal.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-internal.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-internal.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-linked_ptr.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-linked_ptr.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-linked_ptr.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-linked_ptr.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-param-util-generated.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-param-util-generated.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-param-util-generated.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-param-util-generated.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-param-util-generated.h.pump b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-param-util-generated.h.pump similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-param-util-generated.h.pump rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-param-util-generated.h.pump diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-param-util.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-param-util.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-param-util.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-param-util.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-port-arch.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-port-arch.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-port-arch.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-port-arch.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-port.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-port.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-port.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-port.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-string.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-string.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-string.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-string.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-tuple.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-tuple.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-tuple.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-tuple.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-tuple.h.pump b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-tuple.h.pump similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-tuple.h.pump rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-tuple.h.pump diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-type-util.h b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-type-util.h similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-type-util.h rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-type-util.h diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-type-util.h.pump b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-type-util.h.pump similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/build/native/include/gtest/internal/gtest-type-util.h.pump rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/build/native/include/gtest/internal/gtest-type-util.h.pump diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Debug/gtest_maind.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Debug/gtest_maind.lib new file mode 100644 index 00000000..5719a6be Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Debug/gtest_maind.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Debug/gtestd.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Debug/gtestd.lib new file mode 100644 index 00000000..3e451d15 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Debug/gtestd.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Release/gtest.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Release/gtest.lib new file mode 100644 index 00000000..d3cd5b41 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Release/gtest.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Release/gtest_main.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Release/gtest_main.lib new file mode 100644 index 00000000..cb810cc9 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm/Release/gtest_main.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Debug/gtest_maind.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Debug/gtest_maind.lib new file mode 100644 index 00000000..9c4a1fcb Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Debug/gtest_maind.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtestd.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Debug/gtestd.lib similarity index 54% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtestd.lib rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Debug/gtestd.lib index 78ee6d93..63304d78 100644 Binary files a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/lib/native/v140/windesktop/msvcstl/static/rt-dyn/x64/Debug/gtestd.lib and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Debug/gtestd.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Release/gtest.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Release/gtest.lib new file mode 100644 index 00000000..2e91ad9c Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Release/gtest.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Release/gtest_main.lib b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Release/gtest_main.lib new file mode 100644 index 00000000..6a35731f Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/lib/native/v140/windesktop/msvcstl/static/rt-dyn/arm64/Release/gtest_main.lib differ diff --git a/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/license (MIT).txt b/Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/license (MIT).txt similarity index 100% rename from Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3/license (MIT).txt rename to Sources/backend-cpp/Windows/packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7/license (MIT).txt diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/.signature.p7s b/Sources/backend-cpp/Windows/packages/lua.5.4.6/.signature.p7s new file mode 100644 index 00000000..4107326c Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/.signature.p7s differ diff --git a/Sources/backend-cpp/Vendor/json/LICENSE.MIT b/Sources/backend-cpp/Windows/packages/lua.5.4.6/LICENSE similarity index 88% rename from Sources/backend-cpp/Vendor/json/LICENSE.MIT rename to Sources/backend-cpp/Windows/packages/lua.5.4.6/LICENSE index 1c1f7a69..b82a2647 100644 --- a/Sources/backend-cpp/Vendor/json/LICENSE.MIT +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/LICENSE @@ -1,6 +1,7 @@ -MIT License +MIT License -Copyright (c) 2013-2022 Niels Lohmann +Copyright (c) Lua source code 1994–2023 by Lua.org, PUC-Rio, +Copyright (c) Nuget package 2023 by Sebastian Grottel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/README.md b/Sources/backend-cpp/Windows/packages/lua.5.4.6/README.md new file mode 100644 index 00000000..53607095 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/README.md @@ -0,0 +1,9 @@ +# Lua + +[Lua](https://www.lua.org/) is a powerful, fast, lightweight, embeddable scripting language. + +Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. + +Lua is free open-source software, distributed under a very liberal license (the well-known MIT license). + +Project Website: https://www.lua.org/ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/Lua-propertiesui.xml b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/Lua-propertiesui.xml new file mode 100644 index 00000000..2e55ddfe --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/Lua-propertiesui.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/Lua.targets b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/Lua.targets new file mode 100644 index 00000000..902f4d24 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/Lua.targets @@ -0,0 +1,85 @@ + + + + + + + + + dynamic + + + + + Debug + + + + + Release + + + + + + + v143 + + + + + v142 + + + + + v141 + + + + + v140 + + + + + v120 + + + + + ERROR + + + + + + + HAS_LUA;%(PreprocessorDefinitions) + $(MSBuildThisFileDirectory)include\;%(AdditionalIncludeDirectories) + + + + + LUA_BUILD_AS_DLL;%(PreprocessorDefinitions) + + + + + + $(MSBuildThisFileDirectory)lib\$(PlatformName)\$(LuaRuntimePlatform)\$(LuaConfiguration)\lua_static.lib;%(AdditionalDependencies) + + + + + $(MSBuildThisFileDirectory)lib\$(PlatformName)\$(LuaRuntimePlatform)\$(LuaConfiguration)\lua.lib;%(AdditionalDependencies) + + + + + + + + + + \ No newline at end of file diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v120/Debug/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v120/Debug/lua.dll new file mode 100644 index 00000000..786529b2 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v120/Debug/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v120/Release/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v120/Release/lua.dll new file mode 100644 index 00000000..7635ed66 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v120/Release/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v140/Debug/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v140/Debug/lua.dll new file mode 100644 index 00000000..47eb150c Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v140/Debug/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v140/Release/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v140/Release/lua.dll new file mode 100644 index 00000000..2d8faa3e Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v140/Release/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v141/Debug/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v141/Debug/lua.dll new file mode 100644 index 00000000..d747f108 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v141/Debug/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v141/Release/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v141/Release/lua.dll new file mode 100644 index 00000000..bc81d4fa Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v141/Release/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v142/Debug/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v142/Debug/lua.dll new file mode 100644 index 00000000..c15a9b10 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v142/Debug/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v142/Release/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v142/Release/lua.dll new file mode 100644 index 00000000..23e68ded Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v142/Release/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v143/Debug/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v143/Debug/lua.dll new file mode 100644 index 00000000..e936bc70 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v143/Debug/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v143/Release/lua.dll b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v143/Release/lua.dll new file mode 100644 index 00000000..6f199f3e Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/bin/Win32/v143/Release/lua.dll differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/contents.html b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/contents.html new file mode 100644 index 00000000..1231e6d2 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/contents.html @@ -0,0 +1,678 @@ + + + +Lua 5.4 Reference Manual - contents + + + + + + + +

+Lua +Lua 5.4 Reference Manual +

+ +

+The reference manual is the official definition of the Lua language. +
+For a complete introduction to Lua programming, see the book +Programming in Lua. + +

+ +

+ +Copyright © 2020–2023 Lua.org, PUC-Rio. +Freely available under the terms of the +Lua license. + + +

Contents

+ + +

Index

+ + + + + + + + + + + + + + diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/index.css b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/index.css new file mode 100644 index 00000000..c9618357 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/index.css @@ -0,0 +1,21 @@ +ul { + list-style-type: none ; +} + +ul.contents { + padding: 0 ; +} + +table { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +td { + vertical-align: top ; + padding: 0 ; + text-align: left ; + line-height: 1.25 ; + width: 15% ; +} diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/logo.gif b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/logo.gif new file mode 100644 index 00000000..5c77eacc Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/logo.gif differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/lua.1 b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/lua.1 new file mode 100644 index 00000000..3f472fd8 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/lua.1 @@ -0,0 +1,155 @@ +.\" $Id: lua.man,v 1.14 2022/09/23 09:06:36 lhf Exp $ +.TH LUA 1 "$Date: 2022/09/23 09:06:36 $" +.SH NAME +lua \- Lua interpreter +.SH SYNOPSIS +.B lua +[ +.I options +] +[ +.I script +[ +.I args +] +] +.SH DESCRIPTION +.B lua +is the standalone Lua interpreter. +It loads and executes Lua programs, +either in textual source form or +in precompiled binary form. +(Precompiled binaries are output by +.BR luac , +the Lua compiler.) +.B lua +can be used as a batch interpreter and also interactively. +.LP +After handling the +.IR options , +the Lua program in file +.I script +is loaded and executed. +The +.I args +are available to +.I script +as strings in a global table named +.B arg +and also as arguments to its main function. +When called without arguments, +.B lua +behaves as +.B "lua \-v \-i" +if the standard input is a terminal, +and as +.B "lua \-" +otherwise. +.LP +In interactive mode, +.B lua +prompts the user, +reads lines from the standard input, +and executes them as they are read. +If the line contains an expression, +then the line is evaluated and the result is printed. +If a line does not contain a complete statement, +then a secondary prompt is displayed and +lines are read until a complete statement is formed or +a syntax error is found. +.LP +Before handling command line options and scripts, +.B lua +checks the contents of the environment variables +.B LUA_INIT_5_4 +and +.BR LUA_INIT , +in that order. +If the contents are of the form +.RI '@ filename ', +then +.I filename +is executed. +Otherwise, the contents are assumed to be a Lua statement and is executed. +When +.B LUA_INIT_5_4 +is defined, +.B LUA_INIT +is ignored. +.SH OPTIONS +.TP +.BI \-e " stat" +execute statement +.IR stat . +.TP +.B \-i +enter interactive mode after executing +.IR script . +.TP +.BI \-l " mod" +require library +.I mod +into global +.IR mod . +.TP +.BI \-l " g=mod" +require library +.I mod +into global +.IR g . +.TP +.B \-v +show version information. +.TP +.B \-E +ignore environment variables. +.TP +.B \-W +turn warnings on. +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and execute the standard input as a file. +.SH ENVIRONMENT VARIABLES +The following environment variables affect the execution of +.BR lua . +When defined, +the version-specific variants take priority +and the version-neutral variants are ignored. +.TP +.B LUA_INIT, LUA_INIT_5_4 +Code to be executed before command line options and scripts. +.TP +.B LUA_PATH, LUA_PATH_5_4 +Initial value of package.cpath, +the path used by require to search for Lua loaders. +.TP +.B LUA_CPATH, LUA_CPATH_5_4 +Initial value of package.cpath, +the path used by require to search for C loaders. +.SH EXIT STATUS +If a script calls os.exit, +then +.B lua +exits with the given exit status. +Otherwise, +.B lua +exits +with EXIT_SUCCESS (0 on POSIX systems) if there were no errors +and +with EXIT_FAILURE (1 on POSIX systems) if there were errors. +Errors raised in interactive mode do not cause exits. +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH "SEE ALSO" +.BR luac (1) +.br +The documentation at lua.org, +especially section 7 of the reference manual. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +W. Celes +.\" EOF diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/lua.css b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/lua.css new file mode 100644 index 00000000..cbd0799d --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/lua.css @@ -0,0 +1,161 @@ +html { + background-color: #F8F8F8 ; +} + +body { + background-color: #FFFFFF ; + color: #000000 ; + font-family: Helvetica, Arial, sans-serif ; + text-align: justify ; + line-height: 1.25 ; + margin: 16px auto ; + padding: 32px ; + border: solid #ccc 1px ; + border-radius: 20px ; + max-width: 70em ; + width: 90% ; +} + +h1, h2, h3, h4 { + color: #000080 ; + font-family: Verdana, Geneva, sans-serif ; + font-weight: normal ; + font-style: normal ; + text-align: left ; +} + +h1 { + font-size: 28pt ; +} + +h1 img { + vertical-align: text-bottom ; +} + +h2:before { + content: "\2756" ; + padding-right: 0.5em ; +} + +a { + text-decoration: none ; +} + +a:link { + color: #000080 ; +} + +a:link:hover, a:visited:hover { + background-color: #D0D0FF ; + color: #000080 ; + border-radius: 4px ; +} + +a:link:active, a:visited:active { + color: #FF0000 ; +} + +div.menubar { + padding-bottom: 0.5em ; +} + +p.menubar { + margin-left: 2.5em ; +} + +.menubar a:hover { + margin: -3px -3px -3px -3px ; + padding: 3px 3px 3px 3px ; + border-radius: 4px ; +} + +:target { + background-color: #F0F0F0 ; + margin: -8px ; + padding: 8px ; + border-radius: 8px ; + outline: none ; +} + +hr { + display: none ; +} + +table hr { + background-color: #a0a0a0 ; + color: #a0a0a0 ; + border: 0 ; + height: 1px ; + display: block ; +} + +.footer { + color: gray ; + font-size: x-small ; + text-transform: lowercase ; +} + +input[type=text] { + border: solid #a0a0a0 2px ; + border-radius: 2em ; + background-image: url('images/search.png') ; + background-repeat: no-repeat ; + background-position: 4px center ; + padding-left: 20px ; + height: 2em ; +} + +pre.session { + background-color: #F8F8F8 ; + padding: 1em ; + border-radius: 8px ; +} + +table { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +td { + padding: 0 ; + margin: 0 ; +} + +td.gutter { + width: 4% ; +} + +table.columns td { + vertical-align: top ; + padding-bottom: 1em ; + text-align: justify ; + line-height: 1.25 ; +} + +table.book td { + vertical-align: top ; +} + +table.book td.cover { + padding-right: 1em ; +} + +table.book img { + border: solid #000080 1px ; +} + +table.book span { + font-size: small ; + text-align: left ; + display: block ; + margin-top: 0.25em ; +} + +p.logos a:link:hover, p.logos a:visited:hover { + background-color: inherit ; +} + +img { + background-color: white ; +} diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/luac.1 b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/luac.1 similarity index 56% rename from Sources/backend-cpp/Vendor/lua-5.1.5/doc/luac.1 rename to Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/luac.1 index d8146782..33a4ed00 100644 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/luac.1 +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/luac.1 @@ -1,5 +1,5 @@ -.\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $ -.TH LUAC 1 "$Date: 2006/01/06 16:03:34 $" +.\" $Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp $ +.TH LUAC 1 "$Date: 2011/11/16 13:53:40 $" .SH NAME luac \- Lua compiler .SH SYNOPSIS @@ -13,29 +13,29 @@ luac \- Lua compiler .B luac is the Lua compiler. It translates programs written in the Lua programming language -into binary files that can be later loaded and executed. +into binary files containing precompiled chunks +that can be later loaded and executed. .LP The main advantages of precompiling chunks are: faster loading, protecting source code from accidental user changes, and off-line syntax checking. -.LP -Pre-compiling does not imply faster execution +Precompiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. .B luac simply allows those bytecodes to be saved in a file for later execution. +Precompiled chunks are not necessarily smaller than the corresponding source. +The main goal in precompiling is faster loading. .LP -Pre-compiled chunks are not necessarily smaller than the corresponding source. -The main goal in pre-compiling is faster loading. -.LP -The binary files created by -.B luac -are portable only among architectures with the same word size and byte order. -.LP +In the command line, +you can mix +text files containing Lua source and +binary files containing precompiled chunks. .B luac -produces a single output file containing the bytecodes -for all source files given. +produces a single output file containing the combined bytecodes +for all files given. +Executing the combined file is equivalent to executing the given files. By default, the output file is named .BR luac.out , @@ -43,32 +43,15 @@ but you can change this with the .B \-o option. .LP -In the command line, -you can mix -text files containing Lua source and -binary files containing precompiled chunks. -This is useful to combine several precompiled chunks, -even from different (but compatible) platforms, -into a single precompiled chunk. -.LP -You can use -.B "'\-'" -to indicate the standard input as a source file -and -.B "'\--'" -to signal the end of options -(that is, -all remaining arguments will be treated as files even if they start with -.BR "'\-'" ). -.LP -The internal format of the binary files produced by -.B luac +Precompiled chunks are +.I not +portable across different architectures. +Moreover, +the internal format of precompiled chunks is likely to change when a new version of Lua is released. -So, -save the source files of all Lua programs that you precompile. +Make sure you save the source files of all Lua programs that you precompile. .LP .SH OPTIONS -Options must be separate. .TP .B \-l produce a listing of the compiled bytecode for Lua's virtual machine. @@ -78,6 +61,9 @@ If no files are given, then loads .B luac.out and lists its contents. +Use +.B \-l \-l +for a full listing. .TP .BI \-o " file" output to @@ -88,7 +74,7 @@ instead of the default .B "'\-'" for standard output, but not on platforms that open standard output in text mode.) -The output file may be a source file because +The output file may be one of the given files because all files are loaded before the output file is written. Be careful not to overwrite precious files. .TP @@ -96,41 +82,37 @@ Be careful not to overwrite precious files. load files but do not generate any output file. Used mainly for syntax checking and for testing precompiled chunks: corrupted files will probably generate errors when loaded. -Lua always performs a thorough integrity test on precompiled chunks. -Bytecode that passes this test is completely safe, -in the sense that it will not break the interpreter. -However, -there is no guarantee that such code does anything sensible. -(None can be given, because the halting problem is unsolvable.) If no files are given, then .B luac loads .B luac.out and tests its contents. -No messages are displayed if the file passes the integrity test. +No messages are displayed if the file loads without errors. .TP .B \-s strip debug information before writing the output file. This saves some space in very large chunks, but if errors occur when running a stripped chunk, then the error messages may not contain the full information they usually do. -For instance, +In particular, line numbers and names of local variables are lost. .TP .B \-v show version information. -.SH FILES -.TP 15 -.B luac.out -default output file +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and process standard input. .SH "SEE ALSO" .BR lua (1) .br -http://www.lua.org/ +The documentation at lua.org. .SH DIAGNOSTICS Error messages should be self explanatory. .SH AUTHORS +R. Ierusalimschy, L. H. de Figueiredo, -R. Ierusalimschy and W. Celes .\" EOF diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/manual.css b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/manual.css similarity index 60% rename from Sources/backend-cpp/Vendor/lua-5.1.5/doc/manual.css rename to Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/manual.css index b49b3629..aa0e677d 100644 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/doc/manual.css +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/manual.css @@ -8,17 +8,14 @@ pre, code { } span.apii { + color: gray ; float: right ; font-family: inherit ; font-style: normal ; font-size: small ; - color: gray ; } -p+h1, ul+h1 { - padding-top: 0.4em ; - padding-bottom: 0.4em ; - padding-left: 30px ; - margin-left: -30px ; - background-color: #E0E0FF ; +h2:before { + content: "" ; + padding-right: 0em ; } diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/manual.html b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/manual.html new file mode 100644 index 00000000..0af688b3 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/manual.html @@ -0,0 +1,12046 @@ + + + +Lua 5.4 Reference Manual + + + + + + + +

+Lua +Lua 5.4 Reference Manual +

+ +

+by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes + +

+ +Copyright © 2020–2023 Lua.org, PUC-Rio. +Freely available under the terms of the +Lua license. + + +

+ + +

+ + + + + + +

1 – Introduction

+ +

+Lua is a powerful, efficient, lightweight, embeddable scripting language. +It supports procedural programming, +object-oriented programming, functional programming, +data-driven programming, and data description. + + +

+Lua combines simple procedural syntax with powerful data description +constructs based on associative arrays and extensible semantics. +Lua is dynamically typed, +runs by interpreting bytecode with a register-based +virtual machine, +and has automatic memory management with +a generational garbage collection, +making it ideal for configuration, scripting, +and rapid prototyping. + + +

+Lua is implemented as a library, written in clean C, +the common subset of standard C and C++. +The Lua distribution includes a host program called lua, +which uses the Lua library to offer a complete, +standalone Lua interpreter, +for interactive or batch use. +Lua is intended to be used both as a powerful, lightweight, +embeddable scripting language for any program that needs one, +and as a powerful but lightweight and efficient stand-alone language. + + +

+As an extension language, Lua has no notion of a "main" program: +it works embedded in a host client, +called the embedding program or simply the host. +(Frequently, this host is the stand-alone lua program.) +The host program can invoke functions to execute a piece of Lua code, +can write and read Lua variables, +and can register C functions to be called by Lua code. +Through the use of C functions, Lua can be augmented to cope with +a wide range of different domains, +thus creating customized programming languages sharing a syntactical framework. + + +

+Lua is free software, +and is provided as usual with no guarantees, +as stated in its license. +The implementation described in this manual is available +at Lua's official web site, www.lua.org. + + +

+Like any other reference manual, +this document is dry in places. +For a discussion of the decisions behind the design of Lua, +see the technical papers available at Lua's web site. +For a detailed introduction to programming in Lua, +see Roberto's book, Programming in Lua. + + + +

2 – Basic Concepts

+ + + +

+This section describes the basic concepts of the language. + + + + + +

2.1 – Values and Types

+ +

+Lua is a dynamically typed language. +This means that +variables do not have types; only values do. +There are no type definitions in the language. +All values carry their own type. + + +

+All values in Lua are first-class values. +This means that all values can be stored in variables, +passed as arguments to other functions, and returned as results. + + +

+There are eight basic types in Lua: +nil, boolean, number, +string, function, userdata, +thread, and table. +The type nil has one single value, nil, +whose main property is to be different from any other value; +it often represents the absence of a useful value. +The type boolean has two values, false and true. +Both nil and false make a condition false; +they are collectively called false values. +Any other value makes a condition true. +Despite its name, +false is frequently used as an alternative to nil, +with the key difference that false behaves +like a regular value in a table, +while a nil in a table represents an absent key. + + +

+The type number represents both +integer numbers and real (floating-point) numbers, +using two subtypes: integer and float. +Standard Lua uses 64-bit integers and double-precision (64-bit) floats, +but you can also compile Lua so that it +uses 32-bit integers and/or single-precision (32-bit) floats. +The option with 32 bits for both integers and floats +is particularly attractive +for small machines and embedded systems. +(See macro LUA_32BITS in file luaconf.h.) + + +

+Unless stated otherwise, +any overflow when manipulating integer values wrap around, +according to the usual rules of two-complement arithmetic. +(In other words, +the actual result is the unique representable integer +that is equal modulo 2n to the mathematical result, +where n is the number of bits of the integer type.) + + +

+Lua has explicit rules about when each subtype is used, +but it also converts between them automatically as needed (see §3.4.3). +Therefore, +the programmer may choose to mostly ignore the difference +between integers and floats +or to assume complete control over the representation of each number. + + +

+The type string represents immutable sequences of bytes. + +Lua is 8-bit clean: +strings can contain any 8-bit value, +including embedded zeros ('\0'). +Lua is also encoding-agnostic; +it makes no assumptions about the contents of a string. +The length of any string in Lua must fit in a Lua integer. + + +

+Lua can call (and manipulate) functions written in Lua and +functions written in C (see §3.4.10). +Both are represented by the type function. + + +

+The type userdata is provided to allow arbitrary C data to +be stored in Lua variables. +A userdata value represents a block of raw memory. +There are two kinds of userdata: +full userdata, +which is an object with a block of memory managed by Lua, +and light userdata, +which is simply a C pointer value. +Userdata has no predefined operations in Lua, +except assignment and identity test. +By using metatables, +the programmer can define operations for full userdata values +(see §2.4). +Userdata values cannot be created or modified in Lua, +only through the C API. +This guarantees the integrity of data owned by +the host program and C libraries. + + +

+The type thread represents independent threads of execution +and it is used to implement coroutines (see §2.6). +Lua threads are not related to operating-system threads. +Lua supports coroutines on all systems, +even those that do not support threads natively. + + +

+The type table implements associative arrays, +that is, arrays that can have as indices not only numbers, +but any Lua value except nil and NaN. +(Not a Number is a special floating-point value +used by the IEEE 754 standard to represent +undefined numerical results, such as 0/0.) +Tables can be heterogeneous; +that is, they can contain values of all types (except nil). +Any key associated to the value nil is not considered part of the table. +Conversely, any key that is not part of a table has +an associated value nil. + + +

+Tables are the sole data-structuring mechanism in Lua; +they can be used to represent ordinary arrays, lists, +symbol tables, sets, records, graphs, trees, etc. +To represent records, Lua uses the field name as an index. +The language supports this representation by +providing a.name as syntactic sugar for a["name"]. +There are several convenient ways to create tables in Lua +(see §3.4.9). + + +

+Like indices, +the values of table fields can be of any type. +In particular, +because functions are first-class values, +table fields can contain functions. +Thus tables can also carry methods (see §3.4.11). + + +

+The indexing of tables follows +the definition of raw equality in the language. +The expressions a[i] and a[j] +denote the same table element +if and only if i and j are raw equal +(that is, equal without metamethods). +In particular, floats with integral values +are equal to their respective integers +(e.g., 1.0 == 1). +To avoid ambiguities, +any float used as a key that is equal to an integer +is converted to that integer. +For instance, if you write a[2.0] = true, +the actual key inserted into the table will be the integer 2. + + +

+Tables, functions, threads, and (full) userdata values are objects: +variables do not actually contain these values, +only references to them. +Assignment, parameter passing, and function returns +always manipulate references to such values; +these operations do not imply any kind of copy. + + +

+The library function type returns a string describing the type +of a given value (see type). + + + + + +

2.2 – Environments and the Global Environment

+ +

+As we will discuss further in §3.2 and §3.3.3, +any reference to a free name +(that is, a name not bound to any declaration) var +is syntactically translated to _ENV.var. +Moreover, every chunk is compiled in the scope of +an external local variable named _ENV (see §3.3.2), +so _ENV itself is never a free name in a chunk. + + +

+Despite the existence of this external _ENV variable and +the translation of free names, +_ENV is a completely regular name. +In particular, +you can define new variables and parameters with that name. +Each reference to a free name uses the _ENV that is +visible at that point in the program, +following the usual visibility rules of Lua (see §3.5). + + +

+Any table used as the value of _ENV is called an environment. + + +

+Lua keeps a distinguished environment called the global environment. +This value is kept at a special index in the C registry (see §4.3). +In Lua, the global variable _G is initialized with this same value. +(_G is never used internally, +so changing its value will affect only your own code.) + + +

+When Lua loads a chunk, +the default value for its _ENV variable +is the global environment (see load). +Therefore, by default, +free names in Lua code refer to entries in the global environment +and, therefore, they are also called global variables. +Moreover, all standard libraries are loaded in the global environment +and some functions there operate on that environment. +You can use load (or loadfile) +to load a chunk with a different environment. +(In C, you have to load the chunk and then change the value +of its first upvalue; see lua_setupvalue.) + + + + + +

2.3 – Error Handling

+ +

+Several operations in Lua can raise an error. +An error interrupts the normal flow of the program, +which can continue by catching the error. + + +

+Lua code can explicitly raise an error by calling the +error function. +(This function never returns.) + + +

+To catch errors in Lua, +you can do a protected call, +using pcall (or xpcall). +The function pcall calls a given function in protected mode. +Any error while running the function stops its execution, +and control returns immediately to pcall, +which returns a status code. + + +

+Because Lua is an embedded extension language, +Lua code starts running by a call +from C code in the host program. +(When you use Lua standalone, +the lua application is the host program.) +Usually, this call is protected; +so, when an otherwise unprotected error occurs during +the compilation or execution of a Lua chunk, +control returns to the host, +which can take appropriate measures, +such as printing an error message. + + +

+Whenever there is an error, +an error object +is propagated with information about the error. +Lua itself only generates errors whose error object is a string, +but programs may generate errors with +any value as the error object. +It is up to the Lua program or its host to handle such error objects. +For historical reasons, +an error object is often called an error message, +even though it does not have to be a string. + + +

+When you use xpcall (or lua_pcall, in C) +you may give a message handler +to be called in case of errors. +This function is called with the original error object +and returns a new error object. +It is called before the error unwinds the stack, +so that it can gather more information about the error, +for instance by inspecting the stack and creating a stack traceback. +This message handler is still protected by the protected call; +so, an error inside the message handler +will call the message handler again. +If this loop goes on for too long, +Lua breaks it and returns an appropriate message. +The message handler is called only for regular runtime errors. +It is not called for memory-allocation errors +nor for errors while running finalizers or other message handlers. + + +

+Lua also offers a system of warnings (see warn). +Unlike errors, warnings do not interfere +in any way with program execution. +They typically only generate a message to the user, +although this behavior can be adapted from C (see lua_setwarnf). + + + + + +

2.4 – Metatables and Metamethods

+ +

+Every value in Lua can have a metatable. +This metatable is an ordinary Lua table +that defines the behavior of the original value +under certain events. +You can change several aspects of the behavior +of a value by setting specific fields in its metatable. +For instance, when a non-numeric value is the operand of an addition, +Lua checks for a function in the field __add of the value's metatable. +If it finds one, +Lua calls this function to perform the addition. + + +

+The key for each event in a metatable is a string +with the event name prefixed by two underscores; +the corresponding value is called a metavalue. +For most events, the metavalue must be a function, +which is then called a metamethod. +In the previous example, the key is the string "__add" +and the metamethod is the function that performs the addition. +Unless stated otherwise, +a metamethod may in fact be any callable value, +which is either a function or a value with a __call metamethod. + + +

+You can query the metatable of any value +using the getmetatable function. +Lua queries metamethods in metatables using a raw access (see rawget). + + +

+You can replace the metatable of tables +using the setmetatable function. +You cannot change the metatable of other types from Lua code, +except by using the debug library (§6.10). + + +

+Tables and full userdata have individual metatables, +although multiple tables and userdata can share their metatables. +Values of all other types share one single metatable per type; +that is, there is one single metatable for all numbers, +one for all strings, etc. +By default, a value has no metatable, +but the string library sets a metatable for the string type (see §6.4). + + +

+A detailed list of operations controlled by metatables is given next. +Each event is identified by its corresponding key. +By convention, all metatable keys used by Lua are composed by +two underscores followed by lowercase Latin letters. + + + +

    + +
  • __add: +the addition (+) operation. +If any operand for an addition is not a number, +Lua will try to call a metamethod. +It starts by checking the first operand (even if it is a number); +if that operand does not define a metamethod for __add, +then Lua will check the second operand. +If Lua can find a metamethod, +it calls the metamethod with the two operands as arguments, +and the result of the call +(adjusted to one value) +is the result of the operation. +Otherwise, if no metamethod is found, +Lua raises an error. +
  • + +
  • __sub: +the subtraction (-) operation. +Behavior similar to the addition operation. +
  • + +
  • __mul: +the multiplication (*) operation. +Behavior similar to the addition operation. +
  • + +
  • __div: +the division (/) operation. +Behavior similar to the addition operation. +
  • + +
  • __mod: +the modulo (%) operation. +Behavior similar to the addition operation. +
  • + +
  • __pow: +the exponentiation (^) operation. +Behavior similar to the addition operation. +
  • + +
  • __unm: +the negation (unary -) operation. +Behavior similar to the addition operation. +
  • + +
  • __idiv: +the floor division (//) operation. +Behavior similar to the addition operation. +
  • + +
  • __band: +the bitwise AND (&) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod +if any operand is neither an integer +nor a float coercible to an integer (see §3.4.3). +
  • + +
  • __bor: +the bitwise OR (|) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __bxor: +the bitwise exclusive OR (binary ~) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __bnot: +the bitwise NOT (unary ~) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __shl: +the bitwise left shift (<<) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __shr: +the bitwise right shift (>>) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __concat: +the concatenation (..) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod +if any operand is neither a string nor a number +(which is always coercible to a string). +
  • + +
  • __len: +the length (#) operation. +If the object is not a string, +Lua will try its metamethod. +If there is a metamethod, +Lua calls it with the object as argument, +and the result of the call +(always adjusted to one value) +is the result of the operation. +If there is no metamethod but the object is a table, +then Lua uses the table length operation (see §3.4.7). +Otherwise, Lua raises an error. +
  • + +
  • __eq: +the equal (==) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod only when the values +being compared are either both tables or both full userdata +and they are not primitively equal. +The result of the call is always converted to a boolean. +
  • + +
  • __lt: +the less than (<) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod only when the values +being compared are neither both numbers nor both strings. +Moreover, the result of the call is always converted to a boolean. +
  • + +
  • __le: +the less equal (<=) operation. +Behavior similar to the less than operation. +
  • + +
  • __index: +The indexing access operation table[key]. +This event happens when table is not a table or +when key is not present in table. +The metavalue is looked up in the metatable of table. + + +

    +The metavalue for this event can be either a function, a table, +or any value with an __index metavalue. +If it is a function, +it is called with table and key as arguments, +and the result of the call +(adjusted to one value) +is the result of the operation. +Otherwise, +the final result is the result of indexing this metavalue with key. +This indexing is regular, not raw, +and therefore can trigger another __index metavalue. +

  • + +
  • __newindex: +The indexing assignment table[key] = value. +Like the index event, +this event happens when table is not a table or +when key is not present in table. +The metavalue is looked up in the metatable of table. + + +

    +Like with indexing, +the metavalue for this event can be either a function, a table, +or any value with an __newindex metavalue. +If it is a function, +it is called with table, key, and value as arguments. +Otherwise, +Lua repeats the indexing assignment over this metavalue +with the same key and value. +This assignment is regular, not raw, +and therefore can trigger another __newindex metavalue. + + +

    +Whenever a __newindex metavalue is invoked, +Lua does not perform the primitive assignment. +If needed, +the metamethod itself can call rawset +to do the assignment. +

  • + +
  • __call: +The call operation func(args). +This event happens when Lua tries to call a non-function value +(that is, func is not a function). +The metamethod is looked up in func. +If present, +the metamethod is called with func as its first argument, +followed by the arguments of the original call (args). +All results of the call +are the results of the operation. +This is the only metamethod that allows multiple results. +
  • + +
+ +

+In addition to the previous list, +the interpreter also respects the following keys in metatables: +__gc (see §2.5.3), +__close (see §3.3.8), +__mode (see §2.5.4), +and __name. +(The entry __name, +when it contains a string, +may be used by tostring and in error messages.) + + +

+For the unary operators (negation, length, and bitwise NOT), +the metamethod is computed and called with a dummy second operand, +equal to the first one. +This extra operand is only to simplify Lua's internals +(by making these operators behave like a binary operation) +and may be removed in future versions. +For most uses this extra operand is irrelevant. + + +

+Because metatables are regular tables, +they can contain arbitrary fields, +not only the event names defined above. +Some functions in the standard library +(e.g., tostring) +use other fields in metatables for their own purposes. + + +

+It is a good practice to add all needed metamethods to a table +before setting it as a metatable of some object. +In particular, the __gc metamethod works only when this order +is followed (see §2.5.3). +It is also a good practice to set the metatable of an object +right after its creation. + + + + + +

2.5 – Garbage Collection

+ + + +

+Lua performs automatic memory management. +This means that +you do not have to worry about allocating memory for new objects +or freeing it when the objects are no longer needed. +Lua manages memory automatically by running +a garbage collector to collect all dead objects. +All memory used by Lua is subject to automatic management: +strings, tables, userdata, functions, threads, internal structures, etc. + + +

+An object is considered dead +as soon as the collector can be sure the object +will not be accessed again in the normal execution of the program. +("Normal execution" here excludes finalizers, +which can resurrect dead objects (see §2.5.3), +and excludes also operations using the debug library.) +Note that the time when the collector can be sure that an object +is dead may not coincide with the programmer's expectations. +The only guarantees are that Lua will not collect an object +that may still be accessed in the normal execution of the program, +and it will eventually collect an object +that is inaccessible from Lua. +(Here, +inaccessible from Lua means that neither a variable nor +another live object refer to the object.) +Because Lua has no knowledge about C code, +it never collects objects accessible through the registry (see §4.3), +which includes the global environment (see §2.2). + + +

+The garbage collector (GC) in Lua can work in two modes: +incremental and generational. + + +

+The default GC mode with the default parameters +are adequate for most uses. +However, programs that waste a large proportion of their time +allocating and freeing memory can benefit from other settings. +Keep in mind that the GC behavior is non-portable +both across platforms and across different Lua releases; +therefore, optimal settings are also non-portable. + + +

+You can change the GC mode and parameters by calling +lua_gc in C +or collectgarbage in Lua. +You can also use these functions to control +the collector directly (e.g., to stop and restart it). + + + + + +

2.5.1 – Incremental Garbage Collection

+ +

+In incremental mode, +each GC cycle performs a mark-and-sweep collection in small steps +interleaved with the program's execution. +In this mode, +the collector uses three numbers to control its garbage-collection cycles: +the garbage-collector pause, +the garbage-collector step multiplier, +and the garbage-collector step size. + + +

+The garbage-collector pause +controls how long the collector waits before starting a new cycle. +The collector starts a new cycle when the use of memory +hits n% of the use after the previous collection. +Larger values make the collector less aggressive. +Values equal to or less than 100 mean the collector will not wait to +start a new cycle. +A value of 200 means that the collector waits for the total memory in use +to double before starting a new cycle. +The default value is 200; the maximum value is 1000. + + +

+The garbage-collector step multiplier +controls the speed of the collector relative to +memory allocation, +that is, +how many elements it marks or sweeps for each +kilobyte of memory allocated. +Larger values make the collector more aggressive but also increase +the size of each incremental step. +You should not use values less than 100, +because they make the collector too slow and +can result in the collector never finishing a cycle. +The default value is 100; the maximum value is 1000. + + +

+The garbage-collector step size controls the +size of each incremental step, +specifically how many bytes the interpreter allocates +before performing a step. +This parameter is logarithmic: +A value of n means the interpreter will allocate 2n +bytes between steps and perform equivalent work during the step. +A large value (e.g., 60) makes the collector a stop-the-world +(non-incremental) collector. +The default value is 13, +which means steps of approximately 8 Kbytes. + + + + + +

2.5.2 – Generational Garbage Collection

+ +

+In generational mode, +the collector does frequent minor collections, +which traverses only objects recently created. +If after a minor collection the use of memory is still above a limit, +the collector does a stop-the-world major collection, +which traverses all objects. +The generational mode uses two parameters: +the minor multiplier and the the major multiplier. + + +

+The minor multiplier controls the frequency of minor collections. +For a minor multiplier x, +a new minor collection will be done when memory +grows x% larger than the memory in use after the previous major +collection. +For instance, for a multiplier of 20, +the collector will do a minor collection when the use of memory +gets 20% larger than the use after the previous major collection. +The default value is 20; the maximum value is 200. + + +

+The major multiplier controls the frequency of major collections. +For a major multiplier x, +a new major collection will be done when memory +grows x% larger than the memory in use after the previous major +collection. +For instance, for a multiplier of 100, +the collector will do a major collection when the use of memory +gets larger than twice the use after the previous collection. +The default value is 100; the maximum value is 1000. + + + + + +

2.5.3 – Garbage-Collection Metamethods

+ +

+You can set garbage-collector metamethods for tables +and, using the C API, +for full userdata (see §2.4). +These metamethods, called finalizers, +are called when the garbage collector detects that the +corresponding table or userdata is dead. +Finalizers allow you to coordinate Lua's garbage collection +with external resource management such as closing files, +network or database connections, +or freeing your own memory. + + +

+For an object (table or userdata) to be finalized when collected, +you must mark it for finalization. + +You mark an object for finalization when you set its metatable +and the metatable has a __gc metamethod. +Note that if you set a metatable without a __gc field +and later create that field in the metatable, +the object will not be marked for finalization. + + +

+When a marked object becomes dead, +it is not collected immediately by the garbage collector. +Instead, Lua puts it in a list. +After the collection, +Lua goes through that list. +For each object in the list, +it checks the object's __gc metamethod: +If it is present, +Lua calls it with the object as its single argument. + + +

+At the end of each garbage-collection cycle, +the finalizers are called in +the reverse order that the objects were marked for finalization, +among those collected in that cycle; +that is, the first finalizer to be called is the one associated +with the object marked last in the program. +The execution of each finalizer may occur at any point during +the execution of the regular code. + + +

+Because the object being collected must still be used by the finalizer, +that object (and other objects accessible only through it) +must be resurrected by Lua. +Usually, this resurrection is transient, +and the object memory is freed in the next garbage-collection cycle. +However, if the finalizer stores the object in some global place +(e.g., a global variable), +then the resurrection is permanent. +Moreover, if the finalizer marks a finalizing object for finalization again, +its finalizer will be called again in the next cycle where the +object is dead. +In any case, +the object memory is freed only in a GC cycle where +the object is dead and not marked for finalization. + + +

+When you close a state (see lua_close), +Lua calls the finalizers of all objects marked for finalization, +following the reverse order that they were marked. +If any finalizer marks objects for collection during that phase, +these marks have no effect. + + +

+Finalizers cannot yield nor run the garbage collector. +Because they can run in unpredictable times, +it is good practice to restrict each finalizer +to the minimum necessary to properly release +its associated resource. + + +

+Any error while running a finalizer generates a warning; +the error is not propagated. + + + + + +

2.5.4 – Weak Tables

+ +

+A weak table is a table whose elements are +weak references. +A weak reference is ignored by the garbage collector. +In other words, +if the only references to an object are weak references, +then the garbage collector will collect that object. + + +

+A weak table can have weak keys, weak values, or both. +A table with weak values allows the collection of its values, +but prevents the collection of its keys. +A table with both weak keys and weak values allows the collection of +both keys and values. +In any case, if either the key or the value is collected, +the whole pair is removed from the table. +The weakness of a table is controlled by the +__mode field of its metatable. +This metavalue, if present, must be one of the following strings: +"k", for a table with weak keys; +"v", for a table with weak values; +or "kv", for a table with both weak keys and values. + + +

+A table with weak keys and strong values +is also called an ephemeron table. +In an ephemeron table, +a value is considered reachable only if its key is reachable. +In particular, +if the only reference to a key comes through its value, +the pair is removed. + + +

+Any change in the weakness of a table may take effect only +at the next collect cycle. +In particular, if you change the weakness to a stronger mode, +Lua may still collect some items from that table +before the change takes effect. + + +

+Only objects that have an explicit construction +are removed from weak tables. +Values, such as numbers and light C functions, +are not subject to garbage collection, +and therefore are not removed from weak tables +(unless their associated values are collected). +Although strings are subject to garbage collection, +they do not have an explicit construction and +their equality is by value; +they behave more like values than like objects. +Therefore, they are not removed from weak tables. + + +

+Resurrected objects +(that is, objects being finalized +and objects accessible only through objects being finalized) +have a special behavior in weak tables. +They are removed from weak values before running their finalizers, +but are removed from weak keys only in the next collection +after running their finalizers, when such objects are actually freed. +This behavior allows the finalizer to access properties +associated with the object through weak tables. + + +

+If a weak table is among the resurrected objects in a collection cycle, +it may not be properly cleared until the next cycle. + + + + + + + +

2.6 – Coroutines

+ +

+Lua supports coroutines, +also called collaborative multithreading. +A coroutine in Lua represents an independent thread of execution. +Unlike threads in multithread systems, however, +a coroutine only suspends its execution by explicitly calling +a yield function. + + +

+You create a coroutine by calling coroutine.create. +Its sole argument is a function +that is the main function of the coroutine. +The create function only creates a new coroutine and +returns a handle to it (an object of type thread); +it does not start the coroutine. + + +

+You execute a coroutine by calling coroutine.resume. +When you first call coroutine.resume, +passing as its first argument +a thread returned by coroutine.create, +the coroutine starts its execution by +calling its main function. +Extra arguments passed to coroutine.resume are passed +as arguments to that function. +After the coroutine starts running, +it runs until it terminates or yields. + + +

+A coroutine can terminate its execution in two ways: +normally, when its main function returns +(explicitly or implicitly, after the last instruction); +and abnormally, if there is an unprotected error. +In case of normal termination, +coroutine.resume returns true, +plus any values returned by the coroutine main function. +In case of errors, coroutine.resume returns false +plus the error object. +In this case, the coroutine does not unwind its stack, +so that it is possible to inspect it after the error +with the debug API. + + +

+A coroutine yields by calling coroutine.yield. +When a coroutine yields, +the corresponding coroutine.resume returns immediately, +even if the yield happens inside nested function calls +(that is, not in the main function, +but in a function directly or indirectly called by the main function). +In the case of a yield, coroutine.resume also returns true, +plus any values passed to coroutine.yield. +The next time you resume the same coroutine, +it continues its execution from the point where it yielded, +with the call to coroutine.yield returning any extra +arguments passed to coroutine.resume. + + +

+Like coroutine.create, +the coroutine.wrap function also creates a coroutine, +but instead of returning the coroutine itself, +it returns a function that, when called, resumes the coroutine. +Any arguments passed to this function +go as extra arguments to coroutine.resume. +coroutine.wrap returns all the values returned by coroutine.resume, +except the first one (the boolean error code). +Unlike coroutine.resume, +the function created by coroutine.wrap +propagates any error to the caller. +In this case, +the function also closes the coroutine (see coroutine.close). + + +

+As an example of how coroutines work, +consider the following code: + +

+     function foo (a)
+       print("foo", a)
+       return coroutine.yield(2*a)
+     end
+     
+     co = coroutine.create(function (a,b)
+           print("co-body", a, b)
+           local r = foo(a+1)
+           print("co-body", r)
+           local r, s = coroutine.yield(a+b, a-b)
+           print("co-body", r, s)
+           return b, "end"
+     end)
+     
+     print("main", coroutine.resume(co, 1, 10))
+     print("main", coroutine.resume(co, "r"))
+     print("main", coroutine.resume(co, "x", "y"))
+     print("main", coroutine.resume(co, "x", "y"))
+

+When you run it, it produces the following output: + +

+     co-body 1       10
+     foo     2
+     main    true    4
+     co-body r
+     main    true    11      -9
+     co-body x       y
+     main    true    10      end
+     main    false   cannot resume dead coroutine
+
+ +

+You can also create and manipulate coroutines through the C API: +see functions lua_newthread, lua_resume, +and lua_yield. + + + + + +

3 – The Language

+ + + +

+This section describes the lexis, the syntax, and the semantics of Lua. +In other words, +this section describes +which tokens are valid, +how they can be combined, +and what their combinations mean. + + +

+Language constructs will be explained using the usual extended BNF notation, +in which +{a} means 0 or more a's, and +[a] means an optional a. +Non-terminals are shown like non-terminal, +keywords are shown like kword, +and other terminal symbols are shown like ‘=’. +The complete syntax of Lua can be found in §9 +at the end of this manual. + + + + + +

3.1 – Lexical Conventions

+ +

+Lua is a free-form language. +It ignores spaces and comments between lexical elements (tokens), +except as delimiters between two tokens. +In source code, +Lua recognizes as spaces the standard ASCII whitespace +characters space, form feed, newline, +carriage return, horizontal tab, and vertical tab. + + +

+Names +(also called identifiers) +in Lua can be any string of Latin letters, +Arabic-Indic digits, and underscores, +not beginning with a digit and +not being a reserved word. +Identifiers are used to name variables, table fields, and labels. + + +

+The following keywords are reserved +and cannot be used as names: + + +

+     and       break     do        else      elseif    end
+     false     for       function  goto      if        in
+     local     nil       not       or        repeat    return
+     then      true      until     while
+
+ +

+Lua is a case-sensitive language: +and is a reserved word, but And and AND +are two different, valid names. +As a convention, +programs should avoid creating +names that start with an underscore followed by +one or more uppercase letters (such as _VERSION). + + +

+The following strings denote other tokens: + +

+     +     -     *     /     %     ^     #
+     &     ~     |     <<    >>    //
+     ==    ~=    <=    >=    <     >     =
+     (     )     {     }     [     ]     ::
+     ;     :     ,     .     ..    ...
+
+ +

+A short literal string +can be delimited by matching single or double quotes, +and can contain the following C-like escape sequences: +'\a' (bell), +'\b' (backspace), +'\f' (form feed), +'\n' (newline), +'\r' (carriage return), +'\t' (horizontal tab), +'\v' (vertical tab), +'\\' (backslash), +'\"' (quotation mark [double quote]), +and '\'' (apostrophe [single quote]). +A backslash followed by a line break +results in a newline in the string. +The escape sequence '\z' skips the following span +of whitespace characters, +including line breaks; +it is particularly useful to break and indent a long literal string +into multiple lines without adding the newlines and spaces +into the string contents. +A short literal string cannot contain unescaped line breaks +nor escapes not forming a valid escape sequence. + + +

+We can specify any byte in a short literal string, +including embedded zeros, +by its numeric value. +This can be done +with the escape sequence \xXX, +where XX is a sequence of exactly two hexadecimal digits, +or with the escape sequence \ddd, +where ddd is a sequence of up to three decimal digits. +(Note that if a decimal escape sequence is to be followed by a digit, +it must be expressed using exactly three digits.) + + +

+The UTF-8 encoding of a Unicode character +can be inserted in a literal string with +the escape sequence \u{XXX} +(with mandatory enclosing braces), +where XXX is a sequence of one or more hexadecimal digits +representing the character code point. +This code point can be any value less than 231. +(Lua uses the original UTF-8 specification here, +which is not restricted to valid Unicode code points.) + + +

+Literal strings can also be defined using a long format +enclosed by long brackets. +We define an opening long bracket of level n as an opening +square bracket followed by n equal signs followed by another +opening square bracket. +So, an opening long bracket of level 0 is written as [[, +an opening long bracket of level 1 is written as [=[, +and so on. +A closing long bracket is defined similarly; +for instance, +a closing long bracket of level 4 is written as ]====]. +A long literal starts with an opening long bracket of any level and +ends at the first closing long bracket of the same level. +It can contain any text except a closing bracket of the same level. +Literals in this bracketed form can run for several lines, +do not interpret any escape sequences, +and ignore long brackets of any other level. +Any kind of end-of-line sequence +(carriage return, newline, carriage return followed by newline, +or newline followed by carriage return) +is converted to a simple newline. +When the opening long bracket is immediately followed by a newline, +the newline is not included in the string. + + +

+As an example, in a system using ASCII +(in which 'a' is coded as 97, +newline is coded as 10, and '1' is coded as 49), +the five literal strings below denote the same string: + +

+     a = 'alo\n123"'
+     a = "alo\n123\""
+     a = '\97lo\10\04923"'
+     a = [[alo
+     123"]]
+     a = [==[
+     alo
+     123"]==]
+
+ +

+Any byte in a literal string not +explicitly affected by the previous rules represents itself. +However, Lua opens files for parsing in text mode, +and the system's file functions may have problems with +some control characters. +So, it is safer to represent +binary data as a quoted literal with +explicit escape sequences for the non-text characters. + + +

+A numeric constant (or numeral) +can be written with an optional fractional part +and an optional decimal exponent, +marked by a letter 'e' or 'E'. +Lua also accepts hexadecimal constants, +which start with 0x or 0X. +Hexadecimal constants also accept an optional fractional part +plus an optional binary exponent, +marked by a letter 'p' or 'P' and written in decimal. +(For instance, 0x1.fp10 denotes 1984, +which is 0x1f / 16 multiplied by 210.) + + +

+A numeric constant with a radix point or an exponent +denotes a float; +otherwise, +if its value fits in an integer or it is a hexadecimal constant, +it denotes an integer; +otherwise (that is, a decimal integer numeral that overflows), +it denotes a float. +Hexadecimal numerals with neither a radix point nor an exponent +always denote an integer value; +if the value overflows, it wraps around +to fit into a valid integer. + + +

+Examples of valid integer constants are + +

+     3   345   0xff   0xBEBADA
+

+Examples of valid float constants are + +

+     3.0     3.1416     314.16e-2     0.31416E1     34e1
+     0x0.1E  0xA23p-4   0X1.921FB54442D18P+1
+
+ +

+A comment starts with a double hyphen (--) +anywhere outside a string. +If the text immediately after -- is not an opening long bracket, +the comment is a short comment, +which runs until the end of the line. +Otherwise, it is a long comment, +which runs until the corresponding closing long bracket. + + + + + +

3.2 – Variables

+ +

+Variables are places that store values. +There are three kinds of variables in Lua: +global variables, local variables, and table fields. + + +

+A single name can denote a global variable or a local variable +(or a function's formal parameter, +which is a particular kind of local variable): + +

+	var ::= Name
+

+Name denotes identifiers (see §3.1). + + +

+Any variable name is assumed to be global unless explicitly declared +as a local (see §3.3.7). +Local variables are lexically scoped: +local variables can be freely accessed by functions +defined inside their scope (see §3.5). + + +

+Before the first assignment to a variable, its value is nil. + + +

+Square brackets are used to index a table: + +

+	var ::= prefixexp ‘[’ exp ‘]’
+

+The meaning of accesses to table fields can be changed via metatables +(see §2.4). + + +

+The syntax var.Name is just syntactic sugar for +var["Name"]: + +

+	var ::= prefixexp ‘.’ Name
+
+ +

+An access to a global variable x +is equivalent to _ENV.x. +Due to the way that chunks are compiled, +the variable _ENV itself is never global (see §2.2). + + + + + +

3.3 – Statements

+ + + +

+Lua supports an almost conventional set of statements, +similar to those in other conventional languages. +This set includes +blocks, assignments, control structures, function calls, +and variable declarations. + + + + + +

3.3.1 – Blocks

+ +

+A block is a list of statements, +which are executed sequentially: + +

+	block ::= {stat}
+

+Lua has empty statements +that allow you to separate statements with semicolons, +start a block with a semicolon +or write two semicolons in sequence: + +

+	stat ::= ‘;’
+
+ +

+Both function calls and assignments +can start with an open parenthesis. +This possibility leads to an ambiguity in Lua's grammar. +Consider the following fragment: + +

+     a = b + c
+     (print or io.write)('done')
+

+The grammar could see this fragment in two ways: + +

+     a = b + c(print or io.write)('done')
+     
+     a = b + c; (print or io.write)('done')
+

+The current parser always sees such constructions +in the first way, +interpreting the open parenthesis +as the start of the arguments to a call. +To avoid this ambiguity, +it is a good practice to always precede with a semicolon +statements that start with a parenthesis: + +

+     ;(print or io.write)('done')
+
+ +

+A block can be explicitly delimited to produce a single statement: + +

+	stat ::= do block end
+

+Explicit blocks are useful +to control the scope of variable declarations. +Explicit blocks are also sometimes used to +add a return statement in the middle +of another block (see §3.3.4). + + + + + +

3.3.2 – Chunks

+ +

+The unit of compilation of Lua is called a chunk. +Syntactically, +a chunk is simply a block: + +

+	chunk ::= block
+
+ +

+Lua handles a chunk as the body of an anonymous function +with a variable number of arguments +(see §3.4.11). +As such, chunks can define local variables, +receive arguments, and return values. +Moreover, such anonymous function is compiled as in the +scope of an external local variable called _ENV (see §2.2). +The resulting function always has _ENV as its only external variable, +even if it does not use that variable. + + +

+A chunk can be stored in a file or in a string inside the host program. +To execute a chunk, +Lua first loads it, +precompiling the chunk's code into instructions for a virtual machine, +and then Lua executes the compiled code +with an interpreter for the virtual machine. + + +

+Chunks can also be precompiled into binary form; +see the program luac and the function string.dump for details. +Programs in source and compiled forms are interchangeable; +Lua automatically detects the file type and acts accordingly (see load). + + + + + +

3.3.3 – Assignment

+ +

+Lua allows multiple assignments. +Therefore, the syntax for assignment +defines a list of variables on the left side +and a list of expressions on the right side. +The elements in both lists are separated by commas: + +

+	stat ::= varlist ‘=’ explist
+	varlist ::= var {‘,’ var}
+	explist ::= exp {‘,’ exp}
+

+Expressions are discussed in §3.4. + + +

+Before the assignment, +the list of values is adjusted to the length of +the list of variables (see §3.4.12). + + +

+If a variable is both assigned and read +inside a multiple assignment, +Lua ensures that all reads get the value of the variable +before the assignment. +Thus the code + +

+     i = 3
+     i, a[i] = i+1, 20
+

+sets a[3] to 20, without affecting a[4] +because the i in a[i] is evaluated (to 3) +before it is assigned 4. +Similarly, the line + +

+     x, y = y, x
+

+exchanges the values of x and y, +and + +

+     x, y, z = y, z, x
+

+cyclically permutes the values of x, y, and z. + + +

+Note that this guarantee covers only accesses +syntactically inside the assignment statement. +If a function or a metamethod called during the assignment +changes the value of a variable, +Lua gives no guarantees about the order of that access. + + +

+An assignment to a global name x = val +is equivalent to the assignment +_ENV.x = val (see §2.2). + + +

+The meaning of assignments to table fields and +global variables (which are actually table fields, too) +can be changed via metatables (see §2.4). + + + + + +

3.3.4 – Control Structures

+The control structures +if, while, and repeat have the usual meaning and +familiar syntax: + + + + +

+	stat ::= while exp do block end
+	stat ::= repeat block until exp
+	stat ::= if exp then block {elseif exp then block} [else block] end
+

+Lua also has a for statement, in two flavors (see §3.3.5). + + +

+The condition expression of a +control structure can return any value. +Both false and nil test false. +All values different from nil and false test true. +In particular, the number 0 and the empty string also test true. + + +

+In the repeatuntil loop, +the inner block does not end at the until keyword, +but only after the condition. +So, the condition can refer to local variables +declared inside the loop block. + + +

+The goto statement transfers the program control to a label. +For syntactical reasons, +labels in Lua are considered statements too: + + + +

+	stat ::= goto Name
+	stat ::= label
+	label ::= ‘::’ Name ‘::’
+
+ +

+A label is visible in the entire block where it is defined, +except inside nested functions. +A goto may jump to any visible label as long as it does not +enter into the scope of a local variable. +A label should not be declared +where a label with the same name is visible, +even if this other label has been declared in an enclosing block. + + +

+The break statement terminates the execution of a +while, repeat, or for loop, +skipping to the next statement after the loop: + + +

+	stat ::= break
+

+A break ends the innermost enclosing loop. + + +

+The return statement is used to return values +from a function or a chunk +(which is handled as an anonymous function). + +Functions can return more than one value, +so the syntax for the return statement is + +

+	stat ::= return [explist] [‘;’]
+
+ +

+The return statement can only be written +as the last statement of a block. +If it is necessary to return in the middle of a block, +then an explicit inner block can be used, +as in the idiom do return end, +because now return is the last statement in its (inner) block. + + + + + +

3.3.5 – For Statement

+ +

+ +The for statement has two forms: +one numerical and one generic. + + + +

The numerical for loop

+ +

+The numerical for loop repeats a block of code while a +control variable goes through an arithmetic progression. +It has the following syntax: + +

+	stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
+

+The given identifier (Name) defines the control variable, +which is a new variable local to the loop body (block). + + +

+The loop starts by evaluating once the three control expressions. +Their values are called respectively +the initial value, the limit, and the step. +If the step is absent, it defaults to 1. + + +

+If both the initial value and the step are integers, +the loop is done with integers; +note that the limit may not be an integer. +Otherwise, the three values are converted to +floats and the loop is done with floats. +Beware of floating-point accuracy in this case. + + +

+After that initialization, +the loop body is repeated with the value of the control variable +going through an arithmetic progression, +starting at the initial value, +with a common difference given by the step. +A negative step makes a decreasing sequence; +a step equal to zero raises an error. +The loop continues while the value is less than +or equal to the limit +(greater than or equal to for a negative step). +If the initial value is already greater than the limit +(or less than, if the step is negative), +the body is not executed. + + +

+For integer loops, +the control variable never wraps around; +instead, the loop ends in case of an overflow. + + +

+You should not change the value of the control variable +during the loop. +If you need its value after the loop, +assign it to another variable before exiting the loop. + + + + + +

The generic for loop

+ +

+The generic for statement works over functions, +called iterators. +On each iteration, the iterator function is called to produce a new value, +stopping when this new value is nil. +The generic for loop has the following syntax: + +

+	stat ::= for namelist in explist do block end
+	namelist ::= Name {‘,’ Name}
+

+A for statement like + +

+     for var_1, ···, var_n in explist do body end
+

+works as follows. + + +

+The names var_i declare loop variables local to the loop body. +The first of these variables is the control variable. + + +

+The loop starts by evaluating explist +to produce four values: +an iterator function, +a state, +an initial value for the control variable, +and a closing value. + + +

+Then, at each iteration, +Lua calls the iterator function with two arguments: +the state and the control variable. +The results from this call are then assigned to the loop variables, +following the rules of multiple assignments (see §3.3.3). +If the control variable becomes nil, +the loop terminates. +Otherwise, the body is executed and the loop goes +to the next iteration. + + +

+The closing value behaves like a +to-be-closed variable (see §3.3.8), +which can be used to release resources when the loop ends. +Otherwise, it does not interfere with the loop. + + +

+You should not change the value of the control variable +during the loop. + + + + + + + +

3.3.6 – Function Calls as Statements

+To allow possible side-effects, +function calls can be executed as statements: + +

+	stat ::= functioncall
+

+In this case, all returned values are thrown away. +Function calls are explained in §3.4.10. + + + + + +

3.3.7 – Local Declarations

+Local variables can be declared anywhere inside a block. +The declaration can include an initialization: + +

+	stat ::= local attnamelist [‘=’ explist]
+	attnamelist ::=  Name attrib {‘,’ Name attrib}
+

+If present, an initial assignment has the same semantics +of a multiple assignment (see §3.3.3). +Otherwise, all variables are initialized with nil. + + +

+Each variable name may be postfixed by an attribute +(a name between angle brackets): + +

+	attrib ::= [‘<’ Name ‘>’]
+

+There are two possible attributes: +const, which declares a constant variable, +that is, a variable that cannot be assigned to +after its initialization; +and close, which declares a to-be-closed variable (see §3.3.8). +A list of variables can contain at most one to-be-closed variable. + + +

+A chunk is also a block (see §3.3.2), +and so local variables can be declared in a chunk outside any explicit block. + + +

+The visibility rules for local variables are explained in §3.5. + + + + + +

3.3.8 – To-be-closed Variables

+ +

+A to-be-closed variable behaves like a constant local variable, +except that its value is closed whenever the variable +goes out of scope, including normal block termination, +exiting its block by break/goto/return, +or exiting by an error. + + +

+Here, to close a value means +to call its __close metamethod. +When calling the metamethod, +the value itself is passed as the first argument +and the error object that caused the exit (if any) +is passed as a second argument; +if there was no error, the second argument is nil. + + +

+The value assigned to a to-be-closed variable +must have a __close metamethod +or be a false value. +(nil and false are ignored as to-be-closed values.) + + +

+If several to-be-closed variables go out of scope at the same event, +they are closed in the reverse order that they were declared. + + +

+If there is any error while running a closing method, +that error is handled like an error in the regular code +where the variable was defined. +After an error, +the other pending closing methods will still be called. + + +

+If a coroutine yields and is never resumed again, +some variables may never go out of scope, +and therefore they will never be closed. +(These variables are the ones created inside the coroutine +and in scope at the point where the coroutine yielded.) +Similarly, if a coroutine ends with an error, +it does not unwind its stack, +so it does not close any variable. +In both cases, +you can either use finalizers +or call coroutine.close to close the variables. +However, if the coroutine was created +through coroutine.wrap, +then its corresponding function will close the coroutine +in case of errors. + + + + + + + +

3.4 – Expressions

+ + + +

+The basic expressions in Lua are the following: + +

+	exp ::= prefixexp
+	exp ::= nil | false | true
+	exp ::= Numeral
+	exp ::= LiteralString
+	exp ::= functiondef
+	exp ::= tableconstructor
+	exp ::= ‘...’
+	exp ::= exp binop exp
+	exp ::= unop exp
+	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
+
+ +

+Numerals and literal strings are explained in §3.1; +variables are explained in §3.2; +function definitions are explained in §3.4.11; +function calls are explained in §3.4.10; +table constructors are explained in §3.4.9. +Vararg expressions, +denoted by three dots ('...'), can only be used when +directly inside a variadic function; +they are explained in §3.4.11. + + +

+Binary operators comprise arithmetic operators (see §3.4.1), +bitwise operators (see §3.4.2), +relational operators (see §3.4.4), logical operators (see §3.4.5), +and the concatenation operator (see §3.4.6). +Unary operators comprise the unary minus (see §3.4.1), +the unary bitwise NOT (see §3.4.2), +the unary logical not (see §3.4.5), +and the unary length operator (see §3.4.7). + + + + + +

3.4.1 – Arithmetic Operators

+Lua supports the following arithmetic operators: + +

    +
  • +: addition
  • +
  • -: subtraction
  • +
  • *: multiplication
  • +
  • /: float division
  • +
  • //: floor division
  • +
  • %: modulo
  • +
  • ^: exponentiation
  • +
  • -: unary minus
  • +
+ +

+With the exception of exponentiation and float division, +the arithmetic operators work as follows: +If both operands are integers, +the operation is performed over integers and the result is an integer. +Otherwise, if both operands are numbers, +then they are converted to floats, +the operation is performed following the machine's rules +for floating-point arithmetic +(usually the IEEE 754 standard), +and the result is a float. +(The string library coerces strings to numbers in +arithmetic operations; see §3.4.3 for details.) + + +

+Exponentiation and float division (/) +always convert their operands to floats +and the result is always a float. +Exponentiation uses the ISO C function pow, +so that it works for non-integer exponents too. + + +

+Floor division (//) is a division +that rounds the quotient towards minus infinity, +resulting in the floor of the division of its operands. + + +

+Modulo is defined as the remainder of a division +that rounds the quotient towards minus infinity (floor division). + + +

+In case of overflows in integer arithmetic, +all operations wrap around. + + + +

3.4.2 – Bitwise Operators

+Lua supports the following bitwise operators: + +

    +
  • &: bitwise AND
  • +
  • |: bitwise OR
  • +
  • ~: bitwise exclusive OR
  • +
  • >>: right shift
  • +
  • <<: left shift
  • +
  • ~: unary bitwise NOT
  • +
+ +

+All bitwise operations convert its operands to integers +(see §3.4.3), +operate on all bits of those integers, +and result in an integer. + + +

+Both right and left shifts fill the vacant bits with zeros. +Negative displacements shift to the other direction; +displacements with absolute values equal to or higher than +the number of bits in an integer +result in zero (as all bits are shifted out). + + + + + +

3.4.3 – Coercions and Conversions

+Lua provides some automatic conversions between some +types and representations at run time. +Bitwise operators always convert float operands to integers. +Exponentiation and float division +always convert integer operands to floats. +All other arithmetic operations applied to mixed numbers +(integers and floats) convert the integer operand to a float. +The C API also converts both integers to floats and +floats to integers, as needed. +Moreover, string concatenation accepts numbers as arguments, +besides strings. + + +

+In a conversion from integer to float, +if the integer value has an exact representation as a float, +that is the result. +Otherwise, +the conversion gets the nearest higher or +the nearest lower representable value. +This kind of conversion never fails. + + +

+The conversion from float to integer +checks whether the float has an exact representation as an integer +(that is, the float has an integral value and +it is in the range of integer representation). +If it does, that representation is the result. +Otherwise, the conversion fails. + + +

+Several places in Lua coerce strings to numbers when necessary. +In particular, +the string library sets metamethods that try to coerce +strings to numbers in all arithmetic operations. +If the conversion fails, +the library calls the metamethod of the other operand +(if present) or it raises an error. +Note that bitwise operators do not do this coercion. + + +

+It is always a good practice not to rely on the +implicit coercions from strings to numbers, +as they are not always applied; +in particular, "1"==1 is false and "1"<1 raises an error +(see §3.4.4). +These coercions exist mainly for compatibility and may be removed +in future versions of the language. + + +

+A string is converted to an integer or a float +following its syntax and the rules of the Lua lexer. +The string may have also leading and trailing whitespaces and a sign. +All conversions from strings to numbers +accept both a dot and the current locale mark +as the radix character. +(The Lua lexer, however, accepts only a dot.) +If the string is not a valid numeral, +the conversion fails. +If necessary, the result of this first step is then converted +to a specific number subtype following the previous rules +for conversions between floats and integers. + + +

+The conversion from numbers to strings uses a +non-specified human-readable format. +To convert numbers to strings in any specific way, +use the function string.format. + + + + + +

3.4.4 – Relational Operators

+Lua supports the following relational operators: + +

    +
  • ==: equality
  • +
  • ~=: inequality
  • +
  • <: less than
  • +
  • >: greater than
  • +
  • <=: less or equal
  • +
  • >=: greater or equal
  • +

+These operators always result in false or true. + + +

+Equality (==) first compares the type of its operands. +If the types are different, then the result is false. +Otherwise, the values of the operands are compared. +Strings are equal if they have the same byte content. +Numbers are equal if they denote the same mathematical value. + + +

+Tables, userdata, and threads +are compared by reference: +two objects are considered equal only if they are the same object. +Every time you create a new object +(a table, a userdata, or a thread), +this new object is different from any previously existing object. +A function is always equal to itself. +Functions with any detectable difference +(different behavior, different definition) are always different. +Functions created at different times but with no detectable differences +may be classified as equal or not +(depending on internal caching details). + + +

+You can change the way that Lua compares tables and userdata +by using the __eq metamethod (see §2.4). + + +

+Equality comparisons do not convert strings to numbers +or vice versa. +Thus, "0"==0 evaluates to false, +and t[0] and t["0"] denote different +entries in a table. + + +

+The operator ~= is exactly the negation of equality (==). + + +

+The order operators work as follows. +If both arguments are numbers, +then they are compared according to their mathematical values, +regardless of their subtypes. +Otherwise, if both arguments are strings, +then their values are compared according to the current locale. +Otherwise, Lua tries to call the __lt or the __le +metamethod (see §2.4). +A comparison a > b is translated to b < a +and a >= b is translated to b <= a. + + +

+Following the IEEE 754 standard, +the special value NaN is considered neither less than, +nor equal to, nor greater than any value, including itself. + + + + + +

3.4.5 – Logical Operators

+The logical operators in Lua are +and, or, and not. +Like the control structures (see §3.3.4), +all logical operators consider both false and nil as false +and anything else as true. + + +

+The negation operator not always returns false or true. +The conjunction operator and returns its first argument +if this value is false or nil; +otherwise, and returns its second argument. +The disjunction operator or returns its first argument +if this value is different from nil and false; +otherwise, or returns its second argument. +Both and and or use short-circuit evaluation; +that is, +the second operand is evaluated only if necessary. +Here are some examples: + +

+     10 or 20            --> 10
+     10 or error()       --> 10
+     nil or "a"          --> "a"
+     nil and 10          --> nil
+     false and error()   --> false
+     false and nil       --> false
+     false or nil        --> nil
+     10 and 20           --> 20
+
+ + + + +

3.4.6 – Concatenation

+The string concatenation operator in Lua is +denoted by two dots ('..'). +If both operands are strings or numbers, +then the numbers are converted to strings +in a non-specified format (see §3.4.3). +Otherwise, the __concat metamethod is called (see §2.4). + + + + + +

3.4.7 – The Length Operator

+ +

+The length operator is denoted by the unary prefix operator #. + + +

+The length of a string is its number of bytes. +(That is the usual meaning of string length when each +character is one byte.) + + +

+The length operator applied on a table +returns a border in that table. +A border in a table t is any non-negative integer +that satisfies the following condition: + +

+     (border == 0 or t[border] ~= nil) and
+     (t[border + 1] == nil or border == math.maxinteger)
+

+In words, +a border is any positive integer index present in the table +that is followed by an absent index, +plus two limit cases: +zero, when index 1 is absent; +and the maximum value for an integer, when that index is present. +Note that keys that are not positive integers +do not interfere with borders. + + +

+A table with exactly one border is called a sequence. +For instance, the table {10, 20, 30, 40, 50} is a sequence, +as it has only one border (5). +The table {10, 20, 30, nil, 50} has two borders (3 and 5), +and therefore it is not a sequence. +(The nil at index 4 is called a hole.) +The table {nil, 20, 30, nil, nil, 60, nil} +has three borders (0, 3, and 6), +so it is not a sequence, too. +The table {} is a sequence with border 0. + + +

+When t is a sequence, +#t returns its only border, +which corresponds to the intuitive notion of the length of the sequence. +When t is not a sequence, +#t can return any of its borders. +(The exact one depends on details of +the internal representation of the table, +which in turn can depend on how the table was populated and +the memory addresses of its non-numeric keys.) + + +

+The computation of the length of a table +has a guaranteed worst time of O(log n), +where n is the largest integer key in the table. + + +

+A program can modify the behavior of the length operator for +any value but strings through the __len metamethod (see §2.4). + + + + + +

3.4.8 – Precedence

+Operator precedence in Lua follows the table below, +from lower to higher priority: + +

+     or
+     and
+     <     >     <=    >=    ~=    ==
+     |
+     ~
+     &
+     <<    >>
+     ..
+     +     -
+     *     /     //    %
+     unary operators (not   #     -     ~)
+     ^
+

+As usual, +you can use parentheses to change the precedences of an expression. +The concatenation ('..') and exponentiation ('^') +operators are right associative. +All other binary operators are left associative. + + + + + +

3.4.9 – Table Constructors

+Table constructors are expressions that create tables. +Every time a constructor is evaluated, a new table is created. +A constructor can be used to create an empty table +or to create a table and initialize some of its fields. +The general syntax for constructors is + +

+	tableconstructor ::= ‘{’ [fieldlist] ‘}’
+	fieldlist ::= field {fieldsep field} [fieldsep]
+	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
+	fieldsep ::= ‘,’ | ‘;’
+
+ +

+Each field of the form [exp1] = exp2 adds to the new table an entry +with key exp1 and value exp2. +A field of the form name = exp is equivalent to +["name"] = exp. +Fields of the form exp are equivalent to +[i] = exp, where i are consecutive integers +starting with 1; +fields in the other formats do not affect this counting. +For example, + +

+     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
+

+is equivalent to + +

+     do
+       local t = {}
+       t[f(1)] = g
+       t[1] = "x"         -- 1st exp
+       t[2] = "y"         -- 2nd exp
+       t.x = 1            -- t["x"] = 1
+       t[3] = f(x)        -- 3rd exp
+       t[30] = 23
+       t[4] = 45          -- 4th exp
+       a = t
+     end
+
+ +

+The order of the assignments in a constructor is undefined. +(This order would be relevant only when there are repeated keys.) + + +

+If the last field in the list has the form exp +and the expression is a multires expression, +then all values returned by this expression enter the list consecutively +(see §3.4.12). + + +

+The field list can have an optional trailing separator, +as a convenience for machine-generated code. + + + + + +

3.4.10 – Function Calls

+A function call in Lua has the following syntax: + +

+	functioncall ::= prefixexp args
+

+In a function call, +first prefixexp and args are evaluated. +If the value of prefixexp has type function, +then this function is called +with the given arguments. +Otherwise, if present, +the prefixexp __call metamethod is called: +its first argument is the value of prefixexp, +followed by the original call arguments +(see §2.4). + + +

+The form + +

+	functioncall ::= prefixexp ‘:’ Name args
+

+can be used to emulate methods. +A call v:name(args) +is syntactic sugar for v.name(v,args), +except that v is evaluated only once. + + +

+Arguments have the following syntax: + +

+	args ::= ‘(’ [explist] ‘)’
+	args ::= tableconstructor
+	args ::= LiteralString
+

+All argument expressions are evaluated before the call. +A call of the form f{fields} is +syntactic sugar for f({fields}); +that is, the argument list is a single new table. +A call of the form f'string' +(or f"string" or f[[string]]) +is syntactic sugar for f('string'); +that is, the argument list is a single literal string. + + +

+A call of the form return functioncall not in the +scope of a to-be-closed variable is called a tail call. +Lua implements proper tail calls +(or proper tail recursion): +In a tail call, +the called function reuses the stack entry of the calling function. +Therefore, there is no limit on the number of nested tail calls that +a program can execute. +However, a tail call erases any debug information about the +calling function. +Note that a tail call only happens with a particular syntax, +where the return has one single function call as argument, +and it is outside the scope of any to-be-closed variable. +This syntax makes the calling function return exactly +the returns of the called function, +without any intervening action. +So, none of the following examples are tail calls: + +

+     return (f(x))        -- results adjusted to 1
+     return 2 * f(x)      -- result multiplied by 2
+     return x, f(x)       -- additional results
+     f(x); return         -- results discarded
+     return x or f(x)     -- results adjusted to 1
+
+ + + + +

3.4.11 – Function Definitions

+ +

+The syntax for function definition is + +

+	functiondef ::= function funcbody
+	funcbody ::= ‘(’ [parlist] ‘)’ block end
+
+ +

+The following syntactic sugar simplifies function definitions: + +

+	stat ::= function funcname funcbody
+	stat ::= local function Name funcbody
+	funcname ::= Name {‘.’ Name} [‘:’ Name]
+

+The statement + +

+     function f () body end
+

+translates to + +

+     f = function () body end
+

+The statement + +

+     function t.a.b.c.f () body end
+

+translates to + +

+     t.a.b.c.f = function () body end
+

+The statement + +

+     local function f () body end
+

+translates to + +

+     local f; f = function () body end
+

+not to + +

+     local f = function () body end
+

+(This only makes a difference when the body of the function +contains references to f.) + + +

+A function definition is an executable expression, +whose value has type function. +When Lua precompiles a chunk, +all its function bodies are precompiled too, +but they are not created yet. +Then, whenever Lua executes the function definition, +the function is instantiated (or closed). +This function instance, or closure, +is the final value of the expression. + + +

+Parameters act as local variables that are +initialized with the argument values: + +

+	parlist ::= namelist [‘,’ ‘...’] | ‘...’
+

+When a Lua function is called, +it adjusts its list of arguments to +the length of its list of parameters (see §3.4.12), +unless the function is a variadic function, +which is indicated by three dots ('...') +at the end of its parameter list. +A variadic function does not adjust its argument list; +instead, it collects all extra arguments and supplies them +to the function through a vararg expression, +which is also written as three dots. +The value of this expression is a list of all actual extra arguments, +similar to a function with multiple results (see §3.4.12). + + +

+As an example, consider the following definitions: + +

+     function f(a, b) end
+     function g(a, b, ...) end
+     function r() return 1,2,3 end
+

+Then, we have the following mapping from arguments to parameters and +to the vararg expression: + +

+     CALL             PARAMETERS
+     
+     f(3)             a=3, b=nil
+     f(3, 4)          a=3, b=4
+     f(3, 4, 5)       a=3, b=4
+     f(r(), 10)       a=1, b=10
+     f(r())           a=1, b=2
+     
+     g(3)             a=3, b=nil, ... -->  (nothing)
+     g(3, 4)          a=3, b=4,   ... -->  (nothing)
+     g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8
+     g(5, r())        a=5, b=1,   ... -->  2  3
+
+ +

+Results are returned using the return statement (see §3.3.4). +If control reaches the end of a function +without encountering a return statement, +then the function returns with no results. + + +

+ +There is a system-dependent limit on the number of values +that a function may return. +This limit is guaranteed to be greater than 1000. + + +

+The colon syntax +is used to emulate methods, +adding an implicit extra parameter self to the function. +Thus, the statement + +

+     function t.a.b.c:f (params) body end
+

+is syntactic sugar for + +

+     t.a.b.c.f = function (self, params) body end
+
+ + + + +

3.4.12 – Lists of expressions, multiple results, +and adjustment

+ +

+Both function calls and vararg expressions can result in multiple values. +These expressions are called multires expressions. + + +

+When a multires expression is used as the last element +of a list of expressions, +all results from the expression are added to the +list of values produced by the list of expressions. +Note that a single expression +in a place that expects a list of expressions +is the last expression in that (singleton) list. + + +

+These are the places where Lua expects a list of expressions: + +

    + +
  • A return statement, +for instance return e1, e2, e3 (see §3.3.4).
  • + +
  • A table constructor, +for instance {e1, e2, e3} (see §3.4.9).
  • + +
  • The arguments of a function call, +for instance foo(e1, e2, e3) (see §3.4.10).
  • + +
  • A multiple assignment, +for instance a , b, c = e1, e2, e3 (see §3.3.3).
  • + +
  • A local declaration, +for instance local a , b, c = e1, e2, e3 (see §3.3.7).
  • + +
  • The initial values in a generic for loop, +for instance for k in e1, e2, e3 do ... end (see §3.3.5).
  • + +

+In the last four cases, +the list of values from the list of expressions +must be adjusted to a specific length: +the number of parameters in a call to a non-variadic function +(see §3.4.11), +the number of variables in a multiple assignment or +a local declaration, +and exactly four values for a generic for loop. +The adjustment follows these rules: +If there are more values than needed, +the extra values are thrown away; +if there are fewer values than needed, +the list is extended with nil's. +When the list of expressions ends with a multires expression, +all results from that expression enter the list of values +before the adjustment. + + +

+When a multires expression is used +in a list of expressions without being the last element, +or in a place where the syntax expects a single expression, +Lua adjusts the result list of that expression to one element. +As a particular case, +the syntax expects a single expression inside a parenthesized expression; +therefore, adding parentheses around a multires expression +forces it to produce exactly one result. + + +

+We seldom need to use a vararg expression in a place +where the syntax expects a single expression. +(Usually it is simpler to add a regular parameter before +the variadic part and use that parameter.) +When there is such a need, +we recommend assigning the vararg expression +to a single variable and using that variable +in its place. + + +

+Here are some examples of uses of mutlres expressions. +In all cases, when the construction needs +"the n-th result" and there is no such result, +it uses a nil. + +

+     print(x, f())      -- prints x and all results from f().
+     print(x, (f()))    -- prints x and the first result from f().
+     print(f(), x)      -- prints the first result from f() and x.
+     print(1 + f())     -- prints 1 added to the first result from f().
+     local x = ...      -- x gets the first vararg argument.
+     x,y = ...          -- x gets the first vararg argument,
+                        -- y gets the second vararg argument.
+     x,y,z = w, f()     -- x gets w, y gets the first result from f(),
+                        -- z gets the second result from f().
+     x,y,z = f()        -- x gets the first result from f(),
+                        -- y gets the second result from f(),
+                        -- z gets the third result from f().
+     x,y,z = f(), g()   -- x gets the first result from f(),
+                        -- y gets the first result from g(),
+                        -- z gets the second result from g().
+     x,y,z = (f())      -- x gets the first result from f(), y and z get nil.
+     return f()         -- returns all results from f().
+     return x, ...      -- returns x and all received vararg arguments.
+     return x,y,f()     -- returns x, y, and all results from f().
+     {f()}              -- creates a list with all results from f().
+     {...}              -- creates a list with all vararg arguments.
+     {f(), 5}           -- creates a list with the first result from f() and 5.
+
+ + + + + + +

3.5 – Visibility Rules

+ +

+ +Lua is a lexically scoped language. +The scope of a local variable begins at the first statement after +its declaration and lasts until the last non-void statement +of the innermost block that includes the declaration. +(Void statements are labels and empty statements.) +Consider the following example: + +

+     x = 10                -- global variable
+     do                    -- new block
+       local x = x         -- new 'x', with value 10
+       print(x)            --> 10
+       x = x+1
+       do                  -- another block
+         local x = x+1     -- another 'x'
+         print(x)          --> 12
+       end
+       print(x)            --> 11
+     end
+     print(x)              --> 10  (the global one)
+
+ +

+Notice that, in a declaration like local x = x, +the new x being declared is not in scope yet, +and so the second x refers to the outside variable. + + +

+Because of the lexical scoping rules, +local variables can be freely accessed by functions +defined inside their scope. +A local variable used by an inner function is called an upvalue +(or external local variable, or simply external variable) +inside the inner function. + + +

+Notice that each execution of a local statement +defines new local variables. +Consider the following example: + +

+     a = {}
+     local x = 20
+     for i = 1, 10 do
+       local y = 0
+       a[i] = function () y = y + 1; return x + y end
+     end
+

+The loop creates ten closures +(that is, ten instances of the anonymous function). +Each of these closures uses a different y variable, +while all of them share the same x. + + + + + +

4 – The Application Program Interface

+ + + +

+ +This section describes the C API for Lua, that is, +the set of C functions available to the host program to communicate +with Lua. +All API functions and related types and constants +are declared in the header file lua.h. + + +

+Even when we use the term "function", +any facility in the API may be provided as a macro instead. +Except where stated otherwise, +all such macros use each of their arguments exactly once +(except for the first argument, which is always a Lua state), +and so do not generate any hidden side-effects. + + +

+As in most C libraries, +the Lua API functions do not check their arguments +for validity or consistency. +However, you can change this behavior by compiling Lua +with the macro LUA_USE_APICHECK defined. + + +

+The Lua library is fully reentrant: +it has no global variables. +It keeps all information it needs in a dynamic structure, +called the Lua state. + + +

+Each Lua state has one or more threads, +which correspond to independent, cooperative lines of execution. +The type lua_State (despite its name) refers to a thread. +(Indirectly, through the thread, it also refers to the +Lua state associated to the thread.) + + +

+A pointer to a thread must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch and returns a pointer +to the main thread in the new state. + + + + + +

4.1 – The Stack

+ + + +

+Lua uses a virtual stack to pass values to and from C. +Each element in this stack represents a Lua value +(nil, number, string, etc.). +Functions in the API can access this stack through the +Lua state parameter that they receive. + + +

+Whenever Lua calls C, the called function gets a new stack, +which is independent of previous stacks and of stacks of +C functions that are still active. +This stack initially contains any arguments to the C function +and it is where the C function can store temporary +Lua values and must push its results +to be returned to the caller (see lua_CFunction). + + +

+For convenience, +most query operations in the API do not follow a strict stack discipline. +Instead, they can refer to any element in the stack +by using an index: +A positive index represents an absolute stack position, +starting at 1 as the bottom of the stack; +a negative index represents an offset relative to the top of the stack. +More specifically, if the stack has n elements, +then index 1 represents the first element +(that is, the element that was pushed onto the stack first) +and +index n represents the last element; +index -1 also represents the last element +(that is, the element at the top) +and index -n represents the first element. + + + + + +

4.1.1 – Stack Size

+ +

+When you interact with the Lua API, +you are responsible for ensuring consistency. +In particular, +you are responsible for controlling stack overflow. +When you call any API function, +you must ensure the stack has enough room to accommodate the results. + + +

+There is one exception to the above rule: +When you call a Lua function +without a fixed number of results (see lua_call), +Lua ensures that the stack has enough space for all results. +However, it does not ensure any extra space. +So, before pushing anything on the stack after such a call +you should use lua_checkstack. + + +

+Whenever Lua calls C, +it ensures that the stack has space for +at least LUA_MINSTACK extra elements; +that is, you can safely push up to LUA_MINSTACK values into it. +LUA_MINSTACK is defined as 20, +so that usually you do not have to worry about stack space +unless your code has loops pushing elements onto the stack. +Whenever necessary, +you can use the function lua_checkstack +to ensure that the stack has enough space for pushing new elements. + + + + + +

4.1.2 – Valid and Acceptable Indices

+ +

+Any function in the API that receives stack indices +works only with valid indices or acceptable indices. + + +

+A valid index is an index that refers to a +position that stores a modifiable Lua value. +It comprises stack indices between 1 and the stack top +(1 ≤ abs(index) ≤ top) + +plus pseudo-indices, +which represent some positions that are accessible to C code +but that are not in the stack. +Pseudo-indices are used to access the registry (see §4.3) +and the upvalues of a C function (see §4.2). + + +

+Functions that do not need a specific mutable position, +but only a value (e.g., query functions), +can be called with acceptable indices. +An acceptable index can be any valid index, +but it also can be any positive index after the stack top +within the space allocated for the stack, +that is, indices up to the stack size. +(Note that 0 is never an acceptable index.) +Indices to upvalues (see §4.2) greater than the real number +of upvalues in the current C function are also acceptable (but invalid). +Except when noted otherwise, +functions in the API work with acceptable indices. + + +

+Acceptable indices serve to avoid extra tests +against the stack top when querying the stack. +For instance, a C function can query its third argument +without the need to check whether there is a third argument, +that is, without the need to check whether 3 is a valid index. + + +

+For functions that can be called with acceptable indices, +any non-valid index is treated as if it +contains a value of a virtual type LUA_TNONE, +which behaves like a nil value. + + + + + +

4.1.3 – Pointers to strings

+ +

+Several functions in the API return pointers (const char*) +to Lua strings in the stack. +(See lua_pushfstring, lua_pushlstring, +lua_pushstring, and lua_tolstring. +See also luaL_checklstring, luaL_checkstring, +and luaL_tolstring in the auxiliary library.) + + +

+In general, +Lua's garbage collection can free or move internal memory +and then invalidate pointers to internal strings. +To allow a safe use of these pointers, +the API guarantees that any pointer to a string in a stack index +is valid while the string value at that index is not removed from the stack. +(It can be moved to another index, though.) +When the index is a pseudo-index (referring to an upvalue), +the pointer is valid while the corresponding call is active and +the corresponding upvalue is not modified. + + +

+Some functions in the debug interface +also return pointers to strings, +namely lua_getlocal, lua_getupvalue, +lua_setlocal, and lua_setupvalue. +For these functions, the pointer is guaranteed to +be valid while the caller function is active and +the given closure (if one was given) is in the stack. + + +

+Except for these guarantees, +the garbage collector is free to invalidate +any pointer to internal strings. + + + + + + + +

4.2 – C Closures

+ +

+When a C function is created, +it is possible to associate some values with it, +thus creating a C closure +(see lua_pushcclosure); +these values are called upvalues and are +accessible to the function whenever it is called. + + +

+Whenever a C function is called, +its upvalues are located at specific pseudo-indices. +These pseudo-indices are produced by the macro +lua_upvalueindex. +The first upvalue associated with a function is at index +lua_upvalueindex(1), and so on. +Any access to lua_upvalueindex(n), +where n is greater than the number of upvalues of the +current function +(but not greater than 256, +which is one plus the maximum number of upvalues in a closure), +produces an acceptable but invalid index. + + +

+A C closure can also change the values +of its corresponding upvalues. + + + + + +

4.3 – Registry

+ +

+Lua provides a registry, +a predefined table that can be used by any C code to +store whatever Lua values it needs to store. +The registry table is always accessible at pseudo-index +LUA_REGISTRYINDEX. +Any C library can store data into this table, +but it must take care to choose keys +that are different from those used +by other libraries, to avoid collisions. +Typically, you should use as key a string containing your library name, +or a light userdata with the address of a C object in your code, +or any Lua object created by your code. +As with variable names, +string keys starting with an underscore followed by +uppercase letters are reserved for Lua. + + +

+The integer keys in the registry are used +by the reference mechanism (see luaL_ref) +and by some predefined values. +Therefore, integer keys in the registry +must not be used for other purposes. + + +

+When you create a new Lua state, +its registry comes with some predefined values. +These predefined values are indexed with integer keys +defined as constants in lua.h. +The following constants are defined: + +

    +
  • LUA_RIDX_MAINTHREAD: At this index the registry has +the main thread of the state. +(The main thread is the one created together with the state.) +
  • + +
  • LUA_RIDX_GLOBALS: At this index the registry has +the global environment. +
  • +
+ + + + +

4.4 – Error Handling in C

+ + + +

+Internally, Lua uses the C longjmp facility to handle errors. +(Lua will use exceptions if you compile it as C++; +search for LUAI_THROW in the source code for details.) +When Lua faces any error, +such as a memory allocation error or a type error, +it raises an error; +that is, it does a long jump. +A protected environment uses setjmp +to set a recovery point; +any error jumps to the most recent active recovery point. + + +

+Inside a C function you can raise an error explicitly +by calling lua_error. + + +

+Most functions in the API can raise an error, +for instance due to a memory allocation error. +The documentation for each function indicates whether +it can raise errors. + + +

+If an error happens outside any protected environment, +Lua calls a panic function (see lua_atpanic) +and then calls abort, +thus exiting the host application. +Your panic function can avoid this exit by +never returning +(e.g., doing a long jump to your own recovery point outside Lua). + + +

+The panic function, +as its name implies, +is a mechanism of last resort. +Programs should avoid it. +As a general rule, +when a C function is called by Lua with a Lua state, +it can do whatever it wants on that Lua state, +as it should be already protected. +However, +when C code operates on other Lua states +(e.g., a Lua-state argument to the function, +a Lua state stored in the registry, or +the result of lua_newthread), +it should use them only in API calls that cannot raise errors. + + +

+The panic function runs as if it were a message handler (see §2.3); +in particular, the error object is on the top of the stack. +However, there is no guarantee about stack space. +To push anything on the stack, +the panic function must first check the available space (see §4.1.1). + + + + + +

4.4.1 – Status Codes

+ +

+Several functions that report errors in the API use the following +status codes to indicate different kinds of errors or other conditions: + +

    + +
  • LUA_OK (0): no errors.
  • + +
  • LUA_ERRRUN: a runtime error.
  • + +
  • LUA_ERRMEM: +memory allocation error. +For such errors, Lua does not call the message handler. +
  • + +
  • LUA_ERRERR: error while running the message handler.
  • + +
  • LUA_ERRSYNTAX: syntax error during precompilation.
  • + +
  • LUA_YIELD: the thread (coroutine) yields.
  • + +
  • LUA_ERRFILE: a file-related error; +e.g., it cannot open or read the file.
  • + +

+These constants are defined in the header file lua.h. + + + + + + + +

4.5 – Handling Yields in C

+ +

+Internally, Lua uses the C longjmp facility to yield a coroutine. +Therefore, if a C function foo calls an API function +and this API function yields +(directly or indirectly by calling another function that yields), +Lua cannot return to foo any more, +because the longjmp removes its frame from the C stack. + + +

+To avoid this kind of problem, +Lua raises an error whenever it tries to yield across an API call, +except for three functions: +lua_yieldk, lua_callk, and lua_pcallk. +All those functions receive a continuation function +(as a parameter named k) to continue execution after a yield. + + +

+We need to set some terminology to explain continuations. +We have a C function called from Lua which we will call +the original function. +This original function then calls one of those three functions in the C API, +which we will call the callee function, +that then yields the current thread. +This can happen when the callee function is lua_yieldk, +or when the callee function is either lua_callk or lua_pcallk +and the function called by them yields. + + +

+Suppose the running thread yields while executing the callee function. +After the thread resumes, +it eventually will finish running the callee function. +However, +the callee function cannot return to the original function, +because its frame in the C stack was destroyed by the yield. +Instead, Lua calls a continuation function, +which was given as an argument to the callee function. +As the name implies, +the continuation function should continue the task +of the original function. + + +

+As an illustration, consider the following function: + +

+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       status = lua_pcall(L, n, m, h);  /* calls Lua */
+       ...     /* code 2 */
+     }
+

+Now we want to allow +the Lua code being run by lua_pcall to yield. +First, we can rewrite our function like here: + +

+     int k (lua_State *L, int status, lua_KContext ctx) {
+       ...  /* code 2 */
+     }
+     
+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       return k(L, lua_pcall(L, n, m, h), ctx);
+     }
+

+In the above code, +the new function k is a +continuation function (with type lua_KFunction), +which should do all the work that the original function +was doing after calling lua_pcall. +Now, we must inform Lua that it must call k if the Lua code +being executed by lua_pcall gets interrupted in some way +(errors or yielding), +so we rewrite the code as here, +replacing lua_pcall by lua_pcallk: + +

+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       return k(L, lua_pcallk(L, n, m, h, ctx2, k), ctx1);
+     }
+

+Note the external, explicit call to the continuation: +Lua will call the continuation only if needed, that is, +in case of errors or resuming after a yield. +If the called function returns normally without ever yielding, +lua_pcallk (and lua_callk) will also return normally. +(Of course, instead of calling the continuation in that case, +you can do the equivalent work directly inside the original function.) + + +

+Besides the Lua state, +the continuation function has two other parameters: +the final status of the call and the context value (ctx) that +was passed originally to lua_pcallk. +Lua does not use this context value; +it only passes this value from the original function to the +continuation function. +For lua_pcallk, +the status is the same value that would be returned by lua_pcallk, +except that it is LUA_YIELD when being executed after a yield +(instead of LUA_OK). +For lua_yieldk and lua_callk, +the status is always LUA_YIELD when Lua calls the continuation. +(For these two functions, +Lua will not call the continuation in case of errors, +because they do not handle errors.) +Similarly, when using lua_callk, +you should call the continuation function +with LUA_OK as the status. +(For lua_yieldk, there is not much point in calling +directly the continuation function, +because lua_yieldk usually does not return.) + + +

+Lua treats the continuation function as if it were the original function. +The continuation function receives the same Lua stack +from the original function, +in the same state it would be if the callee function had returned. +(For instance, +after a lua_callk the function and its arguments are +removed from the stack and replaced by the results from the call.) +It also has the same upvalues. +Whatever it returns is handled by Lua as if it were the return +of the original function. + + + + + +

4.6 – Functions and Types

+ +

+Here we list all functions and types from the C API in +alphabetical order. +Each function has an indicator like this: +[-o, +p, x] + + +

+The first field, o, +is how many elements the function pops from the stack. +The second field, p, +is how many elements the function pushes onto the stack. +(Any function always pushes its results after popping its arguments.) +A field in the form x|y means the function can push (or pop) +x or y elements, +depending on the situation; +an interrogation mark '?' means that +we cannot know how many elements the function pops/pushes +by looking only at its arguments. +(For instance, they may depend on what is in the stack.) +The third field, x, +tells whether the function may raise errors: +'-' means the function never raises any error; +'m' means the function may raise only out-of-memory errors; +'v' means the function may raise the errors explained in the text; +'e' means the function can run arbitrary Lua code, +either directly or through metamethods, +and therefore may raise any errors. + + + +


lua_absindex

+[-0, +0, –] +

int lua_absindex (lua_State *L, int idx);
+ +

+Converts the acceptable index idx +into an equivalent absolute index +(that is, one that does not depend on the stack size). + + + + + +


lua_Alloc

+
typedef void * (*lua_Alloc) (void *ud,
+                             void *ptr,
+                             size_t osize,
+                             size_t nsize);
+ +

+The type of the memory-allocation function used by Lua states. +The allocator function must provide a +functionality similar to realloc, +but not exactly the same. +Its arguments are +ud, an opaque pointer passed to lua_newstate; +ptr, a pointer to the block being allocated/reallocated/freed; +osize, the original size of the block or some code about what +is being allocated; +and nsize, the new size of the block. + + +

+When ptr is not NULL, +osize is the size of the block pointed by ptr, +that is, the size given when it was allocated or reallocated. + + +

+When ptr is NULL, +osize encodes the kind of object that Lua is allocating. +osize is any of +LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, +LUA_TUSERDATA, or LUA_TTHREAD when (and only when) +Lua is creating a new object of that type. +When osize is some other value, +Lua is allocating memory for something else. + + +

+Lua assumes the following behavior from the allocator function: + + +

+When nsize is zero, +the allocator must behave like free +and then return NULL. + + +

+When nsize is not zero, +the allocator must behave like realloc. +In particular, the allocator returns NULL +if and only if it cannot fulfill the request. + + +

+Here is a simple implementation for the allocator function. +It is used in the auxiliary library by luaL_newstate. + +

+     static void *l_alloc (void *ud, void *ptr, size_t osize,
+                                                size_t nsize) {
+       (void)ud;  (void)osize;  /* not used */
+       if (nsize == 0) {
+         free(ptr);
+         return NULL;
+       }
+       else
+         return realloc(ptr, nsize);
+     }
+

+Note that ISO C ensures +that free(NULL) has no effect and that +realloc(NULL,size) is equivalent to malloc(size). + + + + + +


lua_arith

+[-(2|1), +1, e] +

void lua_arith (lua_State *L, int op);
+ +

+Performs an arithmetic or bitwise operation over the two values +(or one, in the case of negations) +at the top of the stack, +with the value on the top being the second operand, +pops these values, and pushes the result of the operation. +The function follows the semantics of the corresponding Lua operator +(that is, it may call metamethods). + + +

+The value of op must be one of the following constants: + +

+ + + + +

lua_atpanic

+[-0, +0, –] +

lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
+ +

+Sets a new panic function and returns the old one (see §4.4). + + + + + +


lua_call

+[-(nargs+1), +nresults, e] +

void lua_call (lua_State *L, int nargs, int nresults);
+ +

+Calls a function. +Like regular Lua calls, +lua_call respects the __call metamethod. +So, here the word "function" +means any callable value. + + +

+To do a call you must use the following protocol: +first, the function to be called is pushed onto the stack; +then, the arguments to the call are pushed +in direct order; +that is, the first argument is pushed first. +Finally you call lua_call; +nargs is the number of arguments that you pushed onto the stack. +When the function returns, +all arguments and the function value are popped +and the call results are pushed onto the stack. +The number of results is adjusted to nresults, +unless nresults is LUA_MULTRET. +In this case, all results from the function are pushed; +Lua takes care that the returned values fit into the stack space, +but it does not ensure any extra space in the stack. +The function results are pushed onto the stack in direct order +(the first result is pushed first), +so that after the call the last result is on the top of the stack. + + +

+Any error while calling and running the function is propagated upwards +(with a longjmp). + + +

+The following example shows how the host program can do the +equivalent to this Lua code: + +

+     a = f("how", t.x, 14)
+

+Here it is in C: + +

+     lua_getglobal(L, "f");                  /* function to be called */
+     lua_pushliteral(L, "how");                       /* 1st argument */
+     lua_getglobal(L, "t");                    /* table to be indexed */
+     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
+     lua_remove(L, -2);                  /* remove 't' from the stack */
+     lua_pushinteger(L, 14);                          /* 3rd argument */
+     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
+     lua_setglobal(L, "a");                         /* set global 'a' */
+

+Note that the code above is balanced: +at its end, the stack is back to its original configuration. +This is considered good programming practice. + + + + + +


lua_callk

+[-(nargs + 1), +nresults, e] +

void lua_callk (lua_State *L,
+                int nargs,
+                int nresults,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+This function behaves exactly like lua_call, +but allows the called function to yield (see §4.5). + + + + + +


lua_CFunction

+
typedef int (*lua_CFunction) (lua_State *L);
+ +

+Type for C functions. + + +

+In order to communicate properly with Lua, +a C function must use the following protocol, +which defines the way parameters and results are passed: +a C function receives its arguments from Lua in its stack +in direct order (the first argument is pushed first). +So, when the function starts, +lua_gettop(L) returns the number of arguments received by the function. +The first argument (if any) is at index 1 +and its last argument is at index lua_gettop(L). +To return values to Lua, a C function just pushes them onto the stack, +in direct order (the first result is pushed first), +and returns in C the number of results. +Any other value in the stack below the results will be properly +discarded by Lua. +Like a Lua function, a C function called by Lua can also return +many results. + + +

+As an example, the following function receives a variable number +of numeric arguments and returns their average and their sum: + +

+     static int foo (lua_State *L) {
+       int n = lua_gettop(L);    /* number of arguments */
+       lua_Number sum = 0.0;
+       int i;
+       for (i = 1; i <= n; i++) {
+         if (!lua_isnumber(L, i)) {
+           lua_pushliteral(L, "incorrect argument");
+           lua_error(L);
+         }
+         sum += lua_tonumber(L, i);
+       }
+       lua_pushnumber(L, sum/n);        /* first result */
+       lua_pushnumber(L, sum);         /* second result */
+       return 2;                   /* number of results */
+     }
+
+ + + + +

lua_checkstack

+[-0, +0, –] +

int lua_checkstack (lua_State *L, int n);
+ +

+Ensures that the stack has space for at least n extra elements, +that is, that you can safely push up to n values into it. +It returns false if it cannot fulfill the request, +either because it would cause the stack +to be greater than a fixed maximum size +(typically at least several thousand elements) or +because it cannot allocate memory for the extra space. +This function never shrinks the stack; +if the stack already has space for the extra elements, +it is left unchanged. + + + + + +


lua_close

+[-0, +0, –] +

void lua_close (lua_State *L);
+ +

+Close all active to-be-closed variables in the main thread, +release all objects in the given Lua state +(calling the corresponding garbage-collection metamethods, if any), +and frees all dynamic memory used by this state. + + +

+On several platforms, you may not need to call this function, +because all resources are naturally released when the host program ends. +On the other hand, long-running programs that create multiple states, +such as daemons or web servers, +will probably need to close states as soon as they are not needed. + + + + + +


lua_closeslot

+[-0, +0, e] +

void lua_closeslot (lua_State *L, int index);
+ +

+Close the to-be-closed slot at the given index and set its value to nil. +The index must be the last index previously marked to be closed +(see lua_toclose) that is still active (that is, not closed yet). + + +

+A __close metamethod cannot yield +when called through this function. + + +

+(This function was introduced in release 5.4.3.) + + + + + +


lua_closethread

+[-0, +?, –] +

int lua_closethread (lua_State *L, lua_State *from);
+ +

+Resets a thread, cleaning its call stack and closing all pending +to-be-closed variables. +Returns a status code: +LUA_OK for no errors in the thread +(either the original error that stopped the thread or +errors in closing methods), +or an error status otherwise. +In case of error, +leaves the error object on the top of the stack. + + +

+The parameter from represents the coroutine that is resetting L. +If there is no such coroutine, +this parameter can be NULL. + + +

+(This function was introduced in release 5.4.6.) + + + + + +


lua_compare

+[-0, +0, e] +

int lua_compare (lua_State *L, int index1, int index2, int op);
+ +

+Compares two Lua values. +Returns 1 if the value at index index1 satisfies op +when compared with the value at index index2, +following the semantics of the corresponding Lua operator +(that is, it may call metamethods). +Otherwise returns 0. +Also returns 0 if any of the indices is not valid. + + +

+The value of op must be one of the following constants: + +

    + +
  • LUA_OPEQ: compares for equality (==)
  • +
  • LUA_OPLT: compares for less than (<)
  • +
  • LUA_OPLE: compares for less or equal (<=)
  • + +
+ + + + +

lua_concat

+[-n, +1, e] +

void lua_concat (lua_State *L, int n);
+ +

+Concatenates the n values at the top of the stack, +pops them, and leaves the result on the top. +If n is 1, the result is the single value on the stack +(that is, the function does nothing); +if n is 0, the result is the empty string. +Concatenation is performed following the usual semantics of Lua +(see §3.4.6). + + + + + +


lua_copy

+[-0, +0, –] +

void lua_copy (lua_State *L, int fromidx, int toidx);
+ +

+Copies the element at index fromidx +into the valid index toidx, +replacing the value at that position. +Values at other positions are not affected. + + + + + +


lua_createtable

+[-0, +1, m] +

void lua_createtable (lua_State *L, int narr, int nrec);
+ +

+Creates a new empty table and pushes it onto the stack. +Parameter narr is a hint for how many elements the table +will have as a sequence; +parameter nrec is a hint for how many other elements +the table will have. +Lua may use these hints to preallocate memory for the new table. +This preallocation may help performance when you know in advance +how many elements the table will have. +Otherwise you can use the function lua_newtable. + + + + + +


lua_dump

+[-0, +0, –] +

int lua_dump (lua_State *L,
+                        lua_Writer writer,
+                        void *data,
+                        int strip);
+ +

+Dumps a function as a binary chunk. +Receives a Lua function on the top of the stack +and produces a binary chunk that, +if loaded again, +results in a function equivalent to the one dumped. +As it produces parts of the chunk, +lua_dump calls function writer (see lua_Writer) +with the given data +to write them. + + +

+If strip is true, +the binary representation may not include all debug information +about the function, +to save space. + + +

+The value returned is the error code returned by the last +call to the writer; +0 means no errors. + + +

+This function does not pop the Lua function from the stack. + + + + + +


lua_error

+[-1, +0, v] +

int lua_error (lua_State *L);
+ +

+Raises a Lua error, +using the value on the top of the stack as the error object. +This function does a long jump, +and therefore never returns +(see luaL_error). + + + + + +


lua_gc

+[-0, +0, –] +

int lua_gc (lua_State *L, int what, ...);
+ +

+Controls the garbage collector. + + +

+This function performs several tasks, +according to the value of the parameter what. +For options that need extra arguments, +they are listed after the option. + +

    + +
  • LUA_GCCOLLECT: +Performs a full garbage-collection cycle. +
  • + +
  • LUA_GCSTOP: +Stops the garbage collector. +
  • + +
  • LUA_GCRESTART: +Restarts the garbage collector. +
  • + +
  • LUA_GCCOUNT: +Returns the current amount of memory (in Kbytes) in use by Lua. +
  • + +
  • LUA_GCCOUNTB: +Returns the remainder of dividing the current amount of bytes of +memory in use by Lua by 1024. +
  • + +
  • LUA_GCSTEP (int stepsize): +Performs an incremental step of garbage collection, +corresponding to the allocation of stepsize Kbytes. +
  • + +
  • LUA_GCISRUNNING: +Returns a boolean that tells whether the collector is running +(i.e., not stopped). +
  • + +
  • LUA_GCINC (int pause, int stepmul, stepsize): +Changes the collector to incremental mode +with the given parameters (see §2.5.1). +Returns the previous mode (LUA_GCGEN or LUA_GCINC). +
  • + +
  • LUA_GCGEN (int minormul, int majormul): +Changes the collector to generational mode +with the given parameters (see §2.5.2). +Returns the previous mode (LUA_GCGEN or LUA_GCINC). +
  • + +

+For more details about these options, +see collectgarbage. + + +

+This function should not be called by a finalizer. + + + + + +


lua_getallocf

+[-0, +0, –] +

lua_Alloc lua_getallocf (lua_State *L, void **ud);
+ +

+Returns the memory-allocation function of a given state. +If ud is not NULL, Lua stores in *ud the +opaque pointer given when the memory-allocator function was set. + + + + + +


lua_getfield

+[-0, +1, e] +

int lua_getfield (lua_State *L, int index, const char *k);
+ +

+Pushes onto the stack the value t[k], +where t is the value at the given index. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_getextraspace

+[-0, +0, –] +

void *lua_getextraspace (lua_State *L);
+ +

+Returns a pointer to a raw memory area associated with the +given Lua state. +The application can use this area for any purpose; +Lua does not use it for anything. + + +

+Each new thread has this area initialized with a copy +of the area of the main thread. + + +

+By default, this area has the size of a pointer to void, +but you can recompile Lua with a different size for this area. +(See LUA_EXTRASPACE in luaconf.h.) + + + + + +


lua_getglobal

+[-0, +1, e] +

int lua_getglobal (lua_State *L, const char *name);
+ +

+Pushes onto the stack the value of the global name. +Returns the type of that value. + + + + + +


lua_geti

+[-0, +1, e] +

int lua_geti (lua_State *L, int index, lua_Integer i);
+ +

+Pushes onto the stack the value t[i], +where t is the value at the given index. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_getmetatable

+[-0, +(0|1), –] +

int lua_getmetatable (lua_State *L, int index);
+ +

+If the value at the given index has a metatable, +the function pushes that metatable onto the stack and returns 1. +Otherwise, +the function returns 0 and pushes nothing on the stack. + + + + + +


lua_gettable

+[-1, +1, e] +

int lua_gettable (lua_State *L, int index);
+ +

+Pushes onto the stack the value t[k], +where t is the value at the given index +and k is the value on the top of the stack. + + +

+This function pops the key from the stack, +pushing the resulting value in its place. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_gettop

+[-0, +0, –] +

int lua_gettop (lua_State *L);
+ +

+Returns the index of the top element in the stack. +Because indices start at 1, +this result is equal to the number of elements in the stack; +in particular, 0 means an empty stack. + + + + + +


lua_getiuservalue

+[-0, +1, –] +

int lua_getiuservalue (lua_State *L, int index, int n);
+ +

+Pushes onto the stack the n-th user value associated with the +full userdata at the given index and +returns the type of the pushed value. + + +

+If the userdata does not have that value, +pushes nil and returns LUA_TNONE. + + + + + +


lua_insert

+[-1, +1, –] +

void lua_insert (lua_State *L, int index);
+ +

+Moves the top element into the given valid index, +shifting up the elements above this index to open space. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_Integer

+
typedef ... lua_Integer;
+ +

+The type of integers in Lua. + + +

+By default this type is long long, +(usually a 64-bit two-complement integer), +but that can be changed to long or int +(usually a 32-bit two-complement integer). +(See LUA_INT_TYPE in luaconf.h.) + + +

+Lua also defines the constants +LUA_MININTEGER and LUA_MAXINTEGER, +with the minimum and the maximum values that fit in this type. + + + + + +


lua_isboolean

+[-0, +0, –] +

int lua_isboolean (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a boolean, +and 0 otherwise. + + + + + +


lua_iscfunction

+[-0, +0, –] +

int lua_iscfunction (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a C function, +and 0 otherwise. + + + + + +


lua_isfunction

+[-0, +0, –] +

int lua_isfunction (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a function +(either C or Lua), and 0 otherwise. + + + + + +


lua_isinteger

+[-0, +0, –] +

int lua_isinteger (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is an integer +(that is, the value is a number and is represented as an integer), +and 0 otherwise. + + + + + +


lua_islightuserdata

+[-0, +0, –] +

int lua_islightuserdata (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a light userdata, +and 0 otherwise. + + + + + +


lua_isnil

+[-0, +0, –] +

int lua_isnil (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is nil, +and 0 otherwise. + + + + + +


lua_isnone

+[-0, +0, –] +

int lua_isnone (lua_State *L, int index);
+ +

+Returns 1 if the given index is not valid, +and 0 otherwise. + + + + + +


lua_isnoneornil

+[-0, +0, –] +

int lua_isnoneornil (lua_State *L, int index);
+ +

+Returns 1 if the given index is not valid +or if the value at this index is nil, +and 0 otherwise. + + + + + +


lua_isnumber

+[-0, +0, –] +

int lua_isnumber (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a number +or a string convertible to a number, +and 0 otherwise. + + + + + +


lua_isstring

+[-0, +0, –] +

int lua_isstring (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a string +or a number (which is always convertible to a string), +and 0 otherwise. + + + + + +


lua_istable

+[-0, +0, –] +

int lua_istable (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a table, +and 0 otherwise. + + + + + +


lua_isthread

+[-0, +0, –] +

int lua_isthread (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a thread, +and 0 otherwise. + + + + + +


lua_isuserdata

+[-0, +0, –] +

int lua_isuserdata (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a userdata +(either full or light), and 0 otherwise. + + + + + +


lua_isyieldable

+[-0, +0, –] +

int lua_isyieldable (lua_State *L);
+ +

+Returns 1 if the given coroutine can yield, +and 0 otherwise. + + + + + +


lua_KContext

+
typedef ... lua_KContext;
+ +

+The type for continuation-function contexts. +It must be a numeric type. +This type is defined as intptr_t +when intptr_t is available, +so that it can store pointers too. +Otherwise, it is defined as ptrdiff_t. + + + + + +


lua_KFunction

+
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
+ +

+Type for continuation functions (see §4.5). + + + + + +


lua_len

+[-0, +1, e] +

void lua_len (lua_State *L, int index);
+ +

+Returns the length of the value at the given index. +It is equivalent to the '#' operator in Lua (see §3.4.7) and +may trigger a metamethod for the "length" event (see §2.4). +The result is pushed on the stack. + + + + + +


lua_load

+[-0, +1, –] +

int lua_load (lua_State *L,
+              lua_Reader reader,
+              void *data,
+              const char *chunkname,
+              const char *mode);
+ +

+Loads a Lua chunk without running it. +If there are no errors, +lua_load pushes the compiled chunk as a Lua +function on top of the stack. +Otherwise, it pushes an error message. + + +

+The lua_load function uses a user-supplied reader function +to read the chunk (see lua_Reader). +The data argument is an opaque value passed to the reader function. + + +

+The chunkname argument gives a name to the chunk, +which is used for error messages and in debug information (see §4.7). + + +

+lua_load automatically detects whether the chunk is text or binary +and loads it accordingly (see program luac). +The string mode works as in function load, +with the addition that +a NULL value is equivalent to the string "bt". + + +

+lua_load uses the stack internally, +so the reader function must always leave the stack +unmodified when returning. + + +

+lua_load can return +LUA_OK, LUA_ERRSYNTAX, or LUA_ERRMEM. +The function may also return other values corresponding to +errors raised by the read function (see §4.4.1). + + +

+If the resulting function has upvalues, +its first upvalue is set to the value of the global environment +stored at index LUA_RIDX_GLOBALS in the registry (see §4.3). +When loading main chunks, +this upvalue will be the _ENV variable (see §2.2). +Other upvalues are initialized with nil. + + + + + +


lua_newstate

+[-0, +0, –] +

lua_State *lua_newstate (lua_Alloc f, void *ud);
+ +

+Creates a new independent state and returns its main thread. +Returns NULL if it cannot create the state +(due to lack of memory). +The argument f is the allocator function; +Lua will do all memory allocation for this state +through this function (see lua_Alloc). +The second argument, ud, is an opaque pointer that Lua +passes to the allocator in every call. + + + + + +


lua_newtable

+[-0, +1, m] +

void lua_newtable (lua_State *L);
+ +

+Creates a new empty table and pushes it onto the stack. +It is equivalent to lua_createtable(L, 0, 0). + + + + + +


lua_newthread

+[-0, +1, m] +

lua_State *lua_newthread (lua_State *L);
+ +

+Creates a new thread, pushes it on the stack, +and returns a pointer to a lua_State that represents this new thread. +The new thread returned by this function shares with the original thread +its global environment, +but has an independent execution stack. + + +

+Threads are subject to garbage collection, +like any Lua object. + + + + + +


lua_newuserdatauv

+[-0, +1, m] +

void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue);
+ +

+This function creates and pushes on the stack a new full userdata, +with nuvalue associated Lua values, called user values, +plus an associated block of raw memory with size bytes. +(The user values can be set and read with the functions +lua_setiuservalue and lua_getiuservalue.) + + +

+The function returns the address of the block of memory. +Lua ensures that this address is valid as long as +the corresponding userdata is alive (see §2.5). +Moreover, if the userdata is marked for finalization (see §2.5.3), +its address is valid at least until the call to its finalizer. + + + + + +


lua_next

+[-1, +(2|0), v] +

int lua_next (lua_State *L, int index);
+ +

+Pops a key from the stack, +and pushes a key–value pair from the table at the given index, +the "next" pair after the given key. +If there are no more elements in the table, +then lua_next returns 0 and pushes nothing. + + +

+A typical table traversal looks like this: + +

+     /* table is in the stack at index 't' */
+     lua_pushnil(L);  /* first key */
+     while (lua_next(L, t) != 0) {
+       /* uses 'key' (at index -2) and 'value' (at index -1) */
+       printf("%s - %s\n",
+              lua_typename(L, lua_type(L, -2)),
+              lua_typename(L, lua_type(L, -1)));
+       /* removes 'value'; keeps 'key' for next iteration */
+       lua_pop(L, 1);
+     }
+
+ +

+While traversing a table, +avoid calling lua_tolstring directly on a key, +unless you know that the key is actually a string. +Recall that lua_tolstring may change +the value at the given index; +this confuses the next call to lua_next. + + +

+This function may raise an error if the given key +is neither nil nor present in the table. +See function next for the caveats of modifying +the table during its traversal. + + + + + +


lua_Number

+
typedef ... lua_Number;
+ +

+The type of floats in Lua. + + +

+By default this type is double, +but that can be changed to a single float or a long double. +(See LUA_FLOAT_TYPE in luaconf.h.) + + + + + +


lua_numbertointeger

+
int lua_numbertointeger (lua_Number n, lua_Integer *p);
+ +

+Tries to convert a Lua float to a Lua integer; +the float n must have an integral value. +If that value is within the range of Lua integers, +it is converted to an integer and assigned to *p. +The macro results in a boolean indicating whether the +conversion was successful. +(Note that this range test can be tricky to do +correctly without this macro, due to rounding.) + + +

+This macro may evaluate its arguments more than once. + + + + + +


lua_pcall

+[-(nargs + 1), +(nresults|1), –] +

int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);
+ +

+Calls a function (or a callable object) in protected mode. + + +

+Both nargs and nresults have the same meaning as +in lua_call. +If there are no errors during the call, +lua_pcall behaves exactly like lua_call. +However, if there is any error, +lua_pcall catches it, +pushes a single value on the stack (the error object), +and returns an error code. +Like lua_call, +lua_pcall always removes the function +and its arguments from the stack. + + +

+If msgh is 0, +then the error object returned on the stack +is exactly the original error object. +Otherwise, msgh is the stack index of a +message handler. +(This index cannot be a pseudo-index.) +In case of runtime errors, +this handler will be called with the error object +and its return value will be the object +returned on the stack by lua_pcall. + + +

+Typically, the message handler is used to add more debug +information to the error object, such as a stack traceback. +Such information cannot be gathered after the return of lua_pcall, +since by then the stack has unwound. + + +

+The lua_pcall function returns one of the following status codes: +LUA_OK, LUA_ERRRUN, LUA_ERRMEM, or LUA_ERRERR. + + + + + +


lua_pcallk

+[-(nargs + 1), +(nresults|1), –] +

int lua_pcallk (lua_State *L,
+                int nargs,
+                int nresults,
+                int msgh,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+This function behaves exactly like lua_pcall, +except that it allows the called function to yield (see §4.5). + + + + + +


lua_pop

+[-n, +0, e] +

void lua_pop (lua_State *L, int n);
+ +

+Pops n elements from the stack. +It is implemented as a macro over lua_settop. + + + + + +


lua_pushboolean

+[-0, +1, –] +

void lua_pushboolean (lua_State *L, int b);
+ +

+Pushes a boolean value with value b onto the stack. + + + + + +


lua_pushcclosure

+[-n, +1, m] +

void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
+ +

+Pushes a new C closure onto the stack. +This function receives a pointer to a C function +and pushes onto the stack a Lua value of type function that, +when called, invokes the corresponding C function. +The parameter n tells how many upvalues this function will have +(see §4.2). + + +

+Any function to be callable by Lua must +follow the correct protocol to receive its parameters +and return its results (see lua_CFunction). + + +

+When a C function is created, +it is possible to associate some values with it, +the so called upvalues; +these upvalues are then accessible to the function whenever it is called. +This association is called a C closure (see §4.2). +To create a C closure, +first the initial values for its upvalues must be pushed onto the stack. +(When there are multiple upvalues, the first value is pushed first.) +Then lua_pushcclosure +is called to create and push the C function onto the stack, +with the argument n telling how many values will be +associated with the function. +lua_pushcclosure also pops these values from the stack. + + +

+The maximum value for n is 255. + + +

+When n is zero, +this function creates a light C function, +which is just a pointer to the C function. +In that case, it never raises a memory error. + + + + + +


lua_pushcfunction

+[-0, +1, –] +

void lua_pushcfunction (lua_State *L, lua_CFunction f);
+ +

+Pushes a C function onto the stack. +This function is equivalent to lua_pushcclosure with no upvalues. + + + + + +


lua_pushfstring

+[-0, +1, v] +

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
+ +

+Pushes onto the stack a formatted string +and returns a pointer to this string (see §4.1.3). +It is similar to the ISO C function sprintf, +but has two important differences. +First, +you do not have to allocate space for the result; +the result is a Lua string and Lua takes care of memory allocation +(and deallocation, through garbage collection). +Second, +the conversion specifiers are quite restricted. +There are no flags, widths, or precisions. +The conversion specifiers can only be +'%%' (inserts the character '%'), +'%s' (inserts a zero-terminated string, with no size restrictions), +'%f' (inserts a lua_Number), +'%I' (inserts a lua_Integer), +'%p' (inserts a pointer), +'%d' (inserts an int), +'%c' (inserts an int as a one-byte character), and +'%U' (inserts a long int as a UTF-8 byte sequence). + + +

+This function may raise errors due to memory overflow +or an invalid conversion specifier. + + + + + +


lua_pushglobaltable

+[-0, +1, –] +

void lua_pushglobaltable (lua_State *L);
+ +

+Pushes the global environment onto the stack. + + + + + +


lua_pushinteger

+[-0, +1, –] +

void lua_pushinteger (lua_State *L, lua_Integer n);
+ +

+Pushes an integer with value n onto the stack. + + + + + +


lua_pushlightuserdata

+[-0, +1, –] +

void lua_pushlightuserdata (lua_State *L, void *p);
+ +

+Pushes a light userdata onto the stack. + + +

+Userdata represent C values in Lua. +A light userdata represents a pointer, a void*. +It is a value (like a number): +you do not create it, it has no individual metatable, +and it is not collected (as it was never created). +A light userdata is equal to "any" +light userdata with the same C address. + + + + + +


lua_pushliteral

+[-0, +1, m] +

const char *lua_pushliteral (lua_State *L, const char *s);
+ +

+This macro is equivalent to lua_pushstring, +but should be used only when s is a literal string. +(Lua may optimize this case.) + + + + + +


lua_pushlstring

+[-0, +1, m] +

const char *lua_pushlstring (lua_State *L, const char *s, size_t len);
+ +

+Pushes the string pointed to by s with size len +onto the stack. +Lua will make or reuse an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. +The string can contain any binary data, +including embedded zeros. + + +

+Returns a pointer to the internal copy of the string (see §4.1.3). + + + + + +


lua_pushnil

+[-0, +1, –] +

void lua_pushnil (lua_State *L);
+ +

+Pushes a nil value onto the stack. + + + + + +


lua_pushnumber

+[-0, +1, –] +

void lua_pushnumber (lua_State *L, lua_Number n);
+ +

+Pushes a float with value n onto the stack. + + + + + +


lua_pushstring

+[-0, +1, m] +

const char *lua_pushstring (lua_State *L, const char *s);
+ +

+Pushes the zero-terminated string pointed to by s +onto the stack. +Lua will make or reuse an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. + + +

+Returns a pointer to the internal copy of the string (see §4.1.3). + + +

+If s is NULL, pushes nil and returns NULL. + + + + + +


lua_pushthread

+[-0, +1, –] +

int lua_pushthread (lua_State *L);
+ +

+Pushes the thread represented by L onto the stack. +Returns 1 if this thread is the main thread of its state. + + + + + +


lua_pushvalue

+[-0, +1, –] +

void lua_pushvalue (lua_State *L, int index);
+ +

+Pushes a copy of the element at the given index +onto the stack. + + + + + +


lua_pushvfstring

+[-0, +1, v] +

const char *lua_pushvfstring (lua_State *L,
+                              const char *fmt,
+                              va_list argp);
+ +

+Equivalent to lua_pushfstring, except that it receives a va_list +instead of a variable number of arguments. + + + + + +


lua_rawequal

+[-0, +0, –] +

int lua_rawequal (lua_State *L, int index1, int index2);
+ +

+Returns 1 if the two values in indices index1 and +index2 are primitively equal +(that is, equal without calling the __eq metamethod). +Otherwise returns 0. +Also returns 0 if any of the indices are not valid. + + + + + +


lua_rawget

+[-1, +1, –] +

int lua_rawget (lua_State *L, int index);
+ +

+Similar to lua_gettable, but does a raw access +(i.e., without metamethods). +The value at index must be a table. + + + + + +


lua_rawgeti

+[-0, +1, –] +

int lua_rawgeti (lua_State *L, int index, lua_Integer n);
+ +

+Pushes onto the stack the value t[n], +where t is the table at the given index. +The access is raw, +that is, it does not use the __index metavalue. + + +

+Returns the type of the pushed value. + + + + + +


lua_rawgetp

+[-0, +1, –] +

int lua_rawgetp (lua_State *L, int index, const void *p);
+ +

+Pushes onto the stack the value t[k], +where t is the table at the given index and +k is the pointer p represented as a light userdata. +The access is raw; +that is, it does not use the __index metavalue. + + +

+Returns the type of the pushed value. + + + + + +


lua_rawlen

+[-0, +0, –] +

lua_Unsigned lua_rawlen (lua_State *L, int index);
+ +

+Returns the raw "length" of the value at the given index: +for strings, this is the string length; +for tables, this is the result of the length operator ('#') +with no metamethods; +for userdata, this is the size of the block of memory allocated +for the userdata. +For other values, this call returns 0. + + + + + +


lua_rawset

+[-2, +0, m] +

void lua_rawset (lua_State *L, int index);
+ +

+Similar to lua_settable, but does a raw assignment +(i.e., without metamethods). +The value at index must be a table. + + + + + +


lua_rawseti

+[-1, +0, m] +

void lua_rawseti (lua_State *L, int index, lua_Integer i);
+ +

+Does the equivalent of t[i] = v, +where t is the table at the given index +and v is the value on the top of the stack. + + +

+This function pops the value from the stack. +The assignment is raw, +that is, it does not use the __newindex metavalue. + + + + + +


lua_rawsetp

+[-1, +0, m] +

void lua_rawsetp (lua_State *L, int index, const void *p);
+ +

+Does the equivalent of t[p] = v, +where t is the table at the given index, +p is encoded as a light userdata, +and v is the value on the top of the stack. + + +

+This function pops the value from the stack. +The assignment is raw, +that is, it does not use the __newindex metavalue. + + + + + +


lua_Reader

+
typedef const char * (*lua_Reader) (lua_State *L,
+                                    void *data,
+                                    size_t *size);
+ +

+The reader function used by lua_load. +Every time lua_load needs another piece of the chunk, +it calls the reader, +passing along its data parameter. +The reader must return a pointer to a block of memory +with a new piece of the chunk +and set size to the block size. +The block must exist until the reader function is called again. +To signal the end of the chunk, +the reader must return NULL or set size to zero. +The reader function may return pieces of any size greater than zero. + + + + + +


lua_register

+[-0, +0, e] +

void lua_register (lua_State *L, const char *name, lua_CFunction f);
+ +

+Sets the C function f as the new value of global name. +It is defined as a macro: + +

+     #define lua_register(L,n,f) \
+            (lua_pushcfunction(L, f), lua_setglobal(L, n))
+
+ + + + +

lua_remove

+[-1, +0, –] +

void lua_remove (lua_State *L, int index);
+ +

+Removes the element at the given valid index, +shifting down the elements above this index to fill the gap. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_replace

+[-1, +0, –] +

void lua_replace (lua_State *L, int index);
+ +

+Moves the top element into the given valid index +without shifting any element +(therefore replacing the value at that given index), +and then pops the top element. + + + + + +


lua_resetthread

+[-0, +?, –] +

int lua_resetthread (lua_State *L);
+ +

+This function is deprecated; +it is equivalent to lua_closethread with +from being NULL. + + + + + +


lua_resume

+[-?, +?, –] +

int lua_resume (lua_State *L, lua_State *from, int nargs,
+                          int *nresults);
+ +

+Starts and resumes a coroutine in the given thread L. + + +

+To start a coroutine, +you push the main function plus any arguments +onto the empty stack of the thread. +then you call lua_resume, +with nargs being the number of arguments. +This call returns when the coroutine suspends or finishes its execution. +When it returns, +*nresults is updated and +the top of the stack contains +the *nresults values passed to lua_yield +or returned by the body function. +lua_resume returns +LUA_YIELD if the coroutine yields, +LUA_OK if the coroutine finishes its execution +without errors, +or an error code in case of errors (see §4.4.1). +In case of errors, +the error object is on the top of the stack. + + +

+To resume a coroutine, +you remove the *nresults yielded values from its stack, +push the values to be passed as results from yield, +and then call lua_resume. + + +

+The parameter from represents the coroutine that is resuming L. +If there is no such coroutine, +this parameter can be NULL. + + + + + +


lua_rotate

+[-0, +0, –] +

void lua_rotate (lua_State *L, int idx, int n);
+ +

+Rotates the stack elements between the valid index idx +and the top of the stack. +The elements are rotated n positions in the direction of the top, +for a positive n, +or -n positions in the direction of the bottom, +for a negative n. +The absolute value of n must not be greater than the size +of the slice being rotated. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_setallocf

+[-0, +0, –] +

void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
+ +

+Changes the allocator function of a given state to f +with user data ud. + + + + + +


lua_setfield

+[-1, +0, e] +

void lua_setfield (lua_State *L, int index, const char *k);
+ +

+Does the equivalent to t[k] = v, +where t is the value at the given index +and v is the value on the top of the stack. + + +

+This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_setglobal

+[-1, +0, e] +

void lua_setglobal (lua_State *L, const char *name);
+ +

+Pops a value from the stack and +sets it as the new value of global name. + + + + + +


lua_seti

+[-1, +0, e] +

void lua_seti (lua_State *L, int index, lua_Integer n);
+ +

+Does the equivalent to t[n] = v, +where t is the value at the given index +and v is the value on the top of the stack. + + +

+This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_setiuservalue

+[-1, +0, –] +

int lua_setiuservalue (lua_State *L, int index, int n);
+ +

+Pops a value from the stack and sets it as +the new n-th user value associated to the +full userdata at the given index. +Returns 0 if the userdata does not have that value. + + + + + +


lua_setmetatable

+[-1, +0, –] +

int lua_setmetatable (lua_State *L, int index);
+ +

+Pops a table or nil from the stack and +sets that value as the new metatable for the value at the given index. +(nil means no metatable.) + + +

+(For historical reasons, this function returns an int, +which now is always 1.) + + + + + +


lua_settable

+[-2, +0, e] +

void lua_settable (lua_State *L, int index);
+ +

+Does the equivalent to t[k] = v, +where t is the value at the given index, +v is the value on the top of the stack, +and k is the value just below the top. + + +

+This function pops both the key and the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_settop

+[-?, +?, e] +

void lua_settop (lua_State *L, int index);
+ +

+Accepts any index, or 0, +and sets the stack top to this index. +If the new top is greater than the old one, +then the new elements are filled with nil. +If index is 0, then all stack elements are removed. + + +

+This function can run arbitrary code when removing an index +marked as to-be-closed from the stack. + + + + + +


lua_setwarnf

+[-0, +0, –] +

void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud);
+ +

+Sets the warning function to be used by Lua to emit warnings +(see lua_WarnFunction). +The ud parameter sets the value ud passed to +the warning function. + + + + + +


lua_State

+
typedef struct lua_State lua_State;
+ +

+An opaque structure that points to a thread and indirectly +(through the thread) to the whole state of a Lua interpreter. +The Lua library is fully reentrant: +it has no global variables. +All information about a state is accessible through this structure. + + +

+A pointer to this structure must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch. + + + + + +


lua_status

+[-0, +0, –] +

int lua_status (lua_State *L);
+ +

+Returns the status of the thread L. + + +

+The status can be LUA_OK for a normal thread, +an error code if the thread finished the execution +of a lua_resume with an error, +or LUA_YIELD if the thread is suspended. + + +

+You can call functions only in threads with status LUA_OK. +You can resume threads with status LUA_OK +(to start a new coroutine) or LUA_YIELD +(to resume a coroutine). + + + + + +


lua_stringtonumber

+[-0, +1, –] +

size_t lua_stringtonumber (lua_State *L, const char *s);
+ +

+Converts the zero-terminated string s to a number, +pushes that number into the stack, +and returns the total size of the string, +that is, its length plus one. +The conversion can result in an integer or a float, +according to the lexical conventions of Lua (see §3.1). +The string may have leading and trailing whitespaces and a sign. +If the string is not a valid numeral, +returns 0 and pushes nothing. +(Note that the result can be used as a boolean, +true if the conversion succeeds.) + + + + + +


lua_toboolean

+[-0, +0, –] +

int lua_toboolean (lua_State *L, int index);
+ +

+Converts the Lua value at the given index to a C boolean +value (0 or 1). +Like all tests in Lua, +lua_toboolean returns true for any Lua value +different from false and nil; +otherwise it returns false. +(If you want to accept only actual boolean values, +use lua_isboolean to test the value's type.) + + + + + +


lua_tocfunction

+[-0, +0, –] +

lua_CFunction lua_tocfunction (lua_State *L, int index);
+ +

+Converts a value at the given index to a C function. +That value must be a C function; +otherwise, returns NULL. + + + + + +


lua_toclose

+[-0, +0, m] +

void lua_toclose (lua_State *L, int index);
+ +

+Marks the given index in the stack as a +to-be-closed slot (see §3.3.8). +Like a to-be-closed variable in Lua, +the value at that slot in the stack will be closed +when it goes out of scope. +Here, in the context of a C function, +to go out of scope means that the running function returns to Lua, +or there is an error, +or the slot is removed from the stack through +lua_settop or lua_pop, +or there is a call to lua_closeslot. +A slot marked as to-be-closed should not be removed from the stack +by any other function in the API except lua_settop or lua_pop, +unless previously deactivated by lua_closeslot. + + +

+This function should not be called for an index +that is equal to or below an active to-be-closed slot. + + +

+Note that, both in case of errors and of a regular return, +by the time the __close metamethod runs, +the C stack was already unwound, +so that any automatic C variable declared in the calling function +(e.g., a buffer) will be out of scope. + + + + + +


lua_tointeger

+[-0, +0, –] +

lua_Integer lua_tointeger (lua_State *L, int index);
+ +

+Equivalent to lua_tointegerx with isnum equal to NULL. + + + + + +


lua_tointegerx

+[-0, +0, –] +

lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);
+ +

+Converts the Lua value at the given index +to the signed integral type lua_Integer. +The Lua value must be an integer, +or a number or string convertible to an integer (see §3.4.3); +otherwise, lua_tointegerx returns 0. + + +

+If isnum is not NULL, +its referent is assigned a boolean value that +indicates whether the operation succeeded. + + + + + +


lua_tolstring

+[-0, +0, m] +

const char *lua_tolstring (lua_State *L, int index, size_t *len);
+ +

+Converts the Lua value at the given index to a C string. +If len is not NULL, +it sets *len with the string length. +The Lua value must be a string or a number; +otherwise, the function returns NULL. +If the value is a number, +then lua_tolstring also +changes the actual value in the stack to a string. +(This change confuses lua_next +when lua_tolstring is applied to keys during a table traversal.) + + +

+lua_tolstring returns a pointer +to a string inside the Lua state (see §4.1.3). +This string always has a zero ('\0') +after its last character (as in C), +but can contain other zeros in its body. + + + + + +


lua_tonumber

+[-0, +0, –] +

lua_Number lua_tonumber (lua_State *L, int index);
+ +

+Equivalent to lua_tonumberx with isnum equal to NULL. + + + + + +


lua_tonumberx

+[-0, +0, –] +

lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);
+ +

+Converts the Lua value at the given index +to the C type lua_Number (see lua_Number). +The Lua value must be a number or a string convertible to a number +(see §3.4.3); +otherwise, lua_tonumberx returns 0. + + +

+If isnum is not NULL, +its referent is assigned a boolean value that +indicates whether the operation succeeded. + + + + + +


lua_topointer

+[-0, +0, –] +

const void *lua_topointer (lua_State *L, int index);
+ +

+Converts the value at the given index to a generic +C pointer (void*). +The value can be a userdata, a table, a thread, a string, or a function; +otherwise, lua_topointer returns NULL. +Different objects will give different pointers. +There is no way to convert the pointer back to its original value. + + +

+Typically this function is used only for hashing and debug information. + + + + + +


lua_tostring

+[-0, +0, m] +

const char *lua_tostring (lua_State *L, int index);
+ +

+Equivalent to lua_tolstring with len equal to NULL. + + + + + +


lua_tothread

+[-0, +0, –] +

lua_State *lua_tothread (lua_State *L, int index);
+ +

+Converts the value at the given index to a Lua thread +(represented as lua_State*). +This value must be a thread; +otherwise, the function returns NULL. + + + + + +


lua_touserdata

+[-0, +0, –] +

void *lua_touserdata (lua_State *L, int index);
+ +

+If the value at the given index is a full userdata, +returns its memory-block address. +If the value is a light userdata, +returns its value (a pointer). +Otherwise, returns NULL. + + + + + +


lua_type

+[-0, +0, –] +

int lua_type (lua_State *L, int index);
+ +

+Returns the type of the value in the given valid index, +or LUA_TNONE for a non-valid but acceptable index. +The types returned by lua_type are coded by the following constants +defined in lua.h: +LUA_TNIL, +LUA_TNUMBER, +LUA_TBOOLEAN, +LUA_TSTRING, +LUA_TTABLE, +LUA_TFUNCTION, +LUA_TUSERDATA, +LUA_TTHREAD, +and +LUA_TLIGHTUSERDATA. + + + + + +


lua_typename

+[-0, +0, –] +

const char *lua_typename (lua_State *L, int tp);
+ +

+Returns the name of the type encoded by the value tp, +which must be one the values returned by lua_type. + + + + + +


lua_Unsigned

+
typedef ... lua_Unsigned;
+ +

+The unsigned version of lua_Integer. + + + + + +


lua_upvalueindex

+[-0, +0, –] +

int lua_upvalueindex (int i);
+ +

+Returns the pseudo-index that represents the i-th upvalue of +the running function (see §4.2). +i must be in the range [1,256]. + + + + + +


lua_version

+[-0, +0, –] +

lua_Number lua_version (lua_State *L);
+ +

+Returns the version number of this core. + + + + + +


lua_WarnFunction

+
typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
+ +

+The type of warning functions, called by Lua to emit warnings. +The first parameter is an opaque pointer +set by lua_setwarnf. +The second parameter is the warning message. +The third parameter is a boolean that +indicates whether the message is +to be continued by the message in the next call. + + +

+See warn for more details about warnings. + + + + + +


lua_warning

+[-0, +0, –] +

void lua_warning (lua_State *L, const char *msg, int tocont);
+ +

+Emits a warning with the given message. +A message in a call with tocont true should be +continued in another call to this function. + + +

+See warn for more details about warnings. + + + + + +


lua_Writer

+
typedef int (*lua_Writer) (lua_State *L,
+                           const void* p,
+                           size_t sz,
+                           void* ud);
+ +

+The type of the writer function used by lua_dump. +Every time lua_dump produces another piece of chunk, +it calls the writer, +passing along the buffer to be written (p), +its size (sz), +and the ud parameter supplied to lua_dump. + + +

+The writer returns an error code: +0 means no errors; +any other value means an error and stops lua_dump from +calling the writer again. + + + + + +


lua_xmove

+[-?, +?, –] +

void lua_xmove (lua_State *from, lua_State *to, int n);
+ +

+Exchange values between different threads of the same state. + + +

+This function pops n values from the stack from, +and pushes them onto the stack to. + + + + + +


lua_yield

+[-?, +?, v] +

int lua_yield (lua_State *L, int nresults);
+ +

+This function is equivalent to lua_yieldk, +but it has no continuation (see §4.5). +Therefore, when the thread resumes, +it continues the function that called +the function calling lua_yield. +To avoid surprises, +this function should be called only in a tail call. + + + + + +


lua_yieldk

+[-?, +?, v] +

int lua_yieldk (lua_State *L,
+                int nresults,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+Yields a coroutine (thread). + + +

+When a C function calls lua_yieldk, +the running coroutine suspends its execution, +and the call to lua_resume that started this coroutine returns. +The parameter nresults is the number of values from the stack +that will be passed as results to lua_resume. + + +

+When the coroutine is resumed again, +Lua calls the given continuation function k to continue +the execution of the C function that yielded (see §4.5). +This continuation function receives the same stack +from the previous function, +with the n results removed and +replaced by the arguments passed to lua_resume. +Moreover, +the continuation function receives the value ctx +that was passed to lua_yieldk. + + +

+Usually, this function does not return; +when the coroutine eventually resumes, +it continues executing the continuation function. +However, there is one special case, +which is when this function is called +from inside a line or a count hook (see §4.7). +In that case, lua_yieldk should be called with no continuation +(probably in the form of lua_yield) and no results, +and the hook should return immediately after the call. +Lua will yield and, +when the coroutine resumes again, +it will continue the normal execution +of the (Lua) function that triggered the hook. + + +

+This function can raise an error if it is called from a thread +with a pending C call with no continuation function +(what is called a C-call boundary), +or it is called from a thread that is not running inside a resume +(typically the main thread). + + + + + + + +

4.7 – The Debug Interface

+ +

+Lua has no built-in debugging facilities. +Instead, it offers a special interface +by means of functions and hooks. +This interface allows the construction of different +kinds of debuggers, profilers, and other tools +that need "inside information" from the interpreter. + + + +


lua_Debug

+
typedef struct lua_Debug {
+  int event;
+  const char *name;           /* (n) */
+  const char *namewhat;       /* (n) */
+  const char *what;           /* (S) */
+  const char *source;         /* (S) */
+  size_t srclen;              /* (S) */
+  int currentline;            /* (l) */
+  int linedefined;            /* (S) */
+  int lastlinedefined;        /* (S) */
+  unsigned char nups;         /* (u) number of upvalues */
+  unsigned char nparams;      /* (u) number of parameters */
+  char isvararg;              /* (u) */
+  char istailcall;            /* (t) */
+  unsigned short ftransfer;   /* (r) index of first value transferred */
+  unsigned short ntransfer;   /* (r) number of transferred values */
+  char short_src[LUA_IDSIZE]; /* (S) */
+  /* private part */
+  other fields
+} lua_Debug;
+ +

+A structure used to carry different pieces of +information about a function or an activation record. +lua_getstack fills only the private part +of this structure, for later use. +To fill the other fields of lua_Debug with useful information, +you must call lua_getinfo with an appropriate parameter. +(Specifically, to get a field, +you must add the letter between parentheses in the field's comment +to the parameter what of lua_getinfo.) + + +

+The fields of lua_Debug have the following meaning: + +

    + +
  • source: +the source of the chunk that created the function. +If source starts with a '@', +it means that the function was defined in a file where +the file name follows the '@'. +If source starts with a '=', +the remainder of its contents describes the source in a user-dependent manner. +Otherwise, +the function was defined in a string where +source is that string. +
  • + +
  • srclen: +The length of the string source. +
  • + +
  • short_src: +a "printable" version of source, to be used in error messages. +
  • + +
  • linedefined: +the line number where the definition of the function starts. +
  • + +
  • lastlinedefined: +the line number where the definition of the function ends. +
  • + +
  • what: +the string "Lua" if the function is a Lua function, +"C" if it is a C function, +"main" if it is the main part of a chunk. +
  • + +
  • currentline: +the current line where the given function is executing. +When no line information is available, +currentline is set to -1. +
  • + +
  • name: +a reasonable name for the given function. +Because functions in Lua are first-class values, +they do not have a fixed name: +some functions can be the value of multiple global variables, +while others can be stored only in a table field. +The lua_getinfo function checks how the function was +called to find a suitable name. +If it cannot find a name, +then name is set to NULL. +
  • + +
  • namewhat: +explains the name field. +The value of namewhat can be +"global", "local", "method", +"field", "upvalue", or "" (the empty string), +according to how the function was called. +(Lua uses the empty string when no other option seems to apply.) +
  • + +
  • istailcall: +true if this function invocation was called by a tail call. +In this case, the caller of this level is not in the stack. +
  • + +
  • nups: +the number of upvalues of the function. +
  • + +
  • nparams: +the number of parameters of the function +(always 0 for C functions). +
  • + +
  • isvararg: +true if the function is a variadic function +(always true for C functions). +
  • + +
  • ftransfer: +the index in the stack of the first value being "transferred", +that is, parameters in a call or return values in a return. +(The other values are in consecutive indices.) +Using this index, you can access and modify these values +through lua_getlocal and lua_setlocal. +This field is only meaningful during a +call hook, denoting the first parameter, +or a return hook, denoting the first value being returned. +(For call hooks, this value is always 1.) +
  • + +
  • ntransfer: +The number of values being transferred (see previous item). +(For calls of Lua functions, +this value is always equal to nparams.) +
  • + +
+ + + + +

lua_gethook

+[-0, +0, –] +

lua_Hook lua_gethook (lua_State *L);
+ +

+Returns the current hook function. + + + + + +


lua_gethookcount

+[-0, +0, –] +

int lua_gethookcount (lua_State *L);
+ +

+Returns the current hook count. + + + + + +


lua_gethookmask

+[-0, +0, –] +

int lua_gethookmask (lua_State *L);
+ +

+Returns the current hook mask. + + + + + +


lua_getinfo

+[-(0|1), +(0|1|2), m] +

int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+ +

+Gets information about a specific function or function invocation. + + +

+To get information about a function invocation, +the parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). + + +

+To get information about a function, you push it onto the stack +and start the what string with the character '>'. +(In that case, +lua_getinfo pops the function from the top of the stack.) +For instance, to know in which line a function f was defined, +you can write the following code: + +

+     lua_Debug ar;
+     lua_getglobal(L, "f");  /* get global 'f' */
+     lua_getinfo(L, ">S", &ar);
+     printf("%d\n", ar.linedefined);
+
+ +

+Each character in the string what +selects some fields of the structure ar to be filled or +a value to be pushed on the stack. +(These characters are also documented in the declaration of +the structure lua_Debug, +between parentheses in the comments following each field.) + +

    + +
  • 'f': +pushes onto the stack the function that is +running at the given level; +
  • + +
  • 'l': fills in the field currentline; +
  • + +
  • 'n': fills in the fields name and namewhat; +
  • + +
  • 'r': fills in the fields ftransfer and ntransfer; +
  • + +
  • 'S': +fills in the fields source, short_src, +linedefined, lastlinedefined, and what; +
  • + +
  • 't': fills in the field istailcall; +
  • + +
  • 'u': fills in the fields +nups, nparams, and isvararg; +
  • + +
  • 'L': +pushes onto the stack a table whose indices are +the lines on the function with some associated code, +that is, the lines where you can put a break point. +(Lines with no code include empty lines and comments.) +If this option is given together with option 'f', +its table is pushed after the function. +This is the only option that can raise a memory error. +
  • + +
+ +

+This function returns 0 to signal an invalid option in what; +even then the valid options are handled correctly. + + + + + +


lua_getlocal

+[-0, +(0|1), –] +

const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+ +

+Gets information about a local variable or a temporary value +of a given activation record or a given function. + + +

+In the first case, +the parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). +The index n selects which local variable to inspect; +see debug.getlocal for details about variable indices +and names. + + +

+lua_getlocal pushes the variable's value onto the stack +and returns its name. + + +

+In the second case, ar must be NULL and the function +to be inspected must be on the top of the stack. +In this case, only parameters of Lua functions are visible +(as there is no information about what variables are active) +and no values are pushed onto the stack. + + +

+Returns NULL (and pushes nothing) +when the index is greater than +the number of active local variables. + + + + + +


lua_getstack

+[-0, +0, –] +

int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+ +

+Gets information about the interpreter runtime stack. + + +

+This function fills parts of a lua_Debug structure with +an identification of the activation record +of the function executing at a given level. +Level 0 is the current running function, +whereas level n+1 is the function that has called level n +(except for tail calls, which do not count in the stack). +When called with a level greater than the stack depth, +lua_getstack returns 0; +otherwise it returns 1. + + + + + +


lua_getupvalue

+[-0, +(0|1), –] +

const char *lua_getupvalue (lua_State *L, int funcindex, int n);
+ +

+Gets information about the n-th upvalue +of the closure at index funcindex. +It pushes the upvalue's value onto the stack +and returns its name. +Returns NULL (and pushes nothing) +when the index n is greater than the number of upvalues. + + +

+See debug.getupvalue for more information about upvalues. + + + + + +


lua_Hook

+
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+ +

+Type for debugging hook functions. + + +

+Whenever a hook is called, its ar argument has its field +event set to the specific event that triggered the hook. +Lua identifies these events with the following constants: +LUA_HOOKCALL, LUA_HOOKRET, +LUA_HOOKTAILCALL, LUA_HOOKLINE, +and LUA_HOOKCOUNT. +Moreover, for line events, the field currentline is also set. +To get the value of any other field in ar, +the hook must call lua_getinfo. + + +

+For call events, event can be LUA_HOOKCALL, +the normal value, or LUA_HOOKTAILCALL, for a tail call; +in this case, there will be no corresponding return event. + + +

+While Lua is running a hook, it disables other calls to hooks. +Therefore, if a hook calls back Lua to execute a function or a chunk, +this execution occurs without any calls to hooks. + + +

+Hook functions cannot have continuations, +that is, they cannot call lua_yieldk, +lua_pcallk, or lua_callk with a non-null k. + + +

+Hook functions can yield under the following conditions: +Only count and line events can yield; +to yield, a hook function must finish its execution +calling lua_yield with nresults equal to zero +(that is, with no values). + + + + + +


lua_sethook

+[-0, +0, –] +

void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);
+ +

+Sets the debugging hook function. + + +

+Argument f is the hook function. +mask specifies on which events the hook will be called: +it is formed by a bitwise OR of the constants +LUA_MASKCALL, +LUA_MASKRET, +LUA_MASKLINE, +and LUA_MASKCOUNT. +The count argument is only meaningful when the mask +includes LUA_MASKCOUNT. +For each event, the hook is called as explained below: + +

    + +
  • The call hook: is called when the interpreter calls a function. +The hook is called just after Lua enters the new function. +
  • + +
  • The return hook: is called when the interpreter returns from a function. +The hook is called just before Lua leaves the function. +
  • + +
  • The line hook: is called when the interpreter is about to +start the execution of a new line of code, +or when it jumps back in the code (even to the same line). +This event only happens while Lua is executing a Lua function. +
  • + +
  • The count hook: is called after the interpreter executes every +count instructions. +This event only happens while Lua is executing a Lua function. +
  • + +
+ +

+Hooks are disabled by setting mask to zero. + + + + + +


lua_setlocal

+[-(0|1), +0, –] +

const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+ +

+Sets the value of a local variable of a given activation record. +It assigns the value on the top of the stack +to the variable and returns its name. +It also pops the value from the stack. + + +

+Returns NULL (and pops nothing) +when the index is greater than +the number of active local variables. + + +

+Parameters ar and n are as in the function lua_getlocal. + + + + + +


lua_setupvalue

+[-(0|1), +0, –] +

const char *lua_setupvalue (lua_State *L, int funcindex, int n);
+ +

+Sets the value of a closure's upvalue. +It assigns the value on the top of the stack +to the upvalue and returns its name. +It also pops the value from the stack. + + +

+Returns NULL (and pops nothing) +when the index n is greater than the number of upvalues. + + +

+Parameters funcindex and n are as in +the function lua_getupvalue. + + + + + +


lua_upvalueid

+[-0, +0, –] +

void *lua_upvalueid (lua_State *L, int funcindex, int n);
+ +

+Returns a unique identifier for the upvalue numbered n +from the closure at index funcindex. + + +

+These unique identifiers allow a program to check whether different +closures share upvalues. +Lua closures that share an upvalue +(that is, that access a same external local variable) +will return identical ids for those upvalue indices. + + +

+Parameters funcindex and n are as in +the function lua_getupvalue, +but n cannot be greater than the number of upvalues. + + + + + +


lua_upvaluejoin

+[-0, +0, –] +

void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
+                                    int funcindex2, int n2);
+ +

+Make the n1-th upvalue of the Lua closure at index funcindex1 +refer to the n2-th upvalue of the Lua closure at index funcindex2. + + + + + + + +

5 – The Auxiliary Library

+ + + +

+ +The auxiliary library provides several convenient functions +to interface C with Lua. +While the basic API provides the primitive functions for all +interactions between C and Lua, +the auxiliary library provides higher-level functions for some +common tasks. + + +

+All functions and types from the auxiliary library +are defined in header file lauxlib.h and +have a prefix luaL_. + + +

+All functions in the auxiliary library are built on +top of the basic API, +and so they provide nothing that cannot be done with that API. +Nevertheless, the use of the auxiliary library ensures +more consistency to your code. + + +

+Several functions in the auxiliary library use internally some +extra stack slots. +When a function in the auxiliary library uses less than five slots, +it does not check the stack size; +it simply assumes that there are enough slots. + + +

+Several functions in the auxiliary library are used to +check C function arguments. +Because the error message is formatted for arguments +(e.g., "bad argument #1"), +you should not use these functions for other stack values. + + +

+Functions called luaL_check* +always raise an error if the check is not satisfied. + + + + + +

5.1 – Functions and Types

+ +

+Here we list all functions and types from the auxiliary library +in alphabetical order. + + + +


luaL_addchar

+[-?, +?, m] +

void luaL_addchar (luaL_Buffer *B, char c);
+ +

+Adds the byte c to the buffer B +(see luaL_Buffer). + + + + + +


luaL_addgsub

+[-?, +?, m] +

const void luaL_addgsub (luaL_Buffer *B, const char *s,
+                         const char *p, const char *r);
+ +

+Adds a copy of the string s to the buffer B (see luaL_Buffer), +replacing any occurrence of the string p +with the string r. + + + + + +


luaL_addlstring

+[-?, +?, m] +

void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
+ +

+Adds the string pointed to by s with length l to +the buffer B +(see luaL_Buffer). +The string can contain embedded zeros. + + + + + +


luaL_addsize

+[-?, +?, –] +

void luaL_addsize (luaL_Buffer *B, size_t n);
+ +

+Adds to the buffer B +a string of length n previously copied to the +buffer area (see luaL_prepbuffer). + + + + + +


luaL_addstring

+[-?, +?, m] +

void luaL_addstring (luaL_Buffer *B, const char *s);
+ +

+Adds the zero-terminated string pointed to by s +to the buffer B +(see luaL_Buffer). + + + + + +


luaL_addvalue

+[-?, +?, m] +

void luaL_addvalue (luaL_Buffer *B);
+ +

+Adds the value on the top of the stack +to the buffer B +(see luaL_Buffer). +Pops the value. + + +

+This is the only function on string buffers that can (and must) +be called with an extra element on the stack, +which is the value to be added to the buffer. + + + + + +


luaL_argcheck

+[-0, +0, v] +

void luaL_argcheck (lua_State *L,
+                    int cond,
+                    int arg,
+                    const char *extramsg);
+ +

+Checks whether cond is true. +If it is not, raises an error with a standard message (see luaL_argerror). + + + + + +


luaL_argerror

+[-0, +0, v] +

int luaL_argerror (lua_State *L, int arg, const char *extramsg);
+ +

+Raises an error reporting a problem with argument arg +of the C function that called it, +using a standard message +that includes extramsg as a comment: + +

+     bad argument #arg to 'funcname' (extramsg)
+

+This function never returns. + + + + + +


luaL_argexpected

+[-0, +0, v] +

void luaL_argexpected (lua_State *L,
+                       int cond,
+                       int arg,
+                       const char *tname);
+ +

+Checks whether cond is true. +If it is not, raises an error about the type of the argument arg +with a standard message (see luaL_typeerror). + + + + + +


luaL_Buffer

+
typedef struct luaL_Buffer luaL_Buffer;
+ +

+Type for a string buffer. + + +

+A string buffer allows C code to build Lua strings piecemeal. +Its pattern of use is as follows: + +

    + +
  • First declare a variable b of type luaL_Buffer.
  • + +
  • Then initialize it with a call luaL_buffinit(L, &b).
  • + +
  • +Then add string pieces to the buffer calling any of +the luaL_add* functions. +
  • + +
  • +Finish by calling luaL_pushresult(&b). +This call leaves the final string on the top of the stack. +
  • + +
+ +

+If you know beforehand the maximum size of the resulting string, +you can use the buffer like this: + +

    + +
  • First declare a variable b of type luaL_Buffer.
  • + +
  • Then initialize it and preallocate a space of +size sz with a call luaL_buffinitsize(L, &b, sz).
  • + +
  • Then produce the string into that space.
  • + +
  • +Finish by calling luaL_pushresultsize(&b, sz), +where sz is the total size of the resulting string +copied into that space (which may be less than or +equal to the preallocated size). +
  • + +
+ +

+During its normal operation, +a string buffer uses a variable number of stack slots. +So, while using a buffer, you cannot assume that you know where +the top of the stack is. +You can use the stack between successive calls to buffer operations +as long as that use is balanced; +that is, +when you call a buffer operation, +the stack is at the same level +it was immediately after the previous buffer operation. +(The only exception to this rule is luaL_addvalue.) +After calling luaL_pushresult, +the stack is back to its level when the buffer was initialized, +plus the final string on its top. + + + + + +


luaL_buffaddr

+[-0, +0, –] +

char *luaL_buffaddr (luaL_Buffer *B);
+ +

+Returns the address of the current content of buffer B +(see luaL_Buffer). +Note that any addition to the buffer may invalidate this address. + + + + + +


luaL_buffinit

+[-0, +?, –] +

void luaL_buffinit (lua_State *L, luaL_Buffer *B);
+ +

+Initializes a buffer B +(see luaL_Buffer). +This function does not allocate any space; +the buffer must be declared as a variable. + + + + + +


luaL_bufflen

+[-0, +0, –] +

size_t luaL_bufflen (luaL_Buffer *B);
+ +

+Returns the length of the current content of buffer B +(see luaL_Buffer). + + + + + +


luaL_buffinitsize

+[-?, +?, m] +

char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);
+ +

+Equivalent to the sequence +luaL_buffinit, luaL_prepbuffsize. + + + + + +


luaL_buffsub

+[-?, +?, –] +

void luaL_buffsub (luaL_Buffer *B, int n);
+ +

+Removes n bytes from the buffer B +(see luaL_Buffer). +The buffer must have at least that many bytes. + + + + + +


luaL_callmeta

+[-0, +(0|1), e] +

int luaL_callmeta (lua_State *L, int obj, const char *e);
+ +

+Calls a metamethod. + + +

+If the object at index obj has a metatable and this +metatable has a field e, +this function calls this field passing the object as its only argument. +In this case this function returns true and pushes onto the +stack the value returned by the call. +If there is no metatable or no metamethod, +this function returns false without pushing any value on the stack. + + + + + +


luaL_checkany

+[-0, +0, v] +

void luaL_checkany (lua_State *L, int arg);
+ +

+Checks whether the function has an argument +of any type (including nil) at position arg. + + + + + +


luaL_checkinteger

+[-0, +0, v] +

lua_Integer luaL_checkinteger (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is an integer +(or can be converted to an integer) +and returns this integer. + + + + + +


luaL_checklstring

+[-0, +0, v] +

const char *luaL_checklstring (lua_State *L, int arg, size_t *l);
+ +

+Checks whether the function argument arg is a string +and returns this string; +if l is not NULL fills its referent +with the string's length. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_checknumber

+[-0, +0, v] +

lua_Number luaL_checknumber (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is a number +and returns this number converted to a lua_Number. + + + + + +


luaL_checkoption

+[-0, +0, v] +

int luaL_checkoption (lua_State *L,
+                      int arg,
+                      const char *def,
+                      const char *const lst[]);
+ +

+Checks whether the function argument arg is a string and +searches for this string in the array lst +(which must be NULL-terminated). +Returns the index in the array where the string was found. +Raises an error if the argument is not a string or +if the string cannot be found. + + +

+If def is not NULL, +the function uses def as a default value when +there is no argument arg or when this argument is nil. + + +

+This is a useful function for mapping strings to C enums. +(The usual convention in Lua libraries is +to use strings instead of numbers to select options.) + + + + + +


luaL_checkstack

+[-0, +0, v] +

void luaL_checkstack (lua_State *L, int sz, const char *msg);
+ +

+Grows the stack size to top + sz elements, +raising an error if the stack cannot grow to that size. +msg is an additional text to go into the error message +(or NULL for no additional text). + + + + + +


luaL_checkstring

+[-0, +0, v] +

const char *luaL_checkstring (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is a string +and returns this string. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_checktype

+[-0, +0, v] +

void luaL_checktype (lua_State *L, int arg, int t);
+ +

+Checks whether the function argument arg has type t. +See lua_type for the encoding of types for t. + + + + + +


luaL_checkudata

+[-0, +0, v] +

void *luaL_checkudata (lua_State *L, int arg, const char *tname);
+ +

+Checks whether the function argument arg is a userdata +of the type tname (see luaL_newmetatable) and +returns the userdata's memory-block address (see lua_touserdata). + + + + + +


luaL_checkversion

+[-0, +0, v] +

void luaL_checkversion (lua_State *L);
+ +

+Checks whether the code making the call and the Lua library being called +are using the same version of Lua and the same numeric types. + + + + + +


luaL_dofile

+[-0, +?, m] +

int luaL_dofile (lua_State *L, const char *filename);
+ +

+Loads and runs the given file. +It is defined as the following macro: + +

+     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
+

+It returns 0 (LUA_OK) if there are no errors, +or 1 in case of errors. + + + + + +


luaL_dostring

+[-0, +?, –] +

int luaL_dostring (lua_State *L, const char *str);
+ +

+Loads and runs the given string. +It is defined as the following macro: + +

+     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
+

+It returns 0 (LUA_OK) if there are no errors, +or 1 in case of errors. + + + + + +


luaL_error

+[-0, +0, v] +

int luaL_error (lua_State *L, const char *fmt, ...);
+ +

+Raises an error. +The error message format is given by fmt +plus any extra arguments, +following the same rules of lua_pushfstring. +It also adds at the beginning of the message the file name and +the line number where the error occurred, +if this information is available. + + +

+This function never returns, +but it is an idiom to use it in C functions +as return luaL_error(args). + + + + + +


luaL_execresult

+[-0, +3, m] +

int luaL_execresult (lua_State *L, int stat);
+ +

+This function produces the return values for +process-related functions in the standard library +(os.execute and io.close). + + + + + +


luaL_fileresult

+[-0, +(1|3), m] +

int luaL_fileresult (lua_State *L, int stat, const char *fname);
+ +

+This function produces the return values for +file-related functions in the standard library +(io.open, os.rename, file:seek, etc.). + + + + + +


luaL_getmetafield

+[-0, +(0|1), m] +

int luaL_getmetafield (lua_State *L, int obj, const char *e);
+ +

+Pushes onto the stack the field e from the metatable +of the object at index obj and returns the type of the pushed value. +If the object does not have a metatable, +or if the metatable does not have this field, +pushes nothing and returns LUA_TNIL. + + + + + +


luaL_getmetatable

+[-0, +1, m] +

int luaL_getmetatable (lua_State *L, const char *tname);
+ +

+Pushes onto the stack the metatable associated with the name tname +in the registry (see luaL_newmetatable), +or nil if there is no metatable associated with that name. +Returns the type of the pushed value. + + + + + +


luaL_getsubtable

+[-0, +1, e] +

int luaL_getsubtable (lua_State *L, int idx, const char *fname);
+ +

+Ensures that the value t[fname], +where t is the value at index idx, +is a table, +and pushes that table onto the stack. +Returns true if it finds a previous table there +and false if it creates a new table. + + + + + +


luaL_gsub

+[-0, +1, m] +

const char *luaL_gsub (lua_State *L,
+                       const char *s,
+                       const char *p,
+                       const char *r);
+ +

+Creates a copy of string s, +replacing any occurrence of the string p +with the string r. +Pushes the resulting string on the stack and returns it. + + + + + +


luaL_len

+[-0, +0, e] +

lua_Integer luaL_len (lua_State *L, int index);
+ +

+Returns the "length" of the value at the given index +as a number; +it is equivalent to the '#' operator in Lua (see §3.4.7). +Raises an error if the result of the operation is not an integer. +(This case can only happen through metamethods.) + + + + + +


luaL_loadbuffer

+[-0, +1, –] +

int luaL_loadbuffer (lua_State *L,
+                     const char *buff,
+                     size_t sz,
+                     const char *name);
+ +

+Equivalent to luaL_loadbufferx with mode equal to NULL. + + + + + +


luaL_loadbufferx

+[-0, +1, –] +

int luaL_loadbufferx (lua_State *L,
+                      const char *buff,
+                      size_t sz,
+                      const char *name,
+                      const char *mode);
+ +

+Loads a buffer as a Lua chunk. +This function uses lua_load to load the chunk in the +buffer pointed to by buff with size sz. + + +

+This function returns the same results as lua_load. +name is the chunk name, +used for debug information and error messages. +The string mode works as in the function lua_load. + + + + + +


luaL_loadfile

+[-0, +1, m] +

int luaL_loadfile (lua_State *L, const char *filename);
+ +

+Equivalent to luaL_loadfilex with mode equal to NULL. + + + + + +


luaL_loadfilex

+[-0, +1, m] +

int luaL_loadfilex (lua_State *L, const char *filename,
+                                            const char *mode);
+ +

+Loads a file as a Lua chunk. +This function uses lua_load to load the chunk in the file +named filename. +If filename is NULL, +then it loads from the standard input. +The first line in the file is ignored if it starts with a #. + + +

+The string mode works as in the function lua_load. + + +

+This function returns the same results as lua_load +or LUA_ERRFILE for file-related errors. + + +

+As lua_load, this function only loads the chunk; +it does not run it. + + + + + +


luaL_loadstring

+[-0, +1, –] +

int luaL_loadstring (lua_State *L, const char *s);
+ +

+Loads a string as a Lua chunk. +This function uses lua_load to load the chunk in +the zero-terminated string s. + + +

+This function returns the same results as lua_load. + + +

+Also as lua_load, this function only loads the chunk; +it does not run it. + + + + + +


luaL_newlib

+[-0, +1, m] +

void luaL_newlib (lua_State *L, const luaL_Reg l[]);
+ +

+Creates a new table and registers there +the functions in the list l. + + +

+It is implemented as the following macro: + +

+     (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
+

+The array l must be the actual array, +not a pointer to it. + + + + + +


luaL_newlibtable

+[-0, +1, m] +

void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);
+ +

+Creates a new table with a size optimized +to store all entries in the array l +(but does not actually store them). +It is intended to be used in conjunction with luaL_setfuncs +(see luaL_newlib). + + +

+It is implemented as a macro. +The array l must be the actual array, +not a pointer to it. + + + + + +


luaL_newmetatable

+[-0, +1, m] +

int luaL_newmetatable (lua_State *L, const char *tname);
+ +

+If the registry already has the key tname, +returns 0. +Otherwise, +creates a new table to be used as a metatable for userdata, +adds to this new table the pair __name = tname, +adds to the registry the pair [tname] = new table, +and returns 1. + + +

+In both cases, +the function pushes onto the stack the final value associated +with tname in the registry. + + + + + +


luaL_newstate

+[-0, +0, –] +

lua_State *luaL_newstate (void);
+ +

+Creates a new Lua state. +It calls lua_newstate with an +allocator based on the ISO C allocation functions +and then sets a warning function and a panic function (see §4.4) +that print messages to the standard error output. + + +

+Returns the new state, +or NULL if there is a memory allocation error. + + + + + +


luaL_openlibs

+[-0, +0, e] +

void luaL_openlibs (lua_State *L);
+ +

+Opens all standard Lua libraries into the given state. + + + + + +


luaL_opt

+[-0, +0, –] +

T luaL_opt (L, func, arg, dflt);
+ +

+This macro is defined as follows: + +

+     (lua_isnoneornil(L,(arg)) ? (dflt) : func(L,(arg)))
+

+In words, if the argument arg is nil or absent, +the macro results in the default dflt. +Otherwise, it results in the result of calling func +with the state L and the argument index arg as +arguments. +Note that it evaluates the expression dflt only if needed. + + + + + +


luaL_optinteger

+[-0, +0, v] +

lua_Integer luaL_optinteger (lua_State *L,
+                             int arg,
+                             lua_Integer d);
+ +

+If the function argument arg is an integer +(or it is convertible to an integer), +returns this integer. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_optlstring

+[-0, +0, v] +

const char *luaL_optlstring (lua_State *L,
+                             int arg,
+                             const char *d,
+                             size_t *l);
+ +

+If the function argument arg is a string, +returns this string. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + +

+If l is not NULL, +fills its referent with the result's length. +If the result is NULL +(only possible when returning d and d == NULL), +its length is considered zero. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_optnumber

+[-0, +0, v] +

lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);
+ +

+If the function argument arg is a number, +returns this number as a lua_Number. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_optstring

+[-0, +0, v] +

const char *luaL_optstring (lua_State *L,
+                            int arg,
+                            const char *d);
+ +

+If the function argument arg is a string, +returns this string. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_prepbuffer

+[-?, +?, m] +

char *luaL_prepbuffer (luaL_Buffer *B);
+ +

+Equivalent to luaL_prepbuffsize +with the predefined size LUAL_BUFFERSIZE. + + + + + +


luaL_prepbuffsize

+[-?, +?, m] +

char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);
+ +

+Returns an address to a space of size sz +where you can copy a string to be added to buffer B +(see luaL_Buffer). +After copying the string into this space you must call +luaL_addsize with the size of the string to actually add +it to the buffer. + + + + + +


luaL_pushfail

+[-0, +1, –] +

void luaL_pushfail (lua_State *L);
+ +

+Pushes the fail value onto the stack (see §6). + + + + + +


luaL_pushresult

+[-?, +1, m] +

void luaL_pushresult (luaL_Buffer *B);
+ +

+Finishes the use of buffer B leaving the final string on +the top of the stack. + + + + + +


luaL_pushresultsize

+[-?, +1, m] +

void luaL_pushresultsize (luaL_Buffer *B, size_t sz);
+ +

+Equivalent to the sequence luaL_addsize, luaL_pushresult. + + + + + +


luaL_ref

+[-1, +0, m] +

int luaL_ref (lua_State *L, int t);
+ +

+Creates and returns a reference, +in the table at index t, +for the object on the top of the stack (and pops the object). + + +

+A reference is a unique integer key. +As long as you do not manually add integer keys into the table t, +luaL_ref ensures the uniqueness of the key it returns. +You can retrieve an object referred by the reference r +by calling lua_rawgeti(L, t, r). +The function luaL_unref frees a reference. + + +

+If the object on the top of the stack is nil, +luaL_ref returns the constant LUA_REFNIL. +The constant LUA_NOREF is guaranteed to be different +from any reference returned by luaL_ref. + + + + + +


luaL_Reg

+
typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+ +

+Type for arrays of functions to be registered by +luaL_setfuncs. +name is the function name and func is a pointer to +the function. +Any array of luaL_Reg must end with a sentinel entry +in which both name and func are NULL. + + + + + +


luaL_requiref

+[-0, +1, e] +

void luaL_requiref (lua_State *L, const char *modname,
+                    lua_CFunction openf, int glb);
+ +

+If package.loaded[modname] is not true, +calls the function openf with the string modname as an argument +and sets the call result to package.loaded[modname], +as if that function has been called through require. + + +

+If glb is true, +also stores the module into the global modname. + + +

+Leaves a copy of the module on the stack. + + + + + +


luaL_setfuncs

+[-nup, +0, m] +

void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
+ +

+Registers all functions in the array l +(see luaL_Reg) into the table on the top of the stack +(below optional upvalues, see next). + + +

+When nup is not zero, +all functions are created with nup upvalues, +initialized with copies of the nup values +previously pushed on the stack +on top of the library table. +These values are popped from the stack after the registration. + + +

+A function with a NULL value represents a placeholder, +which is filled with false. + + + + + +


luaL_setmetatable

+[-0, +0, –] +

void luaL_setmetatable (lua_State *L, const char *tname);
+ +

+Sets the metatable of the object on the top of the stack +as the metatable associated with name tname +in the registry (see luaL_newmetatable). + + + + + +


luaL_Stream

+
typedef struct luaL_Stream {
+  FILE *f;
+  lua_CFunction closef;
+} luaL_Stream;
+ +

+The standard representation for file handles +used by the standard I/O library. + + +

+A file handle is implemented as a full userdata, +with a metatable called LUA_FILEHANDLE +(where LUA_FILEHANDLE is a macro with the actual metatable's name). +The metatable is created by the I/O library +(see luaL_newmetatable). + + +

+This userdata must start with the structure luaL_Stream; +it can contain other data after this initial structure. +The field f points to the corresponding C stream +(or it can be NULL to indicate an incompletely created handle). +The field closef points to a Lua function +that will be called to close the stream +when the handle is closed or collected; +this function receives the file handle as its sole argument and +must return either a true value, in case of success, +or a false value plus an error message, in case of error. +Once Lua calls this field, +it changes the field value to NULL +to signal that the handle is closed. + + + + + +


luaL_testudata

+[-0, +0, m] +

void *luaL_testudata (lua_State *L, int arg, const char *tname);
+ +

+This function works like luaL_checkudata, +except that, when the test fails, +it returns NULL instead of raising an error. + + + + + +


luaL_tolstring

+[-0, +1, e] +

const char *luaL_tolstring (lua_State *L, int idx, size_t *len);
+ +

+Converts any Lua value at the given index to a C string +in a reasonable format. +The resulting string is pushed onto the stack and also +returned by the function (see §4.1.3). +If len is not NULL, +the function also sets *len with the string length. + + +

+If the value has a metatable with a __tostring field, +then luaL_tolstring calls the corresponding metamethod +with the value as argument, +and uses the result of the call as its result. + + + + + +


luaL_traceback

+[-0, +1, m] +

void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
+                     int level);
+ +

+Creates and pushes a traceback of the stack L1. +If msg is not NULL, it is appended +at the beginning of the traceback. +The level parameter tells at which level +to start the traceback. + + + + + +


luaL_typeerror

+[-0, +0, v] +

int luaL_typeerror (lua_State *L, int arg, const char *tname);
+ +

+Raises a type error for the argument arg +of the C function that called it, +using a standard message; +tname is a "name" for the expected type. +This function never returns. + + + + + +


luaL_typename

+[-0, +0, –] +

const char *luaL_typename (lua_State *L, int index);
+ +

+Returns the name of the type of the value at the given index. + + + + + +


luaL_unref

+[-0, +0, –] +

void luaL_unref (lua_State *L, int t, int ref);
+ +

+Releases the reference ref from the table at index t +(see luaL_ref). +The entry is removed from the table, +so that the referred object can be collected. +The reference ref is also freed to be used again. + + +

+If ref is LUA_NOREF or LUA_REFNIL, +luaL_unref does nothing. + + + + + +


luaL_where

+[-0, +1, m] +

void luaL_where (lua_State *L, int lvl);
+ +

+Pushes onto the stack a string identifying the current position +of the control at level lvl in the call stack. +Typically this string has the following format: + +

+     chunkname:currentline:
+

+Level 0 is the running function, +level 1 is the function that called the running function, +etc. + + +

+This function is used to build a prefix for error messages. + + + + + + + +

6 – The Standard Libraries

+ + + +

+The standard Lua libraries provide useful functions +that are implemented in C through the C API. +Some of these functions provide essential services to the language +(e.g., type and getmetatable); +others provide access to outside services (e.g., I/O); +and others could be implemented in Lua itself, +but that for different reasons +deserve an implementation in C (e.g., table.sort). + + +

+All libraries are implemented through the official C API +and are provided as separate C modules. +Unless otherwise noted, +these library functions do not adjust its number of arguments +to its expected parameters. +For instance, a function documented as foo(arg) +should not be called without an argument. + + +

+The notation fail means a false value representing +some kind of failure. +(Currently, fail is equal to nil, +but that may change in future versions. +The recommendation is to always test the success of these functions +with (not status), instead of (status == nil).) + + +

+Currently, Lua has the following standard libraries: + +

    + +
  • basic library (§6.1);
  • + +
  • coroutine library (§6.2);
  • + +
  • package library (§6.3);
  • + +
  • string manipulation (§6.4);
  • + +
  • basic UTF-8 support (§6.5);
  • + +
  • table manipulation (§6.6);
  • + +
  • mathematical functions (§6.7) (sin, log, etc.);
  • + +
  • input and output (§6.8);
  • + +
  • operating system facilities (§6.9);
  • + +
  • debug facilities (§6.10).
  • + +

+Except for the basic and the package libraries, +each library provides all its functions as fields of a global table +or as methods of its objects. + + +

+To have access to these libraries, +the C host program should call the luaL_openlibs function, +which opens all standard libraries. +Alternatively, +the host program can open them individually by using +luaL_requiref to call +luaopen_base (for the basic library), +luaopen_package (for the package library), +luaopen_coroutine (for the coroutine library), +luaopen_string (for the string library), +luaopen_utf8 (for the UTF-8 library), +luaopen_table (for the table library), +luaopen_math (for the mathematical library), +luaopen_io (for the I/O library), +luaopen_os (for the operating system library), +and luaopen_debug (for the debug library). +These functions are declared in lualib.h. + + + + + +

6.1 – Basic Functions

+ +

+The basic library provides core functions to Lua. +If you do not include this library in your application, +you should check carefully whether you need to provide +implementations for some of its facilities. + + +

+


assert (v [, message])

+ + +

+Raises an error if +the value of its argument v is false (i.e., nil or false); +otherwise, returns all its arguments. +In case of error, +message is the error object; +when absent, it defaults to "assertion failed!" + + + + +

+


collectgarbage ([opt [, arg]])

+ + +

+This function is a generic interface to the garbage collector. +It performs different functions according to its first argument, opt: + +

    + +
  • "collect": +Performs a full garbage-collection cycle. +This is the default option. +
  • + +
  • "stop": +Stops automatic execution of the garbage collector. +The collector will run only when explicitly invoked, +until a call to restart it. +
  • + +
  • "restart": +Restarts automatic execution of the garbage collector. +
  • + +
  • "count": +Returns the total memory in use by Lua in Kbytes. +The value has a fractional part, +so that it multiplied by 1024 +gives the exact number of bytes in use by Lua. +
  • + +
  • "step": +Performs a garbage-collection step. +The step "size" is controlled by arg. +With a zero value, +the collector will perform one basic (indivisible) step. +For non-zero values, +the collector will perform as if that amount of memory +(in Kbytes) had been allocated by Lua. +Returns true if the step finished a collection cycle. +
  • + +
  • "isrunning": +Returns a boolean that tells whether the collector is running +(i.e., not stopped). +
  • + +
  • "incremental": +Change the collector mode to incremental. +This option can be followed by three numbers: +the garbage-collector pause, +the step multiplier, +and the step size (see §2.5.1). +A zero means to not change that value. +
  • + +
  • "generational": +Change the collector mode to generational. +This option can be followed by two numbers: +the garbage-collector minor multiplier +and the major multiplier (see §2.5.2). +A zero means to not change that value. +
  • + +

+See §2.5 for more details about garbage collection +and some of these options. + + +

+This function should not be called by a finalizer. + + + + +

+


dofile ([filename])

+Opens the named file and executes its content as a Lua chunk. +When called without arguments, +dofile executes the content of the standard input (stdin). +Returns all values returned by the chunk. +In case of errors, dofile propagates the error +to its caller. +(That is, dofile does not run in protected mode.) + + + + +

+


error (message [, level])

+Raises an error (see §2.3) with message as the error object. +This function never returns. + + +

+Usually, error adds some information about the error position +at the beginning of the message, if the message is a string. +The level argument specifies how to get the error position. +With level 1 (the default), the error position is where the +error function was called. +Level 2 points the error to where the function +that called error was called; and so on. +Passing a level 0 avoids the addition of error position information +to the message. + + + + +

+


_G

+A global variable (not a function) that +holds the global environment (see §2.2). +Lua itself does not use this variable; +changing its value does not affect any environment, +nor vice versa. + + + + +

+


getmetatable (object)

+ + +

+If object does not have a metatable, returns nil. +Otherwise, +if the object's metatable has a __metatable field, +returns the associated value. +Otherwise, returns the metatable of the given object. + + + + +

+


ipairs (t)

+ + +

+Returns three values (an iterator function, the table t, and 0) +so that the construction + +

+     for i,v in ipairs(t) do body end
+

+will iterate over the key–value pairs +(1,t[1]), (2,t[2]), ..., +up to the first absent index. + + + + +

+


load (chunk [, chunkname [, mode [, env]]])

+ + +

+Loads a chunk. + + +

+If chunk is a string, the chunk is this string. +If chunk is a function, +load calls it repeatedly to get the chunk pieces. +Each call to chunk must return a string that concatenates +with previous results. +A return of an empty string, nil, or no value signals the end of the chunk. + + +

+If there are no syntactic errors, +load returns the compiled chunk as a function; +otherwise, it returns fail plus the error message. + + +

+When you load a main chunk, +the resulting function will always have exactly one upvalue, +the _ENV variable (see §2.2). +However, +when you load a binary chunk created from a function (see string.dump), +the resulting function can have an arbitrary number of upvalues, +and there is no guarantee that its first upvalue will be +the _ENV variable. +(A non-main function may not even have an _ENV upvalue.) + + +

+Regardless, if the resulting function has any upvalues, +its first upvalue is set to the value of env, +if that parameter is given, +or to the value of the global environment. +Other upvalues are initialized with nil. +All upvalues are fresh, that is, +they are not shared with any other function. + + +

+chunkname is used as the name of the chunk for error messages +and debug information (see §4.7). +When absent, +it defaults to chunk, if chunk is a string, +or to "=(load)" otherwise. + + +

+The string mode controls whether the chunk can be text or binary +(that is, a precompiled chunk). +It may be the string "b" (only binary chunks), +"t" (only text chunks), +or "bt" (both binary and text). +The default is "bt". + + +

+It is safe to load malformed binary chunks; +load signals an appropriate error. +However, +Lua does not check the consistency of the code inside binary chunks; +running maliciously crafted bytecode can crash the interpreter. + + + + +

+


loadfile ([filename [, mode [, env]]])

+ + +

+Similar to load, +but gets the chunk from file filename +or from the standard input, +if no file name is given. + + + + +

+


next (table [, index])

+ + +

+Allows a program to traverse all fields of a table. +Its first argument is a table and its second argument +is an index in this table. +A call to next returns the next index of the table +and its associated value. +When called with nil as its second argument, +next returns an initial index +and its associated value. +When called with the last index, +or with nil in an empty table, +next returns nil. +If the second argument is absent, then it is interpreted as nil. +In particular, +you can use next(t) to check whether a table is empty. + + +

+The order in which the indices are enumerated is not specified, +even for numeric indices. +(To traverse a table in numerical order, +use a numerical for.) + + +

+You should not assign any value to a non-existent field in a table +during its traversal. +You may however modify existing fields. +In particular, you may set existing fields to nil. + + + + +

+


pairs (t)

+ + +

+If t has a metamethod __pairs, +calls it with t as argument and returns the first three +results from the call. + + +

+Otherwise, +returns three values: the next function, the table t, and nil, +so that the construction + +

+     for k,v in pairs(t) do body end
+

+will iterate over all key–value pairs of table t. + + +

+See function next for the caveats of modifying +the table during its traversal. + + + + +

+


pcall (f [, arg1, ···])

+ + +

+Calls the function f with +the given arguments in protected mode. +This means that any error inside f is not propagated; +instead, pcall catches the error +and returns a status code. +Its first result is the status code (a boolean), +which is true if the call succeeds without errors. +In such case, pcall also returns all results from the call, +after this first result. +In case of any error, pcall returns false plus the error object. +Note that errors caught by pcall do not call a message handler. + + + + +

+


print (···)

+Receives any number of arguments +and prints their values to stdout, +converting each argument to a string +following the same rules of tostring. + + +

+The function print is not intended for formatted output, +but only as a quick way to show a value, +for instance for debugging. +For complete control over the output, +use string.format and io.write. + + + + +

+


rawequal (v1, v2)

+Checks whether v1 is equal to v2, +without invoking the __eq metamethod. +Returns a boolean. + + + + +

+


rawget (table, index)

+Gets the real value of table[index], +without using the __index metavalue. +table must be a table; +index may be any value. + + + + +

+


rawlen (v)

+Returns the length of the object v, +which must be a table or a string, +without invoking the __len metamethod. +Returns an integer. + + + + +

+


rawset (table, index, value)

+Sets the real value of table[index] to value, +without using the __newindex metavalue. +table must be a table, +index any value different from nil and NaN, +and value any Lua value. + + +

+This function returns table. + + + + +

+


select (index, ···)

+ + +

+If index is a number, +returns all arguments after argument number index; +a negative number indexes from the end (-1 is the last argument). +Otherwise, index must be the string "#", +and select returns the total number of extra arguments it received. + + + + +

+


setmetatable (table, metatable)

+ + +

+Sets the metatable for the given table. +If metatable is nil, +removes the metatable of the given table. +If the original metatable has a __metatable field, +raises an error. + + +

+This function returns table. + + +

+To change the metatable of other types from Lua code, +you must use the debug library (§6.10). + + + + +

+


tonumber (e [, base])

+ + +

+When called with no base, +tonumber tries to convert its argument to a number. +If the argument is already a number or +a string convertible to a number, +then tonumber returns this number; +otherwise, it returns fail. + + +

+The conversion of strings can result in integers or floats, +according to the lexical conventions of Lua (see §3.1). +The string may have leading and trailing spaces and a sign. + + +

+When called with base, +then e must be a string to be interpreted as +an integer numeral in that base. +The base may be any integer between 2 and 36, inclusive. +In bases above 10, the letter 'A' (in either upper or lower case) +represents 10, 'B' represents 11, and so forth, +with 'Z' representing 35. +If the string e is not a valid numeral in the given base, +the function returns fail. + + + + +

+


tostring (v)

+ + +

+Receives a value of any type and +converts it to a string in a human-readable format. + + +

+If the metatable of v has a __tostring field, +then tostring calls the corresponding value +with v as argument, +and uses the result of the call as its result. +Otherwise, if the metatable of v has a __name field +with a string value, +tostring may use that string in its final result. + + +

+For complete control of how numbers are converted, +use string.format. + + + + +

+


type (v)

+ + +

+Returns the type of its only argument, coded as a string. +The possible results of this function are +"nil" (a string, not the value nil), +"number", +"string", +"boolean", +"table", +"function", +"thread", +and "userdata". + + + + +

+


_VERSION

+ + +

+A global variable (not a function) that +holds a string containing the running Lua version. +The current value of this variable is "Lua 5.4". + + + + +

+


warn (msg1, ···)

+ + +

+Emits a warning with a message composed by the concatenation +of all its arguments (which should be strings). + + +

+By convention, +a one-piece message starting with '@' +is intended to be a control message, +which is a message to the warning system itself. +In particular, the standard warning function in Lua +recognizes the control messages "@off", +to stop the emission of warnings, +and "@on", to (re)start the emission; +it ignores unknown control messages. + + + + +

+


xpcall (f, msgh [, arg1, ···])

+ + +

+This function is similar to pcall, +except that it sets a new message handler msgh. + + + + + + + +

6.2 – Coroutine Manipulation

+ +

+This library comprises the operations to manipulate coroutines, +which come inside the table coroutine. +See §2.6 for a general description of coroutines. + + +

+


coroutine.close (co)

+ + +

+Closes coroutine co, +that is, +closes all its pending to-be-closed variables +and puts the coroutine in a dead state. +The given coroutine must be dead or suspended. +In case of error +(either the original error that stopped the coroutine or +errors in closing methods), +returns false plus the error object; +otherwise returns true. + + + + +

+


coroutine.create (f)

+ + +

+Creates a new coroutine, with body f. +f must be a function. +Returns this new coroutine, +an object with type "thread". + + + + +

+


coroutine.isyieldable ([co])

+ + +

+Returns true when the coroutine co can yield. +The default for co is the running coroutine. + + +

+A coroutine is yieldable if it is not the main thread and +it is not inside a non-yieldable C function. + + + + +

+


coroutine.resume (co [, val1, ···])

+ + +

+Starts or continues the execution of coroutine co. +The first time you resume a coroutine, +it starts running its body. +The values val1, ... are passed +as the arguments to the body function. +If the coroutine has yielded, +resume restarts it; +the values val1, ... are passed +as the results from the yield. + + +

+If the coroutine runs without any errors, +resume returns true plus any values passed to yield +(when the coroutine yields) or any values returned by the body function +(when the coroutine terminates). +If there is any error, +resume returns false plus the error message. + + + + +

+


coroutine.running ()

+ + +

+Returns the running coroutine plus a boolean, +true when the running coroutine is the main one. + + + + +

+


coroutine.status (co)

+ + +

+Returns the status of the coroutine co, as a string: +"running", +if the coroutine is running +(that is, it is the one that called status); +"suspended", if the coroutine is suspended in a call to yield, +or if it has not started running yet; +"normal" if the coroutine is active but not running +(that is, it has resumed another coroutine); +and "dead" if the coroutine has finished its body function, +or if it has stopped with an error. + + + + +

+


coroutine.wrap (f)

+ + +

+Creates a new coroutine, with body f; +f must be a function. +Returns a function that resumes the coroutine each time it is called. +Any arguments passed to this function behave as the +extra arguments to resume. +The function returns the same values returned by resume, +except the first boolean. +In case of error, +the function closes the coroutine and propagates the error. + + + + +

+


coroutine.yield (···)

+ + +

+Suspends the execution of the calling coroutine. +Any arguments to yield are passed as extra results to resume. + + + + + + + +

6.3 – Modules

+ +

+The package library provides basic +facilities for loading modules in Lua. +It exports one function directly in the global environment: +require. +Everything else is exported in the table package. + + +

+


require (modname)

+ + +

+Loads the given module. +The function starts by looking into the package.loaded table +to determine whether modname is already loaded. +If it is, then require returns the value stored +at package.loaded[modname]. +(The absence of a second result in this case +signals that this call did not have to load the module.) +Otherwise, it tries to find a loader for the module. + + +

+To find a loader, +require is guided by the table package.searchers. +Each item in this table is a search function, +that searches for the module in a particular way. +By changing this table, +we can change how require looks for a module. +The following explanation is based on the default configuration +for package.searchers. + + +

+First require queries package.preload[modname]. +If it has a value, +this value (which must be a function) is the loader. +Otherwise require searches for a Lua loader using the +path stored in package.path. +If that also fails, it searches for a C loader using the +path stored in package.cpath. +If that also fails, +it tries an all-in-one loader (see package.searchers). + + +

+Once a loader is found, +require calls the loader with two arguments: +modname and an extra value, +a loader data, +also returned by the searcher. +The loader data can be any value useful to the module; +for the default searchers, +it indicates where the loader was found. +(For instance, if the loader came from a file, +this extra value is the file path.) +If the loader returns any non-nil value, +require assigns the returned value to package.loaded[modname]. +If the loader does not return a non-nil value and +has not assigned any value to package.loaded[modname], +then require assigns true to this entry. +In any case, require returns the +final value of package.loaded[modname]. +Besides that value, require also returns as a second result +the loader data returned by the searcher, +which indicates how require found the module. + + +

+If there is any error loading or running the module, +or if it cannot find any loader for the module, +then require raises an error. + + + + +

+


package.config

+ + +

+A string describing some compile-time configurations for packages. +This string is a sequence of lines: + +

    + +
  • The first line is the directory separator string. +Default is '\' for Windows and '/' for all other systems.
  • + +
  • The second line is the character that separates templates in a path. +Default is ';'.
  • + +
  • The third line is the string that marks the +substitution points in a template. +Default is '?'.
  • + +
  • The fourth line is a string that, in a path in Windows, +is replaced by the executable's directory. +Default is '!'.
  • + +
  • The fifth line is a mark to ignore all text after it +when building the luaopen_ function name. +Default is '-'.
  • + +
+ + + +

+


package.cpath

+ + +

+A string with the path used by require +to search for a C loader. + + +

+Lua initializes the C path package.cpath in the same way +it initializes the Lua path package.path, +using the environment variable LUA_CPATH_5_4, +or the environment variable LUA_CPATH, +or a default path defined in luaconf.h. + + + + +

+


package.loaded

+ + +

+A table used by require to control which +modules are already loaded. +When you require a module modname and +package.loaded[modname] is not false, +require simply returns the value stored there. + + +

+This variable is only a reference to the real table; +assignments to this variable do not change the +table used by require. +The real table is stored in the C registry (see §4.3), +indexed by the key LUA_LOADED_TABLE, a string. + + + + +

+


package.loadlib (libname, funcname)

+ + +

+Dynamically links the host program with the C library libname. + + +

+If funcname is "*", +then it only links with the library, +making the symbols exported by the library +available to other dynamically linked libraries. +Otherwise, +it looks for a function funcname inside the library +and returns this function as a C function. +So, funcname must follow the lua_CFunction prototype +(see lua_CFunction). + + +

+This is a low-level function. +It completely bypasses the package and module system. +Unlike require, +it does not perform any path searching and +does not automatically adds extensions. +libname must be the complete file name of the C library, +including if necessary a path and an extension. +funcname must be the exact name exported by the C library +(which may depend on the C compiler and linker used). + + +

+This functionality is not supported by ISO C. +As such, it is only available on some platforms +(Windows, Linux, Mac OS X, Solaris, BSD, +plus other Unix systems that support the dlfcn standard). + + +

+This function is inherently insecure, +as it allows Lua to call any function in any readable dynamic +library in the system. +(Lua calls any function assuming the function +has a proper prototype and respects a proper protocol +(see lua_CFunction). +Therefore, +calling an arbitrary function in an arbitrary dynamic library +more often than not results in an access violation.) + + + + +

+


package.path

+ + +

+A string with the path used by require +to search for a Lua loader. + + +

+At start-up, Lua initializes this variable with +the value of the environment variable LUA_PATH_5_4 or +the environment variable LUA_PATH or +with a default path defined in luaconf.h, +if those environment variables are not defined. +A ";;" in the value of the environment variable +is replaced by the default path. + + + + +

+


package.preload

+ + +

+A table to store loaders for specific modules +(see require). + + +

+This variable is only a reference to the real table; +assignments to this variable do not change the +table used by require. +The real table is stored in the C registry (see §4.3), +indexed by the key LUA_PRELOAD_TABLE, a string. + + + + +

+


package.searchers

+ + +

+A table used by require to control how to find modules. + + +

+Each entry in this table is a searcher function. +When looking for a module, +require calls each of these searchers in ascending order, +with the module name (the argument given to require) as its +sole argument. +If the searcher finds the module, +it returns another function, the module loader, +plus an extra value, a loader data, +that will be passed to that loader and +returned as a second result by require. +If it cannot find the module, +it returns a string explaining why +(or nil if it has nothing to say). + + +

+Lua initializes this table with four searcher functions. + + +

+The first searcher simply looks for a loader in the +package.preload table. + + +

+The second searcher looks for a loader as a Lua library, +using the path stored at package.path. +The search is done as described in function package.searchpath. + + +

+The third searcher looks for a loader as a C library, +using the path given by the variable package.cpath. +Again, +the search is done as described in function package.searchpath. +For instance, +if the C path is the string + +

+     "./?.so;./?.dll;/usr/local/?/init.so"
+

+the searcher for module foo +will try to open the files ./foo.so, ./foo.dll, +and /usr/local/foo/init.so, in that order. +Once it finds a C library, +this searcher first uses a dynamic link facility to link the +application with the library. +Then it tries to find a C function inside the library to +be used as the loader. +The name of this C function is the string "luaopen_" +concatenated with a copy of the module name where each dot +is replaced by an underscore. +Moreover, if the module name has a hyphen, +its suffix after (and including) the first hyphen is removed. +For instance, if the module name is a.b.c-v2.1, +the function name will be luaopen_a_b_c. + + +

+The fourth searcher tries an all-in-one loader. +It searches the C path for a library for +the root name of the given module. +For instance, when requiring a.b.c, +it will search for a C library for a. +If found, it looks into it for an open function for +the submodule; +in our example, that would be luaopen_a_b_c. +With this facility, a package can pack several C submodules +into one single library, +with each submodule keeping its original open function. + + +

+All searchers except the first one (preload) return as the extra value +the file path where the module was found, +as returned by package.searchpath. +The first searcher always returns the string ":preload:". + + +

+Searchers should raise no errors and have no side effects in Lua. +(They may have side effects in C, +for instance by linking the application with a library.) + + + + +

+


package.searchpath (name, path [, sep [, rep]])

+ + +

+Searches for the given name in the given path. + + +

+A path is a string containing a sequence of +templates separated by semicolons. +For each template, +the function replaces each interrogation mark (if any) +in the template with a copy of name +wherein all occurrences of sep +(a dot, by default) +were replaced by rep +(the system's directory separator, by default), +and then tries to open the resulting file name. + + +

+For instance, if the path is the string + +

+     "./?.lua;./?.lc;/usr/local/?/init.lua"
+

+the search for the name foo.a +will try to open the files +./foo/a.lua, ./foo/a.lc, and +/usr/local/foo/a/init.lua, in that order. + + +

+Returns the resulting name of the first file that it can +open in read mode (after closing the file), +or fail plus an error message if none succeeds. +(This error message lists all file names it tried to open.) + + + + + + + +

6.4 – String Manipulation

+ + + +

+This library provides generic functions for string manipulation, +such as finding and extracting substrings, and pattern matching. +When indexing a string in Lua, the first character is at position 1 +(not at 0, as in C). +Indices are allowed to be negative and are interpreted as indexing backwards, +from the end of the string. +Thus, the last character is at position -1, and so on. + + +

+The string library provides all its functions inside the table +string. +It also sets a metatable for strings +where the __index field points to the string table. +Therefore, you can use the string functions in object-oriented style. +For instance, string.byte(s,i) +can be written as s:byte(i). + + +

+The string library assumes one-byte character encodings. + + +

+


string.byte (s [, i [, j]])

+Returns the internal numeric codes of the characters s[i], +s[i+1], ..., s[j]. +The default value for i is 1; +the default value for j is i. +These indices are corrected +following the same rules of function string.sub. + + +

+Numeric codes are not necessarily portable across platforms. + + + + +

+


string.char (···)

+Receives zero or more integers. +Returns a string with length equal to the number of arguments, +in which each character has the internal numeric code equal +to its corresponding argument. + + +

+Numeric codes are not necessarily portable across platforms. + + + + +

+


string.dump (function [, strip])

+ + +

+Returns a string containing a binary representation +(a binary chunk) +of the given function, +so that a later load on this string returns +a copy of the function (but with new upvalues). +If strip is a true value, +the binary representation may not include all debug information +about the function, +to save space. + + +

+Functions with upvalues have only their number of upvalues saved. +When (re)loaded, +those upvalues receive fresh instances. +(See the load function for details about +how these upvalues are initialized. +You can use the debug library to serialize +and reload the upvalues of a function +in a way adequate to your needs.) + + + + +

+


string.find (s, pattern [, init [, plain]])

+ + +

+Looks for the first match of +pattern (see §6.4.1) in the string s. +If it finds a match, then find returns the indices of s +where this occurrence starts and ends; +otherwise, it returns fail. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. +A true as a fourth, optional argument plain +turns off the pattern matching facilities, +so the function does a plain "find substring" operation, +with no characters in pattern being considered magic. + + +

+If the pattern has captures, +then in a successful match +the captured values are also returned, +after the two indices. + + + + +

+


string.format (formatstring, ···)

+ + +

+Returns a formatted version of its variable number of arguments +following the description given in its first argument, +which must be a string. +The format string follows the same rules as the ISO C function sprintf. +The only differences are that the conversion specifiers and modifiers +F, n, *, h, L, and l are not supported +and that there is an extra specifier, q. +Both width and precision, when present, +are limited to two digits. + + +

+The specifier q formats booleans, nil, numbers, and strings +in a way that the result is a valid constant in Lua source code. +Booleans and nil are written in the obvious way +(true, false, nil). +Floats are written in hexadecimal, +to preserve full precision. +A string is written between double quotes, +using escape sequences when necessary to ensure that +it can safely be read back by the Lua interpreter. +For instance, the call + +

+     string.format('%q', 'a string with "quotes" and \n new line')
+

+may produce the string: + +

+     "a string with \"quotes\" and \
+      new line"
+

+This specifier does not support modifiers (flags, width, precision). + + +

+The conversion specifiers +A, a, E, e, f, +G, and g all expect a number as argument. +The specifiers c, d, +i, o, u, X, and x +expect an integer. +When Lua is compiled with a C89 compiler, +the specifiers A and a (hexadecimal floats) +do not support modifiers. + + +

+The specifier s expects a string; +if its argument is not a string, +it is converted to one following the same rules of tostring. +If the specifier has any modifier, +the corresponding string argument should not contain embedded zeros. + + +

+The specifier p formats the pointer +returned by lua_topointer. +That gives a unique string identifier for tables, userdata, +threads, strings, and functions. +For other values (numbers, nil, booleans), +this specifier results in a string representing +the pointer NULL. + + + + +

+


string.gmatch (s, pattern [, init])

+Returns an iterator function that, +each time it is called, +returns the next captures from pattern (see §6.4.1) +over the string s. +If pattern specifies no captures, +then the whole match is produced in each call. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. + + +

+As an example, the following loop +will iterate over all the words from string s, +printing one per line: + +

+     s = "hello world from Lua"
+     for w in string.gmatch(s, "%a+") do
+       print(w)
+     end
+

+The next example collects all pairs key=value from the +given string into a table: + +

+     t = {}
+     s = "from=world, to=Lua"
+     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
+       t[k] = v
+     end
+
+ +

+For this function, a caret '^' at the start of a pattern does not +work as an anchor, as this would prevent the iteration. + + + + +

+


string.gsub (s, pattern, repl [, n])

+Returns a copy of s +in which all (or the first n, if given) +occurrences of the pattern (see §6.4.1) have been +replaced by a replacement string specified by repl, +which can be a string, a table, or a function. +gsub also returns, as its second value, +the total number of matches that occurred. +The name gsub comes from Global SUBstitution. + + +

+If repl is a string, then its value is used for replacement. +The character % works as an escape character: +any sequence in repl of the form %d, +with d between 1 and 9, +stands for the value of the d-th captured substring; +the sequence %0 stands for the whole match; +the sequence %% stands for a single %. + + +

+If repl is a table, then the table is queried for every match, +using the first capture as the key. + + +

+If repl is a function, then this function is called every time a +match occurs, with all captured substrings passed as arguments, +in order. + + +

+In any case, +if the pattern specifies no captures, +then it behaves as if the whole pattern was inside a capture. + + +

+If the value returned by the table query or by the function call +is a string or a number, +then it is used as the replacement string; +otherwise, if it is false or nil, +then there is no replacement +(that is, the original match is kept in the string). + + +

+Here are some examples: + +

+     x = string.gsub("hello world", "(%w+)", "%1 %1")
+     --> x="hello hello world world"
+     
+     x = string.gsub("hello world", "%w+", "%0 %0", 1)
+     --> x="hello hello world"
+     
+     x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
+     --> x="world hello Lua from"
+     
+     x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
+     --> x="home = /home/roberto, user = roberto"
+     
+     x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
+           return load(s)()
+         end)
+     --> x="4+5 = 9"
+     
+     local t = {name="lua", version="5.4"}
+     x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
+     --> x="lua-5.4.tar.gz"
+
+ + + +

+


string.len (s)

+ + +

+Receives a string and returns its length. +The empty string "" has length 0. +Embedded zeros are counted, +so "a\000bc\000" has length 5. + + + + +

+


string.lower (s)

+ + +

+Receives a string and returns a copy of this string with all +uppercase letters changed to lowercase. +All other characters are left unchanged. +The definition of what an uppercase letter is depends on the current locale. + + + + +

+


string.match (s, pattern [, init])

+ + +

+Looks for the first match of +the pattern (see §6.4.1) in the string s. +If it finds one, then match returns +the captures from the pattern; +otherwise it returns fail. +If pattern specifies no captures, +then the whole match is returned. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. + + + + +

+


string.pack (fmt, v1, v2, ···)

+ + +

+Returns a binary string containing the values v1, v2, etc. +serialized in binary form (packed) +according to the format string fmt (see §6.4.2). + + + + +

+


string.packsize (fmt)

+ + +

+Returns the length of a string resulting from string.pack +with the given format. +The format string cannot have the variable-length options +'s' or 'z' (see §6.4.2). + + + + +

+


string.rep (s, n [, sep])

+ + +

+Returns a string that is the concatenation of n copies of +the string s separated by the string sep. +The default value for sep is the empty string +(that is, no separator). +Returns the empty string if n is not positive. + + +

+(Note that it is very easy to exhaust the memory of your machine +with a single call to this function.) + + + + +

+


string.reverse (s)

+ + +

+Returns a string that is the string s reversed. + + + + +

+


string.sub (s, i [, j])

+ + +

+Returns the substring of s that +starts at i and continues until j; +i and j can be negative. +If j is absent, then it is assumed to be equal to -1 +(which is the same as the string length). +In particular, +the call string.sub(s,1,j) returns a prefix of s +with length j, +and string.sub(s, -i) (for a positive i) +returns a suffix of s +with length i. + + +

+If, after the translation of negative indices, +i is less than 1, +it is corrected to 1. +If j is greater than the string length, +it is corrected to that length. +If, after these corrections, +i is greater than j, +the function returns the empty string. + + + + +

+


string.unpack (fmt, s [, pos])

+ + +

+Returns the values packed in string s (see string.pack) +according to the format string fmt (see §6.4.2). +An optional pos marks where +to start reading in s (default is 1). +After the read values, +this function also returns the index of the first unread byte in s. + + + + +

+


string.upper (s)

+ + +

+Receives a string and returns a copy of this string with all +lowercase letters changed to uppercase. +All other characters are left unchanged. +The definition of what a lowercase letter is depends on the current locale. + + + + + + + +

6.4.1 – Patterns

+ + + +

+Patterns in Lua are described by regular strings, +which are interpreted as patterns by the pattern-matching functions +string.find, +string.gmatch, +string.gsub, +and string.match. +This section describes the syntax and the meaning +(that is, what they match) of these strings. + + + + + +

Character Class:

+A character class is used to represent a set of characters. +The following combinations are allowed in describing a character class: + +

    + +
  • x: +(where x is not one of the magic characters +^$()%.[]*+-?) +represents the character x itself. +
  • + +
  • .: (a dot) represents all characters.
  • + +
  • %a: represents all letters.
  • + +
  • %c: represents all control characters.
  • + +
  • %d: represents all digits.
  • + +
  • %g: represents all printable characters except space.
  • + +
  • %l: represents all lowercase letters.
  • + +
  • %p: represents all punctuation characters.
  • + +
  • %s: represents all space characters.
  • + +
  • %u: represents all uppercase letters.
  • + +
  • %w: represents all alphanumeric characters.
  • + +
  • %x: represents all hexadecimal digits.
  • + +
  • %x: (where x is any non-alphanumeric character) +represents the character x. +This is the standard way to escape the magic characters. +Any non-alphanumeric character +(including all punctuation characters, even the non-magical) +can be preceded by a '%' to represent itself in a pattern. +
  • + +
  • [set]: +represents the class which is the union of all +characters in set. +A range of characters can be specified by +separating the end characters of the range, +in ascending order, with a '-'. +All classes %x described above can also be used as +components in set. +All other characters in set represent themselves. +For example, [%w_] (or [_%w]) +represents all alphanumeric characters plus the underscore, +[0-7] represents the octal digits, +and [0-7%l%-] represents the octal digits plus +the lowercase letters plus the '-' character. + + +

    +You can put a closing square bracket in a set +by positioning it as the first character in the set. +You can put a hyphen in a set +by positioning it as the first or the last character in the set. +(You can also use an escape for both cases.) + + +

    +The interaction between ranges and classes is not defined. +Therefore, patterns like [%a-z] or [a-%%] +have no meaning. +

  • + +
  • [^set]: +represents the complement of set, +where set is interpreted as above. +
  • + +

+For all classes represented by single letters (%a, %c, etc.), +the corresponding uppercase letter represents the complement of the class. +For instance, %S represents all non-space characters. + + +

+The definitions of letter, space, and other character groups +depend on the current locale. +In particular, the class [a-z] may not be equivalent to %l. + + + + + +

Pattern Item:

+A pattern item can be + +

    + +
  • +a single character class, +which matches any single character in the class; +
  • + +
  • +a single character class followed by '*', +which matches sequences of zero or more characters in the class. +These repetition items will always match the longest possible sequence; +
  • + +
  • +a single character class followed by '+', +which matches sequences of one or more characters in the class. +These repetition items will always match the longest possible sequence; +
  • + +
  • +a single character class followed by '-', +which also matches sequences of zero or more characters in the class. +Unlike '*', +these repetition items will always match the shortest possible sequence; +
  • + +
  • +a single character class followed by '?', +which matches zero or one occurrence of a character in the class. +It always matches one occurrence if possible; +
  • + +
  • +%n, for n between 1 and 9; +such item matches a substring equal to the n-th captured string +(see below); +
  • + +
  • +%bxy, where x and y are two distinct characters; +such item matches strings that start with x, end with y, +and where the x and y are balanced. +This means that, if one reads the string from left to right, +counting +1 for an x and -1 for a y, +the ending y is the first y where the count reaches 0. +For instance, the item %b() matches expressions with +balanced parentheses. +
  • + +
  • +%f[set], a frontier pattern; +such item matches an empty string at any position such that +the next character belongs to set +and the previous character does not belong to set. +The set set is interpreted as previously described. +The beginning and the end of the subject are handled as if +they were the character '\0'. +
  • + +
+ + + + +

Pattern:

+A pattern is a sequence of pattern items. +A caret '^' at the beginning of a pattern anchors the match at the +beginning of the subject string. +A '$' at the end of a pattern anchors the match at the +end of the subject string. +At other positions, +'^' and '$' have no special meaning and represent themselves. + + + + + +

Captures:

+A pattern can contain sub-patterns enclosed in parentheses; +they describe captures. +When a match succeeds, the substrings of the subject string +that match captures are stored (captured) for future use. +Captures are numbered according to their left parentheses. +For instance, in the pattern "(a*(.)%w(%s*))", +the part of the string matching "a*(.)%w(%s*)" is +stored as the first capture, and therefore has number 1; +the character matching "." is captured with number 2, +and the part matching "%s*" has number 3. + + +

+As a special case, the capture () captures +the current string position (a number). +For instance, if we apply the pattern "()aa()" on the +string "flaaap", there will be two captures: 3 and 5. + + + + + +

Multiple matches:

+The function string.gsub and the iterator string.gmatch +match multiple occurrences of the given pattern in the subject. +For these functions, +a new match is considered valid only +if it ends at least one byte after the end of the previous match. +In other words, the pattern machine never accepts the +empty string as a match immediately after another match. +As an example, +consider the results of the following code: + +

+     > string.gsub("abc", "()a*()", print);
+     --> 1   2
+     --> 3   3
+     --> 4   4
+

+The second and third results come from Lua matching an empty +string after 'b' and another one after 'c'. +Lua does not match an empty string after 'a', +because it would end at the same position of the previous match. + + + + + + + +

6.4.2 – Format Strings for Pack and Unpack

+ +

+The first argument to string.pack, +string.packsize, and string.unpack +is a format string, +which describes the layout of the structure being created or read. + + +

+A format string is a sequence of conversion options. +The conversion options are as follows: + +

    +
  • <: sets little endian
  • +
  • >: sets big endian
  • +
  • =: sets native endian
  • +
  • ![n]: sets maximum alignment to n +(default is native alignment)
  • +
  • b: a signed byte (char)
  • +
  • B: an unsigned byte (char)
  • +
  • h: a signed short (native size)
  • +
  • H: an unsigned short (native size)
  • +
  • l: a signed long (native size)
  • +
  • L: an unsigned long (native size)
  • +
  • j: a lua_Integer
  • +
  • J: a lua_Unsigned
  • +
  • T: a size_t (native size)
  • +
  • i[n]: a signed int with n bytes +(default is native size)
  • +
  • I[n]: an unsigned int with n bytes +(default is native size)
  • +
  • f: a float (native size)
  • +
  • d: a double (native size)
  • +
  • n: a lua_Number
  • +
  • cn: a fixed-sized string with n bytes
  • +
  • z: a zero-terminated string
  • +
  • s[n]: a string preceded by its length +coded as an unsigned integer with n bytes +(default is a size_t)
  • +
  • x: one byte of padding
  • +
  • Xop: an empty item that aligns +according to option op +(which is otherwise ignored)
  • +
  • ' ': (space) ignored
  • +

+(A "[n]" means an optional integral numeral.) +Except for padding, spaces, and configurations +(options "xX <=>!"), +each option corresponds to an argument in string.pack +or a result in string.unpack. + + +

+For options "!n", "sn", "in", and "In", +n can be any integer between 1 and 16. +All integral options check overflows; +string.pack checks whether the given value fits in the given size; +string.unpack checks whether the read value fits in a Lua integer. +For the unsigned options, +Lua integers are treated as unsigned values too. + + +

+Any format string starts as if prefixed by "!1=", +that is, +with maximum alignment of 1 (no alignment) +and native endianness. + + +

+Native endianness assumes that the whole system is +either big or little endian. +The packing functions will not emulate correctly the behavior +of mixed-endian formats. + + +

+Alignment works as follows: +For each option, +the format gets extra padding until the data starts +at an offset that is a multiple of the minimum between the +option size and the maximum alignment; +this minimum must be a power of 2. +Options "c" and "z" are not aligned; +option "s" follows the alignment of its starting integer. + + +

+All padding is filled with zeros by string.pack +and ignored by string.unpack. + + + + + + + +

6.5 – UTF-8 Support

+ +

+This library provides basic support for UTF-8 encoding. +It provides all its functions inside the table utf8. +This library does not provide any support for Unicode other +than the handling of the encoding. +Any operation that needs the meaning of a character, +such as character classification, is outside its scope. + + +

+Unless stated otherwise, +all functions that expect a byte position as a parameter +assume that the given position is either the start of a byte sequence +or one plus the length of the subject string. +As in the string library, +negative indices count from the end of the string. + + +

+Functions that create byte sequences +accept all values up to 0x7FFFFFFF, +as defined in the original UTF-8 specification; +that implies byte sequences of up to six bytes. + + +

+Functions that interpret byte sequences only accept +valid sequences (well formed and not overlong). +By default, they only accept byte sequences +that result in valid Unicode code points, +rejecting values greater than 10FFFF and surrogates. +A boolean argument lax, when available, +lifts these checks, +so that all values up to 0x7FFFFFFF are accepted. +(Not well formed and overlong sequences are still rejected.) + + +

+


utf8.char (···)

+ + +

+Receives zero or more integers, +converts each one to its corresponding UTF-8 byte sequence +and returns a string with the concatenation of all these sequences. + + + + +

+


utf8.charpattern

+ + +

+The pattern (a string, not a function) "[\0-\x7F\xC2-\xFD][\x80-\xBF]*" +(see §6.4.1), +which matches exactly one UTF-8 byte sequence, +assuming that the subject is a valid UTF-8 string. + + + + +

+


utf8.codes (s [, lax])

+ + +

+Returns values so that the construction + +

+     for p, c in utf8.codes(s) do body end
+

+will iterate over all UTF-8 characters in string s, +with p being the position (in bytes) and c the code point +of each character. +It raises an error if it meets any invalid byte sequence. + + + + +

+


utf8.codepoint (s [, i [, j [, lax]]])

+ + +

+Returns the code points (as integers) from all characters in s +that start between byte position i and j (both included). +The default for i is 1 and for j is i. +It raises an error if it meets any invalid byte sequence. + + + + +

+


utf8.len (s [, i [, j [, lax]]])

+ + +

+Returns the number of UTF-8 characters in string s +that start between positions i and j (both inclusive). +The default for i is 1 and for j is -1. +If it finds any invalid byte sequence, +returns fail plus the position of the first invalid byte. + + + + +

+


utf8.offset (s, n [, i])

+ + +

+Returns the position (in bytes) where the encoding of the +n-th character of s +(counting from position i) starts. +A negative n gets characters before position i. +The default for i is 1 when n is non-negative +and #s + 1 otherwise, +so that utf8.offset(s, -n) gets the offset of the +n-th character from the end of the string. +If the specified character is neither in the subject +nor right after its end, +the function returns fail. + + +

+As a special case, +when n is 0 the function returns the start of the encoding +of the character that contains the i-th byte of s. + + +

+This function assumes that s is a valid UTF-8 string. + + + + + + + +

6.6 – Table Manipulation

+ +

+This library provides generic functions for table manipulation. +It provides all its functions inside the table table. + + +

+Remember that, whenever an operation needs the length of a table, +all caveats about the length operator apply (see §3.4.7). +All functions ignore non-numeric keys +in the tables given as arguments. + + +

+


table.concat (list [, sep [, i [, j]]])

+ + +

+Given a list where all elements are strings or numbers, +returns the string list[i]..sep..list[i+1] ··· sep..list[j]. +The default value for sep is the empty string, +the default for i is 1, +and the default for j is #list. +If i is greater than j, returns the empty string. + + + + +

+


table.insert (list, [pos,] value)

+ + +

+Inserts element value at position pos in list, +shifting up the elements +list[pos], list[pos+1], ···, list[#list]. +The default value for pos is #list+1, +so that a call table.insert(t,x) inserts x at the end +of the list t. + + + + +

+


table.move (a1, f, e, t [,a2])

+ + +

+Moves elements from the table a1 to the table a2, +performing the equivalent to the following +multiple assignment: +a2[t],··· = a1[f],···,a1[e]. +The default for a2 is a1. +The destination range can overlap with the source range. +The number of elements to be moved must fit in a Lua integer. + + +

+Returns the destination table a2. + + + + +

+


table.pack (···)

+ + +

+Returns a new table with all arguments stored into keys 1, 2, etc. +and with a field "n" with the total number of arguments. +Note that the resulting table may not be a sequence, +if some arguments are nil. + + + + +

+


table.remove (list [, pos])

+ + +

+Removes from list the element at position pos, +returning the value of the removed element. +When pos is an integer between 1 and #list, +it shifts down the elements +list[pos+1], list[pos+2], ···, list[#list] +and erases element list[#list]; +The index pos can also be 0 when #list is 0, +or #list + 1. + + +

+The default value for pos is #list, +so that a call table.remove(l) removes the last element +of the list l. + + + + +

+


table.sort (list [, comp])

+ + +

+Sorts the list elements in a given order, in-place, +from list[1] to list[#list]. +If comp is given, +then it must be a function that receives two list elements +and returns true when the first element must come +before the second in the final order, +so that, after the sort, +i <= j implies not comp(list[j],list[i]). +If comp is not given, +then the standard Lua operator < is used instead. + + +

+The comp function must define a consistent order; +more formally, the function must define a strict weak order. +(A weak order is similar to a total order, +but it can equate different elements for comparison purposes.) + + +

+The sort algorithm is not stable: +Different elements considered equal by the given order +may have their relative positions changed by the sort. + + + + +

+


table.unpack (list [, i [, j]])

+ + +

+Returns the elements from the given list. +This function is equivalent to + +

+     return list[i], list[i+1], ···, list[j]
+

+By default, i is 1 and j is #list. + + + + + + + +

6.7 – Mathematical Functions

+ +

+This library provides basic mathematical functions. +It provides all its functions and constants inside the table math. +Functions with the annotation "integer/float" give +integer results for integer arguments +and float results for non-integer arguments. +The rounding functions +math.ceil, math.floor, and math.modf +return an integer when the result fits in the range of an integer, +or a float otherwise. + + +

+


math.abs (x)

+ + +

+Returns the maximum value between x and -x. (integer/float) + + + + +

+


math.acos (x)

+ + +

+Returns the arc cosine of x (in radians). + + + + +

+


math.asin (x)

+ + +

+Returns the arc sine of x (in radians). + + + + +

+


math.atan (y [, x])

+ + +

+ +Returns the arc tangent of y/x (in radians), +using the signs of both arguments to find the +quadrant of the result. +It also handles correctly the case of x being zero. + + +

+The default value for x is 1, +so that the call math.atan(y) +returns the arc tangent of y. + + + + +

+


math.ceil (x)

+ + +

+Returns the smallest integral value greater than or equal to x. + + + + +

+


math.cos (x)

+ + +

+Returns the cosine of x (assumed to be in radians). + + + + +

+


math.deg (x)

+ + +

+Converts the angle x from radians to degrees. + + + + +

+


math.exp (x)

+ + +

+Returns the value ex +(where e is the base of natural logarithms). + + + + +

+


math.floor (x)

+ + +

+Returns the largest integral value less than or equal to x. + + + + +

+


math.fmod (x, y)

+ + +

+Returns the remainder of the division of x by y +that rounds the quotient towards zero. (integer/float) + + + + +

+


math.huge

+ + +

+The float value HUGE_VAL, +a value greater than any other numeric value. + + + + +

+


math.log (x [, base])

+ + +

+Returns the logarithm of x in the given base. +The default for base is e +(so that the function returns the natural logarithm of x). + + + + +

+


math.max (x, ···)

+ + +

+Returns the argument with the maximum value, +according to the Lua operator <. + + + + +

+


math.maxinteger

+An integer with the maximum value for an integer. + + + + +

+


math.min (x, ···)

+ + +

+Returns the argument with the minimum value, +according to the Lua operator <. + + + + +

+


math.mininteger

+An integer with the minimum value for an integer. + + + + +

+


math.modf (x)

+ + +

+Returns the integral part of x and the fractional part of x. +Its second result is always a float. + + + + +

+


math.pi

+ + +

+The value of π. + + + + +

+


math.rad (x)

+ + +

+Converts the angle x from degrees to radians. + + + + +

+


math.random ([m [, n]])

+ + +

+When called without arguments, +returns a pseudo-random float with uniform distribution +in the range [0,1). +When called with two integers m and n, +math.random returns a pseudo-random integer +with uniform distribution in the range [m, n]. +The call math.random(n), for a positive n, +is equivalent to math.random(1,n). +The call math.random(0) produces an integer with +all bits (pseudo)random. + + +

+This function uses the xoshiro256** algorithm to produce +pseudo-random 64-bit integers, +which are the results of calls with argument 0. +Other results (ranges and floats) +are unbiased extracted from these integers. + + +

+Lua initializes its pseudo-random generator with the equivalent of +a call to math.randomseed with no arguments, +so that math.random should generate +different sequences of results each time the program runs. + + + + +

+


math.randomseed ([x [, y]])

+ + +

+When called with at least one argument, +the integer parameters x and y are +joined into a 128-bit seed that +is used to reinitialize the pseudo-random generator; +equal seeds produce equal sequences of numbers. +The default for y is zero. + + +

+When called with no arguments, +Lua generates a seed with +a weak attempt for randomness. + + +

+This function returns the two seed components +that were effectively used, +so that setting them again repeats the sequence. + + +

+To ensure a required level of randomness to the initial state +(or contrarily, to have a deterministic sequence, +for instance when debugging a program), +you should call math.randomseed with explicit arguments. + + + + +

+


math.sin (x)

+ + +

+Returns the sine of x (assumed to be in radians). + + + + +

+


math.sqrt (x)

+ + +

+Returns the square root of x. +(You can also use the expression x^0.5 to compute this value.) + + + + +

+


math.tan (x)

+ + +

+Returns the tangent of x (assumed to be in radians). + + + + +

+


math.tointeger (x)

+ + +

+If the value x is convertible to an integer, +returns that integer. +Otherwise, returns fail. + + + + +

+


math.type (x)

+ + +

+Returns "integer" if x is an integer, +"float" if it is a float, +or fail if x is not a number. + + + + +

+


math.ult (m, n)

+ + +

+Returns a boolean, +true if and only if integer m is below integer n when +they are compared as unsigned integers. + + + + + + + +

6.8 – Input and Output Facilities

+ +

+The I/O library provides two different styles for file manipulation. +The first one uses implicit file handles; +that is, there are operations to set a default input file and a +default output file, +and all input/output operations are done over these default files. +The second style uses explicit file handles. + + +

+When using implicit file handles, +all operations are supplied by table io. +When using explicit file handles, +the operation io.open returns a file handle +and then all operations are supplied as methods of the file handle. + + +

+The metatable for file handles provides metamethods +for __gc and __close that try +to close the file when called. + + +

+The table io also provides +three predefined file handles with their usual meanings from C: +io.stdin, io.stdout, and io.stderr. +The I/O library never closes these files. + + +

+Unless otherwise stated, +all I/O functions return fail on failure, +plus an error message as a second result and +a system-dependent error code as a third result, +and some non-false value on success. +On non-POSIX systems, +the computation of the error message and error code +in case of errors +may be not thread safe, +because they rely on the global C variable errno. + + +

+


io.close ([file])

+ + +

+Equivalent to file:close(). +Without a file, closes the default output file. + + + + +

+


io.flush ()

+ + +

+Equivalent to io.output():flush(). + + + + +

+


io.input ([file])

+ + +

+When called with a file name, it opens the named file (in text mode), +and sets its handle as the default input file. +When called with a file handle, +it simply sets this file handle as the default input file. +When called without arguments, +it returns the current default input file. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


io.lines ([filename, ···])

+ + +

+Opens the given file name in read mode +and returns an iterator function that +works like file:lines(···) over the opened file. +When the iterator function fails to read any value, +it automatically closes the file. +Besides the iterator function, +io.lines returns three other values: +two nil values as placeholders, +plus the created file handle. +Therefore, when used in a generic for loop, +the file is closed also if the loop is interrupted by an +error or a break. + + +

+The call io.lines() (with no file name) is equivalent +to io.input():lines("l"); +that is, it iterates over the lines of the default input file. +In this case, the iterator does not close the file when the loop ends. + + +

+In case of errors opening the file, +this function raises the error, +instead of returning an error code. + + + + +

+


io.open (filename [, mode])

+ + +

+This function opens a file, +in the mode specified in the string mode. +In case of success, +it returns a new file handle. + + +

+The mode string can be any of the following: + +

    +
  • "r": read mode (the default);
  • +
  • "w": write mode;
  • +
  • "a": append mode;
  • +
  • "r+": update mode, all previous data is preserved;
  • +
  • "w+": update mode, all previous data is erased;
  • +
  • "a+": append update mode, previous data is preserved, + writing is only allowed at the end of file.
  • +

+The mode string can also have a 'b' at the end, +which is needed in some systems to open the file in binary mode. + + + + +

+


io.output ([file])

+ + +

+Similar to io.input, but operates over the default output file. + + + + +

+


io.popen (prog [, mode])

+ + +

+This function is system dependent and is not available +on all platforms. + + +

+Starts the program prog in a separated process and returns +a file handle that you can use to read data from this program +(if mode is "r", the default) +or to write data to this program +(if mode is "w"). + + + + +

+


io.read (···)

+ + +

+Equivalent to io.input():read(···). + + + + +

+


io.tmpfile ()

+ + +

+In case of success, +returns a handle for a temporary file. +This file is opened in update mode +and it is automatically removed when the program ends. + + + + +

+


io.type (obj)

+ + +

+Checks whether obj is a valid file handle. +Returns the string "file" if obj is an open file handle, +"closed file" if obj is a closed file handle, +or fail if obj is not a file handle. + + + + +

+


io.write (···)

+ + +

+Equivalent to io.output():write(···). + + + + +

+


file:close ()

+ + +

+Closes file. +Note that files are automatically closed when +their handles are garbage collected, +but that takes an unpredictable amount of time to happen. + + +

+When closing a file handle created with io.popen, +file:close returns the same values +returned by os.execute. + + + + +

+


file:flush ()

+ + +

+Saves any written data to file. + + + + +

+


file:lines (···)

+ + +

+Returns an iterator function that, +each time it is called, +reads the file according to the given formats. +When no format is given, +uses "l" as a default. +As an example, the construction + +

+     for c in file:lines(1) do body end
+

+will iterate over all characters of the file, +starting at the current position. +Unlike io.lines, this function does not close the file +when the loop ends. + + + + +

+


file:read (···)

+ + +

+Reads the file file, +according to the given formats, which specify what to read. +For each format, +the function returns a string or a number with the characters read, +or fail if it cannot read data with the specified format. +(In this latter case, +the function does not read subsequent formats.) +When called without arguments, +it uses a default format that reads the next line +(see below). + + +

+The available formats are + +

    + +
  • "n": +reads a numeral and returns it as a float or an integer, +following the lexical conventions of Lua. +(The numeral may have leading whitespaces and a sign.) +This format always reads the longest input sequence that +is a valid prefix for a numeral; +if that prefix does not form a valid numeral +(e.g., an empty string, "0x", or "3.4e-") +or it is too long (more than 200 characters), +it is discarded and the format returns fail. +
  • + +
  • "a": +reads the whole file, starting at the current position. +On end of file, it returns the empty string; +this format never fails. +
  • + +
  • "l": +reads the next line skipping the end of line, +returning fail on end of file. +This is the default format. +
  • + +
  • "L": +reads the next line keeping the end-of-line character (if present), +returning fail on end of file. +
  • + +
  • number: +reads a string with up to this number of bytes, +returning fail on end of file. +If number is zero, +it reads nothing and returns an empty string, +or fail on end of file. +
  • + +

+The formats "l" and "L" should be used only for text files. + + + + +

+


file:seek ([whence [, offset]])

+ + +

+Sets and gets the file position, +measured from the beginning of the file, +to the position given by offset plus a base +specified by the string whence, as follows: + +

    +
  • "set": base is position 0 (beginning of the file);
  • +
  • "cur": base is current position;
  • +
  • "end": base is end of file;
  • +

+In case of success, seek returns the final file position, +measured in bytes from the beginning of the file. +If seek fails, it returns fail, +plus a string describing the error. + + +

+The default value for whence is "cur", +and for offset is 0. +Therefore, the call file:seek() returns the current +file position, without changing it; +the call file:seek("set") sets the position to the +beginning of the file (and returns 0); +and the call file:seek("end") sets the position to the +end of the file, and returns its size. + + + + +

+


file:setvbuf (mode [, size])

+ + +

+Sets the buffering mode for a file. +There are three available modes: + +

    +
  • "no": no buffering.
  • +
  • "full": full buffering.
  • +
  • "line": line buffering.
  • +
+ +

+For the last two cases, +size is a hint for the size of the buffer, in bytes. +The default is an appropriate size. + + +

+The specific behavior of each mode is non portable; +check the underlying ISO C function setvbuf in your platform for +more details. + + + + +

+


file:write (···)

+ + +

+Writes the value of each of its arguments to file. +The arguments must be strings or numbers. + + +

+In case of success, this function returns file. + + + + + + + +

6.9 – Operating System Facilities

+ +

+This library is implemented through table os. + + +

+


os.clock ()

+ + +

+Returns an approximation of the amount in seconds of CPU time +used by the program, +as returned by the underlying ISO C function clock. + + + + +

+


os.date ([format [, time]])

+ + +

+Returns a string or a table containing date and time, +formatted according to the given string format. + + +

+If the time argument is present, +this is the time to be formatted +(see the os.time function for a description of this value). +Otherwise, date formats the current time. + + +

+If format starts with '!', +then the date is formatted in Coordinated Universal Time. +After this optional character, +if format is the string "*t", +then date returns a table with the following fields: +year, month (1–12), day (1–31), +hour (0–23), min (0–59), +sec (0–61, due to leap seconds), +wday (weekday, 1–7, Sunday is 1), +yday (day of the year, 1–366), +and isdst (daylight saving flag, a boolean). +This last field may be absent +if the information is not available. + + +

+If format is not "*t", +then date returns the date as a string, +formatted according to the same rules as the ISO C function strftime. + + +

+If format is absent, it defaults to "%c", +which gives a human-readable date and time representation +using the current locale. + + +

+On non-POSIX systems, +this function may be not thread safe +because of its reliance on C function gmtime and C function localtime. + + + + +

+


os.difftime (t2, t1)

+ + +

+Returns the difference, in seconds, +from time t1 to time t2 +(where the times are values returned by os.time). +In POSIX, Windows, and some other systems, +this value is exactly t2-t1. + + + + +

+


os.execute ([command])

+ + +

+This function is equivalent to the ISO C function system. +It passes command to be executed by an operating system shell. +Its first result is true +if the command terminated successfully, +or fail otherwise. +After this first result +the function returns a string plus a number, +as follows: + +

    + +
  • "exit": +the command terminated normally; +the following number is the exit status of the command. +
  • + +
  • "signal": +the command was terminated by a signal; +the following number is the signal that terminated the command. +
  • + +
+ +

+When called without a command, +os.execute returns a boolean that is true if a shell is available. + + + + +

+


os.exit ([code [, close]])

+ + +

+Calls the ISO C function exit to terminate the host program. +If code is true, +the returned status is EXIT_SUCCESS; +if code is false, +the returned status is EXIT_FAILURE; +if code is a number, +the returned status is this number. +The default value for code is true. + + +

+If the optional second argument close is true, +the function closes the Lua state before exiting (see lua_close). + + + + +

+


os.getenv (varname)

+ + +

+Returns the value of the process environment variable varname +or fail if the variable is not defined. + + + + +

+


os.remove (filename)

+ + +

+Deletes the file (or empty directory, on POSIX systems) +with the given name. +If this function fails, it returns fail +plus a string describing the error and the error code. +Otherwise, it returns true. + + + + +

+


os.rename (oldname, newname)

+ + +

+Renames the file or directory named oldname to newname. +If this function fails, it returns fail, +plus a string describing the error and the error code. +Otherwise, it returns true. + + + + +

+


os.setlocale (locale [, category])

+ + +

+Sets the current locale of the program. +locale is a system-dependent string specifying a locale; +category is an optional string describing which category to change: +"all", "collate", "ctype", +"monetary", "numeric", or "time"; +the default category is "all". +The function returns the name of the new locale, +or fail if the request cannot be honored. + + +

+If locale is the empty string, +the current locale is set to an implementation-defined native locale. +If locale is the string "C", +the current locale is set to the standard C locale. + + +

+When called with nil as the first argument, +this function only returns the name of the current locale +for the given category. + + +

+This function may be not thread safe +because of its reliance on C function setlocale. + + + + +

+


os.time ([table])

+ + +

+Returns the current time when called without arguments, +or a time representing the local date and time specified by the given table. +This table must have fields year, month, and day, +and may have fields +hour (default is 12), +min (default is 0), +sec (default is 0), +and isdst (default is nil). +Other fields are ignored. +For a description of these fields, see the os.date function. + + +

+When the function is called, +the values in these fields do not need to be inside their valid ranges. +For instance, if sec is -10, +it means 10 seconds before the time specified by the other fields; +if hour is 1000, +it means 1000 hours after the time specified by the other fields. + + +

+The returned value is a number, whose meaning depends on your system. +In POSIX, Windows, and some other systems, +this number counts the number +of seconds since some given start time (the "epoch"). +In other systems, the meaning is not specified, +and the number returned by time can be used only as an argument to +os.date and os.difftime. + + +

+When called with a table, +os.time also normalizes all the fields +documented in the os.date function, +so that they represent the same time as before the call +but with values inside their valid ranges. + + + + +

+


os.tmpname ()

+ + +

+Returns a string with a file name that can +be used for a temporary file. +The file must be explicitly opened before its use +and explicitly removed when no longer needed. + + +

+In POSIX systems, +this function also creates a file with that name, +to avoid security risks. +(Someone else might create the file with wrong permissions +in the time between getting the name and creating the file.) +You still have to open the file to use it +and to remove it (even if you do not use it). + + +

+When possible, +you may prefer to use io.tmpfile, +which automatically removes the file when the program ends. + + + + + + + +

6.10 – The Debug Library

+ +

+This library provides +the functionality of the debug interface (§4.7) to Lua programs. +You should exert care when using this library. +Several of its functions +violate basic assumptions about Lua code +(e.g., that variables local to a function +cannot be accessed from outside; +that userdata metatables cannot be changed by Lua code; +that Lua programs do not crash) +and therefore can compromise otherwise secure code. +Moreover, some functions in this library may be slow. + + +

+All functions in this library are provided +inside the debug table. +All functions that operate over a thread +have an optional first argument which is the +thread to operate over. +The default is always the current thread. + + +

+


debug.debug ()

+ + +

+Enters an interactive mode with the user, +running each string that the user enters. +Using simple commands and other debug facilities, +the user can inspect global and local variables, +change their values, evaluate expressions, and so on. +A line containing only the word cont finishes this function, +so that the caller continues its execution. + + +

+Note that commands for debug.debug are not lexically nested +within any function and so have no direct access to local variables. + + + + +

+


debug.gethook ([thread])

+ + +

+Returns the current hook settings of the thread, as three values: +the current hook function, the current hook mask, +and the current hook count, +as set by the debug.sethook function. + + +

+Returns fail if there is no active hook. + + + + +

+


debug.getinfo ([thread,] f [, what])

+ + +

+Returns a table with information about a function. +You can give the function directly +or you can give a number as the value of f, +which means the function running at level f of the call stack +of the given thread: +level 0 is the current function (getinfo itself); +level 1 is the function that called getinfo +(except for tail calls, which do not count in the stack); +and so on. +If f is a number greater than the number of active functions, +then getinfo returns fail. + + +

+The returned table can contain all the fields returned by lua_getinfo, +with the string what describing which fields to fill in. +The default for what is to get all information available, +except the table of valid lines. +If present, +the option 'f' +adds a field named func with the function itself. +If present, +the option 'L' +adds a field named activelines with the table of +valid lines. + + +

+For instance, the expression debug.getinfo(1,"n").name returns +a name for the current function, +if a reasonable name can be found, +and the expression debug.getinfo(print) +returns a table with all available information +about the print function. + + + + +

+


debug.getlocal ([thread,] f, local)

+ + +

+This function returns the name and the value of the local variable +with index local of the function at level f of the stack. +This function accesses not only explicit local variables, +but also parameters and temporary values. + + +

+The first parameter or local variable has index 1, and so on, +following the order that they are declared in the code, +counting only the variables that are active +in the current scope of the function. +Compile-time constants may not appear in this listing, +if they were optimized away by the compiler. +Negative indices refer to vararg arguments; +-1 is the first vararg argument. +The function returns fail +if there is no variable with the given index, +and raises an error when called with a level out of range. +(You can call debug.getinfo to check whether the level is valid.) + + +

+Variable names starting with '(' (open parenthesis) +represent variables with no known names +(internal variables such as loop control variables, +and variables from chunks saved without debug information). + + +

+The parameter f may also be a function. +In that case, getlocal returns only the name of function parameters. + + + + +

+


debug.getmetatable (value)

+ + +

+Returns the metatable of the given value +or nil if it does not have a metatable. + + + + +

+


debug.getregistry ()

+ + +

+Returns the registry table (see §4.3). + + + + +

+


debug.getupvalue (f, up)

+ + +

+This function returns the name and the value of the upvalue +with index up of the function f. +The function returns fail +if there is no upvalue with the given index. + + +

+(For Lua functions, +upvalues are the external local variables that the function uses, +and that are consequently included in its closure.) + + +

+For C functions, this function uses the empty string "" +as a name for all upvalues. + + +

+Variable name '?' (interrogation mark) +represents variables with no known names +(variables from chunks saved without debug information). + + + + +

+


debug.getuservalue (u, n)

+ + +

+Returns the n-th user value associated +to the userdata u plus a boolean, +false if the userdata does not have that value. + + + + +

+


debug.sethook ([thread,] hook, mask [, count])

+ + +

+Sets the given function as the debug hook. +The string mask and the number count describe +when the hook will be called. +The string mask may have any combination of the following characters, +with the given meaning: + +

    +
  • 'c': the hook is called every time Lua calls a function;
  • +
  • 'r': the hook is called every time Lua returns from a function;
  • +
  • 'l': the hook is called every time Lua enters a new line of code.
  • +

+Moreover, +with a count different from zero, +the hook is called also after every count instructions. + + +

+When called without arguments, +debug.sethook turns off the hook. + + +

+When the hook is called, its first parameter is a string +describing the event that has triggered its call: +"call", "tail call", "return", +"line", and "count". +For line events, +the hook also gets the new line number as its second parameter. +Inside a hook, +you can call getinfo with level 2 to get more information about +the running function. +(Level 0 is the getinfo function, +and level 1 is the hook function.) + + + + +

+


debug.setlocal ([thread,] level, local, value)

+ + +

+This function assigns the value value to the local variable +with index local of the function at level level of the stack. +The function returns fail if there is no local +variable with the given index, +and raises an error when called with a level out of range. +(You can call getinfo to check whether the level is valid.) +Otherwise, it returns the name of the local variable. + + +

+See debug.getlocal for more information about +variable indices and names. + + + + +

+


debug.setmetatable (value, table)

+ + +

+Sets the metatable for the given value to the given table +(which can be nil). +Returns value. + + + + +

+


debug.setupvalue (f, up, value)

+ + +

+This function assigns the value value to the upvalue +with index up of the function f. +The function returns fail if there is no upvalue +with the given index. +Otherwise, it returns the name of the upvalue. + + +

+See debug.getupvalue for more information about upvalues. + + + + +

+


debug.setuservalue (udata, value, n)

+ + +

+Sets the given value as +the n-th user value associated to the given udata. +udata must be a full userdata. + + +

+Returns udata, +or fail if the userdata does not have that value. + + + + +

+


debug.traceback ([thread,] [message [, level]])

+ + +

+If message is present but is neither a string nor nil, +this function returns message without further processing. +Otherwise, +it returns a string with a traceback of the call stack. +The optional message string is appended +at the beginning of the traceback. +An optional level number tells at which level +to start the traceback +(default is 1, the function calling traceback). + + + + +

+


debug.upvalueid (f, n)

+ + +

+Returns a unique identifier (as a light userdata) +for the upvalue numbered n +from the given function. + + +

+These unique identifiers allow a program to check whether different +closures share upvalues. +Lua closures that share an upvalue +(that is, that access a same external local variable) +will return identical ids for those upvalue indices. + + + + +

+


debug.upvaluejoin (f1, n1, f2, n2)

+ + +

+Make the n1-th upvalue of the Lua closure f1 +refer to the n2-th upvalue of the Lua closure f2. + + + + + + + +

7 – Lua Standalone

+ +

+Although Lua has been designed as an extension language, +to be embedded in a host C program, +it is also frequently used as a standalone language. +An interpreter for Lua as a standalone language, +called simply lua, +is provided with the standard distribution. +The standalone interpreter includes +all standard libraries. +Its usage is: + +

+     lua [options] [script [args]]
+

+The options are: + +

    +
  • -e stat: execute string stat;
  • +
  • -i: enter interactive mode after running script;
  • +
  • -l mod: "require" mod and assign the + result to global mod;
  • +
  • -l g=mod: "require" mod and assign the + result to global g;
  • +
  • -v: print version information;
  • +
  • -E: ignore environment variables;
  • +
  • -W: turn warnings on;
  • +
  • --: stop handling options;
  • +
  • -: execute stdin as a file and stop handling options.
  • +

+(The form -l g=mod was introduced in release 5.4.4.) + + +

+After handling its options, lua runs the given script. +When called without arguments, +lua behaves as lua -v -i +when the standard input (stdin) is a terminal, +and as lua - otherwise. + + +

+When called without the option -E, +the interpreter checks for an environment variable LUA_INIT_5_4 +(or LUA_INIT if the versioned name is not defined) +before running any argument. +If the variable content has the format @filename, +then lua executes the file. +Otherwise, lua executes the string itself. + + +

+When called with the option -E, +Lua does not consult any environment variables. +In particular, +the values of package.path and package.cpath +are set with the default paths defined in luaconf.h. + + +

+The options -e, -l, and -W are handled in +the order they appear. +For instance, an invocation like + +

+     $ lua -e 'a=1' -llib1 script.lua
+

+will first set a to 1, then require the library lib1, +and finally run the file script.lua with no arguments. +(Here $ is the shell prompt. Your prompt may be different.) + + +

+Before running any code, +lua collects all command-line arguments +in a global table called arg. +The script name goes to index 0, +the first argument after the script name goes to index 1, +and so on. +Any arguments before the script name +(that is, the interpreter name plus its options) +go to negative indices. +For instance, in the call + +

+     $ lua -la b.lua t1 t2
+

+the table is like this: + +

+     arg = { [-2] = "lua", [-1] = "-la",
+             [0] = "b.lua",
+             [1] = "t1", [2] = "t2" }
+

+If there is no script in the call, +the interpreter name goes to index 0, +followed by the other arguments. +For instance, the call + +

+     $ lua -e "print(arg[1])"
+

+will print "-e". +If there is a script, +the script is called with arguments +arg[1], ···, arg[#arg]. +Like all chunks in Lua, +the script is compiled as a variadic function. + + +

+In interactive mode, +Lua repeatedly prompts and waits for a line. +After reading a line, +Lua first try to interpret the line as an expression. +If it succeeds, it prints its value. +Otherwise, it interprets the line as a statement. +If you write an incomplete statement, +the interpreter waits for its completion +by issuing a different prompt. + + +

+If the global variable _PROMPT contains a string, +then its value is used as the prompt. +Similarly, if the global variable _PROMPT2 contains a string, +its value is used as the secondary prompt +(issued during incomplete statements). + + +

+In case of unprotected errors in the script, +the interpreter reports the error to the standard error stream. +If the error object is not a string but +has a metamethod __tostring, +the interpreter calls this metamethod to produce the final message. +Otherwise, the interpreter converts the error object to a string +and adds a stack traceback to it. +When warnings are on, +they are simply printed in the standard error output. + + +

+When finishing normally, +the interpreter closes its main Lua state +(see lua_close). +The script can avoid this step by +calling os.exit to terminate. + + +

+To allow the use of Lua as a +script interpreter in Unix systems, +Lua skips the first line of a file chunk if it starts with #. +Therefore, Lua scripts can be made into executable programs +by using chmod +x and the #! form, +as in + +

+     #!/usr/local/bin/lua
+

+Of course, +the location of the Lua interpreter may be different in your machine. +If lua is in your PATH, +then + +

+     #!/usr/bin/env lua
+

+is a more portable solution. + + + +

8 – Incompatibilities with the Previous Version

+ + + +

+Here we list the incompatibilities that you may find when moving a program +from Lua 5.3 to Lua 5.4. + + +

+You can avoid some incompatibilities by compiling Lua with +appropriate options (see file luaconf.h). +However, +all these compatibility options will be removed in the future. +More often than not, +compatibility issues arise when these compatibility options +are removed. +So, whenever you have the chance, +you should try to test your code with a version of Lua compiled +with all compatibility options turned off. +That will ease transitions to newer versions of Lua. + + +

+Lua versions can always change the C API in ways that +do not imply source-code changes in a program, +such as the numeric values for constants +or the implementation of functions as macros. +Therefore, +you should never assume that binaries are compatible between +different Lua versions. +Always recompile clients of the Lua API when +using a new version. + + +

+Similarly, Lua versions can always change the internal representation +of precompiled chunks; +precompiled chunks are not compatible between different Lua versions. + + +

+The standard paths in the official distribution may +change between versions. + + + + + +

8.1 – Incompatibilities in the Language

+
    + +
  • +The coercion of strings to numbers in +arithmetic and bitwise operations +has been removed from the core language. +The string library does a similar job +for arithmetic (but not for bitwise) operations +using the string metamethods. +However, unlike in previous versions, +the new implementation preserves the implicit type of the numeral +in the string. +For instance, the result of "1" + "2" now is an integer, +not a float. +
  • + +
  • +Literal decimal integer constants that overflow are read as floats, +instead of wrapping around. +You can use hexadecimal notation for such constants if you +want the old behavior +(reading them as integers with wrap around). +
  • + +
  • +The use of the __lt metamethod to emulate __le +has been removed. +When needed, this metamethod must be explicitly defined. +
  • + +
  • +The semantics of the numerical for loop +over integers changed in some details. +In particular, the control variable never wraps around. +
  • + +
  • +A label for a goto cannot be declared where a label with the same +name is visible, even if this other label is declared in an enclosing +block. +
  • + +
  • +When finalizing an object, +Lua does not ignore __gc metamethods that are not functions. +Any value will be called, if present. +(Non-callable values will generate a warning, +like any other error when calling a finalizer.) +
  • + +
+ + + + +

8.2 – Incompatibilities in the Libraries

+
    + +
  • +The function print does not call tostring +to format its arguments; +instead, it has this functionality hardwired. +You should use __tostring to modify how values are printed. +
  • + +
  • +The pseudo-random number generator used by the function math.random +now starts with a somewhat random seed. +Moreover, it uses a different algorithm. +
  • + +
  • +By default, the decoding functions in the utf8 library +do not accept surrogates as valid code points. +An extra parameter in these functions makes them more permissive. +
  • + +
  • +The options "setpause" and "setstepmul" +of the function collectgarbage are deprecated. +You should use the new option "incremental" to set them. +
  • + +
  • +The function io.lines now returns four values, +instead of just one. +That can be a problem when it is used as the sole +argument to another function that has optional parameters, +such as in load(io.lines(filename, "L")). +To fix that issue, +you can wrap the call into parentheses, +to adjust its number of results to one. +
  • + +
+ + + + +

8.3 – Incompatibilities in the API

+ + +
    + +
  • +Full userdata now has an arbitrary number of associated user values. +Therefore, the functions lua_newuserdata, +lua_setuservalue, and lua_getuservalue were +replaced by lua_newuserdatauv, +lua_setiuservalue, and lua_getiuservalue, +which have an extra argument. + + +

    +For compatibility, the old names still work as macros assuming +one single user value. +Note, however, that userdata with zero user values +are more efficient memory-wise. +

  • + +
  • +The function lua_resume has an extra parameter. +This out parameter returns the number of values on +the top of the stack that were yielded or returned by the coroutine. +(In previous versions, +those values were the entire stack.) +
  • + +
  • +The function lua_version returns the version number, +instead of an address of the version number. +The Lua core should work correctly with libraries using their +own static copies of the same core, +so there is no need to check whether they are using the same +address space. +
  • + +
  • +The constant LUA_ERRGCMM was removed. +Errors in finalizers are never propagated; +instead, they generate a warning. +
  • + +
  • +The options LUA_GCSETPAUSE and LUA_GCSETSTEPMUL +of the function lua_gc are deprecated. +You should use the new option LUA_GCINC to set them. +
  • + +
+ + + + +

9 – The Complete Syntax of Lua

+ +

+Here is the complete syntax of Lua in extended BNF. +As usual in extended BNF, +{A} means 0 or more As, +and [A] means an optional A. +(For operator precedences, see §3.4.8; +for a description of the terminals +Name, Numeral, +and LiteralString, see §3.1.) + + + + +

+
+	chunk ::= block
+
+	block ::= {stat} [retstat]
+
+	stat ::=  ‘;’ | 
+		 varlist ‘=’ explist | 
+		 functioncall | 
+		 label | 
+		 break | 
+		 goto Name | 
+		 do block end | 
+		 while exp do block end | 
+		 repeat block until exp | 
+		 if exp then block {elseif exp then block} [else block] end | 
+		 for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 
+		 for namelist in explist do block end | 
+		 function funcname funcbody | 
+		 local function Name funcbody | 
+		 local attnamelist [‘=’ explist] 
+
+	attnamelist ::=  Name attrib {‘,’ Name attrib}
+
+	attrib ::= [‘<’ Name ‘>’]
+
+	retstat ::= return [explist] [‘;’]
+
+	label ::= ‘::’ Name ‘::’
+
+	funcname ::= Name {‘.’ Name} [‘:’ Name]
+
+	varlist ::= var {‘,’ var}
+
+	var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name 
+
+	namelist ::= Name {‘,’ Name}
+
+	explist ::= exp {‘,’ exp}
+
+	exp ::=  nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | 
+		 prefixexp | tableconstructor | exp binop exp | unop exp 
+
+	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
+
+	functioncall ::=  prefixexp args | prefixexp ‘:’ Name args 
+
+	args ::=  ‘(’ [explist] ‘)’ | tableconstructor | LiteralString 
+
+	functiondef ::= function funcbody
+
+	funcbody ::= ‘(’ [parlist] ‘)’ block end
+
+	parlist ::= namelist [‘,’ ‘...’] | ‘...’
+
+	tableconstructor ::= ‘{’ [fieldlist] ‘}’
+
+	fieldlist ::= field {fieldsep field} [fieldsep]
+
+	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
+
+	fieldsep ::= ‘,’ | ‘;’
+
+	binop ::=  ‘+’ | ‘-’ | ‘*’ | ‘/’ | ‘//’ | ‘^’ | ‘%’ | 
+		 ‘&’ | ‘~’ | ‘|’ | ‘>>’ | ‘<<’ | ‘..’ | 
+		 ‘<’ | ‘<=’ | ‘>’ | ‘>=’ | ‘==’ | ‘~=’ | 
+		 and | or
+
+	unop ::= ‘-’ | not | ‘#’ | ‘~’
+
+
+ +

+ + + + + + + +

+ + + + diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/osi-certified-72x60.png b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/osi-certified-72x60.png new file mode 100644 index 00000000..07df5f6e Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/osi-certified-72x60.png differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/readme.html b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/readme.html new file mode 100644 index 00000000..918ec8ed --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/doc/readme.html @@ -0,0 +1,337 @@ + + + +Lua 5.4 readme + + + + + + + +

+Lua +Welcome to Lua 5.4 +

+ + + +

About Lua

+

+Lua is a powerful, efficient, lightweight, embeddable scripting language +developed by a +team +at +PUC-Rio, +the Pontifical Catholic University of Rio de Janeiro in Brazil. +Lua is +free software +used in +many products and projects +around the world. + +

+Lua's +official web site +provides complete information +about Lua, +including +an +executive summary +and +updated +documentation, +especially the +reference manual, +which may differ slightly from the +local copy +distributed in this package. + +

Installing Lua

+

+Lua is distributed in +source +form. +You need to build it before using it. +Building Lua should be straightforward +because +Lua is implemented in pure ANSI C and compiles unmodified in all known +platforms that have an ANSI C compiler. +Lua also compiles unmodified as C++. +The instructions given below for building Lua are for Unix-like platforms, +such as Linux and Mac OS X. +See also +instructions for other systems +and +customization options. + +

+If you don't have the time or the inclination to compile Lua yourself, +get a binary from +LuaBinaries. + +

Building Lua

+

+In most common Unix-like platforms, simply do "make". +Here are the details. + +

    +
  1. +Open a terminal window and move to +the top-level directory, which is named lua-5.4.6. +The Makefile there controls both the build process and the installation process. +

    +

  2. + Do "make". The Makefile will guess your platform and build Lua for it. +

    +

  3. + If the guess failed, do "make help" and see if your platform is listed. + The platforms currently supported are: +

    +

    + guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris +

    +

    + If your platform is listed, just do "make xxx", where xxx + is your platform name. +

    + If your platform is not listed, try the closest one or posix, generic, + c89, in this order. +

    +

  4. +The compilation takes only a few moments +and produces three files in the src directory: +lua (the interpreter), +luac (the compiler), +and liblua.a (the library). +

    +

  5. + To check that Lua has been built correctly, do "make test" + after building Lua. This will run the interpreter and print its version. +
+

+If you're running Linux, try "make linux-readline" to build the interactive Lua interpreter with handy line-editing and history capabilities. +If you get compilation errors, +make sure you have installed the readline development package +(which is probably named libreadline-dev or readline-devel). +If you get link errors after that, +then try "make linux-readline MYLIBS=-ltermcap". + +

Installing Lua

+

+ Once you have built Lua, you may want to install it in an official + place in your system. In this case, do "make install". The official + place and the way to install files are defined in the Makefile. You'll + probably need the right permissions to install files, and so may need to do "sudo make install". + +

+ To build and install Lua in one step, do "make all install", + or "make xxx install", + where xxx is your platform name. + +

+ To install Lua locally after building it, do "make local". + This will create a directory install with subdirectories + bin, include, lib, man, share, + and install Lua as listed below. + + To install Lua locally, but in some other directory, do + "make install INSTALL_TOP=xxx", where xxx is your chosen directory. + The installation starts in the src and doc directories, + so take care if INSTALL_TOP is not an absolute path. + +

+
+ bin: +
+ lua luac +
+ include: +
+ lua.h luaconf.h lualib.h lauxlib.h lua.hpp +
+ lib: +
+ liblua.a +
+ man/man1: +
+ lua.1 luac.1 +
+ +

+ These are the only directories you need for development. + If you only want to run Lua programs, + you only need the files in bin and man. + The files in include and lib are needed for + embedding Lua in C or C++ programs. + +

Customization

+

+ Three kinds of things can be customized by editing a file: +

    +
  • Where and how to install Lua — edit Makefile. +
  • How to build Lua — edit src/Makefile. +
  • Lua features — edit src/luaconf.h. +
+ +

+ You don't actually need to edit the Makefiles because you may set the + relevant variables in the command line when invoking make. + Nevertheless, it's probably best to edit and save the Makefiles to + record the changes you've made. + +

+ On the other hand, if you need to customize some Lua features, you'll need + to edit src/luaconf.h before building and installing Lua. + The edited file will be the one installed, and + it will be used by any Lua clients that you build, to ensure consistency. + Further customization is available to experts by editing the Lua sources. + +

Building Lua on other systems

+

+ If you're not using the usual Unix tools, then the instructions for + building Lua depend on the compiler you use. You'll need to create + projects (or whatever your compiler uses) for building the library, + the interpreter, and the compiler, as follows: + +

+
+library: +
+lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c +lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c +
+interpreter: +
+ library, lua.c +
+compiler: +
+ library, luac.c +
+ +

+ To use Lua as a library in your own programs, you'll need to know how to + create and use libraries with your compiler. Moreover, to dynamically load + C libraries for Lua, you'll need to know how to create dynamic libraries + and you'll need to make sure that the Lua API functions are accessible to + those dynamic libraries — but don't link the Lua library + into each dynamic library. For Unix, we recommend that the Lua library + be linked statically into the host program and its symbols exported for + dynamic linking; src/Makefile does this for the Lua interpreter. + For Windows, we recommend that the Lua library be a DLL. + In all cases, the compiler luac should be linked statically. + +

+ As mentioned above, you may edit src/luaconf.h to customize + some features before building Lua. + +

Changes since Lua 5.3

+

+Here are the main changes introduced in Lua 5.4. +The +reference manual +lists the +incompatibilities that had to be introduced. + +

Main changes

+
    +
  • new generational mode for garbage collection +
  • to-be-closed variables +
  • const variables +
  • userdata can have multiple user values +
  • new implementation for math.random +
  • warning system +
  • debug information about function arguments and returns +
  • new semantics for the integer 'for' loop +
  • optional 'init' argument to 'string.gmatch' +
  • new functions 'lua_resetthread' and 'coroutine.close' +
  • string-to-number coercions moved to the string library +
  • allocation function allowed to fail when shrinking a memory block +
  • new format '%p' in 'string.format' +
  • utf8 library accepts codepoints up to 2^31 +
+ +

License

+

+ +[osi certified] + +Lua is free software distributed under the terms of the +MIT license +reproduced below; +it may be used for any purpose, including commercial purposes, +at absolutely no cost without having to ask us. + +The only requirement is that if you do use Lua, +then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. + +For details, see +this. + +

+Copyright © 1994–2023 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. +

+

+ +

+ + + + diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lauxlib.h b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lauxlib.h new file mode 100644 index 00000000..5b977e2a --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lauxlib.h @@ -0,0 +1,301 @@ +/* +** $Id: lauxlib.h $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "luaconf.h" +#include "lua.h" + + +/* global table */ +#define LUA_GNAME "_G" + + +typedef struct luaL_Buffer luaL_Buffer; + + +/* extra error code for 'luaL_loadfilex' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +/* key, in the registry, for table of loaded modules */ +#define LUA_LOADED_TABLE "_LOADED" + + +/* key, in the registry, for table of preloaded loaders */ +#define LUA_PRELOAD_TABLE "_PRELOAD" + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + +#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) + +LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); +#define luaL_checkversion(L) \ + luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES) + +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); +LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); +LUALIB_API int (luaL_typeerror) (lua_State *L, int arg, const char *tname); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int arg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); +LUALIB_API int (luaL_execresult) (lua_State *L, int stat); + + +/* predefined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, + const char *mode); + +#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) + +LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, + const char *name, const char *mode); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + +LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); + +LUALIB_API void (luaL_addgsub) (luaL_Buffer *b, const char *s, + const char *p, const char *r); +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, + const char *p, const char *r); + +LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); + +LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); + +LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, + const char *msg, int level); + +LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, + lua_CFunction openf, int glb); + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + + +#define luaL_newlibtable(L,l) \ + lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) + +#define luaL_newlib(L,l) \ + (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) + +#define luaL_argcheck(L, cond,arg,extramsg) \ + ((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg)))) + +#define luaL_argexpected(L,cond,arg,tname) \ + ((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname)))) + +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) + + +/* +** Perform arithmetic operations on lua_Integer values with wrap-around +** semantics, as the Lua core does. +*/ +#define luaL_intop(op,v1,v2) \ + ((lua_Integer)((lua_Unsigned)(v1) op (lua_Unsigned)(v2))) + + +/* push the value used to represent failure/error */ +#define luaL_pushfail(L) lua_pushnil(L) + + +/* +** Internal assertions for in-house debugging +*/ +#if !defined(lua_assert) + +#if defined LUAI_ASSERT + #include + #define lua_assert(c) assert(c) +#else + #define lua_assert(c) ((void)0) +#endif + +#endif + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + +struct luaL_Buffer { + char *b; /* buffer address */ + size_t size; /* buffer size */ + size_t n; /* number of characters in buffer */ + lua_State *L; + union { + LUAI_MAXALIGN; /* ensure maximum alignment for buffer */ + char b[LUAL_BUFFERSIZE]; /* initial buffer */ + } init; +}; + + +#define luaL_bufflen(bf) ((bf)->n) +#define luaL_buffaddr(bf) ((bf)->b) + + +#define luaL_addchar(B,c) \ + ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ + ((B)->b[(B)->n++] = (c))) + +#define luaL_addsize(B,s) ((B)->n += (s)) + +#define luaL_buffsub(B,s) ((B)->n -= (s)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); +LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); + +#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) + +/* }====================================================== */ + + + +/* +** {====================================================== +** File handles for IO library +** ======================================================= +*/ + +/* +** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and +** initial structure 'luaL_Stream' (it may contain other fields +** after that initial structure). +*/ + +#define LUA_FILEHANDLE "FILE*" + + +typedef struct luaL_Stream { + FILE *f; /* stream (NULL for incompletely created streams) */ + lua_CFunction closef; /* to close stream (NULL for closed streams) */ +} luaL_Stream; + +/* }====================================================== */ + +/* +** {================================================================== +** "Abstraction Layer" for basic report of messages and errors +** =================================================================== +*/ + +/* print a string */ +#if !defined(lua_writestring) +#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +#endif + +/* print a newline and flush the output */ +#if !defined(lua_writeline) +#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) +#endif + +/* print an error message */ +#if !defined(lua_writestringerror) +#define lua_writestringerror(s,p) \ + (fprintf(stderr, (s), (p)), fflush(stderr)) +#endif + +/* }================================================================== */ + + +/* +** {============================================================ +** Compatibility with deprecated conversions +** ============================================================= +*/ +#if defined(LUA_COMPAT_APIINTCASTS) + +#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) +#define luaL_optunsigned(L,a,d) \ + ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) + +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) + +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#endif +/* }============================================================ */ + + + +#endif + + diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lua.h b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lua.h new file mode 100644 index 00000000..fd16cf80 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lua.h @@ -0,0 +1,523 @@ +/* +** $Id: lua.h $ +** Lua - A Scripting Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION_MAJOR "5" +#define LUA_VERSION_MINOR "4" +#define LUA_VERSION_RELEASE "6" + +#define LUA_VERSION_NUM 504 +#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6) + +#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2023 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" + + +/* mark for precompiled code ('Lua') */ +#define LUA_SIGNATURE "\x1bLua" + +/* option for multiple returns in 'lua_pcall' and 'lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** Pseudo-indices +** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty +** space after that to help overflow detection) +*/ +#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) +#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) + + +/* thread status */ +#define LUA_OK 0 +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + +#define LUA_NUMTYPES 9 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* predefined values in the registry */ +#define LUA_RIDX_MAINTHREAD 1 +#define LUA_RIDX_GLOBALS 2 +#define LUA_RIDX_LAST LUA_RIDX_GLOBALS + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + +/* unsigned integer type */ +typedef LUA_UNSIGNED lua_Unsigned; + +/* type for continuation-function contexts */ +typedef LUA_KCONTEXT lua_KContext; + + +/* +** Type for C functions registered with Lua +*/ +typedef int (*lua_CFunction) (lua_State *L); + +/* +** Type for continuation functions +*/ +typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); + + +/* +** Type for functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); + + +/* +** Type for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** Type for warning functions +*/ +typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont); + + +/* +** Type used by the debug API to collect debug information +*/ +typedef struct lua_Debug lua_Debug; + + +/* +** Functions to be called by the debugger in specific events +*/ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* +** RCS ident string +*/ +extern const char lua_ident[]; + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); +LUA_API int (lua_closethread) (lua_State *L, lua_State *from); +LUA_API int (lua_resetthread) (lua_State *L); /* Deprecated! */ + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +LUA_API lua_Number (lua_version) (lua_State *L); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_absindex) (lua_State *L, int idx); +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_rotate) (lua_State *L, int idx, int n); +LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); +LUA_API int (lua_checkstack) (lua_State *L, int n); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isinteger) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); +LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API lua_Unsigned (lua_rawlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** Comparison and arithmetic functions +*/ + +#define LUA_OPADD 0 /* ORDER TM, ORDER OP */ +#define LUA_OPSUB 1 +#define LUA_OPMUL 2 +#define LUA_OPMOD 3 +#define LUA_OPPOW 4 +#define LUA_OPDIV 5 +#define LUA_OPIDIV 6 +#define LUA_OPBAND 7 +#define LUA_OPBOR 8 +#define LUA_OPBXOR 9 +#define LUA_OPSHL 10 +#define LUA_OPSHR 11 +#define LUA_OPUNM 12 +#define LUA_OPBNOT 13 + +LUA_API void (lua_arith) (lua_State *L, int op); + +#define LUA_OPEQ 0 +#define LUA_OPLT 1 +#define LUA_OPLE 2 + +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); +LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API int (lua_getglobal) (lua_State *L, const char *name); +LUA_API int (lua_gettable) (lua_State *L, int idx); +LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n); +LUA_API int (lua_rawget) (lua_State *L, int idx); +LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); +LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); + +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdatauv) (lua_State *L, size_t sz, int nuvalue); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API int (lua_getiuservalue) (lua_State *L, int idx, int n); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_setglobal) (lua_State *L, const char *name); +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); +LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setiuservalue) (lua_State *L, int idx, int n); + + +/* +** 'load' and 'call' functions (load and run Lua code) +*/ +LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, + lua_KContext ctx, lua_KFunction k); +#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) + +LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, + lua_KContext ctx, lua_KFunction k); +#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) + +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname, const char *mode); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, + lua_KFunction k); +LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg, + int *nres); +LUA_API int (lua_status) (lua_State *L); +LUA_API int (lua_isyieldable) (lua_State *L); + +#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) + + +/* +** Warning-related functions +*/ +LUA_API void (lua_setwarnf) (lua_State *L, lua_WarnFunction f, void *ud); +LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont); + + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 +#define LUA_GCISRUNNING 9 +#define LUA_GCGEN 10 +#define LUA_GCINC 11 + +LUA_API int (lua_gc) (lua_State *L, int what, ...); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); +LUA_API void (lua_len) (lua_State *L, int idx); + +LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); + +LUA_API void (lua_toclose) (lua_State *L, int idx); +LUA_API void (lua_closeslot) (lua_State *L, int idx); + + +/* +** {============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) + +#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) +#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) lua_pushstring(L, "" s) + +#define lua_pushglobaltable(L) \ + ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + +#define lua_insert(L,idx) lua_rotate(L, (idx), 1) + +#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) + +#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1)) + +/* }============================================================== */ + + +/* +** {============================================================== +** compatibility macros +** =============================================================== +*/ +#if defined(LUA_COMPAT_APIINTCASTS) + +#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) +#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) +#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) + +#endif + +#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1) +#define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1) +#define lua_setuservalue(L,idx) lua_setiuservalue(L,idx,1) + +#define LUA_NUMTAGS LUA_NUMTYPES + +/* }============================================================== */ + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILCALL 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + + +LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); +LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); +LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); + +LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); +LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, + int fidx2, int n2); + +LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook (lua_gethook) (lua_State *L); +LUA_API int (lua_gethookmask) (lua_State *L); +LUA_API int (lua_gethookcount) (lua_State *L); + +LUA_API int (lua_setcstacklimit) (lua_State *L, unsigned int limit); + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ + const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ + const char *source; /* (S) */ + size_t srclen; /* (S) */ + int currentline; /* (l) */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + unsigned char nups; /* (u) number of upvalues */ + unsigned char nparams;/* (u) number of parameters */ + char isvararg; /* (u) */ + char istailcall; /* (t) */ + unsigned short ftransfer; /* (r) index of first value transferred */ + unsigned short ntransfer; /* (r) number of transferred values */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + struct CallInfo *i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2023 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. +******************************************************************************/ + + +#endif diff --git a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.hpp b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lua.hpp similarity index 62% rename from Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.hpp rename to Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lua.hpp index d784cb2e..ec417f59 100644 --- a/Sources/backend-cpp/Vendor/lua-5.1.5/etc/lua.hpp +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lua.hpp @@ -3,7 +3,7 @@ // <> not supplied automatically because Lua also compiles as C++ extern "C" { -#include "../src/lauxlib.h" -#include "../src/lua.h" -#include "../src/lualib.h" +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" } diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/luaconf.h b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/luaconf.h new file mode 100644 index 00000000..137103ed --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/luaconf.h @@ -0,0 +1,793 @@ +/* +** $Id: luaconf.h $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef luaconf_h +#define luaconf_h + +#include +#include + + +/* +** =================================================================== +** General Configuration File for Lua +** +** Some definitions here can be changed externally, through the compiler +** (e.g., with '-D' options): They are commented out or protected +** by '#if !defined' guards. However, several other definitions +** should be changed directly here, either because they affect the +** Lua ABI (by making the changes here, you ensure that all software +** connected to Lua, such as C libraries, will be compiled with the same +** configuration); or because they are seldom changed. +** +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +** {==================================================================== +** System Configuration: macros to adapt (if needed) Lua to some +** particular platform, for instance restricting it to C89. +** ===================================================================== +*/ + +/* +@@ LUA_USE_C89 controls the use of non-ISO-C89 features. +** Define it if you want Lua to avoid the use of a few C99 features +** or Windows-specific features on Windows. +*/ +/* #define LUA_USE_C89 */ + + +/* +** By default, Lua on Windows use (some) specific Windows features +*/ +#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) +#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ +#endif + + +#if defined(LUA_USE_WINDOWS) +#define LUA_DL_DLL /* enable support for DLL */ +#define LUA_USE_C89 /* broadly, Windows is C89 */ +#endif + + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#endif + + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ +#endif + + +#if defined(LUA_USE_IOS) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN +#endif + + +/* +@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. +*/ +#define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Number types. These options should not be +** set externally, because any other code connected to Lua must +** use the same configuration. +** =================================================================== +*/ + +/* +@@ LUA_INT_TYPE defines the type for Lua integers. +@@ LUA_FLOAT_TYPE defines the type for Lua floats. +** Lua should work fine with any mix of these options supported +** by your C compiler. The usual configurations are 64-bit integers +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not +** compliant with C99, which may not have support for 'long long'). +*/ + +/* predefined options for LUA_INT_TYPE */ +#define LUA_INT_INT 1 +#define LUA_INT_LONG 2 +#define LUA_INT_LONGLONG 3 + +/* predefined options for LUA_FLOAT_TYPE */ +#define LUA_FLOAT_FLOAT 1 +#define LUA_FLOAT_DOUBLE 2 +#define LUA_FLOAT_LONGDOUBLE 3 + + +/* Default configuration ('long long' and 'double', for 64-bit Lua) */ +#define LUA_INT_DEFAULT LUA_INT_LONGLONG +#define LUA_FLOAT_DEFAULT LUA_FLOAT_DOUBLE + + +/* +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. +*/ +#define LUA_32BITS 0 + + +/* +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. +*/ +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) +#define LUA_C89_NUMBERS 1 +#else +#define LUA_C89_NUMBERS 0 +#endif + + +#if LUA_32BITS /* { */ +/* +** 32-bit integers and 'float' +*/ +#if LUAI_IS32INT /* use 'int' if big enough */ +#define LUA_INT_TYPE LUA_INT_INT +#else /* otherwise use 'long' */ +#define LUA_INT_TYPE LUA_INT_LONG +#endif +#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT + +#elif LUA_C89_NUMBERS /* }{ */ +/* +** largest types available for C89 ('long' and 'double') +*/ +#define LUA_INT_TYPE LUA_INT_LONG +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE + +#else /* }{ */ +/* use defaults */ + +#define LUA_INT_TYPE LUA_INT_DEFAULT +#define LUA_FLOAT_TYPE LUA_FLOAT_DEFAULT + +#endif /* } */ + + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Paths. +** =================================================================== +*/ + +/* +** LUA_PATH_SEP is the character that separates templates in a path. +** LUA_PATH_MARK is the string that marks the substitution points in a +** template. +** LUA_EXEC_DIR in a Windows path is replaced by the executable's +** directory. +*/ +#define LUA_PATH_SEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXEC_DIR "!" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +** Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +** C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ + +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#if defined(_WIN32) /* { */ +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" + +#if !defined(LUA_PATH_DEFAULT) +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ + LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ + ".\\?.lua;" ".\\?\\init.lua" +#endif + +#if !defined(LUA_CPATH_DEFAULT) +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.dll;" \ + LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ + LUA_CDIR"loadall.dll;" ".\\?.dll" +#endif + +#else /* }{ */ + +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" + +#if !defined(LUA_PATH_DEFAULT) +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ + "./?.lua;" "./?/init.lua" +#endif + +#if !defined(LUA_CPATH_DEFAULT) +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif + +#endif /* } */ + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if !defined(LUA_DIRSEP) + +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Marks for exported symbols in the C code +** =================================================================== +*/ + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all auxiliary library functions. +@@ LUAMOD_API is a mark for all standard library opening functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) /* { */ + +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#define LUA_API __declspec(dllexport) +#else /* }{ */ +#define LUA_API __declspec(dllimport) +#endif /* } */ + +#else /* }{ */ + +#define LUA_API extern + +#endif /* } */ + + +/* +** More often than not the libs go together with the core. +*/ +#define LUALIB_API LUA_API +#define LUAMOD_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +** exported to outside modules. +@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables, +** none of which to be exported to outside modules (LUAI_DDEF for +** definitions and LUAI_DDEC for declarations). +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. Not all elf targets support +** this attribute. Unfortunately, gcc does not offer a way to check +** whether the target offers that support, and those without support +** give a warning about it. To avoid these warnings, change to the +** default definition. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("internal"))) extern +#else /* }{ */ +#define LUAI_FUNC extern +#endif /* } */ + +#define LUAI_DDEC(dec) LUAI_FUNC dec +#define LUAI_DDEF /* empty */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Compatibility with previous versions +** =================================================================== +*/ + +/* +@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3. +** You can define it to get all options, or change specific options +** to fit your specific needs. +*/ +#if defined(LUA_COMPAT_5_3) /* { */ + +/* +@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated +** functions in the mathematical library. +** (These functions were already officially removed in 5.3; +** nevertheless they are still available here.) +*/ +#define LUA_COMPAT_MATHLIB + +/* +@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for +** manipulating other integer types (lua_pushunsigned, lua_tounsigned, +** luaL_checkint, luaL_checklong, etc.) +** (These macros were also officially removed in 5.3, but they are still +** available here.) +*/ +#define LUA_COMPAT_APIINTCASTS + + +/* +@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod +** using '__lt'. +*/ +#define LUA_COMPAT_LT_LE + + +/* +@@ The following macros supply trivial compatibility for some +** changes in the API. The macros themselves document how to +** change your code to avoid using them. +** (Once more, these macros were officially removed in 5.3, but they are +** still available here.) +*/ +#define lua_strlen(L,i) lua_rawlen(L, (i)) + +#define lua_objlen(L,i) lua_rawlen(L, (i)) + +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) + +#endif /* } */ + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Numbers (low-level part). +** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* +** satisfy your needs. +** =================================================================== +*/ + +/* +@@ LUAI_UACNUMBER is the result of a 'default argument promotion' +@@ over a floating number. +@@ l_floatatt(x) corrects float attribute 'x' to the proper float type +** by prefixing it with one of FLT/DBL/LDBL. +@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. +@@ LUA_NUMBER_FMT is the format for writing floats. +@@ lua_number2str converts a float to a string. +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. +@@ l_floor takes the floor of a float. +@@ lua_str2number converts a decimal numeral to a number. +*/ + + +/* The following definitions are good for most cases here */ + +#define l_floor(x) (l_mathop(floor)(x)) + +#define lua_number2str(s,sz,n) \ + l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) + +/* +@@ lua_numbertointeger converts a float number with an integral value +** to an integer, or returns 0 if float is not within the range of +** a lua_Integer. (The range comparisons are tricky because of +** rounding. The tests here assume a two-complement representation, +** where MININTEGER always has an exact representation as a float; +** MAXINTEGER may not have one, and therefore its conversion to float +** may have an ill-defined value.) +*/ +#define lua_numbertointeger(n,p) \ + ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ + (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ + (*(p) = (LUA_INTEGER)(n), 1)) + + +/* now the variable definitions */ + +#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ + +#define LUA_NUMBER float + +#define l_floatatt(n) (FLT_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.7g" + +#define l_mathop(op) op##f + +#define lua_str2number(s,p) strtof((s), (p)) + + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ + +#define LUA_NUMBER long double + +#define l_floatatt(n) (LDBL_##n) + +#define LUAI_UACNUMBER long double + +#define LUA_NUMBER_FRMLEN "L" +#define LUA_NUMBER_FMT "%.19Lg" + +#define l_mathop(op) op##l + +#define lua_str2number(s,p) strtold((s), (p)) + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ + +#define LUA_NUMBER double + +#define l_floatatt(n) (DBL_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.14g" + +#define l_mathop(op) op + +#define lua_str2number(s,p) strtod((s), (p)) + +#else /* }{ */ + +#error "numeric float type not defined" + +#endif /* } */ + + + +/* +@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. +@@ LUAI_UACINT is the result of a 'default argument promotion' +@@ over a LUA_INTEGER. +@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. +@@ LUA_INTEGER_FMT is the format for writing integers. +@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. +@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. +@@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. +@@ lua_integer2str converts an integer to a string. +*/ + + +/* The following definitions are good for most cases here */ + +#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" + +#define LUAI_UACINT LUA_INTEGER + +#define lua_integer2str(s,sz,n) \ + l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) + +/* +** use LUAI_UACINT here to avoid problems with promotions (which +** can turn a comparison between unsigneds into a signed comparison) +*/ +#define LUA_UNSIGNED unsigned LUAI_UACINT + + +/* now the variable definitions */ + +#if LUA_INT_TYPE == LUA_INT_INT /* { int */ + +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#define LUA_MAXINTEGER INT_MAX +#define LUA_MININTEGER INT_MIN + +#define LUA_MAXUNSIGNED UINT_MAX + +#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ + +#define LUA_INTEGER long +#define LUA_INTEGER_FRMLEN "l" + +#define LUA_MAXINTEGER LONG_MAX +#define LUA_MININTEGER LONG_MIN + +#define LUA_MAXUNSIGNED ULONG_MAX + +#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ + +/* use presence of macro LLONG_MAX as proxy for C99 compliance */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#define LUA_MAXUNSIGNED ULLONG_MAX + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ + +#define LUA_INTEGER __int64 +#define LUA_INTEGER_FRMLEN "I64" + +#define LUA_MAXINTEGER _I64_MAX +#define LUA_MININTEGER _I64_MIN + +#define LUA_MAXUNSIGNED _UI64_MAX + +#else /* }{ */ + +#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ + or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" + +#endif /* } */ + +#else /* }{ */ + +#error "numeric integer type not defined" + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Dependencies with C99 and other C details +** =================================================================== +*/ + +/* +@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. +** (All uses in Lua have only one format item.) +*/ +#if !defined(LUA_USE_C89) +#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) +#else +#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) +#endif + + +/* +@@ lua_strx2number converts a hexadecimal numeral to a number. +** In C99, 'strtod' does that conversion. Otherwise, you can +** leave 'lua_strx2number' undefined and Lua will provide its own +** implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_strx2number(s,p) lua_str2number(s,p) +#endif + + +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) + + +/* +@@ lua_number2strx converts a float to a hexadecimal numeral. +** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. +** Otherwise, you can leave 'lua_number2strx' undefined and Lua will +** provide its own implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_number2strx(L,b,sz,f,n) \ + ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) +#endif + + +/* +** 'strtof' and 'opf' variants for math functions are not valid in +** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the +** availability of these variants. ('math.h' is already included in +** all files that use these macros.) +*/ +#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) +#undef l_mathop /* variants not available */ +#undef lua_str2number +#define l_mathop(op) (lua_Number)op /* no variant */ +#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) +#endif + + +/* +@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation +** functions. It must be a numerical type; Lua will use 'intptr_t' if +** available, otherwise it will use 'ptrdiff_t' (the nearest thing to +** 'intptr_t' in C89) +*/ +#define LUA_KCONTEXT ptrdiff_t + +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(INTPTR_MAX) /* even in C99 this type is optional */ +#undef LUA_KCONTEXT +#define LUA_KCONTEXT intptr_t +#endif +#endif + + +/* +@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). +** Change that if you do not want to use C locales. (Code using this +** macro must include the header 'locale.h'.) +*/ +#if !defined(lua_getlocaledecpoint) +#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) +#endif + + +/* +** macros to improve jump prediction, used mostly for error handling +** and debug facilities. (Some macros in the Lua API use these macros. +** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your +** code.) +*/ +#if !defined(luai_likely) + +#if defined(__GNUC__) && !defined(LUA_NOBUILTIN) +#define luai_likely(x) (__builtin_expect(((x) != 0), 1)) +#define luai_unlikely(x) (__builtin_expect(((x) != 0), 0)) +#else +#define luai_likely(x) (x) +#define luai_unlikely(x) (x) +#endif + +#endif + + +#if defined(LUA_CORE) || defined(LUA_LIB) +/* shorter names for Lua's own use */ +#define l_likely(x) luai_likely(x) +#define l_unlikely(x) luai_unlikely(x) +#endif + + + +/* }================================================================== */ + + +/* +** {================================================================== +** Language Variations +** ===================================================================== +*/ + +/* +@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some +** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from +** numbers to strings. Define LUA_NOCVTS2N to turn off automatic +** coercion from strings to numbers. +*/ +/* #define LUA_NOCVTN2S */ +/* #define LUA_NOCVTS2N */ + + +/* +@@ LUA_USE_APICHECK turns on several consistency checks on the C API. +** Define it as a help when debugging C code. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(l,e) assert(e) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Macros that affect the API and must be stable (that is, must be the +** same when you compile Lua and when you compile code that links to +** Lua). +** ===================================================================== +*/ + +/* +@@ LUAI_MAXSTACK limits the size of the Lua stack. +** CHANGE it if you need a different limit. This limit is arbitrary; +** its only purpose is to stop Lua from consuming unlimited stack +** space (and to reserve some numbers for pseudo-indices). +** (It must fit into max(size_t)/32 and max(int)/2.) +*/ +#if LUAI_IS32INT +#define LUAI_MAXSTACK 1000000 +#else +#define LUAI_MAXSTACK 15000 +#endif + + +/* +@@ LUA_EXTRASPACE defines the size of a raw memory area associated with +** a Lua state with very fast access. +** CHANGE it if you need a different size. +*/ +#define LUA_EXTRASPACE (sizeof(void *)) + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +** of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +@@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib +** buffer system. +*/ +#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) + + +/* +@@ LUAI_MAXALIGN defines fields that, when used in a union, ensure +** maximum alignment for the other items in that union. +*/ +#define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l + +/* }================================================================== */ + + + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + + + +#endif + diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lualib.h b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lualib.h new file mode 100644 index 00000000..26255290 --- /dev/null +++ b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/include/lualib.h @@ -0,0 +1,52 @@ +/* +** $Id: lualib.h $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* version suffix for environment variable names */ +#define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR + + +LUAMOD_API int (luaopen_base) (lua_State *L); + +#define LUA_COLIBNAME "coroutine" +LUAMOD_API int (luaopen_coroutine) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUAMOD_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUAMOD_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUAMOD_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUAMOD_API int (luaopen_string) (lua_State *L); + +#define LUA_UTF8LIBNAME "utf8" +LUAMOD_API int (luaopen_utf8) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUAMOD_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUAMOD_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUAMOD_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + +#endif diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Debug/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Debug/lua.lib new file mode 100644 index 00000000..ba0024d6 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Debug/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Debug/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Debug/lua_static.lib new file mode 100644 index 00000000..d656b8cd Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Debug/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Release/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Release/lua.lib new file mode 100644 index 00000000..7039c96a Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Release/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Release/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Release/lua_static.lib new file mode 100644 index 00000000..9303f4d7 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v120/Release/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Debug/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Debug/lua.lib new file mode 100644 index 00000000..35621f9d Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Debug/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Debug/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Debug/lua_static.lib new file mode 100644 index 00000000..fa370b04 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Debug/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Release/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Release/lua.lib new file mode 100644 index 00000000..ab9cf7fa Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Release/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Release/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Release/lua_static.lib new file mode 100644 index 00000000..ce19d447 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v140/Release/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Debug/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Debug/lua.lib new file mode 100644 index 00000000..af59442d Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Debug/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Debug/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Debug/lua_static.lib new file mode 100644 index 00000000..932391bb Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Debug/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Release/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Release/lua.lib new file mode 100644 index 00000000..234085fd Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Release/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Release/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Release/lua_static.lib new file mode 100644 index 00000000..e2f9c235 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v141/Release/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Debug/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Debug/lua.lib new file mode 100644 index 00000000..3f3f45ae Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Debug/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Debug/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Debug/lua_static.lib new file mode 100644 index 00000000..79430e2b Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Debug/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Release/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Release/lua.lib new file mode 100644 index 00000000..5173f087 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Release/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Release/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Release/lua_static.lib new file mode 100644 index 00000000..9a7980c0 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v142/Release/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Debug/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Debug/lua.lib new file mode 100644 index 00000000..5331e129 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Debug/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Debug/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Debug/lua_static.lib new file mode 100644 index 00000000..87749010 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Debug/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Release/lua.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Release/lua.lib new file mode 100644 index 00000000..5bc08cd4 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Release/lua.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Release/lua_static.lib b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Release/lua_static.lib new file mode 100644 index 00000000..81fade8b Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/build/native/lib/Win32/v143/Release/lua_static.lib differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/images/logo.png b/Sources/backend-cpp/Windows/packages/lua.5.4.6/images/logo.png new file mode 100644 index 00000000..343afbb6 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/images/logo.png differ diff --git a/Sources/backend-cpp/Windows/packages/lua.5.4.6/lua.5.4.6.nupkg b/Sources/backend-cpp/Windows/packages/lua.5.4.6/lua.5.4.6.nupkg new file mode 100644 index 00000000..f3015e51 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/lua.5.4.6/lua.5.4.6.nupkg differ diff --git a/Sources/backend-cpp/Windows/packages/nlohmann.json.3.11.2/.signature.p7s b/Sources/backend-cpp/Windows/packages/nlohmann.json.3.11.2/.signature.p7s new file mode 100644 index 00000000..31a39895 Binary files /dev/null and b/Sources/backend-cpp/Windows/packages/nlohmann.json.3.11.2/.signature.p7s differ diff --git a/Sources/backend-cpp/Vendor/json/src/json.hpp b/Sources/backend-cpp/Windows/packages/nlohmann.json.3.11.2/build/native/include/nlohmann/json.hpp similarity index 83% rename from Sources/backend-cpp/Vendor/json/src/json.hpp rename to Sources/backend-cpp/Windows/packages/nlohmann.json.3.11.2/build/native/include/nlohmann/json.hpp index 92308c55..4d1a37ad 100644 --- a/Sources/backend-cpp/Vendor/json/src/json.hpp +++ b/Sources/backend-cpp/Windows/packages/nlohmann.json.3.11.2/build/native/include/nlohmann/json.hpp @@ -1,31 +1,10 @@ -/* - __ _____ _____ _____ - __| | __| | | | JSON for Modern C++ -| | |__ | | | | | | version 3.10.5 -|_____|_____|_____|_|___| https://github.com/nlohmann/json - -Licensed under the MIT License . -SPDX-License-Identifier: MIT -Copyright (c) 2013-2022 Niels Lohmann . - -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. -*/ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT /****************************************************************************\ * Note on documentation: The source files contain links to the online * @@ -33,16 +12,12 @@ SOFTWARE. * contains the most recent documentation and should also be applicable to * * previous versions; documentation for deprecated functions is not * * removed, but marked deprecated. See "Generate documentation" section in * - * file doc/README.md. * + * file docs/README.md. * \****************************************************************************/ #ifndef INCLUDE_NLOHMANN_JSON_HPP_ #define INCLUDE_NLOHMANN_JSON_HPP_ -#define NLOHMANN_JSON_VERSION_MAJOR 3 -#define NLOHMANN_JSON_VERSION_MINOR 10 -#define NLOHMANN_JSON_VERSION_PATCH 5 - #include // all_of, find, for_each #include // nullptr_t, ptrdiff_t, size_t #include // hash, less @@ -58,12 +33,129 @@ SOFTWARE. #include // vector // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + -#include #include +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include // transform @@ -79,14 +171,31 @@ SOFTWARE. #include // valarray // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +#include // nullptr_t #include // exception #include // runtime_error #include // to_string #include // vector // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include // array @@ -94,102 +203,130 @@ SOFTWARE. #include // uint8_t #include // string -namespace nlohmann -{ +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { -/////////////////////////// -// JSON type enumeration // -/////////////////////////// -/*! -@brief the JSON type enumeration +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; -This enumeration collects the different JSON types. It is internally used to -distinguish the stored values, and the functions @ref basic_json::is_null(), -@ref basic_json::is_object(), @ref basic_json::is_array(), -@ref basic_json::is_string(), @ref basic_json::is_boolean(), -@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), -@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), -@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and -@ref basic_json::is_structured() rely on it. +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END -@note There are three enumeration entries (number_integer, number_unsigned, and -number_float), because the library distinguishes these three types for numbers: -@ref basic_json::number_unsigned_t is used for unsigned integers, -@ref basic_json::number_integer_t is used for signed integers, and -@ref basic_json::number_float_t is used for floating-point numbers or to -approximate integers which do not fit in the limits of their respective type. -@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON -value with the default value for a given type +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ -@since version 1.0.0 -*/ -enum class value_t : std::uint8_t +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch { - null, ///< null value - object, ///< object (unordered set of name/value pairs) - array, ///< array (ordered collection of values) - string, ///< string value - boolean, ///< boolean value - number_integer, ///< number value (signed integer) - number_unsigned, ///< number value (unsigned integer) - number_float, ///< number value (floating-point) - binary, ///< binary array (ordered collection of bytes) - discarded ///< discarded by the parser callback function + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; }; -/*! -@brief comparison operator for JSON types - -Returns an ordering that is similar to Python: -- order: null < boolean < number < object < array < string < binary -- furthermore, each type is not smaller than itself -- discarded values are not comparable -- binary is represented as a b"" string in python and directly comparable to a - string; however, making a binary array directly comparable with a string would - be surprising behavior in a JSON file. +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; -@since version 1.0.0 -*/ -inline bool operator<(const value_t lhs, const value_t rhs) noexcept +template class Op, class... Args> +struct detector>, Op, Args...> { - static constexpr std::array order = {{ - 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, - 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, - 6 /* binary */ - } - }; + using value_t = std::true_type; + using type = Op; +}; - const auto l_index = static_cast(lhs); - const auto r_index = static_cast(rhs); - return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; -} -} // namespace detail -} // namespace nlohmann +template class Op, class... Args> +using is_detected = typename detector::value_t; -// #include +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; +template class Op, class... Args> +using detected_t = typename detector::type; -#include -// #include +template class Op, class... Args> +using detected_or = detector; +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END -#include // declval, pair // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + /* Hedley - https://nemequ.github.io/hedley * Created by Evan Nemerson - * - * To the extent possible under law, the author(s) have dedicated all - * copyright and related and neighboring rights to this software to - * the public domain worldwide. This software is distributed without - * any warranty. - * - * For details, see . - * SPDX-License-Identifier: CC0-1.0 */ #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) @@ -2223,130 +2360,62 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ -// #include +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them -#include +// #include -// #include +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif -namespace nlohmann -{ -namespace detail -{ -template struct make_void -{ - using type = void; -}; -template using void_t = typename make_void::type; -} // namespace detail -} // namespace nlohmann +// C++ language standard detection +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif +#ifdef __has_include + #if __has_include() + #include + #endif +#endif -// https://en.cppreference.com/w/cpp/experimental/is_detected -namespace nlohmann -{ -namespace detail -{ -struct nonesuch -{ - nonesuch() = delete; - ~nonesuch() = delete; - nonesuch(nonesuch const&) = delete; - nonesuch(nonesuch const&&) = delete; - void operator=(nonesuch const&) = delete; - void operator=(nonesuch&&) = delete; -}; - -template class Op, - class... Args> -struct detector -{ - using value_t = std::false_type; - using type = Default; -}; - -template class Op, class... Args> -struct detector>, Op, Args...> -{ - using value_t = std::true_type; - using type = Op; -}; - -template class Op, class... Args> -using is_detected = typename detector::value_t; - -template class Op, class... Args> -struct is_detected_lazy : is_detected { }; - -template class Op, class... Args> -using detected_t = typename detector::type; - -template class Op, class... Args> -using detected_or = detector; - -template class Op, class... Args> -using detected_or_t = typename detected_or::type; - -template class Op, class... Args> -using is_detected_exact = std::is_same>; - -template class Op, class... Args> -using is_detected_convertible = - std::is_convertible, To>; -} // namespace detail -} // namespace nlohmann - - -// This file contains all internal macro definitions -// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them - -// exclude unsupported compilers -#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) - #if defined(__clang__) - #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 - #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" - #endif - #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) - #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 - #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" - #endif - #endif -#endif - -// C++ language standard detection -// if the user manually specified the used c++ version this is skipped -#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) - #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - #define JSON_HAS_CPP_20 - #define JSON_HAS_CPP_17 - #define JSON_HAS_CPP_14 - #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 - #define JSON_HAS_CPP_17 - #define JSON_HAS_CPP_14 - #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) - #define JSON_HAS_CPP_14 - #endif - // the cpp 11 flag is always specified because it is the minimal required version - #define JSON_HAS_CPP_11 -#endif - -#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) - #ifdef JSON_HAS_CPP_17 - #if defined(__cpp_lib_filesystem) - #define JSON_HAS_FILESYSTEM 1 - #elif defined(__cpp_lib_experimental_filesystem) - #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 - #elif !defined(__has_include) - #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 - #elif __has_include() - #define JSON_HAS_FILESYSTEM 1 - #elif __has_include() - #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 - #endif +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 @@ -2394,6 +2463,38 @@ using is_detected_convertible = #define JSON_HAS_FILESYSTEM 0 #endif +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + // disable documentation warnings on clang #if defined(__clang__) #pragma clang diagnostic push @@ -2631,6 +2732,7 @@ using is_detected_convertible = #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); /*! @brief macro @@ -2641,6 +2743,10 @@ using is_detected_convertible = friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + /*! @brief macro @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE @@ -2650,6 +2756,10 @@ using is_detected_convertible = inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + // inspired from https://stackoverflow.com/a/26745591 // allows to call any std function as if (e.g. with begin): @@ -2699,13 +2809,132 @@ using is_detected_convertible = #define JSON_EXPLICIT explicit #endif -#ifndef JSON_DIAGNOSTICS - #define JSON_DIAGNOSTICS 0 +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept #endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} -namespace nlohmann +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept { + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { @@ -2722,12 +2951,13 @@ enforced with an assertion.** @since version 2.0.0 */ -inline void replace_substring(std::string& s, const std::string& f, - const std::string& t) +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) { JSON_ASSERT(!f.empty()); for (auto pos = s.find(f); // find first occurrence of f - pos != std::string::npos; // make sure f was found + pos != StringType::npos; // make sure f was found s.replace(pos, f.size(), t), // replace with t, and pos = s.find(f, pos + t.size())) // find next occurrence of f {} @@ -2740,10 +2970,11 @@ inline void replace_substring(std::string& s, const std::string& f, * * Note the order of escaping "~" to "~0" and "/" to "~1" is important. */ -inline std::string escape(std::string s) +template +inline StringType escape(StringType s) { - replace_substring(s, "~", "~0"); - replace_substring(s, "/", "~1"); + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); return s; } @@ -2754,24 +2985,36 @@ inline std::string escape(std::string s) * * Note the order of escaping "~1" to "/" and "~0" to "~" is important. */ -static void unescape(std::string& s) +template +static void unescape(StringType& s) { - replace_substring(s, "~1", "/"); - replace_substring(s, "~0", "~"); + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); } -} // namespace detail -} // namespace nlohmann +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include // size_t -namespace nlohmann -{ +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { + /// struct to capture the start position of the current token struct position_t { @@ -2789,266 +3032,47 @@ struct position_t } }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for // #include -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { -//////////////// -// exceptions // -//////////////// -/// @brief general exception of the @ref basic_json class -/// @sa https://json.nlohmann.me/api/basic_json/exception/ -class exception : public std::exception -{ - public: - /// returns the explanatory string - const char* what() const noexcept override - { - return m.what(); - } +template +using uncvref_t = typename std::remove_cv::type>::type; - /// the id of the exception - const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes) +#ifdef JSON_HAS_CPP_14 - protected: - JSON_HEDLEY_NON_NULL(3) - exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing) +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; - static std::string name(const std::string& ename, int id_) - { - return "[json.exception." + ename + "." + std::to_string(id_) + "] "; - } - - template - static std::string diagnostics(const BasicJsonType& leaf_element) - { -#if JSON_DIAGNOSTICS - std::vector tokens; - for (const auto* current = &leaf_element; current->m_parent != nullptr; current = current->m_parent) - { - switch (current->m_parent->type()) - { - case value_t::array: - { - for (std::size_t i = 0; i < current->m_parent->m_value.array->size(); ++i) - { - if (¤t->m_parent->m_value.array->operator[](i) == current) - { - tokens.emplace_back(std::to_string(i)); - break; - } - } - break; - } - - case value_t::object: - { - for (const auto& element : *current->m_parent->m_value.object) - { - if (&element.second == current) - { - tokens.emplace_back(element.first.c_str()); - break; - } - } - break; - } - - case value_t::null: // LCOV_EXCL_LINE - case value_t::string: // LCOV_EXCL_LINE - case value_t::boolean: // LCOV_EXCL_LINE - case value_t::number_integer: // LCOV_EXCL_LINE - case value_t::number_unsigned: // LCOV_EXCL_LINE - case value_t::number_float: // LCOV_EXCL_LINE - case value_t::binary: // LCOV_EXCL_LINE - case value_t::discarded: // LCOV_EXCL_LINE - default: // LCOV_EXCL_LINE - break; // LCOV_EXCL_LINE - } - } - - if (tokens.empty()) - { - return ""; - } - - return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, - [](const std::string & a, const std::string & b) - { - return a + "/" + detail::escape(b); - }) + ") "; -#else - static_cast(leaf_element); - return ""; -#endif - } - - private: - /// an exception object as storage for error messages - std::runtime_error m; -}; - -/// @brief exception indicating a parse error -/// @sa https://json.nlohmann.me/api/basic_json/parse_error/ -class parse_error : public exception -{ - public: - /*! - @brief create a parse error exception - @param[in] id_ the id of the exception - @param[in] pos the position where the error occurred (or with - chars_read_total=0 if the position cannot be - determined) - @param[in] what_arg the explanatory string - @return parse_error object - */ - template - static parse_error create(int id_, const position_t& pos, const std::string& what_arg, const BasicJsonType& context) - { - std::string w = exception::name("parse_error", id_) + "parse error" + - position_string(pos) + ": " + exception::diagnostics(context) + what_arg; - return {id_, pos.chars_read_total, w.c_str()}; - } - - template - static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, const BasicJsonType& context) - { - std::string w = exception::name("parse_error", id_) + "parse error" + - (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + - ": " + exception::diagnostics(context) + what_arg; - return {id_, byte_, w.c_str()}; - } - - /*! - @brief byte index of the parse error - - The byte index of the last read character in the input file. - - @note For an input with n bytes, 1 is the index of the first character and - n+1 is the index of the terminating null byte or the end of file. - This also holds true when reading a byte vector (CBOR or MessagePack). - */ - const std::size_t byte; - - private: - parse_error(int id_, std::size_t byte_, const char* what_arg) - : exception(id_, what_arg), byte(byte_) {} - - static std::string position_string(const position_t& pos) - { - return " at line " + std::to_string(pos.lines_read + 1) + - ", column " + std::to_string(pos.chars_read_current_line); - } -}; - -/// @brief exception indicating errors with iterators -/// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/ -class invalid_iterator : public exception -{ - public: - template - static invalid_iterator create(int id_, const std::string& what_arg, const BasicJsonType& context) - { - std::string w = exception::name("invalid_iterator", id_) + exception::diagnostics(context) + what_arg; - return {id_, w.c_str()}; - } - - private: - JSON_HEDLEY_NON_NULL(3) - invalid_iterator(int id_, const char* what_arg) - : exception(id_, what_arg) {} -}; - -/// @brief exception indicating executing a member function with a wrong type -/// @sa https://json.nlohmann.me/api/basic_json/type_error/ -class type_error : public exception -{ - public: - template - static type_error create(int id_, const std::string& what_arg, const BasicJsonType& context) - { - std::string w = exception::name("type_error", id_) + exception::diagnostics(context) + what_arg; - return {id_, w.c_str()}; - } - - private: - JSON_HEDLEY_NON_NULL(3) - type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} -}; - -/// @brief exception indicating access out of the defined range -/// @sa https://json.nlohmann.me/api/basic_json/out_of_range/ -class out_of_range : public exception -{ - public: - template - static out_of_range create(int id_, const std::string& what_arg, const BasicJsonType& context) - { - std::string w = exception::name("out_of_range", id_) + exception::diagnostics(context) + what_arg; - return {id_, w.c_str()}; - } - - private: - JSON_HEDLEY_NON_NULL(3) - out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} -}; - -/// @brief exception indicating other library errors -/// @sa https://json.nlohmann.me/api/basic_json/other_error/ -class other_error : public exception -{ - public: - template - static other_error create(int id_, const std::string& what_arg, const BasicJsonType& context) - { - std::string w = exception::name("other_error", id_) + exception::diagnostics(context) + what_arg; - return {id_, w.c_str()}; - } - - private: - JSON_HEDLEY_NON_NULL(3) - other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} -}; - -} // namespace detail -} // namespace nlohmann - -// #include - -// #include - - -#include // size_t -#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type -#include // index_sequence, make_index_sequence, index_sequence_for - -// #include - - -namespace nlohmann -{ -namespace detail -{ - -template -using uncvref_t = typename std::remove_cv::type>::type; - -#ifdef JSON_HAS_CPP_14 - -// the following utilities are natively available in C++14 -using std::enable_if_t; -using std::index_sequence; -using std::make_index_sequence; -using std::index_sequence_for; - -#else +#else // alias templates to reduce boilerplate template @@ -3170,28 +3194,32 @@ template<> struct priority_tag<0> {}; template struct static_const { - static constexpr T value{}; + static JSON_INLINE_VARIABLE constexpr T value{}; }; -template -constexpr T static_const::value; // NOLINT(readability-redundant-declaration) - -} // namespace detail -} // namespace nlohmann - -// #include - +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif -namespace nlohmann -{ -namespace detail +template +inline constexpr std::array make_array(Args&& ... args) { -// dispatching helper struct -template struct identity_tag {}; + return std::array {{static_cast(std::forward(args))...}}; +} + } // namespace detail -} // namespace nlohmann +NLOHMANN_JSON_NAMESPACE_END // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include // numeric_limits @@ -3199,23 +3227,30 @@ template struct identity_tag {}; #include // declval #include // tuple -// #include - - // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #include // random_access_iterator_tag +// #include + // #include // #include -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { + template struct iterator_types {}; @@ -3254,104 +3289,135 @@ struct iterator_traits::value>> using pointer = T*; using reference = T&; }; -} // namespace detail -} // namespace nlohmann + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + // #include -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN + NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); -} // namespace nlohmann + +NLOHMANN_JSON_NAMESPACE_END // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + // #include -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN + NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); -} // namespace nlohmann + +NLOHMANN_JSON_NAMESPACE_END // #include // #include // #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ -#define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ -#include // int64_t, uint64_t -#include // map -#include // allocator -#include // string -#include // vector + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector -/*! -@brief namespace for Niels Lohmann -@see https://github.com/nlohmann -@since version 1.0.0 -*/ -namespace nlohmann -{ -/*! -@brief default JSONSerializer template argument + // #include -This serializer ignores the template arguments and uses ADL -([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) -for serialization. -*/ -template -struct adl_serializer; - -/// a class to store JSON values -/// @sa https://json.nlohmann.me/api/basic_json/ -template class ObjectType = - std::map, - template class ArrayType = std::vector, - class StringType = std::string, class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = - adl_serializer, - class BinaryType = std::vector> -class basic_json; -/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document -/// @sa https://json.nlohmann.me/api/json_pointer/ -template -class json_pointer; + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN -/*! -@brief default specialization -@sa https://json.nlohmann.me/api/json/ -*/ -using json = basic_json<>; + /*! + @brief default JSONSerializer template argument -/// @brief a minimal map-like container that preserves insertion order -/// @sa https://json.nlohmann.me/api/ordered_map/ -template -struct ordered_map; + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; -/// @brief specialization that maintains the insertion order of object keys -/// @sa https://json.nlohmann.me/api/ordered_json/ -using ordered_json = basic_json; + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; -} // namespace nlohmann + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ -namespace nlohmann -{ +NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief detail namespace with internal helper functions @@ -3362,6 +3428,7 @@ implementations of some @ref basic_json methods, and meta-programming helpers. */ namespace detail { + ///////////// // helpers // ///////////// @@ -3380,6 +3447,16 @@ template struct is_basic_json : std::false_type {}; NLOHMANN_BASIC_JSON_TPL_DECLARATION struct is_basic_json : std::true_type {}; +// used by exceptions create() member functions +// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + ////////////////////// // json_ref helpers // ////////////////////// @@ -3481,6 +3558,24 @@ struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> T>::value; }; +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; /////////////////// // is_ functions // @@ -3488,10 +3583,10 @@ struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> // https://en.cppreference.com/w/cpp/types/conjunction template struct conjunction : std::true_type { }; -template struct conjunction : B1 { }; -template -struct conjunction -: std::conditional, B1>::type {}; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { }; @@ -3655,9 +3750,18 @@ struct is_compatible_string_type template struct is_constructible_string_type { + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + static constexpr auto value = - is_constructible::value; + conjunction < + is_constructible, + is_detected_exact>::value; }; template @@ -3775,6 +3879,81 @@ struct is_constructible_tuple : std::false_type {}; template struct is_constructible_tuple> : conjunction...> {}; +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template