update.
[chise/xemacs-chise.git.1] / src / mule-charset.c
index cff909a..0007daa 100644 (file)
@@ -1,7 +1,8 @@
 /* Functions to handle multilingual characters.
    Copyright (C) 1992, 1995 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1999,2000,2001,2002,2003,2004,2008,2009 MORIOKA Tomohiko
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2011, 2013, 2016
+     MORIOKA Tomohiko
 
 This file is part of XEmacs.
 
@@ -1139,35 +1140,50 @@ decode_builtin_char (Lisp_Object charset, int code_point)
 }
 
 int
-charset_code_point (Lisp_Object charset, Emchar ch, int defined_only)
+charset_code_point (Lisp_Object charset, Emchar ch, int accepted_mode)
 {
-  Lisp_Object encoding_table = XCHARSET_ENCODING_TABLE (charset);
   Lisp_Object ret;
 
-  if ( CHAR_TABLEP (encoding_table)
-       && INTP (ret = get_char_id_table (XCHAR_TABLE(encoding_table),
-                                        ch)) )
-    return XINT (ret);
-  else
+  if ( accepted_mode >= 0 )
+    {
+      Lisp_Object encoding_table = XCHARSET_ENCODING_TABLE (charset);
+
+      if ( CHAR_TABLEP (encoding_table)
+#ifdef USE_CONCORD_OBJECT_SYSTEM
+          && !UNBOUNDP (ret = get_char_id_table_ce (XCHAR_TABLE
+                                                    (encoding_table),
+                                                    ch))
+#else
+          && !UNBOUNDP (ret = get_char_id_table (XCHAR_TABLE(encoding_table),
+                                                 ch))
+#endif
+          )
+       if ( INTP (ret) )
+         return XINT (ret);
+       else
+         return -1;
+    }
     {
       Lisp_Object mother = XCHARSET_MOTHER (charset);
       int min = XCHARSET_MIN_CODE (charset);
       int max = XCHARSET_MAX_CODE (charset);
       int code = -1;
 
-      if ( CHARSETP (mother) )
-       {
-         if (XCHARSET_FINAL (charset) >= '0')
-           code = charset_code_point (mother, ch, 1);
-         else
-           code = charset_code_point (mother, ch, defined_only);
-       }
-      else if (defined_only)
+      if ( CHARSETP (mother) && ( accepted_mode >= 0)
+          && ( XCHARSET_FINAL (charset) >= '0' )
+          )
+       code = charset_code_point (mother, ch, CHAR_DEFINED_ONLY);
+      else if ( CHARSETP (mother)
+               && ( XCHARSET_FINAL (charset) < '0' )
+               )
+       code = charset_code_point (mother, ch, accepted_mode);
+      else if ( accepted_mode == CHAR_DEFINED_ONLY )
        return -1;
       else if ( ((max == 0) && CHARSETP (mother)
                 && (XCHARSET_FINAL (charset) == 0))
                || ((min <= ch) && (ch <= max)) )
        code = ch;
+
       if ( ((max == 0) && CHARSETP (mother) && (code >= 0))
           || ((min <= code) && (code <= max)) )
        {
@@ -1260,7 +1276,7 @@ charset_code_point (Lisp_Object charset, Emchar ch, int defined_only)
              exit (-1);
            }
        }
-      else if (defined_only)
+      else if ( accepted_mode == CHAR_DEFINED_ONLY )
        return -1;
       else if ( ( XCHARSET_FINAL (charset) >= '0' ) &&
                ( XCHARSET_MIN_CODE (charset) == 0 )
@@ -1634,6 +1650,8 @@ character set.  Recognized properties are:
                is passed the octets of the character, with the high
                bit cleared and set depending upon whether the value
                of the 'graphic property is 0 or 1.
+'iso-ir                ISO-IR number (for representative coded-charset).
+'=>iso-ir      [UTF-2000 only] Corresponding ISO-IR number.
 'mother                [UTF-2000 only] Base coded-charset.
 'code-min      [UTF-2000 only] Minimum code-point of a base coded-charset.
 'code-max      [UTF-2000 only] Maximum code-point of a base coded-charset.
@@ -1872,6 +1890,47 @@ character set.  Recognized properties are:
        byte_offset = 0;
     }
 
+  if ( (conversion == 0) && NILP (mother) && (min_code > 0) )
+    {
+      switch (chars)
+       {
+       case 94:
+         switch (dimension)
+           {
+           case 1:
+             conversion = CONVERSION_94;
+             break;
+           case 2:
+             conversion = CONVERSION_94x94;
+             break;
+           case 3:
+             conversion = CONVERSION_94x94x94;
+             break;
+           case 4:
+             conversion = CONVERSION_94x94x94x94;
+             break;
+           }
+         break;
+       case 96:
+         switch (dimension)
+           {
+           case 1:
+             conversion = CONVERSION_96;
+             break;
+           case 2:
+             conversion = CONVERSION_96x96;
+             break;
+           case 3:
+             conversion = CONVERSION_96x96x96;
+             break;
+           case 4:
+             conversion = CONVERSION_96x96x96x96;
+             break;
+           }
+         break;
+       }
+    }
+
   charset = make_charset (id, name, chars, dimension, columns, graphic,
                          final, direction, short_name, long_name,
                          doc_string, registry, iso_ir,
@@ -2086,7 +2145,8 @@ Recognized properties are those listed in `make-charset', as well as
       return CHARSETP (obj) ? XCHARSET_NAME (obj) : obj;
     }
 #ifdef UTF2000
-  if (EQ (prop, Qiso_ir))
+  if (EQ (prop, Qiso_ir)||
+      EQ (prop, Qto_iso_ir))
     {
       if ( CHARSET_ISO_IR (cs) > 0 )
        return make_int (CHARSET_ISO_IR (cs));
@@ -2503,10 +2563,12 @@ load_char_decoding_entry_maybe (Lisp_Object ccs, int code_point)
     = chise_ds_decode_char (default_chise_data_source,
                            XSTRING_DATA(Fsymbol_name (XCHARSET_NAME(ccs))),
                            code_point);
+#if 0
   if (char_id >= 0)
     decoding_table_put_char (ccs, code_point, make_char (char_id));
   else
     decoding_table_put_char (ccs, code_point, Qnil);
+#endif
 
   /* chise_ccst_close (dt_ccs); */
   return char_id;
@@ -3443,7 +3505,7 @@ complex_vars_of_mule_charset (void)
                  build_string ("JIS X0208"),
                  build_string ("JIS X0208 Common"),
                  build_string ("JIS X0208 Common part"),
-                 build_string ("jisx0208\\.1990"),
+                 build_string ("jisx0208"),
                  - LEADING_BYTE_JAPANESE_JISX0208_1978,
                  Qnil,
                  MIN_CHAR_JIS_X0208_1990,