aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2002-06-12 00:13:36 +0000
committerKenichi Handa2002-06-12 00:13:36 +0000
commitec7dd615e67f78a758d726a45215a5850960e0df (patch)
tree826205613bae923a0ead8005f7859af0e37e53d4 /src
parentbe8b50bc30e6f0b8d77838fa28389b2a7b3d3185 (diff)
downloademacs-ec7dd615e67f78a758d726a45215a5850960e0df.tar.gz
emacs-ec7dd615e67f78a758d726a45215a5850960e0df.zip
(enum define_charset_arg_index): Delete
charset_arg_parents and add charset_arg_subset and charset_arg_superset,. (enum charset_attr_index): Delete charset_parents and add charset_subset and charset_superset. (enum charset_method): Delete CHARSET_METHOD_INHERIT and add CHARSET_METHOD_SUBSET and CHARSET_METHOD_SUPERSET. (CHARSET_ATTR_PARENTS, CHARSET_PARENTS): Macros deleted. (CHARSET_ATTR_SUBSET, CHARSET_ATTR_SUPERSET, CHARSET_SUBSET, CHARSET_SUPERSET): New macros. (charset_work): Extern it. (ENCODE_CHAR): Use charset_work. (CHAR_CHARSET_P): Adjusted for the change of encoder format. (map_charset_chars): Extern it.
Diffstat (limited to 'src')
-rw-r--r--src/charset.h104
1 files changed, 68 insertions, 36 deletions
diff --git a/src/charset.h b/src/charset.h
index 727246574ea..48b6b35c35e 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -43,7 +43,8 @@ enum define_charset_arg_index
43 charset_arg_invalid_code, 43 charset_arg_invalid_code,
44 charset_arg_code_offset, 44 charset_arg_code_offset,
45 charset_arg_map, 45 charset_arg_map,
46 charset_arg_parents, 46 charset_arg_subset,
47 charset_arg_superset,
47 charset_arg_unify_map, 48 charset_arg_unify_map,
48 charset_arg_plist, 49 charset_arg_plist,
49 charset_arg_max 50 charset_arg_max
@@ -80,9 +81,27 @@ enum charset_attr_index
80 points. */ 81 points. */
81 charset_encoder, 82 charset_encoder,
82 83
83 /* If the method of the charset is `INHERIT', the value is a list 84 /* If the method of the charset is `SUBSET', the value is a vector
84 of the form (PARENT-CHARSET-ID . CODE-OFFSET). */ 85 that has this form:
85 charset_parents, 86
87 [ CHARSET-ID MIN-CODE MAX-CODE OFFSET ]
88
89 CHARSET-ID is an ID number of a parent charset. MIN-CODE and
90 MAX-CODE specify the range of characters inherited from the
91 parent. OFFSET is an integer value to add to a code point of
92 the parent charset to get the corresponding code point of this
93 charset. */
94 charset_subset,
95
96 /* If the method of the charset is `SUPERSET', the value is a list
97 whose elements have this form:
98
99 (CHARSET-ID . OFFSET)
100
101 CHARSET-IDs are ID numbers of parent charsets. OFFSET is an
102 integer value to add to a code point of the parent charset to
103 get the corresponding code point of this charset. */
104 charset_superset,
86 105
87 /* The value is a mapping vector or a file name that contains 106 /* The value is a mapping vector or a file name that contains
88 mapping vector. This provide how characters in the charset 107 mapping vector. This provide how characters in the charset
@@ -118,9 +137,11 @@ enum charset_method
118 CHARSET_METHOD_MAP. */ 137 CHARSET_METHOD_MAP. */
119 CHARSET_METHOD_MAP_DEFERRED, 138 CHARSET_METHOD_MAP_DEFERRED,
120 139
121 /* A charset of this method inherits characters from the other 140 /* A charset of this method is a subset of the other charset. */
122 charsets. */ 141 CHARSET_METHOD_SUBSET,
123 CHARSET_METHOD_INHERIT 142
143 /* A charset of this method is a superset of the other charsets. */
144 CHARSET_METHOD_SUPERSET
124 }; 145 };
125 146
126struct charset 147struct charset
@@ -245,7 +266,8 @@ extern struct charset *emacs_mule_charset[256];
245#define CHARSET_ATTR_MAP(attrs) AREF ((attrs), charset_map) 266#define CHARSET_ATTR_MAP(attrs) AREF ((attrs), charset_map)
246#define CHARSET_ATTR_DECODER(attrs) AREF ((attrs), charset_decoder) 267#define CHARSET_ATTR_DECODER(attrs) AREF ((attrs), charset_decoder)
247#define CHARSET_ATTR_ENCODER(attrs) AREF ((attrs), charset_encoder) 268#define CHARSET_ATTR_ENCODER(attrs) AREF ((attrs), charset_encoder)
248#define CHARSET_ATTR_PARENTS(attrs) AREF ((attrs), charset_parents) 269#define CHARSET_ATTR_SUBSET(attrs) AREF ((attrs), charset_subset)
270#define CHARSET_ATTR_SUPERSET(attrs) AREF ((attrs), charset_superset)
249#define CHARSET_ATTR_UNIFY_MAP(attrs) AREF ((attrs), charset_unify_map) 271#define CHARSET_ATTR_UNIFY_MAP(attrs) AREF ((attrs), charset_unify_map)
250#define CHARSET_ATTR_DEUNIFIER(attrs) AREF ((attrs), charset_deunifier) 272#define CHARSET_ATTR_DEUNIFIER(attrs) AREF ((attrs), charset_deunifier)
251 273
@@ -290,8 +312,10 @@ extern struct charset *emacs_mule_charset[256];
290 (CHARSET_ATTR_DECODER (CHARSET_ATTRIBUTES (charset))) 312 (CHARSET_ATTR_DECODER (CHARSET_ATTRIBUTES (charset)))
291#define CHARSET_ENCODER(charset) \ 313#define CHARSET_ENCODER(charset) \
292 (CHARSET_ATTR_ENCODER (CHARSET_ATTRIBUTES (charset))) 314 (CHARSET_ATTR_ENCODER (CHARSET_ATTRIBUTES (charset)))
293#define CHARSET_PARENTS(charset) \ 315#define CHARSET_SUBSET(charset) \
294 (CHARSET_ATTR_PARENTS (CHARSET_ATTRIBUTES (charset))) 316 (CHARSET_ATTR_SUBSET (CHARSET_ATTRIBUTES (charset)))
317#define CHARSET_SUPERSET(charset) \
318 (CHARSET_ATTR_SUPERSET (CHARSET_ATTRIBUTES (charset)))
295#define CHARSET_UNIFY_MAP(charset) \ 319#define CHARSET_UNIFY_MAP(charset) \
296 (CHARSET_ATTR_UNIFY_MAP (CHARSET_ATTRIBUTES (charset))) 320 (CHARSET_ATTR_UNIFY_MAP (CHARSET_ATTRIBUTES (charset)))
297#define CHARSET_DEUNIFIER(charset) \ 321#define CHARSET_DEUNIFIER(charset) \
@@ -382,24 +406,29 @@ extern Lisp_Object Vchar_charset_set;
382 : decode_char ((charset), (code))) 406 : decode_char ((charset), (code)))
383 407
384 408
409extern Lisp_Object charset_work;
410
385/* Return a code point of CHAR in CHARSET. 411/* Return a code point of CHAR in CHARSET.
386 Try some optimization before calling encode_char. */ 412 Try some optimization before calling encode_char. */
387 413
388#define ENCODE_CHAR(charset, c) \ 414#define ENCODE_CHAR(charset, c) \
389 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \ 415 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
390 ? (c) \ 416 ? (c) \
391 : (charset)->unified_p \ 417 : (charset)->unified_p \
392 ? encode_char ((charset), (c)) \ 418 ? encode_char ((charset), (c)) \
393 : ((c) < (charset)->min_char || (c) > (charset)->max_char) \ 419 : ((c) < (charset)->min_char || (c) > (charset)->max_char) \
394 ? (charset)->invalid_code \ 420 ? (charset)->invalid_code \
395 : (charset)->method == CHARSET_METHOD_OFFSET \ 421 : (charset)->method == CHARSET_METHOD_OFFSET \
396 ? ((charset)->code_linear_p \ 422 ? ((charset)->code_linear_p \
397 ? (c) - (charset)->code_offset + (charset)->min_code \ 423 ? (c) - (charset)->code_offset + (charset)->min_code \
398 : encode_char ((charset), (c))) \ 424 : encode_char ((charset), (c))) \
399 : (charset)->method == CHARSET_METHOD_MAP \ 425 : (charset)->method == CHARSET_METHOD_MAP \
400 ? ((charset)->compact_codes_p \ 426 ? ((charset)->compact_codes_p \
401 ? XFASTINT (CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c))) \ 427 ? (charset_work = CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c)), \
402 : encode_char ((charset), (c))) \ 428 (NILP (charset_work) \
429 ? (charset)->invalid_code \
430 : XFASTINT (charset_work))) \
431 : encode_char ((charset), (c))) \
403 : encode_char ((charset), (c))) 432 : encode_char ((charset), (c)))
404 433
405 434
@@ -445,17 +474,16 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
445 474
446 475
447/* 1 iff CHARSET may contain the character C. */ 476/* 1 iff CHARSET may contain the character C. */
448#define CHAR_CHARSET_P(c, charset) \ 477#define CHAR_CHARSET_P(c, charset) \
449 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \ 478 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
450 || (CHARSET_UNIFIED_P (charset) \ 479 || (CHARSET_UNIFIED_P (charset) \
451 ? encode_char ((charset), (c)) != (charset)->invalid_code \ 480 ? encode_char ((charset), (c)) != (charset)->invalid_code \
452 : (CHARSET_FAST_MAP_REF ((c), (charset)->fast_map) \ 481 : (CHARSET_FAST_MAP_REF ((c), (charset)->fast_map) \
453 && ((charset)->method == CHARSET_METHOD_OFFSET \ 482 && ((charset)->method == CHARSET_METHOD_OFFSET \
454 ? (c) >= (charset)->min_char && (c) <= (charset)->max_char \ 483 ? (c) >= (charset)->min_char && (c) <= (charset)->max_char \
455 : ((charset)->method == CHARSET_METHOD_MAP \ 484 : ((charset)->method == CHARSET_METHOD_MAP \
456 && (charset)->compact_codes_p) \ 485 && (charset)->compact_codes_p) \
457 ? (XFASTINT (CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c))) \ 486 ? ! NILP (CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c))) \
458 != (charset)->invalid_code) \
459 : encode_char ((charset), (c)) != (charset)->invalid_code)))) 487 : encode_char ((charset), (c)) != (charset)->invalid_code))))
460 488
461 489
@@ -476,6 +504,10 @@ extern int decode_char P_ ((struct charset *, unsigned));
476extern unsigned encode_char P_ ((struct charset *, int)); 504extern unsigned encode_char P_ ((struct charset *, int));
477extern int string_xstring_p P_ ((Lisp_Object)); 505extern int string_xstring_p P_ ((Lisp_Object));
478 506
507extern void map_charset_chars P_ ((void (*) (Lisp_Object, Lisp_Object),
508 Lisp_Object, Lisp_Object,
509 struct charset *, unsigned, unsigned));
510
479EXFUN (Funify_charset, 2); 511EXFUN (Funify_charset, 2);
480 512
481#endif /* EMACS_CHARSET_H */ 513#endif /* EMACS_CHARSET_H */