annotate src/gui-msw.c @ 5307:c096d8051f89

Have NATNUMP give t for positive bignums; check limits appropriately. src/ChangeLog addition: 2010-11-20 Aidan Kehoe <kehoea@parhasard.net> * abbrev.c (Fexpand_abbrev): * alloc.c: * alloc.c (Fmake_list): * alloc.c (Fmake_vector): * alloc.c (Fmake_bit_vector): * alloc.c (Fmake_byte_code): * alloc.c (Fmake_string): * alloc.c (vars_of_alloc): * bytecode.c (UNUSED): * bytecode.c (Fbyte_code): * chartab.c (decode_char_table_range): * cmds.c (Fself_insert_command): * data.c (check_integer_range): * data.c (Fnatnump): * data.c (Fnonnegativep): * data.c (Fstring_to_number): * elhash.c (hash_table_size_validate): * elhash.c (decode_hash_table_size): * eval.c (Fbacktrace_frame): * event-stream.c (lisp_number_to_milliseconds): * event-stream.c (Faccept_process_output): * event-stream.c (Frecent_keys): * event-stream.c (Fdispatch_event): * events.c (Fmake_event): * events.c (Fevent_timestamp): * events.c (Fevent_timestamp_lessp): * events.h: * events.h (struct command_builder): * file-coding.c (gzip_putprop): * fns.c: * fns.c (check_sequence_range): * fns.c (Frandom): * fns.c (Fnthcdr): * fns.c (Flast): * fns.c (Fnbutlast): * fns.c (Fbutlast): * fns.c (Fmember): * fns.c (Ffill): * fns.c (Freduce): * fns.c (replace_string_range_1): * fns.c (Freplace): * font-mgr.c (Ffc_pattern_get): * frame-msw.c (msprinter_set_frame_properties): * glyphs.c (check_valid_xbm_inline): * indent.c (Fmove_to_column): * intl-win32.c (mswindows_multibyte_to_unicode_putprop): * lisp.h: * lisp.h (ARRAY_DIMENSION_LIMIT): * lread.c (decode_mode_1): * mule-ccl.c (ccl_get_compiled_code): * number.h: * process-unix.c (unix_open_multicast_group): * process.c (Fset_process_window_size): * profile.c (Fstart_profiling): * unicode.c (Funicode_to_char): Change NATNUMP to return 1 for positive bignums; changes uses of it and of CHECK_NATNUM appropriately, usually by checking for an integer in an appropriate range. Add array-dimension-limit and use it in #'make-vector, #'make-string. Add array-total-size-limit, array-rank-limit while we're at it, for the sake of any Common Lisp-oriented code that uses these limits. Rename check_int_range to check_integer_range, have it take Lisp_Objects (and thus bignums) instead. Remove bignum_butlast(), just set int_n to an appropriately large integer if N is a bignum. Accept bignums in check_sequence_range(), change the functions that use check_sequence_range() appropriately. Move the definition of NATNUMP() to number.h; document why it's a reasonable name, contradicting an old comment. tests/ChangeLog addition: 2010-11-20 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: * automated/lisp-tests.el (featurep): * automated/lisp-tests.el (wrong-type-argument): * automated/mule-tests.el (featurep): Check for args-out-of-range errors instead of wrong-type-argument errors in various places when code is handed a large bignum instead of a fixnum. Also check for the wrong-type-argument errors when giving the same code a non-integer value.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 20 Nov 2010 16:49:11 +0000
parents ecf1ebac70d8
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* mswindows GUI code. (menubars, scrollbars, toolbars, dialogs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1998 Andy Piper.
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
3 Copyright (C) 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
24 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
25 5-2000. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
26
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "lisp.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
29 #include "console-msw-impl.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
30 #include "redisplay.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "gui.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
32 #include "glyphs.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
33 #include "frame-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "elhash.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
35 #include "events.h"
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
36 #include "buffer.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 * Return value is Qt if we have dispatched the command,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 * or Qnil if id has not been mapped to a callback.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 * Window procedure may try other targets to route the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 * command if we return nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1204
diff changeset
45 mswindows_handle_gui_wm_command (struct frame *f, HWND UNUSED (ctrl),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1204
diff changeset
46 LPARAM id)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 /* Try to map the command id through the proper hash table */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
49 Lisp_Object callback, callback_ex, image_instance, frame, event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
50
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
51 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 793
diff changeset
53 image_instance = Fgethash (make_int_verify (id),
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
54 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
55 /* It is possible for a widget action to cause it to get out of sync
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
56 with its instantiator. Thus it is necessary to signal this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
57 possibility. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
58 if (IMAGE_INSTANCEP (image_instance))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
59 XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60 callback = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62 callback_ex = Fgethash (make_int (id),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
63 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
65 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
66 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
67 event = Fmake_event (Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
68
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
69 XSET_EVENT_TYPE (event, misc_user_event);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
70 XSET_EVENT_CHANNEL (event, frame);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
71 XSET_EVENT_TIMESTAMP (event, GetTickCount());
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
72 XSET_EVENT_MISC_USER_FUNCTION (event, Qeval);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
73 XSET_EVENT_MISC_USER_OBJECT (event,
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
74 list4 (Qfuncall, callback_ex, image_instance, event));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
75 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
76 else if (NILP (callback) || UNBOUNDP (callback))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
77 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
78 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
79 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
80 Lisp_Object fn, arg;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
81
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
82 event = Fmake_event (Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
83
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
84 get_gui_callback (callback, &fn, &arg);
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
85 XSET_EVENT_TYPE (event, misc_user_event);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
86 XSET_EVENT_CHANNEL (event, frame);
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 872
diff changeset
87 XSET_EVENT_TIMESTAMP (event, GetTickCount());
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
88 XSET_EVENT_MISC_USER_FUNCTION (event, fn);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
89 XSET_EVENT_MISC_USER_OBJECT (event, arg);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
90 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
91
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
92 mswindows_enqueue_dispatch_event (event);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
93 /* The result of this evaluation could cause other instances to change so
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
94 enqueue an update callback to check this. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
95 enqueue_magic_eval_event (update_widget_instances, frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
96 return Qt;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
97 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
98
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
99 /*
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
100 * Translate X accelerator syntax to win32 accelerator syntax.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
101 * accel = (Ichar*) to receive the accelerator character
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
102 * or NULL to suppress accelerators in the menu or dialog item.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
103 *
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
104 * %% is replaced with %
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
105 * if accel is NULL:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
106 * %_ is removed.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
107 * if accel is non-NULL:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
108 * %_ is replaced with &.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
109 * The accelerator character is passed back in *accel.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
110 * (If there is no accelerator, it will be added on the first character.)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
111 *
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
112 */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
113
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
114 Lisp_Object
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
115 mswindows_translate_menu_or_dialog_item (Lisp_Object item, Ichar *accel)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
116 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
117 Bytecount len = XSTRING_LENGTH (item);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
118 Ibyte *it = alloca_ibytes (2 * len + 42), *ptr = it;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
119
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
120 memcpy (ptr, XSTRING_DATA (item), len + 1);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
121 if (accel)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
122 *accel = '\0';
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
123
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
124 /* Escape '&' as '&&' */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
125
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
126 while ((ptr = (Ibyte *) memchr (ptr, '&', len - (ptr - it))) != NULL)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
127 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
128 memmove (ptr + 1, ptr, (len - (ptr - it)) + 1);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
129 len++;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
130 ptr += 2;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
131 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
132
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
133 /* Replace XEmacs accelerator '%_' with Windows accelerator '&'
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
134 and `%%' with `%'. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
135 ptr = it;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
136 while ((ptr = (Ibyte *) memchr (ptr, '%', len - (ptr - it))) != NULL)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
137 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
138 if (*(ptr + 1) == '_')
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
139 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
140 if (accel)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
141 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
142 *ptr = '&';
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
143 if (!*accel)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
144 *accel = DOWNCASE (0, itext_ichar (ptr + 2));
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
145 memmove (ptr + 1, ptr + 2, len - (ptr - it + 2) + 1);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
146 len--;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
147 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
148 else /* Skip accelerator */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
149 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
150 memmove (ptr, ptr + 2, len - (ptr - it + 2) + 1);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
151 len -= 2;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
152 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
153 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
154 else if (*(ptr + 1) == '%')
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
155 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
156 memmove (ptr + 1, ptr + 2, len - (ptr - it + 2) + 1);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
157 len--;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
158 ptr++;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
159 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
160 else /* % on its own - shouldn't happen */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
161 ptr++;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
162 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
163
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
164 if (accel && !*accel)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
165 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
166 /* Force a default accelerator */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
167 ptr = it;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
168 memmove (ptr + 1, ptr, len + 1);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
169 *accel = DOWNCASE (0, itext_ichar (ptr + 1));
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
170 *ptr = '&';
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
171
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
172 len++;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
173 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
174
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
175 return make_string (it, len);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
176 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
177
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
178 void
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
179 syms_of_gui_mswindows (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
180 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
181 }