Skip to content

Commit

Permalink
Promote ASCII functions to elemental (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz authored Nov 28, 2024
2 parents 68524b3 + 882966e commit 662ad1a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions doc/specs/stdlib_ascii.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Converts input character variable to all lowercase.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -70,7 +70,7 @@ Converts input character variable to all uppercase.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -107,7 +107,7 @@ or numeral present next to either of its 2 ends.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -142,7 +142,7 @@ transformed to lowercase.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -174,7 +174,7 @@ Reverses the order of all characters in the input character type.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down
24 changes: 12 additions & 12 deletions src/stdlib_ascii.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,35 @@ module stdlib_ascii

!> Returns a new character sequence which is the lower case
!> version of the input character sequence
!> This method is pure and returns a character sequence
!> This method is elemental and returns a character sequence
interface to_lower
module procedure :: to_lower
end interface to_lower

!> Returns a new character sequence which is the upper case
!> version of the input character sequence
!> This method is pure and returns a character sequence
!> This method is elemental and returns a character sequence
interface to_upper
module procedure :: to_upper
end interface to_upper

!> Returns a new character sequence which is the title case
!> version of the input character sequence
!> This method is pure and returns a character sequence
!> This method is elemental and returns a character sequence
interface to_title
module procedure :: to_title
end interface to_title

!> Returns a new character sequence which is the sentence case
!> version of the input character sequence
!> This method is pure and returns a character sequence
!> This method is elemental and returns a character sequence
interface to_sentence
module procedure :: to_sentence
end interface to_sentence

!> Returns a new character sequence which is reverse of
!> the input charater sequence
!> This method is pure and returns a character sequence
!> This method is elemental and returns a character sequence
interface reverse
module procedure :: reverse
end interface reverse
Expand Down Expand Up @@ -220,7 +220,7 @@ contains

!> Returns the corresponding lowercase letter, if `c` is an uppercase
!> ASCII character, otherwise `c` itself.
pure function char_to_lower(c) result(t)
elemental function char_to_lower(c) result(t)
character(len=1), intent(in) :: c !! A character.
character(len=1) :: t
integer, parameter :: wp= iachar('a')-iachar('A'), BA=iachar('A'), BZ=iachar('Z')
Expand All @@ -234,7 +234,7 @@ contains

!> Returns the corresponding uppercase letter, if `c` is a lowercase
!> ASCII character, otherwise `c` itself.
pure function char_to_upper(c) result(t)
elemental function char_to_upper(c) result(t)
character(len=1), intent(in) :: c !! A character.
character(len=1) :: t
integer, parameter :: wp= iachar('a')-iachar('A'), la=iachar('a'), lz=iachar('z')
Expand All @@ -250,7 +250,7 @@ contains
!> ([Specification](../page/specs/stdlib_ascii.html#to_lower))
!>
!> Version: experimental
pure function to_lower(string) result(lower_string)
elemental function to_lower(string) result(lower_string)
character(len=*), intent(in) :: string
character(len=len(string)) :: lower_string
integer :: i
Expand All @@ -265,7 +265,7 @@ contains
!> ([Specification](../page/specs/stdlib_ascii.html#to_upper))
!>
!> Version: experimental
pure function to_upper(string) result(upper_string)
elemental function to_upper(string) result(upper_string)
character(len=*), intent(in) :: string
character(len=len(string)) :: upper_string
integer :: i
Expand All @@ -280,7 +280,7 @@ contains
!> ([Specification](../page/specs/stdlib_ascii.html#to_title))
!>
!> Version: experimental
pure function to_title(string) result(title_string)
elemental function to_title(string) result(title_string)
character(len=*), intent(in) :: string
character(len=len(string)) :: title_string
integer :: i
Expand All @@ -307,7 +307,7 @@ contains
!> ([Specification](../page/specs/stdlib_ascii.html#to_sentence))
!>
!> Version: experimental
pure function to_sentence(string) result(sentence_string)
elemental function to_sentence(string) result(sentence_string)
character(len=*), intent(in) :: string
character(len=len(string)) :: sentence_string
integer :: i, n
Expand All @@ -333,7 +333,7 @@ contains
!> ([Specification](../page/specs/stdlib_ascii.html#reverse))
!>
!> Version: experimental
pure function reverse(string) result(reverse_string)
elemental function reverse(string) result(reverse_string)
character(len=*), intent(in) :: string
character(len=len(string)) :: reverse_string
integer :: i, n
Expand Down

0 comments on commit 662ad1a

Please sign in to comment.