

DEFINITION MODULE LIST;

FROM STAT   IMPORT Block;
FROM SYSTEM IMPORT ADDRESS;

TYPE
   List;


   OutPosition = (First, Last, Previous, Next, Current);


   InPosition = [First..Next];


   OrdProc = PROCEDURE (ADDRESS, ADDRESS) : BOOLEAN;


   CondProc = PROCEDURE (ADDRESS) : BOOLEAN;


   ActionProc = PROCEDURE (ADDRESS);


PROCEDURE Create
   ( VAR  L : List;
     Name   : ARRAY OF CHAR
   );


PROCEDURE CreateOrd
   ( VAR  L  : List;
     Precede : OrdProc;
     Name    : ARRAY OF CHAR
   );


PROCEDURE CollectStat
   ( L : List
   );


PROCEDURE InitStat
   ( L : List
   );


PROCEDURE Init
   ( L : List
   );


PROCEDURE Insert
   ( P : ADDRESS;
     Where : InPosition;
     L : List
   );


PROCEDURE InsertOrd
   ( P : ADDRESS;
     L : List
   );


PROCEDURE Belongs
   ( P : ADDRESS;
     L : List
   ) : BOOLEAN;


PROCEDURE View
   ( VAR P  : ADDRESS;
     Which  : OutPosition;
     L      : List
   );


PROCEDURE Remove
   ( VAR P : ADDRESS;
     Where : OutPosition;
     L     : List
   );


PROCEDURE RemoveObject
   ( P : ADDRESS;
     L : List
   );


PROCEDURE Size
   ( L : List
   ) : CARDINAL;


PROCEDURE Concatenate
   ( VAR L1, L2 : List
   );


PROCEDURE Sort
   ( L : List;
     Precede : OrdProc
   );


PROCEDURE Merge
   ( VAR L1, L2 : List
   );
 

PROCEDURE Split
   ( VAR L, L1, L2 : List;
     Name1, Name2 : ARRAY OF CHAR
   );


PROCEDURE FindFirstSuchThat
   ( L : List;
     VAR P : ADDRESS;
     Cond  : CondProc
   );


PROCEDURE ForEachInListDo
   ( L : List;
     Action : ActionProc
   );


PROCEDURE StatSize
   ( L : List
   ) : Block;


PROCEDURE StatSojourn
   ( L : List
   ) : Block;
  

PROCEDURE Report
   ( L : List
   );


PROCEDURE Delete
   ( VAR L : List
   );

END LIST.
