|
182 | 182 | end procedure
|
183 | 183 |
|
184 | 184 | module procedure get_json_integer_array
|
185 |
| - character(len=:), allocatable :: raw_line |
186 |
| - real, allocatable :: real_array(:) |
187 |
| - integer i |
188 |
| - |
189 |
| - call assert(key==self%get_json_key(), "string_s(get_json_integer_array): key==self%get_json_key()", key) |
190 |
| - |
191 |
| - raw_line = self%string() |
192 |
| - associate(colon => index(raw_line, ":")) |
193 |
| - associate(opening_bracket => colon + index(raw_line(colon+1:), "[")) |
194 |
| - associate(closing_bracket => opening_bracket + index(raw_line(opening_bracket+1:), "]")) |
195 |
| - associate(commas => count("," == [(raw_line(i:i), i=opening_bracket+1,closing_bracket-1)])) |
196 |
| - associate(num_inputs => commas + 1) |
197 |
| - allocate(real_array(num_inputs)) |
198 |
| - read(raw_line(opening_bracket+1:closing_bracket-1), fmt=*) real_array |
199 |
| - value_ = int(real_array) |
200 |
| - end associate |
201 |
| - end associate |
202 |
| - end associate |
203 |
| - end associate |
204 |
| - end associate |
205 |
| - |
| 185 | + value_ = int(self%get_json_real_array(key,mold=[0.])) |
206 | 186 | end procedure
|
207 | 187 |
|
208 | 188 | module procedure get_json_real_array
|
209 | 189 | character(len=:), allocatable :: raw_line
|
210 | 190 | real, allocatable :: real_array(:)
|
211 | 191 | integer i
|
212 | 192 |
|
213 |
| - call assert(key==self%get_json_key(), "string_s(get_json_real_array): key==self%get_json_key()", key) |
| 193 | + call assert(key==self%get_json_key(), "string_s(get_json_{real,integer}_array): key==self%get_json_key()", key) |
214 | 194 |
|
215 | 195 | raw_line = self%string()
|
216 | 196 | associate(colon => index(raw_line, ":"))
|
|
0 commit comments