diff --git a/NEWS.txt b/NEWS.txt index 71edd19..e53b880 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -13,8 +13,8 @@ Notes: you need to setup the environment by running vcvars32.bat (e.g. MSVC 2008 command prompt in start menu) before running scons. - - Added support for amalgated source and header generation (a la sqlite). - Refer to README.txt section "Generating amalgated source and header" + - Added support for amalgamated source and header generation (a la sqlite). + Refer to README.txt section "Generating amalgamated source and header" for detail. * Value diff --git a/README.txt b/README.txt index ba70329..51a098a 100644 --- a/README.txt +++ b/README.txt @@ -90,30 +90,30 @@ Notes that the documentation is also available for download as a tarball. The documentation of the latest release is available online at: http://jsoncpp.sourceforge.net/ -* Generating amalgated source and header - ====================================== +* Generating amalgamated source and header + ======================================== JsonCpp is provided with a script to generate a single header and a single source file to ease inclusion in an existing project. -The amalgated source can be generated at any time by running the following +The amalgamated source can be generated at any time by running the following command from the top-directory (requires python 2.6): -python amalgate.py +python amalgamate.py It is possible to specify header name. See -h options for detail. By default, the following files are generated: - dist/jsoncpp.cpp: source file that need to be added to your project - dist/json/json.h: header file corresponding to use in your project. It is -equivalent to including json/json.h in non-amalgated source. This header +equivalent to including json/json.h in non-amalgamated source. This header only depends on standard headers. - dist/json/json-forwards.h: header the provides forward declaration of all JsonCpp types. This typically what should be included in headers to speed-up compilation. -The amalgated sources are generated by concatenating JsonCpp source in the -correct order and defining macro JSON_IS_AMALGATED to prevent inclusion of -other headers. +The amalgamated sources are generated by concatenating JsonCpp source in the +correct order and defining macro JSON_IS_AMALGAMATION to prevent inclusion +of other headers. * Using json-cpp in your project: =============================== diff --git a/amalgate.py b/amalgamate.py similarity index 90% rename from amalgate.py rename to amalgamate.py index 502971c..1476a5f 100644 --- a/amalgate.py +++ b/amalgamate.py @@ -9,7 +9,7 @@ import os import os.path import sys -class AmalagatedFile: +class AmalgamationFile: def __init__( self, top_dir ): self.top_dir = top_dir self.blocks = [] @@ -47,9 +47,9 @@ class AmalagatedFile: f.write( self.get_value() ) f.close() -def amalgate_source( source_top_dir=None, - target_source_path=None, - header_include_path=None ): +def amalgamate_source( source_top_dir=None, + target_source_path=None, + header_include_path=None ): """Produces amalgated source. Parameters: source_top_dir: top-directory @@ -57,7 +57,7 @@ def amalgate_source( source_top_dir=None, header_include_path: generated header path relative to target_source_path. """ print 'Amalgating header...' - header = AmalagatedFile( source_top_dir ) + header = AmalgamationFile( source_top_dir ) header.add_text( '/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).' ) header.add_text( '/// It is intented to be used with #include <%s>' % header_include_path ) header.add_file( 'LICENSE', wrap_in_comment=True ) @@ -81,7 +81,7 @@ def amalgate_source( source_top_dir=None, base, ext = os.path.splitext( header_include_path ) forward_header_include_path = base + '-forwards' + ext print 'Amalgating forward header...' - header = AmalagatedFile( source_top_dir ) + header = AmalgamationFile( source_top_dir ) header.add_text( '/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).' ) header.add_text( '/// It is intented to be used with #include <%s>' % forward_header_include_path ) header.add_text( '/// This header provides forward declaration for all JsonCpp types.' ) @@ -101,7 +101,7 @@ def amalgate_source( source_top_dir=None, header.write_to( target_forward_header_path ) print 'Amalgating source...' - source = AmalagatedFile( source_top_dir ) + source = AmalgamationFile( source_top_dir ) source.add_text( '/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).' ) source.add_text( '/// It is intented to be used with #include <%s>' % header_include_path ) source.add_file( 'LICENSE', wrap_in_comment=True ) @@ -134,9 +134,9 @@ Generate a single amalgated source and header file from the sources. parser.enable_interspersed_args() options, args = parser.parse_args() - msg = amalgate_source( source_top_dir=options.top_dir, - target_source_path=options.target_source_path, - header_include_path=options.header_include_path ) + msg = amalgamate_source( source_top_dir=options.top_dir, + target_source_path=options.target_source_path, + header_include_path=options.header_include_path ) if msg: sys.stderr.write( msg + '\n' ) sys.exit( 1 ) diff --git a/include/json/config.h b/include/json/config.h index 24991d5..7609d45 100644 --- a/include/json/config.h +++ b/include/json/config.h @@ -31,7 +31,7 @@ /// If defined, indicates that the source file is amalgated /// to prevent private header inclusion. /// Remarks: it is automatically defined in the generated amalgated header. -// #define JSON_IS_AMALGATED +// #define JSON_IS_AMALGAMATION # ifdef JSON_IN_CPPTL diff --git a/include/json/features.h b/include/json/features.h index 0b53db1..4353278 100644 --- a/include/json/features.h +++ b/include/json/features.h @@ -6,9 +6,9 @@ #ifndef CPPTL_JSON_FEATURES_H_INCLUDED # define CPPTL_JSON_FEATURES_H_INCLUDED -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include "forwards.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { diff --git a/include/json/forwards.h b/include/json/forwards.h index 083d44f..ab863da 100644 --- a/include/json/forwards.h +++ b/include/json/forwards.h @@ -6,9 +6,9 @@ #ifndef JSON_FORWARDS_H_INCLUDED # define JSON_FORWARDS_H_INCLUDED -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include "config.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { diff --git a/include/json/reader.h b/include/json/reader.h index 34dc785..0a324df 100644 --- a/include/json/reader.h +++ b/include/json/reader.h @@ -6,10 +6,10 @@ #ifndef CPPTL_JSON_READER_H_INCLUDED # define CPPTL_JSON_READER_H_INCLUDED -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include "features.h" # include "value.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) # include # include # include diff --git a/include/json/value.h b/include/json/value.h index c9c7e1d..32e3455 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -6,9 +6,9 @@ #ifndef CPPTL_JSON_H_INCLUDED # define CPPTL_JSON_H_INCLUDED -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include "forwards.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) # include # include diff --git a/include/json/writer.h b/include/json/writer.h index cb0bd9b..4789363 100644 --- a/include/json/writer.h +++ b/include/json/writer.h @@ -6,9 +6,9 @@ #ifndef JSON_WRITER_H_INCLUDED # define JSON_WRITER_H_INCLUDED -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include "value.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) # include # include # include diff --git a/makerelease.py b/makerelease.py index a6e330e..6b8eec3 100644 --- a/makerelease.py +++ b/makerelease.py @@ -23,7 +23,7 @@ import tempfile import os import time from devtools import antglob, fixeol, tarball -import amalgate +import amalgamate SVN_ROOT = 'https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/' SVN_TAG_ROOT = SVN_ROOT + 'tags/jsoncpp' @@ -323,13 +323,13 @@ Warning: --force should only be used when developping/testing the release script print 'Generating source tarball to', source_tarball_path tarball.make_tarball( source_tarball_path, [export_dir], export_dir, prefix_dir=source_dir ) - amalgated_tarball_path = 'dist/%s-amalgated.tar.gz' % source_dir - print 'Generating amalgated source tarball to', amalgated_tarball_path - amalgated_dir = 'dist/amalgated' - amalgate.amalgate_source( export_dir, '%s/jsoncpp.cpp' % amalgated_dir, 'json/json.h' ) - amalgated_source_dir = 'jsoncpp-src-amalgated' + release_version - tarball.make_tarball( amalgated_tarball_path, [amalgated_dir], - amalgated_dir, prefix_dir=amalgated_source_dir ) + amalgamation_tarball_path = 'dist/%s-amalgamation.tar.gz' % source_dir + print 'Generating amalgamation source tarball to', amalgamation_tarball_path + amalgamation_dir = 'dist/amalgamation' + amalgamate.amalgamate_source( export_dir, '%s/jsoncpp.cpp' % amalgamation_dir, 'json/json.h' ) + amalgamation_source_dir = 'jsoncpp-src-amalgamation' + release_version + tarball.make_tarball( amalgamation_tarball_path, [amalgamation_dir], + amalgamation_dir, prefix_dir=amalgamation_source_dir ) # Decompress source tarball, download and install scons-local distcheck_dir = 'dist/distcheck' diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp index fa46dca..8bb0304 100644 --- a/src/lib_json/json_reader.cpp +++ b/src/lib_json/json_reader.cpp @@ -3,11 +3,11 @@ // recognized in your jurisdiction. // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include # include # include "json_tool.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) #include #include #include diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index ec3fb2e..ff98f63 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -3,13 +3,13 @@ // recognized in your jurisdiction. // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include # include # ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR # include "json_batchallocator.h" # endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) #include #include #include @@ -83,14 +83,14 @@ releaseStringValue( char *value ) // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # ifdef JSON_VALUE_USE_INTERNAL_MAP # include "json_internalarray.inl" # include "json_internalmap.inl" # endif // JSON_VALUE_USE_INTERNAL_MAP # include "json_valueiterator.inl" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 90e5c1b..1bda183 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -3,10 +3,10 @@ // recognized in your jurisdiction. // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE -#if !defined(JSON_IS_AMALGATED) +#if !defined(JSON_IS_AMALGAMATION) # include # include "json_tool.h" -#endif // if !defined(JSON_IS_AMALGATED) +#endif // if !defined(JSON_IS_AMALGAMATION) #include #include #include