diff --git a/include/simdjson/arm64/implementation.h b/include/simdjson/arm64/implementation.h index 45e5032ed..8c187a809 100644 --- a/include/simdjson/arm64/implementation.h +++ b/include/simdjson/arm64/implementation.h @@ -1,8 +1,10 @@ #ifndef SIMDJSON_ARM64_IMPLEMENTATION_H #define SIMDJSON_ARM64_IMPLEMENTATION_H +#ifndef SIMDJSON_AMALGAMATED #include "simdjson/implementation.h" #include "simdjson/internal/instruction_set.h" +#endif // SIMDJSON_AMALGAMATED namespace simdjson { namespace arm64 { diff --git a/include/simdjson/builtin/implementation.h b/include/simdjson/builtin/implementation.h index 5565a4684..e028ba8c9 100644 --- a/include/simdjson/builtin/implementation.h +++ b/include/simdjson/builtin/implementation.h @@ -3,6 +3,10 @@ #include "simdjson/builtin/base.h" +#include "simdjson/generic/dependencies.h" + +#define SIMDJSON_AMALGAMATED + #if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64) #include "simdjson/arm64/implementation.h" #elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback) @@ -19,6 +23,8 @@ #error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION #endif +#undef SIMDJSON_AMALGAMATED + namespace simdjson { /** * Function which returns a pointer to an implementation matching the "builtin" implementation. diff --git a/include/simdjson/fallback/implementation.h b/include/simdjson/fallback/implementation.h index bb69110e9..b05e76936 100644 --- a/include/simdjson/fallback/implementation.h +++ b/include/simdjson/fallback/implementation.h @@ -1,7 +1,9 @@ #ifndef SIMDJSON_FALLBACK_IMPLEMENTATION_H #define SIMDJSON_FALLBACK_IMPLEMENTATION_H +#ifndef SIMDJSON_AMALGAMATED #include "simdjson/implementation.h" +#endif // SIMDJSON_AMALGAMATED namespace simdjson { namespace fallback { diff --git a/include/simdjson/generic/dependencies.h b/include/simdjson/generic/dependencies.h index c4284af7c..68b40c286 100644 --- a/include/simdjson/generic/dependencies.h +++ b/include/simdjson/generic/dependencies.h @@ -8,11 +8,12 @@ // Internal headers needed for generics. // All includes referencing simdjson headers *not* under simdjson/generic must be here! // Otherwise, amalgamation will fail. -#include "simdjson/dom/document.h" +#include "simdjson/base.h" +#include "simdjson/implementation.h" +#include "simdjson/internal/instruction_set.h" #include "simdjson/internal/dom_parser_implementation.h" #include "simdjson/internal/jsoncharutils_tables.h" #include "simdjson/internal/numberparsing_tables.h" #include "simdjson/internal/simdprune_tables.h" -#include "simdjson/padded_string_view.h" #endif // SIMDJSON_GENERIC_DEPENDENCIES_H \ No newline at end of file diff --git a/include/simdjson/generic/ondemand/dependencies.h b/include/simdjson/generic/ondemand/dependencies.h index 9e38e6dba..2fb0787dc 100644 --- a/include/simdjson/generic/ondemand/dependencies.h +++ b/include/simdjson/generic/ondemand/dependencies.h @@ -8,10 +8,10 @@ // Internal headers needed for ondemand generics. // All includes not under simdjson/generic/ondemand must be here! // Otherwise, amalgamation will fail. +#include "simdjson/dom/base.h" // for MINIMAL_DOCUMENT_CAPACITY +#include "simdjson/implementation.h" #include "simdjson/padded_string.h" #include "simdjson/padded_string_view.h" -#include "simdjson/dom/base.h" // for MINIMAL_DOCUMENT_CAPACITY -#include "simdjson/internal/jsoncharutils_tables.h" -#include "simdjson/internal/numberparsing_tables.h" +#include "simdjson/internal/dom_parser_implementation.h" #endif // SIMDJSON_GENERIC_ONDEMAND_DEPENDENCIES_H \ No newline at end of file diff --git a/include/simdjson/haswell/implementation.h b/include/simdjson/haswell/implementation.h index 28bffefe2..e51dd19d0 100644 --- a/include/simdjson/haswell/implementation.h +++ b/include/simdjson/haswell/implementation.h @@ -1,8 +1,10 @@ #ifndef SIMDJSON_HASWELL_IMPLEMENTATION_H #define SIMDJSON_HASWELL_IMPLEMENTATION_H +#ifndef SIMDJSON_AMALGAMATED #include "simdjson/implementation.h" #include "simdjson/internal/instruction_set.h" +#endif // SIMDJSON_AMALGAMATED // The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_HASWELL namespace simdjson { diff --git a/include/simdjson/icelake/implementation.h b/include/simdjson/icelake/implementation.h index 67261c9ed..570d057bf 100644 --- a/include/simdjson/icelake/implementation.h +++ b/include/simdjson/icelake/implementation.h @@ -1,8 +1,10 @@ #ifndef SIMDJSON_ICELAKE_IMPLEMENTATION_H #define SIMDJSON_ICELAKE_IMPLEMENTATION_H +#ifndef SIMDJSON_AMALGAMATED #include "simdjson/implementation.h" #include "simdjson/internal/instruction_set.h" +#endif // SIMDJSON_AMALGAMATED // The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_ICELAKE namespace simdjson { diff --git a/include/simdjson/ppc64/implementation.h b/include/simdjson/ppc64/implementation.h index f273d6086..9c9ed5b63 100644 --- a/include/simdjson/ppc64/implementation.h +++ b/include/simdjson/ppc64/implementation.h @@ -1,8 +1,10 @@ #ifndef SIMDJSON_PPC64_IMPLEMENTATION_H #define SIMDJSON_PPC64_IMPLEMENTATION_H +#ifndef SIMDJSON_AMALGAMATED #include "simdjson/implementation.h" #include "simdjson/internal/instruction_set.h" +#endif // SIMDJSON_AMALGAMATED namespace simdjson { diff --git a/include/simdjson/westmere/implementation.h b/include/simdjson/westmere/implementation.h index dc7a0ac93..fb76e4231 100644 --- a/include/simdjson/westmere/implementation.h +++ b/include/simdjson/westmere/implementation.h @@ -1,9 +1,10 @@ #ifndef SIMDJSON_WESTMERE_IMPLEMENTATION_H #define SIMDJSON_WESTMERE_IMPLEMENTATION_H -#include "simdjson/base.h" +#ifndef SIMDJSON_AMALGAMATED #include "simdjson/implementation.h" #include "simdjson/internal/instruction_set.h" +#endif // SIMDJSON_AMALGAMATED // The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_WESTMERE namespace simdjson { diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py index cb68f8ef7..7c4846315 100755 --- a/singleheader/amalgamate.py +++ b/singleheader/amalgamate.py @@ -10,7 +10,7 @@ import os import re import shutil import datetime -from typing import Dict, Iterable, List, Optional, TextIO +from typing import Dict, Iterable, List, Optional, Set, TextIO if sys.version_info < (3, 0): sys.stdout.write("Sorry, requires Python 3.x or better\n") @@ -43,13 +43,35 @@ IMPLEMENTATION_DETECTION_H = "include/simdjson/implementation_detection.h" def any_match(patterns: Iterable[str], string: str): return any([re.match(pattern, string) for pattern in patterns]) +class DirectoryDependencies: + def __init__(self, dependencies_file: str, amalgamated_dependencies: List[str]): + self.dependencies_file = dependencies_file + # Dependencies from {directory}/dependencies.h + self.amalgamated_dependencies = amalgamated_dependencies + # filename -> editor-only dependencies + self.extra_dependencies = set(amalgamated_dependencies) + + def add_editor_only_dependency(self, file: str, included_file: str): + dir = os.path.dirname(file) + # Exclude the base.h hack to include begin.h and implementation_selection.h + if file.endswith('/base.h') and (included_file.endswith('/begin.h') or included_file == IMPLEMENTATION_DETECTION_H): + return + # Includes of generic files don't need to be in dependencies (they need to be in amalgamated.h, really, though we're not checking that): + if included_file.startswith('include/simdjson/generic/') or included_file.startswith('src/generic/'): + return + assert included_file in self.amalgamated_dependencies, f"{included_file} is included in {file} but not in {self.dependencies_file} (which has {self.amalgamated_dependencies})!" + if included_file in self.extra_dependencies: + self.extra_dependencies.remove(included_file) + class Amalgamator: @classmethod def amalgamate(cls, output_path: str, file: str, roots: List[str], timestamp: str): print(f"Creating {output_path}") fid = open(output_path, 'w') print(f"/* auto-generated on {timestamp}. Do not edit! */", file=fid) - cls(fid, roots).maybe_write_file(file, "", "") + amalgamator = cls(fid, roots) + amalgamator.maybe_write_file(file, "", "") + amalgamator.validate_dependencies() fid.close() def __init__(self, fid: TextIO, roots: List[str]): @@ -60,8 +82,9 @@ class Amalgamator: self.found_includes: List[str] = [] self.found_generic_includes: List[tuple[str, str]] = [] self.amalgamated_defined = False - self.ignoring: Optional[str] = None + self.editor_only_region = False self.include_stack: List[str] = [] + self.dependencies: Dict[str, DirectoryDependencies] = {} def is_generic(self, file: str): return ( @@ -81,7 +104,7 @@ class Amalgamator: def maybe_write_file(self, file: str, including_file: str, else_line: str): # These files get written out every time they are included, and must be included during SIMDJSON_AMALGAMATED - if re.search(r'(/|^)(arm64|fallback|haswell|icelake|ppc64|westmere)(\.\w+|)?(/|$)', file) and not file.endswith('/implementation.h'): + if re.search(r'(/|^)(arm64|fallback|haswell|icelake|ppc64|westmere)(\.\w+|)?(/|$)', file): assert self.amalgamated_defined, f"{file} included from {including_file} without defining SIMDJSON_AMALGAMATED!" elif self.is_generic(file): # Generic files may only be included from their actual implementations. @@ -130,6 +153,9 @@ class Amalgamator: assert file not in self.include_stack, f"Cyclic include: {self.include_stack} -> {file}" self.include_stack.append(file) + dir = os.path.dirname(file) + dependencies: List[str] = [] + self.write(f"/* begin file {self.file_to_str(file)} */") if file == BUILTIN_BEGIN_H: @@ -138,7 +164,7 @@ class Amalgamator: self.builtin_implementation = True self.implementation = "SIMDJSON_BUILTIN_IMPLEMENTATION" - assert self.ignoring is None + assert not self.editor_only_region with open(os.path.join(PROJECTPATH, file), 'r') as fid2: for line in fid2: line = line.rstrip('\n') @@ -146,25 +172,40 @@ class Amalgamator: # Ignore lines inside #ifndef SIMDJSON_AMALGAMATED if re.search(r'^#ifndef\s+SIMDJSON_AMALGAMATED\s*$', line): assert self.amalgamated_defined, f"{file} uses #ifndef SIMDJSON_AMALGAMATED without a prior #define SIMDJSON_AMALGAMATED: {self.include_stack}" - assert not self.ignoring, f"{file} uses #ifndef SIMDJSON_AMALGAMATED twice in a row" - self.ignoring = "editor-only" + assert not self.editor_only_region, f"{file} uses #ifndef SIMDJSON_AMALGAMATED twice in a row" + self.editor_only_region = True # Handle ignored lines (and ending ignore blocks) end_ignore = re.search(r'^#endif\s*//\s*SIMDJSON_AMALGAMATED\s*$', line) - if self.ignoring: - self.write(f"/* amalgamation skipped ({self.ignoring}): {line} */") + if self.editor_only_region: + self.write(f"/* amalgamation skipped (editor-only): {line} */") + + # Includes in here are "local includes" which must be added to dependencies.h but not processed. + included = re.search(r'^#include "([^"]*)"', line) + if included: + included_file = self.project_relative_file(included.group(1)) + if file.startswith('include/simdjson/generic/') or file.startswith('src/generic/'): + generic_dir = dir + elif dir == 'src' or dir == 'include': + generic_dir = f"{dir}/generic" + else: + generic_dir = f"{os.path.dirname(dir)}/generic" + assert generic_dir in self.dependencies, f"{file} included before {generic_dir}/dependencies.h: {self.include_stack}!" + # Track all local dependencies so we can check at the end + self.dependencies[generic_dir].add_editor_only_dependency(file, included_file) + if end_ignore: - self.ignoring = None + self.editor_only_region = False continue assert not end_ignore, f"{file} has #endif // SIMDJSON_AMALGAMATED without #ifndef SIMDJSON_AMALGAMATED" # Handle #include lines - included = re.search(r'^#include "(.*)"', line) + included = re.search(r'^#include "([^"]*)"', line) if included: - includedfile = included.group(1) - includedfile = self.project_relative_file(includedfile) + included_file = self.project_relative_file(included.group(1)) + dependencies.append(included_file) # we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine) - self.maybe_write_file(includedfile, file, line) + self.maybe_write_file(included_file, file, line) continue # Handle defining and replacing SIMDJSON_IMPLEMENTATION @@ -198,7 +239,7 @@ class Amalgamator: self.write(line) - assert self.ignoring is None, f"{file} ended without #endif // SIMDJSON_AMALGAMATED" + assert not self.editor_only_region, f"{file} ended without #endif // SIMDJSON_AMALGAMATED" self.write(f"/* end file {self.file_to_str(file)} */") @@ -213,6 +254,13 @@ class Amalgamator: self.include_stack.pop() + if file.endswith('/dependencies.h'): + self.dependencies[dir] = DirectoryDependencies(file, dependencies) + + def validate_dependencies(self): + for dependencies in self.dependencies.values(): + assert len(dependencies.extra_dependencies) == 0, f"{dependencies.dependencies_file} includes unnecessary files not included in {os.path.dirname(dependencies.dependencies_file)}/*.h: {dependencies.extra_dependencies}" + # Get the generation date from git, so the output is reproducible. # The %ci specifier gives the unambiguous ISO 8601 format, and # does not change with locale and timezone at time of generation. diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index 960d4fa22..58303479e 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2023-07-17 10:02:55 -0700. Do not edit! */ +/* auto-generated on 2023-07-17 13:07:20 -0700. Do not edit! */ /* including src/simdjson.cpp: */ /* begin file src/simdjson.cpp */ #define SIMDJSON_SRC_SIMDJSON_CPP @@ -375,7 +375,8 @@ double from_chars(const char *first, const char* end) noexcept; SIMDJSON_DISABLE_GCC_WARNING(-Wshadow) \ SIMDJSON_DISABLE_GCC_WARNING(-Wunused-parameter) \ SIMDJSON_DISABLE_GCC_WARNING(-Wunused-variable) \ - SIMDJSON_DISABLE_GCC_WARNING(-Wmaybe-uninitialized) + SIMDJSON_DISABLE_GCC_WARNING(-Wmaybe-uninitialized) \ + SIMDJSON_DISABLE_GCC_WARNING(-Wformat-security) #endif // __clang__ #define SIMDJSON_PRAGMA(P) _Pragma(#P) @@ -4166,6 +4167,7 @@ inline const std::string error_message(int error) noexcept; #endif // SIMDJSON_ERROR_H /* end file include/simdjson/error.h */ +/* skipped duplicate #include "simdjson/portability.h" */ /** * @brief The top level simdjson namespace, containing everything the library provides. @@ -5726,6 +5728,10 @@ class key_value_pair; class object; class parser; +#ifdef SIMDJSON_THREADS_ENABLED +struct stage1_worker; +#endif // SIMDJSON_THREADS_ENABLED + } // namespace dom namespace internal { @@ -9590,13 +9596,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_ARM64_STRINGPARSING_DEFS_H /* end file include/simdjson/arm64/stringparsing_defs.h */ /* end file include/simdjson/arm64/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for arm64: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for arm64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for arm64: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for arm64 */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -9645,7 +9651,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for arm64 */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for arm64: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for arm64 */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -9752,7 +9758,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for arm64 */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for arm64: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for arm64 */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -9830,7 +9836,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for arm64 */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for arm64: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for arm64 */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -9922,7 +9928,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for arm64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for arm64: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for arm64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -10059,7 +10065,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for arm64 */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for arm64: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for arm64 */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -11330,7 +11336,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for arm64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for arm64: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -13741,13 +13747,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_ARM64_STRINGPARSING_DEFS_H /* end file include/simdjson/arm64/stringparsing_defs.h */ /* end file include/simdjson/arm64/begin.h */ -/* including src/generic/amalgamated.h: #include "generic/amalgamated.h" */ +/* including src/generic/amalgamated.h for arm64: #include "generic/amalgamated.h" */ /* begin file src/generic/amalgamated.h for arm64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_SRC_GENERIC_DEPENDENCIES_H) #error generic/dependencies.h must be included before generic/amalgamated.h! #endif -/* including src/generic/base.h: #include "generic/base.h" */ +/* including src/generic/base.h for arm64: #include "generic/base.h" */ /* begin file src/generic/base.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_BASE_H @@ -13768,7 +13774,7 @@ struct json_character_block; #endif // SIMDJSON_SRC_GENERIC_BASE_H /* end file src/generic/base.h for arm64 */ -/* including src/generic/dom_parser_implementation.h: #include "generic/dom_parser_implementation.h" */ +/* including src/generic/dom_parser_implementation.h for arm64: #include "generic/dom_parser_implementation.h" */ /* begin file src/generic/dom_parser_implementation.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -13792,7 +13798,7 @@ simdjson_inline bool is_ascii(const simd8x64& input); #endif // SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file src/generic/dom_parser_implementation.h for arm64 */ -/* including src/generic/json_character_block.h: #include "generic/json_character_block.h" */ +/* including src/generic/json_character_block.h for arm64: #include "generic/json_character_block.h" */ /* begin file src/generic/json_character_block.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H @@ -13823,10 +13829,10 @@ struct json_character_block { #endif // SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H /* end file src/generic/json_character_block.h for arm64 */ /* end file src/generic/amalgamated.h for arm64 */ -/* including src/generic/stage1/amalgamated.h: #include "generic/stage1/amalgamated.h" */ +/* including src/generic/stage1/amalgamated.h for arm64: #include "generic/stage1/amalgamated.h" */ /* begin file src/generic/stage1/amalgamated.h for arm64 */ // Stuff other things depend on -/* including src/generic/stage1/base.h: #include "generic/stage1/base.h" */ +/* including src/generic/stage1/base.h for arm64: #include "generic/stage1/base.h" */ /* begin file src/generic/stage1/base.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BASE_H @@ -13864,7 +13870,7 @@ using utf8_validation::utf8_checker; #endif // SIMDJSON_SRC_GENERIC_STAGE1_BASE_H /* end file src/generic/stage1/base.h for arm64 */ -/* including src/generic/stage1/json_string_scanner.h: #include "generic/stage1/json_string_scanner.h" */ +/* including src/generic/stage1/json_string_scanner.h for arm64: #include "generic/stage1/json_string_scanner.h" */ /* begin file src/generic/stage1/json_string_scanner.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H @@ -14029,7 +14035,7 @@ simdjson_inline error_code json_string_scanner::finish() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H /* end file src/generic/stage1/json_string_scanner.h for arm64 */ -/* including src/generic/stage1/utf8_lookup4_algorithm.h: #include "generic/stage1/utf8_lookup4_algorithm.h" */ +/* including src/generic/stage1/utf8_lookup4_algorithm.h for arm64: #include "generic/stage1/utf8_lookup4_algorithm.h" */ /* begin file src/generic/stage1/utf8_lookup4_algorithm.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H @@ -14249,7 +14255,7 @@ using namespace simd; #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H /* end file src/generic/stage1/utf8_lookup4_algorithm.h for arm64 */ -/* including src/generic/stage1/json_scanner.h: #include "generic/stage1/json_scanner.h" */ +/* including src/generic/stage1/json_scanner.h for arm64: #include "generic/stage1/json_scanner.h" */ /* begin file src/generic/stage1/json_scanner.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_SCANNER_H @@ -14422,7 +14428,7 @@ simdjson_inline error_code json_scanner::finish() { /* end file src/generic/stage1/json_scanner.h for arm64 */ // All other declarations -/* including src/generic/stage1/buf_block_reader.h: #include "generic/stage1/buf_block_reader.h" */ +/* including src/generic/stage1/buf_block_reader.h for arm64: #include "generic/stage1/buf_block_reader.h" */ /* begin file src/generic/stage1/buf_block_reader.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H @@ -14528,7 +14534,7 @@ simdjson_inline void buf_block_reader::advance() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H /* end file src/generic/stage1/buf_block_reader.h for arm64 */ -/* including src/generic/stage1/find_next_document_index.h: #include "generic/stage1/find_next_document_index.h" */ +/* including src/generic/stage1/find_next_document_index.h for arm64: #include "generic/stage1/find_next_document_index.h" */ /* begin file src/generic/stage1/find_next_document_index.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H @@ -14636,7 +14642,7 @@ simdjson_inline uint32_t find_next_document_index(dom_parser_implementation &par #endif // SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H /* end file src/generic/stage1/find_next_document_index.h for arm64 */ -/* including src/generic/stage1/json_minifier.h: #include "generic/stage1/json_minifier.h" */ +/* including src/generic/stage1/json_minifier.h for arm64: #include "generic/stage1/json_minifier.h" */ /* begin file src/generic/stage1/json_minifier.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H @@ -14743,7 +14749,7 @@ error_code json_minifier::minify(const uint8_t *buf, size_t len, uint8_t *dst, s #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H /* end file src/generic/stage1/json_minifier.h for arm64 */ -/* including src/generic/stage1/json_structural_indexer.h: #include "generic/stage1/json_structural_indexer.h" */ +/* including src/generic/stage1/json_structural_indexer.h for arm64: #include "generic/stage1/json_structural_indexer.h" */ /* begin file src/generic/stage1/json_structural_indexer.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H @@ -15114,7 +15120,7 @@ simdjson_inline error_code json_structural_indexer::finish(dom_parser_implementa #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H /* end file src/generic/stage1/json_structural_indexer.h for arm64 */ -/* including src/generic/stage1/utf8_validator.h: #include "generic/stage1/utf8_validator.h" */ +/* including src/generic/stage1/utf8_validator.h for arm64: #include "generic/stage1/utf8_validator.h" */ /* begin file src/generic/stage1/utf8_validator.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H @@ -15163,10 +15169,10 @@ bool generic_validate_utf8(const char * input, size_t length) { #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H /* end file src/generic/stage1/utf8_validator.h for arm64 */ /* end file src/generic/stage1/amalgamated.h for arm64 */ -/* including src/generic/stage2/amalgamated.h: #include "generic/stage2/amalgamated.h" */ +/* including src/generic/stage2/amalgamated.h for arm64: #include "generic/stage2/amalgamated.h" */ /* begin file src/generic/stage2/amalgamated.h for arm64 */ // Stuff other things depend on -/* including src/generic/stage2/base.h: #include "generic/stage2/base.h" */ +/* including src/generic/stage2/base.h for arm64: #include "generic/stage2/base.h" */ /* begin file src/generic/stage2/base.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_BASE_H @@ -15192,7 +15198,7 @@ struct tape_writer; #endif // SIMDJSON_SRC_GENERIC_STAGE2_BASE_H /* end file src/generic/stage2/base.h for arm64 */ -/* including src/generic/stage2/tape_writer.h: #include "generic/stage2/tape_writer.h" */ +/* including src/generic/stage2/tape_writer.h for arm64: #include "generic/stage2/tape_writer.h" */ /* begin file src/generic/stage2/tape_writer.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H @@ -15309,7 +15315,7 @@ simdjson_inline void tape_writer::write(uint64_t &tape_loc, uint64_t val, intern #endif // SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H /* end file src/generic/stage2/tape_writer.h for arm64 */ -/* including src/generic/stage2/logger.h: #include "generic/stage2/logger.h" */ +/* including src/generic/stage2/logger.h for arm64: #include "generic/stage2/logger.h" */ /* begin file src/generic/stage2/logger.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H @@ -15411,7 +15417,7 @@ namespace logger { /* end file src/generic/stage2/logger.h for arm64 */ // All other declarations -/* including src/generic/stage2/json_iterator.h: #include "generic/stage2/json_iterator.h" */ +/* including src/generic/stage2/json_iterator.h for arm64: #include "generic/stage2/json_iterator.h" */ /* begin file src/generic/stage2/json_iterator.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H @@ -15740,7 +15746,7 @@ simdjson_warn_unused simdjson_inline error_code json_iterator::visit_primitive(V #endif // SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H /* end file src/generic/stage2/json_iterator.h for arm64 */ -/* including src/generic/stage2/stringparsing.h: #include "generic/stage2/stringparsing.h" */ +/* including src/generic/stage2/stringparsing.h for arm64: #include "generic/stage2/stringparsing.h" */ /* begin file src/generic/stage2/stringparsing.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H @@ -15991,7 +15997,7 @@ simdjson_warn_unused simdjson_inline uint8_t *parse_wobbly_string(const uint8_t #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H /* end file src/generic/stage2/stringparsing.h for arm64 */ -/* including src/generic/stage2/structural_iterator.h: #include "generic/stage2/structural_iterator.h" */ +/* including src/generic/stage2/structural_iterator.h for arm64: #include "generic/stage2/structural_iterator.h" */ /* begin file src/generic/stage2/structural_iterator.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H @@ -16058,7 +16064,7 @@ public: #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H /* end file src/generic/stage2/structural_iterator.h for arm64 */ -/* including src/generic/stage2/tape_builder.h: #include "generic/stage2/tape_builder.h" */ +/* including src/generic/stage2/tape_builder.h for arm64: #include "generic/stage2/tape_builder.h" */ /* begin file src/generic/stage2/tape_builder.h for arm64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_BUILDER_H @@ -16835,13 +16841,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file include/simdjson/fallback/numberparsing_defs.h */ /* end file include/simdjson/fallback/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for fallback: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for fallback */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for fallback: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for fallback */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -16890,7 +16896,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for fallback */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for fallback: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for fallback */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -16997,7 +17003,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for fallback */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for fallback: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for fallback */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -17075,7 +17081,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for fallback */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for fallback: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for fallback */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -17167,7 +17173,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for fallback */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for fallback: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for fallback */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -17304,7 +17310,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for fallback */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for fallback: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for fallback */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -18575,7 +18581,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for fallback */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for fallback: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -18964,7 +18970,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file include/simdjson/fallback/numberparsing_defs.h */ /* end file include/simdjson/fallback/begin.h */ -/* including src/generic/stage1/find_next_document_index.h: #include "generic/stage1/find_next_document_index.h" */ +/* including src/generic/stage1/find_next_document_index.h for fallback: #include "generic/stage1/find_next_document_index.h" */ /* begin file src/generic/stage1/find_next_document_index.h for fallback */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H @@ -19072,7 +19078,7 @@ simdjson_inline uint32_t find_next_document_index(dom_parser_implementation &par #endif // SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H /* end file src/generic/stage1/find_next_document_index.h for fallback */ -/* including src/generic/stage2/stringparsing.h: #include "generic/stage2/stringparsing.h" */ +/* including src/generic/stage2/stringparsing.h for fallback: #include "generic/stage2/stringparsing.h" */ /* begin file src/generic/stage2/stringparsing.h for fallback */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H @@ -19323,7 +19329,7 @@ simdjson_warn_unused simdjson_inline uint8_t *parse_wobbly_string(const uint8_t #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H /* end file src/generic/stage2/stringparsing.h for fallback */ -/* including src/generic/stage2/logger.h: #include "generic/stage2/logger.h" */ +/* including src/generic/stage2/logger.h for fallback: #include "generic/stage2/logger.h" */ /* begin file src/generic/stage2/logger.h for fallback */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H @@ -19423,7 +19429,7 @@ namespace logger { #endif // SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H /* end file src/generic/stage2/logger.h for fallback */ -/* including src/generic/stage2/json_iterator.h: #include "generic/stage2/json_iterator.h" */ +/* including src/generic/stage2/json_iterator.h for fallback: #include "generic/stage2/json_iterator.h" */ /* begin file src/generic/stage2/json_iterator.h for fallback */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H @@ -19752,7 +19758,7 @@ simdjson_warn_unused simdjson_inline error_code json_iterator::visit_primitive(V #endif // SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H /* end file src/generic/stage2/json_iterator.h for fallback */ -/* including src/generic/stage2/tape_writer.h: #include "generic/stage2/tape_writer.h" */ +/* including src/generic/stage2/tape_writer.h for fallback: #include "generic/stage2/tape_writer.h" */ /* begin file src/generic/stage2/tape_writer.h for fallback */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H @@ -19869,7 +19875,7 @@ simdjson_inline void tape_writer::write(uint64_t &tape_loc, uint64_t val, intern #endif // SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H /* end file src/generic/stage2/tape_writer.h for fallback */ -/* including src/generic/stage2/tape_builder.h: #include "generic/stage2/tape_builder.h" */ +/* including src/generic/stage2/tape_builder.h for fallback: #include "generic/stage2/tape_builder.h" */ /* begin file src/generic/stage2/tape_builder.h for fallback */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_BUILDER_H @@ -22803,13 +22809,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_HASWELL_STRINGPARSING_DEFS_H /* end file include/simdjson/haswell/stringparsing_defs.h */ /* end file include/simdjson/haswell/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for haswell: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for haswell */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for haswell: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for haswell */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -22858,7 +22864,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for haswell */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for haswell: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for haswell */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -22965,7 +22971,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for haswell */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for haswell: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for haswell */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -23043,7 +23049,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for haswell */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for haswell: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for haswell */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -23135,7 +23141,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for haswell */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for haswell: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for haswell */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -23272,7 +23278,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for haswell */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for haswell: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for haswell */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -24543,7 +24549,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for haswell */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for haswell: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -26909,13 +26915,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_HASWELL_STRINGPARSING_DEFS_H /* end file include/simdjson/haswell/stringparsing_defs.h */ /* end file include/simdjson/haswell/begin.h */ -/* including src/generic/amalgamated.h: #include "generic/amalgamated.h" */ +/* including src/generic/amalgamated.h for haswell: #include "generic/amalgamated.h" */ /* begin file src/generic/amalgamated.h for haswell */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_SRC_GENERIC_DEPENDENCIES_H) #error generic/dependencies.h must be included before generic/amalgamated.h! #endif -/* including src/generic/base.h: #include "generic/base.h" */ +/* including src/generic/base.h for haswell: #include "generic/base.h" */ /* begin file src/generic/base.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_BASE_H @@ -26936,7 +26942,7 @@ struct json_character_block; #endif // SIMDJSON_SRC_GENERIC_BASE_H /* end file src/generic/base.h for haswell */ -/* including src/generic/dom_parser_implementation.h: #include "generic/dom_parser_implementation.h" */ +/* including src/generic/dom_parser_implementation.h for haswell: #include "generic/dom_parser_implementation.h" */ /* begin file src/generic/dom_parser_implementation.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -26960,7 +26966,7 @@ simdjson_inline bool is_ascii(const simd8x64& input); #endif // SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file src/generic/dom_parser_implementation.h for haswell */ -/* including src/generic/json_character_block.h: #include "generic/json_character_block.h" */ +/* including src/generic/json_character_block.h for haswell: #include "generic/json_character_block.h" */ /* begin file src/generic/json_character_block.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H @@ -26991,10 +26997,10 @@ struct json_character_block { #endif // SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H /* end file src/generic/json_character_block.h for haswell */ /* end file src/generic/amalgamated.h for haswell */ -/* including src/generic/stage1/amalgamated.h: #include "generic/stage1/amalgamated.h" */ +/* including src/generic/stage1/amalgamated.h for haswell: #include "generic/stage1/amalgamated.h" */ /* begin file src/generic/stage1/amalgamated.h for haswell */ // Stuff other things depend on -/* including src/generic/stage1/base.h: #include "generic/stage1/base.h" */ +/* including src/generic/stage1/base.h for haswell: #include "generic/stage1/base.h" */ /* begin file src/generic/stage1/base.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BASE_H @@ -27032,7 +27038,7 @@ using utf8_validation::utf8_checker; #endif // SIMDJSON_SRC_GENERIC_STAGE1_BASE_H /* end file src/generic/stage1/base.h for haswell */ -/* including src/generic/stage1/json_string_scanner.h: #include "generic/stage1/json_string_scanner.h" */ +/* including src/generic/stage1/json_string_scanner.h for haswell: #include "generic/stage1/json_string_scanner.h" */ /* begin file src/generic/stage1/json_string_scanner.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H @@ -27197,7 +27203,7 @@ simdjson_inline error_code json_string_scanner::finish() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H /* end file src/generic/stage1/json_string_scanner.h for haswell */ -/* including src/generic/stage1/utf8_lookup4_algorithm.h: #include "generic/stage1/utf8_lookup4_algorithm.h" */ +/* including src/generic/stage1/utf8_lookup4_algorithm.h for haswell: #include "generic/stage1/utf8_lookup4_algorithm.h" */ /* begin file src/generic/stage1/utf8_lookup4_algorithm.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H @@ -27417,7 +27423,7 @@ using namespace simd; #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H /* end file src/generic/stage1/utf8_lookup4_algorithm.h for haswell */ -/* including src/generic/stage1/json_scanner.h: #include "generic/stage1/json_scanner.h" */ +/* including src/generic/stage1/json_scanner.h for haswell: #include "generic/stage1/json_scanner.h" */ /* begin file src/generic/stage1/json_scanner.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_SCANNER_H @@ -27590,7 +27596,7 @@ simdjson_inline error_code json_scanner::finish() { /* end file src/generic/stage1/json_scanner.h for haswell */ // All other declarations -/* including src/generic/stage1/buf_block_reader.h: #include "generic/stage1/buf_block_reader.h" */ +/* including src/generic/stage1/buf_block_reader.h for haswell: #include "generic/stage1/buf_block_reader.h" */ /* begin file src/generic/stage1/buf_block_reader.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H @@ -27696,7 +27702,7 @@ simdjson_inline void buf_block_reader::advance() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H /* end file src/generic/stage1/buf_block_reader.h for haswell */ -/* including src/generic/stage1/find_next_document_index.h: #include "generic/stage1/find_next_document_index.h" */ +/* including src/generic/stage1/find_next_document_index.h for haswell: #include "generic/stage1/find_next_document_index.h" */ /* begin file src/generic/stage1/find_next_document_index.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H @@ -27804,7 +27810,7 @@ simdjson_inline uint32_t find_next_document_index(dom_parser_implementation &par #endif // SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H /* end file src/generic/stage1/find_next_document_index.h for haswell */ -/* including src/generic/stage1/json_minifier.h: #include "generic/stage1/json_minifier.h" */ +/* including src/generic/stage1/json_minifier.h for haswell: #include "generic/stage1/json_minifier.h" */ /* begin file src/generic/stage1/json_minifier.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H @@ -27911,7 +27917,7 @@ error_code json_minifier::minify(const uint8_t *buf, size_t len, uint8_t *dst, s #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H /* end file src/generic/stage1/json_minifier.h for haswell */ -/* including src/generic/stage1/json_structural_indexer.h: #include "generic/stage1/json_structural_indexer.h" */ +/* including src/generic/stage1/json_structural_indexer.h for haswell: #include "generic/stage1/json_structural_indexer.h" */ /* begin file src/generic/stage1/json_structural_indexer.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H @@ -28282,7 +28288,7 @@ simdjson_inline error_code json_structural_indexer::finish(dom_parser_implementa #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H /* end file src/generic/stage1/json_structural_indexer.h for haswell */ -/* including src/generic/stage1/utf8_validator.h: #include "generic/stage1/utf8_validator.h" */ +/* including src/generic/stage1/utf8_validator.h for haswell: #include "generic/stage1/utf8_validator.h" */ /* begin file src/generic/stage1/utf8_validator.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H @@ -28331,10 +28337,10 @@ bool generic_validate_utf8(const char * input, size_t length) { #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H /* end file src/generic/stage1/utf8_validator.h for haswell */ /* end file src/generic/stage1/amalgamated.h for haswell */ -/* including src/generic/stage2/amalgamated.h: #include "generic/stage2/amalgamated.h" */ +/* including src/generic/stage2/amalgamated.h for haswell: #include "generic/stage2/amalgamated.h" */ /* begin file src/generic/stage2/amalgamated.h for haswell */ // Stuff other things depend on -/* including src/generic/stage2/base.h: #include "generic/stage2/base.h" */ +/* including src/generic/stage2/base.h for haswell: #include "generic/stage2/base.h" */ /* begin file src/generic/stage2/base.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_BASE_H @@ -28360,7 +28366,7 @@ struct tape_writer; #endif // SIMDJSON_SRC_GENERIC_STAGE2_BASE_H /* end file src/generic/stage2/base.h for haswell */ -/* including src/generic/stage2/tape_writer.h: #include "generic/stage2/tape_writer.h" */ +/* including src/generic/stage2/tape_writer.h for haswell: #include "generic/stage2/tape_writer.h" */ /* begin file src/generic/stage2/tape_writer.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H @@ -28477,7 +28483,7 @@ simdjson_inline void tape_writer::write(uint64_t &tape_loc, uint64_t val, intern #endif // SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H /* end file src/generic/stage2/tape_writer.h for haswell */ -/* including src/generic/stage2/logger.h: #include "generic/stage2/logger.h" */ +/* including src/generic/stage2/logger.h for haswell: #include "generic/stage2/logger.h" */ /* begin file src/generic/stage2/logger.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H @@ -28579,7 +28585,7 @@ namespace logger { /* end file src/generic/stage2/logger.h for haswell */ // All other declarations -/* including src/generic/stage2/json_iterator.h: #include "generic/stage2/json_iterator.h" */ +/* including src/generic/stage2/json_iterator.h for haswell: #include "generic/stage2/json_iterator.h" */ /* begin file src/generic/stage2/json_iterator.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H @@ -28908,7 +28914,7 @@ simdjson_warn_unused simdjson_inline error_code json_iterator::visit_primitive(V #endif // SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H /* end file src/generic/stage2/json_iterator.h for haswell */ -/* including src/generic/stage2/stringparsing.h: #include "generic/stage2/stringparsing.h" */ +/* including src/generic/stage2/stringparsing.h for haswell: #include "generic/stage2/stringparsing.h" */ /* begin file src/generic/stage2/stringparsing.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H @@ -29159,7 +29165,7 @@ simdjson_warn_unused simdjson_inline uint8_t *parse_wobbly_string(const uint8_t #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H /* end file src/generic/stage2/stringparsing.h for haswell */ -/* including src/generic/stage2/structural_iterator.h: #include "generic/stage2/structural_iterator.h" */ +/* including src/generic/stage2/structural_iterator.h for haswell: #include "generic/stage2/structural_iterator.h" */ /* begin file src/generic/stage2/structural_iterator.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H @@ -29226,7 +29232,7 @@ public: #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H /* end file src/generic/stage2/structural_iterator.h for haswell */ -/* including src/generic/stage2/tape_builder.h: #include "generic/stage2/tape_builder.h" */ +/* including src/generic/stage2/tape_builder.h for haswell: #include "generic/stage2/tape_builder.h" */ /* begin file src/generic/stage2/tape_builder.h for haswell */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_BUILDER_H @@ -31731,13 +31737,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t #endif // SIMDJSON_ICELAKE_NUMBERPARSING_DEFS_H /* end file include/simdjson/icelake/numberparsing_defs.h */ /* end file include/simdjson/icelake/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for icelake: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for icelake */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for icelake: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for icelake */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -31786,7 +31792,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for icelake */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for icelake: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for icelake */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -31893,7 +31899,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for icelake */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for icelake: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for icelake */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -31971,7 +31977,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for icelake */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for icelake: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for icelake */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -32063,7 +32069,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for icelake */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for icelake: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for icelake */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -32200,7 +32206,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for icelake */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for icelake: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for icelake */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -33471,7 +33477,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for icelake */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for icelake: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -35588,13 +35594,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t #endif // SIMDJSON_ICELAKE_NUMBERPARSING_DEFS_H /* end file include/simdjson/icelake/numberparsing_defs.h */ /* end file include/simdjson/icelake/begin.h */ -/* including src/generic/amalgamated.h: #include "generic/amalgamated.h" */ +/* including src/generic/amalgamated.h for icelake: #include "generic/amalgamated.h" */ /* begin file src/generic/amalgamated.h for icelake */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_SRC_GENERIC_DEPENDENCIES_H) #error generic/dependencies.h must be included before generic/amalgamated.h! #endif -/* including src/generic/base.h: #include "generic/base.h" */ +/* including src/generic/base.h for icelake: #include "generic/base.h" */ /* begin file src/generic/base.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_BASE_H @@ -35615,7 +35621,7 @@ struct json_character_block; #endif // SIMDJSON_SRC_GENERIC_BASE_H /* end file src/generic/base.h for icelake */ -/* including src/generic/dom_parser_implementation.h: #include "generic/dom_parser_implementation.h" */ +/* including src/generic/dom_parser_implementation.h for icelake: #include "generic/dom_parser_implementation.h" */ /* begin file src/generic/dom_parser_implementation.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -35639,7 +35645,7 @@ simdjson_inline bool is_ascii(const simd8x64& input); #endif // SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file src/generic/dom_parser_implementation.h for icelake */ -/* including src/generic/json_character_block.h: #include "generic/json_character_block.h" */ +/* including src/generic/json_character_block.h for icelake: #include "generic/json_character_block.h" */ /* begin file src/generic/json_character_block.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H @@ -35670,10 +35676,10 @@ struct json_character_block { #endif // SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H /* end file src/generic/json_character_block.h for icelake */ /* end file src/generic/amalgamated.h for icelake */ -/* including src/generic/stage1/amalgamated.h: #include "generic/stage1/amalgamated.h" */ +/* including src/generic/stage1/amalgamated.h for icelake: #include "generic/stage1/amalgamated.h" */ /* begin file src/generic/stage1/amalgamated.h for icelake */ // Stuff other things depend on -/* including src/generic/stage1/base.h: #include "generic/stage1/base.h" */ +/* including src/generic/stage1/base.h for icelake: #include "generic/stage1/base.h" */ /* begin file src/generic/stage1/base.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BASE_H @@ -35711,7 +35717,7 @@ using utf8_validation::utf8_checker; #endif // SIMDJSON_SRC_GENERIC_STAGE1_BASE_H /* end file src/generic/stage1/base.h for icelake */ -/* including src/generic/stage1/json_string_scanner.h: #include "generic/stage1/json_string_scanner.h" */ +/* including src/generic/stage1/json_string_scanner.h for icelake: #include "generic/stage1/json_string_scanner.h" */ /* begin file src/generic/stage1/json_string_scanner.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H @@ -35876,7 +35882,7 @@ simdjson_inline error_code json_string_scanner::finish() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H /* end file src/generic/stage1/json_string_scanner.h for icelake */ -/* including src/generic/stage1/utf8_lookup4_algorithm.h: #include "generic/stage1/utf8_lookup4_algorithm.h" */ +/* including src/generic/stage1/utf8_lookup4_algorithm.h for icelake: #include "generic/stage1/utf8_lookup4_algorithm.h" */ /* begin file src/generic/stage1/utf8_lookup4_algorithm.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H @@ -36096,7 +36102,7 @@ using namespace simd; #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H /* end file src/generic/stage1/utf8_lookup4_algorithm.h for icelake */ -/* including src/generic/stage1/json_scanner.h: #include "generic/stage1/json_scanner.h" */ +/* including src/generic/stage1/json_scanner.h for icelake: #include "generic/stage1/json_scanner.h" */ /* begin file src/generic/stage1/json_scanner.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_SCANNER_H @@ -36269,7 +36275,7 @@ simdjson_inline error_code json_scanner::finish() { /* end file src/generic/stage1/json_scanner.h for icelake */ // All other declarations -/* including src/generic/stage1/buf_block_reader.h: #include "generic/stage1/buf_block_reader.h" */ +/* including src/generic/stage1/buf_block_reader.h for icelake: #include "generic/stage1/buf_block_reader.h" */ /* begin file src/generic/stage1/buf_block_reader.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H @@ -36375,7 +36381,7 @@ simdjson_inline void buf_block_reader::advance() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H /* end file src/generic/stage1/buf_block_reader.h for icelake */ -/* including src/generic/stage1/find_next_document_index.h: #include "generic/stage1/find_next_document_index.h" */ +/* including src/generic/stage1/find_next_document_index.h for icelake: #include "generic/stage1/find_next_document_index.h" */ /* begin file src/generic/stage1/find_next_document_index.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H @@ -36483,7 +36489,7 @@ simdjson_inline uint32_t find_next_document_index(dom_parser_implementation &par #endif // SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H /* end file src/generic/stage1/find_next_document_index.h for icelake */ -/* including src/generic/stage1/json_minifier.h: #include "generic/stage1/json_minifier.h" */ +/* including src/generic/stage1/json_minifier.h for icelake: #include "generic/stage1/json_minifier.h" */ /* begin file src/generic/stage1/json_minifier.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H @@ -36590,7 +36596,7 @@ error_code json_minifier::minify(const uint8_t *buf, size_t len, uint8_t *dst, s #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H /* end file src/generic/stage1/json_minifier.h for icelake */ -/* including src/generic/stage1/json_structural_indexer.h: #include "generic/stage1/json_structural_indexer.h" */ +/* including src/generic/stage1/json_structural_indexer.h for icelake: #include "generic/stage1/json_structural_indexer.h" */ /* begin file src/generic/stage1/json_structural_indexer.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H @@ -36961,7 +36967,7 @@ simdjson_inline error_code json_structural_indexer::finish(dom_parser_implementa #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H /* end file src/generic/stage1/json_structural_indexer.h for icelake */ -/* including src/generic/stage1/utf8_validator.h: #include "generic/stage1/utf8_validator.h" */ +/* including src/generic/stage1/utf8_validator.h for icelake: #include "generic/stage1/utf8_validator.h" */ /* begin file src/generic/stage1/utf8_validator.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H @@ -37010,10 +37016,10 @@ bool generic_validate_utf8(const char * input, size_t length) { #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H /* end file src/generic/stage1/utf8_validator.h for icelake */ /* end file src/generic/stage1/amalgamated.h for icelake */ -/* including src/generic/stage2/amalgamated.h: #include "generic/stage2/amalgamated.h" */ +/* including src/generic/stage2/amalgamated.h for icelake: #include "generic/stage2/amalgamated.h" */ /* begin file src/generic/stage2/amalgamated.h for icelake */ // Stuff other things depend on -/* including src/generic/stage2/base.h: #include "generic/stage2/base.h" */ +/* including src/generic/stage2/base.h for icelake: #include "generic/stage2/base.h" */ /* begin file src/generic/stage2/base.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_BASE_H @@ -37039,7 +37045,7 @@ struct tape_writer; #endif // SIMDJSON_SRC_GENERIC_STAGE2_BASE_H /* end file src/generic/stage2/base.h for icelake */ -/* including src/generic/stage2/tape_writer.h: #include "generic/stage2/tape_writer.h" */ +/* including src/generic/stage2/tape_writer.h for icelake: #include "generic/stage2/tape_writer.h" */ /* begin file src/generic/stage2/tape_writer.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H @@ -37156,7 +37162,7 @@ simdjson_inline void tape_writer::write(uint64_t &tape_loc, uint64_t val, intern #endif // SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H /* end file src/generic/stage2/tape_writer.h for icelake */ -/* including src/generic/stage2/logger.h: #include "generic/stage2/logger.h" */ +/* including src/generic/stage2/logger.h for icelake: #include "generic/stage2/logger.h" */ /* begin file src/generic/stage2/logger.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H @@ -37258,7 +37264,7 @@ namespace logger { /* end file src/generic/stage2/logger.h for icelake */ // All other declarations -/* including src/generic/stage2/json_iterator.h: #include "generic/stage2/json_iterator.h" */ +/* including src/generic/stage2/json_iterator.h for icelake: #include "generic/stage2/json_iterator.h" */ /* begin file src/generic/stage2/json_iterator.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H @@ -37587,7 +37593,7 @@ simdjson_warn_unused simdjson_inline error_code json_iterator::visit_primitive(V #endif // SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H /* end file src/generic/stage2/json_iterator.h for icelake */ -/* including src/generic/stage2/stringparsing.h: #include "generic/stage2/stringparsing.h" */ +/* including src/generic/stage2/stringparsing.h for icelake: #include "generic/stage2/stringparsing.h" */ /* begin file src/generic/stage2/stringparsing.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H @@ -37838,7 +37844,7 @@ simdjson_warn_unused simdjson_inline uint8_t *parse_wobbly_string(const uint8_t #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H /* end file src/generic/stage2/stringparsing.h for icelake */ -/* including src/generic/stage2/structural_iterator.h: #include "generic/stage2/structural_iterator.h" */ +/* including src/generic/stage2/structural_iterator.h for icelake: #include "generic/stage2/structural_iterator.h" */ /* begin file src/generic/stage2/structural_iterator.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H @@ -37905,7 +37911,7 @@ public: #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H /* end file src/generic/stage2/structural_iterator.h for icelake */ -/* including src/generic/stage2/tape_builder.h: #include "generic/stage2/tape_builder.h" */ +/* including src/generic/stage2/tape_builder.h for icelake: #include "generic/stage2/tape_builder.h" */ /* begin file src/generic/stage2/tape_builder.h for icelake */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_BUILDER_H @@ -40353,13 +40359,13 @@ backslash_and_quote::copy_and_find(const uint8_t *src, uint8_t *dst) { #endif // SIMDJSON_PPC64_STRINGPARSING_DEFS_H /* end file include/simdjson/ppc64/stringparsing_defs.h */ /* end file include/simdjson/ppc64/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for ppc64: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for ppc64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for ppc64: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for ppc64 */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -40408,7 +40414,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for ppc64 */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for ppc64: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for ppc64 */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -40515,7 +40521,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for ppc64 */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for ppc64: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -40593,7 +40599,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for ppc64 */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for ppc64: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for ppc64 */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -40685,7 +40691,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for ppc64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for ppc64: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for ppc64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -40822,7 +40828,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for ppc64 */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for ppc64: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for ppc64 */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -42093,7 +42099,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for ppc64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for ppc64: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -44079,13 +44085,13 @@ backslash_and_quote::copy_and_find(const uint8_t *src, uint8_t *dst) { #endif // SIMDJSON_PPC64_STRINGPARSING_DEFS_H /* end file include/simdjson/ppc64/stringparsing_defs.h */ /* end file include/simdjson/ppc64/begin.h */ -/* including src/generic/amalgamated.h: #include "generic/amalgamated.h" */ +/* including src/generic/amalgamated.h for ppc64: #include "generic/amalgamated.h" */ /* begin file src/generic/amalgamated.h for ppc64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_SRC_GENERIC_DEPENDENCIES_H) #error generic/dependencies.h must be included before generic/amalgamated.h! #endif -/* including src/generic/base.h: #include "generic/base.h" */ +/* including src/generic/base.h for ppc64: #include "generic/base.h" */ /* begin file src/generic/base.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_BASE_H @@ -44106,7 +44112,7 @@ struct json_character_block; #endif // SIMDJSON_SRC_GENERIC_BASE_H /* end file src/generic/base.h for ppc64 */ -/* including src/generic/dom_parser_implementation.h: #include "generic/dom_parser_implementation.h" */ +/* including src/generic/dom_parser_implementation.h for ppc64: #include "generic/dom_parser_implementation.h" */ /* begin file src/generic/dom_parser_implementation.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -44130,7 +44136,7 @@ simdjson_inline bool is_ascii(const simd8x64& input); #endif // SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file src/generic/dom_parser_implementation.h for ppc64 */ -/* including src/generic/json_character_block.h: #include "generic/json_character_block.h" */ +/* including src/generic/json_character_block.h for ppc64: #include "generic/json_character_block.h" */ /* begin file src/generic/json_character_block.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H @@ -44161,10 +44167,10 @@ struct json_character_block { #endif // SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H /* end file src/generic/json_character_block.h for ppc64 */ /* end file src/generic/amalgamated.h for ppc64 */ -/* including src/generic/stage1/amalgamated.h: #include "generic/stage1/amalgamated.h" */ +/* including src/generic/stage1/amalgamated.h for ppc64: #include "generic/stage1/amalgamated.h" */ /* begin file src/generic/stage1/amalgamated.h for ppc64 */ // Stuff other things depend on -/* including src/generic/stage1/base.h: #include "generic/stage1/base.h" */ +/* including src/generic/stage1/base.h for ppc64: #include "generic/stage1/base.h" */ /* begin file src/generic/stage1/base.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BASE_H @@ -44202,7 +44208,7 @@ using utf8_validation::utf8_checker; #endif // SIMDJSON_SRC_GENERIC_STAGE1_BASE_H /* end file src/generic/stage1/base.h for ppc64 */ -/* including src/generic/stage1/json_string_scanner.h: #include "generic/stage1/json_string_scanner.h" */ +/* including src/generic/stage1/json_string_scanner.h for ppc64: #include "generic/stage1/json_string_scanner.h" */ /* begin file src/generic/stage1/json_string_scanner.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H @@ -44367,7 +44373,7 @@ simdjson_inline error_code json_string_scanner::finish() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H /* end file src/generic/stage1/json_string_scanner.h for ppc64 */ -/* including src/generic/stage1/utf8_lookup4_algorithm.h: #include "generic/stage1/utf8_lookup4_algorithm.h" */ +/* including src/generic/stage1/utf8_lookup4_algorithm.h for ppc64: #include "generic/stage1/utf8_lookup4_algorithm.h" */ /* begin file src/generic/stage1/utf8_lookup4_algorithm.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H @@ -44587,7 +44593,7 @@ using namespace simd; #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H /* end file src/generic/stage1/utf8_lookup4_algorithm.h for ppc64 */ -/* including src/generic/stage1/json_scanner.h: #include "generic/stage1/json_scanner.h" */ +/* including src/generic/stage1/json_scanner.h for ppc64: #include "generic/stage1/json_scanner.h" */ /* begin file src/generic/stage1/json_scanner.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_SCANNER_H @@ -44760,7 +44766,7 @@ simdjson_inline error_code json_scanner::finish() { /* end file src/generic/stage1/json_scanner.h for ppc64 */ // All other declarations -/* including src/generic/stage1/buf_block_reader.h: #include "generic/stage1/buf_block_reader.h" */ +/* including src/generic/stage1/buf_block_reader.h for ppc64: #include "generic/stage1/buf_block_reader.h" */ /* begin file src/generic/stage1/buf_block_reader.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H @@ -44866,7 +44872,7 @@ simdjson_inline void buf_block_reader::advance() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H /* end file src/generic/stage1/buf_block_reader.h for ppc64 */ -/* including src/generic/stage1/find_next_document_index.h: #include "generic/stage1/find_next_document_index.h" */ +/* including src/generic/stage1/find_next_document_index.h for ppc64: #include "generic/stage1/find_next_document_index.h" */ /* begin file src/generic/stage1/find_next_document_index.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H @@ -44974,7 +44980,7 @@ simdjson_inline uint32_t find_next_document_index(dom_parser_implementation &par #endif // SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H /* end file src/generic/stage1/find_next_document_index.h for ppc64 */ -/* including src/generic/stage1/json_minifier.h: #include "generic/stage1/json_minifier.h" */ +/* including src/generic/stage1/json_minifier.h for ppc64: #include "generic/stage1/json_minifier.h" */ /* begin file src/generic/stage1/json_minifier.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H @@ -45081,7 +45087,7 @@ error_code json_minifier::minify(const uint8_t *buf, size_t len, uint8_t *dst, s #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H /* end file src/generic/stage1/json_minifier.h for ppc64 */ -/* including src/generic/stage1/json_structural_indexer.h: #include "generic/stage1/json_structural_indexer.h" */ +/* including src/generic/stage1/json_structural_indexer.h for ppc64: #include "generic/stage1/json_structural_indexer.h" */ /* begin file src/generic/stage1/json_structural_indexer.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H @@ -45452,7 +45458,7 @@ simdjson_inline error_code json_structural_indexer::finish(dom_parser_implementa #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H /* end file src/generic/stage1/json_structural_indexer.h for ppc64 */ -/* including src/generic/stage1/utf8_validator.h: #include "generic/stage1/utf8_validator.h" */ +/* including src/generic/stage1/utf8_validator.h for ppc64: #include "generic/stage1/utf8_validator.h" */ /* begin file src/generic/stage1/utf8_validator.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H @@ -45501,10 +45507,10 @@ bool generic_validate_utf8(const char * input, size_t length) { #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H /* end file src/generic/stage1/utf8_validator.h for ppc64 */ /* end file src/generic/stage1/amalgamated.h for ppc64 */ -/* including src/generic/stage2/amalgamated.h: #include "generic/stage2/amalgamated.h" */ +/* including src/generic/stage2/amalgamated.h for ppc64: #include "generic/stage2/amalgamated.h" */ /* begin file src/generic/stage2/amalgamated.h for ppc64 */ // Stuff other things depend on -/* including src/generic/stage2/base.h: #include "generic/stage2/base.h" */ +/* including src/generic/stage2/base.h for ppc64: #include "generic/stage2/base.h" */ /* begin file src/generic/stage2/base.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_BASE_H @@ -45530,7 +45536,7 @@ struct tape_writer; #endif // SIMDJSON_SRC_GENERIC_STAGE2_BASE_H /* end file src/generic/stage2/base.h for ppc64 */ -/* including src/generic/stage2/tape_writer.h: #include "generic/stage2/tape_writer.h" */ +/* including src/generic/stage2/tape_writer.h for ppc64: #include "generic/stage2/tape_writer.h" */ /* begin file src/generic/stage2/tape_writer.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H @@ -45647,7 +45653,7 @@ simdjson_inline void tape_writer::write(uint64_t &tape_loc, uint64_t val, intern #endif // SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H /* end file src/generic/stage2/tape_writer.h for ppc64 */ -/* including src/generic/stage2/logger.h: #include "generic/stage2/logger.h" */ +/* including src/generic/stage2/logger.h for ppc64: #include "generic/stage2/logger.h" */ /* begin file src/generic/stage2/logger.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H @@ -45749,7 +45755,7 @@ namespace logger { /* end file src/generic/stage2/logger.h for ppc64 */ // All other declarations -/* including src/generic/stage2/json_iterator.h: #include "generic/stage2/json_iterator.h" */ +/* including src/generic/stage2/json_iterator.h for ppc64: #include "generic/stage2/json_iterator.h" */ /* begin file src/generic/stage2/json_iterator.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H @@ -46078,7 +46084,7 @@ simdjson_warn_unused simdjson_inline error_code json_iterator::visit_primitive(V #endif // SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H /* end file src/generic/stage2/json_iterator.h for ppc64 */ -/* including src/generic/stage2/stringparsing.h: #include "generic/stage2/stringparsing.h" */ +/* including src/generic/stage2/stringparsing.h for ppc64: #include "generic/stage2/stringparsing.h" */ /* begin file src/generic/stage2/stringparsing.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H @@ -46329,7 +46335,7 @@ simdjson_warn_unused simdjson_inline uint8_t *parse_wobbly_string(const uint8_t #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H /* end file src/generic/stage2/stringparsing.h for ppc64 */ -/* including src/generic/stage2/structural_iterator.h: #include "generic/stage2/structural_iterator.h" */ +/* including src/generic/stage2/structural_iterator.h for ppc64: #include "generic/stage2/structural_iterator.h" */ /* begin file src/generic/stage2/structural_iterator.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H @@ -46396,7 +46402,7 @@ public: #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H /* end file src/generic/stage2/structural_iterator.h for ppc64 */ -/* including src/generic/stage2/tape_builder.h: #include "generic/stage2/tape_builder.h" */ +/* including src/generic/stage2/tape_builder.h for ppc64: #include "generic/stage2/tape_builder.h" */ /* begin file src/generic/stage2/tape_builder.h for ppc64 */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_BUILDER_H @@ -48466,13 +48472,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_WESTMERE_STRINGPARSING_DEFS_H /* end file include/simdjson/westmere/stringparsing_defs.h */ /* end file include/simdjson/westmere/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for westmere: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for westmere */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for westmere: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for westmere */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -48521,7 +48527,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for westmere */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for westmere: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for westmere */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -48628,7 +48634,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for westmere */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for westmere: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for westmere */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -48706,7 +48712,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for westmere */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for westmere: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for westmere */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -48798,7 +48804,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for westmere */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for westmere: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for westmere */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -48935,7 +48941,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for westmere */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for westmere: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for westmere */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -50206,7 +50212,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for westmere */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for westmere: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -51959,13 +51965,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_WESTMERE_STRINGPARSING_DEFS_H /* end file include/simdjson/westmere/stringparsing_defs.h */ /* end file include/simdjson/westmere/begin.h */ -/* including src/generic/amalgamated.h: #include "generic/amalgamated.h" */ +/* including src/generic/amalgamated.h for westmere: #include "generic/amalgamated.h" */ /* begin file src/generic/amalgamated.h for westmere */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_SRC_GENERIC_DEPENDENCIES_H) #error generic/dependencies.h must be included before generic/amalgamated.h! #endif -/* including src/generic/base.h: #include "generic/base.h" */ +/* including src/generic/base.h for westmere: #include "generic/base.h" */ /* begin file src/generic/base.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_BASE_H @@ -51986,7 +51992,7 @@ struct json_character_block; #endif // SIMDJSON_SRC_GENERIC_BASE_H /* end file src/generic/base.h for westmere */ -/* including src/generic/dom_parser_implementation.h: #include "generic/dom_parser_implementation.h" */ +/* including src/generic/dom_parser_implementation.h for westmere: #include "generic/dom_parser_implementation.h" */ /* begin file src/generic/dom_parser_implementation.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -52010,7 +52016,7 @@ simdjson_inline bool is_ascii(const simd8x64& input); #endif // SIMDJSON_SRC_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file src/generic/dom_parser_implementation.h for westmere */ -/* including src/generic/json_character_block.h: #include "generic/json_character_block.h" */ +/* including src/generic/json_character_block.h for westmere: #include "generic/json_character_block.h" */ /* begin file src/generic/json_character_block.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H @@ -52041,10 +52047,10 @@ struct json_character_block { #endif // SIMDJSON_SRC_GENERIC_JSON_CHARACTER_BLOCK_H /* end file src/generic/json_character_block.h for westmere */ /* end file src/generic/amalgamated.h for westmere */ -/* including src/generic/stage1/amalgamated.h: #include "generic/stage1/amalgamated.h" */ +/* including src/generic/stage1/amalgamated.h for westmere: #include "generic/stage1/amalgamated.h" */ /* begin file src/generic/stage1/amalgamated.h for westmere */ // Stuff other things depend on -/* including src/generic/stage1/base.h: #include "generic/stage1/base.h" */ +/* including src/generic/stage1/base.h for westmere: #include "generic/stage1/base.h" */ /* begin file src/generic/stage1/base.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BASE_H @@ -52082,7 +52088,7 @@ using utf8_validation::utf8_checker; #endif // SIMDJSON_SRC_GENERIC_STAGE1_BASE_H /* end file src/generic/stage1/base.h for westmere */ -/* including src/generic/stage1/json_string_scanner.h: #include "generic/stage1/json_string_scanner.h" */ +/* including src/generic/stage1/json_string_scanner.h for westmere: #include "generic/stage1/json_string_scanner.h" */ /* begin file src/generic/stage1/json_string_scanner.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H @@ -52247,7 +52253,7 @@ simdjson_inline error_code json_string_scanner::finish() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRING_SCANNER_H /* end file src/generic/stage1/json_string_scanner.h for westmere */ -/* including src/generic/stage1/utf8_lookup4_algorithm.h: #include "generic/stage1/utf8_lookup4_algorithm.h" */ +/* including src/generic/stage1/utf8_lookup4_algorithm.h for westmere: #include "generic/stage1/utf8_lookup4_algorithm.h" */ /* begin file src/generic/stage1/utf8_lookup4_algorithm.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H @@ -52467,7 +52473,7 @@ using namespace simd; #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_LOOKUP4_ALGORITHM_H /* end file src/generic/stage1/utf8_lookup4_algorithm.h for westmere */ -/* including src/generic/stage1/json_scanner.h: #include "generic/stage1/json_scanner.h" */ +/* including src/generic/stage1/json_scanner.h for westmere: #include "generic/stage1/json_scanner.h" */ /* begin file src/generic/stage1/json_scanner.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_SCANNER_H @@ -52640,7 +52646,7 @@ simdjson_inline error_code json_scanner::finish() { /* end file src/generic/stage1/json_scanner.h for westmere */ // All other declarations -/* including src/generic/stage1/buf_block_reader.h: #include "generic/stage1/buf_block_reader.h" */ +/* including src/generic/stage1/buf_block_reader.h for westmere: #include "generic/stage1/buf_block_reader.h" */ /* begin file src/generic/stage1/buf_block_reader.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H @@ -52746,7 +52752,7 @@ simdjson_inline void buf_block_reader::advance() { #endif // SIMDJSON_SRC_GENERIC_STAGE1_BUF_BLOCK_READER_H /* end file src/generic/stage1/buf_block_reader.h for westmere */ -/* including src/generic/stage1/find_next_document_index.h: #include "generic/stage1/find_next_document_index.h" */ +/* including src/generic/stage1/find_next_document_index.h for westmere: #include "generic/stage1/find_next_document_index.h" */ /* begin file src/generic/stage1/find_next_document_index.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H @@ -52854,7 +52860,7 @@ simdjson_inline uint32_t find_next_document_index(dom_parser_implementation &par #endif // SIMDJSON_SRC_GENERIC_STAGE1_FIND_NEXT_DOCUMENT_INDEX_H /* end file src/generic/stage1/find_next_document_index.h for westmere */ -/* including src/generic/stage1/json_minifier.h: #include "generic/stage1/json_minifier.h" */ +/* including src/generic/stage1/json_minifier.h for westmere: #include "generic/stage1/json_minifier.h" */ /* begin file src/generic/stage1/json_minifier.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H @@ -52961,7 +52967,7 @@ error_code json_minifier::minify(const uint8_t *buf, size_t len, uint8_t *dst, s #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_MINIFIER_H /* end file src/generic/stage1/json_minifier.h for westmere */ -/* including src/generic/stage1/json_structural_indexer.h: #include "generic/stage1/json_structural_indexer.h" */ +/* including src/generic/stage1/json_structural_indexer.h for westmere: #include "generic/stage1/json_structural_indexer.h" */ /* begin file src/generic/stage1/json_structural_indexer.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H @@ -53332,7 +53338,7 @@ simdjson_inline error_code json_structural_indexer::finish(dom_parser_implementa #endif // SIMDJSON_SRC_GENERIC_STAGE1_JSON_STRUCTURAL_INDEXER_H /* end file src/generic/stage1/json_structural_indexer.h for westmere */ -/* including src/generic/stage1/utf8_validator.h: #include "generic/stage1/utf8_validator.h" */ +/* including src/generic/stage1/utf8_validator.h for westmere: #include "generic/stage1/utf8_validator.h" */ /* begin file src/generic/stage1/utf8_validator.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H @@ -53381,10 +53387,10 @@ bool generic_validate_utf8(const char * input, size_t length) { #endif // SIMDJSON_SRC_GENERIC_STAGE1_UTF8_VALIDATOR_H /* end file src/generic/stage1/utf8_validator.h for westmere */ /* end file src/generic/stage1/amalgamated.h for westmere */ -/* including src/generic/stage2/amalgamated.h: #include "generic/stage2/amalgamated.h" */ +/* including src/generic/stage2/amalgamated.h for westmere: #include "generic/stage2/amalgamated.h" */ /* begin file src/generic/stage2/amalgamated.h for westmere */ // Stuff other things depend on -/* including src/generic/stage2/base.h: #include "generic/stage2/base.h" */ +/* including src/generic/stage2/base.h for westmere: #include "generic/stage2/base.h" */ /* begin file src/generic/stage2/base.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_BASE_H @@ -53410,7 +53416,7 @@ struct tape_writer; #endif // SIMDJSON_SRC_GENERIC_STAGE2_BASE_H /* end file src/generic/stage2/base.h for westmere */ -/* including src/generic/stage2/tape_writer.h: #include "generic/stage2/tape_writer.h" */ +/* including src/generic/stage2/tape_writer.h for westmere: #include "generic/stage2/tape_writer.h" */ /* begin file src/generic/stage2/tape_writer.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H @@ -53527,7 +53533,7 @@ simdjson_inline void tape_writer::write(uint64_t &tape_loc, uint64_t val, intern #endif // SIMDJSON_SRC_GENERIC_STAGE2_TAPE_WRITER_H /* end file src/generic/stage2/tape_writer.h for westmere */ -/* including src/generic/stage2/logger.h: #include "generic/stage2/logger.h" */ +/* including src/generic/stage2/logger.h for westmere: #include "generic/stage2/logger.h" */ /* begin file src/generic/stage2/logger.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_LOGGER_H @@ -53629,7 +53635,7 @@ namespace logger { /* end file src/generic/stage2/logger.h for westmere */ // All other declarations -/* including src/generic/stage2/json_iterator.h: #include "generic/stage2/json_iterator.h" */ +/* including src/generic/stage2/json_iterator.h for westmere: #include "generic/stage2/json_iterator.h" */ /* begin file src/generic/stage2/json_iterator.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H @@ -53958,7 +53964,7 @@ simdjson_warn_unused simdjson_inline error_code json_iterator::visit_primitive(V #endif // SIMDJSON_SRC_GENERIC_STAGE2_JSON_ITERATOR_H /* end file src/generic/stage2/json_iterator.h for westmere */ -/* including src/generic/stage2/stringparsing.h: #include "generic/stage2/stringparsing.h" */ +/* including src/generic/stage2/stringparsing.h for westmere: #include "generic/stage2/stringparsing.h" */ /* begin file src/generic/stage2/stringparsing.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H @@ -54209,7 +54215,7 @@ simdjson_warn_unused simdjson_inline uint8_t *parse_wobbly_string(const uint8_t #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRINGPARSING_H /* end file src/generic/stage2/stringparsing.h for westmere */ -/* including src/generic/stage2/structural_iterator.h: #include "generic/stage2/structural_iterator.h" */ +/* including src/generic/stage2/structural_iterator.h for westmere: #include "generic/stage2/structural_iterator.h" */ /* begin file src/generic/stage2/structural_iterator.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H @@ -54276,7 +54282,7 @@ public: #endif // SIMDJSON_SRC_GENERIC_STAGE2_STRUCTURAL_ITERATOR_H /* end file src/generic/stage2/structural_iterator.h for westmere */ -/* including src/generic/stage2/tape_builder.h: #include "generic/stage2/tape_builder.h" */ +/* including src/generic/stage2/tape_builder.h for westmere: #include "generic/stage2/tape_builder.h" */ /* begin file src/generic/stage2/tape_builder.h for westmere */ #ifndef SIMDJSON_SRC_GENERIC_STAGE2_TAPE_BUILDER_H diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index 4b05a2a3c..9fcd7ffc3 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on 2023-07-17 10:02:55 -0700. Do not edit! */ +/* auto-generated on 2023-07-17 13:07:20 -0700. Do not edit! */ /* including include/simdjson.h: */ /* begin file include/simdjson.h */ #ifndef SIMDJSON_H @@ -409,7 +409,8 @@ double from_chars(const char *first, const char* end) noexcept; SIMDJSON_DISABLE_GCC_WARNING(-Wshadow) \ SIMDJSON_DISABLE_GCC_WARNING(-Wunused-parameter) \ SIMDJSON_DISABLE_GCC_WARNING(-Wunused-variable) \ - SIMDJSON_DISABLE_GCC_WARNING(-Wmaybe-uninitialized) + SIMDJSON_DISABLE_GCC_WARNING(-Wmaybe-uninitialized) \ + SIMDJSON_DISABLE_GCC_WARNING(-Wformat-security) #endif // __clang__ #define SIMDJSON_PRAGMA(P) _Pragma(#P) @@ -2659,6 +2660,7 @@ inline const std::string error_message(int error) noexcept; #endif // SIMDJSON_ERROR_H /* end file include/simdjson/error.h */ +/* skipped duplicate #include "simdjson/portability.h" */ /** * @brief The top level simdjson namespace, containing everything the library provides. @@ -3956,6 +3958,10 @@ class key_value_pair; class object; class parser; +#ifdef SIMDJSON_THREADS_ENABLED +struct stage1_worker; +#endif // SIMDJSON_THREADS_ENABLED + } // namespace dom namespace internal { @@ -6037,50 +6043,9 @@ namespace simdjson { */ namespace internal { -class mini_formatter; - -/** - * @private The string_builder template allows us to construct - * a string from a document element. It is parametrized - * by a "formatter" which handles the details. Thus - * the string_builder template could support both minification - * and prettification, and various other tradeoffs. - */ -template -class string_builder { +template +class base_formatter { public: - /** Construct an initially empty builder, would print the empty string **/ - string_builder() = default; - /** Append an element to the builder (to be printed) **/ - inline void append(simdjson::dom::element value); - /** Append an array to the builder (to be printed) **/ - inline void append(simdjson::dom::array value); - /** Append an object to the builder (to be printed) **/ - inline void append(simdjson::dom::object value); - /** Reset the builder (so that it would print the empty string) **/ - simdjson_inline void clear(); - /** - * Get access to the string. The string_view is owned by the builder - * and it is invalid to use it after the string_builder has been - * destroyed. - * However you can make a copy of the string_view on memory that you - * own. - */ - simdjson_inline std::string_view str() const; - /** Append a key_value_pair to the builder (to be printed) **/ - simdjson_inline void append(simdjson::dom::key_value_pair value); -private: - formatter format{}; -}; - -/** - * @private This is the class that we expect to use with the string_builder - * template. It tries to produce a compact version of the JSON element - * as quickly as possible. - */ -class mini_formatter { -public: - mini_formatter() = default; /** Add a comma **/ simdjson_inline void comma(); /** Start an array, prints [ **/ @@ -6115,14 +6080,88 @@ public: **/ simdjson_inline std::string_view str() const; -private: - // implementation details (subject to change) /** Prints one character **/ simdjson_inline void one_char(char c); + + simdjson_inline void call_print_newline() { + this->print_newline(); + } + + simdjson_inline void call_print_indents(size_t depth) { + this->print_indents(depth); + } + + simdjson_inline void call_print_space() { + this->print_space(); + } + +protected: + // implementation details (subject to change) /** Backing buffer **/ std::vector buffer{}; // not ideal! }; + +/** + * @private This is the class that we expect to use with the string_builder + * template. It tries to produce a compact version of the JSON element + * as quickly as possible. + */ +class mini_formatter : public base_formatter { +public: + simdjson_inline void print_newline(); + + simdjson_inline void print_indents(size_t depth); + + simdjson_inline void print_space(); +}; + +class pretty_formatter : public base_formatter { +public: + simdjson_inline void print_newline(); + + simdjson_inline void print_indents(size_t depth); + + simdjson_inline void print_space(); + +protected: + int indent_step = 4; +}; + +/** + * @private The string_builder template allows us to construct + * a string from a document element. It is parametrized + * by a "formatter" which handles the details. Thus + * the string_builder template could support both minification + * and prettification, and various other tradeoffs. + */ +template +class string_builder { +public: + /** Construct an initially empty builder, would print the empty string **/ + string_builder() = default; + /** Append an element to the builder (to be printed) **/ + inline void append(simdjson::dom::element value); + /** Append an array to the builder (to be printed) **/ + inline void append(simdjson::dom::array value); + /** Append an object to the builder (to be printed) **/ + inline void append(simdjson::dom::object value); + /** Reset the builder (so that it would print the empty string) **/ + simdjson_inline void clear(); + /** + * Get access to the string. The string_view is owned by the builder + * and it is invalid to use it after the string_builder has been + * destroyed. + * However you can make a copy of the string_view on memory that you + * own. + */ + simdjson_inline std::string_view str() const; + /** Append a key_value_pair to the builder (to be printed) **/ + simdjson_inline void append(simdjson::dom::key_value_pair value); +private: + formatter format{}; +}; + } // internal namespace dom { @@ -6230,6 +6269,38 @@ std::string minify(simdjson_result x) { } #endif +/** + * Prettifies a JSON element or document, printing the valid JSON with indentation. + * + * dom::parser parser; + * element doc = parser.parse(" [ 1 , 2 , 3 ] "_padded); + * + * // Prints: + * // { + * // [ + * // 1, + * // 2, + * // 3 + * // ] + * // } + * cout << prettify(doc) << endl; + * + */ +template +std::string prettify(T x) { + simdjson::internal::string_builder sb; + sb.append(x); + std::string_view answer = sb.str(); + return std::string(answer.data(), answer.size()); +} + +#if SIMDJSON_EXCEPTIONS +template +std::string prettify(simdjson_result x) { + if (x.error()) { throw simdjson_error(x.error()); } + return to_string(x.value()); +} +#endif } // namespace simdjson @@ -6623,6 +6694,7 @@ public: #include +/* skipped duplicate #include "simdjson/dom/base.h" */ /* skipped duplicate #include "simdjson/dom/array.h" */ /* skipped duplicate #include "simdjson/dom/element.h" */ /* skipped duplicate #include "simdjson/error-inl.h" */ @@ -6935,6 +7007,7 @@ inline bool array::iterator::operator>(const array::iterator& other) const noexc #ifndef SIMDJSON_INLINE_ELEMENT_H #define SIMDJSON_INLINE_ELEMENT_H +/* skipped duplicate #include "simdjson/dom/base.h" */ /* skipped duplicate #include "simdjson/dom/element.h" */ /* skipped duplicate #include "simdjson/dom/document.h" */ /* skipped duplicate #include "simdjson/dom/object.h" */ @@ -7392,6 +7465,7 @@ static_assert(std::ranges::sized_range +#include +#include +#endif + namespace simdjson { namespace dom { #ifdef SIMDJSON_THREADS_ENABLED + inline void stage1_worker::finish() { // After calling "run" someone would call finish() to wait // for the end of the processing. @@ -7982,6 +8064,7 @@ simdjson_inline dom::document_stream::iterator simdjson_result +simdjson_inline void base_formatter::number(uint64_t x) { char number_buffer[24]; char *newp = fast_itoa(number_buffer, x); buffer.insert(buffer.end(), number_buffer, newp); } -simdjson_inline void mini_formatter::number(int64_t x) { +template +simdjson_inline void base_formatter::number(int64_t x) { char number_buffer[24]; char *newp = fast_itoa(number_buffer, x); buffer.insert(buffer.end(), number_buffer, newp); } -simdjson_inline void mini_formatter::number(double x) { +template +simdjson_inline void base_formatter::number(double x) { char number_buffer[24]; // Currently, passing the nullptr to the second argument is // safe because our implementation does not check the second @@ -9132,31 +9223,51 @@ simdjson_inline void mini_formatter::number(double x) { buffer.insert(buffer.end(), number_buffer, newp); } -simdjson_inline void mini_formatter::start_array() { one_char('['); } -simdjson_inline void mini_formatter::end_array() { one_char(']'); } -simdjson_inline void mini_formatter::start_object() { one_char('{'); } -simdjson_inline void mini_formatter::end_object() { one_char('}'); } -simdjson_inline void mini_formatter::comma() { one_char(','); } +template +simdjson_inline void base_formatter::start_array() { one_char('['); } -simdjson_inline void mini_formatter::true_atom() { +template +simdjson_inline void base_formatter::end_array() { one_char(']'); } + +template +simdjson_inline void base_formatter::start_object() { one_char('{'); } + +template +simdjson_inline void base_formatter::end_object() { one_char('}'); } + +template +simdjson_inline void base_formatter::comma() { one_char(','); } + +template +simdjson_inline void base_formatter::true_atom() { const char * s = "true"; buffer.insert(buffer.end(), s, s + 4); } -simdjson_inline void mini_formatter::false_atom() { + +template +simdjson_inline void base_formatter::false_atom() { const char * s = "false"; buffer.insert(buffer.end(), s, s + 5); } -simdjson_inline void mini_formatter::null_atom() { + +template +simdjson_inline void base_formatter::null_atom() { const char * s = "null"; buffer.insert(buffer.end(), s, s + 4); } -simdjson_inline void mini_formatter::one_char(char c) { buffer.push_back(c); } -simdjson_inline void mini_formatter::key(std::string_view unescaped) { + +template +simdjson_inline void base_formatter::one_char(char c) { buffer.push_back(c); } + +template +simdjson_inline void base_formatter::key(std::string_view unescaped) { string(unescaped); one_char(':'); } -simdjson_inline void mini_formatter::string(std::string_view unescaped) { + +template +simdjson_inline void base_formatter::string(std::string_view unescaped) { one_char('\"'); size_t i = 0; // Fast path for the case where we have no control character, no ", and no backslash. @@ -9235,14 +9346,46 @@ simdjson_inline void mini_formatter::string(std::string_view unescaped) { one_char('\"'); } -inline void mini_formatter::clear() { + +template +inline void base_formatter::clear() { buffer.clear(); } -simdjson_inline std::string_view mini_formatter::str() const { +template +simdjson_inline std::string_view base_formatter::str() const { return std::string_view(buffer.data(), buffer.size()); } +simdjson_inline void mini_formatter::print_newline() { + return; +} + +simdjson_inline void mini_formatter::print_indents(size_t depth) { + (void)depth; + return; +} + +simdjson_inline void mini_formatter::print_space() { + return; +} + +simdjson_inline void pretty_formatter::print_newline() { + one_char('\n'); +} + +simdjson_inline void pretty_formatter::print_indents(size_t depth) { + if(this->indent_step <= 0) { + return; + } + for(size_t i = 0; i < this->indent_step * depth; i++) { + one_char(' '); + } +} + +simdjson_inline void pretty_formatter::print_space() { + one_char(' '); +} /*** * String building code. @@ -9262,11 +9405,16 @@ inline void string_builder::append(simdjson::dom::element value) { // print commas after each value if (after_value) { format.comma(); + format.print_newline(); } + + format.print_indents(depth); + // If we are in an object, print the next key and :, and skip to the next // value. if (is_object[depth]) { format.key(iter.get_string_view()); + format.print_space(); iter.json_index++; } switch (iter.tape_ref_type()) { @@ -9295,6 +9443,7 @@ inline void string_builder::append(simdjson::dom::element value) { is_object[depth] = false; after_value = false; + format.print_newline(); continue; } @@ -9322,6 +9471,7 @@ inline void string_builder::append(simdjson::dom::element value) { is_object[depth] = true; after_value = false; + format.print_newline(); continue; } @@ -9366,17 +9516,21 @@ inline void string_builder::append(simdjson::dom::element value) { // Handle multiple ends in a row while (depth != 0 && (iter.tape_ref_type() == tape_type::END_ARRAY || iter.tape_ref_type() == tape_type::END_OBJECT)) { + format.print_newline(); + depth--; + format.print_indents(depth); if (iter.tape_ref_type() == tape_type::END_ARRAY) { format.end_array(); } else { format.end_object(); } - depth--; iter.json_index++; } // Stop when we're at depth 0 } while (depth != 0); + + format.print_newline(); } template @@ -12371,13 +12525,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_ARM64_STRINGPARSING_DEFS_H /* end file include/simdjson/arm64/stringparsing_defs.h */ /* end file include/simdjson/arm64/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for arm64: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for arm64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for arm64: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for arm64 */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -12426,7 +12580,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for arm64 */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for arm64: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for arm64 */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -12533,7 +12687,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for arm64 */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for arm64: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for arm64 */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -12611,7 +12765,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for arm64 */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for arm64: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for arm64 */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -12703,7 +12857,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for arm64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for arm64: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for arm64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -12840,7 +12994,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for arm64 */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for arm64: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for arm64 */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -14111,7 +14265,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for arm64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for arm64: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -14505,13 +14659,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file include/simdjson/fallback/numberparsing_defs.h */ /* end file include/simdjson/fallback/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for fallback: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for fallback */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for fallback: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for fallback */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -14560,7 +14714,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for fallback */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for fallback: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for fallback */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -14667,7 +14821,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for fallback */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for fallback: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for fallback */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -14745,7 +14899,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for fallback */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for fallback: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for fallback */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -14837,7 +14991,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for fallback */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for fallback: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for fallback */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -14974,7 +15128,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for fallback */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for fallback: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for fallback */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -16245,7 +16399,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for fallback */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for fallback: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -18574,13 +18728,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_HASWELL_STRINGPARSING_DEFS_H /* end file include/simdjson/haswell/stringparsing_defs.h */ /* end file include/simdjson/haswell/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for haswell: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for haswell */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for haswell: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for haswell */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -18629,7 +18783,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for haswell */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for haswell: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for haswell */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -18736,7 +18890,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for haswell */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for haswell: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for haswell */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -18814,7 +18968,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for haswell */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for haswell: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for haswell */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -18906,7 +19060,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for haswell */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for haswell: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for haswell */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -19043,7 +19197,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for haswell */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for haswell: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for haswell */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -20314,7 +20468,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for haswell */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for haswell: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -22440,13 +22594,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t #endif // SIMDJSON_ICELAKE_NUMBERPARSING_DEFS_H /* end file include/simdjson/icelake/numberparsing_defs.h */ /* end file include/simdjson/icelake/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for icelake: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for icelake */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for icelake: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for icelake */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -22495,7 +22649,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for icelake */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for icelake: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for icelake */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -22602,7 +22756,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for icelake */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for icelake: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for icelake */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -22680,7 +22834,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for icelake */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for icelake: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for icelake */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -22772,7 +22926,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for icelake */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for icelake: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for icelake */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -22909,7 +23063,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for icelake */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for icelake: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for icelake */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -24180,7 +24334,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for icelake */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for icelake: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -26206,13 +26360,13 @@ backslash_and_quote::copy_and_find(const uint8_t *src, uint8_t *dst) { #endif // SIMDJSON_PPC64_STRINGPARSING_DEFS_H /* end file include/simdjson/ppc64/stringparsing_defs.h */ /* end file include/simdjson/ppc64/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for ppc64: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for ppc64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for ppc64: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for ppc64 */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -26261,7 +26415,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for ppc64 */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for ppc64: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for ppc64 */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -26368,7 +26522,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for ppc64 */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for ppc64: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -26446,7 +26600,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for ppc64 */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for ppc64: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for ppc64 */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -26538,7 +26692,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for ppc64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for ppc64: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for ppc64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -26675,7 +26829,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for ppc64 */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for ppc64: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for ppc64 */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -27946,7 +28100,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for ppc64 */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for ppc64: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -29662,13 +29816,13 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_WESTMERE_STRINGPARSING_DEFS_H /* end file include/simdjson/westmere/stringparsing_defs.h */ /* end file include/simdjson/westmere/begin.h */ -/* including include/simdjson/generic/amalgamated.h: #include "simdjson/generic/amalgamated.h" */ +/* including include/simdjson/generic/amalgamated.h for westmere: #include "simdjson/generic/amalgamated.h" */ /* begin file include/simdjson/generic/amalgamated.h for westmere */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H) #error simdjson/generic/dependencies.h must be included before simdjson/generic/amalgamated.h! #endif -/* including include/simdjson/generic/base.h: #include "simdjson/generic/base.h" */ +/* including include/simdjson/generic/base.h for westmere: #include "simdjson/generic/base.h" */ /* begin file include/simdjson/generic/base.h for westmere */ #ifndef SIMDJSON_GENERIC_BASE_H @@ -29717,7 +29871,7 @@ enum class number_type { #endif // SIMDJSON_GENERIC_BASE_H /* end file include/simdjson/generic/base.h for westmere */ -/* including include/simdjson/generic/jsoncharutils.h: #include "simdjson/generic/jsoncharutils.h" */ +/* including include/simdjson/generic/jsoncharutils.h for westmere: #include "simdjson/generic/jsoncharutils.h" */ /* begin file include/simdjson/generic/jsoncharutils.h for westmere */ #ifndef SIMDJSON_GENERIC_JSONCHARUTILS_H @@ -29824,7 +29978,7 @@ static simdjson_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) #endif // SIMDJSON_GENERIC_JSONCHARUTILS_H /* end file include/simdjson/generic/jsoncharutils.h for westmere */ -/* including include/simdjson/generic/atomparsing.h: #include "simdjson/generic/atomparsing.h" */ +/* including include/simdjson/generic/atomparsing.h for westmere: #include "simdjson/generic/atomparsing.h" */ /* begin file include/simdjson/generic/atomparsing.h for westmere */ #ifndef SIMDJSON_GENERIC_ATOMPARSING_H @@ -29902,7 +30056,7 @@ simdjson_inline bool is_valid_null_atom(const uint8_t *src, size_t len) { #endif // SIMDJSON_GENERIC_ATOMPARSING_H /* end file include/simdjson/generic/atomparsing.h for westmere */ -/* including include/simdjson/generic/dom_parser_implementation.h: #include "simdjson/generic/dom_parser_implementation.h" */ +/* including include/simdjson/generic/dom_parser_implementation.h for westmere: #include "simdjson/generic/dom_parser_implementation.h" */ /* begin file include/simdjson/generic/dom_parser_implementation.h for westmere */ #ifndef SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H @@ -29994,7 +30148,7 @@ inline simdjson_warn_unused error_code dom_parser_implementation::set_max_depth( #endif // SIMDJSON_GENERIC_DOM_PARSER_IMPLEMENTATION_H /* end file include/simdjson/generic/dom_parser_implementation.h for westmere */ -/* including include/simdjson/generic/implementation_simdjson_result_base.h: #include "simdjson/generic/implementation_simdjson_result_base.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base.h for westmere: #include "simdjson/generic/implementation_simdjson_result_base.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h for westmere */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H @@ -30131,7 +30285,7 @@ protected: #endif // SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_H /* end file include/simdjson/generic/implementation_simdjson_result_base.h for westmere */ -/* including include/simdjson/generic/numberparsing.h: #include "simdjson/generic/numberparsing.h" */ +/* including include/simdjson/generic/numberparsing.h for westmere: #include "simdjson/generic/numberparsing.h" */ /* begin file include/simdjson/generic/numberparsing.h for westmere */ #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H @@ -31402,7 +31556,7 @@ inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept { #endif // SIMDJSON_GENERIC_NUMBERPARSING_H /* end file include/simdjson/generic/numberparsing.h for westmere */ -/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ +/* including include/simdjson/generic/implementation_simdjson_result_base-inl.h for westmere: #include "simdjson/generic/implementation_simdjson_result_base-inl.h" */ /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_IMPLEMENTATION_SIMDJSON_RESULT_BASE_INL_H @@ -33895,14 +34049,14 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin #endif // SIMDJSON_ARM64_STRINGPARSING_DEFS_H /* end file include/simdjson/arm64/stringparsing_defs.h */ /* end file include/simdjson/arm64/begin.h */ -/* including include/simdjson/generic/ondemand/amalgamated.h: #include "simdjson/generic/ondemand/amalgamated.h" */ +/* including include/simdjson/generic/ondemand/amalgamated.h for arm64: #include "simdjson/generic/ondemand/amalgamated.h" */ /* begin file include/simdjson/generic/ondemand/amalgamated.h for arm64 */ #if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_ONDEMAND_DEPENDENCIES_H) #error simdjson/generic/ondemand/dependencies.h must be included before simdjson/generic/ondemand/amalgamated.h! #endif // Stuff other things depend on -/* including include/simdjson/generic/ondemand/base.h: #include "simdjson/generic/ondemand/base.h" */ +/* including include/simdjson/generic/ondemand/base.h for arm64: #include "simdjson/generic/ondemand/base.h" */ /* begin file include/simdjson/generic/ondemand/base.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_BASE_H @@ -33952,7 +34106,7 @@ class value_iterator; #endif // SIMDJSON_GENERIC_ONDEMAND_BASE_H /* end file include/simdjson/generic/ondemand/base.h for arm64 */ -/* including include/simdjson/generic/ondemand/value_iterator.h: #include "simdjson/generic/ondemand/value_iterator.h" */ +/* including include/simdjson/generic/ondemand/value_iterator.h for arm64: #include "simdjson/generic/ondemand/value_iterator.h" */ /* begin file include/simdjson/generic/ondemand/value_iterator.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_ITERATOR_H @@ -34441,7 +34595,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_VALUE_ITERATOR_H /* end file include/simdjson/generic/ondemand/value_iterator.h for arm64 */ -/* including include/simdjson/generic/ondemand/value.h: #include "simdjson/generic/ondemand/value.h" */ +/* including include/simdjson/generic/ondemand/value.h for arm64: #include "simdjson/generic/ondemand/value.h" */ /* begin file include/simdjson/generic/ondemand/value.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_H @@ -35151,7 +35305,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_VALUE_H /* end file include/simdjson/generic/ondemand/value.h for arm64 */ -/* including include/simdjson/generic/ondemand/logger.h: #include "simdjson/generic/ondemand/logger.h" */ +/* including include/simdjson/generic/ondemand/logger.h for arm64: #include "simdjson/generic/ondemand/logger.h" */ /* begin file include/simdjson/generic/ondemand/logger.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_H @@ -35169,6 +35323,11 @@ namespace ondemand { // create temporary std::string instances. namespace logger { +enum class log_level : int32_t { + info = 0, + error = 1 +}; + #if SIMDJSON_VERBOSE_LOGGING static constexpr const bool LOG_ENABLED = true; #else @@ -35179,14 +35338,18 @@ namespace logger { // for performance purposes and if you are using the loggers, you do not care about // performance (or should not). static inline void log_headers() noexcept; -static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; -static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; +// If args are provided, title will be treated as format string +template +static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; +template +static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept; static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept; static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; + static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept; static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept; @@ -35203,7 +35366,7 @@ static inline void log_error(const value_iterator &iter, const char *error, cons #endif // SIMDJSON_GENERIC_ONDEMAND_LOGGER_H /* end file include/simdjson/generic/ondemand/logger.h for arm64 */ -/* including include/simdjson/generic/ondemand/token_iterator.h: #include "simdjson/generic/ondemand/token_iterator.h" */ +/* including include/simdjson/generic/ondemand/token_iterator.h for arm64: #include "simdjson/generic/ondemand/token_iterator.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H @@ -35332,8 +35495,10 @@ protected: friend class json_iterator; friend class value_iterator; friend class object; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; } // namespace ondemand @@ -35355,7 +35520,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H /* end file include/simdjson/generic/ondemand/token_iterator.h for arm64 */ -/* including include/simdjson/generic/ondemand/json_iterator.h: #include "simdjson/generic/ondemand/json_iterator.h" */ +/* including include/simdjson/generic/ondemand/json_iterator.h for arm64: #include "simdjson/generic/ondemand/json_iterator.h" */ /* begin file include/simdjson/generic/ondemand/json_iterator.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H @@ -35658,8 +35823,10 @@ protected: friend class raw_json_string; friend class parser; friend class value_iterator; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; // json_iterator } // namespace ondemand @@ -35681,7 +35848,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H /* end file include/simdjson/generic/ondemand/json_iterator.h for arm64 */ -/* including include/simdjson/generic/ondemand/json_type.h: #include "simdjson/generic/ondemand/json_type.h" */ +/* including include/simdjson/generic/ondemand/json_type.h for arm64: #include "simdjson/generic/ondemand/json_type.h" */ /* begin file include/simdjson/generic/ondemand/json_type.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H @@ -35846,7 +36013,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H /* end file include/simdjson/generic/ondemand/json_type.h for arm64 */ -/* including include/simdjson/generic/ondemand/raw_json_string.h: #include "simdjson/generic/ondemand/raw_json_string.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string.h for arm64: #include "simdjson/generic/ondemand/raw_json_string.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H @@ -36055,7 +36222,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H /* end file include/simdjson/generic/ondemand/raw_json_string.h for arm64 */ -/* including include/simdjson/generic/ondemand/parser.h: #include "simdjson/generic/ondemand/parser.h" */ +/* including include/simdjson/generic/ondemand/parser.h for arm64: #include "simdjson/generic/ondemand/parser.h" */ /* begin file include/simdjson/generic/ondemand/parser.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_H @@ -36413,7 +36580,7 @@ public: /* end file include/simdjson/generic/ondemand/parser.h for arm64 */ // All other declarations -/* including include/simdjson/generic/ondemand/array.h: #include "simdjson/generic/ondemand/array.h" */ +/* including include/simdjson/generic/ondemand/array.h for arm64: #include "simdjson/generic/ondemand/array.h" */ /* begin file include/simdjson/generic/ondemand/array.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H @@ -36615,7 +36782,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_H /* end file include/simdjson/generic/ondemand/array.h for arm64 */ -/* including include/simdjson/generic/ondemand/array_iterator.h: #include "simdjson/generic/ondemand/array_iterator.h" */ +/* including include/simdjson/generic/ondemand/array_iterator.h for arm64: #include "simdjson/generic/ondemand/array_iterator.h" */ /* begin file include/simdjson/generic/ondemand/array_iterator.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H @@ -36714,7 +36881,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H /* end file include/simdjson/generic/ondemand/array_iterator.h for arm64 */ -/* including include/simdjson/generic/ondemand/document.h: #include "simdjson/generic/ondemand/document.h" */ +/* including include/simdjson/generic/ondemand/document.h for arm64: #include "simdjson/generic/ondemand/document.h" */ /* begin file include/simdjson/generic/ondemand/document.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H @@ -37524,7 +37691,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H /* end file include/simdjson/generic/ondemand/document.h for arm64 */ -/* including include/simdjson/generic/ondemand/document_stream.h: #include "simdjson/generic/ondemand/document_stream.h" */ +/* including include/simdjson/generic/ondemand/document_stream.h for arm64: #include "simdjson/generic/ondemand/document_stream.h" */ /* begin file include/simdjson/generic/ondemand/document_stream.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H @@ -37866,7 +38033,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H /* end file include/simdjson/generic/ondemand/document_stream.h for arm64 */ -/* including include/simdjson/generic/ondemand/field.h: #include "simdjson/generic/ondemand/field.h" */ +/* including include/simdjson/generic/ondemand/field.h for arm64: #include "simdjson/generic/ondemand/field.h" */ /* begin file include/simdjson/generic/ondemand/field.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_H @@ -37951,7 +38118,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_FIELD_H /* end file include/simdjson/generic/ondemand/field.h for arm64 */ -/* including include/simdjson/generic/ondemand/object.h: #include "simdjson/generic/ondemand/object.h" */ +/* including include/simdjson/generic/ondemand/object.h for arm64: #include "simdjson/generic/ondemand/object.h" */ /* begin file include/simdjson/generic/ondemand/object.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_H @@ -38193,7 +38360,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_H /* end file include/simdjson/generic/ondemand/object.h for arm64 */ -/* including include/simdjson/generic/ondemand/object_iterator.h: #include "simdjson/generic/ondemand/object_iterator.h" */ +/* including include/simdjson/generic/ondemand/object_iterator.h for arm64: #include "simdjson/generic/ondemand/object_iterator.h" */ /* begin file include/simdjson/generic/ondemand/object_iterator.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H @@ -38276,7 +38443,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H /* end file include/simdjson/generic/ondemand/object_iterator.h for arm64 */ -/* including include/simdjson/generic/ondemand/serialization.h: #include "simdjson/generic/ondemand/serialization.h" */ +/* including include/simdjson/generic/ondemand/serialization.h for arm64: #include "simdjson/generic/ondemand/serialization.h" */ /* begin file include/simdjson/generic/ondemand/serialization.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_H @@ -38384,7 +38551,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result simdjson_result &simdjson_resul #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/array_iterator-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/document-inl.h: #include "simdjson/generic/ondemand/document-inl.h" */ +/* including include/simdjson/generic/ondemand/document-inl.h for arm64: #include "simdjson/generic/ondemand/document-inl.h" */ /* begin file include/simdjson/generic/ondemand/document-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_INL_H @@ -39520,7 +39687,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_resu #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_INL_H /* end file include/simdjson/generic/ondemand/document_stream-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/field-inl.h: #include "simdjson/generic/ondemand/field-inl.h" */ +/* including include/simdjson/generic/ondemand/field-inl.h for arm64: #include "simdjson/generic/ondemand/field-inl.h" */ /* begin file include/simdjson/generic/ondemand/field-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_INL_H @@ -40040,7 +40207,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_result #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/json_iterator-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/json_type-inl.h: #include "simdjson/generic/ondemand/json_type-inl.h" */ +/* including include/simdjson/generic/ondemand/json_type-inl.h for arm64: #include "simdjson/generic/ondemand/json_type-inl.h" */ /* begin file include/simdjson/generic/ondemand/json_type-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H @@ -40572,7 +40739,7 @@ simdjson_inline simdjson_result::simdjson_result(err #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H /* end file include/simdjson/generic/ondemand/json_type-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/logger-inl.h: #include "simdjson/generic/ondemand/logger-inl.h" */ +/* including include/simdjson/generic/ondemand/logger-inl.h for arm64: #include "simdjson/generic/ondemand/logger-inl.h" */ /* begin file include/simdjson/generic/ondemand/logger-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_INL_H @@ -40604,36 +40771,70 @@ static inline char printable_char(char c) { } } +template +static inline std::string string_format(const std::string& format, const Args&... args) +{ + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; + auto size = static_cast(size_s); + if (size <= 0) return std::string(); + std::unique_ptr buf(new char[size]); + std::snprintf(buf.get(), size, format.c_str(), args...); + SIMDJSON_POP_DISABLE_WARNINGS + return std::string(buf.get(), buf.get() + size - 1); +} + +static inline log_level get_log_level_from_env() +{ + SIMDJSON_PUSH_DISABLE_WARNINGS + SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe + char *lvl = getenv("SIMDJSON_LOG_LEVEL"); + SIMDJSON_POP_DISABLE_WARNINGS + if (lvl && simdjson_strcasecmp(lvl, "ERROR") == 0) { return log_level::error; } + return log_level::info; +} + +static inline log_level log_threshold() +{ + static log_level threshold = get_log_level_from_env(); + return threshold; +} + +static inline bool should_log(log_level level) +{ + return level >= log_threshold(); +} + inline void log_event(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "", type, detail); + log_line(iter, index, depth, "", type, detail, log_level::info); } inline void log_value(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "+", type, detail); + log_line(iter, index, depth, "+", type, detail, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_start_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { - log_line(iter, "+", type, "", delta, depth_delta); + log_line(iter, "+", type, "", delta, depth_delta, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_end_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { if (LOG_ENABLED) { log_depth--; } - log_line(iter, "-", type, "", delta, depth_delta); + log_line(iter, "-", type, "", delta, depth_delta, log_level::info); } inline void log_error(const json_iterator &iter, const char *error, const char *detail, int delta, int depth_delta) noexcept { - log_line(iter, "ERROR: ", error, detail, delta, depth_delta); + log_line(iter, "ERROR: ", error, detail, delta, depth_delta, log_level::error); } inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail) noexcept { - log_line(iter, index, depth, "ERROR: ", error, detail); + log_line(iter, index, depth, "ERROR: ", error, detail, log_level::error); } inline void log_event(const value_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { @@ -40658,96 +40859,101 @@ inline void log_error(const value_iterator &iter, const char *error, const char inline void log_headers() noexcept { if (LOG_ENABLED) { - // Technically a static variable is not thread-safe, but if you are using threads - // and logging... well... - static bool displayed_hint{false}; - log_depth = 0; - printf("\n"); - if(!displayed_hint) { - // We only print this helpful header once. - printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); - printf("# +array says 'this is where we were when we discovered the start array'\n"); - printf("# -array says 'this is where we were when we ended the array'\n"); - printf("# skip says 'this is a structural or value I am skipping'\n"); - printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); - printf("#\n"); - printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); - printf("# in addition to the depth being displayed.\n"); - printf("#\n"); - printf("# Every token in the document has a single depth determined by the tokens before it,\n"); - printf("# and is not affected by what the token actually is.\n"); - printf("#\n"); - printf("# Not all structural elements are presented as tokens in the logs.\n"); - printf("#\n"); - printf("# We never give control to the user within an empty array or an empty object.\n"); - printf("#\n"); - printf("# Inside an array, having a depth greater than the array's depth means that\n"); - printf("# we are pointing inside a value.\n"); - printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); - printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); - displayed_hint = true; - } - printf("\n"); - printf("| %-*s ", LOG_EVENT_LEN, "Event"); - printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); - printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); - // printf("| %-*s ", 5, "Next#"); - printf("| %-*s ", 5, "Depth"); - printf("| Detail "); - printf("|\n"); + if (simdjson_unlikely(should_log(log_level::info))) { + // Technically a static variable is not thread-safe, but if you are using threads and logging... well... + static bool displayed_hint{false}; + log_depth = 0; + printf("\n"); + if (!displayed_hint) { + // We only print this helpful header once. + printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); + printf("# +array says 'this is where we were when we discovered the start array'\n"); + printf( + "# -array says 'this is where we were when we ended the array'\n"); + printf("# skip says 'this is a structural or value I am skipping'\n"); + printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); + printf("#\n"); + printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); + printf("# in addition to the depth being displayed.\n"); + printf("#\n"); + printf("# Every token in the document has a single depth determined by the tokens before it,\n"); + printf("# and is not affected by what the token actually is.\n"); + printf("#\n"); + printf("# Not all structural elements are presented as tokens in the logs.\n"); + printf("#\n"); + printf("# We never give control to the user within an empty array or an empty object.\n"); + printf("#\n"); + printf("# Inside an array, having a depth greater than the array's depth means that\n"); + printf("# we are pointing inside a value.\n"); + printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); + printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); + displayed_hint = true; + } + printf("\n"); + printf("| %-*s ", LOG_EVENT_LEN, "Event"); + printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); + printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); + // printf("| %-*s ", 5, "Next#"); + printf("| %-*s ", 5, "Depth"); + printf("| Detail "); + printf("|\n"); - printf("|%.*s", LOG_EVENT_LEN+2, DASHES); - printf("|%.*s", LOG_BUFFER_LEN+2, DASHES); - printf("|%.*s", LOG_SMALL_BUFFER_LEN+2, DASHES); - // printf("|%.*s", 5+2, DASHES); - printf("|%.*s", 5+2, DASHES); - printf("|--------"); - printf("|\n"); - fflush(stdout); + printf("|%.*s", LOG_EVENT_LEN + 2, DASHES); + printf("|%.*s", LOG_BUFFER_LEN + 2, DASHES); + printf("|%.*s", LOG_SMALL_BUFFER_LEN + 2, DASHES); + // printf("|%.*s", 5+2, DASHES); + printf("|%.*s", 5 + 2, DASHES); + printf("|--------"); + printf("|\n"); + fflush(stdout); + } } } -inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail); +template +inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level, Args&&... args) noexcept { + log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail, level, std::forward(args)...); } -inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept { + +template +inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level, Args&&... args) noexcept { if (LOG_ENABLED) { - const int indent = depth*2; - const auto buf = iter.token.buf; - printf("| %*s%s%-*s ", - indent, "", - title_prefix, - LOG_EVENT_LEN - indent - int(strlen(title_prefix)), title - ); - { - // Print the current structural. - printf("| "); - // Before we begin, the index might point right before the document. - // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 - if(index < iter._root) { - printf("%*s", LOG_BUFFER_LEN, ""); - } else { - auto current_structural = &buf[*index]; - for (int i=0;i(args)...); + printf("| %*s%s%-*s ", indent, "", title_prefix, + LOG_EVENT_LEN - indent - int(strlen(title_prefix)), msg.c_str()); + { + // Print the current structural. + printf("| "); + // Before we begin, the index might point right before the document. + // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 + if (index < iter._root) { + printf("%*s", LOG_BUFFER_LEN, ""); + } else { + auto current_structural = &buf[*index]; + for (int i = 0; i < LOG_BUFFER_LEN; i++) { printf("%c", printable_char(current_structural[i])); + } } + printf(" "); } - printf(" "); - } - { - // Print the next structural. - printf("| "); - auto next_structural = &buf[*(index+1)]; - for (int i=0;i object::find_field_unordered(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field_unordered(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::operator[](const std::string_view key) & noexcept { @@ -40798,13 +41010,19 @@ simdjson_inline simdjson_result object::operator[](const std::string_view simdjson_inline simdjson_result object::find_field(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } @@ -41009,7 +41227,7 @@ simdjson_inline simdjson_result simdjson_result &simdjson_resu #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/object_iterator-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/parser-inl.h: #include "simdjson/generic/ondemand/parser-inl.h" */ +/* including include/simdjson/generic/ondemand/parser-inl.h for arm64: #include "simdjson/generic/ondemand/parser-inl.h" */ /* begin file include/simdjson/generic/ondemand/parser-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H @@ -41315,7 +41533,7 @@ simdjson_inline simdjson_result::simdjson_result(error_ #endif // SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H /* end file include/simdjson/generic/ondemand/parser-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/raw_json_string-inl.h: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string-inl.h for arm64: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H @@ -41521,7 +41739,7 @@ simdjson_inline simdjson_warn_unused simdjson_result simdjson_ #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H /* end file include/simdjson/generic/ondemand/raw_json_string-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/serialization-inl.h: #include "simdjson/generic/ondemand/serialization-inl.h" */ +/* including include/simdjson/generic/ondemand/serialization-inl.h for arm64: #include "simdjson/generic/ondemand/serialization-inl.h" */ /* begin file include/simdjson/generic/ondemand/serialization-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H @@ -41757,7 +41975,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::arm64::ondemand::ob #endif // SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H /* end file include/simdjson/generic/ondemand/serialization-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/token_iterator-inl.h: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ +/* including include/simdjson/generic/ondemand/token_iterator-inl.h for arm64: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H @@ -41849,7 +42067,7 @@ simdjson_inline simdjson_result::simdjson_resul #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/token_iterator-inl.h for arm64 */ -/* including include/simdjson/generic/ondemand/value-inl.h: #include "simdjson/generic/ondemand/value-inl.h" */ +/* including include/simdjson/generic/ondemand/value-inl.h for arm64: #include "simdjson/generic/ondemand/value-inl.h" */ /* begin file include/simdjson/generic/ondemand/value-inl.h for arm64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_INL_H @@ -42291,7 +42509,7 @@ simdjson_inline simdjson_result simdjson_result +static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; +template +static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept; static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept; static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; + static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept; static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept; @@ -44954,7 +45181,7 @@ static inline void log_error(const value_iterator &iter, const char *error, cons #endif // SIMDJSON_GENERIC_ONDEMAND_LOGGER_H /* end file include/simdjson/generic/ondemand/logger.h for fallback */ -/* including include/simdjson/generic/ondemand/token_iterator.h: #include "simdjson/generic/ondemand/token_iterator.h" */ +/* including include/simdjson/generic/ondemand/token_iterator.h for fallback: #include "simdjson/generic/ondemand/token_iterator.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H @@ -45083,8 +45310,10 @@ protected: friend class json_iterator; friend class value_iterator; friend class object; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; } // namespace ondemand @@ -45106,7 +45335,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H /* end file include/simdjson/generic/ondemand/token_iterator.h for fallback */ -/* including include/simdjson/generic/ondemand/json_iterator.h: #include "simdjson/generic/ondemand/json_iterator.h" */ +/* including include/simdjson/generic/ondemand/json_iterator.h for fallback: #include "simdjson/generic/ondemand/json_iterator.h" */ /* begin file include/simdjson/generic/ondemand/json_iterator.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H @@ -45409,8 +45638,10 @@ protected: friend class raw_json_string; friend class parser; friend class value_iterator; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; // json_iterator } // namespace ondemand @@ -45432,7 +45663,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H /* end file include/simdjson/generic/ondemand/json_iterator.h for fallback */ -/* including include/simdjson/generic/ondemand/json_type.h: #include "simdjson/generic/ondemand/json_type.h" */ +/* including include/simdjson/generic/ondemand/json_type.h for fallback: #include "simdjson/generic/ondemand/json_type.h" */ /* begin file include/simdjson/generic/ondemand/json_type.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H @@ -45597,7 +45828,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H /* end file include/simdjson/generic/ondemand/json_type.h for fallback */ -/* including include/simdjson/generic/ondemand/raw_json_string.h: #include "simdjson/generic/ondemand/raw_json_string.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string.h for fallback: #include "simdjson/generic/ondemand/raw_json_string.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H @@ -45806,7 +46037,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H /* end file include/simdjson/generic/ondemand/raw_json_string.h for fallback */ -/* including include/simdjson/generic/ondemand/parser.h: #include "simdjson/generic/ondemand/parser.h" */ +/* including include/simdjson/generic/ondemand/parser.h for fallback: #include "simdjson/generic/ondemand/parser.h" */ /* begin file include/simdjson/generic/ondemand/parser.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_H @@ -46164,7 +46395,7 @@ public: /* end file include/simdjson/generic/ondemand/parser.h for fallback */ // All other declarations -/* including include/simdjson/generic/ondemand/array.h: #include "simdjson/generic/ondemand/array.h" */ +/* including include/simdjson/generic/ondemand/array.h for fallback: #include "simdjson/generic/ondemand/array.h" */ /* begin file include/simdjson/generic/ondemand/array.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H @@ -46366,7 +46597,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_H /* end file include/simdjson/generic/ondemand/array.h for fallback */ -/* including include/simdjson/generic/ondemand/array_iterator.h: #include "simdjson/generic/ondemand/array_iterator.h" */ +/* including include/simdjson/generic/ondemand/array_iterator.h for fallback: #include "simdjson/generic/ondemand/array_iterator.h" */ /* begin file include/simdjson/generic/ondemand/array_iterator.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H @@ -46465,7 +46696,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H /* end file include/simdjson/generic/ondemand/array_iterator.h for fallback */ -/* including include/simdjson/generic/ondemand/document.h: #include "simdjson/generic/ondemand/document.h" */ +/* including include/simdjson/generic/ondemand/document.h for fallback: #include "simdjson/generic/ondemand/document.h" */ /* begin file include/simdjson/generic/ondemand/document.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H @@ -47275,7 +47506,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H /* end file include/simdjson/generic/ondemand/document.h for fallback */ -/* including include/simdjson/generic/ondemand/document_stream.h: #include "simdjson/generic/ondemand/document_stream.h" */ +/* including include/simdjson/generic/ondemand/document_stream.h for fallback: #include "simdjson/generic/ondemand/document_stream.h" */ /* begin file include/simdjson/generic/ondemand/document_stream.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H @@ -47617,7 +47848,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H /* end file include/simdjson/generic/ondemand/document_stream.h for fallback */ -/* including include/simdjson/generic/ondemand/field.h: #include "simdjson/generic/ondemand/field.h" */ +/* including include/simdjson/generic/ondemand/field.h for fallback: #include "simdjson/generic/ondemand/field.h" */ /* begin file include/simdjson/generic/ondemand/field.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_H @@ -47702,7 +47933,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_FIELD_H /* end file include/simdjson/generic/ondemand/field.h for fallback */ -/* including include/simdjson/generic/ondemand/object.h: #include "simdjson/generic/ondemand/object.h" */ +/* including include/simdjson/generic/ondemand/object.h for fallback: #include "simdjson/generic/ondemand/object.h" */ /* begin file include/simdjson/generic/ondemand/object.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_H @@ -47944,7 +48175,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_H /* end file include/simdjson/generic/ondemand/object.h for fallback */ -/* including include/simdjson/generic/ondemand/object_iterator.h: #include "simdjson/generic/ondemand/object_iterator.h" */ +/* including include/simdjson/generic/ondemand/object_iterator.h for fallback: #include "simdjson/generic/ondemand/object_iterator.h" */ /* begin file include/simdjson/generic/ondemand/object_iterator.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H @@ -48027,7 +48258,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H /* end file include/simdjson/generic/ondemand/object_iterator.h for fallback */ -/* including include/simdjson/generic/ondemand/serialization.h: #include "simdjson/generic/ondemand/serialization.h" */ +/* including include/simdjson/generic/ondemand/serialization.h for fallback: #include "simdjson/generic/ondemand/serialization.h" */ /* begin file include/simdjson/generic/ondemand/serialization.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_H @@ -48135,7 +48366,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result simdjson_result &simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/array_iterator-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/document-inl.h: #include "simdjson/generic/ondemand/document-inl.h" */ +/* including include/simdjson/generic/ondemand/document-inl.h for fallback: #include "simdjson/generic/ondemand/document-inl.h" */ /* begin file include/simdjson/generic/ondemand/document-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_INL_H @@ -49271,7 +49502,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_r #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_INL_H /* end file include/simdjson/generic/ondemand/document_stream-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/field-inl.h: #include "simdjson/generic/ondemand/field-inl.h" */ +/* including include/simdjson/generic/ondemand/field-inl.h for fallback: #include "simdjson/generic/ondemand/field-inl.h" */ /* begin file include/simdjson/generic/ondemand/field-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_INL_H @@ -49791,7 +50022,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_res #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/json_iterator-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/json_type-inl.h: #include "simdjson/generic/ondemand/json_type-inl.h" */ +/* including include/simdjson/generic/ondemand/json_type-inl.h for fallback: #include "simdjson/generic/ondemand/json_type-inl.h" */ /* begin file include/simdjson/generic/ondemand/json_type-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H @@ -50323,7 +50554,7 @@ simdjson_inline simdjson_result::simdjson_result( #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H /* end file include/simdjson/generic/ondemand/json_type-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/logger-inl.h: #include "simdjson/generic/ondemand/logger-inl.h" */ +/* including include/simdjson/generic/ondemand/logger-inl.h for fallback: #include "simdjson/generic/ondemand/logger-inl.h" */ /* begin file include/simdjson/generic/ondemand/logger-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_INL_H @@ -50355,36 +50586,70 @@ static inline char printable_char(char c) { } } +template +static inline std::string string_format(const std::string& format, const Args&... args) +{ + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; + auto size = static_cast(size_s); + if (size <= 0) return std::string(); + std::unique_ptr buf(new char[size]); + std::snprintf(buf.get(), size, format.c_str(), args...); + SIMDJSON_POP_DISABLE_WARNINGS + return std::string(buf.get(), buf.get() + size - 1); +} + +static inline log_level get_log_level_from_env() +{ + SIMDJSON_PUSH_DISABLE_WARNINGS + SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe + char *lvl = getenv("SIMDJSON_LOG_LEVEL"); + SIMDJSON_POP_DISABLE_WARNINGS + if (lvl && simdjson_strcasecmp(lvl, "ERROR") == 0) { return log_level::error; } + return log_level::info; +} + +static inline log_level log_threshold() +{ + static log_level threshold = get_log_level_from_env(); + return threshold; +} + +static inline bool should_log(log_level level) +{ + return level >= log_threshold(); +} + inline void log_event(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "", type, detail); + log_line(iter, index, depth, "", type, detail, log_level::info); } inline void log_value(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "+", type, detail); + log_line(iter, index, depth, "+", type, detail, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_start_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { - log_line(iter, "+", type, "", delta, depth_delta); + log_line(iter, "+", type, "", delta, depth_delta, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_end_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { if (LOG_ENABLED) { log_depth--; } - log_line(iter, "-", type, "", delta, depth_delta); + log_line(iter, "-", type, "", delta, depth_delta, log_level::info); } inline void log_error(const json_iterator &iter, const char *error, const char *detail, int delta, int depth_delta) noexcept { - log_line(iter, "ERROR: ", error, detail, delta, depth_delta); + log_line(iter, "ERROR: ", error, detail, delta, depth_delta, log_level::error); } inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail) noexcept { - log_line(iter, index, depth, "ERROR: ", error, detail); + log_line(iter, index, depth, "ERROR: ", error, detail, log_level::error); } inline void log_event(const value_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { @@ -50409,96 +50674,101 @@ inline void log_error(const value_iterator &iter, const char *error, const char inline void log_headers() noexcept { if (LOG_ENABLED) { - // Technically a static variable is not thread-safe, but if you are using threads - // and logging... well... - static bool displayed_hint{false}; - log_depth = 0; - printf("\n"); - if(!displayed_hint) { - // We only print this helpful header once. - printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); - printf("# +array says 'this is where we were when we discovered the start array'\n"); - printf("# -array says 'this is where we were when we ended the array'\n"); - printf("# skip says 'this is a structural or value I am skipping'\n"); - printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); - printf("#\n"); - printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); - printf("# in addition to the depth being displayed.\n"); - printf("#\n"); - printf("# Every token in the document has a single depth determined by the tokens before it,\n"); - printf("# and is not affected by what the token actually is.\n"); - printf("#\n"); - printf("# Not all structural elements are presented as tokens in the logs.\n"); - printf("#\n"); - printf("# We never give control to the user within an empty array or an empty object.\n"); - printf("#\n"); - printf("# Inside an array, having a depth greater than the array's depth means that\n"); - printf("# we are pointing inside a value.\n"); - printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); - printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); - displayed_hint = true; - } - printf("\n"); - printf("| %-*s ", LOG_EVENT_LEN, "Event"); - printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); - printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); - // printf("| %-*s ", 5, "Next#"); - printf("| %-*s ", 5, "Depth"); - printf("| Detail "); - printf("|\n"); + if (simdjson_unlikely(should_log(log_level::info))) { + // Technically a static variable is not thread-safe, but if you are using threads and logging... well... + static bool displayed_hint{false}; + log_depth = 0; + printf("\n"); + if (!displayed_hint) { + // We only print this helpful header once. + printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); + printf("# +array says 'this is where we were when we discovered the start array'\n"); + printf( + "# -array says 'this is where we were when we ended the array'\n"); + printf("# skip says 'this is a structural or value I am skipping'\n"); + printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); + printf("#\n"); + printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); + printf("# in addition to the depth being displayed.\n"); + printf("#\n"); + printf("# Every token in the document has a single depth determined by the tokens before it,\n"); + printf("# and is not affected by what the token actually is.\n"); + printf("#\n"); + printf("# Not all structural elements are presented as tokens in the logs.\n"); + printf("#\n"); + printf("# We never give control to the user within an empty array or an empty object.\n"); + printf("#\n"); + printf("# Inside an array, having a depth greater than the array's depth means that\n"); + printf("# we are pointing inside a value.\n"); + printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); + printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); + displayed_hint = true; + } + printf("\n"); + printf("| %-*s ", LOG_EVENT_LEN, "Event"); + printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); + printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); + // printf("| %-*s ", 5, "Next#"); + printf("| %-*s ", 5, "Depth"); + printf("| Detail "); + printf("|\n"); - printf("|%.*s", LOG_EVENT_LEN+2, DASHES); - printf("|%.*s", LOG_BUFFER_LEN+2, DASHES); - printf("|%.*s", LOG_SMALL_BUFFER_LEN+2, DASHES); - // printf("|%.*s", 5+2, DASHES); - printf("|%.*s", 5+2, DASHES); - printf("|--------"); - printf("|\n"); - fflush(stdout); + printf("|%.*s", LOG_EVENT_LEN + 2, DASHES); + printf("|%.*s", LOG_BUFFER_LEN + 2, DASHES); + printf("|%.*s", LOG_SMALL_BUFFER_LEN + 2, DASHES); + // printf("|%.*s", 5+2, DASHES); + printf("|%.*s", 5 + 2, DASHES); + printf("|--------"); + printf("|\n"); + fflush(stdout); + } } } -inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail); +template +inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level, Args&&... args) noexcept { + log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail, level, std::forward(args)...); } -inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept { + +template +inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level, Args&&... args) noexcept { if (LOG_ENABLED) { - const int indent = depth*2; - const auto buf = iter.token.buf; - printf("| %*s%s%-*s ", - indent, "", - title_prefix, - LOG_EVENT_LEN - indent - int(strlen(title_prefix)), title - ); - { - // Print the current structural. - printf("| "); - // Before we begin, the index might point right before the document. - // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 - if(index < iter._root) { - printf("%*s", LOG_BUFFER_LEN, ""); - } else { - auto current_structural = &buf[*index]; - for (int i=0;i(args)...); + printf("| %*s%s%-*s ", indent, "", title_prefix, + LOG_EVENT_LEN - indent - int(strlen(title_prefix)), msg.c_str()); + { + // Print the current structural. + printf("| "); + // Before we begin, the index might point right before the document. + // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 + if (index < iter._root) { + printf("%*s", LOG_BUFFER_LEN, ""); + } else { + auto current_structural = &buf[*index]; + for (int i = 0; i < LOG_BUFFER_LEN; i++) { printf("%c", printable_char(current_structural[i])); + } } + printf(" "); } - printf(" "); - } - { - // Print the next structural. - printf("| "); - auto next_structural = &buf[*(index+1)]; - for (int i=0;i object::find_field_unordered(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field_unordered(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::operator[](const std::string_view key) & noexcept { @@ -50549,13 +50825,19 @@ simdjson_inline simdjson_result object::operator[](const std::string_view simdjson_inline simdjson_result object::find_field(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } @@ -50760,7 +51042,7 @@ simdjson_inline simdjson_result simdjson_result &simdjson_r #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/object_iterator-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/parser-inl.h: #include "simdjson/generic/ondemand/parser-inl.h" */ +/* including include/simdjson/generic/ondemand/parser-inl.h for fallback: #include "simdjson/generic/ondemand/parser-inl.h" */ /* begin file include/simdjson/generic/ondemand/parser-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H @@ -51066,7 +51348,7 @@ simdjson_inline simdjson_result::simdjson_result(err #endif // SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H /* end file include/simdjson/generic/ondemand/parser-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/raw_json_string-inl.h: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string-inl.h for fallback: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H @@ -51272,7 +51554,7 @@ simdjson_inline simdjson_warn_unused simdjson_result simdjson_ #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H /* end file include/simdjson/generic/ondemand/raw_json_string-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/serialization-inl.h: #include "simdjson/generic/ondemand/serialization-inl.h" */ +/* including include/simdjson/generic/ondemand/serialization-inl.h for fallback: #include "simdjson/generic/ondemand/serialization-inl.h" */ /* begin file include/simdjson/generic/ondemand/serialization-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H @@ -51508,7 +51790,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::fallback::ondemand: #endif // SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H /* end file include/simdjson/generic/ondemand/serialization-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/token_iterator-inl.h: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ +/* including include/simdjson/generic/ondemand/token_iterator-inl.h for fallback: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H @@ -51600,7 +51882,7 @@ simdjson_inline simdjson_result::simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/token_iterator-inl.h for fallback */ -/* including include/simdjson/generic/ondemand/value-inl.h: #include "simdjson/generic/ondemand/value-inl.h" */ +/* including include/simdjson/generic/ondemand/value-inl.h for fallback: #include "simdjson/generic/ondemand/value-inl.h" */ /* begin file include/simdjson/generic/ondemand/value-inl.h for fallback */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_INL_H @@ -52042,7 +52324,7 @@ simdjson_inline simdjson_result simdjson_result +static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; +template +static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept; static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept; static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; + static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept; static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept; @@ -56640,7 +56931,7 @@ static inline void log_error(const value_iterator &iter, const char *error, cons #endif // SIMDJSON_GENERIC_ONDEMAND_LOGGER_H /* end file include/simdjson/generic/ondemand/logger.h for haswell */ -/* including include/simdjson/generic/ondemand/token_iterator.h: #include "simdjson/generic/ondemand/token_iterator.h" */ +/* including include/simdjson/generic/ondemand/token_iterator.h for haswell: #include "simdjson/generic/ondemand/token_iterator.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H @@ -56769,8 +57060,10 @@ protected: friend class json_iterator; friend class value_iterator; friend class object; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; } // namespace ondemand @@ -56792,7 +57085,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H /* end file include/simdjson/generic/ondemand/token_iterator.h for haswell */ -/* including include/simdjson/generic/ondemand/json_iterator.h: #include "simdjson/generic/ondemand/json_iterator.h" */ +/* including include/simdjson/generic/ondemand/json_iterator.h for haswell: #include "simdjson/generic/ondemand/json_iterator.h" */ /* begin file include/simdjson/generic/ondemand/json_iterator.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H @@ -57095,8 +57388,10 @@ protected: friend class raw_json_string; friend class parser; friend class value_iterator; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; // json_iterator } // namespace ondemand @@ -57118,7 +57413,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H /* end file include/simdjson/generic/ondemand/json_iterator.h for haswell */ -/* including include/simdjson/generic/ondemand/json_type.h: #include "simdjson/generic/ondemand/json_type.h" */ +/* including include/simdjson/generic/ondemand/json_type.h for haswell: #include "simdjson/generic/ondemand/json_type.h" */ /* begin file include/simdjson/generic/ondemand/json_type.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H @@ -57283,7 +57578,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H /* end file include/simdjson/generic/ondemand/json_type.h for haswell */ -/* including include/simdjson/generic/ondemand/raw_json_string.h: #include "simdjson/generic/ondemand/raw_json_string.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string.h for haswell: #include "simdjson/generic/ondemand/raw_json_string.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H @@ -57492,7 +57787,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H /* end file include/simdjson/generic/ondemand/raw_json_string.h for haswell */ -/* including include/simdjson/generic/ondemand/parser.h: #include "simdjson/generic/ondemand/parser.h" */ +/* including include/simdjson/generic/ondemand/parser.h for haswell: #include "simdjson/generic/ondemand/parser.h" */ /* begin file include/simdjson/generic/ondemand/parser.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_H @@ -57850,7 +58145,7 @@ public: /* end file include/simdjson/generic/ondemand/parser.h for haswell */ // All other declarations -/* including include/simdjson/generic/ondemand/array.h: #include "simdjson/generic/ondemand/array.h" */ +/* including include/simdjson/generic/ondemand/array.h for haswell: #include "simdjson/generic/ondemand/array.h" */ /* begin file include/simdjson/generic/ondemand/array.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H @@ -58052,7 +58347,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_H /* end file include/simdjson/generic/ondemand/array.h for haswell */ -/* including include/simdjson/generic/ondemand/array_iterator.h: #include "simdjson/generic/ondemand/array_iterator.h" */ +/* including include/simdjson/generic/ondemand/array_iterator.h for haswell: #include "simdjson/generic/ondemand/array_iterator.h" */ /* begin file include/simdjson/generic/ondemand/array_iterator.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H @@ -58151,7 +58446,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H /* end file include/simdjson/generic/ondemand/array_iterator.h for haswell */ -/* including include/simdjson/generic/ondemand/document.h: #include "simdjson/generic/ondemand/document.h" */ +/* including include/simdjson/generic/ondemand/document.h for haswell: #include "simdjson/generic/ondemand/document.h" */ /* begin file include/simdjson/generic/ondemand/document.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H @@ -58961,7 +59256,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H /* end file include/simdjson/generic/ondemand/document.h for haswell */ -/* including include/simdjson/generic/ondemand/document_stream.h: #include "simdjson/generic/ondemand/document_stream.h" */ +/* including include/simdjson/generic/ondemand/document_stream.h for haswell: #include "simdjson/generic/ondemand/document_stream.h" */ /* begin file include/simdjson/generic/ondemand/document_stream.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H @@ -59303,7 +59598,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H /* end file include/simdjson/generic/ondemand/document_stream.h for haswell */ -/* including include/simdjson/generic/ondemand/field.h: #include "simdjson/generic/ondemand/field.h" */ +/* including include/simdjson/generic/ondemand/field.h for haswell: #include "simdjson/generic/ondemand/field.h" */ /* begin file include/simdjson/generic/ondemand/field.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_H @@ -59388,7 +59683,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_FIELD_H /* end file include/simdjson/generic/ondemand/field.h for haswell */ -/* including include/simdjson/generic/ondemand/object.h: #include "simdjson/generic/ondemand/object.h" */ +/* including include/simdjson/generic/ondemand/object.h for haswell: #include "simdjson/generic/ondemand/object.h" */ /* begin file include/simdjson/generic/ondemand/object.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_H @@ -59630,7 +59925,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_H /* end file include/simdjson/generic/ondemand/object.h for haswell */ -/* including include/simdjson/generic/ondemand/object_iterator.h: #include "simdjson/generic/ondemand/object_iterator.h" */ +/* including include/simdjson/generic/ondemand/object_iterator.h for haswell: #include "simdjson/generic/ondemand/object_iterator.h" */ /* begin file include/simdjson/generic/ondemand/object_iterator.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H @@ -59713,7 +60008,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H /* end file include/simdjson/generic/ondemand/object_iterator.h for haswell */ -/* including include/simdjson/generic/ondemand/serialization.h: #include "simdjson/generic/ondemand/serialization.h" */ +/* including include/simdjson/generic/ondemand/serialization.h for haswell: #include "simdjson/generic/ondemand/serialization.h" */ /* begin file include/simdjson/generic/ondemand/serialization.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_H @@ -59821,7 +60116,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result simdjson_result &simdjson_res #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/array_iterator-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/document-inl.h: #include "simdjson/generic/ondemand/document-inl.h" */ +/* including include/simdjson/generic/ondemand/document-inl.h for haswell: #include "simdjson/generic/ondemand/document-inl.h" */ /* begin file include/simdjson/generic/ondemand/document-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_INL_H @@ -60957,7 +61252,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_INL_H /* end file include/simdjson/generic/ondemand/document_stream-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/field-inl.h: #include "simdjson/generic/ondemand/field-inl.h" */ +/* including include/simdjson/generic/ondemand/field-inl.h for haswell: #include "simdjson/generic/ondemand/field-inl.h" */ /* begin file include/simdjson/generic/ondemand/field-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_INL_H @@ -61477,7 +61772,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_resu #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/json_iterator-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/json_type-inl.h: #include "simdjson/generic/ondemand/json_type-inl.h" */ +/* including include/simdjson/generic/ondemand/json_type-inl.h for haswell: #include "simdjson/generic/ondemand/json_type-inl.h" */ /* begin file include/simdjson/generic/ondemand/json_type-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H @@ -62009,7 +62304,7 @@ simdjson_inline simdjson_result::simdjson_result(e #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H /* end file include/simdjson/generic/ondemand/json_type-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/logger-inl.h: #include "simdjson/generic/ondemand/logger-inl.h" */ +/* including include/simdjson/generic/ondemand/logger-inl.h for haswell: #include "simdjson/generic/ondemand/logger-inl.h" */ /* begin file include/simdjson/generic/ondemand/logger-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_INL_H @@ -62041,36 +62336,70 @@ static inline char printable_char(char c) { } } +template +static inline std::string string_format(const std::string& format, const Args&... args) +{ + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; + auto size = static_cast(size_s); + if (size <= 0) return std::string(); + std::unique_ptr buf(new char[size]); + std::snprintf(buf.get(), size, format.c_str(), args...); + SIMDJSON_POP_DISABLE_WARNINGS + return std::string(buf.get(), buf.get() + size - 1); +} + +static inline log_level get_log_level_from_env() +{ + SIMDJSON_PUSH_DISABLE_WARNINGS + SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe + char *lvl = getenv("SIMDJSON_LOG_LEVEL"); + SIMDJSON_POP_DISABLE_WARNINGS + if (lvl && simdjson_strcasecmp(lvl, "ERROR") == 0) { return log_level::error; } + return log_level::info; +} + +static inline log_level log_threshold() +{ + static log_level threshold = get_log_level_from_env(); + return threshold; +} + +static inline bool should_log(log_level level) +{ + return level >= log_threshold(); +} + inline void log_event(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "", type, detail); + log_line(iter, index, depth, "", type, detail, log_level::info); } inline void log_value(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "+", type, detail); + log_line(iter, index, depth, "+", type, detail, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_start_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { - log_line(iter, "+", type, "", delta, depth_delta); + log_line(iter, "+", type, "", delta, depth_delta, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_end_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { if (LOG_ENABLED) { log_depth--; } - log_line(iter, "-", type, "", delta, depth_delta); + log_line(iter, "-", type, "", delta, depth_delta, log_level::info); } inline void log_error(const json_iterator &iter, const char *error, const char *detail, int delta, int depth_delta) noexcept { - log_line(iter, "ERROR: ", error, detail, delta, depth_delta); + log_line(iter, "ERROR: ", error, detail, delta, depth_delta, log_level::error); } inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail) noexcept { - log_line(iter, index, depth, "ERROR: ", error, detail); + log_line(iter, index, depth, "ERROR: ", error, detail, log_level::error); } inline void log_event(const value_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { @@ -62095,96 +62424,101 @@ inline void log_error(const value_iterator &iter, const char *error, const char inline void log_headers() noexcept { if (LOG_ENABLED) { - // Technically a static variable is not thread-safe, but if you are using threads - // and logging... well... - static bool displayed_hint{false}; - log_depth = 0; - printf("\n"); - if(!displayed_hint) { - // We only print this helpful header once. - printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); - printf("# +array says 'this is where we were when we discovered the start array'\n"); - printf("# -array says 'this is where we were when we ended the array'\n"); - printf("# skip says 'this is a structural or value I am skipping'\n"); - printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); - printf("#\n"); - printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); - printf("# in addition to the depth being displayed.\n"); - printf("#\n"); - printf("# Every token in the document has a single depth determined by the tokens before it,\n"); - printf("# and is not affected by what the token actually is.\n"); - printf("#\n"); - printf("# Not all structural elements are presented as tokens in the logs.\n"); - printf("#\n"); - printf("# We never give control to the user within an empty array or an empty object.\n"); - printf("#\n"); - printf("# Inside an array, having a depth greater than the array's depth means that\n"); - printf("# we are pointing inside a value.\n"); - printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); - printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); - displayed_hint = true; - } - printf("\n"); - printf("| %-*s ", LOG_EVENT_LEN, "Event"); - printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); - printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); - // printf("| %-*s ", 5, "Next#"); - printf("| %-*s ", 5, "Depth"); - printf("| Detail "); - printf("|\n"); + if (simdjson_unlikely(should_log(log_level::info))) { + // Technically a static variable is not thread-safe, but if you are using threads and logging... well... + static bool displayed_hint{false}; + log_depth = 0; + printf("\n"); + if (!displayed_hint) { + // We only print this helpful header once. + printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); + printf("# +array says 'this is where we were when we discovered the start array'\n"); + printf( + "# -array says 'this is where we were when we ended the array'\n"); + printf("# skip says 'this is a structural or value I am skipping'\n"); + printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); + printf("#\n"); + printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); + printf("# in addition to the depth being displayed.\n"); + printf("#\n"); + printf("# Every token in the document has a single depth determined by the tokens before it,\n"); + printf("# and is not affected by what the token actually is.\n"); + printf("#\n"); + printf("# Not all structural elements are presented as tokens in the logs.\n"); + printf("#\n"); + printf("# We never give control to the user within an empty array or an empty object.\n"); + printf("#\n"); + printf("# Inside an array, having a depth greater than the array's depth means that\n"); + printf("# we are pointing inside a value.\n"); + printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); + printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); + displayed_hint = true; + } + printf("\n"); + printf("| %-*s ", LOG_EVENT_LEN, "Event"); + printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); + printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); + // printf("| %-*s ", 5, "Next#"); + printf("| %-*s ", 5, "Depth"); + printf("| Detail "); + printf("|\n"); - printf("|%.*s", LOG_EVENT_LEN+2, DASHES); - printf("|%.*s", LOG_BUFFER_LEN+2, DASHES); - printf("|%.*s", LOG_SMALL_BUFFER_LEN+2, DASHES); - // printf("|%.*s", 5+2, DASHES); - printf("|%.*s", 5+2, DASHES); - printf("|--------"); - printf("|\n"); - fflush(stdout); + printf("|%.*s", LOG_EVENT_LEN + 2, DASHES); + printf("|%.*s", LOG_BUFFER_LEN + 2, DASHES); + printf("|%.*s", LOG_SMALL_BUFFER_LEN + 2, DASHES); + // printf("|%.*s", 5+2, DASHES); + printf("|%.*s", 5 + 2, DASHES); + printf("|--------"); + printf("|\n"); + fflush(stdout); + } } } -inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail); +template +inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level, Args&&... args) noexcept { + log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail, level, std::forward(args)...); } -inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept { + +template +inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level, Args&&... args) noexcept { if (LOG_ENABLED) { - const int indent = depth*2; - const auto buf = iter.token.buf; - printf("| %*s%s%-*s ", - indent, "", - title_prefix, - LOG_EVENT_LEN - indent - int(strlen(title_prefix)), title - ); - { - // Print the current structural. - printf("| "); - // Before we begin, the index might point right before the document. - // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 - if(index < iter._root) { - printf("%*s", LOG_BUFFER_LEN, ""); - } else { - auto current_structural = &buf[*index]; - for (int i=0;i(args)...); + printf("| %*s%s%-*s ", indent, "", title_prefix, + LOG_EVENT_LEN - indent - int(strlen(title_prefix)), msg.c_str()); + { + // Print the current structural. + printf("| "); + // Before we begin, the index might point right before the document. + // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 + if (index < iter._root) { + printf("%*s", LOG_BUFFER_LEN, ""); + } else { + auto current_structural = &buf[*index]; + for (int i = 0; i < LOG_BUFFER_LEN; i++) { printf("%c", printable_char(current_structural[i])); + } } + printf(" "); } - printf(" "); - } - { - // Print the next structural. - printf("| "); - auto next_structural = &buf[*(index+1)]; - for (int i=0;i object::find_field_unordered(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field_unordered(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::operator[](const std::string_view key) & noexcept { @@ -62235,13 +62575,19 @@ simdjson_inline simdjson_result object::operator[](const std::string_view simdjson_inline simdjson_result object::find_field(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } @@ -62446,7 +62792,7 @@ simdjson_inline simdjson_result simdjson_result &simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/object_iterator-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/parser-inl.h: #include "simdjson/generic/ondemand/parser-inl.h" */ +/* including include/simdjson/generic/ondemand/parser-inl.h for haswell: #include "simdjson/generic/ondemand/parser-inl.h" */ /* begin file include/simdjson/generic/ondemand/parser-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H @@ -62752,7 +63098,7 @@ simdjson_inline simdjson_result::simdjson_result(erro #endif // SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H /* end file include/simdjson/generic/ondemand/parser-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/raw_json_string-inl.h: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string-inl.h for haswell: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H @@ -62958,7 +63304,7 @@ simdjson_inline simdjson_warn_unused simdjson_result simdjson_ #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H /* end file include/simdjson/generic/ondemand/raw_json_string-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/serialization-inl.h: #include "simdjson/generic/ondemand/serialization-inl.h" */ +/* including include/simdjson/generic/ondemand/serialization-inl.h for haswell: #include "simdjson/generic/ondemand/serialization-inl.h" */ /* begin file include/simdjson/generic/ondemand/serialization-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H @@ -63194,7 +63540,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::haswell::ondemand:: #endif // SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H /* end file include/simdjson/generic/ondemand/serialization-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/token_iterator-inl.h: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ +/* including include/simdjson/generic/ondemand/token_iterator-inl.h for haswell: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H @@ -63286,7 +63632,7 @@ simdjson_inline simdjson_result::simdjson_res #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/token_iterator-inl.h for haswell */ -/* including include/simdjson/generic/ondemand/value-inl.h: #include "simdjson/generic/ondemand/value-inl.h" */ +/* including include/simdjson/generic/ondemand/value-inl.h for haswell: #include "simdjson/generic/ondemand/value-inl.h" */ /* begin file include/simdjson/generic/ondemand/value-inl.h for haswell */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_INL_H @@ -63728,7 +64074,7 @@ simdjson_inline simdjson_result simdjson_result +static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; +template +static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept; static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept; static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; + static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept; static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept; @@ -68123,7 +68478,7 @@ static inline void log_error(const value_iterator &iter, const char *error, cons #endif // SIMDJSON_GENERIC_ONDEMAND_LOGGER_H /* end file include/simdjson/generic/ondemand/logger.h for icelake */ -/* including include/simdjson/generic/ondemand/token_iterator.h: #include "simdjson/generic/ondemand/token_iterator.h" */ +/* including include/simdjson/generic/ondemand/token_iterator.h for icelake: #include "simdjson/generic/ondemand/token_iterator.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H @@ -68252,8 +68607,10 @@ protected: friend class json_iterator; friend class value_iterator; friend class object; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; } // namespace ondemand @@ -68275,7 +68632,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H /* end file include/simdjson/generic/ondemand/token_iterator.h for icelake */ -/* including include/simdjson/generic/ondemand/json_iterator.h: #include "simdjson/generic/ondemand/json_iterator.h" */ +/* including include/simdjson/generic/ondemand/json_iterator.h for icelake: #include "simdjson/generic/ondemand/json_iterator.h" */ /* begin file include/simdjson/generic/ondemand/json_iterator.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H @@ -68578,8 +68935,10 @@ protected: friend class raw_json_string; friend class parser; friend class value_iterator; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; // json_iterator } // namespace ondemand @@ -68601,7 +68960,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H /* end file include/simdjson/generic/ondemand/json_iterator.h for icelake */ -/* including include/simdjson/generic/ondemand/json_type.h: #include "simdjson/generic/ondemand/json_type.h" */ +/* including include/simdjson/generic/ondemand/json_type.h for icelake: #include "simdjson/generic/ondemand/json_type.h" */ /* begin file include/simdjson/generic/ondemand/json_type.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H @@ -68766,7 +69125,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H /* end file include/simdjson/generic/ondemand/json_type.h for icelake */ -/* including include/simdjson/generic/ondemand/raw_json_string.h: #include "simdjson/generic/ondemand/raw_json_string.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string.h for icelake: #include "simdjson/generic/ondemand/raw_json_string.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H @@ -68975,7 +69334,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H /* end file include/simdjson/generic/ondemand/raw_json_string.h for icelake */ -/* including include/simdjson/generic/ondemand/parser.h: #include "simdjson/generic/ondemand/parser.h" */ +/* including include/simdjson/generic/ondemand/parser.h for icelake: #include "simdjson/generic/ondemand/parser.h" */ /* begin file include/simdjson/generic/ondemand/parser.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_H @@ -69333,7 +69692,7 @@ public: /* end file include/simdjson/generic/ondemand/parser.h for icelake */ // All other declarations -/* including include/simdjson/generic/ondemand/array.h: #include "simdjson/generic/ondemand/array.h" */ +/* including include/simdjson/generic/ondemand/array.h for icelake: #include "simdjson/generic/ondemand/array.h" */ /* begin file include/simdjson/generic/ondemand/array.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H @@ -69535,7 +69894,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_H /* end file include/simdjson/generic/ondemand/array.h for icelake */ -/* including include/simdjson/generic/ondemand/array_iterator.h: #include "simdjson/generic/ondemand/array_iterator.h" */ +/* including include/simdjson/generic/ondemand/array_iterator.h for icelake: #include "simdjson/generic/ondemand/array_iterator.h" */ /* begin file include/simdjson/generic/ondemand/array_iterator.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H @@ -69634,7 +69993,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H /* end file include/simdjson/generic/ondemand/array_iterator.h for icelake */ -/* including include/simdjson/generic/ondemand/document.h: #include "simdjson/generic/ondemand/document.h" */ +/* including include/simdjson/generic/ondemand/document.h for icelake: #include "simdjson/generic/ondemand/document.h" */ /* begin file include/simdjson/generic/ondemand/document.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H @@ -70444,7 +70803,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H /* end file include/simdjson/generic/ondemand/document.h for icelake */ -/* including include/simdjson/generic/ondemand/document_stream.h: #include "simdjson/generic/ondemand/document_stream.h" */ +/* including include/simdjson/generic/ondemand/document_stream.h for icelake: #include "simdjson/generic/ondemand/document_stream.h" */ /* begin file include/simdjson/generic/ondemand/document_stream.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H @@ -70786,7 +71145,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H /* end file include/simdjson/generic/ondemand/document_stream.h for icelake */ -/* including include/simdjson/generic/ondemand/field.h: #include "simdjson/generic/ondemand/field.h" */ +/* including include/simdjson/generic/ondemand/field.h for icelake: #include "simdjson/generic/ondemand/field.h" */ /* begin file include/simdjson/generic/ondemand/field.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_H @@ -70871,7 +71230,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_FIELD_H /* end file include/simdjson/generic/ondemand/field.h for icelake */ -/* including include/simdjson/generic/ondemand/object.h: #include "simdjson/generic/ondemand/object.h" */ +/* including include/simdjson/generic/ondemand/object.h for icelake: #include "simdjson/generic/ondemand/object.h" */ /* begin file include/simdjson/generic/ondemand/object.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_H @@ -71113,7 +71472,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_H /* end file include/simdjson/generic/ondemand/object.h for icelake */ -/* including include/simdjson/generic/ondemand/object_iterator.h: #include "simdjson/generic/ondemand/object_iterator.h" */ +/* including include/simdjson/generic/ondemand/object_iterator.h for icelake: #include "simdjson/generic/ondemand/object_iterator.h" */ /* begin file include/simdjson/generic/ondemand/object_iterator.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H @@ -71196,7 +71555,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H /* end file include/simdjson/generic/ondemand/object_iterator.h for icelake */ -/* including include/simdjson/generic/ondemand/serialization.h: #include "simdjson/generic/ondemand/serialization.h" */ +/* including include/simdjson/generic/ondemand/serialization.h for icelake: #include "simdjson/generic/ondemand/serialization.h" */ /* begin file include/simdjson/generic/ondemand/serialization.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_H @@ -71304,7 +71663,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result simdjson_result &simdjson_res #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/array_iterator-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/document-inl.h: #include "simdjson/generic/ondemand/document-inl.h" */ +/* including include/simdjson/generic/ondemand/document-inl.h for icelake: #include "simdjson/generic/ondemand/document-inl.h" */ /* begin file include/simdjson/generic/ondemand/document-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_INL_H @@ -72440,7 +72799,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_INL_H /* end file include/simdjson/generic/ondemand/document_stream-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/field-inl.h: #include "simdjson/generic/ondemand/field-inl.h" */ +/* including include/simdjson/generic/ondemand/field-inl.h for icelake: #include "simdjson/generic/ondemand/field-inl.h" */ /* begin file include/simdjson/generic/ondemand/field-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_INL_H @@ -72960,7 +73319,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_resu #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/json_iterator-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/json_type-inl.h: #include "simdjson/generic/ondemand/json_type-inl.h" */ +/* including include/simdjson/generic/ondemand/json_type-inl.h for icelake: #include "simdjson/generic/ondemand/json_type-inl.h" */ /* begin file include/simdjson/generic/ondemand/json_type-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H @@ -73492,7 +73851,7 @@ simdjson_inline simdjson_result::simdjson_result(e #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H /* end file include/simdjson/generic/ondemand/json_type-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/logger-inl.h: #include "simdjson/generic/ondemand/logger-inl.h" */ +/* including include/simdjson/generic/ondemand/logger-inl.h for icelake: #include "simdjson/generic/ondemand/logger-inl.h" */ /* begin file include/simdjson/generic/ondemand/logger-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_INL_H @@ -73524,36 +73883,70 @@ static inline char printable_char(char c) { } } +template +static inline std::string string_format(const std::string& format, const Args&... args) +{ + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; + auto size = static_cast(size_s); + if (size <= 0) return std::string(); + std::unique_ptr buf(new char[size]); + std::snprintf(buf.get(), size, format.c_str(), args...); + SIMDJSON_POP_DISABLE_WARNINGS + return std::string(buf.get(), buf.get() + size - 1); +} + +static inline log_level get_log_level_from_env() +{ + SIMDJSON_PUSH_DISABLE_WARNINGS + SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe + char *lvl = getenv("SIMDJSON_LOG_LEVEL"); + SIMDJSON_POP_DISABLE_WARNINGS + if (lvl && simdjson_strcasecmp(lvl, "ERROR") == 0) { return log_level::error; } + return log_level::info; +} + +static inline log_level log_threshold() +{ + static log_level threshold = get_log_level_from_env(); + return threshold; +} + +static inline bool should_log(log_level level) +{ + return level >= log_threshold(); +} + inline void log_event(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "", type, detail); + log_line(iter, index, depth, "", type, detail, log_level::info); } inline void log_value(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "+", type, detail); + log_line(iter, index, depth, "+", type, detail, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_start_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { - log_line(iter, "+", type, "", delta, depth_delta); + log_line(iter, "+", type, "", delta, depth_delta, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_end_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { if (LOG_ENABLED) { log_depth--; } - log_line(iter, "-", type, "", delta, depth_delta); + log_line(iter, "-", type, "", delta, depth_delta, log_level::info); } inline void log_error(const json_iterator &iter, const char *error, const char *detail, int delta, int depth_delta) noexcept { - log_line(iter, "ERROR: ", error, detail, delta, depth_delta); + log_line(iter, "ERROR: ", error, detail, delta, depth_delta, log_level::error); } inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail) noexcept { - log_line(iter, index, depth, "ERROR: ", error, detail); + log_line(iter, index, depth, "ERROR: ", error, detail, log_level::error); } inline void log_event(const value_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { @@ -73578,96 +73971,101 @@ inline void log_error(const value_iterator &iter, const char *error, const char inline void log_headers() noexcept { if (LOG_ENABLED) { - // Technically a static variable is not thread-safe, but if you are using threads - // and logging... well... - static bool displayed_hint{false}; - log_depth = 0; - printf("\n"); - if(!displayed_hint) { - // We only print this helpful header once. - printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); - printf("# +array says 'this is where we were when we discovered the start array'\n"); - printf("# -array says 'this is where we were when we ended the array'\n"); - printf("# skip says 'this is a structural or value I am skipping'\n"); - printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); - printf("#\n"); - printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); - printf("# in addition to the depth being displayed.\n"); - printf("#\n"); - printf("# Every token in the document has a single depth determined by the tokens before it,\n"); - printf("# and is not affected by what the token actually is.\n"); - printf("#\n"); - printf("# Not all structural elements are presented as tokens in the logs.\n"); - printf("#\n"); - printf("# We never give control to the user within an empty array or an empty object.\n"); - printf("#\n"); - printf("# Inside an array, having a depth greater than the array's depth means that\n"); - printf("# we are pointing inside a value.\n"); - printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); - printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); - displayed_hint = true; - } - printf("\n"); - printf("| %-*s ", LOG_EVENT_LEN, "Event"); - printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); - printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); - // printf("| %-*s ", 5, "Next#"); - printf("| %-*s ", 5, "Depth"); - printf("| Detail "); - printf("|\n"); + if (simdjson_unlikely(should_log(log_level::info))) { + // Technically a static variable is not thread-safe, but if you are using threads and logging... well... + static bool displayed_hint{false}; + log_depth = 0; + printf("\n"); + if (!displayed_hint) { + // We only print this helpful header once. + printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); + printf("# +array says 'this is where we were when we discovered the start array'\n"); + printf( + "# -array says 'this is where we were when we ended the array'\n"); + printf("# skip says 'this is a structural or value I am skipping'\n"); + printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); + printf("#\n"); + printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); + printf("# in addition to the depth being displayed.\n"); + printf("#\n"); + printf("# Every token in the document has a single depth determined by the tokens before it,\n"); + printf("# and is not affected by what the token actually is.\n"); + printf("#\n"); + printf("# Not all structural elements are presented as tokens in the logs.\n"); + printf("#\n"); + printf("# We never give control to the user within an empty array or an empty object.\n"); + printf("#\n"); + printf("# Inside an array, having a depth greater than the array's depth means that\n"); + printf("# we are pointing inside a value.\n"); + printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); + printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); + displayed_hint = true; + } + printf("\n"); + printf("| %-*s ", LOG_EVENT_LEN, "Event"); + printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); + printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); + // printf("| %-*s ", 5, "Next#"); + printf("| %-*s ", 5, "Depth"); + printf("| Detail "); + printf("|\n"); - printf("|%.*s", LOG_EVENT_LEN+2, DASHES); - printf("|%.*s", LOG_BUFFER_LEN+2, DASHES); - printf("|%.*s", LOG_SMALL_BUFFER_LEN+2, DASHES); - // printf("|%.*s", 5+2, DASHES); - printf("|%.*s", 5+2, DASHES); - printf("|--------"); - printf("|\n"); - fflush(stdout); + printf("|%.*s", LOG_EVENT_LEN + 2, DASHES); + printf("|%.*s", LOG_BUFFER_LEN + 2, DASHES); + printf("|%.*s", LOG_SMALL_BUFFER_LEN + 2, DASHES); + // printf("|%.*s", 5+2, DASHES); + printf("|%.*s", 5 + 2, DASHES); + printf("|--------"); + printf("|\n"); + fflush(stdout); + } } } -inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail); +template +inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level, Args&&... args) noexcept { + log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail, level, std::forward(args)...); } -inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept { + +template +inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level, Args&&... args) noexcept { if (LOG_ENABLED) { - const int indent = depth*2; - const auto buf = iter.token.buf; - printf("| %*s%s%-*s ", - indent, "", - title_prefix, - LOG_EVENT_LEN - indent - int(strlen(title_prefix)), title - ); - { - // Print the current structural. - printf("| "); - // Before we begin, the index might point right before the document. - // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 - if(index < iter._root) { - printf("%*s", LOG_BUFFER_LEN, ""); - } else { - auto current_structural = &buf[*index]; - for (int i=0;i(args)...); + printf("| %*s%s%-*s ", indent, "", title_prefix, + LOG_EVENT_LEN - indent - int(strlen(title_prefix)), msg.c_str()); + { + // Print the current structural. + printf("| "); + // Before we begin, the index might point right before the document. + // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 + if (index < iter._root) { + printf("%*s", LOG_BUFFER_LEN, ""); + } else { + auto current_structural = &buf[*index]; + for (int i = 0; i < LOG_BUFFER_LEN; i++) { printf("%c", printable_char(current_structural[i])); + } } + printf(" "); } - printf(" "); - } - { - // Print the next structural. - printf("| "); - auto next_structural = &buf[*(index+1)]; - for (int i=0;i object::find_field_unordered(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field_unordered(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::operator[](const std::string_view key) & noexcept { @@ -73718,13 +74122,19 @@ simdjson_inline simdjson_result object::operator[](const std::string_view simdjson_inline simdjson_result object::find_field(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } @@ -73929,7 +74339,7 @@ simdjson_inline simdjson_result simdjson_result &simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/object_iterator-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/parser-inl.h: #include "simdjson/generic/ondemand/parser-inl.h" */ +/* including include/simdjson/generic/ondemand/parser-inl.h for icelake: #include "simdjson/generic/ondemand/parser-inl.h" */ /* begin file include/simdjson/generic/ondemand/parser-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H @@ -74235,7 +74645,7 @@ simdjson_inline simdjson_result::simdjson_result(erro #endif // SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H /* end file include/simdjson/generic/ondemand/parser-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/raw_json_string-inl.h: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string-inl.h for icelake: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H @@ -74441,7 +74851,7 @@ simdjson_inline simdjson_warn_unused simdjson_result simdjson_ #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H /* end file include/simdjson/generic/ondemand/raw_json_string-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/serialization-inl.h: #include "simdjson/generic/ondemand/serialization-inl.h" */ +/* including include/simdjson/generic/ondemand/serialization-inl.h for icelake: #include "simdjson/generic/ondemand/serialization-inl.h" */ /* begin file include/simdjson/generic/ondemand/serialization-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H @@ -74677,7 +75087,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::icelake::ondemand:: #endif // SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H /* end file include/simdjson/generic/ondemand/serialization-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/token_iterator-inl.h: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ +/* including include/simdjson/generic/ondemand/token_iterator-inl.h for icelake: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H @@ -74769,7 +75179,7 @@ simdjson_inline simdjson_result::simdjson_res #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/token_iterator-inl.h for icelake */ -/* including include/simdjson/generic/ondemand/value-inl.h: #include "simdjson/generic/ondemand/value-inl.h" */ +/* including include/simdjson/generic/ondemand/value-inl.h for icelake: #include "simdjson/generic/ondemand/value-inl.h" */ /* begin file include/simdjson/generic/ondemand/value-inl.h for icelake */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_INL_H @@ -75211,7 +75621,7 @@ simdjson_inline simdjson_result simdjson_result +static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; +template +static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept; static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept; static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; + static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept; static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept; @@ -79506,7 +79925,7 @@ static inline void log_error(const value_iterator &iter, const char *error, cons #endif // SIMDJSON_GENERIC_ONDEMAND_LOGGER_H /* end file include/simdjson/generic/ondemand/logger.h for ppc64 */ -/* including include/simdjson/generic/ondemand/token_iterator.h: #include "simdjson/generic/ondemand/token_iterator.h" */ +/* including include/simdjson/generic/ondemand/token_iterator.h for ppc64: #include "simdjson/generic/ondemand/token_iterator.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H @@ -79635,8 +80054,10 @@ protected: friend class json_iterator; friend class value_iterator; friend class object; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; } // namespace ondemand @@ -79658,7 +80079,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H /* end file include/simdjson/generic/ondemand/token_iterator.h for ppc64 */ -/* including include/simdjson/generic/ondemand/json_iterator.h: #include "simdjson/generic/ondemand/json_iterator.h" */ +/* including include/simdjson/generic/ondemand/json_iterator.h for ppc64: #include "simdjson/generic/ondemand/json_iterator.h" */ /* begin file include/simdjson/generic/ondemand/json_iterator.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H @@ -79961,8 +80382,10 @@ protected: friend class raw_json_string; friend class parser; friend class value_iterator; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; // json_iterator } // namespace ondemand @@ -79984,7 +80407,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H /* end file include/simdjson/generic/ondemand/json_iterator.h for ppc64 */ -/* including include/simdjson/generic/ondemand/json_type.h: #include "simdjson/generic/ondemand/json_type.h" */ +/* including include/simdjson/generic/ondemand/json_type.h for ppc64: #include "simdjson/generic/ondemand/json_type.h" */ /* begin file include/simdjson/generic/ondemand/json_type.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H @@ -80149,7 +80572,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H /* end file include/simdjson/generic/ondemand/json_type.h for ppc64 */ -/* including include/simdjson/generic/ondemand/raw_json_string.h: #include "simdjson/generic/ondemand/raw_json_string.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string.h for ppc64: #include "simdjson/generic/ondemand/raw_json_string.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H @@ -80358,7 +80781,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H /* end file include/simdjson/generic/ondemand/raw_json_string.h for ppc64 */ -/* including include/simdjson/generic/ondemand/parser.h: #include "simdjson/generic/ondemand/parser.h" */ +/* including include/simdjson/generic/ondemand/parser.h for ppc64: #include "simdjson/generic/ondemand/parser.h" */ /* begin file include/simdjson/generic/ondemand/parser.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_H @@ -80716,7 +81139,7 @@ public: /* end file include/simdjson/generic/ondemand/parser.h for ppc64 */ // All other declarations -/* including include/simdjson/generic/ondemand/array.h: #include "simdjson/generic/ondemand/array.h" */ +/* including include/simdjson/generic/ondemand/array.h for ppc64: #include "simdjson/generic/ondemand/array.h" */ /* begin file include/simdjson/generic/ondemand/array.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H @@ -80918,7 +81341,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_H /* end file include/simdjson/generic/ondemand/array.h for ppc64 */ -/* including include/simdjson/generic/ondemand/array_iterator.h: #include "simdjson/generic/ondemand/array_iterator.h" */ +/* including include/simdjson/generic/ondemand/array_iterator.h for ppc64: #include "simdjson/generic/ondemand/array_iterator.h" */ /* begin file include/simdjson/generic/ondemand/array_iterator.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H @@ -81017,7 +81440,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H /* end file include/simdjson/generic/ondemand/array_iterator.h for ppc64 */ -/* including include/simdjson/generic/ondemand/document.h: #include "simdjson/generic/ondemand/document.h" */ +/* including include/simdjson/generic/ondemand/document.h for ppc64: #include "simdjson/generic/ondemand/document.h" */ /* begin file include/simdjson/generic/ondemand/document.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H @@ -81827,7 +82250,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H /* end file include/simdjson/generic/ondemand/document.h for ppc64 */ -/* including include/simdjson/generic/ondemand/document_stream.h: #include "simdjson/generic/ondemand/document_stream.h" */ +/* including include/simdjson/generic/ondemand/document_stream.h for ppc64: #include "simdjson/generic/ondemand/document_stream.h" */ /* begin file include/simdjson/generic/ondemand/document_stream.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H @@ -82169,7 +82592,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H /* end file include/simdjson/generic/ondemand/document_stream.h for ppc64 */ -/* including include/simdjson/generic/ondemand/field.h: #include "simdjson/generic/ondemand/field.h" */ +/* including include/simdjson/generic/ondemand/field.h for ppc64: #include "simdjson/generic/ondemand/field.h" */ /* begin file include/simdjson/generic/ondemand/field.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_H @@ -82254,7 +82677,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_FIELD_H /* end file include/simdjson/generic/ondemand/field.h for ppc64 */ -/* including include/simdjson/generic/ondemand/object.h: #include "simdjson/generic/ondemand/object.h" */ +/* including include/simdjson/generic/ondemand/object.h for ppc64: #include "simdjson/generic/ondemand/object.h" */ /* begin file include/simdjson/generic/ondemand/object.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_H @@ -82496,7 +82919,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_H /* end file include/simdjson/generic/ondemand/object.h for ppc64 */ -/* including include/simdjson/generic/ondemand/object_iterator.h: #include "simdjson/generic/ondemand/object_iterator.h" */ +/* including include/simdjson/generic/ondemand/object_iterator.h for ppc64: #include "simdjson/generic/ondemand/object_iterator.h" */ /* begin file include/simdjson/generic/ondemand/object_iterator.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H @@ -82579,7 +83002,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H /* end file include/simdjson/generic/ondemand/object_iterator.h for ppc64 */ -/* including include/simdjson/generic/ondemand/serialization.h: #include "simdjson/generic/ondemand/serialization.h" */ +/* including include/simdjson/generic/ondemand/serialization.h for ppc64: #include "simdjson/generic/ondemand/serialization.h" */ /* begin file include/simdjson/generic/ondemand/serialization.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_H @@ -82687,7 +83110,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result simdjson_result &simdjson_resul #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/array_iterator-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/document-inl.h: #include "simdjson/generic/ondemand/document-inl.h" */ +/* including include/simdjson/generic/ondemand/document-inl.h for ppc64: #include "simdjson/generic/ondemand/document-inl.h" */ /* begin file include/simdjson/generic/ondemand/document-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_INL_H @@ -83823,7 +84246,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_resu #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_INL_H /* end file include/simdjson/generic/ondemand/document_stream-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/field-inl.h: #include "simdjson/generic/ondemand/field-inl.h" */ +/* including include/simdjson/generic/ondemand/field-inl.h for ppc64: #include "simdjson/generic/ondemand/field-inl.h" */ /* begin file include/simdjson/generic/ondemand/field-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_INL_H @@ -84343,7 +84766,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_result #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/json_iterator-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/json_type-inl.h: #include "simdjson/generic/ondemand/json_type-inl.h" */ +/* including include/simdjson/generic/ondemand/json_type-inl.h for ppc64: #include "simdjson/generic/ondemand/json_type-inl.h" */ /* begin file include/simdjson/generic/ondemand/json_type-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H @@ -84875,7 +85298,7 @@ simdjson_inline simdjson_result::simdjson_result(err #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H /* end file include/simdjson/generic/ondemand/json_type-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/logger-inl.h: #include "simdjson/generic/ondemand/logger-inl.h" */ +/* including include/simdjson/generic/ondemand/logger-inl.h for ppc64: #include "simdjson/generic/ondemand/logger-inl.h" */ /* begin file include/simdjson/generic/ondemand/logger-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_INL_H @@ -84907,36 +85330,70 @@ static inline char printable_char(char c) { } } +template +static inline std::string string_format(const std::string& format, const Args&... args) +{ + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; + auto size = static_cast(size_s); + if (size <= 0) return std::string(); + std::unique_ptr buf(new char[size]); + std::snprintf(buf.get(), size, format.c_str(), args...); + SIMDJSON_POP_DISABLE_WARNINGS + return std::string(buf.get(), buf.get() + size - 1); +} + +static inline log_level get_log_level_from_env() +{ + SIMDJSON_PUSH_DISABLE_WARNINGS + SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe + char *lvl = getenv("SIMDJSON_LOG_LEVEL"); + SIMDJSON_POP_DISABLE_WARNINGS + if (lvl && simdjson_strcasecmp(lvl, "ERROR") == 0) { return log_level::error; } + return log_level::info; +} + +static inline log_level log_threshold() +{ + static log_level threshold = get_log_level_from_env(); + return threshold; +} + +static inline bool should_log(log_level level) +{ + return level >= log_threshold(); +} + inline void log_event(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "", type, detail); + log_line(iter, index, depth, "", type, detail, log_level::info); } inline void log_value(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "+", type, detail); + log_line(iter, index, depth, "+", type, detail, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_start_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { - log_line(iter, "+", type, "", delta, depth_delta); + log_line(iter, "+", type, "", delta, depth_delta, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_end_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { if (LOG_ENABLED) { log_depth--; } - log_line(iter, "-", type, "", delta, depth_delta); + log_line(iter, "-", type, "", delta, depth_delta, log_level::info); } inline void log_error(const json_iterator &iter, const char *error, const char *detail, int delta, int depth_delta) noexcept { - log_line(iter, "ERROR: ", error, detail, delta, depth_delta); + log_line(iter, "ERROR: ", error, detail, delta, depth_delta, log_level::error); } inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail) noexcept { - log_line(iter, index, depth, "ERROR: ", error, detail); + log_line(iter, index, depth, "ERROR: ", error, detail, log_level::error); } inline void log_event(const value_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { @@ -84961,96 +85418,101 @@ inline void log_error(const value_iterator &iter, const char *error, const char inline void log_headers() noexcept { if (LOG_ENABLED) { - // Technically a static variable is not thread-safe, but if you are using threads - // and logging... well... - static bool displayed_hint{false}; - log_depth = 0; - printf("\n"); - if(!displayed_hint) { - // We only print this helpful header once. - printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); - printf("# +array says 'this is where we were when we discovered the start array'\n"); - printf("# -array says 'this is where we were when we ended the array'\n"); - printf("# skip says 'this is a structural or value I am skipping'\n"); - printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); - printf("#\n"); - printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); - printf("# in addition to the depth being displayed.\n"); - printf("#\n"); - printf("# Every token in the document has a single depth determined by the tokens before it,\n"); - printf("# and is not affected by what the token actually is.\n"); - printf("#\n"); - printf("# Not all structural elements are presented as tokens in the logs.\n"); - printf("#\n"); - printf("# We never give control to the user within an empty array or an empty object.\n"); - printf("#\n"); - printf("# Inside an array, having a depth greater than the array's depth means that\n"); - printf("# we are pointing inside a value.\n"); - printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); - printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); - displayed_hint = true; - } - printf("\n"); - printf("| %-*s ", LOG_EVENT_LEN, "Event"); - printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); - printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); - // printf("| %-*s ", 5, "Next#"); - printf("| %-*s ", 5, "Depth"); - printf("| Detail "); - printf("|\n"); + if (simdjson_unlikely(should_log(log_level::info))) { + // Technically a static variable is not thread-safe, but if you are using threads and logging... well... + static bool displayed_hint{false}; + log_depth = 0; + printf("\n"); + if (!displayed_hint) { + // We only print this helpful header once. + printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); + printf("# +array says 'this is where we were when we discovered the start array'\n"); + printf( + "# -array says 'this is where we were when we ended the array'\n"); + printf("# skip says 'this is a structural or value I am skipping'\n"); + printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); + printf("#\n"); + printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); + printf("# in addition to the depth being displayed.\n"); + printf("#\n"); + printf("# Every token in the document has a single depth determined by the tokens before it,\n"); + printf("# and is not affected by what the token actually is.\n"); + printf("#\n"); + printf("# Not all structural elements are presented as tokens in the logs.\n"); + printf("#\n"); + printf("# We never give control to the user within an empty array or an empty object.\n"); + printf("#\n"); + printf("# Inside an array, having a depth greater than the array's depth means that\n"); + printf("# we are pointing inside a value.\n"); + printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); + printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); + displayed_hint = true; + } + printf("\n"); + printf("| %-*s ", LOG_EVENT_LEN, "Event"); + printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); + printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); + // printf("| %-*s ", 5, "Next#"); + printf("| %-*s ", 5, "Depth"); + printf("| Detail "); + printf("|\n"); - printf("|%.*s", LOG_EVENT_LEN+2, DASHES); - printf("|%.*s", LOG_BUFFER_LEN+2, DASHES); - printf("|%.*s", LOG_SMALL_BUFFER_LEN+2, DASHES); - // printf("|%.*s", 5+2, DASHES); - printf("|%.*s", 5+2, DASHES); - printf("|--------"); - printf("|\n"); - fflush(stdout); + printf("|%.*s", LOG_EVENT_LEN + 2, DASHES); + printf("|%.*s", LOG_BUFFER_LEN + 2, DASHES); + printf("|%.*s", LOG_SMALL_BUFFER_LEN + 2, DASHES); + // printf("|%.*s", 5+2, DASHES); + printf("|%.*s", 5 + 2, DASHES); + printf("|--------"); + printf("|\n"); + fflush(stdout); + } } } -inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail); +template +inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level, Args&&... args) noexcept { + log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail, level, std::forward(args)...); } -inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept { + +template +inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level, Args&&... args) noexcept { if (LOG_ENABLED) { - const int indent = depth*2; - const auto buf = iter.token.buf; - printf("| %*s%s%-*s ", - indent, "", - title_prefix, - LOG_EVENT_LEN - indent - int(strlen(title_prefix)), title - ); - { - // Print the current structural. - printf("| "); - // Before we begin, the index might point right before the document. - // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 - if(index < iter._root) { - printf("%*s", LOG_BUFFER_LEN, ""); - } else { - auto current_structural = &buf[*index]; - for (int i=0;i(args)...); + printf("| %*s%s%-*s ", indent, "", title_prefix, + LOG_EVENT_LEN - indent - int(strlen(title_prefix)), msg.c_str()); + { + // Print the current structural. + printf("| "); + // Before we begin, the index might point right before the document. + // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 + if (index < iter._root) { + printf("%*s", LOG_BUFFER_LEN, ""); + } else { + auto current_structural = &buf[*index]; + for (int i = 0; i < LOG_BUFFER_LEN; i++) { printf("%c", printable_char(current_structural[i])); + } } + printf(" "); } - printf(" "); - } - { - // Print the next structural. - printf("| "); - auto next_structural = &buf[*(index+1)]; - for (int i=0;i object::find_field_unordered(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field_unordered(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::operator[](const std::string_view key) & noexcept { @@ -85101,13 +85569,19 @@ simdjson_inline simdjson_result object::operator[](const std::string_view simdjson_inline simdjson_result object::find_field(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } @@ -85312,7 +85786,7 @@ simdjson_inline simdjson_result simdjson_result &simdjson_resu #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/object_iterator-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/parser-inl.h: #include "simdjson/generic/ondemand/parser-inl.h" */ +/* including include/simdjson/generic/ondemand/parser-inl.h for ppc64: #include "simdjson/generic/ondemand/parser-inl.h" */ /* begin file include/simdjson/generic/ondemand/parser-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H @@ -85618,7 +86092,7 @@ simdjson_inline simdjson_result::simdjson_result(error_ #endif // SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H /* end file include/simdjson/generic/ondemand/parser-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/raw_json_string-inl.h: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string-inl.h for ppc64: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H @@ -85824,7 +86298,7 @@ simdjson_inline simdjson_warn_unused simdjson_result simdjson_ #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H /* end file include/simdjson/generic/ondemand/raw_json_string-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/serialization-inl.h: #include "simdjson/generic/ondemand/serialization-inl.h" */ +/* including include/simdjson/generic/ondemand/serialization-inl.h for ppc64: #include "simdjson/generic/ondemand/serialization-inl.h" */ /* begin file include/simdjson/generic/ondemand/serialization-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H @@ -86060,7 +86534,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::ppc64::ondemand::ob #endif // SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H /* end file include/simdjson/generic/ondemand/serialization-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/token_iterator-inl.h: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ +/* including include/simdjson/generic/ondemand/token_iterator-inl.h for ppc64: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H @@ -86152,7 +86626,7 @@ simdjson_inline simdjson_result::simdjson_resul #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/token_iterator-inl.h for ppc64 */ -/* including include/simdjson/generic/ondemand/value-inl.h: #include "simdjson/generic/ondemand/value-inl.h" */ +/* including include/simdjson/generic/ondemand/value-inl.h for ppc64: #include "simdjson/generic/ondemand/value-inl.h" */ /* begin file include/simdjson/generic/ondemand/value-inl.h for ppc64 */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_INL_H @@ -86594,7 +87068,7 @@ simdjson_inline simdjson_result simdjson_result +static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; +template +static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept; static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept; static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept; static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept; + static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept; static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept; @@ -90579,7 +91062,7 @@ static inline void log_error(const value_iterator &iter, const char *error, cons #endif // SIMDJSON_GENERIC_ONDEMAND_LOGGER_H /* end file include/simdjson/generic/ondemand/logger.h for westmere */ -/* including include/simdjson/generic/ondemand/token_iterator.h: #include "simdjson/generic/ondemand/token_iterator.h" */ +/* including include/simdjson/generic/ondemand/token_iterator.h for westmere: #include "simdjson/generic/ondemand/token_iterator.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H @@ -90708,8 +91191,10 @@ protected: friend class json_iterator; friend class value_iterator; friend class object; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; } // namespace ondemand @@ -90731,7 +91216,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H /* end file include/simdjson/generic/ondemand/token_iterator.h for westmere */ -/* including include/simdjson/generic/ondemand/json_iterator.h: #include "simdjson/generic/ondemand/json_iterator.h" */ +/* including include/simdjson/generic/ondemand/json_iterator.h for westmere: #include "simdjson/generic/ondemand/json_iterator.h" */ /* begin file include/simdjson/generic/ondemand/json_iterator.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H @@ -91034,8 +91519,10 @@ protected: friend class raw_json_string; friend class parser; friend class value_iterator; - friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept; - friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, logger::log_level level, Args&&... args) noexcept; + template + friend simdjson_inline void logger::log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept; }; // json_iterator } // namespace ondemand @@ -91057,7 +91544,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_H /* end file include/simdjson/generic/ondemand/json_iterator.h for westmere */ -/* including include/simdjson/generic/ondemand/json_type.h: #include "simdjson/generic/ondemand/json_type.h" */ +/* including include/simdjson/generic/ondemand/json_type.h for westmere: #include "simdjson/generic/ondemand/json_type.h" */ /* begin file include/simdjson/generic/ondemand/json_type.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H @@ -91222,7 +91709,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H /* end file include/simdjson/generic/ondemand/json_type.h for westmere */ -/* including include/simdjson/generic/ondemand/raw_json_string.h: #include "simdjson/generic/ondemand/raw_json_string.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string.h for westmere: #include "simdjson/generic/ondemand/raw_json_string.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H @@ -91431,7 +91918,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_H /* end file include/simdjson/generic/ondemand/raw_json_string.h for westmere */ -/* including include/simdjson/generic/ondemand/parser.h: #include "simdjson/generic/ondemand/parser.h" */ +/* including include/simdjson/generic/ondemand/parser.h for westmere: #include "simdjson/generic/ondemand/parser.h" */ /* begin file include/simdjson/generic/ondemand/parser.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_H @@ -91789,7 +92276,7 @@ public: /* end file include/simdjson/generic/ondemand/parser.h for westmere */ // All other declarations -/* including include/simdjson/generic/ondemand/array.h: #include "simdjson/generic/ondemand/array.h" */ +/* including include/simdjson/generic/ondemand/array.h for westmere: #include "simdjson/generic/ondemand/array.h" */ /* begin file include/simdjson/generic/ondemand/array.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H @@ -91991,7 +92478,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_H /* end file include/simdjson/generic/ondemand/array.h for westmere */ -/* including include/simdjson/generic/ondemand/array_iterator.h: #include "simdjson/generic/ondemand/array_iterator.h" */ +/* including include/simdjson/generic/ondemand/array_iterator.h for westmere: #include "simdjson/generic/ondemand/array_iterator.h" */ /* begin file include/simdjson/generic/ondemand/array_iterator.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H @@ -92090,7 +92577,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H /* end file include/simdjson/generic/ondemand/array_iterator.h for westmere */ -/* including include/simdjson/generic/ondemand/document.h: #include "simdjson/generic/ondemand/document.h" */ +/* including include/simdjson/generic/ondemand/document.h for westmere: #include "simdjson/generic/ondemand/document.h" */ /* begin file include/simdjson/generic/ondemand/document.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H @@ -92900,7 +93387,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_H /* end file include/simdjson/generic/ondemand/document.h for westmere */ -/* including include/simdjson/generic/ondemand/document_stream.h: #include "simdjson/generic/ondemand/document_stream.h" */ +/* including include/simdjson/generic/ondemand/document_stream.h for westmere: #include "simdjson/generic/ondemand/document_stream.h" */ /* begin file include/simdjson/generic/ondemand/document_stream.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H @@ -93242,7 +93729,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_H /* end file include/simdjson/generic/ondemand/document_stream.h for westmere */ -/* including include/simdjson/generic/ondemand/field.h: #include "simdjson/generic/ondemand/field.h" */ +/* including include/simdjson/generic/ondemand/field.h for westmere: #include "simdjson/generic/ondemand/field.h" */ /* begin file include/simdjson/generic/ondemand/field.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_H @@ -93327,7 +93814,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_FIELD_H /* end file include/simdjson/generic/ondemand/field.h for westmere */ -/* including include/simdjson/generic/ondemand/object.h: #include "simdjson/generic/ondemand/object.h" */ +/* including include/simdjson/generic/ondemand/object.h for westmere: #include "simdjson/generic/ondemand/object.h" */ /* begin file include/simdjson/generic/ondemand/object.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_H @@ -93569,7 +94056,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_H /* end file include/simdjson/generic/ondemand/object.h for westmere */ -/* including include/simdjson/generic/ondemand/object_iterator.h: #include "simdjson/generic/ondemand/object_iterator.h" */ +/* including include/simdjson/generic/ondemand/object_iterator.h for westmere: #include "simdjson/generic/ondemand/object_iterator.h" */ /* begin file include/simdjson/generic/ondemand/object_iterator.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H @@ -93652,7 +94139,7 @@ public: #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_H /* end file include/simdjson/generic/ondemand/object_iterator.h for westmere */ -/* including include/simdjson/generic/ondemand/serialization.h: #include "simdjson/generic/ondemand/serialization.h" */ +/* including include/simdjson/generic/ondemand/serialization.h for westmere: #include "simdjson/generic/ondemand/serialization.h" */ /* begin file include/simdjson/generic/ondemand/serialization.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_H @@ -93760,7 +94247,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result simdjson_result &simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/array_iterator-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/document-inl.h: #include "simdjson/generic/ondemand/document-inl.h" */ +/* including include/simdjson/generic/ondemand/document-inl.h for westmere: #include "simdjson/generic/ondemand/document-inl.h" */ /* begin file include/simdjson/generic/ondemand/document-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_INL_H @@ -94896,7 +95383,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_r #endif // SIMDJSON_GENERIC_ONDEMAND_DOCUMENT_STREAM_INL_H /* end file include/simdjson/generic/ondemand/document_stream-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/field-inl.h: #include "simdjson/generic/ondemand/field-inl.h" */ +/* including include/simdjson/generic/ondemand/field-inl.h for westmere: #include "simdjson/generic/ondemand/field-inl.h" */ /* begin file include/simdjson/generic/ondemand/field-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_FIELD_INL_H @@ -95416,7 +95903,7 @@ simdjson_inline simdjson_result simdjson_result::simdjson_res #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/json_iterator-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/json_type-inl.h: #include "simdjson/generic/ondemand/json_type-inl.h" */ +/* including include/simdjson/generic/ondemand/json_type-inl.h for westmere: #include "simdjson/generic/ondemand/json_type-inl.h" */ /* begin file include/simdjson/generic/ondemand/json_type-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H @@ -95948,7 +96435,7 @@ simdjson_inline simdjson_result::simdjson_result( #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_INL_H /* end file include/simdjson/generic/ondemand/json_type-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/logger-inl.h: #include "simdjson/generic/ondemand/logger-inl.h" */ +/* including include/simdjson/generic/ondemand/logger-inl.h for westmere: #include "simdjson/generic/ondemand/logger-inl.h" */ /* begin file include/simdjson/generic/ondemand/logger-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_LOGGER_INL_H @@ -95980,36 +96467,70 @@ static inline char printable_char(char c) { } } +template +static inline std::string string_format(const std::string& format, const Args&... args) +{ + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; + auto size = static_cast(size_s); + if (size <= 0) return std::string(); + std::unique_ptr buf(new char[size]); + std::snprintf(buf.get(), size, format.c_str(), args...); + SIMDJSON_POP_DISABLE_WARNINGS + return std::string(buf.get(), buf.get() + size - 1); +} + +static inline log_level get_log_level_from_env() +{ + SIMDJSON_PUSH_DISABLE_WARNINGS + SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe + char *lvl = getenv("SIMDJSON_LOG_LEVEL"); + SIMDJSON_POP_DISABLE_WARNINGS + if (lvl && simdjson_strcasecmp(lvl, "ERROR") == 0) { return log_level::error; } + return log_level::info; +} + +static inline log_level log_threshold() +{ + static log_level threshold = get_log_level_from_env(); + return threshold; +} + +static inline bool should_log(log_level level) +{ + return level >= log_threshold(); +} + inline void log_event(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "", type, detail); + log_line(iter, index, depth, "", type, detail, log_level::info); } inline void log_value(const json_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, "", type, detail, delta, depth_delta); + log_line(iter, "", type, detail, delta, depth_delta, log_level::info); } inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail) noexcept { - log_line(iter, index, depth, "+", type, detail); + log_line(iter, index, depth, "+", type, detail, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_start_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { - log_line(iter, "+", type, "", delta, depth_delta); + log_line(iter, "+", type, "", delta, depth_delta, log_level::info); if (LOG_ENABLED) { log_depth++; } } inline void log_end_value(const json_iterator &iter, const char *type, int delta, int depth_delta) noexcept { if (LOG_ENABLED) { log_depth--; } - log_line(iter, "-", type, "", delta, depth_delta); + log_line(iter, "-", type, "", delta, depth_delta, log_level::info); } inline void log_error(const json_iterator &iter, const char *error, const char *detail, int delta, int depth_delta) noexcept { - log_line(iter, "ERROR: ", error, detail, delta, depth_delta); + log_line(iter, "ERROR: ", error, detail, delta, depth_delta, log_level::error); } inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail) noexcept { - log_line(iter, index, depth, "ERROR: ", error, detail); + log_line(iter, index, depth, "ERROR: ", error, detail, log_level::error); } inline void log_event(const value_iterator &iter, const char *type, std::string_view detail, int delta, int depth_delta) noexcept { @@ -96034,96 +96555,101 @@ inline void log_error(const value_iterator &iter, const char *error, const char inline void log_headers() noexcept { if (LOG_ENABLED) { - // Technically a static variable is not thread-safe, but if you are using threads - // and logging... well... - static bool displayed_hint{false}; - log_depth = 0; - printf("\n"); - if(!displayed_hint) { - // We only print this helpful header once. - printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); - printf("# +array says 'this is where we were when we discovered the start array'\n"); - printf("# -array says 'this is where we were when we ended the array'\n"); - printf("# skip says 'this is a structural or value I am skipping'\n"); - printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); - printf("#\n"); - printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); - printf("# in addition to the depth being displayed.\n"); - printf("#\n"); - printf("# Every token in the document has a single depth determined by the tokens before it,\n"); - printf("# and is not affected by what the token actually is.\n"); - printf("#\n"); - printf("# Not all structural elements are presented as tokens in the logs.\n"); - printf("#\n"); - printf("# We never give control to the user within an empty array or an empty object.\n"); - printf("#\n"); - printf("# Inside an array, having a depth greater than the array's depth means that\n"); - printf("# we are pointing inside a value.\n"); - printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); - printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); - displayed_hint = true; - } - printf("\n"); - printf("| %-*s ", LOG_EVENT_LEN, "Event"); - printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); - printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); - // printf("| %-*s ", 5, "Next#"); - printf("| %-*s ", 5, "Depth"); - printf("| Detail "); - printf("|\n"); + if (simdjson_unlikely(should_log(log_level::info))) { + // Technically a static variable is not thread-safe, but if you are using threads and logging... well... + static bool displayed_hint{false}; + log_depth = 0; + printf("\n"); + if (!displayed_hint) { + // We only print this helpful header once. + printf("# Logging provides the depth and position of the iterator user-visible steps:\n"); + printf("# +array says 'this is where we were when we discovered the start array'\n"); + printf( + "# -array says 'this is where we were when we ended the array'\n"); + printf("# skip says 'this is a structural or value I am skipping'\n"); + printf("# +/-skip says 'this is a start/end array or object I am skipping'\n"); + printf("#\n"); + printf("# The indentation of the terms (array, string,...) indicates the depth,\n"); + printf("# in addition to the depth being displayed.\n"); + printf("#\n"); + printf("# Every token in the document has a single depth determined by the tokens before it,\n"); + printf("# and is not affected by what the token actually is.\n"); + printf("#\n"); + printf("# Not all structural elements are presented as tokens in the logs.\n"); + printf("#\n"); + printf("# We never give control to the user within an empty array or an empty object.\n"); + printf("#\n"); + printf("# Inside an array, having a depth greater than the array's depth means that\n"); + printf("# we are pointing inside a value.\n"); + printf("# Having a depth equal to the array means that we are pointing right before a value.\n"); + printf("# Having a depth smaller than the array means that we have moved beyond the array.\n"); + displayed_hint = true; + } + printf("\n"); + printf("| %-*s ", LOG_EVENT_LEN, "Event"); + printf("| %-*s ", LOG_BUFFER_LEN, "Buffer"); + printf("| %-*s ", LOG_SMALL_BUFFER_LEN, "Next"); + // printf("| %-*s ", 5, "Next#"); + printf("| %-*s ", 5, "Depth"); + printf("| Detail "); + printf("|\n"); - printf("|%.*s", LOG_EVENT_LEN+2, DASHES); - printf("|%.*s", LOG_BUFFER_LEN+2, DASHES); - printf("|%.*s", LOG_SMALL_BUFFER_LEN+2, DASHES); - // printf("|%.*s", 5+2, DASHES); - printf("|%.*s", 5+2, DASHES); - printf("|--------"); - printf("|\n"); - fflush(stdout); + printf("|%.*s", LOG_EVENT_LEN + 2, DASHES); + printf("|%.*s", LOG_BUFFER_LEN + 2, DASHES); + printf("|%.*s", LOG_SMALL_BUFFER_LEN + 2, DASHES); + // printf("|%.*s", 5+2, DASHES); + printf("|%.*s", 5 + 2, DASHES); + printf("|--------"); + printf("|\n"); + fflush(stdout); + } } } -inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta) noexcept { - log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail); +template +inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level, Args&&... args) noexcept { + log_line(iter, iter.position()+delta, depth_t(iter.depth()+depth_delta), title_prefix, title, detail, level, std::forward(args)...); } -inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail) noexcept { + +template +inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level, Args&&... args) noexcept { if (LOG_ENABLED) { - const int indent = depth*2; - const auto buf = iter.token.buf; - printf("| %*s%s%-*s ", - indent, "", - title_prefix, - LOG_EVENT_LEN - indent - int(strlen(title_prefix)), title - ); - { - // Print the current structural. - printf("| "); - // Before we begin, the index might point right before the document. - // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 - if(index < iter._root) { - printf("%*s", LOG_BUFFER_LEN, ""); - } else { - auto current_structural = &buf[*index]; - for (int i=0;i(args)...); + printf("| %*s%s%-*s ", indent, "", title_prefix, + LOG_EVENT_LEN - indent - int(strlen(title_prefix)), msg.c_str()); + { + // Print the current structural. + printf("| "); + // Before we begin, the index might point right before the document. + // This could be unsafe, see https://github.com/simdjson/simdjson/discussions/1938 + if (index < iter._root) { + printf("%*s", LOG_BUFFER_LEN, ""); + } else { + auto current_structural = &buf[*index]; + for (int i = 0; i < LOG_BUFFER_LEN; i++) { printf("%c", printable_char(current_structural[i])); + } } + printf(" "); } - printf(" "); - } - { - // Print the next structural. - printf("| "); - auto next_structural = &buf[*(index+1)]; - for (int i=0;i object::find_field_unordered(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field_unordered(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_unordered_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::operator[](const std::string_view key) & noexcept { @@ -96174,13 +96706,19 @@ simdjson_inline simdjson_result object::operator[](const std::string_view simdjson_inline simdjson_result object::find_field(const std::string_view key) & noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } simdjson_inline simdjson_result object::find_field(const std::string_view key) && noexcept { bool has_value; SIMDJSON_TRY( iter.find_field_raw(key).get(has_value) ); - if (!has_value) { return NO_SUCH_FIELD; } + if (!has_value) { + logger::log_line(iter.json_iter(), "ERROR: ", "Cannot find key %.*s", "", -1, 0, logger::log_level::error, static_cast(key.size()), key.data()); + return NO_SUCH_FIELD; + } return value(iter.child()); } @@ -96385,7 +96923,7 @@ simdjson_inline simdjson_result simdjson_result &simdjson_r #endif // SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/object_iterator-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/parser-inl.h: #include "simdjson/generic/ondemand/parser-inl.h" */ +/* including include/simdjson/generic/ondemand/parser-inl.h for westmere: #include "simdjson/generic/ondemand/parser-inl.h" */ /* begin file include/simdjson/generic/ondemand/parser-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H @@ -96691,7 +97229,7 @@ simdjson_inline simdjson_result::simdjson_result(err #endif // SIMDJSON_GENERIC_ONDEMAND_PARSER_INL_H /* end file include/simdjson/generic/ondemand/parser-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/raw_json_string-inl.h: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ +/* including include/simdjson/generic/ondemand/raw_json_string-inl.h for westmere: #include "simdjson/generic/ondemand/raw_json_string-inl.h" */ /* begin file include/simdjson/generic/ondemand/raw_json_string-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H @@ -96897,7 +97435,7 @@ simdjson_inline simdjson_warn_unused simdjson_result simdjson_ #endif // SIMDJSON_GENERIC_ONDEMAND_RAW_JSON_STRING_INL_H /* end file include/simdjson/generic/ondemand/raw_json_string-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/serialization-inl.h: #include "simdjson/generic/ondemand/serialization-inl.h" */ +/* including include/simdjson/generic/ondemand/serialization-inl.h for westmere: #include "simdjson/generic/ondemand/serialization-inl.h" */ /* begin file include/simdjson/generic/ondemand/serialization-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H @@ -97133,7 +97671,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::westmere::ondemand: #endif // SIMDJSON_GENERIC_ONDEMAND_SERIALIZATION_INL_H /* end file include/simdjson/generic/ondemand/serialization-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/token_iterator-inl.h: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ +/* including include/simdjson/generic/ondemand/token_iterator-inl.h for westmere: #include "simdjson/generic/ondemand/token_iterator-inl.h" */ /* begin file include/simdjson/generic/ondemand/token_iterator-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H @@ -97225,7 +97763,7 @@ simdjson_inline simdjson_result::simdjson_re #endif // SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_INL_H /* end file include/simdjson/generic/ondemand/token_iterator-inl.h for westmere */ -/* including include/simdjson/generic/ondemand/value-inl.h: #include "simdjson/generic/ondemand/value-inl.h" */ +/* including include/simdjson/generic/ondemand/value-inl.h for westmere: #include "simdjson/generic/ondemand/value-inl.h" */ /* begin file include/simdjson/generic/ondemand/value-inl.h for westmere */ #ifndef SIMDJSON_GENERIC_ONDEMAND_VALUE_INL_H @@ -97667,7 +98205,7 @@ simdjson_inline simdjson_result simdjson_result @@ -15,6 +16,8 @@ bool implementation::supported_by_runtime_system() const { } // namespace simdjson +#define SIMDJSON_AMALGAMATED + #if SIMDJSON_IMPLEMENTATION_ARM64 #include "simdjson/arm64/implementation.h" namespace simdjson { @@ -88,6 +91,8 @@ static const simdjson::westmere::implementation* get_westmere_singleton() { } // namespace simdjson #endif // SIMDJSON_IMPLEMENTATION_WESTMERE +#undef SIMDJSON_AMALGAMATED + namespace simdjson { namespace internal { diff --git a/src/ppc64.cpp b/src/ppc64.cpp index 235f7b937..973e6f22b 100644 --- a/src/ppc64.cpp +++ b/src/ppc64.cpp @@ -1,11 +1,8 @@ #ifndef SIMDJSON_SRC_PPC64_CPP #define SIMDJSON_SRC_PPC64_CPP -#ifndef SIMDJSON_AMALGAMATED -#include "simdjson/ppc64/implementation.h" -#endif // SIMDJSON_AMALGAMATED - #include "simdjson/ppc64.h" +#include "simdjson/ppc64/implementation.h" #include "simdjson/ppc64/begin.h" #include "generic/amalgamated.h" diff --git a/src/simdjson.cpp b/src/simdjson.cpp index 51e0ecd45..4efa13efb 100644 --- a/src/simdjson.cpp +++ b/src/simdjson.cpp @@ -13,6 +13,8 @@ SIMDJSON_PUSH_DISABLE_UNUSED_WARNINGS #include "simdjson/generic/dependencies.h" #include "generic/dependencies.h" +#include "generic/stage1/dependencies.h" +#include "generic/stage2/dependencies.h" #include "implementation.cpp" diff --git a/src/westmere.cpp b/src/westmere.cpp index c0cbb8208..952c33572 100644 --- a/src/westmere.cpp +++ b/src/westmere.cpp @@ -1,11 +1,8 @@ #ifndef SIMDJSON_SRC_WESTMERE_CPP #define SIMDJSON_SRC_WESTMERE_CPP -#ifndef SIMDJSON_AMALGAMATED -#include "simdjson/westmere/implementation.h" -#endif // SIMDJSON_AMALGAMATED - #include "simdjson/westmere.h" +#include "simdjson/westmere/implementation.h" #include "simdjson/westmere/begin.h" #include "generic/amalgamated.h"