+#define BUF_SET_PT(buffer, position) \
+ (set_point ((buffer), (position)))
+#define BUF_TEMP_SET_PT(buffer, position) \
+ (temp_set_point ((buffer), (position)))
+
+extern void set_point P_ ((struct buffer *, int));
+extern INLINE void temp_set_point P_ ((struct buffer *, int));
+extern void set_point_both P_ ((struct buffer *, int, int));
+extern INLINE void temp_set_point_both P_ ((struct buffer *, int, int));
+
+#else /* don't support text properties */
+
+#define SET_PT(position) (current_buffer->pt = (position))
+#define TEMP_SET_PT(position) (current_buffer->pt = (position))
+
+#define SET_PT_BOTH(position, byte) \
+ (current_buffer->pt = (position), \
+ current_buffer->pt_byte = (byte))
+
+#define TEMP_SET_PT_BOTH(position, byte) \
+ (current_buffer->pt = (position), \
+ current_buffer->pt_byte = (byte))
+
+#define BUF_SET_PT(buffer, position) (buffer->pt = (position))
+#define BUF_TEMP_SET_PT(buffer, position) (buffer->pt = (position))
+#endif /* don't support text properties */
+\f
+/* Macros for setting the BEGV, ZV or PT of a given buffer.
+
+ SET_BUF_PT* seet to be redundant. Get rid of them?
+
+ The ..._BOTH macros take both a charpos and a bytepos,
+ which must correspond to each other.
+
+ The macros without ..._BOTH take just a charpos,
+ and compute the bytepos from it. */
+
+#define SET_BUF_BEGV(buf, charpos) \
+ ((buf)->begv_byte = buf_charpos_to_bytepos ((buf), (charpos)), \
+ (buf)->begv = (charpos))
+
+#define SET_BUF_ZV(buf, charpos) \
+ ((buf)->zv_byte = buf_charpos_to_bytepos ((buf), (charpos)), \
+ (buf)->zv = (charpos))
+
+#define SET_BUF_BEGV_BOTH(buf, charpos, byte) \
+ ((buf)->begv = (charpos), \
+ (buf)->begv_byte = (byte))
+
+#define SET_BUF_ZV_BOTH(buf, charpos, byte) \
+ ((buf)->zv = (charpos), \
+ (buf)->zv_byte = (byte))
+
+#define SET_BUF_PT_BOTH(buf, charpos, byte) \
+ ((buf)->pt = (charpos), \
+ (buf)->pt_byte = (byte))
+\f
+/* Macros to access a character or byte in the current buffer,
+ or convert between a byte position and an address.
+ These macros do not check that the position is in range. */
+
+/* Access a Lisp position value in POS,
+ and store the charpos in CHARPOS and the bypepos in BYPEPOS. */
+
+#define DECODE_POSITION(charpos, bytepos, pos) \
+if (1) \
+ { \
+ Lisp_Object __pos = (pos); \
+ if (NUMBERP (__pos)) \
+ { \
+ charpos = __pos; \
+ bytepos = buf_charpos_to_bytepos (current_buffer, __pos); \
+ } \
+ else if (MARKERP (__pos)) \
+ { \
+ charpos = marker_position (__pos); \
+ bytepos = marker_byte_position (__pos); \
+ } \
+ else \
+ wrong_type_argument (Qinteger_or_marker_p, __pos); \
+ } \
+else
+
+/* Return the address of byte position N in current buffer. */
+
+#define BYTE_POS_ADDR(n) \
+ (((n) >= GPT_BYTE ? GAP_SIZE : 0) + (n) + BEG_ADDR - 1)
+
+/* Return the address of char position N. */
+
+#define CHAR_POS_ADDR(n) \
+ (((n) >= GPT ? GAP_SIZE : 0) \
+ + buf_charpos_to_bytepos (current_buffer, n) \
+ + BEG_ADDR - 1)
+
+/* Convert a character position to a byte position. */
+
+#define CHAR_TO_BYTE(charpos) \
+ (buf_charpos_to_bytepos (current_buffer, charpos))
+
+/* Convert a byte position to a character position. */
+
+#define BYTE_TO_CHAR(bytepos) \
+ (buf_bytepos_to_charpos (current_buffer, bytepos))
+
+/* Convert PTR, the address of a byte in the buffer, into a byte position. */
+
+#define PTR_BYTE_POS(ptr) \
+((ptr) - (current_buffer)->text->beg \
+ - (ptr - (current_buffer)->text->beg < (unsigned) GPT_BYTE ? 0 : GAP_SIZE) \
+ + 1)
+
+/* Return character at position POS. */
+
+#define FETCH_CHAR(pos) \
+ (!NILP (current_buffer->enable_multibyte_characters) \
+ ? FETCH_MULTIBYTE_CHAR ((pos)) \
+ : FETCH_BYTE ((pos)))
+
+/* Return the byte at byte position N. */
+
+#define FETCH_BYTE(n) *(BYTE_POS_ADDR ((n)))
+
+/* 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
+ POS is returned. No range checking. */
+
+#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))
+\f
+/* Macros for accessing a character or byte,
+ or converting between byte positions and addresses,
+ in a specified buffer. */
+
+/* Return the address of character at byte position POS in buffer BUF.