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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,859116256d0a7bc2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.216.234.135 with SMTP id s7mr973210weq.8.1343789445471; Tue, 31 Jul 2012 19:50:45 -0700 (PDT) Received: by 10.66.77.41 with SMTP id p9mr2858842paw.8.1343789445346; Tue, 31 Jul 2012 19:50:45 -0700 (PDT) Path: q11ni15940136wiw.1!nntp.google.com!7no2008058wig.0!news-out.google.com!p10ni7591933pbh.1!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: basic question on nested packages Date: Sat, 28 Jul 2012 04:01:25 -0500 Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: nma@12000.org NNTP-Posting-Host: 9ii5QNw33OfeoTzEH8w9ug.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 X-Notice: Filtered by postfilter v. 0.8.2 X-Received-Bytes: 3365 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-07-28T04:01:25-05:00 List-Id: On 7/28/2012 12:36 AM, Shark8 wrote: > On Friday, July 27, 2012 11:27:31 PM UTC-6, Nasser M. Abbasi wrote: >> On 7/27/2012 10:22 PM, Nasser M. Abbasi wrote: >> >>> >>> What I think would be better is to have ONE lapack package and >>> with the above packages as nested packages. >> ref (me) >> >> I think may be I need to use 'child packages', not 'nested pacakges', >> but not sure yet. >> >> I am doing a crash course now reading an ada book to learn more >> the difference between these and which one to use.... > > You could likely use nested packages; though child packages will likely be better >for maintainability, but if they're short/simple child packages make good sense. > Yes, this is what I ended up doing. It was easier that I thought. Now the lapack client has this: ---------------------------- with Ada.Text_IO; use Ada.Text_IO; with Interfaces.Fortran; use Interfaces.Fortran; with lapack, lapack.driver; procedure mysolve is A : lapack.Fortran_Real_Matrix (1 .. 3, 1 .. 3) begin lapack.driver.SGESV(...) .... ----------------------- >gnatmake -I../ada mysolve.adb -largs -L/usr/lib/atlas-base/atlas -L/usr/lib/atlas-base/ -lblas -llapack >./mysolve -1.31250E+00 3.50000E+00 1.12500E+00 > done! The only surprise for me, was that I had to WITH the 'driver' which is a child package of the parent lapack package explicitly to use it from the client even though I withed the parent package. I thought, since it is a child package of lapack, then it will be pulled in automatically by just WITH'ing lapack. But no. i.e. I thought by inviting the parent in, the children will come along with the parent and not be left alone outside. No problem. I think now the API is much more clean. I rebuild lapack with this new change and all is well. I think when Lapack binding was made, child packages did not exist yet in Ada? I also removed all the pragma linker options that was hard-coded in the source code. I do not like to see hard-coded values for build in source code. I think all of this belong to Makefile or gpr and not in source code. Making more documentations and diagrams and will update all this on my Ada page soon with a new snapshot tar file in case someone wants to try it. --Nasser