(Fmake_char): Fix problem of 256-set.
[chise/xemacs-chise.git-] / src / char-ucs.h
index 2db4ca3..fe680f6 100644 (file)
@@ -24,10 +24,6 @@ Boston, MA 02111-1307, USA.  */
 #ifndef _XEMACS_CHAR_UCS_H
 #define _XEMACS_CHAR_UCS_H
 
-/* ---------------------------- */
-/* (D) For working with Emchars */
-/* ---------------------------- */
-
 #define valid_char_p(ch) 1
 
 #define CHAR_ASCII_P(ch) ((ch) <= 0x7F)
@@ -158,20 +154,6 @@ typedef int Charset_ID;
 
 \f
 /************************************************************************/
-/*                     Operations on individual bytes                   */
-/*                             of any format                            */
-/************************************************************************/
-
-/* Argument `c' should be (unsigned int) or (unsigned char). */
-/* Note that SP and DEL are not included. */
-
-#define BYTE_ASCII_P(c) ((c) < 0x80)
-#define BYTE_C0_P(c) ((c) < 0x20)
-/* Do some forced casting just to make *sure* things are gotten right. */
-#define BYTE_C1_P(c) ((unsigned int) ((unsigned int) (c) - 0x80) < 0x20)
-
-\f
-/************************************************************************/
 /*            Information about a particular character set              */
 /************************************************************************/
 
@@ -301,24 +283,6 @@ CHARSET_BY_LEADING_BYTE (Charset_ID lb)
 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \
   (charset_by_attributes[type][final])
 
-INLINE int REP_BYTES_BY_FIRST_BYTE (int fb);
-INLINE int
-REP_BYTES_BY_FIRST_BYTE (int fb)
-{
-  if ( fb < 0xc0 )
-    return 1;
-  else if ( fb < 0xe0 )
-    return 2;
-  else if ( fb < 0xf0 )
-    return 3;
-  else if ( fb < 0xf8 )
-    return 4;
-  else if ( fb < 0xfc )
-    return 5;
-  else
-    return 6;
-}
-
 \f
 /************************************************************************/
 /*                        Dealing with characters                       */
@@ -351,6 +315,7 @@ REP_BYTES_BY_FIRST_BYTE (int fb)
 #define MIN_CHAR_96x96         0xF4C000
 #define MAX_CHAR_96x96         (MIN_CHAR_96x96 + 96 * 96 * 80 - 1)
 
+extern Lisp_Object Vcharset_ucs_bmp;
 
 /* Return a character whose charset is CHARSET and position-codes
    are C1 and C2.  TYPE9N character ignores C2. */
@@ -363,6 +328,8 @@ MAKE_CHAR (Lisp_Object charset, int c1, int c2)
     return c1;
   else if (EQ (charset, Vcharset_control_1))
     return c1 | 0x80;
+  else if (EQ (charset, Vcharset_ucs_bmp))
+    return (c1 << 8) | c2;
   else if (EQ (charset, Vcharset_latin_iso8859_1))
     return c1 | 0x80;
   else if (EQ (charset, Vcharset_greek_iso8859_7))
@@ -445,8 +412,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
     }
   else if (c < MIN_CHAR_GREEK)
     {
-      printf("not break up u+%x", c);
-      abort ();
+      *charset = Vcharset_ucs_bmp;
+      *c1 = c >> 8;
+      *c2 = c & 0xff;
     }
   else if (c <= MAX_CHAR_GREEK)
     {
@@ -456,8 +424,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
     }
   else if (c < MIN_CHAR_CYRILLIC)
     {
-      printf("not break up u+%x", c);
-      abort ();
+      *charset = Vcharset_ucs_bmp;
+      *c1 = c >> 8;
+      *c2 = c & 0xff;
     }
   else if (c <= MAX_CHAR_CYRILLIC)
     {
@@ -467,8 +436,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
     }
   else if (c < MIN_CHAR_HEBREW)
     {
-      printf("not break up u+%x", c);
-      abort ();
+      *charset = Vcharset_ucs_bmp;
+      *c1 = c >> 8;
+      *c2 = c & 0xff;
     }
   else if (c <= MAX_CHAR_HEBREW)
     {
@@ -478,8 +448,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
     }
   else if (c < MIN_CHAR_THAI)
     {
-      printf("not break up u+%x", c);
-      abort ();
+      *charset = Vcharset_ucs_bmp;
+      *c1 = c >> 8;
+      *c2 = c & 0xff;
     }
   else if (c <= MAX_CHAR_THAI)
     {
@@ -489,8 +460,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
     }
   else if (c < MIN_CHAR_HALFWIDTH_KATAKANA)
     {
-      printf("not break up u+%x", c);
-      abort ();
+      *charset = Vcharset_ucs_bmp;
+      *c1 = c >> 8;
+      *c2 = c & 0xff;
     }
   else if (c <= MAX_CHAR_HALFWIDTH_KATAKANA)
     {
@@ -580,13 +552,4 @@ extern Lisp_Object Vcharset_chinese_big5_2;
 extern Lisp_Object Vcharset_japanese_jisx0208;
 extern Lisp_Object Vcharset_japanese_jisx0212;
 
-Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char);
-int Lstream_fput_emchar (Lstream *stream, Emchar ch);
-void Lstream_funget_emchar (Lstream *stream, Emchar ch);
-
-int copy_internal_to_external (CONST Bufbyte *internal, Bytecount len,
-                              unsigned char *external);
-Bytecount copy_external_to_internal (CONST unsigned char *external,
-                                    int len, Bufbyte *internal);
-
 #endif /* _XEMACS_CHAR_UCS_H */