comp.lang.ada
 help / color / mirror / Atom feed
* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found] <81734679-bcfc-4d52-b5c2-104f0d75b592@i12g2000prg.googlegroups.com>
@ 2009-11-04 19:27 ` Hibou57 (Yannick Duchêne)
       [not found] ` <40fef45f-7203-47f1-8aae-7f0bdd23ea94@u36g2000prn.googlegroups.com>
       [not found] ` <687d5205-3e93-4b10-8d5d-e31d20e19e08@2g2000prl.googlegroups.com>
  2 siblings, 0 replies; 10+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-11-04 19:27 UTC (permalink / raw)


On 4 nov, 19:53, ChristopherL <clusard...@aol.com> wrote:
> How would you go about compiling your code?

You are talking about “ files ” (not package) : what are
responsibilities for this project ?
As a developer ? As a manager ?
And what kind of code is it ? Any tricky implementation or
dependencies ?
Ada is notably portable, so unless the code relies on some specific
pragma or suspicious assumption about the compiler behavior, there
should not be any trouble.

Well, just to give an advice (as we finally do not know a lot), it
seems that elaboration order is a common trap while switching from one
compiler to another (this is not a compiler trouble then, but mostly a
design trouble).

But I guess linking may also be an issue, if multiple parts of the one
application are to be compiled by different compilers.

Does it help ? Did I understood what you were asking about ?




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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
@ 2009-11-04 19:32 Hibou57 (Yannick Duchêne)
  2009-11-05 10:26 ` Stephen Leake
  0 siblings, 1 reply; 10+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-11-04 19:32 UTC (permalink / raw)


On 4 nov, 20:27, ChristopherL <clusard...@aol.com> wrote:
> So, how can I combine all the files together into 1060 files and
> compile them with both compilers. I.E.: Take the bundle of 10060
> files and compile them with compiler A, and do the same for
> compiler B.
>
> What are the various tricks of the trade, and could you supply
> small examples segnents of code to demonstrate.
>
> Thanks

Please, tell : you first suggested that one subset is to be compiled
with one compiler, and the remaining subset with another compiler, and
the latter quote, suggest that all the set is be compiled with one
compiler and then the same with another compiler.

Which is the one to be applied : the first way or the second way ?



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found]     ` <7b8ca66e-ca6d-44ea-bad9-35b44bb8425a@12g2000pri.googlegroups.com>
@ 2009-11-04 20:10       ` Jeffrey R. Carter
  2009-11-11 20:51         ` sjw
  0 siblings, 1 reply; 10+ messages in thread
From: Jeffrey R. Carter @ 2009-11-04 20:10 UTC (permalink / raw)


ChristopherL wrote:
> On Nov 4, 11:31 am, ChristopherL <clusard...@aol.com> wrote:

[The same post 4 times.]

It would be nice if your posts didn't show up multiple times.

-- 
Jeff Carter
"The time has come to act, and act fast. I'm leaving."
Blazing Saddles
36



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found] ` <687d5205-3e93-4b10-8d5d-e31d20e19e08@2g2000prl.googlegroups.com>
@ 2009-11-05 10:02   ` Niklas Holsti
       [not found]     ` <b813c43f-5973-43ee-aa79-9fb90d6d077c@r24g2000prf.googlegroups.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Niklas Holsti @ 2009-11-05 10:02 UTC (permalink / raw)


ChristopherL wrote:
> On Nov 4, 10:53 am, ChristopherL <clusard...@aol.com> wrote:
>> Hello,
>>
>> In about a year, I will be presented with the task of making the same
>> large program compilable with two very different Ada compilers.
>>
>> Sorry, I do not know the names of the compilers or computers that I'll
>> be working with. The decision has not been reached at this time. The
>> manufacturer support on one or both of these compilers may be almost
>> non-existant.
>>
>> How would you go about compiling your code?
>>
>> Thanks
> 
> O'kay, I have some additional information to add!
> 
> I will know what files to use to compile with each compiler. In other
> words, I will be told this program (group of files) compiles on this
> computer using this compiler, and I will be told the same thing for
> the second compiler/computer. Again, they will be compiling the same
> program with minor differences between them. The differences are in
> about 30 files. So, basically there are two groups of 30 files. Each
> compiler will use the program with different a different set of 30
> files.
> There are about 1000 files in the entire program. So compiler A will
> compile 1030 files and compiler B will compile 1000 files plus
> different 30 files. The 30 files are required to compile with compiler
> A, and a different set of 30 files are required to compile the 1000
> files with compiler B.

You are still not making your question or problem clear, in Ada terms. 
To get reasonable answers you should explain what all these "files" have 
to do with the desired functionality of the program on one or another 
computer.

So you have a computer A with compiler A, and a computer B with compiler 
B. The Ada program consists of 1000 "files" (presumably Ada package 
declarations and package bodies) that are the same for system A and for 
system B. The complete program for system A consists of these 1000 
shared files, plus 30 files specific to system A. The complete program 
for system B consists of the same 1000 shared files, and 30 other files 
specific to system B. The core question is *why* you have 30 different 
files for systems A and B:

- Are they simply different versions of the same Ada packages, one 
version tailored for system A, the other for system B, but implementing 
the same functionality? Tailoring could be necessary for compiler 
differences, O/S differences, or computer differences.

- Or do they represent different functionality, so that the complete 
program on system A behaves differently from the complete program on 
system B? For example, the program on system A may have some added 
functionality that is absent from the program on system B, and vice 
versa. Do you now want to combine the two so that all functionality 
exists on both systems?

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
  2009-11-04 19:32 Hibou57 (Yannick Duchêne)
@ 2009-11-05 10:26 ` Stephen Leake
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Leake @ 2009-11-05 10:26 UTC (permalink / raw)


"Hibou57 (Yannick Duch�ne)" <yannick_duchene@yahoo.fr> writes:

> On 4 nov, 20:27, ChristopherL <clusard...@aol.com> wrote:
>> So, how can I combine all the files together into 1060 files and
>> compile them with both compilers. I.E.: Take the bundle of 10060
>> files and compile them with compiler A, and do the same for
>> compiler B.

This is compiler dependent. You need to read the compiler
documentation; it will tell you how to specify what files to compile.

In general, keeping the two different sets of 30 files in separate
directories will help.

-- 
-- Stephe



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found]     ` <b813c43f-5973-43ee-aa79-9fb90d6d077c@r24g2000prf.googlegroups.com>
@ 2009-11-05 15:31       ` Georg Bauhaus
       [not found]         ` <1dac1c79-6cfe-46da-a5cf-7b0dd4b95775@z4g2000prh.googlegroups.com>
  2009-11-05 19:04       ` Jeffrey R. Carter
  1 sibling, 1 reply; 10+ messages in thread
From: Georg Bauhaus @ 2009-11-05 15:31 UTC (permalink / raw)


ChristopherL schrieb:
> On Nov 5, 2:02 am, Niklas Holsti <niklas.hol...@tidorum.invalid>
> wrote:
>> - Are they simply different versions of the same Ada packages, one
>> version tailored for system A, the other for system B, but implementing
>> the same functionality? Tailoring could be necessary for compiler
>> differences, O/S differences, or computer differences.
> 
> They are different versions of the same Ada packages, one version
> tailored
> for system A, the other for system B, but implementing the same
> functionality.
> 
> Query: Is there some way I can combine the two sets of 30 files into
> one set of
> 30 files.
> 
> Or, is it best to just forget trying to combine these two sets of 30
> files in some way. And, just manually compile the appropriate set of
> 30 files on what ever system I am working on. Does anyone have any
> ideas.

I'm not sure I understand what you mean by combine.
Manual work seems unneccessary, and maybe the whole
combination approach is not really the best option:
Would it be OK to perform the distinction by system
at run-time, e.g. during program setup by setting
some pointers or by running main loops in instances
of suitable generic instances?

If not, it was suggested to use directories, and instruct
the respective compilers to look for the respective
30 files in these directories.  Assuming you
have the typical set of spec files, body files, and
some files containing full subprograms.  A directory
setup might look like this:

/1000+-common/
/1000+-common/30-system-A
/1000+-common/30-system-B

Is this something you have in mind:
Package Foo specifies functions for both systems A and B,
but the bodies are different for systems A and B.
I'd put the spec file of package Foo in /1000+-common.
Body files go in the ./30-system-{A,B} subdirectories.
Then I tell the compiler X for system A to look in /1000+-common
and in /1000+-common/30-system-A.
I tell the compiler Y for system B to look in /1000+-common
and in /1000+-common/30-system-B.
The compiler will find specs in the directory of common files,
and bodies either in the subdirectory 30-system-A or 30-system-B,
as specified.
If compiler X should compily for system B, too, I'd say
that in the same way, for another run. And similarly for
compiler Y for system A.



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found]           ` <4fbfba1f-65ac-43d5-8328-61dcf075a1b1@13g2000prl.googlegroups.com>
@ 2009-11-05 18:21             ` Georg Bauhaus
  0 siblings, 0 replies; 10+ messages in thread
From: Georg Bauhaus @ 2009-11-05 18:21 UTC (permalink / raw)


ChristopherL schrieb:
> Does Ada have anything similar to the following C preprocessor
> directives:
> 
> #ifdef TABLE_SIZE
> --Add Code Here
> #elif TABLE_SIZE < 50
> --Add Code Here
> #endif
> 

I had hesitated to mention a preprocessor.  You can use
M4, or cpp.  However, dead code elimination is another
option, stays within the language and insofar seems more
manageable (cases don't get lost accross units
when they are in types, not #conditionals, for example.)

(To seems more manageable to me at least, I have lost hair
in missing #else, missing code, missing test cases, and
similar features of conditional program text.
The separate directories solution (as long as the number
of decisions is small) is no less checkable, and, I think,
no more prone to errors than placing the code between
preprocessor conditionals.)

Small example that reduces the need for conditional
text to one constant.  It can be replaced using
a preprocessor (or script or human) that needs not
support conditionals.  Dead code elimination may work:

package Control is

   type Capacity is range 1 .. 8_000;

   type Table_Size is (Small, Big);
   for Table_Size use (Small => 10, Big => 1000);
   for Table_Size'Size use Capacity'Size;

   Mode : constant Table_Size := Small;  -- <- adjust per system




   procedure Start;

end Control;

with Interfaces;
with Ada.Unchecked_Conversion;
package body Control  is

   function To_Capacity is new Ada.Unchecked_Conversion
     (Table_Size, Capacity);

   package Small_System is
      procedure Run;
   private
      Last : constant Capacity := To_Capacity (Small);
      Data_Store : array (Capacity range 1 .. Last) of Interfaces.Unsigned_8;
   end Small_System;

   package Big_System is
      procedure Run;
   private
      Last : constant Capacity := To_Capacity (Big);
      Data_Store : array (Capacity range 1 .. Last) of Interfaces.Unsigned_8;
      -- ... other differences
   end Big_System;


   procedure Start is
   begin
      case Mode is
         when Small =>
             Small_System.Run;
         when Big =>
            Big_System.Run;
      end case;
   end;

   package body Small_System is separate;
   package body Big_System is separate;
end Control;



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found]     ` <b813c43f-5973-43ee-aa79-9fb90d6d077c@r24g2000prf.googlegroups.com>
  2009-11-05 15:31       ` Georg Bauhaus
@ 2009-11-05 19:04       ` Jeffrey R. Carter
       [not found]         ` <74d8ae6e-a5f6-4add-b08f-6760c8d3d182@12g2000pri.googlegroups.com>
  1 sibling, 1 reply; 10+ messages in thread
From: Jeffrey R. Carter @ 2009-11-05 19:04 UTC (permalink / raw)


ChristopherL wrote:
> 
> They are different versions of the same Ada packages, one version
> tailored
> for system A, the other for system B, but implementing the same
> functionality.

We need to know what it is about these packages that results in you having 
different versions for the 2 compilers. Some things that differ between 
compilers can be handled in a single package; others require that you have 
different bodies for the different compilers.

-- 
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
       [not found]         ` <74d8ae6e-a5f6-4add-b08f-6760c8d3d182@12g2000pri.googlegroups.com>
