1+ #:include "common.fypp"
12!> The `stdlib_str2num` module provides procedures and interfaces for conversion
23!> of characters to numerical types. Currently supported: int32, real32 and real64
34!>
@@ -61,7 +62,9 @@ module stdlib_str2num
6162 end interface
6263
6364 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
6568 module procedure to_real_sp
6669 module procedure to_real_dp
6770#:if WITH_QP
@@ -193,11 +196,12 @@ module stdlib_str2num
193196 ! String To Number Implementations
194197 !---------------------------------------------
195198
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)
197201 !> Return an unsigned 32-bit integer
198202 ! -- In/out Variables
199203 character(*), intent(in) :: s !> input string
200- integer(int32) , intent(inout ) :: v !> Output real value
204+ ${t1}$ , intent(out ) :: v !> Output real value
201205 integer(int8), intent(out) :: p !> position within the number
202206 integer(int8), intent(out) :: stat !> status upon succes or failure to read
203207 ! -- Internal Variables
@@ -219,6 +223,7 @@ module stdlib_str2num
219223 end do
220224 stat = 0
221225 end subroutine
226+ #:endfor
222227
223228 elemental subroutine to_real_sp(s,v,p,stat)
224229 integer, parameter :: wp = sp
@@ -520,7 +525,7 @@ module stdlib_str2num
520525 elemental function mvs2nwsp(s) result(p)
521526 !> move string to position of the next non white space character
522527 character(*),intent(in) :: s !> character chain
523- integer(1 ) :: p !> position
528+ integer(int8 ) :: p !> position
524529 !----------------------------------------------
525530 p = 1
526531 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