annotate gcc/ada/stringt.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /****************************************************************************
kono
parents:
diff changeset
2 * *
kono
parents:
diff changeset
3 * GNAT COMPILER COMPONENTS *
kono
parents:
diff changeset
4 * *
kono
parents:
diff changeset
5 * S T R I N G T *
kono
parents:
diff changeset
6 * *
kono
parents:
diff changeset
7 * C Header File *
kono
parents:
diff changeset
8 * *
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
111
kono
parents:
diff changeset
10 * *
kono
parents:
diff changeset
11 * GNAT is free software; you can redistribute it and/or modify it under *
kono
parents:
diff changeset
12 * terms of the GNU General Public License as published by the Free Soft- *
kono
parents:
diff changeset
13 * ware Foundation; either version 3, or (at your option) any later ver- *
kono
parents:
diff changeset
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
kono
parents:
diff changeset
15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
kono
parents:
diff changeset
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
kono
parents:
diff changeset
17 * for more details. You should have received a copy of the GNU General *
kono
parents:
diff changeset
18 * Public License distributed with GNAT; see file COPYING3. If not, go to *
kono
parents:
diff changeset
19 * http://www.gnu.org/licenses for a complete copy of the license. *
kono
parents:
diff changeset
20 * *
kono
parents:
diff changeset
21 * GNAT was originally developed by the GNAT team at New York University. *
kono
parents:
diff changeset
22 * Extensive contributions were provided by Ada Core Technologies Inc. *
kono
parents:
diff changeset
23 * *
kono
parents:
diff changeset
24 ****************************************************************************/
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 /* This file is the C file that corresponds to the Ada package spec
kono
parents:
diff changeset
27 Stringt. It was created manually from stringt.ads and stringt.adb
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 Note: only the access functions are provided, since the tree transformer
kono
parents:
diff changeset
30 is not allowed to modify the tree or its auxiliary structures.
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 This package contains routines for handling the strings table which is
kono
parents:
diff changeset
33 used to store string constants encountered in the source, and also those
kono
parents:
diff changeset
34 additional string constants generated by compile time concatenation and
kono
parents:
diff changeset
35 other similar processing.
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 A string constant in this table consists of a series of Char_Code values,
kono
parents:
diff changeset
38 so that 16-bit character codes can be properly handled if this feature is
kono
parents:
diff changeset
39 implemented in the scanner.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 There is no guarantee that hashing is used in the implementation. This
kono
parents:
diff changeset
42 means that the caller cannot count on having the same Id value for two
kono
parents:
diff changeset
43 identical strings stored separately.
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 The String_Id values reference entries in the Strings table, which
kono
parents:
diff changeset
46 contains String_Entry records that record the length of each stored string
kono
parents:
diff changeset
47 and its starting location in the String_Chars table. */
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 struct String_Entry
kono
parents:
diff changeset
50 {
kono
parents:
diff changeset
51 Int String_Index;
kono
parents:
diff changeset
52 Int Length;
kono
parents:
diff changeset
53 };
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 /* Pointer to string entry vector. This pointer is passed to the tree
kono
parents:
diff changeset
56 transformer and stored in a global location. */
kono
parents:
diff changeset
57 extern struct String_Entry *Strings_Ptr;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 /* Pointer to name characters table. This pointer is passed to the tree
kono
parents:
diff changeset
60 transformer and stored in a global location for access from here. The
kono
parents:
diff changeset
61 String_Index values are subscripts into this array. */
kono
parents:
diff changeset
62 extern Char_Code *String_Chars_Ptr;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 /* String_Length returns the length of the specified string. */
kono
parents:
diff changeset
66 INLINE Int String_Length (String_Id);
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 INLINE Int
kono
parents:
diff changeset
69 String_Length (String_Id Id)
kono
parents:
diff changeset
70 {
kono
parents:
diff changeset
71 return Strings_Ptr[Id - First_String_Id].Length;
kono
parents:
diff changeset
72 }
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 /* Get_String_Char obtains the specified character from a stored string. The
kono
parents:
diff changeset
76 lower bound of stored strings is always 1, so the range of values is 1 to
kono
parents:
diff changeset
77 String_Length (Id). */
kono
parents:
diff changeset
78 INLINE Char_Code Get_String_Char (String_Id, Int);
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 INLINE Char_Code
kono
parents:
diff changeset
81 Get_String_Char (String_Id Id, Int Index)
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 return
kono
parents:
diff changeset
84 String_Chars_Ptr
kono
parents:
diff changeset
85 [Strings_Ptr[Id - First_String_Id].String_Index + Index - 1];
kono
parents:
diff changeset
86 }