Skip to content

Commit c12d324

Browse files
committed
integer to string routine no longer public.
other minor changes.
1 parent f4dc356 commit c12d324

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

src/json_example.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,16 @@ subroutine test_4()
200200
write(*,'(A)') ''
201201
write(*,'(A)') 'creating structure'
202202

203-
call json_value_create(p) ! create the value and associate the pointer
204-
call to_object(p,dir//filename4) !add the file name as the name of the overall structure:
203+
call json_value_create(p) !create the value and associate the pointer
204+
call to_object(p,dir//filename4) !add the file name as the name of the overall structure
205205

206206
!config structure:
207207
call json_value_create(inp) !an object
208208
call to_object(inp,'INPUTS')
209209
!add just integers:
210210
do i=1,100
211-
call integer_to_string(i,istr)
211+
write(istr,fmt='(I10)') i
212+
istr = adjustl(istr)
212213
call json_value_add(inp, 'x'//trim(istr),i)
213214
end do
214215
call json_value_add(p, inp)
@@ -421,7 +422,8 @@ subroutine test_3()
421422
!get vectors:
422423
do i=1,4
423424

424-
call integer_to_string(i,str)
425+
write(str,fmt='(I10)') i
426+
str = adjustl(str)
425427

426428
write(*,'(A)') ''
427429
call json%get('trajectory('//trim(str)//').VARIABLE', cval)

src/json_module.f90

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ end subroutine array_callback_func
270270
interface json_get
271271
module procedure :: json_get_by_path
272272
module procedure :: json_get_integer, json_get_integer_vec
273-
module procedure :: json_get_double, json_get_double_vec
273+
module procedure :: json_get_double, json_get_double_vec
274274
module procedure :: json_get_logical, json_get_logical_vec
275-
module procedure :: json_get_chars, json_get_char_vec
275+
module procedure :: json_get_chars, json_get_char_vec
276276
module procedure :: json_get_array
277277
end interface json_get
278278

@@ -308,18 +308,15 @@ end subroutine array_callback_func
308308
public :: to_object !
309309
public :: to_array !
310310

311-
public :: integer_to_string !basic integer to string routine
312-
313311
!exception handling [private variables]
314312
logical :: exception_thrown = .false. !the error flag
315313
character(len=:),allocatable :: err_message !the error message
316-
logical,parameter :: print_tracebacks = .false. !used when debugging
317314

318315
! POP/PUSH CHARACTER [private variables]
319316
integer :: char_count = 0
320317
integer :: line_count = 1
321318
integer :: pushed_index = 0
322-
character (len = 10) :: pushed_char !JW : what is this magic number 10??
319+
character(len=10) :: pushed_char !JW : what is this magic number 10??
323320

324321
contains
325322
!*****************************************************************************************
@@ -633,7 +630,6 @@ subroutine get_integer_vec_from_json_file(me, path, vec, found)
633630
integer,dimension(:),allocatable,intent(out) :: vec
634631
logical,intent(out),optional :: found
635632

636-
637633
call json_get(me%p, path, vec, found)
638634

639635
end subroutine get_integer_vec_from_json_file
@@ -910,17 +906,6 @@ subroutine throw_exception(msg)
910906
exception_thrown = .true.
911907
err_message = trim(msg)
912908

913-
!if (print_tracebacks) then
914-
!
915-
! !This is a feature of the Intel Fortran Compiler:
916-
! !Throw a traceback and return control to the user.
917-
! call tracebackqq(string=trim(msg), user_exit_code=-1)
918-
!
919-
! !write(*,'(A)') trim(msg) !gfortran version
920-
! !stop
921-
!
922-
!end if
923-
924909
end subroutine throw_exception
925910
!*****************************************************************************************
926911

0 commit comments

Comments
 (0)