From 1a457ecfa8bbb121c48cccd70779a0a23cf95e46 Mon Sep 17 00:00:00 2001 From: tomo Date: Thu, 22 Nov 2001 05:52:09 +0000 Subject: [PATCH] Merge no-et-1. --- lisp/utf-2000/ChangeLog | 9 +++++ lisp/utf-2000/char-db-util.el | 28 +++++++++------ lisp/utf-2000/ideograph-util.el | 9 +++-- src/ChangeLog | 25 +++++++++++++ src/char-ucs.h | 15 +++++--- src/chartab.c | 74 ++++++++++++--------------------------- src/chartab.h | 3 ++ src/mule-charset.c | 28 +++++---------- 8 files changed, 103 insertions(+), 88 deletions(-) diff --git a/lisp/utf-2000/ChangeLog b/lisp/utf-2000/ChangeLog index ebd4614..3a05ed0 100644 --- a/lisp/utf-2000/ChangeLog +++ b/lisp/utf-2000/ChangeLog @@ -1,3 +1,12 @@ +2001-11-20 MORIOKA Tomohiko + + * ideograph-util.el (insert-ideograph-radical-char-data): Now + return value of `char-attribute-list' includes names of + CCS-attributes. + + * char-db-util.el (insert-char-attributes): Now return value of + `char-attribute-list' includes names of CCS-attributes. + 2001-11-19 MORIOKA Tomohiko * Ideograph-R140-Grass.el: Merge KS X 1001 code points. diff --git a/lisp/utf-2000/char-db-util.el b/lisp/utf-2000/char-db-util.el index bc8e6a5..50996cb 100644 --- a/lisp/utf-2000/char-db-util.el +++ b/lisp/utf-2000/char-db-util.el @@ -358,17 +358,23 @@ (defun insert-char-attributes (char &optional readable attributes ccs-attributes column) - (setq attributes - (sort (if attributes - (if (consp attributes) - (copy-sequence attributes)) - (char-attribute-list)) - #'char-attribute-name<)) - (setq ccs-attributes - (sort (if ccs-attributes - (copy-sequence ccs-attributes) - (charset-list)) - #'char-attribute-name<)) + (let (atr-d ccs-d) + (setq attributes + (sort (if attributes + (if (consp attributes) + (copy-sequence attributes)) + (dolist (name (char-attribute-list)) + (if (find-charset name) + (push name ccs-d) + (push name atr-d))) + atr-d) + #'char-attribute-name<)) + (setq ccs-attributes + (sort (if ccs-attributes + (copy-sequence ccs-attributes) + (or ccs-d + (charset-list))) + #'char-attribute-name<))) (unless column (setq column (current-column))) (let (name value has-long-ccs-name rest diff --git a/lisp/utf-2000/ideograph-util.el b/lisp/utf-2000/ideograph-util.el index 562485b..4612b30 100644 --- a/lisp/utf-2000/ideograph-util.el +++ b/lisp/utf-2000/ideograph-util.el @@ -205,8 +205,13 @@ (let ((chars (sort (copy-list (aref ideograph-radical-chars-vector radical)) (function ideograph-char<))) - (attributes (sort (char-attribute-list) #'char-attribute-name<)) - (ccs (sort (charset-list) #'char-attribute-name<))) + attributes ccs) + (dolist (name (char-attribute-list)) + (if (find-charset name) + (push name ccs) + (push name attributes))) + (setq attributes (sort attributes #'char-attribute-name<) + ccs (sort ccs #'char-attribute-name<)) (aset ideograph-radical-chars-vector radical chars) (while chars (insert-char-data (car chars) nil attributes ccs) diff --git a/src/ChangeLog b/src/ChangeLog index b6bce9a..ddb4bc9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,28 @@ +2001-11-20 MORIOKA Tomohiko + + * mule-charset.c (put_char_ccs_code_point): Return canonicalized + value; don't store value into `encoding_table' of `Lisp_Charset'. + (mark_charset): `encoding_table' was deleted. + (charset_description): Likewise. + (make_charset): Likewise. + (Fset_charset_mapping_table): Use `Fput_char_attribute' instead of + `put_char_ccs_code_point'. + + * chartab.h (Fput_char_attribute): New EXFUN. + + * chartab.c (Fchar_attribute_alist): Name space of CCS-attributes + is unified with normal symbol space. + (Fget_char_attribute): Likewise. + (Fput_char_attribute): Likewise; behavior of + `put_char_ccs_code_point' is changed. + + * char-ucs.h: Include "elhash.h". + (Vchar_attribute_hash_table): New external variable. + (struct Lisp_Charset): Delete `encoding_table'. + (CHARSET_ENCODING_TABLE): New implementation; refer + `Vchar_attribute_hash_table' instead of `encoding_table' of struct + `Lisp_Charset'. + 2001-11-15 MORIOKA Tomohiko * mule-charset.c (Fcharset_property): Return Qnil if CHARSET_FINAL diff --git a/src/char-ucs.h b/src/char-ucs.h index 98696da..d8768c6 100644 --- a/src/char-ucs.h +++ b/src/char-ucs.h @@ -22,6 +22,9 @@ Boston, MA 02111-1307, USA. */ #define INCLUDED_char_ucs_h_ #include "chartab.h" +#include "elhash.h" + +extern Lisp_Object Vchar_attribute_hash_table; #define valid_char_p(ch) 1 @@ -293,9 +296,6 @@ struct Lisp_Charset /* Code-point->character mapping table */ Lisp_Object decoding_table; - /* Character->code-point mapping table */ - Lisp_Object encoding_table; - /* Range of character code */ Emchar ucs_min, ucs_max; @@ -335,12 +335,19 @@ DECLARE_LRECORD (charset, Lisp_Charset); #define CHARSET_CHARS(cs) ((cs)->chars) #define CHARSET_REVERSE_DIRECTION_CHARSET(cs) ((cs)->reverse_direction_charset) #define CHARSET_DECODING_TABLE(cs) ((cs)->decoding_table) -#define CHARSET_ENCODING_TABLE(cs) ((cs)->encoding_table) #define CHARSET_UCS_MIN(cs) ((cs)->ucs_min) #define CHARSET_UCS_MAX(cs) ((cs)->ucs_max) #define CHARSET_CODE_OFFSET(cs) ((cs)->code_offset) #define CHARSET_BYTE_OFFSET(cs) ((cs)->byte_offset) +INLINE_HEADER Lisp_Object CHARSET_ENCODING_TABLE (Lisp_Charset* cs); +INLINE_HEADER Lisp_Object +CHARSET_ENCODING_TABLE (Lisp_Charset* cs) +{ + return Fgethash (CHARSET_NAME(cs), + Vchar_attribute_hash_table, + Qnil); +} #define XCHARSET_ID(cs) CHARSET_ID (XCHARSET (cs)) #define XCHARSET_NAME(cs) CHARSET_NAME (XCHARSET (cs)) diff --git a/src/chartab.c b/src/chartab.c index 84878f4..4ff2a57 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -2844,41 +2844,20 @@ Return the alist of attributes of CHARACTER. */ (character)) { + struct gcpro gcpro1; + struct char_attribute_alist_closure char_attribute_alist_closure; Lisp_Object alist = Qnil; - int i; CHECK_CHAR (character); - { - struct gcpro gcpro1; - struct char_attribute_alist_closure char_attribute_alist_closure; - - GCPRO1 (alist); - char_attribute_alist_closure.char_id = XCHAR (character); - char_attribute_alist_closure.char_attribute_alist = &alist; - elisp_maphash (add_char_attribute_alist_mapper, - Vchar_attribute_hash_table, - &char_attribute_alist_closure); - UNGCPRO; - } - - for (i = 0; i < countof (chlook->charset_by_leading_byte); i++) - { - Lisp_Object ccs = chlook->charset_by_leading_byte[i]; - if (!NILP (ccs)) - { - Lisp_Object encoding_table = XCHARSET_ENCODING_TABLE (ccs); - Lisp_Object cpos; + GCPRO1 (alist); + char_attribute_alist_closure.char_id = XCHAR (character); + char_attribute_alist_closure.char_attribute_alist = &alist; + elisp_maphash (add_char_attribute_alist_mapper, + Vchar_attribute_hash_table, + &char_attribute_alist_closure); + UNGCPRO; - if ( CHAR_TABLEP (encoding_table) - && INTP (cpos - = get_char_id_table (XCHAR_TABLE(encoding_table), - XCHAR (character))) ) - { - alist = Fcons (Fcons (ccs, cpos), alist); - } - } - } return alist; } @@ -2888,29 +2867,21 @@ Return DEFAULT-VALUE if the value is not exist. */ (character, attribute, default_value)) { - Lisp_Object ccs; + Lisp_Object table; CHECK_CHAR (character); - if (!NILP (ccs = Ffind_charset (attribute))) - { - Lisp_Object encoding_table = XCHARSET_ENCODING_TABLE (ccs); - if (CHAR_TABLEP (encoding_table)) - return get_char_id_table (XCHAR_TABLE(encoding_table), - XCHAR (character)); - } - else + if (CHARSETP (attribute)) + attribute = XCHARSET_NAME (attribute); + + table = Fgethash (attribute, Vchar_attribute_hash_table, + Qunbound); + if (!UNBOUNDP (table)) { - Lisp_Object table = Fgethash (attribute, - Vchar_attribute_hash_table, - Qunbound); - if (!UNBOUNDP (table)) - { - Lisp_Object ret = get_char_id_table (XCHAR_TABLE(table), - XCHAR (character)); - if (!UNBOUNDP (ret)) - return ret; - } + Lisp_Object ret = get_char_id_table (XCHAR_TABLE(table), + XCHAR (character)); + if (!UNBOUNDP (ret)) + return ret; } return default_value; } @@ -2920,13 +2891,12 @@ Store CHARACTER's ATTRIBUTE with VALUE. */ (character, attribute, value)) { - Lisp_Object ccs; + Lisp_Object ccs = Ffind_charset (attribute); - ccs = Ffind_charset (attribute); if (!NILP (ccs)) { CHECK_CHAR (character); - return put_char_ccs_code_point (character, ccs, value); + value = put_char_ccs_code_point (character, ccs, value); } else if (EQ (attribute, Q_decomposition)) { diff --git a/src/chartab.h b/src/chartab.h index 44b0632..7d62ac2 100644 --- a/src/chartab.h +++ b/src/chartab.h @@ -34,6 +34,9 @@ Boston, MA 02111-1307, USA. */ EXFUN (Fmake_char, 3); EXFUN (Fdecode_char, 3); +EXFUN (Fput_char_attribute, 3); + + /************************************************************************/ /* Char-ID Tables */ /************************************************************************/ diff --git a/src/mule-charset.c b/src/mule-charset.c index e592ad4..e937b18 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -294,9 +294,8 @@ Lisp_Object put_char_ccs_code_point (Lisp_Object character, Lisp_Object ccs, Lisp_Object value) { - Lisp_Object encoding_table; - if (!EQ (XCHARSET_NAME (ccs), Qucs) + || !INTP (value) || (XCHAR (character) != XINT (value))) { Lisp_Object v = XCHARSET_DECODING_TABLE (ccs); @@ -350,7 +349,7 @@ put_char_ccs_code_point (Lisp_Object character, if (VECTORP (v)) { Lisp_Object cpos = Fget_char_attribute (character, ccs, Qnil); - if (!NILP (cpos)) + if (INTP (cpos)) { decoding_table_remove_char (v, dim, byte_offset, XINT (cpos)); } @@ -363,13 +362,7 @@ put_char_ccs_code_point (Lisp_Object character, decoding_table_put_char (v, dim, byte_offset, code_point, character); } - if (NILP (encoding_table = XCHARSET_ENCODING_TABLE (ccs))) - { - XCHARSET_ENCODING_TABLE (ccs) - = encoding_table = make_char_id_table (Qnil); - } - put_char_id_table (XCHAR_TABLE(encoding_table), character, value); - return Qt; + return value; } Lisp_Object @@ -844,7 +837,6 @@ mark_charset (Lisp_Object obj) mark_object (cs->registry); mark_object (cs->ccl_program); #ifdef UTF2000 - mark_object (cs->encoding_table); /* mark_object (cs->decoding_table); */ #endif return cs->name; @@ -892,7 +884,6 @@ static const struct lrecord_description charset_description[] = { { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) }, #ifdef UTF2000 { XD_LISP_OBJECT, offsetof (Lisp_Charset, decoding_table) }, - { XD_LISP_OBJECT, offsetof (Lisp_Charset, encoding_table) }, #endif { XD_END } }; @@ -938,7 +929,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; @@ -1978,8 +1968,8 @@ Set mapping-table of CHARSET to TABLE. Lisp_Object c = XVECTOR_DATA(table)[i]; if (CHARP (c)) - put_char_ccs_code_point (c, charset, - make_int (i + byte_offset)); + Fput_char_attribute (c, XCHARSET_NAME (charset), + make_int (i + byte_offset)); } break; case 2: @@ -1996,16 +1986,16 @@ Set mapping-table of CHARSET to TABLE. Lisp_Object c = XVECTOR_DATA(v)[j]; if (CHARP (c)) - put_char_ccs_code_point - (c, charset, + Fput_char_attribute + (c, XCHARSET_NAME (charset), make_int ( ( (i + byte_offset) << 8 ) | (j + byte_offset) ) ); } } else if (CHARP (v)) - put_char_ccs_code_point (v, charset, - make_int (i + byte_offset)); + Fput_char_attribute (v, XCHARSET_NAME (charset), + make_int (i + byte_offset)); } break; } -- 1.7.10.4