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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.90.67 with SMTP id d43mr41638673yhf.36.1381875588541; Tue, 15 Oct 2013 15:19:48 -0700 (PDT) X-Received: by 10.50.83.6 with SMTP id m6mr122674igy.1.1381875588501; Tue, 15 Oct 2013 15:19:48 -0700 (PDT) Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!backlog3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.85.216.87.MISMATCH!o2no7080641qas.0!news-out.google.com!9ni40949qaf.0!nntp.google.com!o2no7080639qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 15 Oct 2013 15:19:47 -0700 (PDT) In-Reply-To: <9ee842b6-b053-4f4e-94df-66459ec1fb7c@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=97.123.228.141; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 97.123.228.141 References: <9ee842b6-b053-4f4e-94df-66459ec1fb7c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6d603161-46a4-4d3a-a5b9-0babb9887619@googlegroups.com> Subject: Re: Passing a String to a C/C++ Subprogram (Special Case) From: Shark8 Injection-Date: Tue, 15 Oct 2013 22:19:48 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 3511 Xref: number.nntp.dca.giganews.com comp.lang.ada:183627 Date: 2013-10-15T15:19:47-07:00 List-Id: On Tuesday, October 15, 2013 3:13:09 PM UTC-6, Eryndlia Mavourneen wrote: > On Tuesday, October 15, 2013 3:59:21 PM UTC-5, Jeffrey Carter wrote: >=20 > > On 10/15/2013 12:54 PM, Eryndlia Mavourneen wrote: >=20 > >=20 >=20 > > > . . . >=20 > >=20 >=20 > > If I were doing this, I would wrap each in an Ada subprogram that ensur= es the=20 >=20 > > String will be passed correctly to C. Ultimately it will be less effort= . >=20 > >=20 >=20 >=20 >=20 > Thanks, Jeff. This could be a good way to manage things. Unfortunately,= I can not guarantee that I can perform a trim operation or that the last c= haracter is indeed not being used (for the placement of a nul). I suppose = I could create the wrapper, as you said, and copy the String (1 .. size) to= a String (1 .. size + 1) and place a nul in the last character of the targ= et string. Of course, this does not add a lot of overhead for short string= s, but it is a hard real-time system. >=20 >=20 >=20 > It sounds as if I need to get with my people and get a further, clear con= sensus about how this stuff is going to be used, in reality. >=20 >=20 >=20 > -- Eryndlia Mavourneen (KK1T) Could you use an Ada 2012 subtype predicate? something like: Type Transport_String is array (1..31) of Character with Default_Component_Value =3D> ASCII.NUL, Dynamic_Predicate =3D> Transport_String(Transport_String'Last) =3D = ASCII.NUL; Actually I'm rather disappointed that there aren't static_predicates availa= ble for Arrays. I had hoped to, in my OpenGL binding, have something like t= he following available for the vector operations: Type RGBA is (Red, Blue, Green, Alpha);=20 Subtype RGB is RGBA range Red..Blue; =20 -- Declare the general Vector-type for OprnGL which has vectors -- of three or four components of RGBA [A being optional], always -- starting with R. Type Float_Vector is array(RGBA range <>) of Float with Static_Predicate =3D> Float_Vector'First =3D Red;