Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ada compiler question

17 views
Skip to first unread message

Andrew

unread,
Sep 11, 2003, 9:01:25 PM9/11/03
to

I need to write a program in Ada.

I went to a couple of sites that showed the packages that i needed to
download and install. but one of them
gnat-3.13p-8.i386.rpm
when I try to install it , it says there is a conflict with file xxx
from package
gcc-gnat-3.3.1-3.i386.rpm
now unless I'm misreading the 2 packages it sounds like the 2nd one is
just basically an updated version of the 1st one.

1st question: is the 2nd one just an updated version of the 1st one.


2nd question: does anyone here know anything about writing a program in
the language of Ada on a linux o/s. If so what would the command be to
compile the program in linux? I have taken 2 years of programming in
Ada from the local university but it's been several years since I have
written in Ada. And I have never done it under linux. I wrote in a unix
evironment in college. Which is very similar.I remember that I just
have to activate a text editor write the program, and save the file ..
but the command to actually compile the thing eludes me.

RodgerH

unread,
Sep 11, 2003, 9:45:37 PM9/11/03
to
Hey Andrew,

May have found it for you; to list the files belonging to a package:

rpm -ql gcc-gnat

/usr/bin/gnat
/usr/bin/gnatbind
/usr/bin/gnatbl
/usr/bin/gnatchop
/usr/bin/gnatfind
/usr/bin/gnatgcc
/usr/bin/gnatkr
/usr/bin/gnatlink
/usr/bin/gnatls
/usr/bin/gnatmake
/usr/bin/gnatprep
/usr/bin/gnatpsta
/usr/bin/gnatpsys
/usr/bin/gnatxref

Looks to me like "gnatgcc" is the compiler.

If so, how about posting the Ada version of the "Hello World" program
for me to compile. Have never seen or used Ada.

--
Regards,
RodgerH
---
Registered Linux User #285004
---

RodgerH

unread,
Sep 11, 2003, 9:35:48 PM9/11/03
to
I have not used Ada, but it looks like your compiler for Ada on RH9 is
in this package:

$rpm -q gcc-gnat
gcc-gnat-3.2.2-5
$rpm -qi gcc-gnat
Name : gcc-gnat Relocations: (not relocateable)
Version : 3.2.2 Vendor: Red Hat, Inc.
Release : 5 Build Date: Tue 25 Feb 2003
08:53:15 AM EST
Install Date: Tue 27 May 2003 05:01:48 PM EDT Build Host:
stripples.devel.redhat.com
Group : Development/Languages Source RPM: gcc-3.2.2-5.src.rpm
Size : 18312255 License: GPL
Signature : DSA/SHA1, Tue 25 Feb 2003 10:04:21 AM EST, Key ID
219180cddb42a60e
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://gcc.gnu.org
Summary : Ada 95 support for GCC
Description :
GNAT is a GNU Ada 95 front-end to GCC. This package includes development
tools,
the documents and Ada 95 compiler.

$rpm -qi gnat
package gnat is not installed

$cat rh9_cd1 | grep gnat
$cat rh9_cd2 | grep gnat
gcc-gnat-3.2.2-5.i386.rpm
libgnat-3.2.2-5.i386.rpm
$cat rh9_cd3 | grep gnat

If you get file level naming conflicts trying to install a package, then
it appears to be an older or competing package. So if it is not coming
from the RH9 distro CD's, then you should probably not need it.

Try doing some Google searches and see what you come up with on what the
compiler command is.

Andrew

unread,
Sep 15, 2003, 11:15:38 PM9/15/03
to

RodgerH wrote:
> Andrew wrote:
>
>>
>> I need to write a program in Ada.
>>
>> I went to a couple of sites that showed the packages that i needed to
>> download and install. but one of them
>> gnat-3.13p-8.i386.rpm
>> when I try to install it , it says there is a conflict with file xxx
>> from package

<<<Snip>>>

>
> Looks to me like "gnatgcc" is the compiler.
>
> If so, how about posting the Ada version of the "Hello World" program
> for me to compile. Have never seen or used Ada.
>

here is a hello world program

type
emacs hello.adb
in the text editor type


with Ada.Text_Io; use Ada.Text_Io;
procedure Hello is
begin
Put_Line ("Hello, world!");
end Hello;


then save and exit

