update.
[chise/xemacs-chise.git-] / src / mule-charset.c
index 791056d..3044d66 100644 (file)
@@ -53,6 +53,7 @@ Lisp_Object Vcharset_latin_iso8859_9;
 Lisp_Object Vcharset_japanese_jisx0208_1978;
 Lisp_Object Vcharset_chinese_gb2312;
 Lisp_Object Vcharset_japanese_jisx0208;
+Lisp_Object Vcharset_japanese_jisx0208_1990;
 Lisp_Object Vcharset_korean_ksc5601;
 Lisp_Object Vcharset_japanese_jisx0212;
 Lisp_Object Vcharset_chinese_cns11643_1;
@@ -62,8 +63,29 @@ Lisp_Object Vcharset_ucs_bmp;
 Lisp_Object Vcharset_latin_viscii;
 Lisp_Object Vcharset_latin_viscii_lower;
 Lisp_Object Vcharset_latin_viscii_upper;
-Lisp_Object Vcharset_hiragana_jisx0208;
-Lisp_Object Vcharset_katakana_jisx0208;
+Lisp_Object Vcharset_ideograph_daikanwa;
+Lisp_Object Vcharset_mojikyo_pj_1;
+Lisp_Object Vcharset_mojikyo_pj_2;
+Lisp_Object Vcharset_mojikyo_pj_3;
+Lisp_Object Vcharset_mojikyo_pj_4;
+Lisp_Object Vcharset_mojikyo_pj_5;
+Lisp_Object Vcharset_mojikyo_pj_6;
+Lisp_Object Vcharset_mojikyo_pj_7;
+Lisp_Object Vcharset_mojikyo_pj_8;
+Lisp_Object Vcharset_mojikyo_pj_9;
+Lisp_Object Vcharset_mojikyo_pj_10;
+Lisp_Object Vcharset_mojikyo_pj_11;
+Lisp_Object Vcharset_mojikyo_pj_12;
+Lisp_Object Vcharset_mojikyo_pj_13;
+Lisp_Object Vcharset_mojikyo_pj_14;
+Lisp_Object Vcharset_mojikyo_pj_15;
+Lisp_Object Vcharset_mojikyo_pj_16;
+Lisp_Object Vcharset_mojikyo_pj_17;
+Lisp_Object Vcharset_mojikyo_pj_18;
+Lisp_Object Vcharset_mojikyo_pj_19;
+Lisp_Object Vcharset_mojikyo_pj_20;
+Lisp_Object Vcharset_mojikyo_pj_21;
+Lisp_Object Vcharset_ethiopic_ucs;
 #endif
 Lisp_Object Vcharset_chinese_big5_1;
 Lisp_Object Vcharset_chinese_big5_2;
@@ -125,6 +147,7 @@ Bytecount rep_bytes_by_first_byte[0xA0] =
 #endif
 
 #ifdef UTF2000
+
 static Lisp_Object
 mark_char_byte_table (Lisp_Object obj, void (*markobj) (Lisp_Object))
 {
@@ -176,7 +199,7 @@ static const struct lrecord_description char_byte_table_description[] = {
   { XD_END }
 };
 
-DEFINE_LRECORD_IMPLEMENTATION ("char-code-table", char_byte_table,
+DEFINE_LRECORD_IMPLEMENTATION ("char-byte-table", char_byte_table,
                                mark_char_byte_table,
                               internal_object_printer,
                               0, char_byte_table_equal,
@@ -184,7 +207,6 @@ DEFINE_LRECORD_IMPLEMENTATION ("char-code-table", char_byte_table,
                               char_byte_table_description,
                               struct Lisp_Char_Byte_Table);
 
-
 static Lisp_Object
 make_char_byte_table (Lisp_Object initval)
 {
@@ -224,63 +246,133 @@ copy_char_byte_table (Lisp_Object entry)
   return obj;
 }
 
-#define make_char_code_table(initval) make_char_byte_table(initval)
+
+static Lisp_Object
+mark_char_code_table (Lisp_Object obj, void (*markobj) (Lisp_Object))
+{
+  struct Lisp_Char_Code_Table *cte = XCHAR_CODE_TABLE (obj);
+
+  return cte->table;
+}
+
+static int
+char_code_table_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
+{
+  struct Lisp_Char_Code_Table *cte1 = XCHAR_CODE_TABLE (obj1);
+  struct Lisp_Char_Code_Table *cte2 = XCHAR_CODE_TABLE (obj2);
+
+  return char_byte_table_equal (cte1->table, cte2->table, depth + 1);
+}
+
+static unsigned long
+char_code_table_hash (Lisp_Object obj, int depth)
+{
+  struct Lisp_Char_Code_Table *cte = XCHAR_CODE_TABLE (obj);
+
+  return char_code_table_hash (cte->table, depth + 1);
+}
+
+static const struct lrecord_description char_code_table_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Code_Table, table), 1 },
+  { XD_END }
+};
+
+DEFINE_LRECORD_IMPLEMENTATION ("char-code-table", char_code_table,
+                               mark_char_code_table,
+                              internal_object_printer,
+                              0, char_code_table_equal,
+                              char_code_table_hash,
+                              char_code_table_description,
+                              struct Lisp_Char_Code_Table);
+
+static Lisp_Object
+make_char_code_table (Lisp_Object initval)
+{
+  Lisp_Object obj;
+  struct Lisp_Char_Code_Table *cte =
+    alloc_lcrecord_type (struct Lisp_Char_Code_Table,
+                        &lrecord_char_code_table);
+
+  cte->table = make_char_byte_table (initval);
+
+  XSETCHAR_CODE_TABLE (obj, cte);
+  return obj;
+}
+
+static Lisp_Object
+copy_char_code_table (Lisp_Object entry)
+{
+  struct Lisp_Char_Code_Table *cte = XCHAR_CODE_TABLE (entry);
+  Lisp_Object obj;
+  struct Lisp_Char_Code_Table *ctenew =
+    alloc_lcrecord_type (struct Lisp_Char_Code_Table,
+                        &lrecord_char_code_table);
+
+  ctenew->table = copy_char_byte_table (cte->table);
+  XSETCHAR_CODE_TABLE (obj, ctenew);
+  return obj;
+}
+
 
 Lisp_Object
 get_char_code_table (Emchar ch, Lisp_Object table)
 {
-  struct Lisp_Char_Byte_Table* cpt = XCHAR_BYTE_TABLE (table);
-  Lisp_Object ret = cpt->property [ch >> 24];
+  unsigned int code = ch;
+  struct Lisp_Char_Byte_Table* cpt
+    = XCHAR_BYTE_TABLE (XCHAR_CODE_TABLE (table)->table);
+  Lisp_Object ret = cpt->property [(unsigned char)(code >> 24)];
 
   if (CHAR_BYTE_TABLE_P (ret))
     cpt = XCHAR_BYTE_TABLE (ret);
   else
     return ret;
 
-  ret = cpt->property [(unsigned char) (ch >> 16)];
+  ret = cpt->property [(unsigned char) (code >> 16)];
   if (CHAR_BYTE_TABLE_P (ret))
     cpt = XCHAR_BYTE_TABLE (ret);
   else
     return ret;
 
-  ret = cpt->property [(unsigned char) (ch >> 8)];
+  ret = cpt->property [(unsigned char) (code >> 8)];
   if (CHAR_BYTE_TABLE_P (ret))
     cpt = XCHAR_BYTE_TABLE (ret);
   else
     return ret;
   
-  return cpt->property [(unsigned char) ch];
+  return cpt->property [(unsigned char) code];
 }
 
 void
 put_char_code_table (Emchar ch, Lisp_Object value, Lisp_Object table)
 {
-  struct Lisp_Char_Byte_Table* cpt1 = XCHAR_BYTE_TABLE (table);
-  Lisp_Object ret = cpt1->property[ch >> 24];
+  unsigned int code = ch;
+  struct Lisp_Char_Byte_Table* cpt1
+    = XCHAR_BYTE_TABLE (XCHAR_CODE_TABLE (table)->table);
+  Lisp_Object ret = cpt1->property[(unsigned char)(code >> 24)];
 
   if (CHAR_BYTE_TABLE_P (ret))
     {
       struct Lisp_Char_Byte_Table* cpt2 = XCHAR_BYTE_TABLE (ret);
       
-      ret = cpt2->property[(unsigned char)(ch >> 16)];
+      ret = cpt2->property[(unsigned char)(code >> 16)];
       if (CHAR_BYTE_TABLE_P (ret))
        {
          struct Lisp_Char_Byte_Table* cpt3 = XCHAR_BYTE_TABLE (ret);
          
-         ret = cpt3->property[(unsigned char)(ch >> 8)];
+         ret = cpt3->property[(unsigned char)(code >> 8)];
          if (CHAR_BYTE_TABLE_P (ret))
            {
              struct Lisp_Char_Byte_Table* cpt4
                = XCHAR_BYTE_TABLE (ret);
              
-             cpt4->property[(unsigned char)ch] = value;
+             cpt4->property[(unsigned char)code] = value;
            }
          else if (!EQ (ret, value))
            {
              Lisp_Object cpt4 = make_char_byte_table (ret);
              
-             XCHAR_BYTE_TABLE(cpt4)->property[(unsigned char)ch] = value;
-             cpt3->property[(unsigned char)(ch >> 8)] = cpt4;
+             XCHAR_BYTE_TABLE(cpt4)->property[(unsigned char)code] = value;
+             cpt3->property[(unsigned char)(code >> 8)] = cpt4;
            }
        }
       else if (!EQ (ret, value))
@@ -288,10 +380,10 @@ put_char_code_table (Emchar ch, Lisp_Object value, Lisp_Object table)
          Lisp_Object cpt3 = make_char_byte_table (ret);
          Lisp_Object cpt4 = make_char_byte_table (ret);
          
-         XCHAR_BYTE_TABLE(cpt4)->property[(unsigned char)ch] = value;
-         XCHAR_BYTE_TABLE(cpt3)->property[(unsigned char)(ch >> 8)]
+         XCHAR_BYTE_TABLE(cpt4)->property[(unsigned char)code] = value;
+         XCHAR_BYTE_TABLE(cpt3)->property[(unsigned char)(code >> 8)]
            = cpt4;
-         cpt2->property[(unsigned char)(ch >> 16)] = cpt3;
+         cpt2->property[(unsigned char)(code >> 16)] = cpt3;
        }
     }
   else if (!EQ (ret, value))
