From a288b809aff37519a04081acac678fd33f42f372 Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Sat, 2 Apr 2022 21:15:28 -0500 Subject: [PATCH] an alternate way to return version See #505 --- src/json_module.F90 | 23 +++++++++++++++++++++-- src/tests/jf_test_01.F90 | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/json_module.F90 b/src/json_module.F90 index 40db581834..a15ee99fd5 100644 --- a/src/json_module.F90 +++ b/src/json_module.F90 @@ -73,13 +73,32 @@ module json_module implicit none - character(kind=json_CK,len=5),protected :: json_fortran_version = '8.2.5' + character(kind=json_CK,len=*),parameter,private :: version = '8.2.5' !! JSON-Fortran version. !! !!@note This string should match the one in the `.VERSION` file (which is used - !! for the documentation generation.) + !! for the documentation generation.) public + contains +!***************************************************************************************** + +!***************************************************************************************** +!> +! Returns the JSON-Fortran version string. + + function json_fortran_version() result(ver) + + implicit none + + character(len=:),allocatable :: ver !! JSON-Fortran version string + + ver = version + + end function json_fortran_version +!***************************************************************************************** + +!***************************************************************************************** end module json_module !***************************************************************************************** diff --git a/src/tests/jf_test_01.F90 b/src/tests/jf_test_01.F90 index 73d067ba8a..534aed7ab2 100644 --- a/src/tests/jf_test_01.F90 +++ b/src/tests/jf_test_01.F90 @@ -57,7 +57,7 @@ subroutine test_1(error_cnt) write(error_unit,'(A)') '=================================' write(error_unit,'(A)') '' - write(error_unit,'(A)') 'JSON-Fortran version: '//json_fortran_version + write(error_unit,'(A)') 'JSON-Fortran version: '//json_fortran_version() ! parse the json file: write(error_unit,'(A)') ''