diff options
| author | Richard M. Stallman | 1995-04-10 07:34:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-04-10 07:34:53 +0000 |
| commit | 931e7866164d09f01fa717a0b1d8c7cb1ffc1ece (patch) | |
| tree | 40d0145dcd52a68e61f55a5190f52d9635d1ddd5 /src | |
| parent | d806e7202af35d895dfecfdb9fa653500e592cba (diff) | |
| download | emacs-931e7866164d09f01fa717a0b1d8c7cb1ffc1ece.tar.gz emacs-931e7866164d09f01fa717a0b1d8c7cb1ffc1ece.zip | |
(single_kboard): Renamed from kboard_locked. All refs renamed.
(struct kboard): Renamed from struct KBOARD.
Move flag fields to the end, and make them chars.
Delete the `unused' field.
(KBOARD, etc): Moved from lisp.h.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/src/keyboard.h b/src/keyboard.h index feacedd6388..e3c30fd0f54 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -17,6 +17,139 @@ You should have received a copy of the GNU General Public License | |||
| 17 | along with GNU Emacs; see the file COPYING. If not, write to | 17 | along with GNU Emacs; see the file COPYING. If not, write to |
| 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 19 | 19 | ||
| 20 | /* Length of echobuf field in each KBOARD. */ | ||
| 21 | |||
| 22 | #define ECHOBUFSIZE 300 | ||
| 23 | |||
| 24 | /* Each KBOARD represents one logical input stream from which Emacs gets input. | ||
| 25 | If we are using an ordinary terminal, it has one KBOARD object. | ||
| 26 | Usually each X display screen has its own KBOARD, | ||
| 27 | but when two of them are on the same X server, | ||
| 28 | we assume they share a keyboard and give them one KBOARD in common. | ||
| 29 | |||
| 30 | Some Lisp variables are per-kboard; they are stored in the KBOARD structure | ||
| 31 | and accessed indirectly via a Lisp_Misc_Kboard_Objfwd object. | ||
| 32 | |||
| 33 | So that definition of keyboard macros, and reading of prefix arguments, | ||
| 34 | can happen in parallel on various KBOARDs at once, | ||
| 35 | the state information for those activities is stored in the KBOARD. | ||
| 36 | |||
| 37 | Emacs has two states for reading input: | ||
| 38 | |||
| 39 | ** Any kboard. Emacs can accept input from any KBOARD, | ||
| 40 | and as soon as any of them provides a complete command, Emacs can run it. | ||
| 41 | |||
| 42 | ** Single kboard. Then Emacs is running a command for one KBOARD | ||
| 43 | and can only read input from that KBOARD. | ||
| 44 | |||
| 45 | All input, from all KBOARDs, goes together in a single event queue | ||
| 46 | at interrupt level. read_char sees the events sequentially, | ||
| 47 | but deals with them in accord with the current input state. | ||
| 48 | |||
| 49 | In the any-kboard state, read_key_sequence processes input from any KBOARD | ||
| 50 | immediately. When a new event comes in from a particular KBOARD, | ||
| 51 | read_key_sequence switches to that KBOARD. As a result, | ||
| 52 | as soon as a complete key arrives from some KBOARD or other, | ||
| 53 | Emacs starts executing that key's binding. It switches to the | ||
| 54 | single-kboard state for the execution of that command, | ||
| 55 | so that that command can get input only from its own KBOARD. | ||
| 56 | |||
| 57 | While in the single-kboard state, read_char can consider input only | ||
| 58 | from the current KBOARD. If events come from other KBOARDs, they | ||
| 59 | are put aside for later in the KBOARDs' kbd_queue lists. | ||
| 60 | The flag kbd_queue_has_data in a KBOARD is 1 if this has happened. | ||
| 61 | When Emacs goes back to the any-kboard state, it looks at all the KBOARDS | ||
| 62 | to find those; and it tries processing their input right away. */ | ||
| 63 | |||
| 64 | typedef struct kboard KBOARD; | ||
| 65 | struct kboard | ||
| 66 | { | ||
| 67 | KBOARD *next_kboard; | ||
| 68 | |||
| 69 | /* The state of a prefix arg. */ | ||
| 70 | Lisp_Object prefix_factor, prefix_value; | ||
| 71 | int prefix_sign, prefix_partial; | ||
| 72 | |||
| 73 | /* Unread events specific to this kboard. */ | ||
| 74 | Lisp_Object kbd_queue; | ||
| 75 | |||
| 76 | /* Non-nil while a kbd macro is being defined. */ | ||
| 77 | Lisp_Object defining_kbd_macro; | ||
| 78 | |||
| 79 | /* The start of storage for the current keyboard macro. */ | ||
| 80 | Lisp_Object *kbd_macro_buffer; | ||
| 81 | |||
| 82 | /* Where to store the next keystroke of the macro. */ | ||
| 83 | Lisp_Object *kbd_macro_ptr; | ||
| 84 | |||
| 85 | /* The finalized section of the macro starts at kbd_macro_buffer and | ||
| 86 | ends before this. This is not the same as kbd_macro_ptr, because | ||
| 87 | we advance this to kbd_macro_ptr when a key's command is complete. | ||
| 88 | This way, the keystrokes for "end-kbd-macro" are not included in the | ||
| 89 | macro. */ | ||
| 90 | Lisp_Object *kbd_macro_end; | ||
| 91 | |||
| 92 | /* Allocated size of kbd_macro_buffer. */ | ||
| 93 | int kbd_macro_bufsize; | ||
| 94 | |||
| 95 | /* Last anonymous kbd macro defined. */ | ||
| 96 | Lisp_Object Vlast_kbd_macro; | ||
| 97 | |||
| 98 | /* Number of displays using this KBOARD. Normally 1, but can be | ||
| 99 | larger when you have multiple screens on a single X display. */ | ||
| 100 | int reference_count; | ||
| 101 | |||
| 102 | /* Where to append more text to echobuf if we want to. */ | ||
| 103 | char *echoptr; | ||
| 104 | |||
| 105 | /* The text we're echoing in the modeline - partial key sequences, | ||
| 106 | usually. '\0'-terminated. This really shouldn't have a fixed size. */ | ||
| 107 | char echobuf[ECHOBUFSIZE]; | ||
| 108 | |||
| 109 | /* This flag indicates that events were put into kbd_queue | ||
| 110 | while Emacs was running for some other KBOARD. | ||
| 111 | The flag means that, when Emacs goes into the any-kboard state again, | ||
| 112 | it should check this KBOARD to see if there is a complete command | ||
| 113 | waiting. | ||
| 114 | |||
| 115 | Note that the kbd_queue field can be non-nil even when | ||
| 116 | kbd_queue_has_data is 0. When we push back an incomplete | ||
| 117 | command, then this flag is 0, meaning we don't want to try | ||
| 118 | reading from this KBOARD again until more input arrives. */ | ||
| 119 | char kbd_queue_has_data; | ||
| 120 | |||
| 121 | /* Nonzero means echo each character as typed. */ | ||
| 122 | char immediate_echo; | ||
| 123 | |||
| 124 | /* If we have echoed a prompt string specified by the user, | ||
| 125 | this is its length. Otherwise this is -1. */ | ||
| 126 | char echo_after_prompt; | ||
| 127 | }; | ||
| 128 | |||
| 129 | #ifdef MULTI_KBOARD | ||
| 130 | /* Temporarily used before a frame has been opened, and for termcap frames */ | ||
| 131 | extern KBOARD *initial_kboard; | ||
| 132 | |||
| 133 | /* In the single-kboard state, this is the kboard | ||
| 134 | from which input is accepted. | ||
| 135 | |||
| 136 | In the any-kboard state, this is the kboard from which we are | ||
| 137 | right now considering input. We can consider input from another | ||
| 138 | kboard, but doing so requires throwing to wrong_kboard_jmpbuf. */ | ||
| 139 | extern KBOARD *current_kboard; | ||
| 140 | |||
| 141 | /* A list of all kboard objects, linked through next_kboard. */ | ||
| 142 | extern KBOARD *all_kboards; | ||
| 143 | |||
| 144 | /* Nonzero in the single-kboard state, 0 in the any-kboard state. */ | ||
| 145 | extern int single_kboard; | ||
| 146 | #else | ||
| 147 | extern KBOARD the_only_kboard; | ||
| 148 | #define current_kboard (&the_only_kboard) | ||
| 149 | #define all_kboards (&the_only_kboard) | ||
| 150 | #define single_kboard 1 | ||
| 151 | #endif | ||
| 152 | |||
| 20 | /* Total number of times read_char has returned. */ | 153 | /* Total number of times read_char has returned. */ |
| 21 | extern int num_input_chars; | 154 | extern int num_input_chars; |
| 22 | 155 | ||