Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref authored and cdunn2001 committed Dec 3, 2017
1 parent 7c979e8 commit e6a588a
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 57 deletions.
46 changes: 23 additions & 23 deletions amalgamate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Amalgate json-cpp library sources into a single source and header file.
"""Amalgamate json-cpp library sources into a single source and header file.
Works with python2.6+ and python3.4+.
Example of invocation (must be invoked from json-cpp top directory):
python amalgate.py
python amalgamate.py
"""
import os
import os.path
Expand Down Expand Up @@ -50,20 +50,20 @@ def write_to(self, output_path):
def amalgamate_source(source_top_dir=None,
target_source_path=None,
header_include_path=None):
"""Produces amalgated source.
"""Produces amalgamated source.
Parameters:
source_top_dir: top-directory
target_source_path: output .cpp path
header_include_path: generated header path relative to target_source_path.
"""
print("Amalgating header...")
print("Amalgamating header...")
header = AmalgamationFile(source_top_dir)
header.add_text("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).")
header.add_text("/// Json-cpp amalgamated header (http://jsoncpp.sourceforge.net/).")
header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
header.add_file("LICENSE", wrap_in_comment=True)
header.add_text("#ifndef JSON_AMALGATED_H_INCLUDED")
header.add_text("# define JSON_AMALGATED_H_INCLUDED")
header.add_text("/// If defined, indicates that the source file is amalgated")
header.add_text("#ifndef JSON_AMALGAMATED_H_INCLUDED")
header.add_text("# define JSON_AMALGAMATED_H_INCLUDED")
header.add_text("/// If defined, indicates that the source file is amalgamated")
header.add_text("/// to prevent private header inclusion.")
header.add_text("#define JSON_IS_AMALGAMATION")
header.add_file("include/json/version.h")
Expand All @@ -75,37 +75,37 @@ def amalgamate_source(source_top_dir=None,
header.add_file("include/json/reader.h")
header.add_file("include/json/writer.h")
header.add_file("include/json/assertions.h")
header.add_text("#endif //ifndef JSON_AMALGATED_H_INCLUDED")
header.add_text("#endif //ifndef JSON_AMALGAMATED_H_INCLUDED")

target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
print("Writing amalgated header to %r" % target_header_path)
print("Writing amalgamated header to %r" % target_header_path)
header.write_to(target_header_path)

base, ext = os.path.splitext(header_include_path)
forward_header_include_path = base + "-forwards" + ext
print("Amalgating forward header...")
print("Amalgamating forward header...")
header = AmalgamationFile(source_top_dir)
header.add_text("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).")
header.add_text("/// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/).")
header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
header.add_text("/// This header provides forward declaration for all JsonCpp types.")
header.add_file("LICENSE", wrap_in_comment=True)
header.add_text("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
header.add_text("# define JSON_FORWARD_AMALGATED_H_INCLUDED")
header.add_text("/// If defined, indicates that the source file is amalgated")
header.add_text("#ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
header.add_text("# define JSON_FORWARD_AMALGAMATED_H_INCLUDED")
header.add_text("/// If defined, indicates that the source file is amalgamated")
header.add_text("/// to prevent private header inclusion.")
header.add_text("#define JSON_IS_AMALGAMATION")
header.add_file("include/json/config.h")
header.add_file("include/json/forwards.h")
header.add_text("#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
header.add_text("#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")

target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
forward_header_include_path)
print("Writing amalgated forward header to %r" % target_forward_header_path)
print("Writing amalgamated forward header to %r" % target_forward_header_path)
header.write_to(target_forward_header_path)

print("Amalgating source...")
print("Amalgamating source...")
source = AmalgamationFile(source_top_dir)
source.add_text("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).")
source.add_text("/// Json-cpp amalgamated source (http://jsoncpp.sourceforge.net/).")
source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
source.add_file("LICENSE", wrap_in_comment=True)
source.add_text("")
Expand All @@ -123,20 +123,20 @@ def amalgamate_source(source_top_dir=None,
source.add_file(os.path.join(lib_json, "json_value.cpp"))
source.add_file(os.path.join(lib_json, "json_writer.cpp"))

print("Writing amalgated source to %r" % target_source_path)
print("Writing amalgamated source to %r" % target_source_path)
source.write_to(target_source_path)

def main():
usage = """%prog [options]
Generate a single amalgated source and header file from the sources.
Generate a single amalgamated source and header file from the sources.
"""
from optparse import OptionParser
parser = OptionParser(usage=usage)
parser.allow_interspersed_args = False
parser.add_option("-s", "--source", dest="target_source_path", action="store", default="dist/jsoncpp.cpp",
help="""Output .cpp source path. [Default: %default]""")
parser.add_option("-i", "--include", dest="header_include_path", action="store", default="json/json.h",
help="""Header include path. Used to include the header from the amalgated source file. [Default: %default]""")
help="""Header include path. Used to include the header from the amalgamated source file. [Default: %default]""")
parser.add_option("-t", "--top-dir", dest="top_dir", action="store", default=os.getcwd(),
help="""Source top-directory. [Default: %default]""")
parser.enable_interspersed_args()
Expand All @@ -149,7 +149,7 @@ def main():
sys.stderr.write(msg + "\n")
sys.exit(1)
else:
print("Source succesfully amalagated")
print("Source successfully amalgamated")

if __name__ == "__main__":
main()
8 changes: 4 additions & 4 deletions doc/doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C.
Expand Down Expand Up @@ -1408,7 +1408,7 @@ FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES

# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering
# http://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
Expand Down Expand Up @@ -1478,7 +1478,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = NO

# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavours of web server based searching depending on the
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
# searching and an index file used by the script. When EXTERNAL_SEARCH is
Expand Down Expand Up @@ -1959,7 +1959,7 @@ PREDEFINED = "_MSC_VER=1400" \
EXPAND_AS_DEFINED =

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all refrences to function-like macros that are alone on a line, have an
# remove all references to function-like macros that are alone on a line, have an
# all uppercase name, and do not end with a semicolon. Such function macros are
# typically used for boiler-plate code, and will confuse the parser if not
# removed.
Expand Down
8 changes: 4 additions & 4 deletions doc/web_doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C.
Expand Down Expand Up @@ -1408,7 +1408,7 @@ FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES

# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering
# http://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
Expand Down Expand Up @@ -1478,7 +1478,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = NO

# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavours of web server based searching depending on the
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
# searching and an index file used by the script. When EXTERNAL_SEARCH is
Expand Down Expand Up @@ -1947,7 +1947,7 @@ PREDEFINED = "_MSC_VER=1400" \
EXPAND_AS_DEFINED =

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all refrences to function-like macros that are alone on a line, have an
# remove all references to function-like macros that are alone on a line, have an
# all uppercase name, and do not end with a semicolon. Such function macros are
# typically used for boiler-plate code, and will confuse the parser if not
# removed.
Expand Down
2 changes: 1 addition & 1 deletion doxybuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def yesno(bool):
def main():
usage = """%prog
Generates doxygen documentation in build/doxygen.
Optionaly makes a tarball of the documentation to dist/.
Optionally makes a tarball of the documentation to dist/.
Must be started in the project top directory.
"""
Expand Down
6 changes: 3 additions & 3 deletions include/json/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#define JSON_USE_EXCEPTION 1
#endif

/// If defined, indicates that the source file is amalgated
/// If defined, indicates that the source file is amalgamated
/// to prevent private header inclusion.
/// Remarks: it is automatically defined in the generated amalgated header.
/// Remarks: it is automatically defined in the generated amalgamated header.
// #define JSON_IS_AMALGAMATION

#ifdef JSON_IN_CPPTL
Expand Down Expand Up @@ -78,7 +78,7 @@

#endif // defined(_MSC_VER)

// In c++11 the override keyword allows you to explicity define that a function
// In c++11 the override keyword allows you to explicitly define that a function
// is intended to override the base-class version. This makes the code more
// managable and fixes a set of common hard-to-find bugs.
#if __cplusplus >= 201103L
Expand Down
2 changes: 1 addition & 1 deletion include/json/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ enum CommentPlacement {

/** \brief Lightweight wrapper to tag static string.
*
* Value constructor and objectValue member assignement takes advantage of the
* Value constructor and objectValue member assignment takes advantage of the
* StaticString and avoid the cost of string duplication when storing the
* string or the member name.
*
Expand Down
10 changes: 5 additions & 5 deletions include/json/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
- "dropNullPlaceholders": false or true
- Drop the "null" string from the writer's output for nullValues.
Strictly speaking, this is not valid JSON. But when the output is being
fed to a browser's Javascript, it makes for smaller output and the
fed to a browser's JavaScript, it makes for smaller output and the
browser can handle the output just fine.
- "useSpecialFloats": false or true
- If true, outputs non-finite floating point values in the following way:
Expand Down Expand Up @@ -169,7 +169,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter

/** \brief Drop the "null" string from the writer's output for nullValues.
* Strictly speaking, this is not valid JSON. But when the output is being
* fed to a browser's Javascript, it makes for smaller output and the
* fed to a browser's JavaScript, it makes for smaller output and the
* browser can handle the output just fine.
*/
void dropNullPlaceholders();
Expand All @@ -183,7 +183,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter
void writeValue(const Value& value);

JSONCPP_STRING document_;
bool yamlCompatiblityEnabled_;
bool yamlCompatibilityEnabled_;
bool dropNullPlaceholders_;
bool omitEndingLineFeed_;
};
Expand Down Expand Up @@ -234,7 +234,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWrite
private:
void writeValue(const Value& value);
void writeArrayValue(const Value& value);
bool isMultineArray(const Value& value);
bool isMultilineArray(const Value& value);
void pushValue(const JSONCPP_STRING& value);
void writeIndent();
void writeWithIndent(const JSONCPP_STRING& value);
Expand Down Expand Up @@ -307,7 +307,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledStrea
private:
void writeValue(const Value& value);
void writeArrayValue(const Value& value);
bool isMultineArray(const Value& value);
bool isMultilineArray(const Value& value);
void pushValue(const JSONCPP_STRING& value);
void writeIndent();
void writeWithIndent(const JSONCPP_STRING& value);
Expand Down
4 changes: 2 additions & 2 deletions makerelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def main():
Must be started in the project top directory.
Warning: --force should only be used when developping/testing the release script.
Warning: --force should only be used when developing/testing the release script.
"""
from optparse import OptionParser
parser = OptionParser(usage=usage)
Expand Down Expand Up @@ -377,7 +377,7 @@ def main():
user=options.user, sftp=options.sftp)
print('Source and doc release tarballs uploaded')
else:
print('No upload user specified. Web site and download tarbal were not uploaded.')
print('No upload user specified. Web site and download tarball were not uploaded.')
print('Tarball can be found at:', doc_tarball_path)