@@ -300,22 +392,132 @@ put_char_code_table (Emchar ch, Lisp_Object value, Lisp_Object table)
       Lisp_Object cpt3 = make_char_byte_table (ret);
       Lisp_Object cpt4 = make_char_byte_table (ret);
       
-      XCHAR_BYTE_TABLE(cpt4)->property[(unsigned char)ch] = value;
-      XCHAR_BYTE_TABLE(cpt3)->property[(unsigned char)(ch >>  8)] = cpt4;
-      XCHAR_BYTE_TABLE(cpt2)->property[(unsigned char)(ch >> 16)] = cpt3;
-      cpt1->property[(unsigned char)(ch >> 24)] = cpt2;
+      XCHAR_BYTE_TABLE(cpt4)->property[(unsigned char)code] = value;
+      XCHAR_BYTE_TABLE(cpt3)->property[(unsigned char)(code >>  8)] = cpt4;
+      XCHAR_BYTE_TABLE(cpt2)->property[(unsigned char)(code >> 16)] = cpt3;
+      cpt1->property[(unsigned char)(code >> 24)] = cpt2;
     }
 }
 
 
 Lisp_Object Vcharacter_attribute_table;
+Lisp_Object Vcharacter_composition_table;
+Lisp_Object Vcharacter_variant_table;
+
+Lisp_Object Q_decomposition;
+Lisp_Object Q_ucs;
+Lisp_Object Qcompat;
+Lisp_Object Qisolated;
+Lisp_Object Qinitial;
+Lisp_Object Qmedial;
+Lisp_Object Qfinal;
+Lisp_Object Qvertical;
+Lisp_Object QnoBreak;
+Lisp_Object Qfraction;
+Lisp_Object Qsuper;
+Lisp_Object Qsub;
+Lisp_Object Qcircle;
+Lisp_Object Qsquare;
+Lisp_Object Qwide;
+Lisp_Object Qnarrow;
+Lisp_Object Qsmall;
+Lisp_Object Qfont;
+
+Emchar
+to_char_code (Lisp_Object v, char* err_msg, Lisp_Object err_arg)
+{
+  if (INTP (v))
+    return XINT (v);
+  if (CHARP (v))
+    return XCHAR (v);
+  else if (EQ (v, Qcompat))
+    return -1;
+  else if (EQ (v, Qisolated))
+    return -2;
+  else if (EQ (v, Qinitial))
+    return -3;
+  else if (EQ (v, Qmedial))
+    return -4;
+  else if (EQ (v, Qfinal))
+    return -5;
+  else if (EQ (v, Qvertical))
+    return -6;
+  else if (EQ (v, QnoBreak))
+    return -7;
+  else if (EQ (v, Qfraction))
+    return -8;
+  else if (EQ (v, Qsuper))
+    return -9;
+  else if (EQ (v, Qsub))
+    return -10;
+  else if (EQ (v, Qcircle))
+    return -11;
+  else if (EQ (v, Qsquare))
+    return -12;
+  else if (EQ (v, Qwide))
+    return -13;
+  else if (EQ (v, Qnarrow))
+    return -14;
+  else if (EQ (v, Qsmall))
+    return -15;
+  else if (EQ (v, Qfont))
+    return -16;
+  else 
+    signal_simple_error (err_msg, err_arg);
+}
+
+DEFUN ("get-composite-char", Fget_composite_char, 1, 1, 0, /*
+Return character corresponding with list.
+*/
+       (list))
+{
+  Lisp_Object table = Vcharacter_composition_table;
+  Lisp_Object rest = list;
+
+  while (CONSP (rest))
+    {
+      Lisp_Object v = Fcar (rest);
+      Lisp_Object ret;
+      Emchar c = to_char_code (v, "Invalid value for composition", list);
+
+      ret = get_char_code_table (c, table);
+
+      rest = Fcdr (rest);
+      if (NILP (rest))
+       {
+         if (!CHAR_CODE_TABLE_P (ret))
+           return ret;
+         else
+           return Qt;
+       }
+      else if (!CONSP (rest))
+       break;
+      else if (CHAR_CODE_TABLE_P (ret))
+       table = ret;
+      else
+       signal_simple_error ("Invalid table is found with", list);
+    }
+  signal_simple_error ("Invalid value for composition", list);
+}
+
+DEFUN ("char-variants", Fchar_variants, 1, 1, 0, /*
+Return variants of CHARACTER.
+*/
+       (character))
+{
+  CHECK_CHAR (character);
+  return Fcopy_list (get_char_code_table (XCHAR (character),
+                                         Vcharacter_variant_table));
+}
 
 DEFUN ("char-attribute-alist", Fchar_attribute_alist, 1, 1, 0, /*
 Return the alist of attributes of CHARACTER.
 */
        (character))
 {
-  return get_char_code_table (XCHAR (character), Vcharacter_attribute_table);
+  CHECK_CHAR (character);
+  return Fcopy_alist (get_char_code_table (XCHAR (character),
+                                          Vcharacter_attribute_table));
 }
 
 DEFUN ("get-char-attribute", Fget_char_attribute, 2, 2, 0, /*
@@ -323,33 +525,247 @@ Return the value of CHARACTER's ATTRIBUTE.
 */
        (character, attribute))
 {
-  Lisp_Object ret
-    = get_char_code_table (XCHAR (character), Vcharacter_attribute_table);
+  Lisp_Object ret;
+  Lisp_Object ccs;
 
+  CHECK_CHAR (character);
+  ret = get_char_code_table (XCHAR (character),
+                            Vcharacter_attribute_table);
   if (EQ (ret, Qnil))
     return Qnil;
-  
+
+  if (!NILP (ccs = Ffind_charset (attribute)))
+    attribute = ccs;
+
   return Fcdr (Fassq (attribute, ret));
 }
 
-DEFUN ("put-char-attribute", Fput_char_attribute, 3, 3, 0, /*
-Store CHARACTER's ATTRIBUTE with VALUE.
-*/
-       (character, attribute, value))
+Lisp_Object
+put_char_attribute (Lisp_Object character, Lisp_Object attribute,
+                   Lisp_Object value)
 {
   Emchar char_code = XCHAR (character);
   Lisp_Object ret
     = get_char_code_table (char_code, Vcharacter_attribute_table);
-  Lisp_Object cell = Fassq (attribute, ret);
+  Lisp_Object cell;
 
-  if (EQ (cell, Qnil))
-    ret = Fcons (Fcons (attribute, value), ret);
-  else
-    Fsetcdr (cell, value);
+  cell = Fassq (attribute, ret);
+
+  if (NILP (cell))
+    {
+      ret = Fcons (Fcons (attribute, value), ret);
+    }
+  else if (!EQ (Fcdr (cell), value))
+    {
+      Fsetcdr (cell, value);
+    }
   put_char_code_table (char_code, ret, Vcharacter_attribute_table);
   return ret;
 }
+  
+DEFUN ("put-char-attribute", Fput_char_attribute, 3, 3, 0, /*
+Store CHARACTER's ATTRIBUTE with VALUE.
+*/
+       (character, attribute, value))
+{
+  Lisp_Object ccs;
 
+  CHECK_CHAR (character);
+  ccs = Ffind_charset (attribute);
+  if (!NILP (ccs))
+    {
+      Lisp_Object rest;
+      Lisp_Object v = XCHARSET_DECODING_TABLE (ccs);
+      Lisp_Object nv;
+      int i = -1;
+      int ccs_len;
+
+      /* ad-hoc method for `ascii' */
+      if ((XCHARSET_CHARS (ccs) == 94) &&
+         (XCHARSET_BYTE_OFFSET (ccs) != 33))
+       ccs_len = 128 - XCHARSET_BYTE_OFFSET (ccs);
+      else
+       ccs_len = XCHARSET_CHARS (ccs);
+         
+      if (!CONSP (value))
+       signal_simple_error ("Invalid value for coded-charset",
+                            value);
+
+      attribute = ccs;
+      rest = Fget_char_attribute (character, attribute);
+      if (VECTORP (v))
+       {
+         if (!NILP (rest))
+           {
+             while (!NILP (rest))
+               {
+                 Lisp_Object ei = Fcar (rest);
+                 
+                 i = XINT (ei) - XCHARSET_BYTE_OFFSET (ccs);
+                 nv = XVECTOR_DATA(v)[i];
+                 if (!VECTORP (nv))
+                   break;
+                 v = nv;
+                 rest = Fcdr (rest);
+               }
+             if (i >= 0)
+               XVECTOR_DATA(v)[i] = Qnil;
+             v = XCHARSET_DECODING_TABLE (ccs);
+           }
+       }
+      else
+       {
+         XCHARSET_DECODING_TABLE (ccs) = v = make_vector (ccs_len, Qnil);
+       }
+
+      if (XCHARSET_GRAPHIC (ccs) == 1)
+       value = Fcopy_list (value);
+      rest = value;
+      i = -1;
+      while (CONSP (rest))
+       {
+         Lisp_Object ei = Fcar (rest);
+         
+         if (!INTP (ei))
+           signal_simple_error ("Invalid value for coded-charset", value);
+         i = XINT (ei);
+         if ((i < 0) || (255 < i))
+           signal_simple_error ("Invalid value for coded-charset", value);
+         if (XCHARSET_GRAPHIC (ccs) == 1)
+           {
+             i &= 0x7F;
+             Fsetcar (rest, make_int (i));
+           }
+         i -= XCHARSET_BYTE_OFFSET (ccs);
+         nv = XVECTOR_DATA(v)[i];
+         rest = Fcdr (rest);
+         if (CONSP (rest))
+           {
+             if (!VECTORP (nv))
+               {
+                 nv = (XVECTOR_DATA(v)[i] = make_vector (ccs_len, Qnil));
+               }
+             v = nv;
+           }
+         else
+           break;
+       }
+      XVECTOR_DATA(v)[i] = character;
+    }
+  else if (EQ (attribute, Q_decomposition))
+    {
+      Lisp_Object rest = value;
+      Lisp_Object table = Vcharacter_composition_table;
+
+      if (!CONSP (value))
+       signal_simple_error ("Invalid value for ->decomposition",
+                            value);
+
+      while (CONSP (rest))
+       {
+         Lisp_Object v = Fcar (rest);
+         Lisp_Object ntable;
+         Emchar c
+           = to_char_code (v, "Invalid value for ->decomposition", value);
+
+         rest = Fcdr (rest);
+         if (!CONSP (rest))
+           {
+             put_char_code_table (c, character, table);
+             break;
+           }
+         else
+           {
+             ntable = get_char_code_table (c, table);
+             if (!CHAR_CODE_TABLE_P (ntable))
+               {
+                 ntable = make_char_code_table (Qnil);
+                 put_char_code_table (c, ntable, table);
+               }
+             table = ntable;
+           }
+       }
+    }
+  else if (EQ (attribute, Q_ucs))
+    {
+      Lisp_Object ret;
+      Emchar c;
+
+      if (!INTP (value))
+       signal_simple_error ("Invalid value for ->ucs", value);
+
+      c = XINT (value);
+
+      ret = get_char_code_table (c, Vcharacter_variant_table);
+      if (NILP (Fmemq (character, ret)))
+       {
+         put_char_code_table (c, Fcons (character, ret),
+                              Vcharacter_variant_table);
+       }
+    }
+  return put_char_attribute (character, attribute, value);
+}
+
+Lisp_Object Qucs;
+
+EXFUN (Fmake_char, 3);
+
+DEFUN ("define-char", Fdefine_char, 1, 1, 0, /*
+Store character's ATTRIBUTES.
+*/
+       (attributes))
+{
+  Lisp_Object rest = attributes;
+  Lisp_Object code = Fcdr (Fassq (Qucs, attributes));
+  Lisp_Object character;
+
+  if (NILP (code))
+    {
+      while (CONSP (rest))
+       {
+         Lisp_Object cell = Fcar (rest);
+         Lisp_Object ccs;
+
+         if (!LISTP (cell))
+           signal_simple_error ("Invalid argument", attributes);
+         if (!NILP (ccs = Ffind_charset (Fcar (cell))))
+           {
+             cell = Fcdr (cell);
+             character = Fmake_char (ccs, Fcar (cell),
+                                     Fcar (Fcdr (cell)));
+             goto setup_attributes;
+           }
+         rest = Fcdr (rest);
+       }
+      if (!NILP (code = Fcdr (Fassq (Q_ucs, attributes))))
+       {
+         if (!INTP (code))
+           signal_simple_error ("Invalid argument", attributes);
+         else
+           character = make_char (XINT (code) + 0x100000);
+         goto setup_attributes;
+       }
+      return Qnil;
+    }
+  else if (!INTP (code))
+    signal_simple_error ("Invalid argument", attributes);
+  else
+    character = make_char (XINT (code));
+
+ setup_attributes:
+  rest = attributes;
+  while (CONSP (rest))
+    {
+      Lisp_Object cell = Fcar (rest);
+
+      if (!LISTP (cell))
+       signal_simple_error ("Invalid argument", attributes);
+      Fput_char_attribute (character, Fcar (cell), Fcdr (cell));
+      rest = Fcdr (rest);
+    }
+  return
+    get_char_code_table (XCHAR (character), Vcharacter_attribute_table);
+}
 
 Lisp_Object Vutf_2000_version;
 #endif
