Skip to content

Devel #313

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 9 commits into from
Apr 21, 2018
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ install:
fi
- pip install --upgrade pygooglechart
- pip install --upgrade graphviz
- (pip install --upgrade FoBiS.py && FoBiS.py --version)
- (pip install --upgrade ford && ford --version)
- (pip install --upgrade FoBiS.py==2.2.8 && FoBiS.py --version)
- (pip install --upgrade ford==5.0.6 && ford --version)
- (pip install --upgrade markdown==2.6.9)
- (pip install --upgrade git+https://github.com/dmeranda/demjson.git && jsonlint --version)

before_script:
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ if ( ENABLE_TESTS )
endif()
endforeach ( UNIT_TEST )

set_property ( TEST jf_test_3
set_property ( TEST jf_test_03
APPEND
PROPERTY DEPENDS jf_test_2 )
PROPERTY DEPENDS jf_test_02 )

# Validate output
if ( JSONLINT )
Expand Down Expand Up @@ -423,4 +423,4 @@ install(FILES
if(MSVC_IDE)
INCLUDE_DIRECTORIES("src")
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
endif()
endif()
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,22 @@ script) with the [NAG Fortran compiler 6.0](http://www.nag.com/nagware/NP/NP_des
Currently, several ways are provided to build the JSON-fortran library
(libjsonfortran).

* A build script, `build.sh` is provided in the project root directory. This script uses [FoBiS](https://github.com/szaghi/FoBiS) to build the JSON-Fortran library and the unit tests. Edit the script to use either the [Intel Fortran Compiler](https://software.intel.com/en-us/fortran-compilers) or [Gfortran](https://gcc.gnu.org/wiki/GFortran). Note that version 1.2.5 of FoBiS (or later) is required.
* A build script, `build.sh` is provided in the project root directory. This script uses [FoBiS](https://github.com/szaghi/FoBiS) to build the JSON-Fortran library and the unit tests on Unix-like systems. Edit the script to use either the [Intel Fortran Compiler](https://software.intel.com/en-us/fortran-compilers) or [Gfortran](https://gcc.gnu.org/wiki/GFortran). Note that version 1.2.5 of FoBiS (or later) is required.

* A [FoBiS](https://github.com/szaghi/FoBiS) configuration file (`json-fortran.fobis`) is also provided that can also build the library and examples. Use the `mode` flag to indicate what to build. For example:

* To build all the examples using gfortran: `FoBiS.py build -f json-fortran.fobis -mode tests-gnu`
* To build all the examples using ifort: `FoBiS.py build -f json-fortran.fobis -mode tests-intel`
* To build a static library using gfortran: `FoBiS.py build -f json-fortran.fobis -mode static-gnu`
* To build a static library using ifort: `FoBiS.py build -f json-fortran.fobis -mode static-intel`

The full set of modes are: `static-gnu`, `static-gnu-debug`, `static-intel`, `static-intel-debug`, `shared-gnu`, `shared-gnu-debug`, `shared-intel`, `shared-intel-debug`, `tests-gnu`, `tests-gnu-debug`, `tests-intel`, `tests-intel-debug`

To generate the documentation using [ford](https://github.com/cmacmackin/ford), run:

```
FoBis.py rule --execute makedoc -f json-fortran.fobis
```

* A [Visual Studio](https://www.visualstudio.com) project is included for building the library (and unit tests) on Windows with the Intel Fortran Compiler. The project has been tested with Visual Studio 2010 and 2013.

Expand All @@ -116,7 +131,7 @@ project ( jf_test NONE )
find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} 6.2.0 REQUIRED )
include_directories ( "${jsonfortran_INCLUDE_DIRS}" )

file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.f90" )
file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.F90" )
foreach ( UNIT_TEST ${JF_TEST_SRCS} )
get_filename_component ( TEST ${UNIT_TEST} NAME_WE )
add_executable ( ${TEST} ${UNIT_TEST} )
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Script to deploy documentation after successfull build of master branch or tag
# Script to deploy documentation after successful build of master branch or tag
# If running under travis-ci this will automatically deploy updates to the master branch's
# documentation on build events for the master branch, and will add/update documentation for
# any new/updated tags that are pushed.
Expand All @@ -20,7 +20,7 @@ if [ "$TRAVIS" ]; then #running under travis
git commit -m "Development documentation updated by travis job $TRAVIS_JOB_NUMBER for commits $TRAVIS_COMMIT_RANGE" || true
git push -fq origin gh-pages > /dev/null 2>&1 || true
fi
# If publishing a new/updated tag, deploy it's documentation
# If publishing a new/updated tag, deploy its documentation
if [ "$TRAVIS_TAG" ] && [ "$(ls -A "$TRAVIS_BUILD_DIR/doc")" ] ; then #not empty
cd "$TRAVIS_BUILD_DIR" || exit 1
git clone -q --branch=gh-pages "https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG" gh-pages >/dev/null 2>&1
Expand Down
144 changes: 144 additions & 0 deletions json-fortran.fobis
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
[modes]
modes = static-gnu static-gnu-debug
static-intel static-intel-debug
shared-gnu shared-gnu-debug
shared-intel shared-intel-debug
tests-gnu tests-gnu-debug
tests-intel tests-intel-debug

[common-variables]
$MOD_FILE = json_module.F90
$FORD_FILE = json-fortran.md
$STATIC_LIB = libjsonfortran.a
$SHARED_LIB = libjsonfortran.so
$OPTIMIZE = -O2
$CSTATIC_GNU = -c -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -Wno-unused-function -pedantic -std=f2008ts
$DEBUG_GNU = -O0 -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan -std=f2008ts -fall-intrinsics
$CSTATIC_INT = -c -std15
$DEBUG_INT = -O0 -debug all -check all -warn all -extend-source 132 -traceback -gen-interfaces -fpe-all=0 -fp-stack-check -fstack-protector-all -ftrapuv -no-ftz -std15
$EXCLUDE_DIRS = ./src/tests/introspection
./visual_studio/jsonfortrantest

# modes templates
[template-static]
cflags_heritage = True
build_dir = ./lib/
mod_dir = ./mod/
obj_dir = ./obj/
src = ./src/
colors = True
quiet = False
log = False
jobs = 2
mklib = static
target = $MOD_FILE
output = $STATIC_LIB
exclude_dirs = $EXCLUDE_DIRS

[template-shared]
cflags_heritage = True
build_dir = ./lib/
mod_dir = ./mod/
obj_dir = ./obj/
src = ./src/
colors = True
quiet = False
log = False
jobs = 2
mklib = shared
target = $MOD_FILE
output = $SHARED_LIB
exclude_dirs = $EXCLUDE_DIRS

[template-tests]
cflags_heritage = True
build_dir = ./bin/
mod_dir = ./mod/
obj_dir = ./obj/
src = ./src/
colors = True
quiet = False
log = False
jobs = 2
exclude_dirs = $EXCLUDE_DIRS

# main modes

# library
[static-gnu]
description = Build library with GNU gfortran by optimized-static flags
compiler = gnu
cflags = $CSTATIC_GNU $OPTIMIZE
template = template-static

[static-gnu-debug]
description = Build library with GNU gfortran by debug-static flags
compiler = gnu
cflags = $CSTATIC_GNU $DEBUG_GNU
template = template-static

[static-intel]
description = Build library with Intel Fortran by optimized-static flags
compiler = intel
cflags = $CSTATIC_INT $OPTIMIZE
template = template-static

[static-intel-debug]
description = Build library with Intel Fortran by debug-static flags
compiler = intel
cflags = $CSTATIC_INT $DEBUG_INT
template = template-static

[shared-gnu]
description = Build library with GNU gfortran by optimized-shared flags
compiler = gnu
cflags = $CSTATIC_GNU $OPTIMIZE
template = template-shared

[shared-gnu-debug]
description = Build library with GNU gfortran by debug-shared flags
compiler = gnu
cflags = $CSTATIC_GNU $DEBUG_GNU
template = template-shared

[shared-intel]
description = Build library with Intel Fortran by optimized-shared flags
compiler = intel
cflags = $CSTATIC_INT $OPTIMIZE
template = template-shared

[shared-intel-debug]
description = Build library with Intel Fortran by debug-shared flags
compiler = intel
cflags = $CSTATIC_INT $DEBUG_INT
template = template-shared

# test programs
[tests-gnu]
description = Build all tests with GNU gfortran by optimized-static flags
compiler = gnu
cflags = $CSTATIC_GNU $OPTIMIZE
template = template-tests

[tests-gnu-debug]
description = Build all tests with GNU gfortran by debug-static flags
compiler = gnu
cflags = $CSTATIC_GNU $DEBUG_GNU
template = template-tests

[tests-intel]
description = Build all tests with Intel Fortran by optimized-static flags
compiler = intel
cflags = $CSTATIC_INT $OPTIMIZE
template = template-tests

[tests-intel-debug]
description = Build all tests with Intel Fortran by debug-static flags
compiler = intel
cflags = $CSTATIC_INT $DEBUG_INT
template = template-tests

# auxiliary rules
[rule-makedoc]
help = Rule for building documentation from source files
rule_1 = ford $FORD_FILE
3 changes: 3 additions & 0 deletions src/json_string_utilities.F90
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ subroutine escape_string(str_in, str_out, escape_solidus)
if (escape_solidus) then
str_out(ipos:ipos+1) = backslash//c
ipos = ipos + 2
else
str_out(ipos:ipos) = c
ipos = ipos + 1
end if
case(bspace)
str_out(ipos:ipos+1) = '\b'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/tests/jf_test_30.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ subroutine test_30(error_cnt)
type(json_core) :: json_c
integer :: i

character(kind=CK,len=*),parameter :: str = CK_'{"vars":{"a/first":1,"a\/second":2}}'
character(kind=CK,len=*),parameter :: str = CK_'{"vars":{"a/first":1,"a\/second":2,"a\\b\\c\/third/blah/blah":3}}'
character(len=*),dimension(2),parameter :: tf = ['True ','False']

error_cnt = 0
Expand Down
3 changes: 2 additions & 1 deletion visual_studio/jsonfortranlib/jsonfortranlib.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<Tool Name="VFPostBuildEventTool"/></Configuration></Configurations>
<Files>
<Filter Name="include">
<File RelativePath="..\..\src\json_macros.inc"/></Filter>
<File RelativePath="..\..\src\json_macros.inc"/>
<File RelativePath="..\..\src\json_initialize_arguments.inc"/></Filter>
<Filter Name="src" Filter="F90;f90;for;f;fpp;ftn;def;odl;idl">
<File RelativePath="..\..\src\json_file_module.F90"/>
<File RelativePath="..\..\src\json_kinds.F90"/>
Expand Down
18 changes: 9 additions & 9 deletions visual_studio/jsonfortrantest/jsonfortrantest.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
<Files>
<Filter Name="src" Filter="f90;for;f;fpp;ftn;def;odl;idl">
<File RelativePath="..\..\src\tests\jf_test_1.F90"/>
<File RelativePath="..\..\src\tests\jf_test_01.F90"/>
<File RelativePath="..\..\src\tests\jf_test_02.F90"/>
<File RelativePath="..\..\src\tests\jf_test_03.F90"/>
<File RelativePath="..\..\src\tests\jf_test_04.F90"/>
<File RelativePath="..\..\src\tests\jf_test_05.F90"/>
<File RelativePath="..\..\src\tests\jf_test_06.F90"/>
<File RelativePath="..\..\src\tests\jf_test_07.F90"/>
<File RelativePath="..\..\src\tests\jf_test_08.F90"/>
<File RelativePath="..\..\src\tests\jf_test_09.F90"/>
<File RelativePath="..\..\src\tests\jf_test_10.F90"/>
<File RelativePath="..\..\src\tests\jf_test_11.F90"/>
<File RelativePath="..\..\src\tests\jf_test_12.F90"/>
Expand All @@ -57,7 +65,6 @@
<File RelativePath="..\..\src\tests\jf_test_17.F90"/>
<File RelativePath="..\..\src\tests\jf_test_18.F90"/>
<File RelativePath="..\..\src\tests\jf_test_19.F90"/>
<File RelativePath="..\..\src\tests\jf_test_2.F90"/>
<File RelativePath="..\..\src\tests\jf_test_20.F90"/>
<File RelativePath="..\..\src\tests\jf_test_21.F90"/>
<File RelativePath="..\..\src\tests\jf_test_22.F90"/>
Expand All @@ -67,13 +74,6 @@
<File RelativePath="..\..\src\tests\jf_test_26.F90"/>
<File RelativePath="..\..\src\tests\jf_test_27.F90"/>
<File RelativePath="..\..\src\tests\jf_test_29.F90"/>
<File RelativePath="..\..\src\tests\jf_test_3.F90"/>
<File RelativePath="..\..\src\tests\jf_test_30.F90"/>
<File RelativePath="..\..\src\tests\jf_test_4.F90"/>
<File RelativePath="..\..\src\tests\jf_test_5.F90"/>
<File RelativePath="..\..\src\tests\jf_test_6.F90"/>
<File RelativePath="..\..\src\tests\jf_test_7.F90"/>
<File RelativePath="..\..\src\tests\jf_test_8.F90"/>
<File RelativePath="..\..\src\tests\jf_test_9.F90"/>
<File RelativePath=".\jsonfortrantest.f90"/></Filter></Files>
<Globals/></VisualStudioProject>