aboutsummaryrefslogtreecommitdiffstats
path: root/src/chartab.c
diff options
context:
space:
mode:
authorPaul Eggert2012-08-17 10:08:30 -0700
committerPaul Eggert2012-08-17 10:08:30 -0700
commit34dabdb7701594b83a5b35b034bba55855d256a5 (patch)
tree860e8c22685321d157f71cd4a57c9c1162e69d54 /src/chartab.c
parentc24eb18ab40c3b022ab3b7d9c2aa26a37923340f (diff)
downloademacs-34dabdb7701594b83a5b35b034bba55855d256a5.tar.gz
emacs-34dabdb7701594b83a5b35b034bba55855d256a5.zip
* lisp.h (set_char_table_extras): Rename from char_table_set_extras.
(set_char_table_contents): Rename from char_table_set_contents. (set_sub_char_table_contents): Rename from sub_char_table_sub_contents. All uses changed. See the end of <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00549.html>.
Diffstat (limited to 'src/chartab.c')
-rw-r--r--src/chartab.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/src/chartab.c b/src/chartab.c
index 01b65eb50b7..25d331b73e2 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -155,21 +155,17 @@ char_table_ascii (Lisp_Object table)
155static Lisp_Object 155static Lisp_Object
156copy_sub_char_table (Lisp_Object table) 156copy_sub_char_table (Lisp_Object table)
157{ 157{
158 Lisp_Object copy;
159 int depth = XINT (XSUB_CHAR_TABLE (table)->depth); 158 int depth = XINT (XSUB_CHAR_TABLE (table)->depth);
160 int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char); 159 int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char);
161 Lisp_Object val; 160 Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil);
162 int i; 161 int i;
163 162
164 copy = make_sub_char_table (depth, min_char, Qnil);
165 /* Recursively copy any sub char-tables. */ 163 /* Recursively copy any sub char-tables. */
166 for (i = 0; i < chartab_size[depth]; i++) 164 for (i = 0; i < chartab_size[depth]; i++)
167 { 165 {
168 val = XSUB_CHAR_TABLE (table)->contents[i]; 166 Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[i];
169 if (SUB_CHAR_TABLE_P (val)) 167 set_sub_char_table_contents
170 sub_char_table_set_contents (copy, i, copy_sub_char_table (val)); 168 (copy, i, SUB_CHAR_TABLE_P (val) ? copy_sub_char_table (val) : val);
171 else
172 sub_char_table_set_contents (copy, i, val);
173 } 169 }
174 170
175 return copy; 171 return copy;
@@ -189,7 +185,7 @@ copy_char_table (Lisp_Object table)
189 set_char_table_parent (copy, XCHAR_TABLE (table)->parent); 185 set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
190 set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose); 186 set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose);
191 for (i = 0; i < chartab_size[0]; i++) 187 for (i = 0; i < chartab_size[0]; i++)
192 char_table_set_contents 188 set_char_table_contents
193 (copy, i, 189 (copy, i,
194 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i]) 190 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
195 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i]) 191 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i])
@@ -197,7 +193,7 @@ copy_char_table (Lisp_Object table)
197 set_char_table_ascii (copy, char_table_ascii (copy)); 193 set_char_table_ascii (copy, char_table_ascii (copy));
198 size -= VECSIZE (struct Lisp_Char_Table) - 1; 194 size -= VECSIZE (struct Lisp_Char_Table) - 1;
199 for (i = 0; i < size; i++) 195 for (i = 0; i < size; i++)
200 char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]); 196 set_char_table_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
201 197
202 XSETCHAR_TABLE (copy, XCHAR_TABLE (copy)); 198 XSETCHAR_TABLE (copy, XCHAR_TABLE (copy));
203 return copy; 199 return copy;
@@ -395,7 +391,7 @@ sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
395 Lisp_Object sub; 391 Lisp_Object sub;
396 392
397 if (depth == 3) 393 if (depth == 3)
398 sub_char_table_set_contents (table, i, val); 394 set_sub_char_table_contents (table, i, val);
399 else 395 else
400 { 396 {
401 sub = tbl->contents[i]; 397 sub = tbl->contents[i];
@@ -408,7 +404,7 @@ sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
408 sub = make_sub_char_table (depth + 1, 404 sub = make_sub_char_table (depth + 1,
409 min_char + i * chartab_chars[depth], 405 min_char + i * chartab_chars[depth],
410 sub); 406 sub);
411 sub_char_table_set_contents (table, i, sub); 407 set_sub_char_table_contents (table, i, sub);
412 } 408 }
413 } 409 }
414 sub_char_table_set (sub, c, val, is_uniprop); 410 sub_char_table_set (sub, c, val, is_uniprop);
@@ -422,7 +418,7 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
422 418
423 if (ASCII_CHAR_P (c) 419 if (ASCII_CHAR_P (c)
424 && SUB_CHAR_TABLE_P (tbl->ascii)) 420 && SUB_CHAR_TABLE_P (tbl->ascii))
425 sub_char_table_set_contents (tbl->ascii, c, val); 421 set_sub_char_table_contents (tbl->ascii, c, val);
426 else 422 else
427 { 423 {
428 int i = CHARTAB_IDX (c, 0, 0); 424 int i = CHARTAB_IDX (c, 0, 0);
@@ -432,7 +428,7 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
432 if (! SUB_CHAR_TABLE_P (sub)) 428 if (! SUB_CHAR_TABLE_P (sub))
433 { 429 {
434 sub = make_sub_char_table (1, i * chartab_chars[0], sub); 430 sub = make_sub_char_table (1, i * chartab_chars[0], sub);
435 char_table_set_contents (table, i, sub); 431 set_char_table_contents (table, i, sub);
436 } 432 }
437 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table)); 433 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table));
438 if (ASCII_CHAR_P (c)) 434 if (ASCII_CHAR_P (c))
@@ -460,7 +456,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
460 if (c > to) 456 if (c > to)
461 break; 457 break;
462 if (from <= c && c + chars_in_block - 1 <= to) 458 if (from <= c && c + chars_in_block - 1 <= to)
463 sub_char_table_set_contents (table, i, val); 459 set_sub_char_table_contents (table, i, val);
464 else 460 else
465 { 461 {
466 Lisp_Object sub = tbl->contents[i]; 462 Lisp_Object sub = tbl->contents[i];
@@ -471,7 +467,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
471 else 467 else
472 { 468 {
473 sub = make_sub_char_table (depth + 1, c, sub); 469 sub = make_sub_char_table (depth + 1, c, sub);
474 sub_char_table_set_contents (table, i, sub); 470 set_sub_char_table_contents (table, i, sub);
475 } 471 }
476 } 472 }
477 sub_char_table_set_range (sub, from, to, val, is_uniprop); 473 sub_char_table_set_range (sub, from, to, val, is_uniprop);
@@ -499,14 +495,14 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
499 if (c > to) 495 if (c > to)
500 break; 496 break;
501 if (from <= c && c + chartab_chars[0] - 1 <= to) 497 if (from <= c && c + chartab_chars[0] - 1 <= to)
502 char_table_set_contents (table, i, val); 498 set_char_table_contents (table, i, val);
503 else 499 else
504 { 500 {
505 Lisp_Object sub = tbl->contents[i]; 501 Lisp_Object sub = tbl->contents[i];
506 if (! SUB_CHAR_TABLE_P (sub)) 502 if (! SUB_CHAR_TABLE_P (sub))
507 { 503 {
508 sub = make_sub_char_table (1, i * chartab_chars[0], sub); 504 sub = make_sub_char_table (1, i * chartab_chars[0], sub);
509 char_table_set_contents (table, i, sub); 505 set_char_table_contents (table, i, sub);
510 } 506 }
511 sub_char_table_set_range (sub, from, to, val, is_uniprop); 507 sub_char_table_set_range (sub, from, to, val, is_uniprop);
512 } 508 }
@@ -593,7 +589,7 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
593 || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table))) 589 || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
594 args_out_of_range (char_table, n); 590 args_out_of_range (char_table, n);
595 591
596 char_table_set_extras (char_table, XINT (n), value); 592 set_char_table_extras (char_table, XINT (n), value);
597 return value; 593 return value;
598} 594}
599 595
@@ -642,7 +638,7 @@ or a character code. Return VALUE. */)
642 638
643 set_char_table_ascii (char_table, value); 639 set_char_table_ascii (char_table, value);
644 for (i = 0; i < chartab_size[0]; i++) 640 for (i = 0; i < chartab_size[0]; i++)
645 char_table_set_contents (char_table, i, value); 641 set_char_table_contents (char_table, i, value);
646 } 642 }
647 else if (EQ (range, Qnil)) 643 else if (EQ (range, Qnil))
648 set_char_table_defalt (char_table, value); 644 set_char_table_defalt (char_table, value);
@@ -695,7 +691,7 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
695 if (SUB_CHAR_TABLE_P (elt)) 691 if (SUB_CHAR_TABLE_P (elt))
696 { 692 {
697 elt = optimize_sub_char_table (elt, test); 693 elt = optimize_sub_char_table (elt, test);
698 sub_char_table_set_contents (table, 0, elt); 694 set_sub_char_table_contents (table, 0, elt);
699 } 695 }
700 optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; 696 optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1;
701 for (i = 1; i < chartab_size[depth]; i++) 697 for (i = 1; i < chartab_size[depth]; i++)
@@ -704,7 +700,7 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
704 if (SUB_CHAR_TABLE_P (this)) 700 if (SUB_CHAR_TABLE_P (this))
705 { 701 {
706 this = optimize_sub_char_table (this, test); 702 this = optimize_sub_char_table (this, test);
707 sub_char_table_set_contents (table, i, this); 703 set_sub_char_table_contents (table, i, this);
708 } 704 }
709 if (optimizable 705 if (optimizable
710 && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ 706 && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */
@@ -732,7 +728,7 @@ equivalent and can be merged. It defaults to `equal'. */)
732 { 728 {
733 elt = XCHAR_TABLE (char_table)->contents[i]; 729 elt = XCHAR_TABLE (char_table)->contents[i];
734 if (SUB_CHAR_TABLE_P (elt)) 730 if (SUB_CHAR_TABLE_P (elt))
735 char_table_set_contents 731 set_char_table_contents
736 (char_table, i, optimize_sub_char_table (elt, test)); 732 (char_table, i, optimize_sub_char_table (elt, test));
737 } 733 }
738 /* Reset the `ascii' cache, in case it got optimized away. */ 734 /* Reset the `ascii' cache, in case it got optimized away. */
@@ -1149,7 +1145,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1149 Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); 1145 Lisp_Object sub = make_sub_char_table (3, min_char, Qnil);
1150 const unsigned char *p, *pend; 1146 const unsigned char *p, *pend;
1151 1147
1152 sub_char_table_set_contents (table, idx, sub); 1148 set_sub_char_table_contents (table, idx, sub);
1153 p = SDATA (val), pend = p + SBYTES (val); 1149 p = SDATA (val), pend = p + SBYTES (val);
1154 if (*p == 1) 1150 if (*p == 1)
1155 { 1151 {
@@ -1159,7 +1155,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1159 while (p < pend && idx < chartab_chars[2]) 1155 while (p < pend && idx < chartab_chars[2])
1160 { 1156 {
1161 int v = STRING_CHAR_ADVANCE (p); 1157 int v = STRING_CHAR_ADVANCE (p);
1162 sub_char_table_set_contents 1158 set_sub_char_table_contents
1163 (sub, idx++, v > 0 ? make_number (v) : Qnil); 1159 (sub, idx++, v > 0 ? make_number (v) : Qnil);
1164 } 1160 }
1165 } 1161 }
@@ -1185,7 +1181,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1185 } 1181 }
1186 } 1182 }
1187 while (count-- > 0) 1183 while (count-- > 0)
1188 sub_char_table_set_contents (sub, idx++, make_number (v)); 1184 set_sub_char_table_contents (sub, idx++, make_number (v));
1189 } 1185 }
1190 } 1186 }
1191/* It seems that we don't need this function because C code won't need 1187/* It seems that we don't need this function because C code won't need
@@ -1288,7 +1284,7 @@ uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value)
1288 1284
1289 args[0] = XCHAR_TABLE (table)->extras[4]; 1285 args[0] = XCHAR_TABLE (table)->extras[4];
1290 args[1] = Fmake_vector (make_number (1), value); 1286 args[1] = Fmake_vector (make_number (1), value);
1291 char_table_set_extras (table, 4, Fvconcat (2, args)); 1287 set_char_table_extras (table, 4, Fvconcat (2, args));
1292 } 1288 }
1293 return make_number (i); 1289 return make_number (i);
1294} 1290}