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