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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7e490a18b9688bd9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.49.166 with SMTP id v6mr330666pbn.34.1316157742892; Fri, 16 Sep 2011 00:22:22 -0700 (PDT) Path: m9ni7339pbd.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Stream_Element_Array Date: Fri, 16 Sep 2011 09:22:22 +0200 Organization: cbb software GmbH Message-ID: <1ha21cmm4ub0x.1x5tkefenjm53$.dlg@40tude.net> References: <1e6rw4vto3ldb.i8d7fxixapx4.dlg@40tude.net> <28u4e86fk8gn$.ialexttobgr0$.dlg@40tude.net> <276b8d0a-5b3c-4559-a275-98620657cc2f@s30g2000pri.googlegroups.com> <01c12338-e9f8-49ab-863d-c8282be3875e@g31g2000yqh.googlegroups.com> <1esmml9qftomp.vihelaijmcar$.dlg@40tude.net> <02671fc7-5c38-42dc-8017-529f6dead8fd@j19g2000yqc.googlegroups.com> <631f3859-8118-4f4c-a684-152ee5f589bf@o15g2000vbe.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:17987 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: 2011-09-16T09:22:22+02:00 List-Id: On Thu, 15 Sep 2011 17:18:28 -0700 (PDT), Adam Beneschan wrote: > On Sep 15, 2:42�pm, Simon Wright wrote: >> � �Write (Interfaces.Unsigned_8 (Interfaces.Shift_Right (V, 8))); >> � �Write (Interfaces.Unsigned_8 (V and 16#FF#)); > > Would it be useful to add a 'Stream_Element_Order attribute to the > language (somewhat analogous to 'Stream_Size) that would allow a > programmer to specify, via an aspect clause or attribute definition > clause, whether values of a given elementary type are read/written > with the most or least significant byte first? Not much. Apart from the point that S'Write is not a proper way to handle protocols, a more pragmatic reason is that many protocols (I can remember at least 2 or 3) don't have a fixed endianness. E.g. you, as a master, establish a connection to the slave, the slave during handshaking or by other means tells you which format it wishes to deploy, i.e. "Motorola" or "Intel" etc. The master, you, have to adapt on the fly. This is admittedly idiotic, but very common nevertheless. As for S'Write, in particular note that most of the underlying transports, upon which the stream would operate, are packet-oriented. RS232 is a dying minority. So you would really wish to send outgoing logical packets whole, in order to allow the lower levels to handle them as whole physical packets. As an example, consider TCP/IP. If you wanted to make TCP_NO_DELAY option working, you would have to respect packet boundaries. I.e. the right way to handle stream protocols is to use Write (S, Packet) instead. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de