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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:7b45:: with SMTP id m5mr19458836qtu.360.1580177415893; Mon, 27 Jan 2020 18:10:15 -0800 (PST) X-Received: by 2002:aca:6244:: with SMTP id w65mr761031oib.113.1580177415478; Mon, 27 Jan 2020 18:10:15 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no5971843qtd.0!news-out.google.com!w29ni716qtc.0!nntp.google.com!g89no5971840qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 27 Jan 2020 18:10:15 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=76.77.182.20; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.77.182.20 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNATCOLL-Mmap example From: Stephen Leake Injection-Date: Tue, 28 Jan 2020 02:10:15 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57970 Date: 2020-01-27T18:10:15-08:00 List-Id: 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