comp.lang.ada
 help / color / mirror / Atom feed
* GNAT subunit naming
@ 2008-03-14 18:35 xorquewasp
  2008-03-14 19:01 ` Dmitry A. Kazakov
  2008-03-14 20:22 ` Eric Hughes
  0 siblings, 2 replies; 8+ messages in thread
From: xorquewasp @ 2008-03-14 18:35 UTC (permalink / raw)


Hi.

We have these files:

-- hello.ads
package hello_device is
  procedure func1;
  procedure func2;
  procedure func3;
end;

-- hello.adb
package body hello_device is
  procedure func1 is separate;
  procedure func2 is separate;
  procedure func3 is separate;
end;

-- hello_f1.adb
with ada.text_io;

separate(hello_device)

procedure func1 is
begin
  ada.text_io.put("func1");
  ada.text_io.new_line;
end func1;

-- hello_f2.adb
with ada.text_io;

separate(hello_device)

procedure func2 is
begin
  ada.text_io.put("func2");
  ada.text_io.new_line;
end func2;

-- hello_f3.adb
with ada.text_io;

separate(hello_device)

procedure func3 is
begin
  ada.text_io.put("func3");
  ada.text_io.new_line;
end func3;

Now, I can tell GNAT that the files hello.ads and hello.adb
provide the package 'hello_device' just fine with a
couple of Source_File_Name pragmas but I can't seem to
work out how to tell GNAT that hello_f[123].adb provide
the subunits of this package.

Any help would be appreciated.



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

* Re: GNAT subunit naming
  2008-03-14 18:35 GNAT subunit naming xorquewasp
@ 2008-03-14 19:01 ` Dmitry A. Kazakov
  2008-03-14 19:10   ` xorquewasp
  2008-03-14 20:22 ` Eric Hughes
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2008-03-14 19:01 UTC (permalink / raw)


On Fri, 14 Mar 2008 11:35:11 -0700 (PDT), xorquewasp@googlemail.com wrote:

> Hi.
> 
> We have these files:
> 
> -- hello.ads
> package hello_device is
>   procedure func1;
>   procedure func2;
>   procedure func3;
> end;
> 
> -- hello.adb
> package body hello_device is
>   procedure func1 is separate;
>   procedure func2 is separate;
>   procedure func3 is separate;
> end;
> 
> -- hello_f1.adb
> with ada.text_io;
> 
> separate(hello_device)
> 
> procedure func1 is
> begin
>   ada.text_io.put("func1");
>   ada.text_io.new_line;
> end func1;
> 
> -- hello_f2.adb
> with ada.text_io;
> 
> separate(hello_device)
> 
> procedure func2 is
> begin
>   ada.text_io.put("func2");
>   ada.text_io.new_line;
> end func2;
> 
> -- hello_f3.adb
> with ada.text_io;
> 
> separate(hello_device)
> 
> procedure func3 is
> begin
>   ada.text_io.put("func3");
>   ada.text_io.new_line;
> end func3;
> 
> Now, I can tell GNAT that the files hello.ads and hello.adb
> provide the package 'hello_device' just fine with a
> couple of Source_File_Name pragmas but I can't seem to
> work out how to tell GNAT that hello_f[123].adb provide
> the subunits of this package.

hello_device-func1.adb
hello_device-func2.adb
hello_device-func3.adb ?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: GNAT subunit naming
  2008-03-14 19:01 ` Dmitry A. Kazakov
@ 2008-03-14 19:10   ` xorquewasp
  2008-03-14 21:25     ` Jeffrey R. Carter
  0 siblings, 1 reply; 8+ messages in thread
From: xorquewasp @ 2008-03-14 19:10 UTC (permalink / raw)


Dmitry A. Kazakov wrote:
>
> hello_device-func1.adb
> hello_device-func2.adb
> hello_device-func3.adb ?
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Hi.

Those are the files that GNAT looks for by default, yes,
however I would like to know how to tell it to use the
filenames I specify (hello_f1.adb, hello_f2.adb, etc...).

thanks.



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

* Re: GNAT subunit naming
  2008-03-14 18:35 GNAT subunit naming xorquewasp
  2008-03-14 19:01 ` Dmitry A. Kazakov
@ 2008-03-14 20:22 ` Eric Hughes
  2008-03-14 20:34   ` xorquewasp
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Hughes @ 2008-03-14 20:22 UTC (permalink / raw)


See "package Naming" in the GNAT User's Guide.

Eric



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

* Re: GNAT subunit naming
  2008-03-14 20:22 ` Eric Hughes
@ 2008-03-14 20:34   ` xorquewasp
  2008-03-14 22:04     ` Per Sandberg
  0 siblings, 1 reply; 8+ messages in thread
From: xorquewasp @ 2008-03-14 20:34 UTC (permalink / raw)


Eric Hughes wrote:
> See "package Naming" in the GNAT User's Guide.
>
> Eric

Hello.

I assume you mean section 2.4 "Using other file names".
I also assume that I need to use the Subunit_File_Name
parameter to the Source_File_Name pragma. Unfortunately
it seem no matter how I specify the pragma with a
Subunit_File_Name parameter, the compiler rejects it.

