Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | UnitNumber | ||||
character(len=*) | :: | Heading | ||||
character(len=*) | :: | KindofParameter | ||||
character(len=*) | :: | DataOut |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE ReadINIFile(UnitNumber,Heading,KindofParameter,DataOut)
! SUBROUTINE INFORMATION:
! AUTHOR Linda K. Lawrie
! DATE WRITTEN September 1997
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This routine reads the .ini file and retrieves
! the path names for the files from it.
! METHODOLOGY EMPLOYED:
! Duplicate the kind of reading the Windows "GetINISetting" would
! do.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataStringGlobals
USE DataSystemVariables
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER UnitNumber ! Unit number of the opened INI file
CHARACTER(len=*) Heading ! Heading for the parameters ('[heading]')
CHARACTER(len=*) KindofParameter ! Kind of parameter to be found (String)
CHARACTER(len=*) DataOut ! Output from the retrieval
! SUBROUTINE PARAMETER DEFINITIONS:
INTEGER, PARAMETER :: LineLength=PathLimit+10
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=LineLength) :: LINE=' '
CHARACTER(len=LineLength) :: LINEOut=' '
CHARACTER(len=20) Param
integer IHEAD,ILB,IRB,IEQ,IPAR,IPOS,ILEN
INTEGER ReadStat
LOGICAL EndofFile
LOGICAL Found
LOGICAL NewHeading
DataOut=' '
! I tried ADJUSTL(TRIM(KindofParameter)) and got an internal compiler error
Param=TRIM(KindofParameter)
Param=ADJUSTL(Param)
ILEN=LEN_TRIM(Param)
REWIND(UnitNumber)
EndofFile=.false.
Found=.false.
NewHeading=.false.
700 FORMAT(A)
DO WHILE (.not. EndofFile .and. .not. Found)
READ(UnitNumber,700,IOSTAT=ReadStat) LINE
IF (ReadStat < GoodIOStatValue) THEN
EndofFile=.true.
EXIT
ENDIF
IF (LEN_TRIM(LINE) == 0) CYCLE ! Ignore Blank Lines
CALL ConvertCasetoLower(LINE,LINEOut) ! Turn line into lower case
! LINE=LINEOut
IHEAD=INDEX(LINEOut,Heading)
IF (IHEAD .EQ. 0) CYCLE
! See if [ and ] are on line
ILB=INDEX(LINEOut,'[')
IRB=INDEX(LINEOut,']')
IF (ILB == 0 .AND. IRB == 0) CYCLE
IF (INDEX(LINEOut,'['//TRIM(Heading)//']') == 0) CYCLE ! Must be really correct heading line
ILB=0
IRB=0
! Heading line found, now looking for Kind
DO WHILE (.not. EndofFile .and. .not. NewHeading)
READ(UnitNumber,700,IOSTAT=ReadStat) LINE
IF (ReadStat < GoodIOStatValue) THEN
EndofFile=.true.
EXIT
ENDIF
LINE=ADJUSTL(LINE)
IF (LEN_TRIM(LINE) == 0) CYCLE ! Ignore Blank Lines
CALL ConvertCasetoLower(LINE,LINEOut) ! Turn line into lower case
! LINE=LINEOut
ILB=INDEX(LINEOut,'[')
IRB=INDEX(LINEOut,']')
NewHeading=(ILB /= 0 .and. IRB /= 0)
! Should be a parameter line
! KindofParameter = string
IEQ=INDEX(LINEOut,'=')
IPAR=INDEX(LINEOut,TRIM(Param))
IF (IEQ == 0) CYCLE
IF (IPAR == 0) CYCLE
IF (IPAR /= 1) CYCLE
IF (INDEX(LINEOut,TRIM(Param)//'=') == 0) CYCLE ! needs to be param=
! = found and parameter found.
IF (IPAR > IEQ) CYCLE
! parameter = found
! Set output string to start with non-blank character
DataOut=ADJUSTL(LINE(IEQ+1:))
Found=.true.
EXIT
END DO
END DO
SELECT CASE (Param)
CASE('dir')
IPOS=LEN_TRIM(DataOut)
IF (IPOS /= 0) THEN
! Non-blank make sure last position is valid path character
! (Set in DataStringGlobals)
IF (DataOut(IPOS:IPOS) /= PathChar) THEN
DataOut(IPOS+1:IPOS+1)=PathChar
ENDIF
ENDIF
CASE DEFAULT
END SELECT
RETURN
END SUBROUTINE ReadINIFile