@@ -99,9 +99,9 @@ module json_module
99
99
character (len=* ),parameter ,public :: json_ext = ' .json' ! JSON file extension
100
100
101
101
character (len= 1 ),parameter :: space = ' '
102
- character (len= 1 ),parameter :: newline = char (10 ) ! new line character
102
+ character (len= 1 ),parameter :: newline = ACHAR (10 ) ! new line character
103
103
character (len=* ),parameter :: real_fmt = ' (E30.16E3)' ! format for real numbers
104
- character (len=* ),parameter :: int_fmt = ' (I10)' ! format for integers
104
+ character (len=* ),parameter :: int_fmt = ' (I10)' ! format for integers
105
105
106
106
logical ,parameter :: debug = .false. ! for printing the debug messages
107
107
@@ -1442,19 +1442,19 @@ subroutine escape_string(str_in, str_out)
1442
1442
1443
1443
select case (c)
1444
1444
1445
- case (' "' ,' \ ' ,' /' ,CHAR (8 ),CHAR (12 ),CHAR (10 ),CHAR (13 ),CHAR (9 )) ! special characters
1445
+ case (' "' ,ACHAR ( 92 ) ,' /' ,ACHAR (8 ),ACHAR (12 ),ACHAR (10 ),ACHAR (13 ),ACHAR (9 )) ! special characters
1446
1446
select case (c)
1447
- case (' "' ,' \ ' ,' /' )
1448
- str_out = str_out// ' \ ' // c ! add escape char
1449
- case (CHAR (8 ))
1447
+ case (' "' ,ACHAR ( 92 ) ,' /' )
1448
+ str_out = str_out// ACHAR ( 92 ) // c ! add escape char
1449
+ case (ACHAR (8 ))
1450
1450
str_out = str_out// ' \b' ! backspace
1451
- case (CHAR (12 ))
1451
+ case (ACHAR (12 ))
1452
1452
str_out = str_out// ' \f' ! formfeed
1453
- case (CHAR (10 ))
1453
+ case (ACHAR (10 ))
1454
1454
str_out = str_out// ' \n' ! new line
1455
- case (CHAR (13 ))
1455
+ case (ACHAR (13 ))
1456
1456
str_out = str_out// ' \r' ! carriage return
1457
- case (CHAR (9 ))
1457
+ case (ACHAR (9 ))
1458
1458
str_out = str_out// ' \t' ! horizontal tab
1459
1459
end select
1460
1460
case default
@@ -2631,7 +2631,7 @@ subroutine json_get_chars(this, path, value, found)
2631
2631
do
2632
2632
2633
2633
jprev = j ! initialize
2634
- j = index (s(j:n),' \ ' ) ! look for an escape character
2634
+ j = index (s(j:n),ACHAR ( 92 ) ) ! look for an escape character
2635
2635
2636
2636
if (j> 0 ) then ! an escape character was found
2637
2637
@@ -2650,7 +2650,7 @@ subroutine json_get_chars(this, path, value, found)
2650
2650
c = s( j+1 : j+1 )
2651
2651
2652
2652
select case (c)
2653
- case (' "' ,' \ ' ,' /' ,' b' ,' f' ,' n' ,' r' ,' t' )
2653
+ case (' "' ,ACHAR ( 92 ) ,' /' ,' b' ,' f' ,' n' ,' r' ,' t' )
2654
2654
2655
2655
! save the bit after the escape characters:
2656
2656
if (j+2 < n) then
@@ -2660,18 +2660,18 @@ subroutine json_get_chars(this, path, value, found)
2660
2660
end if
2661
2661
2662
2662
select case (c)
2663
- case (' "' ,' \ ' ,' /' )
2663
+ case (' "' ,ACHAR ( 92 ) ,' /' )
2664
2664
! use c as is
2665
2665
case (' b' )
2666
- c = CHAR (8 ) ! backspace
2666
+ c = ACHAR (8 ) ! backspace
2667
2667
case (' f' )
2668
- c = CHAR (12 ) ! formfeed
2668
+ c = ACHAR (12 ) ! formfeed
2669
2669
case (' n' )
2670
- c = CHAR (10 ) ! new line
2670
+ c = ACHAR (10 ) ! new line
2671
2671
case (' r' )
2672
- c = CHAR (13 ) ! carriage return
2672
+ c = ACHAR (13 ) ! carriage return
2673
2673
case (' t' )
2674
- c = CHAR (9 ) ! horizontal tab
2674
+ c = ACHAR (9 ) ! horizontal tab
2675
2675
end select
2676
2676
2677
2677
s = pre// c// post
@@ -2694,7 +2694,7 @@ subroutine json_get_chars(this, path, value, found)
2694
2694
case default
2695
2695
! unknown escape character
2696
2696
call throw_exception(' Error in json_get_chars: unknown escape sequence in string "' // &
2697
- trim (s)// ' " [\ ' // c// ' ]' )
2697
+ trim (s)// ' " [' // ACHAR ( 92 ) // c// ' ]' )
2698
2698
exit
2699
2699
end select
2700
2700
@@ -3626,7 +3626,7 @@ subroutine parse_string(unit, string)
3626
3626
call throw_exception(' Error in parse_string: Expecting end of string' )
3627
3627
return
3628
3628
3629
- else if (' "' == c .and. last /= ' \ ' ) then
3629
+ else if (' "' == c .and. last /= ACHAR ( 92 ) ) then
3630
3630
3631
3631
if (is_hex) call throw_exception(' Error in parse_string: incomplete hex string: \u' // trim (hex))
3632
3632
exit
@@ -3660,7 +3660,7 @@ subroutine parse_string(unit, string)
3660
3660
escape = .false.
3661
3661
is_hex = (c==' u' ) ! the next four characters are the hex string
3662
3662
else
3663
- escape = (c==' \ ' )
3663
+ escape = (c== ACHAR ( 92 ) )
3664
3664
end if
3665
3665
3666
3666
end if
0 commit comments