indermau@umn-cs.CS.UMN.EDU (Kurt Indermaur) (12/04/88)
Is this possible? I'd like to pass a pointer to a procedure (with its para- meters, ideally) to another procedure, which would then execute the passed procedure. Something like: procedure execute (proc1 : pointer); begin . . . proc1^; . . . end; Do I have to resort to inline stements, or should I just give up on TP and write it in C? --Kurt Indermaur
brookn@btree.uucp (Paul Francis) (12/06/88)
In article <10316@umn-cs.CS.UMN.EDU> indermau@umn-cs.cs.umn.edu (Kurt Indermaur) writes: > >Is this possible? I'd like to pass a pointer to a procedure (with its para- >meters, ideally) to another procedure, which would then execute the passed >procedure. Something like: > >procedure execute (proc1 : pointer); >begin > . > proc1^; > . >end; Get a copy of Turbo Pascal 5.0 !!!!!! From page 94 of the TP 5.0 reference guide : "Since procedure types are allowed in any context, it is possible to declare procedures or functions that take procedures or functions as parameters." You would use it like this : program test; type call_type : procedure( x, y : integer ); procedure arf( called : call_type ); begin called; end; {$F+} { must be far_call } procedure n1( x, y : integer ); begin ... end; procedure n2( x, y : integer ); begin ... end; {$F-} begin arf( n1 ); arf( n2 ); end. > >Do I have to resort to inline stements, or should I just give up on TP and >write it in C? Give up on pascal !!! are you NUTS !!!!!!! >--Kurt Indermaur -- Paul ( Sicnarf ) Francis backbone!ucsd!btree!brookn "you tried it just for once, found it alright for kicks but now you find out you have a habit that sticks, you're an orgasm addict, you're always at it, and you're an orgasm addict" the Buzzcocks