(next_allocated_leading_byte): New variable in UTF-2000.
[chise/xemacs-chise.git] / src / mule-charset.c
index 52c1291..850817e 100644 (file)
@@ -147,12 +147,16 @@ char_byte_table_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
 
   for (i = 0; i < 256; i++)
     if (CHAR_BYTE_TABLE_P (cte1->property[i]))
-      if (CHAR_BYTE_TABLE_P (cte2->property[i]))
-       if (!char_byte_table_equal (cte1->property[i],
+      {
+       if (CHAR_BYTE_TABLE_P (cte2->property[i]))
+         {
+           if (!char_byte_table_equal (cte1->property[i],
                                        cte2->property[i], depth + 1))
+             return 0;
+         }
+       else
          return 0;
-      else
-       return 0;
+      }
     else
       if (!internal_equal (cte1->property[i], cte2->property[i], depth + 1))
        return 0;
@@ -359,8 +363,12 @@ Lisp_Object Ql2r, Qr2l;
 
 Lisp_Object Vcharset_hash_table;
 
+#ifdef UTF2000
+static Charset_ID next_allocated_leading_byte;
+#else
 static Charset_ID next_allocated_1_byte_leading_byte;
 static Charset_ID next_allocated_2_byte_leading_byte;
+#endif
 
 /* Composite characters are characters constructed by overstriking two
    or more regular characters.
@@ -899,6 +907,12 @@ get_unallocated_leading_byte (int dimension)
 {
   Charset_ID lb;
 
+#ifdef UTF2000
+  if (next_allocated_leading_byte > MAX_LEADING_BYTE_PRIVATE)
+    lb = 0;
+  else
+    lb = next_allocated_leading_byte++;
+#else
   if (dimension == 1)
     {
       if (next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1)
@@ -913,6 +927,7 @@ get_unallocated_leading_byte (int dimension)
       else
        lb = next_allocated_2_byte_leading_byte++;
     }
+#endif
 
   if (!lb)
     signal_simple_error
@@ -1210,6 +1225,7 @@ character set.  Recognized properties are:
   Lisp_Object ccl_program = Qnil;
   Lisp_Object short_name = Qnil, long_name = Qnil;
 #ifdef UTF2000
+  Emchar code_offset = 0;
   unsigned char byte_offset = 0;
 #endif
 
@@ -1327,12 +1343,17 @@ character set.  Recognized properties are:
     {
       if (chars == 94)
        {
-         /* id = CHARSET_ID_OFFSET_94 + final; */
-         id = get_unallocated_leading_byte (dimension);
+         if (code_offset == 0)
+           id = CHARSET_ID_OFFSET_94 + final;
+         else
+           id = get_unallocated_leading_byte (dimension);
        }
       else if (chars == 96)
        {
-         id = get_unallocated_leading_byte (dimension);
+         if (code_offset == 0)
+           id = CHARSET_ID_OFFSET_96 + final;
+         else
+           id = get_unallocated_leading_byte (dimension);
        }
       else
        {
@@ -1343,7 +1364,10 @@ character set.  Recognized properties are:
     {
       if (chars == 94)
        {
-         id = get_unallocated_leading_byte (dimension);
+         if (code_offset == 0)
+           id = CHARSET_ID_OFFSET_94x94 + final;
+         else
+           id = get_unallocated_leading_byte (dimension);
        }
       else if (chars == 96)
        {
@@ -1359,10 +1383,12 @@ character set.  Recognized properties are:
       abort ();
     }
   if (final)
-    if (chars == 94)
-      byte_offset = 33;
-    else if (chars == 96)
-      byte_offset = 32;
+    {
+      if (chars == 94)
+       byte_offset = 33;
+      else if (chars == 96)
+       byte_offset = 32;
+    }
 #else
   id = get_unallocated_leading_byte (dimension);
 #endif
@@ -2036,10 +2062,10 @@ vars_of_mule_charset (void)
        charset_by_attributes[i][j][k] = Qnil;
 #endif
 
-  next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1;
 #ifdef UTF2000
-  next_allocated_2_byte_leading_byte = LEADING_BYTE_CHINESE_BIG5_2 + 1;
+  next_allocated_leading_byte = MIN_LEADING_BYTE_PRIVATE;
 #else
+  next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1;
   next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2;
 #endif
 
@@ -2082,8 +2108,8 @@ complex_vars_of_mule_charset (void)
                  CHARSET_LEFT_TO_RIGHT,
                  build_string ("BMP"),
                  build_string ("BMP"),
-                 build_string ("BMP"),
-                 build_string ("\\(ISO10646.*-1\\|UNICODE[23]?\\)"),
+                 build_string ("ISO/IEC 10646 Group 0 Plane 0 (BMP)"),
+                 build_string ("\\(ISO10646.*-1\\|UNICODE[23]?-0\\)"),
                  Qnil, 0, 0xFFFF, 0, 0);
 #else
 # define MIN_CHAR_THAI 0