comp.lang.ada
 help / color / mirror / Atom feed
* Spawn()
@ 1998-09-20  0:00 Thomas Preymesser
  1998-09-20  0:00 ` Spawn() dewarr
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Preymesser @ 1998-09-20  0:00 UTC (permalink / raw)


Hi.

Can someone show me an example how to use the procedure "Spawn" in gnat?
I'm a little bit confused with these access-types.

-Thomas


-- 
-- tp@odn.de
-- Thomas_Preymesser@n.maus.de
-- http://www.geocities.com/Hollywood/3033/
-- +49-911-811957
-- +49-172-8111959





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

* Re: Spawn()
  1998-09-20  0:00 Spawn() Thomas Preymesser
@ 1998-09-20  0:00 ` dewarr
  1998-09-26  0:00   ` Spawn() Thomas Preymesser
  0 siblings, 1 reply; 4+ messages in thread
From: dewarr @ 1998-09-20  0:00 UTC (permalink / raw)


In article <B229FC4896684F827@194.45.232.5>,
  t.preymesser@msn.sub.org (Thomas Preymesser) wrote:
> Hi.
>
> Can someone show me an example how to use the procedure
> "Spawn" in gnat?
> I'm a little bit confused with these access-types.

The documentation on how to use such routines is always
found in the package specification in the corresponding
g-xxx.ads file (use gnatkr to find the file name):

   type Argument_List is array (Positive range <>) of String_Access;
   --  Type used for argument list in call to Spawn. The lower bound
   --  of the array should be 1, and the length of the array indicates
   --  the number of arguments.

   type Argument_List_Access is access all Argument_List;
   --  Type used to return an Argument_List without dragging in secondary
   --  stack.

   procedure Spawn
     (Program_Name : String;
      Args         : Argument_List;
      Success      : out Boolean);
   --  The first parameter of function Spawn is the full path name of the
   --  executable. The second parameter contains the arguments to be passed
   --  to the program. Success is false if the program could not be spawned
   --  or its execution completed unsuccessfully. Note that the caller will
   --  be blocked until the execution of the spawned program is complete.

Rather than give an example, which then is likely to get
copied without real understanding, why not ask a specific
question as to what is unclear in the above. The above
documentation *should* be all that an Ada programmer needs
to call Spawn, so the important thing is to fill in the
missing knowledge. You mention that you are confused with
"all those access types", but, assuming you basically know
what an access type *is*, it is not easy to guess exactly
what is confusing you.

The more precisely you can formulate your question, the
more accurate an answer can be given.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

* Re: Spawn()
  1998-09-20  0:00 ` Spawn() dewarr
@ 1998-09-26  0:00   ` Thomas Preymesser
  1998-09-27  0:00     ` Spawn() dewarr
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Preymesser @ 1998-09-26  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2197 bytes --]

On Sun, 20 Sep 1998 11:41:56 GMT, dewarr@my-dejanews.com wrote:

Hi.

>In article <B229FC4896684F827@194.45.232.5>,
>  t.preymesser@msn.sub.org (Thomas Preymesser) wrote:
>> Hi.
>>
>> Can someone show me an example how to use the procedure
>> "Spawn" in gnat?
>> I'm a little bit confused with these access-types.
>
>The documentation on how to use such routines is always
>found in the package specification in the corresponding
>g-xxx.ads file (use gnatkr to find the file name):
>
>   type Argument_List is array (Positive range <>) of String_Access;
>   --  Type used for argument list in call to Spawn. The lower bound
>   --  of the array should be 1, and the length of the array indicates
>   --  the number of arguments.
>
>   type Argument_List_Access is access all Argument_List;
>   --  Type used to return an Argument_List without dragging in secondary
>   --  stack.
>
>   procedure Spawn
>     (Program_Name : String;
>      Args         : Argument_List;
>      Success      : out Boolean);
>   --  The first parameter of function Spawn is the full path name of the
>   --  executable. The second parameter contains the arguments to be passed
>   --  to the program. Success is false if the program could not be spawned
>   --  or its execution completed unsuccessfully. Note that the caller will
>   --  be blocked until the execution of the spawned program is complete.

yes, i have read these specs but they don't describe how to use the
procedures - they describe the function of a procedure/function and
the types of the parameters.
 
>Rather than give an example, which then is likely to get
>copied without real understanding, why not ask a specific
>question as to what is unclear in the above.

OK, how can i convert a list of Parameters of type string to a
variable of type Parameter_List?

What�s the problem with giving an example for a specific
function-call? Nearly all man-pages of C-functions shows an example of
how to use the function?  

> The above
>documentation *should* be all that an Ada programmer needs
>to call Spawn,

Sure, but i am an experienced C programmer, not an experienced Ada
programmer who knows all aspects of the Ada language. 

-Thomas





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

* Re: Spawn()
  1998-09-26  0:00   ` Spawn() Thomas Preymesser
@ 1998-09-27  0:00     ` dewarr
  0 siblings, 0 replies; 4+ messages in thread
From: dewarr @ 1998-09-27  0:00 UTC (permalink / raw)


In article <360cf12c.25420365@news.nuernberg.odn.de>,
  tp@odn.de (Thomas Preymesser) wrote:
> Sure, but i am an experienced C programmer, not an experienced Ada
> programmer who knows all aspects of the Ada language.
>
> -Thomas

Actually if you are an experienced C programmer, then this should be very
easy to understand because that means that you know the standard C calling
sequence. One way incidentally to further understand these thin bindings,
especially if you know C, is to look at the source code for the
implementation, which is a very direct interface to the corresponding C
routines. In particular the form of the arguments is identical to that passed
to C.

As for the question of how to break a string up into arguments, that is a
reasonable question of how to do string processing in Ada, but has nothing
to do with Spawn per se, and would not even appear in an example of how
to use Spawn.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

end of thread, other threads:[~1998-09-27  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-20  0:00 Spawn() Thomas Preymesser
1998-09-20  0:00 ` Spawn() dewarr
1998-09-26  0:00   ` Spawn() Thomas Preymesser
1998-09-27  0:00     ` Spawn() dewarr

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