23 use,
intrinsic :: iso_fortran_env
47 character(len=*),
intent(in) :: filename
53 character(len=*),
intent(in) :: name
54 type(c_ptr),
intent(inout) :: var
60 type(c_ptr),
intent(in) :: var
61 type(c_ptr),
intent(out) :: name
62 type(c_ptr),
intent(out) :: type
63 type(c_ptr),
intent(out) :: default
64 type(c_ptr),
intent(out) :: section
65 type(c_ptr),
intent(out) :: desc
71 type(c_ptr),
intent(in) :: var
72 type(c_ptr),
intent(inout) :: opt
77 use,
intrinsic :: iso_fortran_env
79 type(c_ptr),
intent(in) :: opt
80 type(c_ptr),
intent(out) :: name
81 integer(int64),
intent(out) :: val
82 type(c_ptr),
intent(out) :: desc
88 character(len=*),
intent(in) :: name
89 type(c_ptr),
intent(inout) :: var
95 type(c_ptr),
intent(in) :: var
96 character(len=*),
intent(in) :: name
97 integer,
intent(out) :: val
98 integer,
intent(out) :: ierr
111 integer,
intent(in) :: iunit
112 character(len=*),
intent(in) :: var
113 integer,
optional,
intent(out):: ierr
115 type(c_ptr) :: handle, opt, name,
type, default, section, desc
116 integer(int64) :: val
120 if (.not. c_associated(handle))
then
121 if (
present(ierr))
then
125 write(iunit,
'(3a)')
'ERROR: Could not find a variable named ', trim(var),
'.'
130 if (
present(ierr)) ierr = 0
137 write(iunit,
'(a)')
"Description:"
144 if (.not. c_associated(opt))
then
148 write(iunit,
'(a)')
"Available options:"
162 character(len=*),
intent(in) :: var
163 integer(int64),
intent(in) :: option
164 logical,
optional,
intent(in) :: is_flag
166 type(c_ptr) :: handle, opt, name, desc
167 integer(int64) :: val, option_
171 if (
present(is_flag)) is_flag_ = is_flag
177 if (.not. c_associated(handle))
then
178 write(0,
'(3a)')
'ERROR: Could not find a variable named ', trim(var),
'.'
185 if (.not. c_associated(opt))
exit
189 option_ = iand(option_, not(val))
191 if (val == option_)
then
199 if (is_flag_ .and. (option_ == 0)) l = .
true.
206 character(len=*),
intent(in) :: var
207 integer,
intent(in) :: option
208 logical,
optional,
intent(in) :: is_flag
216 integer,
intent(in) :: iunit
217 character(len=*),
intent(in) :: var
218 integer,
intent(in) :: option
219 character(len=*),
intent(in),
optional :: pre
221 type(c_ptr) :: handle, opt, name, desc
222 integer(int64) :: val
223 logical :: option_found
226 if (.not. c_associated(handle))
then
227 write(iunit,
'(3a)')
'ERROR: Could not find a variable named ', trim(var),
'.'
231 option_found = .false.
235 if (.not. c_associated(opt))
exit
239 if (val == int(option, int64))
then
240 option_found = .
true.
245 write(iunit,
'(4a)', advance=
'no')
"Input:",
' [', var,
' = '
247 if (option_found)
then
250 write(iunit,
'(i6,a)', advance=
'no') option,
" (INVALID)"
252 write(iunit,
'(a)', advance=
'no')
']'
253 if (
present(pre))
then
254 write(iunit,
'(3a)')
' (', trim(pre),
')'
261 if (.not. option_found)
then
263 write(iunit,
'(a,i6,2a)')
"ERROR: invalid option ", option,
" for variable ", trim(var)
271 integer,
intent(in) :: iunit
272 character(len=*),
intent(in) :: var
273 integer,
optional,
intent(out):: ierr
275 type(c_ptr) :: handle, name,
type, default, section, desc
278 if (
present(ierr)) ierr = -1
282 if (c_associated(handle))
then
283 if (
present(ierr)) ierr = 0
297 character(len=*),
intent(in) :: var
298 character(len=*),
intent(in) :: option
300 type(c_ptr) :: handle
308 write(0,
'(4a)')
"ERROR: invalid option ", trim(option),
" for variable ", trim(var)
317 character(len=*),
intent(in) :: var
319 type(c_ptr) :: handle
325 exists = c_associated(handle)
subroutine, public print_c_string(iunit, str, pre, advance)
prints the C string given by the pointer str
subroutine, public varinfo_print_option(iunit, var, option, pre)
logical function varinfo_valid_option_8(var, option, is_flag)
subroutine, public varinfo_print(iunit, var, ierr)
logical function varinfo_valid_option_4(var, option, is_flag)
subroutine, public varinfo_search(iunit, var, ierr)
logical function, public varinfo_exists(var)
integer function, public varinfo_option(var, option)