/* Rewritten by Ben Wing <ben@xemacs.org>. */
-#ifndef _XEMACS_MULE_CHARSET_H
-#define _XEMACS_MULE_CHARSET_H
+#ifndef INCLUDED_mule_charset_h_
+#define INCLUDED_mule_charset_h_
/*
1. Character Sets
/* Definition of leading bytes */
/************************************************************************/
+typedef int Charset_ID;
+
#define MIN_LEADING_BYTE 0x80
/* These need special treatment in a string and/or character */
#define LEADING_BYTE_ASCII 0x8E /* Omitted in a buffer */
int id;
Lisp_Object name;
- Lisp_Object doc_string, registry, short_name, long_name;
+ Lisp_Object doc_string;
+ Lisp_Object registry;
+ Lisp_Object short_name;
+ Lisp_Object long_name;
Lisp_Object reverse_direction_charset;
/* Which half of font to be used to display this character set */
unsigned int graphic;
};
+typedef struct Lisp_Charset Lisp_Charset;
-DECLARE_LRECORD (charset, struct Lisp_Charset);
-#define XCHARSET(x) XRECORD (x, charset, struct Lisp_Charset)
+DECLARE_LRECORD (charset, Lisp_Charset);
+#define XCHARSET(x) XRECORD (x, charset, Lisp_Charset)
#define XSETCHARSET(x, p) XSETRECORD (x, p, charset)
#define CHARSETP(x) RECORDP (x, charset)
#define CHECK_CHARSET(x) CHECK_RECORD (x, charset)
CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs))
struct charset_lookup {
- /* Table of charsets indexed by leading byte. */
- Lisp_Object charset_by_leading_byte[128];
-
+ /* Table of charsets indexed by (leading byte - MIN_LEADING_BYTE). */
+ Lisp_Object charset_by_leading_byte[NUM_LEADING_BYTES];
+
/* Table of charsets indexed by type/final-byte/direction. */
Lisp_Object charset_by_attributes[4][128][2];
};
INLINE Lisp_Object
CHARSET_BY_LEADING_BYTE (int lb)
{
- assert (lb >= 0x80 && lb <= 0xFF);
- return chlook->charset_by_leading_byte[lb - 128];
+ assert (lb >= MIN_LEADING_BYTE &&
+ lb < (MIN_LEADING_BYTE + NUM_LEADING_BYTES));
+ return chlook->charset_by_leading_byte[lb - MIN_LEADING_BYTE];
}
#else
-#define CHARSET_BY_LEADING_BYTE(lb) (chlook->charset_by_leading_byte[(lb) - 128])
+#define CHARSET_BY_LEADING_BYTE(lb) \
+ (chlook->charset_by_leading_byte[(lb) - MIN_LEADING_BYTE])
#endif
/* Dealing with characters */
/************************************************************************/
-/* Is this character represented by more than one byte in a string? */
-
-#define CHAR_MULTIBYTE_P(c) ((c) >= 0x80)
-
-#define CHAR_ASCII_P(c) (!CHAR_MULTIBYTE_P (c))
+#define CHAR_ASCII_P(ch) ((ch) <= 0x7F)
/* The bit fields of character are divided into 3 parts:
FIELD1(5bits):FIELD2(7bits):FIELD3(7bits) */
Bytecount copy_external_to_internal (CONST unsigned char *external,
int len, Bufbyte *internal);
-#endif /* _XEMACS_MULE_CHARSET_H */
+#endif /* INCLUDED_mule_charset_h_ */