Blame locale/programs/charmap.h

Packit 6c4009
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
Packit 6c4009
Packit 6c4009
   This program is free software; you can redistribute it and/or modify
Packit 6c4009
   it under the terms of the GNU General Public License as published
Packit 6c4009
   by the Free Software Foundation; version 2 of the License, or
Packit 6c4009
   (at your option) any later version.
Packit 6c4009
Packit 6c4009
   This program is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 6c4009
   GNU General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU General Public License
Packit 6c4009
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _CHARMAP_H
Packit 6c4009
#define _CHARMAP_H
Packit 6c4009
Packit 6c4009
#include <obstack.h>
Packit 6c4009
#include <stdbool.h>
Packit 6c4009
#include <stdint.h>
Packit 6c4009
Packit 6c4009
#include "repertoire.h"
Packit 6c4009
#include "simple-hash.h"
Packit 6c4009
Packit 6c4009
Packit 6c4009
struct width_rule
Packit 6c4009
{
Packit 6c4009
  struct charseq *from;
Packit 6c4009
  struct charseq *to;
Packit 6c4009
  unsigned int width;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
struct charmap_t
Packit 6c4009
{
Packit 6c4009
  const char *code_set_name;
Packit 6c4009
  const char *repertoiremap;
Packit 6c4009
  int mb_cur_min;
Packit 6c4009
  int mb_cur_max;
Packit 6c4009
Packit 6c4009
  struct width_rule *width_rules;
Packit 6c4009
  size_t nwidth_rules;
Packit 6c4009
  size_t nwidth_rules_max;
Packit 6c4009
  unsigned int width_default;
Packit 6c4009
Packit 6c4009
  struct obstack mem_pool;
Packit 6c4009
  hash_table char_table;
Packit 6c4009
  hash_table byte_table;
Packit 6c4009
  hash_table ucs4_table;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* This is the structure used for entries in the hash table.  It represents
Packit 6c4009
   the sequence of bytes used for the coded character.  */
Packit 6c4009
struct charseq
Packit 6c4009
{
Packit 6c4009
  const char *name;
Packit 6c4009
  uint32_t ucs4;
Packit 6c4009
  int nbytes;
Packit 6c4009
  unsigned char bytes[0];
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* True if the encoding is not ASCII compatible.  */
Packit 6c4009
extern bool enc_not_ascii_compatible;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Prototypes for charmap handling functions.  */
Packit 6c4009
extern struct charmap_t *charmap_read (const char *filename, int verbose,
Packit 6c4009
				       int error_not_found, int be_quiet,
Packit 6c4009
				       int use_default);
Packit 6c4009
Packit 6c4009
/* Return the value stored under the given key in the hashing table.  */
Packit 6c4009
extern struct charseq *charmap_find_value (const struct charmap_t *charmap,
Packit 6c4009
					   const char *name, size_t len);
Packit 6c4009
Packit 6c4009
/* Return symbol for given multibyte sequence.  */
Packit 6c4009
extern struct charseq *charmap_find_symbol (const struct charmap_t *charmap,
Packit 6c4009
					    const char *name, size_t len);
Packit 6c4009
Packit 6c4009
#endif /* charmap.h */