@@ -384,6 +800,7 @@ Lisp_Object Qascii,
   Qjapanese_jisx0208_1978,
   Qchinese_gb2312,
   Qjapanese_jisx0208,
+  Qjapanese_jisx0208_1990,
   Qkorean_ksc5601,
   Qjapanese_jisx0212,
   Qchinese_cns11643_1,
@@ -395,8 +812,29 @@ Lisp_Object Qascii,
   Qlatin_viscii_upper,
   Qvietnamese_viscii_lower,
   Qvietnamese_viscii_upper,
-  Qhiragana_jisx0208,
-  Qkatakana_jisx0208,
+  Qideograph_daikanwa,
+  Qmojikyo_pj_1,
+  Qmojikyo_pj_2,
+  Qmojikyo_pj_3,
+  Qmojikyo_pj_4,
+  Qmojikyo_pj_5,
+  Qmojikyo_pj_6,
+  Qmojikyo_pj_7,
+  Qmojikyo_pj_8,
+  Qmojikyo_pj_9,
+  Qmojikyo_pj_10,
+  Qmojikyo_pj_11,
+  Qmojikyo_pj_12,
+  Qmojikyo_pj_13,
+  Qmojikyo_pj_14,
+  Qmojikyo_pj_15,
+  Qmojikyo_pj_16,
+  Qmojikyo_pj_17,
+  Qmojikyo_pj_18,
+  Qmojikyo_pj_19,
+  Qmojikyo_pj_20,
+  Qmojikyo_pj_21,
+  Qethiopic_ucs,
 #endif
   Qchinese_big5_1,
   Qchinese_big5_2,
@@ -775,7 +1213,6 @@ mark_charset (Lisp_Object obj, void (*markobj) (Lisp_Object))
   markobj (cs->ccl_program);
 #ifdef UTF2000
   markobj (cs->decoding_table);
-  markobj (cs->encoding_table);
 #endif
   return cs->name;
 }
