/usr/share/ada/adainclude/xmlada/sax-symbols.ads is in libxmlada4.1-dev 4.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | -----------------------------------------------------------------------
-- XML/Ada - An XML suite for Ada95 --
-- --
-- Copyright (C) 2010, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-----------------------------------------------------------------------
-- A symbol table.
-- This provides integers to represent strings internally. The implementation
-- is copied from namet.adb, in the GNAT sources
with Interfaces;
with Sax.HTable;
with Sax.Pointers;
with Unicode.CES; use Unicode.CES;
package Sax.Symbols is
type Symbol_Table_Record is new Sax.Pointers.Root_Encapsulated with private;
type Symbol_Table_Access is access all Symbol_Table_Record'Class;
-- A symbol table associating integers with strings.
-- By default, this is not task safe, so you will need to extend this if
-- the symbol is to be shared between multiple tasks.
type Symbol is private;
No_Symbol : constant Symbol;
Empty_String : constant Symbol;
function Find
(Table : access Symbol_Table_Record;
Str : Unicode.CES.Byte_Sequence) return Symbol;
-- Return the internal version of Str.
-- Comparing Symbol is the same as comparing the string itself, but much
-- faster.
function Get (Sym : Symbol) return Cst_Byte_Sequence_Access;
pragma Inline_Always (Get);
-- The string associated with the symbol.
-- The returned string must not be deallocated, it points to internal data
procedure Free (Table : in out Symbol_Table_Record);
-- Free the table
function Hash (S : Symbol) return Interfaces.Unsigned_32;
-- Returns a hash for the symbol
function "=" (S : Symbol; Str : Unicode.CES.Byte_Sequence) return Boolean;
-- Compare [S] and [Str]
function Debug_Print (S : Symbol) return String;
-- Return a displaying version of symbol (debugging purposes only)
private
type Symbol is new Cst_Byte_Sequence_Access;
Cst_Empty_String : aliased constant Unicode.CES.Byte_Sequence := "";
No_Symbol : constant Symbol := null;
Empty_String : constant Symbol := Cst_Empty_String'Access;
function Get_Key (Str : Symbol) return Cst_Byte_Sequence_Access;
procedure Free (Str : in out Symbol);
function Hash
(Str : Cst_Byte_Sequence_Access) return Interfaces.Unsigned_32;
function Key_Equal (Key1, Key2 : Cst_Byte_Sequence_Access) return Boolean;
pragma Inline (Hash, Get_Key, Key_Equal);
package String_Htable is new Sax.HTable
(Element => Symbol,
Empty_Element => No_Symbol,
Free => Free,
Key => Cst_Byte_Sequence_Access,
Get_Key => Get_Key,
Hash => Hash,
Equal => Key_Equal);
Hash_Num : constant := 2**16;
-- Number of headers in the hash table
type Hash_Type is range 0 .. Hash_Num - 1;
type Symbol_Table_Record is new Sax.Pointers.Root_Encapsulated with record
Hash : String_Htable.HTable (Hash_Num);
end record;
end Sax.Symbols;
|