From: Kenichi Handa Date: Tue, 9 Dec 1997 04:12:03 +0000 (+0000) Subject: (Fget_unused_iso_final_char): New function. X-Git-Tag: emacs-20.3~2638 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3fac5a51f73a80021451704dc053aa638a00baf1;p=emacs.git (Fget_unused_iso_final_char): New function. (syms_of_charset): Declare it as a Lisp function. --- diff --git a/src/charset.c b/src/charset.c index 478882a09d2..50031b70601 100644 --- a/src/charset.c +++ b/src/charset.c @@ -507,6 +507,36 @@ DESCRIPTION (string) is the description string of the charset.") return Qnil; } +DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char, + Sget_unused_iso_final_char, 2, 2, 0, + "Return an unsed ISO's final char for a charset of DIMENISION and CHARS.\n\ +DIMENSION is the number of bytes to represent a character: 1 or 2.\n\ +CHARS is the number of characters in a dimension: 94 or 96.\n\ +\n\ +This final char is for private use, thus the range is `0' (48) .. `?' (63).\n\ +If there's no unused final char for the specified kind of charset,\n\ +return nil.") + (dimension, chars) + Lisp_Object dimension, chars; +{ + int final_char; + + CHECK_NUMBER (dimension, 0); + CHECK_NUMBER (chars, 1); + if (XINT (dimension) != 1 && XINT (dimension) != 2) + error ("Invalid charset dimension %d, it should be 1 or 2", + XINT (dimension)); + if (XINT (chars) != 94 && XINT (chars) != 96) + error ("Invalid charset chars %d, it should be 94 or 96", + XINT (chars)); + for (final_char = '0'; final_char <= '?'; final_char++) + { + if (ISO_CHARSET_TABLE (dimension, chars, make_number (final_char)) < 0) + break; + } + return (final_char <= '?' ? make_number (final_char) : Qnil); +} + DEFUN ("declare-equiv-charset", Fdeclare_equiv_charset, Sdeclare_equiv_charset, 4, 4, 0, "Declare a charset of DIMENSION, CHARS, FINAL-CHAR is the same as CHARSET.\n\ @@ -1625,6 +1655,7 @@ syms_of_charset () CHARSET_SYMBOL (CHARSET_COMPOSITION) = Qcomposition; defsubr (&Sdefine_charset); + defsubr (&Sget_unused_iso_final_char); defsubr (&Sdeclare_equiv_charset); defsubr (&Sfind_charset_region); defsubr (&Sfind_charset_string);