Reamalgamate

This commit is contained in:
John Keiser 2020-05-02 14:49:15 -07:00
parent 5312fd30e5
commit d7f133c24c
2 changed files with 892 additions and 868 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* auto-generated on Mon 27 Apr 2020 21:20:37 EDT. Do not edit! */
/* begin file simdjson.h */
/* auto-generated on Sat May 2 15:01:27 PDT 2020. Do not edit! */
/* begin file include/simdjson.h */
#ifndef SIMDJSON_H
#define SIMDJSON_H
@ -9,7 +9,7 @@
* Check the [README.md](https://github.com/lemire/simdjson/blob/master/README.md#simdjson--parsing-gigabytes-of-json-per-second).
*/
/* begin file simdjson/compiler_check.h */
/* begin file include/simdjson/compiler_check.h */
#ifndef SIMDJSON_COMPILER_CHECK_H
#define SIMDJSON_COMPILER_CHECK_H
@ -45,13 +45,13 @@
#endif
#endif // SIMDJSON_COMPILER_CHECK_H
/* end file */
/* begin file simdjson/common_defs.h */
/* end file include/simdjson/compiler_check.h */
/* begin file include/simdjson/common_defs.h */
#ifndef SIMDJSON_COMMON_DEFS_H
#define SIMDJSON_COMMON_DEFS_H
#include <cassert>
/* begin file simdjson/portability.h */
/* begin file include/simdjson/portability.h */
#ifndef SIMDJSON_PORTABILITY_H
#define SIMDJSON_PORTABILITY_H
@ -201,8 +201,13 @@ compiling for a known 64-bit platform."
// regular visual studio and clang under visual studio.
// clang under Windows has _stricmp (like visual studio) but not strcasecmp (as clang normally has)
#define simdjson_strcasecmp _stricmp
#define simdjson_strncasecmp _strnicmp
#else
// The strcasecmp, strncasecmp, and strcasestr functions do not work with multibyte strings (e.g. UTF-8).
// So they are only useful for ASCII in our context.
// https://www.gnu.org/software/libunistring/manual/libunistring.html#char-_002a-strings
#define simdjson_strcasecmp strcasecmp
#define simdjson_strncasecmp strncasecmp
#endif
namespace simdjson {
@ -248,7 +253,7 @@ static inline void aligned_free_char(char *mem_block) {
}
} // namespace simdjson
#endif // SIMDJSON_PORTABILITY_H
/* end file */
/* end file include/simdjson/portability.h */
namespace simdjson {
@ -423,7 +428,7 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
//
#ifndef SIMDJSON_HAS_STRING_VIEW
SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
/* begin file simdjson/nonstd/string_view.hpp */
/* begin file include/simdjson/nonstd/string_view.hpp */
// Copyright 2017-2019 by Martin Moene
//
// string-view lite, a C++17-like string_view for C++98 and later.
@ -1953,7 +1958,7 @@ nssv_RESTORE_WARNINGS()
#endif // nssv_HAVE_STD_STRING_VIEW
#endif // NONSTD_SV_LITE_H_INCLUDED
/* end file */
/* end file include/simdjson/nonstd/string_view.hpp */
SIMDJSON_POP_DISABLE_WARNINGS
namespace std {
@ -1963,7 +1968,7 @@ namespace std {
#undef SIMDJSON_HAS_STRING_VIEW // We are not going to need this macro anymore.
#endif // SIMDJSON_COMMON_DEFS_H
/* end file */
/* end file include/simdjson/nonstd/string_view.hpp */
SIMDJSON_PUSH_DISABLE_WARNINGS
#if defined(_MSC_VER) && defined(__clang__)
@ -1971,7 +1976,7 @@ SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
#endif
// Public API
/* begin file simdjson/simdjson_version.h */
/* begin file include/simdjson/simdjson_version.h */
// /include/simdjson/simdjson_version.h automatically generated by release.py,
// do not change by hand
#ifndef SIMDJSON_SIMDJSON_VERSION_H
@ -1998,8 +2003,8 @@ enum {
} // namespace simdjson
#endif // SIMDJSON_SIMDJSON_VERSION_H
/* end file */
/* begin file simdjson/error.h */
/* end file include/simdjson/simdjson_version.h */
/* begin file include/simdjson/error.h */
#ifndef SIMDJSON_ERROR_H
#define SIMDJSON_ERROR_H
@ -2232,8 +2237,8 @@ inline const std::string &error_message(int error) noexcept;
} // namespace simdjson
#endif // SIMDJSON_ERROR_H
/* end file */
/* begin file simdjson/padded_string.h */
/* end file include/simdjson/error.h */
/* begin file include/simdjson/padded_string.h */
#ifndef SIMDJSON_PADDED_STRING_H
#define SIMDJSON_PADDED_STRING_H
@ -2373,8 +2378,8 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
} // namespace simdjson
#endif // SIMDJSON_PADDED_STRING_H
/* end file */
/* begin file simdjson/implementation.h */
/* end file include/simdjson/padded_string.h */
/* begin file include/simdjson/implementation.h */
#ifndef SIMDJSON_IMPLEMENTATION_H
#define SIMDJSON_IMPLEMENTATION_H
@ -2382,7 +2387,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
#include <string>
#include <atomic>
#include <vector>
/* begin file simdjson/document.h */
/* begin file include/simdjson/document.h */
#ifndef SIMDJSON_DOCUMENT_H
#define SIMDJSON_DOCUMENT_H
@ -2391,7 +2396,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
#include <string>
#include <limits>
#include <sstream>
/* begin file simdjson/simdjson.h */
/* begin file include/simdjson/simdjson.h */
/**
* @file
* @deprecated We'll be removing this file so it isn't confused with the top level simdjson.h
@ -2401,7 +2406,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
#endif // SIMDJSON_H
/* end file */
/* end file include/simdjson/simdjson.h */
namespace simdjson {
namespace dom {
@ -2706,6 +2711,7 @@ public:
/**
* Get the value associated with the given key in a case-insensitive manner.
* It is only guaranteed to work over ASCII inputs.
*
* Note: The key will be matched against **unescaped** JSON.
*
@ -3731,7 +3737,7 @@ public:
} // namespace simdjson
#endif // SIMDJSON_DOCUMENT_H
/* end file */
/* end file include/simdjson/simdjson.h */
namespace simdjson {
@ -3963,8 +3969,8 @@ extern SIMDJSON_DLLIMPORTEXPORT internal::atomic_ptr<const implementation> activ
} // namespace simdjson
#endif // SIMDJSON_IMPLEMENTATION_H
/* end file */
/* begin file simdjson/document_stream.h */
/* end file include/simdjson/simdjson.h */
/* begin file include/simdjson/document_stream.h */
#ifndef SIMDJSON_DOCUMENT_STREAM_H
#define SIMDJSON_DOCUMENT_STREAM_H
@ -4111,16 +4117,16 @@ private:
} // namespace simdjson
#endif // SIMDJSON_DOCUMENT_STREAM_H
/* end file */
/* end file include/simdjson/document_stream.h */
// // Deprecated API
/* begin file simdjson/jsonparser.h */
/* begin file include/simdjson/jsonparser.h */
// TODO Remove this -- deprecated API and files
#ifndef SIMDJSON_JSONPARSER_H
#define SIMDJSON_JSONPARSER_H
/* begin file simdjson/parsedjson.h */
/* begin file include/simdjson/parsedjson.h */
// TODO Remove this -- deprecated API and files
#ifndef SIMDJSON_PARSEDJSON_H
@ -4136,8 +4142,8 @@ using ParsedJson [[deprecated("Use dom::parser instead")]] = dom::parser;
} // namespace simdjson
#endif
/* end file */
/* begin file simdjson/jsonioutil.h */
/* end file include/simdjson/parsedjson.h */
/* begin file include/simdjson/jsonioutil.h */
#ifndef SIMDJSON_JSONIOUTIL_H
#define SIMDJSON_JSONIOUTIL_H
@ -4163,7 +4169,7 @@ inline padded_string get_corpus(const char *path) {
} // namespace simdjson
#endif // SIMDJSON_JSONIOUTIL_H
/* end file */
/* end file include/simdjson/jsonioutil.h */
namespace simdjson {
@ -4273,8 +4279,8 @@ dom::parser build_parsed_json(const char *buf) noexcept = delete;
} // namespace simdjson
#endif
/* end file */
/* begin file simdjson/parsedjson_iterator.h */
/* end file include/simdjson/jsonioutil.h */
/* begin file include/simdjson/parsedjson_iterator.h */
// TODO Remove this -- deprecated API and files
#ifndef SIMDJSON_PARSEDJSON_ITERATOR_H
@ -4287,7 +4293,7 @@ dom::parser build_parsed_json(const char *buf) noexcept = delete;
#include <limits>
#include <stdexcept>
/* begin file simdjson/internal/jsonformatutils.h */
/* begin file include/simdjson/internal/jsonformatutils.h */
#ifndef SIMDJSON_INTERNAL_JSONFORMATUTILS_H
#define SIMDJSON_INTERNAL_JSONFORMATUTILS_H
@ -4353,7 +4359,7 @@ inline std::ostream& operator<<(std::ostream& out, const escape_json_string &une
} // namespace simdjson
#endif // SIMDJSON_INTERNAL_JSONFORMATUTILS_H
/* end file */
/* end file include/simdjson/internal/jsonformatutils.h */
namespace simdjson {
@ -4608,10 +4614,10 @@ public:
} // namespace simdjson
#endif
/* end file */
/* end file include/simdjson/internal/jsonformatutils.h */
// // Inline functions
/* begin file simdjson/inline/document.h */
/* begin file include/simdjson/inline/document.h */
#ifndef SIMDJSON_INLINE_DOCUMENT_H
#define SIMDJSON_INLINE_DOCUMENT_H
@ -4948,7 +4954,11 @@ inline bool parser::dump_raw_tape(std::ostream &os) const noexcept {
inline simdjson_result<size_t> parser::read_file(const std::string &path) noexcept {
// Open the file
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
std::FILE *fp = std::fopen(path.c_str(), "rb");
SIMDJSON_POP_DISABLE_WARNINGS
if (fp == nullptr) {
return IO_ERROR;
}
@ -5295,10 +5305,10 @@ inline simdjson_result<element> object::at_key_case_insensitive(const std::strin
for (iterator field = begin(); field != end_field; ++field) {
auto field_key = field.key();
if (key.length() == field_key.length()) {
bool equal = true;
for (size_t i=0; i<field_key.length(); i++) {
equal = equal && std::tolower(key[i]) != std::tolower(field_key[i]);
}
// See For case-insensitive string comparisons, avoid char-by-char functions
// https://lemire.me/blog/2020/04/30/for-case-insensitive-string-comparisons-avoid-char-by-char-functions/
// Note that it might be worth rolling our own strncasecmp function, with vectorization.
const bool equal = (simdjson_strncasecmp(key.data(), field_key.data(), key.length()) == 0);
if (equal) { return field.value(); }
}
}
@ -5784,8 +5794,8 @@ inline std::string_view internal::tape_ref::get_string_view() const noexcept {
} // namespace simdjson
#endif // SIMDJSON_INLINE_DOCUMENT_H
/* end file */
/* begin file simdjson/inline/document_stream.h */
/* end file include/simdjson/inline/document.h */
/* begin file include/simdjson/inline/document_stream.h */
#ifndef SIMDJSON_INLINE_DOCUMENT_STREAM_H
#define SIMDJSON_INLINE_DOCUMENT_STREAM_H
@ -6071,8 +6081,8 @@ inline error_code document_stream::json_parse() noexcept {
} // namespace dom
} // namespace simdjson
#endif // SIMDJSON_INLINE_DOCUMENT_STREAM_H
/* end file */
/* begin file simdjson/inline/error.h */
/* end file include/simdjson/inline/document_stream.h */
/* begin file include/simdjson/inline/error.h */
#ifndef SIMDJSON_INLINE_ERROR_H
#define SIMDJSON_INLINE_ERROR_H
@ -6211,8 +6221,8 @@ really_inline simdjson_result<T>::simdjson_result() noexcept
} // namespace simdjson
#endif // SIMDJSON_INLINE_ERROR_H
/* end file */
/* begin file simdjson/inline/padded_string.h */
/* end file include/simdjson/inline/error.h */
/* begin file include/simdjson/inline/padded_string.h */
#ifndef SIMDJSON_INLINE_PADDED_STRING_H
#define SIMDJSON_INLINE_PADDED_STRING_H
@ -6315,7 +6325,11 @@ inline padded_string::operator std::string_view() const { return std::string_vie
inline simdjson_result<padded_string> padded_string::load(const std::string &filename) noexcept {
// Open the file
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
std::FILE *fp = std::fopen(filename.c_str(), "rb");
SIMDJSON_POP_DISABLE_WARNINGS
if (fp == nullptr) {
return IO_ERROR;
}
@ -6352,8 +6366,8 @@ inline simdjson_result<padded_string> padded_string::load(const std::string &fil
} // namespace simdjson
#endif // SIMDJSON_INLINE_PADDED_STRING_H
/* end file */
/* begin file simdjson/inline/parsedjson_iterator.h */
/* end file include/simdjson/inline/padded_string.h */
/* begin file include/simdjson/inline/parsedjson_iterator.h */
#ifndef SIMDJSON_INLINE_PARSEDJSON_ITERATOR_H
#define SIMDJSON_INLINE_PARSEDJSON_ITERATOR_H
@ -6837,9 +6851,9 @@ SIMDJSON_POP_DISABLE_WARNINGS
} // namespace simdjson
#endif // SIMDJSON_INLINE_PARSEDJSON_ITERATOR_H
/* end file */
/* end file include/simdjson/inline/parsedjson_iterator.h */
SIMDJSON_POP_DISABLE_WARNINGS
#endif // SIMDJSON_H
/* end file */
/* end file include/simdjson/inline/parsedjson_iterator.h */