1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2001 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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, 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 Bad_Switch
: exception;
66 -- Exception raised if bad switch encountered
68 Bad_Switch_Value
: exception;
69 -- Exception raised if bad switch value encountered
71 Missing_Switch_Value
: exception;
72 -- Exception raised if no switch value encountered
74 Too_Many_Output_Files
: exception;
75 -- Exception raised if the -o switch is encountered more than once
77 Switch_Max_Value
: constant := 999;
78 -- Maximum value permitted in switches that take a value
81 (Switch_Chars
: String;
85 -- Scan natural integer parameter for switch. On entry, Ptr points
86 -- just past the switch character, on exit it points past the last
87 -- digit of the integer value.
90 (Switch_Chars
: String;
94 -- Scan positive integer parameter for switch. On entry, Ptr points
95 -- just past the switch character, on exit it points past the last
96 -- digit of the integer value.