| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(CFG_var_t), | intent(inout) | :: | var |
subroutine read_variable(var) type(CFG_var_t), intent(inout) :: var integer :: n, n_entries integer :: ix_start(CFG_max_array_size) integer :: ix_end(CFG_max_array_size) ! Get the start and end positions of the line content, and the number of entries call get_fields_string(var%stored_data, CFG_separators, CFG_max_array_size,& n_entries, ix_start, ix_end) if (var%var_size /= n_entries) then if (.not. var%dynamic_size) then call handle_error("read_variable: variable [" // & & trim(var%var_name) // "] has the wrong size") else var%var_size = n_entries call resize_storage(var) end if end if do n = 1, n_entries select case (var%var_type) case (CFG_integer_type) read(var%stored_data(ix_start(n):ix_end(n)), *) var%int_data(n) case (CFG_real_type) read(var%stored_data(ix_start(n):ix_end(n)), *) var%real_data(n) case (CFG_string_type) var%char_data(n) = trim(var%stored_data(ix_start(n):ix_end(n))) case (CFG_logic_type) read(var%stored_data(ix_start(n):ix_end(n)), *) var%logic_data(n) end select end do end subroutine read_variable