changeset 13219:99b5164a319d

(Qchar_table_extra_slots): New variable. (syms_of_alloc): Initialize it. (Fmake_char_table): Take new arg PURPOSE and get N from a property.
author Richard M. Stallman <rms@gnu.org>
date Sat, 14 Oct 1995 05:53:31 +0000
parents d2fc560c7740
children 2e9014617492
files src/alloc.c
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Sat Oct 14 05:52:39 1995 +0000
+++ b/src/alloc.c	Sat Oct 14 05:53:31 1995 +0000
@@ -166,7 +166,7 @@
 /* Non-zero means ignore malloc warnings.  Set during initialization.  */
 int ignore_warnings;
 
-Lisp_Object Qgc_cons_threshold;
+Lisp_Object Qgc_cons_threshold, Qchar_table_extra_slots;
 
 static void mark_object (), mark_buffer (), mark_kboards ();
 static void clear_marks (), gc_sweep ();
@@ -756,22 +756,26 @@
   return vector;
 }
 
-DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 0, 2, 0,
-  "Return a newly created char-table, with N \"extra\" slots.\n\
+DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 1, 2, 0,
+  "Return a newly created char-table, with purpose PURPOSE.
 Each element is initialized to INIT, which defaults to nil.\n\
-N may not be more than ten.\n\
-See `char-table-extra-slot' and `set-char-table-extra-slot'.")
-  (n, init)
-     register Lisp_Object n, init;
+PURPOSE should be a symbol which has a `char-table-extra-slot' property.\n\
+The property's value should be an integer between 0 and 10.")
+  (purpose, init)
+     register Lisp_Object purpose, init;
 {
   Lisp_Object vector;
-  CHECK_NUMBER (n, 1);
+  Lisp_Object n;
+  CHECK_SYMBOL (purpose, 1);
+  n = Fget (purpose, Qchar_table_extra_slots);
+  CHECK_NUMBER (n, 0);
   if (XINT (n) < 0 || XINT (n) > 10)
     args_out_of_range (n, Qnil);
   /* Add 2 to the size for the defalt and parent slots.  */
   vector = Fmake_vector (make_number (CHAR_TABLE_STANDARD_SLOTS + XINT (n)),
 			 init);
   XCHAR_TABLE (vector)->parent = Qnil;
+  XCHAR_TABLE (vector)->purpose = purpose;
   XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
   return vector;
 }
@@ -2608,6 +2612,9 @@
   staticpro (&Qgc_cons_threshold);
   Qgc_cons_threshold = intern ("gc-cons-threshold");
 
+  staticpro (&Qchar_table_extra_slots);
+  Qchar_table_extra_slots = intern ("char-table-extra-slots");
+
   defsubr (&Scons);
   defsubr (&Slist);
   defsubr (&Svector);