OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ada / switch.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                               S W I T C H                                --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- GNAT was originally developed  by the GNAT team at  New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 --                                                                          --
26 ------------------------------------------------------------------------------
27
28 --  This package together with a child package appropriate to the client
29 --  tool scans switches. Note that the body of the appropraite Usage package
30 --  must be coordinated with the switches that are recognized by this package.
31 --  These Usage packages also act as the official documentation for the
32 --  switches that are recognized. In addition, package Debug documents
33 --  the otherwise undocumented debug switches that are also recognized.
34
35 with Types; use Types;
36
37 package Switch is
38
39    --  Note: The default switch character is indicated by Switch_Character,
40    --  but regardless of what it is, a hyphen is always allowed as an
41    --  (alternative) switch character.
42
43    --  Note: In GNAT, the case of switches is not significant if
44    --  Switches_Case_Sensitive is False. If this is the case, switch
45    --  characters, or letters appearing in the parameter to a switch, may be
46    --  either upper case or lower case.
47
48    -----------------
49    -- Subprograms --
50    -----------------
51
52    function Is_Switch (Switch_Chars : String) return Boolean;
53    --  Returns True iff Switch_Chars is at least two characters long,
54    --  and the first character indicates it is a switch.
55
56    function Is_Front_End_Switch (Switch_Chars : String) return Boolean;
57    --  Returns True iff Switch_Chars represents a front-end switch,
58    --  ie. it starts with -I or -gnat.
59
60 private
61
62    --  This section contains some common routines used by the tool dependent
63    --  child packages (there is one such child package for each tool that
64    --  uses Switches to scan switches - Compiler/gnatbind/gnatmake/.
65
66    Bad_Switch : exception;
67    --  Exception raised if bad switch encountered
68
69    Bad_Switch_Value : exception;
70    --  Exception raised if bad switch value encountered
71
72    Missing_Switch_Value : exception;
73    --  Exception raised if no switch value encountered
74
75    Too_Many_Output_Files : exception;
76    --  Exception raised if the -o switch is encountered more than once
77
78    Switch_Max_Value : constant := 999;
79    --  Maximum value permitted in switches that take a value
80
81    procedure Scan_Nat
82      (Switch_Chars : String;
83       Max          : Integer;
84       Ptr          : in out Integer;
85       Result       : out Nat);
86    --  Scan natural integer parameter for switch. On entry, Ptr points
87    --  just past the switch character, on exit it points past the last
88    --  digit of the integer value.
89
90    procedure Scan_Pos
91      (Switch_Chars : String;
92       Max          : Integer;
93       Ptr          : in out Integer;
94       Result       : out Pos);
95    --  Scan positive integer parameter for switch. On entry, Ptr points
96    --  just past the switch character, on exit it points past the last
97    --  digit of the integer value.
98
99 end Switch;