comp.lang.ada
 help / color / mirror / Atom feed
From: Shawn Barber <SbarberNOcqSPAM@snet.net>
Subject: Re: Sequential_IO
Date: 1999/08/19
Date: 1999-08-19T00:00:00+00:00	[thread overview]
Message-ID: <11f733ec.81e1abff@usw-ex0102-014.remarq.com> (raw)
In-Reply-To: 0a0133f8.48529b21@usw-ex0102-014.remarq.com

Ok, I forgot this last time. I'm working on NT4 with the 
GNAT3.11p compiler. Here are the peices of code which apply 
to this problem:

   procedure Get_Command_Line_Parameters (
      
------------------------------------------------------------
---
      -- The purpose of this procedure is to get the command       
--
      -- line parameters.                                          
--
      
------------------------------------------------------------
---
      NVM_File_Name   :    out string  ;
      NVM_Name_Length :    out natural ;
      Memory_Address  :    out string  ;
      DBG_File_Name   :    out string  ;
      DBG_Name_Length :    out natural ) is
   
      -- Command Line Argument Number of the NVM file name.
   NVM_Argument            : constant natural := 1 ;
      
      -- Command Line Argument Number of the Memory Address 
argument.
   Memory_Address_Argument : constant natural := 2 ;
   
      -- Command line Argument Number of the DBG file name.
   DBG_Argument            : constant natural := 3 ;
      
      -- Holds the number of command line arguments which
      -- were suplied at run-time.
   Number_Of_Arguments   : natural ;
   
   begin

         -- Get the total number of Command Line Arguments 
supplied.
      Number_Of_Arguments := command_line.argument_count ;

         -- If there are not exactly 2 Arguments then the 
argument list is
         -- invalid.
      if Number_Of_Arguments < 2  or Number_Of_Arguments > 3 
then

            -- Incorrect number of arguments enters at the 
command prompt.
         raise Invalid_Arguments ;
      
      end if ;

         -- Calculate the length of NVM_File_Name.
      NVM_Name_Length := command_line.argument ( 
NVM_Argument )'last ;
         
         -- Get the File Name from the Argument list.
      Fixed.Move
         ( Source => command_line.argument ( NVM_Argument ) 
,
           Target => NVM_File_Name                          
) ;
         
         -- Get the starting memory address from the 
argument list.
      Fixed.Move
         ( Source => command_line.argument ( 
Memory_Address_Argument ) ,
           Target => Memory_Address                                    
) ;

      if Number_Of_Arguments = 3 then

            -- Calculate the length of DBG_File_Name.
         DBG_Name_Length := command_line.argument ( 
DBG_Argument )'last ;

            -- Get the File Name from the Argument list.
         Fixed.Move
            ( Source => command_line.argument ( DBG_Argument 
) ,
              Target => DBG_File_Name                          
) ;

      else

            -- Set the DBG File name length to the default.
         DBG_Name_Length := 11 ;
            
            -- Set the DBG File name to the default.
         Fixed.Move
            ( Source => "DEFAULT.DBG" ,
              Target => DBG_File_Name ) ;

      end if;

   end Get_Command_Line_Parameters ;

-----------------------------------------------------------
      -- Get the parameters entered on the command line.
   Get_Command_Line_Parameters
      ( NVM_File_Name    => NVM_Input_File_Name  ,
        NVM_Name_Length  => Length_Of_NVM_Name   ,
        Memory_Address   => Memory_Start_Address ,
        DBG_File_Name    => DBG_Output_File_Name ,
        DBG_Name_Length  => Length_Of_DBG_Name   ) ;

      -- Open the output file.
   text_io.create
      ( File => Output_File           ,
        Mode => text_io.out_file      ,
        Name => DBG_Output_File_Name  ) ;
        
      -- Redirect output.
   text_io.set_output ( File => Output_File ) ;

      -- Open the source file.
   One_Word_IO.Open
      ( File => Input_File           ,
        Mode => One_Word_IO.In_File  ,
        Name => NVM_Input_File_Name  ) ;
        
-----------------------------------------------------------
The first piece of code get the command line parameters. The 
second has the call to the get parameters procedure then the 
create, redirection and open. One_Word_IO is an 
instansiation of Sequential_IO. I've checked the filename 
after being passed back from the get parameters procedure. I 
hope this helps clear something up. Thanks.

Shawn

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!





  parent reply	other threads:[~1999-08-19  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-18  0:00 Sequential_IO Shawn Barber
1999-08-18  0:00 ` Sequential_IO Marin David Condic
1999-08-18  0:00 ` Sequential_IO Ted Dennison
1999-08-18  0:00 ` Sequential_IO Larry Kilgallen
1999-08-19  0:00 ` Shawn Barber [this message]
1999-08-19  0:00   ` Sequential_IO David C. Hoos, Sr.
1999-08-19  0:00   ` Sequential_IO Ted Dennison
1999-08-19  0:00   ` Sequential_IO Marin David Condic
1999-08-19  0:00 ` Sequential_IO Tucker Taft
1999-08-19  0:00   ` Sequential_IO Marin David Condic
1999-08-19  0:00   ` Sequential_IO Ted Dennison
1999-08-19  0:00     ` Sequential_IO Robert Dewar
1999-08-21  0:00     ` Sequential_IO Simon Wright
replies disabled

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