mirror of
https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
synced 2025-10-13 16:34:22 -05:00
Bag of holding updates
This commit is contained in:
10
vendor/json/third_party/amalgamate/CHANGES.md
vendored
Normal file
10
vendor/json/third_party/amalgamate/CHANGES.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
The following changes have been made to the code with respect to <https://github.com/edlund/amalgamate/commit/c91f07eea1133aa184f652b8f1398eaf03586208>:
|
||||
|
||||
- Resolved inspection results from PyCharm:
|
||||
- replaced tabs with spaces
|
||||
- added encoding annotation
|
||||
- reindented file to remove trailing whitespaces
|
||||
- unused import `sys`
|
||||
- membership check
|
||||
- made function from `_is_within`
|
||||
- removed unused variable `actual_path`
|
27
vendor/json/third_party/amalgamate/LICENSE.md
vendored
Normal file
27
vendor/json/third_party/amalgamate/LICENSE.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
amalgamate.py - Amalgamate C source and header files
|
||||
Copyright (c) 2012, Erik Edlund <erik.edlund@32767.se>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Erik Edlund, nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
66
vendor/json/third_party/amalgamate/README.md
vendored
Normal file
66
vendor/json/third_party/amalgamate/README.md
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
# amalgamate.py - Amalgamate C source and header files
|
||||
|
||||
Origin: https://bitbucket.org/erikedlund/amalgamate
|
||||
|
||||
Mirror: https://github.com/edlund/amalgamate
|
||||
|
||||
`amalgamate.py` aims to make it easy to use SQLite-style C source and header
|
||||
amalgamation in projects.
|
||||
|
||||
For more information, please refer to: http://sqlite.org/amalgamation.html
|
||||
|
||||
## Here be dragons
|
||||
|
||||
`amalgamate.py` is quite dumb, it only knows the bare minimum about C code
|
||||
required in order to be able to handle trivial include directives. It can
|
||||
produce weird results for unexpected code.
|
||||
|
||||
Things to be aware of:
|
||||
|
||||
`amalgamate.py` will not handle complex include directives correctly:
|
||||
|
||||
#define HEADER_PATH "path/to/header.h"
|
||||
#include HEADER_PATH
|
||||
|
||||
In the above example, `path/to/header.h` will not be included in the
|
||||
amalgamation (HEADER_PATH is never expanded).
|
||||
|
||||
`amalgamate.py` makes the assumption that each source and header file which
|
||||
is not empty will end in a new-line character, which is not immediately
|
||||
preceded by a backslash character (see 5.1.1.2p1.2 of ISO C99).
|
||||
|
||||
`amalgamate.py` should be usable with C++ code, but raw string literals from
|
||||
C++11 will definitely cause problems:
|
||||
|
||||
R"delimiter(Terrible raw \ data " #include <sneaky.hpp>)delimiter"
|
||||
R"delimiter(Terrible raw \ data " escaping)delimiter"
|
||||
|
||||
In the examples above, `amalgamate.py` will stop parsing the raw string literal
|
||||
when it encounters the first quotation mark, which will produce unexpected
|
||||
results.
|
||||
|
||||
## Installing amalgamate.py
|
||||
|
||||
Python v.2.7.0 or higher is required.
|
||||
|
||||
`amalgamate.py` can be tested and installed using the following commands:
|
||||
|
||||
./test.sh && sudo -k cp ./amalgamate.py /usr/local/bin/
|
||||
|
||||
## Using amalgamate.py
|
||||
|
||||
amalgamate.py [-v] -c path/to/config.json -s path/to/source/dir \
|
||||
[-p path/to/prologue.(c|h)]
|
||||
|
||||
* The `-c, --config` option should specify the path to a JSON config file which
|
||||
lists the source files, include paths and where to write the resulting
|
||||
amalgamation. Have a look at `test/source.c.json` and `test/include.h.json`
|
||||
to see two examples.
|
||||
|
||||
* The `-s, --source` option should specify the path to the source directory.
|
||||
This is useful for supporting separate source and build directories.
|
||||
|
||||
* The `-p, --prologue` option should specify the path to a file which will be
|
||||
added to the beginning of the amalgamation. It is optional.
|
||||
|
299
vendor/json/third_party/amalgamate/amalgamate.py
vendored
Normal file
299
vendor/json/third_party/amalgamate/amalgamate.py
vendored
Normal file
@@ -0,0 +1,299 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
|
||||
# amalgamate.py - Amalgamate C source and header files.
|
||||
# Copyright (c) 2012, Erik Edlund <erik.edlund@32767.se>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the name of Erik Edlund, nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
class Amalgamation(object):
|
||||
|
||||
# Prepends self.source_path to file_path if needed.
|
||||
def actual_path(self, file_path):
|
||||
if not os.path.isabs(file_path):
|
||||
file_path = os.path.join(self.source_path, file_path)
|
||||
return file_path
|
||||
|
||||
# Search included file_path in self.include_paths and
|
||||
# in source_dir if specified.
|
||||
def find_included_file(self, file_path, source_dir):
|
||||
search_dirs = self.include_paths[:]
|
||||
if source_dir:
|
||||
search_dirs.insert(0, source_dir)
|
||||
|
||||
for search_dir in search_dirs:
|
||||
search_path = os.path.join(search_dir, file_path)
|
||||
if os.path.isfile(self.actual_path(search_path)):
|
||||
return search_path
|
||||
return None
|
||||
|
||||
def __init__(self, args):
|
||||
with open(args.config, 'r') as f:
|
||||
config = json.loads(f.read())
|
||||
for key in config:
|
||||
setattr(self, key, config[key])
|
||||
|
||||
self.verbose = args.verbose == "yes"
|
||||
self.prologue = args.prologue
|
||||
self.source_path = args.source_path
|
||||
self.included_files = []
|
||||
|
||||
# Generate the amalgamation and write it to the target file.
|
||||
def generate(self):
|
||||
amalgamation = ""
|
||||
|
||||
if self.prologue:
|
||||
with open(self.prologue, 'r') as f:
|
||||
amalgamation += datetime.datetime.now().strftime(f.read())
|
||||
|
||||
if self.verbose:
|
||||
print("Config:")
|
||||
print(" target = {0}".format(self.target))
|
||||
print(" working_dir = {0}".format(os.getcwd()))
|
||||
print(" include_paths = {0}".format(self.include_paths))
|
||||
print("Creating amalgamation:")
|
||||
for file_path in self.sources:
|
||||
# Do not check the include paths while processing the source
|
||||
# list, all given source paths must be correct.
|
||||
# actual_path = self.actual_path(file_path)
|
||||
print(" - processing \"{0}\"".format(file_path))
|
||||
t = TranslationUnit(file_path, self, True)
|
||||
amalgamation += t.content
|
||||
|
||||
with open(self.target, 'w') as f:
|
||||
f.write(amalgamation)
|
||||
|
||||
print("...done!\n")
|
||||
if self.verbose:
|
||||
print("Files processed: {0}".format(self.sources))
|
||||
print("Files included: {0}".format(self.included_files))
|
||||
print("")
|
||||
|
||||
|
||||
def _is_within(match, matches):
|
||||
for m in matches:
|
||||
if match.start() > m.start() and \
|
||||
match.end() < m.end():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class TranslationUnit(object):
|
||||
# // C++ comment.
|
||||
cpp_comment_pattern = re.compile(r"//.*?\n")
|
||||
|
||||
# /* C comment. */
|
||||
c_comment_pattern = re.compile(r"/\*.*?\*/", re.S)
|
||||
|
||||
# "complex \"stri\\\ng\" value".
|
||||
string_pattern = re.compile("[^']" r'".*?(?<=[^\\])"', re.S)
|
||||
|
||||
# Handle simple include directives. Support for advanced
|
||||
# directives where macros and defines needs to expanded is
|
||||
# not a concern right now.
|
||||
include_pattern = re.compile(
|
||||
r'#\s*include\s+(<|")(?P<path>.*?)("|>)', re.S)
|
||||
|
||||
# #pragma once
|
||||
pragma_once_pattern = re.compile(r'#\s*pragma\s+once', re.S)
|
||||
|
||||
# Search for pattern in self.content, add the match to
|
||||
# contexts if found and update the index accordingly.
|
||||
def _search_content(self, index, pattern, contexts):
|
||||
match = pattern.search(self.content, index)
|
||||
if match:
|
||||
contexts.append(match)
|
||||
return match.end()
|
||||
return index + 2
|
||||
|
||||
# Return all the skippable contexts, i.e., comments and strings
|
||||
def _find_skippable_contexts(self):
|
||||
# Find contexts in the content in which a found include
|
||||
# directive should not be processed.
|
||||
skippable_contexts = []
|
||||
|
||||
# Walk through the content char by char, and try to grab
|
||||
# skippable contexts using regular expressions when found.
|
||||
i = 1
|
||||
content_len = len(self.content)
|
||||
while i < content_len:
|
||||
j = i - 1
|
||||
current = self.content[i]
|
||||
previous = self.content[j]
|
||||
|
||||
if current == '"':
|
||||
# String value.
|
||||
i = self._search_content(j, self.string_pattern,
|
||||
skippable_contexts)
|
||||
elif current == '*' and previous == '/':
|
||||
# C style comment.
|
||||
i = self._search_content(j, self.c_comment_pattern,
|
||||
skippable_contexts)
|
||||
elif current == '/' and previous == '/':
|
||||
# C++ style comment.
|
||||
i = self._search_content(j, self.cpp_comment_pattern,
|
||||
skippable_contexts)
|
||||
else:
|
||||
# Skip to the next char.
|
||||
i += 1
|
||||
|
||||
return skippable_contexts
|
||||
|
||||
# Returns True if the match is within list of other matches
|
||||
|
||||
# Removes pragma once from content
|
||||
def _process_pragma_once(self):
|
||||
content_len = len(self.content)
|
||||
if content_len < len("#include <x>"):
|
||||
return 0
|
||||
|
||||
# Find contexts in the content in which a found include
|
||||
# directive should not be processed.
|
||||
skippable_contexts = self._find_skippable_contexts()
|
||||
|
||||
pragmas = []
|
||||
pragma_once_match = self.pragma_once_pattern.search(self.content)
|
||||
while pragma_once_match:
|
||||
if not _is_within(pragma_once_match, skippable_contexts):
|
||||
pragmas.append(pragma_once_match)
|
||||
|
||||
pragma_once_match = self.pragma_once_pattern.search(self.content,
|
||||
pragma_once_match.end())
|
||||
|
||||
# Handle all collected pragma once directives.
|
||||
prev_end = 0
|
||||
tmp_content = ''
|
||||
for pragma_match in pragmas:
|
||||
tmp_content += self.content[prev_end:pragma_match.start()]
|
||||
prev_end = pragma_match.end()
|
||||
tmp_content += self.content[prev_end:]
|
||||
self.content = tmp_content
|
||||
|
||||
# Include all trivial #include directives into self.content.
|
||||
def _process_includes(self):
|
||||
content_len = len(self.content)
|
||||
if content_len < len("#include <x>"):
|
||||
return 0
|
||||
|
||||
# Find contexts in the content in which a found include
|
||||
# directive should not be processed.
|
||||
skippable_contexts = self._find_skippable_contexts()
|
||||
|
||||
# Search for include directives in the content, collect those
|
||||
# which should be included into the content.
|
||||
includes = []
|
||||
include_match = self.include_pattern.search(self.content)
|
||||
while include_match:
|
||||
if not _is_within(include_match, skippable_contexts):
|
||||
include_path = include_match.group("path")
|
||||
search_same_dir = include_match.group(1) == '"'
|
||||
found_included_path = self.amalgamation.find_included_file(
|
||||
include_path, self.file_dir if search_same_dir else None)
|
||||
if found_included_path:
|
||||
includes.append((include_match, found_included_path))
|
||||
|
||||
include_match = self.include_pattern.search(self.content,
|
||||
include_match.end())
|
||||
|
||||
# Handle all collected include directives.
|
||||
prev_end = 0
|
||||
tmp_content = ''
|
||||
for include in includes:
|
||||
include_match, found_included_path = include
|
||||
tmp_content += self.content[prev_end:include_match.start()]
|
||||
tmp_content += "// {0}\n".format(include_match.group(0))
|
||||
if found_included_path not in self.amalgamation.included_files:
|
||||
t = TranslationUnit(found_included_path, self.amalgamation, False)
|
||||
tmp_content += t.content
|
||||
prev_end = include_match.end()
|
||||
tmp_content += self.content[prev_end:]
|
||||
self.content = tmp_content
|
||||
|
||||
return len(includes)
|
||||
|
||||
# Make all content processing
|
||||
def _process(self):
|
||||
if not self.is_root:
|
||||
self._process_pragma_once()
|
||||
self._process_includes()
|
||||
|
||||
def __init__(self, file_path, amalgamation, is_root):
|
||||
self.file_path = file_path
|
||||
self.file_dir = os.path.dirname(file_path)
|
||||
self.amalgamation = amalgamation
|
||||
self.is_root = is_root
|
||||
|
||||
self.amalgamation.included_files.append(self.file_path)
|
||||
|
||||
actual_path = self.amalgamation.actual_path(file_path)
|
||||
if not os.path.isfile(actual_path):
|
||||
raise IOError("File not found: \"{0}\"".format(file_path))
|
||||
with open(actual_path, 'r') as f:
|
||||
self.content = f.read()
|
||||
self._process()
|
||||
|
||||
|
||||
def main():
|
||||
description = "Amalgamate C source and header files."
|
||||
usage = " ".join([
|
||||
"amalgamate.py",
|
||||
"[-v]",
|
||||
"-c path/to/config.json",
|
||||
"-s path/to/source/dir",
|
||||
"[-p path/to/prologue.(c|h)]"
|
||||
])
|
||||
argsparser = argparse.ArgumentParser(
|
||||
description=description, usage=usage)
|
||||
|
||||
argsparser.add_argument("-v", "--verbose", dest="verbose",
|
||||
choices=["yes", "no"], metavar="", help="be verbose")
|
||||
|
||||
argsparser.add_argument("-c", "--config", dest="config",
|
||||
required=True, metavar="", help="path to a JSON config file")
|
||||
|
||||
argsparser.add_argument("-s", "--source", dest="source_path",
|
||||
required=True, metavar="", help="source code path")
|
||||
|
||||
argsparser.add_argument("-p", "--prologue", dest="prologue",
|
||||
required=False, metavar="", help="path to a C prologue file")
|
||||
|
||||
amalgamation = Amalgamation(argsparser.parse_args())
|
||||
amalgamation.generate()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
8
vendor/json/third_party/amalgamate/config.json
vendored
Normal file
8
vendor/json/third_party/amalgamate/config.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"project": "JSON for Modern C++",
|
||||
"target": "single_include/nlohmann/json.hpp",
|
||||
"sources": [
|
||||
"include/nlohmann/json.hpp"
|
||||
],
|
||||
"include_paths": ["include"]
|
||||
}
|
27
vendor/json/third_party/cpplint/LICENSE
vendored
Normal file
27
vendor/json/third_party/cpplint/LICENSE
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
cpplint.py and its corresponding unit tests are Copyright (C) 2009 Google Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
80
vendor/json/third_party/cpplint/README.rst
vendored
Normal file
80
vendor/json/third_party/cpplint/README.rst
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
cpplint - static code checker for C++
|
||||
=====================================
|
||||
|
||||
.. image:: https://travis-ci.org/cpplint/cpplint.svg?branch=master
|
||||
:target: https://travis-ci.org/cpplint/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/pyversions/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/status/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/dd/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/dw/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
.. image:: https://img.shields.io/pypi/dm/cpplint.svg
|
||||
:target: https://pypi.python.org/pypi/cpplint
|
||||
|
||||
Cpplint is a command-line tool to check C/C++ files for style issues following `Google's C++ style guide <http://google.github.io/styleguide/cppguide.html>`_.
|
||||
Cpplint is developed and maintained by Google Inc. at `google/styleguide <https://github.com/google/styleguide>`_, also see see the `wikipedia entry <http://en.wikipedia.org/wiki/Cpplint>`_
|
||||
|
||||
While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts.
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
|
||||
To install cpplint from PyPI, run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install cpplint
|
||||
|
||||
Then run it with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cpplint [OPTIONS] files
|
||||
|
||||
For full usage instructions, run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cpplint --help
|
||||
|
||||
Changes
|
||||
-------
|
||||
|
||||
The modifications in this fork are minor fixes and cosmetic changes:
|
||||
|
||||
* more default extensions
|
||||
* python 3 compatibility
|
||||
* customizable file extensions with the --extensions argument
|
||||
* continuous integration on travis
|
||||
* support for recursive file discovery via the --recursive argument
|
||||
* support for excluding files via --exclude
|
||||
* JUnit XML output format
|
||||
* Overriding repository root auto-detection via --repository
|
||||
* Support ``#pragma once`` as an alternative to header include guards
|
||||
|
||||
|
||||
Acknowledgements
|
||||
----------------
|
||||
|
||||
Thanks to Google Inc. for open-sourcing their in-house tool.
|
||||
Thanks to maintainers of the fork
|
||||
|
||||
* `tkruse <https://github.com/tkruse>`_
|
||||
* `mattyclarkson <https://github.com/mattyclarkson>`_
|
||||
* `theandrewdavis <https://github.com/theandrewdavis>`_
|
6583
vendor/json/third_party/cpplint/cpplint.py
vendored
Normal file
6583
vendor/json/third_party/cpplint/cpplint.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
vendor/json/third_party/cpplint/update.sh
vendored
Normal file
5
vendor/json/third_party/cpplint/update.sh
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/cpplint.py
|
||||
wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/LICENSE
|
||||
wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/README.rst
|
77
vendor/json/third_party/gdb_pretty_printer/README.md
vendored
Normal file
77
vendor/json/third_party/gdb_pretty_printer/README.md
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# GDB Pretty Printer
|
||||
|
||||
File [nlohmann-json.py](nlohmann-json.py) contains a pretty printer for GDB for JSON values of this library. It was originally published as [Gist](https://gist.github.com/ssbssa/60da5339c6e6036b2afce17de06050ea#file-nlohmann-json-py) by [Hannes Domani](https://github.com/ssbssa).
|
||||
|
||||
## How to use
|
||||
|
||||
- Add line
|
||||
|
||||
```
|
||||
source /path/to/nlohmann-json.py
|
||||
```
|
||||
|
||||
to `~/.gdbinit`. Note you must replace `/path/to` with whatever path you stored file `nlohmann-json.py`.
|
||||
- In GDB, debug as usual. When you want to pretty-print a JSON value `var`, type
|
||||
|
||||
```
|
||||
p -pretty on -array on -- var
|
||||
```
|
||||
|
||||
The result should look like
|
||||
|
||||
```
|
||||
$1 = std::map with 5 elements = {
|
||||
["Baptiste"] = std::map with 1 element = {
|
||||
["first"] = "second"
|
||||
},
|
||||
["Emmanuel"] = std::vector of length 3, capacity 3 = {
|
||||
3,
|
||||
"25",
|
||||
0.5
|
||||
},
|
||||
["Jean"] = 0.7,
|
||||
["Zorg"] = std::map with 8 elements = {
|
||||
["array"] = std::vector of length 3, capacity 3 = {
|
||||
1,
|
||||
0,
|
||||
2
|
||||
},
|
||||
["awesome_str"] = "bleh",
|
||||
["bool"] = true,
|
||||
["flex"] = 0.2,
|
||||
["float"] = 5.22,
|
||||
["int"] = 5,
|
||||
["nested"] = std::map with 1 element = {
|
||||
["bar"] = "barz"
|
||||
},
|
||||
["trap "] = "you fell"
|
||||
},
|
||||
["empty"] = nlohmann::detail::value_t::null
|
||||
}
|
||||
```
|
||||
|
||||
Tested with GDB 9.2. See [#1952](https://github.com/nlohmann/json/issues/1952) for more information. Please post questions there.
|
||||
|
||||
## Copyright
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2020 [Hannes Domani](https://github.com/ssbssa)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
28
vendor/json/third_party/gdb_pretty_printer/nlohmann-json.py
vendored
Normal file
28
vendor/json/third_party/gdb_pretty_printer/nlohmann-json.py
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import gdb
|
||||
import re
|
||||
|
||||
class JsonValuePrinter:
|
||||
"Print a json-value"
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
||||
def to_string(self):
|
||||
if self.val.type.strip_typedefs().code == gdb.TYPE_CODE_FLT:
|
||||
return ("%.6f" % float(self.val)).rstrip("0")
|
||||
return self.val
|
||||
|
||||
def json_lookup_function(val):
|
||||
if re.search("^nlohmann::basic_json<.*>$", val.type.strip_typedefs().name):
|
||||
t = str(val['m_type'])
|
||||
if t.startswith("nlohmann::detail::value_t::"):
|
||||
try:
|
||||
union_val = val['m_value'][t[27:]]
|
||||
if union_val.type.code == gdb.TYPE_CODE_PTR:
|
||||
return gdb.default_visualizer(union_val.dereference())
|
||||
else:
|
||||
return JsonValuePrinter(union_val)
|
||||
except:
|
||||
return JsonValuePrinter(val['m_type'])
|
||||
|
||||
gdb.pretty_printers.append(json_lookup_function)
|
43
vendor/json/third_party/macro_builder/main.cpp
vendored
Normal file
43
vendor/json/third_party/macro_builder/main.cpp
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void build_code(int max_args)
|
||||
{
|
||||
stringstream ss;
|
||||
ss << "#define NLOHMANN_JSON_EXPAND( x ) x" << endl;
|
||||
ss << "#define NLOHMANN_JSON_GET_MACRO(";
|
||||
for (int i = 0 ; i < max_args ; i++)
|
||||
ss << "_" << i + 1 << ", ";
|
||||
ss << "NAME,...) NAME" << endl;
|
||||
|
||||
ss << "#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \\" << endl;
|
||||
for (int i = max_args ; i > 1 ; i--)
|
||||
ss << "NLOHMANN_JSON_PASTE" << i << ", \\" << endl;
|
||||
ss << "NLOHMANN_JSON_PASTE1)(__VA_ARGS__))" << endl;
|
||||
|
||||
ss << "#define NLOHMANN_JSON_PASTE2(func, v1) func(v1)" << endl;
|
||||
for (int i = 3 ; i <= max_args ; i++)
|
||||
{
|
||||
ss << "#define NLOHMANN_JSON_PASTE" << i << "(func, ";
|
||||
for (int j = 1 ; j < i -1 ; j++)
|
||||
ss << "v" << j << ", ";
|
||||
ss << "v" << i-1 << ") NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE" << i-1 << "(func, ";
|
||||
for (int j = 2 ; j < i-1 ; j++)
|
||||
ss << "v" << j << ", ";
|
||||
ss << "v" << i-1 << ")" << endl;
|
||||
}
|
||||
|
||||
cout << ss.str() << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int max_args = 64;
|
||||
build_code(max_args);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user