home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!asuvax!ennews!telesys!wierius!witsend!dcs
- Message-ID: <765334d7280868t204@witsend.uucp>
- Date: Tuesday, 22 December 1992 20:08:01 MST
- X-Mailer: TMail version 1.15R
- From: "D. C. Sessions" <dcs@witsend.tnet.com>
- Organization: Nobody but me -- really
- References: <1992Dec21.233611.1711@mp.cs.niu.edu>
- Subject: Re: Calling Local Procedures - Problems
- Newsgroups: comp.lang.pascal
- Distribution: world
- Lines: 31
-
- In <1992Dec21.233611.1711@mp.cs.niu.edu>, jeffbyrn@mp.cs.niu.edu (Jeff Byrne) wrote:
- # I'm having a problem that I hope someone can help me with. I want to
- # have a method that takes an address to a procedure/function and calls
- # that routine with some value. I have tried this a couple ways and have
- # run into problems. It seems that I am having problems because I want the
- # procedure/function to be local to another method. I don't know enough
- # about assembler or the TP calling conventions to write the procedure
- # I need.
-
- Sorry, but you're out of luck. The problem is that the caller, being
- out of the procedure's scope, can't set up the appropriate environment
- for it. Local procedures make assumptions about the stack frames of
- the procedures calling them which are valid only when called in scope.
-
- # I know that it can be done because the ForEach and FirstThat methods in
- # TVISION's TGroup object do this. However, I don't have the source to
- # these units and can't seem to figure it out. I have written a small
- # test program below that illustrates the problem and two attempted
- # solutions. The answer is probably a relativly simple assembler routine,
- # however, I lack knowledge in that area. I would appreciate any ideas.
-
- The object methods you mention work only because they are assembly-
- coded to do magic on the stack frame. As a result, the procedures
- they call get handed the same frame they would if called directly.
- You could do the same, but remember that the caller must be pretty
- simple (such as FirstThat) to work.
-
- --- D. C. Sessions Speaking for myself ---
- --- Note new network address: dcs@witsend.tnet.com ---
- --- Author (and everything else!) of TMail (DOS mail/news shell) ---
-