comp.lang.ada
 help / color / mirror / Atom feed
* Re: Command Line Parameters
       [not found] <m-bartz-1701950936420001@macgalois.ee.memst.edu>
@ 1995-01-17 17:10 ` fewellsj
  1995-01-24  2:42   ` David Weller
       [not found] ` <3fgsin$kc6@info4.rus.uni-stuttgart.de>
  1 sibling, 1 reply; 10+ messages in thread
From: fewellsj @ 1995-01-17 17:10 UTC (permalink / raw)


In article <m-bartz-1701950936420001@macgalois.ee.memst.edu>, m-bartz@memphis.edu (Michael Bartz) writes:
> A very newbie question from a long-time C programmer:
> 
> Can you pass command line arguments to an Ada program?
> 
> How do you do it?
> 
Yes you can pass command line arguments.

How you do it, depends on what system you're using,
but on the vax you can use the pragma command to import a procedure
from the system called LIB$GET_FORRIGN, this allows you to access any
command line parameters passed.

Steve.



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

* Re: C programmer with Newbie question
       [not found]   ` <3fhub3$4gv@Starbase.NeoSoft.COM>
@ 1995-01-18 13:50     ` David O'Brien
       [not found]       ` <D2MB10.33w@world.std.com>
  1995-01-25 23:45       ` Tucker Taft
  0 siblings, 2 replies; 10+ messages in thread
From: David O'Brien @ 1995-01-18 13:50 UTC (permalink / raw)


David Weller (dweller@Starbase.NeoSoft.COM) wrote:
: In article <3fgsin$kc6@info4.rus.uni-stuttgart.de>,
: Peter Hermann <ucaa2385@iris1.csv.ica.uni-stuttgart.de> wrote:
: >Michael Bartz (m-bartz@memphis.edu) wrote:
: >: Can you pass command line arguments to an Ada program?
: >
: >A.15 The Package Command_Line
: >
: >   function Argument_Count return Natural;

: 	equiv to argc

: >   function Argument (Number : in Positive) return String;

: 	equiv to argv[1]..argv[argc]

: >   function Command_Name return String;
: 	
: 	equiv to argv[0]

Correct me if I am wrong, but passing command line parameters is *VERY*
implementation specific (I am assuming Ada83).  I assumed "A.15" is a
reference to appendix A in the ARM.  But, that was not what I found
there.  Could someone please point me to the language (Ada83 or Ada9x)
this applies to and where in the ARM it it.

-- David O'Brien	(dobrien@seas.gwu.edu)



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

* Re: C programmer with Newbie question
       [not found]       ` <D2MB10.33w@world.std.com>
@ 1995-01-19  9:32         ` Peter Hermann
  1995-01-20 16:55           ` Robert Dewar
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Hermann @ 1995-01-19  9:32 UTC (permalink / raw)


Robert A Duff (bobduff@world.std.com) wrote:
: The reference was to Ada 95, not Ada 83.  The correct reference is

Unfortunately, the Ada95-team decided to change the letters of the
appendices/annexes. I ate it but unhappily.
In Ada83 the letters were easy to remember
A for Attributes, B for (Bragmas :-) Pragmas, etc.
In Ada95 you could have R for real-time, D for distributed,
F kept for implementation-dependent (chap13) and so on.
They have preferred other criteria.

--
Peter Hermann  Tel:+49-711-685-3611 Fax:3758 ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27, 70569 Stuttgart Uni Computeranwendungen
Team Ada: "C'mon people let the world begin" (Paul McCartney)



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

* Re: C programmer with Newbie question
  1995-01-19  9:32         ` Peter Hermann
@ 1995-01-20 16:55           ` Robert Dewar
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Dewar @ 1995-01-20 16:55 UTC (permalink / raw)


Peter, there were all sorts of constraints in numbering annexes, including
some formal ISO rules. We discussed this at length. In particular, your
R for real time could not fly unless there were annexes A-Q :-)




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

* Re: C programmer with Newbie question
       [not found] ` <3fgsin$kc6@info4.rus.uni-stuttgart.de>
       [not found]   ` <3fhub3$4gv@Starbase.NeoSoft.COM>
