File: has_xml.f90

package info (click to toggle)
espresso 6.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,068 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,503; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (36 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
!
! Copyright (C) 2010 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
LOGICAL FUNCTION has_xml(inp_string)
!
! This function returns true if the last four characters of inp_string are
! .xml or .XML. On output the string .xml or .XML is removed from inp_string
!
IMPLICIT NONE

CHARACTER(LEN=*), INTENT(INOUT) :: inp_string

INTEGER :: leng, start 
CHARACTER(LEN=4) :: aux
LOGICAL, EXTERNAL :: matches

has_xml=.FALSE.
leng=LEN_TRIM(inp_string)

!cannot match xml if it is only 1 or 2 chars long
IF(leng<3) RETURN

start=MAX(leng-3,1)
aux=inp_string(start:leng)

IF (matches(aux,'.xml').OR.matches(aux,'.XML')) THEN
   has_xml=.TRUE.
   inp_string(leng-3:leng)=' '
ENDIF

RETURN
END FUNCTION has_xml