-- $Date: 2004/01/25 05:35:21 $
-- $Revision: 1.20 $
-- $Author: jcrocholl $

package body Lists is

   -- Insert an item at the end of the list.
   function Push
     (This : access List-- Push into this list.
     return Item_Access   -- The newly created item.
     renames Inner_Lists.Push;

   -- Insert an item at the beginning of the list.
   function Unshift
     (This : access List-- Unshift into this list.
     return Item_Access   -- The newly created item.
     renames Inner_Lists.Unshift;

   -- Insert an item directly before the item at the current iteration
   -- pointer.
   function Insert_Before_Current
     (This : access List-- The list to modify.
     return Item_Access   -- The newly created item.
     renames Inner_Lists.Insert_Before_Current;

   -- Insert an item directly after the item at the current iteration
   -- pointer.
   function Insert_After_Current
     (This : access List-- The list to modify.
     return Item_Access   -- The newly created item.
     renames Inner_Lists.Insert_After_Current;

   --------------------
   -- List construction
   --------------------

   -- Insert an item at the end of the list.
   procedure Push
     (This    : access List;        -- Push into this list.
      Content : in Content_Type) is -- The new item.
   begin
      Push(This).Content := Content;
   end Push;

   -- Insert an item at the beginning of the list.
   procedure Unshift
     (This    : access List;        -- Insert into this list.
      Content : in Content_Type) is -- The new item.
   begin
      Unshift(This).Content := Content;
   end Unshift;

   -----------------------------------
   -- Manipulate list while iterating.
   -----------------------------------

   -- Update the item at the current iteration pointer.
   procedure Update_Current
     (This    : access List;        -- The list to modify.
      Content : in Content_Type) is -- New content for the current item.
   begin
      Current_Item(This).Content := Content;
   end Update_Current;

   -- Insert an item directly before the item at the current iteration
   -- pointer.
   procedure Insert_Before_Current
     (This    : access List;        -- The list to modify.
      Content : in Content_Type) is -- The item to insert.
   begin
      Insert_Before_Current(This).Content := Content;
   end Insert_Before_Current;

   -- Insert an item directly after the item at the current iteration
   -- pointer.
   procedure Insert_After_Current
     (This    : access List;        -- The list to modify.
      Content : in Content_Type) is -- The item to insert.
   begin
      Insert_After_Current(This).Content := Content;
   end Insert_After_Current;

   ------------------------
   -- Item direct iteration
   ------------------------

   -- Change an item's content.
   procedure Update_Item
     (This    : access Item;        -- Modify this item.
      Content : in Content_Type) is -- New content.
   begin
      This.Content := Content;
   end Update_Item;

end Lists;