Skip to content

Commit

Permalink
Move answers to reading from answers.tsv (5)
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Sep 25, 2024
1 parent ae73893 commit d47518e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions fortran/src/include/utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,12 @@ function get_answer(id) result(answer)
answer%int_value = i
end if
case ("str")
read(length, *, iostat=ios) i
if (ios /= 0) then
print *, "Invalid integer literal for string length. Returning error type"
allocate(character(len=len(val)), answer%string_value)
if (.not. allocated(answer%string_value)) then
print *, "Memory allocation failed for string_value. Returning error type"
else
allocate(character(len=i), answer%string_value)
if (.not. allocated(answer%string_value)) then
print *, "Memory allocation failed for string_value. Returning error type"
else
answer%type = stringt
answer%string_value = val
end if
answer%type = stringt
answer%string_value = val
end if
case default
print *, "Invalid value type. Returning error type"
Expand Down

0 comments on commit d47518e

Please sign in to comment.