comp.lang.ada
 help / color / mirror / Atom feed
* How to merge multiple compilation units into a compilation unit.
@ 2015-10-21  7:04 Bo Wang
  2015-10-21  7:23 ` J-P. Rosen
  0 siblings, 1 reply; 6+ messages in thread
From: Bo Wang @ 2015-10-21  7:04 UTC (permalink / raw)


Dear All,

I'm developing an ASIS-based static analysis tool for Ada programs.
I want to merge multiple compilation units into a single compilation unit, or generate an abstract tree file ".adt".
Is there a tool or method for merging them.

Thank you,

Bo Wang.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to merge multiple compilation units into a compilation unit.
  2015-10-21  7:04 How to merge multiple compilation units into a compilation unit Bo Wang
@ 2015-10-21  7:23 ` J-P. Rosen
  2015-10-24  3:18   ` Bo Wang
  0 siblings, 1 reply; 6+ messages in thread
From: J-P. Rosen @ 2015-10-21  7:23 UTC (permalink / raw)


Le 21/10/2015 09:04, Bo Wang a écrit :
> I want to merge multiple compilation units into a single compilation unit,
What do you mean by this? If you have two global package specifications,
they /are/ two compilation units. Even if you put them in the same file,
they still are two compilation units.

Now, some compilers allow you to put several compilation units in the
same file, but not Gnat.

> or generate an abstract tree file ".adt".
See the documentation on ASIS for that, or how to compile "on the fly".

Reading the source of ptree can be useful as a starting point of an ASIS
application (ptree is a small utility provided with AdaControl, much
simpler than AdaControl itself).

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to merge multiple compilation units into a compilation unit.
  2015-10-21  7:23 ` J-P. Rosen
@ 2015-10-24  3:18   ` Bo Wang
  2015-10-24 13:19     ` Jacob Sparre Andersen
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bo Wang @ 2015-10-24  3:18 UTC (permalink / raw)


Dear J-P. Rosen
Thank you for giving me valuable advices.
> > I want to merge multiple compilation units into a single compilation unit,
> What do you mean by this? If you have two global package specifications,
> they /are/ two compilation units. Even if you put them in the same file,
> they still are two compilation units.
Perhaps "merge" is vague. I want to create a new compilation unit that acts as same as the original two compilation units, so that I can use the new compilation unit to replace the original two compilation units. When a target program is small-scaled, I can create the new compilation unit manually, however, for a large target program that has massive compilation units, the manual process is impossible. Does there exist a tool that implements this function automatically.

 
> > or generate an abstract tree file ".adt".
> See the documentation on ASIS for that, or how to compile "on the fly".
> 
> Reading the source of ptree can be useful as a starting point of an ASIS
> application (ptree is a small utility provided with AdaControl, much
> simpler than AdaControl itself).
AdaControl is great. I installed and used it. From the view of manual reference of AdaControl, ptree is process compilation units one by one?
Thank you very much.

Sincerely,
Bo Wang

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to merge multiple compilation units into a compilation unit.
  2015-10-24  3:18   ` Bo Wang
@ 2015-10-24 13:19     ` Jacob Sparre Andersen
  2015-10-24 21:09     ` J-P. Rosen
  2015-10-25  6:34     ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: Jacob Sparre Andersen @ 2015-10-24 13:19 UTC (permalink / raw)


Bo Wang <wangbosky@gmail.com> wrote:

> Perhaps "merge" is vague. I want to create a new compilation unit that
> acts as same as the original two compilation units, so that I can use
> the new compilation unit to replace the original two compilation
> units.

package Combined is
   <one compilation unit>

   <other compilation unit>
end Combined;

Assuming that both the original compilation units are specifications.

Greetings,

Jacob
-- 
»But you have to be a bit wary of a ship that collects
 snowflakes.«                                  -- Diziet Sma


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to merge multiple compilation units into a compilation unit.
  2015-10-24  3:18   ` Bo Wang
  2015-10-24 13:19     ` Jacob Sparre Andersen
@ 2015-10-24 21:09     ` J-P. Rosen
  2015-10-25  6:34     ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: J-P. Rosen @ 2015-10-24 21:09 UTC (permalink / raw)


Le 24/10/2015 05:18, Bo Wang a écrit :
> Perhaps "merge" is vague. I want to create a new compilation unit
> that acts as same as the original two compilation units, so that I
> can use the new compilation unit to replace the original two
> compilation units.
Sorry, but I don't understand what you are trying two do. In Ada, a
"compilation unit" is either a package spec, a package body, a
subprogram... What kind of compilation units are you trying to merge?
And what would be the benefit of doing so?

A landmark of good design is that each package should be strongly
coherent and weakly coupled, i.e. it should correspond to /all/ of /one/
thing. You can't keep this if you merge two packages...

> When a target program is small-scaled, I can
> create the new compilation unit manually, however, for a large target
> program that has massive compilation units, the manual process is
> impossible. Does there exist a tool that implements this function
> automatically.
I doubt it, because I see no point in doing that (or I misunderstood
what you mean by compilation unit, if not in the Ada sense).

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to merge multiple compilation units into a compilation unit.
  2015-10-24  3:18   ` Bo Wang
  2015-10-24 13:19     ` Jacob Sparre Andersen
  2015-10-24 21:09     ` J-P. Rosen
@ 2015-10-25  6:34     ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Leake @ 2015-10-25  6:34 UTC (permalink / raw)


Bo Wang <wangbosky@gmail.com> writes:

> Dear J-P. Rosen
> Thank you for giving me valuable advices.
>> > I want to merge multiple compilation units into a single compilation unit,
>> What do you mean by this? If you have two global package specifications,
>> they /are/ two compilation units. Even if you put them in the same file,
>> they still are two compilation units.
> Perhaps "merge" is vague. I want to create a new compilation unit that
> acts as same as the original two compilation units, so that I can use
> the new compilation unit to replace the original two compilation
> units. 

Are you talking about source code refactoring? Or about loading more
than one compilation unit into an ASIS environment? Or something else?

> When a target program is small-scaled, I can create the new
> compilation unit manually, however, for a large target program that
> has massive compilation units, the manual process is impossible.

If the transformation is literally "impossible" to do manually, then it
is also impossible to do automatically; perhaps you meant "impractical"?

You'll have to give an example of what you are talking about to be clear.

-- 
-- Stephe


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-25  6:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21  7:04 How to merge multiple compilation units into a compilation unit Bo Wang
2015-10-21  7:23 ` J-P. Rosen
2015-10-24  3:18   ` Bo Wang
2015-10-24 13:19     ` Jacob Sparre Andersen
2015-10-24 21:09     ` J-P. Rosen
2015-10-25  6:34     ` Stephen Leake

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