Skip to content

Commit a101f35

Browse files
committed
Merge branch 'thread-safe' of https://github.com/jacobwilliams/json-fortran into coverage
updated test 15.
2 parents e437cf0 + e77cfe1 commit a101f35

31 files changed

+8400
-7741
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ addons:
2727
# Build matrix: Run the three build systems and tests in parallel
2828
env:
2929
global:
30-
- CHECK_README_PROGS="yes"
30+
- CHECK_README_PROGS="no"
3131
matrix:
3232
# CMake build with unit tests, no documentation, with coverage analysis
3333
# No unicode so that coverage combined with the build script will cover unicode
@@ -41,10 +41,11 @@ env:
4141
DEPLOY_DOCUMENTATION="no"
4242
4343
# build with build.sh, make documentation, run unit tests and perform coverage analysis
44+
# JW note: disabled coverage for testing purposes !!!! need to fix !!!!
4445
- >
45-
BUILD_SCRIPT="./build.sh --coverage --skip-documentation &&
46-
./build.sh --coverage --enable-unicode"
47-
CODE_COVERAGE="yes"
46+
BUILD_SCRIPT="./build.sh --skip-documentation &&
47+
./build.sh --enable-unicode"
48+
CODE_COVERAGE="no"
4849
DEPLOY_DOCUMENTATION="yes"
4950
5051
install:

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [Change Log](#change-log)
66
- [Unreleased](#unreleased)
7+
- [4.3.0 (2015-12-05)](#430-2015-12-05)
78
- [4.2.0 (2015-08-03)](#420-2015-08-03)
89
- [4.1.1 (2015-05-27)](#411-2015-05-27)
910
- [4.1.0 (2015-05-05)](#410-2015-05-05)
@@ -15,7 +16,30 @@
1516

1617
### [Unreleased](https://github.com/jacobwilliams/json-fortran/tree/HEAD)
1718

18-
[Complete Changeset](https://github.com/jacobwilliams/json-fortran/compare/4.2.0...HEAD)
19+
[Complete Changeset](https://github.com/jacobwilliams/json-fortran/compare/4.3.0...HEAD)
20+
21+
### [4.3.0](https://github.com/jacobwilliams/json-fortran/tree/4.3.0) (2015-12-05)
22+
23+
[Complete Changeset](https://github.com/jacobwilliams/json-fortran/compare/4.2.0...4.3.0)
24+
or [Download v4.3.0](https://github.com/jacobwilliams/json-fortran/releases/tag/4.3.0)
25+
26+
**Enhancements:**
27+
28+
- Added routines for getting the `parent`, `next`, `previous`, and `tail` pointers [\#161](https://github.com/jacobwilliams/json-fortran/issues/161) ([jacobwilliams](https://github.com/jacobwilliams))
29+
- Added a deep copy routine for `json_value` structures [\#160](https://github.com/jacobwilliams/json-fortran/issues/160) ([jacobwilliams](https://github.com/jacobwilliams))
30+
- Updated the Visual Studio solution to VS 2013. Also removed the test projects (it now just compiles the library) ([jacobwilliams](https://github.com/jacobwilliams))
31+
32+
**Fixed issues:**
33+
34+
- Rewrote logic for decoding strings, and fixed bugs related to parsing strings with certain escape character combinations [\#164](https://github.com/jacobwilliams/json-fortran/issues/164) ([jacobwilliams](https://github.com/jacobwilliams))
35+
- Fixed a bug where some real numbers weren't being read in properly. Also added an option to output real numbers with `fmt=*` formatting [\#157](https://github.com/jacobwilliams/json-fortran/issues/157) ([jacobwilliams](https://github.com/jacobwilliams))
36+
37+
**Merged pull requests:**
38+
39+
- Minor documentation change. [\#153](https://github.com/jacobwilliams/json-fortran/pull/153) ([jacobwilliams](https://github.com/jacobwilliams))
40+
- Enabled FORD graphs in documentation. [\#149](https://github.com/jacobwilliams/json-fortran/pull/149) ([jacobwilliams](https://github.com/jacobwilliams))
41+
- Tag documentation fix [\#147](https://github.com/jacobwilliams/json-fortran/pull/147) ([zbeekman](https://github.com/zbeekman))
42+
- Fix url in 4.2.0 tag documentation [\#146](https://github.com/jacobwilliams/json-fortran/pull/146) ([zbeekman](https://github.com/zbeekman))
1943

2044
### [4.2.0](https://github.com/jacobwilliams/json-fortran/tree/4.2.0) (2015-08-03)
2145

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,5 @@ git rebase upstream/master
9999
- *Do NOT* allow your editor to make a bunch of indentation or white space changes, that will introduce non-substantive changes on lines that you have not actually edited.
100100
- The coding style is modern free-form Fortran, consistent with the Fortran 2008 standard. Note that the two supported compilers (ifort and gfortran) do not currently include the entire Fortran 2008 standard. Therefore, only those language features supported by Gfortran 4.9 and Intel 13.1.0 are currently allowed. This also means that previous versions of these compilers are not supported, and major changes to the code to support earlier compilers (or Fortran 95) will not be accepted. At some point in the future (when compiler support has improved), all Fortran 2008 features will be allowed.
101101
- All subroutines and functions *must* be properly documented. This includes useful inline comments as well as comment blocks using the [FORD](https://github.com/cmacmackin/ford/wiki/Writing-Documentation) syntax.
102-
- For simplicity, JSON-Fortran currently consists of one module file. It is not envisioned that it will ever need to expand to include multiple files (if it does, there would need to be a very good reason).
103102

104103
[top](#contributing-to-json-fortran)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
JSON-Fortran: A Fortran 2008 JSON API
22
<https://github.com/jacobwilliams/json-fortran>
33

4-
Copyright (c) 2014-2015, Jacob Williams
4+
Copyright (c) 2014-2016, Jacob Williams
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without modification,

README.md

Lines changed: 4 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,13 @@ A Fortran 2008 JSON API
1212
- [Brief description](#brief-description)
1313
- [Download](#download)
1414
- [Building the library](#building-the-library)
15-
- [Example Usage](#example-usage)
16-
- [Reading JSON from a file](#reading-json-from-a-file)
17-
- [Reading JSON from a string](#reading-json-from-a-string)
18-
- [Modifying variables in a JSON file](#modifying-variables-in-a-json-file)
19-
- [Writing a JSON file](#writing-a-json-file)
20-
- [Building a JSON file from scratch](#building-a-json-file-from-scratch)
2115
- [Documentation](#documentation)
2216
- [Contributing](#contributing)
2317
- [License](#license)
2418
- [Miscellaneous](#miscellaneous)
2519

2620
<!-- markdown-toc end -->
2721

28-
2922
Status
3023
------
3124
[![Build Status](https://img.shields.io/travis/jacobwilliams/json-fortran/master.svg?style=plastic)](https://travis-ci.org/jacobwilliams/json-fortran)
@@ -40,6 +33,7 @@ Status
4033
Take a look at the
4134
[CHANGELOG](https://github.com/jacobwilliams/json-fortran/blob/master/CHANGELOG.md#unreleased)
4235
for a list of changes since the latest release.
36+
4337
[top](#json-fortran)
4438

4539
Brief description
@@ -120,7 +114,7 @@ cmake_minimum_required ( VERSION 2.8.8 FATAL_ERROR )
120114
enable_language ( Fortran )
121115
project ( jf_test NONE )
122116
123-
find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} 4.2.0 REQUIRED )
117+
find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} 4.3.0 REQUIRED )
124118
include_directories ( "${jsonfortran_INCLUDE_DIRS}" )
125119
126120
file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.f90" )
@@ -135,161 +129,6 @@ endforeach()
135129

136130
[top](#json-fortran)
137131

138-
Example Usage
139-
---------------
140-
In this section the basic functionality of the JSON-Fortran library is illustrated.
141-
142-
### Reading JSON from a file
143-
144-
Reading a JSON file and getting data from it is fairly
145-
straightforward using the `json_file` class. Here is an example. See unit tests 1 and 3-6
146-
for more examples. The source files may be found in `src/tests/`.
147-
148-
```fortran
149-
program example1
150-
151-
use json_module
152-
153-
type(json_file) :: json
154-
logical :: found
155-
integer :: i,j,k
156-
157-
! initialize the module
158-
call json_initialize()
159-
160-
! read the file
161-
call json%load_file(filename = '../files/inputs/test1.json')
162-
163-
! print the file to the console
164-
call json%print_file()
165-
166-
! extract data from the file
167-
! [found can be used to check if the data was really there]
168-
call json%get('version.major', i, found)
169-
if ( .not. found ) stop 1
170-
call json%get('version.minor', j, found)
171-
if ( .not. found ) stop 1
172-
call json%get('data(1).number', k, found)
173-
if ( .not. found ) stop 1
174-
175-
! clean up
176-
call json%destroy()
177-
if (json_failed()) stop 1
178-
179-
end program example1
180-
```
181-
182-
[top](#json-fortran)
183-
184-
### Reading JSON from a string
185-
186-
JSON can also be read directly from a character string like so:
187-
```fortran
188-
call json%load_from_string('{"name": "Leonidas"}')
189-
```
190-
191-
[top](#json-fortran)
192-
193-
### Modifying variables in a JSON file
194-
195-
After reading a JSON file, if you want to change the values of some of the variables, you can use the `update` method. For the example above:
196-
197-
```fortran
198-
! [found can be used to check if the data was really there]
199-
call json%update('version.major',9,found) !change major version to 9
200-
call json%update('version.minor',0,found) !change minor version to 0
201-
call json%update('version.patch',0,found) !change patch to 0
202-
```
203-
204-
[top](#json-fortran)
205-
206-
### Writing a JSON file
207-
208-
To print the JSON file (either to a file or the console), the `print_file` method can be used. For the above example:
209-
210-
```fortran
211-
call json%print_file() !prints to the console
212-
call json%print_file(iunit) !prints to the file connected to iunit
213-
```
214-
215-
[top](#json-fortran)
216-
217-
### Building a JSON file from scratch
218-
219-
Constructing a JSON file element by element is slightly more complicated and involves the use
220-
of `json_value` pointers. For more examples see unit tests 2, 4 and 7 in `src/tests/`.
221-
222-
```fortran
223-
program example2
224-
225-
use,intrinsic :: iso_fortran_env, only: wp => real64
226-
227-
use json_module
228-
229-
type(json_value),pointer :: p, inp
230-
231-
! initialize the module
232-
call json_initialize()
233-
234-
! initialize the structure:
235-
call json_create_object(p,'')
236-
237-
! add an "inputs" object to the structure:
238-
call json_create_object(inp,'inputs')
239-
call json_add(p, inp) !add it to the root
240-
241-
! add some data to inputs:
242-
call json_add(inp, 't0', 0.1_wp)
243-
call json_add(inp, 'tf', 1.1_wp)
244-
call json_add(inp, 'x0', 9999.0000d0)
245-
call json_add(inp, 'integer_scalar', 787)
246-
call json_add(inp, 'integer_array', [2,4,99])
247-
call json_add(inp, 'names', ['aaa','bbb','ccc'])
248-
call json_add(inp, 'logical_scalar', .true.)
249-
call json_add(inp, 'logical_vector', [.true., .false., .true.])
250-
nullify(inp) !don't need this anymore
251-
252-
! write the file:
253-
call json_print(p,'../files/example2.json')
254-
255-
!cleanup:
256-
call json_destroy(p)
257-
if (json_failed()) stop 1
258-
259-
end program example2
260-
```
261-
262-
The code above produces the file:
263-
264-
```JSON
265-
{
266-
"inputs": {
267-
"t0": 0.1E+0,
268-
"tf": 0.11E+1,
269-
"x0": 0.9999E+4,
270-
"integer_scalar": 787,
271-
"integer_array": [
272-
2,
273-
4,
274-
99
275-
],
276-
"names": [
277-
"aaa",
278-
"bbb",
279-
"ccc"
280-
],
281-
"logical_scalar": true,
282-
"logical_vector": [
283-
true,
284-
false,
285-
true
286-
]
287-
}
288-
}
289-
```
290-
291-
[top](#json-fortran)
292-
293132
Documentation
294133
--------------
295134

@@ -299,6 +138,8 @@ documentation can also be generated by processing the source files
299138
with [FORD](https://github.com/cmacmackin/ford). Note that both the
300139
shell script and CMake will also generate these files automatically in the documentation folder, assuming you have FORD installed.
301140

141+
Some examples can also be found on the [wiki](https://github.com/jacobwilliams/json-fortran/wiki/Example-Usage).
142+
302143
[top](#json-fortran)
303144

304145
Contributing

__VERSION__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2.0
1+
4.3.0

files/inputs/test1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"..\\path\\to\\files\\file2.txt",
1212
"..\\path\\to\\files\\file3.txt",
1313
"test \u2FA4 \uABCD \uABCD\uABCDtest",
14-
" test test test"
14+
" test \\u \" blah\\\" test test",
15+
"..\\path\\to\\files\\"
1516
],
1617
"empty_array": [
1718
],

json-fortran.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
project: JSON-Fortran
23
favicon: ./media/json-fortran-32x32.png
34
project_dir: ./src
@@ -20,27 +21,33 @@ display: public
2021
source: true
2122
graph: true
2223
extra_mods: iso_fortran_env:https://gcc.gnu.org/onlinedocs/gfortran/ISO_005fFORTRAN_005fENV.html
23-
md_extensions: markdown.extensions.toc
24+
md_extensions: markdown.extensions.toc(anchorlink=True)
2425
markdown.extensions.smarty(smart_quotes=False)
26+
---
27+
28+
--------------------
2529

2630
[TOC]
2731

28-
# Brief description
32+
Brief description
33+
-----------------
2934

3035
A user-friendly and object-oriented API for reading and writing JSON files, written in
3136
modern Fortran (Fortran 2003+). The source code is
3237
[a single Fortran module](|url|/module/json_module.html) file
3338
([json_module.F90](|url|/sourcefile/json_module.f90.html)).
3439

35-
# License
40+
License
41+
-------
3642

3743
The JSON-Fortran source code and related files and documentation are
3844
distributed under a permissive free software license (BSD-style). See
3945
the
4046
[LICENSE](http://jacobwilliams.github.io/json-fortran/page/development-resources/LICENSE.html)
4147
file for more details.
4248

43-
# Official Releases
49+
Official Releases
50+
-----------------
4451

4552
The **current stable release** is **{!__VERSION__!}** and can be [downloaded
4653
on GitHub](https://github.com/jacobwilliams/json-fortran/releases/latest)
@@ -54,7 +61,8 @@ A list of all past releases, links to their documentation, and the
5461
chage log can be found on the
5562
[releases page](http://jacobwilliams.github.io/json-fortran/page/releases/index.html).
5663

57-
# Miscellaneous
64+
Miscellaneous
65+
-------------
5866

5967
* For more information about JSON, see: <http://www.json.org/>
6068

pages/releases/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ documentation from the documentation for official releases other than
2525
using the browser's back button. Feel free to bookmark this page, or
2626
the [main project page](|url|/index.html) for convenient navigation.
2727

28+
* [4.3.0](http://jacobwilliams.github.io/json-fortran/4.3.0/index.html)
29+
([FORD](https://github.com/cmacmackin/ford) generated documentation)
30+
- [Download](https://github.com/jacobwilliams/json-fortran/releases/tag/4.3.0)
2831
* [4.2.0](http://jacobwilliams.github.io/json-fortran/4.2.0/index.html)
2932
([FORD](https://github.com/cmacmackin/ford) generated documentation)
3033
- [Download](https://github.com/jacobwilliams/json-fortran/releases/tag/4.2.0)

0 commit comments

Comments
 (0)