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
105 module procedure kim_log_pop_default_verbosity
114 module procedure kim_log_push_default_print_function
123 module procedure kim_log_pop_default_print_function
130 module procedure kim_log_convert_c_string
139 module procedure kim_log_get_id
148 module procedure kim_log_set_id
157 module procedure kim_log_push_verbosity
166 module procedure kim_log_pop_verbosity
175 module procedure kim_log_log_entry
182 logical recursive function kim_log_handle_equal(lhs, 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)
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)
260 recursive subroutine push_default_verbosity(log_verbosity) &
261 bind(c, name="KIM_Log_PushDefaultVerbosity")
262 use,
intrinsic :: iso_c_binding
266 end subroutine push_default_verbosity
268 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
270 call push_default_verbosity(log_verbosity)
271 end subroutine kim_log_push_default_verbosity
278 recursive subroutine kim_log_pop_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()
289 end subroutine kim_log_pop_default_verbosity
334 recursive subroutine kim_log_push_default_print_function(language_name, fptr)
338 recursive subroutine push_default_print_function(language_name, fptr) &
339 bind(c, name="KIM_Log_PushDefaultPrintFunction")
340 use,
intrinsic :: iso_c_binding
344 type(c_funptr),
intent(in),
value :: fptr
345 end subroutine push_default_print_function
347 type(kim_language_name_type),
intent(in) :: language_name
348 type(c_funptr),
intent(in),
value :: fptr
350 call push_default_print_function(language_name, fptr)
351 end subroutine kim_log_push_default_print_function
358 recursive subroutine kim_log_pop_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()
369 end subroutine kim_log_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
394 recursive subroutine kim_log_get_id(log_handle, id_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
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)
415 end subroutine kim_log_get_id
422 recursive subroutine kim_log_set_id(log_handle, 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(*)
432 end subroutine set_id
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)
440 end subroutine kim_log_set_id
447 recursive subroutine kim_log_push_verbosity(log_handle, log_verbosity)
449 use kim_interoperable_types_module,
only: kim_log_type
452 recursive subroutine push_verbosity(log, log_verbosity) &
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
460 end subroutine push_verbosity
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)
467 call push_verbosity(log, log_verbosity)
468 end subroutine kim_log_push_verbosity
475 recursive subroutine kim_log_pop_verbosity(log_handle)
476 use kim_interoperable_types_module,
only: kim_log_type
479 recursive subroutine pop_verbosity(log) &
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
485 end subroutine pop_verbosity
488 type(kim_log_type),
pointer :: log
490 call c_f_pointer(log_handle%p, log)
491 call pop_verbosity(log)
492 end subroutine kim_log_pop_verbosity
499 recursive subroutine kim_log_log_entry(log_handle, log_verbosity, message)
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
512 character(c_char),
intent(in) :: message(*)
513 integer(c_int),
intent(in),
value :: line_number
514 character(c_char),
intent(in) :: file_name(*)
515 end subroutine log_entry
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, &
525 end subroutine kim_log_log_entry
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.
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, 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.