From: "Nasser M. Abbasi" <nma@12000.org>
Subject: Re: basic question on nested packages
Date: Sat, 28 Jul 2012 04:01:25 -0500
Date: 2012-07-28T04:01:25-05:00 [thread overview]
Message-ID: <jv09pe$d9a$1@speranza.aioe.org> (raw)
In-Reply-To: fe9b2dea-c076-4cec-8b42-2ee6ff56569e@googlegroups.com
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
next prev parent reply other threads:[~2012-08-01 2:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-28 3:22 basic question on nested packages Nasser M. Abbasi
2012-07-28 5:27 ` Nasser M. Abbasi
2012-07-28 5:36 ` Shark8
2012-07-28 9:01 ` Nasser M. Abbasi [this message]
2012-07-28 9:53 ` AdaMagica
2012-07-28 12:54 ` J-P. Rosen
2012-07-28 12:19 ` Niklas Holsti
2012-07-28 12:52 ` Nasser M. Abbasi
2012-07-28 13:34 ` Niklas Holsti
2012-07-29 1:19 ` Nasser M. Abbasi
2012-07-29 23:05 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox