|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 11264 (0x2c00)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, generic, package Command_Line_Interface, seg_030b0f
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with String_Lists;
use String_Lists;
with String_Pkg;
use String_Pkg;
--------------------------------------------------------------------
package Command_Line_Interface is
--| Provides primitives for getting at the command line arguments.
--| Overview
--| This package provides a universal and portable interface to
--| the arguments typed on a command line when a program is invoked.
--| Each command line argument is either a Word (sequence of non-blank
--| characters) or a quoted string, with embedded quotes doubled.
--|
--| Both named and positional arguments may be given on the command
--| line. However, once a named parameter is used, all the subseqent
--| parameters on the command line must be named parameters. For example,
--| the commands
--|-
--| compile abc pqr xyz library => plib
--| compile abc,pqr,unit=>xyz,library=>plib
--|+
--| have one named argument and three positional arguments. This
--| package separates the named parameters from the positional
--| parameters, ignores spaces around the "bound to" (=>) symbol, and
--| allows parameters to be separated by either spaces or commas,
--| so these command lines are indistinguishable.
--|
--| At program elaboration time, the command line string is automatically
--| obtained from the host operating system and parsed into
--| individual arguments. The following operations may then be used:
--|-
--| Named_arg_count()\x09\x09Returns number of named arguments entered
--| Positional_arg_count()\x09Returns number of positional arguments
--| Positional_arg_value(N)\x09Returns the Nth positional argument
--| Named_arg_value(Name, Dflt)\x09Returns value of a named argument
--| Arguments()\x09\x09\x09Returns the entire command line
--|+
----------------------------------------------------------------
Max_Args : constant := 255;
--| Maximum number of command line arguments (arbitrary).
subtype Argument_Count is Integer range 0 .. Max_Args;
--| For number of arguments
subtype Argument_Index is Argument_Count range 1 .. Argument_Count'Last;
--| Used to number the command line arguments.
No_Arg : exception;
--| Raised when request made for nonexistent argument
Missing_Positional_Arg : exception;
--| Raised when command line is missing positional argument (A,,B)
Invalid_Named_Association : exception;
--| Raised when command line is missing named argument value (output=> ,A,B)
Unreferenced_Named_Arg : exception;
--| Raised when not all named parameters have been retrieved
Invalid_Parameter_Order : exception;
--| Raised when a positional parameter occurs after a named parameter
-- in the command line
--Invalid_Aggregate : exception;
--| Raised when an aggregate does not begin and end with parentheses
-- in Parse_Aggregate.
Unbalanced_Parentheses : exception;
--| Raised when the number of left paren's does not match the number
--| of right paren's.
Invalid_Parameter : exception;
--| Raised when the conversion of a string to a parameter type is not
--| possible.
----------------------------------------------------------------
procedure Initialize (Tool_Name : in String);
--| Initializes command_line_interface
--| N/A: modifies, errors, raises
---------------------------------------------------------------------
function Named_Arg_Count --| Return number of named arguments
return Argument_Count;
--| N/A: modifies, errors, raises
function Positional_Arg_Count --| Return number of positional arguments
return Argument_Count;
--| N/A: modifies, errors, raises
----------------------------------------------------------------
function Positional_Arg_Value
( --| Return an argument value
N : Argument_Index --| Position of desired argument
) return String; --| Raises: no_arg
--| Effects: Return the Nth argument. If there is no argument at
--| position N, no_arg is raised.
--| N/A: modifies, errors
function Positional_Arg_Value
( --| Return an argument value
N :
Argument_Index --| Position of desired argument
) return String_Type; --| Raises: no_arg
--| Effects: Return the Nth argument. If there is no argument at
--| position N, no_arg is raised.
--| N/A: modifies, errors
--------------------------------------------------------------------
function Named_Arg_Value (--| Return a named argument value
Name : String;
Default : String) return String;
--| Effects: Return the value associated with Name on the command
--| line. If there was none, return Default.
--| N/A: modifies, errors
function Named_Arg_Value (--| Return a named argument value
Name : String;
Default : String) return String_Type;
--| Effects: Return the value associated with Name on the command
--| line. If there was none, return Default.
--| N/A: modifies, errors
function Named_Arg_Value (--| Return a named argument value
Name : String;
Default : String_Type) return String_Type;
--| Effects: Return the value associated with Name on the command
--| line. If there was none, return Default.
--| N/A: modifies, errors
----------------------------------------------------------------
function Arguments --| Return the entire argument string
return String;
--| Effects: Return the entire command line, except for the name
--| of the command itself.
--| N/A: modifies, errors, raises
----------------------------------------------------------------
function Parse_Aggregate (Aggregate_Text : in String_Type)
return String_Lists.List;
function Parse_Aggregate (Aggregate_Text : in String)
return String_Lists.List;
--| Effects: Returns components of Aggregate_Text as a String_List.
--| Raises : Invalid_Aggregate
----------------------------------------------------------------
generic
type Parameter_Type is (<>);
Type_Name : in String;
function Convert (Parameter_Text : in String) return Parameter_Type;
--| Raises: Invalid_Parameter
----------------------------------------------------------------
procedure Finalize; --| Raises: unrecognized parameters
--| Effects: If not all named parameters have been retrieved
--| unrecognized parameters is raised.
--| N/A: modifies, errors
end Command_Line_Interface;
----------------------------------------------------------------
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to ayacc-info@ics.uci.edu
-- Send bug reports for ayacc to ayacc-bugs@ics.uci.edu
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : file_names.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:29:16
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxfile_names.ada
-- $Header: file_names.a,v 0.1 86/04/01 15:04:19 ada Exp $
-- $Log:\x09file_names.a,v $
-- Revision 0,2 88/03/16
-- Set file names modified to include a file extension parameter.
-- Revision 0.1 86/04/01 15:04:19 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:36:22 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by David Taback and Deepak Tolani.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
-- The collection of all file names used by Ayacc --
nblk1=a
nid=0
hdr6=14
[0x00] rec0=1b rec1=00 rec2=01 rec3=044
[0x01] rec0=16 rec1=00 rec2=02 rec3=018
[0x02] rec0=1a rec1=00 rec2=03 rec3=00c
[0x03] rec0=1d rec1=00 rec2=04 rec3=032
[0x04] rec0=1e rec1=00 rec2=05 rec3=02a
[0x05] rec0=1c rec1=00 rec2=06 rec3=06c
[0x06] rec0=1d rec1=00 rec2=07 rec3=004
[0x07] rec0=12 rec1=00 rec2=08 rec3=068
[0x08] rec0=1d rec1=00 rec2=09 rec3=03e
[0x09] rec0=02 rec1=00 rec2=0a rec3=000
tail 0x2172a447884a64fbf84d0 0x42a00088462060003