comp.lang.ada
 help / color / mirror / Atom feed
* a Newbie's question
@ 1999-03-20  0:00 Alon Rotem
  1999-03-21  0:00 ` robert_dewar
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Alon Rotem @ 1999-03-20  0:00 UTC (permalink / raw)


Hi

I am very new to ADA-95, I'm using ADACAPS 2.1, and this is my first
experience with this programming language (I've had C and C++, Delphi,
Visual Basic and some Visual C++, even HTML and javascript).
Since I'm not experienced with ADA-95, My question is going to seem very
trivial to all of you.

I need some direction about basic programming in ADA-95. I know the
theoretical basics of the language (data types, procedures, functions,
packages), my problem is putting it all together.

Which file extensions are to be used?
What's the difference between ADB and ADS ?
What's the relation between the filename and the main procedure's name?
What's the relation between the filename and the package name ?
How can I write a simple program with one main procedure which uses  a
package?
Can I do it all in one file? do I have to split it into files? how?

Where can i get more information about this and example programs?

Thanks a lot

Alon Rotem
alon_rotem@hotmail.com





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

* Re: a Newbie's question
  1999-03-21  0:00 ` Matthew Heaney
@ 1999-03-21  0:00   ` Ehud Lamm
  0 siblings, 0 replies; 7+ messages in thread
From: Ehud Lamm @ 1999-03-21  0:00 UTC (permalink / raw)


On Sun, 21 Mar 1999, Matthew Heaney wrote:

> Alon Rotem <alon_rotem@hotmail.com> writes:
> 
> > I need some direction about basic programming in ADA-95. I know the
> > theoretical basics of the language (data types, procedures, functions,
> > packages), my problem is putting it all together.
> 
> I suggest you study code written by an, um, expert in Ada95.  There are
> examples to be found in the ACM patterns archive.
> 
> <http://www.acm.org/archives/patterns.html>
> 

Matthew's patterns are illuminating, but I would think it is only fair to
warn Ada beginners that not all of them are easy to understand. Some of
the issues causes long threads here, and may only confuse someone just
starting out.

Ehud Lamm     mslamm@pluto.mscc.huji.ac.il






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

* Re: a Newbie's question
  1999-03-20  0:00 a Newbie's question Alon Rotem
  1999-03-21  0:00 ` robert_dewar
@ 1999-03-21  0:00 ` Ehud Lamm
  1999-03-21  0:00 ` Matthew Heaney
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Ehud Lamm @ 1999-03-21  0:00 UTC (permalink / raw)


Since the answers to most of your questions are specific to the compiler
you use (in your case GNAT), it is best you ask your instructor directly.

However, since these are common questions, I'll give a brief answr.

Ada modules are spilt into two parts: specification (often called spec)
and body. The spec specifies the INTERFACE of the module (which can be
subroutine, a package, a task etc.) and the body give the actual
implementation.

In the GNAT env. the extension ADS is used for spec files, and ADB for
body.

Since you are just starting out, my first guess is that you are writing a
program which consists of a "main" and maybe some internal procedures.
This means that the extension to use is ADB.

In this scenario, you code will look like this:

procedure Program_name is

   procedure Internal_Subroutine_Name is
   begin
   end;

   prcoedure Second_Routine is
   begin
   end;

begin -- main
end;

all inside one ADB file. You can not write more than one compilation unit
(come to class to learn what this is!) inside a file.

Hope this help.

Good luck with Ada.

Ehud Lamm     mslamm@pluto.mscc.huji.ac.il





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

* Re: a Newbie's question
  1999-03-20  0:00 a Newbie's question Alon Rotem
@ 1999-03-21  0:00 ` robert_dewar
  1999-03-21  0:00 ` Ehud Lamm
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: robert_dewar @ 1999-03-21  0:00 UTC (permalink / raw)


In article <36F416E2.7D459C4A@hotmail.com>,
  Alon Rotem <alon_rotem@hotmail.com> wrote:
> Which file extensions are to be used?
> What's the difference between ADB and ADS ?
> What's the relation between the filename and the main
>   procedure's name?
> What's the relation between the filename and the package
>   name ?
> How can I write a simple program with one main procedure
>   which uses  a
> package?
> Can I do it all in one file? do I have to split it into
> files? how?
>
> Where can i get more information about this and example
> programs?

For most of the questions above, read the documentation
that comes with your Ada 95 compiler.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: a Newbie's question
  1999-03-20  0:00 a Newbie's question Alon Rotem
  1999-03-21  0:00 ` robert_dewar
  1999-03-21  0:00 ` Ehud Lamm
