diff src/chartab.c @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 1d11ecca9cd0
children d1247f3cc363
line wrap: on
line diff
--- a/src/chartab.c	Sat Dec 26 00:20:27 2009 -0600
+++ b/src/chartab.c	Sat Dec 26 21:18:49 2009 -0600
@@ -138,12 +138,12 @@
   { XD_END }
 };
 
-DEFINE_LISP_OBJECT ("char-table-entry", char_table_entry,
-		    mark_char_table_entry, 0,
-		    0, char_table_entry_equal,
-		    char_table_entry_hash,
-		    char_table_entry_description,
-		    Lisp_Char_Table_Entry);
+DEFINE_DUMPABLE_LISP_OBJECT ("char-table-entry", char_table_entry,
+			     mark_char_table_entry, 0,
+			     0, char_table_entry_equal,
+			     char_table_entry_hash,
+			     char_table_entry_description,
+			     Lisp_Char_Table_Entry);
 
 #endif /* MULE */
 
@@ -316,7 +316,7 @@
   a->first = 0;
   lisprange = encode_char_table_range (range);
   GCPRO1 (lisprange);
-  write_fmt_string_lisp (a->printcharfun, "%s %s", 2, lisprange, val);
+  write_fmt_string_lisp (a->printcharfun, "%s %S", 2, lisprange, val);
   UNGCPRO;
   return 0;
 }
@@ -391,11 +391,11 @@
   { XD_END }
 };
 
-DEFINE_LISP_OBJECT ("char-table", char_table,
-			       mark_char_table, print_char_table, 0,
-			       char_table_equal, char_table_hash,
-			       char_table_description,
-			       Lisp_Char_Table);
+DEFINE_DUMPABLE_LISP_OBJECT ("char-table", char_table,
+			     mark_char_table, print_char_table, 0,
+			     char_table_equal, char_table_hash,
+			     char_table_description,
+			     Lisp_Char_Table);
 
 DEFUN ("char-table-p", Fchar_table_p, 1, 1, 0, /*
 Return non-nil if OBJECT is a char table.
@@ -564,25 +564,32 @@
 sorts of values.  The different char table types are
 
 `category'
-	Used for category tables, which specify the regexp categories
-	that a character is in.  The valid values are nil or a
-	bit vector of 95 elements.  Higher-level Lisp functions are
-	provided for working with category tables.  Currently categories
+	Used for category tables, which specify the regexp categories that a
+	character is in.  The valid values are nil or a bit vector of 95
+	elements, and values default to nil.  Higher-level Lisp functions
+	are provided for working with category tables.  Currently categories
 	and category tables only exist when Mule support is present.
 `char'
-	A generalized char table, for mapping from one character to
-	another.  Used for case tables, syntax matching tables,
-	`keyboard-translate-table', etc.  The valid values are characters.
+	A generalized char table, for mapping from one character to another.
+	Used for case tables, syntax matching tables,
+	`keyboard-translate-table', etc.  The valid values are characters,
+	and the default result given by `get-char-table' if a value hasn't
+	been set for a given character or for a range that includes it, is
+	?\x00.
 `generic'
-        An even more generalized char table, for mapping from a
-	character to anything.
+        An even more generalized char table, for mapping from a character to
+	anything. The default result given by `get-char-table' is nil.
 `display'
-	Used for display tables, which specify how a particular character
-	is to appear when displayed.  #### Not yet implemented.
+	Used for display tables, which specify how a particular character is
+	to appear when displayed.  #### Not yet implemented; currently, the
+	display table code uses generic char tables, and it's not clear that
+	implementing this char table type would be useful.
 `syntax'
 	Used for syntax tables, which specify the syntax of a particular
 	character.  Higher-level Lisp functions are provided for
-	working with syntax tables.  The valid values are integers.
+	working with syntax tables.  The valid values are integers, and the
+	default result given by `get-char-table' is the syntax code for
+	`inherit'.
 */
        (type))
 {
@@ -596,7 +603,7 @@
       /* Qgeneric not Qsyntax because a syntax table has a mirror table
 	 and we don't want infinite recursion */
       ct->mirror_table = Fmake_char_table (Qgeneric);
-      set_char_table_default (ct->mirror_table, make_int (Spunct));
+      set_char_table_default (ct->mirror_table, make_int (Sword));
       XCHAR_TABLE (ct->mirror_table)->mirror_table_p = 1;
       XCHAR_TABLE (ct->mirror_table)->mirror_table = obj;
     }
@@ -664,12 +671,13 @@
 
   CHECK_CHAR_TABLE (char_table);
   ct = XCHAR_TABLE (char_table);
+  assert(!ct->mirror_table_p);
   obj = ALLOC_LISP_OBJECT (char_table);
   ctnew = XCHAR_TABLE (obj);
   ctnew->type = ct->type;
   ctnew->parent = ct->parent;
   ctnew->default_ = ct->default_;
-  ctnew->mirror_table_p = ct->mirror_table_p;
+  ctnew->mirror_table_p = 0;
 
   for (i = 0; i < NUM_ASCII_CHARS; i++)
     {
@@ -693,13 +701,17 @@
 
 #endif /* MULE */
 
-  if (!ct->mirror_table_p && CHAR_TABLEP (ct->mirror_table))
+  if (!EQ (ct->mirror_table, Qnil))
     {
-      ctnew->mirror_table = Fcopy_char_table (ct->mirror_table);
+      ctnew->mirror_table = Fmake_char_table (Qgeneric);
+      set_char_table_default (ctnew->mirror_table, make_int (Sword));
       XCHAR_TABLE (ctnew->mirror_table)->mirror_table = obj;
+      XCHAR_TABLE (ctnew->mirror_table)->mirror_table_p = 1;
+      XCHAR_TABLE (ctnew->mirror_table)->dirty = 1;
     }
   else
-    ctnew->mirror_table = ct->mirror_table;
+    ctnew->mirror_table = Qnil;
+
   ctnew->next_table = Qnil;
   if (ctnew->type == CHAR_TABLE_TYPE_SYNTAX)
     {