From 1d645d37b22f29a239302ab5796a83cdc33327de Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 30 Jul 2009 15:11:34 +0000 Subject: [PATCH] mld2p4: fixed error in data_input when "!" not present in input file. --- examples/pdegen/data_input.f90 | 4 ++++ tests/fileread/data_input.f90 | 4 ++++ tests/pdegen/data_input.f90 | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/examples/pdegen/data_input.f90 b/examples/pdegen/data_input.f90 index 19349aee..51a3339c 100644 --- a/examples/pdegen/data_input.f90 +++ b/examples/pdegen/data_input.f90 @@ -108,6 +108,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),'(a)') val end subroutine string_read_char @@ -126,6 +127,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_int subroutine string_read_single(val,file,marker) @@ -144,6 +146,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_single subroutine string_read_double(val,file,marker) @@ -162,6 +165,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_double diff --git a/tests/fileread/data_input.f90 b/tests/fileread/data_input.f90 index 19349aee..51a3339c 100644 --- a/tests/fileread/data_input.f90 +++ b/tests/fileread/data_input.f90 @@ -108,6 +108,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),'(a)') val end subroutine string_read_char @@ -126,6 +127,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_int subroutine string_read_single(val,file,marker) @@ -144,6 +146,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_single subroutine string_read_double(val,file,marker) @@ -162,6 +165,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_double diff --git a/tests/pdegen/data_input.f90 b/tests/pdegen/data_input.f90 index 19349aee..51a3339c 100644 --- a/tests/pdegen/data_input.f90 +++ b/tests/pdegen/data_input.f90 @@ -108,6 +108,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),'(a)') val end subroutine string_read_char @@ -126,6 +127,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_int subroutine string_read_single(val,file,marker) @@ -144,6 +146,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_single subroutine string_read_double(val,file,marker) @@ -162,6 +165,7 @@ contains read(file,'(a)')charbuf charbuf = adjustl(charbuf) idx=index(charbuf,marker_) + if (idx == 0) idx = len(charbuf)+1 read(charbuf(1:idx-1),*) val end subroutine string_read_double