comparison src/keymap.c @ 8866:48a0ea73a9d7

(Fkey_description): Give error if KEYS not an array. (get_keyelt, access_keymap, get_keymap_1): Use type test macros.
author Richard M. Stallman <rms@gnu.org>
date Sun, 18 Sep 1994 04:02:25 +0000
parents 7ebb77d4aff2
children 67b7eb875a1e
comparison
equal deleted inserted replaced
8865:3fe65c32616b 8866:48a0ea73a9d7
212 return tem; 212 return tem;
213 213
214 /* Should we do an autoload? Autoload forms for keymaps have 214 /* Should we do an autoload? Autoload forms for keymaps have
215 Qkeymap as their fifth element. */ 215 Qkeymap as their fifth element. */
216 if (autoload 216 if (autoload
217 && XTYPE (object) == Lisp_Symbol 217 && SYMBOLP (object)
218 && CONSP (tem) 218 && CONSP (tem)
219 && EQ (XCONS (tem)->car, Qautoload)) 219 && EQ (XCONS (tem)->car, Qautoload))
220 { 220 {
221 Lisp_Object tail; 221 Lisp_Object tail;
222 222
277 ought to be a symbol. */ 277 ought to be a symbol. */
278 idx = EVENT_HEAD (idx); 278 idx = EVENT_HEAD (idx);
279 279
280 /* If idx is a symbol, it might have modifiers, which need to 280 /* If idx is a symbol, it might have modifiers, which need to
281 be put in the canonical order. */ 281 be put in the canonical order. */
282 if (XTYPE (idx) == Lisp_Symbol) 282 if (SYMBOLP (idx))
283 idx = reorder_modifiers (idx); 283 idx = reorder_modifiers (idx);
284 else if (INTEGERP (idx)) 284 else if (INTEGERP (idx))
285 /* Clobber the high bits that can be present on a machine 285 /* Clobber the high bits that can be present on a machine
286 with more than 24 bits of integer. */ 286 with more than 24 bits of integer. */
287 XFASTINT (idx) = XINT (idx) & (CHAR_META | (CHAR_META - 1)); 287 XFASTINT (idx) = XINT (idx) & (CHAR_META | (CHAR_META - 1));
316 if (t_ok && EQ (XCONS (binding)->car, Qt)) 316 if (t_ok && EQ (XCONS (binding)->car, Qt))
317 t_binding = XCONS (binding)->cdr; 317 t_binding = XCONS (binding)->cdr;
318 break; 318 break;
319 319
320 case Lisp_Vector: 320 case Lisp_Vector:
321 if (XTYPE (idx) == Lisp_Int 321 if (INTEGERP (idx)
322 && XINT (idx) >= 0 322 && XINT (idx) >= 0
323 && XINT (idx) < XVECTOR (binding)->size) 323 && XINT (idx) < XVECTOR (binding)->size)
324 { 324 {
325 val = XVECTOR (binding)->contents[XINT (idx)]; 325 val = XVECTOR (binding)->contents[XINT (idx)];
326 if (noprefix && CONSP (val) && EQ (XCONS (val)->car, Qkeymap)) 326 if (noprefix && CONSP (val) && EQ (XCONS (val)->car, Qkeymap))
366 366
367 /* If the keymap contents looks like (STRING . DEFN), 367 /* If the keymap contents looks like (STRING . DEFN),
368 use DEFN. 368 use DEFN.
369 Keymap alist elements like (CHAR MENUSTRING . DEFN) 369 Keymap alist elements like (CHAR MENUSTRING . DEFN)
370 will be used by HierarKey menus. */ 370 will be used by HierarKey menus. */
371 else if (XTYPE (object) == Lisp_Cons 371 else if (CONSP (object)
372 && XTYPE (XCONS (object)->car) == Lisp_String) 372 && STRINGP (XCONS (object)->car))
373 { 373 {
374 object = XCONS (object)->cdr; 374 object = XCONS (object)->cdr;
375 /* Also remove a menu help string, if any, 375 /* Also remove a menu help string, if any,
376 following the menu item name. */ 376 following the menu item name. */
377 if (XTYPE (object) == Lisp_Cons 377 if (XTYPE (object) == Lisp_Cons
378 && XTYPE (XCONS (object)->car) == Lisp_String) 378 && STRINGP (XCONS (object)->car) == Lisp_String)
379 object = XCONS (object)->cdr; 379 object = XCONS (object)->cdr;
380 /* Also remove the sublist that caches key equivalences, if any. */ 380 /* Also remove the sublist that caches key equivalences, if any. */
381 if (CONSP (object) 381 if (CONSP (object)
382 && CONSP (XCONS (object)->car)) 382 && CONSP (XCONS (object)->car))
383 { 383 {
1349 int len; 1349 int len;
1350 int i; 1350 int i;
1351 Lisp_Object sep; 1351 Lisp_Object sep;
1352 Lisp_Object *args; 1352 Lisp_Object *args;
1353 1353
1354 if (XTYPE (keys) == Lisp_String) 1354 if (STRINGP (keys))
1355 { 1355 {
1356 Lisp_Object vector; 1356 Lisp_Object vector;
1357 vector = Fmake_vector (Flength (keys), Qnil); 1357 vector = Fmake_vector (Flength (keys), Qnil);
1358 for (i = 0; i < XSTRING (keys)->size; i++) 1358 for (i = 0; i < XSTRING (keys)->size; i++)
1359 { 1359 {
1364 XFASTINT (XVECTOR (vector)->contents[i]) 1364 XFASTINT (XVECTOR (vector)->contents[i])
1365 = XSTRING (keys)->data[i]; 1365 = XSTRING (keys)->data[i];
1366 } 1366 }
1367 keys = vector; 1367 keys = vector;
1368 } 1368 }
1369 else if (VECTORP (keys))
1370 keys = wrong_type_argument (Qarrayp, keys);
1369 1371
1370 /* In effect, this computes 1372 /* In effect, this computes
1371 (mapconcat 'single-key-description keys " ") 1373 (mapconcat 'single-key-description keys " ")
1372 but we shouldn't use mapconcat because it can do GC. */ 1374 but we shouldn't use mapconcat because it can do GC. */
1373 1375