aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-02-20 01:40:47 +0000
committerKenichi Handa1998-02-20 01:40:47 +0000
commitbb5999ae966d67fe951700fe340cdb1691f1f3ee (patch)
tree2a2d601aa81351b7ceb5bb93e12d2d64a1d7a1ac /src
parentfb88bf2d25eab2ddc569eaad7488707e23760a6e (diff)
downloademacs-bb5999ae966d67fe951700fe340cdb1691f1f3ee.tar.gz
emacs-bb5999ae966d67fe951700fe340cdb1691f1f3ee.zip
(INC_POS): Use macro BASE_LEADING_CODE_P.
(DEC_POS): Make the behaviour consistent with INC_POS. (BUF_INC_POS, BUF_DEC_POS): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/charset.h47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/charset.h b/src/charset.h
index 290ee11ca83..12bc02e48aa 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -628,22 +628,28 @@ else
628 do { \ 628 do { \
629 unsigned char *p = BYTE_POS_ADDR (pos); \ 629 unsigned char *p = BYTE_POS_ADDR (pos); \
630 pos++; \ 630 pos++; \
631 if (*p++ >= 0x80) \ 631 if (BASE_LEADING_CODE_P (*p++)) \
632 while (!CHAR_HEAD_P (*p)) p++, pos++; \ 632 while (!CHAR_HEAD_P (*p)) p++, pos++; \
633 } while (0) 633 } while (0)
634 634
635/* Decrease the buffer point POS of the current buffer to the previous 635/* Decrease the buffer point POS of the current buffer to the previous
636 character boundary. No range checking of POS. */ 636 character boundary. No range checking of POS. */
637#define DEC_POS(pos) \ 637#define DEC_POS(pos) \
638 do { \ 638 do { \
639 unsigned char *p, *p_min; \ 639 unsigned char *p, *p_min; \
640 int pos_saved = --pos; \ 640 \
641 if (pos < GPT_BYTE) \ 641 pos--; \
642 p = BEG_ADDR + pos - 1, p_min = BEG_ADDR; \ 642 if (pos < GPT_BYTE) \
643 else \ 643 p = BEG_ADDR + pos - 1, p_min = BEG_ADDR; \
644 else \
644 p = BEG_ADDR + GAP_SIZE + pos - 1, p_min = GAP_END_ADDR; \ 645 p = BEG_ADDR + GAP_SIZE + pos - 1, p_min = GAP_END_ADDR; \
645 while (p > p_min && !CHAR_HEAD_P (*p)) p--, pos--; \ 646 if (p > p_min && !CHAR_HEAD_P (*p)) \
646 if (*p < 0x80 && pos != pos_saved) pos = pos_saved; \ 647 { \
648 int pos_saved = pos--; \
649 p--; \
650 while (p > p_min && !CHAR_HEAD_P (*p)) p--, pos--; \
651 if (!BASE_LEADING_CODE_P (*p)) pos = pos_saved; \
652 } \
647 } while (0) 653 } while (0)
648 654
649/* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */ 655/* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */
@@ -676,12 +682,12 @@ while (0)
676 character boundary. This macro relies on the fact that *GPT_ADDR 682 character boundary. This macro relies on the fact that *GPT_ADDR
677 and *Z_ADDR are always accessible and the values are '\0'. No 683 and *Z_ADDR are always accessible and the values are '\0'. No
678 range checking of POS. */ 684 range checking of POS. */
679#define BUF_INC_POS(buf, pos) \ 685#define BUF_INC_POS(buf, pos) \
680 do { \ 686 do { \
681 unsigned char *p = BUF_BYTE_ADDRESS (buf, pos); \ 687 unsigned char *p = BUF_BYTE_ADDRESS (buf, pos); \
682 pos++; \ 688 pos++; \
683 if (*p++ >= 0x80) \ 689 if (BASE_LEADING_CODE_P (*p++)) \
684 while (!CHAR_HEAD_P (*p)) p++, pos++; \ 690 while (!CHAR_HEAD_P (*p)) p++, pos++; \
685 } while (0) 691 } while (0)
686 692
687/* Decrease the buffer point POS of the current buffer to the previous 693/* Decrease the buffer point POS of the current buffer to the previous
@@ -700,8 +706,13 @@ while (0)
700 p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos - 1; \ 706 p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos - 1; \
701 p_min = BUF_GAP_END_ADDR (buf); \ 707 p_min = BUF_GAP_END_ADDR (buf); \
702 } \ 708 } \
703 while (p > p_min && !CHAR_HEAD_P (*p)) p--, pos--; \ 709 if (p > p_min && !CHAR_HEAD_P (*p)) \
704 if (*p < 0x80 && pos != pos_saved) pos = pos_saved; \ 710 { \
711 int pos_saved = pos--; \
712 p--; \
713 while (p > p_min && !CHAR_HEAD_P (*p)) p--, pos--; \
714 if (!BASE_LEADING_CODE_P (*p)) pos = pos_saved; \
715 } \
705 } while (0) 716 } while (0)
706 717
707#endif /* emacs */ 718#endif /* emacs */
@@ -756,6 +767,8 @@ extern int n_cmpchars;
756/* Maximum character code currently used. */ 767/* Maximum character code currently used. */
757#define MAX_CHAR (MIN_CHAR_COMPOSITION + n_cmpchars) 768#define MAX_CHAR (MIN_CHAR_COMPOSITION + n_cmpchars)
758 769
770extern void invalid_character P_ ((int));
771
759extern int unify_char P_ ((Lisp_Object, int, int, int, int)); 772extern int unify_char P_ ((Lisp_Object, int, int, int, int));
760extern int split_non_ascii_string P_ ((unsigned char *, int, int *, 773extern int split_non_ascii_string P_ ((unsigned char *, int, int *,
761 unsigned char *, unsigned char *)); 774 unsigned char *, unsigned char *));