aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-08-17 09:48:22 -0700
committerPaul Eggert2012-08-17 09:48:22 -0700
commit742af32f280f9e0051691a34874d6a7de693239c (patch)
tree6fe111e6e6d8b14af62caecc3a8ef5a18f01a8aa /src
parenta04e2c62ec8ce903310b7c7635c43f42ccab5e2f (diff)
downloademacs-742af32f280f9e0051691a34874d6a7de693239c.tar.gz
emacs-742af32f280f9e0051691a34874d6a7de693239c.zip
* lisp.h (CSET): Remove.
(set_char_table_ascii, set_char_table_defalt, set_char_table_parent) (set_char_table_purpose): New functions, replacing CSET. All uses changed. For example, replace "CSET (XCHAR_TABLE (char_table), parent, parent);" with "char_table_set_parent (char_table, parent);". The old version was confusing because it used the same name 'parent' for two different things. Fixes: debbugs:12215
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/casetab.c2
-rw-r--r--src/category.c8
-rw-r--r--src/chartab.c36
-rw-r--r--src/fns.c2
-rw-r--r--src/fontset.c2
-rw-r--r--src/lisp.h30
-rw-r--r--src/syntax.c2
8 files changed, 61 insertions, 32 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9ceaa95dcea..5ff6a577280 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-08-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 * lisp.h (CSET): Remove (Bug#12215).
4 (set_char_table_ascii, set_char_table_defalt, set_char_table_parent)
5 (set_char_table_purpose): New functions,
6 replacing CSET. All uses changed. For example, replace
7 "CSET (XCHAR_TABLE (char_table), parent, parent);" with
8 "char_table_set_parent (char_table, parent);".
9 The old version was confusing because it used the same name
10 'parent' for two different things.
11
12012-08-17 Dmitry Antipov <dmantipov@yandex.ru> 122012-08-17 Dmitry Antipov <dmantipov@yandex.ru>
2 13
3 Functions to get and set Lisp_Object fields of buffer-local variables. 14 Functions to get and set Lisp_Object fields of buffer-local variables.
diff --git a/src/casetab.c b/src/casetab.c
index 6097299047a..78c6034bf5f 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -260,7 +260,7 @@ init_casetab_once (void)
260 260
261 down = Fmake_char_table (Qcase_table, Qnil); 261 down = Fmake_char_table (Qcase_table, Qnil);
262 Vascii_downcase_table = down; 262 Vascii_downcase_table = down;
263 CSET (XCHAR_TABLE (down), purpose, Qcase_table); 263 set_char_table_purpose (down, Qcase_table);
264 264
265 for (i = 0; i < 128; i++) 265 for (i = 0; i < 128; i++)
266 { 266 {
diff --git a/src/category.c b/src/category.c
index 246a7d35a6d..8a7d4d40762 100644
--- a/src/category.c
+++ b/src/category.c
@@ -238,8 +238,8 @@ copy_category_table (Lisp_Object table)
238 table = copy_char_table (table); 238 table = copy_char_table (table);
239 239
240 if (! NILP (XCHAR_TABLE (table)->defalt)) 240 if (! NILP (XCHAR_TABLE (table)->defalt))
241 CSET (XCHAR_TABLE (table), defalt, 241 set_char_table_defalt (table,
242 Fcopy_sequence (XCHAR_TABLE (table)->defalt)); 242 Fcopy_sequence (XCHAR_TABLE (table)->defalt));
243 char_table_set_extras 243 char_table_set_extras
244 (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0])); 244 (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0]));
245 map_char_table (copy_category_entry, Qnil, table, table); 245 map_char_table (copy_category_entry, Qnil, table, table);
@@ -270,7 +270,7 @@ DEFUN ("make-category-table", Fmake_category_table, Smake_category_table,
270 int i; 270 int i;
271 271
272 val = Fmake_char_table (Qcategory_table, Qnil); 272 val = Fmake_char_table (Qcategory_table, Qnil);
273 CSET (XCHAR_TABLE (val), defalt, MAKE_CATEGORY_SET); 273 set_char_table_defalt (val, MAKE_CATEGORY_SET);
274 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 274 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
275 char_table_set_contents (val, i, MAKE_CATEGORY_SET); 275 char_table_set_contents (val, i, MAKE_CATEGORY_SET);
276 Fset_char_table_extra_slot (val, make_number (0), 276 Fset_char_table_extra_slot (val, make_number (0),
@@ -466,7 +466,7 @@ init_category_once (void)
466 466
467 Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil); 467 Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil);
468 /* Set a category set which contains nothing to the default. */ 468 /* Set a category set which contains nothing to the default. */
469 CSET (XCHAR_TABLE (Vstandard_category_table), defalt, MAKE_CATEGORY_SET); 469 set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET);
470 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0), 470 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0),
471 Fmake_vector (make_number (95), Qnil)); 471 Fmake_vector (make_number (95), Qnil));
472} 472}
diff --git a/src/chartab.c b/src/chartab.c
index 6d3f83499d8..01b65eb50b7 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -115,8 +115,8 @@ the char-table has no extra slot. */)
115 size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras; 115 size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras;
116 vector = Fmake_vector (make_number (size), init); 116 vector = Fmake_vector (make_number (size), init);
117 XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE); 117 XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
118 CSET (XCHAR_TABLE (vector), parent, Qnil); 118 set_char_table_parent (vector, Qnil);
119 CSET (XCHAR_TABLE (vector), purpose, purpose); 119 set_char_table_purpose (vector, purpose);
120 XSETCHAR_TABLE (vector, XCHAR_TABLE (vector)); 120 XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
121 return vector; 121 return vector;
122} 122}
@@ -185,16 +185,16 @@ copy_char_table (Lisp_Object table)
185 185
186 copy = Fmake_vector (make_number (size), Qnil); 186 copy = Fmake_vector (make_number (size), Qnil);
187 XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE); 187 XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
188 CSET (XCHAR_TABLE (copy), defalt, XCHAR_TABLE (table)->defalt); 188 set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt);
189 CSET (XCHAR_TABLE (copy), parent, XCHAR_TABLE (table)->parent); 189 set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
190 CSET (XCHAR_TABLE (copy), purpose, XCHAR_TABLE (table)->purpose); 190 set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose);
191 for (i = 0; i < chartab_size[0]; i++) 191 for (i = 0; i < chartab_size[0]; i++)
192 char_table_set_contents 192 char_table_set_contents
193 (copy, i, 193 (copy, i,
194 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i]) 194 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
195 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i]) 195 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i])
196 : XCHAR_TABLE (table)->contents[i])); 196 : XCHAR_TABLE (table)->contents[i]));
197 CSET (XCHAR_TABLE (copy), ascii, char_table_ascii (copy)); 197 set_char_table_ascii (copy, char_table_ascii (copy));
198 size -= VECSIZE (struct Lisp_Char_Table) - 1; 198 size -= VECSIZE (struct Lisp_Char_Table) - 1;
199 for (i = 0; i < size; i++) 199 for (i = 0; i < size; i++)
200 char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]); 200 char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
@@ -436,7 +436,7 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
436 } 436 }
437 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table)); 437 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table));
438 if (ASCII_CHAR_P (c)) 438 if (ASCII_CHAR_P (c))
439 CSET (tbl, ascii, char_table_ascii (table)); 439 set_char_table_ascii (table, char_table_ascii (table));
440 } 440 }
441 return val; 441 return val;
442} 442}
@@ -512,7 +512,7 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
512 } 512 }
513 } 513 }
514 if (ASCII_CHAR_P (from)) 514 if (ASCII_CHAR_P (from))
515 CSET (tbl, ascii, char_table_ascii (table)); 515 set_char_table_ascii (table, char_table_ascii (table));
516 } 516 }
517 return val; 517 return val;
518} 518}
@@ -562,7 +562,7 @@ Return PARENT. PARENT must be either nil or another char-table. */)
562 error ("Attempt to make a chartable be its own parent"); 562 error ("Attempt to make a chartable be its own parent");
563 } 563 }
564 564
565 CSET (XCHAR_TABLE (char_table), parent, parent); 565 set_char_table_parent (char_table, parent);
566 566
567 return parent; 567 return parent;
568} 568}
@@ -640,12 +640,12 @@ or a character code. Return VALUE. */)
640 { 640 {
641 int i; 641 int i;
642 642
643 CSET (XCHAR_TABLE (char_table), ascii, value); 643 set_char_table_ascii (char_table, value);
644 for (i = 0; i < chartab_size[0]; i++) 644 for (i = 0; i < chartab_size[0]; i++)
645 char_table_set_contents (char_table, i, value); 645 char_table_set_contents (char_table, i, value);
646 } 646 }
647 else if (EQ (range, Qnil)) 647 else if (EQ (range, Qnil))
648 CSET (XCHAR_TABLE (char_table), defalt, value); 648 set_char_table_defalt (char_table, value);
649 else if (CHARACTERP (range)) 649 else if (CHARACTERP (range))
650 char_table_set (char_table, XINT (range), value); 650 char_table_set (char_table, XINT (range), value);
651 else if (CONSP (range)) 651 else if (CONSP (range))
@@ -736,7 +736,7 @@ equivalent and can be merged. It defaults to `equal'. */)
736 (char_table, i, optimize_sub_char_table (elt, test)); 736 (char_table, i, optimize_sub_char_table (elt, test));
737 } 737 }
738 /* Reset the `ascii' cache, in case it got optimized away. */ 738 /* Reset the `ascii' cache, in case it got optimized away. */
739 CSET (XCHAR_TABLE (char_table), ascii, char_table_ascii (char_table)); 739 set_char_table_ascii (char_table, char_table_ascii (char_table));
740 740
741 return Qnil; 741 return Qnil;
742} 742}
@@ -828,9 +828,9 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
828 828
829 /* This is to get a value of FROM in PARENT 829 /* This is to get a value of FROM in PARENT
830 without checking the parent of PARENT. */ 830 without checking the parent of PARENT. */
831 CSET (XCHAR_TABLE (parent), parent, Qnil); 831 set_char_table_parent (parent, Qnil);
832 val = CHAR_TABLE_REF (parent, from); 832 val = CHAR_TABLE_REF (parent, from);
833 CSET (XCHAR_TABLE (parent), parent, temp); 833 set_char_table_parent (parent, temp);
834 XSETCDR (range, make_number (c - 1)); 834 XSETCDR (range, make_number (c - 1));
835 val = map_sub_char_table (c_function, function, 835 val = map_sub_char_table (c_function, function,
836 parent, arg, val, range, 836 parent, arg, val, range,
@@ -910,9 +910,9 @@ map_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
910 temp = XCHAR_TABLE (parent)->parent; 910 temp = XCHAR_TABLE (parent)->parent;
911 /* This is to get a value of FROM in PARENT without checking the 911 /* This is to get a value of FROM in PARENT without checking the
912 parent of PARENT. */ 912 parent of PARENT. */
913 CSET (XCHAR_TABLE (parent), parent, Qnil); 913 set_char_table_parent (parent, Qnil);
914 val = CHAR_TABLE_REF (parent, from); 914 val = CHAR_TABLE_REF (parent, from);
915 CSET (XCHAR_TABLE (parent), parent, temp); 915 set_char_table_parent (parent, temp);
916 val = map_sub_char_table (c_function, function, parent, arg, val, range, 916 val = map_sub_char_table (c_function, function, parent, arg, val, range,
917 parent); 917 parent);
918 table = parent; 918 table = parent;
@@ -1350,7 +1350,7 @@ uniprop_table (Lisp_Object prop)
1350 : ! NILP (val)) 1350 : ! NILP (val))
1351 return Qnil; 1351 return Qnil;
1352 /* Prepare ASCII values in advance for CHAR_TABLE_REF. */ 1352 /* Prepare ASCII values in advance for CHAR_TABLE_REF. */
1353 CSET (XCHAR_TABLE (table), ascii, char_table_ascii (table)); 1353 set_char_table_ascii (table, char_table_ascii (table));
1354 return table; 1354 return table;
1355} 1355}
1356 1356
diff --git a/src/fns.c b/src/fns.c
index 039c208b0d3..bc46a135e40 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2151,7 +2151,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2151 2151
2152 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 2152 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
2153 char_table_set_contents (array, i, item); 2153 char_table_set_contents (array, i, item);
2154 CSET (XCHAR_TABLE (array), defalt, item); 2154 set_char_table_defalt (array, item);
2155 } 2155 }
2156 else if (STRINGP (array)) 2156 else if (STRINGP (array))
2157 { 2157 {
diff --git a/src/fontset.c b/src/fontset.c
index 82d668a3871..b25a896deda 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1979,7 +1979,7 @@ format is the same as above. */)
1979 if (c <= MAX_5_BYTE_CHAR) 1979 if (c <= MAX_5_BYTE_CHAR)
1980 char_table_set_range (tables[k], c, to, alist); 1980 char_table_set_range (tables[k], c, to, alist);
1981 else 1981 else
1982 CSET (XCHAR_TABLE (tables[k]), defalt, alist); 1982 set_char_table_defalt (tables[k], alist);
1983 1983
1984 /* At last, change each elements to font names. */ 1984 /* At last, change each elements to font names. */
1985 for (; CONSP (alist); alist = XCDR (alist)) 1985 for (; CONSP (alist); alist = XCDR (alist))
diff --git a/src/lisp.h b/src/lisp.h
index 827f2be06d0..6da1fe97c12 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -936,12 +936,6 @@ enum CHARTAB_SIZE_BITS
936 936
937extern const int chartab_size[4]; 937extern const int chartab_size[4];
938 938
939/* Most code should use this macro to set non-array Lisp fields in struct
940 Lisp_Char_Table. For CONTENTS and EXTRAS, use char_table_set_contents
941 and char_table_set_extras, respectively. */
942
943#define CSET(c, field, value) ((c)->field = (value))
944
945struct Lisp_Char_Table 939struct Lisp_Char_Table
946 { 940 {
947 /* HEADER.SIZE is the vector's size field, which also holds the 941 /* HEADER.SIZE is the vector's size field, which also holds the
@@ -2477,6 +2471,30 @@ string_set_intervals (Lisp_Object s, INTERVAL i)
2477 XSTRING (s)->intervals = i; 2471 XSTRING (s)->intervals = i;
2478} 2472}
2479 2473
2474/* Set a Lisp slot in TABLE to VAL. Most code should use this instead
2475 of setting slots directly. */
2476
2477LISP_INLINE void
2478set_char_table_ascii (Lisp_Object table, Lisp_Object val)
2479{
2480 XCHAR_TABLE (table)->ascii = val;
2481}
2482LISP_INLINE void
2483set_char_table_defalt (Lisp_Object table, Lisp_Object val)
2484{
2485 XCHAR_TABLE (table)->defalt = val;
2486}
2487LISP_INLINE void
2488set_char_table_parent (Lisp_Object table, Lisp_Object val)
2489{
2490 XCHAR_TABLE (table)->parent = val;
2491}
2492LISP_INLINE void
2493set_char_table_purpose (Lisp_Object table, Lisp_Object val)
2494{
2495 XCHAR_TABLE (table)->purpose = val;
2496}
2497
2480/* Set different slots in (sub)character tables. */ 2498/* Set different slots in (sub)character tables. */
2481 2499
2482LISP_INLINE void 2500LISP_INLINE void
diff --git a/src/syntax.c b/src/syntax.c
index 69965d1d824..b8b1bb2ed9c 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -818,7 +818,7 @@ It is a copy of the TABLE, which defaults to the standard syntax table. */)
818 818
819 /* Only the standard syntax table should have a default element. 819 /* Only the standard syntax table should have a default element.
820 Other syntax tables should inherit from parents instead. */ 820 Other syntax tables should inherit from parents instead. */
821 CSET (XCHAR_TABLE (copy), defalt, Qnil); 821 set_char_table_defalt (copy, Qnil);
822 822
823 /* Copied syntax tables should all have parents. 823 /* Copied syntax tables should all have parents.
824 If we copied one with no parent, such as the standard syntax table, 824 If we copied one with no parent, such as the standard syntax table,