|
51 | 51 |
|
52 | 52 | end procedure |
53 | 53 |
|
54 | | - module procedure get_json_string_scalar_value |
| 54 | + module procedure get_json_string_value |
55 | 55 |
|
56 | 56 | character(len=:), allocatable :: raw_line |
57 | 57 |
|
58 | | - call assert(key==self%get_json_key(), "key==self%get_string_scalar_json_value()", key) |
| 58 | + call assert(key==self%get_json_key(), "key==self%get_string_json_value()", key) |
59 | 59 |
|
60 | 60 | raw_line = self%string() |
61 | 61 | associate(text_after_colon => raw_line(index(raw_line, ':')+1:)) |
|
72 | 72 |
|
73 | 73 | end procedure |
74 | 74 |
|
75 | | - module procedure get_json_logical_scalar_value |
| 75 | + module procedure get_json_logical_value |
76 | 76 | character(len=:), allocatable :: raw_line, string_value |
77 | 77 |
|
78 | | - call assert(key==self%get_json_key(), "string_s(get_json_logical_scalar_value): key==self%get_json_key()", key) |
| 78 | + call assert(key==self%get_json_key(), "string_s(get_json_logical_value): key==self%get_json_key()", key) |
79 | 79 |
|
80 | 80 | raw_line = self%string() |
81 | 81 | associate(text_after_colon => raw_line(index(raw_line, ':')+1:)) |
82 | | - associate(comma => index(text_after_colon, ',')) |
83 | | - if (comma == 0) then |
| 82 | + associate(trailing_comma => index(text_after_colon, ',')) |
| 83 | + if (trailing_comma == 0) then |
84 | 84 | string_value = trim(adjustl((text_after_colon))) |
85 | 85 | else |
86 | | - string_value = trim(adjustl((text_after_colon(:comma-1)))) |
| 86 | + string_value = trim(adjustl((text_after_colon(:trailing_comma-1)))) |
87 | 87 | end if |
88 | 88 | call assert(string_value=="true" .or. string_value=="false", & |
89 | | - 'string_s(get_json_logical_scalar_value): string_value=="true" .or. string_value="false"', string_value) |
| 89 | + 'string_s(get_json_logical_value): string_value=="true" .or. string_value="false"', string_value) |
90 | 90 | value_ = string_value == "true" |
91 | 91 | end associate |
92 | 92 | end associate |
93 | 93 |
|
94 | 94 | end procedure |
95 | 95 |
|
| 96 | + module procedure get_json_integer_value |
| 97 | + character(len=:), allocatable :: raw_line, string_value |
| 98 | + |
| 99 | + call assert(key==self%get_json_key(), "string_s(get_json_logical_value): key==self%get_json_key()", key) |
| 100 | + |
| 101 | + raw_line = self%string() |
| 102 | + associate(text_after_colon => raw_line(index(raw_line, ':')+1:)) |
| 103 | + associate(trailing_comma => index(text_after_colon, ',')) |
| 104 | + if (trailing_comma == 0) then |
| 105 | + string_value = trim(adjustl((text_after_colon))) |
| 106 | + else |
| 107 | + string_value = trim(adjustl((text_after_colon(:trailing_comma-1)))) |
| 108 | + end if |
| 109 | + read(string_value, fmt=*) value_ |
| 110 | + end associate |
| 111 | + end associate |
| 112 | + |
| 113 | + end procedure |
| 114 | + |
96 | 115 | module procedure get_json_integer_array_value |
97 | 116 | character(len=:), allocatable :: raw_line |
98 | 117 | real, allocatable :: real_array(:) |
|
108 | 127 | associate(num_inputs => commas + 1) |
109 | 128 | allocate(real_array(num_inputs)) |
110 | 129 | read(raw_line(opening_bracket+1:closing_bracket-1), fmt=*) real_array |
111 | | - value_ = real_array |
| 130 | + value_ = int(real_array) |
112 | 131 | end associate |
113 | 132 | end associate |
114 | 133 | end associate |
|
0 commit comments