]>
Commit | Line | Data |
---|---|---|
bfff8b1b | 1 | /* Copyright (C) 1996-2017 Free Software Foundation, Inc. |
6d52618b | 2 | This file is part of the GNU C Library. |
4b10dd6c | 3 | Contributed by Ulrich Drepper <drepper@gnu.org>, 1996. |
19bc17a9 | 4 | |
43bc8ac6 | 5 | This program is free software; you can redistribute it and/or modify |
2e2efe65 RM |
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. | |
19bc17a9 | 9 | |
43bc8ac6 | 10 | This program is distributed in the hope that it will be useful, |
6d52618b | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
43bc8ac6 UD |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | |
19bc17a9 | 14 | |
43bc8ac6 | 15 | You should have received a copy of the GNU General Public License |
59ba27a6 | 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
19bc17a9 | 17 | |
4b10dd6c UD |
18 | #ifndef _CHARMAP_H |
19 | #define _CHARMAP_H | |
19bc17a9 RM |
20 | |
21 | #include <obstack.h> | |
cb2eab1f | 22 | #include <stdbool.h> |
e054f494 | 23 | #include <stdint.h> |
19bc17a9 | 24 | |
69f155d4 | 25 | #include "repertoire.h" |
19bc17a9 | 26 | #include "simple-hash.h" |
19bc17a9 RM |
27 | |
28 | ||
75cd5204 RM |
29 | struct width_rule |
30 | { | |
4b10dd6c UD |
31 | struct charseq *from; |
32 | struct charseq *to; | |
75cd5204 RM |
33 | unsigned int width; |
34 | }; | |
35 | ||
36 | ||
4b10dd6c | 37 | struct charmap_t |
19bc17a9 RM |
38 | { |
39 | const char *code_set_name; | |
4b10dd6c | 40 | const char *repertoiremap; |
19bc17a9 RM |
41 | int mb_cur_min; |
42 | int mb_cur_max; | |
75cd5204 RM |
43 | |
44 | struct width_rule *width_rules; | |
45 | size_t nwidth_rules; | |
46 | size_t nwidth_rules_max; | |
ba1ffaa1 | 47 | unsigned int width_default; |
19bc17a9 RM |
48 | |
49 | struct obstack mem_pool; | |
50 | hash_table char_table; | |
4b10dd6c UD |
51 | hash_table byte_table; |
52 | hash_table ucs4_table; | |
19bc17a9 RM |
53 | }; |
54 | ||
55 | ||
4b10dd6c UD |
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 | }; | |
19bc17a9 | 65 | |
c84142e8 | 66 | |
cb2eab1f UD |
67 | /* True if the encoding is not ASCII compatible. */ |
68 | extern bool enc_not_ascii_compatible; | |
69 | ||
70 | ||
19bc17a9 | 71 | /* Prototypes for charmap handling functions. */ |
93693c4d | 72 | extern struct charmap_t *charmap_read (const char *filename, int verbose, |
8a6537b0 UD |
73 | int error_not_found, int be_quiet, |
74 | int use_default); | |
19bc17a9 | 75 | |
69f155d4 | 76 | /* Return the value stored under the given key in the hashing table. */ |
4b10dd6c UD |
77 | extern struct charseq *charmap_find_value (const struct charmap_t *charmap, |
78 | const char *name, size_t len); | |
79 | ||
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); | |
19bc17a9 | 83 | |
4b10dd6c | 84 | #endif /* charmap.h */ |