What I would like to be able to do is to specify each subunit
filename explicitly:

pragma source_file_name (hello_device,
  subunit_file_name => "hello_f1.adb");
pragma source_file_name (hello_device,
  subunit_file_name => "hello_f2.adb");
pragma source_file_name (hello_device,
  subunit_file_name => "hello_f3.adb");

If I actually try to do this, however, the compiler simply
gives me an "incorrect argument" error.

What is the correct way to specify filenames for subunits?

thanks.



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

* Re: GNAT subunit naming
  2008-03-14 19:10   ` xorquewasp
@ 2008-03-14 21:25     ` Jeffrey R. Carter
  2008-03-14 21:49       ` xorquewasp
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey R. Carter @ 2008-03-14 21:25 UTC (permalink / raw)


xorquewasp@googlemail.com wrote:
> Dmitry A. Kazakov wrote:
>> hello_device-func1.adb
>> hello_device-func2.adb
>> hello_device-func3.adb ?
> 
> Those are the files that GNAT looks for by default, yes,
> however I would like to know how to tell it to use the
> filenames I specify (hello_f1.adb, hello_f2.adb, etc...).

Your subunits are named Hello_Device.Func1 and the like. Those are the names to 
give to pragma Source_File_Name.

-- 
Jeff Carter
"Go and boil your bottoms."
Monty Python & the Holy Grail
01



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

* Re: GNAT subunit naming
  2008-03-14 21:25     ` Jeffrey R. Carter
@ 2008-03-14 21:49       ` xorquewasp
  0 siblings, 0 replies; 8+ messages in thread
From: xorquewasp @ 2008-03-14 21:49 UTC (permalink / raw)


Jeffrey R. Carter wrote:
> xorquewasp@googlemail.com wrote:
> > Dmitry A. Kazakov wrote:
> >> hello_device-func1.adb
> >> hello_device-func2.adb
> >> hello_device-func3.adb ?
> >
> > Those are the files that GNAT looks for by default, yes,
> > however I would like to know how to tell it to use the
> > filenames I specify (hello_f1.adb, hello_f2.adb, etc...).
>
> Your subunits are named Hello_Device.Func1 and the like. Those are the names to
> give to pragma Source_File_Name.

Hi.

Thanks! I have it now. GNAT accepts the following:

pragma source_file_name
  (hello_device, spec_file_name => "hello.ads");
pragma source_file_name
  (hello_device, body_file_name => "hello.adb");

pragma source_file_name
  (hello_device.func1, body_file_name => "hello_f1.adb");
pragma source_file_name
  (hello_device.func2, body_file_name => "hello_f2.adb");
pragma source_file_name
  (hello_device.func3, body_file_name => "hello_f3.adb");

Thanks very much.



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

* Re: GNAT subunit naming
  2008-03-14 20:34   ` xorquewasp
@ 2008-03-14 22:04     ` Per Sandberg
  0 siblings, 0 replies; 8+ messages in thread
From: Per Sandberg @ 2008-03-14 22:04 UTC (permalink / raw)


An advice on the road, breaking the gcc/gnat naming conventions may look 
like a good idea in the beginning but I could guarantee that I will give 
you plenty of headache down the road.
So even if the component I was building contained 100+ files and they 
was stored i a VC system where renaming was a real pain in ass (it takes 
16 hours just for the renaming) I would take that pain front up without 
hesitating instead of having a lot of pain down the road (been there 
done that).

/Per S

xorquewasp@googlemail.com wrote:
> Eric Hughes wrote:
>> See "package Naming" in the GNAT User's Guide.
>>
>> Eric
> 
> Hello.
> 
> I assume you mean section 2.4 "Using other file names".
> I also assume that I need to use the Subunit_File_Name
> parameter to the Source_File_Name pragma. Unfortunately
> it seem no matter how I specify the pragma with a
> Subunit_File_Name parameter, the compiler rejects it.
> 
> What I would like to be able to do is to specify each subunit
> filename explicitly:
> 
> pragma source_file_name (hello_device,
>   subunit_file_name => "hello_f1.adb");
> pragma source_file_name (hello_device,
>   subunit_file_name => "hello_f2.adb");
> pragma source_file_name (hello_device,
>   subunit_file_name => "hello_f3.adb");
> 
> If I actually try to do this, however, the compiler simply
> gives me an "incorrect argument" error.
> 
> What is the correct way to specify filenames for subunits?
> 
> thanks.



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

end of thread, other threads:[~2008-03-14 22:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 18:35 GNAT subunit naming xorquewasp
2008-03-14 19:01 ` Dmitry A. Kazakov
2008-03-14 19:10   ` xorquewasp
2008-03-14 21:25     ` Jeffrey R. Carter
2008-03-14 21:49       ` xorquewasp
2008-03-14 20:22 ` Eric Hughes
2008-03-14 20:34   ` xorquewasp
2008-03-14 22:04     ` Per Sandberg

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