Merge from mainline
[official-gcc.git] / gcc / ada / a-colire.ads
blob6a826bc406ad363da8963d8577f9b13282dfe741
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . C O M M A N D _ L I N E . R E M O V E --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1999-2006, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package is intended to be used in conjunction with its parent unit,
35 -- Ada.Command_Line. It provides facilities for logically removing arguments
36 -- from the command line, so that subsequent calls to Argument_Count and
37 -- Argument will reflect the removals.
39 -- For example, if the original command line has three arguments A B C, so
40 -- that Argument_Count is initially three, then after removing B, the second
41 -- argument, Argument_Count will be 2, and Argument (2) will return C.
43 package Ada.Command_Line.Remove is
44 pragma Preelaborate;
46 procedure Remove_Argument (Number : Positive);
47 -- Removes the argument identified by Number, which must be in the
48 -- range 1 .. Argument_Count (i.e. an in range argument number which
49 -- reflects removals). If Number is out of range Constraint_Error
50 -- will be raised.
52 -- Note: the numbering of arguments greater than Number is affected
53 -- by the call. If you need a loop through the arguments, removing
54 -- some as you go, run the loop in reverse to avoid confusion from
55 -- this renumbering:
57 -- for J in reverse 1 .. Argument_Count loop
58 -- if Should_Remove (Arguments (J)) then
59 -- Remove_Argument (J);
60 -- end if;
61 -- end loop;
63 -- Reversing the loop in this manner avoids the confusion.
65 procedure Remove_Arguments (From : Positive; To : Natural);
66 -- Removes arguments in the given From..To range. From must be in the
67 -- range 1 .. Argument_Count and To in the range 0 .. Argument_Count.
68 -- Constraint_Error is raised if either argument is out of range. If
69 -- To is less than From, then the call has no effect.
71 procedure Remove_Argument (Argument : String);
72 -- Removes the argument which matches the given string Argument. Has
73 -- no effect if no argument matches the string. If more than one
74 -- argument matches the string, all are removed.
76 procedure Remove_Arguments (Argument_Prefix : String);
77 -- Removes all arguments whose prefix matches Argument_Prefix. Has
78 -- no effect if no argument matches the string. For example a call
79 -- to Remove_Arguments ("--") removes all arguments starting with --.
81 end Ada.Command_Line.Remove;