kim-api 2.3.0+AppleClang.AppleClang.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kim_log_module::kim_push_default_print_function Interface Reference

Push a new default log PrintFunction onto the KIM API global default log PrintFunction stack. More...

Public Member Functions

recursive subroutine kim_log_push_default_print_function (language_name, fptr)
 Push a new default log PrintFunction onto the KIM API global default log PrintFunction stack.
 

Detailed Description

Push a new default log PrintFunction onto the KIM API global default log PrintFunction stack.

See also
KIM::Log::PushDefaultPrintFunction, KIM_Log_PushDefaultPrintFunction
Since
2.2

Definition at line 113 of file kim_log_module.f90.

Member Function/Subroutine Documentation

◆ kim_log_push_default_print_function()

recursive subroutine kim_log_module::kim_push_default_print_function::kim_log_push_default_print_function ( type(kim_language_name_type), intent(in)  language_name,
type(c_funptr), intent(in), value  fptr 
)

Push a new default log PrintFunction onto the KIM API global default log PrintFunction stack.

A Fortran routine may provide a KIM::Log::PrintFunction routine. The interface for this is given here (see also KIM::LogPrintFunction, KIM_LogPrintFunction).

interface
recursive subroutine log_print_function(entry_string, ierr) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), intent(in), value :: entry_string
integer(c_int), intent(out) :: ierr
end subroutine log_print_function
end interface

The routine must take a c_ptr pointing to a null terminated c string representing the log message. To work with this, the kim_log_module provides a conversion routine: kim_log_module::kim_convert_c_string.

An example log print function, which simply writes log messages to stdout, is given here:

recursive subroutine log_print_function(entry_string, ierr) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), intent(in), value :: entry_string
integer(c_int), intent(out) :: ierr
character(len=2048, kind=c_char) :: message
call kim_convert_c_string(entry_string, message)
print *, trim(message)
ierr = 0
return
end subroutine log_print_function
Convert a c sting to a Fortran string.
Provides the logging interface for the KIM API.
See also
KIM::Log::PushDefaultPrintFunction, KIM_Log_PushDefaultPrintFunction
Since
2.2

Definition at line 334 of file kim_log_module.f90.


The documentation for this interface was generated from the following file: