annotate src/termhooks.h @ 959:c1fc76b79275

* bytecode.c (Fbyte_code): When metering the Bcall opcodes, make sure the count on the symbol's `byte-code-meter' property does not overflow. * bytecode.c (syms_of_bytecode): Add a docstring for byte-metering-on.
author Jim Blandy <jimb@redhat.com>
date Wed, 12 Aug 1992 13:30:54 +0000
parents b9e81bfc7ad9
children 407100cee78a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Hooks by which low level terminal operations
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 can be made to call other routines.
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
3 Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 This file is part of GNU Emacs.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 any later version.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 extern int (*cursor_to_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 extern int (*raw_cursor_to_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 extern int (*clear_to_end_hook) ();
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
26 extern int (*clear_frame_hook) ();
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 extern int (*clear_end_of_line_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 extern int (*ins_del_lines_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 extern int (*change_line_highlight_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 extern int (*reassert_line_highlight_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 extern int (*insert_glyphs_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 extern int (*write_glyphs_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 extern int (*delete_glyphs_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 extern int (*ring_bell_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 extern int (*reset_terminal_modes_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 extern int (*set_terminal_modes_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 extern int (*update_begin_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 extern int (*update_end_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 extern int (*set_terminal_window_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 extern int (*read_socket_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
48 /* Return the current position of the mouse. This should clear
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
49 mouse_moved until the next motion event arrives. */
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
50 extern void (*mouse_position_hook) ( /* FRAME_PTR *f,
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
51 Lisp_Object *x,
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
52 Lisp_Object *y,
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
53 unsigned long *time */ );
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
55 /* The window system handling code should set this if the mouse has
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
56 moved since the last call to the mouse_position_hook. Calling that
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
57 hook should clear this. */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
58 extern int mouse_moved;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
60 /* When a frame's focus redirection is changed, this hook tells the
357
1ad871406b12 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
61 window system code to re-decide where to put the highlight. Under
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
62 X, this means that Emacs lies about where the focus is. */
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
63 extern void (*frame_rehighlight_hook) ( /* void */ );
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
64
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 /* If nonzero, send all terminal output characters to this stream also. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 extern FILE *termscript;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 /* Expedient hack: only provide the below definitions to files that
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 are prepared to handle lispy things. XINT is defined iff lisp.h
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
70 has been included before this file. */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
71 #ifdef XINT
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 /* The keyboard input buffer is an array of these structures. Each one
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 represents some sort of input event - a keystroke, a mouse click, or
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 a window system event. These get turned into their lispy forms when
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 they are removed from the event queue. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 struct input_event {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 /* What kind of event was this? */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 enum {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 no_event, /* nothing happened. This should never
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 actually appear in the event queue. */
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
84 ascii_keystroke, /* The ASCII code is in .code.
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
85 .frame is the frame in which the key
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
86 was typed.
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
87 Note that this includes meta-keys, and
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
88 the modifiers field of the event
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
89 is unused.
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
90 .timestamp gives a timestamp (in
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
91 milliseconds) for the keystroke. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 non_ascii_keystroke, /* .code is a number identifying the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 function key. A code N represents
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 a key whose name is
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 function_key_names[N]; function_key_names
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 is a table in keyboard.c to which you
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 should feel free to add missing keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 .modifiers holds the state of the
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
99 modifier keys.
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
100 .frame is the frame in which the key
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
101 was typed.
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
102 .timestamp gives a timestamp (in
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 357
diff changeset
103 milliseconds) for the keystroke. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 mouse_click, /* The button number is in .code.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 .modifiers holds the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 modifier keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 .x and .y give the mouse position,
708
030fb4635335 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 648
diff changeset
108 in characters, within the window.
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
109 .frame gives the frame the mouse
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 click occurred in.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 .timestamp gives a timestamp (in
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 milliseconds) for the click. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 scrollbar_click, /* .code gives the number of the mouse
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 button that was clicked.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 .part is a lisp symbol indicating which
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 part of the scrollbar got clicked. This
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 indicates whether the scroll bar was
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 horizontal or vertical.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 .modifiers gives the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 modifier keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 .x gives the distance from the start
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 of the scroll bar of the click; .y gives
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 the total length of the scroll bar.
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
124 .frame gives the frame the click
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 should apply to.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 .timestamp gives a timestamp (in
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 milliseconds) for the click. */
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
128 #if 0
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
129 frame_selected, /* The user has moved the focus to another
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
130 frame.
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
131 .frame is the frame that should become
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 selected at the next convenient time. */
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
133 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 } kind;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 Lisp_Object code;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 Lisp_Object part;
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
138
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
139 /* This is obviously wrong, but I'm not sure what else I should do.
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
140 Obviously, this should be a FRAME_PTR. But that would require that
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
141 every file which #includes this one should also #include "frame.h",
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
142 which would mean that files like cm.c and other innocents would be
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
143 dragged into the set of frame.h users. Maybe the definition of this
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
144 structure should be elsewhere? In its own file? */
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
145 #ifdef MULTI_FRAME
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
146 struct frame *frame;
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
147 #else
766
b9e81bfc7ad9 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
148 int frame;
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
149 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 int modifiers; /* See enum below for interpretation. */
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 708
diff changeset
151
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 Lisp_Object x, y;
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
153 unsigned long timestamp;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 };
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 /* Bits in the modifiers member of the input_event structure. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 enum {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 shift_modifier = 1,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 ctrl_modifier = 2,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 meta_modifier = 4,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 up_modifier = 8, /* This only applies to mouse buttons. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 last_modifier /* This should always be one more than the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 highest modifier bit defined. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 };
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 #define NUM_MODIFIER_COMBOS ((last_modifier-1) << 1)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 #endif