summaryrefslogtreecommitdiff
path: root/gcc/ada/switch.ads
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/ada/switch.ads
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/ada/switch.ads')
-rw-r--r--gcc/ada/switch.ads131
1 files changed, 131 insertions, 0 deletions
diff --git a/gcc/ada/switch.ads b/gcc/ada/switch.ads
new file mode 100644
index 000000000..f7c62cba2
--- /dev/null
+++ b/gcc/ada/switch.ads
@@ -0,0 +1,131 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S W I T C H --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package together with a child package appropriate to the client tool
+-- scans switches. Note that the body of the appropriate Usage package must be
+-- coordinated with the switches that are recognized by this package. These
+-- Usage packages also act as the official documentation for the switches
+-- that are recognized. In addition, package Debug documents the otherwise
+-- undocumented debug switches that are also recognized.
+
+with Gnatvsn;
+with Types; use Types;
+
+------------
+-- Switch --
+------------
+
+package Switch is
+
+ -- Common switches for GNU tools
+
+ Version_Switch : constant String := "--version";
+ Help_Switch : constant String := "--help";
+
+ -----------------
+ -- Subprograms --
+ -----------------
+
+ generic
+ with procedure Usage;
+ -- Print tool-specific part of --help message
+ procedure Check_Version_And_Help_G
+ (Tool_Name : String;
+ Initial_Year : String;
+ Version_String : String := Gnatvsn.Gnat_Version_String);
+ -- Check if switches --version or --help is used. If one of this switch is
+ -- used, issue the proper messages and end the process.
+
+ procedure Display_Version
+ (Tool_Name : String;
+ Initial_Year : String;
+ Version_String : String := Gnatvsn.Gnat_Version_String);
+ -- Display version of a tool when switch --version is used
+
+ function Is_Switch (Switch_Chars : String) return Boolean;
+ -- Returns True iff Switch_Chars is at least two characters long, and the
+ -- first character is an hyphen ('-').
+
+ function Is_Front_End_Switch (Switch_Chars : String) return Boolean;
+ -- Returns True iff Switch_Chars represents a front-end switch, i.e. it
+ -- starts with -I, -gnat or -?RTS.
+
+ function Is_Internal_GCC_Switch (Switch_Chars : String) return Boolean;
+ -- Returns True iff Switch_Chars represents an internal GCC switch to be
+ -- followed by a single argument, such as -dumpbase, --param or -auxbase.
+ -- Even though passed by the "gcc" driver, these need not be stored in ALI
+ -- files and may safely be ignored by non GCC back-ends.
+
+ function Switch_Last (Switch_Chars : String) return Natural;
+ -- Index in Switch_Chars of the last relevant character for later string
+ -- comparison purposes. This is typically 'Last, minus one if there is a
+ -- terminating ASCII.NUL.
+
+private
+ -- This section contains some common routines used by the tool dependent
+ -- child packages (there is one such child package for each tool that uses
+ -- Switches to scan switches - Compiler/gnatbind/gnatmake/.
+
+ Switch_Max_Value : constant := 999_999;
+ -- Maximum value permitted in switches that take a value
+
+ function Nat_Present
+ (Switch_Chars : String;
+ Max : Integer;
+ Ptr : Integer) return Boolean;
+ -- Returns True if an integer is at the current scan location or an equal
+ -- sign. This is used as a guard for calling Scan_Nat. Switch_Chars is the
+ -- string containing the switch, and Ptr points just past the switch
+ -- character. Max is the maximum allowed value of Ptr.
+
+ procedure Scan_Nat
+ (Switch_Chars : String;
+ Max : Integer;
+ Ptr : in out Integer;
+ Result : out Nat;
+ Switch : Character);
+ -- Scan natural integer parameter for switch. On entry, Ptr points just
+ -- past the switch character, on exit it points past the last digit of the
+ -- integer value. Max is the maximum allowed value of Ptr, so the scan is
+ -- restricted to Switch_Chars (Ptr .. Max). It is possible for Ptr to be
+ -- one greater than Max on return if the entire string is digits. Scan_Nat
+ -- will skip an optional equal sign if it is present. Nat_Present must be
+ -- True, or an error will be signalled.
+
+ procedure Scan_Pos
+ (Switch_Chars : String;
+ Max : Integer;
+ Ptr : in out Integer;
+ Result : out Pos;
+ Switch : Character);
+ -- Scan positive integer parameter for switch. On entry, Ptr points just
+ -- past the switch character, on exit it points past the last digit of the
+ -- integer value.
+
+ procedure Bad_Switch (Switch : Character);
+ procedure Bad_Switch (Switch : String);
+ -- Fail with an appropriate message when a switch is not recognized
+
+end Switch;