comparison src/charset.h @ 17833:59aa4a0772f6

(VALID_CHAR_P): New macro. (CHAR_STRING): Comment modified
author Kenichi Handa <handa@m17n.org>
date Fri, 16 May 1997 00:43:26 +0000
parents b5f2a7d6a2d0
children 33e78cc7f058
comparison
equal deleted inserted replaced
17832:0cbd45e72b2d 17833:59aa4a0772f6
461 #define MAKE_CHAR(charset, c1, c2) \ 461 #define MAKE_CHAR(charset, c1, c2) \
462 ((charset) == CHARSET_ASCII \ 462 ((charset) == CHARSET_ASCII \
463 ? (c1) \ 463 ? (c1) \
464 : MAKE_NON_ASCII_CHAR ((charset), (c1) & 0x7F, (c2) & 0x7F)) 464 : MAKE_NON_ASCII_CHAR ((charset), (c1) & 0x7F, (c2) & 0x7F))
465 465
466 /* 1 if C is in the range of possible character code Emacs can have. */
467 #define VALID_CHAR_P(c) \
468 ((c) >= 0 \
469 && (SINGLE_BYTE_CHAR_P (c) \
470 || ((c) < MIN_CHAR_COMPOSITION \
471 ? ((c) & CHAR_FIELD1_MASK \
472 ? (CHAR_FIELD2 (c) >= 32 && CHAR_FIELD3 (c) >= 32) \
473 : (CHAR_FIELD2 (c) >= 16 && CHAR_FIELD3 (c) >= 32)) \
474 : (c) < MIN_CHAR_COMPOSITION + n_cmpchars)))
475
466 /* The charset of non-ASCII character C is set to CHARSET, and the 476 /* The charset of non-ASCII character C is set to CHARSET, and the
467 position-codes of C are set to C1 and C2. C2 of DIMENSION1 character 477 position-codes of C are set to C1 and C2. C2 of DIMENSION1 character
468 is -1. */ 478 is -1. */
469 #define SPLIT_NON_ASCII_CHAR(c, charset, c1, c2) \ 479 #define SPLIT_NON_ASCII_CHAR(c, charset, c1, c2) \
470 ((c) < MIN_CHAR_OFFICIAL_DIMENSION2 \ 480 ((c) < MIN_CHAR_OFFICIAL_DIMENSION2 \
515 525
516 /* Set STR a pointer to the multi-byte form of the character C. If C 526 /* Set STR a pointer to the multi-byte form of the character C. If C
517 is not a composite character, the multi-byte form is set in WORKBUF 527 is not a composite character, the multi-byte form is set in WORKBUF
518 and STR points WORKBUF. The caller should allocate at least 4-byte 528 and STR points WORKBUF. The caller should allocate at least 4-byte
519 area at WORKBUF in advance. Returns the length of the multi-byte 529 area at WORKBUF in advance. Returns the length of the multi-byte
520 form. */ 530 form. If C is an invalid character code, signal an error. */
521 531
522 #define CHAR_STRING(c, workbuf, str) \ 532 #define CHAR_STRING(c, workbuf, str) \
523 (SINGLE_BYTE_CHAR_P (c) \ 533 (SINGLE_BYTE_CHAR_P (c) \
524 ? *(str = workbuf) = (unsigned char)(c), 1 \ 534 ? *(str = workbuf) = (unsigned char)(c), 1 \
525 : non_ascii_char_to_string (c, workbuf, &str)) 535 : non_ascii_char_to_string (c, workbuf, &str))