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.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PLING_QUERY autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5ffde75d5ac5a4c2,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Norbert Caspari Newsgroups: comp.lang.ada Subject: how to "put" a binary structure? (newbie question!) Date: Wed, 1 Feb 2006 18:04:43 +0100 Organization: T-Online Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1138813483 00 4213 az5VvW4l1z8SSkDY 060201 17:04:43 X-Complaints-To: usenet-abuse@t-online.de X-ID: SfH53uZUQeegalLdqkNNy35Vfs-PAoik5GuOEeulnFbR7FTc3vEPoy User-Agent: KNode/0.4 Xref: g2news1.google.com comp.lang.ada:2735 Date: 2006-02-01T18:04:43+01:00 List-Id: Dear experts, I like to print the content of a binary bit structure with the put statement but it doesn't work. I'm a newbie to Ada programming and therefore please excuse if my question might be silly or stupid. Maybe I misunderstood something. Here is some test case I tried to compile: --------------------snip-------------------------- with Ada.Text_Io; with Ada.Integer_Text_Io; with Interfaces; use Interfaces; use Ada; procedure Bittest is type Bit_T is (Off, On); for Bit_T use ( Off => 0, On => 1); for Bit_T'Size use 1; type Byte is record Bit0 : Bit_T; Bit1 : Bit_T; Bit2 : Bit_T; Bit3 : Bit_T; Bit4 : Bit_T; Bit5 : Bit_T; Bit6 : Bit_T; Bit7 : Bit_T; end record; for Byte'Size use 8; pragma Pack(Byte); -- the whole structure should fit in one byte package Byte_Io is new Text_Io.Integer_Io(Byte => Unsigned_8); --^^^^^^^^^ -- This does not work, why??? Xxx.Bit0 := off; Xxx.Bit1 := on; Xxx.Bit2 := off; Xxx.Bit3 := off; Xxx.Bit4 := on; Xxx.Bit5 := on; Xxx.Bit6 := off; Xxx.Bit7 := off; -- and of course this does not work too because the declaration -- of the child package above failed. Byte_IO.Put(Xxx.Bit0, Width=>1, Base=>2); -- Is it possible to print the whole content of a record structure with one -- put statement? end Bittest; -------------------------snap---------------------- The compiler says missing actual for instantiation of "Num" instantiation abandoned How can I correct the source code to print the values stored in the structure Xxx? Is it possible, to print the whole content of Xxx with just one put statement? Or alternatively how can I assign the content of Xxx to another variable of the type Unsigned_8 that I can use for output? Or is there maybe another way? Questions over questions ;-) Anyway, thanks a lot in advance for your help. Best regards, Norbert