recursive subroutine rename_id(cmp,prefix,postfix)
type(type_dictionary), intent(inout) :: cmp
character(*), intent(in) :: prefix,postfix
type(type_error),allocatable :: err
character(:), allocatable :: cmp_id
type(type_dictionary),pointer :: dict
type(type_list),pointer :: list
type(type_list_item),pointer :: list_item
list => null()
dict => null()
cmp_id = cmp%get_string('id','',err)
if (cmp_id/='') then
cmp_id = prefix//cmp_id//postfix
call cmp%set_string('id',cmp_id)
endif
dict => cmp%get_dictionary('port',.true.,err)
if (allocated(err)) then; deallocate(err)
else; call rename_id(dict,prefix,postfix); endif
dict => cmp%get_dictionary('in',.true.,err)
if (allocated(err)) then; deallocate(err)
else; call rename_id(dict,prefix,postfix); endif
dict => cmp%get_dictionary('out',.true.,err)
if (allocated(err)) then; deallocate(err)
else; call rename_id(dict,prefix,postfix); endif
list => cmp%get_list('branches',.false.,err)
if (.not.associated(list)) then
list => cmp%get_list('link',.false.,err)
if (.not.associated(list)) then
return
endif
endif
list_item => list%first
do while(associated(list_item))
dict => select_dict(list_item%node)
call rename_id(dict,prefix,postfix)
list_item => list_item%next
enddo
end subroutine rename_id