@@ -44,7 +44,9 @@ module stdlib_str2num
44
44
integer(kind=ikind), parameter :: LF = 10, CR = 13, WS = 32
45
45
46
46
interface to_num
47
- module procedure to_int
47
+ #:for k1, t1 in INT_KINDS_TYPES
48
+ module procedure to_${k1}$
49
+ #:endfor
48
50
module procedure to_float
49
51
module procedure to_double
50
52
#:if WITH_QP
@@ -53,7 +55,9 @@ module stdlib_str2num
53
55
end interface
54
56
55
57
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
57
61
module procedure to_float_p
58
62
module procedure to_double_p
59
63
#:if WITH_QP
@@ -78,33 +82,35 @@ module stdlib_str2num
78
82
! String To Number interfaces
79
83
!---------------------------------------------
80
84
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)
82
87
! -- In/out Variables
83
88
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
86
91
! -- 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
89
94
!----------------------------------------------
90
95
call to_num_base(s,v,p,stat)
91
96
end function
92
97
93
- function to_int_p (s,mold,stat) result(v)
98
+ function to_${k1}$_p (s,mold,stat) result(v)
94
99
! -- In/out Variables
95
100
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
99
104
! -- 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
102
107
!----------------------------------------------
103
108
call to_num_base(s,v,p,err)
104
109
p = min( p , len(s) )
105
110
s => s(p:)
106
111
if(present(stat)) stat = err
107
112
end function
113
+ #:endfor
108
114
109
115
elemental function to_float(s,mold) result(r)
110
116
! -- In/out Variables
0 commit comments