15
15
%fragment("SWIG_fin"{char*}, "fsubprograms", fragment="SwigArrayWrapper_f", noblock=1) {
16
16
subroutine %fortrantm(fin, char*)(finp, iminp, temp)
17
17
use, intrinsic :: ISO_C_BINDING
18
- character(kind=C_CHAR, len=*), intent(in) :: finp
18
+ character(len=*), intent(in) :: finp
19
19
type(SwigArrayWrapper), intent(out) :: iminp
20
20
character(kind=C_CHAR), dimension(:), target, allocatable, intent(out) :: temp
21
21
integer :: i
22
22
23
23
allocate(character(kind=C_CHAR) :: temp(len(finp) + 1))
24
24
do i=1,len(finp)
25
- temp(i) = finp(i:i)
25
+ temp(i) = char(ichar( finp(i:i)), kind=C_CHAR )
26
26
end do
27
27
i = len(finp) + 1
28
28
temp(i) = C_NULL_CHAR ! C finp compatibility
@@ -36,13 +36,13 @@ end subroutine
36
36
subroutine %fortrantm(fout, char*)(imout, fout)
37
37
use, intrinsic :: ISO_C_BINDING
38
38
type(SwigArrayWrapper), intent(in) :: imout
39
- character(kind=C_CHAR, len=:), allocatable, intent(out) :: fout
39
+ character(len=:), allocatable, intent(out) :: fout
40
40
character(kind=C_CHAR), dimension(:), pointer :: chars
41
41
integer(kind=C_SIZE_T) :: i
42
42
call c_f_pointer(imout%data, chars, [imout%size])
43
43
allocate(character(kind=C_CHAR, len=imout%size) :: fout)
44
44
do i=1, imout%size
45
- fout(i:i) = chars(i)
45
+ fout(i:i) = char(ichar( chars(i)) )
46
46
end do
47
47
end subroutine
48
48
}
@@ -69,8 +69,8 @@ end subroutine
69
69
}
70
70
71
71
// Fortran proxy code: return allocatable string
72
- %typemap(ftype, in="character(kind=C_CHAR, len=*), target") char *
73
- "character(kind=C_CHAR, len=:), allocatable"
72
+ %typemap(ftype, in="character(len=*), target") char *
73
+ "character(len=:), allocatable"
74
74
75
75
%typemap(fin, fragment="SWIG_fin"{char*}, noblock=1,
76
76
temp="character(kind=C_CHAR), dimension(:), allocatable, target"
@@ -107,8 +107,8 @@ end subroutine
107
107
$2 = $input->size;
108
108
}
109
109
110
- %typemap(ftype, in="character(kind=C_CHAR, len=*), target") (char *STRING, size_t LENGTH)
111
- "character(kind=C_CHAR, len=:), allocatable"
110
+ %typemap(ftype, in="character(len=*), target") (char *STRING, size_t LENGTH)
111
+ "character(len=:), allocatable"
112
112
113
113
%typemap(fin, fragment="SWIG_fin"{char*}, noblock=1,
114
114
temp="character(kind=C_CHAR), dimension(:), allocatable, target")
0 commit comments