procedure hlretrieve;
begin
hlasf_ct:=fname_ct+'hlasf';
spath := fsearch(hlasf_ct,GetEnv('PATH'));
if (spath = '') then exit;
assign(bytefile,hlasf_ct);
reset(bytefile);
hlhigh_by:=0;
hlcheck_by:=0;
for lp_by:=2 to 10 do
begin
read(bytefile,hlasf_by[lp_by]);
if (hlasf_by[lp_by]=1) then
begin
hlcheck_by:=hlcheck_by+1;
hlhigh_by:=lp_by;
end;
end;
close(bytefile);
hl_ct:=fname_ct+'hl';
spath := fsearch(hl_ct,GetEnv('PATH'));
if (spath = '') then exit;
assign(bytefile,hl_ct);
reset(bytefile);
for lp_by:=2 to 10 do
begin
for lp2_by:=1 to 4 do
begin
for lp3_by:=1 to 6 do
begin
for lp4_by:=1 to 3 do
begin
read(bytefile,aisihl_by[lp_by,lp2_by,lp3_by,lp4_by]);
end;
end;
end;
end;
close(bytefile);
end;
procedure retrievemeet;
begin
initvars;
metag_bo:=true;
retag_bo:=false;
clrscr;
write('screen for retrieving meeting & results data');
gotoxy(1,4);
write('file to retrieve(w): ');
gotoxy(30,4);
readln(rvs_ct);
readln(fname_ct);
mf_ct:=fname_ct+'m';
rf_ct:=fname_ct+'r';
hf_ct:=fname_ct+'h';
nrf_ct:=fname_ct+'nr';
nhf_ct:=fname_ct+'nh';
rsff_ct:=fname_ct+'rsf';
assign(bytefile, nrf_ct);
reset(bytefile);
read(bytefile,nor_by);
close(bytefile);
assign(bytefile,nhf_ct);
reset(bytefile);
for lp_by:=1 to nor_by do
begin
read(bytefile,hir_by[lp_by]);
end;
close(bytefile);
assign(string30file, mf_ct);
reset(string30file);
for lp_by:=1 to 5 do
begin
read(string30file,string30);
rdn_p^[lp_by]:=string30;
end;
close(string30file);
assign(string30file, rf_ct);
reset(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to 4 do
begin
read(string30file,string30);
rd_p^[lp_by, lp2_by]:=string30;
end;
end;
close(string30file);
assign(string30file,hf_ct);
reset(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
read(string30file, string30);
horse_p^[lp_by, lp2_by, lp3_by]:=string30;
end;
end;
end;
close(string30file);
spath := fsearch(rsff_ct,GetEnv('PATH'));
if (spath = '') then exit;
retag_bo:=true;
nrsff_ct:=fname_ct+'nrsf';
assign(bytefile, nrsff_ct);
reset(bytefile);
read(bytefile,rsf_by);
close(bytefile);
assign(string30file,rsff_ct);
reset(string30file);
for lp_by:=1 to rsf_by do
begin
for lp2_by:=1 to 3 do
begin
read
(string30file,string30,string30_2,string30_3,string30_4,string30_5);
hd_p^[lp_by,lp2_by,1]:=string30;
hd_p^[lp_by,lp2_by,2]:=string30_2;
hd_p^[lp_by,lp2_by,3]:=string30_3;
hd_p^[lp_by,lp2_by,4]:=string30_4;
hd_p^[lp_by,lp2_by,5]:=string30_5;
end;
end;
close(string30file);
for lp_by:=1 to rsf_by do
begin
for lp2_by:=1 to 3 do
begin
for lp3_by:=1 to hir_by[lp_by] do
begin
if (hd_p^[lp_by,lp2_by,1]=horse_p^[lp_by,lp3_by,1]) then
place_by[lp_by,lp2_by]:=lp3_by;
end;
end;
end;
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
if (horse_p^[lp_by,lp2_by,3] <> 's') then
hirscratch_by[lp_by]:=hirscratch_by[lp_by]+1;
end;
end;
for lp_by:=1 to 5 do
begin
hdlength_by:=length(rdn_p^[lp_by]);
charsepcount(rdn_p^[lp_by]);
rdnl_by[lp_by]:=hdlength_by;
rdn_wo[lp_by,1]:=charcount_wo;
rdn_wo[lp_by,2]:=sepcount_wo;
end;
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to 4 do
begin
hdlength_by:=length(rd_p^[lp_by,lp2_by]);
charsepcount(rd_p^[lp_by,lp2_by]);
rdl_by[lp_by,lp2_by]:=hdlength_by;
rd_wo[lp_by,lp2_by,1]:=charcount_wo;
rd_wo[lp_by,lp2_by,2]:=sepcount_wo;
end;
end;
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
hdlength_by:=length(horse_p^[lp_by,lp2_by,lp3_by]);
charsepcount(horse_p^[lp_by,lp2_by,lp3_by]);
horsel_by[lp_by,lp2_by,lp3_by]:=hdlength_by;
horse_wo[lp_by,lp2_by,lp3_by,1]:=charcount_wo;
horse_wo[lp_by,lp2_by,lp3_by,2]:=sepcount_wo;
end;
end;
end;
for lp_by:=1 to rsf_by do
begin
for lp2_by:=1 to 3 do
begin
for lp3_by:=1 to 5 do
begin
hdlength_by:=length(hd_p^[lp_by,lp2_by,lp3_by]);
charsepcount(hd_p^[lp_by,lp2_by,lp3_by]);
hdl_by[lp_by,lp2_by,lp3_by]:=hdlength_by;
hd_wo[lp_by,lp2_by,lp3_by,1]:=charcount_wo;
hd_wo[lp_by,lp2_by,lp3_by,2]:=sepcount_wo;
end;
end;
end;
commentretrieve;
hlretrieve;
end;
procedure eraseresult;
begin
clrscr;
write('erase result file');
gotoxy(1,4);
write('file name for result erasure(w): ');
readln(rvs_ct);
readln(fname_ct);
nrsff_ct:=fname_ct+'nrsf';
assign(bytefile,nrsff_ct);
erase(bytefile);
rsff_ct:=fname_ct+'rsf';
assign(bytefile,rsff_ct);
erase(bytefile);
retag_bo:=false;
rsf_by:=0;
end;
procedure commentdelete;
begin
if (metag_bo=false) then exit;
gc_ct:=fname_ct+'gc';
spath := fsearch(gc_ct,GetEnv('PATH'));
if (spath = '') then exit;
assign(string30file, gc_ct);
erase(string30file);
for lp_by:=2 to 10 do
begin
for lp2_by:=1 to 12 do
begin
graphcomment_st[lp_by,lp2_by]:='';
end;
end;
end;
procedure hldelete;
begin
hlasf_ct:=fname_ct+'hlasf';
spath := fsearch(hlasf_ct,GetEnv('PATH'));
if (spath = '') then exit;
assign(bytefile,hlasf_ct);
erase(bytefile);
hlcheck_by:=0;
hlhigh_by:=0;
for lp_by:=2 to 10 do
begin
hlasf_by[lp_by]:=0;
end;
hl_ct:=fname_ct+'hl';
spath := fsearch(hl_ct,GetEnv('PATH'));
if (spath = '') then exit;
assign(bytefile,hl_ct);
erase(bytefile);
for lp_by:= 2 to 10 do
begin
for lp2_by:=1 to 4 do
begin
for lp3_by:=1 to 6 do
begin
for lp4_by:=1 to 3 do
begin
aisihl_by[lp_by,lp2_by,lp3_by,lp4_by]:=0;
end;
end;
end;
end;
end;
procedure scratchings;
label scratchagain;
begin
initvars;
metag_bo:=false;
retag_bo:=false;
clrscr;
write('screen for entering scratchings (max:18s)');
gotoxy(1,4);
write('file to retrieve(w):');
gotoxy(22,4);
readln(rvs_ct);
readln(fname_ct);
hf_ct:=fname_ct+'h';
nrf_ct:=fname_ct+'nr';
nhf_ct:=fname_ct+'nh';
assign(bytefile, nrf_ct);
reset(bytefile);
read(bytefile,nor_by);
close(bytefile);
assign(bytefile,nhf_ct);
reset(bytefile);
for lp_by:=1 to nor_by do
begin
read(bytefile,hir_by[lp_by]);
end;
close(bytefile);
assign(string30file,hf_ct);
reset(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
read(string30file, string30);
horse_p^[lp_by, lp2_by, lp3_by]:=string30;
end;
end;
end;
close(string30file);
scratchagain:
clrscr;
write('screen for entering scratchings (max:18s)');
gotoxy(60,1);
write('file: ');
gotoxy(67,1);
write(fname_ct);
gotoxy(1,4);
write('number of scratchings(n):');
gotoxy(27,4);
read(nscratch_by);
if(nscratch_by>18) then goto scratchagain;
for lp_by:=1 to nscratch_by do
begin
gotoxy(1,6+lp_by);
write('scratching[',lp_by,'] race number(n):');
gotoxy(32,6+lp_by);
read(rscratch_by[lp_by]);
gotoxy(42,6+lp_by);
write('scratching[',lp_by,'] horse number(n):');
gotoxy(75,6+lp_by);
read(hscratch_by[lp_by]);
end;
gotoxy(1,25);
write('input correct(y/n): ');
readln(rvs_ct);
read(ic_ch);
if (ic_ch=chr(110)) then goto scratchagain;
for lp_by:=1 to nscratch_by do
begin
horse_p^[rscratch_by[lp_by],hscratch_by[lp_by],3]:='s';
end;
assign(string30file,hf_ct);
rewrite(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
string30:=horse_p^[lp_by, lp2_by, lp3_by];
write(string30file, string30);
end;
end;
end;
close(string30file);
fname_ct:='';
end;
procedure initdynamicvars;
begin
getmem(rd_p,10*4*sizeof(string40));
getmem(rdn_p,5*sizeof(string40));
getmem(horse_p,10*20*5*sizeof(string40));
getmem(hd_p,10*3*5*sizeof(string40));
end;
procedure freedynamicvars;
begin
freemem(rd_p,10*4*sizeof(string40));
freemem(rdn_p,5*sizeof(string40));
freemem(horse_p,10*20*5*sizeof(string40));
freemem(hd_p,10*3*5*sizeof(string40));
end;
begin
initdynamicvars;
initvars;
menu:
if (hlcheck_by=hlhigh_by-1) then hlcheck_st:='yes'
else hlcheck_st:='no';
textmode(co80);
clrscr;
write('main menu: enter option (max:10r-20h)');
gotoxy(40,1);
write('file:');
gotoxy(45,1);
write(fname_ct);
gotoxy(50,1);
write('rsf:');
gotoxy(54,1);
write(rsf_by);
gotoxy(60,1);
write('asf:');
gotoxy(64,1);
write(hlhigh_by);
gotoxy(70,1);
write('asfok:');
gotoxy(76,1);
write(hlcheck_st);
gotoxy(1,4);
write('(1) enter & record results');
gotoxy(1,6);
write('(2) retrieve meeting & results');
gotoxy(1,8);
write('(3) erase results file');
gotoxy(1,10);
write('(4) delete race comment');
gotoxy(1,12);
write('(5) hi/lo data delete');
gotoxy(1,14);
write('(6) enter scratchings');
gotoxy(1,16);
write('(7) process race');
gotoxy(1,18);
write('(8) exit program');
gotoxy(1,22);
write('selection (n):');
gotoxy(16,22);
read(mv_by);
case mv_by of
1: resultentry;
2: retrievemeet;
3: eraseresult;
4: commentdelete;
5: hldelete;
6: scratchings;
7: processmeet;
8: begin
freedynamicvars;
exit;
end;
else
goto menu;
end;
goto menu;
end.