diff src/chartab.c @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents cf808b4c4290
children bfd6434d15b3
line wrap: on
line diff
--- a/src/chartab.c	Mon Aug 13 09:18:41 2007 +0200
+++ b/src/chartab.c	Mon Aug 13 09:19:45 2007 +0200
@@ -1647,12 +1647,12 @@
 }   
 
 int
-check_category_at(Emchar ch, Lisp_Object table,
-		  unsigned int designator, unsigned int not)
+check_category_char(Emchar ch, Lisp_Object table,
+		    unsigned int designator, unsigned int not)
 {
   register Lisp_Object temp;
   struct Lisp_Char_Table *ctbl;  
-#if 1 /* ifdef ERROR_CHECK_TYPECHECK */
+#ifdef ERROR_CHECK_TYPECHECK
   if (NILP (Fcategory_table_p (table)))
     signal_simple_error("Expected category table", table);
 #endif
@@ -1665,7 +1665,7 @@
 }
 
 DEFUN ("check-category-at", Fcheck_category_at, 2, 4, 0, /*
-Return t if category of a character at POS includes DESIGNATIOR,
+Return t if category of a character at POS includes DESIGNATOR,
 else return nil. Optional third arg specifies which buffer
 (defaulting to current), and fourth specifies the CATEGORY-TABLE,
 (defaulting to the buffer's category table).
@@ -1682,7 +1682,28 @@
   des = XREALINT(designator);
   ctbl = check_category_table (category_table, Vstandard_category_table);
   ch = BUF_FETCH_CHAR (buf, XINT(pos));
-  return (check_category_at(ch, ctbl, des, 0)
+  return (check_category_char(ch, ctbl, des, 0)
+	  ? Qt : Qnil);
+}
+
+DEFUN ("char-in-category-p", Fchar_in_category_p, 2, 3, 0, /*
+Return t if category of character CHR includes DESIGNATOR, else
+return nil. Optional third arg specifies the CATEGORY-TABLE to use,
+
+which defaults to the system default table.
+*/
+       (chr, designator, category_table))
+{
+  Lisp_Object ctbl;
+  Emchar ch;
+  unsigned int des;
+
+  CHECK_CATEGORY_DESIGNATOR (designator);
+  des = XREALINT(designator);
+  CHECK_CHAR(chr);
+  ch = XCHAR(chr);
+  ctbl = check_category_table (category_table, Vstandard_category_table);
+  return (check_category_char(ch, ctbl, des, 0)
 	  ? Qt : Qnil);
 }
 
@@ -1790,6 +1811,7 @@
   DEFSUBR (Fcopy_category_table);
   DEFSUBR (Fset_category_table);
   DEFSUBR (Fcheck_category_at);
+  DEFSUBR (Fchar_in_category_p);
   DEFSUBR (Fcategory_designator_p);
   DEFSUBR (Fcategory_table_value_p);
 #endif /* MULE */