From: tomo Date: Wed, 8 Jan 2003 01:53:38 +0000 (+0000) Subject: (simplify_char_spec): New function. X-Git-Tag: r21-4-10-utf-2000-0_20-5~294 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9cc75dde15e504c56666357a45d3a53c44389a84;p=chise%2Fxemacs-chise.git- (simplify_char_spec): New function. (char_ref_simplify_spec): New function. (Fchar_refs_simplify_char_specs): New function. (syms_of_fns): Add new builtin function `char-refs-simplify-char-specs'. --- diff --git a/src/fns.c b/src/fns.c index 46241f0..8c02746 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3811,6 +3811,59 @@ Format ideographic-structure IDS-LIST as an IDS-string. } return dest; } + +Lisp_Object simplify_char_spec (Lisp_Object char_spec); +Lisp_Object +simplify_char_spec (Lisp_Object char_spec) +{ + if (CHARP (char_spec)) + return char_spec; + else if (INTP (char_spec)) + return Fdecode_char (Qucs, char_spec, Qnil); + else + { + Lisp_Object ret = Ffind_char (char_spec); + + if (CHARP (ret)) + return ret; + else + return char_spec; + } +} + +Lisp_Object char_ref_simplify_spec (Lisp_Object char_ref); +Lisp_Object +char_ref_simplify_spec (Lisp_Object char_ref) +{ + if (!NILP (Fchar_ref_p (char_ref))) + { + Lisp_Object ret = Fplist_get (char_ref, Qkeyword_char, Qnil); + + if (NILP (ret)) + return char_ref; + else + return Fplist_put (Fcopy_sequence (char_ref), Qkeyword_char, + simplify_char_spec (ret)); + } + else + return simplify_char_spec (char_ref); +} + +DEFUN ("char-refs-simplify-char-specs", + Fchar_refs_simplify_char_specs, 1, 1, 0, /* +Simplify char-specs in CHAR-REFS. +*/ + (char_refs)) +{ + Lisp_Object rest = char_refs; + + while (CONSP (rest)) + { + Fsetcar (rest, char_ref_simplify_spec (XCAR (rest))); + rest = XCDR (rest); + } + return char_refs; +} Lisp_Object Qyes_or_no_p; @@ -3910,6 +3963,7 @@ syms_of_fns (void) DEFSUBR (Fbase64_decode_region); DEFSUBR (Fbase64_decode_string); DEFSUBR (Fideographic_structure_to_ids); + DEFSUBR (Fchar_refs_simplify_char_specs); } void