#define _XEMACS_BUFFER_H_
#ifdef MULE
-#include "mule-charset.h"
+#include "character.h"
#endif
/************************************************************************/
This information is text-only so it goes here. */
Bufpos mule_bufmin, mule_bufmax;
Bytind mule_bytmin, mule_bytmax;
+#ifdef UTF2000
+ int mule_size;
+#else
int mule_shifter, mule_three_p;
+#endif
/* And we also cache 16 positions for fairly fast access near those
positions. */
#define REAL_INC_CHARPTR(ptr) \
((void) ((ptr) += REP_BYTES_BY_FIRST_BYTE (* (unsigned char *) (ptr))))
+#define REAL_INC_CHARBYTIND(ptr,pos) \
+ (pos += REP_BYTES_BY_FIRST_BYTE (* (unsigned char *) (ptr)))
+
#define REAL_DEC_CHARPTR(ptr) do { \
(ptr)--; \
} while (!VALID_CHARPTR_P (ptr))
REAL_INC_CHARPTR (ptr); \
} while (0)
+#define INC_CHARBYTIND(ptr,pos) do { \
+ ASSERT_VALID_CHARPTR (ptr); \
+ REAL_INC_CHARBYTIND (ptr,pos); \
+} while (0)
+
#define DEC_CHARPTR(ptr) do { \
CONST Bufbyte *dc_ptr1 = (ptr); \
CONST Bufbyte *dc_ptr2 = dc_ptr1; \
} while (0)
#else /* ! ERROR_CHECK_BUFPOS */
+#define INC_CHARBYTIND(ptr,pos) REAL_INC_CHARBYTIND (ptr,pos)
#define INC_CHARPTR(ptr) REAL_INC_CHARPTR (ptr)
#define DEC_CHARPTR(ptr) REAL_DEC_CHARPTR (ptr)
#endif /* ! ERROR_CHECK_BUFPOS */
#ifdef MULE
+#ifdef UTF2000
+#define valid_char_p(ch) 1
+#else
int non_ascii_valid_char_p (Emchar ch);
INLINE int valid_char_p (Emchar ch);
{
return ((unsigned int) (ch) <= 0xff) || non_ascii_valid_char_p (ch);
}
+#endif
#else /* not MULE */
x = wrong_type_argument (Qcharacterp, x); \
} while (0)
+#ifdef UTF2000
+# define MAX_EMCHAR_LEN 6
+#else
#ifdef MULE
# define MAX_EMCHAR_LEN 4
#else
# define MAX_EMCHAR_LEN 1
#endif
+#endif
\f
/*----------------------------------------------------------------------*/
64K for width-three characters.
*/
+#ifndef UTF2000
extern short three_to_one_table[];
+#endif
INLINE int real_bufpos_to_bytind (struct buffer *buf, Bufpos x);
INLINE int
{
if (x >= buf->text->mule_bufmin && x <= buf->text->mule_bufmax)
return (buf->text->mule_bytmin +
+#ifdef UTF2000
+ (x - buf->text->mule_bufmin) * buf->text->mule_size
+#else
((x - buf->text->mule_bufmin) << buf->text->mule_shifter) +
- (buf->text->mule_three_p ? (x - buf->text->mule_bufmin) : 0));
+ (buf->text->mule_three_p ? (x - buf->text->mule_bufmin) : 0)
+#endif
+ );
else
return bufpos_to_bytind_func (buf, x);
}
{
if (x >= buf->text->mule_bytmin && x <= buf->text->mule_bytmax)
return (buf->text->mule_bufmin +
+#ifdef UTF2000
+ (buf->text->mule_size == 0 ? 0 :
+ (x - buf->text->mule_bytmin) / buf->text->mule_size)
+#else
((buf->text->mule_three_p
? three_to_one_table[x - buf->text->mule_bytmin]
- : (x - buf->text->mule_bytmin) >> buf->text->mule_shifter)));
+ : (x - buf->text->mule_bytmin) >> buf->text->mule_shifter))
+#endif
+ );
else
return bytind_to_bufpos_func (buf, x);
}