PARAMS: Unify formatting of INQUIRE, READ, and WRITE statements.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2023-12-19 15:33:29 -03:00
parent b10e8d8db4
commit f31cb12545

View File

@ -123,7 +123,7 @@ module parameters
parameter_file = trim(arg)
else
if (verbose) &
write(error_unit,*) &
write (error_unit,*) &
"The option '--input' or '-i' requires an argument. Exiting..."
status = 112
return
@ -132,12 +132,12 @@ module parameters
end if
end do
inquire(file=parameter_file, exist=info)
inquire (file=parameter_file, exist=info)
if (info) then
call parse_parameters(status)
else
write(error_unit,*) "The parameter file '" // parameter_file // &
write (error_unit,*) "The parameter file '" // parameter_file // &
"' does not exist. Exiting..."
status = 111
end if
@ -228,20 +228,20 @@ module parameters
n = 0
j = 1024
inquire(file=parameter_file, size=j)
inquire (file=parameter_file, size=j)
allocate(character(len=j) :: line)
open (newunit=io, file=parameter_file, action='read', err=30)
10 read(io, fmt="(a)", end=20) line
10 read (io, fmt="(a)", end=20) line
n = n + 1
! remove comments
!
i = index(line, '#')
if (i > 0) write(line,"(a)") trim(adjustl(line(:i-1)))
if (i > 0) write (line,"(a)") trim(adjustl(line(:i-1)))
! skip empty lines
!
@ -278,7 +278,7 @@ module parameters
end if
if (status > 0) then
write(error_unit,"('[',a,']: ',a)") loc, &
write (error_unit,"('[',a,']: ',a)") loc, &
"Wrong parameter format in '" // parameter_file // "'."
write (error_unit,"('[',a,']: ',a,i0,':')") loc, "Verify line ", n
write (error_unit,"('[',a,']: ',a)") loc, trim(adjustl(line))
@ -298,7 +298,7 @@ module parameters
item_ptr => item_ptr%next
end do
if (exists) then
write(error_unit,"('[',a,']: ',a)") loc, "Parameter '" // key // &
write (error_unit,"('[',a,']: ',a)") loc, "Parameter '" // key // &
"' appears multiple times. " // &
"Only the value of the first occurrence is considered."
else
@ -317,7 +317,7 @@ module parameters
return
30 write(error_unit,"('[',a,']: ',a)") loc, &
30 write (error_unit,"('[',a,']: ',a)") loc, &
"Unable to open the parameter file '" // &
parameter_file // "'!"
@ -418,7 +418,7 @@ module parameters
item_ptr => parameter_list
do while(associated(item_ptr))
if (item_ptr%key == key) then
read(item_ptr%val, err=10, fmt=*) val
read (item_ptr%val, err=10, fmt=*) val
exit
end if
item_ptr => item_ptr%next
@ -426,7 +426,7 @@ module parameters
return
10 write(error_unit,"('[',a,']: ',a)") loc, &
10 write (error_unit,"('[',a,']: ',a)") loc, &
"Incorrect format for the integer parameter '" // key // &
"', or its value is either too small or too large!"
@ -468,7 +468,7 @@ module parameters
item_ptr => parameter_list
do while(associated(item_ptr))
if (item_ptr%key == key) then
read(item_ptr%val, err=10, fmt=*) val
read (item_ptr%val, err=10, fmt=*) val
exit
end if
item_ptr => item_ptr%next
@ -476,7 +476,7 @@ module parameters
return
10 write(error_unit,"('[',a,']: ',a)") loc, &
10 write (error_unit,"('[',a,']: ',a)") loc, &
"Incorrect format for the float parameter '" // key // &
"', or its value is either too small or too large!"
@ -585,7 +585,7 @@ module parameters
if (master) then
item_ptr => parameter_list
do while(associated(item_ptr))
write(str,"(a)") item_ptr%key // '|' // item_ptr%val
write (str,"(a)") item_ptr%key // '|' // item_ptr%val
call broadcast(str)