comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: GNATCOLL-Mmap example
Date: Mon, 27 Jan 2020 18:10:15 -0800 (PST)
Date: 2020-01-27T18:10:15-08:00	[thread overview]
Message-ID: <e033495c-ab52-45df-a62e-c8bbaf29f3fa@googlegroups.com> (raw)
In-Reply-To: <a97a7b9a-48b5-4741-927c-a8ac2b44c80b@googlegroups.com>

On Saturday, January 25, 2020 at 1:52:45 PM UTC-8, Bob Goddard wrote:
> Does anyone have a small GNATCOLL-Mmap example that I can use on Linux. Just can't see what to do and the "example" in the source  just doesn't work.

The full code for my usage is complex. Distilling it down, it becomes something like:

declare
   use GNATCOLL.Mmap;
   File : Mapped_File := Open_Read (file_name);
   Region : Mapped_Region := Read (File);
   Buffer : Str_Access := Data (region);
begin
  --  use Buffer as a string, but there are no bounds, so be careful.
end;

> I need to map the RPi's GPIO memory addresses so that I can do what I need to do.

I doubt Mmap is what you want; that is for mapping disk files to memory. To treat a memory address as a string, just use unchecked_conversion to gnatcoll.mmap.str_access, or something similar (remember a real String has bounds, but this doesn't).

--  Stephe


  reply	other threads:[~2020-01-28  2:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25 21:52 GNATCOLL-Mmap example Bob Goddard
2020-01-28  2:10 ` Stephen Leake [this message]
2020-01-28  5:59   ` J-P. Rosen
2020-01-28  8:25 ` Dmitry A. Kazakov
2020-01-28 18:53   ` Bob Goddard
2020-01-28 20:07     ` Dmitry A. Kazakov
2020-01-28 20:17       ` Bob Goddard
2020-01-29  8:19         ` Dmitry A. Kazakov
2020-01-29 21:56           ` Bob Goddard
2020-01-30  2:45             ` Dennis Lee Bieber
2020-01-31 16:59     ` Björn Lundin
2020-01-28 19:11   ` Philip Munts
2020-01-28 20:15     ` Dmitry A. Kazakov
2020-01-28 20:18     ` Philip Munts
2020-01-28 22:06       ` Bob Goddard
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox