summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2002-08-20 03:59:29 +0000
committerKenichi Handa <handa@m17n.org>2002-08-20 03:59:29 +0000
commitfeb3066c150a1465094fa608143dba2caaa0afe1 (patch)
treec66cca880387972678b29268ef4f4da48246dd63 /src/buffer.h
parent3e411074503a75b3cb85da2bdb6d5b42bbf64a38 (diff)
downloademacs-feb3066c150a1465094fa608143dba2caaa0afe1.tar.gz
(_fetch_multibyte_char_len): Extern deleted.
(FETCH_MULTIBYTE_CHAR): Don't use _fetch_multibyte_char_len. (BUF_FETCH_MULTIBYTE_CHAR): Likewise. (FETCH_CHAR_AS_MULTIBYTE): New macro.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 6d11035bb4e..447c618f77a 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -319,7 +319,6 @@ else
/* Variables used locally in FETCH_MULTIBYTE_CHAR. */
extern unsigned char *_fetch_multibyte_char_p;
-extern int _fetch_multibyte_char_len;
/* Return character code of multi-byte form at position POS. If POS
doesn't point the head of valid multi-byte form, only the byte at
@@ -328,9 +327,17 @@ extern int _fetch_multibyte_char_len;
#define FETCH_MULTIBYTE_CHAR(pos) \
(_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0) \
+ (pos) + BEG_ADDR - 1), \
- _fetch_multibyte_char_len \
- = ((pos) >= GPT_BYTE ? ZV_BYTE : GPT_BYTE) - (pos), \
- STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
+ STRING_CHAR (_fetch_multibyte_char_p, 0))
+
+/* Return character at position POS. If the current buffer is unibyte
+ and the character is not ASCII, make the returning character
+ multibyte. */
+
+#define FETCH_CHAR_AS_MULTIBYTE(pos) \
+ (!NILP (current_buffer->enable_multibyte_characters) \
+ ? FETCH_MULTIBYTE_CHAR ((pos)) \
+ : unibyte_char_to_multibyte (FETCH_BYTE ((pos))))
+
/* Macros for accessing a character or byte,
or converting between byte positions and addresses,
@@ -379,10 +386,7 @@ extern int _fetch_multibyte_char_len;
(_fetch_multibyte_char_p \
= (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0) \
+ (pos) + BUF_BEG_ADDR (buf) - 1), \
- _fetch_multibyte_char_len \
- = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_ZV_BYTE (buf) : BUF_GPT_BYTE (buf)) \
- - (pos)), \
- STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
+ STRING_CHAR (_fetch_multibyte_char_p, 0))
/* Define the actual buffer data structures. */