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 ConvertToEscaped(inString) RESULT (outString)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer
! DATE WRITTEN February 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Convert to XML safe escaped character string
! so it excludes:
! " ' < > &
! 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
outString = " "
jOut = 0
DO iIn = 1,LEN_TRIM(inString)
curCharVal = ICHAR(inString(iIn:iIn))
SELECT CASE (curCharVal)
CASE (34) ! "
jOut = jOut + 6
outString(jOut-5:jOut) = '"'
CASE (38) ! &
jOut = jOut + 5
outString(jOut-4:jOut) = '&'
CASE (39) ! '
jOut = jOut + 6
outString(jOut-6:jOut) = '''
CASE (60) ! <
jOut = jOut + 4
outString(jOut-3:jOut) = '<'
CASE (62) ! >
jOut = jOut + 4
outString(jOut-3:jOut) = '>'
CASE (176) ! degree
jOut = jOut + 1
outString(jOut:jOut) = '*' !replace degree symbol with asterisk to avoid errors from various XML editors
CASE DEFAULT !most characters are fine
jOut = jOut + 1
outString(jOut:jOut) = CHAR(curCharVal)
END SELECT
END DO
END FUNCTION ConvertToEscaped