@@ -859,7 +1296,6 @@ make_charset (Charset_ID id, Lisp_Object name,
   CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
 #ifdef UTF2000
   CHARSET_DECODING_TABLE(cs) = Qnil;
-  CHARSET_ENCODING_TABLE(cs) = Qnil;
   CHARSET_UCS_MIN(cs) = ucs_min;
   CHARSET_UCS_MAX(cs) = ucs_max;
   CHARSET_CODE_OFFSET(cs) = code_offset;
@@ -912,7 +1348,7 @@ make_charset (Charset_ID id, Lisp_Object name,
   else
     CHARSET_REP_BYTES (cs) = CHARSET_DIMENSION (cs) + 2;
 #endif
-  
+
   if (final)
     {
       /* some charsets do not have final characters.  This includes
@@ -1051,7 +1487,8 @@ range_charset_code_point (Lisp_Object charset, Emchar ch)
                              + (XCHARSET_FINAL (charset) - '0') * 94 * 94))
                   >= 0)
                  && (d < 94 * 94))
-               return list2 ((d / 94) + 33, d % 94 + 33);
+               return list2 (make_int ((d / 94) + 33),
+                             make_int (d % 94 + 33));
            }
          else if (XCHARSET_CHARS (charset) == 96)
            {
@@ -1059,7 +1496,8 @@ range_charset_code_point (Lisp_Object charset, Emchar ch)
                              + (XCHARSET_FINAL (charset) - '0') * 96 * 96))
                   >= 0)
                  && (d < 96 * 96))
-               return list2 ((d / 96) + 32, d % 96 + 32);
+               return list2 (make_int ((d / 96) + 32),
+                             make_int (d % 96 + 32));
            }
        }
     }
@@ -1067,155 +1505,120 @@ range_charset_code_point (Lisp_Object charset, Emchar ch)
 }
 
 Lisp_Object
-charset_code_point (Lisp_Object charset, Emchar ch)
+split_builtin_char (Emchar c)
 {
-  Lisp_Object cdef = get_char_code_table (ch, Vcharacter_attribute_table);
-
-  if (!EQ (cdef, Qnil))
+  if (c < MIN_CHAR_OBS_94x94)
     {
-      Lisp_Object field = Fassq (charset, cdef);
-
-      if (!EQ (field, Qnil))
-       return Fcdr (field);
-    }
-  return range_charset_code_point (charset, ch);
-}
-
-unsigned char
-charset_get_byte1 (Lisp_Object charset, Emchar ch)
-{
-  Lisp_Object table;
-  int d;
-
-  if (!EQ (table = XCHARSET_ENCODING_TABLE (charset), Qnil))
-    {
-      Lisp_Object value = get_char_code_table (ch, table);
-
-      if (INTP (value))
+      if (c <= MAX_CHAR_BASIC_LATIN)
        {
-         Emchar code = XINT (value);
-
-         if (code < (1 << 8))
-           return code;
-         else if (code < (1 << 16))
-           return code >> 8;
-         else if (code < (1 << 24))
-           return code >> 16;
-         else
-           return code >> 24;
+         return list2 (Vcharset_ascii, make_int (c));
        }
-    }
-  if ((XCHARSET_UCS_MIN (charset) <= ch)
-      && (ch <= XCHARSET_UCS_MAX (charset)))
-    return (ch - XCHARSET_UCS_MIN (charset)
-           + XCHARSET_CODE_OFFSET (charset))
-      / (XCHARSET_DIMENSION (charset) == 1 ?
-        1
-        :
-        XCHARSET_DIMENSION (charset) == 2 ?
-        XCHARSET_CHARS (charset)
-        :
-        XCHARSET_DIMENSION (charset) == 3 ?
-        XCHARSET_CHARS (charset) * XCHARSET_CHARS (charset)
-        :
-        XCHARSET_CHARS (charset)
-        * XCHARSET_CHARS (charset) * XCHARSET_CHARS (charset))
-      + XCHARSET_BYTE_OFFSET (charset);
-  else if (XCHARSET_CODE_OFFSET (charset) == 0)
-    {
-      if (XCHARSET_DIMENSION (charset) == 1)
+      else if (c < 0xA0)
        {
-         if (XCHARSET_CHARS (charset) == 94)
-           {
-             if (((d = ch - (MIN_CHAR_94
-                             + (XCHARSET_FINAL (charset) - '0') * 94)) >= 0)
-                 && (d < 94))
-               return d + 33;
-           }
-         else if (XCHARSET_CHARS (charset) == 96)
-           {
-             if (((d = ch - (MIN_CHAR_96
-                             + (XCHARSET_FINAL (charset) - '0') * 96)) >= 0)
-                 && (d < 96))
-               return d + 32;
-           }
-         else
-           return 0;
+         return list2 (Vcharset_control_1, make_int (c & 0x7F));
        }
-      else if (XCHARSET_DIMENSION (charset) == 2)
+      else if (c <= 0xff)
        {
-         if (XCHARSET_CHARS (charset) == 94)
-           {
-             if (((d = ch - (MIN_CHAR_94x94
-                             + (XCHARSET_FINAL (charset) - '0') * 94 * 94))
-                  >= 0)
-                 && (d < 94 * 94))
-               return (d / 94) + 33;
-           }
-         else if (XCHARSET_CHARS (charset) == 96)
-           {
-             if (((d = ch - (MIN_CHAR_96x96
-                             + (XCHARSET_FINAL (charset) - '0') * 96 * 96))
-                  >= 0)
-                 && (d < 96 * 96))
-               return (d / 96) + 32;
-           }
+         return list2 (Vcharset_latin_iso8859_1, make_int (c & 0x7F));
+       }
+      else if ((MIN_CHAR_GREEK <= c) && (c <= MAX_CHAR_GREEK))
+       {
+         return list2 (Vcharset_greek_iso8859_7,
+                       make_int (c - MIN_CHAR_GREEK + 0x20));
+       }
+      else if ((MIN_CHAR_CYRILLIC <= c) && (c <= MAX_CHAR_CYRILLIC))
+       {
+         return list2 (Vcharset_cyrillic_iso8859_5,
+                       make_int (c - MIN_CHAR_CYRILLIC + 0x20));
+       }
+      else if ((MIN_CHAR_HEBREW <= c) && (c <= MAX_CHAR_HEBREW))
+       {
+         return list2 (Vcharset_hebrew_iso8859_8,
+                       make_int (c - MIN_CHAR_HEBREW + 0x20));
+       }
+      else if ((MIN_CHAR_THAI <= c) && (c <= MAX_CHAR_THAI))
+       {
+         return list2 (Vcharset_thai_tis620,
+                       make_int (c - MIN_CHAR_THAI + 0x20));
+       }
+      else if ((MIN_CHAR_HALFWIDTH_KATAKANA <= c)
+              && (c <= MAX_CHAR_HALFWIDTH_KATAKANA))
+       {
+         return list2 (Vcharset_katakana_jisx0201,
+                       make_int (c - MIN_CHAR_HALFWIDTH_KATAKANA + 33));
+       }
+      else
+       {
+         return list3 (Vcharset_ucs_bmp,
+                       make_int (c >> 8), make_int (c & 0xff));
        }
     }
-  return 0;
+  else if (c <= MAX_CHAR_OBS_94x94)
+    {
+      return list3 (CHARSET_BY_ATTRIBUTES
+                   (CHARSET_TYPE_94X94,
+                    ((c - MIN_CHAR_OBS_94x94) / (94 * 94)) + '@',
+                    CHARSET_LEFT_TO_RIGHT),
+                   make_int ((((c - MIN_CHAR_OBS_94x94) / 94) % 94) + 33),
+                   make_int (((c - MIN_CHAR_OBS_94x94) % 94) + 33));
+    }
+  else if (c <= MAX_CHAR_DAIKANWA)
+    {
+      return list3 (Vcharset_ideograph_daikanwa,
+                   make_int ((c - MIN_CHAR_DAIKANWA) >> 8),
+                   make_int ((c - MIN_CHAR_DAIKANWA) & 255));
+    }
+  else if (c <= MAX_CHAR_94)
+    {
+      return list2 (CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94,
+                                          ((c - MIN_CHAR_94) / 94) + '0',
+                                          CHARSET_LEFT_TO_RIGHT),
+                   make_int (((c - MIN_CHAR_94) % 94) + 33));
+    }
+  else if (c <= MAX_CHAR_96)
+    {
+      return list2 (CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96,
+                                          ((c - MIN_CHAR_96) / 96) + '0',
+                                          CHARSET_LEFT_TO_RIGHT),
+                   make_int (((c - MIN_CHAR_96) % 96) + 32));
+    }
+  else if (c <= MAX_CHAR_94x94)
+    {
+      return list3 (CHARSET_BY_ATTRIBUTES
+                   (CHARSET_TYPE_94X94,
+                    ((c - MIN_CHAR_94x94) / (94 * 94)) + '0',
+                    CHARSET_LEFT_TO_RIGHT),
+                   make_int ((((c - MIN_CHAR_94x94) / 94) % 94) + 33),
+                   make_int (((c - MIN_CHAR_94x94) % 94) + 33));
+    }
+  else if (c <= MAX_CHAR_96x96)
+    {
+      return list3 (CHARSET_BY_ATTRIBUTES
+                   (CHARSET_TYPE_96X96,
+                    ((c - MIN_CHAR_96x96) / (96 * 96)) + '0',
+                    CHARSET_LEFT_TO_RIGHT),
+                   make_int ((((c - MIN_CHAR_96x96) / 96) % 96) + 32),
+                   make_int (((c - MIN_CHAR_96x96) % 96) + 32));
+    }
+  else
+    {
+      return Qnil;
+    }
 }
 
-unsigned char
-charset_get_byte2 (Lisp_Object charset, Emchar ch)
+Lisp_Object
+charset_code_point (Lisp_Object charset, Emchar ch)
 {
-  if (XCHARSET_DIMENSION (charset) == 1)
-    return 0;
-  else
+  Lisp_Object cdef = get_char_code_table (ch, Vcharacter_attribute_table);
+
+  if (!EQ (cdef, Qnil))
     {
-      Lisp_Object table;
+      Lisp_Object field = Fassq (charset, cdef);
 
-      if (!EQ (table = XCHARSET_ENCODING_TABLE (charset), Qnil))
-       {
-         Lisp_Object value = get_char_code_table (ch, table);
-         
-         if (INTP (value))
-           {
-             Emchar code = XINT (value);
-
-             if (code < (1 << 16))
-               return (unsigned char)code;
-             else if (code < (1 << 24))
-               return (unsigned char)(code >> 16);
-             else
-               return (unsigned char)(code >> 24);
-           }
-       }
-      if ((XCHARSET_UCS_MIN (charset) <= ch)
-         && (ch <= XCHARSET_UCS_MAX (charset)))
-       return ((ch - XCHARSET_UCS_MIN (charset)
-                + XCHARSET_CODE_OFFSET (charset))
-               / (XCHARSET_DIMENSION (charset) == 2 ?
-                  1
-                  :
-                  XCHARSET_DIMENSION (charset) == 3 ?
-                  XCHARSET_CHARS (charset)
-                  :
-                  XCHARSET_CHARS (charset) * XCHARSET_CHARS (charset)))
-         % XCHARSET_CHARS (charset)
-         + XCHARSET_BYTE_OFFSET (charset);
-      else if (XCHARSET_CHARS (charset) == 94)
-       return (MIN_CHAR_94x94
-               + (XCHARSET_FINAL (charset) - '0') * 94 * 94 <= ch)
-         && (ch < MIN_CHAR_94x94
-             + (XCHARSET_FINAL (charset) - '0' + 1) * 94 * 94) ?
-         ((ch - MIN_CHAR_94x94) % 94) + 33 : 0;
-      else /* if (XCHARSET_CHARS (charset) == 96) */
-       return (MIN_CHAR_96x96
-               + (XCHARSET_FINAL (charset) - '0') * 96 * 96 <= ch)
-         && (ch < MIN_CHAR_96x96
-             + (XCHARSET_FINAL (charset) - '0' + 1) * 96 * 96) ?
-         ((ch - MIN_CHAR_96x96) % 96) + 32 : 0;
+      if (!EQ (field, Qnil))
+       return Fcdr (field);
     }
+  return range_charset_code_point (charset, ch);
 }
 
 Lisp_Object Vdefault_coded_charset_priority_list;
@@ -1367,9 +1770,7 @@ character set.  Recognized properties are:
   Lisp_Object rest, keyword, value;
   Lisp_Object ccl_program = Qnil;
   Lisp_Object short_name = Qnil, long_name = Qnil;
-#ifdef UTF2000
-  unsigned char byte_offset = 0;
-#endif
+  int byte_offset = -1;
 
   CHECK_SYMBOL (name);
   if (!NILP (doc_string))
@@ -1496,6 +1897,17 @@ character set.  Recognized properties are:
 
   if (columns == -1)
     columns = dimension;
+
+  if (byte_offset < 0)
+    {
+      if (chars == 94)
+       byte_offset = 33;
+      else if (chars == 96)
+       byte_offset = 32;
+      else
+       byte_offset = 0;
+    }
+
   charset = make_charset (id, name, type, columns, graphic,
                          final, direction, short_name, long_name,
                          doc_string, registry,
@@ -1789,14 +2201,22 @@ Set mapping-table of CHARSET to TABLE.
   if (EQ (table, Qnil))
     {
       CHARSET_DECODING_TABLE(cs) = table;
-      CHARSET_ENCODING_TABLE(cs) = Qnil;
       return table;
     }
   else if (VECTORP (table))
     {
-      if (XVECTOR_LENGTH (table) > CHARSET_CHARS (cs))
+      int ccs_len;
+
+      /* ad-hoc method for `ascii' */
+      if ((CHARSET_CHARS (cs) == 94) &&
+         (CHARSET_BYTE_OFFSET (cs) != 33))
+       ccs_len = 128 - CHARSET_BYTE_OFFSET (cs);
+      else
+       ccs_len = CHARSET_CHARS (cs);
+
+      if (XVECTOR_LENGTH (table) > ccs_len)
        args_out_of_range (table, make_int (CHARSET_CHARS (cs)));
-      old_table = CHARSET_ENCODING_TABLE(cs);
+      old_table = CHARSET_DECODING_TABLE(cs);
       CHARSET_DECODING_TABLE(cs) = table;
     }
   else
@@ -1808,24 +2228,17 @@ Set mapping-table of CHARSET to TABLE.
   switch (CHARSET_DIMENSION (cs))
     {
     case 1:
-      CHARSET_ENCODING_TABLE(cs) = make_char_code_table (Qnil);
       for (i = 0; i < XVECTOR_LENGTH (table); i++)
        {
          Lisp_Object c = XVECTOR_DATA(table)[i];
 
          if (CHARP (c))
-           {
-             put_char_code_table (XCHAR (c),
-                                  make_int (i + CHARSET_BYTE_OFFSET (cs)),
-                                  CHARSET_ENCODING_TABLE(cs));
-             Fput_char_attribute (c, charset,
-                                  list1
-                                  (make_int (i + CHARSET_BYTE_OFFSET (cs))));
-           }
+           put_char_attribute
+             (c, charset,
+              list1 (make_int (i + CHARSET_BYTE_OFFSET (cs))));
        }
       break;
     case 2:
-      CHARSET_ENCODING_TABLE(cs) = make_char_code_table (Qnil);
       for (i = 0; i < XVECTOR_LENGTH (table); i++)
        {
          Lisp_Object v = XVECTOR_DATA(table)[i];
@@ -1844,30 +2257,18 @@ Set mapping-table of CHARSET to TABLE.
                  Lisp_Object c = XVECTOR_DATA(v)[j];
 
                  if (CHARP (c))
-                   {
-                     put_char_code_table
-                       (XCHAR (c),
-                        make_int (( (i + CHARSET_BYTE_OFFSET (cs)) << 8)
-                                  | (j + CHARSET_BYTE_OFFSET (cs))),
-                        CHARSET_ENCODING_TABLE(cs));
-                     Fput_char_attribute (c, charset,
-                                          list2
-                                          (make_int
-                                           (i + CHARSET_BYTE_OFFSET (cs)),
-                                           make_int
-                                           (j + CHARSET_BYTE_OFFSET (cs))));
-                   }
+                   put_char_attribute (c, charset,
+                                       list2
+                                       (make_int
+                                        (i + CHARSET_BYTE_OFFSET (cs)),
+                                        make_int
+                                        (j + CHARSET_BYTE_OFFSET (cs))));
                }
            }
          else if (CHARP (v))
-           {
-             put_char_code_table (XCHAR (v),
-                                  make_int (i + CHARSET_BYTE_OFFSET (cs)),
-                                  CHARSET_ENCODING_TABLE(cs));
-             Fput_char_attribute (v, charset,
-                                  list1
-                                  (make_int (i + CHARSET_BYTE_OFFSET (cs))));
-           }
+           put_char_attribute (v, charset,
+                               list1
+                               (make_int (i + CHARSET_BYTE_OFFSET (cs))));
        }
       break;
     }
