home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG027.ARC
/
TTFAMILY.INC
< prev
next >
Wrap
Text File
|
1979-12-31
|
3KB
|
113 lines
OVERLAY PROCEDURE Family_Display(Date : str14);
LABEL
escape;
const
MaxParents = 50;
MaxChildren = 500;
TYPE
child_rec = RECORD
parent : str5;
Ear_No : str5;
END;
VAR
dummy : str5;
rab,
rab_child : Animal_rec;
i,y : INTEGER;
k : INTEGER;
child : ARRAY[1..MaxChildren] OF child_rec; {holds record no of childern}
parent : ARRAY[1..MaxParents] OF str5; {holds parents ear number}
rec : INTEGER;
parents : INTEGER;
got : BOOLEAN;
J : INTEGER;
PROCEDURE check(dd : str5);
BEGIN
got := FALSE;
FOR i := 1 TO parents DO
IF parent[i] = dd
THEN got := TRUE;
IF NOT got
THEN
BEGIN
parent[i] := dd;
parents := parents + 1;
END;
END;
BEGIN
line(1);
dis(1,2,' D I S P L A Y F A M I L Y');
print;
if ch <> #27 then
begin
line(1);
gotoxy(1,2);
Write(Q,date,' F A M I L Y of');
ClrEOL;
Write(Q,' ',Animal.name,' ':20-Length(Animal.name));
y := 3;
parents := 1;
FOR i := 1 TO MaxParents DO parent[i] := '';
dummy := Animal.ear_no;
IF Animal.sex = 'M'
THEN Writeln(Q,'FATHER',dummy:10)
ELSE Writeln(Q,'MOTHER',dummy:10);
rec := 1;
J := 0;
REPEAT
J := J + 1;
GetRec(DatF,J,Rab);
IF (rab.sire = dummy) THEN
BEGIN
check(rab.dam);
child[rec].parent := rab.dam;
child[rec].Ear_No := rab.Ear_No;
rec := rec + 1;
END;
IF (rab.dam = dummy) THEN
BEGIN
check(rab.sire);
child[rec].parent := rab.sire;
Child[rec].Ear_No := Rab.Ear_No;
rec := rec + 1;
END;
UNTIL J = UsedRecs(DatF);
FOR k := 1 TO parents - 1 DO
BEGIN
FindKey(EarIndexFile,J,parent[k]);
GetRec(DatF,J,Rab);
y := y + 1;
Writeln(Q);
Write(Q,' ',rab.name,' ':30-Length(rab.name));
IF (rab.sex = 'M')
THEN Write(Q,'FATHER')
ELSE Write(Q,'MOTHER');
Writeln(Q,rab.ear_no:10);
FOR i := 1 TO rec -1 DO
BEGIN
IF rab.ear_no = child[i].parent THEN
BEGIN
FindKey(EarIndexFile,J,child[i].Ear_No);
GetRec(DatF,J,rab_child);
Write(Q,' ':14,rab_child.name,' ':20-Length(rab_child.name));
Write(Q,rab_child.sex:3);
Writeln(Q,rab_child.ear_no:7);
y := y + 1;
END;
END;
END; {For K := 1 to parents}
Writeln;
Writeln;
end;
escape:
ASSIGN(Q,'CON:');
REWRITE(Q);
Write('Press RETURN to continue ':50);
Readln;
ch := ^M;
END;