comp.lang.ada
 help / color / mirror / Atom feed
* Access to procedures
@ 1999-06-25  0:00 Gautier
  1999-06-25  0:00 ` Ehud Lamm
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Gautier @ 1999-06-25  0:00 UTC (permalink / raw)


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/




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1999-06-28  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-25  0:00 Access to procedures Gautier
1999-06-25  0:00 ` Ehud Lamm
1999-06-25  0:00 ` David Botton
1999-06-25  0:00 ` Ted Dennison
1999-06-25  0:00 ` tmoran
1999-06-26  0:00   ` Gautier
1999-06-26  0:00     ` Brian Rogoff
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-25  0:00 ` David Botton
1999-06-26  0:00 ` David C. Hoos, Sr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox