Skip to content

Commit 02d89fa

Browse files
committed
Merge pull request #2 from zbeekman/DPD200247629-work-around
DPD200247629 work around
2 parents 9a5da3d + 9ab8690 commit 02d89fa

File tree

5 files changed

+110
-97
lines changed

5 files changed

+110
-97
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A Fortran 2003/2008 JSON API
66
Brief Description
77
---------------
88

9-
A mostly-complete API for reading and writing JSON files, written in modern Fortran. The code requires a Fortran compiler that supports various Fortran 2003 and Fortran 2008 features such as: allocatable strings, associate, newunit, generic, class, and abstract interface. I am using the Intel Fortran compiler 13.1.0 on Linux (the Mac and PC versions should also work fine). It does not currently compile with the gnu gfortran compiler. The source code is a single Fortran module file (json_module.f90).
9+
A mostly-complete API for reading and writing JSON files, written in modern Fortran. The code requires a Fortran compiler that supports various Fortran 2003 and Fortran 2008 features such as: allocatable strings, associate, newunit, generic, class, and abstract interface. I am using the Intel Fortran compiler 13.1.0 on Linux (the Mac and PC versions should also work fine). It also currently compiles under recent experimental 4.9 release of the gnu gfortran compiler. The source code is a single Fortran module file (json_module.f90).
1010

1111
Reading a JSON file
1212
---------------

build.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,28 @@
66
# Jacob Williams : 2/8/2014
77
#
88

9+
# Uncomment to debug
10+
#set -x
11+
912
SRCDIR='src/'
1013
BUILDDIR='lib/'
1114
BINDIR='bin/'
1215

16+
# Intel compiler
1317
FCOMPILER='ifort'
14-
FCOMPILERFLAGS='-O2'
15-
#FCOMPILERFLAGS='-check all -debug full'
18+
# The following warning might be triggered by ifort unless explicitly silenced:
19+
# warning #7601: F2008 standard does not allow an internal procedure to be an actual argument procedure name. (R1214.4).
20+
# In the context of F2008 this is an erroneous warning.
21+
# See https://prd1idz.cps.intel.com/en-us/forums/topic/486629
22+
FCOMPILERFLAGS='-O2 -warn -stand f08 -diag-disable 7601 -traceback'
23+
#FCOMPILERFLAGS='-warn -traceback -stand f08 -assume protect_parens -assume buffered_io -check all'
24+
# trailing space is significant
25+
FCMODULEPATHFLAG='-module '
26+
27+
# GFortran (must be >= 4.9)
28+
#FCOMPILER='/opt/local/bin/gfortran-mp-4.9'
29+
#FCOMPILERFLAGS='-O2 -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -pedantic -std=f2008'
30+
#FCMODULEPATHFLAG='-J'
1631

1732
ARCHIVER='ar'
1833
ARCHIVERFLAGS='-cq'
@@ -32,8 +47,9 @@ mkdir -p $BUILDDIR
3247
mkdir -p $BINDIR
3348

3449
#build library:
35-
$FCOMPILER $FCOMPILERFLAGS -c $SRCDIR$MODCODE$FEXT -Fo$BUILDDIR -module $BUILDDIR
50+
$FCOMPILER $FCOMPILERFLAGS -c $SRCDIR$MODCODE$FEXT $FCMODULEPATHFLAG$BUILDDIR
51+
mv $MODCODE$OBJEXT $BUILDDIR
3652
$ARCHIVER $ARCHIVERFLAGS $BUILDDIR$LIBOUT$LIBEXT $BUILDDIR$MODCODE$OBJEXT
3753

3854
#build example:
39-
$FCOMPILER $FCOMPILERFLAGS -o $BINDIR$EXEOUT -module $BUILDDIR $SRCDIR$EXAMPLECODE$FEXT $BUILDDIR$LIBOUT$LIBEXT
55+
$FCOMPILER $FCOMPILERFLAGS -o $BINDIR$EXEOUT $FCMODULEPATHFLAG$BUILDDIR $SRCDIR$EXAMPLECODE$FEXT $BUILDDIR$LIBOUT$LIBEXT

files/test2.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44
"tf": 0.1100000000000000E+001,
55
"x0": 0.9999000000000000E+004,
66
"integer_scalar": 1,
7-
"integer_array": [
7+
"integer_array": [
88
2,
99
4,
1010
99
1111
],
12-
"names": [
12+
"names": [
1313
"aaa",
1414
"bbb",
1515
"ccc"
1616
],
1717
"logical_scalar": true,
18-
"logical_vector": [
18+
"logical_vector": [
1919
true,
2020
false,
2121
true
2222
]
2323
},
24-
"trajectory": [
24+
"trajectory": [
2525
{
2626
"VARIABLE": "Rx",
2727
"UNITS": "km",
2828
"FRAME": "J2000",
2929
"CENTER": "EARTH",
30-
"DATA": [
30+
"DATA": [
3131
0.1000000000000000E+001,
3232
0.2000000000000000E+001,
3333
0.3000000000000000E+001
@@ -38,7 +38,7 @@
3838
"UNITS": "km",
3939
"FRAME": "J2000",
4040
"CENTER": "EARTH",
41-
"DATA": [
41+
"DATA": [
4242
0.1000000000000000E+002,
4343
0.2000000000000000E+002,
4444
0.3000000000000000E+002
@@ -49,7 +49,7 @@
4949
"UNITS": "km",
5050
"FRAME": "J2000",
5151
"CENTER": "EARTH",
52-
"DATA": [
52+
"DATA": [
5353
0.1000000000000000E+003,
5454
0.2000000000000000E+003,
5555
0.3000000000000000E+003
@@ -60,7 +60,7 @@
6060
"UNITS": "km\/s",
6161
"FRAME": "J2000",
6262
"CENTER": "EARTH",
63-
"DATA": [
63+
"DATA": [
6464
0.1000000000000000E-002,
6565
0.2000000000000000E-002,
6666
0.3000000000000000E-002
@@ -71,7 +71,7 @@
7171
"UNITS": "km\/s",
7272
"FRAME": "J2000",
7373
"CENTER": "EARTH",
74-
"DATA": [
74+
"DATA": [
7575
0.2000000000000000E-002,
7676
0.2000000000000000E-001,
7777
0.3000000000000000E-002
@@ -82,7 +82,7 @@
8282
"UNITS": "km\/s",
8383
"FRAME": "J2000",
8484
"CENTER": "EARTH",
85-
"DATA": [
85+
"DATA": [
8686
0.3000000000000000E-002,
8787
0.3000000000000000E-001,
8888
0.4000000000000000E-001

src/json_example.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ subroutine add_variables_to_input(me, variable, units, frame, center, rdata)
333333
real(wp),dimension(:),intent(in) :: rdata
334334

335335
type(json_value),pointer :: var !a variable in the trajectory:
336-
integer :: i
337336

338337
!initialize:
339338
nullify(var)
@@ -617,4 +616,4 @@ end subroutine print_error_message
617616

618617
!*******************************************************************************************************
619618
end program json_test
620-
!*******************************************************************************************************
619+
!*******************************************************************************************************

0 commit comments

Comments
 (0)