Returns this library's own version string. Default (mode absent): the RELEASE_VERSION build macro's bare release number; emits an informational remark first if that disagrees with cversion (a hand-maintained "vX.Y.Z (date)" string), which signals a build that skipped fpm's macro substitution or a version bump missed on one side. mode="internal" instead returns cversion verbatim. Any other mode value is an error -- in particular the linked Arrow and Parquet C++ library versions are reported by parquet_get_arrow_version, not by this procedure.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=:), | intent(out), | allocatable | :: | ver_string |
resulting version string. |
|
| character(len=*), | intent(in), | optional | :: | mode |
"internal"; absent = default RELEASE_VERSION behavior. |
subroutine parquet_get_version(ver_string, mode) implicit none character(len=:), allocatable, intent(out) :: ver_string !! resulting version string. character(len=*), intent(in), optional :: mode !! "internal"; absent = default RELEASE_VERSION behavior. integer :: i character(len=:), allocatable :: preview ! ! Accept solution from https://stackoverflow.com/questions/31649691/stringify-macro-with-gnu-gfortran ! which provides the easiest way to pass a macro to a string in Fortran complying with both ! gfortran traditional cpp and the standard cpp syntaxes #ifdef NAGFOR ! NAG drives -fpp, a Fortran preprocessor implementing NEITHER the standard cpp `#` ! stringification operator NOR gfortran's traditional-cpp continuation trick, so no spelling of ! the macro pair below compiles here (confirmed against NAG 7.2: the first gives ! "Invalid character '#'", the second "Unrecognised statement"). Take the release number from ! cversion instead. The consequence is deliberate rather than a gap: the development-build remark ! below compares ver_string against that same substring, so it can never fire under NAG -- the ! question it asks, "did fpm substitute RELEASE_VERSION?", is one this preprocessor cannot answer. ver_string = cversion(2:index(cversion, " ") - 1) #else # ifdef __GFORTRAN__ # define STRINGIFY_START(X) "& # define STRINGIFY_END(X) &X" # else # define STRINGIFY_(X) #X # define STRINGIFY_START(X) & # define STRINGIFY_END(X) STRINGIFY_(X) # endif ver_string = STRINGIFY_START(RELEASE_VERSION) STRINGIFY_END(RELEASE_VERSION) #endif ! i = index(cversion, " ") ! if (cversion(2:i-1) /= ver_string) then ! GCOVR_EXCL_START -- gcov attribution artifact ! A remark rather than a warning: it says something about how this copy of the library ! was BUILT, not about the caller's data, and it fires on every call in a build whose ! macro substitution did not happen. So it goes through the informational channel, which ! `verbosity="silent"` quiets while leaving real warnings alone. call parquet_emit_info("note: this is a development build of parquet-fortran " // & "(library version " // trim(cversion) // ", RELEASE_VERSION " // trim(ver_string) // ")") end if ! GCOVR_EXCL_STOP ! if (present(mode)) then select case (mode) case ("internal") ver_string = trim(cversion) case default ! Only a short preview of the offending value goes into the message, never the whole ! (unboundedly long) text: ifx 2026.1.1's ERROR STOP runtime corrupts memory once the ! composed message reaches 8192 bytes, and `mode` is caller-supplied with no cap. if (len(mode) > 100) then preview = mode(1:100) // "..." else preview = mode end if error stop "parquet_get_version: invalid mode '" // preview // & "' (must be 'internal'; for the linked Arrow/Parquet C++ library versions " // & "call parquet_get_arrow_version)" end select else ver_string = trim(ver_string) end if ! end subroutine parquet_get_version