and type
gnatmake hello.adb
then type
./hello

and that should do it
by the way .. i'm still trying to remember if you need the
"use Ada.Text_Io;"
line, but i do know that it worked on my computer when i did the above
stated commands.

Andrew

unread,
Sep 16, 2003, 12:05:26 AM9/16/03
to

Andrew wrote:
>
>
> RodgerH wrote:
>
>> Andrew wrote:
>>

almost forgot, when you are finished compiling and have ran the hello
world program you will have 5 files in your directory.

-rwxrwxr-x 1 andrew andrew 20530 Sep 15 23:00 hello
-rw-rw-r-- 1 andrew andrew 210 Sep 15 23:00 hello.adb
-rw-rw-r-- 1 andrew andrew 118 Sep 15 22:11 hello.adb~
-rw-rw-r-- 1 andrew andrew 1338 Sep 15 23:00 hello.ali
-rw-rw-r-- 1 andrew andrew 1036 Sep 15 23:00 hello.o

that is copied from my terminal window when I typed ls

you can delete everything except
-rwxrwxr-x 1 andrew andrew 20530 Sep 15 23:00 hello
-rw-rw-r-- 1 andrew andrew 210 Sep 15 23:00 hello.adb

I would suggest keeping the hello.adb file since that is the source
code... *heh*

and the hello file is the executable file, but the other 3 files are
just created as the program is compiled.. I think there might be a way
for you to compile the program and have it clean up the garbage, but I'm
not to sure how to do that.

RodgerH

unread,
Sep 16, 2003, 8:35:58 AM9/16/03
to
Andrew.
Thanks for the demo program, it's my first Ada program.
It looks like Pascal, if i remember, its been 22 years since i had
Pascal in college. I remembered Ada was mentioned (used in military
applications) but i never had it for any class.

Andrew

unread,
Sep 16, 2003, 10:57:47 AM9/16/03
to

Yeah, Ada is used for military apps .. actually when I was taking the
classes in colllege, they told us that 'the' only place that uses the
language is the DOD (Dept. of Defense).
But it's good for certain apps because it's main power is number crunching.

Andrew

unread,
Sep 16, 2003, 11:23:57 AM9/16/03
to

Andrew wrote:
>
> I need to write a program in Ada.
>

ok I've run into a snag .. and i'm hoping that a programmer can help me
out.

here is a copy of my program (written in Ada)

====
-- computes Interest on money invested

with TEXT_IO;
use TEXT_IO;

procedure Interest is
Initialamt : Float;
Interest : Float;
TimeNWeeks : Integer;
DRate : Float;
Days : Integer;
Balance : Float;

package NUMBER_IO is new INTEGER_IO(INTEGER);
use NUMBER_IO;
package Float1_IO is new Float_IO(FLOAT);
use Float1_IO;

begin
New_Line;
Put ("How much money do you have-Please add cents? example 365.22 ");
Get (Initialamt);

Put ("What is the interest you will receive? ");
Get (Interest);

Put ("How long will it be invested in weeks? ");
Get (TimeNWeeks);

New_Line;

Days:=TimeNWeeks * 7;
DRate:=(Interest/100.0)/365.0;
Balance:=Initialamt * (1.0+DRate)**Days;

New_Line;
Put ("Your ending balance will be ");
Put (Balance);

New_Line;
end Interest;


========================================


now here is the output from when I try to run the program

How much money do you have-Please add cents? .02
What is the interest you will receive? 25
How long will it be invested in weeks? 4


Your ending balance will be 2.03872E-02
[andrew@stc program]$ ./interest

How much money do you have-Please add cents? .02
What is the interest you will receive? .25
How long will it be invested in weeks? 4


Your ending balance will be 2.00038E-02

============


now I realize that not many people here program in ada .. and i realize
that this is a linux group not a programming one..

but I'm hoping that this is just a simple case of I .. well *L* I'm
hoping this is a simple error that I'm overlooking..

sub-note : this program is directly copied from a printout of a program
that I wrote in college (and it worked on the colleges computers).

ssal...@gmail.com

unread,
Mar 16, 2014, 10:37:43 PM3/16/14
to
Andrew, ever play baseball at Key in 1976 with the Key Tigers ? if this is you we went to school together.won the city playoffs that year, Troy Miles was our couch, its Sanders.
0 new messages