On 1/23/2014 2:18 PM, waldo kitty wrote:
following up on this, how do i pass parameters to doThis and doThat?? do i have
to use an intermediate pre_doThis and pre_doThat which handles the calls from
centralControl and then calls doThis and doThat with the necessary parameters?
type
TProc = Procedure;
procedure doThis(aRecord : somerec;);
begin
addRecord(aRecord);
end;
procedure doThat(outFile : textfile; aRecord : somerec;);
begin
writefile(outFile,aRecord);
end;
procedure pre_doThis;
begin
doThis(theRecord);
end;
procedure pre_doThat;
begin
doThat(oFile,theRecord);
end;
procedure centralControl(var aValue : word; theRecord : somerec; whichProc :
TProc);
begin
case aValue of
0 : begin
whichProc;
end;
1 : begin
if theRecord^.aValue = something then
whichProc;
end;
end;
procedure inputThis;
begin
centralControl(foo,thisRecord,@pre_doThis);
end;
procedure outputThat;
begin
centralControl(foo,thisRecord,@pre_doThat);
end;
--
NOTE: No off-list assistance is given without prior approval.
Please keep mailing list traffic on the list unless
private contact is specifically requested and granted.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal