diff options
| author | Kenichi Handa | 1997-04-07 07:12:13 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-04-07 07:12:13 +0000 |
| commit | a1942d88594c7f2fa188077de4ef9f33a41a4437 (patch) | |
| tree | 1d3ac844be891cf4e6f4ff582c902add209af953 /src | |
| parent | ea724a01827c263afb64e8b627da6b005757518d (diff) | |
| download | emacs-a1942d88594c7f2fa188077de4ef9f33a41a4437.tar.gz emacs-a1942d88594c7f2fa188077de4ef9f33a41a4437.zip | |
(describe_vector): Adjusted for the new structure of Lisp_Char_Table.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keymap.c | 102 |
1 files changed, 65 insertions, 37 deletions
diff --git a/src/keymap.c b/src/keymap.c index 536b27dae7e..b860b7565a3 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2552,7 +2552,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2552 | /* Prepare for handling a nested char-table. */ | 2552 | /* Prepare for handling a nested char-table. */ |
| 2553 | if (NILP (elt_prefix)) | 2553 | if (NILP (elt_prefix)) |
| 2554 | { | 2554 | { |
| 2555 | /* VECTOR is the top level of char-table. */ | 2555 | /* VECTOR is a top level char-table. */ |
| 2556 | this_level = 0; | 2556 | this_level = 0; |
| 2557 | complete_char = 0; | 2557 | complete_char = 0; |
| 2558 | from = 0; | 2558 | from = 0; |
| @@ -2560,11 +2560,11 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2560 | } | 2560 | } |
| 2561 | else | 2561 | else |
| 2562 | { | 2562 | { |
| 2563 | /* VECTOR is the deeper level of char-table. */ | 2563 | /* VECTOR is a sub char-table. */ |
| 2564 | this_level = XVECTOR (elt_prefix)->size; | 2564 | this_level = XVECTOR (elt_prefix)->size; |
| 2565 | if (this_level >= 3) | 2565 | if (this_level >= 3) |
| 2566 | /* A char-table is not that deep. */ | 2566 | /* A char-table is not that deep. */ |
| 2567 | wrong_type_argument (Qchar_table_p, vector); | 2567 | error ("Too deep char table"); |
| 2568 | 2568 | ||
| 2569 | /* For multibyte characters, the top level index for | 2569 | /* For multibyte characters, the top level index for |
| 2570 | charsets starts from 256. */ | 2570 | charsets starts from 256. */ |
| @@ -2578,7 +2578,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2578 | 2578 | ||
| 2579 | /* Meaningful elements are from 32th to 127th. */ | 2579 | /* Meaningful elements are from 32th to 127th. */ |
| 2580 | from = 32; | 2580 | from = 32; |
| 2581 | to = 128; | 2581 | to = SUB_CHAR_TABLE_ORDINARY_SLOTS; |
| 2582 | } | 2582 | } |
| 2583 | chartable_kludge = Fmake_vector (make_number (this_level + 1), Qnil); | 2583 | chartable_kludge = Fmake_vector (make_number (this_level + 1), Qnil); |
| 2584 | if (this_level != 0) | 2584 | if (this_level != 0) |
| @@ -2599,13 +2599,16 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2599 | { | 2599 | { |
| 2600 | QUIT; | 2600 | QUIT; |
| 2601 | 2601 | ||
| 2602 | if (this_level == 0 | 2602 | if (CHAR_TABLE_P (vector)) |
| 2603 | && i >= CHAR_TABLE_SINGLE_BYTE_SLOTS | 2603 | { |
| 2604 | && !CHARSET_DEFINED_P (i - 128)) | 2604 | if (i >= CHAR_TABLE_SINGLE_BYTE_SLOTS |
| 2605 | continue; | 2605 | && !CHARSET_DEFINED_P (i - 128)) |
| 2606 | 2606 | continue; | |
| 2607 | definition = get_keyelt (XVECTOR (vector)->contents[i], 0); | 2607 | definition = get_keyelt (XCHAR_TABLE (vector)->contents[i]); |
| 2608 | if (NILP (definition)) continue; | 2608 | if (NILP (definition)) continue; |
| 2609 | } | ||
| 2610 | else | ||
| 2611 | definition = get_keyelt (XVECTOR (vector)->contents[i], 0); | ||
| 2609 | 2612 | ||
| 2610 | /* Don't mention suppressed commands. */ | 2613 | /* Don't mention suppressed commands. */ |
| 2611 | if (SYMBOLP (definition) && partial) | 2614 | if (SYMBOLP (definition) && partial) |
| @@ -2648,7 +2651,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2648 | first = 0; | 2651 | first = 0; |
| 2649 | } | 2652 | } |
| 2650 | 2653 | ||
| 2651 | /* If VECTOR is a deeper char-table, show the depth by indentation. | 2654 | /* If VECTOR is a sub char-table, show the depth by indentation. |
| 2652 | THIS_LEVEL can be greater than 0 only for char-table. */ | 2655 | THIS_LEVEL can be greater than 0 only for char-table. */ |
| 2653 | if (this_level > 0) | 2656 | if (this_level > 0) |
| 2654 | insert (" ", this_level * 2); /* THIS_LEVEL is 1 or 2. */ | 2657 | insert (" ", this_level * 2); /* THIS_LEVEL is 1 or 2. */ |
| @@ -2656,7 +2659,23 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2656 | /* Get a Lisp object for the character I. */ | 2659 | /* Get a Lisp object for the character I. */ |
| 2657 | XSETFASTINT (dummy, i); | 2660 | XSETFASTINT (dummy, i); |
| 2658 | 2661 | ||
| 2659 | if (CHAR_TABLE_P (vector)) | 2662 | if (this_level == 0 && CHAR_TABLE_P (vector)) |
| 2663 | { | ||
| 2664 | if (i < CHAR_TABLE_SINGLE_BYTE_SLOTS) | ||
| 2665 | insert1 (Fsingle_key_description (dummy)); | ||
| 2666 | else | ||
| 2667 | { | ||
| 2668 | /* Print the information for this character set. */ | ||
| 2669 | insert_string ("<"); | ||
| 2670 | tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX); | ||
| 2671 | if (STRINGP (tem2)) | ||
| 2672 | insert_from_string (tem2, 0 , XSTRING (tem2)->size, 0); | ||
| 2673 | else | ||
| 2674 | insert ("?", 1); | ||
| 2675 | insert (">", 1); | ||
| 2676 | } | ||
| 2677 | } | ||
| 2678 | else if (this_level > 0 && SUB_CHAR_TABLE_P (vector)) | ||
| 2660 | { | 2679 | { |
| 2661 | if (complete_char) | 2680 | if (complete_char) |
| 2662 | { | 2681 | { |
| @@ -2665,15 +2684,14 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2665 | idx[this_level] = i; | 2684 | idx[this_level] = i; |
| 2666 | insert_char (MAKE_NON_ASCII_CHAR (idx[0], idx[1], idx[2])); | 2685 | insert_char (MAKE_NON_ASCII_CHAR (idx[0], idx[1], idx[2])); |
| 2667 | } | 2686 | } |
| 2668 | else if (this_level > 0) | 2687 | else |
| 2669 | { | 2688 | { |
| 2670 | /* We need an octal representation. */ | 2689 | /* We need an octal representation for this block of |
| 2690 | characters. */ | ||
| 2671 | char work[5]; | 2691 | char work[5]; |
| 2672 | sprintf (work, "\\%03o", i & 255); | 2692 | sprintf (work, "\\%03o", i & 255); |
| 2673 | insert (work, 4); | 2693 | insert (work, 4); |
| 2674 | } | 2694 | } |
| 2675 | else | ||
| 2676 | insert1 (Fsingle_key_description (dummy)); | ||
| 2677 | } | 2695 | } |
| 2678 | else | 2696 | else |
| 2679 | { | 2697 | { |
| @@ -2685,22 +2703,11 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2685 | insert1 (Fsingle_key_description (dummy)); | 2703 | insert1 (Fsingle_key_description (dummy)); |
| 2686 | } | 2704 | } |
| 2687 | 2705 | ||
| 2688 | /* If we find a char-table within a char-table, | 2706 | /* If we find a sub char-table within a char-table, |
| 2689 | scan it recursively; it defines the details for | 2707 | scan it recursively; it defines the details for |
| 2690 | a character set or a portion of a character set. */ | 2708 | a character set or a portion of a character set. */ |
| 2691 | if (multibyte && CHAR_TABLE_P (vector) && CHAR_TABLE_P (definition)) | 2709 | if (multibyte && CHAR_TABLE_P (vector) && SUB_CHAR_TABLE_P (definition)) |
| 2692 | { | 2710 | { |
| 2693 | if (this_level == 0 | ||
| 2694 | && CHARSET_VALID_P (i - 128)) | ||
| 2695 | { | ||
| 2696 | /* Before scanning the deeper table, print the | ||
| 2697 | information for this character set. */ | ||
| 2698 | insert_string ("\t\t<charset:"); | ||
| 2699 | tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX); | ||
| 2700 | insert_from_string (tem2, 0 , XSTRING (tem2)->size, 0); | ||
| 2701 | insert (">", 1); | ||
| 2702 | } | ||
| 2703 | |||
| 2704 | insert ("\n", 1); | 2711 | insert ("\n", 1); |
| 2705 | XVECTOR (chartable_kludge)->contents[this_level] = make_number (i); | 2712 | XVECTOR (chartable_kludge)->contents[this_level] = make_number (i); |
| 2706 | describe_vector (definition, chartable_kludge, elt_describer, | 2713 | describe_vector (definition, chartable_kludge, elt_describer, |
| @@ -2708,12 +2715,33 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2708 | continue; | 2715 | continue; |
| 2709 | } | 2716 | } |
| 2710 | 2717 | ||
| 2711 | /* Find all consecutive characters that have the same definition. */ | 2718 | /* Find all consecutive characters that have the same |
| 2712 | while (i + 1 < to | 2719 | definition. But, for elements of a top level char table, if |
| 2713 | && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1], 0), | 2720 | they are for charsets, we had better describe one by one even |
| 2714 | !NILP (tem2)) | 2721 | if they have the same definition. */ |
| 2715 | && !NILP (Fequal (tem2, definition))) | 2722 | if (CHAR_TABLE_P (vector)) |
| 2716 | i++; | 2723 | { |
| 2724 | if (this_level == 0) | ||
| 2725 | while (i + 1 < CHAR_TABLE_SINGLE_BYTE_SLOTS | ||
| 2726 | && (tem2 | ||
| 2727 | = get_keyelt (XCHAR_TABLE (vector)->contents[i + 1], 0), | ||
| 2728 | !NILP (tem2)) | ||
| 2729 | && !NILP (Fequal (tem2, definition))) | ||
| 2730 | i++; | ||
| 2731 | else | ||
| 2732 | while (i + 1 < to | ||
| 2733 | && (tem2 = get_keyelt (XCHAR_TABLE (vector)->contents[i + 1], 0), | ||
| 2734 | !NILP (tem2)) | ||
| 2735 | && !NILP (Fequal (tem2, definition))) | ||
| 2736 | i++; | ||
| 2737 | } | ||
| 2738 | else | ||
| 2739 | while (i + 1 < CHAR_TABLE_SINGLE_BYTE_SLOTS | ||
| 2740 | && (tem2 = get_keyelt (XVECTOR (vector)->contents[i + 1], 0), | ||
| 2741 | !NILP (tem2)) | ||
| 2742 | && !NILP (Fequal (tem2, definition))) | ||
| 2743 | i++; | ||
| 2744 | |||
| 2717 | 2745 | ||
| 2718 | /* If we have a range of more than one character, | 2746 | /* If we have a range of more than one character, |
| 2719 | print where the range reaches to. */ | 2747 | print where the range reaches to. */ |
| @@ -2756,7 +2784,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 2756 | (*elt_describer) (definition); | 2784 | (*elt_describer) (definition); |
| 2757 | } | 2785 | } |
| 2758 | 2786 | ||
| 2759 | /* For char-table, print `defalt' slot at last. */ | 2787 | /* For (sub) char-table, print `defalt' slot at last. */ |
| 2760 | if (CHAR_TABLE_P (vector) && !NILP (XCHAR_TABLE (vector)->defalt)) | 2788 | if (CHAR_TABLE_P (vector) && !NILP (XCHAR_TABLE (vector)->defalt)) |
| 2761 | { | 2789 | { |
| 2762 | insert (" ", this_level * 2); | 2790 | insert (" ", this_level * 2); |