Skip to content

Commit 7f45591

Browse files
Merge pull request #313 from jacobwilliams/devel
Devel
2 parents aaf2c84 + f72eb2e commit 7f45591

18 files changed

+184
-20
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ install:
6767
fi
6868
- pip install --upgrade pygooglechart
6969
- pip install --upgrade graphviz
70-
- (pip install --upgrade FoBiS.py && FoBiS.py --version)
71-
- (pip install --upgrade ford && ford --version)
70+
- (pip install --upgrade FoBiS.py==2.2.8 && FoBiS.py --version)
71+
- (pip install --upgrade ford==5.0.6 && ford --version)
72+
- (pip install --upgrade markdown==2.6.9)
7273
- (pip install --upgrade git+https://github.com/dmeranda/demjson.git && jsonlint --version)
7374

7475
before_script:

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ if ( ENABLE_TESTS )
301301
endif()
302302
endforeach ( UNIT_TEST )
303303

304-
set_property ( TEST jf_test_3
304+
set_property ( TEST jf_test_03
305305
APPEND
306-
PROPERTY DEPENDS jf_test_2 )
306+
PROPERTY DEPENDS jf_test_02 )
307307

308308
# Validate output
309309
if ( JSONLINT )
@@ -423,4 +423,4 @@ install(FILES
423423
if(MSVC_IDE)
424424
INCLUDE_DIRECTORIES("src")
425425
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
426-
endif()
426+
endif()

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,22 @@ script) with the [NAG Fortran compiler 6.0](http://www.nag.com/nagware/NP/NP_des
9090
Currently, several ways are provided to build the JSON-fortran library
9191
(libjsonfortran).
9292

93-
* 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.
93+
* 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.
94+
95+
* 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:
96+
97+
* To build all the examples using gfortran: `FoBiS.py build -f json-fortran.fobis -mode tests-gnu`
98+
* To build all the examples using ifort: `FoBiS.py build -f json-fortran.fobis -mode tests-intel`
99+
* To build a static library using gfortran: `FoBiS.py build -f json-fortran.fobis -mode static-gnu`
100+
* To build a static library using ifort: `FoBiS.py build -f json-fortran.fobis -mode static-intel`
101+
102+
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`
103+
104+
To generate the documentation using [ford](https://github.com/cmacmackin/ford), run:
105+
106+
```
107+
FoBis.py rule --execute makedoc -f json-fortran.fobis
108+
```
94109

95110
* 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.
96111

@@ -116,7 +131,7 @@ project ( jf_test NONE )
116131
find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} 6.2.0 REQUIRED )
117132
include_directories ( "${jsonfortran_INCLUDE_DIRS}" )
118133
119-
file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.f90" )
134+
file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.F90" )
120135
foreach ( UNIT_TEST ${JF_TEST_SRCS} )
121136
get_filename_component ( TEST ${UNIT_TEST} NAME_WE )
122137
add_executable ( ${TEST} ${UNIT_TEST} )

deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Script to deploy documentation after successfull build of master branch or tag
2+
# Script to deploy documentation after successful build of master branch or tag
33
# If running under travis-ci this will automatically deploy updates to the master branch's
44
# documentation on build events for the master branch, and will add/update documentation for
55
# any new/updated tags that are pushed.
@@ -20,7 +20,7 @@ if [ "$TRAVIS" ]; then #running under travis
2020
git commit -m "Development documentation updated by travis job $TRAVIS_JOB_NUMBER for commits $TRAVIS_COMMIT_RANGE" || true
2121
git push -fq origin gh-pages > /dev/null 2>&1 || true
2222
fi
23-
# If publishing a new/updated tag, deploy it's documentation
23+
# If publishing a new/updated tag, deploy its documentation
2424
if [ "$TRAVIS_TAG" ] && [ "$(ls -A "$TRAVIS_BUILD_DIR/doc")" ] ; then #not empty
2525
cd "$TRAVIS_BUILD_DIR" || exit 1
2626
git clone -q --branch=gh-pages "https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG" gh-pages >/dev/null 2>&1

json-fortran.fobis

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
[modes]
2+
modes = static-gnu static-gnu-debug
3+
static-intel static-intel-debug
4+
shared-gnu shared-gnu-debug
5+
shared-intel shared-intel-debug
6+
tests-gnu tests-gnu-debug
7+
tests-intel tests-intel-debug
8+
9+
[common-variables]
10+
$MOD_FILE = json_module.F90
11+
$FORD_FILE = json-fortran.md
12+
$STATIC_LIB = libjsonfortran.a
13+
$SHARED_LIB = libjsonfortran.so
14+
$OPTIMIZE = -O2
15+
$CSTATIC_GNU = -c -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -Wno-unused-function -pedantic -std=f2008ts
16+
$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
17+
$CSTATIC_INT = -c -std15
18+
$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
19+
$EXCLUDE_DIRS = ./src/tests/introspection
20+
./visual_studio/jsonfortrantest
21+
22+
# modes templates
23+
[template-static]
24+
cflags_heritage = True
25+
build_dir = ./lib/
26+
mod_dir = ./mod/
27+
obj_dir = ./obj/
28+
src = ./src/
29+
colors = True
30+
quiet = False
31+
log = False
32+
jobs = 2
33+
mklib = static
34+
target = $MOD_FILE
35+
output = $STATIC_LIB
36+
exclude_dirs = $EXCLUDE_DIRS
37+
38+
[template-shared]
39+
cflags_heritage = True
40+
build_dir = ./lib/
41+
mod_dir = ./mod/
42+
obj_dir = ./obj/
43+
src = ./src/
44+
colors = True
45+
quiet = False
46+
log = False
47+
jobs = 2
48+
mklib = shared
49+
target = $MOD_FILE
50+
output = $SHARED_LIB
51+
exclude_dirs = $EXCLUDE_DIRS
52+
53+
[template-tests]
54+
cflags_heritage = True
55+
build_dir = ./bin/
56+
mod_dir = ./mod/
57+
obj_dir = ./obj/
58+
src = ./src/
59+
colors = True
60+
quiet = False
61+
log = False
62+
jobs = 2
63+
exclude_dirs = $EXCLUDE_DIRS
64+
65+
# main modes
66+
67+
# library
68+
[static-gnu]
69+
description = Build library with GNU gfortran by optimized-static flags
70+
compiler = gnu
71+
cflags = $CSTATIC_GNU $OPTIMIZE
72+
template = template-static
73+
74+
[static-gnu-debug]
75+
description = Build library with GNU gfortran by debug-static flags
76+
compiler = gnu
77+
cflags = $CSTATIC_GNU $DEBUG_GNU
78+
template = template-static
79+
80+
[static-intel]
81+
description = Build library with Intel Fortran by optimized-static flags
82+
compiler = intel
83+
cflags = $CSTATIC_INT $OPTIMIZE
84+
template = template-static
85+
86+
[static-intel-debug]
87+
description = Build library with Intel Fortran by debug-static flags
88+
compiler = intel
89+
cflags = $CSTATIC_INT $DEBUG_INT
90+
template = template-static
91+
92+
[shared-gnu]
93+
description = Build library with GNU gfortran by optimized-shared flags
94+
compiler = gnu
95+
cflags = $CSTATIC_GNU $OPTIMIZE
96+
template = template-shared
97+
98+
[shared-gnu-debug]
99+
description = Build library with GNU gfortran by debug-shared flags
100+
compiler = gnu
101+
cflags = $CSTATIC_GNU $DEBUG_GNU
102+
template = template-shared
103+
104+
[shared-intel]
105+
description = Build library with Intel Fortran by optimized-shared flags
106+
compiler = intel
107+
cflags = $CSTATIC_INT $OPTIMIZE
108+
template = template-shared
109+
110+
[shared-intel-debug]
111+
description = Build library with Intel Fortran by debug-shared flags
112+
compiler = intel
113+
cflags = $CSTATIC_INT $DEBUG_INT
114+
template = template-shared
115+
116+
# test programs
117+
[tests-gnu]
118+
description = Build all tests with GNU gfortran by optimized-static flags
119+
compiler = gnu
120+
cflags = $CSTATIC_GNU $OPTIMIZE
121+
template = template-tests
122+
123+
[tests-gnu-debug]
124+
description = Build all tests with GNU gfortran by debug-static flags
125+
compiler = gnu
126+
cflags = $CSTATIC_GNU $DEBUG_GNU
127+
template = template-tests
128+
129+
[tests-intel]
130+
description = Build all tests with Intel Fortran by optimized-static flags
131+
compiler = intel
132+
cflags = $CSTATIC_INT $OPTIMIZE
133+
template = template-tests
134+
135+
[tests-intel-debug]
136+
description = Build all tests with Intel Fortran by debug-static flags
137+
compiler = intel
138+
cflags = $CSTATIC_INT $DEBUG_INT
139+
template = template-tests
140+
141+
# auxiliary rules
142+
[rule-makedoc]
143+
help = Rule for building documentation from source files
144+
rule_1 = ford $FORD_FILE

src/json_string_utilities.F90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ subroutine escape_string(str_in, str_out, escape_solidus)
369369
if (escape_solidus) then
370370
str_out(ipos:ipos+1) = backslash//c
371371
ipos = ipos + 2
372+
else
373+
str_out(ipos:ipos) = c
374+
ipos = ipos + 1
372375
end if
373376
case(bspace)
374377
str_out(ipos:ipos+1) = '\b'
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.

src/tests/jf_test_30.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ subroutine test_30(error_cnt)
2222
type(json_core) :: json_c
2323
integer :: i
2424

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

2828
error_cnt = 0

visual_studio/jsonfortranlib/jsonfortranlib.vfproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
<Tool Name="VFPostBuildEventTool"/></Configuration></Configurations>
4343
<Files>
4444
<Filter Name="include">
45-
<File RelativePath="..\..\src\json_macros.inc"/></Filter>
45+
<File RelativePath="..\..\src\json_macros.inc"/>
46+
<File RelativePath="..\..\src\json_initialize_arguments.inc"/></Filter>
4647
<Filter Name="src" Filter="F90;f90;for;f;fpp;ftn;def;odl;idl">
4748
<File RelativePath="..\..\src\json_file_module.F90"/>
4849
<File RelativePath="..\..\src\json_kinds.F90"/>

visual_studio/jsonfortrantest/jsonfortrantest.vfproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,15 @@
4646
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
4747
<Files>
4848
<Filter Name="src" Filter="f90;for;f;fpp;ftn;def;odl;idl">
49-
<File RelativePath="..\..\src\tests\jf_test_1.F90"/>
49+
<File RelativePath="..\..\src\tests\jf_test_01.F90"/>
50+
<File RelativePath="..\..\src\tests\jf_test_02.F90"/>
51+
<File RelativePath="..\..\src\tests\jf_test_03.F90"/>
52+
<File RelativePath="..\..\src\tests\jf_test_04.F90"/>
53+
<File RelativePath="..\..\src\tests\jf_test_05.F90"/>
54+
<File RelativePath="..\..\src\tests\jf_test_06.F90"/>
55+
<File RelativePath="..\..\src\tests\jf_test_07.F90"/>
56+
<File RelativePath="..\..\src\tests\jf_test_08.F90"/>
57+
<File RelativePath="..\..\src\tests\jf_test_09.F90"/>
5058
<File RelativePath="..\..\src\tests\jf_test_10.F90"/>
5159
<File RelativePath="..\..\src\tests\jf_test_11.F90"/>
5260
<File RelativePath="..\..\src\tests\jf_test_12.F90"/>
@@ -57,7 +65,6 @@
5765
<File RelativePath="..\..\src\tests\jf_test_17.F90"/>
5866
<File RelativePath="..\..\src\tests\jf_test_18.F90"/>
5967
<File RelativePath="..\..\src\tests\jf_test_19.F90"/>
60-
<File RelativePath="..\..\src\tests\jf_test_2.F90"/>
6168
<File RelativePath="..\..\src\tests\jf_test_20.F90"/>
6269
<File RelativePath="..\..\src\tests\jf_test_21.F90"/>
6370
<File RelativePath="..\..\src\tests\jf_test_22.F90"/>
@@ -67,13 +74,6 @@
6774
<File RelativePath="..\..\src\tests\jf_test_26.F90"/>
6875
<File RelativePath="..\..\src\tests\jf_test_27.F90"/>
6976
<File RelativePath="..\..\src\tests\jf_test_29.F90"/>
70-
<File RelativePath="..\..\src\tests\jf_test_3.F90"/>
7177
<File RelativePath="..\..\src\tests\jf_test_30.F90"/>
72-
<File RelativePath="..\..\src\tests\jf_test_4.F90"/>
73-
<File RelativePath="..\..\src\tests\jf_test_5.F90"/>
74-
<File RelativePath="..\..\src\tests\jf_test_6.F90"/>
75-
<File RelativePath="..\..\src\tests\jf_test_7.F90"/>
76-
<File RelativePath="..\..\src\tests\jf_test_8.F90"/>
77-
<File RelativePath="..\..\src\tests\jf_test_9.F90"/>
7878
<File RelativePath=".\jsonfortrantest.f90"/></Filter></Files>
7979
<Globals/></VisualStudioProject>

0 commit comments

Comments
 (0)