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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,565ddc0e6b80e338,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!r29g2000hsg.googlegroups.com!not-for-mail From: jef.mangelschots@gmail.com Newsgroups: comp.lang.ada Subject: copying data between memory locations Date: Mon, 03 Sep 2007 08:59:28 -0000 Organization: http://groups.google.com Message-ID: <1188809968.217323.145640@r29g2000hsg.googlegroups.com> NNTP-Posting-Host: 71.108.162.75 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1188809968 19420 127.0.0.1 (3 Sep 2007 08:59:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 3 Sep 2007 08:59:28 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: r29g2000hsg.googlegroups.com; posting-host=71.108.162.75; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1668 Date: 2007-09-03T08:59:28+00:00 List-Id: In our current design, we have a package that maintains a list of descriptors of various buffers in the application. We don't want to know their datatypes or how to write data into them. We only want to maintain a physical address of them and use that address to directly write data into these buffers (this data comes out incoming packets over the network). In C, this is very straightforward and use the address as a pointer and simply copy the packet into the memory location. I can't figure out a way to do this in Ada (at least not Ada83). suppose the following: type BUFFER_DETAILS_RECORD is record num_bytes : integer; start_address : system.address; end record; type BUFFER_DETAILS_ARRAY_TYPE is array(1..2) of BUFFER_DETAILS_RECORD; BUFFER_DETAILS : constant BUFFER_DETAILS_ARRAY_TYPE := BUFFER_DETAILS_ARRAY_TYPE'(1 => (num_bytes => 100, start_address => 16#123# ), 1 => (num_bytes => 200, start_address => 16#456# )); procedure insert_block(idx : in integer; num_bytes : in integer; offset : in integer; data : BYTE_ARRAY_TYPE) is begin ??? how do I copy the content of data into the memory pointed to by BUFFER_DETAILS(idx).start_address + offset end;