@@ -1955,6 +2356,18 @@ Return list of charset and one or two position-codes of CHAR.
 */
        (character))
 {
+#ifdef UTF2000
+  Lisp_Object ret;
+  Lisp_Object charset;
+
+  CHECK_CHAR_COERCE_INT (character);
+  ret = SPLIT_CHAR (XCHAR (character));
+  charset = Fcar (ret);
+  if (CHARSETP (charset))
+    return Fcons (XCHARSET_NAME (charset), Fcopy_list (Fcdr (ret)));
+  else
+    return ret;
+#else
   /* This function can GC */
   struct gcpro gcpro1, gcpro2;
   Lisp_Object charset = Qnil;
@@ -1975,8 +2388,8 @@ Return list of charset and one or two position-codes of CHAR.
       rc = list2 (XCHARSET_NAME (charset), make_int (c1));
     }
   UNGCPRO;
-
   return rc;
+#endif
 }
 
 \f
@@ -2083,6 +2496,9 @@ syms_of_mule_charset (void)
   DEFSUBR (Fchar_attribute_alist);
   DEFSUBR (Fget_char_attribute);
   DEFSUBR (Fput_char_attribute);
+  DEFSUBR (Fdefine_char);
+  DEFSUBR (Fchar_variants);
+  DEFSUBR (Fget_composite_char);
   DEFSUBR (Fcharset_mapping_table);
   DEFSUBR (Fset_charset_mapping_table);
 #endif
