update.
[chise/xemacs-chise.git-] / src / mule-charset.h
index 5e0caa4..c7b6693 100644 (file)
@@ -23,8 +23,8 @@ Boston, MA 02111-1307, USA.  */
 
 /* 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
@@ -324,6 +324,8 @@ Boston, MA 02111-1307, USA.  */
 /*                    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 */
@@ -456,7 +458,10 @@ struct Lisp_Charset
 
   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;
 
@@ -489,9 +494,10 @@ struct Lisp_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)
@@ -548,9 +554,9 @@ DECLARE_LRECORD (charset, struct Lisp_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];
 };
@@ -565,13 +571,15 @@ INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (int lb);
 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
 
@@ -603,11 +611,7 @@ REP_BYTES_BY_FIRST_BYTE (int fb)
 /*                        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) */
@@ -787,4 +791,4 @@ int copy_internal_to_external (CONST Bufbyte *internal, Bytecount len,
 Bytecount copy_external_to_internal (CONST unsigned char *external,
                                     int len, Bufbyte *internal);
 
-#endif /* _XEMACS_MULE_CHARSET_H */
+#endif /* INCLUDED_mule_charset_h_ */