Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | inString |
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.
FUNCTION ConvertToElementTag(inString) RESULT (outString)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer
! DATE WRITTEN February 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Convert report column or row header into a tag string
! that just has A-Z, a-z, or 0-1 characters and is
! shown in camelCase.
! METHODOLOGY EMPLOYED:
! na
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=*), INTENT(IN) :: inString ! Input String
CHARACTER(len=LEN(inString)) :: outString ! Result String
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: iIn !index through the string
INTEGER :: jOut !index of the output string
INTEGER :: curCharVal !ascii value of current character
LOGICAL :: foundOther !flag if character found besides A-Z, a-z, 0-9
outString = " "
jOut = 0
foundOther = .TRUE.
DO iIn = 1,LEN_TRIM(inString)
curCharVal = ICHAR(inString(iIn:iIn))
SELECT CASE (curCharVal)
CASE (65:90) !A-Z upper case
jOut = jOut + 1
IF (foundOther) THEN
outString(jOut:jOut) = CHAR(curCharVal) !keep as upper case after finding a space or another character
ELSE
outString(jOut:jOut) = CHAR(curCharVal + 32) !convert to lower case
ENDIF
foundOther = .FALSE.
CASE (97:122) !A-Z lower case
jOut = jOut + 1
IF (foundOther) THEN
outString(jOut:jOut) = CHAR(curCharVal - 32) !convert to upper case
ELSE
outString(jOut:jOut) = CHAR(curCharVal) !leave as lower case
ENDIF
foundOther = .FALSE.
CASE (48:57) !0-9 numbers
jOut = jOut + 1
! if first character is a number then prepend with the letter "t"
IF (jOut .EQ. 1) THEN
outString(1:1) = 't'
jOut = 2
END IF
outString(jOut:jOut) = CHAR(curCharVal)
foundOther = .FALSE.
CASE (91) ! [ bracket
EXIT !stop parsing because unit string was found
CASE DEFAULT
foundOther = .TRUE.
END SELECT
END DO
END FUNCTION ConvertToElementTag