DEFINITION DCL;

(* DCL (DoubleChainedList) implements a double pointer chained list, i.e.
   a list of records which have one pointer to the next and one to the
   previous element. The base type Element can be extended for all purposes.
*)


TYPE Elem*    = POINTER TO Element;
     Element* = RECORD
                  next-,prev- : Elem;
                END(*RECORD*);
     List*    = POINTER TO ListDesc;
     ListDesc*= RECORD
                  root- : Elem; (* first element in list *)
                  last- : Elem; (* last element in list *)

                  PROCEDURE(l : List) Init*;
                    (* initializes a list of elements *)

                  PROCEDURE(l : List) Add*(e : Elem);
                    (* adds element e at the beginning of list l *)

                  PROCEDURE(l : List) Append*(e : Elem);
                    (* adds element e at the end of list l *)

                  PROCEDURE(l : List) Delete*(e : Elem);
                    (* deletes element e in list l. The memory is not disposed! *)

                END;


END DCL.
