home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adav313.zip / gnat-3_13p-os2-bin-20010916.zip / emx / gnatlib / a-colire.ads < prev    next >
Text File  |  2001-07-08  |  5KB  |  84 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME 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. --                            $Revision: 1.1 $
  10. --                                                                          --
  11. --        Copyright (C) 1999 Free Software Foundation, Inc.                 --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  22. -- MA 02111-1307, USA.                                                      --
  23. --                                                                          --
  24. -- As a special exception,  if other files  instantiate  generics from this --
  25. -- unit, or you link  this unit with other files  to produce an executable, --
  26. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  27. -- covered  by the  GNU  General  Public  License.  This exception does not --
  28. -- however invalidate  any other reasons why  the executable file  might be --
  29. -- covered by the  GNU Public License.                                      --
  30. --                                                                          --
  31. -- GNAT was originally developed  by the GNAT team at  New York University. --
  32. -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
  33. --                                                                          --
  34. ------------------------------------------------------------------------------
  35.  
  36. --  This package is intended to be used in conjunction with its parent unit,
  37. --  Ada.Command_Line. It provides facilities for logically removing arguments
  38. --  from the command line, so that subsequent calls to Argument_Count and
  39. --  Argument will reflect the removals.
  40.  
  41. --  For example, if the original command line has three arguments A B C, so
  42. --  that Argument_Count is initially three, then after removing B, the second
  43. --  argument, Argument_Count will be 2, and Argument (2) will return C.
  44.  
  45. package Ada.Command_Line.Remove is
  46. pragma Preelaborate (Remove);
  47.  
  48.    procedure Remove_Argument (Number : in Positive);
  49.    --  Removes the argument identified by Number, which must be in the
  50.    --  range 1 .. Argument_Count (i.e. an in range argument number which
  51.    --  reflects removals). If Number is out of range Constraint_Error
  52.    --  will be raised.
  53.    --
  54.    --  Note: the numbering of arguments greater than Number is affected
  55.    --  by the call. If you need a loop through the arguments, removing
  56.    --  some as you go, run the loop in reverse to avoid confusion from
  57.    --  this renumbering:
  58.    --
  59.    --    for J in reverse 1 .. Argument_Count loop
  60.    --      if Should_Remove (Arguments (J)) then
  61.    --        Remove_Argument (J);
  62.    --      end if;
  63.    --    end loop;
  64.    --
  65.    --  Reversing the loop in this manner avoids the confusion.
  66.  
  67.    procedure Remove_Arguments (From : Positive; To : Natural);
  68.    --  Removes arguments in the given From..To range. From must be in the
  69.    --  range 1 .. Argument_Count and To in the range 0 .. Argument_Count.
  70.    --  Constraint_Error is raised if either argument is out of range. If
  71.    --  To is less than From, then the call has no effect.
  72.  
  73.    procedure Remove_Argument (Argument : String);
  74.    --  Removes the argument which matches the given string Argument. Has
  75.    --  no effect if no argument matches the string. If more than one
  76.    --  argument matches the string, all are removed.
  77.  
  78.    procedure Remove_Arguments (Argument_Prefix : String);
  79.    --  Removes all arguments whose prefix matches Argument_Prefix. Has
  80.    --  no effect if no argument matches the string. For example a call
  81.    --  to Remove_Arguments ("--") removes all arguments starting with --.
  82.  
  83. end Ada.Command_Line.Remove;
  84.