Octopus
loct.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch, M. Oliveira
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
21module loct_oct_m
22
23 implicit none
24
26 private
27 public :: &
28 loct_clock, &
37 loct_mkdir, &
38 loct_stat, &
39 loct_rm, &
50
51 ! ---------------------------------------------------------
53
54 interface loct_strerror
55 subroutine oct_strerror(errno, res)
56 implicit none
57 integer, intent(in) :: errno
58 character(len=*), intent(out) :: res
59 end subroutine oct_strerror
60 end interface loct_strerror
61
62 interface loct_clock
63 function oct_clock()
64 use, intrinsic :: iso_fortran_env
65 implicit none
66 real(real64) :: oct_clock
67 end function oct_clock
68 end interface loct_clock
69
70 interface loct_gettimeofday
71 subroutine oct_gettimeofday(sec, usec)
72 implicit none
73 integer, intent(out) :: sec, usec
74 end subroutine oct_gettimeofday
75 end interface loct_gettimeofday
76
77 interface loct_nanosleep
78 subroutine oct_nanosleep(sec, nsec)
79 implicit none
80 integer, intent(in) :: sec
81 integer, intent(in) :: nsec
82 end subroutine oct_nanosleep
83 end interface loct_nanosleep
84
85 interface loct_sysname
86 subroutine oct_sysname(name)
87 implicit none
88 character(len=*), intent(out) :: name
89 end subroutine oct_sysname
90 end interface loct_sysname
91
92 interface loct_getcwd
93 subroutine oct_getcwd(name)
94 implicit none
95 character(len=*), intent(out) :: name
96 end subroutine oct_getcwd
97 end interface loct_getcwd
98
99 interface loct_realpath
100 subroutine oct_realpath(fnam, rnam)
101 character(len=*), intent(in) :: fnam
102 character(len=*), intent(out) :: rnam
103 end subroutine oct_realpath
104 end interface
105
106 interface loct_dirname
107 subroutine oct_dirname(fnam, dnam)
108 character(len=*), intent(in) :: fnam
109 character(len=*), intent(out) :: dnam
110 end subroutine oct_dirname
111 end interface
112
113 interface loct_basename
114 subroutine oct_basename(fnam, dnam)
115 character(len=*), intent(in) :: fnam
116 character(len=*), intent(out) :: dnam
117 end subroutine oct_basename
118 end interface
119
120
121 ! ---------------------------------------------------------
123 interface loct_mkdir
124 subroutine oct_mkdir(name)
125 implicit none
126 character(len=*), intent(in) :: name
127 end subroutine oct_mkdir
128 end interface loct_mkdir
129
130 interface loct_stat
131 subroutine oct_stat(ierr, name, mod_time)
132 implicit none
133 integer, intent(out) :: ierr
134 character(len=*), intent(in) :: name
135 character(len=*), intent(out) :: mod_time
136 end subroutine oct_stat
137 end interface loct_stat
138
139 interface loct_rm
140 subroutine oct_rm(name)
141 implicit none
142 character(len=*), intent(in) :: name
143 end subroutine oct_rm
144 end interface loct_rm
145
146 interface loct_number_of_lines
147 integer function oct_number_of_lines(filename)
148 implicit none
149 character(len=*), intent(in) :: filename
150 end function oct_number_of_lines
151 end interface loct_number_of_lines
152
153 interface loct_break_c_string
154 subroutine oct_break_c_string(str, s, line)
155 use iso_c_binding
156 implicit none
157 type(c_ptr), intent(in) :: str
158 type(c_ptr), intent(inout) :: s
159 character(len=*), intent(out) :: line
160 end subroutine oct_break_c_string
161 end interface loct_break_c_string
162
164 subroutine oct_search_file_lr(freq, tag, ierr, dirname)
165 use, intrinsic :: iso_fortran_env
166 implicit none
167 real(real64), intent(inout) :: freq
168 integer, intent(in) :: tag
169 integer, intent(out) :: ierr
170 character(len=*), intent(in) :: dirname
171 end subroutine oct_search_file_lr
172 end interface loct_search_file_lr
173
174 ! ---------------------------------------------------------
176 interface loct_getenv
177 subroutine oct_getenv(var, val)
178 implicit none
179 character(len=*), intent(in) :: var
180 character(len=*), intent(out) :: val
181 end subroutine oct_getenv
182 end interface loct_getenv
183
184 interface loct_progress_bar
185 subroutine oct_progress_bar(a, maxcount)
186 implicit none
187 integer, intent(in) :: a, maxcount
188 end subroutine oct_progress_bar
189 end interface loct_progress_bar
190
191 interface loct_printrecipe
192 subroutine oct_printrecipe(dir, filename)
193 implicit none
194 character(len=*), intent(in) :: dir
195 character(len=*), intent(out) :: filename
196 end subroutine oct_printrecipe
197 end interface loct_printrecipe
198
200 subroutine oct_exit_failure()
201 implicit none
202 end subroutine oct_exit_failure
203 end interface loct_exit_failure
204
205 interface loct_wfs_list
206 subroutine oct_wfs_list(str, l)
207 implicit none
208 character(len=*), intent(in) :: str
209 integer, intent(out) :: l
210 end subroutine oct_wfs_list
211 end interface loct_wfs_list
212
213 interface loct_get_memory_usage
214 integer(c_intptr_t) function oct_get_memory_usage()
215 use iso_c_binding, only: c_intptr_t
216 implicit none
217 end function oct_get_memory_usage
218 end interface loct_get_memory_usage
219
220contains
221
222 logical function loct_isinstringlist(a, s) result(inlist)
223 integer, intent(in) :: a
224 character(len=*), intent(in) :: s
225
226 integer, allocatable :: list(:)
227
228 allocate(list(2**14))
229
230 call loct_wfs_list(s, list(1))
231 inlist = .false.
232 if (list(a) == 1) inlist = .true.
234 deallocate(list)
235
236 end function loct_isinstringlist
237
238
239 logical function loct_dir_exists(dirname) result(exists)
240 character(len=*), intent(in) :: dirname
241
242 interface oct_dir_exists
243 integer function oct_dir_exists(dirname)
244 implicit none
245 character(len=*), intent(in) :: dirname
246 end function oct_dir_exists
247 end interface oct_dir_exists
248
249 exists = oct_dir_exists(dirname) /= 0
250
251 end function loct_dir_exists
252
253end module loct_oct_m
254
255!! Local Variables:
256!! mode: f90
257!! coding: utf-8
258!! End:
File-handling.
Definition: loct.F90:216
Define which routines can be seen from the outside.
Definition: loct.F90:147
logical function, public loct_isinstringlist(a, s)
Definition: loct.F90:316
logical function, public loct_dir_exists(dirname)
Definition: loct.F90:333
int true(void)