From: Peter Amey <pna@erlang.praxis.co.uk>
Subject: Re: How to pass commandline parameters to a vax vms ada main prog
Date: 1997/01/23
Date: 1997-01-23T00:00:00+00:00 [thread overview]
Message-ID: <Pine.SUN.3.91.970123121601.327C-100000@erlang.praxis.co.uk> (raw)
In-Reply-To: 32E71F0B.270@dfd.dlr.de
On Thu, 23 Jan 1997, Markus Wolfgart wrote:
> I'm running in a programing problem and can't find a satisfactory
> solution, please help if you know the right anwser.
>
> How to pass comandline parameters to an ada main procedure written
> in vax vms 5.1 ada. Do I need to import the starlet lib ?
>
> thanks for help in advance.
>
> markus
>
Useful fragments follow:
LenCmdLine : constant INTEGER := 255;
subtype TypCmdLineRange is INTEGER range 1..LenCmdLine;
subtype TypCmdLine is STRING (TypCmdLineRange);
with STARLET;
....
procedure ReadCmdLine( CmdLineFound : out BOOLEAN;
CmdLine : out TypCmdLine;
CmdLinePntr : out TypCmdLineRange )
--# derives CmdLine from CmdLine &
--# CmdLinePntr from &
--# CmdLinefound from;
is
--# hide ReadCmdLine
-- FUNCTION :
--
-- Checks if command line supplied, if supplied sets 'CmdLineFound'
True, else
-- sets it False. Reads any supplied command line into the array
'CmdLine' and
-- sets 'CmdLinePntr' to initial value of 1.
--
-- The command line string returned in 'CmdLine' does not include the
program name.
--
-- OPERATION :
--
-- Uses VAX/VMS run time library procedure Lib$Get_Foreign ( which is
documented in
-- the VAX/VMS Runtime Library manual Volume 8B )
Status : COND_VALUE_TYPE;
Found : BOOLEAN;
CmdLineLen : UNSIGNED_WORD;
StsValue : INTEGER;
PrmptFlag : INTEGER;
procedure GetForeign( Status : out COND_VALUE_TYPE;
CmdString : out STRING;
Prompt : in STRING := STRING'NULL_PARAMETER;
OutLen : out UNSIGNED_WORD;
Force : in INTEGER );
pragma interface( VAXRTL, GetForeign );
pragma import_valued_procedure( GetForeign, "LIB$Get_Foreign" );
-- This declaration is mapped to the VAX/VMS RTL function
LIB$Get_Foreign.
-- It reads the programs invoking command line ( if any ) and
returns it
-- in 'CmdString' and the number of characters it contains in 'OutLen'.
-- If 'Force' is set to 1 it prompts with string 'Prompt' if no
command line
-- is supplied. It does not prompt if 'Force' is set to 0. The returned
-- command line does not include the program name. Success of
operation is
-- returned in the function result and should be SS_Normal if
successful.
begin
for Index in TypCmdLineRange loop
CmdLine( Index ) := ' ';
end loop;
PrmptFlag := 0; -- no Prompt if command line is not found
CmdLineLen := 0;
GetForeign( Status, CmdLine, STRING'NULL_PARAMETER, CmdLineLen,
PrmptFlag );
Found := ( CmdLineLen > 0 ) and ( Status = STARLET.SS_Normal ); --
SS$_Normal implies
-- a
successful exit
CmdLinePntr := 1;
if not Found then
for Index in TypCmdLineRange loop
CmdLine( Index ) := ' ';
end loop;
end if;
CmdLineFound := Found;
end ReadCmdLine;
----------------------------------------------------------------------------
Sorry about some of the lie wraps in the above!
regards Peter
next prev parent reply other threads:[~1997-01-23 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-23 0:00 How to pass commandline parameters to a vax vms ada main prog Markus Wolfgart
1997-01-23 0:00 ` Larry Kilgallen
1997-01-23 0:00 ` Peter Amey [this message]
1997-01-24 0:00 ` Ken Garlington
1997-01-25 0:00 ` Larry Kilgallen
1997-01-27 0:00 ` Ken Garlington
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox