X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a8101f663e6cbff953b67b8bef33bc0171818477..d0fffa3f69eb3401bf9ee2ee38c235e830c18abd:/src/category.c diff --git a/src/category.c b/src/category.c index 5c38f351d0..08eadb0473 100644 --- a/src/category.c +++ b/src/category.c @@ -1,13 +1,13 @@ /* GNU Emacs routines to deal with category tables. - Copyright (C) 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 - National Institute of Advanced Industrial Science and Technology (AIST) - Registration Number H14PRO021 - Copyright (C) 2003 - National Institute of Advanced Industrial Science and Technology (AIST) - Registration Number H13PRO009 + +Copyright (C) 1998, 2001-2011 Free Software Foundation, Inc. +Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, 2010, 2011 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H14PRO021 +Copyright (C) 2003 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H13PRO009 This file is part of GNU Emacs. @@ -48,14 +48,16 @@ along with GNU Emacs. If not, see . */ For the moment, we are not using this feature. */ static int category_table_version; -Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p; - -/* Variables to determine word boundary. */ -Lisp_Object Vword_combining_categories, Vword_separating_categories; +static Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p; /* Temporary internal variable used in macro CHAR_HAS_CATEGORY. */ Lisp_Object _temp_category_set; +/* 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) +static void set_category_set (Lisp_Object, Lisp_Object, Lisp_Object); /* Category set staff. */ @@ -64,10 +66,9 @@ static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); static Lisp_Object hash_get_category_set (Lisp_Object table, Lisp_Object category_set) { - Lisp_Object val; struct Lisp_Hash_Table *h; - int i; - unsigned hash; + EMACS_INT i; + EMACS_UINT hash; if (NILP (XCHAR_TABLE (table)->extras[1])) XCHAR_TABLE (table)->extras[1] @@ -115,7 +116,7 @@ those categories. */) /* Category staff. */ -Lisp_Object check_category_table (Lisp_Object table); +static Lisp_Object check_category_table (Lisp_Object table); DEFUN ("define-category", Fdefine_category, Sdefine_category, 2, 3, 0, doc: /* Define CATEGORY as a category which is described by DOCSTRING. @@ -132,7 +133,7 @@ the current buffer's category table. */) table = check_category_table (table); if (!NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) - error ("Category `%c' is already defined", XFASTINT (category)); + error ("Category `%c' is already defined", (int) XFASTINT (category)); if (!NILP (Vpurify_flag)) docstring = Fpurecopy (docstring); CATEGORY_DOCSTRING (table, XFASTINT (category)) = docstring; @@ -189,11 +190,11 @@ DEFUN ("category-table-p", Fcategory_table_p, Scategory_table_p, 1, 1, 0, valid, return TABLE itself, but if not valid, signal an error of wrong-type-argument. */ -Lisp_Object +static Lisp_Object check_category_table (Lisp_Object table) { if (NILP (table)) - return current_buffer->category_table; + return BVAR (current_buffer, category_table); CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); return table; } @@ -203,7 +204,7 @@ DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0, This is the one specified by the current buffer. */) (void) { - return current_buffer->category_table; + return BVAR (current_buffer, category_table); } DEFUN ("standard-category-table", Fstandard_category_table, @@ -231,7 +232,7 @@ copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val) the original and the copy. This function is called recursively by binding TABLE to a sub char table. */ -Lisp_Object +static Lisp_Object copy_category_table (Lisp_Object table) { table = copy_char_table (table); @@ -284,7 +285,7 @@ Return TABLE. */) { int idx; table = check_category_table (table); - current_buffer->category_table = table; + BVAR (current_buffer, category_table) = table; /* Indicate that this buffer now has a specified category table. */ idx = PER_BUFFER_VAR_IDX (category_table); SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); @@ -295,7 +296,7 @@ Return TABLE. */) Lisp_Object char_category_set (int c) { - return CHAR_TABLE_REF (current_buffer->category_table, c); + return CHAR_TABLE_REF (BVAR (current_buffer, category_table), c); } DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, @@ -329,7 +330,7 @@ The return value is a string containing those same categories. */) return build_string (str); } -void +static void set_category_set (Lisp_Object category_set, Lisp_Object category, Lisp_Object val) { do { @@ -377,7 +378,7 @@ then delete CATEGORY from the category set instead of adding it. */) table = check_category_table (table); if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) - error ("Undefined category: %c", XFASTINT (category)); + error ("Undefined category: %c", (int) XFASTINT (category)); set_value = NILP (reset) ? Qt : Qnil; @@ -452,8 +453,7 @@ void init_category_once (void) { /* This has to be done here, before we call Fmake_char_table. */ - Qcategory_table = intern_c_string ("category-table"); - staticpro (&Qcategory_table); + DEFSYM (Qcategory_table, "category-table"); /* Intern this now in case it isn't already done. Setting this variable twice is harmless. @@ -474,14 +474,11 @@ init_category_once (void) void syms_of_category (void) { - Qcategoryp = intern_c_string ("categoryp"); - staticpro (&Qcategoryp); - Qcategorysetp = intern_c_string ("categorysetp"); - staticpro (&Qcategorysetp); - Qcategory_table_p = intern_c_string ("category-table-p"); - staticpro (&Qcategory_table_p); - - DEFVAR_LISP ("word-combining-categories", &Vword_combining_categories, + DEFSYM (Qcategoryp, "categoryp"); + DEFSYM (Qcategorysetp, "categorysetp"); + DEFSYM (Qcategory_table_p, "category-table-p"); + + DEFVAR_LISP ("word-combining-categories", Vword_combining_categories, doc: /* List of pair (cons) of categories to determine word boundary. Emacs treats a sequence of word constituent characters as a single @@ -519,7 +516,7 @@ the element `(?H . ?K) should be in this list. */); Vword_combining_categories = Qnil; - DEFVAR_LISP ("word-separating-categories", &Vword_separating_categories, + DEFVAR_LISP ("word-separating-categories", Vword_separating_categories, doc: /* List of pair (cons) of categories to determine word boundary. See the documentation of the variable `word-combining-categories'. */); @@ -541,6 +538,3 @@ See the documentation of the variable `word-combining-categories'. */); category_table_version = 0; } - -/* arch-tag: 74ebf524-121b-4d9c-bd68-07f8d708b211 - (do not change this comment) */