aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2003-01-16 04:31:29 +0000
committerKenichi Handa2003-01-16 04:31:29 +0000
commitd3985b787890f24be1be7c7dd1850c1bc4714c47 (patch)
tree235ab0af2539c331279204bcfb33b1da90f4d65d /src
parent35ef97a54d856c4a7a9b389a4ffd9b9ceced8ba5 (diff)
downloademacs-d3985b787890f24be1be7c7dd1850c1bc4714c47.tar.gz
emacs-d3985b787890f24be1be7c7dd1850c1bc4714c47.zip
(NEXT_CHAR_BOUNDARY, PREV_CHAR_BOUNDARY): New macros.
Diffstat (limited to 'src')
-rw-r--r--src/charset.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/charset.h b/src/charset.h
index 2b58f88f840..23a46326678 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -634,6 +634,34 @@ else
634 ? 1 \ 634 ? 1 \
635 : multibyte_form_length (str, len)) 635 : multibyte_form_length (str, len))
636 636
637/* If P is before LIMIT, advance P to the next character boundary. It
638 assumes that P is already at a character boundary of the sane
639 mulitbyte form whose end address is LIMIT. */
640
641#define NEXT_CHAR_BOUNDARY(p, limit) \
642 do { \
643 if ((p) < (limit)) \
644 (p) += BYTES_BY_CHAR_HEAD (*(p)); \
645 } while (0)
646
647
648/* If P is after LIMIT, advance P to the previous character boundary.
649 It assumes that P is already at a character boundary of the sane
650 mulitbyte form whose beginning address is LIMIT. */
651
652#define PREV_CHAR_BOUNDARY(p, limit) \
653 do { \
654 if ((p) > (limit)) \
655 { \
656 const unsigned char *p0 = (p); \
657 do { \
658 p0--; \
659 } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \
660 (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \
661 } \
662 } while (0)
663
664
637#ifdef emacs 665#ifdef emacs
638 666
639/* Increase the buffer byte position POS_BYTE of the current buffer to 667/* Increase the buffer byte position POS_BYTE of the current buffer to