aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-04-26 12:17:42 +0000
committerKaroly Lorentey2005-04-26 12:17:42 +0000
commit030cd69ff13d95f439ca0d13a03215fc45959789 (patch)
tree4554735b53848a05f107b8b421a898e0e9fe7ee6 /src
parent3379bbb24d58ecd8dca0c96b976b7031167e76a5 (diff)
parent35b1b8abe3d3833ecb4b4cee75b7340ffb707d65 (diff)
downloademacs-030cd69ff13d95f439ca0d13a03215fc45959789.tar.gz
emacs-030cd69ff13d95f439ca0d13a03215fc45959789.zip
Merged from miles@gnu.org--gnu-2005 (patch 279-280)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-279 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-280 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-335
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/fns.c129
-rw-r--r--src/fontset.c2
3 files changed, 122 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 834dcf4ab82..9fc43e0bd4a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12005-04-26 Kenichi Handa <handa@m17n.org>
2
3 * fns.c (char_table_range): New function.
4 (Fchar_table_range): Signal an error if characters in the range
5 have inconsistent values. Don't check the parent.
6
72005-04-25 Kenichi Handa <handa@m17n.org>
8
9 * fontset.c (fontset_set): Fix previous change.
10
12005-04-24 Richard M. Stallman <rms@gnu.org> 112005-04-24 Richard M. Stallman <rms@gnu.org>
2 12
3 * indent.c (Fvertical_motion): Bind fontification-functions to nil. 13 * indent.c (Fvertical_motion): Bind fontification-functions to nil.
diff --git a/src/fns.c b/src/fns.c
index b93ebb65234..f0dff278117 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2508,50 +2508,143 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
2508 return XCHAR_TABLE (char_table)->extras[XINT (n)] = value; 2508 return XCHAR_TABLE (char_table)->extras[XINT (n)] = value;
2509} 2509}
2510 2510
2511static Lisp_Object
2512char_table_range (table, from, to, defalt)
2513 Lisp_Object table;
2514 int from, to;
2515 Lisp_Object defalt;
2516{
2517 Lisp_Object val;
2518
2519 if (! NILP (XCHAR_TABLE (table)->defalt))
2520 defalt = XCHAR_TABLE (table)->defalt;
2521 val = XCHAR_TABLE (table)->contents[from];
2522 if (SUB_CHAR_TABLE_P (val))
2523 val = char_table_range (val, 32, 127, defalt);
2524 else if (NILP (val))
2525 val = defalt;
2526 for (from++; from <= to; from++)
2527 {
2528 Lisp_Object this_val;
2529
2530 this_val = XCHAR_TABLE (table)->contents[from];
2531 if (SUB_CHAR_TABLE_P (this_val))
2532 this_val = char_table_range (this_val, 32, 127, defalt);
2533 else if (NILP (this_val))
2534 this_val = defalt;
2535 if (! EQ (val, this_val))
2536 error ("Characters in the range have inconsistent values");
2537 }
2538 return val;
2539}
2540
2541
2511DEFUN ("char-table-range", Fchar_table_range, Schar_table_range, 2542DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
2512 2, 2, 0, 2543 2, 2, 0,
2513 doc: /* Return the value in CHAR-TABLE for a range of characters RANGE. 2544 doc: /* Return the value in CHAR-TABLE for a range of characters RANGE.
2514RANGE should be nil (for the default value) 2545RANGE should be nil (for the default value)
2515a vector which identifies a character set or a row of a character set, 2546a vector which identifies a character set or a row of a character set,
2516a character set name, or a character code. */) 2547a character set name, or a character code.
2548If the characters in the specified range have different values,
2549an error is signalled.
2550
2551Note that this function doesn't check the parent of CHAR_TABLE. */)
2517 (char_table, range) 2552 (char_table, range)
2518 Lisp_Object char_table, range; 2553 Lisp_Object char_table, range;
2519{ 2554{
2555 int charset_id, c1 = 0, c2 = 0;
2556 int size, i;
2557 Lisp_Object ch, val, current_default;
2558
2520 CHECK_CHAR_TABLE (char_table); 2559 CHECK_CHAR_TABLE (char_table);
2521 2560
2522 if (EQ (range, Qnil)) 2561 if (EQ (range, Qnil))
2523 return XCHAR_TABLE (char_table)->defalt; 2562 return XCHAR_TABLE (char_table)->defalt;
2524 else if (INTEGERP (range)) 2563 if (INTEGERP (range))
2525 return Faref (char_table, range); 2564 {
2565 int c = XINT (range);
2566 if (! CHAR_VALID_P (c, 0))
2567 error ("Invalid character code: %d", c);
2568 ch = range;
2569 SPLIT_CHAR (c, charset_id, c1, c2);
2570 }
2526 else if (SYMBOLP (range)) 2571 else if (SYMBOLP (range))
2527 { 2572 {
2528 Lisp_Object charset_info; 2573 Lisp_Object charset_info;
2529 2574
2530 charset_info = Fget (range, Qcharset); 2575 charset_info = Fget (range, Qcharset);
2531 CHECK_VECTOR (charset_info); 2576 CHECK_VECTOR (charset_info);
2532 2577 charset_id = XINT (XVECTOR (charset_info)->contents[0]);
2533 return Faref (char_table, 2578 ch = Fmake_char_internal (make_number (charset_id),
2534 make_number (XINT (XVECTOR (charset_info)->contents[0]) 2579 make_number (0), make_number (0));
2535 + 128));
2536 } 2580 }
2537 else if (VECTORP (range)) 2581 else if (VECTORP (range))
2538 { 2582 {
2539 if (XVECTOR (range)->size == 1) 2583 size = ASIZE (range);
2540 return Faref (char_table, 2584 if (size == 0)
2541 make_number (XINT (XVECTOR (range)->contents[0]) + 128)); 2585 args_out_of_range (range, 0);
2542 else 2586 CHECK_NUMBER (AREF (range, 0));
2587 charset_id = XINT (AREF (range, 0));
2588 if (size > 1)
2543 { 2589 {
2544 int size = XVECTOR (range)->size; 2590 CHECK_NUMBER (AREF (range, 1));
2545 Lisp_Object *val = XVECTOR (range)->contents; 2591 c1 = XINT (AREF (range, 1));
2546 Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0], 2592 if (size > 2)
2547 size <= 1 ? Qnil : val[1], 2593 {
2548 size <= 2 ? Qnil : val[2]); 2594 CHECK_NUMBER (AREF (range, 2));
2549 return Faref (char_table, ch); 2595 c2 = XINT (AREF (range, 2));
2596 }
2550 } 2597 }
2598
2599 /* This checks if charset_id, c0, and c1 are all valid or not. */
2600 ch = Fmake_char_internal (make_number (charset_id),
2601 make_number (c1), make_number (c2));
2551 } 2602 }
2552 else 2603 else
2553 error ("Invalid RANGE argument to `char-table-range'"); 2604 error ("Invalid RANGE argument to `char-table-range'");
2554 return Qt; 2605
2606 if (c1 > 0 && (CHARSET_DIMENSION (charset_id) == 1 || c2 > 0))
2607 {
2608 /* Fully specified character. */
2609 Lisp_Object parent = XCHAR_TABLE (char_table)->parent;
2610
2611 XCHAR_TABLE (char_table)->parent = Qnil;
2612 val = Faref (char_table, ch);
2613 XCHAR_TABLE (char_table)->parent = parent;
2614 return val;
2615 }
2616
2617 current_default = XCHAR_TABLE (char_table)->defalt;
2618 if (charset_id == CHARSET_ASCII
2619 || charset_id == CHARSET_8_BIT_CONTROL
2620 || charset_id == CHARSET_8_BIT_GRAPHIC)
2621 {
2622 int from, to, defalt;
2623
2624 if (charset_id == CHARSET_ASCII)
2625 from = 0, to = 127, defalt = CHAR_TABLE_DEFAULT_SLOT_ASCII;
2626 else if (charset_id == CHARSET_8_BIT_CONTROL)
2627 from = 128, to = 159, defalt = CHAR_TABLE_DEFAULT_SLOT_8_BIT_CONTROL;
2628 else
2629 from = 160, to = 255, defalt = CHAR_TABLE_DEFAULT_SLOT_8_BIT_GRAPHIC;
2630 if (! NILP (XCHAR_TABLE (char_table)->contents[defalt]))
2631 current_default = XCHAR_TABLE (char_table)->contents[defalt];
2632 return char_table_range (char_table, from, to, current_default);
2633 }
2634
2635 val = XCHAR_TABLE (char_table)->contents[128 + charset_id];
2636 if (! SUB_CHAR_TABLE_P (val))
2637 return (NILP (val) ? current_default : val);
2638 if (! NILP (XCHAR_TABLE (val)->defalt))
2639 current_default = XCHAR_TABLE (val)->defalt;
2640 if (c1 == 0)
2641 return char_table_range (val, 32, 127, current_default);
2642 val = XCHAR_TABLE (val)->contents[c1];
2643 if (! SUB_CHAR_TABLE_P (val))
2644 return (NILP (val) ? current_default : val);
2645 if (! NILP (XCHAR_TABLE (val)->defalt))
2646 current_default = XCHAR_TABLE (val)->defalt;
2647 return char_table_range (val, 32, 127, current_default);
2555} 2648}
2556 2649
2557DEFUN ("set-char-table-range", Fset_char_table_range, Sset_char_table_range, 2650DEFUN ("set-char-table-range", Fset_char_table_range, Sset_char_table_range,
diff --git a/src/fontset.c b/src/fontset.c
index ee6ef213af7..8d4507530fa 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -356,7 +356,7 @@ fontset_set (fontset, c, newelt)
356 if (!SUB_CHAR_TABLE_P (*elt)) 356 if (!SUB_CHAR_TABLE_P (*elt))
357 { 357 {
358 Lisp_Object val = *elt; 358 Lisp_Object val = *elt;
359 *elt = make_sub_char_table (val); 359 *elt = make_sub_char_table (Qnil);
360 XCHAR_TABLE (*elt)->defalt = val; 360 XCHAR_TABLE (*elt)->defalt = val;
361 } 361 }
362 elt = &XCHAR_TABLE (*elt)->contents[code[i]]; 362 elt = &XCHAR_TABLE (*elt)->contents[code[i]];