1 /*- 2 * Copyright (c) 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)gs.h 8.39 (Berkeley) 7/23/94 34 */ 35 36 struct _gs { 37 CIRCLEQ_HEAD(_dqh, _scr) dq; /* Displayed screens. */ 38 CIRCLEQ_HEAD(_hqh, _scr) hq; /* Hidden screens. */ 39 40 mode_t origmode; /* Original terminal mode. */ 41 struct termios 42 original_termios; /* Original terminal values. */ 43 44 MSGH msgq; /* User message list. */ 45 46 char *tmp_bp; /* Temporary buffer. */ 47 size_t tmp_blen; /* Size of temporary buffer. */ 48 49 sigset_t blockset; /* Signal mask. */ 50 51 #ifdef DEBUG 52 FILE *tracefp; /* Trace file pointer. */ 53 #endif 54 55 /* INFORMATION SHARED BY ALL SCREENS. */ 56 IBUF *tty; /* Key input buffer. */ 57 58 CB *dcbp; /* Default cut buffer pointer. */ 59 CB dcb_store; /* Default cut buffer storage. */ 60 LIST_HEAD(_cuth, _cb) cutq; /* Linked list of cut buffers. */ 61 62 #define MAX_BIT_SEQ 128 /* Max + 1 fast check character. */ 63 LIST_HEAD(_seqh, _seq) seqq; /* Linked list of maps, abbrevs. */ 64 bitstr_t bit_decl(seqb, MAX_BIT_SEQ); 65 66 #define MAX_FAST_KEY 254 /* Max fast check character.*/ 67 #define KEY_LEN(sp, ch) \ 68 ((ch) <= MAX_FAST_KEY ? \ 69 sp->gp->cname[ch].len : __key_len(sp, ch)) 70 #define KEY_NAME(sp, ch) \ 71 ((ch) <= MAX_FAST_KEY ? \ 72 sp->gp->cname[ch].name : __key_name(sp, ch)) 73 struct { 74 CHAR_T name[MAX_CHARACTER_COLUMNS + 1]; 75 u_int8_t len; 76 } cname[MAX_FAST_KEY + 1]; /* Fast lookup table. */ 77 78 #define KEY_VAL(sp, ch) \ 79 ((ch) <= MAX_FAST_KEY ? sp->gp->special_key[ch] : \ 80 (ch) > sp->gp->max_special ? 0 : __key_val(sp, ch)) 81 CHAR_T max_special; /* Max special character. */ 82 u_char /* Fast lookup table. */ 83 special_key[MAX_FAST_KEY + 1]; 84 85 /* Interrupt macros. */ 86 #define INTERRUPTED(sp) \ 87 (F_ISSET((sp), S_INTERRUPTED) || F_ISSET((sp)->gp, G_SIGINT)) 88 #define CLR_INTERRUPT(sp) { \ 89 F_CLR((sp), S_INTERRUPTED | S_INTERRUPTIBLE); \ 90 F_CLR((sp)->gp, G_SIGINT); \ 91 } 92 93 #define G_ABBREV 0x0001 /* If have abbreviations. */ 94 #define G_BELLSCHED 0x0002 /* Bell scheduled. */ 95 #define G_RECOVER_SET 0x0004 /* Recover system initialized. */ 96 #define G_SETMODE 0x0008 /* Tty mode changed. */ 97 #define G_SIGALRM 0x0010 /* SIGALRM arrived. */ 98 #define G_SIGINT 0x0020 /* SIGINT arrived. */ 99 #define G_SIGWINCH 0x0040 /* SIGWINCH arrived. */ 100 #define G_SNAPSHOT 0x0080 /* Always snapshot files. */ 101 #define G_STDIN_TTY 0x0100 /* Standard input is a tty. */ 102 #define G_TERMIOS_SET 0x0200 /* Termios structure is valid. */ 103 #define G_TMP_INUSE 0x0400 /* Temporary buffer in use. */ 104 u_int16_t flags; 105 }; 106 107 extern GS *__global_list; /* List of screens. */ 108