X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/5244bc019bf7376caff3bb198ff674e0ad9fb0e6..0a2aedfe6d650e825a50f25f972bac20d669f5cb:/src/category.h diff --git a/src/category.h b/src/category.h index 17cd203db4..247f9093d0 100644 --- a/src/category.h +++ b/src/category.h @@ -11,8 +11,8 @@ This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,6 +22,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +#ifndef EMACS_CATEGORY_H +#define EMACS_CATEGORY_H /* We introduce here three types of object: category, category set, and category table. @@ -53,20 +55,17 @@ 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. */ +#include "lisp.h" + INLINE_HEADER_BEGIN -#ifndef CATEGORY_INLINE -# define CATEGORY_INLINE INLINE -#endif #define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E) #define CHECK_CATEGORY(x) \ CHECK_TYPE (CATEGORYP (x), Qcategoryp, x) -#define XCATEGORY_SET XBOOL_VECTOR - #define CATEGORY_SET_P(x) \ - (BOOL_VECTOR_P (x) && XBOOL_VECTOR (x)->size == 128) + (BOOL_VECTOR_P (x) && bool_vector_size (x) == 128) /* Return a new empty category set. */ #define MAKE_CATEGORY_SET (Fmake_bool_vector (make_number (128), Qnil)) @@ -78,13 +77,15 @@ INLINE_HEADER_BEGIN #define CATEGORY_SET(c) char_category_set (c) /* Return true if CATEGORY_SET contains CATEGORY. - The faster version of `!NILP (Faref (category_set, category))'. */ -#define CATEGORY_MEMBER(category, category_set) \ - ((XCATEGORY_SET (category_set)->data[(category) / 8] \ - >> ((category) % 8)) & 1) + Faster than '!NILP (Faref (category_set, make_number (category)))'. */ +INLINE bool +CATEGORY_MEMBER (EMACS_INT category, Lisp_Object category_set) +{ + return bool_vector_bitref (category_set, category); +} /* Return true if category set of CH contains CATEGORY. */ -CATEGORY_INLINE bool +INLINE bool CHAR_HAS_CATEGORY (int ch, int category) { Lisp_Object category_set = CATEGORY_SET (ch); @@ -119,3 +120,5 @@ CHAR_HAS_CATEGORY (int ch, int category) extern bool word_boundary_p (int, int); INLINE_HEADER_END + +#endif /* EMACS_CATEGORY_H */