Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promote ascii functions to elemental #886

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading