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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,75ce2ead897158b2,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.172.200 with SMTP id m8mr310226qaz.0.1364500466364; Thu, 28 Mar 2013 12:54:26 -0700 (PDT) X-Received: by 10.49.61.234 with SMTP id t10mr1495235qer.16.1364500466315; Thu, 28 Mar 2013 12:54:26 -0700 (PDT) Path: v17ni9qad.0!nntp.google.com!ca1no15072358qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 28 Mar 2013 12:54:26 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.34; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 149.32.224.34 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0c77e832-e12b-446d-af24-78d77c358f1e@googlegroups.com> Subject: My bug or else regarding Visibility Rules From: Anh Vo Injection-Date: Thu, 28 Mar 2013 19:54:26 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-03-28T12:54:26-07:00 List-Id: For the codes below GNAT complains that In_Index, Buffer, and Out_Index are undefined. However, if I comment out private key word, GNAT is happy. Did I violate Ada syntax rules? Thanks. generic type Element is private; Length : Positive := 1; package Circular_Queue is -- Indicates incorrect usage Queue_Error : Exception; -- Places an item in the queue. procedure Put (Item : Element) with pre => not Queue_Full, Post => (In_Index = In_Index'Old mod Length + 1) and (Buffer(In_Index'Old) = Item) and (for all I in 1 .. Queue_Length'Old => Buffer(I) = Buffer'Old (I)) and (not Queue_Empty); -- Takes an item from the queue. function Get return Element with pre => not Queue_Empty, Post => (Out_Index = Out_Index'Old mod Length + 1) and (Buffer(Out_Index'Old) = Get'Result) and (for all I in 1 .. Queue_Length => Buffer(I) = Buffer'Old (I)) and (not Queue_Full); -- Returns the depth of the queue function Queue_Length return Natural; -- Indicates if the queue is full or not function Queue_Full return Boolean; -- Indicates if the queue is empty or not function Queue_Empty return Boolean; private subtype Index is Positive range 1 .. Length; type Element_Array is array (Index) of Element; Buffer : Element_Array; In_Index : Index := 1; Out_Index : Index := 1; Count: Natural range 0 .. Length := 0; end Circular_Queue;