Imported Upstream version 1.22.4
[platform/upstream/groff.git] / src / include / DviChar.h
1 /* -*- C -*- */
2 /* Copyright (C) 2014-2018 Free Software Foundation, Inc.
3
4 This file is part of groff.
5
6 groff is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You can find the license text at
17 <http://www.gnu.org/licenses/gpl-2.0.txt>. */
18
19 /*
20  * DviChar.h
21  *
22  * descriptions for mapping dvi names to
23  * font indexes and back.  Dvi fonts are all
24  * 256 elements (actually only 256-32 are usable).
25  *
26  * The encoding names are taken from X -
27  * case insensitive, a dash separating the
28  * CharSetRegistry from the CharSetEncoding
29  */
30
31 # define DVI_MAX_SYNONYMS       10
32 # define DVI_MAP_SIZE           256
33 # define DVI_HASH_SIZE          256
34
35 typedef struct _dviCharNameHash {
36         struct _dviCharNameHash *next;
37         const char              *name;
38         int                     position;
39 } DviCharNameHash;
40
41 typedef struct _dviCharNameMap {
42     const char          *encoding;
43     int                 special;
44     const char          *dvi_names[DVI_MAP_SIZE][DVI_MAX_SYNONYMS];
45     DviCharNameHash     *buckets[DVI_HASH_SIZE];
46 } DviCharNameMap;
47
48 DviCharNameMap          *DviFindMap (char *);
49 void                    DviRegisterMap (DviCharNameMap *);
50 #ifdef NOTDEF
51 char                    *DviCharName (DviCharNameMap *, int, int);
52 #else
53 #define DviCharName(map,index,synonym)  ((map)->dvi_names[index][synonym])
54 #endif
55 int                     DviCharIndex (DviCharNameMap *, const char *);