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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e9f44aef4f5aee18,start X-Google-Attributes: gid103376,public From: Gautier Subject: Access to procedures Date: 1999/06/25 Message-ID: <37737285.5CF9ED5F@Maths.UniNe.CH>#1/1 X-Deja-AN: 493745659 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-06-25T00:00:00+00:00 List-Id: Hello, Reference Manual gurus! I've encountered a stupid but sticky problem by implementing my Unzip-Ada project. In the interactive versions of extract procedures, I pass an access to a feedback procedure for display & interaction. *But* whatever the way I nest and subtype the things, the compiler (GNAT) tells me (certainly with good reasons): "subprogram must not be deeper than access type" even when it doesn't seem depper at all! So, my question is: how to do it ? The code in question is : * in Unzip package spec : type feedback_proc is access procedure ( percents_done: in natural; user_abort: out boolean ); procedure Extract(from : zip_info; what : String; method : out pkzip_method; feedback : feedback_proc ); * in a main program (one of many attempts!) : subtype local_feedback_proc is feedback_proc; procedure My_feedback( percents_done: natural; user_abort: out boolean ) is new_done_dots: natural:= (dots * percents_done) / 100; begin for i in done_dots .. new_done_dots loop Put('.'); end loop; user_abort:= false; end My_feedback; -- My_feedback_access: constant local_feedback_proc:= My_feedback'access; procedure Do_Unzip is begin ... Extract( zi, Argument(i), method, My_feedback_access ); end Do_unzip; NB: a generic solution doesn't seem a solution as some packages, basically non-generic, have to call the feedback procedure; making the whole generic could become heavy. -- Gautier -------- http://members.xoom.com/gdemont/