From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: newbie problem
Date: Mon, 18 May 2009 03:52:47 -0700 (PDT)
Date: 2009-05-18T03:52:47-07:00 [thread overview]
Message-ID: <449a54de-81c8-405b-aae7-5f87b1754c27@n4g2000vba.googlegroups.com> (raw)
In-Reply-To: 4a11370a$0$2868$ba620e4c@news.skynet.be
On May 18, 12:23 pm, Olivier Scalbert <olivier.scalb...@algosyn.com>
wrote:
> sjw wrote:
> > We proposed a (joke) coding standard that the length of a name should
> > be log-base-2 the length of its scope in lines. So I might be quite
> > happy with Output : File_Type; for example. Depends whether you have
> > anything else that might be confused with it.
>
> Hi,
>
> I have reorganized the code a little bit.
>
> ------------------------------------------
> -- audio.ads
> ------------------------------------------
> package audio is
>
> type Amplitude is new Float;
> type Frequency is new Float;
> type Time is new Float;
>
> type Stereo_Amplitude is record
> Left : Amplitude;
> Right: Amplitude;
> end record;
>
> end audio;
>
> ------------------------------------------
> -- audio-als.ads
> ------------------------------------------
> private with Ada.Sequential_Io;
>
> package audio.als is
>
> type File is limited private;
>
> procedure Create (F: out File; File_Name: String);
> procedure Write (F: in File; Sample: Stereo_Amplitude);
> procedure Close (F: out File);
> procedure Get_Min_Max (File_Name: String; Min: out Amplitude; Max: out
> Amplitude);
>
> private
>
> package Stereo_Amplitude.Io is new Ada.Sequential_Io (Stereo_Amplitude);
>
> type File is record
> File_Type: Stereo_Amplitude_Io.File_Type;
> -- perhaps more stuff later
> end record;
>
> end audio.als;
>
> ------------------------------------------
> -- audio-als.adb
> ------------------------------------------
> ...
>
> When I do: gnatmake audio-als.adb, I've got:
>
> gnatmake audio-als.adb
> gcc-4.3 -c audio-als.adb
> audio-als.ads:14:09: child unit allowed only at library level
>
> line 14 is : package Stereo_Amplitude.Io is new Ada.Sequential_Io
> (Stereo_Amplitude);
>
> I must admit that I have no idea on how to solve it ...
Rename it Stereo_Amplitude_IO. (You don't yet have a package named
Stereo_Amplitude, BTW). If you insist on making a package named
Stereo_Amplitude.IO then you must put it at library level, i.e. not
inside another package, like this:
-- stereo_amplitude.ads
package Stereo_Amplitude is
end Stereo_Amplitude;
-- stereo_amplitude-io.ads
with Ada.Sequential_IO
with Audio;
package Stereo_Amplitude.IO is new Ada.Sequential_IO
(Audio.Stereo_Amplitude);
but I fail to see the benefit of this.
--
Ludovic Brenta.
next prev parent reply other threads:[~2009-05-18 10:52 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-13 14:16 newbie problem Olivier Scalbert
2009-05-13 14:54 ` Martin
2009-05-13 15:20 ` Olivier Scalbert
2009-05-13 15:14 ` Adam Beneschan
2009-05-13 15:54 ` Olivier Scalbert
2009-05-13 15:44 ` Ludovic Brenta
2009-05-13 16:03 ` Olivier Scalbert
2009-05-13 18:00 ` Olivier Scalbert
2009-05-13 18:51 ` Martin
2009-05-13 19:45 ` sjw
2009-05-13 19:48 ` Olivier Scalbert
2009-05-14 19:41 ` sjw
2009-05-15 5:02 ` Olivier Scalbert
2009-05-15 8:05 ` Jean-Pierre Rosen
2009-05-18 10:23 ` Olivier Scalbert
2009-05-18 10:48 ` Martin
2009-05-18 10:54 ` Olivier Scalbert
2009-05-18 10:52 ` Ludovic Brenta [this message]
2009-05-18 11:09 ` Olivier Scalbert
2009-05-14 22:39 ` Jeffrey R. Carter
2009-05-14 2:59 ` anon
-- strict thread matches above, loose matches on Subject: below --
1998-12-05 0:00 Graeme Wallace
1998-12-04 0:00 ` Marin David Condic
1998-12-04 0:00 ` Simon Bracken
1998-12-04 0:00 ` Marin David Condic
1998-12-04 0:00 ` Mats Weber
1998-12-05 0:00 ` Matthew Heaney
1998-12-04 0:00 ` David Botton
1998-12-04 0:00 ` Gautier.DeMontmollin
1998-12-05 0:00 ` Matthew Heaney
1998-12-07 0:00 ` Jeff Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox