stdlib_version.fypp Source File


Contents

Source Code


Source Code

! SPDX-Identifier: MIT

#:include "common.fypp"

!> Version information on stdlib
module stdlib_version
    implicit none
    private

    public :: get_stdlib_version
    public :: stdlib_version_string, stdlib_version_compact


    !> String representation of the standard library version
    character(len=*), parameter :: stdlib_version_string = "${PROJECT_VERSION}$"

    !> Major version number of the above standard library version
    integer, parameter :: stdlib_major = ${PROJECT_VERSION_MAJOR}$

    !> Minor version number of the above standard library version
    integer, parameter :: stdlib_minor = ${PROJECT_VERSION_MINOR}$

    !> Patch version number of the above standard library version
    integer, parameter :: stdlib_patch = ${PROJECT_VERSION_PATCH}$

    !> Compact numeric representation of the standard library version
    integer, parameter :: stdlib_version_compact = &
        & stdlib_major*10000 + stdlib_minor*100 + stdlib_patch


contains


!> Getter function to retrieve standard library version
pure subroutine get_stdlib_version(major, minor, patch, string)

    !> Major version number of the standard library version
    integer, intent(out), optional :: major

    !> Minor version number of the standard library version
    integer, intent(out), optional :: minor

    !> Patch version number of the standard library version
    integer, intent(out), optional :: patch

    !> String representation of the standard library version
    character(len=:), allocatable, intent(out), optional :: string

    if (present(major)) then
        major = stdlib_major
    end if
    if (present(minor)) then
        minor = stdlib_minor
    end if
    if (present(patch)) then
        patch = stdlib_patch
    end if
    if (present(string)) then
        string = stdlib_version_string
    end if

end subroutine get_stdlib_version


end module stdlib_version