27 type(LINKED_LIST),
pointer :: next
28 type(LIST_DATA) :: data
81 subroutine list_create( list, data )
82 type(LINKED_LIST),
pointer :: list
83 type(LIST_DATA),
intent(in) :: data
88 end subroutine list_create
98 subroutine 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 )
111 end subroutine list_destroy
118 integer 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
134 end function list_count
142 function list_next( elem )
result(next)
143 type(LINKED_LIST),
pointer :: elem
144 type(LINKED_LIST),
pointer :: next
148 end function list_next
157 subroutine 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
168 end subroutine list_insert
177 subroutine list_delete_element( list, elem )
178 type(LINKED_LIST),
pointer :: list
179 type(LINKED_LIST),
pointer :: elem
181 type(LINKED_LIST),
pointer :: current
182 type(LINKED_LIST),
pointer :: prev
184 if (
associated(list,elem) )
then
190 do while (
associated(current) )
191 if (
associated(current,elem) )
then
192 prev%next => current%next
193 deallocate( current )
197 current => current%next
205 end subroutine list_delete_element