From 085e3b534b1dddd627acd2e772d842621c7f823e Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 14 Sep 2010 07:34:00 +0000 Subject: [PATCH] (allocate_character): New function. (Fdefine_char): Use allocate_character(). --- src/chartab.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/chartab.c b/src/chartab.c index 0b3c130..58bdb92 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -4233,6 +4233,20 @@ implementation does not coalesce ranges all of whose values are the same. return slarg.retval; } +Lisp_Object +allocate_character () +{ + int cid = XINT (Vnext_defined_char_id); + + if (cid <= 0xE00000) + { + Vnext_defined_char_id = make_int (cid + 1); + return make_char (cid); + } + else + return Qnil; +} + DEFUN ("define-char", Fdefine_char, 1, 1, 0, /* Store character's ATTRIBUTES. */ @@ -4281,7 +4295,7 @@ Store character's ATTRIBUTES. } rest = Fcdr (rest); } -#if 1 +#if 0 { int cid = XINT (Vnext_defined_char_id); @@ -4293,16 +4307,9 @@ Store character's ATTRIBUTES. } } #else - if ( (!NILP (code = Fcdr (Fassq (Qto_ucs, attributes)))) ) - { - if (!INTP (code)) - signal_simple_error ("Invalid argument", attributes); - else - character = make_char (XINT (code) + 0x100000); - goto setup_attributes; - } + if ( NILP (character = allocate_character ()) ) #endif - return Qnil; + return Qnil; } else if (!INTP (code)) signal_simple_error ("Invalid argument", attributes); -- 1.7.10.4