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,e9caf8720058dd5e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!out01a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!in03.usenetserver.com!news.usenetserver.com!pc03.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: embed accept statement in procedures not possible? References: <1178291081.936739.131740@c35g2000hsg.googlegroups.com> From: Stephen Leake Date: Sat, 05 May 2007 19:54:31 -0400 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:mG8DJVx97jgwl+TBGRTAxgz+dAA= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 1662a463d1940e084460618164 Xref: g2news1.google.com comp.lang.ada:15586 Date: 2007-05-05T19:54:31-04:00 List-Id: Gerd writes: > Hi all, > > I work with GNAT 3.15 on Windows XP. My problem is that I want > structure my program in a way that is not accepted by GNAT, but I > cannot understand why. > > My code (schematic only): > > task t is > entry e; > end t; > > task body t is > procedure p is > begin > accept e; > end p; > begin > p; > end t; > > GNAT tells me: "enclosing body for accept must be a task". But - the > accept in procedure p _is_ in a task. So why is this not allowed? > > My accept statement is a bit longer and needed a few times in > different situations. Therefore I don't want to "copy and paste" this > code directly in the task body. You can make the body of the accept call a shared procedure: task body t is procedure p is begin ...; end p; begin accept e do p; end; ... accept e do p; end; ... end t; > > > Gerd > -- -- Stephe