#define BIG5_SAME_ROW (0xFF - 0xA1 + 0x7F - 0x40)
Emchar
+decode_defined_char (Lisp_Object ccs, int code_point)
+{
+ int dim = XCHARSET_DIMENSION (ccs);
+ Lisp_Object decoding_table = XCHARSET_DECODING_TABLE (ccs);
+ Emchar char_id = -1;
+ Lisp_Object mother;
+
+ while (dim > 0)
+ {
+ dim--;
+ decoding_table
+ = get_ccs_octet_table (decoding_table, ccs,
+ (code_point >> (dim * 8)) & 255);
+ }
+ if (CHARP (decoding_table))
+ return XCHAR (decoding_table);
+#ifdef HAVE_DATABASE
+ if (EQ (decoding_table, Qunloaded) ||
+ EQ (decoding_table, Qunbound) ||
+ NILP (decoding_table) )
+ {
+ char_id = load_char_decoding_entry_maybe (ccs, code_point);
+ }
+#endif
+ if (char_id >= 0)
+ return char_id;
+ else if ( CHARSETP (mother = XCHARSET_MOTHER (ccs)) )
+ {
+ if ( XCHARSET_CONVERSION (ccs) == CONVERSION_IDENTICAL )
+ {
+ if ( EQ (mother, Vcharset_ucs) )
+ return DECODE_CHAR (mother, code_point);
+ else
+ return decode_defined_char (mother, code_point);
+ }
+ }
+ return -1;
+}
+
+Emchar
decode_builtin_char (Lisp_Object charset, int code_point)
{
Lisp_Object mother = XCHARSET_MOTHER (charset);
int final;
- if ( CHARSETP (mother) )
+ if ( CHARSETP (mother) && (XCHARSET_MAX_CODE (charset) > 0) )
{
int code = code_point;
code = charset_code_point (mother, ch);
else
code = ch;
- if ( (min <= code) && (code <= max) )
+ if ( ((max == 0) && CHARSETP (mother)) ||
+ ((min <= code) && (code <= max)) )
{
int d = code - XCHARSET_CODE_OFFSET (charset);
db_file = char_attribute_system_db_file (CHARSET_NAME (cs),
Qsystem_char_id, 1);
- db = Fopen_database (db_file, Qnil, Qnil, Qnil, Qnil);
-
+ db = Fopen_database (db_file, Qnil, Qnil, build_string ("w+"), Qnil);
+
byte_min = CHARSET_BYTE_OFFSET (cs);
byte_max = byte_min + CHARSET_BYTE_SIZE (cs);
switch (CHARSET_DIMENSION (cs))
= char_attribute_system_db_file (XCHARSET_NAME(ccs), Qsystem_char_id,
0);
- db = Fopen_database (db_file, Qnil, Qnil, Qnil, Qnil);
+ db = Fopen_database (db_file, Qnil, Qnil, build_string ("r"), Qnil);
if (!NILP (db))
{
Lisp_Object ret
if (NILP (defined_only))
c = DECODE_CHAR (charset, c);
else
- c = DECODE_DEFINED_CHAR (charset, c);
+ c = decode_defined_char (charset, c);
return c >= 0 ? make_char (c) : Qnil;
}
build_string ("UCS"),
build_string ("ISO/IEC 10646"),
build_string (""),
- Qnil, 0, 0xFFFFFFF, 0, 0, Qnil, CONVERSION_IDENTICAL);
+ Qnil, 0, 0x7FFFFFFF, 0, 0, Qnil, CONVERSION_IDENTICAL);
staticpro (&Vcharset_ucs_bmp);
Vcharset_ucs_bmp =
make_charset (LEADING_BYTE_UCS_BMP, Qucs_bmp, 256, 2,
build_string ("UCS for CNS 11643"),
build_string ("ISO/IEC 10646 for CNS 11643"),
build_string (""),
- Qnil, 0, 0, 0, 0,
- Qnil, CONVERSION_IDENTICAL);
+ Qnil, 0, 0, 0, 0, Vcharset_ucs, CONVERSION_IDENTICAL);
staticpro (&Vcharset_ucs_jis);
Vcharset_ucs_jis =
make_charset (LEADING_BYTE_UCS_JIS, Qucs_jis, 256, 3,
2, 2, 0, CHARSET_LEFT_TO_RIGHT,
build_string ("UCS for JIS"),
build_string ("UCS for JIS X 0208, 0212 and 0213"),
- build_string ("ISO/IEC 10646 for JIS X 0208, 0212 and 0213"),
+ build_string
+ ("ISO/IEC 10646 for JIS X 0208, 0212 and 0213"),
build_string (""),
- Qnil, 0, 0, 0, 0, Qnil, CONVERSION_IDENTICAL);
+ Qnil, 0, 0, 0, 0, Vcharset_ucs, CONVERSION_IDENTICAL);
staticpro (&Vcharset_ucs_ks);
Vcharset_ucs_ks =
make_charset (LEADING_BYTE_UCS_KS, Qucs_ks, 256, 3,
build_string ("UCS for CCS defined by KS"),
build_string ("ISO/IEC 10646 for Korean Standards"),
build_string (""),
- Qnil, 0, 0, 0, 0, Qnil, CONVERSION_IDENTICAL);
+ Qnil, 0, 0, 0, 0, Vcharset_ucs, CONVERSION_IDENTICAL);
staticpro (&Vcharset_ucs_big5);
Vcharset_ucs_big5 =
make_charset (LEADING_BYTE_UCS_BIG5, Qucs_big5, 256, 3,
build_string ("UCS for Big5"),
build_string ("ISO/IEC 10646 for Big5"),
build_string (""),
- Qnil, 0, 0, 0, 0, Qnil, CONVERSION_IDENTICAL);
+ Qnil, 0, 0, 0, 0, Vcharset_ucs, CONVERSION_IDENTICAL);
#else
# define MIN_CHAR_THAI 0
# define MAX_CHAR_THAI 0