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

  1. Path: sparky!uunet!mcsun!sun4nl!wtrlnd!contrast!postmaster
  2. From: berend@contrast.wlink.nl (Berend de Boer)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Calling Local Procedures - Problems
  5. Message-ID: <725106656.AA00884@contrast.wlink.nl>
  6. Date: Wed, 23 Dec 1992 08:17:36
  7. Sender: postmaster@contrast.wlink.nl
  8. Lines: 40
  9.  
  10. Jeff Byrne wrote in a message to All:
  11.  
  12.  JB> Procedure TestObj.ForEach (Proc : LocalMethodType);
  13.  JB> Var
  14.  JB>   Count : Integer;
  15.  JB> begin
  16.  JB>   For Count := 1 to 10 do
  17.  JB>     begin
  18.  JB>       Proc (@Test);  { These would be different instances of
  19.  JB> the object }     end;
  20.  JB> end;
  21.  
  22. Hai Jeff,
  23.  
  24. I saw your question had already been answered. But here follows the ForEach
  25. method Borland uses. It should work (although untested): 
  26.  
  27.  
  28. procedure TList.ForEach(Action : pointer);
  29. var
  30.   Count : integer;
  31. begin
  32.   for Count := 1 to 10 do  begin
  33.     asm
  34.       les  di,Test
  35.       push es
  36.       push di
  37.       push word ptr [bp]
  38.       call dword ptr Action
  39.     end;
  40.   end;  { of for Count }
  41. end;
  42.  
  43.  
  44. Groetjes,
  45.  
  46. Berend. (-:
  47. fido: 2:281/527.23
  48. email: berend@contrast.wlink.nl
  49.  
  50.