X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fmule-charset.c;h=712263a62e0fc1f74008e9ad10fc74bc44f0fee8;hp=739e6ba7366a702e049baac934160f02ec9bf388;hb=44e716ef11bd794a51f8c5b56c4f3f10a7dbf217;hpb=2416430cb588c7f7a7ca990d536c092f3af3a0b9 diff --git a/src/mule-charset.c b/src/mule-charset.c index 739e6ba..712263a 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -1105,27 +1105,33 @@ Return the character set of char CH. (CHAR_LEADING_BYTE (XCHAR (ch)))); } -DEFUN ("char-octet", Fchar_octet, 1, 2, 0, /* -Return the octet numbered N (should be 0 or 1) of char CH. -N defaults to 0 if omitted. +DEFUN ("split-char", Fsplit_char, 1, 1, 0, /* +Return list of charset and one or two position-codes of CHAR. */ - (ch, n)) + (character)) { - Lisp_Object charset; - int c1, c2, int_n; + /* This function can GC */ + struct gcpro gcpro1, gcpro2; + Lisp_Object charset = Qnil; + Lisp_Object rc = Qnil; + int c1, c2; - CHECK_CHAR_COERCE_INT (ch); - if (NILP (n)) - int_n = 0; + GCPRO2 (charset, rc); + CHECK_CHAR_COERCE_INT (character); + + BREAKUP_CHAR (XCHAR (character), charset, c1, c2); + + if (XCHARSET_DIMENSION (Fget_charset (charset)) == 2) + { + rc = list3 (XCHARSET_NAME (charset), make_int (c1), make_int (c2)); + } else { - CHECK_INT (n); - int_n = XINT (n); - if (int_n != 0 && int_n != 1) - signal_simple_error ("Octet number must be 0 or 1", n); + rc = list2 (XCHARSET_NAME (charset), make_int (c1)); } - BREAKUP_CHAR (XCHAR (ch), charset, c1, c2); - return make_int (int_n == 0 ? c1 : c2); + UNGCPRO; + + return rc; } @@ -1230,7 +1236,7 @@ syms_of_mule_charset (void) DEFSUBR (Fmake_char); DEFSUBR (Fchar_charset); - DEFSUBR (Fchar_octet); + DEFSUBR (Fsplit_char); #ifdef ENABLE_COMPOSITE_CHARS DEFSUBR (Fmake_composite_char);