]> git.ipfire.org Git - thirdparty/glibc.git/blob - locale/programs/charmap.h
Update.
[thirdparty/glibc.git] / locale / programs / charmap.h
1 /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 #ifndef _CHARMAP_H
21 #define _CHARMAP_H
22
23 #include <obstack.h>
24
25 #include "repertoire.h"
26 #include "simple-hash.h"
27
28
29 struct width_rule
30 {
31 struct charseq *from;
32 struct charseq *to;
33 unsigned int width;
34 };
35
36
37 struct charmap_t
38 {
39 const char *code_set_name;
40 const char *repertoiremap;
41 int mb_cur_min;
42 int mb_cur_max;
43
44 struct width_rule *width_rules;
45 size_t nwidth_rules;
46 size_t nwidth_rules_max;
47 unsigned int width_default;
48
49 struct obstack mem_pool;
50 hash_table char_table;
51 hash_table byte_table;
52 hash_table ucs4_table;
53 };
54
55
56 /* This is the structure used for entries in the hash table. It represents
57 the sequence of bytes used for the coded character. */
58 struct charseq
59 {
60 const char *name;
61 uint32_t ucs4;
62 int nbytes;
63 unsigned char bytes[0];
64 };
65
66
67 /* Prototypes for charmap handling functions. */
68 extern struct charmap_t *charmap_read (const char *filename);
69
70 /* Return the value stored under the given key in the hashing table. */
71 extern struct charseq *charmap_find_value (const struct charmap_t *charmap,
72 const char *name, size_t len);
73
74 /* Return symbol for given multibyte sequence. */
75 extern struct charseq *charmap_find_symbol (const struct charmap_t *charmap,
76 const char *name, size_t len);
77
78 #endif /* charmap.h */