Skip to content

Commit

Permalink
addition of fypp directives for some integer procedures
Browse files Browse the repository at this point in the history
  • Loading branch information
jvdp1 committed Dec 26, 2023
1 parent ea2ee72 commit 1585c10
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/stdlib_str2num.fypp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#:include "common.fypp"
!> The `stdlib_str2num` module provides procedures and interfaces for conversion
!> of characters to numerical types. Currently supported: int32, real32 and real64
!>
Expand Down Expand Up @@ -61,7 +62,9 @@ module stdlib_str2num
end interface

interface to_num_base
module procedure to_int_32
#:for k1, t1 in INT_KINDS_TYPES
module procedure to_${k1}$
#:endfor
module procedure to_real_sp
module procedure to_real_dp
#:if WITH_QP
Expand Down Expand Up @@ -193,11 +196,12 @@ module stdlib_str2num
! String To Number Implementations
!---------------------------------------------

elemental subroutine to_int_32(s,v,p,stat)
#:for k1, t1 in INT_KINDS_TYPES
elemental subroutine to_${k1}$(s,v,p,stat)
!> Return an unsigned 32-bit integer
! -- In/out Variables
character(*), intent(in) :: s !> input string
integer(int32), intent(inout) :: v !> Output real value
${t1}$, intent(out) :: v !> Output real value
integer(int8), intent(out) :: p !> position within the number
integer(int8), intent(out) :: stat !> status upon succes or failure to read
! -- Internal Variables
Expand All @@ -219,6 +223,7 @@ module stdlib_str2num
end do
stat = 0
end subroutine
#:endfor

elemental subroutine to_real_sp(s,v,p,stat)
integer, parameter :: wp = sp
Expand Down Expand Up @@ -520,7 +525,7 @@ module stdlib_str2num
elemental function mvs2nwsp(s) result(p)
!> move string to position of the next non white space character
character(*),intent(in) :: s !> character chain
integer(1) :: p !> position
integer(int8) :: p !> position
!----------------------------------------------
p = 1
do while( p<len(s) .and. (iachar(s(p:p))==WS.or.iachar(s(p:p))==LF.or.iachar(s(p:p))==CR) )
Expand Down

0 comments on commit 1585c10

Please sign in to comment.