1 /****************************************************************************
3 * GNAT COMPILER COMPONENTS *
11 * Copyright (C) 1992-2001 Free Software Foundation, Inc. *
13 * GNAT is free software; you can redistribute it and/or modify it under *
14 * terms of the GNU General Public License as published by the Free Soft- *
15 * ware Foundation; either version 2, or (at your option) any later ver- *
16 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
17 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
19 * for more details. You should have received a copy of the GNU General *
20 * Public License distributed with GNAT; see file COPYING. If not, write *
21 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
22 * MA 02111-1307, USA. *
24 * GNAT was originally developed by the GNAT team at New York University. *
25 * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
27 ****************************************************************************/
29 /* This is the C file that corresponds to the Ada package specification
30 Namet. It was created manually from files namet.ads and namet.adb. */
32 /* Structure defining a names table entry. */
36 Int Name_Chars_Index
; /* Starting location of char in Name_Chars table. */
37 Short Name_Len
; /* Length of this name in characters. */
38 Byte Byte_Info
; /* Byte value associated with this name */
39 Byte Spare
; /* Unused */
40 Name_Id Hash_Link
; /* Link to next entry in names table for same hash
41 code. Not accessed by C routines. */
42 Int Int_Info
; /* Int value associated with this name */
45 /* Pointer to names table vector. */
46 #define Names_Ptr namet__name_entries__table
47 extern struct Name_Entry
*Names_Ptr
;
49 /* Pointer to name characters table. */
50 #define Name_Chars_Ptr namet__name_chars__table
51 extern char *Name_Chars_Ptr
;
53 #define Name_Buffer namet__name_buffer
54 extern char Name_Buffer
[];
56 extern Int namet__name_len
;
57 #define Name_Len namet__name_len
59 /* Get_Name_String returns a null terminated C string for the specified name.
60 We could use the official Ada routine for this purpose, but since the
61 strings we want are sitting in the name strings table in exactly the form
62 we need them (null terminated), we just point to the name directly. */
64 static char *Get_Name_String
PARAMS ((Name_Id
));
70 return Name_Chars_Ptr
+ Names_Ptr
[Id
- First_Name_Id
].Name_Chars_Index
+ 1;
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) */
78 extern void namet__get_decoded_name_string
PARAMS ((Name_Id
));
80 static char *Get_Decoded_Name_String
PARAMS ((Name_Id
));
83 Get_Decoded_Name_String (Id
)
86 namet__get_decoded_name_string (Id
);
87 Name_Buffer
[Name_Len
] = 0;
91 /* Like Get_Decoded_Name_String, but the result has all qualification and
92 package body entity suffixes stripped, and also all letters are upper
93 cased. This is used fo rbuilding the enumeration literal table. */
95 extern void casing__set_all_upper_case
PARAMS ((void));
96 extern void namet__get_unqualified_decoded_name_string
PARAMS ((Name_Id
));
98 static char *Get_Upper_Decoded_Name_String
PARAMS ((Name_Id
));
101 Get_Upper_Decoded_Name_String (Id
)
104 namet__get_unqualified_decoded_name_string (Id
);
105 if (Name_Buffer
[0] != '\'')
106 casing__set_all_upper_case ();
107 Name_Buffer
[Name_Len
] = 0;
111 /* The following routines and variables are not part of Namet, but we
112 include the header here since it seems the best place for it. */
114 #define Get_Encoded_Type_Name exp_dbug__get_encoded_type_name
115 extern Boolean Get_Encoded_Type_Name
PARAMS ((Entity_Id
));
116 #define Get_Variant_Encoding exp_dbug__get_variant_encoding
117 extern void Get_Variant_Encoding
PARAMS ((Entity_Id
));
119 #define Spec_Context_List exp_dbug__spec_context_list
120 #define Body_Context_List exp_dbug__body_context_list
121 extern char *Spec_Context_List
, *Body_Context_List
;
122 #define Spec_Filename exp_dbug__spec_filename
123 #define Body_Filename exp_dbug__body_filename
124 extern char *Spec_Filename
, *Body_Filename
;
126 #define Is_Non_Ada_Error exp_ch11__is_non_ada_error
127 extern Boolean Is_Non_Ada_Error
PARAMS ((Entity_Id
));
129 /* Here are some functions in sinput.adb we call from a-trans.c. */
130 typedef Nat Source_File_Index
;
131 typedef Int Logical_Line_Number
;
133 #define Debug_Source_Name sinput__debug_source_name
134 #define Reference_Name sinput__reference_name
135 #define Get_Source_File_Index sinput__get_source_file_index
136 #define Get_Logical_Line_Number sinput__get_logical_line_number
138 extern File_Name_Type Debug_Source_Name
PARAMS ((Source_File_Index
));
139 extern File_Name_Type Reference_Name
PARAMS ((Source_File_Index
));
140 extern Source_File_Index Get_Source_File_Index
PARAMS ((Source_Ptr
));
141 extern Logical_Line_Number Get_Logical_Line_Number
PARAMS ((Source_Ptr
));