comparison src/keymap.c @ 3025:facf3239ba30

[xemacs-hg @ 2005-10-25 11:16:19 by ben] rename new->new_, convert 'foo to `foo' EmacsFrame.c, ExternalClient.c, ExternalShell.c, chartab.c, cmdloop.c, compiler.h, console.c, database.c, device-msw.c, device-x.c, device.c, doc.c, dragdrop.c, eval.c, event-msw.c, event-stream.c, events.c, extents.c, file-coding.c, fns.c, frame-tty.c, frame.c, gpmevent.c, gutter.c, hash.c, imgproc.c, indent.c, keymap.c, lisp-union.h, macros.c, malloc.c, marker.c, menubar-x.c, menubar.c, mule-charset.c, number.c, process.c, profile.h, ralloc.c, redisplay.c, select-common.h, select.c, syntax.c, sysfile.h, sysproc.h, systime.h, syswindows.h, toolbar.c, tooltalk.c, tparam.c, unexaix.c, unexalpha.c, unexconvex.c, unexec.c, unexhp9k800.c, unexmips.c, unicode.c, window.c: new -> new_. 'foo -> `foo'. lwlib-internal.h: redo assert macros to follow lisp.h and not trigger warnings. lwlib.c, xlwtabs.c: new -> new_.
author ben
date Tue, 25 Oct 2005 11:16:49 +0000
parents 1e7cc382eb16
children c6ef6267f65c 3742ea8250b5
comparison
equal deleted inserted replaced
3024:b7f26b2f78bd 3025:facf3239ba30
48 Keymaps can thus be arranged in a hierarchy. 48 Keymaps can thus be arranged in a hierarchy.
49 49
50 table A hash table, hashing keysyms to their bindings. 50 table A hash table, hashing keysyms to their bindings.
51 It will be one of the following: 51 It will be one of the following:
52 52
53 -- a symbol, e.g. 'home 53 -- a symbol, e.g. `home'
54 -- a character, representing something printable 54 -- a character, representing something printable
55 (not ?\C-c meaning C-c, for instance) 55 (not ?\C-c meaning C-c, for instance)
56 -- an integer representing a modifier combination 56 -- an integer representing a modifier combination
57 57
58 inverse_table A hash table, hashing bindings to the list of keysyms 58 inverse_table A hash table, hashing bindings to the list of keysyms
1175 (struct copy_keymap_closure *) copy_keymap_closure; 1175 (struct copy_keymap_closure *) copy_keymap_closure;
1176 1176
1177 /* When we encounter a keymap which is indirected through a 1177 /* When we encounter a keymap which is indirected through a
1178 symbol, we need to copy the sub-map. In v18, the form 1178 symbol, we need to copy the sub-map. In v18, the form
1179 (lookup-key (copy-keymap global-map) "\C-x") 1179 (lookup-key (copy-keymap global-map) "\C-x")
1180 returned a new keymap, not the symbol 'Control-X-prefix. 1180 returned a new keymap, not the symbol `Control-X-prefix'.
1181 */ 1181 */
1182 value = get_keymap (value, 0, 1); /* #### autoload GC-safe here? */ 1182 value = get_keymap (value, 0, 1); /* #### autoload GC-safe here? */
1183 if (KEYMAPP (value)) 1183 if (KEYMAPP (value))
1184 keymap_store_internal (key, closure->self, 1184 keymap_store_internal (key, closure->self,
1185 copy_keymap (value)); 1185 copy_keymap (value));
1295 1295
1296 if (SYMBOLP (*keysym)) 1296 if (SYMBOLP (*keysym))
1297 { 1297 {
1298 Ibyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name); 1298 Ibyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name);
1299 1299
1300 /* FSFmacs uses symbols with the printed representation of keysyms in 1300 /* GNU Emacs uses symbols with the printed representation of keysyms in
1301 their names, like 'M-x, and we use the syntax '(meta x). So, to avoid 1301 their names, like `M-x', and we use the syntax '(meta x). So, to
1302 confusion, notice the M-x syntax and signal an error - because 1302 avoid confusion, notice the M-x syntax and signal an error -
1303 otherwise it would be interpreted as a regular keysym, and would even 1303 because otherwise it would be interpreted as a regular keysym, and
1304 show up in the list-buffers output, causing confusion to the naive. 1304 would even show up in the list-buffers output, causing confusion
1305 to the naive.
1305 1306
1306 We can get away with this because none of the X keysym names contain 1307 We can get away with this because none of the X keysym names contain
1307 a hyphen (some contain underscore, however). 1308 a hyphen (some contain underscore, however).
1308 1309
1309 It might be useful to reject keysyms which are not x-valid-keysym- 1310 It might be useful to reject keysyms which are not x-valid-keysym-
1572 if (XEVENT_TYPE (event) != key_press_event || NILP (key_specifier) || 1573 if (XEVENT_TYPE (event) != key_press_event || NILP (key_specifier) ||
1573 (INTP (key_specifier) && !CHAR_INTP (key_specifier))) 1574 (INTP (key_specifier) && !CHAR_INTP (key_specifier)))
1574 return 0; 1575 return 0;
1575 1576
1576 /* if the specifier is an integer such as 27, then it should match 1577 /* if the specifier is an integer such as 27, then it should match
1577 both of the events 'escape' and 'control ['. Calling 1578 both of the events `escape' and `control ['. Calling
1578 Fcharacter_to_event() will only match 'escape'. */ 1579 Fcharacter_to_event() will only match `escape'. */
1579 if (CHAR_OR_CHAR_INTP (key_specifier)) 1580 if (CHAR_OR_CHAR_INTP (key_specifier))
1580 return (XCHAR_OR_CHAR_INT (key_specifier) 1581 return (XCHAR_OR_CHAR_INT (key_specifier)
1581 == event_to_character (event, 0, 0)); 1582 == event_to_character (event, 0, 0));
1582 1583
1583 /* Otherwise, we cannot call event_to_character() because we may 1584 /* Otherwise, we cannot call event_to_character() because we may
1584 be dealing with non-ASCII keystrokes. In any case, if I ask 1585 be dealing with non-ASCII keystrokes. In any case, if I ask
1585 for 'control [' then I should get exactly that, and not 1586 for `control [' then I should get exactly that, and not
1586 'escape'. 1587 `escape'.
1587 1588
1588 However, we have to behave differently on TTY's, where 'control [' 1589 However, we have to behave differently on TTY's, where `control ['
1589 is silently converted into 'escape' by the keyboard driver. 1590 is silently converted into `escape' by the keyboard driver.
1590 In this case, ASCII is the only thing we know about, so we have 1591 In this case, ASCII is the only thing we know about, so we have
1591 to compare the ASCII values. */ 1592 to compare the ASCII values. */
1592 1593
1593 GCPRO1 (event2); 1594 GCPRO1 (event2);
1594 if (EVENTP (key_specifier)) 1595 if (EVENTP (key_specifier))
2685 2686
2686 static Lisp_Object 2687 static Lisp_Object
2687 process_event_binding_result (Lisp_Object result) 2688 process_event_binding_result (Lisp_Object result)
2688 { 2689 {
2689 if (EQ (result, Qundefined)) 2690 if (EQ (result, Qundefined))
2690 /* The suppress-keymap function binds keys to 'undefined - special-case 2691 /* The suppress-keymap function binds keys to `undefined' - special-case
2691 that here, so that being bound to that has the same error-behavior as 2692 that here, so that being bound to that has the same error-behavior as
2692 not being defined at all. 2693 not being defined at all.
2693 */ 2694 */
2694 result = Qnil; 2695 result = Qnil;
2695 if (!NILP (result)) 2696 if (!NILP (result))
3733 if (lower_keys_count >= c->keys_so_far_total_size) 3734 if (lower_keys_count >= c->keys_so_far_total_size)
3734 { 3735 {
3735 int size = lower_keys_count + 50; 3736 int size = lower_keys_count + 50;
3736 if (! c->keys_so_far_malloced) 3737 if (! c->keys_so_far_malloced)
3737 { 3738 {
3738 Lisp_Key_Data *new = xnew_array (Lisp_Key_Data, size); 3739 Lisp_Key_Data *new_ = xnew_array (Lisp_Key_Data, size);
3739 memcpy ((void *)new, (const void *)c->keys_so_far, 3740 memcpy ((void *)new_, (const void *)c->keys_so_far,
3740 c->keys_so_far_total_size * sizeof (Lisp_Key_Data)); 3741 c->keys_so_far_total_size * sizeof (Lisp_Key_Data));
3741 } 3742 }
3742 else 3743 else
3743 XREALLOC_ARRAY (c->keys_so_far, Lisp_Key_Data, size); 3744 XREALLOC_ARRAY (c->keys_so_far, Lisp_Key_Data, size);
3744 3745