function Search var aL TDList const aData TData integer var PElem TPEl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
function Search(var aL : TDList; const aData : TData ):integer;
var
PElem: TPElem;
position:integer;
begin
position:=1;
PElem:=aL.PFirst;
while PElem<>nil do
begin
if PElem.Data = aData then
begin
Search:=position;
Exit();
end
else
position:=position+1;
PElem:=PElem^.PNext;
end;
Search:=0;
end;