Skip to content

Commit 30fda42

Browse files
committed
sort_index: add fypp variable for code simplifications
1 parent b7d79af commit 30fda42

File tree

3 files changed

+16
-426
lines changed

3 files changed

+16
-426
lines changed

src/common.fypp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#! Real kinds to be considered during templating
44
#:set REAL_KINDS = ["sp", "dp", "qp"]
55

6-
#! Real types to be considere during templating
6+
#! Real types to be considered during templating
77
#:set REAL_TYPES = ["real({})".format(k) for k in REAL_KINDS]
88

99
#! Collected (kind, type) tuples for real types
@@ -12,7 +12,7 @@
1212
#! Complex kinds to be considered during templating
1313
#:set CMPLX_KINDS = ["sp", "dp", "qp"]
1414

15-
#! Complex types to be considere during templating
15+
#! Complex types to be considered during templating
1616
#:set CMPLX_TYPES = ["complex({})".format(k) for k in CMPLX_KINDS]
1717

1818
#! Collected (kind, type) tuples for complex types
@@ -21,12 +21,21 @@
2121
#! Integer kinds to be considered during templating
2222
#:set INT_KINDS = ["int8", "int16", "int32", "int64"]
2323

24-
#! Integer types to be considere during templating
24+
#! Integer types to be considered during templating
2525
#:set INT_TYPES = ["integer({})".format(k) for k in INT_KINDS]
2626

2727
#! Collected (kind, type) tuples for integer types
2828
#:set INT_KINDS_TYPES = list(zip(INT_KINDS, INT_TYPES))
2929

30+
#! Derived type string_type
31+
#:set STRING_KINDS = ["string_type"]
32+
33+
#! String types to be considered during templating
34+
#:set STRING_TYPES = ["type({})".format(k) for k in STRING_KINDS]
35+
36+
#! Collected (kind, type) tuples for string derived types
37+
#:set STRING_KINDS_TYPES = list(zip(STRING_KINDS, STRING_TYPES))
38+
3039

3140
#! Whether Fortran 90 compatible code should be generated
3241
#:set VERSION90 = defined('VERSION90')

src/stdlib_sorting.fypp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#:include "common.fypp"
2-
#:set IR_KINDS_TYPES = INT_KINDS_TYPES + REAL_KINDS_TYPES
2+
#:set IR_KINDS_TYPES = INT_KINDS_TYPES + REAL_KINDS_TYPES + STRING_KINDS_TYPES
33

44
!! Licensing:
55
!!
@@ -434,7 +434,7 @@ module stdlib_sorting
434434
!! non-decreasing sort, but if the optional argument `REVERSE` is present
435435
!! with a value of `.TRUE.` the indices correspond to a non-increasing sort.
436436

437-
#:for k1, t1 in IR_KINDS_TYPES
437+
#:for k1, t1 in IRS_KINDS_TYPES
438438
module subroutine ${k1}$_sort_index( array, index, work, iwork, &
439439
reverse )
440440
!! Version: experimental
@@ -467,21 +467,6 @@ module stdlib_sorting
467467
logical, intent(in), optional :: reverse
468468
end subroutine char_sort_index
469469

470-
module subroutine string_sort_index( array, index, work, iwork, &
471-
reverse )
472-
!! Version: experimental
473-
!!
474-
!! `string_sort_index( array )` sorts an input `ARRAY` of type `STRING_TYPE`
475-
!! using a hybrid sort based on the `'Rust" sort` algorithm found in `slice.rs`
476-
!! and returns the sorted `ARRAY` and an array `INDEX of indices in the
477-
!! order that would sort the input `ARRAY` in the desired direction.
478-
type(string_type), intent(inout) :: array(0:)
479-
integer(int_size), intent(inout) :: index(0:)
480-
type(string_type), intent(inout), optional :: work(0:)
481-
integer(int_size), intent(inout), optional :: iwork(0:)
482-
logical, intent(in), optional :: reverse
483-
end subroutine string_sort_index
484-
485470
end interface sort_index
486471

487472

0 commit comments

Comments
 (0)