Skip to content

Commit 763b170

Browse files
Merge pull request #265 from jacobwilliams/get_alloc_string
Get alloc string
2 parents 75b95e9 + 1f285e9 commit 763b170

File tree

5 files changed

+565
-108
lines changed

5 files changed

+565
-108
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ addons:
1818
- kalakris-cmake
1919
- ubuntu-toolchain-r-test
2020
packages:
21-
- gfortran-4.9
21+
- gfortran-6
2222
- binutils
2323
- cmake
2424
- python-pip
@@ -53,10 +53,10 @@ install:
5353
mkdir "$HOME/.local/bin"
5454
fi
5555
- export PATH="$HOME/.local/bin:$PATH"
56-
- export FC=/usr/bin/gfortran-4.9
57-
- ln -fs /usr/bin/gfortran-4.9 "$HOME/.local/bin/gfortran" && gfortran --version
58-
- ls -l /usr/bin/gfortran-4.9
59-
- ln -fs /usr/bin/gcov-4.9 "$HOME/.local/bin/gcov" && gcov --version
56+
- export FC=/usr/bin/gfortran-6
57+
- ln -fs /usr/bin/gfortran-6 "$HOME/.local/bin/gfortran" && gfortran --version
58+
- ls -l /usr/bin/gfortran-6
59+
- ln -fs /usr/bin/gcov-6 "$HOME/.local/bin/gcov" && gcov --version
6060
- perl --version
6161
- |
6262
if ! which f90split; then

src/json_file_module.F90

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ module json_file_module
101101
MAYBEWRAP(json_file_get_double_vec), &
102102
MAYBEWRAP(json_file_get_logical_vec), &
103103
MAYBEWRAP(json_file_get_string_vec), &
104+
MAYBEWRAP(json_file_get_alloc_string_vec), &
104105
json_file_get_root
105106

106107
generic,public :: update => MAYBEWRAP(json_file_update_integer), &
@@ -140,6 +141,7 @@ module json_file_module
140141
procedure :: MAYBEWRAP(json_file_get_double_vec)
141142
procedure :: MAYBEWRAP(json_file_get_logical_vec)
142143
procedure :: MAYBEWRAP(json_file_get_string_vec)
144+
procedure :: MAYBEWRAP(json_file_get_alloc_string_vec)
143145
procedure :: json_file_get_root
144146

145147
!update:
@@ -1120,6 +1122,52 @@ subroutine wrap_json_file_get_string_vec(me, path, vec, found)
11201122
end subroutine wrap_json_file_get_string_vec
11211123
!*****************************************************************************************
11221124

1125+
!*****************************************************************************************
1126+
!> author: Jacob Williams
1127+
! date: 12/17/2016
1128+
!
1129+
! Get an (allocatable length) string vector from a JSON file.
1130+
! This is just a wrapper for [[json_get_alloc_string_vec_with_path]].
1131+
1132+
subroutine json_file_get_alloc_string_vec(me, path, vec, ilen, found)
1133+
1134+
implicit none
1135+
1136+
class(json_file),intent(inout) :: me
1137+
character(kind=CK,len=*),intent(in) :: path
1138+
character(kind=CK,len=:),dimension(:),allocatable,intent(out) :: vec
1139+
integer(IK),dimension(:),allocatable,intent(out) :: ilen !! the actual length
1140+
!! of each character
1141+
!! string in the array
1142+
logical(LK),intent(out),optional :: found
1143+
1144+
call me%core%get(me%p, path, vec, ilen, found)
1145+
1146+
end subroutine json_file_get_alloc_string_vec
1147+
!*****************************************************************************************
1148+
1149+
!*****************************************************************************************
1150+
!>
1151+
! Alternate version of [[json_file_get_alloc_string_vec]], where "path" is kind=CDK.
1152+
! This is just a wrapper for [[wrap_json_get_alloc_string_vec_with_path]].
1153+
1154+
subroutine wrap_json_file_get_alloc_string_vec(me, path, vec, ilen, found)
1155+
1156+
implicit none
1157+
1158+
class(json_file),intent(inout) :: me
1159+
character(kind=CDK,len=*),intent(in) :: path
1160+
character(kind=CK,len=:),dimension(:),allocatable,intent(out) :: vec
1161+
integer(IK),dimension(:),allocatable,intent(out) :: ilen !! the actual length
1162+
!! of each character
1163+
!! string in the array
1164+
logical(LK),intent(out),optional :: found
1165+
1166+
call me%get(to_unicode(path), vec, ilen, found)
1167+
1168+
end subroutine wrap_json_file_get_alloc_string_vec
1169+
!*****************************************************************************************
1170+
11231171
!*****************************************************************************************
11241172
!> author: Jacob Williams
11251173
! date:1/10/2015

0 commit comments

Comments
 (0)