@@ -2127,19 +2543,60 @@ syms_of_mule_charset (void)
   defsymbol (&Qjapanese_jisx0208_1978, "japanese-jisx0208-1978");
   defsymbol (&Qchinese_gb2312,         "chinese-gb2312");
   defsymbol (&Qjapanese_jisx0208,      "japanese-jisx0208");
+  defsymbol (&Qjapanese_jisx0208_1990,         "japanese-jisx0208-1990");
   defsymbol (&Qkorean_ksc5601,         "korean-ksc5601");
   defsymbol (&Qjapanese_jisx0212,      "japanese-jisx0212");
   defsymbol (&Qchinese_cns11643_1,     "chinese-cns11643-1");
   defsymbol (&Qchinese_cns11643_2,     "chinese-cns11643-2");
 #ifdef UTF2000
+  defsymbol (&Q_ucs,                   "->ucs");
+  defsymbol (&Q_decomposition,         "->decomposition");
+  defsymbol (&Qcompat,                 "compat");
+  defsymbol (&Qisolated,               "isolated");
+  defsymbol (&Qinitial,                        "initial");
+  defsymbol (&Qmedial,                 "medial");
+  defsymbol (&Qfinal,                  "final");
+  defsymbol (&Qvertical,               "vertical");
+  defsymbol (&QnoBreak,                        "noBreak");
+  defsymbol (&Qfraction,               "fraction");
+  defsymbol (&Qsuper,                  "super");
+  defsymbol (&Qsub,                    "sub");
+  defsymbol (&Qcircle,                 "circle");
+  defsymbol (&Qsquare,                 "square");
+  defsymbol (&Qwide,                   "wide");
+  defsymbol (&Qnarrow,                 "narrow");
+  defsymbol (&Qsmall,                  "small");
+  defsymbol (&Qfont,                   "font");
+  defsymbol (&Qucs,                    "ucs");
   defsymbol (&Qucs_bmp,                        "ucs-bmp");
   defsymbol (&Qlatin_viscii,           "latin-viscii");
   defsymbol (&Qlatin_viscii_lower,     "latin-viscii-lower");
   defsymbol (&Qlatin_viscii_upper,     "latin-viscii-upper");
   defsymbol (&Qvietnamese_viscii_lower,        "vietnamese-viscii-lower");
   defsymbol (&Qvietnamese_viscii_upper,        "vietnamese-viscii-upper");
-  defsymbol (&Qhiragana_jisx0208,      "hiragana-jisx0208");
-  defsymbol (&Qkatakana_jisx0208,      "katakana-jisx0208");
+  defsymbol (&Qideograph_daikanwa,     "ideograph-daikanwa");
+  defsymbol (&Qmojikyo_pj_1,           "mojikyo-pj-1");
+  defsymbol (&Qmojikyo_pj_2,           "mojikyo-pj-2");
+  defsymbol (&Qmojikyo_pj_3,           "mojikyo-pj-3");
+  defsymbol (&Qmojikyo_pj_4,           "mojikyo-pj-4");
+  defsymbol (&Qmojikyo_pj_5,           "mojikyo-pj-5");
+  defsymbol (&Qmojikyo_pj_6,           "mojikyo-pj-6");
+  defsymbol (&Qmojikyo_pj_7,           "mojikyo-pj-7");
+  defsymbol (&Qmojikyo_pj_8,           "mojikyo-pj-8");
+  defsymbol (&Qmojikyo_pj_9,           "mojikyo-pj-9");
+  defsymbol (&Qmojikyo_pj_10,          "mojikyo-pj-10");
+  defsymbol (&Qmojikyo_pj_11,          "mojikyo-pj-11");
+  defsymbol (&Qmojikyo_pj_12,          "mojikyo-pj-12");
+  defsymbol (&Qmojikyo_pj_13,          "mojikyo-pj-13");
+  defsymbol (&Qmojikyo_pj_14,          "mojikyo-pj-14");
+  defsymbol (&Qmojikyo_pj_15,          "mojikyo-pj-15");
+  defsymbol (&Qmojikyo_pj_16,          "mojikyo-pj-16");
+  defsymbol (&Qmojikyo_pj_17,          "mojikyo-pj-17");
+  defsymbol (&Qmojikyo_pj_18,          "mojikyo-pj-18");
+  defsymbol (&Qmojikyo_pj_19,          "mojikyo-pj-19");
+  defsymbol (&Qmojikyo_pj_20,          "mojikyo-pj-20");
+  defsymbol (&Qmojikyo_pj_21,          "mojikyo-pj-21");
+  defsymbol (&Qethiopic_ucs,           "ethiopic-ucs");
 #endif
   defsymbol (&Qchinese_big5_1,         "chinese-big5-1");
   defsymbol (&Qchinese_big5_2,         "chinese-big5-2");
@@ -2188,7 +2645,7 @@ Leading-code of private TYPE9N charset of column-width 1.
 #endif
 
 #ifdef UTF2000
-  Vutf_2000_version = build_string("0.10 (Yao)");
+  Vutf_2000_version = build_string("0.12 (Kashiwara)");
   DEFVAR_LISP ("utf-2000-version", &Vutf_2000_version /*
 Version number of UTF-2000.
 */ );
@@ -2196,6 +2653,12 @@ Version number of UTF-2000.
   staticpro (&Vcharacter_attribute_table);
   Vcharacter_attribute_table = make_char_code_table (Qnil);
 
