|
| 1 | +! SPDX-Identifier: MIT |
| 2 | + |
| 3 | + |
| 4 | +!> Version information on stdlib |
| 5 | +module stdlib_version |
| 6 | + implicit none |
| 7 | + private |
| 8 | + |
| 9 | + public :: get_stdlib_version |
| 10 | + public :: stdlib_version_string, stdlib_version_compact |
| 11 | + |
| 12 | + |
| 13 | + !> String representation of the standard library version |
| 14 | + character(len=*), parameter :: stdlib_version_string = "0.1.0" |
| 15 | + |
| 16 | + !> Major version number of the above standard library version |
| 17 | + integer, parameter :: stdlib_major = 0 |
| 18 | + |
| 19 | + !> Minor version number of the above standard library version |
| 20 | + integer, parameter :: stdlib_minor = 1 |
| 21 | + |
| 22 | + !> Patch version number of the above standard library version |
| 23 | + integer, parameter :: stdlib_patch = 0 |
| 24 | + |
| 25 | + !> Compact numeric representation of the standard library version |
| 26 | + integer, parameter :: stdlib_version_compact = & |
| 27 | + & stdlib_major*10000 + stdlib_minor*100 + stdlib_patch |
| 28 | + |
| 29 | + |
| 30 | +contains |
| 31 | + |
| 32 | + |
| 33 | +!> Getter function to retrieve standard library version |
| 34 | +pure subroutine get_stdlib_version(major, minor, patch, string) |
| 35 | + |
| 36 | + !> Major version number of the standard library version |
| 37 | + integer, intent(out), optional :: major |
| 38 | + |
| 39 | + !> Minor version number of the standard library version |
| 40 | + integer, intent(out), optional :: minor |
| 41 | + |
| 42 | + !> Patch version number of the standard library version |
| 43 | + integer, intent(out), optional :: patch |
| 44 | + |
| 45 | + !> String representation of the standard library version |
| 46 | + character(len=:), allocatable, intent(out), optional :: string |
| 47 | + |
| 48 | + if (present(major)) then |
| 49 | + major = stdlib_major |
| 50 | + end if |
| 51 | + if (present(minor)) then |
| 52 | + minor = stdlib_minor |
| 53 | + end if |
| 54 | + if (present(patch)) then |
| 55 | + patch = stdlib_patch |
| 56 | + end if |
| 57 | + if (present(string)) then |
| 58 | + string = stdlib_version_string |
| 59 | + end if |
| 60 | + |
| 61 | +end subroutine get_stdlib_version |
| 62 | + |
| 63 | + |
| 64 | +end module stdlib_version |
0 commit comments