Append one string element from a multiline JSON string array.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
Current JSON line inside a multiline string array |
||
| character(len=*), | intent(in) | :: | active_array |
Array currently being accumulated: input or output |
||
| character(len=128), | intent(inout) | :: | inputs(:) |
Mutable node input/output buffers |
||
| integer, | intent(inout) | :: | num_inputs |
Counts of valid input/output entries |
||
| character(len=128), | intent(inout) | :: | outputs(:) |
Mutable node input/output buffers |
||
| integer, | intent(inout) | :: | num_outputs |
Counts of valid input/output entries |
subroutine append_json_string_array_item(line, active_array, inputs, & num_inputs, outputs, num_outputs) !! Append one string element from a multiline JSON string array. implicit none ! Arguments character(*), intent(in) :: line !! Current JSON line inside a multiline string array character(*), intent(in) :: active_array !! Array currently being accumulated: input or output character(128), intent(inout) :: inputs(:), outputs(:) !! Mutable node input/output buffers integer, intent(inout) :: num_inputs, num_outputs !! Counts of valid input/output entries ! Local variables integer :: pos1, pos2 !! Quote positions used to slice the current string token character(128) :: value !! Current array element value if(index(line, '"') .eq. 0) return pos1 = index(line, '"') if(pos1 .le. 0) return pos2 = index(line(pos1+1:), '"') if(pos2 .le. 0) return value = line(pos1+1:pos1+pos2-1) select case(trim(active_array)) case('input') num_inputs = num_inputs + 1 inputs(num_inputs) = trim(value) case('output') num_outputs = num_outputs + 1 outputs(num_outputs) = trim(value) end select end subroutine append_json_string_array_item