changeset 8061:ce94573db44d

(BUF_PTR_CHAR_POS): New macro.
author Richard M. Stallman <rms@gnu.org>
date Sat, 25 Jun 1994 22:34:25 +0000
parents 5b9bbe66631c
children ad595e4e165c
files src/buffer.h
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.h	Sat Jun 25 22:27:06 1994 +0000
+++ b/src/buffer.h	Sat Jun 25 22:34:25 1994 +0000
@@ -130,6 +130,13 @@
 ((ptr) - (current_buffer)->text.beg					\
  - (ptr - (current_buffer)->text.beg < (unsigned) GPT ? 0 : GAP_SIZE)	\
  + 1)
+
+/* Convert the address of a char in the buffer into a character position.  */
+#define BUF_PTR_CHAR_POS(buf, ptr)			\
+((ptr) - (buf)->text.beg				\
+ - (ptr - (buf)->text.beg < (unsigned) BUF_GPT ((buf))	\
+    ? 0 : BUF_GAP_SIZE ((buf)))				\
+ + 1)
 
 struct buffer_text
   {