1
+ #:include "common.fypp"
1
2
!> The `stdlib_str2num` module provides procedures and interfaces for conversion
2
3
!> of characters to numerical types. Currently supported: int32, real32 and real64
3
4
!>
@@ -61,7 +62,9 @@ module stdlib_str2num
61
62
end interface
62
63
63
64
interface to_num_base
64
- module procedure to_int_32
65
+ #:for k1, t1 in INT_KINDS_TYPES
66
+ module procedure to_${k1}$
67
+ #:endfor
65
68
module procedure to_real_sp
66
69
module procedure to_real_dp
67
70
#:if WITH_QP
@@ -193,11 +196,12 @@ module stdlib_str2num
193
196
! String To Number Implementations
194
197
!---------------------------------------------
195
198
196
- elemental subroutine to_int_32(s,v,p,stat)
199
+ #:for k1, t1 in INT_KINDS_TYPES
200
+ elemental subroutine to_${k1}$(s,v,p,stat)
197
201
!> Return an unsigned 32-bit integer
198
202
! -- In/out Variables
199
203
character(*), intent(in) :: s !> input string
200
- integer(int32) , intent(inout ) :: v !> Output real value
204
+ ${t1}$ , intent(out ) :: v !> Output real value
201
205
integer(int8), intent(out) :: p !> position within the number
202
206
integer(int8), intent(out) :: stat !> status upon succes or failure to read
203
207
! -- Internal Variables
@@ -219,6 +223,7 @@ module stdlib_str2num
219
223
end do
220
224
stat = 0
221
225
end subroutine
226
+ #:endfor
222
227
223
228
elemental subroutine to_real_sp(s,v,p,stat)
224
229
integer, parameter :: wp = sp
@@ -520,7 +525,7 @@ module stdlib_str2num
520
525
elemental function mvs2nwsp(s) result(p)
521
526
!> move string to position of the next non white space character
522
527
character(*),intent(in) :: s !> character chain
523
- integer(1 ) :: p !> position
528
+ integer(int8 ) :: p !> position
524
529
!----------------------------------------------
525
530
p = 1
526
531
do while( p<len(s) .and. (iachar(s(p:p))==WS.or.iachar(s(p:p))==LF.or.iachar(s(p:p))==CR) )
0 commit comments