* gcc.c (getenv_spec_function): New function.
[official-gcc.git] / gcc / ada / switch.ads
blobdce2f12d8f81648a5adb51734ea7bf659c6cf134
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S W I T C H --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2005 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 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This package together with a child package appropriate to the client
28 -- tool scans switches. Note that the body of the appropraite Usage package
29 -- must be coordinated with the switches that are recognized by this package.
30 -- These Usage packages also act as the official documentation for the
31 -- switches that are recognized. In addition, package Debug documents
32 -- the otherwise undocumented debug switches that are also recognized.
34 with Types; use Types;
36 package Switch is
38 -- Note: The default switch character is indicated by Switch_Character,
39 -- but regardless of what it is, a hyphen is always allowed as an
40 -- (alternative) switch character.
42 -- Note: In GNAT, the case of switches is not significant if
43 -- Switches_Case_Sensitive is False. If this is the case, switch
44 -- characters, or letters appearing in the parameter to a switch, may be
45 -- either upper case or lower case.
47 -----------------
48 -- Subprograms --
49 -----------------
51 function Is_Switch (Switch_Chars : String) return Boolean;
52 -- Returns True iff Switch_Chars is at least two characters long,
53 -- and the first character indicates it is a switch.
55 function Is_Front_End_Switch (Switch_Chars : String) return Boolean;
56 -- Returns True iff Switch_Chars represents a front-end switch,
57 -- ie. it starts with -I or -gnat.
59 private
61 -- This section contains some common routines used by the tool dependent
62 -- child packages (there is one such child package for each tool that
63 -- uses Switches to scan switches - Compiler/gnatbind/gnatmake/.
65 Switch_Max_Value : constant := 999_999;
66 -- Maximum value permitted in switches that take a value
68 procedure Scan_Nat
69 (Switch_Chars : String;
70 Max : Integer;
71 Ptr : in out Integer;
72 Result : out Nat;
73 Switch : Character);
74 -- Scan natural integer parameter for switch. On entry, Ptr points
75 -- just past the switch character, on exit it points past the last
76 -- digit of the integer value.
78 procedure Scan_Pos
79 (Switch_Chars : String;
80 Max : Integer;
81 Ptr : in out Integer;
82 Result : out Pos;
83 Switch : Character);
84 -- Scan positive integer parameter for switch. On entry, Ptr points
85 -- just past the switch character, on exit it points past the last
86 -- digit of the integer value.
88 procedure Bad_Switch (Switch : Character);
89 procedure Bad_Switch (Switch : String);
90 -- Fail with an appropriate message when a switch is not recognized
92 end Switch;