annotate gcc/ada/libgnat/s-resfil.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . R E S P O N S E _ F I L E --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 2007-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package provides facilities for getting command-line arguments from
kono
parents:
diff changeset
33 -- a text file, called a "response file".
kono
parents:
diff changeset
34 --
kono
parents:
diff changeset
35 -- Using a response file allow passing a set of arguments to an executable
kono
parents:
diff changeset
36 -- longer than the maximum allowed by the system on the command line.
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 pragma Compiler_Unit_Warning;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 with System.Strings;
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 package System.Response_File is
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 subtype String_Access is System.Strings.String_Access;
kono
parents:
diff changeset
45 -- type String_Access is access all String;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 procedure Free (S : in out String_Access) renames System.Strings.Free;
kono
parents:
diff changeset
48 -- To deallocate a String
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 subtype Argument_List is System.Strings.String_List;
kono
parents:
diff changeset
51 -- type String_List is array (Positive range <>) of String_Access;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 Max_Line_Length : constant := 4096;
kono
parents:
diff changeset
54 -- The maximum length of lines in a response file
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 File_Does_Not_Exist : exception;
kono
parents:
diff changeset
57 -- Raise by Arguments_From when a response file cannot be found
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 Line_Too_Long : exception;
kono
parents:
diff changeset
60 -- Raise by Arguments_From when a line in the response file is longer than
kono
parents:
diff changeset
61 -- Max_Line_Length.
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 No_Closing_Quote : exception;
kono
parents:
diff changeset
64 -- Raise by Arguments_From when a quoted string does not end before the
kono
parents:
diff changeset
65 -- end of the line.
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 Circularity_Detected : exception;
kono
parents:
diff changeset
68 -- Raise by Arguments_From when Recursive is True and the same response
kono
parents:
diff changeset
69 -- file is reading itself, either directly or indirectly.
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 function Arguments_From
kono
parents:
diff changeset
72 (Response_File_Name : String;
kono
parents:
diff changeset
73 Recursive : Boolean := False;
kono
parents:
diff changeset
74 Ignore_Non_Existing_Files : Boolean := False)
kono
parents:
diff changeset
75 return Argument_List;
kono
parents:
diff changeset
76 -- Read response file with name Response_File_Name and return the argument
kono
parents:
diff changeset
77 -- it contains as an Argument_List. It is the responsibility of the caller
kono
parents:
diff changeset
78 -- to deallocate the strings in the Argument_List if desired. When
kono
parents:
diff changeset
79 -- Recursive is True, any argument of the form @file_name indicates the
kono
parents:
diff changeset
80 -- name of another response file and is replaced by the arguments in this
kono
parents:
diff changeset
81 -- response file.
kono
parents:
diff changeset
82 --
kono
parents:
diff changeset
83 -- Each nonempty line of the response file contains one or several
kono
parents:
diff changeset
84 -- arguments separated by white space. Empty lines or lines containing only
kono
parents:
diff changeset
85 -- white space are ignored. Arguments containing white space or a double
kono
parents:
diff changeset
86 -- quote ('"')must be quoted. A double quote inside a quote string is
kono
parents:
diff changeset
87 -- indicated by two consecutive double quotes. Example: "-Idir with quote
kono
parents:
diff changeset
88 -- "" and spaces". Non-white-space characters immediately before or after a
kono
parents:
diff changeset
89 -- quoted string are part of the same argument. Ex: -Idir" with "spaces
kono
parents:
diff changeset
90 --
kono
parents:
diff changeset
91 -- When a response file cannot be found, exception File_Does_Not_Exist is
kono
parents:
diff changeset
92 -- raised if Ignore_Non_Existing_Files is False, otherwise the response
kono
parents:
diff changeset
93 -- file is ignored. Exception Line_Too_Long is raised when a line of a
kono
parents:
diff changeset
94 -- response file is longer than Max_Line_Length. Exception No_Closing_Quote
kono
parents:
diff changeset
95 -- is raised when a quoted argument is not closed before the end of the
kono
parents:
diff changeset
96 -- line. Exception Circularity_Detected is raised when a Recursive is True
kono
parents:
diff changeset
97 -- and a response file is reading itself, either directly or indirectly.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 end System.Response_File;