-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.f90
77 lines (54 loc) · 1.78 KB
/
functions.f90
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Module functions
implicit none
PUBLIC :: nextBlank, notBlank
Contains
Function nextBlank(line,offset)
implicit none
! ========================================================================
integer :: nextBlank
character(*),intent(in) :: line
integer,intent(in) :: offset
integer :: i
nextBlank=offset
do i=offset,len_trim(line)
if (line(i:i) == ' ') then
nextBlank=i
return
endif
! End of line
if (i == len_trim(line)) then
nextBlank=i+1
endif
enddo
End Function nextBlank
Function notBlank(line,offset)
implicit none
! ========================================================================
integer :: notBlank
character(*),intent(in) :: line
integer,intent(in) :: offset
integer :: i
do i=offset,len_trim(line)
if (line(i:i) /= ' ') then
notBlank=i
return
endif
enddo
End Function notBlank
Function check_end(line,start) Result(end_char)
character(len=120),intent(in) :: line
character(len=120) :: input
integer,intent(in),optional :: start
integer :: end_char
input=ADJUSTL(line)
IF(present(start)) input=ADJUSTL(line(start:120))
end_char=INDEX(input,' ')
IF((end_char.eq.0).OR.(end_char.gt.INDEX(input,';')).AND.(INDEX(input,';').gt.0)) end_char=INDEX(input,';')
RETURN
END Function check_end
Function uppercase(input) result(output)
character(len=1) :: input
integer :: output
output=ichar(input)-ichar('a')+ichar('A')
END Function uppercase
END Module functions