27 type(LINKED_LIST),
pointer :: next
28 type(LIST_DATA) :: data
81subroutine list_create( list, data )
82 type(LINKED_LIST),
pointer :: list
83 type(LIST_DATA),
intent(in) :: data
88end subroutine list_create
98subroutine list_destroy( list )
99 type(LINKED_LIST),
pointer :: list
101 type(LINKED_LIST),
pointer :: current
102 type(LINKED_LIST),
pointer :: next
105 do while (
associated(current) )
107 call finalize_table( current%data%value )
108 deallocate( current )
111end subroutine list_destroy
118integer function list_count( list )
119 type(LINKED_LIST),
pointer :: list
121 type(LINKED_LIST),
pointer :: current
124 if (
associated(list) )
then
127 do while (
associated(current%next) )
128 current => current%next
129 list_count = list_count + 1
134end function list_count
142function list_next( elem )
result(next)
143 type(LINKED_LIST),
pointer :: elem
144 type(LINKED_LIST),
pointer :: next
148end function list_next
157subroutine list_insert( elem, data )
158 type(LINKED_LIST),
pointer :: elem
159 type(LIST_DATA),
intent(in) :: data
161 type(LINKED_LIST),
pointer :: next
165 next%next => elem%next
168end subroutine list_insert
176subroutine list_insert_head( list, data )
177 type(LINKED_LIST),
pointer :: list
178 type(LIST_DATA),
intent(in) :: data
180 type(LINKED_LIST),
pointer :: elem
187end subroutine list_insert_head
196subroutine list_delete_element( list, elem )
197 type(LINKED_LIST),
pointer :: list
198 type(LINKED_LIST),
pointer :: elem
200 type(LINKED_LIST),
pointer :: current
201 type(LINKED_LIST),
pointer :: prev
203 if (
associated(list,elem) )
then
209 do while (
associated(current) )
210 if (
associated(current,elem) )
then
211 prev%next => current%next
212 deallocate( current )
216 current => current%next
224end subroutine list_delete_element
231function list_get_data( elem )
result(data)
232 type(LINKED_LIST),
pointer :: elem
234 type(LIST_DATA) :: data
237end function list_get_data
245subroutine list_put_data( elem, data )
246 type(LINKED_LIST),
pointer :: elem
247 type(LIST_DATA),
intent(in) :: data
250end subroutine list_put_data