Skip to content

Commit c65ec9d

Browse files
committed
minor commenting and refactoring.
1 parent 650da7d commit c65ec9d

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

robodoc.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ keywords:
147147
elemental
148148
else
149149
else if
150+
elseif
150151
elsewhere
151152
end
152153
end associate

src/json_module.f90

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ module json_module
245245
!
246246
! SOURCE
247247

248-
type,public :: json_value
248+
type,public :: json_value
249249

250250
!force the constituents to be stored contiguously
251251
![note: on Intel, the order of the variables below
@@ -272,11 +272,9 @@ module json_module
272272

273273
integer(IK),private :: n_children = 0 !number of children
274274

275-
end type json_value
275+
end type json_value
276276
!*********************************************************
277277

278-
!*********************************************************
279-
type,public :: json_file
280278
!*********************************************************
281279
!****c* json_module/json_file
282280
!
@@ -306,12 +304,14 @@ module json_module
306304
!
307305
! SOURCE
308306

307+
type,public :: json_file
308+
309309
private
310310

311311
!the JSON structure read from the file:
312312
type(json_value),pointer :: p => null()
313313

314-
contains
314+
contains
315315

316316
procedure,public :: load_file => json_file_load
317317
procedure,public :: load_from_string => json_file_load_from_string
@@ -363,8 +363,7 @@ module json_module
363363
procedure :: json_file_print_1
364364
procedure :: json_file_print_2
365365

366-
!*********************************************************
367-
end type json_file
366+
end type json_file
368367
!*********************************************************
369368

370369
!*************************************************************************************
@@ -506,7 +505,7 @@ end subroutine array_callback_func
506505
! EXAMPLE
507506
! Consider the following example:
508507
! type(json_value) :: p
509-
! ...
508+
! !...
510509
! call json_print(p,'test.json') !this is json_print_2
511510
!
512511
! SOURCE
@@ -1574,14 +1573,10 @@ end subroutine json_value_create
15741573
! DESCRIPTION
15751574
! Destroy a json_value linked-list structure.
15761575
!
1577-
! NOTES
1578-
! This routine does not check for exceptions.
1579-
!
1580-
! The original version of this routine was not
1581-
! properly freeing the memory. It has been rewritten.
1582-
!
15831576
! AUTHOR
1584-
! Jacob Williams : 1/22/2014
1577+
! Jacob Williams : 1/22/2014 : The original version of this
1578+
! routine was not properly freeing the memory.
1579+
! It has been rewritten.
15851580
!
15861581
! SOURCE
15871582

@@ -2569,7 +2564,7 @@ end subroutine json_value_add_string_vec
25692564
!
25702565
! SOURCE
25712566

2572-
function json_count(me) result(count)
2567+
pure function json_count(me) result(count)
25732568

25742569
implicit none
25752570

@@ -3071,7 +3066,7 @@ end subroutine json_value_print
30713066
! Consider the following example:
30723067
! type(json_value),pointer :: dat,p
30733068
! logical :: found
3074-
! ...
3069+
! !...
30753070
! call json_get(dat,'data(2).version',p,found)
30763071
!
30773072
! NOTES
@@ -4144,7 +4139,7 @@ subroutine json_parse(file, p, unit, str)
41444139
iostat = istat)
41454140
end if
41464141

4147-
elseif (.not. present(unit) .and. present(file) .and. .not. present(str)) then
4142+
else if (.not. present(unit) .and. present(file) .and. .not. present(str)) then
41484143

41494144
! open the file with a new unit number:
41504145
open ( newunit = iunit, &
@@ -4155,7 +4150,7 @@ subroutine json_parse(file, p, unit, str)
41554150
position = 'REWIND', &
41564151
iostat = istat)
41574152

4158-
elseif (.not. present(unit) .and. .not. present(file) .and. present(str)) then
4153+
else if (.not. present(unit) .and. .not. present(file) .and. present(str)) then
41594154

41604155
buffer = str
41614156
iunit = 0 !indicates that json data will be read from buffer
@@ -5468,7 +5463,7 @@ end subroutine push_char
54685463
!
54695464
! SOURCE
54705465

5471-
subroutine integer_to_string(ival,str)
5466+
pure subroutine integer_to_string(ival,str)
54725467

54735468
implicit none
54745469

@@ -5635,7 +5630,7 @@ end subroutine compact_real_string
56355630
!
56365631
! SOURCE
56375632

5638-
function valid_json_hex(str) result(valid)
5633+
pure function valid_json_hex(str) result(valid)
56395634

56405635
implicit none
56415636

0 commit comments

Comments
 (0)