@ 1999-03-21  0:00 ` Matthew Heaney
  1999-03-21  0:00   ` Ehud Lamm
  1999-03-23  0:00 ` Jonathan Hough
  1999-03-26  0:00 ` Tony Gair
  4 siblings, 1 reply; 7+ messages in thread
From: Matthew Heaney @ 1999-03-21  0:00 UTC (permalink / raw)


Alon Rotem <alon_rotem@hotmail.com> writes:

> I need some direction about basic programming in ADA-95. I know the
> theoretical basics of the language (data types, procedures, functions,
> packages), my problem is putting it all together.

I suggest you study code written by an, um, expert in Ada95.  There are
examples to be found in the ACM patterns archive.

<http://www.acm.org/archives/patterns.html>

You can subscribe to the patterns list by sending a message with the
body

subscribe patterns <your full name>

to the ACM mailing-list server.

<mailto:listserv@acm.org>

I've been converting all the C++ examples in the GoF book to Ada95, and
I'm almost done...


> Which file extensions are to be used?
> What's the difference between ADB and ADS ?
> What's the relation between the filename and the main procedure's name?
> What's the relation between the filename and the package name ?
> How can I write a simple program with one main procedure which uses  a
> package?
> Can I do it all in one file? do I have to split it into files? how?
> 
> Where can i get more information about this and example programs?

The relationship between Ada program units and files isn't defined by
the language.  Read the documentation that comes with your compiler.

There are a couple of no-cost Ada compilers available, from ACT and
Aonix.

<http://www.gnat.com/>
<http://www.aonix.com/>

The articles in the ACM patterns archive come with all the code at the
bottom of the message.  I recommend you install gnatchop (a tool that's
part of the gnat compiler), and use that to separate the code in the
message into separate files.




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

* Re: a Newbie's question
  1999-03-20  0:00 a Newbie's question Alon Rotem
                   ` (2 preceding siblings ...)
  1999-03-21  0:00 ` Matthew Heaney
@ 1999-03-23  0:00 ` Jonathan Hough
  1999-03-26  0:00 ` Tony Gair
  4 siblings, 0 replies; 7+ messages in thread
From: Jonathan Hough @ 1999-03-23  0:00 UTC (permalink / raw)




Alon Rotem wrote:

>
>
> Where can i get more information about this and example programs?
>
>

  HI

I'm a newbie and here are some places I have used for some really good ADA
resources:-

http://burks.bton.ac.uk/burks/language/ada/index.htm

http://stad.dsl.nl/~jvandyk/

hope this helps

cheers

Jon Hough







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

* Re: a Newbie's question
  1999-03-20  0:00 a Newbie's question Alon Rotem
                   ` (3 preceding siblings ...)
  1999-03-23  0:00 ` Jonathan Hough
@ 1999-03-26  0:00 ` Tony Gair
  4 siblings, 0 replies; 7+ messages in thread
From: Tony Gair @ 1999-03-26  0:00 UTC (permalink / raw)


Alon, I'm not being rude but you seriously need a book

Alon Rotem wrote:
> 
> Hi
> 
> I am very new to ADA-95, I'm using ADACAPS 2.1, and this is my first
> experience with this programming language (I've had C and C++, Delphi,
> Visual Basic and some Visual C++, even HTML and javascript).
> Since I'm not experienced with ADA-95, My question is going to seem very
> trivial to all of you.
> 
> I need some direction about basic programming in ADA-95. I know the
> theoretical basics of the language (data types, procedures, functions,
> packages), my problem is putting it all together.
> 
> Which file extensions are to be used?
> What's the difference between ADB and ADS ?
> What's the relation between the filename and the main procedure's name?
> What's the relation between the filename and the package name ?
> How can I write a simple program with one main procedure which uses  a
> package?
> Can I do it all in one file? do I have to split it into files? how?
> 
> Where can i get more information about this and example programs?
> 
> Thanks a lot
> 
> Alon Rotem
> alon_rotem@hotmail.com




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

end of thread, other threads:[~1999-03-26  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-20  0:00 a Newbie's question Alon Rotem
1999-03-21  0:00 ` robert_dewar
1999-03-21  0:00 ` Ehud Lamm
1999-03-21  0:00 ` Matthew Heaney
1999-03-21  0:00   ` Ehud Lamm
1999-03-23  0:00 ` Jonathan Hough
1999-03-26  0:00 ` Tony Gair

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