36 use,
intrinsic :: iso_c_binding
66 type,
bind(c) :: kim_log_handle_type
67 type(c_ptr) :: p = c_null_ptr
79 interface operator(.eq.)
80 module procedure kim_log_handle_equal
81 end interface operator(.eq.)
86 interface operator(.ne.)
87 module procedure kim_log_handle_not_equal
88 end interface operator(.ne.)
96 module procedure kim_log_push_default_verbosity
114 module procedure kim_log_push_default_print_function
130 module procedure kim_log_convert_c_string
182 logical recursive function kim_log_handle_equal(lhs, rhs)
184 type(kim_log_handle_type),
intent(in) :: lhs
185 type(kim_log_handle_type),
intent(in) :: rhs
187 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p)))
then
188 kim_log_handle_equal = .true.
190 kim_log_handle_equal = c_associated(lhs%p, rhs%p)
192 end function kim_log_handle_equal
197 logical recursive function kim_log_handle_not_equal(lhs, rhs)
199 type(kim_log_handle_type),
intent(in) :: lhs
200 type(kim_log_handle_type),
intent(in) :: rhs
202 kim_log_handle_not_equal = .not. (lhs == rhs)
203 end function kim_log_handle_not_equal
213 integer(c_int) recursive function create(log) &
214 bind(c, name="KIM_Log_Create")
215 use,
intrinsic :: iso_c_binding
217 type(c_ptr),
intent(out) :: log
221 integer(c_int),
intent(out) :: ierr
237 recursive subroutine destroy(log)
bind(c, name="KIM_Log_Destroy")
238 use,
intrinsic :: iso_c_binding
240 type(c_ptr),
intent(inout) :: log
241 end subroutine destroy
248 log_handle%p = c_null_ptr
256 recursive subroutine kim_log_push_default_verbosity(log_verbosity)
261 bind(c, name="KIM_Log_PushDefaultVerbosity")
262 use,
intrinsic :: iso_c_binding
265 type(kim_log_verbosity_type),
intent(in),
value :: log_verbosity
268 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
271 end subroutine kim_log_push_default_verbosity
281 recursive subroutine pop_default_verbosity() &
282 bind(c, name="KIM_Log_PopDefaultVerbosity")
283 use,
intrinsic :: iso_c_binding
285 end subroutine pop_default_verbosity
288 call pop_default_verbosity()
334 recursive subroutine kim_log_push_default_print_function(language_name, fptr)
339 bind(c, name="KIM_Log_PushDefaultPrintFunction")
340 use,
intrinsic :: iso_c_binding
343 type(kim_language_name_type),
intent(in),
value :: language_name
344 type(c_funptr),
intent(in),
value :: fptr
347 type(kim_language_name_type),
intent(in) :: language_name
348 type(c_funptr),
intent(in),
value :: fptr
351 end subroutine kim_log_push_default_print_function
361 recursive subroutine pop_default_print_function() &
362 bind(c, name="KIM_Log_PopDefaultPrintFunction")
363 use,
intrinsic :: iso_c_binding
365 end subroutine pop_default_print_function
368 call pop_default_print_function()
380 recursive subroutine kim_log_convert_c_string(c_char_ptr, string)
381 use kim_convert_string_module,
only: kim_convert_c_char_ptr_to_string
383 type(c_ptr),
intent(in),
value :: c_char_ptr
384 character(len=*, kind=c_char),
intent(out) :: string
386 call kim_convert_c_char_ptr_to_string(c_char_ptr, string)
387 end subroutine kim_log_convert_c_string
395 use kim_convert_string_module,
only: kim_convert_c_char_ptr_to_string
396 use kim_interoperable_types_module,
only: kim_log_type
399 type(c_ptr)
recursive function get_id(log)
bind(c, name="KIM_Log_GetID")
400 use,
intrinsic :: iso_c_binding
401 use kim_interoperable_types_module,
only: kim_log_type
403 type(kim_log_type),
intent(in) :: log
406 type(kim_log_handle_type),
intent(in) :: log_handle
407 character(len=*, kind=c_char),
intent(out) :: id_string
408 type(kim_log_type),
pointer :: log
412 call c_f_pointer(log_handle%p, log)
414 call kim_convert_c_char_ptr_to_string(p, id_string)
423 use kim_interoperable_types_module,
only: kim_log_type
426 recursive subroutine set_id(log, id_string)
bind(c, name="KIM_Log_SetID")
427 use,
intrinsic :: iso_c_binding
428 use kim_interoperable_types_module,
only: kim_log_type
430 type(kim_log_type),
intent(in) :: log
431 character(c_char),
intent(in) :: id_string(*)
434 type(kim_log_handle_type),
intent(in) :: log_handle
435 character(len=*, kind=c_char),
intent(in) :: id_string
436 type(kim_log_type),
pointer :: log
438 call c_f_pointer(log_handle%p, log)
439 call set_id(log, trim(id_string)//c_null_char)
449 use kim_interoperable_types_module,
only: kim_log_type
453 bind(c, name="KIM_Log_PushVerbosity")
454 use,
intrinsic :: iso_c_binding
456 use kim_interoperable_types_module,
only: kim_log_type
458 type(kim_log_type),
intent(in) :: log
459 type(kim_log_verbosity_type),
intent(in),
value :: log_verbosity
462 type(kim_log_handle_type),
intent(in) :: log_handle
463 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
464 type(kim_log_type),
pointer :: log
466 call c_f_pointer(log_handle%p, log)
476 use kim_interoperable_types_module,
only: kim_log_type
480 bind(c, name="KIM_Log_PopVerbosity")
481 use,
intrinsic :: iso_c_binding
482 use kim_interoperable_types_module,
only: kim_log_type
484 type(kim_log_type),
intent(in) :: log
487 type(kim_log_handle_type),
intent(in) :: log_handle
488 type(kim_log_type),
pointer :: log
490 call c_f_pointer(log_handle%p, log)
501 use kim_interoperable_types_module,
only: kim_log_type
504 recursive subroutine log_entry(log, log_verbosity, message, line_number, &
505 file_name)
bind(c, name="KIM_Log_LogEntry")
506 use,
intrinsic :: iso_c_binding
508 use kim_interoperable_types_module,
only: kim_log_type
510 type(kim_log_type),
intent(in) :: log
511 type(kim_log_verbosity_type),
intent(in),
value :: log_verbosity
512 character(c_char),
intent(in) :: message(*)
513 integer(c_int),
intent(in),
value :: line_number
514 character(c_char),
intent(in) :: file_name(*)
517 type(kim_log_handle_type),
intent(in) :: log_handle
518 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
519 character(len=*, kind=c_char),
intent(in) :: message
520 type(kim_log_type),
pointer :: log
522 call c_f_pointer(log_handle%p, log)
523 call log_entry(log, log_verbosity, trim(message)//c_null_char, &
Convert a c sting to a Fortran string.
Get the identity of the Log object.
Write a log entry into the log file.
Pop a log PrintFunction from the KIM API global default log PrintFunction stack.
Pop a LogVerbosity from the KIM API global default verbosity stack.
Pop a LogVerbosity from the Log object's verbosity stack.
Push a new default log PrintFunction onto the KIM API global default log PrintFunction stack.
Push a new default LogVerbosity onto the KIM API global default verbosity stack.
Push a new LogVerbosity onto the Log object's verbosity stack.
Set the identity of the Log object.
An Extensible Enumeration for the LanguageName's supported by the KIM API.
Provides the logging interface for the KIM API.
recursive subroutine kim_log_pop_default_verbosity()
Pop a LogVerbosity from the KIM API global default verbosity stack.
recursive subroutine kim_log_log_entry(log_handle, log_verbosity, message)
Write a log entry into the log file.
recursive subroutine kim_log_pop_default_print_function()
Pop a log PrintFunction from the KIM API global default log PrintFunction stack.
recursive subroutine kim_log_pop_verbosity(log_handle)
Pop a LogVerbosity from the Log object's verbosity stack.
recursive subroutine kim_log_set_id(log_handle, id_string)
Set the identity of the Log object.
type(kim_log_handle_type), save, public, protected kim_log_null_handle
NULL handle for use in comparisons.
recursive subroutine, public kim_log_destroy(log_handle)
Destroy a previously Log::Create'd object.
recursive subroutine kim_log_push_verbosity(log_handle, log_verbosity)
Push a new LogVerbosity onto the Log object's verbosity stack.
recursive subroutine kim_log_get_id(log_handle, id_string)
Get the identity of the Log object.
recursive subroutine, public kim_log_create(log_handle, ierr)
Create a new KIM API Log object.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
An Extensible Enumeration for the LanguageName's supported by the KIM API.
Provides the logging interface for the KIM API.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.