From 65436860487cb6828c53b343b26de30187bfc411 Mon Sep 17 00:00:00 2001 From: tomo Date: Fri, 19 Jul 2002 07:57:50 +0000 Subject: [PATCH] Sync with r21-2-44-utf-2000-0_19-ids1-n14. --- lisp/utf-2000/ChangeLog | 5 +++++ src/ChangeLog | 16 ++++++++++++++ src/chartab.h | 4 +++- src/data.c | 9 ++++++++ src/fns.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++ src/lisp.h | 1 + 6 files changed, 88 insertions(+), 1 deletion(-) diff --git a/lisp/utf-2000/ChangeLog b/lisp/utf-2000/ChangeLog index 8fdf4fb..79330e2 100644 --- a/lisp/utf-2000/ChangeLog +++ b/lisp/utf-2000/ChangeLog @@ -1,3 +1,8 @@ +2002-07-17 MORIOKA Tomohiko + + * char-db-util.el (char-ref-p): Deleted [defined as a builtin + function]. + 2002-07-18 MORIOKA Tomohiko * Ideograph-R075-Tree.el: Add missing mappings between JIS X 0213 diff --git a/src/ChangeLog b/src/ChangeLog index d5be085..ca9f450 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2002-07-17 MORIOKA Tomohiko + + * lisp.h: Add an EXFUN for `Fchar_ref_p'. + + * fns.c (Qideographic_structure): New variable. + (Qkeyword_char): New variable. + (ids_format_unit): New function. + (Fideographic_structure_to_ids): New function. + (syms_of_fns): Add new symbols `ideographic-structure' and + `:char'; add new builtin function `ideographic-structure-to-ids'. + + * data.c (Fchar_ref_p): New function. + (syms_of_data): Add new builtin function `char-ref-p'. + + * chartab.h: Add an EXFUN for `Ffind_char'. + 2002-07-07 MORIOKA Tomohiko * text-coding.c (decode_coding_utf8): Use `COMPOSE_FLUSH_CHARS' diff --git a/src/chartab.h b/src/chartab.h index ca71025..778186b 100644 --- a/src/chartab.h +++ b/src/chartab.h @@ -1,7 +1,7 @@ /* Declarations having to do with Mule char tables. Copyright (C) 1992 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 1999,2000,2001 MORIOKA Tomohiko + Copyright (C) 1999,2000,2001,2002 MORIOKA Tomohiko This file is part of XEmacs. @@ -36,6 +36,8 @@ EXFUN (Fdecode_char, 3); EXFUN (Fput_char_attribute, 3); +EXFUN (Ffind_char, 1); + /************************************************************************/ /* Char-ID Tables */ diff --git a/src/data.c b/src/data.c index b90b3ca..e51c15e 100644 --- a/src/data.c +++ b/src/data.c @@ -458,6 +458,14 @@ confoundedness in older versions of E-Lisp. { return CHAR_OR_CHAR_INTP (object) || STRINGP (object) ? Qt : Qnil; } + +DEFUN ("char-ref-p", Fchar_ref_p, 1, 1, 0, /* +Return t if OBJECT is a character-reference. +*/ + (object)) +{ + return CONSP (object) && KEYWORDP (XCAR (object)) ? Qt : Qnil; +} DEFUN ("integerp", Fintegerp, 1, 1, 0, /* Return t if OBJECT is an integer. @@ -2156,6 +2164,7 @@ syms_of_data (void) DEFSUBR (Fchar_to_int); DEFSUBR (Fint_to_char); DEFSUBR (Fchar_or_char_int_p); + DEFSUBR (Fchar_ref_p); DEFSUBR (Fintegerp); DEFSUBR (Finteger_or_marker_p); DEFSUBR (Finteger_or_char_p); diff --git a/src/fns.c b/src/fns.c index 95ce145..d5224c4 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1,6 +1,7 @@ /* Random utility Lisp functions. Copyright (C) 1985, 86, 87, 93, 94, 95 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 2002 MORIOKA Tomohiko This file is part of XEmacs. @@ -3759,6 +3760,56 @@ Characters out of the base64 alphabet are ignored. return result; } +Lisp_Object Qideographic_structure; +Lisp_Object Qkeyword_char; + +EXFUN (Fideographic_structure_to_ids, 1); + +Lisp_Object ids_format_unit (Lisp_Object ids_char); +Lisp_Object +ids_format_unit (Lisp_Object ids_char) +{ + if (CHARP (ids_char)) + return Fchar_to_string (ids_char); + else if (INTP (ids_char)) + return Fchar_to_string (Fdecode_char (Qucs, ids_char, Qnil)); + else + { + Lisp_Object ret = Ffind_char (ids_char); + + if (CHARP (ret)) + return Fchar_to_string (ret); + else + { + ret = Fassq (Qideographic_structure, ids_char); + + if (CONSP (ret)) + return Fideographic_structure_to_ids (XCDR (ret)); + } + } + return Qnil; +} + +DEFUN ("ideographic-structure-to-ids", + Fideographic_structure_to_ids, 1, 1, 0, /* +Format ideographic-structure IDS-LIST as an IDS-string. +*/ + (ids_list)) +{ + Lisp_Object dest = Qnil; + + while (CONSP (ids_list)) + { + Lisp_Object cell = XCAR (ids_list); + + if (!NILP (Fchar_ref_p (cell))) + cell = Fplist_get (cell, Qkeyword_char, Qnil); + dest = concat2 (dest, ids_format_unit (cell)); + ids_list = XCDR (ids_list); + } + return dest; +} + Lisp_Object Qyes_or_no_p; void @@ -3768,6 +3819,8 @@ syms_of_fns (void) defsymbol (&Qstring_lessp, "string-lessp"); defsymbol (&Qidentity, "identity"); + defsymbol (&Qideographic_structure, "ideographic-structure"); + defsymbol (&Qkeyword_char, ":char"); defsymbol (&Qyes_or_no_p, "yes-or-no-p"); DEFSUBR (Fidentity); @@ -3854,6 +3907,7 @@ syms_of_fns (void) DEFSUBR (Fbase64_encode_string); DEFSUBR (Fbase64_decode_region); DEFSUBR (Fbase64_decode_string); + DEFSUBR (Fideographic_structure_to_ids); } void diff --git a/src/lisp.h b/src/lisp.h index 3dcea5b..82feef9 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2939,6 +2939,7 @@ EXFUN (Fcar, 1); EXFUN (Fcar_safe, 1); EXFUN (Fcdr, 1); EXFUN (Fchar_after, 2); +EXFUN (Fchar_ref_p, 1); EXFUN (Fchar_to_string, 1); EXFUN (Fcheck_valid_plist, 1); EXFUN (Fvalid_plist_p, 1); -- 1.7.10.4