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=-0.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,4ea0c01838520df4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-25 03:17:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!deine.net!freenix!enst!enst.fr!not-for-mail From: Erik Sigra Newsgroups: comp.lang.ada Subject: Re: Read booleans from streams Date: Mon, 25 Mar 2002 12:21:09 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 1017055022 50984 137.194.161.2 (25 Mar 2002 11:17:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 25 Mar 2002 11:17:02 +0000 (UTC) Return-Path: X-Mailer: KMail [version 1.3.2] In-Reply-To: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: sigra@home.se List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:21638 Date: 2002-03-25T12:21:09+01:00 m�ndagen den 25 mars 2002 04.57 skrev du: > I think the problem is in the read procedure. It sees an array of 8 > elements, so wants to read 8 bytes. I think you need a 'Read wrapper to > read a single byte (type Byte is mod 2**8), and then do an > Unchecked_Conversion: > > function To_Boolean_Aggregate is new > Ada.Unchecked_Conversion(Byte,Boolean_Aggregate); > > procedure Read_Boolean_Aggregate > (Stream : Stream_Access; Data : in out Boolean_Aggregate) is > > Item : Byte; > begin > Byte'Read (Stream, Item); > Data := To_Boolean_Aggregate (Item); > end Read_Boolean_Aggregate; > > ... > > while not End_Of_File (File_Type) loop > Read_Boolean_Aggregate (Stream, Data); > > ... > end loop; Thanks, it works! The only problem is that it seems impossible to state "for Boolean_Aggregate'Read use Boolean_Aggregate_Read;".