# Set next version number and commit
Expand Down
2 changes: 1 addition & 1 deletion src/lib_json/json_tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ enum {
typedef char UIntToStringBuffer[uintToStringBufferSize];

/** Converts an unsigned integer to string.
* @param value Unsigned interger to convert to string
* @param value Unsigned integer to convert to string
* @param current Input/Output string buffer.
* Must have at least uintToStringBufferSize chars free.
*/
Expand Down
22 changes: 11 additions & 11 deletions src/lib_json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
snprintf(formatString, sizeof(formatString), "%%.%dg", precision);

// Print into the buffer. We need not request the alternative representation
// that always has a decimal point because JSON doesn't distingish the
// that always has a decimal point because JSON doesn't distinguish the
// concepts of reals and integers.
if (isfinite(value)) {
len = snprintf(buffer, sizeof(buffer), formatString, value);
Expand Down Expand Up @@ -334,10 +334,10 @@ Writer::~Writer() {}
// //////////////////////////////////////////////////////////////////

FastWriter::FastWriter()
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
: yamlCompatibilityEnabled_(false), dropNullPlaceholders_(false),
omitEndingLineFeed_(false) {}

void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }
void FastWriter::enableYAMLCompatibility() { yamlCompatibilityEnabled_ = true; }

void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }

Expand Down Expand Up @@ -397,7 +397,7 @@ void FastWriter::writeValue(const Value& value) {
if (it != members.begin())
document_ += ',';
document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
document_ += yamlCompatibilityEnabled_ ? ": " : ":";
writeValue(value[name]);
}
document_ += '}';
Expand Down Expand Up @@ -486,7 +486,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
if (size == 0)
pushValue("[]");
else {
bool isArrayMultiLine = isMultineArray(value);
bool isArrayMultiLine = isMultilineArray(value);
if (isArrayMultiLine) {
writeWithIndent("[");
indent();
Expand Down Expand Up @@ -524,7 +524,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
}
}

bool StyledWriter::isMultineArray(const Value& value) {
bool StyledWriter::isMultilineArray(const Value& value) {
ArrayIndex const size = value.size();
bool isMultiLine = size * 3 >= rightMargin_;
childValues_.clear();
Expand Down Expand Up @@ -703,7 +703,7 @@ void StyledStreamWriter::writeArrayValue(const Value& value) {
if (size == 0)
pushValue("[]");
else {
bool isArrayMultiLine = isMultineArray(value);
bool isArrayMultiLine = isMultilineArray(value);
if (isArrayMultiLine) {
writeWithIndent("[");
indent();
Expand Down Expand Up @@ -743,7 +743,7 @@ void StyledStreamWriter::writeArrayValue(const Value& value) {
}
}

bool StyledStreamWriter::isMultineArray(const Value& value) {
bool StyledStreamWriter::isMultilineArray(const Value& value) {
ArrayIndex const size = value.size();
bool isMultiLine = size * 3 >= rightMargin_;
childValues_.clear();
Expand Down Expand Up @@ -860,7 +860,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
private:
void writeValue(Value const& value);
void writeArrayValue(Value const& value);
bool isMultineArray(Value const& value);
bool isMultilineArray(Value const& value);
void pushValue(JSONCPP_STRING const& value);
void writeIndent();
void writeWithIndent(JSONCPP_STRING const& value);
Expand Down Expand Up @@ -984,7 +984,7 @@ void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
if (size == 0)
pushValue("[]");
else {
bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value);
bool isMultiLine = (cs_ == CommentStyle::All) || isMultilineArray(value);
if (isMultiLine) {
writeWithIndent("[");
indent();
Expand Down Expand Up @@ -1026,7 +1026,7 @@ void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
}
}

bool BuiltStyledStreamWriter::isMultineArray(Value const& value) {
bool BuiltStyledStreamWriter::isMultilineArray(Value const& value) {
ArrayIndex const size = value.size();
bool isMultiLine = size * 3 >= rightMargin_;
childValues_.clear();
Expand Down
Loading

0 comments on commit e6a588a

Please sign in to comment.