2666 |
|
|
2667 |
/* This is the function that Fwhere_is_internal calls using map_char_table. |
/* This is the function that Fwhere_is_internal calls using map_char_table. |
2668 |
ARGS has the form |
ARGS has the form |
2669 |
(((DEFINITION . NOINDIRECT) . (KEYMAP . RESULT)) |
(((DEFINITION . NOINDIRECT) . RESULT) |
2670 |
. |
. |
2671 |
((THIS . LAST) . (NOMENUS . LAST_IS_META))) |
((THIS . LAST) . (NOMENUS . LAST_IS_META))) |
2672 |
Since map_char_table doesn't really use the return value from this function, |
Since map_char_table doesn't really use the return value from this function, |
2673 |
we the result append to RESULT, the slot in ARGS. |
we the result append to RESULT, the slot in ARGS. |
2674 |
|
|
2675 |
|
KEY may be a cons (FROM . TO) where both FROM and TO are integers |
2676 |
|
(i.e. character events). |
2677 |
|
|
2678 |
This function can GC because it calls where_is_internal_1 which can |
This function can GC because it calls where_is_internal_1 which can |
2679 |
GC. */ |
GC. */ |
2680 |
|
|
2688 |
struct gcpro gcpro1, gcpro2, gcpro3; |
struct gcpro gcpro1, gcpro2, gcpro3; |
2689 |
|
|
2690 |
GCPRO3 (args, key, binding); |
GCPRO3 (args, key, binding); |
|
result = XCDR (XCAR (args)); |
|
2691 |
definition = XCAR (XCAR (XCAR (args))); |
definition = XCAR (XCAR (XCAR (args))); |
2692 |
noindirect = XCDR (XCAR (XCAR (args))); |
noindirect = XCDR (XCAR (XCAR (args))); |
2693 |
this = XCAR (XCAR (XCDR (args))); |
this = XCAR (XCAR (XCDR (args))); |
2695 |
nomenus = XFASTINT (XCAR (XCDR (XCDR (args)))); |
nomenus = XFASTINT (XCAR (XCDR (XCDR (args)))); |
2696 |
last_is_meta = XFASTINT (XCDR (XCDR (XCDR (args)))); |
last_is_meta = XFASTINT (XCDR (XCDR (XCDR (args)))); |
2697 |
|
|
2698 |
sequence = where_is_internal_1 (binding, key, definition, noindirect, |
result = Qnil; |
2699 |
this, last, nomenus, last_is_meta); |
if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key))) |
2700 |
|
{ |
2701 |
|
/* Try all ASCII characters. Try also non-ASCII characters but |
2702 |
|
only the first and last one because trying all of them is |
2703 |
|
extremely memory and time consuming. |
2704 |
|
|
2705 |
|
Fixme: Perhaps it should be allowed to store a cons directly |
2706 |
|
in RESULT. -- handa@m17n.org */ |
2707 |
|
int from = XINT (XCAR (key)), to = XINT (XCDR (key)); |
2708 |
|
Lisp_Object k; |
2709 |
|
|
2710 |
|
for (; from <= to; from++) |
2711 |
|
{ |
2712 |
|
k = make_number (from); |
2713 |
|
sequence = where_is_internal_1 (binding, k, definition, noindirect, |
2714 |
|
this, last, nomenus, last_is_meta); |
2715 |
|
if (!NILP (sequence)) |
2716 |
|
result = Fcons (sequence, result); |
2717 |
|
if (from >= 128 && from < to) |
2718 |
|
from = to - 1; |
2719 |
|
} |
2720 |
|
result = Fnreverse (result); |
2721 |
|
} |
2722 |
|
else |
2723 |
|
{ |
2724 |
|
sequence = where_is_internal_1 (binding, key, definition, noindirect, |
2725 |
|
this, last, nomenus, last_is_meta); |
2726 |
|
if (!NILP (sequence)) |
2727 |
|
result = Fcons (sequence, Qnil); |
2728 |
|
} |
2729 |
|
|
2730 |
if (!NILP (sequence)) |
if (! NILP (result)) |
2731 |
XSETCDR (XCAR (args), Fcons (sequence, result)); |
nconc2 (XCAR (args), result); |
2732 |
|
|
2733 |
UNGCPRO; |
UNGCPRO; |
2734 |
} |
} |