VMAN%PACEVM.BITNET@uga.cc.uga.edu ( cliff brenner) (02/07/91)
i just what to thank everyone who has written to help me figure out
how to pass a procedure name as a parameter for a procedure. my difficulty
was trying to pass, along with the procedure name, parameters for that
procedure. for anyone else who is interested, here is a sample program:
program procpas1 (output);
type string = packed array(.1..5.) of char;
var word: string;
procedure ab ( procedure x(name: string); token: string;
i: integer);
var n: integer;
begin
for n := 1 to i do x(token);
end;
procedure yz (name: string);
begin
writeln (' hello ',name,' ...')
end;
begin
word := 'cliff';
ab(yz,word,3);
writeln;
yz(word)
end.
notice the syntactical difference between the call to procedure yz from
within procedure ab, and its direct invocation two statements later. i
had never encountered this kind of flexibilty in pascal definitions
before. granted, the above code is pretty trivial, but i'm working
on a syntax analyzer where this kind of parameter passing would be
mighty handy. thanks again, all.