aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1999-09-07 12:18:57 +0000
committerKenichi Handa1999-09-07 12:18:57 +0000
commit9dd2aa1a51b5c63c61349a50b692450c3fc02e89 (patch)
tree3739b3acbf07bb6218e2cf1f54ece38ef5192e29 /src
parentacc975b1aa8d1ecc434072d3d5586d9fda6dfcae (diff)
downloademacs-9dd2aa1a51b5c63c61349a50b692450c3fc02e89.tar.gz
emacs-9dd2aa1a51b5c63c61349a50b692450c3fc02e89.zip
Lots of comments fixed.
(PARSE_MULTIBYTE_SEQ): Make it work also for ASCII string. (STRING_CHAR_AND_CHAR_LENGTH): This macro removed.
Diffstat (limited to 'src')
-rw-r--r--src/charset.h50
1 files changed, 32 insertions, 18 deletions
diff --git a/src/charset.h b/src/charset.h
index 775b755c372..fe97b417cff 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -488,10 +488,17 @@ extern int width_by_char_head[256];
488 488
489#define DEFAULT_NONASCII_INSERT_OFFSET 0x800 489#define DEFAULT_NONASCII_INSERT_OFFSET 0x800
490 490
491/* Parse string STR of length LENGTH (>= 2) and check if a composite 491/* Parse composite character string STR of length LENGTH (>= 2) and
492 character is at STR. Actually, the whole multibyte sequence 492 set BYTES to the length of actual multibyte sequence.
493 starting with LEADING_CODE_COMPOSITION is treated as a single 493
494 multibyte character. So, here, we just set BYTES to LENGTH. */ 494 It is assumed that *STR is LEADING_CODE_COMPOSITION and the
495 following (LENGTH - 1) bytes satisfy !CHAR_HEAD_P.
496
497 Actually, the whole multibyte sequence starting with
498 LEADING_CODE_COMPOSITION is treated as a single multibyte
499 character. So, here, we just set BYTES to LENGTH.
500
501 This macro should be called only from PARSE_MULTIBYTE_SEQ. */
495 502
496#define PARSE_COMPOSITE_SEQ(str, length, bytes) \ 503#define PARSE_COMPOSITE_SEQ(str, length, bytes) \
497 do { \ 504 do { \
@@ -499,9 +506,15 @@ extern int width_by_char_head[256];
499 } while (0) 506 } while (0)
500 507
501 508
502/* Parse string STR of length LENGTH (>= 2) and check if a 509/* Parse non-composite multibyte character string STR of length
503 non-composite multibyte character is at STR. Set BYTES to the 510 LENGTH (>= 2) and set BYTES to the length of actual multibyte
504 actual sequence length. */ 511 sequence.
512
513 It is assumed that *STR is one of base leading codes (excluding
514 LEADING_CODE_COMPOSITION) and the following (LENGTH - 1) bytes
515 satisfy !CHAR_HEAD_P.
516
517 This macro should be called only from PARSE_MULTIBYTE_SEQ. */
505 518
506#define PARSE_CHARACTER_SEQ(str, length, bytes) \ 519#define PARSE_CHARACTER_SEQ(str, length, bytes) \
507 do { \ 520 do { \
@@ -517,13 +530,18 @@ extern int width_by_char_head[256];
517#define PARSE_MULTIBYTE_SEQ(str, length, bytes) \ 530#define PARSE_MULTIBYTE_SEQ(str, length, bytes) \
518 do { \ 531 do { \
519 int i = 1; \ 532 int i = 1; \
520 while (i < (length) && ! CHAR_HEAD_P ((str)[i])) i++; \ 533 if (ASCII_BYTE_P (*str)) \
521 if (i == 1) \ 534 bytes = 1; \
522 (bytes) = 1; \
523 else if ((str)[0] == LEADING_CODE_COMPOSITION) \
524 PARSE_COMPOSITE_SEQ (str, i, bytes); \
525 else \ 535 else \
526 PARSE_CHARACTER_SEQ (str, i, bytes); \ 536 { \
537 while (i < (length) && ! CHAR_HEAD_P ((str)[i])) i++; \
538 if (i == 1) \
539 (bytes) = 1; \
540 else if ((str)[0] == LEADING_CODE_COMPOSITION) \
541 PARSE_COMPOSITE_SEQ (str, i, bytes); \
542 else \
543 PARSE_CHARACTER_SEQ (str, i, bytes); \
544 } \
527 } while (0) 545 } while (0)
528 546
529/* The charset of non-ASCII character C is stored in CHARSET, and the 547/* The charset of non-ASCII character C is stored in CHARSET, and the
@@ -546,7 +564,7 @@ extern int width_by_char_head[256];
546 564
547/* The charset of character C is stored in CHARSET, and the 565/* The charset of character C is stored in CHARSET, and the
548 position-codes of C are stored in C1 and C2. 566 position-codes of C are stored in C1 and C2.
549 We store -1 in C2 if the dimension of the charset 1. */ 567 We store -1 in C2 if the dimension of the charset is 1. */
550 568
551#define SPLIT_CHAR(c, charset, c1, c2) \ 569#define SPLIT_CHAR(c, charset, c1, c2) \
552 (SINGLE_BYTE_CHAR_P (c) \ 570 (SINGLE_BYTE_CHAR_P (c) \
@@ -623,10 +641,6 @@ extern int iso_charset_table[2][2][128];
623 ? ((actual_len) = 1), (unsigned char) *(str) \ 641 ? ((actual_len) = 1), (unsigned char) *(str) \
624 : string_to_non_ascii_char (str, len, &(actual_len))) 642 : string_to_non_ascii_char (str, len, &(actual_len)))
625 643
626/* This is like STRING_CHAR_AND_LENGTH but the third arg ACTUAL_LEN
627 does not include garbage bytes following the multibyte character. */
628#define STRING_CHAR_AND_CHAR_LENGTH STRING_CHAR_AND_LENGTH
629
630/* Fetch the "next" multibyte character from Lisp string STRING 644/* Fetch the "next" multibyte character from Lisp string STRING
631 at byte position BYTEIDX, character position CHARIDX. 645 at byte position BYTEIDX, character position CHARIDX.
632 Store it into OUTPUT. 646 Store it into OUTPUT.