Skip to content

Commit 0b00eb7

Browse files
committed
Additional API cleanups. All public json_value_* routines were renamed json_*.
some commenting updates.
1 parent 2046f29 commit 0b00eb7

File tree

3 files changed

+132
-120
lines changed

3 files changed

+132
-120
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ of pointers. See the json_example.f90 file for more examples.
116116
117117
! add an "inputs" object to the structure:
118118
call json_create_object(inp,'inputs')
119-
call json_value_add(p, inp) !add it to the root
119+
call json_add(p, inp) !add it to the root
120120
121121
! add some data to inputs:
122-
call json_value_add(inp, 't0', 0.1_wp)
123-
call json_value_add(inp, 'tf', 1.1_wp)
124-
call json_value_add(inp, 'x0', 9999.0000d0)
125-
call json_value_add(inp, 'integer_scalar', 787)
126-
call json_value_add(inp, 'integer_array', [2,4,99])
127-
call json_value_add(inp, 'names', ['aaa','bbb','ccc'])
128-
call json_value_add(inp, 'logical_scalar', .true.)
129-
call json_value_add(inp, 'logical_vector', [.true., .false., .true.])
122+
call json_add(inp, 't0', 0.1_wp)
123+
call json_add(inp, 'tf', 1.1_wp)
124+
call json_add(inp, 'x0', 9999.0000d0)
125+
call json_add(inp, 'integer_scalar', 787)
126+
call json_add(inp, 'integer_array', [2,4,99])
127+
call json_add(inp, 'names', ['aaa','bbb','ccc'])
128+
call json_add(inp, 'logical_scalar', .true.)
129+
call json_add(inp, 'logical_vector', [.true., .false., .true.])
130130
nullify(inp) !don't need this anymore
131131
132132
! write the file:

src/json_example.f90

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ subroutine test_4()
261261
do i=1,100
262262
write(istr,fmt='(I10)') i
263263
istr = adjustl(istr)
264-
call json_value_add(inp, 'x'//trim(istr),i)
264+
call json_add(inp, 'x'//trim(istr),i)
265265
end do
266-
call json_value_add(p, inp)
266+
call json_add(p, inp)
267267
nullify(inp)
268268

269269
write(*,'(A)') ''
@@ -327,26 +327,26 @@ subroutine test_2()
327327

328328
!config structure:
329329
call json_create_object(inp,'inputs') !an object
330-
call json_value_add(p, inp)
330+
call json_add(p, inp)
331331

332332
!trajectory structure:
333333
call json_create_array(traj,'trajectory') !an array
334-
call json_value_add(p, traj)
334+
call json_add(p, traj)
335335

336336
write(*,'(A)') ''
337337
write(*,'(A)') 'adding some data to structure...'
338338

339339
!add some variables:
340340

341341
!input variables:
342-
call json_value_add(inp, 't0', 0.1_wp)
343-
call json_value_add(inp, 'tf', 1.1_wp)
344-
call json_value_add(inp, 'x0', 9999.000_wp)
345-
call json_value_add(inp, 'integer_scalar', 1)
346-
call json_value_add(inp, 'integer_array', [2,4,99])
347-
call json_value_add(inp, 'names', ['aaa','bbb','ccc'])
348-
call json_value_add(inp, 'logical_scalar', .true.)
349-
call json_value_add(inp, 'logical_vector', [.true., .false., .true.])
342+
call json_add(inp, 't0', 0.1_wp)
343+
call json_add(inp, 'tf', 1.1_wp)
344+
call json_add(inp, 'x0', 9999.000_wp)
345+
call json_add(inp, 'integer_scalar', 1)
346+
call json_add(inp, 'integer_array', [2,4,99])
347+
call json_add(inp, 'names', ['aaa','bbb','ccc'])
348+
call json_add(inp, 'logical_scalar', .true.)
349+
call json_add(inp, 'logical_vector', [.true., .false., .true.])
350350
nullify(inp)
351351

352352
!trajectory variables:
@@ -395,16 +395,16 @@ subroutine add_variables_to_input(me, variable, units, frame, center, rdata)
395395
call json_create_object(var,'') !name does not matter
396396

397397
!variable info:
398-
call json_value_add(var, 'VARIABLE',trim(variable))
399-
call json_value_add(var, 'UNITS', trim(units))
400-
call json_value_add(var, 'FRAME', trim(frame))
401-
call json_value_add(var, 'CENTER', trim(center))
398+
call json_add(var, 'VARIABLE',trim(variable))
399+
call json_add(var, 'UNITS', trim(units))
400+
call json_add(var, 'FRAME', trim(frame))
401+
call json_add(var, 'CENTER', trim(center))
402402

403403
!trajectory [vector of reals]:
404-
call json_value_add(var, 'DATA', rdata)
404+
call json_add(var, 'DATA', rdata)
405405

406406
!add this variable to trajectory structure:
407-
call json_value_add(me, var)
407+
call json_add(me, var)
408408

409409
!cleanup:
410410
nullify(var)
@@ -710,4 +710,4 @@ end subroutine print_error_message
710710

711711
!*******************************************************************************************************
712712
end program json_test
713-
!*******************************************************************************************************
713+
!*******************************************************************************************************

0 commit comments

Comments
 (0)