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