diff options
| author | Richard M. Stallman | 2003-05-17 12:45:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-05-17 12:45:52 +0000 |
| commit | 44356f63a3addda5adbb841cacc6b23d529c39fa (patch) | |
| tree | 7d73449e68def64529a8944cda723bd34162ecc3 /src | |
| parent | e0c04065bdadbdfd94f9d6c6f05f25d7ae153197 (diff) | |
| download | emacs-44356f63a3addda5adbb841cacc6b23d529c39fa.tar.gz emacs-44356f63a3addda5adbb841cacc6b23d529c39fa.zip | |
(map_char_table): New arg TABLE gets the master table. All calls changed.
Process default and inheritance, resorting to Faref if necessary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 16 |
1 files changed, 11 insertions, 5 deletions
| @@ -2634,9 +2634,9 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, | |||
| 2634 | ARG is passed to C_FUNCTION when that is called. */ | 2634 | ARG is passed to C_FUNCTION when that is called. */ |
| 2635 | 2635 | ||
| 2636 | void | 2636 | void |
| 2637 | map_char_table (c_function, function, subtable, arg, depth, indices) | 2637 | map_char_table (c_function, function, table, subtable, arg, depth, indices) |
| 2638 | void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 2638 | void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
| 2639 | Lisp_Object function, subtable, arg, *indices; | 2639 | Lisp_Object function, table, subtable, arg, *indices; |
| 2640 | int depth; | 2640 | int depth; |
| 2641 | { | 2641 | { |
| 2642 | int i, to; | 2642 | int i, to; |
| @@ -2646,7 +2646,11 @@ map_char_table (c_function, function, subtable, arg, depth, indices) | |||
| 2646 | /* At first, handle ASCII and 8-bit European characters. */ | 2646 | /* At first, handle ASCII and 8-bit European characters. */ |
| 2647 | for (i = 0; i < CHAR_TABLE_SINGLE_BYTE_SLOTS; i++) | 2647 | for (i = 0; i < CHAR_TABLE_SINGLE_BYTE_SLOTS; i++) |
| 2648 | { | 2648 | { |
| 2649 | Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i]; | 2649 | Lisp_Object elt= XCHAR_TABLE (subtable)->contents[i]; |
| 2650 | if (NILP (elt)) | ||
| 2651 | elt = XCHAR_TABLE (subtable)->defalt; | ||
| 2652 | if (NILP (elt)) | ||
| 2653 | elt = Faref (subtable, make_number (i)); | ||
| 2650 | if (c_function) | 2654 | if (c_function) |
| 2651 | (*c_function) (arg, make_number (i), elt); | 2655 | (*c_function) (arg, make_number (i), elt); |
| 2652 | else | 2656 | else |
| @@ -2687,7 +2691,7 @@ map_char_table (c_function, function, subtable, arg, depth, indices) | |||
| 2687 | { | 2691 | { |
| 2688 | if (depth >= 3) | 2692 | if (depth >= 3) |
| 2689 | error ("Too deep char table"); | 2693 | error ("Too deep char table"); |
| 2690 | map_char_table (c_function, function, elt, arg, depth + 1, indices); | 2694 | map_char_table (c_function, function, table, elt, arg, depth + 1, indices); |
| 2691 | } | 2695 | } |
| 2692 | else | 2696 | else |
| 2693 | { | 2697 | { |
| @@ -2695,6 +2699,8 @@ map_char_table (c_function, function, subtable, arg, depth, indices) | |||
| 2695 | 2699 | ||
| 2696 | if (NILP (elt)) | 2700 | if (NILP (elt)) |
| 2697 | elt = XCHAR_TABLE (subtable)->defalt; | 2701 | elt = XCHAR_TABLE (subtable)->defalt; |
| 2702 | if (NILP (elt)) | ||
| 2703 | elt = Faref (table, make_number (i)); | ||
| 2698 | c1 = depth >= 1 ? XFASTINT (indices[1]) : 0; | 2704 | c1 = depth >= 1 ? XFASTINT (indices[1]) : 0; |
| 2699 | c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; | 2705 | c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; |
| 2700 | c = MAKE_CHAR (charset, c1, c2); | 2706 | c = MAKE_CHAR (charset, c1, c2); |
| @@ -2731,7 +2737,7 @@ The key is always a possible IDX argument to `aref'. */) | |||
| 2731 | be passed to map_char_table because it returns a Lisp_Object rather | 2737 | be passed to map_char_table because it returns a Lisp_Object rather |
| 2732 | than returning nothing. | 2738 | than returning nothing. |
| 2733 | Casting leads to crashes on some architectures. -stef */ | 2739 | Casting leads to crashes on some architectures. -stef */ |
| 2734 | map_char_table (void_call2, Qnil, char_table, function, 0, indices); | 2740 | map_char_table (void_call2, Qnil, char_table, char_table, function, 0, indices); |
| 2735 | return Qnil; | 2741 | return Qnil; |
| 2736 | } | 2742 | } |
| 2737 | 2743 | ||