comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier <gautier@fakeaddress.nil>
Subject: Re: Splitting packages  in per-procedure separate files
Date: Sun, 11 Feb 2007 20:29:57 +0100
Date: 2007-02-11T20:29:57+01:00	[thread overview]
Message-ID: <45cf6ecd$1_4@news.bluewin.ch> (raw)
In-Reply-To: <pan.2007.02.11.12.09.37.535113@virgilio.it>

Francesco Bochicchio:

> Maybe the term program was misleading. What I have is an
> application consisting of a dozen different packages. Now the standard
> mandates:
> 
> - one name_package.ads for package public declarations
> - one name_package.adb for package private declarations (including
> separate declarations for all procedures)
> - one name_package-name_procedure.adb for each procedure in the package
> 
> Some of the coders have actually followed the standards, some have not,
> putting all the procedure code inside the name_package.adb file. Now I
> have to split these files ( about half of the packages, so probably 10000
> line of codes, not the 20000 initially stated ).
> 
> This could be done by hand in at most a (very boring) week (but I'd say
> three days could be enough), so I can't spend too much effort in
> automating this task, except for: 
> a) preparing for future similar activities 
> b) having sligtly more fun.
> 
> Thanks to all the posters that answered. 
> 
>  Ciao
> ------
> FB

At least the task of putting your separate procedures into files can be done 
automatically by GNAT. Say I modify (manually or automatically) a package to 
meet the standard you mention (modifications with "**"):

--8<-----------8<-----------8<---sep.txt-8<---------
package A is
   procedure B1;
   procedure B2;
end A;
package body A is
   procedure B1 is separate; -- ** line added **
   procedure B2 is separate; -- ** line added **
end A; -- ** line added **
separate(A) -- ** line added **
   procedure B1 is
   begin
     null;
   end B1;
separate(A) -- ** line added **
   procedure B2 is
   begin
     null;
   end B2;
-- end A; -- ** line commented out **
--8<-----------8<-----------8<-----------8<---------

Then gnatchop will do the following:
gnatchop sep.txt
splitting sep.txt into:
    a.ads
    a.adb
    a~b1.adb
    a~b2.adb

Then, you just need to rename your files with '-' instead of '~'.
HTH
______________________________________________________________
Gautier         -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



  parent reply	other threads:[~2007-02-11 19:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-10 16:23 Splitting packages in per-procedure separate files Francesco Bochicchio
2007-02-10 17:50 ` Stephen Sangwine
2007-02-10 18:36   ` Anh Vo
2007-02-10 19:36   ` Jeffrey R. Carter
2007-02-11 12:09     ` Francesco Bochicchio
2007-02-11 14:08       ` Markus E Leypold
2007-02-11 19:29       ` Gautier [this message]
2007-02-12 10:45       ` Stephen Leake
2007-02-12 18:42         ` Francesco Bochicchio
2007-02-10 18:49 ` Simon Wright
2007-02-11 12:20   ` Francesco Bochicchio
2007-02-12  9:13   ` Jean-Pierre Rosen
2007-02-10 19:33 ` Jeffrey R. Carter
2007-02-11 13:45 ` Jeffrey Creem
replies disabled

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