@@ -44,7 +44,9 @@ module stdlib_str2num
4444 integer(kind=ikind), parameter :: LF = 10, CR = 13, WS = 32
4545
4646 interface to_num
47- module procedure to_int
47+ #:for k1, t1 in INT_KINDS_TYPES
48+ module procedure to_${k1}$
49+ #:endfor
4850 module procedure to_float
4951 module procedure to_double
5052#:if WITH_QP
@@ -53,7 +55,9 @@ module stdlib_str2num
5355 end interface
5456
5557 interface to_num_p
56- module procedure to_int_p
58+ #:for k1, t1 in INT_KINDS_TYPES
59+ module procedure to_${k1}$_p
60+ #:endfor
5761 module procedure to_float_p
5862 module procedure to_double_p
5963#:if WITH_QP
@@ -78,33 +82,35 @@ module stdlib_str2num
7882 ! String To Number interfaces
7983 !---------------------------------------------
8084
81- elemental function to_int(s,mold) result(v)
85+ #:for k1, t1 in INT_KINDS_TYPES
86+ elemental function to_${k1}$(s,mold) result(v)
8287 ! -- In/out Variables
8388 character(*), intent(in) :: s !> input string
84- integer , intent(in) :: mold !> dummy argument to disambiguate at compile time the generic interface
85- integer :: v !> Output integer 32 value
89+ ${t1}$ , intent(in) :: mold !> dummy argument to disambiguate at compile time the generic interface
90+ ${t1}$ :: v !> Output integer 32 value
8691 ! -- Internal Variables
87- integer(1 ) :: p !> position within the number
88- integer(1 ) :: stat !> error status
92+ integer(int8 ) :: p !> position within the number
93+ integer(int8 ) :: stat !> error status
8994 !----------------------------------------------
9095 call to_num_base(s,v,p,stat)
9196 end function
9297
93- function to_int_p (s,mold,stat) result(v)
98+ function to_${k1}$_p (s,mold,stat) result(v)
9499 ! -- In/out Variables
95100 character(len=:), pointer :: s !> input string
96- integer , intent(in) :: mold !> dummy argument to disambiguate at compile time the generic interface
97- integer :: v !> Output integer 32 value
98- integer(1 ),intent(inout), optional :: stat
101+ ${t1}$ , intent(in) :: mold !> dummy argument to disambiguate at compile time the generic interface
102+ ${t1}$ :: v !> Output ${t1}$ value
103+ integer(int8 ),intent(inout), optional :: stat
99104 ! -- Internal Variables
100- integer(1 ) :: p !> position within the number
101- integer(1 ) :: err
105+ integer(int8 ) :: p !> position within the number
106+ integer(int8 ) :: err
102107 !----------------------------------------------
103108 call to_num_base(s,v,p,err)
104109 p = min( p , len(s) )
105110 s => s(p:)
106111 if(present(stat)) stat = err
107112 end function
113+ #:endfor
108114
109115 elemental function to_float(s,mold) result(r)
110116 ! -- In/out Variables
0 commit comments