comparison src/keymap.c @ 241:f955c73f5258 r20-5b19

Import from CVS: tag r20-5b19
author cvs
date Mon, 13 Aug 2007 10:16:16 +0200
parents 262b8bb4a523
children 51092a27c943
comparison
equal deleted inserted replaced
240:835e739f3c17 241:f955c73f5258
679 struct keymap_submaps_closure 679 struct keymap_submaps_closure
680 { 680 {
681 Lisp_Object *result_locative; 681 Lisp_Object *result_locative;
682 }; 682 };
683 683
684 static void 684 static int
685 keymap_submaps_mapper_0 (CONST void *hash_key, void *hash_contents, 685 keymap_submaps_mapper_0 (CONST void *hash_key, void *hash_contents,
686 void *keymap_submaps_closure) 686 void *keymap_submaps_closure)
687 { 687 {
688 /* This function can GC */ 688 /* This function can GC */
689 Lisp_Object contents; 689 Lisp_Object contents;
690 VOID_TO_LISP (contents, hash_contents); 690 VOID_TO_LISP (contents, hash_contents);
691 /* Perform any autoloads, etc */ 691 /* Perform any autoloads, etc */
692 Fkeymapp (contents); 692 Fkeymapp (contents);
693 } 693 return 0;
694 694 }
695 static void 695
696 static int
696 keymap_submaps_mapper (CONST void *hash_key, void *hash_contents, 697 keymap_submaps_mapper (CONST void *hash_key, void *hash_contents,
697 void *keymap_submaps_closure) 698 void *keymap_submaps_closure)
698 { 699 {
699 /* This function can GC */ 700 /* This function can GC */
700 Lisp_Object key, contents; 701 Lisp_Object key, contents;
705 VOID_TO_LISP (contents, hash_contents); 706 VOID_TO_LISP (contents, hash_contents);
706 result_locative = cl->result_locative; 707 result_locative = cl->result_locative;
707 708
708 if (!NILP (Fkeymapp (contents))) 709 if (!NILP (Fkeymapp (contents)))
709 *result_locative = Fcons (Fcons (key, contents), *result_locative); 710 *result_locative = Fcons (Fcons (key, contents), *result_locative);
711 return 0;
710 } 712 }
711 713
712 static int map_keymap_sort_predicate (Lisp_Object obj1, Lisp_Object obj2, 714 static int map_keymap_sort_predicate (Lisp_Object obj1, Lisp_Object obj2,
713 Lisp_Object pred); 715 Lisp_Object pred);
714 716
1108 struct copy_keymap_inverse_closure 1110 struct copy_keymap_inverse_closure
1109 { 1111 {
1110 Lisp_Object inverse_table; 1112 Lisp_Object inverse_table;
1111 }; 1113 };
1112 1114
1113 static void 1115 static int
1114 copy_keymap_inverse_mapper (CONST void *hash_key, void *hash_contents, 1116 copy_keymap_inverse_mapper (CONST void *hash_key, void *hash_contents,
1115 void *copy_keymap_inverse_closure) 1117 void *copy_keymap_inverse_closure)
1116 { 1118 {
1117 Lisp_Object key, inverse_table, inverse_contents; 1119 Lisp_Object key, inverse_table, inverse_contents;
1118 struct copy_keymap_inverse_closure *closure = 1120 struct copy_keymap_inverse_closure *closure =
1123 CVOID_TO_LISP (key, hash_key); 1125 CVOID_TO_LISP (key, hash_key);
1124 /* copy-sequence deals with dotted lists. */ 1126 /* copy-sequence deals with dotted lists. */
1125 if (CONSP (inverse_contents)) 1127 if (CONSP (inverse_contents))
1126 inverse_contents = Fcopy_sequence (inverse_contents); 1128 inverse_contents = Fcopy_sequence (inverse_contents);
1127 Fputhash (key, inverse_contents, closure->inverse_table); 1129 Fputhash (key, inverse_contents, closure->inverse_table);
1130
1131 return 0;
1128 } 1132 }
1129 1133
1130 1134
1131 static Lisp_Object 1135 static Lisp_Object
1132 copy_keymap_internal (struct keymap *keymap) 1136 copy_keymap_internal (struct keymap *keymap)
1155 struct copy_keymap_closure 1159 struct copy_keymap_closure
1156 { 1160 {
1157 struct keymap *self; 1161 struct keymap *self;
1158 }; 1162 };
1159 1163
1160 static void 1164 static int
1161 copy_keymap_mapper (CONST void *hash_key, void *hash_contents, 1165 copy_keymap_mapper (CONST void *hash_key, void *hash_contents,
1162 void *copy_keymap_closure) 1166 void *copy_keymap_closure)
1163 { 1167 {
1164 /* This function can GC */ 1168 /* This function can GC */
1165 Lisp_Object key, contents; 1169 Lisp_Object key, contents;
1176 contents = get_keymap (contents, 1180 contents = get_keymap (contents,
1177 0, 1); /* #### autoload GC-safe here? */ 1181 0, 1); /* #### autoload GC-safe here? */
1178 if (KEYMAPP (contents)) 1182 if (KEYMAPP (contents))
1179 keymap_store_internal (key, closure->self, 1183 keymap_store_internal (key, closure->self,
1180 copy_keymap (contents)); 1184 copy_keymap (contents));
1185 return 0;
1181 } 1186 }
1182 1187
1183 static Lisp_Object 1188 static Lisp_Object
1184 copy_keymap (Lisp_Object keymap) 1189 copy_keymap (Lisp_Object keymap)
1185 { 1190 {
2763 void *arg; 2768 void *arg;
2764 unsigned int modifiers; 2769 unsigned int modifiers;
2765 }; 2770 };
2766 2771
2767 /* used by map_keymap() */ 2772 /* used by map_keymap() */
2768 static void 2773 static int
2769 map_keymap_unsorted_mapper (CONST void *hash_key, void *hash_contents, 2774 map_keymap_unsorted_mapper (CONST void *hash_key, void *hash_contents,
2770 void *map_keymap_unsorted_closure) 2775 void *map_keymap_unsorted_closure)
2771 { 2776 {
2772 /* This function can GC */ 2777 /* This function can GC */
2773 Lisp_Object keysym; 2778 Lisp_Object keysym;
2794 struct key_data key; 2799 struct key_data key;
2795 key.keysym = keysym; 2800 key.keysym = keysym;
2796 key.modifiers = modifiers; 2801 key.modifiers = modifiers;
2797 ((*closure->fn) (&key, contents, closure->arg)); 2802 ((*closure->fn) (&key, contents, closure->arg));
2798 } 2803 }
2804 return 0;
2799 } 2805 }
2800 2806
2801 2807
2802 struct map_keymap_sorted_closure 2808 struct map_keymap_sorted_closure
2803 { 2809 {
2804 Lisp_Object *result_locative; 2810 Lisp_Object *result_locative;
2805 }; 2811 };
2806 2812
2807 /* used by map_keymap_sorted() */ 2813 /* used by map_keymap_sorted() */
2808 static void 2814 static int
2809 map_keymap_sorted_mapper (CONST void *hash_key, void *hash_contents, 2815 map_keymap_sorted_mapper (CONST void *hash_key, void *hash_contents,
2810 void *map_keymap_sorted_closure) 2816 void *map_keymap_sorted_closure)
2811 { 2817 {
2812 struct map_keymap_sorted_closure *cl = 2818 struct map_keymap_sorted_closure *cl =
2813 (struct map_keymap_sorted_closure *) map_keymap_sorted_closure; 2819 (struct map_keymap_sorted_closure *) map_keymap_sorted_closure;
2814 Lisp_Object key, contents; 2820 Lisp_Object key, contents;
2815 Lisp_Object *list = cl->result_locative; 2821 Lisp_Object *list = cl->result_locative;
2816 CVOID_TO_LISP (key, hash_key); 2822 CVOID_TO_LISP (key, hash_key);
2817 VOID_TO_LISP (contents, hash_contents); 2823 VOID_TO_LISP (contents, hash_contents);
2818 *list = Fcons (Fcons (key, contents), *list); 2824 *list = Fcons (Fcons (key, contents), *list);
2825 return 0;
2819 } 2826 }
2820 2827
2821 2828
2822 /* used by map_keymap_sorted(), describe_map_sort_predicate(), 2829 /* used by map_keymap_sorted(), describe_map_sort_predicate(),
2823 and keymap_submaps(). 2830 and keymap_submaps().