+  staticpro (&Vcharacter_composition_table);
+  Vcharacter_composition_table = make_char_code_table (Qnil);
+
+  staticpro (&Vcharacter_variant_table);
+  Vcharacter_variant_table = make_char_code_table (Qnil);
+
   Vdefault_coded_charset_priority_list = Qnil;
   DEFVAR_LISP ("default-coded-charset-priority-list",
               &Vdefault_coded_charset_priority_list /*
@@ -2392,6 +2855,18 @@ complex_vars_of_mule_charset (void)
                  build_string ("JIS X0208:1983 Japanese Kanji"),
                  build_string ("jisx0208\\.1983"),
                  Qnil, 0, 0, 0, 33);
+  Vcharset_japanese_jisx0208_1990 =
+    make_charset (LEADING_BYTE_JAPANESE_JISX0208_1990,
+                 Qjapanese_jisx0208_1990,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("JISX0208-1990"),
+                 build_string ("JIS X0208:1990 (Japanese)"),
+                 build_string ("JIS X0208:1990 Japanese Kanji"),
+                 build_string ("jisx0208\\.1990"),
+                 Qnil,
+                 MIN_CHAR_JIS_X0208_1990,
+                 MAX_CHAR_JIS_X0208_1990, 0, 33);
   Vcharset_korean_ksc5601 =
     make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601,
                  CHARSET_TYPE_94X94, 2, 0, 'C',
@@ -2460,26 +2935,234 @@ complex_vars_of_mule_charset (void)
                  build_string ("VISCII 1.1 (Vietnamese)"),
                  build_string ("VISCII1\\.1"),
                  Qnil, 0, 0, 0, 0);
-  Vcharset_hiragana_jisx0208 =
-    make_charset (LEADING_BYTE_HIRAGANA_JISX0208, Qhiragana_jisx0208,
-                 CHARSET_TYPE_94X94, 2, 0, 'B',
+  Vcharset_ideograph_daikanwa =
+    make_charset (LEADING_BYTE_DAIKANWA, Qideograph_daikanwa,
+                 CHARSET_TYPE_256X256, 2, 2, 0,
                  CHARSET_LEFT_TO_RIGHT,
-                 build_string ("Hiragana"),
-                 build_string ("Hiragana of JIS X0208"),
-                 build_string ("Japanese Hiragana of JIS X0208"),
-                 build_string ("jisx0208\\.19\\(78\\|83\\|90\\)"),
-                 Qnil, MIN_CHAR_HIRAGANA, MAX_CHAR_HIRAGANA,
-                 (0x24 - 33) * 94 + (0x21 - 33), 33);
-  Vcharset_katakana_jisx0208 =
-    make_charset (LEADING_BYTE_KATAKANA_JISX0208, Qkatakana_jisx0208,
-                 CHARSET_TYPE_94X94, 2, 0, 'B',
+                 build_string ("Daikanwa"),
+                 build_string ("Morohashi's Daikanwa"),
+                 build_string ("Daikanwa dictionary by MOROHASHI Tetsuji"),
+                 build_string ("Daikanwa"),
+                 Qnil, MIN_CHAR_DAIKANWA, MAX_CHAR_DAIKANWA, 0, 0);
+  Vcharset_mojikyo_pj_1 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_1, Qmojikyo_pj_1,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-1"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 1"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 1"),
+                 build_string ("jisx0208\\.Mojikyo-1$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_2 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_2, Qmojikyo_pj_2,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-2"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 2"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 2"),
+                 build_string ("jisx0208\\.Mojikyo-2$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_3 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_3, Qmojikyo_pj_3,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-3"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 3"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 3"),
+                 build_string ("jisx0208\\.Mojikyo-3$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_4 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_4, Qmojikyo_pj_4,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-4"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 4"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 4"),
+                 build_string ("jisx0208\\.Mojikyo-4$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_5 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_5, Qmojikyo_pj_5,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-5"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 5"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 5"),
+                 build_string ("jisx0208\\.Mojikyo-5$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_6 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_6, Qmojikyo_pj_6,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-6"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 6"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 6"),
+                 build_string ("jisx0208\\.Mojikyo-6$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_7 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_7, Qmojikyo_pj_7,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-7"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 7"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 7"),
+                 build_string ("jisx0208\\.Mojikyo-7$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_8 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_8, Qmojikyo_pj_8,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-8"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 8"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 8"),
+                 build_string ("jisx0208\\.Mojikyo-8$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_9 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_9, Qmojikyo_pj_9,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-9"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 9"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 9"),
+                 build_string ("jisx0208\\.Mojikyo-9$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_10 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_10, Qmojikyo_pj_10,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-10"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 10"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 10"),
+                 build_string ("jisx0208\\.Mojikyo-10$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_11 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_11, Qmojikyo_pj_11,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-11"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 11"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 11"),
+                 build_string ("jisx0208\\.Mojikyo-11$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_12 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_12, Qmojikyo_pj_12,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-12"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 12"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 12"),
+                 build_string ("jisx0208\\.Mojikyo-12$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_13 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_13, Qmojikyo_pj_13,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-13"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 13"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 13"),
+                 build_string ("jisx0208\\.Mojikyo-13$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_14 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_14, Qmojikyo_pj_14,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-14"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 14"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 14"),
+                 build_string ("jisx0208\\.Mojikyo-14$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_15 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_15, Qmojikyo_pj_15,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-15"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 15"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 15"),
+                 build_string ("jisx0208\\.Mojikyo-15$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_16 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_16, Qmojikyo_pj_16,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-16"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 16"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 16"),
+                 build_string ("jisx0208\\.Mojikyo-16$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_17 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_17, Qmojikyo_pj_17,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-17"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 17"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 17"),
+                 build_string ("jisx0208\\.Mojikyo-17$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_18 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_18, Qmojikyo_pj_18,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-18"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 18"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 18"),
+                 build_string ("jisx0208\\.Mojikyo-18$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_19 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_19, Qmojikyo_pj_19,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-19"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 19"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 19"),
+                 build_string ("jisx0208\\.Mojikyo-19$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_20 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_20, Qmojikyo_pj_20,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-20"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 20"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 20"),
+                 build_string ("jisx0208\\.Mojikyo-20$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_mojikyo_pj_21 =
+    make_charset (LEADING_BYTE_MOJIKYO_PJ_21, Qmojikyo_pj_21,
+                 CHARSET_TYPE_94X94, 2, 0, 0,
+                 CHARSET_LEFT_TO_RIGHT,
+                 build_string ("Mojikyo-PJ-21"),
+                 build_string ("Mojikyo (pseudo JIS encoding) part 21"),
+                 build_string
+                 ("Konjaku-Mojikyo (pseudo JIS encoding) part 21"),
+                 build_string ("jisx0208\\.Mojikyo-21$"),
+                 Qnil, 0, 0, 0, 33);
+  Vcharset_ethiopic_ucs =
+    make_charset (LEADING_BYTE_ETHIOPIC_UCS, Qethiopic_ucs,
+                 CHARSET_TYPE_256X256, 2, 2, 0,
                  CHARSET_LEFT_TO_RIGHT,
-                 build_string ("Katakana"),
-                 build_string ("Katakana of JIS X0208"),
-                 build_string ("Japanese Katakana of JIS X0208"),
-                 build_string ("jisx0208\\.19\\(78\\|83\\|90\\)"),
-                 Qnil, MIN_CHAR_KATAKANA, MAX_CHAR_KATAKANA,
-                 (0x25 - 33) * 94 + (0x21 - 33), 33);
+                 build_string ("Ethiopic (UCS)"),
+                 build_string ("Ethiopic (UCS)"),
+                 build_string ("Ethiopic of UCS"),
+                 build_string ("Ethiopic-Unicode"),
+                 Qnil, 0x1200, 0x137F, 0x1200, 0);
 #endif
   Vcharset_chinese_big5_1 =
     make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1,