import xemacs-21.2.37
[chise/xemacs-chise.git.1] / src / casetab.c
index ff9443c..4bb1cde 100644 (file)
@@ -42,30 +42,29 @@ Boston, MA 02111-1307, USA.  */
 #include "buffer.h"
 #include "opaque.h"
 
-Lisp_Object Qcase_table_p;
+Lisp_Object Qcase_tablep;
 Lisp_Object Vascii_downcase_table, Vascii_upcase_table;
 Lisp_Object Vascii_canon_table, Vascii_eqv_table;
 #ifdef MULE
 Lisp_Object Vmirror_ascii_downcase_table, Vmirror_ascii_upcase_table;
 Lisp_Object Vmirror_ascii_canon_table, Vmirror_ascii_eqv_table;
 #endif
-Lisp_Object Qtranslate_table;
 
 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse);
 
 #define STRING256_P(obj) (STRINGP (obj) && XSTRING_CHAR_LENGTH (obj) == 256)
 
 DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /*
-Return t if ARG is a case table.
+Return t if OBJECT is a case table.
 See `set-case-table' for more information on these data structures.
 */
-       (table))
+       (object))
 {
   Lisp_Object down, up, canon, eqv;
-  if (!CONSP (table)) return Qnil; down  = XCAR (table); table = XCDR (table);
-  if (!CONSP (table)) return Qnil; up    = XCAR (table); table = XCDR (table);
-  if (!CONSP (table)) return Qnil; canon = XCAR (table); table = XCDR (table);
-  if (!CONSP (table)) return Qnil; eqv   = XCAR (table);
+  if (!CONSP (object)) return Qnil; down  = XCAR (object); object = XCDR (object);
+  if (!CONSP (object)) return Qnil; up    = XCAR (object); object = XCDR (object);
+  if (!CONSP (object)) return Qnil; canon = XCAR (object); object = XCDR (object);
+  if (!CONSP (object)) return Qnil; eqv   = XCAR (object);
 
   return (STRING256_P (down)
          && (NILP (up) || STRING256_P (up))
@@ -76,13 +75,11 @@ See `set-case-table' for more information on these data structures.
 }
 
 static Lisp_Object
-check_case_table (Lisp_Object obj)
+check_case_table (Lisp_Object object)
 {
-  REGISTER Lisp_Object tem;
-
-  while (tem = Fcase_table_p (obj), NILP (tem))
-    obj = wrong_type_argument (Qcase_table_p, obj);
-  return (obj);
+  while (NILP (Fcase_table_p (object)))
+    object = wrong_type_argument (Qcase_tablep, object);
+  return object;
 }
 
 DEFUN ("current-case-table", Fcurrent_case_table, 0, 1, 0, /*
@@ -114,7 +111,7 @@ static Lisp_Object set_case_table (Lisp_Object table, int standard);
 
 
 DEFUN ("set-case-table", Fset_case_table, 1, 1, 0, /*
-Select a new case table for the current buffer.
+Select CASE-TABLE as the new case table for the current buffer.
 A case table is a list (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES)
  where each element is either nil or a string of length 256.
 DOWNCASE maps each character to its lower-case equivalent.
@@ -135,18 +132,18 @@ BUG: Under XEmacs/Mule, translations to or from non-ASCII characters
  will not correctly conflate a-umlaut and A-umlaut even if the
  case tables call for this.
 */
-       (table))
+       (case_table))
 {
-  return set_case_table (table, 0);
+  return set_case_table (case_table, 0);
 }
 
 DEFUN ("set-standard-case-table", Fset_standard_case_table, 1, 1, 0, /*
-Select a new standard case table for new buffers.
+Select CASE-TABLE as the new standard case table for new buffers.
 See `set-case-table' for more info on case tables.
 */
-       (table))
+       (case_table))
 {
-  return set_case_table (table, 1);
+  return set_case_table (case_table, 1);
 }
 
 #ifdef MULE
@@ -190,7 +187,8 @@ static Lisp_Object
 set_case_table (Lisp_Object table, int standard)
 {
   Lisp_Object down, up, canon, eqv, tail = table;
-  struct buffer *buf = current_buffer;
+  struct buffer *buf =
+    standard ? XBUFFER(Vbuffer_defaults) : current_buffer;
 
   check_case_table (table);
 
@@ -243,19 +241,17 @@ set_case_table (Lisp_Object table, int standard)
       Vmirror_ascii_eqv_table = make_mirror_trt_table (eqv);
 #endif
     }
-  else
-    {
-      buf->downcase_table = down;
-      buf->upcase_table = up;
-      buf->case_canon_table = canon;
-      buf->case_eqv_table = eqv;
+  buf->downcase_table = down;
+  buf->upcase_table = up;
+  buf->case_canon_table = canon;
+  buf->case_eqv_table = eqv;
 #ifdef MULE
-      buf->mirror_downcase_table = make_mirror_trt_table (down);
-      buf->mirror_upcase_table = make_mirror_trt_table (up);
-      buf->mirror_case_canon_table = make_mirror_trt_table (canon);
-      buf->mirror_case_eqv_table = make_mirror_trt_table (eqv);
+  buf->mirror_downcase_table = make_mirror_trt_table (down);
+  buf->mirror_upcase_table = make_mirror_trt_table (up);
+  buf->mirror_case_canon_table = make_mirror_trt_table (canon);
+  buf->mirror_case_eqv_table = make_mirror_trt_table (eqv);
 #endif
-    }
+
   return table;
 }
 \f
@@ -289,8 +285,7 @@ compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse)
 void
 syms_of_casetab (void)
 {
-  defsymbol (&Qcase_table_p, "case-table-p");
-  defsymbol (&Qtranslate_table, "translate-table");
+  defsymbol (&Qcase_tablep, "case-table-p");
 
   DEFSUBR (Fcase_table_p);
   DEFSUBR (Fcurrent_case_table);
@@ -310,6 +305,13 @@ complex_vars_of_casetab (void)
   staticpro (&Vascii_canon_table);
   staticpro (&Vascii_eqv_table);
 
+#ifdef MULE
+  staticpro (&Vmirror_ascii_downcase_table);
+  staticpro (&Vmirror_ascii_upcase_table);
+  staticpro (&Vmirror_ascii_canon_table);
+  staticpro (&Vmirror_ascii_eqv_table);
+#endif
+
   tem = MAKE_TRT_TABLE ();
   Vascii_downcase_table = tem;
   Vascii_canon_table = tem;