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 2002:a6b:fc05:: with SMTP id r5mr2949252ioh.6.1551448773536; Fri, 01 Mar 2019 05:59:33 -0800 (PST) X-Received: by 2002:a9d:5c09:: with SMTP id o9mr3496134otk.128.1551448773268; Fri, 01 Mar 2019 05:59:33 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!y22no86382ita.0!news-out.google.com!d79ni192itc.0!nntp.google.com!y42no86191ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 1 Mar 2019 05:59:32 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5 References: <1bb2318a-eb48-450f-908d-a304b92bd74c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to bind this properly, C ** which is an array From: Lucretia Injection-Date: Fri, 01 Mar 2019 13:59:33 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:55738 Date: 2019-03-01T05:59:32-08:00 List-Id: On Friday, 1 March 2019 13:54:32 UTC, bj=C3=B6rn lundin wrote: > On 2019-03-01 14:48, Lucretia wrote: > > Hi, > >=20 > > I'm trying to bind the following struct: > >=20 > > typedef struct mpc_ast_t { > > char *tag; > > char *contents; > > mpc_state_t state; > > int children_num; > > struct mpc_ast_t** children; > > } mpc_ast_t; > >=20 > > I have this: > >=20 > > type ASTs is > > record > > Tag : C.Strings.chars_ptr; > > Contents : C.Strings.chars_ptr; > > State : States; > > Number_Of_Children : C.int; > > Children : System.Address; -- Pointer to a pointer to = an array of ASTs. > > end record with > > Convention =3D> C; > >=20 > > Children needs to be accessed in code as a pointer to a pointer to an a= rray of ASTs. > >=20 > > How do I best bind this thing? It's likely going to have to be converte= d from Address to a particular type using Unchecked_Conversion most likely. > >=20 > > Thanks, > > Luke. > >=20 >=20 > na=C3=AFvly I would have tried something like >=20 > type Ptr_To_Chars_Ptr is access all C.Strings.chars_ptr; >=20 > type ASTs is > record > Tag : C.Strings.chars_ptr; > Contents : C.Strings.chars_ptr; > State : States; > Number_Of_Children : C.int; > Children : Ptr_To_Chars_Ptr; > end record with > Convention =3D> C; But it's not a chars_ptr, it's an ASTs_Ptr_Ptr, effecitvely.