annotate src/charset.h @ 88605:af5e229d578e

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Thu, 23 May 2002 01:02:14 +0000
parents 47c2e6825a1e
children 61f981fb213a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
1 /* Header for charset handler.
20708
ed9ed828415e Update copyright year.
Richard M. Stallman <rms@gnu.org>
parents: 20589
diff changeset
2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
18341
33e78cc7f058 Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents: 17833
diff changeset
3 Licensed to the Free Software Foundation.
38395
b7a9187751b2 (CHAR_STRING_NO_SIGNAL): New macro.
Gerd Moellmann <gerd@gnu.org>
parents: 35949
diff changeset
4 Copyright (C) 2001 Free Software Foundation, Inc.
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
5 Copyright (C) 2001, 2002
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
6 National Institute of Advanced Industrial Science and Technology (AIST)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
7 Registration Number H13PRO009
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
9 This file is part of GNU Emacs.
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
10
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
11 GNU Emacs is free software; you can redistribute it and/or modify
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
12 it under the terms of the GNU General Public License as published by
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
13 the Free Software Foundation; either version 2, or (at your option)
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
14 any later version.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
16 GNU Emacs is distributed in the hope that it will be useful,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
19 GNU General Public License for more details.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
21 You should have received a copy of the GNU General Public License
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 along with GNU Emacs; see the file COPYING. If not, write to
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
24 Boston, MA 02111-1307, USA. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25
29570
825505ff211e (EMACS_CHARSET_H): Renamed from _CHARSET_H.
Kenichi Handa <handa@m17n.org>
parents: 29539
diff changeset
26 #ifndef EMACS_CHARSET_H
825505ff211e (EMACS_CHARSET_H): Renamed from _CHARSET_H.
Kenichi Handa <handa@m17n.org>
parents: 29539
diff changeset
27 #define EMACS_CHARSET_H
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
29 /* Index to arguments of Fdefine_charset_internal. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
31 enum define_charset_arg_index
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
32 {
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
33 charset_arg_name,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
34 charset_arg_dimension,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
35 charset_arg_code_space,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
36 charset_arg_iso_final,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
37 charset_arg_iso_revision,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
38 charset_arg_emacs_mule_id,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
39 charset_arg_ascii_compatible_p,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
40 charset_arg_supplementary_p,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
41 charset_arg_invalid_code,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
42 charset_arg_code_offset,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
43 charset_arg_map,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
44 charset_arg_parents,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
45 charset_arg_unify_map,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
46 charset_arg_plist,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
47 charset_arg_max
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
48 };
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
50
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
51 /* Indices to charset attributes vector. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
53 enum charset_attr_index
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
54 {
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
55 /* ID number of the charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
56 charset_id,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
58 /* Name of the charset (symbol). */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
59 charset_name,
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
60
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
61 /* Property list of the charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
62 charset_plist,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
63
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
64 /* If the method of the charset is `MAP_DEFERRED', the value is a
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
65 mapping vector or a file name that contains mapping vector.
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
66 Otherwise, nil. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
67 charset_map,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
68
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
69 /* If the method of the charset is `MAP', the value is a vector
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
70 that maps code points of the charset to characters. The vector
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
71 is indexed by a character index. A character index is
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
72 calculated from a code point and the code-space table of the
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
73 charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
74 charset_decoder,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
75
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
76 /* If the method of the charset is `MAP', the value is a
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
77 char-table that maps characters of the charset to code
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
78 points. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
79 charset_encoder,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
81 /* If the method of the charset is `INHERIT', the value is a list
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
82 of the form (PARENT-CHARSET-ID . CODE-OFFSET). */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
83 charset_parents,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
85 /* The value is a mapping vector or a file name that contains
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
86 mapping vector. This provide how characters in the charset
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
87 should be unified with Unicode. The value of the member
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
88 `charset_deunifier' is created from this information. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
89 charset_unify_map,
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
90
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
91 /* If characters in the charset must be unified Unicode, the value
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
92 is a char table that maps a character code in the charset to
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
93 the corresponding Unicode character. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
94 charset_deunifier,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
96 /* The length of charset attribute vector. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
97 charset_attr_max
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
98 };
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
99
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
100 /* Methods for converting code points and characters of charsets. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
101
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
102 enum charset_method
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
103 {
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
104 /* For a charset of this method, a character code is calculated
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
105 from a character index (which is calculated from a code point)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
106 simply by adding an offset value. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
107 CHARSET_METHOD_OFFSET,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
109 /* For a charset of this method, a decoder vector and an encoder
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
110 char-table is used for code point <-> character code
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
111 conversion. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
112 CHARSET_METHOD_MAP,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
114 /* Same as above but decoder and encoder are loaded from a file on
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
115 demand. Once loaded, the method is changed to
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
116 CHARSET_METHOD_MAP. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
117 CHARSET_METHOD_MAP_DEFERRED,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
118
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
119 /* A charset of this method inherits characters from the other
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
120 charsets. */
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
121 CHARSET_METHOD_INHERIT
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
122 };
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
124 struct charset
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
125 {
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
126 /* Index to charset_table. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
127 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
129 /* Index to Vcharset_hash_table. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
130 int hash_index;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
132 /* Dimension of the charset: 1, 2, 3, or 4. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
133 int dimension;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134
88476
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
135 /* Byte code range of each dimension. <code_space>[4N] is a mininum
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
136 byte code of the (N+1)th dimension, <code_space>[4N+1] is a
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
137 maximum byte code of the (N+1)th dimension, <code_space>[4N+2] is
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
138 (<code_space>[4N+1] - <code_space>[4N] + 1), <code_space>[4N+3]
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
139 is a number of characters containd in the first to (N+1)th
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
140 dismesions. We get `char-index' of a `code-point' from this
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
141 information. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
142 int code_space[16];
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143
88476
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
144 /* If B is a byte of Nth dimension of a code-point, the (N-1)th bit
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
145 of code_space_mask[B] is set. This array is used to quickly
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
146 check if a code-point is in a valid range. */
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
147 unsigned char *code_space_mask;
47c2e6825a1e (struct charset): New member `code_space_mask'.
Kenichi Handa <handa@m17n.org>
parents: 88436
diff changeset
148
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
149 /* 1 if there's no gap in code-points. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
150 int code_linear_p;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
152 /* If the charset is treated as 94-chars in ISO-2022, the value is 0.
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
153 If the charset is treated as 96-chars in ISO-2022, the value is 1. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
154 int iso_chars_96;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
156 /* ISO final byte of the charset: 48..127. It may be -1 if the
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
157 charset doesn't conform to ISO-2022. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
158 int iso_final;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
159
88436
29c4241b5418 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88364
diff changeset
160 /* ISO revision number of the charset. */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
161 int iso_revision;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
163 /* If the charset is identical to what supported by Emacs 21 and the
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
164 priors, the identification number of the charset used in those
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
165 version. Otherwise, -1. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
166 int emacs_mule_id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
168 /* Nonzero iff the charset is compatible with ASCII. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
169 int ascii_compatible_p;
35478
340a9e4aeb29 comment fixes
Dave Love <fx@gnu.org>
parents: 35408
diff changeset
170
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
171 /* Nonzero iff the charset is supplementary. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
172 int supplementary_p;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
173
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
174 /* Nonzero iff all the code points are representable by Lisp_Int. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
175 int compact_codes_p;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
177 /* The method for encoding/decoding characters of the charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
178 enum charset_method method;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
180 /* Mininum and Maximum code points of the charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
181 unsigned min_code, max_code;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
183 /* Mininum and Maximum character codes of the charset. If the
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
184 charset is compatible with ASCII, min_char is a minimum non-ASCII
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
185 character of the charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
186 int min_char, max_char;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
187
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
188 /* The code returned by ENCODE_CHAR if a character is not encodable
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
189 by the charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
190 unsigned invalid_code;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
191
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
192 /* If the method of the charset is CHARSET_METHOD_MAP, this is a
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
193 table of bits used to quickly and roughly guess if a character
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
194 belongs to the charset.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
196 The first 64 elements are 512 bits for characters less than
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
197 0x10000. Each bit corresponds to 128-character block. The last
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
198 126 elements are 1008 bits for the greater characters
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
199 (0x10000..0x3FFFFF). Each bit corresponds to 4096-character
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
200 block.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
202 If a bit is 1, at least one character in the corresponds block is
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
203 in this charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
204 unsigned char fast_map[190];
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
206 /* Offset value to calculate a character code from code-point, and
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
207 visa versa. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
208 int code_offset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
210 int unified_p;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
211 };
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
213 /* Hash table of charset symbols vs. the correponding attribute
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
214 vectors. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
215 extern Lisp_Object Vcharset_hash_table;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
217 /* Table of struct charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
218 extern struct charset *charset_table;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
219 extern int charset_table_used;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
221 #define CHARSET_FROM_ID(id) (charset_table + (id))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
223 extern Lisp_Object Vcharset_list;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
224 extern Lisp_Object Viso_2022_charset_list;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
225 extern Lisp_Object Vemacs_mule_charset_list;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
226
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
227 extern struct charset *emacs_mule_charset[256];
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
228
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
230 /* Macros to access information about charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
231
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
232 /* Return the attribute vector of charset whose symbol is SYMBOL. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
233 #define CHARSET_SYMBOL_ATTRIBUTES(symbol) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
234 Fgethash ((symbol), Vcharset_hash_table, Qnil)
17833
59aa4a0772f6 (VALID_CHAR_P): New macro.
Kenichi Handa <handa@m17n.org>
parents: 17726
diff changeset
235
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
236 #define CHARSET_ATTR_ID(attrs) AREF ((attrs), charset_id)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
237 #define CHARSET_ATTR_NAME(attrs) AREF ((attrs), charset_name)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
238 #define CHARSET_ATTR_PLIST(attrs) AREF ((attrs), charset_plist)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
239 #define CHARSET_ATTR_MAP(attrs) AREF ((attrs), charset_map)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
240 #define CHARSET_ATTR_DECODER(attrs) AREF ((attrs), charset_decoder)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
241 #define CHARSET_ATTR_ENCODER(attrs) AREF ((attrs), charset_encoder)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
242 #define CHARSET_ATTR_PARENTS(attrs) AREF ((attrs), charset_parents)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
243 #define CHARSET_ATTR_UNIFY_MAP(attrs) AREF ((attrs), charset_unify_map)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
244 #define CHARSET_ATTR_DEUNIFIER(attrs) AREF ((attrs), charset_deunifier)
21033
9f32198e0d9f (NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents: 20932
diff changeset
245
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
246 #define CHARSET_SYMBOL_ID(symbol) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
247 CHARSET_ATTR_ID (CHARSET_SYMBOL_ATTRIBUTES (symbol))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
248
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
249 /* Return an index to Vcharset_hash_table of the charset whose symbol
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
250 is SYMBOL. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
251 #define CHARSET_SYMBOL_HASH_INDEX(symbol) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
252 hash_lookup (XHASH_TABLE (Vcharset_hash_table), symbol, NULL)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
253
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
254 /* Return the attribute vector of CHARSET. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
255 #define CHARSET_ATTRIBUTES(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
256 (HASH_VALUE (XHASH_TABLE (Vcharset_hash_table), (charset)->hash_index))
21033
9f32198e0d9f (NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents: 20932
diff changeset
257
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
258 #define CHARSET_ID(charset) ((charset)->id)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
259 #define CHARSET_HASH_INDEX(charset) ((charset)->hash_index)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
260 #define CHARSET_DIMENSION(charset) ((charset)->dimension)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
261 #define CHARSET_CODE_SPACE(charset) ((charset)->code_space)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
262 #define CHARSET_CODE_LINEAR_P(charset) ((charset)->code_linear_p)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
263 #define CHARSET_ISO_CHARS_96(charset) ((charset)->iso_chars_96)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
264 #define CHARSET_ISO_FINAL(charset) ((charset)->iso_final)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
265 #define CHARSET_ISO_PLANE(charset) ((charset)->iso_plane)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
266 #define CHARSET_ISO_REVISION(charset) ((charset)->iso_revision)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
267 #define CHARSET_EMACS_MULE_ID(charset) ((charset)->emacs_mule_id)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
268 #define CHARSET_ASCII_COMPATIBLE_P(charset) ((charset)->ascii_compatible_p)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
269 #define CHARSET_COMPACT_CODES_P(charset) ((charset)->compact_codes_p)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
270 #define CHARSET_METHOD(charset) ((charset)->method)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
271 #define CHARSET_MIN_CODE(charset) ((charset)->min_code)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
272 #define CHARSET_MAX_CODE(charset) ((charset)->max_code)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
273 #define CHARSET_INVALID_CODE(charset) ((charset)->invalid_code)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
274 #define CHARSET_MIN_CHAR(charset) ((charset)->min_char)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
275 #define CHARSET_MAX_CHAR(charset) ((charset)->max_char)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
276 #define CHARSET_CODE_OFFSET(charset) ((charset)->code_offset)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
277 #define CHARSET_UNIFIED_P(charset) ((charset)->unified_p)
25505
4d5f87073d63 (MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents: 25234
diff changeset
278
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
279 #define CHARSET_NAME(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
280 (CHARSET_ATTR_NAME (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
281 #define CHARSET_MAP(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
282 (CHARSET_ATTR_MAP (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
283 #define CHARSET_DECODER(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
284 (CHARSET_ATTR_DECODER (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
285 #define CHARSET_ENCODER(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
286 (CHARSET_ATTR_ENCODER (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
287 #define CHARSET_PARENTS(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
288 (CHARSET_ATTR_PARENTS (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
289 #define CHARSET_UNIFY_MAP(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
290 (CHARSET_ATTR_UNIFY_MAP (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
291 #define CHARSET_DEUNIFIER(charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
292 (CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
293
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
294
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
295 /* Nonzero iff OBJ is a valid charset symbol. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
296 #define CHARSETP(obj) (CHARSET_SYMBOL_HASH_INDEX (obj) >= 0)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
297
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
298 /* Check if X is a valid charset symbol. If not, signal an error. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
299 #define CHECK_CHARSET(x) \
25505
4d5f87073d63 (MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents: 25234
diff changeset
300 do { \
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
301 if (! SYMBOLP (x) || CHARSET_SYMBOL_HASH_INDEX (x) < 0) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
302 x = wrong_type_argument (Qcharsetp, (x)); \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
303 } while (0)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
304
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
305
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
306 /* Check if X is a valid charset symbol. If valid, set ID to the id
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
307 number of the charset. Otherwise, signal an error. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
308 #define CHECK_CHARSET_GET_ID(x, id) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
309 do { \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
310 int idx; \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
311 \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
312 if (! SYMBOLP (x) || (idx = CHARSET_SYMBOL_HASH_INDEX (x)) < 0) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
313 x = wrong_type_argument (Qcharsetp, (x)); \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
314 id = AREF (HASH_VALUE (XHASH_TABLE (Vcharset_hash_table), idx), \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
315 charset_id); \
25505
4d5f87073d63 (MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents: 25234
diff changeset
316 } while (0)
21033
9f32198e0d9f (NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents: 20932
diff changeset
317
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
318
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
319 /* Check if X is a valid charset symbol. If valid, set ATTR to the
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
320 attr vector of the charset. Otherwise, signal an error. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
321 #define CHECK_CHARSET_GET_ATTR(x, attr) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
322 do { \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
323 if (!SYMBOLP (x) || NILP (attr = CHARSET_SYMBOL_ATTRIBUTES (x))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
324 x = wrong_type_argument (Qcharsetp, (x)); \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
325 } while (0)
19319
9ea3c87ea61d Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 18341
diff changeset
326
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
327
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
328 #define CHECK_CHARSET_GET_CHARSET(x, charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
329 do { \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
330 int id; \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
331 CHECK_CHARSET_GET_ID (x, id); \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
332 charset = CHARSET_FROM_ID (id); \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
333 } while (0)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
334
19319
9ea3c87ea61d Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 18341
diff changeset
335
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
336 /* Lookup Vcharset_order_list and return the first charset that
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
337 contains the character C. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
338 #define CHAR_CHARSET(c) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
339 char_charset ((c), Qnil, NULL)
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
340
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
341 #if 0
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
342 /* Char-table of charset-sets. Each element is a bool vector indexed
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
343 by a charset ID. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
344 extern Lisp_Object Vchar_charset_set;
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
345
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
346 /* Charset-bag of character C. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
347 #define CHAR_CHARSET_SET(c) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
348 CHAR_TABLE_REF (Vchar_charset_set, c)
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
349
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
350 /* Check if two characters C1 and C2 belong to the same charset. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
351 #define SAME_CHARSET_P(c1, c2) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
352 intersection_p (CHAR_CHARSET_SET (c1), CHAR_CHARSET_SET (c2))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
353
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
354 #endif
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
355
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
356
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
357 /* Return a character correponding to the code-point CODE of CHARSET.
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
358 Try some optimization before calling decode_char. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
359
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
360 #define DECODE_CHAR(charset, code) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
361 ((ASCII_BYTE_P (code) && (charset)->ascii_compatible_p) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
362 ? (code) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
363 : ((code) < (charset)->min_code || (code) > (charset)->max_code) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
364 ? -1 \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
365 : (charset)->unified_p \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
366 ? decode_char ((charset), (code)) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
367 : (charset)->method == CHARSET_METHOD_OFFSET \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
368 ? ((charset)->code_linear_p \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
369 ? (code) - (charset)->min_code + (charset)->code_offset \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
370 : decode_char ((charset), (code))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
371 : (charset)->method == CHARSET_METHOD_MAP \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
372 ? ((charset)->code_linear_p \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
373 ? XINT (AREF (CHARSET_DECODER (charset), \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
374 (code) - (charset)->min_code)) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
375 : decode_char ((charset), (code))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
376 : decode_char ((charset), (code)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
377
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
378
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
379 /* Return a code point of CHAR in CHARSET.
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
380 Try some optimization before calling encode_char. */
19319
9ea3c87ea61d Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 18341
diff changeset
381
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
382 #define ENCODE_CHAR(charset, c) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
383 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
384 ? (c) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
385 : (charset)->unified_p \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
386 ? encode_char ((charset), (c)) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
387 : ((c) < (charset)->min_char || (c) > (charset)->max_char) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
388 ? (charset)->invalid_code \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
389 : (charset)->method == CHARSET_METHOD_OFFSET \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
390 ? ((charset)->code_linear_p \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
391 ? (c) - (charset)->code_offset + (charset)->min_code \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
392 : encode_char ((charset), (c))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
393 : (charset)->method == CHARSET_METHOD_MAP \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
394 ? ((charset)->compact_codes_p \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
395 ? XFASTINT (CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
396 : encode_char ((charset), (c))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
397 : encode_char ((charset), (c)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
398
25505
4d5f87073d63 (MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents: 25234
diff changeset
399
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
400 /* Set to 1 when a charset map is loaded to warn that a buffer text
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
401 and a string data may be relocated. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
402 extern int charset_map_loaded;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
403
19319
9ea3c87ea61d Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 18341
diff changeset
404
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
405 /* Set CHARSET to the charset highest priority of C, CODE to the
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
406 code-point of C in CHARSET. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
407 #define SPLIT_CHAR(c, charset, code) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
408 ((charset) = char_charset ((c), Qnil, &(code)))
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
409
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
410
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
411 #define ISO_MAX_DIMENSION 3
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
412 #define ISO_MAX_CHARS 2
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
413 #define ISO_MAX_FINAL 0x80 /* only 0x30..0xFF are used */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
414
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
415 /* Mapping table from ISO2022's charset (specified by DIMENSION,
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
416 CHARS, and FINAL_CHAR) to Emacs' charset ID. Should be accessed by
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417 macro ISO_CHARSET_TABLE (DIMENSION, CHARS, FINAL_CHAR). */
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
418 extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
419
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
420 /* A charset of type iso2022 who has DIMENSION, CHARS, and FINAL
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
421 (final character). */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
422 #define ISO_CHARSET_TABLE(dimension, chars_96, final) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
423 iso_charset_table[(dimension) - 1][(chars_96)][(final)]
20589
3acb053e757e (FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 20531
diff changeset
424
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
425 /* Nonzero iff the charset who has FAST_MAP may contain C. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
426 #define CHARSET_FAST_MAP_REF(c, fast_map) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
427 ((c) < 0x10000 \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
428 ? fast_map[(c) >> 10] & (1 << (((c) >> 7) & 7)) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
429 : fast_map[((c) >> 15) + 62] & (1 << (((c) >> 12) & 7)))
26843
0aadeca4a4a7 In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents: 25637
diff changeset
430
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
431 #define CHARSET_FAST_MAP_SET(c, fast_map) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
432 do { \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
433 if ((c) < 0x10000) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
434 (fast_map)[(c) >> 10] |= 1 << (((c) >> 7) & 7); \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
435 else \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
436 (fast_map)[((c) >> 15) + 62] |= 1 << (((c) >> 12) & 7); \
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
437 } while (0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
438
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
439
20531
f019e056ad9a (CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents: 20352
diff changeset
440
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
441 /* 1 iff CHARSET may contain the character C. */
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
442 #define CHAR_CHARSET_P(c, charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
443 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
444 || (CHARSET_UNIFIED_P (charset) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
445 ? encode_char ((charset), (c)) != (charset)->invalid_code \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
446 : (CHARSET_FAST_MAP_REF ((c), (charset)->fast_map) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
447 && ((charset)->method == CHARSET_METHOD_OFFSET \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
448 ? (c) >= (charset)->min_char && (c) <= (charset)->max_char \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
449 : ((charset)->method == CHARSET_METHOD_MAP \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
450 && (charset)->compact_codes_p) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
451 ? (XFASTINT (CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c))) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
452 != (charset)->invalid_code) \
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
453 : encode_char ((charset), (c)) != (charset)->invalid_code))))
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
454
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
455
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
456 extern Lisp_Object Qcharsetp;
29004
383e4e21306a (LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents: 28513
diff changeset
457
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
458 extern Lisp_Object Qascii, Qunicode;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
459 extern int charset_ascii, charset_8_bit_control, charset_8_bit_graphic;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
460 extern int charset_iso_8859_1;
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
461 extern int charset_primary;
20932
3c2c8431c51d (INC_POS): Use macro BASE_LEADING_CODE_P.
Kenichi Handa <handa@m17n.org>
parents: 20904
diff changeset
462
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
463 extern struct charset *char_charset P_ ((int, Lisp_Object, unsigned *));
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
464 extern Lisp_Object charset_attributes P_ ((int));
17726
b5f2a7d6a2d0 (unify_char): Extern it.
Kenichi Handa <handa@m17n.org>
parents: 17321
diff changeset
465
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
466 extern int decode_char P_ ((struct charset *, unsigned));
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
467 extern unsigned encode_char P_ ((struct charset *, int));
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
468 extern int string_xstring_p P_ ((Lisp_Object));
23488
958ab288116d (Vauto_fill_chars): Extern it.
Kenichi Handa <handa@m17n.org>
parents: 23202
diff changeset
469
88364
f6557aebe110 Completely re-written. Character and multibyte
Kenichi Handa <handa@m17n.org>
parents: 42473
diff changeset
470 EXFUN (Funify_charset, 2);
20719
78d95f2a9d92 (BCOPY_SHORT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 20708
diff changeset
471
29570
825505ff211e (EMACS_CHARSET_H): Renamed from _CHARSET_H.
Kenichi Handa <handa@m17n.org>
parents: 29539
diff changeset
472 #endif /* EMACS_CHARSET_H */