Skip to content

Commit 662ad1a

Browse files
authored
Promote ASCII functions to elemental (#886)
2 parents 68524b3 + 882966e commit 662ad1a

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

doc/specs/stdlib_ascii.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Converts input character variable to all lowercase.
3838

3939
#### Class
4040

41-
Pure function.
41+
Elemental function.
4242

4343
#### Argument
4444

@@ -70,7 +70,7 @@ Converts input character variable to all uppercase.
7070

7171
#### Class
7272

73-
Pure function.
73+
Elemental function.
7474

7575
#### Argument
7676

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

108108
#### Class
109109

110-
Pure function.
110+
Elemental function.
111111

112112
#### Argument
113113

@@ -142,7 +142,7 @@ transformed to lowercase.
142142

143143
#### Class
144144

145-
Pure function.
145+
Elemental function.
146146

147147
#### Argument
148148

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

175175
#### Class
176176

177-
Pure function.
177+
Elemental function.
178178

179179
#### Argument
180180

src/stdlib_ascii.fypp

+12-12
Original file line numberDiff line numberDiff line change
@@ -70,35 +70,35 @@ module stdlib_ascii
7070

7171
!> Returns a new character sequence which is the lower case
7272
!> version of the input character sequence
73-
!> This method is pure and returns a character sequence
73+
!> This method is elemental and returns a character sequence
7474
interface to_lower
7575
module procedure :: to_lower
7676
end interface to_lower
7777

7878
!> Returns a new character sequence which is the upper case
7979
!> version of the input character sequence
80-
!> This method is pure and returns a character sequence
80+
!> This method is elemental and returns a character sequence
8181
interface to_upper
8282
module procedure :: to_upper
8383
end interface to_upper
8484

8585
!> Returns a new character sequence which is the title case
8686
!> version of the input character sequence
87-
!> This method is pure and returns a character sequence
87+
!> This method is elemental and returns a character sequence
8888
interface to_title
8989
module procedure :: to_title
9090
end interface to_title
9191

9292
!> Returns a new character sequence which is the sentence case
9393
!> version of the input character sequence
94-
!> This method is pure and returns a character sequence
94+
!> This method is elemental and returns a character sequence
9595
interface to_sentence
9696
module procedure :: to_sentence
9797
end interface to_sentence
9898

9999
!> Returns a new character sequence which is reverse of
100100
!> the input charater sequence
101-
!> This method is pure and returns a character sequence
101+
!> This method is elemental and returns a character sequence
102102
interface reverse
103103
module procedure :: reverse
104104
end interface reverse
@@ -220,7 +220,7 @@ contains
220220

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

235235
!> Returns the corresponding uppercase letter, if `c` is a lowercase
236236
!> ASCII character, otherwise `c` itself.
237-
pure function char_to_upper(c) result(t)
237+
elemental function char_to_upper(c) result(t)
238238
character(len=1), intent(in) :: c !! A character.
239239
character(len=1) :: t
240240
integer, parameter :: wp= iachar('a')-iachar('A'), la=iachar('a'), lz=iachar('z')
@@ -250,7 +250,7 @@ contains
250250
!> ([Specification](../page/specs/stdlib_ascii.html#to_lower))
251251
!>
252252
!> Version: experimental
253-
pure function to_lower(string) result(lower_string)
253+
elemental function to_lower(string) result(lower_string)
254254
character(len=*), intent(in) :: string
255255
character(len=len(string)) :: lower_string
256256
integer :: i
@@ -265,7 +265,7 @@ contains
265265
!> ([Specification](../page/specs/stdlib_ascii.html#to_upper))
266266
!>
267267
!> Version: experimental
268-
pure function to_upper(string) result(upper_string)
268+
elemental function to_upper(string) result(upper_string)
269269
character(len=*), intent(in) :: string
270270
character(len=len(string)) :: upper_string
271271
integer :: i
@@ -280,7 +280,7 @@ contains
280280
!> ([Specification](../page/specs/stdlib_ascii.html#to_title))
281281
!>
282282
!> Version: experimental
283-
pure function to_title(string) result(title_string)
283+
elemental function to_title(string) result(title_string)
284284
character(len=*), intent(in) :: string
285285
character(len=len(string)) :: title_string
286286
integer :: i
@@ -307,7 +307,7 @@ contains
307307
!> ([Specification](../page/specs/stdlib_ascii.html#to_sentence))
308308
!>
309309
!> Version: experimental
310-
pure function to_sentence(string) result(sentence_string)
310+
elemental function to_sentence(string) result(sentence_string)
311311
character(len=*), intent(in) :: string
312312
character(len=len(string)) :: sentence_string
313313
integer :: i, n
@@ -333,7 +333,7 @@ contains
333333
!> ([Specification](../page/specs/stdlib_ascii.html#reverse))
334334
!>
335335
!> Version: experimental
336-
pure function reverse(string) result(reverse_string)
336+
elemental function reverse(string) result(reverse_string)
337337
character(len=*), intent(in) :: string
338338
character(len=len(string)) :: reverse_string
339339
integer :: i, n

0 commit comments

Comments
 (0)