Statistics
| Revision:

root / src / Warning.f90 @ 5

History | View | Annotate | Download (1.6 kB)

1
! This routine prints a warning message and goes on
2
! Inspired  from Die in Siesta 3.1 
3
    SUBROUTINE Warning(routine, msg, file, line, unit)
4

    
5
      Use VarTypes
6
      Use io_module
7

    
8
      implicit none
9

    
10

    
11
  INTERFACE
12
     function valid(string) result (isValid)
13
       CHARACTER(*), intent(in) :: string
14
       logical                  :: isValid
15
     END function VALID
16

    
17
  END INTERFACE
18
!--------------------------------------------------------------- Input Variables
19
      character(len=*), intent(in)           :: routine, msg
20
      character(len=*), intent(in), optional :: file
21
      integer(KINT), intent(in), optional      :: line, unit
22

    
23
!--------------------------------------------------------------- Local Variables
24
      integer(KINT)                            :: warning_unit
25

    
26
      LOGICAL ::  Debug
27

    
28
!------------------------------------------------------------------------- BEGIN
29
      debug=valid('warning')
30

    
31
      if (debug) Call Header('Entering Warning')
32
      if (PRESENT(unit)) then
33
        warning_unit = unit
34
      else
35
        warning_unit = IOOUT
36
      endif
37

    
38
      write(warning_unit,'(a)') '*************************************************************'
39
      write(warning_unit,'(a)') '* WARNING *'
40
      write(warning_unit,'(a)') ' '
41
      write(warning_unit,'(3a)') TRIM(routine), ': ', TRIM(msg)
42
      write(warning_unit,'(a)') ' '
43
      if (PRESENT(file)) write(warning_unit,'(5x,2a)') 'File: ', file
44
      if (PRESENT(line)) write(warning_unit,'(5x,a,i5)') 'Line: ', line
45
      write(warning_unit,'(a)') '*************************************************************'
46

    
47
      if (debug) Call Header('Exiting Warning')
48

    
49
    END SUBROUTINE warning
50