| 1 |
/**************************************************************************** |
| 2 |
* * |
| 3 |
* GNAT COMPILER COMPONENTS * |
| 4 |
* * |
| 5 |
* N A M E T * |
| 6 |
* * |
| 7 |
* C Header File * |
| 8 |
* * |
| 9 |
* Copyright (C) 1992-2025, 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 header that corresponds to the Ada package specification for |
| 27 |
Namet. It also contains the implementation of inlined functions from the |
| 28 |
package body for Namet. It was created manually from namet.ads and |
| 29 |
namet.adb and must be kept synchronized with changes in these files. */ |
| 30 |
|
| 31 |
#ifdef __cplusplus |
| 32 |
extern "C" { |
| 33 |
#endif |
| 34 |
|
| 35 |
/* Structure defining a name table entry. */ |
| 36 |
struct Name_Entry |
| 37 |
{ |
| 38 |
Int Name_Chars_Index; |
| 39 |
Short Name_Len; |
| 40 |
Byte Byte_Info; |
| 41 |
Byte Name_Has_No_Encodings : 1; |
| 42 |
Byte Boolean1_Info : 1; |
| 43 |
Byte Boolean2_Info : 1; |
| 44 |
Byte Boolean3_Info : 1; |
| 45 |
Byte Spare : 4; |
| 46 |
Name_Id Hash_Link; |
| 47 |
Int Int_Info; |
| 48 |
}; |
| 49 |
|
| 50 |
/* Pointer to the name table. */ |
| 51 |
#define Names_Ptr namet__name_entries__table |
| 52 |
extern struct Name_Entry (*Names_Ptr)[]; |
| 53 |
|
| 54 |
/* Pointer to the name character table. */ |
| 55 |
#define Name_Chars_Ptr namet__name_chars__table |
| 56 |
extern char (*Name_Chars_Ptr)[]; |
| 57 |
|
| 58 |
/* This is Hostparm.Max_Line_Length. */ |
| 59 |
#define Max_Line_Length (32767 - 1) |
| 60 |
|
| 61 |
/* The global name buffer. */ |
| 62 |
struct Bounded_String |
| 63 |
{ |
| 64 |
Nat Max_Length; |
| 65 |
Nat Length; |
| 66 |
char Chars[4 * Max_Line_Length]; /* Exact value for overflow detection. */ |
| 67 |
}; |
| 68 |
|
| 69 |
#define Global_Name_Buffer namet__global_name_buffer |
| 70 |
extern struct Bounded_String Global_Name_Buffer; |
| 71 |
|
| 72 |
#define Name_Buffer Global_Name_Buffer.Chars |
| 73 |
#define Name_Len Global_Name_Buffer.Length |
| 74 |
|
| 75 |
/* Get_Name_String returns a NUL terminated C string for the specified name. |
| 76 |
We could use the official Ada routine for this purpose, but since the |
| 77 |
strings we want are sitting in the name strings table in exactly the form |
| 78 |
we need them (NUL terminated), we just point to the name directly. */ |
| 79 |
|
| 80 |
INLINE char *Get_Name_String (Name_Id); |
| 81 |
|
| 82 |
INLINE char * |
| 83 |
Get_Name_String (Name_Id Id) |
| 84 |
{ |
| 85 |
return |
| 86 |
&(*Name_Chars_Ptr)[(*Names_Ptr)[Id - First_Name_Id].Name_Chars_Index + 1]; |
| 87 |
} |
| 88 |
|
| 89 |
#define Name_Equals namet__name_equals |
| 90 |
extern Boolean Name_Equals (Name_Id, Name_Id); |
| 91 |
|
| 92 |
#ifdef __cplusplus |
| 93 |
} |
| 94 |
#endif |