@ 1995-01-23 15:45   ` David Emery
  1995-01-25 23:40   ` Tucker Taft
  2 siblings, 0 replies; 10+ messages in thread
From: David Emery @ 1995-01-23 15:45 UTC (permalink / raw)


A similar package for Ada83 can be found in the ADAR 2.0 components.
			dave
--
--The preceeding opinions do not necessarily reflect the opinions of
--The MITRE Corporation or its sponsors. 
-- "A good plan violently executed -NOW- is better than a perfect plan
--  next week"                                      George Patton
-- "Any damn fool can write a plan.  It's the execution that gets you
--  all screwed up"                              James Hollingsworth
-------------------------------------------------------------------------



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

* Re: Command Line Parameters
  1995-01-17 17:10 ` Command Line Parameters fewellsj
@ 1995-01-24  2:42   ` David Weller
  1995-01-24 16:09     ` Tarjei Jensen
  1995-01-26 12:54     ` Mats Weber
  0 siblings, 2 replies; 10+ messages in thread
From: David Weller @ 1995-01-24  2:42 UTC (permalink / raw)


In article <1995Jan17.171040.8865@vax.sbu.ac.uk>,
 <fewellsj@vax.sbu.ac.uk> wrote:
>In article <m-bartz-1701950936420001@macgalois.ee.memst.edu>, m-bartz@memphis.edu (Michael Bartz) writes:
>> Can you pass command line arguments to an Ada program?
>> 
>Yes you can pass command line arguments.
>
>How you do it, depends on what system you're using,
>but on the vax you can use the pragma command to import a procedure
>from the system called LIB$GET_FORRIGN, 
			^^^^^^^^^^^^^^^

			I've never seen a better Rationale as to why
			Ada 95 has Ada.Command_Line  :-)

-- 
       Frustrated with C/C++, Pascal, Fortran?  Ada95 _might_ be for you!
	  For all sorts of interesting Ada95 tidbits, run the command:
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
	



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

* Re: Command Line Parameters
  1995-01-24  2:42   ` David Weller
@ 1995-01-24 16:09     ` Tarjei Jensen
  1995-01-26 12:54     ` Mats Weber
  1 sibling, 0 replies; 10+ messages in thread
From: Tarjei Jensen @ 1995-01-24 16:09 UTC (permalink / raw)


In article <3g1pf5$s3q@Starbase.NeoSoft.COM> dweller@Starbase.NeoSoft.COM (David Weller) writes:


>		   I've never seen a better Rationale as to why
>		   Ada 95 has Ada.Command_Line  :-)

You should check out the new getopt package that Perl5 comes with. That shows
how a good command line package could have been done. Of course the age old VMS
command line stuff is more advanced (and informal standards are adhered to:
it is very rare to have to worry about how to get out of a VMS program).

The command_line package is better than nothing, but the times are changing.


Greetings,
 
 
--
// Tarjei T. Jensen 
//    tarjeij@ulrik.uio.no       || +47 51 563411
//   Support you local rescue centre: GET LOST!
// Working, but not speaking for the Norwegian Hydrographic Service.



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

* Re: C programmer with Newbie question
       [not found] ` <3fgsin$kc6@info4.rus.uni-stuttgart.de>
       [not found]   ` <3fhub3$4gv@Starbase.NeoSoft.COM>
  1995-01-23 15:45   ` David Emery
