From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Return unconstrained types in ZFP
Date: Mon, 03 Dec 2012 07:25:41 -0500
Date: 2012-12-03T07:25:41-05:00 [thread overview]
Message-ID: <85boebuxtm.fsf@stephe-leake.org> (raw)
In-Reply-To: 3254b304-ed8b-4601-8a3c-ab3df74d84ad@googlegroups.com
"Rego, P." <pvrego@gmail.com> writes:
> I am trying to implement, for an ATmega2560 (Arduino Mega) micro-controller using ZFP in GNAT-AVR, an USART unconstrained Get string like
> function Get (Port : USART_Port_Type; Size : Unsigned_8) return
> String_U8;
Is "Size" a maximum here, or is the result expected to be exactly Size
bytes long?
Another alternative is to use a procedure:
procedure Get
(Port : in USART_Port_Type;
Data : out String_U8;
Data_Last : out Unsigned_8);
Then the user must allocate space for Data:
declare
Data : String_U8 (1 .. Size);
Data_Last : Unsigned_8;
begin
Get (Port, Data, Data_Last);
... use Data
end;
This way, you don't need to implement the runtime code.
It is more of a burden for the user, but that's the point of ZFP; it's
easier to implement, harder to use.
--
-- Stephe
next prev parent reply other threads:[~2012-12-03 12:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-02 2:38 Return unconstrained types in ZFP Rego, P.
2012-12-02 3:29 ` Shark8
2012-12-04 1:08 ` Rego, P.
2012-12-02 18:13 ` Luke A. Guest
2012-12-04 0:59 ` Rego, P.
2012-12-02 18:27 ` rrr.eee.27
2012-12-04 0:54 ` Rego, P.
2012-12-03 12:25 ` Stephen Leake [this message]
2012-12-04 1:15 ` Rego, P.
2012-12-04 8:40 ` Stephen Leake
2012-12-04 13:21 ` Britt
2012-12-05 3:34 ` Stephen Leake
2012-12-05 13:48 ` Britt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox