home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7654 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  2.2 KB

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