Skip to content

Get alloc string #265

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 12 commits into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ addons:
- kalakris-cmake
- ubuntu-toolchain-r-test
packages:
- gfortran-4.9
- gfortran-6
- binutils
- cmake
- python-pip
Expand Down Expand Up @@ -53,10 +53,10 @@ install:
mkdir "$HOME/.local/bin"
fi
- export PATH="$HOME/.local/bin:$PATH"
- export FC=/usr/bin/gfortran-4.9
- ln -fs /usr/bin/gfortran-4.9 "$HOME/.local/bin/gfortran" && gfortran --version
- ls -l /usr/bin/gfortran-4.9
- ln -fs /usr/bin/gcov-4.9 "$HOME/.local/bin/gcov" && gcov --version
- export FC=/usr/bin/gfortran-6
- ln -fs /usr/bin/gfortran-6 "$HOME/.local/bin/gfortran" && gfortran --version
- ls -l /usr/bin/gfortran-6
- ln -fs /usr/bin/gcov-6 "$HOME/.local/bin/gcov" && gcov --version
- perl --version
- |
if ! which f90split; then
Expand Down
48 changes: 48 additions & 0 deletions src/json_file_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ module json_file_module
MAYBEWRAP(json_file_get_double_vec), &
MAYBEWRAP(json_file_get_logical_vec), &
MAYBEWRAP(json_file_get_string_vec), &
MAYBEWRAP(json_file_get_alloc_string_vec), &
json_file_get_root

generic,public :: update => MAYBEWRAP(json_file_update_integer), &
Expand Down Expand Up @@ -140,6 +141,7 @@ module json_file_module
procedure :: MAYBEWRAP(json_file_get_double_vec)
procedure :: MAYBEWRAP(json_file_get_logical_vec)
procedure :: MAYBEWRAP(json_file_get_string_vec)
procedure :: MAYBEWRAP(json_file_get_alloc_string_vec)
procedure :: json_file_get_root

!update:
Expand Down Expand Up @@ -1120,6 +1122,52 @@ subroutine wrap_json_file_get_string_vec(me, path, vec, found)
end subroutine wrap_json_file_get_string_vec
!*****************************************************************************************

!*****************************************************************************************
!> author: Jacob Williams
! date: 12/17/2016
!
! Get an (allocatable length) string vector from a JSON file.
! This is just a wrapper for [[json_get_alloc_string_vec_with_path]].

subroutine json_file_get_alloc_string_vec(me, path, vec, ilen, found)

implicit none

class(json_file),intent(inout) :: me
character(kind=CK,len=*),intent(in) :: path
character(kind=CK,len=:),dimension(:),allocatable,intent(out) :: vec
integer(IK),dimension(:),allocatable,intent(out) :: ilen !! the actual length
!! of each character
!! string in the array
logical(LK),intent(out),optional :: found

call me%core%get(me%p, path, vec, ilen, found)

end subroutine json_file_get_alloc_string_vec
!*****************************************************************************************

!*****************************************************************************************
!>
! Alternate version of [[json_file_get_alloc_string_vec]], where "path" is kind=CDK.
! This is just a wrapper for [[wrap_json_get_alloc_string_vec_with_path]].

subroutine wrap_json_file_get_alloc_string_vec(me, path, vec, ilen, found)

implicit none

class(json_file),intent(inout) :: me
character(kind=CDK,len=*),intent(in) :: path
character(kind=CK,len=:),dimension(:),allocatable,intent(out) :: vec
integer(IK),dimension(:),allocatable,intent(out) :: ilen !! the actual length
!! of each character
!! string in the array
logical(LK),intent(out),optional :: found

call me%get(to_unicode(path), vec, ilen, found)

end subroutine wrap_json_file_get_alloc_string_vec
!*****************************************************************************************

!*****************************************************************************************
!> author: Jacob Williams
! date:1/10/2015
Expand Down
Loading