3 !BUG: STRSIZE should be as large as the longest string length used in WPS
4 integer, parameter :: STRSIZE = 1024
8 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11 ! Purpose: Returns a string containing the path to the file specified by s.
12 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
18 character (len=*) :: s
21 character (len=STRSIZE) :: get_path
29 write(6,*) 'ERROR: Maximum string length exceeded in get_path()'
33 write(get_path,'(a)') './'
36 if (s(i:i) == '/') then
37 write(get_path,'(a)') s(1:i)
45 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
48 ! Purpose: Remove all space and tab characters from a string, thus compressing
49 ! the string to the left.
50 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51 subroutine despace(string)
56 character (len=*), intent(inout) :: string
59 integer :: i, j, length, iquoted
66 ! Check for a quote mark
67 if (string(i:i) == '"' .or. string(i:i) == '''') iquoted = mod(iquoted+1,2)
69 ! Check for non-space, non-tab character, or if we are inside quoted text
70 if ((string(i:i) /= ' ' .and. string(i:i) /= achar(9)) .or. iquoted == 1) then
71 string(j:j) = string(i:i)
80 end subroutine despace
83 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
86 ! Purpose: The non-space characters in s are shifted so that they end at
87 ! position n. The argument s is modified, so if the original string
88 ! must be preserved, a copy should be passed to right_justify.
89 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
90 subroutine right_justify(s,n)
95 integer, intent(in) :: n
96 character (len=*), intent(inout) :: s
106 s(i+n-l:i+n-l) = s(i:i)
113 end subroutine right_justify
115 end module stringutil