comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: The Dreaded "Missing Subunits"
Date: Wed, 18 Sep 2002 21:17:44 GMT
Date: 2002-09-18T21:17:44+00:00	[thread overview]
Message-ID: <wccn0qf9evb.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: m34rcqdl6l.fsf@lyon.act-europe.fr

Emmanuel Briot <briot@act-europe.fr> writes:

> Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> 
> > >...Have a look in the documentation at pragma
> > > Source_File_Name, which provides handling for any possible naming scheme you
> > > can conceive.
> > 
> > This is also of course wrong.  The patterns supported by the pragma are
> > fairly limited, but I can "conceive" of many things.  For example, if
> > you want to put all main procedures in files with a certain pattern, it
> > doesn't really work.
> 
> Have a look at the more recent versions of GNAT (I don't know if the full
> support was already in 3.14p or was added later, although I think it was
> already there in 3.14p) for the project files.

I don't know.  Project files are in 3.14p, but I don't know about "full
support".  Please tell us what project files can do.

> Also have a look at pragma Source_File_Name, where you associate a unit name
> with *any* file name you want. There is no notion of naming scheme, since you
> can use a different one for each unit and even for specs and bodies for a given
> unit.

The form of pragma Source_File_Name that lists all the compilation units
and their file names is useless, in my opinion, unless there's an
automatic way to generate them (as you say below).

There is also a form of pragma Source_File_Name that takes a *pattern*,
which is sufficient to make GNAT understand, for example, the Rational
file-naming convention.  That's useful, but as I said, it's not very
general.

For example, I don't think GNAT will allow multiple compilation units in
one file.  That's rarely a good idea, but sometimes useful.  For
example, I would like to put package Ada.Text_IO and the renaming as
Text_IO in the same file.  For another example, small test programs
should usually go all in one file, even when they contain several
compilation units.

> Of course, it used to be a pain to generate these pragma Source_File_Name by
> hand. There is now a tool called gnatname that will scan your source
> directories to generate the pragmas directly.

The gnatname command does not exist in 3.14p.  I would consider this a
good solution only if it's fast enough to run it automatically *every*
time I do a build (e.g. the Makefile would do "gnatname" followed by
"gnatmake").  Is gnatname smart enough to re-scan only those files that
have changed (or have newly been created) since the last time I ran
gnatname?  And to delete whatever information is associated with files I
have deleted (or renamed) since the last time I ran gnatname?  If not,
I suspect it's too slow for large bodies of code.

Anyway, this all seems rather convoluted.  Why can't the
compiler/builder automatically determine which compilation units are in
which files?  Why is a separate tool needed?  And a separate file of
pragmas Source_File_Name to maintain?

Furthermore, none of this mumbo-jumbo would be necessary at all,
if only all Ada compilers agreed on the file naming convention.
(I must admit, that wasn't easy in the days when operating systems
had unreasonable limits on file names (like only one dot, or only 8
characters).  Are those bad-old-days over?)

I also admit that C has it easy in this regard, since it has no proper
notion of "module" separate from source file.

> So any naming scheme is supported, and yes, this is a challenge :-)

- Bob



  reply	other threads:[~2002-09-18 21:17 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12 22:49 The Dreaded "Missing Subunits" Peter Richtmyer
2002-09-13  8:16 ` Peter Amey
2002-09-13  8:51   ` Ada2005 temp solo child (was: " Peter Hermann
2002-09-14  2:33     ` Robert A Duff
2002-09-13  9:24   ` Emmanuel Briot
2002-09-13 20:46     ` Simon Wright
2002-09-14  0:25     ` Chad R. Meiners
2002-09-14  2:53     ` Robert A Duff
2002-09-14 20:20       ` Simon Wright
2002-09-16 13:48         ` Ted Dennison
2002-09-16 16:33           ` Keith Thompson
2002-09-17  2:42             ` Ted Dennison
2002-09-18 20:56           ` Robert A Duff
2002-09-19  8:26             ` Emmanuel Briot
2002-09-19  9:55             ` Preben Randhol
2002-09-19 10:53             ` Marc A. Criley
2002-09-19 11:26             ` Marin David Condic
2002-09-19 21:49             ` Dmitry A.Kazakov
2002-09-19  9:47               ` Preben Randhol
2002-09-20  2:42                 ` Dmitry A.Kazakov
2002-09-19 15:33                   ` Stephen Leake
2002-09-19 15:36                   ` Preben Randhol
2002-09-20 22:31                     ` Dmitry A.Kazakov
2002-09-16 15:10       ` Emmanuel Briot
2002-09-18 21:17         ` Robert A Duff [this message]
2002-09-18 22:41           ` Stephen Leake
2002-09-19  0:00             ` Robert A Duff
2002-09-19  1:39               ` Keith Thompson
2002-09-19 15:19                 ` Stephen Leake
2002-09-19  4:02               ` Larry Kilgallen
2002-09-19 15:24               ` Stephen Leake
2002-09-19 20:34               ` Randy Brukardt
2002-09-19 14:44           ` Peter Richtmyer
2002-09-19 20:25           ` Randy Brukardt
2002-09-13 17:15 ` Mark Johnson
2002-09-13 20:56 ` Stephen Leake
2002-09-13 20:58 ` Simon Wright
2002-09-16 17:28   ` Peter Richtmyer
2002-09-19 20:05     ` Brian Gaffney
  -- strict thread matches above, loose matches on Subject: below --
2002-09-19  1:41 Alexandre E. Kopilovitch
2002-09-19 14:25 ` Peter Hermann
2002-09-19 11:37 Grein, Christoph
2002-09-20  6:03 Grein, Christoph
2002-09-20  7:30 ` Preben Randhol
2002-09-20 14:01   ` Robert A Duff
2002-09-20  9:05 Grein, Christoph
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox