X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/6b8bc570715801cb194dc4273370eab87628e8bf..8c74a125c85da08e34dceedb271b71b5f09ce690:/src/category.h diff --git a/src/category.h b/src/category.h index b279f3d9c5..580e516afd 100644 --- a/src/category.h +++ b/src/category.h @@ -1,6 +1,6 @@ /* Declarations having to do with Emacs category tables. Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H14PRO021 Copyright (C) 2003 @@ -53,8 +53,7 @@ along with GNU Emacs. If not, see . */ The second extra slot is a version number of the category table. But, for the moment, we are not using this slot. */ -#define CATEGORYP(x) \ - (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E) +#define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E) #define CHECK_CATEGORY(x) \ CHECK_TYPE (CATEGORYP (x), Qcategoryp, x) @@ -62,40 +61,35 @@ along with GNU Emacs. If not, see . */ #define XCATEGORY_SET XBOOL_VECTOR #define CATEGORY_SET_P(x) \ - (BOOL_VECTOR_P ((x)) && (EMACS_INT) (XBOOL_VECTOR ((x))->size) == 128) + (BOOL_VECTOR_P (x) && XBOOL_VECTOR (x)->size == 128) /* Return a new empty category set. */ #define MAKE_CATEGORY_SET (Fmake_bool_vector (make_number (128), Qnil)) -/* Make CATEGORY_SET includes (if VAL is t) or excludes (if VAL is - nil) CATEGORY. */ -#define SET_CATEGORY_SET(category_set, category, val) \ - (set_category_set (category_set, category, val)) - #define CHECK_CATEGORY_SET(x) \ CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x) +/* Return the category set of character C in the current category table. */ +#define CATEGORY_SET(c) char_category_set (c) + /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. The faster version of `!NILP (Faref (category_set, category))'. */ #define CATEGORY_MEMBER(category, category_set) \ - (XCATEGORY_SET (category_set)->data[(category) / 8] \ - & (1 << ((category) % 8))) - -/* Temporary internal variable used in macro CHAR_HAS_CATEGORY. */ -extern Lisp_Object _temp_category_set; + ((XCATEGORY_SET (category_set)->data[(category) / 8] \ + >> ((category) % 8)) & 1) -/* Return 1 if category set of CH contains CATEGORY, elt return 0. */ -#define CHAR_HAS_CATEGORY(ch, category) \ - (_temp_category_set = CATEGORY_SET (ch), \ - CATEGORY_MEMBER (category, _temp_category_set)) +/* Return 1 if category set of CH contains CATEGORY, else return 0. */ +static inline int +CHAR_HAS_CATEGORY (int ch, int category) +{ + Lisp_Object category_set = CATEGORY_SET (ch); + return CATEGORY_MEMBER (category, category_set); +} /* The standard category table is stored where it will automatically be used in all new buffers. */ #define Vstandard_category_table BVAR (&buffer_defaults, category_table) -/* Return the category set of character C in the current category table. */ -#define CATEGORY_SET(c) char_category_set (c) - /* Return the doc string of CATEGORY in category table TABLE. */ #define CATEGORY_DOCSTRING(table, category) \ XVECTOR (Fchar_table_extra_slot (table, make_number (0)))->contents[(category) - ' '] @@ -114,5 +108,3 @@ extern Lisp_Object _temp_category_set; && word_boundary_p (c1, c2)) extern int word_boundary_p (int, int); -extern void set_category_set (Lisp_Object, Lisp_Object, Lisp_Object); -