Mercurial > hg > xemacs-beta
comparison src/keymap.c @ 867:804517e16990
[xemacs-hg @ 2002-06-05 09:54:39 by ben]
Textual renaming: text/char names
abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization.
[a] distinguish between "charptr" when it refers to operations on
the pointer itself and when it refers to operations on text; and
[b] use consistent naming for everything referring to internal
format, i.e.
Itext == text in internal format
Ibyte == a byte in such text
Ichar == a char as represented in internal character format
thus e.g.
set_charptr_emchar -> set_itext_ichar
The pre and post tags on either side of this change are:
pre-internal-format-textual-renaming
post-internal-format-textual-renaming
See the Internals Manual for details of exactly how this was done,
how to handle the change in your workspace, etc.
author | ben |
---|---|
date | Wed, 05 Jun 2002 09:58:45 +0000 |
parents | 2b6fa2618f76 |
children | 79c6ff3eef26 |
comparison
equal
deleted
inserted
replaced
866:613552a02607 | 867:804517e16990 |
---|---|
438 It's now ok to do this for digit-chars too, since we've fixed the | 438 It's now ok to do this for digit-chars too, since we've fixed the |
439 bug where \9 read as the integer 9 instead of as the symbol with | 439 bug where \9 read as the integer 9 instead of as the symbol with |
440 "9" as its name. | 440 "9" as its name. |
441 */ | 441 */ |
442 /* !!#### I'm not sure how correct this is. */ | 442 /* !!#### I'm not sure how correct this is. */ |
443 Intbyte str [1 + MAX_EMCHAR_LEN]; | 443 Ibyte str [1 + MAX_ICHAR_LEN]; |
444 Bytecount count = set_charptr_emchar (str, XCHAR (keysym)); | 444 Bytecount count = set_itext_ichar (str, XCHAR (keysym)); |
445 str[count] = 0; | 445 str[count] = 0; |
446 keysym = intern_int (str); | 446 keysym = intern_int (str); |
447 } | 447 } |
448 return control_meta_superify (keysym, modifiers); | 448 return control_meta_superify (keysym, modifiers); |
449 } | 449 } |
476 | 476 |
477 /* If the keysym is a one-character symbol, use the char code instead. */ | 477 /* If the keysym is a one-character symbol, use the char code instead. */ |
478 if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) | 478 if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) |
479 { | 479 { |
480 Lisp_Object i_fart_on_gcc = | 480 Lisp_Object i_fart_on_gcc = |
481 make_char (string_emchar (XSYMBOL (keysym)->name, 0)); | 481 make_char (string_ichar (XSYMBOL (keysym)->name, 0)); |
482 keysym = i_fart_on_gcc; | 482 keysym = i_fart_on_gcc; |
483 } | 483 } |
484 | 484 |
485 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ | 485 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ |
486 { | 486 { |
652 | XEMACS_MOD_SUPER | XEMACS_MOD_HYPER | 652 | XEMACS_MOD_SUPER | XEMACS_MOD_HYPER |
653 | XEMACS_MOD_ALT | XEMACS_MOD_SHIFT)) == 0); | 653 | XEMACS_MOD_ALT | XEMACS_MOD_SHIFT)) == 0); |
654 | 654 |
655 /* If the keysym is a one-character symbol, use the char code instead. */ | 655 /* If the keysym is a one-character symbol, use the char code instead. */ |
656 if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) | 656 if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) |
657 keysym = make_char (string_emchar (XSYMBOL (keysym)->name, 0)); | 657 keysym = make_char (string_ichar (XSYMBOL (keysym)->name, 0)); |
658 | 658 |
659 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ | 659 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ |
660 { | 660 { |
661 Lisp_Object submap = Fgethash (MAKE_MODIFIER_HASH_KEY (XEMACS_MOD_META), | 661 Lisp_Object submap = Fgethash (MAKE_MODIFIER_HASH_KEY (XEMACS_MOD_META), |
662 k->table, Qnil); | 662 k->table, Qnil); |
1262 if (SYMBOLP (*keysym)) | 1262 if (SYMBOLP (*keysym)) |
1263 { | 1263 { |
1264 if (string_char_length (XSYMBOL (*keysym)->name) == 1) | 1264 if (string_char_length (XSYMBOL (*keysym)->name) == 1) |
1265 { | 1265 { |
1266 Lisp_Object ream_gcc_up_the_ass = | 1266 Lisp_Object ream_gcc_up_the_ass = |
1267 make_char (string_emchar (XSYMBOL (*keysym)->name, 0)); | 1267 make_char (string_ichar (XSYMBOL (*keysym)->name, 0)); |
1268 *keysym = ream_gcc_up_the_ass; | 1268 *keysym = ream_gcc_up_the_ass; |
1269 goto fixnum_keysym; | 1269 goto fixnum_keysym; |
1270 } | 1270 } |
1271 } | 1271 } |
1272 else if (CHAR_OR_CHAR_INTP (*keysym)) | 1272 else if (CHAR_OR_CHAR_INTP (*keysym)) |
1289 invalid_argument ("Unknown keysym specifier", *keysym); | 1289 invalid_argument ("Unknown keysym specifier", *keysym); |
1290 } | 1290 } |
1291 | 1291 |
1292 if (SYMBOLP (*keysym)) | 1292 if (SYMBOLP (*keysym)) |
1293 { | 1293 { |
1294 Intbyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name); | 1294 Ibyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name); |
1295 | 1295 |
1296 /* FSFmacs uses symbols with the printed representation of keysyms in | 1296 /* FSFmacs uses symbols with the printed representation of keysyms in |
1297 their names, like 'M-x, and we use the syntax '(meta x). So, to avoid | 1297 their names, like 'M-x, and we use the syntax '(meta x). So, to avoid |
1298 confusion, notice the M-x syntax and signal an error - because | 1298 confusion, notice the M-x syntax and signal an error - because |
1299 otherwise it would be interpreted as a regular keysym, and would even | 1299 otherwise it would be interpreted as a regular keysym, and would even |
1897 Lisp_Object c; | 1897 Lisp_Object c; |
1898 struct key_data raw_key1; | 1898 struct key_data raw_key1; |
1899 struct key_data raw_key2; | 1899 struct key_data raw_key2; |
1900 | 1900 |
1901 if (STRINGP (keys)) | 1901 if (STRINGP (keys)) |
1902 c = make_char (string_emchar (keys, idx)); | 1902 c = make_char (string_ichar (keys, idx)); |
1903 else | 1903 else |
1904 c = XVECTOR_DATA (keys) [idx]; | 1904 c = XVECTOR_DATA (keys) [idx]; |
1905 | 1905 |
1906 define_key_parser (c, &raw_key1); | 1906 define_key_parser (c, &raw_key1); |
1907 | 1907 |
2223 if (length == 0) | 2223 if (length == 0) |
2224 return Qnil; | 2224 return Qnil; |
2225 | 2225 |
2226 for (i = 0; i < length; i++) | 2226 for (i = 0; i < length; i++) |
2227 { | 2227 { |
2228 Emchar n = string_emchar (keys, i); | 2228 Ichar n = string_ichar (keys, i); |
2229 define_key_parser (make_char (n), &(raw_keys[i])); | 2229 define_key_parser (make_char (n), &(raw_keys[i])); |
2230 } | 2230 } |
2231 return raw_lookup_key (keymap, raw_keys, length, 0, | 2231 return raw_lookup_key (keymap, raw_keys, length, 0, |
2232 !NILP (accept_default)); | 2232 !NILP (accept_default)); |
2233 } | 2233 } |
2920 if (bit1 || bit2) | 2920 if (bit1 || bit2) |
2921 return bit2 ? 1 : -1; | 2921 return bit2 ? 1 : -1; |
2922 | 2922 |
2923 /* otherwise, string-sort them. */ | 2923 /* otherwise, string-sort them. */ |
2924 { | 2924 { |
2925 Intbyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name); | 2925 Ibyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name); |
2926 Intbyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name); | 2926 Ibyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name); |
2927 return 0 > qxestrcmp (s1, s2) ? 1 : -1; | 2927 return 0 > qxestrcmp (s1, s2) ? 1 : -1; |
2928 } | 2928 } |
2929 } | 2929 } |
2930 | 2930 |
2931 | 2931 |
3238 | 3238 |
3239 for (i = 0; i < size; i++) | 3239 for (i = 0; i < size; i++) |
3240 { | 3240 { |
3241 Lisp_Object s2 = Fsingle_key_description | 3241 Lisp_Object s2 = Fsingle_key_description |
3242 (STRINGP (keys) | 3242 (STRINGP (keys) |
3243 ? make_char (string_emchar (keys, i)) | 3243 ? make_char (string_ichar (keys, i)) |
3244 : XVECTOR_DATA (keys)[i]); | 3244 : XVECTOR_DATA (keys)[i]); |
3245 | 3245 |
3246 if (i == 0) | 3246 if (i == 0) |
3247 string = s2; | 3247 string = s2; |
3248 else | 3248 else |
3336 This differs from `single-key-description' in that it returns a description | 3336 This differs from `single-key-description' in that it returns a description |
3337 of a character from a buffer rather than a key read from the user. | 3337 of a character from a buffer rather than a key read from the user. |
3338 */ | 3338 */ |
3339 (chr)) | 3339 (chr)) |
3340 { | 3340 { |
3341 Intbyte buf[200]; | 3341 Ibyte buf[200]; |
3342 Intbyte *p; | 3342 Ibyte *p; |
3343 Emchar c; | 3343 Ichar c; |
3344 Lisp_Object ctl_arrow = current_buffer->ctl_arrow; | 3344 Lisp_Object ctl_arrow = current_buffer->ctl_arrow; |
3345 int ctl_p = !NILP (ctl_arrow); | 3345 int ctl_p = !NILP (ctl_arrow); |
3346 Emchar printable_min = (CHAR_OR_CHAR_INTP (ctl_arrow) | 3346 Ichar printable_min = (CHAR_OR_CHAR_INTP (ctl_arrow) |
3347 ? XCHAR_OR_CHAR_INT (ctl_arrow) | 3347 ? XCHAR_OR_CHAR_INT (ctl_arrow) |
3348 : ((EQ (ctl_arrow, Qt) || NILP (ctl_arrow)) | 3348 : ((EQ (ctl_arrow, Qt) || NILP (ctl_arrow)) |
3349 ? 256 : 160)); | 3349 ? 256 : 160)); |
3350 | 3350 |
3351 if (EVENTP (chr)) | 3351 if (EVENTP (chr)) |
3364 c = XCHAR (chr); | 3364 c = XCHAR (chr); |
3365 p = buf; | 3365 p = buf; |
3366 | 3366 |
3367 if (c >= printable_min) | 3367 if (c >= printable_min) |
3368 { | 3368 { |
3369 p += set_charptr_emchar (p, c); | 3369 p += set_itext_ichar (p, c); |
3370 } | 3370 } |
3371 else if (c < 040 && ctl_p) | 3371 else if (c < 040 && ctl_p) |
3372 { | 3372 { |
3373 *p++ = '^'; | 3373 *p++ = '^'; |
3374 *p++ = c + 64; /* 'A' - 1 */ | 3374 *p++ = c + 64; /* 'A' - 1 */ |
3397 *p++ = '0' + ((c & 0070) >> 3); | 3397 *p++ = '0' + ((c & 0070) >> 3); |
3398 *p++ = '0' + ((c & 0007)); | 3398 *p++ = '0' + ((c & 0007)); |
3399 } | 3399 } |
3400 else | 3400 else |
3401 { | 3401 { |
3402 p += set_charptr_emchar (p, c); | 3402 p += set_itext_ichar (p, c); |
3403 } | 3403 } |
3404 | 3404 |
3405 *p = 0; | 3405 *p = 0; |
3406 return build_string ((char *) buf); | 3406 return build_string ((char *) buf); |
3407 } | 3407 } |
4147 { | 4147 { |
4148 /* This function can GC */ | 4148 /* This function can GC */ |
4149 struct describe_map_closure describe_map_closure; | 4149 struct describe_map_closure describe_map_closure; |
4150 Lisp_Object list = Qnil; | 4150 Lisp_Object list = Qnil; |
4151 struct buffer *buf = XBUFFER (buffer); | 4151 struct buffer *buf = XBUFFER (buffer); |
4152 Emchar printable_min = (CHAR_OR_CHAR_INTP (buf->ctl_arrow) | 4152 Ichar printable_min = (CHAR_OR_CHAR_INTP (buf->ctl_arrow) |
4153 ? XCHAR_OR_CHAR_INT (buf->ctl_arrow) | 4153 ? XCHAR_OR_CHAR_INT (buf->ctl_arrow) |
4154 : ((EQ (buf->ctl_arrow, Qt) | 4154 : ((EQ (buf->ctl_arrow, Qt) |
4155 || EQ (buf->ctl_arrow, Qnil)) | 4155 || EQ (buf->ctl_arrow, Qnil)) |
4156 ? 256 : 160)); | 4156 ? 256 : 160)); |
4157 int elided = 0; | 4157 int elided = 0; |
4195 if (modifiers & XEMACS_MOD_SHIFT) | 4195 if (modifiers & XEMACS_MOD_SHIFT) |
4196 buffer_insert_c_string (buf, "Sh-"); | 4196 buffer_insert_c_string (buf, "Sh-"); |
4197 if (SYMBOLP (keysym)) | 4197 if (SYMBOLP (keysym)) |
4198 { | 4198 { |
4199 Lisp_Object code = Fget (keysym, Vcharacter_set_property, Qnil); | 4199 Lisp_Object code = Fget (keysym, Vcharacter_set_property, Qnil); |
4200 Emchar c = (CHAR_OR_CHAR_INTP (code) | 4200 Ichar c = (CHAR_OR_CHAR_INTP (code) |
4201 ? XCHAR_OR_CHAR_INT (code) : (Emchar) -1); | 4201 ? XCHAR_OR_CHAR_INT (code) : (Ichar) -1); |
4202 /* Calling Fsingle_key_description() would cons more */ | 4202 /* Calling Fsingle_key_description() would cons more */ |
4203 #if 0 /* This is bogus */ | 4203 #if 0 /* This is bogus */ |
4204 if (EQ (keysym, QKlinefeed)) | 4204 if (EQ (keysym, QKlinefeed)) |
4205 buffer_insert_c_string (buf, "LFD"); | 4205 buffer_insert_c_string (buf, "LFD"); |
4206 else if (EQ (keysym, QKtab)) | 4206 else if (EQ (keysym, QKtab)) |
4415 */ ); | 4415 */ ); |
4416 keymap_tick = 0; | 4416 keymap_tick = 0; |
4417 | 4417 |
4418 staticpro (&Vcurrent_global_map); | 4418 staticpro (&Vcurrent_global_map); |
4419 | 4419 |
4420 Vsingle_space_string = make_string ((const Intbyte *) " ", 1); | 4420 Vsingle_space_string = make_string ((const Ibyte *) " ", 1); |
4421 staticpro (&Vsingle_space_string); | 4421 staticpro (&Vsingle_space_string); |
4422 } | 4422 } |
4423 | 4423 |
4424 void | 4424 void |
4425 complex_vars_of_keymap (void) | 4425 complex_vars_of_keymap (void) |