diff options
| author | Kenichi Handa | 2008-11-27 07:59:21 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-11-27 07:59:21 +0000 |
| commit | cd486875776635d52c854f41863011f16291b82a (patch) | |
| tree | 301ec92694bed2e7a70b41b87c6c7b789ea53844 /src | |
| parent | 1a182119e39ae4ce2f2dab91bc84cc985eb43db2 (diff) | |
| download | emacs-cd486875776635d52c854f41863011f16291b82a.tar.gz emacs-cd486875776635d52c854f41863011f16291b82a.zip | |
(hash_get_category_set): New function.
(Fmodify_category_entry): Adjusted for the change of
char_table_ref_and_range. Call hash_get_category_set to get a
category set to store in the table.
Diffstat (limited to 'src')
| -rw-r--r-- | src/category.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/category.c b/src/category.c index e5e5a377ef1..36ab8a9e9e4 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -58,6 +58,32 @@ Lisp_Object _temp_category_set; | |||
| 58 | 58 | ||
| 59 | /* Category set staff. */ | 59 | /* Category set staff. */ |
| 60 | 60 | ||
| 61 | static Lisp_Object hash_get_category_set P_ ((Lisp_Object, Lisp_Object)); | ||
| 62 | |||
| 63 | static Lisp_Object | ||
| 64 | hash_get_category_set (table, category_set) | ||
| 65 | Lisp_Object table, category_set; | ||
| 66 | { | ||
| 67 | Lisp_Object val; | ||
| 68 | struct Lisp_Hash_Table *h; | ||
| 69 | int i; | ||
| 70 | unsigned hash; | ||
| 71 | |||
| 72 | if (NILP (XCHAR_TABLE (table)->extras[1])) | ||
| 73 | XCHAR_TABLE (table)->extras[1] | ||
| 74 | = make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), | ||
| 75 | make_float (DEFAULT_REHASH_SIZE), | ||
| 76 | make_float (DEFAULT_REHASH_THRESHOLD), | ||
| 77 | Qnil, Qnil, Qnil); | ||
| 78 | h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]); | ||
| 79 | i = hash_lookup (h, category_set, &hash); | ||
| 80 | if (i >= 0) | ||
| 81 | return HASH_KEY (h, i); | ||
| 82 | hash_put (h, category_set, Qnil, hash); | ||
| 83 | return category_set; | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 61 | DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0, | 87 | DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0, |
| 62 | doc: /* Return a newly created category-set which contains CATEGORIES. | 88 | doc: /* Return a newly created category-set which contains CATEGORIES. |
| 63 | CATEGORIES is a string of category mnemonics. | 89 | CATEGORIES is a string of category mnemonics. |
| @@ -370,15 +396,14 @@ then delete CATEGORY from the category set instead of adding it. */) | |||
| 370 | 396 | ||
| 371 | while (start <= end) | 397 | while (start <= end) |
| 372 | { | 398 | { |
| 399 | from = start, to = end; | ||
| 373 | category_set = char_table_ref_and_range (table, start, &from, &to); | 400 | category_set = char_table_ref_and_range (table, start, &from, &to); |
| 374 | if (CATEGORY_MEMBER (XFASTINT (category), category_set) != NILP (reset)) | 401 | if (CATEGORY_MEMBER (XFASTINT (category), category_set) != NILP (reset)) |
| 375 | { | 402 | { |
| 376 | category_set = Fcopy_sequence (category_set); | 403 | category_set = Fcopy_sequence (category_set); |
| 377 | SET_CATEGORY_SET (category_set, category, set_value); | 404 | SET_CATEGORY_SET (category_set, category, set_value); |
| 378 | if (to > end) | 405 | category_set = hash_get_category_set (table, category_set); |
| 379 | char_table_set_range (table, start, end, category_set); | 406 | char_table_set_range (table, start, to, category_set); |
| 380 | else | ||
| 381 | char_table_set_range (table, start, to, category_set); | ||
| 382 | } | 407 | } |
| 383 | start = to + 1; | 408 | start = to + 1; |
| 384 | } | 409 | } |