OSDN Git Service

* ifcvt.c (noce_get_alt_condition): Use reg_overlap_mentioned_p.
[pf3gnuchains/gcc-fork.git] / gcc / ada / stringt.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              S T R I N G T                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- As a special exception,  if other files  instantiate  generics from this --
24 -- unit, or you link  this unit with other files  to produce an executable, --
25 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
26 -- covered  by the  GNU  General  Public  License.  This exception does not --
27 -- however invalidate  any other reasons why  the executable file  might be --
28 -- covered by the  GNU Public License.                                      --
29 --                                                                          --
30 -- GNAT was originally developed  by the GNAT team at  New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 with System; use System;
36 with Types;  use Types;
37
38 package Stringt is
39
40 --  This package contains routines for handling the strings table which is
41 --  used to store string constants encountered in the source, and also those
42 --  additional string constants generated by compile time concatenation and
43 --  other similar processing.
44
45 --  A string constant in this table consists of a series of Char_Code values,
46 --  so that 16-bit character codes can be properly handled if this feature
47 --  is implemented in the scanner.
48
49 --  There is no guarantee that hashing is used in the implementation, although
50 --  it maybe. This means that the caller cannot count on having the same Id
51 --  value for two identical strings stored separately and also cannot count on
52 --  the two Id values being different.
53
54    --------------------------------------
55    -- String Table Access Subprograms --
56    --------------------------------------
57
58    procedure Initialize;
59    --  Initializes the strings table for a new compilation. Note that
60    --  Initialize must not be called if Tree_Read is used.
61
62    procedure Lock;
63    --  Lock internal tables before calling back end
64
65    procedure Unlock;
66    --  Unlock internal tables, in case back end needs to modify them
67
68    procedure Start_String;
69    --  Sets up for storing a new string in the table. To store a string, a
70    --  call is first made to Start_String, then successive calls are
71    --  made to Store_String_Character to store the characters of the string.
72    --  Finally, a call to End_String terminates the entry and returns it Id.
73
74    procedure Start_String (S : String_Id);
75    --  Like Start_String with no parameter, except that the contents of the
76    --  new string is initialized to be a copy of the given string. A test is
77    --  made to see if S is the last created string, and if so it is shared,
78    --  rather than copied, this can be particularly helpful for the case of
79    --  a continued concatenaion of string constants.
80
81    procedure Store_String_Char (C : Char_Code);
82    procedure Store_String_Char (C : Character);
83    --  Store next character of string, see description above for Start_String
84
85    procedure Store_String_Chars (S : String);
86    procedure Store_String_Chars (S : String_Id);
87    --  Store character codes of given string in sequence
88
89    procedure Store_String_Int (N : Int);
90    --  Stored decimal representation of integer with possible leading minus
91
92    procedure Unstore_String_Char;
93    --  Undoes effect of previous Store_String_Char call, used in some error
94    --  situations of unterminated string constants.
95
96    function End_String return String_Id;
97    --  Terminates current string and returns its Id
98
99    function String_Length (Id : String_Id) return Nat;
100    --  Returns length of previously stored string
101
102    function Get_String_Char (Id : String_Id; Index : Int) return Char_Code;
103    --  Obtains the specified character from a stored string. The lower bound
104    --  of stored strings is always 1, so the range is 1 .. String_Length (Id).
105
106    function String_Equal (L, R : String_Id) return Boolean;
107    --  Determines if two string literals represent the same string
108
109    procedure String_To_Name_Buffer (S : String_Id);
110    --  Place characters of given string in Name_Buffer, setting Name_Len.
111    --  Error if any characters are out of Character range. Does not attempt
112    --  to do any encoding of any characters.
113
114    procedure Add_String_To_Name_Buffer (S : String_Id);
115    --  Append characters of given string to Name_Buffer, updating Name_Len.
116    --  Error if any characters are out of Character range. Does not attempt
117    --  to do any encoding of any characters.
118
119    function String_Chars_Address return System.Address;
120    --  Return address of String_Chars table (used by Back_End call to Gigi)
121
122    function String_From_Name_Buffer return String_Id;
123    --  Given a name stored in Namet.Name_Buffer (length in Namet.Name_Len),
124    --  returns a string of the corresponding value. The value in Name_Buffer
125    --  is unchanged, and the cases of letters are unchanged.
126
127    function Strings_Address return System.Address;
128    --  Return address of Strings table (used by Back_End call to Gigi)
129
130    procedure Tree_Read;
131    --  Initializes internal tables from current tree file using Tree_Read.
132    --  Note that Initialize should not be called if Tree_Read is used.
133    --  Tree_Read includes all necessary initialization.
134
135    procedure Tree_Write;
136    --  Writes out internal tables to current tree file using Tree_Write
137
138    procedure Write_Char_Code (Code : Char_Code);
139    --  Procedure to write a character code value, used for debugging purposes
140    --  for writing character codes. If the character code is in the range
141    --  16#20# .. 16#7E#, then the single graphic character corresponding to
142    --  the code is output. For any other codes in the range 16#00# .. 16#FF#,
143    --  the code is output as ["hh"] where hh is the two digit hex value for
144    --  the code. Codes greater than 16#FF# are output as ["hhhh"] where hhhh
145    --  is the four digit hex representation of the code value (high order
146    --  byte first). Hex letters are always in lower case.
147
148    procedure Write_String_Table_Entry (Id : String_Id);
149    --  Writes a string value with enclosing quotes to the current file using
150    --  routines in package Output. Does not write an end of line character.
151    --  This procedure is used for debug output purposes, and also for output
152    --  of strings specified by pragma Linker Option to the ali file. 7-bit
153    --  ASCII graphics (except for double quote) are output literally.
154    --  The double quote appears as two successive double quotes.
155    --  All other codes, are output as described for Write_Char_Code. For
156    --  example, the string created by folding "A" & ASCII.LF & "Hello" will
157    --  print as "A["0a"]Hello". A No_String value prints simply as "no string"
158    --  without surrounding quote marks.
159
160 private
161    pragma Inline (End_String);
162    pragma Inline (String_Length);
163
164 end Stringt;