mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-14 09:59:06 +00:00
Make.inc.in Makefile cbind cbind/Makefile cbind/base cbind/base/Makefile cbind/base/psb_base_cbind.h cbind/base/psb_base_cbind_mod.f90 cbind/base/psb_base_psblas_cbind_mod.f90 cbind/base/psb_base_string_cbind_mod.f90 cbind/base/psb_base_tools_cbind_mod.F90 cbind/base/psb_c_base.c cbind/base/psb_c_base.h cbind/base/psb_c_dbase.c cbind/base/psb_c_dbase.h cbind/base/psb_cpenv_mod.f90 cbind/base/psb_d_psblas_cbind_mod.f90 cbind/base/psb_d_serial_cbind_mod.F90 cbind/base/psb_d_tools_cbind_mod.F90 cbind/base/psb_objhandle_mod.f90 Branch for C bindings.
39 lines
827 B
Fortran
39 lines
827 B
Fortran
module psb_base_string_cbind_mod
|
|
use iso_c_binding
|
|
|
|
contains
|
|
|
|
subroutine stringc2f(cstring,fstring)
|
|
character(c_char) :: cstring(*)
|
|
character(len=*) :: fstring
|
|
integer :: i
|
|
|
|
i = 1
|
|
do
|
|
if (cstring(i) == c_null_char) exit
|
|
if (i > len(fstring)) exit
|
|
fstring(i:i) = cstring(i)
|
|
i = i + 1
|
|
end do
|
|
do
|
|
if (i > len(fstring)) exit
|
|
fstring(i:i) = " "
|
|
i = i + 1
|
|
end do
|
|
return
|
|
end subroutine stringc2f
|
|
|
|
subroutine stringf2c(fstring,cstring)
|
|
character(c_char) :: cstring(*)
|
|
character(len=*) :: fstring
|
|
integer :: i
|
|
|
|
do i=1, len(fstring)
|
|
cstring(i) = fstring(i:i)
|
|
end do
|
|
cstring(len(fstring)+1) = c_null_char
|
|
return
|
|
end subroutine stringf2c
|
|
|
|
end module psb_base_string_cbind_mod
|