(hsearch_r): Add back ensurance that hval is not zero.
[glibc/history.git] / locale / programs / charmap.h
blob11fddd760a1553f6e9891a426333fa4ed6393339
1 /* Copyright (C) 1996-1999,2001,2003,2005,2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
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.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 #ifndef _CHARMAP_H
20 #define _CHARMAP_H
22 #include <obstack.h>
23 #include <stdbool.h>
25 #include "repertoire.h"
26 #include "simple-hash.h"
29 struct width_rule
31 struct charseq *from;
32 struct charseq *to;
33 unsigned int width;
37 struct charmap_t
39 const char *code_set_name;
40 const char *repertoiremap;
41 int mb_cur_min;
42 int mb_cur_max;
44 struct width_rule *width_rules;
45 size_t nwidth_rules;
46 size_t nwidth_rules_max;
47 unsigned int width_default;
49 struct obstack mem_pool;
50 hash_table char_table;
51 hash_table byte_table;
52 hash_table ucs4_table;
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
60 const char *name;
61 uint32_t ucs4;
62 int nbytes;
63 unsigned char bytes[0];
67 /* True if the encoding is not ASCII compatible. */
68 extern bool enc_not_ascii_compatible;
71 /* Prototypes for charmap handling functions. */
72 extern struct charmap_t *charmap_read (const char *filename, int verbose,
73 int error_not_found, int be_quiet,
74 int use_default);
76 /* Return the value stored under the given key in the hashing table. */
77 extern struct charseq *charmap_find_value (const struct charmap_t *charmap,
78 const char *name, size_t len);
80 /* Return symbol for given multibyte sequence. */
81 extern struct charseq *charmap_find_symbol (const struct charmap_t *charmap,
82 const char *name, size_t len);
84 #endif /* charmap.h */