1/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef _REPERTOIREMAP_H
19#define _REPERTOIREMAP_H 1
20
21#include <obstack.h>
22#include <stdint.h>
23
24#include "charmap.h"
25#include "simple-hash.h"
26
27struct repertoire_t
28{
29 const char *name;
30 struct obstack mem_pool;
31 hash_table char_table;
32 hash_table reverse_table;
33 hash_table seq_table;
34};
35
36
37/* We need one value to mark the error case. Let's use 0xffffffff.
38 I.e., it is placed in the last page of ISO 10646. For now only the
39 first is used and we have plenty of room. */
40#define ILLEGAL_CHAR_VALUE ((uint32_t) 0xffffffffu)
41
42/* Another value is needed to signal that a value is not yet determined. */
43#define UNINITIALIZED_CHAR_VALUE ((uint32_t) 0xfffffffeu)
44
45
46/* Prototypes for repertoire map handling functions. */
47extern struct repertoire_t *repertoire_read (const char *filename);
48
49/* Report missing repertoire map. */
50extern void repertoire_complain (const char *name);
51
52/* Return UCS4 value of character with given NAME. */
53extern uint32_t repertoire_find_value (const struct repertoire_t *repertoire,
54 const char *name, size_t len);
55
56/* Return symbol for given UCS4 value. */
57extern const char *repertoire_find_symbol (const struct repertoire_t *repertoire,
58 uint32_t ucs);
59
60/* Query the has table to memoize mapping from UCS4 to byte sequences. */
61extern struct charseq *repertoire_find_seq (const struct repertoire_t *rep,
62 uint32_t ucs);
63
64#endif /* repertoiremap.h */
65