X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Ffns.c;h=d5224c484816a0bd8ca22c204328faa1c20f0af3;hb=edb1d7f5d06e1f3ca783853fe435f41eaa32ea8e;hp=fc1d70015f258345fb0285ccc2275c260c827a75;hpb=5483e97d616f1d057edccd2683b499bcf75c402a;p=chise%2Fxemacs-chise.git- diff --git a/src/fns.c b/src/fns.c index fc1d700..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. @@ -113,7 +114,7 @@ static size_t size_bit_vector (const void *lheader) { Lisp_Bit_Vector *v = (Lisp_Bit_Vector *) lheader; - return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, bits, + return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, unsigned long, bits, BIT_VECTOR_LONG_STORAGE (bit_vector_length (v))); } @@ -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