@@ -264,12 +264,12 @@ end subroutine traverse_callback_func
264
264
module procedure MAYBEWRAP(json_value_add_logical_vec)
265
265
module procedure MAYBEWRAP(json_value_add_string)
266
266
module procedure MAYBEWRAP(json_value_add_string_vec)
267
- # ifdef USE_UCS4
267
+ #ifdef USE_UCS4
268
268
module procedure json_value_add_string_name_ascii
269
269
module procedure json_value_add_string_val_ascii
270
270
module procedure json_value_add_string_vec_name_ascii
271
271
module procedure json_value_add_string_vec_val_ascii
272
- # endif
272
+ #endif
273
273
end interface json_add
274
274
! *************************************************************************************
275
275
@@ -289,10 +289,10 @@ end subroutine traverse_callback_func
289
289
MAYBEWRAP(json_update_double),&
290
290
MAYBEWRAP(json_update_integer),&
291
291
MAYBEWRAP(json_update_string)
292
- # ifdef USE_UCS4
292
+ #ifdef USE_UCS4
293
293
module procedure json_update_string_name_ascii
294
294
module procedure json_update_string_val_ascii
295
- # endif
295
+ #endif
296
296
end interface json_update
297
297
! *************************************************************************************
298
298
@@ -784,11 +784,14 @@ subroutine json_initialize(verbose,compact_reals,print_signs,real_format)
784
784
! clear any errors from previous runs:
785
785
call json_clear_exceptions()
786
786
787
- ! JW note: do we need this?.....
787
+ !
788
+ ! JW comment out for now (these are now protected variables in another module)
789
+ ! for thread-save version, we won't be able to have global variables.........
790
+ !
788
791
! Ensure gfortran bug work around "parameters" are set properly
789
- null_str = ' null'
790
- true_str = ' true'
791
- false_str = ' false'
792
+ ! null_str = 'null'
793
+ ! true_str = 'true'
794
+ ! false_str = 'false'
792
795
793
796
! Just in case, clear these global variables also:
794
797
pushed_index = 0
@@ -797,11 +800,11 @@ subroutine json_initialize(verbose,compact_reals,print_signs,real_format)
797
800
line_count = 1
798
801
ipos = 1
799
802
800
- # ifdef USE_UCS4
803
+ #ifdef USE_UCS4
801
804
! reopen stdout and stderr with utf-8 encoding
802
805
open (output_unit,encoding= ' utf-8' )
803
806
open (error_unit, encoding= ' utf-8' )
804
- # endif
807
+ #endif
805
808
806
809
! verbose error printing:
807
810
if (present (verbose)) is_verbose = verbose
@@ -1055,7 +1058,8 @@ recursive subroutine json_value_destroy(me,destroy_next)
1055
1058
implicit none
1056
1059
1057
1060
type (json_value),pointer :: me
1058
- logical (LK),intent (in ),optional :: destroy_next ! ! if true, then me%next is also destroyed (default is true)
1061
+ logical (LK),intent (in ),optional :: destroy_next ! ! if true, then me%next
1062
+ ! ! is also destroyed (default is true)
1059
1063
1060
1064
logical (LK) :: des_next
1061
1065
type (json_value), pointer :: p
@@ -1819,7 +1823,7 @@ subroutine json_value_add_logical_vec(me, name, val)
1819
1823
logical (LK),dimension (:),intent (in ) :: val ! ! value
1820
1824
1821
1825
type (json_value),pointer :: var
1822
- integer (IK) :: i ! counter
1826
+ integer (IK) :: i ! ! counter
1823
1827
1824
1828
! create the variable as an array:
1825
1829
call json_value_create(var)
@@ -2727,13 +2731,9 @@ subroutine json_get_by_path(me, path, p, found)
2727
2731
type (json_value),pointer ,intent (out ) :: p
2728
2732
logical (LK),intent (out ),optional :: found ! ! true if it was found
2729
2733
2730
- character (kind= CK,len= 1 ),parameter :: start_array_alt = ' ('
2731
- character (kind= CK,len= 1 ),parameter :: end_array_alt = ' )'
2732
- character (kind= CK,len= 1 ),parameter :: root = ' $'
2733
- character (kind= CK,len= 1 ),parameter :: this = ' @'
2734
- character (kind= CK,len= 1 ),parameter :: child = ' .'
2735
-
2736
- integer (IK) :: i,length,child_i
2734
+ integer (IK) :: i
2735
+ integer (IK) :: length
2736
+ integer (IK) :: child_i
2737
2737
character (kind= CK,len= 1 ) :: c
2738
2738
logical (LK) :: array
2739
2739
type (json_value),pointer :: tmp
@@ -4358,10 +4358,7 @@ subroutine get_current_line_from_file_sequential(iunit,line)
4358
4358
integer (IK),intent (in ) :: iunit ! ! file unit number
4359
4359
character (kind= CK,len= :),allocatable ,intent (out ) :: line ! ! current line
4360
4360
4361
- integer (IK),parameter :: n_chunk = 256 ! chunk size [arbitrary]
4362
- character (kind= CDK,len=* ),parameter :: nfmt = ' (A256)' ! corresponding format statement
4363
-
4364
- character (kind= CK,len= n_chunk) :: chunk
4361
+ character (kind= CK,len= seq_chunk_size) :: chunk
4365
4362
integer (IK) :: istat,isize
4366
4363
4367
4364
! initialize:
@@ -4374,12 +4371,12 @@ subroutine get_current_line_from_file_sequential(iunit,line)
4374
4371
! [the line is read in chunks until the end of the line is reached]
4375
4372
if (istat== 0 ) then
4376
4373
do
4377
- isize= 0
4378
- read (iunit,fmt= nfmt ,advance= ' NO' ,size= isize,iostat= istat) chunk
4374
+ isize = 0
4375
+ read (iunit,fmt= ' (A) ' ,advance= ' NO' ,size= isize,iostat= istat) chunk
4379
4376
if (istat== 0 ) then
4380
4377
line = line// chunk
4381
4378
else
4382
- if (isize> 0 .and. isize<= n_chunk ) line = line// chunk(1 :isize)
4379
+ if (isize> 0 .and. isize<= seq_chunk_size ) line = line// chunk(1 :isize)
4383
4380
exit
4384
4381
end if
4385
4382
end do
@@ -4405,8 +4402,6 @@ subroutine get_current_line_from_file_stream(iunit,line)
4405
4402
integer (IK) :: istart,iend,ios
4406
4403
character (kind= CK,len= 1 ) :: c
4407
4404
4408
- ! updated for the new STREAM version:
4409
-
4410
4405
istart = ipos
4411
4406
do
4412
4407
if (istart<= 1 ) then
@@ -4446,8 +4441,8 @@ recursive subroutine parse_value(unit, str, value)
4446
4441
4447
4442
logical (LK) :: eof
4448
4443
character (kind= CK,len= 1 ) :: c
4449
- character (kind= CK,len= :),allocatable :: tmp ! this is a work-around for a bug
4450
- ! in the gfortran 4.9 compiler.
4444
+ character (kind= CK,len= :),allocatable :: tmp ! ! this is a work-around for a bug
4445
+ ! ! in the gfortran 4.9 compiler.
4451
4446
4452
4447
if (.not. exception_thrown) then
4453
4448
0 commit comments