@ 1995-01-25 23:40   ` Tucker Taft
  2 siblings, 0 replies; 10+ messages in thread
From: Tucker Taft @ 1995-01-25 23:40 UTC (permalink / raw)


In article <3fgsin$kc6@info4.rus.uni-stuttgart.de>,
Peter Hermann <ucaa2385@iris1.csv.ica.uni-stuttgart.de> wrote:

>Michael Bartz (m-bartz@memphis.edu) wrote:
>: Can you pass command line arguments to an Ada program?
>
>Excerpt from LRM(version5.95) for Ada95 (not Ada83!):

Actually, the excerpt below seems to be from a slightly
older version.  In version 5.95, the type is called
"Exit_Status" and the routine to set it is called 
"Set_Exit_Status".

So "Exit_" should be inserted as indicated below.

>A.15 The Package Command_Line
>
> package Ada.Command_Line is
>   pragma Preelaborate(Command_Line);
>   function Argument_Count return Natural;
>   function Argument (Number : in Positive) return String;
>   function Command_Name return String;
>   type Status is range implementation-defined;
        ^ Exit_
>   Success : constant Status;
                      ^ Exit_
>   Failure : constant Status;
                      ^ Exit_
>   procedure Set_Status (Code : in Status);
                 ^ Exit_           ^ Exit_
> private
>   ... -- not specified by the language
> end Ada.Command_Line;
>
>--
>Peter Hermann  Tel:+49-711-685-3611 Fax:3758 ph@csv.ica.uni-stuttgart.de
>Pfaffenwaldring 27, 70569 Stuttgart Uni Computeranwendungen
>Team Ada: "C'mon people let the world begin" (Paul McCartney)

-Tucker Taft   stt@inmet.com
Intermetrics, Inc.



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

* Re: C programmer with Newbie question
  1995-01-18 13:50     ` C programmer with Newbie question David O'Brien
       [not found]       ` <D2MB10.33w@world.std.com>
@ 1995-01-25 23:45       ` Tucker Taft
  1 sibling, 0 replies; 10+ messages in thread
From: Tucker Taft @ 1995-01-25 23:45 UTC (permalink / raw)


In article <3fj6bh$9a8@cronkite.seas.gwu.edu>,
David O'Brien <dobrien@seas.gwu.edu> wrote:
>David Weller (dweller@Starbase.NeoSoft.COM) wrote:
>: In article <3fgsin$kc6@info4.rus.uni-stuttgart.de>,
>: Peter Hermann <ucaa2385@iris1.csv.ica.uni-stuttgart.de> wrote:
>: >Michael Bartz (m-bartz@memphis.edu) wrote:
>: >: Can you pass command line arguments to an Ada program?
>: >
>: >A.15 The Package Command_Line
>: >
>: >   function Argument_Count return Natural;
>
>: 	equiv to argc

Actually, Argument_Count is equivalent to argc-1.  That is, it is 
a count of "arguments" and does *not* include the command name itself.

>: >   function Argument (Number : in Positive) return String;
>
>: 	equiv to argv[1]..argv[argc]

Actually, Argument(N) for N in 1..Argument_Count is 
equivalent to argv[n] for (n = 1; n < argc; n++)

>: >   function Command_Name return String;
>: 	
>: 	equiv to argv[0]

Right.

> ...
>-- David O'Brien	(dobrien@seas.gwu.edu)

-Tucker Taft   stt@inmet.com
Intermetrics, Inc.
Cambridge, MA  02138



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

* Re: Command Line Parameters
  1995-01-24  2:42   ` David Weller
  1995-01-24 16:09     ` Tarjei Jensen
@ 1995-01-26 12:54     ` Mats Weber
  1 sibling, 0 replies; 10+ messages in thread
From: Mats Weber @ 1995-01-26 12:54 UTC (permalink / raw)


> >How you do it, depends on what system you're using,
> >but on the vax you can use the pragma command to import a procedure
> >from the system called LIB$GET_FORRIGN, 

the correct name is       LIB$Get_Foreign

and you don't need to import the procedure if you use VAX Ada version >=
2.0: it is in the VAX-Ada supplied package Lib and it's full Ada name
Lib.Get_Foreign.

Mats



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

end of thread, other threads:[~1995-01-26 12:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m-bartz-1701950936420001@macgalois.ee.memst.edu>
1995-01-17 17:10 ` Command Line Parameters fewellsj
1995-01-24  2:42   ` David Weller
1995-01-24 16:09     ` Tarjei Jensen
1995-01-26 12:54     ` Mats Weber
     [not found] ` <3fgsin$kc6@info4.rus.uni-stuttgart.de>
     [not found]   ` <3fhub3$4gv@Starbase.NeoSoft.COM>
1995-01-18 13:50     ` C programmer with Newbie question David O'Brien
     [not found]       ` <D2MB10.33w@world.std.com>
1995-01-19  9:32         ` Peter Hermann
1995-01-20 16:55           ` Robert Dewar
1995-01-25 23:45       ` Tucker Taft
1995-01-23 15:45   ` David Emery
1995-01-25 23:40   ` Tucker Taft

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