OSDN Git Service

* gcc-interface/Makefile.in (gnatlib-shared-default): Append
[pf3gnuchains/gcc-fork.git] / gcc / ada / namet.h
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                                N A M E T                                 *
6  *                                                                          *
7  *                              C Header File                               *
8  *                                                                          *
9  *            Copyright (C) 1992-2011, Free Software Foundation, Inc.       *
10  *                                                                          *
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 3,  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 COPYING3.  If not, go to *
19  * http://www.gnu.org/licenses for a complete copy of the license.          *
20  *                                                                          *
21  * GNAT was originally developed  by the GNAT team at  New York University. *
22  * Extensive contributions were provided by Ada Core Technologies Inc.      *
23  *                                                                          *
24  ****************************************************************************/
25
26 /* This is the C file that corresponds to the Ada package specification
27    Namet.  It was created manually from files namet.ads and namet.adb.  */
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* Structure defining a names table entry.  */
34
35 struct Name_Entry
36 {
37   Int Name_Chars_Index; /* Starting location of char in Name_Chars table. */
38   Short Name_Len;         /* Length of this name in characters. */
39   Byte Byte_Info;       /* Byte value associated with this name */
40   Byte Spare;           /* Unused */
41   Name_Id Hash_Link;    /* Link to next entry in names table for same hash
42                            code. Not accessed by C routines.  */
43   Int Int_Info;         /* Int value associated with this name */
44 };
45
46 /* Pointer to names table vector. */
47 #define Names_Ptr namet__name_entries__table
48 extern struct Name_Entry *Names_Ptr;
49
50 /* Pointer to name characters table. */
51 #define Name_Chars_Ptr namet__name_chars__table
52 extern char *Name_Chars_Ptr;
53
54 #define Name_Buffer namet__name_buffer
55 extern char Name_Buffer[];
56
57 extern Int namet__name_len;
58 #define Name_Len namet__name_len
59
60 /* Get_Name_String returns a null terminated C string for the specified name.
61    We could use the official Ada routine for this purpose, but since the
62    strings we want are sitting in the name strings table in exactly the form
63    we need them (null terminated), we just point to the name directly. */
64
65 static char *Get_Name_String (Name_Id);
66
67 INLINE char *
68 Get_Name_String (Name_Id Id)
69 {
70   return Name_Chars_Ptr + Names_Ptr[Id - First_Name_Id].Name_Chars_Index + 1;
71 }
72
73 /* Get_Decoded_Name_String returns a null terminated C string in the same
74    manner as Get_Name_String, except that it is decoded (i.e. upper half or
75    wide characters are put back in their external form, and character literals
76    are also returned in their external form (with surrounding apostrophes) */
77
78 extern void namet__get_decoded_name_string (Name_Id);
79
80 static char *Get_Decoded_Name_String (Name_Id);
81
82 INLINE char *
83 Get_Decoded_Name_String (Name_Id Id)
84 {
85   namet__get_decoded_name_string (Id);
86   Name_Buffer[Name_Len] = 0;
87   return Name_Buffer;
88 }
89
90 /* Like Get_Decoded_Name_String, but the result has all qualification and
91    package body entity suffixes stripped, and also all letters are upper
92    cased.  This is used for building the enumeration literal table. */
93
94 extern void casing__set_all_upper_case (void);
95
96 /* The following routines and variables are not part of Namet, but we
97    include the header here since it seems the best place for it.  */
98
99 #define Get_Encoded_Type_Name exp_dbug__get_encoded_type_name
100 extern Boolean Get_Encoded_Type_Name (Entity_Id);
101 #define Get_Variant_Encoding exp_dbug__get_variant_encoding
102 extern void Get_Variant_Encoding (Entity_Id);
103
104 #define Spec_Context_List exp_dbug__spec_context_list
105 #define Body_Context_List exp_dbug__body_context_list
106 extern char *Spec_Context_List, *Body_Context_List;
107 #define Spec_Filename exp_dbug__spec_filename
108 #define Body_Filename exp_dbug__body_filename
109 extern char *Spec_Filename, *Body_Filename;
110
111 #define Is_Non_Ada_Error exp_ch11__is_non_ada_error
112 extern Boolean Is_Non_Ada_Error (Entity_Id);
113
114 /* Here are some functions in sinput.adb we call from a-trans.c.  */
115 typedef Nat Source_File_Index;
116 typedef Int Logical_Line_Number;
117 typedef Int Column_Number;
118
119 #define Debug_Source_Name sinput__debug_source_name
120 #define Full_Debug_Name sinput__full_debug_name
121 #define Reference_Name sinput__reference_name
122 #define Get_Source_File_Index sinput__get_source_file_index
123 #define Get_Logical_Line_Number sinput__get_logical_line_number
124 #define Get_Column_Number sinput__get_column_number
125 #define Instantiation sinput__instantiation
126
127 extern File_Name_Type Debug_Source_Name (Source_File_Index);
128 extern File_Name_Type Full_Debug_Name   (Source_File_Index);
129 extern File_Name_Type Reference_Name    (Source_File_Index);
130 extern Source_File_Index Get_Source_File_Index (Source_Ptr);
131 extern Logical_Line_Number Get_Logical_Line_Number (Source_Ptr);
132 extern Column_Number Get_Column_Number (Source_Ptr);
133 extern Source_Ptr Instantiation (Source_File_Index);
134
135 #ifdef __cplusplus
136 }
137 #endif