rendered most of the functions to be "pure"

This commit is contained in:
Eralp Demir 2009-01-16 15:25:37 +00:00
parent 9d14dbde2b
commit 1529d6115d
1 changed files with 33 additions and 31 deletions

View File

@ -249,14 +249,15 @@
! return array containing number of parts found and ! return array containing number of parts found and
! their left/right positions to be used by IO_xxxVal ! their left/right positions to be used by IO_xxxVal
!******************************************************************** !********************************************************************
FUNCTION IO_stringPos (line,N) PURE FUNCTION IO_stringPos (line,N)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
character(len=*), parameter :: sep=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces character(len=*), parameter :: sep=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
integer(pInt) N, part integer(pInt), intent(in) :: N
integer(pInt) part
integer(pInt) IO_stringPos(1+N*2) integer(pInt) IO_stringPos(1+N*2)
IO_stringPos = -1 IO_stringPos = -1
@ -276,13 +277,13 @@
!******************************************************************** !********************************************************************
! read string value at pos from line ! read string value at pos from line
!******************************************************************** !********************************************************************
FUNCTION IO_stringValue (line,positions,pos) PURE FUNCTION IO_stringValue (line,positions,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
integer(pInt) positions(*),pos integer(pInt), intent(in) :: positions(*),pos
character(len=1+positions(pos*2+1)-positions(pos*2)) IO_stringValue character(len=1+positions(pos*2+1)-positions(pos*2)) IO_stringValue
if (positions(1) < pos) then if (positions(1) < pos) then
@ -298,13 +299,13 @@
!******************************************************************** !********************************************************************
! read string value at pos from fixed format line ! read string value at pos from fixed format line
!******************************************************************** !********************************************************************
FUNCTION IO_fixedStringValue (line,ends,pos) PURE FUNCTION IO_fixedStringValue (line,ends,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
integer(pInt) ends(*),pos integer(pInt), intent(in) :: ends(*),pos
character(len=ends(pos+1)-ends(pos)) IO_fixedStringValue character(len=ends(pos+1)-ends(pos)) IO_fixedStringValue
IO_fixedStringValue = line(ends(pos)+1:ends(pos+1)) IO_fixedStringValue = line(ends(pos)+1:ends(pos+1))
@ -316,14 +317,14 @@
!******************************************************************** !********************************************************************
! read float value at pos from line ! read float value at pos from line
!******************************************************************** !********************************************************************
FUNCTION IO_floatValue (line,positions,pos) PURE FUNCTION IO_floatValue (line,positions,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
real(pReal) IO_floatValue integer(pInt), intent(in) :: positions(*),pos
integer(pInt) positions(*),pos real(pReal) IO_floatValue
if (positions(1) >= pos) then if (positions(1) >= pos) then
read(UNIT=line(positions(pos*2):positions(pos*2+1)),ERR=100,FMT=*) IO_floatValue read(UNIT=line(positions(pos*2):positions(pos*2+1)),ERR=100,FMT=*) IO_floatValue
@ -338,14 +339,14 @@
!******************************************************************** !********************************************************************
! read float value at pos from fixed format line ! read float value at pos from fixed format line
!******************************************************************** !********************************************************************
FUNCTION IO_fixedFloatValue (line,ends,pos) PURE FUNCTION IO_fixedFloatValue (line,ends,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
real(pReal) IO_fixedFloatValue integer(pInt), intent(in) :: ends(*),pos
integer(pInt) ends(*),pos real(pReal) IO_fixedFloatValue
read(UNIT=line(ends(pos-1)+1:ends(pos)),ERR=100,FMT=*) IO_fixedFloatValue read(UNIT=line(ends(pos-1)+1:ends(pos)),ERR=100,FMT=*) IO_fixedFloatValue
return return
@ -358,14 +359,15 @@
!******************************************************************** !********************************************************************
! read float x.y+z value at pos from format line line ! read float x.y+z value at pos from format line line
!******************************************************************** !********************************************************************
FUNCTION IO_fixedNoEFloatValue (line,ends,pos) PURE FUNCTION IO_fixedNoEFloatValue (line,ends,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
real(pReal) IO_fixedNoEFloatValue,base integer(pInt), intent(in) :: ends(*),pos
integer(pInt) ends(*),pos,pos_exp,expon integer(pInt) pos_exp,expon
real(pReal) IO_fixedNoEFloatValue,base
pos_exp = scan(line(ends(pos)+1:ends(pos+1)),'+-',back=.true.) pos_exp = scan(line(ends(pos)+1:ends(pos+1)),'+-',back=.true.)
if (pos_exp > 1) then if (pos_exp > 1) then
@ -386,14 +388,14 @@
!******************************************************************** !********************************************************************
! read int value at pos from line ! read int value at pos from line
!******************************************************************** !********************************************************************
FUNCTION IO_intValue (line,positions,pos) PURE FUNCTION IO_intValue (line,positions,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
integer(pInt) IO_intValue integer(pInt), intent(in) :: positions(*),pos
integer(pInt) positions(*),pos integer(pInt) IO_intValue
if (positions(1) >= pos) then if (positions(1) >= pos) then
read(UNIT=line(positions(pos*2):positions(pos*2+1)),ERR=100,FMT=*) IO_intValue read(UNIT=line(positions(pos*2):positions(pos*2+1)),ERR=100,FMT=*) IO_intValue
@ -408,14 +410,14 @@
!******************************************************************** !********************************************************************
! read int value at pos from fixed format line ! read int value at pos from fixed format line
!******************************************************************** !********************************************************************
FUNCTION IO_fixedIntValue (line,ends,pos) PURE FUNCTION IO_fixedIntValue (line,ends,pos)
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
character(len=*) line character(len=*), intent(in) :: line
integer(pInt) IO_fixedIntValue integer(pInt), intent(in) :: ends(*),pos
integer(pInt) ends(*),pos integer(pInt) IO_fixedIntValue
read(UNIT=line(ends(pos)+1:ends(pos+1)),ERR=100,FMT=*) IO_fixedIntValue read(UNIT=line(ends(pos)+1:ends(pos+1)),ERR=100,FMT=*) IO_fixedIntValue
return return
@ -428,12 +430,12 @@
!******************************************************************** !********************************************************************
! change character in line to lower case ! change character in line to lower case
!******************************************************************** !********************************************************************
FUNCTION IO_lc (line) PURE FUNCTION IO_lc (line)
use prec, only: pInt use prec, only: pInt
implicit none implicit none
character (len=*) line character (len=*), intent(in) :: line
character (len=len(line)) IO_lc character (len=len(line)) IO_lc
integer(pInt) i integer(pInt) i