
with Ada.Text_IO; use Ada.Text_IO;

procedure List2 is

   type Struct;
   type Struct_Access is access Struct;
   type Struct is record
      Value    : Integer;
      Next     : Struct_Access;
      Previous : Struct_Access;
   end record;

   Head : Struct_Access;
   V    : Struct_Access;

   procedure Debug is
   begin
      Put_Line ("Test");
      if Head /= null then
         Put_Line (Head.Value'Img);
      end if;
      Put_Line ("Foo");
   end Debug;

begin

   Head := new Struct;
   --  Display Head

   V := new Struct;
   Head.Next := V;
   Head.Next.Previous := Head;

   Head.Next.Next := new Struct;

   Head.Value := 1;
   Head.Value := 3;
   Head.Value := 4;

   Head.Next := new Struct;

   Head.Value := 2;
end List2;
