Skip to content

Commit 16a1d99

Browse files
fix(vertex): use varying string to allow elemental functions
1 parent 076837a commit 16a1d99

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/dag_s.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ pure function generate_digraph(self) result(str)
215215

216216
! define the vertices:
217217
do i=1,size(self%vertices)
218-
label = 'label="'//trim(adjustl(self%vertices(i)%label()))//'"'
219-
attributes = '['//trim(adjustl(self%vertices(i)%attributes()))//','//label//']'
218+
label = char('label="'//self%vertices(i)%label()//'"')
219+
attributes = char('['//self%vertices(i)%attributes()//','//label//']')
220220
str = str//tab//integer_to_string(i)//' '//attributes//newline
221221
if (i==size(self%vertices)) str = str//newline
222222
end do

src/vertex_m.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module vertex_m
55
!! date: 2020-Nov-30
66
!! license: Copyright (c) 2020-2021, Sourcery Institute, BSD 3-clause license Copyright (c) 2018 Jacob Williams
77
use jsonff, only : json_element_t, json_object_t, json_value_t
8-
use iso_varying_string, only : varying_string, len
8+
use iso_varying_string, only : varying_string
99

1010
implicit none
1111

@@ -17,7 +17,7 @@ module vertex_m
1717
private
1818
integer, allocatable :: edges_(:)
1919
type(varying_string) :: label_
20-
character(len=:), allocatable :: attributes_
20+
type(varying_string) :: attributes_
2121
contains
2222
procedure :: to_json
2323
procedure :: edges
@@ -87,14 +87,14 @@ elemental module function label(self) result(my_label)
8787
!! Vertex label getter
8888
implicit none
8989
class(vertex_t), intent(in) :: self
90-
character(len=len(self%label_)) my_label
90+
type(varying_string) my_label
9191
end function
9292

9393
elemental module function attributes(self) result(my_attributes)
9494
!! Vertex attributes getter
9595
implicit none
9696
class(vertex_t), intent(in) :: self
97-
character(len=len(self%attributes_)) my_attributes
97+
type(varying_string) my_attributes
9898
end function
9999

100100
end interface

src/vertex_s.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
vertex%edges_ = edges
6262
vertex%label_ = label
6363
if (present(attributes)) then
64-
vertex%attributes_ = char(attributes)
64+
vertex%attributes_ = attributes
6565
else
6666
vertex%attributes_ = branch
6767
end if

0 commit comments

Comments
 (0)