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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,10dba3294c1a2195 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: New to ada95: porting Date: 2000/02/29 Message-ID: <8uLu4.15698$yt2.371252@nnrp3-w.snfc21.pbi.net>#1/1 X-Deja-AN: 591223054 References: <38BB6D88.84BBF5BF@mindspring.com> X-Complaints-To: abuse@pacbell.net X-Trace: nnrp3-w.snfc21.pbi.net 951813124 206.170.2.49 (Tue, 29 Feb 2000 00:32:04 PST) Organization: SBC Internet Services NNTP-Posting-Date: Tue, 29 Feb 2000 00:32:04 PST Newsgroups: comp.lang.ada Date: 2000-02-29T00:00:00+00:00 List-Id: >type NSV is array(positive range <>) of ordinal >type NSVP is access NSV; >type NI is record > id : positive > h : NSVP; >end record; >type HSV is array(positive range <>) of NI >type HSVP is access HSV; > >This is used in an ada routine that calls a c routine. currently >the c routine allocates the memory (including two different >types of dope vectors) and loads the structure and returns >it as a pointer, so when the ada code receives its value >for the inout arg of HSVP it thinks the unconstrained >array parts are "normal" ada unconstrained arrays. So you have something like function In_C return HSVP; pragma import(C, In_C, "InC"); and after calling it you can run the code: and you can run the code P : HSVP := In_C; begin for i in P.all'range loop Ada.Text_IO.Put_Line("id" & integer'image(P.all(i).id)); for j in P.all(i).h.all'range loop Ada.Text_IO.Put_Line(ordinal'image(P.all(i).h.all(j))); end loop; end loop; and it works? If the dope vector stuff as built by your C code does not match what your (new) Ada compiler wants, you'll have to either change the C to make something that does match, or else change the Ada spec to match what the C code generates. Have you decided on the latter? In which case the problem seems to be "how do I specify in Ada 95 a data structure that matches the thing returned by In_C", possibly ignoring some dope vector info while, for instance, using other parts as discriminants to specify array sizes. Or do you instead wish to leave the old Ada specs alone, but change the C code to build the data structures those specs now lead to? What did the old (publicly specified) dope vectors look like? Do you have a lot of similar structures, or is the HSVP one a worst case?