@ 2009-11-07  5:59           ` Stephen Leake
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Leake @ 2009-11-07  5:59 UTC (permalink / raw)


ChristopherL <clusardi2k@aol.com> writes:

> On Nov 5, 11:04�am, "Jeffrey R. Carter"
> <spam.jrcarter....@spam.acm.org> wrote:
>> ChristopherL wrote:
>>
>> > They are different versions of the same Ada packages, one version
>> > tailored
>> > for system A, the other for system B, but implementing the same
>> > functionality.
>>
>> We need to know what it is about these packages that results in you having
>> different versions for the 2 compilers. Some things that differ between
>> compilers can be handled in a single package; others require that you have
>> different bodies for the different compilers.
>>
>
> One requires renaming routines, some of the pragmas to be removed, and
> some of the overloaded operators to be removed.

The general approach to this is to use separate files in separate
directories, and use compiler-specific techniques to select the right
directory at compile time.

This is easy with GNAT project files; other compilers have other ways
to do it.

-- 
-- Stephe



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

* Re: Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers
  2009-11-04 20:10       ` Jeffrey R. Carter
@ 2009-11-11 20:51         ` sjw
  0 siblings, 0 replies; 10+ messages in thread
From: sjw @ 2009-11-11 20:51 UTC (permalink / raw)


On Nov 4, 8:10 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:
> ChristopherL wrote:
> > On Nov 4, 11:31 am, ChristopherL <clusard...@aol.com> wrote:
>
> [The same post 4 times.]
>
> It would be nice if your posts didn't show up multiple times.

As a person who uses Google Groups, it would be nice if
<clusard...@aol.com>'s posts showed up at all! I never see them.



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

end of thread, other threads:[~2009-11-11 20:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <81734679-bcfc-4d52-b5c2-104f0d75b592@i12g2000prg.googlegroups.com>
2009-11-04 19:27 ` Tricks Of The Trade: How To Compile Large Program On Two Very Different Compilers Hibou57 (Yannick Duchêne)
     [not found] ` <40fef45f-7203-47f1-8aae-7f0bdd23ea94@u36g2000prn.googlegroups.com>
     [not found]   ` <95a354e8-385b-4175-b5cd-d59598764750@w37g2000prg.googlegroups.com>
     [not found]     ` <7b8ca66e-ca6d-44ea-bad9-35b44bb8425a@12g2000pri.googlegroups.com>
2009-11-04 20:10       ` Jeffrey R. Carter
2009-11-11 20:51         ` sjw
     [not found] ` <687d5205-3e93-4b10-8d5d-e31d20e19e08@2g2000prl.googlegroups.com>
2009-11-05 10:02   ` Niklas Holsti
     [not found]     ` <b813c43f-5973-43ee-aa79-9fb90d6d077c@r24g2000prf.googlegroups.com>
2009-11-05 15:31       ` Georg Bauhaus
     [not found]         ` <1dac1c79-6cfe-46da-a5cf-7b0dd4b95775@z4g2000prh.googlegroups.com>
     [not found]           ` <4fbfba1f-65ac-43d5-8328-61dcf075a1b1@13g2000prl.googlegroups.com>
2009-11-05 18:21             ` Georg Bauhaus
2009-11-05 19:04       ` Jeffrey R. Carter
     [not found]         ` <74d8ae6e-a5f6-4add-b08f-6760c8d3d182@12g2000pri.googlegroups.com>
2009-11-07  5:59           ` Stephen Leake
2009-11-04 19:32 Hibou57 (Yannick Duchêne)
2009-11-05 10:26 ` Stephen Leake

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