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,6b93224dbe2bb55b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.224.205.65 with SMTP id fp1mr6752795qab.4.1354583718995; Mon, 03 Dec 2012 17:15:18 -0800 (PST) Received: by 10.49.34.135 with SMTP id z7mr2641174qei.1.1354583718969; Mon, 03 Dec 2012 17:15:18 -0800 (PST) Path: gf5ni47564750qab.0!nntp.google.com!c8no135559qao.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 3 Dec 2012 17:15:18 -0800 (PST) In-Reply-To: <85boebuxtm.fsf@stephe-leake.org> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=201.26.49.235; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 201.26.49.235 References: <3254b304-ed8b-4601-8a3c-ab3df74d84ad@googlegroups.com> <85boebuxtm.fsf@stephe-leake.org> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Return unconstrained types in ZFP From: "Rego, P." Injection-Date: Tue, 04 Dec 2012 01:15:18 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-12-03T17:15:18-08:00 List-Id: > 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, you made a very good suggestion. So I don't need to implement the rt code, at least for now (I'm sure I will miss RAM if I do it now). Thanks! > Is "Size" a maximum here, or is the result expected to be exactly Size > bytes long? At first I would put the Size to set the exact size of the output String_U8, but if the user allocate it first, it fits the idea well. So, I used something like procedure Get (Port : in USART_Port_Type; Data : out String_U8); ... procedure Get (Port : in USART_Port_Type; Data : out String_U8) is begin for Index in 1 .. Data'Length loop Data (Unsigned_8 (Index)) := Get (Port); end loop; exception when others => null; -- no need for this now end Get; Thanks again Stephe, Rolf, Luke and Shark8.