TList = ^TNode;
TNode = record
Info: TTreb;
Next: TList;
// Prev: TList;
end;
procedure ListCopy(var K:TList; L:TList);
var P,Q,R:TList;
begin
if L<>nil then
begin
P:=L;
if K=nil then begin
while P<>nil do
begin
ListAddLast(K,P^.Info);
P:=P^.Next;
end;
end else
begin
Q:=K;
while P<>nil do
begin
Q^.Info:=P^.Info;
if Q^.Next=nil then begin
new(R);
Q^.Next:=R;
R^.Next:=nil;
R^.Prev:=Q;
end;
Q:=Q^.Next;
P:=P^.Next;
//if P=nil then ListClear(Q);
end;
end;
if Q<>nil then begin {Q:=nil;}ListClear(Q); end;
end;
end;
procedure ListClear ( var L: TList );
var
N: TList;
begin
while L <> nil do
begin
N :=L;
L:=L^.Next;
dispose(N)
end
end;