(allocate_character): New function.
authortomo <tomo>
Tue, 14 Sep 2010 07:34:00 +0000 (07:34 +0000)
committertomo <tomo>
Tue, 14 Sep 2010 07:34:00 +0000 (07:34 +0000)
(Fdefine_char): Use allocate_character().

src/chartab.c

index 0b3c130..58bdb92 100644 (file)
@@ -4233,6 +4233,20 @@ implementation does not coalesce ranges all of whose values are the same.
   return slarg.retval;
 }
 
   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.
 */
 DEFUN ("define-char", Fdefine_char, 1, 1, 0, /*
 Store character's ATTRIBUTES.
 */
@@ -4281,7 +4295,7 @@ Store character's ATTRIBUTES.
            }
          rest = Fcdr (rest);
        }
            }
          rest = Fcdr (rest);
        }
-#if 1
+#if 0
       {
        int cid = XINT (Vnext_defined_char_id);
 
       {
        int cid = XINT (Vnext_defined_char_id);
 
@@ -4293,16 +4307,9 @@ Store character's ATTRIBUTES.
          }
       }
 #else
          }
       }
 #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
 #endif
-      return Qnil;
+       return Qnil;
     }
   else if (!INTP (code))
     signal_simple_error ("Invalid argument", attributes);
     }
   else if (!INTP (code))
     signal_simple_error ("Invalid argument", attributes);