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