diff options
| author | Andreas Schwab | 2012-06-16 10:20:19 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2012-06-16 10:20:19 +0200 |
| commit | 29b83cecea5cbb09a715282824feb568f03cdf54 (patch) | |
| tree | 7028e7dae1d86e441d2b68dda762608fe24397d3 /src | |
| parent | 4c5501e98fe2336ef7b16bd276dfbbe3917376e9 (diff) | |
| download | emacs-29b83cecea5cbb09a715282824feb568f03cdf54.tar.gz emacs-29b83cecea5cbb09a715282824feb568f03cdf54.zip | |
* category.h (CHAR_HAS_CATEGORY): Define as inline.
(CATEGORY_MEMBER): Enforce 1/0 value.
* category.c (_temp_category_set): Remove.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/category.c | 3 | ||||
| -rw-r--r-- | src/category.h | 26 |
3 files changed, 19 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6b2984c8825..b5a22a0ebce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-06-16 Andreas Schwab <schwab@linux-m68k.org> | ||
| 2 | |||
| 3 | * category.h (CHAR_HAS_CATEGORY): Define as inline. | ||
| 4 | (CATEGORY_MEMBER): Enforce 1/0 value. | ||
| 5 | * category.c (_temp_category_set): Remove. | ||
| 6 | |||
| 1 | 2012-06-16 Eli Zaretskii <eliz@gnu.org> | 7 | 2012-06-16 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * window.c (Fdelete_other_windows_internal) | 9 | * window.c (Fdelete_other_windows_internal) |
diff --git a/src/category.c b/src/category.c index a59ad3da53e..5cb3020a2de 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -50,9 +50,6 @@ static int category_table_version; | |||
| 50 | 50 | ||
| 51 | static Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p; | 51 | static Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p; |
| 52 | 52 | ||
| 53 | /* Temporary internal variable used in macro CHAR_HAS_CATEGORY. */ | ||
| 54 | Lisp_Object _temp_category_set; | ||
| 55 | |||
| 56 | /* Make CATEGORY_SET includes (if VAL is t) or excludes (if VAL is | 53 | /* Make CATEGORY_SET includes (if VAL is t) or excludes (if VAL is |
| 57 | nil) CATEGORY. */ | 54 | nil) CATEGORY. */ |
| 58 | #define SET_CATEGORY_SET(category_set, category, val) \ | 55 | #define SET_CATEGORY_SET(category_set, category, val) \ |
diff --git a/src/category.h b/src/category.h index 423270100b3..580e516afd9 100644 --- a/src/category.h +++ b/src/category.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Declarations having to do with Emacs category tables. | 1 | /* Declarations having to do with Emacs category tables. |
| 2 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 2 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 3 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 3 | 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
| 4 | National Institute of Advanced Industrial Science and Technology (AIST) | 4 | National Institute of Advanced Industrial Science and Technology (AIST) |
| 5 | Registration Number H14PRO021 | 5 | Registration Number H14PRO021 |
| 6 | Copyright (C) 2003 | 6 | Copyright (C) 2003 |
| @@ -69,27 +69,27 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 69 | #define CHECK_CATEGORY_SET(x) \ | 69 | #define CHECK_CATEGORY_SET(x) \ |
| 70 | CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x) | 70 | CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x) |
| 71 | 71 | ||
| 72 | /* Return the category set of character C in the current category table. */ | ||
| 73 | #define CATEGORY_SET(c) char_category_set (c) | ||
| 74 | |||
| 72 | /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. | 75 | /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. |
| 73 | The faster version of `!NILP (Faref (category_set, category))'. */ | 76 | The faster version of `!NILP (Faref (category_set, category))'. */ |
| 74 | #define CATEGORY_MEMBER(category, category_set) \ | 77 | #define CATEGORY_MEMBER(category, category_set) \ |
| 75 | (XCATEGORY_SET (category_set)->data[(category) / 8] \ | 78 | ((XCATEGORY_SET (category_set)->data[(category) / 8] \ |
| 76 | & (1 << ((category) % 8))) | 79 | >> ((category) % 8)) & 1) |
| 77 | |||
| 78 | /* Temporary internal variable used in macro CHAR_HAS_CATEGORY. */ | ||
| 79 | extern Lisp_Object _temp_category_set; | ||
| 80 | 80 | ||
| 81 | /* Return 1 if category set of CH contains CATEGORY, elt return 0. */ | 81 | /* Return 1 if category set of CH contains CATEGORY, else return 0. */ |
| 82 | #define CHAR_HAS_CATEGORY(ch, category) \ | 82 | static inline int |
| 83 | (_temp_category_set = CATEGORY_SET (ch), \ | 83 | CHAR_HAS_CATEGORY (int ch, int category) |
| 84 | CATEGORY_MEMBER (category, _temp_category_set)) | 84 | { |
| 85 | Lisp_Object category_set = CATEGORY_SET (ch); | ||
| 86 | return CATEGORY_MEMBER (category, category_set); | ||
| 87 | } | ||
| 85 | 88 | ||
| 86 | /* The standard category table is stored where it will automatically | 89 | /* The standard category table is stored where it will automatically |
| 87 | be used in all new buffers. */ | 90 | be used in all new buffers. */ |
| 88 | #define Vstandard_category_table BVAR (&buffer_defaults, category_table) | 91 | #define Vstandard_category_table BVAR (&buffer_defaults, category_table) |
| 89 | 92 | ||
| 90 | /* Return the category set of character C in the current category table. */ | ||
| 91 | #define CATEGORY_SET(c) char_category_set (c) | ||
| 92 | |||
| 93 | /* Return the doc string of CATEGORY in category table TABLE. */ | 93 | /* Return the doc string of CATEGORY in category table TABLE. */ |
| 94 | #define CATEGORY_DOCSTRING(table, category) \ | 94 | #define CATEGORY_DOCSTRING(table, category) \ |
| 95 | XVECTOR (Fchar_table_extra_slot (table, make_number (0)))->contents[(category) - ' '] | 95 | XVECTOR (Fchar_table_extra_slot (table, make_number (0)))->contents[(category) - ' '] |