Back to index

glibc  2.9
charmap.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996-1999,2001,2003,2005,2006 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published
00007    by the Free Software Foundation; version 2 of the License, or
00008    (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software Foundation,
00017    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #ifndef _CHARMAP_H
00020 #define _CHARMAP_H
00021 
00022 #include <obstack.h>
00023 #include <stdbool.h>
00024 
00025 #include "repertoire.h"
00026 #include "simple-hash.h"
00027 
00028 
00029 struct width_rule
00030 {
00031   struct charseq *from;
00032   struct charseq *to;
00033   unsigned int width;
00034 };
00035 
00036 
00037 struct charmap_t
00038 {
00039   const char *code_set_name;
00040   const char *repertoiremap;
00041   int mb_cur_min;
00042   int mb_cur_max;
00043 
00044   struct width_rule *width_rules;
00045   size_t nwidth_rules;
00046   size_t nwidth_rules_max;
00047   unsigned int width_default;
00048 
00049   struct obstack mem_pool;
00050   hash_table char_table;
00051   hash_table byte_table;
00052   hash_table ucs4_table;
00053 };
00054 
00055 
00056 /* This is the structure used for entries in the hash table.  It represents
00057    the sequence of bytes used for the coded character.  */
00058 struct charseq
00059 {
00060   const char *name;
00061   uint32_t ucs4;
00062   int nbytes;
00063   unsigned char bytes[0];
00064 };
00065 
00066 
00067 /* True if the encoding is not ASCII compatible.  */
00068 extern bool enc_not_ascii_compatible;
00069 
00070 
00071 /* Prototypes for charmap handling functions.  */
00072 extern struct charmap_t *charmap_read (const char *filename, int verbose,
00073                                    int error_not_found, int be_quiet,
00074                                    int use_default);
00075 
00076 /* Return the value stored under the given key in the hashing table.  */
00077 extern struct charseq *charmap_find_value (const struct charmap_t *charmap,
00078                                       const char *name, size_t len);
00079 
00080 /* Return symbol for given multibyte sequence.  */
00081 extern struct charseq *charmap_find_symbol (const struct charmap_t *charmap,
00082                                        const char *name, size_t len);
00083 
00084 #endif /* charmap.h */