DEFINITION CDCL;

(* CDCL (CircularDoubleChainedList) 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 last element points to the first, so that
   there is no really first and last 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;

                  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 CDCL.
