1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
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. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
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
;
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.
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.
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
69 (Switch_Chars
: String;
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.
79 (Switch_Chars
: String;
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