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 X-Google-Attributes: gid103376,public From: "David Botton" Subject: Re: Access to procedures Date: 1999/06/25 Message-ID: <7kvuji$1vae$1@news.gate.net>#1/1 X-Deja-AN: 493759095 References: <37737285.5CF9ED5F@Maths.UniNe.CH> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 X-Complaints-To: abuse@gate.net X-Trace: news.gate.net 930315698 64846 199.227.189.131 (25 Jun 1999 13:01:38 GMT) Organization: CyberGate, Inc. NNTP-Posting-Date: 25 Jun 1999 13:01:38 GMT Newsgroups: comp.lang.ada Date: 1999-06-25T13:01:38+00:00 List-Id: You could also move your main's My_feedback procedure to library level and that would solve the problem. David Botton Gautier wrote in message <37737285.5CF9ED5F@Maths.UniNe.CH>... >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/