From: "David Botton" <David@Botton.com>
Subject: Re: Access to procedures
Date: 1999/06/25
Date: 1999-06-25T13:01:38+00:00 [thread overview]
Message-ID: <7kvuji$1vae$1@news.gate.net> (raw)
In-Reply-To: 37737285.5CF9ED5F@Maths.UniNe.CH
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/
next prev parent reply other threads:[~1999-06-25 0:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-25 0:00 Access to procedures Gautier
1999-06-25 0:00 ` Ted Dennison
1999-06-25 0:00 ` Ehud Lamm
1999-06-25 0:00 ` tmoran
1999-06-26 0:00 ` Gautier
1999-06-26 0:00 ` tmoran
1999-06-27 0:00 ` David Botton
1999-06-27 0:00 ` Brian Rogoff
1999-06-27 0:00 ` tmoran
1999-06-28 0:00 ` Gautier
1999-06-26 0:00 ` Brian Rogoff
1999-06-25 0:00 ` David Botton
1999-06-25 0:00 ` David Botton [this message]
1999-06-26 0:00 ` David C. Hoos, Sr.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox