Commit abd33ced authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

added fabm_get_version and use it from pyfabm

parent 3e8fbe1a
......@@ -37,6 +37,7 @@ if not dllpath:
# Load FABM library.
fabm = ctypes.CDLL(dllpath)
fabm.initialize_library()
# Initialization
fabm.initialize.argtypes = [ctypes.c_char_p]
......
......@@ -57,15 +57,19 @@
subroutine get_version(length,version_string) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_version
use fabm_version, only: fabm_commit_id=>git_commit_id, &
fabm_branch_name=>git_branch_name
integer(c_int),value,intent(in) :: length
character(kind=c_char) :: version_string(length)
call copy_to_c_string(fabm_commit_id//' ('//fabm_branch_name//' branch)', version_string)
character(len=length-1) :: string
call fabm_get_version(string)
call copy_to_c_string(string, version_string)
end subroutine get_version
subroutine initialize_library() bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: initialize_library
call fabm_initialize_library()
end subroutine initialize_library
!-----------------------------------------------------------------------
!BOP
......
......@@ -36,7 +36,7 @@
private
!
! !PUBLIC MEMBER FUNCTIONS:
public fabm_initialize_library, type_model, fabm_create_model_from_file
public fabm_initialize_library, type_model, fabm_create_model_from_file, fabm_get_version
public fabm_initialize, fabm_finalize, fabm_set_domain, fabm_check_ready, fabm_update_time
public fabm_initialize_state, fabm_initialize_surface_state, fabm_initialize_bottom_state
......@@ -500,6 +500,21 @@
call factory%initialize()
end subroutine fabm_initialize_library
subroutine fabm_get_version(string)
use fabm_version
character(len=*), intent(out) :: string
type (type_version),pointer :: version
string = git_commit_id//' ('//git_branch_name//' branch)'
version => first_module_version
do while (associated(version))
string = trim(string)//', '//trim(version%module_name)//': '//trim(version%version_string)
version => version%next
end do
end subroutine fabm_get_version
!-----------------------------------------------------------------------
!BOP
!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment