Rebase for jsoncpp 1.7.7 10/95610/1
authorBaptiste Lepilleur <baptiste.lepilleur@gmail.com>
Thu, 15 Mar 2007 22:11:38 +0000 (22:11 +0000)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 4 Nov 2016 04:19:41 +0000 (13:19 +0900)
Change-Id: Id7e14a69421eb8b9a6888557f936a02bc8aebd8c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
51 files changed:
.gitignore
CMakeLists.txt
README.md~upstream_1.7.7 [new file with mode: 0644]
amalgate.py [new file with mode: 0644]
devtools/wscript [new file with mode: 0644]
include/json/config.h
include/json/reader.h
include/json/value.h
include/json/version.h
include/json/writer.h
makefiles/vs71/jsontest.vcproj~upstream_1.7.7 [new file with mode: 0644]
makefiles/vs71/lib_json.vcproj~upstream_1.7.7 [new file with mode: 0644]
packaging/baselibs.conf [new file with mode: 0644]
packaging/jsoncpp.manifest [new file with mode: 0644]
packaging/jsoncpp.spec [new file with mode: 0644]
pkg-config/jsoncpp.pc.in
scons-tools/doxygen.py [new file with mode: 0644]
scons-tools/glob.py [new file with mode: 0644]
src/lib_json/CMakeLists.txt
src/lib_json/json_reader.cpp
src/lib_json/json_tool.h
src/lib_json/json_value.cpp
src/lib_json/json_valueiterator.inl
src/lib_json/json_writer.cpp
src/test_lib_json/jsontest.h
src/test_lib_json/main.cpp
test/data/test_basic_08.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_basic_09.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_comment_01.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_comment_01.json~upstream_1.7.7 [new file with mode: 0644]
test/data/test_integer_01.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_integer_02.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_integer_03.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_integer_04.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_preserve_comment_01.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_01.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_02.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_03.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_04.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_05.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_06.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_real_07.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_string_01.json~upstream_1.7.7 [new file with mode: 0644]
test/data/test_string_02.json~upstream_1.7.7 [new file with mode: 0644]
test/data/test_string_unicode_01.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_string_unicode_02.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_string_unicode_03.expected~upstream_1.7.7 [new file with mode: 0644]
test/data/test_string_unicode_04.expected~upstream_1.7.7 [new file with mode: 0644]
test/jsontestrunner.py [new file with mode: 0644]
travis.sh
version

index 7dacb0b..ef226a8 100644 (file)
@@ -34,19 +34,3 @@ CTestTestFile.cmake
 cmake_install.cmake
 pkg-config/jsoncpp.pc
 jsoncpp_lib_static.dir/
-
-# In case someone runs cmake in the root-dir:
-/CMakeCache.txt
-/Makefile
-/include/Makefile
-/src/Makefile
-/src/jsontestrunner/Makefile
-/src/jsontestrunner/jsontestrunner_exe
-/src/lib_json/Makefile
-/src/test_lib_json/Makefile
-/src/test_lib_json/jsoncpp_test
-
-# eclipse project files
-.project
-.cproject
-/.settings/
index c34e169..bfae4cd 100644 (file)
@@ -4,14 +4,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
 PROJECT(jsoncpp)
 ENABLE_TESTING()
 
-OPTION(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" ON)
-OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
+OPTION(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" OFF)
+OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF)
 OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
 OPTION(JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C and ISO C++" ON)
 OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
 OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF)
-OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
-OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
+OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." ON)
+OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." OFF)
 
 # Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
 IF(NOT WIN32)
@@ -22,21 +22,16 @@ IF(NOT WIN32)
     ENDIF()
 ENDIF()
 
-# Enable runtime search path support for dynamic libraries on OSX
-IF(APPLE)
-    SET(CMAKE_MACOSX_RPATH 1)
-ENDIF()
-
 SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
 SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
 
 SET(RUNTIME_INSTALL_DIR bin
     CACHE PATH "Install dir for executables and dlls")
-SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
+SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
     CACHE PATH "Install dir for static libraries")
-SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
+SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
     CACHE PATH "Install dir for shared libraries")
-SET(INCLUDE_INSTALL_DIR include
+SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
     CACHE PATH "Install dir for headers")
 SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
     CACHE PATH "Install dir for cmake package config files")
@@ -69,7 +64,7 @@ ENDMACRO()
 #SET( JSONCPP_VERSION_MAJOR X )
 #SET( JSONCPP_VERSION_MINOR Y )
 #SET( JSONCPP_VERSION_PATCH Z )
-SET( JSONCPP_VERSION 1.7.7 )
+SET( JSONCPP_VERSION 1.6.5 )
 jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
 #IF(NOT JSONCPP_VERSION_FOUND)
 #    MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
@@ -110,20 +105,13 @@ endif()
 
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   # using regular Clang or AppleClang
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wno-sign-conversion")
 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
   # using GCC
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra")
   # not yet ready for -Wsign-conversion
 
   if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion -pedantic")
-  endif ()
-elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
-  # using Intel compiler
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion")
-
-  if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
   endif ()
 endif()
diff --git a/README.md~upstream_1.7.7 b/README.md~upstream_1.7.7
new file mode 100644 (file)
index 0000000..93c8d1f
--- /dev/null
@@ -0,0 +1,214 @@
+Introduction
+------------
+
+[JSON][json-org] is a lightweight data-interchange format. It can represent
+numbers, strings, ordered sequences of values, and collections of name/value
+pairs.
+
+[json-org]: http://json.org/
+
+[JsonCpp][] is a C++ library that allows manipulating JSON values, including
+serialization and deserialization to and from strings. It can also preserve
+existing comment in unserialization/serialization steps, making it a convenient
+format to store user input files.
+
+[JsonCpp]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
+
+## A note on backward-compatibility
+* `1.y.z` is built with C++11.
+* `0.y.z` can be used with older compilers.
+* Major versions maintain binary-compatibility.
+
+# Using JsonCpp in your project
+-----------------------------
+The recommended approach to integrating JsonCpp in your project is to include
+the [amalgamated source](#generating-amalgamated-source-and-header) (a single 
+`.cpp` file and two `.h` files) in your project, and compile and build as you 
+would any other source file. This ensures consistency of compilation flags and
+ABI compatibility, issues which arise when building shared or static 
+libraries. See the next section for instructions.
+  
+The `include/` should be added to your compiler include path. Jsoncpp headers
+should be included as follow:
+
+    #include <json/json.h>
+
+If JsonCpp was built as a dynamic library on Windows, then your project needs to
+define the macro `JSON_DLL`.
+
+Generating amalgamated source and header
+----------------------------------------
+JsonCpp is provided with a script to generate a single header and a single
+source file to ease inclusion into an existing project. The amalgamated source
+can be generated at any time by running the following command from the
+top-directory (this requires Python 2.6):
+
+    python amalgamate.py
+
+It is possible to specify header name. See the `-h` option for detail.
+
+By default, the following files are generated:
+* `dist/jsoncpp.cpp`: source file that needs to be added to your project.
+* `dist/json/json.h`: corresponding header file for use in your project. It is
+  equivalent to including `json/json.h` in non-amalgamated source. This header
+  only depends on standard headers.
+* `dist/json/json-forwards.h`: header that provides forward declaration of all
+  JsonCpp types.
+
+The amalgamated sources are generated by concatenating JsonCpp source in the
+correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
+of other headers.
+
+# Contributing to JsonCpp
+
+Building and testing with CMake
+-------------------------------
+[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
+Linux system as package. On Ubuntu:
+
+    sudo apt-get install cmake
+
+[CMake]: http://www.cmake.org
+
+Note that Python is also required to run the JSON reader/writer tests. If
+missing, the build will skip running those tests.
+
+When running CMake, a few parameters are required:
+
+* a build directory where the makefiles/solution are generated. It is also used
+  to store objects, libraries and executables files.
+* the generator to use: makefiles or Visual Studio solution? What version or
+  Visual Studio, 32 or 64 bits solution? 
+
+Steps for generating solution/makefiles using `cmake-gui`:
+
+* Make "source code" point to the source directory.
+* Make "where to build the binary" point to the directory to use for the build.
+* Click on the "Grouped" check box.
+* Review JsonCpp build options (tick `BUILD_SHARED_LIBS` to build as a
+  dynamic library).
+* Click the configure button at the bottom, then the generate button.
+* The generated solution/makefiles can be found in the binary directory.
+
+Alternatively, from the command-line on Unix in the source directory:
+
+    mkdir -p build/debug
+    cd build/debug
+    cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
+    make
+
+Running `cmake -h` will display the list of available generators (passed using
+the `-G` option).
+
+By default CMake hides compilation commands. This can be modified by specifying
+`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
+
+Building and testing with SCons
+-------------------------------
+**Note:** The SCons-based build system is deprecated. Please use CMake; see the
+section above.
+
+JsonCpp can use [Scons][] as a build system. Note that SCons requires Python to
+be installed.
+
+[SCons]: http://www.scons.org/
+
+Invoke SCons as follows:
+
+    scons platform=$PLATFORM [TARGET]
+
+where `$PLATFORM` may be one of:
+
+* `suncc`: Sun C++ (Solaris)
+* `vacpp`: Visual Age C++ (AIX)
+* `mingw`
+* `msvc6`: Microsoft Visual Studio 6 service pack 5-6
+* `msvc70`: Microsoft Visual Studio 2002
+* `msvc71`: Microsoft Visual Studio 2003
+* `msvc80`: Microsoft Visual Studio 2005
+* `msvc90`: Microsoft Visual Studio 2008
+* `linux-gcc`: Gnu C++ (linux, also reported to work for Mac OS X)
+
+If you are building with Microsoft Visual Studio 2008, you need to set up the
+environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
+running SCons.
+
+## Running the tests manually
+You need to run tests manually only if you are troubleshooting an issue.
+
+In the instructions below, replace `path/to/jsontest` with the path of the
+`jsontest` executable that was compiled on your platform.
+
+    cd test
+    # This will run the Reader/Writer tests
+    python runjsontests.py path/to/jsontest
+    
+    # This will run the Reader/Writer tests, using JSONChecker test suite
+    # (http://www.json.org/JSON_checker/).
+    # Notes: not all tests pass: JsonCpp is too lenient (for example,
+    # it allows an integer to start with '0'). The goal is to improve
+    # strict mode parsing to get all tests to pass.
+    python runjsontests.py --with-json-checker path/to/jsontest
+    
+    # This will run the unit tests (mostly Value)
+    python rununittests.py path/to/test_lib_json
+    
+    # You can run the tests using valgrind:
+    python rununittests.py --valgrind path/to/test_lib_json
+
+## Running the tests using scons
+Note that tests can be run using SCons using the `check` target:
+
+    scons platform=$PLATFORM check
+
+Building the documentation
+--------------------------
+Run the Python script `doxybuild.py` from the top directory:
+
+    python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
+
+See `doxybuild.py --help` for options.
+
+Adding a reader/writer test
+---------------------------
+To add a test, you need to create two files in test/data:
+
+* a `TESTNAME.json` file, that contains the input document in JSON format.
+* a `TESTNAME.expected` file, that contains a flatened representation of the
+  input document.
+
+The `TESTNAME.expected` file format is as follows:
+
+* each line represents a JSON element of the element tree represented by the
+  input document.
+* each line has two parts: the path to access the element separated from the
+  element value by `=`. Array and object values are always empty (i.e.
+  represented by either `[]` or `{}`).
+* element path: `.` represents the root element, and is used to separate object
+  members. `[N]` is used to specify the value of an array element at index `N`.
+
+See the examples `test_complex_01.json` and `test_complex_01.expected` to better
+understand element paths.
+
+Understanding reader/writer test output
+---------------------------------------
+When a test is run, output files are generated beside the input test files.
+Below is a short description of the content of each file:
+
+* `test_complex_01.json`: input JSON document.
+* `test_complex_01.expected`: flattened JSON element tree used to check if
+  parsing was corrected.
+* `test_complex_01.actual`: flattened JSON element tree produced by `jsontest`
+  from reading `test_complex_01.json`.
+* `test_complex_01.rewrite`: JSON document written by `jsontest` using the
+  `Json::Value` parsed from `test_complex_01.json` and serialized using
+  `Json::StyledWritter`.
+* `test_complex_01.actual-rewrite`: flattened JSON element tree produced by
+  `jsontest` from reading `test_complex_01.rewrite`.
+* `test_complex_01.process-output`: `jsontest` output, typically useful for
+  understanding parsing errors.
+
+License
+-------
+See the `LICENSE` file for details. In summary, JsonCpp is licensed under the
+MIT license, or public domain if desired and recognized in your jurisdiction.
diff --git a/amalgate.py b/amalgate.py
new file mode 100644 (file)
index 0000000..9d8facc
--- /dev/null
@@ -0,0 +1,147 @@
+"""Amalgate json-cpp library sources into a single source and header file.
+
+Requires Python 2.6
+
+Example of invocation (must be invoked from json-cpp top directory):
+python amalgate.py
+"""
+import os
+import os.path
+import sys
+
+class AmalagatedFile:
+    def __init__( self, top_dir ):
+        self.top_dir = top_dir
+        self.blocks = []
+
+    def add_text( self, text ):
+        if not text.endswith( '\n' ):
+            text += '\n'
+        self.blocks.append( text )
+
+    def add_file( self, relative_input_path, wrap_in_comment=False ):
+        def add_marker( prefix ):
+            self.add_text( '' )
+            self.add_text( '// ' + '/'*70 )
+            self.add_text( '// %s of content of file: %s' % (prefix, relative_input_path.replace('\\','/')) )
+            self.add_text( '// ' + '/'*70 )
+            self.add_text( '' )
+        add_marker( 'Beginning' )
+        f = open( os.path.join( self.top_dir, relative_input_path ), 'rt' )
+        content = f.read()
+        if wrap_in_comment:
+            content = '/*\n' + content + '\n*/'
+        self.add_text( content )
+        f.close()
+        add_marker( 'End' )
+        self.add_text( '\n\n\n\n' )
+
+    def get_value( self ):
+        return ''.join( self.blocks ).replace('\r\n','\n')
+
+    def write_to( self, output_path ):
+        output_dir = os.path.dirname( output_path )
+        if output_dir and not os.path.isdir( output_dir ):
+            os.makedirs( output_dir )
+        f = open( output_path, 'wb' )
+        f.write( self.get_value() )
+        f.close()
+
+def amalgate_source( source_top_dir=None,
+                     target_source_path=None,
+                     header_include_path=None ):
+    """Produces amalgated 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...'
+    header = AmalagatedFile( 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 )
+    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( '/// to prevent private header inclusion.' )
+    header.add_text( '#define JSON_IS_AMALGATED' )
+    header.add_file( 'include/json/config.h' )
+    header.add_file( 'include/json/forwards.h' )
+    header.add_file( 'include/json/features.h' )
+    header.add_file( 'include/json/value.h' )
+    header.add_file( 'include/json/reader.h' )
+    header.add_file( 'include/json/writer.h' )
+    header.add_text( '#endif //ifndef JSON_AMALGATED_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
+    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...'
+    header = AmalagatedFile( 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.' )
+    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( '/// to prevent private header inclusion.' )
+    header.add_text( '#define JSON_IS_AMALGATED' )
+    header.add_file( 'include/json/config.h' )
+    header.add_file( 'include/json/forwards.h' )
+    header.add_text( '#endif //ifndef JSON_FORWARD_AMALGATED_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
+    header.write_to( target_forward_header_path )
+
+    print 'Amalgating source...'
+    source = AmalagatedFile( 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 )
+    source.add_text( '' )
+    source.add_text( '#include <%s>' % header_include_path )
+    source.add_text( '' )
+    source.add_file( 'src/lib_json\json_tool.h' )
+    source.add_file( 'src/lib_json\json_reader.cpp' )
+    source.add_file( 'src/lib_json\json_batchallocator.h' )
+    source.add_file( 'src/lib_json\json_valueiterator.inl' )
+    source.add_file( 'src/lib_json\json_value.cpp' )
+    source.add_file( 'src/lib_json\json_writer.cpp' )
+
+    print 'Writing amalgated 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.
+"""
+    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]""")
+    parser.add_option('-t', '--top-dir', dest="top_dir", action='store', default=os.getcwd(),
+        help="""Source top-directory. [Default: %default]""")
+    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 )
+    if msg:
+        sys.stderr.write( msg + '\n' )
+        sys.exit( 1 )
+    else:
+        print 'Source succesfully amalagated'
+if __name__ == '__main__':
+    main()
diff --git a/devtools/wscript b/devtools/wscript
new file mode 100644 (file)
index 0000000..f59bc94
--- /dev/null
@@ -0,0 +1,225 @@
+VERSION='0.1.0'
+APPNAME='CppUnit2'
+srcdir = '.'
+blddir = 'build'
+
+import Options
+import Logs
+import UnitTest
+import Utils
+import os.path
+import sys
+import glob
+
+CPPUT_EXAMPLES = '''
+    checking_assertions
+    ignore_failure_demo
+    input_test
+    light_fixture
+    log_demo
+    parametrized_test
+    stringize_demo
+    test_function
+    '''.split()
+
+BROKEN_CPPUT_EXAMPLES = '''
+    input_based_test
+    opentest_demo
+    table_fixture
+    '''.split()
+
+def _get_example_dirs():
+    return [ os.path.join( 'examples', d )
+             for d in CPPUT_EXAMPLES ]
+
+def _get_main_script_dir():
+    """Gets the path of the directory containing this script."""
+    # The main script path is only valid once the it has been executed, hence this can not be a global var.
+    assert Utils.g_module is not None
+    return os.path.split( Utils.g_module.root_path )[0]
+
+def _fix_import_path():
+    """Adds the main script directory to be able to import waftools modules."""
+    import_dir = _get_main_script_dir()
+    if import_dir not in sys.path:
+        sys.path.append( import_dir )
+
+def _get_tool_dir():
+    return os.path.join( main_script_dir, 'waftools' )
+
+def set_options(opt):
+    """Always called first during the build."""
+    _fix_import_path()
+    import waftools.log_output
+    waftools.log_output.set_options( opt )
+
+    # Adds command-line options for compiler
+    opt.tool_options('compiler_cxx')
+
+    # from compiler_cxx tools, set_options
+    import Tools.ccroot as ccroot
+    opt.add_option('-d', '--debug-level',
+        action = 'store',
+        default = ccroot.DEBUG_LEVELS.RELEASE,
+        help = "Specify the debug level, does nothing if CXXFLAGS is set in the environment. [Allowed Values: '%s'] " % "', '".join(ccroot.DEBUG_LEVELS.ALL) +
+               "[default: %default]",
+        choices = ccroot.DEBUG_LEVELS.ALL,
+        dest = 'debug_level')
+
+def init():
+    """Called set_options() once the command-line has been parsed.
+       Command-line options value are accessed through Options.options.
+    """
+    import waftools.log_output
+    waftools.log_output.init()
+
+    
+def configure(conf):
+    # There is a link issue with msvc 9!
+    conf.env['MSVC_VERSIONS'] = ['msvc 8.0']
+
+    # CXX=g++-3.0 ./waf.py configure will use g++-3.0 instead of 'g++'
+    conf.check_tool('compiler_cxx')
+
+    # Select debug/optimize flags
+    debug_level = Options.options.debug_level.upper()
+    conf.env.append_unique('CXXFLAGS', conf.env['CXXFLAGS_' + debug_level])
+
+    compiler = conf.env['COMPILER_CXX']
+    if compiler == 'msvc':  # Microsoft Visual Studio specifics
+        # Select run-time library variant
+        if 'DEBUG' in debug_level:
+            crt_variant = 'MULTITHREADED_DLL_DBG'
+        else:
+            crt_variant = 'MULTITHREADED_DLL'
+        # MULTITHREADED, MULTITHREADED_DLL, MULTITHREADED_DBG, MULTITHREADED_DLL_DBG
+        conf.env.append_unique('CPPFLAGS', conf.env['CPPFLAGS_CRT_' + crt_variant])
+        conf.env.append_unique('CPPDEFINES', conf.env['CPPDEFINES_CRT_' + crt_variant])
+    
+    ## batched builds can be enabled by including the module optim_cc
+    # conf.check_tool('batched_cc')
+   
+   
+# WAF command:
+
+def build(bld):
+    # process subfolders from here
+    bld.add_subdirs('''src/cpptl 
+                       src/cpput 
+                       src/cpputtest''')
+
+    bld.add_subdirs( _get_example_dirs() )
+
+def gen_examples_wscript(ctx):
+    for example_dir in _get_example_dirs():
+        wscript_path = os.path.join( example_dir, 'wscript_build' )
+        sources = glob.glob( os.path.join( example_dir, '*.cpp' ) )
+        Logs.info( 'Generating "%s"' % wscript_path )
+        open( wscript_path, 'wb' ).write( """\
+#! /usr/bin/env python
+# encoding: utf-8
+# Baptiste Lepilleur, 2009
+
+bld.new_task_gen(
+    features = 'cxx cprogram',
+    source = '''%(sources)s''',
+    includes = '../.. ../../include',               # for examples/common
+    uselib_local = 'cpptl cpput',
+    name = 'example_%(name)s',
+    target = 'example_%(name)s' )
+""" % {
+    'sources': ' '.join( [os.path.basename(s) for s in sources] ),
+    'name': os.path.basename( example_dir )
+    } )
+
+def _fix_python_source( path, is_dry_run = True, verbose = True ):
+    """Makes sure that all sources have unix EOL and replace tabs with 4 spaces."""
+    from waftools import reindent
+    if not os.path.isfile( path ):
+        raise ValueError( 'Path "%s" is not a file' % path )
+    try:
+        f = open(path, 'rb')
+    except IOError, msg:
+        print >> sys.stderr, "%s: I/O Error: %s" % (file, str(msg))
+        return False
+
+    if verbose:
+        print '%s =>' % path, 
+    try:
+        r = reindent.Reindenter(f)
+    finally:
+        f.close()
+    if r.run(): # File need to be fixed ?
+        if not is_dry_run:
+            f = open(path, "wb")
+            try:
+                r.write(f)
+            finally:
+                f.close()
+        if verbose:
+            print is_dry_run and ' NEED FIX' or ' FIXED'
+    elif verbose:
+        print ' OK'
+    return True
+
+def _fix_source_eol( path, is_dry_run = True, verbose = True, eol = '\n' ):
+    """Makes sure that all sources have the specified eol sequence (default: unix)."""
+    if not os.path.isfile( path ):
+        raise ValueError( 'Path "%s" is not a file' % path )
+    try:
+        f = open(path, 'rb')
+    except IOError, msg:
+        print >> sys.stderr, "%s: I/O Error: %s" % (file, str(msg))
+        return False
+    try:
+        raw_lines = f.readlines()
+    finally:
+        f.close()
+    fixed_lines = [line.rstrip('\r\n') + eol for line in raw_lines]
+    if raw_lines != fixed_lines:
+        print '%s =>' % path,
+        if not is_dry_run:
+            f = open(path, "wb")
+            try:
+                f.writelines(fixed_lines)
+            finally:
+                f.close()
+        if verbose:
+            print is_dry_run and ' NEED FIX' or ' FIXED'
+    return True
+    
+    
+
+def _do_fix( is_dry_run = True ):
+    from waftools import antglob
+    python_sources = antglob.glob( '.',
+        includes = '**/*.py **/wscript **/wscript_build',
+        excludes = antglob.default_excludes + './waf.py',
+        prune_dirs = antglob.prune_dirs + 'waf-* ./build' )
+    for path in python_sources:
+        _fix_python_source( path, is_dry_run )
+
+    cpp_sources = antglob.glob( '.',
+        includes = '**/*.cpp **/*.h **/*.inl',
+        prune_dirs = antglob.prune_dirs + 'waf-* ./build' )
+    for path in cpp_sources:
+        _fix_source_eol( path, is_dry_run )
+
+
+def dry_fix(context):
+    _do_fix( is_dry_run = True )
+
+def fix(context):
+    _do_fix( is_dry_run = False )
+
+def shutdown():
+    pass
+
+def check(context):
+    # Unit tests are run when "check" target is used
+    ut = UnitTest.unit_test()
+    ut.change_to_testfile_dir = True
+    ut.want_to_see_test_output = True
+    ut.want_to_see_test_error = True
+    ut.run()
+    ut.print_results()
index 7f77d0c..6f61311 100644 (file)
 
 #endif // defined(_MSC_VER)
 
-// In c++11 the override keyword allows you to explicity 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
-# define JSONCPP_OVERRIDE override
-#elif defined(_MSC_VER) && _MSC_VER > 1600
-# define JSONCPP_OVERRIDE override
-#else
-# define JSONCPP_OVERRIDE
-#endif
 
 #ifndef JSON_HAS_RVALUE_REFERENCES
 
index caf8727..959b5d6 100644 (file)
@@ -333,9 +333,9 @@ public:
   Json::Value settings_;
 
   CharReaderBuilder();
-  ~CharReaderBuilder() JSONCPP_OVERRIDE;
+  ~CharReaderBuilder() override;
 
-  CharReader* newCharReader() const JSONCPP_OVERRIDE;
+  CharReader* newCharReader() const override;
 
   /** \return true if 'settings' are legal and consistent;
    *   otherwise, indicate bad settings via 'invalid'.
index fb88c18..b1873bd 100644 (file)
@@ -52,11 +52,11 @@ namespace Json {
  */
 class JSON_API Exception : public std::exception {
 public:
-  Exception(JSONCPP_STRING const& msg);
-  ~Exception() throw() JSONCPP_OVERRIDE;
-  char const* what() const throw() JSONCPP_OVERRIDE;
+  Exception(std::string const& msg);
+  ~Exception() throw() override;
+  char const* what() const throw() override;
 protected:
-  JSONCPP_STRING msg_;
+  std::string msg_;
 };
 
 /** Exceptions which the user cannot easily avoid.
@@ -67,7 +67,7 @@ protected:
  */
 class JSON_API RuntimeError : public Exception {
 public:
-  RuntimeError(JSONCPP_STRING const& msg);
+  RuntimeError(std::string const& msg);
 };
 
 /** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
@@ -78,7 +78,7 @@ public:
  */
 class JSON_API LogicError : public Exception {
 public:
-  LogicError(JSONCPP_STRING const& msg);
+  LogicError(std::string const& msg);
 };
 
 /// used internally
@@ -505,7 +505,7 @@ Json::Value obj_value(Json::objectValue); // {}
   /// Same as removeMember(const char*)
   /// \param key may contain embedded nulls.
   /// \deprecated
-  Value removeMember(const JSONCPP_STRING& key);
+  Value removeMember(const std::string& key);
   /// Same as removeMember(const char* begin, const char* end, Value* removed),
   /// but 'key' is null-terminated.
   bool removeMember(const char* key, Value* removed);
@@ -515,8 +515,8 @@ Json::Value obj_value(Json::objectValue); // {}
       \param key may contain embedded nulls.
       \return true iff removed (no exceptions)
   */
-  bool removeMember(JSONCPP_STRING const& key, Value* removed);
-  /// Same as removeMember(JSONCPP_STRING const& key, Value* removed)
+  bool removeMember(std::string const& key, Value* removed);
+  /// Same as removeMember(std::string const& key, Value* removed)
   bool removeMember(const char* begin, const char* end, Value* removed);
   /** \brief Remove the indexed array element.
 
@@ -531,8 +531,8 @@ Json::Value obj_value(Json::objectValue); // {}
   bool isMember(const char* key) const;
   /// Return true if the object has a member named key.
   /// \param key may contain embedded nulls.
-  bool isMember(const JSONCPP_STRING& key) const;
-  /// Same as isMember(JSONCPP_STRING const& key)const
+  bool isMember(const std::string& key) const;
+  /// Same as isMember(std::string const& key)const
   bool isMember(const char* begin, const char* end) const;
 #ifdef JSON_USE_CPPTL
   /// Return true if the object has a member named key.
index 24e2b09..ec93fd6 100644 (file)
@@ -3,10 +3,10 @@
 #ifndef JSON_VERSION_H_INCLUDED
 # define JSON_VERSION_H_INCLUDED
 
-# define JSONCPP_VERSION_STRING "1.7.7"
+# define JSONCPP_VERSION_STRING "1.6.5"
 # define JSONCPP_VERSION_MAJOR 1
-# define JSONCPP_VERSION_MINOR 7
-# define JSONCPP_VERSION_PATCH 7
+# define JSONCPP_VERSION_MINOR 6
+# define JSONCPP_VERSION_PATCH 5
 # define JSONCPP_VERSION_QUALIFIER
 # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
 
index 2c1e65b..c2b163e 100644 (file)
@@ -112,12 +112,12 @@ public:
   Json::Value settings_;
 
   StreamWriterBuilder();
-  ~StreamWriterBuilder() JSONCPP_OVERRIDE;
+  ~StreamWriterBuilder() override;
 
   /**
    * \throw std::exception if something goes wrong (e.g. invalid settings)
    */
-  StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
+  StreamWriter* newStreamWriter() const override;
 
   /** \return true if 'settings' are legal and consistent;
    *   otherwise, indicate bad settings via 'invalid'.
@@ -158,7 +158,7 @@ class JSON_API FastWriter : public Writer {
 
 public:
   FastWriter();
-  ~FastWriter() JSONCPP_OVERRIDE {}
+  ~FastWriter() override {}
 
   void enableYAMLCompatibility();
 
@@ -172,7 +172,7 @@ public:
   void omitEndingLineFeed();
 
 public: // overridden from Writer
-  JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
+  std::string write(const Value& root) override;
 
 private:
   void writeValue(const Value& value);
@@ -210,14 +210,14 @@ private:
 class JSON_API StyledWriter : public Writer {
 public:
   StyledWriter();
-  ~StyledWriter() JSONCPP_OVERRIDE {}
+  ~StyledWriter() override {}
 
 public: // overridden from Writer
   /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
    * \param root Value to serialize.
    * \return String containing the JSON document that represents the root value.
    */
-  JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
+  std::string write(const Value& root) override;
 
 private:
   void writeValue(const Value& value);
diff --git a/makefiles/vs71/jsontest.vcproj~upstream_1.7.7 b/makefiles/vs71/jsontest.vcproj~upstream_1.7.7
new file mode 100644 (file)
index 0000000..562c71f
--- /dev/null
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="jsontest"
+       ProjectGUID="{25AF2DD2-D396-4668-B188-488C33B8E620}"
+       Keyword="Win32Proj">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="../../build/vs71/debug/jsontest"
+                       IntermediateDirectory="../../build/vs71/debug/jsontest"
+                       ConfigurationType="1"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+                               MinimalRebuild="TRUE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="4"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile="$(OutDir)/jsontest.exe"
+                               LinkIncremental="2"
+                               GenerateDebugInformation="TRUE"
+                               ProgramDatabaseFile="$(OutDir)/jsontest.pdb"
+                               SubSystem="1"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="../../build/vs71/release/jsontest"
+                       IntermediateDirectory="../../build/vs71/release/jsontest"
+                       ConfigurationType="1"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+                               RuntimeLibrary="0"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="3"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile="$(OutDir)/jsontest.exe"
+                               LinkIncremental="1"
+                               GenerateDebugInformation="TRUE"
+                               SubSystem="1"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <File
+                       RelativePath="..\..\src\jsontestrunner\main.cpp">
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/makefiles/vs71/lib_json.vcproj~upstream_1.7.7 b/makefiles/vs71/lib_json.vcproj~upstream_1.7.7
new file mode 100644 (file)
index 0000000..24c5dd4
--- /dev/null
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="lib_json"
+       ProjectGUID="{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
+       Keyword="Win32Proj">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="../../build/vs71/debug/lib_json"
+                       IntermediateDirectory="../../build/vs71/debug/lib_json"
+                       ConfigurationType="4"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+                               StringPooling="TRUE"
+                               MinimalRebuild="TRUE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               EnableFunctionLevelLinking="TRUE"
+                               DisableLanguageExtensions="TRUE"
+                               ForceConformanceInForLoopScope="FALSE"
+                               RuntimeTypeInfo="TRUE"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="4"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="$(OutDir)/json_vc71_libmtd.lib"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="../../build/vs71/release/lib_json"
+                       IntermediateDirectory="../../build/vs71/release/lib_json"
+                       ConfigurationType="4"
+                       CharacterSet="2"
+                       WholeProgramOptimization="TRUE">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               GlobalOptimizations="TRUE"
+                               EnableIntrinsicFunctions="TRUE"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+                               StringPooling="TRUE"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="TRUE"
+                               DisableLanguageExtensions="TRUE"
+                               ForceConformanceInForLoopScope="FALSE"
+                               RuntimeTypeInfo="TRUE"
+                               UsePrecompiledHeader="0"
+                               AssemblerOutput="4"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="3"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="$(OutDir)/json_vc71_libmt.lib"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="dummy|Win32"
+                       OutputDirectory="$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="2"
+                       CharacterSet="2"
+                       WholeProgramOptimization="TRUE">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               GlobalOptimizations="TRUE"
+                               EnableIntrinsicFunctions="TRUE"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+                               StringPooling="TRUE"
+                               RuntimeLibrary="4"
+                               EnableFunctionLevelLinking="TRUE"
+                               DisableLanguageExtensions="TRUE"
+                               ForceConformanceInForLoopScope="FALSE"
+                               RuntimeTypeInfo="TRUE"
+                               UsePrecompiledHeader="0"
+                               AssemblerOutput="4"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="3"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               GenerateDebugInformation="TRUE"
+                               SubSystem="2"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <File
+                       RelativePath="..\..\include\json\autolink.h">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\config.h">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\features.h">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\forwards.h">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\json.h">
+               </File>
+               <File
+                       RelativePath="..\..\src\lib_json\json_reader.cpp">
+               </File>
+               <File
+                       RelativePath="..\..\src\lib_json\json_value.cpp">
+               </File>
+               <File
+                       RelativePath="..\..\src\lib_json\json_valueiterator.inl">
+               </File>
+               <File
+                       RelativePath="..\..\src\lib_json\json_writer.cpp">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\reader.h">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\value.h">
+               </File>
+               <File
+                       RelativePath="..\..\include\json\writer.h">
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100644 (file)
index 0000000..97bf453
--- /dev/null
@@ -0,0 +1 @@
+libjsoncpp
diff --git a/packaging/jsoncpp.manifest b/packaging/jsoncpp.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/jsoncpp.spec b/packaging/jsoncpp.spec
new file mode 100644 (file)
index 0000000..1b38fe2
--- /dev/null
@@ -0,0 +1,88 @@
+%global jsondir json
+
+Name:       jsoncpp
+Version:    1.6.5
+Release:        0
+Summary:    JSON library implemented in C++
+Group:      System Environment/Libraries
+License:    Public Domain or MIT
+URL:        https://github.com/open-source-parsers/jsoncpp
+Source0:    https://github.com/open-source-parsers/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
+Source1:        baselibs.conf
+Source1001:     jsoncpp.manifest
+
+BuildRequires:  doxygen cmake
+BuildRequires:  python
+#BuildRequires:  graphviz
+
+%description
+%{name} is an implementation of a JSON (http://json.org) reader and writer in
+C++. JSON (JavaScript Object Notation) is a lightweight data-interchange format.
+It is easy for humans to read and write. It is easy for machines to parse and
+generate.
+
+
+%package devel
+Summary:    Development headers and library for %{name}
+Group:      Development/Libraries
+Requires:   %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+This package contains the development headers and library for %{name}.
+
+
+%package doc
+Summary:    Documentation for %{name}
+Group:      Documentation
+BuildArch:  noarch
+
+%description doc
+This package contains the documentation for %{name}
+
+
+%prep
+%setup -q -n %{name}-%{version}
+cp %{SOURCE1001} .
+
+
+
+%build
+%cmake -DBUILD_STATIC_LIBS=OFF .
+make %{?_smp_mflags}
+# Build the doc
+python doxybuild.py --doxygen %{_bindir}/doxygen
+
+#%check
+# Tests are run automatically in the build section
+# ctest -V %{?_smp_mflags}
+
+%install
+make install DESTDIR=%{buildroot}
+
+mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/html
+for f in AUTHORS LICENSE NEWS.txt README.md ; do
+    install -p -m 0644 $f $RPM_BUILD_ROOT%{_docdir}/%{name}
+done
+install -p -m 0644 dist/doxygen/*/*.{html,png} $RPM_BUILD_ROOT%{_docdir}/%{name}/html
+
+mkdir -p $RPM_BUILD_ROOT%{_includedir}/%{name}/
+ln -sf ../json $RPM_BUILD_ROOT%{_includedir}/%{name}/json
+
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%{_docdir}/%{name}/
+%exclude %{_docdir}/%{name}/html
+%{_libdir}/lib%{name}.so.*
+
+%files devel
+%{_libdir}/lib%{name}.so
+%{_includedir}/%{jsondir}/
+%{_includedir}/%{name}/%{jsondir}/
+%{_libdir}/pkgconfig/jsoncpp.pc
+
+%files doc
+%{_docdir}/%{name}/
+
index 9613181..3ca4a84 100644 (file)
@@ -1,7 +1,7 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
-includedir=${prefix}/@INCLUDE_INSTALL_DIR@
+libdir=@LIBRARY_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
 
 Name: jsoncpp
 Description: A C++ library for interacting with JSON
diff --git a/scons-tools/doxygen.py b/scons-tools/doxygen.py
new file mode 100644 (file)
index 0000000..927fd29
--- /dev/null
@@ -0,0 +1,117 @@
+# Big issue:
+# emitter depends on doxyfile which is generated from doxyfile.in.
+# build fails after cleaning and relaunching the build.
+
+# Todo:
+# Add helper function to environment like for glob
+# Easier passage of header/footer
+# Automatic deduction of index.html path based on custom parameters passed to doxyfile
+
+import os
+import os.path
+import glob
+from fnmatch import fnmatch
+import SCons
+
+def Doxyfile_emitter(target, source, env):
+   """
+   Modify the target and source lists to use the defaults if nothing
+   else has been specified.
+
+   Dependencies on external HTML documentation references are also
+   appended to the source list.
+   """
+   doxyfile_template = env.File(env['DOXYFILE_FILE'])
+   source.insert(0, doxyfile_template)
+
+   return target, source 
+
+def Doxyfile_Builder(target, source, env):
+   """Input:
+   DOXYFILE_FILE
+   Path of the template file for the output doxyfile
+
+   DOXYFILE_DICT
+   A dictionnary of parameter to append to the generated doxyfile
+   """
+   subdir = os.path.split(source[0].abspath)[0]
+   doc_top_dir = os.path.split(target[0].abspath)[0]
+   doxyfile_path = source[0].abspath
+   doxy_file = file( target[0].abspath, 'wt' )
+   try:
+      # First, output the template file
+      try:
+         f = file(doxyfile_path, 'rt')
+         doxy_file.write( f.read() )
+         f.close()
+         doxy_file.write( '\n' )
+         doxy_file.write( '# Generated content:\n' )
+      except:
+         raise SCons.Errors.UserError, "Can't read doxygen template file '%s'" % doxyfile_path
+      # Then, the input files
+      doxy_file.write( 'INPUT                  = \\\n' )
+      for source in source:
+         if source.abspath != doxyfile_path: # skip doxyfile path, which is the first source
+            doxy_file.write( '"%s" \\\n' % source.abspath )
+      doxy_file.write( '\n' )
+      # Dot...
+      values_dict = { 'HAVE_DOT': env.get('DOT') and 'YES' or 'NO',
+                      'DOT_PATH': env.get('DOT') and os.path.split(env['DOT'])[0] or '',
+                      'OUTPUT_DIRECTORY': doc_top_dir,
+                      'WARN_LOGFILE': target[0].abspath + '-warning.log'}
+      values_dict.update( env['DOXYFILE_DICT'] )
+      # Finally, output user dictionary values which override any of the previously set parameters.
+      for key, value in values_dict.iteritems():
+         doxy_file.write ('%s = "%s"\n' % (key, str(value))) 
+   finally:
+      doxy_file.close()
+
+def generate(env):
+   """
+   Add builders and construction variables for the
+   Doxygen tool.
+   """
+   ## Doxyfile builder
+   def doxyfile_message (target, source, env):
+       return "creating Doxygen config file '%s'" % target[0]
+
+   doxyfile_variables = [
+       'DOXYFILE_DICT',
+       'DOXYFILE_FILE'
+       ]
+
+   #doxyfile_action = SCons.Action.Action( Doxyfile_Builder, doxyfile_message,
+   #                                       doxyfile_variables )
+   doxyfile_action = SCons.Action.Action( Doxyfile_Builder, doxyfile_message)
+
+   doxyfile_builder = SCons.Builder.Builder( action = doxyfile_action,
+                                             emitter = Doxyfile_emitter )
+
+   env['BUILDERS']['Doxyfile'] = doxyfile_builder
+   env['DOXYFILE_DICT'] = {}
+   env['DOXYFILE_FILE'] = 'doxyfile.in'
+
+   ## Doxygen builder
+   def Doxygen_emitter(target, source, env):
+      output_dir = str( source[0].dir )
+      if str(target[0]) == str(source[0]):
+         target = env.File( os.path.join( output_dir, 'html', 'index.html' ) )
+      return target, source
+
+   doxygen_action = SCons.Action.Action( [ '$DOXYGEN_COM'] )
+   doxygen_builder = SCons.Builder.Builder( action = doxygen_action,
+                                            emitter = Doxygen_emitter )
+   env['BUILDERS']['Doxygen'] = doxygen_builder
+   env['DOXYGEN_COM'] = '$DOXYGEN $DOXYGEN_FLAGS $SOURCE'
+   env['DOXYGEN_FLAGS'] = ''
+   env['DOXYGEN'] = 'doxygen'
+    
+   dot_path = env.WhereIs("dot")
+   if dot_path:
+      env['DOT'] = dot_path
+
+def exists(env):
+   """
+   Make sure doxygen exists.
+   """
+   return env.Detect("doxygen")
diff --git a/scons-tools/glob.py b/scons-tools/glob.py
new file mode 100644 (file)
index 0000000..811140e
--- /dev/null
@@ -0,0 +1,53 @@
+import fnmatch
+import os
+
+def generate( env ): 
+   def Glob( env, includes = None, excludes = None, dir = '.' ):
+      """Adds Glob( includes = Split( '*' ), excludes = None, dir = '.')
+       helper function to environment.
+
+       Glob both the file-system files.
+
+       includes: list of file name pattern included in the return list when matched.
+       excludes: list of file name pattern exluced from the return list.
+
+       Example:
+       sources = env.Glob( ("*.cpp", '*.h'), "~*.cpp", "#src" )
+      """
+      def filterFilename(path):
+         abs_path = os.path.join( dir, path )
+         if not os.path.isfile(abs_path):
+            return 0
+         fn = os.path.basename(path)
+         match = 0
+         for include in includes:
+            if fnmatch.fnmatchcase( fn, include ):
+               match = 1
+               break
+         if match == 1 and not excludes is None:
+            for exclude in excludes:
+               if fnmatch.fnmatchcase( fn, exclude ):
+                  match = 0
+                  break
+         return match
+      if includes is None:
+         includes = ('*',)
+      elif type(includes) in ( type(''), type(u'') ):
+         includes = (includes,)
+      if type(excludes) in ( type(''), type(u'') ):
+         excludes = (excludes,)
+      dir = env.Dir(dir).abspath
+      paths = os.listdir( dir )
+      def makeAbsFileNode( path ):
+         return env.File( os.path.join( dir, path ) )
+      nodes = filter( filterFilename, paths )
+      return map( makeAbsFileNode, nodes )
+
+   from SCons.Script import Environment
+   Environment.Glob = Glob
+
+def exists(env):
+    """
+    Tool always exists.
+    """
+    return True
index acd804b..99ddc7f 100644 (file)
@@ -42,15 +42,10 @@ ENDIF()
 IF(BUILD_SHARED_LIBS)
     ADD_DEFINITIONS( -DJSON_DLL_BUILD )
     ADD_LIBRARY(jsoncpp_lib SHARED ${PUBLIC_HEADERS} ${jsoncpp_sources})
-    SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
+    SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR})
     SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
                            DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
 
-    # Set library's runtime search path on OSX
-    IF(APPLE)
-        SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
-    ENDIF()
-
     INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
          RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
          LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
@@ -66,7 +61,7 @@ ENDIF()
 
 IF(BUILD_STATIC_LIBS)
     ADD_LIBRARY(jsoncpp_lib_static STATIC ${PUBLIC_HEADERS} ${jsoncpp_sources})
-    SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
+    SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR})
     SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp
                            DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
 
index 5e04d74..8e8bc1d 100644 (file)
 #elif defined(__ANDROID__) || defined(__QNXNTO__)
 #define snprintf snprintf
 #elif __cplusplus >= 201103L
-#if !defined(__MINGW32__) && !defined(__CYGWIN__)
 #define snprintf std::snprintf
 #endif
-#endif
 
 #if defined(__QNXNTO__)
 #define sscanf std::sscanf
@@ -617,10 +615,10 @@ bool Reader::decodeDouble(Token& token) {
 
 bool Reader::decodeDouble(Token& token, Value& decoded) {
   double value = 0;
-  JSONCPP_STRING buffer(token.start_, token.end_);
-  JSONCPP_ISTRINGSTREAM is(buffer);
+  std::string buffer(token.start_, token.end_);
+  std::istringstream is(buffer);
   if (!(is >> value))
-    return addError("'" + JSONCPP_STRING(token.start_, token.end_) +
+    return addError("'" + std::string(token.start_, token.end_) +
                         "' is not a number.",
                     token);
   decoded = value;
@@ -1908,7 +1906,7 @@ public:
   {}
   bool parse(
       char const* beginDoc, char const* endDoc,
-      Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
+      Value* root, std::string* errs) override {
     bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
     if (errs) {
       *errs = reader_.getFormattedErrorMessages();
index 0e729e6..1616548 100644 (file)
@@ -75,7 +75,7 @@ typedef char UIntToStringBuffer[uintToStringBufferSize];
 static inline void uintToString(LargestUInt value, char*& current) {
   *--current = 0;
   do {
-    *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
+    *--current = static_cast<signed char>(value % 10U + static_cast<unsigned>('0'));
     value /= 10;
   } while (value != 0);
 }
index 88c630f..88b9233 100644 (file)
@@ -190,7 +190,7 @@ static inline void releaseStringValue(char* value, unsigned) {
 
 namespace Json {
 
-Exception::Exception(JSONCPP_STRING const& msg)
+Exception::Exception(std::string const& msg)
   : msg_(msg)
 {}
 Exception::~Exception() throw()
@@ -263,14 +263,14 @@ Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy a
   storage_.length_ = ulength & 0x3FFFFFFF;
 }
 
-Value::CZString::CZString(const CZString& other) {
-  cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
-                                ? duplicateStringValue(other.cstr_, other.storage_.length_)
-                                : other.cstr_);
-  storage_.policy_ = static_cast<unsigned>(other.cstr_
+Value::CZString::CZString(const CZString& other)
+    : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
+                ? duplicateStringValue(other.cstr_, other.storage_.length_)
+                : other.cstr_) {
+  storage_.policy_ = (other.cstr_
                  ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                      ? noDuplication : duplicate)
-                 : static_cast<DuplicationPolicy>(other.storage_.policy_)) & 3U;
+                 : static_cast<DuplicationPolicy>(other.storage_.policy_));
   storage_.length_ = other.storage_.length_;
 }
 
@@ -343,7 +343,6 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
  * This optimization is used in ValueInternalMap fast allocator.
  */
 Value::Value(ValueType vtype) {
-  static char const empty[] = "";
   initBasic(vtype);
   switch (vtype) {
   case nullValue:
@@ -649,18 +648,6 @@ const char* Value::asCString() const {
   return this_str;
 }
 
-#if JSONCPP_USING_SECURE_MEMORY
-unsigned Value::getCStringLength() const {
-  JSON_ASSERT_MESSAGE(type_ == stringValue,
-                         "in Json::Value::asCString(): requires stringValue");
-  if (value_.string_ == 0) return 0;
-  unsigned this_len;
-  char const* this_str;
-  decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
-  return this_len;
-}
-#endif
-
 bool Value::getString(char const** str, char const** cend) const {
   if (type_ != stringValue) return false;
   if (value_.string_ == 0) return false;
index b45162b..ec9c851 100644 (file)
@@ -92,12 +92,12 @@ UInt ValueIteratorBase::index() const {
   return Value::UInt(-1);
 }
 
-JSONCPP_STRING ValueIteratorBase::name() const {
+std::string ValueIteratorBase::name() const {
   char const* keey;
   char const* end;
   keey = memberName(&end);
-  if (!keey) return JSONCPP_STRING();
-  return JSONCPP_STRING(keey, end);
+  if (!keey) return std::string();
+  return std::string(keey, end);
 }
 
 char const* ValueIteratorBase::memberName() const {
index 1bb3b21..1017d41 100644 (file)
 #define snprintf _snprintf
 #endif
 
+#if defined(__BORLANDC__)  
+#include <float.h>
+#define isfinite _finite
+#define snprintf _snprintf
+#endif
+
 #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
 // Disable warning about strdup being deprecated.
 #pragma warning(disable : 4996)
@@ -135,8 +141,7 @@ JSONCPP_STRING valueToString(UInt value) {
 
 #endif // # if defined(JSON_HAS_INT64)
 
-namespace {
-JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int precision) {
+std::string valueToString(double value, bool useSpecialFloats, unsigned int precision) {
   // Allocate a buffer that is more than large enough to store the 16 digits of
   // precision requested below.
   char buffer[32];
@@ -169,7 +174,9 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
 
 JSONCPP_STRING valueToString(double value) { return valueToString(value, false, 17); }
 
-JSONCPP_STRING valueToString(bool value) { return value ? "true" : "false"; }
+std::string valueToString(double value) { return valueToString(value, false, 17); }
+
+std::string valueToString(bool value) { return value ? "true" : "false"; }
 
 JSONCPP_STRING valueToQuotedString(const char* value) {
   if (value == NULL)
@@ -836,12 +843,12 @@ struct BuiltStyledStreamWriter : public StreamWriter
   BuiltStyledStreamWriter(
       JSONCPP_STRING const& indentation,
       CommentStyle::Enum cs,
-      JSONCPP_STRING const& colonSymbol,
-      JSONCPP_STRING const& nullSymbol,
-      JSONCPP_STRING const& endingLineFeedSymbol,
+      std::string const& colonSymbol,
+      std::string const& nullSymbol,
+      std::string const& endingLineFeedSymbol,
       bool useSpecialFloats,
       unsigned int precision);
-  int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE;
+  int write(Value const& root, std::ostream* sout) override;
 private:
   void writeValue(Value const& value);
   void writeArrayValue(Value const& value);
@@ -873,9 +880,9 @@ private:
 BuiltStyledStreamWriter::BuiltStyledStreamWriter(
       JSONCPP_STRING const& indentation,
       CommentStyle::Enum cs,
-      JSONCPP_STRING const& colonSymbol,
-      JSONCPP_STRING const& nullSymbol,
-      JSONCPP_STRING const& endingLineFeedSymbol,
+      std::string const& colonSymbol,
+      std::string const& nullSymbol,
+      std::string const& endingLineFeedSymbol,
       bool useSpecialFloats,
       unsigned int precision)
   : rightMargin_(74)
@@ -1152,7 +1159,7 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
     nullSymbol = "";
   }
   if (pre > 17) pre = 17;
-  JSONCPP_STRING endingLineFeedSymbol = "";
+  std::string endingLineFeedSymbol = "";
   return new BuiltStyledStreamWriter(
       indentation, cs,
       colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
index f0ba1fa..69ecab7 100644 (file)
@@ -271,8 +271,8 @@ TestResult& checkStringEqual(TestResult& result,
     }                                                                          \
                                                                                \
   public: /* overidden from TestCase */                                        \
-    const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; }    \
-    void runTestCase() JSONCPP_OVERRIDE;                                                \
+    const char* testName() const override { return #FixtureType "/" #name; }    \
+    void runTestCase() override;                                                \
   };                                                                           \
                                                                                \
   void Test##FixtureType##name::runTestCase()
index 1a1216e..199f2d6 100644 (file)
@@ -1660,8 +1660,8 @@ JSONTEST_FIXTURE(ValueTest, specialFloats) {
   b.settings_["useSpecialFloats"] = true;
 
   Json::Value v = std::numeric_limits<double>::quiet_NaN();
-  JSONCPP_STRING expected = "NaN";
-  JSONCPP_STRING result = Json::writeString(b, v);
+  std::string expected = "NaN";
+  std::string result = Json::writeString(b, v);
   JSONTEST_ASSERT_STRING_EQUAL(expected, result);
 
   v = std::numeric_limits<double>::infinity();
@@ -1680,8 +1680,8 @@ JSONTEST_FIXTURE(ValueTest, precision) {
     b.settings_["precision"] = 5;
 
     Json::Value v = 100.0/3;
-    JSONCPP_STRING expected = "33.333";
-    JSONCPP_STRING result = Json::writeString(b, v);
+    std::string expected = "33.333";
+    std::string result = Json::writeString(b, v);
     JSONTEST_ASSERT_STRING_EQUAL(expected, result);
     
     v = 0.25000000;
@@ -2326,7 +2326,7 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
   Json::CharReaderBuilder b;
   b.settings_["allowSpecialFloats"] = true;
   Json::Value root;
-  JSONCPP_STRING errs;
+  std::string errs;
   Json::CharReader* reader(b.newCharReader());
   {
     char const doc[] = "{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity}";
@@ -2345,7 +2345,7 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
   struct TestData {
     int line;
     bool ok;
-    JSONCPP_STRING in;
+    std::string in;
   };
   const TestData test_data[] = {
     {__LINE__, 1, "{\"a\":9}"},
@@ -2480,20 +2480,20 @@ JSONTEST_FIXTURE(IteratorTest, const) {
 
   for(int i = 9; i < 12; ++i)
   {
-    JSONCPP_OSTRINGSTREAM out;
+    std::ostringstream out;
     out << std::setw(2) << i;
-    JSONCPP_STRING str = out.str();
+    std::string str = out.str();
     value[str] = str;
   }
 
-  JSONCPP_OSTRINGSTREAM out;
+  std::ostringstream out;
   //in old code, this will get a compile error
   Json::Value::const_iterator iter = value.begin();
   for(; iter != value.end(); ++iter)
   {
     out << *iter << ',';
   }
-  JSONCPP_STRING expected = "\" 9\",\"10\",\"11\",";
+  std::string expected = "\" 9\",\"10\",\"11\",";
   JSONTEST_ASSERT_STRING_EQUAL(expected, out.str());
 }
 
diff --git a/test/data/test_basic_08.expected~upstream_1.7.7 b/test/data/test_basic_08.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..caf5352
--- /dev/null
@@ -0,0 +1,3 @@
+// C++ style comment
+.=null
+
diff --git a/test/data/test_basic_09.expected~upstream_1.7.7 b/test/data/test_basic_09.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..8b129da
--- /dev/null
@@ -0,0 +1,4 @@
+/* C style comment
+ */
+.=null
+
diff --git a/test/data/test_comment_01.expected~upstream_1.7.7 b/test/data/test_comment_01.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..1ed01ba
--- /dev/null
@@ -0,0 +1,10 @@
+.={}
+// Comment for array
+.test=[]
+// Comment within array
+.test[0]={}
+.test[0].a="aaa"
+.test[1]={}
+.test[1].b="bbb"
+.test[2]={}
+.test[2].c="ccc"
diff --git a/test/data/test_comment_01.json~upstream_1.7.7 b/test/data/test_comment_01.json~upstream_1.7.7
new file mode 100644 (file)
index 0000000..6defe40
--- /dev/null
@@ -0,0 +1,10 @@
+{
+    "test":
+    // Comment for array
+    [
+       // Comment within array
+       { "a" : "aaa" }, // Comment for a
+       { "b" : "bbb" }, // Comment for b
+       { "c" : "ccc" } // Comment for c
+    ]
+}
diff --git a/test/data/test_integer_01.expected~upstream_1.7.7 b/test/data/test_integer_01.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..463e149
--- /dev/null
@@ -0,0 +1,2 @@
+// Max signed integer
+.=2147483647
diff --git a/test/data/test_integer_02.expected~upstream_1.7.7 b/test/data/test_integer_02.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..0773e08
--- /dev/null
@@ -0,0 +1,2 @@
+// Min signed integer
+.=-2147483648
diff --git a/test/data/test_integer_03.expected~upstream_1.7.7 b/test/data/test_integer_03.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..c7efff7
--- /dev/null
@@ -0,0 +1,2 @@
+// Max unsigned integer
+.=4294967295
diff --git a/test/data/test_integer_04.expected~upstream_1.7.7 b/test/data/test_integer_04.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..39f8567
--- /dev/null
@@ -0,0 +1,3 @@
+// Min unsigned integer
+.=0
+
diff --git a/test/data/test_preserve_comment_01.expected~upstream_1.7.7 b/test/data/test_preserve_comment_01.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..2797aa7
--- /dev/null
@@ -0,0 +1,11 @@
+/* A comment
+   at the beginning of the file.
+ */
+.={}
+.first=1
+/* Comment before 'second'
+ */
+.second=2
+/* A comment at 
+   the end of the file.
+ */
diff --git a/test/data/test_real_01.expected~upstream_1.7.7 b/test/data/test_real_01.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..9514827
--- /dev/null
@@ -0,0 +1,3 @@
+// 2^33 => out of integer range, switch to double
+.=8589934592
+
diff --git a/test/data/test_real_02.expected~upstream_1.7.7 b/test/data/test_real_02.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..b80c004
--- /dev/null
@@ -0,0 +1,3 @@
+// -2^32 => out of signed integer range, switch to double
+.=-4294967295
+
diff --git a/test/data/test_real_03.expected~upstream_1.7.7 b/test/data/test_real_03.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..b80c004
--- /dev/null
@@ -0,0 +1,3 @@
+// -2^32 => out of signed integer range, switch to double
+.=-4294967295
+
diff --git a/test/data/test_real_04.expected~upstream_1.7.7 b/test/data/test_real_04.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..ff71a23
--- /dev/null
@@ -0,0 +1,3 @@
+// 1.2345678
+.=1.2345678
+
diff --git a/test/data/test_real_05.expected~upstream_1.7.7 b/test/data/test_real_05.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..7a46093
--- /dev/null
@@ -0,0 +1,4 @@
+// 1234567.8
+.=1234567.8
+
+
diff --git a/test/data/test_real_06.expected~upstream_1.7.7 b/test/data/test_real_06.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..a4a004d
--- /dev/null
@@ -0,0 +1,4 @@
+// -1.2345678
+.=-1.2345678
+
+
diff --git a/test/data/test_real_07.expected~upstream_1.7.7 b/test/data/test_real_07.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..dc02a89
--- /dev/null
@@ -0,0 +1,4 @@
+// -1234567.8
+.=-1234567.8
+
+
diff --git a/test/data/test_string_01.json~upstream_1.7.7 b/test/data/test_string_01.json~upstream_1.7.7
new file mode 100644 (file)
index 0000000..6cd0db4
--- /dev/null
@@ -0,0 +1 @@
+"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
diff --git a/test/data/test_string_02.json~upstream_1.7.7 b/test/data/test_string_02.json~upstream_1.7.7
new file mode 100644 (file)
index 0000000..9a7e5dc
--- /dev/null
@@ -0,0 +1 @@
+"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
diff --git a/test/data/test_string_unicode_01.expected~upstream_1.7.7 b/test/data/test_string_unicode_01.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..1f3be7f
--- /dev/null
@@ -0,0 +1 @@
+.="a"
diff --git a/test/data/test_string_unicode_02.expected~upstream_1.7.7 b/test/data/test_string_unicode_02.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..1388f53
--- /dev/null
@@ -0,0 +1 @@
+.="¢"
diff --git a/test/data/test_string_unicode_03.expected~upstream_1.7.7 b/test/data/test_string_unicode_03.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..9b80b27
--- /dev/null
@@ -0,0 +1 @@
+.="€"
diff --git a/test/data/test_string_unicode_04.expected~upstream_1.7.7 b/test/data/test_string_unicode_04.expected~upstream_1.7.7
new file mode 100644 (file)
index 0000000..b9e7fe3
--- /dev/null
@@ -0,0 +1 @@
+.="𝄞"
diff --git a/test/jsontestrunner.py b/test/jsontestrunner.py
new file mode 100644 (file)
index 0000000..a076d0c
--- /dev/null
@@ -0,0 +1,64 @@
+# Simple implementation of a json test runner to run the test against json-py.
+
+import sys
+import os.path
+import json
+import types
+
+if len(sys.argv) != 2:
+    print "Usage: %s input-json-file", sys.argv[0]
+    sys.exit(3)
+    
+input_path = sys.argv[1]
+base_path = os.path.splitext(input_path)[0]
+actual_path = base_path + '.actual'
+rewrite_path = base_path + '.rewrite'
+rewrite_actual_path = base_path + '.actual-rewrite'
+
+def valueTreeToString( fout, value, path = '.' ):
+    ty = type(value) 
+    if ty  is types.DictType:
+        fout.write( '%s={}\n' % path )
+        suffix = path[-1] != '.' and '.' or ''
+        names = value.keys()
+        names.sort()
+        for name in names:
+            valueTreeToString( fout, value[name], path + suffix + name )
+    elif ty is types.ListType:
+        fout.write( '%s=[]\n' % path )
+        for index, childValue in zip( xrange(0,len(value)), value ):
+            valueTreeToString( fout, childValue, path + '[%d]' % index )
+    elif ty is types.StringType:
+        fout.write( '%s="%s"\n' % (path,value) )
+    elif ty is types.IntType:
+        fout.write( '%s=%d\n' % (path,value) )
+    elif ty is types.FloatType:
+        fout.write( '%s=%.16g\n' % (path,value) )
+    elif value is True:
+        fout.write( '%s=true\n' % path )
+    elif value is False:
+        fout.write( '%s=false\n' % path )
+    elif value is None:
+        fout.write( '%s=null\n' % path )
+    else:
+        assert False and "Unexpected value type"
+        
+def parseAndSaveValueTree( input, actual_path ):
+    root = json.read( input )
+    fout = file( actual_path, 'wt' )
+    valueTreeToString( fout, root )
+    fout.close()
+    return root
+
+def rewriteValueTree( value, rewrite_path ):
+    rewrite = json.write( value )
+    rewrite = rewrite[1:-1]  # Somehow the string is quoted ! jsonpy bug ?
+    file( rewrite_path, 'wt').write( rewrite + '\n' )
+    return rewrite
+    
+input = file( input_path, 'rt' ).read()
+root = parseAndSaveValueTree( input, actual_path )
+rewrite = rewriteValueTree( json.write( root ), rewrite_path )
+rewrite_root = parseAndSaveValueTree( rewrite, rewrite_actual_path )
+
+sys.exit( 0 )
index a9811ec..2b25f47 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -19,8 +19,6 @@ env | sort
 
 cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE .
 make
-cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE -DJSONCPP_USE_SECURE_MEMORY=1 .
-make
 
 # Python is not available in Travis for osx.
 #  https://github.com/travis-ci/travis-ci/issues/2320
diff --git a/version b/version
index 91c74a5..9f05f9f 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-1.7.7
+1.6.5