From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,740e91341085efe3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 08 Apr 2005 19:19:01 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Some help for a C++ guy References: <1113001402.404239.275940@z14g2000cwz.googlegroups.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Fri, 08 Apr 2005 19:19:02 -0500 NNTP-Posting-Host: 67.161.24.234 X-Trace: sv3-zbhgwU/m2Aunt5xC+cSOydWLj2rb+dZrgyYxdtoFHOefcRp2gKhGVRXg1KvBWEQuPRsII9K+FC/IvqH!Rp4SOVCExG0+xKQDvqBUPY/385b7giU5xP5PcYzUwR9PKXboAD5NeVeB65pHEg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.31 Xref: g2news1.google.com comp.lang.ada:10358 Date: 2005-04-08T19:19:02-05:00 List-Id: Why not save pointers to the Handler objects instead of the procedures? You have something like: 1) type BC_Completion_Handler_T is access procedure (Status : in IO_Status_T); ... 2) -- in the routine that does callbacks you have: Saved_Completion_Handler_Ptr : BC_Completion_Handler_T; procedure Register_Message_Callback (msg_id : ... ; Callback_Ptr : BC_Completion_Handler_T) is begin Saved_Completion_Handler_Ptr := Callback_Ptr; end Register_Message_Callback; 3) -- and then in various places therein you have the actual callbacks Saved_Completion_Handler_Ptr.all (Status); change the above to something like: 1) type BC_Completion_Handler_T is access all Handler; ... 2) -- then in the routine that does callbacks you have: Saved_Completion_Handler_Ptr : BC_Completion_Handler_T; procedure Register_Message_Callback (msg_id : ... ; Callback_Ptr : BC_Completion_Handler_T) is begin Saved_Completion_Handler_Ptr := Callback_Ptr; end Register_Message_Callback; 3) -- and then in various places therein you have the actual callbacks Completion_Handler (Saved_Completion_Handler_Ptr, Status); that would require a single point change to (1), and a global replace Saved_Completion_Handler_Ptr.all (Status); => Completion_Handler (Saved_Message_Ptr, Status); Registration of an array of Handler could then be done in a loop. Of course you would also do global replacements BC_Completion_Handler_T => BC_Message_T Saved_Completion_Handler => Saved_Message Callback => To_Callback so as not to confuse readers, leading to: 1) type BC_Message_T is access all Handler; ... 2) -- then in the routine that does callbacks you have: Saved_Message_Ptr : BC_Message_T; procedure Register_Message_To_Callback (msg_id : ... ; To_Callback_Ptr : BC_Message_T) is begin Saved_Message_Ptr := To_Callback_Ptr; end Register_Message_To_Callback; 3) -- and then in various places therein you have the actual callbacks Completion_Handler (Saved_Message_Ptr, Status);