ptyx.h revision dfb07bc7
1dfb07bc7Smrg/* $XTermId: ptyx.h,v 1.854 2017/05/29 00:49:11 tom Exp $ */ 2d522f475Smrg 3d522f475Smrg/* 4dfb07bc7Smrg * Copyright 1999-2016,2017 by Thomas E. Dickey 5d522f475Smrg * 6d522f475Smrg * All Rights Reserved 7d522f475Smrg * 8d522f475Smrg * Permission is hereby granted, free of charge, to any person obtaining a 9d522f475Smrg * copy of this software and associated documentation files (the 10d522f475Smrg * "Software"), to deal in the Software without restriction, including 11d522f475Smrg * without limitation the rights to use, copy, modify, merge, publish, 12d522f475Smrg * distribute, sublicense, and/or sell copies of the Software, and to 13d522f475Smrg * permit persons to whom the Software is furnished to do so, subject to 14d522f475Smrg * the following conditions: 15d522f475Smrg * 16d522f475Smrg * The above copyright notice and this permission notice shall be included 17d522f475Smrg * in all copies or substantial portions of the Software. 18d522f475Smrg * 19d522f475Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20d522f475Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21d522f475Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22d522f475Smrg * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 23d522f475Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24d522f475Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25d522f475Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26d522f475Smrg * 27d522f475Smrg * Except as contained in this notice, the name(s) of the above copyright 28d522f475Smrg * holders shall not be used in advertising or otherwise to promote the 29d522f475Smrg * sale, use or other dealings in this Software without prior written 30d522f475Smrg * authorization. 31d522f475Smrg * 32d522f475Smrg * 33d522f475Smrg * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 34d522f475Smrg * 35d522f475Smrg * All Rights Reserved 36d522f475Smrg * 37d522f475Smrg * Permission to use, copy, modify, and distribute this software and its 38d522f475Smrg * documentation for any purpose and without fee is hereby granted, 39d522f475Smrg * provided that the above copyright notice appear in all copies and that 40d522f475Smrg * both that copyright notice and this permission notice appear in 41d522f475Smrg * supporting documentation, and that the name of Digital Equipment 42d522f475Smrg * Corporation not be used in advertising or publicity pertaining to 43d522f475Smrg * distribution of the software without specific, written prior permission. 44d522f475Smrg * 45d522f475Smrg * 46d522f475Smrg * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 47d522f475Smrg * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 48d522f475Smrg * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 49d522f475Smrg * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 50d522f475Smrg * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 51d522f475Smrg * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 52d522f475Smrg * SOFTWARE. 53d522f475Smrg */ 54d522f475Smrg 55d522f475Smrg#ifndef included_ptyx_h 56d522f475Smrg#define included_ptyx_h 1 57d522f475Smrg 58d522f475Smrg#ifdef HAVE_CONFIG_H 59d522f475Smrg#include <xtermcfg.h> 60d522f475Smrg#endif 61d522f475Smrg 62d522f475Smrg/* ptyx.h */ 63c219fbebSmrg/* *INDENT-OFF* */ 64d522f475Smrg/* @(#)ptyx.h X10/6.6 11/10/86 */ 65d522f475Smrg 66d522f475Smrg#include <X11/IntrinsicP.h> 67d522f475Smrg#include <X11/Shell.h> /* for XtNdieCallback, etc. */ 68d522f475Smrg#include <X11/StringDefs.h> /* for standard resource names */ 69d522f475Smrg#include <X11/Xmu/Misc.h> /* For Max() and Min(). */ 703367019cSmrg 713367019cSmrg#undef bcopy 723367019cSmrg#undef bzero 73d522f475Smrg#include <X11/Xfuncs.h> 743367019cSmrg 75d522f475Smrg#include <X11/Xosdefs.h> 76d522f475Smrg#include <X11/Xmu/Converters.h> 77d522f475Smrg#ifdef XRENDERFONT 78d522f475Smrg#include <X11/Xft/Xft.h> 79d522f475Smrg#endif 80d522f475Smrg 81712a7ff4Smrg#include <stdio.h> 82712a7ff4Smrg 83fa3f02f3Smrg#ifdef HAVE_STDINT_H 84fa3f02f3Smrg#include <stdint.h> 85fa3f02f3Smrg#define DECONST(type,s) ((type *)(intptr_t)(const type *)(s)) 86fa3f02f3Smrg#else 87fa3f02f3Smrg#define DECONST(type,s) ((type *)(s)) 88fa3f02f3Smrg#endif 89fa3f02f3Smrg 90d522f475Smrg/* adapted from IntrinsicI.h */ 91d522f475Smrg#define MyStackAlloc(size, stack_cache_array) \ 92d522f475Smrg ((size) <= sizeof(stack_cache_array) \ 93d522f475Smrg ? (XtPointer)(stack_cache_array) \ 94cd3331d0Smrg : (XtPointer)malloc((size_t)(size))) 95d522f475Smrg 96d522f475Smrg#define MyStackFree(pointer, stack_cache_array) \ 97d522f475Smrg if ((pointer) != ((char *)(stack_cache_array))) free(pointer) 98d522f475Smrg 99d522f475Smrg/* adapted from vile (vi-like-emacs) */ 100cd3331d0Smrg#define TypeCallocN(type,n) (type *)calloc((size_t) (n), sizeof(type)) 101cd3331d0Smrg#define TypeCalloc(type) TypeCallocN(type, 1) 102d522f475Smrg 103cd3331d0Smrg#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (size_t) (n)) 104cd3331d0Smrg#define TypeMalloc(type) TypeMallocN(type, 1) 105d522f475Smrg 106d522f475Smrg#define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) 107d522f475Smrg 108c219fbebSmrg#define TypeXtReallocN(t,p,n) (t *)(void *)XtRealloc((char *)(p), (Cardinal)(sizeof(t) * (size_t) (n))) 109c219fbebSmrg 110c219fbebSmrg#define TypeXtMallocX(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) + (size_t) (n))) 111c219fbebSmrg#define TypeXtMallocN(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) * (size_t) (n))) 112c219fbebSmrg#define TypeXtMalloc(type) TypeXtMallocN(type, 1) 113c219fbebSmrg 114d522f475Smrg/* use these to allocate partly-structured data */ 115dfb07bc7Smrg#define TextAlloc(n) (char *)malloc(sizeof(char) * (size_t) ((n) + 1)) 116dfb07bc7Smrg#define CastMalloc(type) (type *)malloc(sizeof(type)) 117d522f475Smrg 118b7c89284Ssnj#define BumpBuffer(type, buffer, size, want) \ 119b7c89284Ssnj if (want >= size) { \ 120b7c89284Ssnj size = 1 + (want * 2); \ 121b7c89284Ssnj buffer = TypeRealloc(type, size, buffer); \ 122b7c89284Ssnj } 123b7c89284Ssnj 124b7c89284Ssnj#define BfBuf(type) screen->bf_buf_##type 125b7c89284Ssnj#define BfLen(type) screen->bf_len_##type 126b7c89284Ssnj 127b7c89284Ssnj#define TypedBuffer(type) \ 128b7c89284Ssnj type *bf_buf_##type; \ 129b7c89284Ssnj Cardinal bf_len_##type 130b7c89284Ssnj 131b7c89284Ssnj#define BumpTypedBuffer(type, want) \ 132b7c89284Ssnj BumpBuffer(type, BfBuf(type), BfLen(type), want) 133b7c89284Ssnj 134b7c89284Ssnj#define FreeTypedBuffer(type) \ 135b7c89284Ssnj if (BfBuf(type) != 0) { \ 136b7c89284Ssnj free(BfBuf(type)); \ 137b7c89284Ssnj BfBuf(type) = 0; \ 138b7c89284Ssnj } \ 139b7c89284Ssnj BfLen(type) = 0 140b7c89284Ssnj 141d522f475Smrg/* 142d522f475Smrg** System V definitions 143d522f475Smrg*/ 144d522f475Smrg 145d522f475Smrg#ifdef att 146d522f475Smrg#define ATT 147d522f475Smrg#endif 148d522f475Smrg 149d522f475Smrg#ifdef SVR4 150d522f475Smrg#undef SYSV /* predefined on Solaris 2.4 */ 151d522f475Smrg#define SYSV /* SVR4 is (approx) superset of SVR3 */ 152d522f475Smrg#define ATT 153d522f475Smrg#endif 154d522f475Smrg 155d522f475Smrg#ifdef SYSV 156d522f475Smrg#ifdef X_NOT_POSIX 157d522f475Smrg#if !defined(CRAY) && !defined(SVR4) 158d522f475Smrg#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ 159d522f475Smrg (close(fd2), fcntl(fd1, F_DUPFD, fd2))) 160d522f475Smrg#endif 161d522f475Smrg#endif 162d522f475Smrg#endif /* SYSV */ 163d522f475Smrg 164d522f475Smrg/* 165d522f475Smrg * Newer versions of <X11/Xft/Xft.h> have a version number. We use certain 166d522f475Smrg * features from that. 167d522f475Smrg */ 168d522f475Smrg#if defined(XRENDERFONT) && defined(XFT_VERSION) && XFT_VERSION >= 20100 169d522f475Smrg#define HAVE_TYPE_FCCHAR32 1 /* compatible: XftChar16 */ 170d522f475Smrg#define HAVE_TYPE_XFTCHARSPEC 1 /* new type XftCharSpec */ 171d522f475Smrg#endif 172d522f475Smrg 173d522f475Smrg/* 174d522f475Smrg** Definitions to simplify ifdef's for pty's. 175d522f475Smrg*/ 176d522f475Smrg#define USE_PTY_DEVICE 1 177d522f475Smrg#define USE_PTY_SEARCH 1 178d522f475Smrg 179b7c89284Ssnj#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 180d522f475Smrg#undef USE_PTY_DEVICE 181d522f475Smrg#undef USE_PTY_SEARCH 182d522f475Smrg#define USE_PTS_DEVICE 1 183d522f475Smrg#elif defined(VMS) 184d522f475Smrg#undef USE_PTY_DEVICE 185d522f475Smrg#undef USE_PTY_SEARCH 186d522f475Smrg#elif defined(PUCC_PTYD) 187d522f475Smrg#undef USE_PTY_SEARCH 188d522f475Smrg#elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__) 189d522f475Smrg#undef USE_PTY_SEARCH 1903367019cSmrg#elif defined(__OpenBSD__) 1913367019cSmrg#undef USE_PTY_SEARCH 1923367019cSmrg#undef USE_PTY_DEVICE 193d522f475Smrg#endif 194d522f475Smrg 1953367019cSmrg#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 1963367019cSmrg#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */ 197d522f475Smrg#endif 198d522f475Smrg 199d522f475Smrg#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 200d522f475Smrg#define USE_USG_PTYS 201d522f475Smrg#elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386)) 202d522f475Smrg#define USE_USG_PTYS 203d522f475Smrg#endif 204d522f475Smrg 205d522f475Smrg/* 206d522f475Smrg * More systems than not require pty-handshaking. 207d522f475Smrg */ 208d522f475Smrg#ifndef USE_HANDSHAKE 209d522f475Smrg#define USE_HANDSHAKE 1 210d522f475Smrg#endif 211d522f475Smrg 212d522f475Smrg/* 213d522f475Smrg** allow for mobility of the pty master/slave directories 214d522f475Smrg*/ 215d522f475Smrg#ifndef PTYDEV 216d522f475Smrg#if defined(__hpux) 217d522f475Smrg#define PTYDEV "/dev/ptym/ptyxx" 218d522f475Smrg#elif defined(__MVS__) 219d522f475Smrg#define PTYDEV "/dev/ptypxxxx" 220d522f475Smrg#else 221d522f475Smrg#define PTYDEV "/dev/ptyxx" 222d522f475Smrg#endif 223d522f475Smrg#endif /* !PTYDEV */ 224d522f475Smrg 225d522f475Smrg#ifndef TTYDEV 226d522f475Smrg#if defined(__hpux) 227d522f475Smrg#define TTYDEV "/dev/pty/ttyxx" 228d522f475Smrg#elif defined(__MVS__) 229d522f475Smrg#define TTYDEV "/dev/ptypxxxx" 230d522f475Smrg#elif defined(USE_PTS_DEVICE) 231d522f475Smrg#define TTYDEV "/dev/pts/0" 232d522f475Smrg#else 233d522f475Smrg#define TTYDEV "/dev/ttyxx" 234d522f475Smrg#endif 235d522f475Smrg#endif /* !TTYDEV */ 236d522f475Smrg 237d522f475Smrg#ifndef PTYCHAR1 238d522f475Smrg#ifdef __hpux 239d522f475Smrg#define PTYCHAR1 "zyxwvutsrqp" 240d522f475Smrg#else /* !__hpux */ 241d522f475Smrg#define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" 242d522f475Smrg#endif /* !__hpux */ 243d522f475Smrg#endif /* !PTYCHAR1 */ 244d522f475Smrg 245d522f475Smrg#ifndef PTYCHAR2 246d522f475Smrg#ifdef __hpux 247d522f475Smrg#define PTYCHAR2 "fedcba9876543210" 248d522f475Smrg#else /* !__hpux */ 249d522f475Smrg#if defined(__DragonFly__) || defined(__FreeBSD__) 250d522f475Smrg#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" 251d522f475Smrg#else /* !__FreeBSD__ */ 252d522f475Smrg#define PTYCHAR2 "0123456789abcdef" 253d522f475Smrg#endif /* !__FreeBSD__ */ 254d522f475Smrg#endif /* !__hpux */ 255d522f475Smrg#endif /* !PTYCHAR2 */ 256d522f475Smrg 257d522f475Smrg#ifndef TTYFORMAT 258d522f475Smrg#if defined(CRAY) 259d522f475Smrg#define TTYFORMAT "/dev/ttyp%03d" 260d522f475Smrg#elif defined(__MVS__) 261d522f475Smrg#define TTYFORMAT "/dev/ttyp%04d" 262d522f475Smrg#else 263d522f475Smrg#define TTYFORMAT "/dev/ttyp%d" 264d522f475Smrg#endif 265d522f475Smrg#endif /* TTYFORMAT */ 266d522f475Smrg 267d522f475Smrg#ifndef PTYFORMAT 268d522f475Smrg#ifdef CRAY 269d522f475Smrg#define PTYFORMAT "/dev/pty/%03d" 270d522f475Smrg#elif defined(__MVS__) 271d522f475Smrg#define PTYFORMAT "/dev/ptyp%04d" 272d522f475Smrg#else 273d522f475Smrg#define PTYFORMAT "/dev/ptyp%d" 274d522f475Smrg#endif 275d522f475Smrg#endif /* PTYFORMAT */ 276d522f475Smrg 277d522f475Smrg#ifndef PTYCHARLEN 278d522f475Smrg#ifdef CRAY 279d522f475Smrg#define PTYCHARLEN 3 280d522f475Smrg#elif defined(__MVS__) 281d522f475Smrg#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ 282d522f475Smrg#else 283d522f475Smrg#define PTYCHARLEN 2 284d522f475Smrg#endif 285d522f475Smrg#endif 286d522f475Smrg 287d522f475Smrg#ifndef MAXPTTYS 288d522f475Smrg#ifdef CRAY 289d522f475Smrg#define MAXPTTYS 256 290d522f475Smrg#else 291d522f475Smrg#define MAXPTTYS 2048 292d522f475Smrg#endif 293d522f475Smrg#endif 294d522f475Smrg 295d522f475Smrg/* Until the translation manager comes along, I have to do my own translation of 296d522f475Smrg * mouse events into the proper routines. */ 297d522f475Smrg 298d522f475Smrgtypedef enum { 299d522f475Smrg NORMAL = 0 300d522f475Smrg , LEFTEXTENSION 301d522f475Smrg , RIGHTEXTENSION 302d522f475Smrg} EventMode; 303d522f475Smrg 304d522f475Smrg/* 305d522f475Smrg * The origin of a screen is 0, 0. Therefore, the number of rows 306d522f475Smrg * on a screen is screen->max_row + 1, and similarly for columns. 307d522f475Smrg */ 308d522f475Smrg#define MaxCols(screen) ((screen)->max_col + 1) 309d522f475Smrg#define MaxRows(screen) ((screen)->max_row + 1) 310d522f475Smrg 311d522f475Smrgtypedef unsigned char Char; /* to support 8 bit chars */ 312d522f475Smrgtypedef Char *ScrnPtr; 313d522f475Smrgtypedef ScrnPtr *ScrnBuf; 314d522f475Smrg 315cd3331d0Smrg/* 316cd3331d0Smrg * Declare an X String, but for unsigned chars. 317cd3331d0Smrg */ 318cd3331d0Smrg#ifdef _CONST_X_STRING 319cd3331d0Smrgtypedef const Char *UString; 320cd3331d0Smrg#else 321cd3331d0Smrgtypedef Char *UString; 322cd3331d0Smrg#endif 323cd3331d0Smrg 324cd3331d0Smrg#define IsEmpty(s) ((s) == 0 || *(s) == '\0') 3259a64e1c5Smrg#define IsSpace(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') 326cd3331d0Smrg 327037a25ddSmrg/* 328037a25ddSmrg * Check strtol result, using "FullS2L" when no more data is expected, and 329037a25ddSmrg * "PartS2L" when more data may follow in the string. 330037a25ddSmrg */ 331037a25ddSmrg#define FullS2L(s,d) (PartS2L(s,d) && (*(d) == '\0')) 332037a25ddSmrg#define PartS2L(s,d) (isdigit(CharOf(*(s))) && (d) != (s) && (d) != 0) 333037a25ddSmrg 334037a25ddSmrg#define CASETYPE(name) case name: result = #name; break 335037a25ddSmrg 336fa3f02f3Smrg#define CharOf(n) ((Char)(n)) 337d522f475Smrg 338d522f475Smrgtypedef struct { 339d522f475Smrg int row; 340d522f475Smrg int col; 341d522f475Smrg} CELL; 342d522f475Smrg 343d522f475Smrg#define isSameRow(a,b) ((a)->row == (b)->row) 344d522f475Smrg#define isSameCol(a,b) ((a)->col == (b)->col) 345d522f475Smrg#define isSameCELL(a,b) (isSameRow(a,b) && isSameCol(a,b)) 346d522f475Smrg 347d522f475Smrg#define xBIT(n) (1 << (n)) 348d522f475Smrg 349d522f475Smrg/* 350d522f475Smrg * ANSI emulation, special character codes 351d522f475Smrg */ 352cd3331d0Smrg#define ANSI_EOT 0x04 353d522f475Smrg#define ANSI_BEL 0x07 354cd3331d0Smrg#define ANSI_BS 0x08 355cd3331d0Smrg#define ANSI_HT 0x09 356cd3331d0Smrg#define ANSI_LF 0x0A 357cd3331d0Smrg#define ANSI_VT 0x0B 358d522f475Smrg#define ANSI_FF 0x0C /* C0, C1 control names */ 359cd3331d0Smrg#define ANSI_CR 0x0D 360cd3331d0Smrg#define ANSI_SO 0x0E 361cd3331d0Smrg#define ANSI_SI 0x0F 362cd3331d0Smrg#define ANSI_XON 0x11 /* DC1 */ 363cd3331d0Smrg#define ANSI_XOFF 0x13 /* DC3 */ 364d522f475Smrg#define ANSI_NAK 0x15 365d522f475Smrg#define ANSI_CAN 0x18 366d522f475Smrg#define ANSI_ESC 0x1B 367d522f475Smrg#define ANSI_SPA 0x20 368d522f475Smrg#define XTERM_POUND 0x1E /* internal mapping for '#' */ 369d522f475Smrg#define ANSI_DEL 0x7F 370d522f475Smrg#define ANSI_SS2 0x8E 371d522f475Smrg#define ANSI_SS3 0x8F 372d522f475Smrg#define ANSI_DCS 0x90 373d522f475Smrg#define ANSI_SOS 0x98 374d522f475Smrg#define ANSI_CSI 0x9B 375d522f475Smrg#define ANSI_ST 0x9C 376d522f475Smrg#define ANSI_OSC 0x9D 377d522f475Smrg#define ANSI_PM 0x9E 378d522f475Smrg#define ANSI_APC 0x9F 379d522f475Smrg 38094644356Smrg#define L_CURL '{' 38194644356Smrg#define R_CURL '}' 38294644356Smrg 383d522f475Smrg#define MIN_DECID 52 /* can emulate VT52 */ 3843367019cSmrg#define MAX_DECID 525 /* ...through VT525 */ 385d522f475Smrg 386d522f475Smrg#ifndef DFT_DECID 3873367019cSmrg#define DFT_DECID "vt420" /* default VT420 */ 388d522f475Smrg#endif 389d522f475Smrg 390d522f475Smrg#ifndef DFT_KBD_DIALECT 391d522f475Smrg#define DFT_KBD_DIALECT "B" /* default USASCII */ 392d522f475Smrg#endif 393d522f475Smrg 394d522f475Smrg/* constants used for utf8 mode */ 395d522f475Smrg#define UCS_REPL 0xfffd 396d522f475Smrg#define UCS_LIMIT 0x80000000U /* both limit and flag for non-UCS */ 397d522f475Smrg 398d522f475Smrg#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ 399d522f475Smrg 400dfb07bc7Smrg#define MAX_XLFD_FONTS 1 401dfb07bc7Smrg#define MAX_XFT_FONTS 1 402dfb07bc7Smrg#define NMENUFONTS 9 /* font entries in fontMenu */ 403d522f475Smrg 404d522f475Smrg#define NBOX 5 /* Number of Points in box */ 405d522f475Smrg#define NPARAM 30 /* Max. parameters */ 406d522f475Smrg 407d522f475Smrgtypedef struct { 408cd3331d0Smrg String opt; 409cd3331d0Smrg String desc; 410d522f475Smrg} OptionHelp; 411d522f475Smrg 4123367019cSmrgtypedef struct { 4133367019cSmrg int count; /* number of values in params[] */ 4143367019cSmrg int has_subparams; /* true if there are any sub's */ 4153367019cSmrg int is_sub[NPARAM]; /* true for subparam */ 4163367019cSmrg int params[NPARAM]; /* parameter value */ 4173367019cSmrg} PARAMS; 4183367019cSmrg 4190d92cbfdSchristostypedef short ParmType; 4200d92cbfdSchristos 421d522f475Smrgtypedef struct { 4220d92cbfdSchristos Char a_type; /* CSI, etc., see unparseq() */ 4230d92cbfdSchristos Char a_pintro; /* private-mode char, if any */ 4243367019cSmrg const char * a_delim; /* between parameters (;) */ 4250d92cbfdSchristos Char a_inters; /* special (before final-char) */ 4260d92cbfdSchristos Char a_final; /* final-char */ 4270d92cbfdSchristos ParmType a_nparam; /* # of parameters */ 4280d92cbfdSchristos ParmType a_param[NPARAM]; /* Parameters */ 4293367019cSmrg Char a_radix[NPARAM]; /* Parameters */ 430d522f475Smrg} ANSI; 431d522f475Smrg 432d522f475Smrg#define TEK_FONT_LARGE 0 433d522f475Smrg#define TEK_FONT_2 1 434d522f475Smrg#define TEK_FONT_3 2 435d522f475Smrg#define TEK_FONT_SMALL 3 436d522f475Smrg#define TEKNUMFONTS 4 437d522f475Smrg 438d522f475Smrg/* Actually there are 5 types of lines, but four are non-solid lines */ 439d522f475Smrg#define TEKNUMLINES 4 440d522f475Smrg 441d522f475Smrgtypedef struct { 442d522f475Smrg int x; 443d522f475Smrg int y; 444d522f475Smrg int fontsize; 445d522f475Smrg unsigned linetype; 446d522f475Smrg} Tmodes; 447d522f475Smrg 448d522f475Smrgtypedef struct { 449d522f475Smrg int Twidth; 450d522f475Smrg int Theight; 451d522f475Smrg} T_fontsize; 452d522f475Smrg 453d522f475Smrgtypedef struct { 454d522f475Smrg short *bits; 455d522f475Smrg int x; 456d522f475Smrg int y; 457d522f475Smrg int width; 458d522f475Smrg int height; 459d522f475Smrg} BitmapBits; 460d522f475Smrg 461d522f475Smrg#define SAVELINES 64 /* default # lines to save */ 462d522f475Smrg#define SCROLLLINES 1 /* default # lines to scroll */ 463d522f475Smrg 464d522f475Smrg#define EXCHANGE(a,b,tmp) tmp = a; a = b; b = tmp 465d522f475Smrg 466d522f475Smrg/***====================================================================***/ 467d522f475Smrg 468d522f475Smrg#if (XtSpecificationRelease < 6) 469d522f475Smrg#ifndef NO_ACTIVE_ICON 470d522f475Smrg#define NO_ACTIVE_ICON 1 /* Note: code relies on an X11R6 function */ 471d522f475Smrg#endif 472d522f475Smrg#endif 473d522f475Smrg 474d522f475Smrg#ifndef OPT_AIX_COLORS 475d522f475Smrg#define OPT_AIX_COLORS 1 /* true if xterm is configured with AIX (16) colors */ 476d522f475Smrg#endif 477d522f475Smrg 478b7c89284Ssnj#ifndef OPT_ALLOW_XXX_OPS 479b7c89284Ssnj#define OPT_ALLOW_XXX_OPS 1 /* true if xterm adds "Allow XXX Ops" submenu */ 480b7c89284Ssnj#endif 481b7c89284Ssnj 482d522f475Smrg#ifndef OPT_BLINK_CURS 483d522f475Smrg#define OPT_BLINK_CURS 1 /* true if xterm has blinking cursor capability */ 484d522f475Smrg#endif 485d522f475Smrg 486d522f475Smrg#ifndef OPT_BLINK_TEXT 487d522f475Smrg#define OPT_BLINK_TEXT OPT_BLINK_CURS /* true if xterm has blinking text capability */ 488d522f475Smrg#endif 489d522f475Smrg 490d522f475Smrg#ifndef OPT_BOX_CHARS 491d522f475Smrg#define OPT_BOX_CHARS 1 /* true if xterm can simulate box-characters */ 492d522f475Smrg#endif 493d522f475Smrg 4943367019cSmrg#ifndef OPT_BUILTIN_XPMS 4953367019cSmrg#define OPT_BUILTIN_XPMS 0 /* true if all xpm data is compiled-in */ 4963367019cSmrg#endif 4973367019cSmrg 498d522f475Smrg#ifndef OPT_BROKEN_OSC 499d522f475Smrg#ifdef linux 500d522f475Smrg#define OPT_BROKEN_OSC 1 /* man console_codes, 1st paragraph - cf: ECMA-48 */ 501d522f475Smrg#else 502d522f475Smrg#define OPT_BROKEN_OSC 0 /* true if xterm allows Linux's broken OSC parsing */ 503d522f475Smrg#endif 504d522f475Smrg#endif 505d522f475Smrg 506d522f475Smrg#ifndef OPT_BROKEN_ST 507d522f475Smrg#define OPT_BROKEN_ST 1 /* true if xterm allows old/broken OSC parsing */ 508d522f475Smrg#endif 509d522f475Smrg 510d522f475Smrg#ifndef OPT_C1_PRINT 511d522f475Smrg#define OPT_C1_PRINT 1 /* true if xterm allows C1 controls to be printable */ 512d522f475Smrg#endif 513d522f475Smrg 514d522f475Smrg#ifndef OPT_CLIP_BOLD 515d522f475Smrg#define OPT_CLIP_BOLD 1 /* true if xterm uses clipping to avoid bold-trash */ 516d522f475Smrg#endif 517d522f475Smrg 518d522f475Smrg#ifndef OPT_COLOR_CLASS 519d522f475Smrg#define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ 520d522f475Smrg#endif 521d522f475Smrg 522d522f475Smrg#ifndef OPT_COLOR_RES 523d522f475Smrg#define OPT_COLOR_RES 1 /* true if xterm delays color-resource evaluation */ 524d522f475Smrg#endif 525d522f475Smrg 526d522f475Smrg#ifndef OPT_DABBREV 527d522f475Smrg#define OPT_DABBREV 0 /* dynamic abbreviations */ 528d522f475Smrg#endif 529d522f475Smrg 530d522f475Smrg#ifndef OPT_DEC_CHRSET 531d522f475Smrg#define OPT_DEC_CHRSET 1 /* true if xterm is configured for DEC charset */ 532d522f475Smrg#endif 533d522f475Smrg 534d522f475Smrg#ifndef OPT_DEC_LOCATOR 535d522f475Smrg#define OPT_DEC_LOCATOR 0 /* true if xterm supports VT220-style mouse events */ 536d522f475Smrg#endif 537d522f475Smrg 538d522f475Smrg#ifndef OPT_DEC_RECTOPS 539d522f475Smrg#define OPT_DEC_RECTOPS 0 /* true if xterm is configured for VT420 rectangles */ 540d522f475Smrg#endif 541d522f475Smrg 542fa3f02f3Smrg#ifndef OPT_SIXEL_GRAPHICS 5439a64e1c5Smrg#define OPT_SIXEL_GRAPHICS 0 /* true if xterm supports VT240-style sixel graphics */ 5449a64e1c5Smrg#endif 5459a64e1c5Smrg 546037a25ddSmrg#ifndef OPT_SCREEN_DUMPS 547037a25ddSmrg#define OPT_SCREEN_DUMPS 0 /* true if xterm supports screen dumps */ 548037a25ddSmrg#endif 549037a25ddSmrg 5509a64e1c5Smrg#ifndef OPT_REGIS_GRAPHICS 5519a64e1c5Smrg#define OPT_REGIS_GRAPHICS 0 /* true if xterm supports VT125/VT240/VT330 ReGIS graphics */ 5529a64e1c5Smrg#endif 5539a64e1c5Smrg 5549a64e1c5Smrg#ifndef OPT_GRAPHICS 5559a64e1c5Smrg#define OPT_GRAPHICS 0 /* true if xterm is configured for any type of graphics */ 556fa3f02f3Smrg#endif 557fa3f02f3Smrg 558d522f475Smrg#ifndef OPT_DEC_SOFTFONT 559d522f475Smrg#define OPT_DEC_SOFTFONT 0 /* true if xterm is configured for VT220 softfonts */ 560d522f475Smrg#endif 561d522f475Smrg 5623367019cSmrg#ifndef OPT_DOUBLE_BUFFER 5633367019cSmrg#define OPT_DOUBLE_BUFFER 0 /* true if using double-buffering */ 5643367019cSmrg#endif 5653367019cSmrg 566d522f475Smrg#ifndef OPT_EBCDIC 567d522f475Smrg#ifdef __MVS__ 568d522f475Smrg#define OPT_EBCDIC 1 569d522f475Smrg#else 570d522f475Smrg#define OPT_EBCDIC 0 571d522f475Smrg#endif 572d522f475Smrg#endif 573d522f475Smrg 574d522f475Smrg#ifndef OPT_EXEC_XTERM 575d522f475Smrg#define OPT_EXEC_XTERM 0 /* true if xterm can fork/exec copies of itself */ 576d522f475Smrg#endif 577d522f475Smrg 578d522f475Smrg#ifndef OPT_EXTRA_PASTE 579d522f475Smrg#define OPT_EXTRA_PASTE 1 580d522f475Smrg#endif 581d522f475Smrg 582b7c89284Ssnj#ifndef OPT_FIFO_LINES 583b7c89284Ssnj#define OPT_FIFO_LINES 0 /* optimize save-lines feature using FIFO */ 584b7c89284Ssnj#endif 585b7c89284Ssnj 586d522f475Smrg#ifndef OPT_FOCUS_EVENT 587d522f475Smrg#define OPT_FOCUS_EVENT 1 /* focus in/out events */ 588d522f475Smrg#endif 589d522f475Smrg 590d522f475Smrg#ifndef OPT_HP_FUNC_KEYS 591d522f475Smrg#define OPT_HP_FUNC_KEYS 0 /* true if xterm supports HP-style function keys */ 592d522f475Smrg#endif 593d522f475Smrg 594d522f475Smrg#ifndef OPT_I18N_SUPPORT 595d522f475Smrg#if (XtSpecificationRelease >= 5) 596d522f475Smrg#define OPT_I18N_SUPPORT 1 /* true if xterm uses internationalization support */ 597d522f475Smrg#else 598d522f475Smrg#define OPT_I18N_SUPPORT 0 599d522f475Smrg#endif 600d522f475Smrg#endif 601d522f475Smrg 602d522f475Smrg#ifndef OPT_INITIAL_ERASE 603d522f475Smrg#define OPT_INITIAL_ERASE 1 /* use pty's erase character if it's not 128 */ 604d522f475Smrg#endif 605d522f475Smrg 606d522f475Smrg#ifndef OPT_INPUT_METHOD 607d522f475Smrg#if (XtSpecificationRelease >= 6) 608d522f475Smrg#define OPT_INPUT_METHOD 1 /* true if xterm uses input-method support */ 609d522f475Smrg#else 610d522f475Smrg#define OPT_INPUT_METHOD 0 611d522f475Smrg#endif 612d522f475Smrg#endif 613d522f475Smrg 614d522f475Smrg#ifndef OPT_ISO_COLORS 615d522f475Smrg#define OPT_ISO_COLORS 1 /* true if xterm is configured with ISO colors */ 616d522f475Smrg#endif 617d522f475Smrg 618d522f475Smrg#ifndef OPT_256_COLORS 619d522f475Smrg#define OPT_256_COLORS 0 /* true if xterm is configured with 256 colors */ 620d522f475Smrg#endif 621d522f475Smrg 622d522f475Smrg#ifndef OPT_88_COLORS 623d522f475Smrg#define OPT_88_COLORS 0 /* true if xterm is configured with 88 colors */ 624d522f475Smrg#endif 625d522f475Smrg 626d522f475Smrg#ifndef OPT_HIGHLIGHT_COLOR 627d522f475Smrg#define OPT_HIGHLIGHT_COLOR 1 /* true if xterm supports color highlighting */ 628d522f475Smrg#endif 629d522f475Smrg 630d522f475Smrg#ifndef OPT_LOAD_VTFONTS 631d522f475Smrg#define OPT_LOAD_VTFONTS 0 /* true if xterm has load-vt-fonts() action */ 632d522f475Smrg#endif 633d522f475Smrg 634d522f475Smrg#ifndef OPT_LUIT_PROG 635d522f475Smrg#define OPT_LUIT_PROG 0 /* true if xterm supports luit */ 636d522f475Smrg#endif 637d522f475Smrg 638d522f475Smrg#ifndef OPT_MAXIMIZE 639d522f475Smrg#define OPT_MAXIMIZE 1 /* add actions for iconify ... maximize */ 640d522f475Smrg#endif 641d522f475Smrg 642d522f475Smrg#ifndef OPT_MINI_LUIT 643d522f475Smrg#define OPT_MINI_LUIT 0 /* true if xterm supports built-in mini-luit */ 644d522f475Smrg#endif 645d522f475Smrg 646d522f475Smrg#ifndef OPT_MOD_FKEYS 647d522f475Smrg#define OPT_MOD_FKEYS 1 /* modify cursor- and function-keys in normal mode */ 648d522f475Smrg#endif 649d522f475Smrg 650d522f475Smrg#ifndef OPT_NUM_LOCK 651d522f475Smrg#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ 652d522f475Smrg#endif 653d522f475Smrg 654d522f475Smrg#ifndef OPT_PASTE64 655d522f475Smrg#define OPT_PASTE64 0 /* program control of select/paste via base64 */ 656d522f475Smrg#endif 657d522f475Smrg 658d522f475Smrg#ifndef OPT_PC_COLORS 659d522f475Smrg#define OPT_PC_COLORS 1 /* true if xterm supports PC-style (bold) colors */ 660d522f475Smrg#endif 661d522f475Smrg 662712a7ff4Smrg#ifndef OPT_PRINT_ON_EXIT 663712a7ff4Smrg#define OPT_PRINT_ON_EXIT 1 /* true allows xterm to dump screen on X error */ 664712a7ff4Smrg#endif 665712a7ff4Smrg 666d522f475Smrg#ifndef OPT_PTY_HANDSHAKE 667d522f475Smrg#define OPT_PTY_HANDSHAKE USE_HANDSHAKE /* avoid pty races on older systems */ 668d522f475Smrg#endif 669d522f475Smrg 670d522f475Smrg#ifndef OPT_PRINT_COLORS 671d522f475Smrg#define OPT_PRINT_COLORS 1 /* true if we print color information */ 672d522f475Smrg#endif 673d522f475Smrg 674d522f475Smrg#ifndef OPT_READLINE 675d522f475Smrg#define OPT_READLINE 0 /* mouse-click/paste support for readline */ 676d522f475Smrg#endif 677d522f475Smrg 678d522f475Smrg#ifndef OPT_RENDERFONT 679d522f475Smrg#ifdef XRENDERFONT 680d522f475Smrg#define OPT_RENDERFONT 1 681d522f475Smrg#else 682d522f475Smrg#define OPT_RENDERFONT 0 683d522f475Smrg#endif 684d522f475Smrg#endif 685d522f475Smrg 686d522f475Smrg#ifndef OPT_RENDERWIDE 687d522f475Smrg#if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) 688d522f475Smrg#define OPT_RENDERWIDE 1 689d522f475Smrg#else 690d522f475Smrg#define OPT_RENDERWIDE 0 691d522f475Smrg#endif 692d522f475Smrg#endif 693d522f475Smrg 694dfb07bc7Smrg#ifndef OPT_REPORT_CCLASS 695dfb07bc7Smrg#define OPT_REPORT_CCLASS 1 /* provide "-report-charclass" option */ 696dfb07bc7Smrg#endif 697dfb07bc7Smrg 698fa3f02f3Smrg#ifndef OPT_REPORT_COLORS 699fa3f02f3Smrg#define OPT_REPORT_COLORS 1 /* provide "-report-colors" option */ 700fa3f02f3Smrg#endif 701fa3f02f3Smrg 702fa3f02f3Smrg#ifndef OPT_REPORT_FONTS 703fa3f02f3Smrg#define OPT_REPORT_FONTS 1 /* provide "-report-fonts" option */ 704fa3f02f3Smrg#endif 705fa3f02f3Smrg 706d522f475Smrg#ifndef OPT_SAME_NAME 707d522f475Smrg#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ 708d522f475Smrg#endif 709d522f475Smrg 710b7c89284Ssnj#ifndef OPT_SAVE_LINES 711b7c89284Ssnj#define OPT_SAVE_LINES OPT_FIFO_LINES /* optimize save-lines feature */ 712b7c89284Ssnj#endif 713b7c89284Ssnj 714d522f475Smrg#ifndef OPT_SCO_FUNC_KEYS 715d522f475Smrg#define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ 716d522f475Smrg#endif 717d522f475Smrg 718d522f475Smrg#ifndef OPT_SUN_FUNC_KEYS 719d522f475Smrg#define OPT_SUN_FUNC_KEYS 1 /* true if xterm supports Sun-style function keys */ 720d522f475Smrg#endif 721d522f475Smrg 722cd3331d0Smrg#ifndef OPT_SCROLL_LOCK 723cd3331d0Smrg#define OPT_SCROLL_LOCK 1 /* true if xterm interprets fontsize-shifting */ 724cd3331d0Smrg#endif 725cd3331d0Smrg 726d522f475Smrg#ifndef OPT_SELECT_REGEX 727d522f475Smrg#define OPT_SELECT_REGEX 0 /* true if xterm supports regular-expression selects */ 728d522f475Smrg#endif 729d522f475Smrg 7303367019cSmrg#ifndef OPT_SELECTION_OPS 7313367019cSmrg#define OPT_SELECTION_OPS 1 /* true if xterm supports operations on selection */ 7323367019cSmrg#endif 7333367019cSmrg 734d522f475Smrg#ifndef OPT_SESSION_MGT 735d522f475Smrg#if defined(XtNdieCallback) && defined(XtNsaveCallback) 736d522f475Smrg#define OPT_SESSION_MGT 1 737d522f475Smrg#else 738d522f475Smrg#define OPT_SESSION_MGT 0 739d522f475Smrg#endif 740d522f475Smrg#endif 741d522f475Smrg 742d522f475Smrg#ifndef OPT_SHIFT_FONTS 743781b53c7Schristos#define OPT_SHIFT_FONTS 0 /* true if xterm interprets fontsize-shifting */ 744d522f475Smrg#endif 745d522f475Smrg 746d522f475Smrg#ifndef OPT_SUNPC_KBD 747d522f475Smrg#define OPT_SUNPC_KBD 1 /* true if xterm supports Sun/PC keyboard map */ 748d522f475Smrg#endif 749d522f475Smrg 750d522f475Smrg#ifndef OPT_TCAP_FKEYS 751d522f475Smrg#define OPT_TCAP_FKEYS 0 /* true for experimental termcap function-keys */ 752d522f475Smrg#endif 753d522f475Smrg 754d522f475Smrg#ifndef OPT_TCAP_QUERY 755d522f475Smrg#define OPT_TCAP_QUERY 0 /* true for experimental termcap query */ 756d522f475Smrg#endif 757d522f475Smrg 758d522f475Smrg#ifndef OPT_TEK4014 759d522f475Smrg#define OPT_TEK4014 1 /* true if we're using tek4014 emulation */ 760d522f475Smrg#endif 761d522f475Smrg 762d522f475Smrg#ifndef OPT_TOOLBAR 763d522f475Smrg#define OPT_TOOLBAR 0 /* true if xterm supports toolbar menus */ 764d522f475Smrg#endif 765d522f475Smrg 766d522f475Smrg#ifndef OPT_TRACE 767d522f475Smrg#define OPT_TRACE 0 /* true if we're using debugging traces */ 768d522f475Smrg#endif 769d522f475Smrg 770d522f475Smrg#ifndef OPT_TRACE_FLAGS 771d522f475Smrg#define OPT_TRACE_FLAGS 0 /* additional tracing used for SCRN_BUF_FLAGS */ 772d522f475Smrg#endif 773d522f475Smrg 774d522f475Smrg#ifndef OPT_VT52_MODE 775d522f475Smrg#define OPT_VT52_MODE 1 /* true if xterm supports VT52 emulation */ 776d522f475Smrg#endif 777d522f475Smrg 7789a64e1c5Smrg#ifndef OPT_WIDE_ATTRS 7799a64e1c5Smrg#define OPT_WIDE_ATTRS 1 /* true if xterm supports 16-bit attributes */ 7809a64e1c5Smrg#endif 7819a64e1c5Smrg 782d522f475Smrg#ifndef OPT_WIDE_CHARS 783d522f475Smrg#define OPT_WIDE_CHARS 0 /* true if xterm supports 16-bit characters */ 784d522f475Smrg#endif 785d522f475Smrg 786b7c89284Ssnj#ifndef OPT_WIDER_ICHAR 787b7c89284Ssnj#define OPT_WIDER_ICHAR 1 /* true if xterm uses 32-bits for wide-chars */ 788b7c89284Ssnj#endif 789b7c89284Ssnj 790d522f475Smrg#ifndef OPT_XMC_GLITCH 791d522f475Smrg#define OPT_XMC_GLITCH 0 /* true if xterm supports xmc (magic cookie glitch) */ 792d522f475Smrg#endif 793d522f475Smrg 794d522f475Smrg#ifndef OPT_ZICONBEEP 795d522f475Smrg#define OPT_ZICONBEEP 1 /* true if xterm supports "-ziconbeep" option */ 796d522f475Smrg#endif 797d522f475Smrg 798d522f475Smrg/***====================================================================***/ 799d522f475Smrg 800d522f475Smrg#if OPT_AIX_COLORS && !OPT_ISO_COLORS 801d522f475Smrg/* You must have ANSI/ISO colors to support AIX colors */ 802d522f475Smrg#undef OPT_AIX_COLORS 803d522f475Smrg#define OPT_AIX_COLORS 0 804d522f475Smrg#endif 805d522f475Smrg 806d522f475Smrg#if OPT_COLOR_RES && !OPT_ISO_COLORS 807d522f475Smrg/* You must have ANSI/ISO colors to support ColorRes logic */ 808d522f475Smrg#undef OPT_COLOR_RES 809d522f475Smrg#define OPT_COLOR_RES 0 810d522f475Smrg#endif 811d522f475Smrg 812cd3331d0Smrg#if OPT_256_COLORS && (OPT_WIDE_CHARS || OPT_RENDERFONT || OPT_XMC_GLITCH) 813cd3331d0Smrg/* It's actually more complicated than that - but by trimming options you can 814cd3331d0Smrg * have 256 color resources though. 815cd3331d0Smrg */ 816cd3331d0Smrg#define OPT_COLOR_RES2 1 817cd3331d0Smrg#else 818d522f475Smrg#define OPT_COLOR_RES2 0 819d522f475Smrg#endif 820d522f475Smrg 821d522f475Smrg#if OPT_PASTE64 && !OPT_READLINE 822d522f475Smrg/* OPT_PASTE64 uses logic from OPT_READLINE */ 823d522f475Smrg#undef OPT_READLINE 824d522f475Smrg#define OPT_READLINE 1 825d522f475Smrg#endif 826d522f475Smrg 827d522f475Smrg#if OPT_PC_COLORS && !OPT_ISO_COLORS 828d522f475Smrg/* You must have ANSI/ISO colors to support PC colors */ 829d522f475Smrg#undef OPT_PC_COLORS 830d522f475Smrg#define OPT_PC_COLORS 0 831d522f475Smrg#endif 832d522f475Smrg 833d522f475Smrg#if OPT_PRINT_COLORS && !OPT_ISO_COLORS 834d522f475Smrg/* You must have ANSI/ISO colors to be able to print them */ 835d522f475Smrg#undef OPT_PRINT_COLORS 836d522f475Smrg#define OPT_PRINT_COLORS 0 837d522f475Smrg#endif 838d522f475Smrg 839d522f475Smrg#if OPT_256_COLORS && !OPT_ISO_COLORS 840d522f475Smrg/* You must have ANSI/ISO colors to support 256 colors */ 841d522f475Smrg#undef OPT_256_COLORS 842d522f475Smrg#define OPT_256_COLORS 0 843d522f475Smrg#endif 844d522f475Smrg 845d522f475Smrg#if OPT_88_COLORS && !OPT_ISO_COLORS 846d522f475Smrg/* You must have ANSI/ISO colors to support 88 colors */ 847d522f475Smrg#undef OPT_88_COLORS 848d522f475Smrg#define OPT_88_COLORS 0 849d522f475Smrg#endif 850d522f475Smrg 851d522f475Smrg#if OPT_88_COLORS && OPT_256_COLORS 852d522f475Smrg/* 256 colors supersedes 88 colors */ 853d522f475Smrg#undef OPT_88_COLORS 854d522f475Smrg#define OPT_88_COLORS 0 855d522f475Smrg#endif 856d522f475Smrg 857d522f475Smrg/***====================================================================***/ 858d522f475Smrg 859d522f475Smrg/* 860d522f475Smrg * Indices for menu_font_names[][] 861d522f475Smrg */ 862d522f475Smrgtypedef enum { 863d522f475Smrg fNorm = 0 /* normal font */ 864d522f475Smrg , fBold /* bold font */ 865dfb07bc7Smrg#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 866dfb07bc7Smrg , fItal /* italic font */ 867dfb07bc7Smrg#endif 868d522f475Smrg#if OPT_WIDE_CHARS 869d522f475Smrg , fWide /* double-width font */ 870d522f475Smrg , fWBold /* double-width bold font */ 871dfb07bc7Smrg , fWItal /* double-width italic font */ 872d522f475Smrg#endif 873d522f475Smrg , fMAX 874d522f475Smrg} VTFontEnum; 875d522f475Smrg 876d522f475Smrg/* 877d522f475Smrg * Indices for cachedGCs.c (unrelated to VTFontEnum). 878d522f475Smrg */ 879d522f475Smrgtypedef enum { 880d522f475Smrg gcNorm = 0 881d522f475Smrg , gcBold 882d522f475Smrg , gcNormReverse 883d522f475Smrg , gcBoldReverse 884d522f475Smrg#if OPT_BOX_CHARS 885d522f475Smrg , gcLine 886d522f475Smrg , gcDots 887d522f475Smrg#endif 888d522f475Smrg#if OPT_DEC_CHRSET 889d522f475Smrg , gcCNorm 890d522f475Smrg , gcCBold 891d522f475Smrg#endif 892d522f475Smrg#if OPT_WIDE_CHARS 893d522f475Smrg , gcWide 894d522f475Smrg , gcWBold 895d522f475Smrg , gcWideReverse 896d522f475Smrg , gcWBoldReverse 897d522f475Smrg#endif 898d522f475Smrg , gcVTcursNormal 899d522f475Smrg , gcVTcursFilled 900d522f475Smrg , gcVTcursReverse 901d522f475Smrg , gcVTcursOutline 902d522f475Smrg#if OPT_TEK4014 903d522f475Smrg , gcTKcurs 904d522f475Smrg#endif 905d522f475Smrg , gcMAX 906d522f475Smrg} CgsEnum; 907d522f475Smrg 908d522f475Smrg#define for_each_text_gc(n) for (n = gcNorm; n < gcVTcursNormal; ++n) 909d522f475Smrg#define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) 910d522f475Smrg#define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) 911d522f475Smrg 912cd3331d0Smrg/* 913cd3331d0Smrg * Indices for the normal terminal colors in screen.Tcolors[]. 914cd3331d0Smrg * See also OscTextColors, which has corresponding values. 915cd3331d0Smrg */ 916d522f475Smrgtypedef enum { 917d522f475Smrg TEXT_FG = 0 /* text foreground */ 918d522f475Smrg , TEXT_BG /* text background */ 919d522f475Smrg , TEXT_CURSOR /* text cursor */ 920d522f475Smrg , MOUSE_FG /* mouse foreground */ 921d522f475Smrg , MOUSE_BG /* mouse background */ 922d522f475Smrg#if OPT_TEK4014 9233367019cSmrg , TEK_FG = 5 /* tektronix foreground */ 924d522f475Smrg , TEK_BG /* tektronix background */ 925d522f475Smrg#endif 926d522f475Smrg#if OPT_HIGHLIGHT_COLOR 9273367019cSmrg , HIGHLIGHT_BG = 7 /* highlight background */ 9283367019cSmrg#endif 9293367019cSmrg#if OPT_TEK4014 9303367019cSmrg , TEK_CURSOR = 8 /* tektronix cursor */ 9313367019cSmrg#endif 9323367019cSmrg#if OPT_HIGHLIGHT_COLOR 9333367019cSmrg , HIGHLIGHT_FG = 9 /* highlight foreground */ 934d522f475Smrg#endif 935d522f475Smrg , NCOLORS /* total number of colors */ 936d522f475Smrg} TermColors; 937d522f475Smrg 93894644356Smrg/* 93994644356Smrg * Definitions for exec-formatted and insert-formatted actions. 94094644356Smrg */ 94194644356Smrgtypedef void (*FormatSelect) (Widget, char *, char *, CELL *, CELL *); 94294644356Smrg 94394644356Smrgtypedef struct { 94494644356Smrg char *format; 94594644356Smrg char *buffer; 94694644356Smrg FormatSelect format_select; 94794644356Smrg#if OPT_PASTE64 94894644356Smrg Cardinal base64_paste; 94994644356Smrg#endif 95094644356Smrg#if OPT_READLINE 95194644356Smrg unsigned paste_brackets; 95294644356Smrg#endif 95394644356Smrg} InternalSelect; 95494644356Smrg 955cd3331d0Smrg/* 956cd3331d0Smrg * Constants for titleModes resource 957cd3331d0Smrg */ 958cd3331d0Smrgtypedef enum { 959cd3331d0Smrg tmSetBase16 = 1 /* set title using hex-string */ 960cd3331d0Smrg , tmGetBase16 = 2 /* get title using hex-string */ 961cd3331d0Smrg#if OPT_WIDE_CHARS 962cd3331d0Smrg , tmSetUtf8 = 4 /* like utf8Title, but controllable */ 963cd3331d0Smrg , tmGetUtf8 = 8 /* retrieve title encoded as UTF-8 */ 964cd3331d0Smrg#endif 965cd3331d0Smrg} TitleModes; 966cd3331d0Smrg 967cd3331d0Smrg#define IsTitleMode(xw,mode) (((xw)->screen.title_modes & mode) != 0) 968cd3331d0Smrg 969fa3f02f3Smrg#include <xcharmouse.h> 970fa3f02f3Smrg 971fa3f02f3Smrg/* 972fa3f02f3Smrg * For readability... 973fa3f02f3Smrg */ 974fa3f02f3Smrg#define nrc_percent 100 975fa3f02f3Smrg#define nrc_dquote 200 976fa3f02f3Smrg#define nrc_ampersand 300 977fa3f02f3Smrgtypedef enum { 978fa3f02f3Smrg nrc_ASCII = 0 979fa3f02f3Smrg ,nrc_British /* vt100 */ 980fa3f02f3Smrg ,nrc_British_Latin_1 /* vt3xx */ 981fa3f02f3Smrg ,nrc_Cyrillic /* vt5xx */ 982fa3f02f3Smrg ,nrc_DEC_Spec_Graphic /* vt100 */ 983fa3f02f3Smrg ,nrc_DEC_Alt_Chars /* vt100 */ 984fa3f02f3Smrg ,nrc_DEC_Alt_Graphics /* vt100 */ 985fa3f02f3Smrg ,nrc_DEC_Supp /* vt2xx */ 986fa3f02f3Smrg ,nrc_DEC_Supp_Graphic /* vt3xx */ 987fa3f02f3Smrg ,nrc_DEC_Technical /* vt3xx */ 988fa3f02f3Smrg ,nrc_Dutch /* vt2xx */ 989fa3f02f3Smrg ,nrc_Finnish /* vt2xx */ 990fa3f02f3Smrg ,nrc_Finnish2 /* vt2xx */ 991fa3f02f3Smrg ,nrc_French /* vt2xx */ 992fa3f02f3Smrg ,nrc_French2 /* vt2xx */ 993fa3f02f3Smrg ,nrc_French_Canadian /* vt2xx */ 994fa3f02f3Smrg ,nrc_French_Canadian2 /* vt3xx */ 995fa3f02f3Smrg ,nrc_German /* vt2xx */ 996fa3f02f3Smrg ,nrc_Greek /* vt5xx */ 997fa3f02f3Smrg ,nrc_Greek_Supp /* vt5xx */ 998fa3f02f3Smrg ,nrc_Hebrew /* vt5xx */ 999fa3f02f3Smrg ,nrc_Hebrew2 /* vt5xx */ 1000fa3f02f3Smrg ,nrc_Hebrew_Supp /* vt5xx */ 1001fa3f02f3Smrg ,nrc_Italian /* vt2xx */ 1002fa3f02f3Smrg ,nrc_Latin_5_Supp /* vt5xx */ 1003fa3f02f3Smrg ,nrc_Latin_Cyrillic /* vt5xx */ 1004fa3f02f3Smrg ,nrc_Norwegian_Danish /* vt3xx */ 1005fa3f02f3Smrg ,nrc_Norwegian_Danish2 /* vt2xx */ 1006fa3f02f3Smrg ,nrc_Norwegian_Danish3 /* vt2xx */ 1007fa3f02f3Smrg ,nrc_Portugese /* vt3xx */ 1008fa3f02f3Smrg ,nrc_Russian /* vt5xx */ 1009fa3f02f3Smrg ,nrc_SCS_NRCS /* vt5xx - probably Serbo/Croatian */ 1010fa3f02f3Smrg ,nrc_Spanish /* vt2xx */ 1011fa3f02f3Smrg ,nrc_Swedish /* vt2xx */ 1012fa3f02f3Smrg ,nrc_Swedish2 /* vt2xx */ 1013fa3f02f3Smrg ,nrc_Swiss /* vt2xx */ 1014fa3f02f3Smrg ,nrc_Turkish /* vt5xx */ 1015fa3f02f3Smrg ,nrc_Turkish2 /* vt5xx */ 1016fa3f02f3Smrg ,nrc_Unknown 1017fa3f02f3Smrg} DECNRCM_codes; 1018fa3f02f3Smrg 1019fa3f02f3Smrg/* 1020fa3f02f3Smrg * Use this enumerated type to check consistency among dpmodes(), savemodes() 1021fa3f02f3Smrg * restoremodes() and do_decrpm(). 1022fa3f02f3Smrg */ 1023fa3f02f3Smrgtypedef enum { 1024fa3f02f3Smrg srm_DECCKM = 1 1025fa3f02f3Smrg ,srm_DECANM = 2 1026fa3f02f3Smrg ,srm_DECCOLM = 3 1027fa3f02f3Smrg ,srm_DECSCLM = 4 1028fa3f02f3Smrg ,srm_DECSCNM = 5 1029fa3f02f3Smrg ,srm_DECOM = 6 1030fa3f02f3Smrg ,srm_DECAWM = 7 1031fa3f02f3Smrg ,srm_DECARM = 8 1032fa3f02f3Smrg ,srm_X10_MOUSE = SET_X10_MOUSE 1033fa3f02f3Smrg#if OPT_TOOLBAR 1034fa3f02f3Smrg ,srm_RXVT_TOOLBAR = 10 1035fa3f02f3Smrg#endif 1036fa3f02f3Smrg#if OPT_BLINK_CURS 1037fa3f02f3Smrg ,srm_ATT610_BLINK = 12 1038fa3f02f3Smrg#endif 1039fa3f02f3Smrg ,srm_DECPFF = 18 1040fa3f02f3Smrg ,srm_DECPEX = 19 1041fa3f02f3Smrg ,srm_DECTCEM = 25 1042fa3f02f3Smrg ,srm_RXVT_SCROLLBAR = 30 1043fa3f02f3Smrg#if OPT_SHIFT_FONTS 1044fa3f02f3Smrg ,srm_RXVT_FONTSIZE = 35 1045fa3f02f3Smrg#endif 1046fa3f02f3Smrg#if OPT_TEK4014 1047fa3f02f3Smrg ,srm_DECTEK = 38 1048fa3f02f3Smrg#endif 1049fa3f02f3Smrg ,srm_132COLS = 40 1050fa3f02f3Smrg ,srm_CURSES_HACK = 41 1051fa3f02f3Smrg ,srm_DECNRCM = 42 1052fa3f02f3Smrg ,srm_MARGIN_BELL = 44 1053fa3f02f3Smrg ,srm_REVERSEWRAP = 45 1054fa3f02f3Smrg#ifdef ALLOWLOGGING 1055fa3f02f3Smrg ,srm_ALLOWLOGGING = 46 1056fa3f02f3Smrg#endif 1057fa3f02f3Smrg ,srm_OPT_ALTBUF_CURSOR = 1049 1058fa3f02f3Smrg ,srm_OPT_ALTBUF = 1047 1059fa3f02f3Smrg ,srm_ALTBUF = 47 1060fa3f02f3Smrg ,srm_DECNKM = 66 1061fa3f02f3Smrg ,srm_DECBKM = 67 1062fa3f02f3Smrg ,srm_DECLRMM = 69 1063fa3f02f3Smrg#if OPT_SIXEL_GRAPHICS 1064fa3f02f3Smrg ,srm_DECSDM = 80 /* Sixel Display Mode */ 1065fa3f02f3Smrg#endif 1066fa3f02f3Smrg ,srm_DECNCSM = 95 1067fa3f02f3Smrg ,srm_VT200_MOUSE = SET_VT200_MOUSE 1068fa3f02f3Smrg ,srm_VT200_HIGHLIGHT_MOUSE = SET_VT200_HIGHLIGHT_MOUSE 1069fa3f02f3Smrg ,srm_BTN_EVENT_MOUSE = SET_BTN_EVENT_MOUSE 1070fa3f02f3Smrg ,srm_ANY_EVENT_MOUSE = SET_ANY_EVENT_MOUSE 1071fa3f02f3Smrg#if OPT_FOCUS_EVENT 1072fa3f02f3Smrg ,srm_FOCUS_EVENT_MOUSE = SET_FOCUS_EVENT_MOUSE 1073fa3f02f3Smrg#endif 1074fa3f02f3Smrg ,srm_EXT_MODE_MOUSE = SET_EXT_MODE_MOUSE 1075fa3f02f3Smrg ,srm_SGR_EXT_MODE_MOUSE = SET_SGR_EXT_MODE_MOUSE 1076fa3f02f3Smrg ,srm_URXVT_EXT_MODE_MOUSE = SET_URXVT_EXT_MODE_MOUSE 1077fa3f02f3Smrg ,srm_ALTERNATE_SCROLL = SET_ALTERNATE_SCROLL 1078fa3f02f3Smrg ,srm_RXVT_SCROLL_TTY_OUTPUT = 1010 1079fa3f02f3Smrg ,srm_RXVT_SCROLL_TTY_KEYPRESS = 1011 1080fa3f02f3Smrg ,srm_EIGHT_BIT_META = 1034 1081fa3f02f3Smrg#if OPT_NUM_LOCK 1082fa3f02f3Smrg ,srm_REAL_NUMLOCK = 1035 1083fa3f02f3Smrg ,srm_META_SENDS_ESC = 1036 1084fa3f02f3Smrg#endif 1085fa3f02f3Smrg ,srm_DELETE_IS_DEL = 1037 1086fa3f02f3Smrg#if OPT_NUM_LOCK 1087fa3f02f3Smrg ,srm_ALT_SENDS_ESC = 1039 1088fa3f02f3Smrg#endif 1089fa3f02f3Smrg ,srm_KEEP_SELECTION = 1040 1090fa3f02f3Smrg ,srm_SELECT_TO_CLIPBOARD = 1041 1091fa3f02f3Smrg ,srm_BELL_IS_URGENT = 1042 1092fa3f02f3Smrg ,srm_POP_ON_BELL = 1043 1093037a25ddSmrg ,srm_KEEP_CLIPBOARD = 1044 1094fa3f02f3Smrg ,srm_TITE_INHIBIT = 1048 1095fa3f02f3Smrg#if OPT_TCAP_FKEYS 1096fa3f02f3Smrg ,srm_TCAP_FKEYS = 1050 1097fa3f02f3Smrg#endif 1098fa3f02f3Smrg#if OPT_SUN_FUNC_KEYS 1099fa3f02f3Smrg ,srm_SUN_FKEYS = 1051 1100fa3f02f3Smrg#endif 1101fa3f02f3Smrg#if OPT_HP_FUNC_KEYS 1102fa3f02f3Smrg ,srm_HP_FKEYS = 1052 1103fa3f02f3Smrg#endif 1104fa3f02f3Smrg#if OPT_SCO_FUNC_KEYS 1105fa3f02f3Smrg ,srm_SCO_FKEYS = 1053 1106fa3f02f3Smrg#endif 1107fa3f02f3Smrg ,srm_LEGACY_FKEYS = 1060 1108fa3f02f3Smrg#if OPT_SUNPC_KBD 1109fa3f02f3Smrg ,srm_VT220_FKEYS = 1061 1110fa3f02f3Smrg#endif 11119a64e1c5Smrg#if OPT_GRAPHICS 1112fa3f02f3Smrg ,srm_PRIVATE_COLOR_REGISTERS = 1070 1113fa3f02f3Smrg#endif 1114fa3f02f3Smrg#if OPT_READLINE 1115fa3f02f3Smrg ,srm_BUTTON1_MOVE_POINT = SET_BUTTON1_MOVE_POINT 1116fa3f02f3Smrg ,srm_BUTTON2_MOVE_POINT = SET_BUTTON2_MOVE_POINT 1117fa3f02f3Smrg ,srm_DBUTTON3_DELETE = SET_DBUTTON3_DELETE 1118fa3f02f3Smrg ,srm_PASTE_IN_BRACKET = SET_PASTE_IN_BRACKET 1119fa3f02f3Smrg ,srm_PASTE_QUOTE = SET_PASTE_QUOTE 1120fa3f02f3Smrg ,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL 1121fa3f02f3Smrg#endif /* OPT_READLINE */ 11229a64e1c5Smrg#if OPT_SIXEL_GRAPHICS 11239a64e1c5Smrg ,srm_SIXEL_SCROLLS_RIGHT = 8452 11249a64e1c5Smrg#endif 1125fa3f02f3Smrg} DECSET_codes; 1126fa3f02f3Smrg 1127d522f475Smrg/* indices for mapping multiple clicks to selection types */ 1128d522f475Smrgtypedef enum { 1129d522f475Smrg Select_CHAR=0 1130d522f475Smrg ,Select_WORD 1131d522f475Smrg ,Select_LINE 1132d522f475Smrg ,Select_GROUP 1133d522f475Smrg ,Select_PAGE 1134d522f475Smrg ,Select_ALL 1135d522f475Smrg#if OPT_SELECT_REGEX 1136d522f475Smrg ,Select_REGEX 1137d522f475Smrg#endif 1138d522f475Smrg ,NSELECTUNITS 1139d522f475Smrg} SelectUnit; 1140d522f475Smrg 1141cd3331d0Smrgtypedef enum { 1142cd3331d0Smrg ecSetColor = 1 1143cd3331d0Smrg , ecGetColor 1144cd3331d0Smrg , ecGetAnsiColor 1145cd3331d0Smrg , ecLAST 1146cd3331d0Smrg} ColorOps; 1147cd3331d0Smrg 1148cd3331d0Smrgtypedef enum { 1149cd3331d0Smrg efSetFont = 1 1150cd3331d0Smrg , efGetFont 1151cd3331d0Smrg , efLAST 1152cd3331d0Smrg} FontOps; 1153cd3331d0Smrg 1154c219fbebSmrgtypedef enum { 1155c219fbebSmrg esFalse = 0 1156c219fbebSmrg , esTrue 1157c219fbebSmrg , esAlways 1158c219fbebSmrg , esNever 1159c219fbebSmrg} FullscreenOps; 1160c219fbebSmrg 11613367019cSmrg#ifndef NO_ACTIVE_ICON 11623367019cSmrgtypedef enum { 11633367019cSmrg eiFalse = 0 11643367019cSmrg , eiTrue 11653367019cSmrg , eiDefault 11663367019cSmrg , eiLAST 11673367019cSmrg} AIconOps; 11683367019cSmrg#endif 11693367019cSmrg 1170dfb07bc7Smrgtypedef enum { 1171dfb07bc7Smrg emX10 = 1 1172dfb07bc7Smrg , emLocator 1173dfb07bc7Smrg , emVT200Click 1174dfb07bc7Smrg , emVT200Hilite 1175dfb07bc7Smrg , emAnyButton 1176dfb07bc7Smrg , emAnyEvent 1177dfb07bc7Smrg , emFocusEvent 1178dfb07bc7Smrg , emExtended 1179dfb07bc7Smrg , emSGR 1180dfb07bc7Smrg , emURXVT 1181dfb07bc7Smrg , emAlternateScroll 1182dfb07bc7Smrg , emLAST 1183dfb07bc7Smrg} MouseOps; 1184dfb07bc7Smrg 1185cd3331d0Smrgtypedef enum { 1186cd3331d0Smrg etSetTcap = 1 1187cd3331d0Smrg , etGetTcap 1188cd3331d0Smrg , etLAST 1189cd3331d0Smrg} TcapOps; 1190cd3331d0Smrg 1191cd3331d0Smrgtypedef enum { 11923367019cSmrg /* 1-23 are chosen to be the same as the control-sequence coding */ 1193cd3331d0Smrg ewRestoreWin = 1 1194cd3331d0Smrg , ewMinimizeWin = 2 1195cd3331d0Smrg , ewSetWinPosition = 3 1196cd3331d0Smrg , ewSetWinSizePixels = 4 1197cd3331d0Smrg , ewRaiseWin = 5 1198cd3331d0Smrg , ewLowerWin = 6 1199cd3331d0Smrg , ewRefreshWin = 7 1200cd3331d0Smrg , ewSetWinSizeChars = 8 1201cd3331d0Smrg#if OPT_MAXIMIZE 1202cd3331d0Smrg , ewMaximizeWin = 9 1203c219fbebSmrg , ewFullscreenWin = 10 1204cd3331d0Smrg#endif 1205cd3331d0Smrg , ewGetWinState = 11 1206cd3331d0Smrg , ewGetWinPosition = 13 1207cd3331d0Smrg , ewGetWinSizePixels = 14 1208cd3331d0Smrg , ewGetWinSizeChars = 18 1209cd3331d0Smrg#if OPT_MAXIMIZE 1210cd3331d0Smrg , ewGetScreenSizeChars = 19 1211cd3331d0Smrg#endif 1212cd3331d0Smrg , ewGetIconTitle = 20 1213cd3331d0Smrg , ewGetWinTitle = 21 1214cd3331d0Smrg , ewPushTitle = 22 1215cd3331d0Smrg , ewPopTitle = 23 1216cd3331d0Smrg /* these do not fit into that scheme, which is why we use an array */ 1217cd3331d0Smrg , ewSetWinLines 1218cd3331d0Smrg , ewSetXprop 1219cd3331d0Smrg , ewGetSelection 1220cd3331d0Smrg , ewSetSelection 1221cd3331d0Smrg /* get the size of the array... */ 1222cd3331d0Smrg , ewLAST 1223cd3331d0Smrg} WindowOps; 1224cd3331d0Smrg 1225cd3331d0Smrg#define COLOR_DEFINED(s,w) ((s)->which & (unsigned) (1<<(w))) 1226d522f475Smrg#define COLOR_VALUE(s,w) ((s)->colors[w]) 1227cd3331d0Smrg#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), UIntSet((s)->which, (1<<(w)))) 1228d522f475Smrg 1229d522f475Smrg#define COLOR_NAME(s,w) ((s)->names[w]) 1230cd3331d0Smrg#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (unsigned) (1<<(w)))) 1231d522f475Smrg 1232d522f475Smrg#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1))) 1233d522f475Smrg 1234d522f475Smrg/***====================================================================***/ 1235d522f475Smrg 1236d522f475Smrg#if OPT_ISO_COLORS 1237d522f475Smrg#define TERM_COLOR_FLAGS(xw) ((xw)->flags & (FG_COLOR|BG_COLOR)) 1238d522f475Smrg#define COLOR_0 0 1239d522f475Smrg#define COLOR_1 1 1240d522f475Smrg#define COLOR_2 2 1241d522f475Smrg#define COLOR_3 3 1242d522f475Smrg#define COLOR_4 4 1243d522f475Smrg#define COLOR_5 5 1244d522f475Smrg#define COLOR_6 6 1245d522f475Smrg#define COLOR_7 7 1246d522f475Smrg#define COLOR_8 8 1247d522f475Smrg#define COLOR_9 9 1248d522f475Smrg#define COLOR_10 10 1249d522f475Smrg#define COLOR_11 11 1250d522f475Smrg#define COLOR_12 12 1251d522f475Smrg#define COLOR_13 13 1252d522f475Smrg#define COLOR_14 14 1253d522f475Smrg#define COLOR_15 15 1254d522f475Smrg#define MIN_ANSI_COLORS 16 1255d522f475Smrg 1256d522f475Smrg#if OPT_256_COLORS 1257d522f475Smrg# define NUM_ANSI_COLORS 256 1258d522f475Smrg#elif OPT_88_COLORS 1259d522f475Smrg# define NUM_ANSI_COLORS 88 1260d522f475Smrg#else 1261d522f475Smrg# define NUM_ANSI_COLORS MIN_ANSI_COLORS 1262d522f475Smrg#endif 1263d522f475Smrg 1264d522f475Smrg#if NUM_ANSI_COLORS > MIN_ANSI_COLORS 1265d522f475Smrg# define OPT_EXT_COLORS 1 1266d522f475Smrg#else 1267d522f475Smrg# define OPT_EXT_COLORS 0 1268d522f475Smrg#endif 1269d522f475Smrg 1270d522f475Smrg#define COLOR_BD (NUM_ANSI_COLORS) /* BOLD */ 1271d522f475Smrg#define COLOR_UL (NUM_ANSI_COLORS+1) /* UNDERLINE */ 1272d522f475Smrg#define COLOR_BL (NUM_ANSI_COLORS+2) /* BLINK */ 1273d522f475Smrg#define COLOR_RV (NUM_ANSI_COLORS+3) /* REVERSE */ 127494644356Smrg 127594644356Smrg#if OPT_WIDE_ATTRS 127694644356Smrg#define COLOR_IT (NUM_ANSI_COLORS+4) /* ITALIC */ 127794644356Smrg#define MAXCOLORS (NUM_ANSI_COLORS+5) 127894644356Smrg#else 1279d522f475Smrg#define MAXCOLORS (NUM_ANSI_COLORS+4) 128094644356Smrg#endif 128194644356Smrg 1282d522f475Smrg#ifndef DFT_COLORMODE 1283d522f475Smrg#define DFT_COLORMODE True /* default colorMode resource */ 1284d522f475Smrg#endif 1285d522f475Smrg 128694644356Smrg#define UseItalicFont(screen) (!(screen)->colorITMode) 128794644356Smrg 1288d522f475Smrg#define ReverseOrHilite(screen,flags,hilite) \ 1289d522f475Smrg (( screen->colorRVMode && hilite ) || \ 1290d522f475Smrg ( !screen->colorRVMode && \ 1291d522f475Smrg (( (flags & INVERSE) && !hilite) || \ 1292d522f475Smrg (!(flags & INVERSE) && hilite)) )) 1293d522f475Smrg 1294d522f475Smrg/* Define a fake XK code, we need it for the fake color response in 1295d522f475Smrg * xtermcapKeycode(). */ 1296d522f475Smrg#if OPT_TCAP_QUERY && OPT_ISO_COLORS 1297d522f475Smrg# define XK_COLORS 0x0003 1298d522f475Smrg#endif 1299d522f475Smrg 1300d522f475Smrg#else /* !OPT_ISO_COLORS */ 1301d522f475Smrg 1302d522f475Smrg#define TERM_COLOR_FLAGS(xw) 0 1303d522f475Smrg 130494644356Smrg#define UseItalicFont(screen) True 1305d522f475Smrg#define ReverseOrHilite(screen,flags,hilite) \ 1306d522f475Smrg (( (flags & INVERSE) && !hilite) || \ 1307d522f475Smrg (!(flags & INVERSE) && hilite)) 1308d522f475Smrg 1309d522f475Smrg#endif /* OPT_ISO_COLORS */ 1310d522f475Smrg 1311cd3331d0Smrg# define XK_TCAPNAME 0x0004 1312cd3331d0Smrg 1313d522f475Smrg#if OPT_AIX_COLORS 1314d522f475Smrg#define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code 1315d522f475Smrg#else 1316d522f475Smrg#define if_OPT_AIX_COLORS(screen, code) /* nothing */ 1317d522f475Smrg#endif 1318d522f475Smrg 1319b7c89284Ssnj#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS 1320b7c89284Ssnj# define if_OPT_ISO_COLORS(screen, code) if (screen->colorMode) code 1321d522f475Smrg#else 1322b7c89284Ssnj# define if_OPT_ISO_COLORS(screen, code) /* nothing */ 1323d522f475Smrg#endif 1324d522f475Smrg 1325d522f475Smrg#define COLOR_RES_NAME(root) "color" root 1326d522f475Smrg 1327d522f475Smrg#if OPT_COLOR_CLASS 1328d522f475Smrg#define COLOR_RES_CLASS(root) "Color" root 1329d522f475Smrg#else 1330d522f475Smrg#define COLOR_RES_CLASS(root) XtCForeground 1331d522f475Smrg#endif 1332d522f475Smrg 1333d522f475Smrg#if OPT_COLOR_RES 1334d522f475Smrg#define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) 1335d522f475Smrg#define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) 1336d522f475Smrg#else 1337d522f475Smrg#define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) 1338d522f475Smrg#define COLOR_RES2(name,class,offset,value) Cres(name, class, offset, value) 1339d522f475Smrg#endif 1340d522f475Smrg 1341d522f475Smrg#define CLICK_RES_NAME(count) "on" count "Clicks" 1342d522f475Smrg#define CLICK_RES_CLASS(count) "On" count "Clicks" 1343d522f475Smrg#define CLICK_RES(count,offset,value) Sres(CLICK_RES_NAME(count), CLICK_RES_CLASS(count), offset, value) 1344d522f475Smrg 1345d522f475Smrg/***====================================================================***/ 1346d522f475Smrg 1347d522f475Smrg#if OPT_DEC_CHRSET 1348d522f475Smrg#define if_OPT_DEC_CHRSET(code) code 1349d522f475Smrg /* Use 2 bits for encoding the double high/wide sense of characters */ 1350d522f475Smrg#define CSET_SWL 0 1351d522f475Smrg#define CSET_DHL_TOP 1 1352d522f475Smrg#define CSET_DHL_BOT 2 1353d522f475Smrg#define CSET_DWL 3 1354d522f475Smrg#define NUM_CHRSET 8 /* normal/bold and 4 CSET_xxx values */ 1355b7c89284Ssnj 1356d522f475Smrg /* Use remaining bits for encoding the other character-sets */ 1357d522f475Smrg#define CSET_NORMAL(code) ((code) == CSET_SWL) 1358d522f475Smrg#define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) 1359cd3331d0Smrg#define CSET_EXTEND(code) ((int)(code) > CSET_DWL) 1360b7c89284Ssnj 1361b7c89284Ssnj#define DBLCS_BITS 4 1362b7c89284Ssnj#define DBLCS_MASK BITS2MASK(DBLCS_BITS) 1363b7c89284Ssnj 1364b7c89284Ssnj#define GetLineDblCS(ld) (((ld)->bufHead >> LINEFLAG_BITS) & DBLCS_MASK) 1365b7c89284Ssnj#define SetLineDblCS(ld,cs) (ld)->bufHead = (RowData) ((ld->bufHead & LINEFLAG_MASK) | (cs << LINEFLAG_BITS)) 1366b7c89284Ssnj 1367b7c89284Ssnj#define LineCharSet(screen, ld) \ 1368b7c89284Ssnj ((CSET_DOUBLE(GetLineDblCS(ld))) \ 1369b7c89284Ssnj ? GetLineDblCS(ld) \ 1370b7c89284Ssnj : (screen)->cur_chrset) 1371b7c89284Ssnj#define LineMaxCol(screen, ld) \ 1372b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1373b7c89284Ssnj ? (screen->max_col / 2) \ 1374b7c89284Ssnj : (screen->max_col)) 1375b7c89284Ssnj#define LineCursorX(screen, ld, col) \ 1376b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1377b7c89284Ssnj ? CursorX(screen, 2*(col)) \ 1378b7c89284Ssnj : CursorX(screen, (col))) 1379b7c89284Ssnj#define LineFontWidth(screen, ld) \ 1380b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1381b7c89284Ssnj ? 2*FontWidth(screen) \ 1382b7c89284Ssnj : FontWidth(screen)) 1383d522f475Smrg#else 1384b7c89284Ssnj 1385d522f475Smrg#define if_OPT_DEC_CHRSET(code) /*nothing*/ 1386b7c89284Ssnj 1387b7c89284Ssnj#define GetLineDblCS(ld) 0 1388b7c89284Ssnj 1389b7c89284Ssnj#define LineCharSet(screen, ld) 0 1390b7c89284Ssnj#define LineMaxCol(screen, ld) screen->max_col 1391b7c89284Ssnj#define LineCursorX(screen, ld, col) CursorX(screen, col) 1392b7c89284Ssnj#define LineFontWidth(screen, ld) FontWidth(screen) 1393b7c89284Ssnj 1394d522f475Smrg#endif 1395d522f475Smrg 1396d522f475Smrg#if OPT_LUIT_PROG && !OPT_WIDE_CHARS 1397d522f475Smrg#error Luit requires the wide-chars configuration 1398d522f475Smrg#endif 1399d522f475Smrg 1400d522f475Smrg/***====================================================================***/ 1401d522f475Smrg 1402d522f475Smrg#if OPT_EBCDIC 1403d522f475Smrgextern int E2A(int); 1404d522f475Smrgextern int A2E(int); 1405d522f475Smrg#else 1406d522f475Smrg#define E2A(a) (a) 1407d522f475Smrg#define A2E(a) (a) 1408d522f475Smrg#endif 1409d522f475Smrg 1410d522f475Smrg#define CONTROL(a) (A2E(E2A(a)&037)) 1411d522f475Smrg 1412d522f475Smrg/***====================================================================***/ 1413d522f475Smrg 1414d522f475Smrg#if OPT_TEK4014 1415d522f475Smrg#define TEK4014_ACTIVE(xw) ((xw)->misc.TekEmu) 1416d522f475Smrg#define TEK4014_SHOWN(xw) ((xw)->misc.Tshow) 1417d522f475Smrg#define CURRENT_EMU_VAL(tek,vt) (TEK4014_ACTIVE(term) ? tek : vt) 1418d522f475Smrg#define CURRENT_EMU() CURRENT_EMU_VAL((Widget)tekWidget, (Widget)term) 1419d522f475Smrg#else 1420d522f475Smrg#define TEK4014_ACTIVE(screen) 0 1421d522f475Smrg#define TEK4014_SHOWN(xw) 0 1422d522f475Smrg#define CURRENT_EMU_VAL(tek,vt) (vt) 1423d522f475Smrg#define CURRENT_EMU() ((Widget)term) 1424d522f475Smrg#endif 1425d522f475Smrg 1426d522f475Smrg/***====================================================================***/ 1427d522f475Smrg 1428d522f475Smrg#if OPT_TOOLBAR 1429d522f475Smrg#define SHELL_OF(widget) XtParent(XtParent(widget)) 1430d522f475Smrg#else 1431d522f475Smrg#define SHELL_OF(widget) XtParent(widget) 1432d522f475Smrg#endif 1433d522f475Smrg 1434d522f475Smrg/***====================================================================***/ 1435d522f475Smrg 1436d522f475Smrg#if OPT_VT52_MODE 1437d522f475Smrg#define if_OPT_VT52_MODE(screen, code) if(screen->vtXX_level == 0) code 1438d522f475Smrg#else 1439d522f475Smrg#define if_OPT_VT52_MODE(screen, code) /* nothing */ 1440d522f475Smrg#endif 1441d522f475Smrg 1442d522f475Smrg/***====================================================================***/ 1443d522f475Smrg 1444d522f475Smrg#if OPT_XMC_GLITCH 1445d522f475Smrg#define if_OPT_XMC_GLITCH(screen, code) if(screen->xmc_glitch) code 1446d522f475Smrg#define XMC_GLITCH 1 /* the character we'll show */ 1447d522f475Smrg#define XMC_FLAGS (INVERSE|UNDERLINE|BOLD|BLINK) 1448d522f475Smrg#else 1449d522f475Smrg#define if_OPT_XMC_GLITCH(screen, code) /* nothing */ 1450d522f475Smrg#endif 1451d522f475Smrg 1452d522f475Smrg/***====================================================================***/ 1453d522f475Smrg 14549a64e1c5Smrgtypedef unsigned IFlags; /* at least 32 bits */ 14559a64e1c5Smrg 14569a64e1c5Smrg#if OPT_WIDE_ATTRS 14579a64e1c5Smrgtypedef unsigned short IAttr; /* at least 16 bits */ 14589a64e1c5Smrg#else 14599a64e1c5Smrgtypedef unsigned char IAttr; /* at least 8 bits */ 14609a64e1c5Smrg#endif 14619a64e1c5Smrg 14629a64e1c5Smrg/***====================================================================***/ 14639a64e1c5Smrg 14640d92cbfdSchristos#define LO_BYTE(ch) CharOf((ch) & 0xff) 14650d92cbfdSchristos#define HI_BYTE(ch) CharOf((ch) >> 8) 14660d92cbfdSchristos 1467d522f475Smrg#if OPT_WIDE_CHARS 1468d522f475Smrg#define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code 1469d522f475Smrg#define if_WIDE_OR_NARROW(screen, wide, narrow) if(screen->wide_chars) wide else narrow 1470b7c89284Ssnj#if OPT_WIDER_ICHAR 1471b7c89284Ssnjtypedef unsigned IChar; /* for 8-21 bit characters */ 1472b7c89284Ssnj#else 1473b7c89284Ssnjtypedef unsigned short IChar; /* for 8-16 bit characters */ 1474b7c89284Ssnj#endif 1475d522f475Smrg#else 1476d522f475Smrg#define if_OPT_WIDE_CHARS(screen, code) /* nothing */ 1477d522f475Smrg#define if_WIDE_OR_NARROW(screen, wide, narrow) narrow 1478d522f475Smrgtypedef unsigned char IChar; /* for 8-bit characters */ 1479d522f475Smrg#endif 1480d522f475Smrg 1481d522f475Smrg/***====================================================================***/ 1482d522f475Smrg 1483d522f475Smrg#ifndef RES_OFFSET 1484d522f475Smrg#define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset) 1485d522f475Smrg#endif 1486d522f475Smrg 1487d522f475Smrg#define RES_NAME(name) name 1488d522f475Smrg#define RES_CLASS(name) name 1489d522f475Smrg 1490d522f475Smrg#define Bres(name, class, offset, dftvalue) \ 1491d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ 1492d522f475Smrg RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1493d522f475Smrg 1494d522f475Smrg#define Cres(name, class, offset, dftvalue) \ 1495d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ 1496fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1497d522f475Smrg 1498d522f475Smrg#define Tres(name, class, offset, dftvalue) \ 1499d522f475Smrg COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \ 1500d522f475Smrg 1501d522f475Smrg#define Fres(name, class, offset, dftvalue) \ 1502d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \ 1503fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1504d522f475Smrg 1505d522f475Smrg#define Ires(name, class, offset, dftvalue) \ 1506d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \ 1507d522f475Smrg RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1508d522f475Smrg 1509d522f475Smrg#define Dres(name, class, offset, dftvalue) \ 1510d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRFloat, sizeof(float), \ 1511fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1512d522f475Smrg 1513d522f475Smrg#define Sres(name, class, offset, dftvalue) \ 1514d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \ 1515fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1516d522f475Smrg 1517d522f475Smrg#define Wres(name, class, offset, dftvalue) \ 1518d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRWidget, sizeof(Widget), \ 1519d522f475Smrg RES_OFFSET(offset), XtRWidget, (XtPointer) dftvalue} 1520d522f475Smrg 1521d522f475Smrg/***====================================================================***/ 1522d522f475Smrg 1523d522f475Smrg#define FRG_SIZE resource.minBufSize 1524d522f475Smrg#define BUF_SIZE resource.maxBufSize 1525d522f475Smrg 1526d522f475Smrgtypedef struct { 152794644356Smrg Char *next; 152894644356Smrg Char *last; 152994644356Smrg int update; /* HandleInterpret */ 1530d522f475Smrg#if OPT_WIDE_CHARS 153194644356Smrg IChar utf_data; /* resulting character */ 153294644356Smrg int utf_size; /* ...number of bytes decoded */ 153394644356Smrg Char *write_buf; 1534d522f475Smrg unsigned write_len; 1535d522f475Smrg#endif 153694644356Smrg Char buffer[1]; 1537d522f475Smrg} PtyData; 1538d522f475Smrg 1539d522f475Smrg/***====================================================================***/ 1540d522f475Smrg 1541d522f475Smrg#if OPT_ISO_COLORS 1542d522f475Smrg#if OPT_256_COLORS || OPT_88_COLORS 1543b7c89284Ssnj#define COLOR_BITS 8 1544b7c89284Ssnjtypedef unsigned short CellColor; 1545d522f475Smrg#else 1546b7c89284Ssnj#define COLOR_BITS 4 1547b7c89284Ssnjtypedef Char CellColor; 1548d522f475Smrg#endif 1549b7c89284Ssnj#else 15509a64e1c5Smrgtypedef unsigned CellColor; 1551d522f475Smrg#endif 1552b7c89284Ssnj 1553b7c89284Ssnj#define BITS2MASK(b) ((1 << b) - 1) 1554b7c89284Ssnj 1555b7c89284Ssnj#define COLOR_MASK BITS2MASK(COLOR_BITS) 1556b7c89284Ssnj 1557b7c89284Ssnj#define GetCellColorFG(src) ((src) & COLOR_MASK) 1558b7c89284Ssnj#define GetCellColorBG(src) (((src) >> COLOR_BITS) & COLOR_MASK) 1559b7c89284Ssnj 1560b7c89284Ssnjtypedef Char RowData; /* wrap/blink, and DEC single-double chars */ 1561b7c89284Ssnj 1562b7c89284Ssnj#define LINEFLAG_BITS 4 1563b7c89284Ssnj#define LINEFLAG_MASK BITS2MASK(LINEFLAG_BITS) 1564b7c89284Ssnj 1565b7c89284Ssnj#define GetLineFlags(ld) ((ld)->bufHead & LINEFLAG_MASK) 1566b7c89284Ssnj 1567d522f475Smrg#if OPT_DEC_CHRSET 1568b7c89284Ssnj#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) ((ld->bufHead & (DBLCS_MASK << LINEFLAG_BITS)) | (xx & LINEFLAG_MASK)) 1569b7c89284Ssnj#else 1570b7c89284Ssnj#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) (xx & LINEFLAG_MASK) 1571d522f475Smrg#endif 1572b7c89284Ssnj 1573b7c89284Ssnjtypedef IChar CharData; 1574b7c89284Ssnj 1575b7c89284Ssnj/* 1576b7c89284Ssnj * This is the xterm line-data/scrollback structure. 1577b7c89284Ssnj */ 1578b7c89284Ssnjtypedef struct { 1579b7c89284Ssnj Dimension lineSize; /* number of columns in this row */ 1580b7c89284Ssnj RowData bufHead; /* flag for wrapped lines */ 1581d522f475Smrg#if OPT_WIDE_CHARS 1582b7c89284Ssnj Char combSize; /* number of items in combData[] */ 1583b7c89284Ssnj#endif 15849a64e1c5Smrg IAttr *attribs; /* video attributes */ 1585b7c89284Ssnj#if OPT_ISO_COLORS 1586b7c89284Ssnj CellColor *color; /* foreground+background color numbers */ 1587b7c89284Ssnj#endif 1588b7c89284Ssnj CharData *charData; /* cell's base character */ 1589b7c89284Ssnj CharData *combData[1]; /* first enum past fixed-offsets */ 1590b7c89284Ssnj} LineData; 1591b7c89284Ssnj 159294644356Smrgtypedef const LineData CLineData; 159394644356Smrg 1594b7c89284Ssnj/* 1595b7c89284Ssnj * We use CellData in a few places, when copying a cell's data to a temporary 1596b7c89284Ssnj * variable. 1597b7c89284Ssnj */ 1598b7c89284Ssnjtypedef struct { 15999a64e1c5Smrg IAttr attribs; 1600b7c89284Ssnj#if OPT_WIDE_CHARS 1601b7c89284Ssnj Char combSize; /* number of items in combData[] */ 1602b7c89284Ssnj#endif 1603b7c89284Ssnj#if OPT_ISO_COLORS 1604b7c89284Ssnj CellColor color; /* color-array */ 1605d522f475Smrg#endif 1606b7c89284Ssnj CharData charData; /* cell's base character */ 1607b7c89284Ssnj CharData combData[1]; /* array of combining chars */ 1608b7c89284Ssnj} CellData; 1609b7c89284Ssnj 1610b7c89284Ssnj#define for_each_combData(off, ld) for (off = 0; off < ld->combSize; ++off) 1611b7c89284Ssnj 1612b7c89284Ssnj/* 1613b7c89284Ssnj * Accommodate older compilers by not using variable-length arrays. 1614b7c89284Ssnj */ 1615b7c89284Ssnj#define SizeOfLineData offsetof(LineData, combData) 1616b7c89284Ssnj#define SizeOfCellData offsetof(CellData, combData) 1617d522f475Smrg 1618d522f475Smrg /* 1619d522f475Smrg * A "row" is the index within the visible part of the screen, and an 1620d522f475Smrg * "inx" is the index within the whole set of scrollable lines. 1621d522f475Smrg */ 1622d522f475Smrg#define ROW2INX(screen, row) ((row) + (screen)->topline) 1623d522f475Smrg#define INX2ROW(screen, inx) ((inx) - (screen)->topline) 1624d522f475Smrg 162594644356Smrg/* these are unused but could be useful for debugging */ 162694644356Smrg#if 0 1627d522f475Smrg#define ROW2ABS(screen, row) ((row) + (screen)->savedlines) 1628d522f475Smrg#define INX2ABS(screen, inx) ROW2ABS(screen, INX2ROW(screen, inx)) 162994644356Smrg#endif 1630d522f475Smrg 1631d522f475Smrg#define okScrnRow(screen, row) \ 1632b7c89284Ssnj ((row) <= ((screen)->max_row - (screen)->topline) \ 1633d522f475Smrg && (row) >= -((screen)->savedlines)) 1634d522f475Smrg 1635b7c89284Ssnj /* 1636b7c89284Ssnj * Cache data for "proportional" and other fonts containing a mixture 1637b7c89284Ssnj * of widths. 1638b7c89284Ssnj */ 1639b7c89284Ssnjtypedef struct { 16403367019cSmrg Bool mixed; 1641b7c89284Ssnj Dimension min_width; /* nominal cell width for 0..255 */ 1642b7c89284Ssnj Dimension max_width; /* maximum cell width */ 1643b7c89284Ssnj} FontMap; 1644d522f475Smrg 1645fa3f02f3Smrg#define KNOWN_MISSING 256 1646fa3f02f3Smrg 1647dfb07bc7Smrgtypedef enum { 1648dfb07bc7Smrg fwNever = 0, 1649dfb07bc7Smrg fwResource, 1650dfb07bc7Smrg fwAlways 1651dfb07bc7Smrg} fontWarningTypes; 1652dfb07bc7Smrg 1653d522f475Smrgtypedef struct { 1654d522f475Smrg unsigned chrset; 1655d522f475Smrg unsigned flags; 1656dfb07bc7Smrg fontWarningTypes warn; 1657d522f475Smrg XFontStruct * fs; 1658d522f475Smrg char * fn; 1659b7c89284Ssnj FontMap map; 1660fa3f02f3Smrg Char known_missing[KNOWN_MISSING]; 1661d522f475Smrg} XTermFonts; 1662d522f475Smrg 1663b7c89284Ssnj#if OPT_RENDERFONT 1664cd3331d0Smrgtypedef enum { 1665cd3331d0Smrg erFalse = 0 1666cd3331d0Smrg , erTrue 1667cd3331d0Smrg , erDefault 1668cd3331d0Smrg , erLast 1669cd3331d0Smrg} RenderFont; 1670cd3331d0Smrg 1671cd3331d0Smrg#define DefaultRenderFont(xw) \ 16723367019cSmrg if ((xw)->work.render_font == erDefault) \ 16733367019cSmrg (xw)->work.render_font = erFalse 1674cd3331d0Smrg 1675b7c89284Ssnjtypedef struct { 1676b7c89284Ssnj XftFont * font; 1677b7c89284Ssnj FontMap map; 1678b7c89284Ssnj} XTermXftFonts; 1679b7c89284Ssnj#endif 1680b7c89284Ssnj 1681d522f475Smrgtypedef struct { 1682d522f475Smrg int top; 1683d522f475Smrg int left; 1684d522f475Smrg int bottom; 1685d522f475Smrg int right; 1686d522f475Smrg} XTermRect; 1687d522f475Smrg 1688d522f475Smrg /* indices into save_modes[] */ 1689d522f475Smrgtypedef enum { 16903367019cSmrg DP_ALTERNATE_SCROLL, 16913367019cSmrg DP_ALT_SENDS_ESC, 16923367019cSmrg DP_BELL_IS_URGENT, 1693d522f475Smrg DP_CRS_VISIBLE, 1694d522f475Smrg DP_DECANM, 1695d522f475Smrg DP_DECARM, 1696d522f475Smrg DP_DECAWM, 1697d522f475Smrg DP_DECBKM, 1698d522f475Smrg DP_DECCKM, 1699d522f475Smrg DP_DECCOLM, /* IN132COLUMNS */ 17003367019cSmrg DP_DECKPAM, 17013367019cSmrg DP_DECNRCM, 1702d522f475Smrg DP_DECOM, 1703d522f475Smrg DP_DECPEX, 1704d522f475Smrg DP_DECPFF, 1705d522f475Smrg DP_DECSCLM, 1706d522f475Smrg DP_DECSCNM, 1707d522f475Smrg DP_DECTCEM, 17083367019cSmrg DP_DELETE_IS_DEL, 17093367019cSmrg DP_EIGHT_BIT_META, 1710037a25ddSmrg DP_KEEP_CLIPBOARD, 17113367019cSmrg DP_KEEP_SELECTION, 17123367019cSmrg DP_KEYBOARD_TYPE, 17133367019cSmrg DP_POP_ON_BELL, 1714d522f475Smrg DP_PRN_EXTENT, 1715d522f475Smrg DP_PRN_FORMFEED, 17163367019cSmrg DP_RXVT_SCROLLBAR, 17173367019cSmrg DP_RXVT_SCROLL_TTY_KEYPRESS, 17183367019cSmrg DP_RXVT_SCROLL_TTY_OUTPUT, 17193367019cSmrg DP_SELECT_TO_CLIPBOARD, 1720d522f475Smrg DP_X_ALTSCRN, 1721d522f475Smrg DP_X_DECCOLM, 17223367019cSmrg DP_X_EXT_MOUSE, 1723d522f475Smrg DP_X_LOGGING, 17243367019cSmrg DP_X_LRMM, 1725d522f475Smrg DP_X_MARGIN, 1726d522f475Smrg DP_X_MORE, 1727d522f475Smrg DP_X_MOUSE, 17283367019cSmrg DP_X_NCSM, 1729d522f475Smrg DP_X_REVWRAP, 1730d522f475Smrg DP_X_X10MSE, 1731d522f475Smrg#if OPT_BLINK_CURS 1732d522f475Smrg DP_CRS_BLINK, 1733d522f475Smrg#endif 1734d522f475Smrg#if OPT_FOCUS_EVENT 1735d522f475Smrg DP_X_FOCUS, 1736d522f475Smrg#endif 17373367019cSmrg#if OPT_NUM_LOCK 17383367019cSmrg DP_REAL_NUMLOCK, 17393367019cSmrg DP_META_SENDS_ESC, 17403367019cSmrg#endif 17413367019cSmrg#if OPT_SHIFT_FONTS 17423367019cSmrg DP_RXVT_FONTSIZE, 17433367019cSmrg#endif 1744fa3f02f3Smrg#if OPT_SIXEL_GRAPHICS 1745fa3f02f3Smrg DP_DECSDM, 1746fa3f02f3Smrg#endif 17473367019cSmrg#if OPT_TEK4014 17483367019cSmrg DP_DECTEK, 17493367019cSmrg#endif 1750d522f475Smrg#if OPT_TOOLBAR 1751d522f475Smrg DP_TOOLBAR, 1752d522f475Smrg#endif 1753fa3f02f3Smrg DP_X_PRIVATE_COLOR_REGISTERS, 17549a64e1c5Smrg#if OPT_SIXEL_GRAPHICS 17559a64e1c5Smrg DP_SIXEL_SCROLLS_RIGHT, 17569a64e1c5Smrg#endif 1757d522f475Smrg DP_LAST 1758d522f475Smrg} SaveModes; 1759d522f475Smrg 17600d92cbfdSchristos#define DoSM(code,value) screen->save_modes[code] = (unsigned) (value) 17610d92cbfdSchristos#define DoRM(code,value) value = (Boolean) screen->save_modes[code] 17620d92cbfdSchristos#define DoRM0(code,value) value = screen->save_modes[code] 1763d522f475Smrg 1764d522f475Smrg /* index into vt_shell[] or tek_shell[] */ 1765d522f475Smrgtypedef enum { 1766dfb07bc7Smrg noMenu = -1 1767dfb07bc7Smrg ,mainMenu 1768dfb07bc7Smrg ,vtMenu 1769dfb07bc7Smrg ,fontMenu 1770b7c89284Ssnj#if OPT_TEK4014 1771dfb07bc7Smrg ,tekMenu 1772b7c89284Ssnj#endif 1773d522f475Smrg} MenuIndex; 1774d522f475Smrg 1775cd3331d0Smrgtypedef enum { 1776cd3331d0Smrg bvOff = -1, 1777cd3331d0Smrg bvLow = 0, 1778cd3331d0Smrg bvHigh 1779cd3331d0Smrg} BellVolume; 1780cd3331d0Smrg 1781d522f475Smrg#define NUM_POPUP_MENUS 4 1782d522f475Smrg 1783d522f475Smrg#if OPT_COLOR_RES 1784d522f475Smrgtypedef struct { 1785d522f475Smrg String resource; 1786d522f475Smrg Pixel value; 17873367019cSmrg unsigned short red, green, blue; 1788cd3331d0Smrg int mode; /* -1=invalid, 0=unset, 1=set */ 1789d522f475Smrg} ColorRes; 1790d522f475Smrg#else 1791d522f475Smrg#define ColorRes Pixel 1792d522f475Smrg#endif 1793d522f475Smrg 1794cd3331d0Smrg/* these are set in getPrinterFlags */ 1795cd3331d0Smrgtypedef struct { 1796cd3331d0Smrg int printer_extent; /* print complete page */ 1797cd3331d0Smrg int printer_formfeed; /* print formfeed per function */ 1798cd3331d0Smrg int printer_newline; /* print newline per function */ 1799cd3331d0Smrg int print_attributes; /* 0=off, 1=normal, 2=color */ 1800712a7ff4Smrg int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 1801cd3331d0Smrg} PrinterFlags; 1802cd3331d0Smrg 1803712a7ff4Smrgtypedef struct { 1804712a7ff4Smrg FILE * fp; /* output file/pipe used */ 1805712a7ff4Smrg Boolean isOpen; /* output was opened/tried */ 1806712a7ff4Smrg Boolean toFile; /* true when directly to file */ 18073367019cSmrg Boolean printer_checked; /* printer_command is checked */ 1808712a7ff4Smrg String printer_command; /* pipe/shell command string */ 1809712a7ff4Smrg Boolean printer_autoclose; /* close printer when offline */ 1810712a7ff4Smrg Boolean printer_extent; /* print complete page */ 1811712a7ff4Smrg Boolean printer_formfeed; /* print formfeed per function */ 1812712a7ff4Smrg Boolean printer_newline; /* print newline per function */ 1813712a7ff4Smrg int printer_controlmode; /* 0=off, 1=auto, 2=controller */ 1814712a7ff4Smrg int print_attributes; /* 0=off, 1=normal, 2=color */ 1815712a7ff4Smrg int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 1816712a7ff4Smrg} PrinterState; 1817712a7ff4Smrg 1818d522f475Smrgtypedef struct { 1819d522f475Smrg unsigned which; /* must have NCOLORS bits */ 1820d522f475Smrg Pixel colors[NCOLORS]; 1821d522f475Smrg char *names[NCOLORS]; 1822d522f475Smrg} ScrnColors; 1823d522f475Smrg 1824d522f475Smrgtypedef struct { 1825d522f475Smrg Boolean saved; 1826d522f475Smrg int row; 1827d522f475Smrg int col; 18289a64e1c5Smrg IFlags flags; /* VTxxx saves graphics rendition */ 18290d92cbfdSchristos Char curgl; 18300d92cbfdSchristos Char curgr; 1831fa3f02f3Smrg int gsets[4]; 1832dfb07bc7Smrg Boolean wrap_flag; 1833d522f475Smrg#if OPT_ISO_COLORS 1834d522f475Smrg int cur_foreground; /* current foreground color */ 1835d522f475Smrg int cur_background; /* current background color */ 1836d522f475Smrg int sgr_foreground; /* current SGR foreground color */ 1837d522f475Smrg int sgr_background; /* current SGR background color */ 1838d522f475Smrg Boolean sgr_extended; /* SGR set with extended codes? */ 1839d522f475Smrg#endif 1840d522f475Smrg} SavedCursor; 1841d522f475Smrg 1842cd3331d0Smrgtypedef struct _SaveTitle { 18433367019cSmrg struct _SaveTitle *next; 1844cd3331d0Smrg char *iconName; 1845cd3331d0Smrg char *windowName; 1846cd3331d0Smrg} SaveTitle; 1847cd3331d0Smrg 1848d522f475Smrg#define SAVED_CURSORS 2 1849d522f475Smrg 1850d522f475Smrgtypedef struct { 1851d522f475Smrg int width; /* if > 0, width of scrollbar, */ 1852d522f475Smrg /* and scrollbar is showing */ 1853d522f475Smrg Boolean rv_cached; /* see ScrollBarReverseVideo */ 1854d522f475Smrg int rv_active; /* ...current reverse-video */ 1855d522f475Smrg Pixel bg; /* ...cached background color */ 1856d522f475Smrg Pixel fg; /* ...cached foreground color */ 1857d522f475Smrg Pixel bdr; /* ...cached border color */ 1858d522f475Smrg Pixmap bdpix; /* ...cached border pixmap */ 1859d522f475Smrg} SbInfo; 1860d522f475Smrg 1861d522f475Smrg#if OPT_TOOLBAR 1862d522f475Smrgtypedef struct { 1863d522f475Smrg Widget menu_bar; /* toolbar, if initialized */ 1864d522f475Smrg Dimension menu_height; /* ...and its height */ 1865d522f475Smrg Dimension menu_border; /* ...and its border */ 1866d522f475Smrg} TbInfo; 1867d522f475Smrg#define VT100_TB_INFO(name) screen.fullVwin.tb_info.name 1868d522f475Smrg#endif 1869d522f475Smrg 1870d522f475Smrgtypedef struct { 1871d522f475Smrg Window window; /* X window id */ 1872d522f475Smrg int width; /* width of columns */ 1873d522f475Smrg int height; /* height of rows */ 1874d522f475Smrg Dimension fullwidth; /* full width of window */ 1875d522f475Smrg Dimension fullheight; /* full height of window */ 1876d522f475Smrg int f_width; /* width of fonts in pixels */ 1877d522f475Smrg int f_height; /* height of fonts in pixels */ 1878d522f475Smrg int f_ascent; /* ascent of font in pixels */ 1879d522f475Smrg int f_descent; /* descent of font in pixels */ 1880d522f475Smrg SbInfo sb_info; 18813367019cSmrg#if OPT_DOUBLE_BUFFER 18823367019cSmrg Drawable drawable; /* X drawable id */ 18833367019cSmrg#endif 1884d522f475Smrg#if OPT_TOOLBAR 1885d522f475Smrg Boolean active; /* true if toolbars are used */ 1886d522f475Smrg TbInfo tb_info; /* toolbar information */ 1887d522f475Smrg#endif 1888d522f475Smrg} VTwin; 1889d522f475Smrg 1890d522f475Smrgtypedef struct { 1891d522f475Smrg Window window; /* X window id */ 1892d522f475Smrg int width; /* width of columns */ 1893d522f475Smrg int height; /* height of rows */ 1894d522f475Smrg Dimension fullwidth; /* full width of window */ 1895d522f475Smrg Dimension fullheight; /* full height of window */ 1896d522f475Smrg double tekscale; /* scale factor Tek -> vs100 */ 1897d522f475Smrg} TKwin; 1898d522f475Smrg 1899712a7ff4Smrgtypedef struct { 1900dfb07bc7Smrg char *f_n; /* the normal font */ 1901dfb07bc7Smrg char *f_b; /* the bold font */ 1902dfb07bc7Smrg#if OPT_WIDE_ATTRS 1903dfb07bc7Smrg char *f_i; /* italic font (Xft only) */ 1904dfb07bc7Smrg#endif 1905712a7ff4Smrg#if OPT_WIDE_CHARS 1906dfb07bc7Smrg char *f_w; /* the normal wide font */ 1907dfb07bc7Smrg char *f_wb; /* the bold wide font */ 1908dfb07bc7Smrg char *f_wi; /* wide italic font (Xft only) */ 1909712a7ff4Smrg#endif 1910712a7ff4Smrg} VTFontNames; 1911712a7ff4Smrg 1912dfb07bc7Smrgtypedef struct { 1913dfb07bc7Smrg char **list_n; /* the normal font */ 1914dfb07bc7Smrg char **list_b; /* the bold font */ 1915dfb07bc7Smrg#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 1916dfb07bc7Smrg char **list_i; /* italic font (Xft only) */ 1917dfb07bc7Smrg#endif 1918dfb07bc7Smrg#if OPT_WIDE_CHARS 1919dfb07bc7Smrg char **list_w; /* the normal wide font */ 1920dfb07bc7Smrg char **list_wb; /* the bold wide font */ 1921dfb07bc7Smrg char **list_wi; /* wide italic font (Xft only) */ 1922dfb07bc7Smrg#endif 1923dfb07bc7Smrg} VTFontList; 1924dfb07bc7Smrg 1925dfb07bc7Smrgtypedef struct { 1926dfb07bc7Smrg VTFontList x11; 1927dfb07bc7Smrg#if OPT_RENDERFONT 1928dfb07bc7Smrg VTFontList xft; 1929dfb07bc7Smrg#endif 1930dfb07bc7Smrg} XtermFontNames; 1931dfb07bc7Smrg 1932712a7ff4Smrgtypedef struct { 1933712a7ff4Smrg VTFontNames default_font; 1934712a7ff4Smrg String menu_font_names[NMENUFONTS][fMAX]; 1935dfb07bc7Smrg XtermFontNames fonts; 1936712a7ff4Smrg} SubResourceRec; 1937712a7ff4Smrg 19383367019cSmrg#if OPT_INPUT_METHOD 19393367019cSmrg#define NINPUTWIDGETS 3 19403367019cSmrgtypedef struct { 19413367019cSmrg Widget w; 19423367019cSmrg XIM xim; /* input method attached to 'w' */ 19433367019cSmrg XIC xic; /* input context attached to 'xim' */ 19443367019cSmrg} TInput; 19453367019cSmrg#endif 19463367019cSmrg 19473367019cSmrgtypedef enum { 19483367019cSmrg CURSOR_BLOCK = 2 19493367019cSmrg , CURSOR_UNDERLINE = 4 19503367019cSmrg , CURSOR_BAR = 6 19513367019cSmrg} XtCursorShape; 19523367019cSmrg 19533367019cSmrg#define isCursorBlock(s) ((s)->cursor_shape == CURSOR_BLOCK) 19543367019cSmrg#define isCursorUnderline(s) ((s)->cursor_shape == CURSOR_UNDERLINE) 19553367019cSmrg#define isCursorBar(s) ((s)->cursor_shape == CURSOR_BAR) 19563367019cSmrg 19573367019cSmrgtypedef enum { 19583367019cSmrg DEFAULT_STYLE = 0 19593367019cSmrg , BLINK_BLOCK 19603367019cSmrg , STEADY_BLOCK 19613367019cSmrg , BLINK_UNDERLINE 19623367019cSmrg , STEADY_UNDERLINE 19633367019cSmrg , BLINK_BAR 19643367019cSmrg , STEADY_BAR 19653367019cSmrg} XtCursorStyle; 19663367019cSmrg 1967d522f475Smrgtypedef struct { 1968d522f475Smrg/* These parameters apply to both windows */ 1969d522f475Smrg Display *display; /* X display for screen */ 1970d522f475Smrg int respond; /* socket for responses 1971d522f475Smrg (position report, etc.) */ 1972d522f475Smrg/* These parameters apply to VT100 window */ 1973d522f475Smrg IChar unparse_bfr[256]; 1974d522f475Smrg unsigned unparse_len; 1975d522f475Smrg 1976d522f475Smrg#if OPT_TCAP_QUERY 1977d522f475Smrg int tc_query_code; 1978d522f475Smrg Bool tc_query_fkey; 1979d522f475Smrg#endif 1980d522f475Smrg pid_t pid; /* pid of process on far side */ 1981d522f475Smrg uid_t uid; /* user id of actual person */ 1982d522f475Smrg gid_t gid; /* group id of actual person */ 1983d522f475Smrg ColorRes Tcolors[NCOLORS]; /* terminal colors */ 1984d522f475Smrg#if OPT_HIGHLIGHT_COLOR 1985d522f475Smrg Boolean hilite_color; /* hilite colors override */ 1986d522f475Smrg Boolean hilite_reverse; /* hilite overrides reverse */ 1987d522f475Smrg#endif 1988d522f475Smrg#if OPT_ISO_COLORS 19893367019cSmrg XColor * cmap_data; /* color table */ 19903367019cSmrg unsigned cmap_size; 1991d522f475Smrg ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ 1992d522f475Smrg int veryBoldColors; /* modifier for boldColors */ 1993d522f475Smrg Boolean boldColors; /* can we make bold colors? */ 1994d522f475Smrg Boolean colorMode; /* are we using color mode? */ 1995d522f475Smrg Boolean colorULMode; /* use color for underline? */ 1996d522f475Smrg Boolean italicULMode; /* italic font for underline? */ 1997d522f475Smrg Boolean colorBDMode; /* use color for bold? */ 1998d522f475Smrg Boolean colorBLMode; /* use color for blink? */ 1999d522f475Smrg Boolean colorRVMode; /* use color for reverse? */ 2000d522f475Smrg Boolean colorAttrMode; /* prefer colorUL/BD to SGR */ 200194644356Smrg#if OPT_WIDE_ATTRS 200294644356Smrg Boolean colorITMode; /* use color for italics? */ 200394644356Smrg#endif 2004d522f475Smrg#endif 2005d522f475Smrg#if OPT_DEC_CHRSET 2006d522f475Smrg Boolean font_doublesize;/* enable font-scaling */ 2007d522f475Smrg int cache_doublesize;/* limit of our cache */ 2008d522f475Smrg Char cur_chrset; /* character-set index & code */ 2009d522f475Smrg int fonts_used; /* count items in double_fonts */ 2010d522f475Smrg XTermFonts double_fonts[NUM_CHRSET]; 2011d522f475Smrg#endif 2012d522f475Smrg#if OPT_DEC_RECTOPS 2013d522f475Smrg int cur_decsace; /* parameter for DECSACE */ 2014d522f475Smrg#endif 2015d522f475Smrg#if OPT_WIDE_CHARS 2016d522f475Smrg Boolean wide_chars; /* true when 16-bit chars */ 2017d522f475Smrg Boolean vt100_graphics; /* true to allow vt100-graphics */ 2018d522f475Smrg Boolean utf8_inparse; /* true to enable UTF-8 parser */ 20193367019cSmrg Boolean normalized_c; /* true to precompose to Form C */ 2020712a7ff4Smrg char * utf8_mode_s; /* use UTF-8 decode/encode */ 2021712a7ff4Smrg char * utf8_fonts_s; /* use UTF-8 decode/encode */ 2022fa3f02f3Smrg int utf8_nrc_mode; /* saved UTF-8 mode for DECNRCM */ 2023fa3f02f3Smrg Boolean utf8_always; /* special case for wideChars */ 2024d522f475Smrg int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ 2025712a7ff4Smrg int utf8_fonts; /* use UTF-8 decode/encode: 0-2 */ 2026d522f475Smrg int max_combining; /* maximum # of combining chars */ 2027d522f475Smrg Boolean utf8_latin1; /* use UTF-8 with Latin-1 bias */ 2028d522f475Smrg Boolean utf8_title; /* use UTF-8 titles */ 2029d522f475Smrg int latin9_mode; /* poor man's luit, latin9 */ 2030d522f475Smrg int unicode_font; /* font uses unicode encoding */ 2031d522f475Smrg int utf_count; /* state of utf_char */ 2032d522f475Smrg IChar utf_char; /* in-progress character */ 20333367019cSmrg Boolean char_was_written; 2034d522f475Smrg int last_written_col; 2035d522f475Smrg int last_written_row; 2036b7c89284Ssnj TypedBuffer(XChar2b); 2037b7c89284Ssnj TypedBuffer(char); 2038d522f475Smrg#endif 2039d522f475Smrg#if OPT_BROKEN_OSC 2040d522f475Smrg Boolean brokenLinuxOSC; /* true to ignore Linux palette ctls */ 2041d522f475Smrg#endif 2042d522f475Smrg#if OPT_BROKEN_ST 2043d522f475Smrg Boolean brokenStringTerm; /* true to match old OSC parse */ 2044d522f475Smrg#endif 2045d522f475Smrg#if OPT_C1_PRINT || OPT_WIDE_CHARS 2046d522f475Smrg Boolean c1_printable; /* true if we treat C1 as print */ 2047d522f475Smrg#endif 2048d522f475Smrg int border; /* inner border */ 2049d522f475Smrg int scrollBarBorder; /* scrollBar border */ 20500d92cbfdSchristos long event_mask; 20510d92cbfdSchristos unsigned send_mouse_pos; /* user wants mouse transition */ 2052d522f475Smrg /* and position information */ 20533367019cSmrg int extend_coords; /* support large terminals */ 2054dfb07bc7Smrg#if OPT_FOCUS_EVENT 2055d522f475Smrg Boolean send_focus_pos; /* user wants focus in/out info */ 2056dfb07bc7Smrg#endif 2057d522f475Smrg Boolean quiet_grab; /* true if no cursor change on focus */ 2058d522f475Smrg#if OPT_PASTE64 2059b7c89284Ssnj Cardinal base64_paste; /* set to send paste in base64 */ 2060d522f475Smrg int base64_final; /* string-terminator for paste */ 2061d522f475Smrg /* _qWriteSelectionData expects these to be initialized to zero. 2062d522f475Smrg * base64_flush() is the last step of the conversion, it clears these 2063d522f475Smrg * variables. 2064d522f475Smrg */ 20650d92cbfdSchristos unsigned base64_accu; 20660d92cbfdSchristos unsigned base64_count; 20670d92cbfdSchristos unsigned base64_pad; 2068d522f475Smrg#endif 2069d522f475Smrg#if OPT_READLINE 2070d522f475Smrg unsigned click1_moves; 2071d522f475Smrg unsigned paste_moves; 2072d522f475Smrg unsigned dclick3_deletes; 2073d522f475Smrg unsigned paste_brackets; 2074d522f475Smrg unsigned paste_quotes; 2075d522f475Smrg unsigned paste_literal_nl; 2076d522f475Smrg#endif /* OPT_READLINE */ 2077d522f475Smrg#if OPT_DEC_LOCATOR 2078d522f475Smrg Boolean locator_reset; /* turn mouse off after 1 report? */ 2079d522f475Smrg Boolean locator_pixels; /* report in pixels? */ 2080d522f475Smrg /* if false, report in cells */ 20810d92cbfdSchristos unsigned locator_events; /* what events to report */ 2082d522f475Smrg Boolean loc_filter; /* is filter rectangle active? */ 2083d522f475Smrg int loc_filter_top; /* filter rectangle for DEC Locator */ 2084d522f475Smrg int loc_filter_left; 2085d522f475Smrg int loc_filter_bottom; 2086d522f475Smrg int loc_filter_right; 2087d522f475Smrg#endif /* OPT_DEC_LOCATOR */ 2088d522f475Smrg int mouse_button; /* current button pressed */ 2089d522f475Smrg int mouse_row; /* ...and its row */ 2090d522f475Smrg int mouse_col; /* ...and its column */ 2091d522f475Smrg int select; /* xterm selected */ 2092d522f475Smrg Boolean bellOnReset; /* bellOnReset */ 2093d522f475Smrg Boolean visualbell; /* visual bell mode */ 2094d522f475Smrg Boolean poponbell; /* pop on bell mode */ 20950d92cbfdSchristos 2096dfb07bc7Smrg Boolean eraseSavedLines; /* eraseSavedLines option */ 2097dfb07bc7Smrg Boolean eraseSavedLines0; /* initial eraseSavedLines */ 2098dfb07bc7Smrg Boolean tabCancelsWrap; /* tabCancelsWrap option */ 2099dfb07bc7Smrg 21003367019cSmrg Boolean allowPasteControls; /* PasteControls mode */ 2101cd3331d0Smrg Boolean allowColorOps; /* ColorOps mode */ 21020d92cbfdSchristos Boolean allowFontOps; /* FontOps mode */ 2103dfb07bc7Smrg Boolean allowMouseOps; /* MouseOps mode */ 2104d522f475Smrg Boolean allowSendEvents;/* SendEvent mode */ 21050d92cbfdSchristos Boolean allowTcapOps; /* TcapOps mode */ 2106d522f475Smrg Boolean allowTitleOps; /* TitleOps mode */ 2107d522f475Smrg Boolean allowWindowOps; /* WindowOps mode */ 21080d92cbfdSchristos 210994644356Smrg Boolean allowPasteControl0; /* PasteControls mode */ 2110cd3331d0Smrg Boolean allowColorOp0; /* initial ColorOps mode */ 21110d92cbfdSchristos Boolean allowFontOp0; /* initial FontOps mode */ 2112dfb07bc7Smrg Boolean allowMouseOp0; /* initial MouseOps mode */ 2113d522f475Smrg Boolean allowSendEvent0;/* initial SendEvent mode */ 21140d92cbfdSchristos Boolean allowTcapOp0; /* initial TcapOps mode */ 2115d522f475Smrg Boolean allowTitleOp0; /* initial TitleOps mode */ 2116d522f475Smrg Boolean allowWindowOp0; /* initial WindowOps mode */ 21170d92cbfdSchristos 2118cd3331d0Smrg String disallowedColorOps; 2119cd3331d0Smrg char disallow_color_ops[ecLAST]; 2120cd3331d0Smrg 2121cd3331d0Smrg String disallowedFontOps; 2122cd3331d0Smrg char disallow_font_ops[efLAST]; 2123cd3331d0Smrg 2124dfb07bc7Smrg String disallowedMouseOps; 2125dfb07bc7Smrg char disallow_mouse_ops[emLAST]; 2126dfb07bc7Smrg 2127cd3331d0Smrg String disallowedTcapOps; 2128cd3331d0Smrg char disallow_tcap_ops[etLAST]; 2129cd3331d0Smrg 2130cd3331d0Smrg String disallowedWinOps; 2131cd3331d0Smrg char disallow_win_ops[ewLAST]; 2132cd3331d0Smrg 2133d522f475Smrg Boolean awaitInput; /* select-timeout mode */ 2134d522f475Smrg Boolean grabbedKbd; /* keyboard is grabbed */ 2135d522f475Smrg#ifdef ALLOWLOGGING 2136d522f475Smrg int logging; /* logging mode */ 2137d522f475Smrg int logfd; /* file descriptor of log */ 2138d522f475Smrg char *logfile; /* log file name */ 2139d522f475Smrg Char *logstart; /* current start of log buffer */ 2140d522f475Smrg#endif 2141d522f475Smrg int inhibit; /* flags for inhibiting changes */ 2142d522f475Smrg 2143d522f475Smrg/* VT window parameters */ 2144d522f475Smrg Boolean Vshow; /* VT window showing */ 2145d522f475Smrg VTwin fullVwin; 21463367019cSmrg int needSwap; 2147d522f475Smrg#ifndef NO_ACTIVE_ICON 2148d522f475Smrg VTwin iconVwin; 2149d522f475Smrg VTwin *whichVwin; 2150d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2151d522f475Smrg 2152d522f475Smrg int pointer_mode; /* when to use hidden_cursor */ 21539a64e1c5Smrg int pointer_mode0; /* ...initial value */ 2154d522f475Smrg Boolean hide_pointer; /* true to use "hidden_cursor" */ 2155d522f475Smrg Cursor pointer_cursor; /* pointer cursor in window */ 2156d522f475Smrg Cursor hidden_cursor; /* hidden cursor in window */ 2157d522f475Smrg 2158d522f475Smrg String answer_back; /* response to ENQ */ 2159d522f475Smrg 2160712a7ff4Smrg PrinterState printer_state; /* actual printer state */ 2161cd3331d0Smrg PrinterFlags printer_flags; /* working copy of printer flags */ 2162712a7ff4Smrg#if OPT_PRINT_ON_EXIT 2163712a7ff4Smrg Boolean write_error; 2164712a7ff4Smrg#endif 2165cd3331d0Smrg 2166d522f475Smrg Boolean fnt_prop; /* true if proportional fonts */ 2167d522f475Smrg Boolean fnt_boxes; /* true if font has box-chars */ 2168cd3331d0Smrg Boolean force_packed; /* true to override proportional */ 2169d522f475Smrg#if OPT_BOX_CHARS 21703367019cSmrg Boolean force_box_chars;/* true if we assume no boxchars */ 2171cd3331d0Smrg Boolean force_all_chars;/* true to outline missing chars */ 2172fa3f02f3Smrg Boolean assume_all_chars;/* true to allow missing chars */ 2173cd3331d0Smrg Boolean allow_packing; /* true to allow packed-fonts */ 2174d522f475Smrg#endif 2175d522f475Smrg Dimension fnt_wide; 2176d522f475Smrg Dimension fnt_high; 21773367019cSmrg float scale_height; /* scaling for font-height */ 2178d522f475Smrg XTermFonts fnts[fMAX]; /* normal/bold/etc for terminal */ 2179d522f475Smrg Boolean free_bold_box; /* same_font_size's austerity */ 2180712a7ff4Smrg Boolean allowBoldFonts; /* do we use bold fonts at all? */ 21819a64e1c5Smrg#if OPT_WIDE_ATTRS 21829a64e1c5Smrg XTermFonts ifnts[fMAX]; /* normal/bold/etc italic fonts */ 21839a64e1c5Smrg Boolean ifnts_ok; /* true if ifnts[] is cached */ 21849a64e1c5Smrg#endif 2185d522f475Smrg#ifndef NO_ACTIVE_ICON 2186cb4a1343Smrg XTermFonts fnt_icon; /* icon font */ 2187cb4a1343Smrg String icon_fontname; /* name of icon font */ 2188cb4a1343Smrg int icon_fontnum; /* number to use for icon font */ 2189d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2190d522f475Smrg int enbolden; /* overstrike for bold font */ 2191d522f475Smrg XPoint *box; /* draw unselected cursor */ 2192d522f475Smrg 2193d522f475Smrg int cursor_state; /* ON, OFF, or BLINKED_OFF */ 2194d522f475Smrg int cursor_busy; /* do not redraw... */ 21950d92cbfdSchristos Boolean cursor_underline; /* true if cursor is in underline mode */ 21963367019cSmrg XtCursorShape cursor_shape; 2197d522f475Smrg#if OPT_BLINK_CURS 2198d522f475Smrg Boolean cursor_blink; /* cursor blink enable */ 2199d522f475Smrg Boolean cursor_blink_res; /* initial cursor blink value */ 2200d522f475Smrg Boolean cursor_blink_esc; /* cursor blink escape-state */ 2201d522f475Smrg#endif 2202d522f475Smrg#if OPT_BLINK_TEXT 2203d522f475Smrg Boolean blink_as_bold; /* text blink disable */ 2204d522f475Smrg#endif 2205d522f475Smrg#if OPT_BLINK_CURS || OPT_BLINK_TEXT 2206d522f475Smrg int blink_state; /* ON, OFF, or BLINKED_OFF */ 2207d522f475Smrg int blink_on; /* cursor on time (msecs) */ 2208d522f475Smrg int blink_off; /* cursor off time (msecs) */ 2209d522f475Smrg XtIntervalId blink_timer; /* timer-id for cursor-proc */ 2210d522f475Smrg#endif 2211d522f475Smrg#if OPT_ZICONBEEP 2212d522f475Smrg Boolean zIconBeep_flagged; /* True if icon name was changed */ 2213d522f475Smrg#endif /* OPT_ZICONBEEP */ 2214d522f475Smrg int cursor_GC; /* see ShowCursor() */ 2215d522f475Smrg int cursor_set; /* requested state */ 2216d522f475Smrg CELL cursorp; /* previous cursor row/column */ 2217d522f475Smrg int cur_col; /* current cursor column */ 2218d522f475Smrg int cur_row; /* current cursor row */ 2219d522f475Smrg int max_col; /* rightmost column */ 2220d522f475Smrg int max_row; /* bottom row */ 2221d522f475Smrg int top_marg; /* top line of scrolling region */ 2222d522f475Smrg int bot_marg; /* bottom line of " " */ 22233367019cSmrg int lft_marg; /* left column of " " */ 22243367019cSmrg int rgt_marg; /* right column of " " */ 2225d522f475Smrg Widget scrollWidget; /* pointer to scrollbar struct */ 2226d522f475Smrg /* 2227d522f475Smrg * Indices used to keep track of the top of the vt100 window and 2228d522f475Smrg * the saved lines, taking scrolling into account. 2229d522f475Smrg */ 2230d522f475Smrg int topline; /* line number of top, <= 0 */ 223194644356Smrg long saved_fifo; /* number of lines that've ever been saved */ 2232d522f475Smrg int savedlines; /* number of lines that've been saved */ 2233d522f475Smrg int savelines; /* number of lines off top to save */ 2234d522f475Smrg int scroll_amt; /* amount to scroll */ 2235d522f475Smrg int refresh_amt; /* amount to refresh */ 2236d522f475Smrg /* 2237b7c89284Ssnj * Working variables for getLineData(). 2238b7c89284Ssnj */ 2239b7c89284Ssnj size_t lineExtra; /* extra space for combining chars */ 2240b7c89284Ssnj /* 2241b7c89284Ssnj * Pointer to the current visible buffer. 2242d522f475Smrg */ 2243d522f475Smrg ScrnBuf visbuf; /* ptr to visible screen buf (main) */ 2244d522f475Smrg /* 2245d522f475Smrg * Data for the normal buffer, which may have saved lines to which 2246d522f475Smrg * the user can scroll. 2247d522f475Smrg */ 2248b7c89284Ssnj ScrnBuf saveBuf_index; 2249b7c89284Ssnj Char *saveBuf_data; 2250d522f475Smrg /* 2251b7c89284Ssnj * Data for visible and alternate buffer. 2252d522f475Smrg */ 2253b7c89284Ssnj ScrnBuf editBuf_index[2]; 2254b7c89284Ssnj Char *editBuf_data[2]; 2255b7c89284Ssnj int whichBuf; /* 0/1 for normal/alternate buf */ 2256b7c89284Ssnj Boolean is_running; /* true when buffers are legal */ 2257d522f475Smrg /* 2258d522f475Smrg * Workspace used for screen operations. 2259d522f475Smrg */ 2260d522f475Smrg Char **save_ptr; /* workspace for save-pointers */ 2261d522f475Smrg size_t save_len; /* ...and its length */ 2262d522f475Smrg 2263d522f475Smrg int scrolllines; /* number of lines to button scroll */ 22643367019cSmrg Boolean alternateScroll; /* scroll-actions become keys */ 2265d522f475Smrg Boolean scrollttyoutput; /* scroll to bottom on tty output */ 2266d522f475Smrg Boolean scrollkey; /* scroll to bottom on key */ 2267d522f475Smrg Boolean cursor_moved; /* scrolling makes cursor move */ 2268d522f475Smrg 22690d92cbfdSchristos Boolean do_wrap; /* true if cursor in last column 2270d522f475Smrg and character just output */ 2271d522f475Smrg 2272d522f475Smrg int incopy; /* 0 idle; 1 XCopyArea issued; 2273d522f475Smrg -1 first GraphicsExpose seen, 2274d522f475Smrg but last not seen */ 2275d522f475Smrg int copy_src_x; /* params from last XCopyArea ... */ 2276d522f475Smrg int copy_src_y; 2277d522f475Smrg unsigned int copy_width; 2278d522f475Smrg unsigned int copy_height; 2279d522f475Smrg int copy_dest_x; 2280d522f475Smrg int copy_dest_y; 2281d522f475Smrg 22823367019cSmrg Dimension embed_wide; 22833367019cSmrg Dimension embed_high; 22843367019cSmrg 2285d522f475Smrg Boolean c132; /* allow change to 132 columns */ 2286d522f475Smrg Boolean curses; /* kludge line wrap for more */ 2287d522f475Smrg Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ 2288d522f475Smrg Boolean marginbell; /* true if margin bell on */ 2289d522f475Smrg int nmarginbell; /* columns from right margin */ 2290cd3331d0Smrg int bellArmed; /* cursor below bell margin */ 2291cd3331d0Smrg BellVolume marginVolume; /* margin-bell volume */ 2292cd3331d0Smrg BellVolume warningVolume; /* warning-bell volume */ 2293d522f475Smrg Boolean multiscroll; /* true if multi-scroll */ 2294d522f475Smrg int scrolls; /* outstanding scroll count, 2295d522f475Smrg used only with multiscroll */ 2296d522f475Smrg SavedCursor sc[SAVED_CURSORS]; /* data for restore cursor */ 22979a64e1c5Smrg IFlags save_modes[DP_LAST]; /* save dec/xterm private modes */ 2298d522f475Smrg 2299cd3331d0Smrg int title_modes; /* control set/get of titles */ 23009a64e1c5Smrg int title_modes0; /* ...initial value */ 2301cd3331d0Smrg SaveTitle *save_title; 2302cd3331d0Smrg 2303d522f475Smrg /* Improved VT100 emulation stuff. */ 2304d522f475Smrg String keyboard_dialect; /* default keyboard dialect */ 2305fa3f02f3Smrg int gsets[4]; /* G0 through G3. */ 2306d522f475Smrg Char curgl; /* Current GL setting. */ 2307d522f475Smrg Char curgr; /* Current GR setting. */ 2308d522f475Smrg Char curss; /* Current single shift. */ 2309d522f475Smrg String term_id; /* resource for terminal_id */ 2310d522f475Smrg int terminal_id; /* 100=vt100, 220=vt220, etc. */ 2311d522f475Smrg int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */ 23123367019cSmrg int ansi_level; /* dpANSI levels 1,2,3 */ 2313d522f475Smrg int protected_mode; /* 0=off, 1=DEC, 2=ISO */ 2314d522f475Smrg Boolean always_bold_mode; /* compare normal/bold font */ 2315d522f475Smrg Boolean always_highlight; /* whether to highlight cursor */ 2316d522f475Smrg Boolean bold_mode; /* use bold font or overstrike */ 2317d522f475Smrg Boolean delete_is_del; /* true for compatible Delete key */ 2318d522f475Smrg Boolean jumpscroll; /* whether we should jumpscroll */ 2319b7c89284Ssnj Boolean fastscroll; /* whether we should fastscroll */ 2320d522f475Smrg Boolean old_fkeys; /* true for compatible fkeys */ 23219a64e1c5Smrg Boolean old_fkeys0; /* ...initial value */ 2322d522f475Smrg Boolean underline; /* whether to underline text */ 2323d522f475Smrg 2324d522f475Smrg#if OPT_MAXIMIZE 2325d522f475Smrg Boolean restore_data; 2326d522f475Smrg int restore_x; 2327d522f475Smrg int restore_y; 2328d522f475Smrg unsigned restore_width; 2329d522f475Smrg unsigned restore_height; 2330d522f475Smrg#endif 2331d522f475Smrg 233294644356Smrg#if OPT_REGIS_GRAPHICS 233394644356Smrg String graphics_regis_default_font; /* font for "builtin" */ 233494644356Smrg 233594644356Smrg String graphics_regis_screensize; /* given a size in pixels */ 233694644356Smrg Dimension graphics_regis_def_wide; /* ...corresponding width */ 233794644356Smrg Dimension graphics_regis_def_high; /* ...and height */ 233894644356Smrg#endif 233994644356Smrg 234094644356Smrg#if OPT_GRAPHICS 234194644356Smrg String graphics_max_size; /* given a size in pixels */ 234294644356Smrg Dimension graphics_max_wide; /* ...corresponding width */ 234394644356Smrg Dimension graphics_max_high; /* ...and height */ 234494644356Smrg#endif 234594644356Smrg 2346cd3331d0Smrg#if OPT_SCROLL_LOCK 2347cd3331d0Smrg Boolean allowScrollLock;/* ScrollLock mode */ 2348cd3331d0Smrg Boolean allowScrollLock0;/* initial ScrollLock mode */ 2349cd3331d0Smrg Boolean scroll_lock; /* true to keep buffer in view */ 2350cd3331d0Smrg Boolean scroll_dirty; /* scrolling makes screen dirty */ 2351cd3331d0Smrg#endif 2352cd3331d0Smrg 2353fa3f02f3Smrg#if OPT_SIXEL_GRAPHICS 2354fa3f02f3Smrg Boolean sixel_scrolling; /* sixel scrolling */ 23559a64e1c5Smrg Boolean sixel_scrolls_right; /* sixel scrolling moves cursor to right */ 23569a64e1c5Smrg#endif 23579a64e1c5Smrg 23589a64e1c5Smrg#if OPT_GRAPHICS 23599a64e1c5Smrg int numcolorregisters; /* number of supported color registers */ 2360fa3f02f3Smrg Boolean privatecolorregisters; /* private color registers for each graphic */ 2361fa3f02f3Smrg#endif 2362fa3f02f3Smrg 2363d522f475Smrg#if OPT_VT52_MODE 23640d92cbfdSchristos Char vt52_save_curgl; 23650d92cbfdSchristos Char vt52_save_curgr; 23660d92cbfdSchristos Char vt52_save_curss; 2367fa3f02f3Smrg int vt52_save_gsets[4]; 2368d522f475Smrg#endif 2369d522f475Smrg /* Testing */ 2370d522f475Smrg#if OPT_XMC_GLITCH 2371d522f475Smrg unsigned xmc_glitch; /* # of spaces to pad on SGR's */ 23729a64e1c5Smrg IAttr xmc_attributes; /* attrs that make a glitch */ 2373d522f475Smrg Boolean xmc_inline; /* SGR's propagate only to eol */ 2374d522f475Smrg Boolean move_sgr_ok; /* SGR is reset on move */ 2375d522f475Smrg#endif 2376d522f475Smrg 2377d522f475Smrg /* 2378d522f475Smrg * Bell 2379d522f475Smrg */ 2380d522f475Smrg int visualBellDelay; /* msecs to delay for visibleBell */ 2381d522f475Smrg int bellSuppressTime; /* msecs after Bell before another allowed */ 2382d522f475Smrg Boolean bellInProgress; /* still ringing/flashing prev bell? */ 2383d522f475Smrg Boolean bellIsUrgent; /* set XUrgency WM hint on bell */ 23843367019cSmrg Boolean flash_line; /* show visualBell as current line */ 2385d522f475Smrg /* 2386d522f475Smrg * Select/paste state. 2387d522f475Smrg */ 2388d522f475Smrg Boolean selectToClipboard; /* primary vs clipboard */ 2389d522f475Smrg String *mappedSelect; /* mapping for "SELECT" to "PRIMARY" */ 2390d522f475Smrg 2391d522f475Smrg Boolean waitingForTrackInfo; 2392d522f475Smrg int numberOfClicks; 2393d522f475Smrg int maxClicks; 2394d522f475Smrg int multiClickTime; /* time between multiclick selects */ 2395d522f475Smrg SelectUnit selectUnit; 2396d522f475Smrg SelectUnit selectMap[NSELECTUNITS]; 2397d522f475Smrg String onClick[NSELECTUNITS + 1]; 2398d522f475Smrg 2399d522f475Smrg char *charClass; /* for overriding word selection */ 2400d522f475Smrg Boolean cutNewline; /* whether or not line cut has \n */ 2401d522f475Smrg Boolean cutToBeginningOfLine; /* line cuts to BOL? */ 2402d522f475Smrg Boolean highlight_selection; /* controls appearance of selection */ 2403cb4a1343Smrg Boolean show_wrap_marks; /* show lines which are wrapped */ 2404d522f475Smrg Boolean trim_selection; /* controls trimming of selection */ 2405d522f475Smrg Boolean i18nSelections; 2406d522f475Smrg Boolean brokenSelections; 2407037a25ddSmrg Boolean keepClipboard; /* retain data sent to clipboard */ 2408d522f475Smrg Boolean keepSelection; /* do not lose selection on output */ 2409d522f475Smrg Boolean replyToEmacs; /* Send emacs escape code when done selecting or extending? */ 2410d522f475Smrg Char *selection_data; /* the current selection */ 2411d522f475Smrg int selection_size; /* size of allocated buffer */ 24120d92cbfdSchristos unsigned long selection_length; /* number of significant bytes */ 2413037a25ddSmrg Char *clipboard_data; /* the current clipboard */ 2414037a25ddSmrg unsigned long clipboard_size; /* size of allocated buffer */ 2415d522f475Smrg EventMode eventMode; 2416d522f475Smrg Time selection_time; /* latest event timestamp */ 2417d522f475Smrg Time lastButtonUpTime; 2418d522f475Smrg unsigned lastButton; 2419d522f475Smrg 2420d522f475Smrg CELL rawPos; /* raw position for selection start */ 2421d522f475Smrg CELL startRaw; /* area before selectUnit processing */ 2422d522f475Smrg CELL endRaw; /* " " */ 2423d522f475Smrg CELL startSel; /* area after selectUnit processing */ 2424d522f475Smrg CELL endSel; /* " " */ 2425d522f475Smrg CELL startH; /* start highlighted text */ 2426d522f475Smrg CELL endH; /* end highlighted text */ 2427d522f475Smrg CELL saveStartW; /* saved WORD state, for LINE */ 2428d522f475Smrg CELL startExt; /* Start, end of extension */ 2429d522f475Smrg CELL endExt; /* " " */ 2430d522f475Smrg CELL saveStartR; /* Saved values of raw selection for extend to restore to */ 2431d522f475Smrg CELL saveEndR; /* " " */ 2432d522f475Smrg int startHCoord, endHCoord; 2433d522f475Smrg int firstValidRow; /* Valid rows for selection clipping */ 2434d522f475Smrg int lastValidRow; /* " " */ 2435d522f475Smrg 24363367019cSmrg Boolean selectToBuffer; /* copy selection to buffer */ 243794644356Smrg InternalSelect internal_select; 24383367019cSmrg 2439b7c89284Ssnj String default_string; 2440b7c89284Ssnj String eightbit_select_types; 2441b7c89284Ssnj Atom* selection_targets_8bit; 2442b7c89284Ssnj#if OPT_WIDE_CHARS 2443b7c89284Ssnj String utf8_select_types; 2444b7c89284Ssnj Atom* selection_targets_utf8; 2445b7c89284Ssnj#endif 2446d522f475Smrg Atom* selection_atoms; /* which selections we own */ 24473367019cSmrg Cardinal sel_atoms_size; /* how many atoms allocated */ 2448d522f475Smrg Cardinal selection_count; /* how many atoms in use */ 2449d522f475Smrg#if OPT_SELECT_REGEX 2450d522f475Smrg char * selectExpr[NSELECTUNITS]; 2451d522f475Smrg#endif 2452d522f475Smrg /* 2453d522f475Smrg * Input/output state. 2454d522f475Smrg */ 24553367019cSmrg Boolean input_eight_bits; /* do not send ESC when meta pressed */ 24563367019cSmrg int eight_bit_meta; /* use 8th bit when meta pressed */ 24573367019cSmrg char * eight_bit_meta_s; /* ...resource eightBitMeta */ 24583367019cSmrg Boolean output_eight_bits; /* honor all bits or strip */ 24593367019cSmrg Boolean control_eight_bits; /* send CSI as 8-bits */ 2460d522f475Smrg Boolean backarrow_key; /* backspace/delete */ 2461d522f475Smrg Boolean alt_is_not_meta; /* use both Alt- and Meta-key */ 2462d522f475Smrg Boolean alt_sends_esc; /* Alt-key sends ESC prefix */ 2463d522f475Smrg Boolean meta_sends_esc; /* Meta-key sends ESC prefix */ 2464d522f475Smrg /* 2465d522f475Smrg * Fonts 2466d522f475Smrg */ 2467d522f475Smrg Pixmap menu_item_bitmap; /* mask for checking items */ 2468d522f475Smrg String initial_font; 2469dfb07bc7Smrg char * menu_font_names[NMENUFONTS][fMAX]; 2470d522f475Smrg#define MenuFontName(n) menu_font_names[n][fNorm] 247194644356Smrg#define EscapeFontName() MenuFontName(fontMenu_fontescape) 247294644356Smrg#define SelectFontName() MenuFontName(fontMenu_fontsel) 2473d522f475Smrg long menu_font_sizes[NMENUFONTS]; 2474d522f475Smrg int menu_font_number; 24753367019cSmrg#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS 2476712a7ff4Smrg Boolean savedVTFonts; 2477712a7ff4Smrg Boolean mergedVTFonts; 2478712a7ff4Smrg SubResourceRec cacheVTFonts; 2479712a7ff4Smrg#endif 2480d522f475Smrg#if OPT_CLIP_BOLD 2481d522f475Smrg Boolean use_clipping; 2482d522f475Smrg#endif 2483d522f475Smrg void * main_cgs_cache; 2484d522f475Smrg#ifndef NO_ACTIVE_ICON 2485d522f475Smrg void * icon_cgs_cache; 2486d522f475Smrg#endif 2487d522f475Smrg#if OPT_RENDERFONT 2488b7c89284Ssnj XTermXftFonts renderFontNorm[NMENUFONTS]; 2489b7c89284Ssnj XTermXftFonts renderFontBold[NMENUFONTS]; 2490b7c89284Ssnj XTermXftFonts renderFontItal[NMENUFONTS]; 2491b7c89284Ssnj#if OPT_RENDERWIDE 2492b7c89284Ssnj XTermXftFonts renderWideNorm[NMENUFONTS]; 2493b7c89284Ssnj XTermXftFonts renderWideBold[NMENUFONTS]; 2494b7c89284Ssnj XTermXftFonts renderWideItal[NMENUFONTS]; 2495b7c89284Ssnj TypedBuffer(XftCharSpec); 2496b7c89284Ssnj#else 2497b7c89284Ssnj TypedBuffer(XftChar8); 2498b7c89284Ssnj#endif 2499d522f475Smrg XftDraw * renderDraw; 2500d522f475Smrg#endif 2501d522f475Smrg#if OPT_DABBREV 2502b7c89284Ssnj Boolean dabbrev_working; /* nonzero during dabbrev process */ 2503d522f475Smrg unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ 2504d522f475Smrg#endif 2505d522f475Smrg char tcapbuf[TERMCAP_SIZE]; 2506712a7ff4Smrg char tcap_area[TERMCAP_SIZE]; 2507d522f475Smrg#if OPT_TCAP_FKEYS 2508d522f475Smrg char ** tcap_fkeys; 2509d522f475Smrg#endif 2510d522f475Smrg} TScreen; 2511d522f475Smrg 2512d522f475Smrgtypedef struct _TekPart { 2513d522f475Smrg XFontStruct * Tfont[TEKNUMFONTS]; 2514d522f475Smrg int tobaseline[TEKNUMFONTS]; /* top-baseline, each font */ 2515d522f475Smrg char * initial_font; /* large, 2, 3, small */ 2516d522f475Smrg char * gin_terminator_str; /* ginTerminator resource */ 2517d522f475Smrg#if OPT_TOOLBAR 2518d522f475Smrg TbInfo tb_info; /* toolbar information */ 2519d522f475Smrg#endif 2520d522f475Smrg} TekPart; 2521d522f475Smrg 2522d522f475Smrg/* Tektronix window parameters */ 2523d522f475Smrgtypedef struct _TekScreen { 2524d522f475Smrg GC TnormalGC; /* normal painting */ 2525d522f475Smrg GC TcursorGC; /* normal cursor painting */ 2526d522f475Smrg 2527d522f475Smrg Boolean waitrefresh; /* postpone refresh */ 2528d522f475Smrg TKwin fullTwin; 2529d522f475Smrg#ifndef NO_ACTIVE_ICON 2530d522f475Smrg TKwin iconTwin; 2531d522f475Smrg TKwin *whichTwin; 2532d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2533d522f475Smrg 2534d522f475Smrg Cursor arrow; /* arrow cursor */ 2535d522f475Smrg GC linepat[TEKNUMLINES]; /* line patterns */ 2536d522f475Smrg int cur_X; /* current x */ 2537d522f475Smrg int cur_Y; /* current y */ 2538d522f475Smrg Tmodes cur; /* current tek modes */ 2539d522f475Smrg Tmodes page; /* starting tek modes on page */ 2540d522f475Smrg int margin; /* 0 -> margin 1, 1 -> margin 2 */ 2541d522f475Smrg int pen; /* current Tektronix pen 0=up, 1=dn */ 2542d522f475Smrg char *TekGIN; /* nonzero if Tektronix GIN mode*/ 2543d522f475Smrg int gin_terminator; /* Tek strap option */ 2544d522f475Smrg char tcapbuf[TERMCAP_SIZE]; 2545d522f475Smrg} TekScreen; 2546d522f475Smrg 2547d522f475Smrg#if OPT_READLINE 2548d522f475Smrg#define SCREEN_FLAG(screenp,f) (1&(screenp)->f) 2549d522f475Smrg#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) 2550cd3331d0Smrg#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= (unsigned) ~1L) 2551d522f475Smrg#define SCREEN_FLAG_save(screenp,f) \ 2552d522f475Smrg ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) 2553d522f475Smrg#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) 2554d522f475Smrg#else 2555d522f475Smrg#define SCREEN_FLAG(screenp,f) (0) 2556d522f475Smrg#endif 2557d522f475Smrg 25583367019cSmrg/* 25593367019cSmrg * After screen-updates, reset the flag that tells us we should do wrapping. 25603367019cSmrg * Likewise, reset (in wide-character mode) the flag that tells us where the 25613367019cSmrg * "previous" character was written. 25623367019cSmrg */ 25633367019cSmrg#if OPT_WIDE_CHARS 25643367019cSmrg#define ResetWrap(screen) \ 25653367019cSmrg (screen)->do_wrap = \ 25663367019cSmrg (screen)->char_was_written = False 25673367019cSmrg#else 25683367019cSmrg#define ResetWrap(screen) \ 25693367019cSmrg (screen)->do_wrap = False 25703367019cSmrg#endif 25713367019cSmrg 2572d522f475Smrg/* meaning of bits in screen.select flag */ 2573d522f475Smrg#define INWINDOW 01 /* the mouse is in one of the windows */ 2574d522f475Smrg#define FOCUS 02 /* one of the windows is the focus window */ 2575d522f475Smrg 2576d522f475Smrg#define MULTICLICKTIME 250 /* milliseconds */ 2577d522f475Smrg 2578c219fbebSmrgtypedef struct { 2579c219fbebSmrg const char *name; 2580c219fbebSmrg int code; 2581c219fbebSmrg} FlagList; 2582c219fbebSmrg 2583d522f475Smrgtypedef enum { 2584d522f475Smrg keyboardIsLegacy, /* bogus vt220 codes for F1-F4, etc. */ 2585d522f475Smrg keyboardIsDefault, 2586d522f475Smrg keyboardIsHP, 2587d522f475Smrg keyboardIsSCO, 2588d522f475Smrg keyboardIsSun, 2589d522f475Smrg keyboardIsTermcap, 2590d522f475Smrg keyboardIsVT220 2591d522f475Smrg} xtermKeyboardType; 2592d522f475Smrg 2593d522f475Smrgtypedef enum { /* legal values for screen.pointer_mode */ 25943367019cSmrg pNever = 0 25953367019cSmrg , pNoMouse = 1 25963367019cSmrg , pAlways = 2 25973367019cSmrg , pFocused = 3 2598d522f475Smrg} pointerModeTypes; 2599d522f475Smrg 2600d522f475Smrgtypedef enum { /* legal values for screen.utf8_mode */ 2601712a7ff4Smrg uFalse = 0 2602712a7ff4Smrg , uTrue = 1 2603712a7ff4Smrg , uAlways = 2 2604712a7ff4Smrg , uDefault = 3 2605712a7ff4Smrg , uLast 2606d522f475Smrg} utf8ModeTypes; 2607d522f475Smrg 26083367019cSmrgtypedef enum { /* legal values for screen.eight_bit_meta */ 26093367019cSmrg ebFalse = 0 26103367019cSmrg , ebTrue = 1 26113367019cSmrg , ebNever = 2 26123367019cSmrg , ebLocale = 3 26133367019cSmrg , ebLast 26143367019cSmrg} ebMetaModeTypes; 26153367019cSmrg 2616037a25ddSmrg#define NAME_OLD_KT " legacy" 2617037a25ddSmrg 2618d522f475Smrg#if OPT_HP_FUNC_KEYS 2619d522f475Smrg#define NAME_HP_KT " hp" 2620d522f475Smrg#else 2621d522f475Smrg#define NAME_HP_KT /*nothing*/ 2622d522f475Smrg#endif 2623d522f475Smrg 2624d522f475Smrg#if OPT_SCO_FUNC_KEYS 2625d522f475Smrg#define NAME_SCO_KT " sco" 2626d522f475Smrg#else 2627d522f475Smrg#define NAME_SCO_KT /*nothing*/ 2628d522f475Smrg#endif 2629d522f475Smrg 2630d522f475Smrg#if OPT_SUN_FUNC_KEYS 2631d522f475Smrg#define NAME_SUN_KT " sun" 2632d522f475Smrg#else 2633d522f475Smrg#define NAME_SUN_KT /*nothing*/ 2634d522f475Smrg#endif 2635d522f475Smrg 2636d522f475Smrg#if OPT_SUNPC_KBD 2637d522f475Smrg#define NAME_VT220_KT " vt220" 2638d522f475Smrg#else 2639d522f475Smrg#define NAME_VT220_KT /*nothing*/ 2640d522f475Smrg#endif 2641d522f475Smrg 2642d522f475Smrg#if OPT_TCAP_FKEYS 2643d522f475Smrg#define NAME_TCAP_KT " tcap" 2644d522f475Smrg#else 2645d522f475Smrg#define NAME_TCAP_KT /*nothing*/ 2646d522f475Smrg#endif 2647d522f475Smrg 2648d522f475Smrg#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT 2649d522f475Smrg 2650cd3331d0Smrg#if OPT_TRACE 2651cd3331d0Smrg#define TRACE_RC(code,func) code = func 2652cd3331d0Smrg#else 2653cd3331d0Smrg#define TRACE_RC(code,func) func 2654cd3331d0Smrg#endif 2655cd3331d0Smrg 2656d522f475Smrgextern const char * visibleKeyboardType(xtermKeyboardType); 2657d522f475Smrg 2658d522f475Smrgtypedef struct 2659d522f475Smrg{ 26603367019cSmrg int allow_keys; /* how to handle legacy/vt220 keyboard */ 2661d522f475Smrg int cursor_keys; /* how to handle cursor-key modifiers */ 2662d522f475Smrg int function_keys; /* how to handle function-key modifiers */ 2663d522f475Smrg int keypad_keys; /* how to handle keypad key-modifiers */ 2664d522f475Smrg int other_keys; /* how to handle other key-modifiers */ 2665d522f475Smrg int string_keys; /* how to handle string() modifiers */ 2666d522f475Smrg} TModify; 2667d522f475Smrg 2668d522f475Smrgtypedef struct 2669d522f475Smrg{ 2670d522f475Smrg xtermKeyboardType type; 26719a64e1c5Smrg IFlags flags; 2672d522f475Smrg char *shell_translations; 2673d522f475Smrg char *xterm_translations; 2674d522f475Smrg char *extra_translations; 2675d522f475Smrg#if OPT_INITIAL_ERASE 2676d522f475Smrg int reset_DECBKM; /* reset should set DECBKM */ 2677d522f475Smrg#endif 2678d522f475Smrg#if OPT_MOD_FKEYS 2679d522f475Smrg TModify modify_now; /* current modifier value */ 2680d522f475Smrg TModify modify_1st; /* original modifier value, for resets */ 2681d522f475Smrg int format_keys; /* format of modifyOtherKeys */ 2682d522f475Smrg#endif 2683d522f475Smrg} TKeyboard; 2684d522f475Smrg 2685b7c89284Ssnj#define GravityIsNorthWest(w) ((w)->misc.resizeGravity == NorthWestGravity) 2686b7c89284Ssnj#define GravityIsSouthWest(w) ((w)->misc.resizeGravity == SouthWestGravity) 2687b7c89284Ssnj 2688d522f475Smrgtypedef struct _Misc { 2689d522f475Smrg VTFontNames default_font; 2690d522f475Smrg char *geo_metry; 2691d522f475Smrg char *T_geometry; 2692d522f475Smrg#if OPT_WIDE_CHARS 2693d522f475Smrg Boolean cjk_width; /* true for built-in CJK wcwidth() */ 2694d522f475Smrg Boolean mk_width; /* true for simpler built-in wcwidth() */ 2695d522f475Smrg int mk_samplesize; 2696d522f475Smrg int mk_samplepass; 2697d522f475Smrg#endif 2698d522f475Smrg#if OPT_LUIT_PROG 2699d522f475Smrg Boolean callfilter; /* true to invoke luit */ 2700d522f475Smrg Boolean use_encoding; /* true to use -encoding option for luit */ 2701d522f475Smrg char *locale_str; /* "locale" resource */ 2702d522f475Smrg char *localefilter; /* path for luit */ 2703d522f475Smrg#endif 2704b7c89284Ssnj fontWarningTypes fontWarnings; 2705d522f475Smrg int limit_resize; 2706d522f475Smrg#ifdef ALLOWLOGGING 2707d522f475Smrg Boolean log_on; 2708d522f475Smrg#endif 2709d522f475Smrg Boolean login_shell; 2710d522f475Smrg Boolean re_verse; 2711d522f475Smrg Boolean re_verse0; /* initial value of "-rv" */ 2712d522f475Smrg XtGravity resizeGravity; 2713d522f475Smrg Boolean reverseWrap; 2714d522f475Smrg Boolean autoWrap; 2715d522f475Smrg Boolean logInhibit; 2716d522f475Smrg Boolean signalInhibit; 2717d522f475Smrg#if OPT_TEK4014 2718d522f475Smrg Boolean tekInhibit; 2719d522f475Smrg Boolean tekSmall; /* start tek window in small size */ 2720d522f475Smrg Boolean TekEmu; /* true if Tektronix emulation */ 2721d522f475Smrg Boolean Tshow; /* Tek window showing */ 2722d522f475Smrg#endif 2723d522f475Smrg Boolean scrollbar; 2724d522f475Smrg#ifdef SCROLLBAR_RIGHT 2725d522f475Smrg Boolean useRight; 2726d522f475Smrg#endif 2727d522f475Smrg Boolean titeInhibit; 27283367019cSmrg Boolean tiXtraScroll; /* scroll on ti/te */ 27293367019cSmrg Boolean cdXtraScroll; /* scroll on cd (clear-display) */ 2730d522f475Smrg Boolean appcursorDefault; 2731d522f475Smrg Boolean appkeypadDefault; 2732d522f475Smrg#if OPT_INPUT_METHOD 2733b7c89284Ssnj char* f_x; /* font for XIM */ 2734d522f475Smrg char* input_method; 2735d522f475Smrg char* preedit_type; 2736b7c89284Ssnj Boolean open_im; /* true if input-method is opened */ 2737b7c89284Ssnj int retry_im; 2738d522f475Smrg#endif 2739d522f475Smrg Boolean dynamicColors; 2740d522f475Smrg#ifndef NO_ACTIVE_ICON 27413367019cSmrg char *active_icon_s; /* use application icon window */ 2742d522f475Smrg unsigned icon_border_width; 2743d522f475Smrg Pixel icon_border_pixel; 2744d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2745d522f475Smrg#if OPT_DEC_SOFTFONT 2746d522f475Smrg Boolean font_loadable; 2747d522f475Smrg#endif 2748d522f475Smrg#if OPT_SHIFT_FONTS 2749d522f475Smrg Boolean shift_fonts; /* true if we interpret fontsize-shifting */ 2750d522f475Smrg#endif 2751d522f475Smrg#if OPT_SUNPC_KBD 2752d522f475Smrg int ctrl_fkeys; /* amount to add to XK_F1 for ctrl modifier */ 2753d522f475Smrg#endif 2754d522f475Smrg#if OPT_NUM_LOCK 2755d522f475Smrg Boolean real_NumLock; /* true if we treat NumLock key specially */ 2756d522f475Smrg Boolean alwaysUseMods; /* true if we always want f-key modifiers */ 2757d522f475Smrg#endif 2758d522f475Smrg#if OPT_RENDERFONT 2759dfb07bc7Smrg VTFontNames default_xft; 2760d522f475Smrg float face_size[NMENUFONTS]; 2761cd3331d0Smrg char *render_font_s; 2762d522f475Smrg#endif 2763d522f475Smrg} Misc; 2764d522f475Smrg 27653367019cSmrgtypedef struct _Work { 27663367019cSmrg int dummy; 27679a64e1c5Smrg#ifdef SunXK_F36 27689a64e1c5Smrg#define MAX_UDK 37 27699a64e1c5Smrg#else 27709a64e1c5Smrg#define MAX_UDK 35 27719a64e1c5Smrg#endif 27729a64e1c5Smrg struct { 27739a64e1c5Smrg char *str; 27749a64e1c5Smrg int len; 27759a64e1c5Smrg } user_keys[MAX_UDK]; 27763367019cSmrg#ifndef NO_ACTIVE_ICON 27773367019cSmrg int active_icon; /* use application icon window */ 27783367019cSmrg#endif /* NO_ACTIVE_ICON */ 2779dfb07bc7Smrg#if OPT_INPUT_METHOD 2780dfb07bc7Smrg Boolean cannot_im; /* true if we cannot use input-method */ 2781dfb07bc7Smrg XFontSet xim_fs; /* fontset for XIM preedit */ 2782dfb07bc7Smrg int xim_fs_ascent; /* ascent of fs */ 2783dfb07bc7Smrg TInput inputs[NINPUTWIDGETS]; 2784dfb07bc7Smrg#endif 27853367019cSmrg#if OPT_MAXIMIZE 27863367019cSmrg#define MAX_EWMH_MODE 3 27873367019cSmrg#define MAX_EWMH_DATA (1 + OPT_TEK4014) 27883367019cSmrg struct { 27893367019cSmrg int mode; /* fullscreen, etc. */ 27903367019cSmrg Boolean checked[MAX_EWMH_MODE]; 27913367019cSmrg Boolean allowed[MAX_EWMH_MODE]; 27923367019cSmrg } ewmh[MAX_EWMH_DATA]; 27933367019cSmrg#endif 27943367019cSmrg#if OPT_NUM_LOCK 27953367019cSmrg unsigned num_lock; /* modifier for Num_Lock */ 27963367019cSmrg unsigned alt_mods; /* modifier for Alt_L or Alt_R */ 27973367019cSmrg unsigned meta_mods; /* modifier for Meta_L or Meta_R */ 27983367019cSmrg#endif 2799dfb07bc7Smrg XtermFontNames fonts; 28003367019cSmrg#if OPT_RENDERFONT 28013367019cSmrg Boolean render_font; 28023367019cSmrg#endif 28039a64e1c5Smrg#if OPT_DABBREV 28049a64e1c5Smrg#define MAX_DABBREV 1024 /* maximum word length as in tcsh */ 28059a64e1c5Smrg char dabbrev_data[MAX_DABBREV]; 28069a64e1c5Smrg#endif 28079a64e1c5Smrg ScrnColors *oldColors; 2808dfb07bc7Smrg Boolean palette_changed; 28093367019cSmrg} Work; 28103367019cSmrg 2811d522f475Smrgtypedef struct {int foo;} XtermClassPart, TekClassPart; 2812d522f475Smrg 2813d522f475Smrgtypedef struct _XtermClassRec { 2814d522f475Smrg CoreClassPart core_class; 2815d522f475Smrg XtermClassPart xterm_class; 2816d522f475Smrg} XtermClassRec; 2817d522f475Smrg 2818d522f475Smrgextern WidgetClass xtermWidgetClass; 2819d522f475Smrg 2820d522f475Smrg#define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass) 2821d522f475Smrg 2822d522f475Smrg#if OPT_TEK4014 2823d522f475Smrgtypedef struct _TekClassRec { 2824d522f475Smrg CoreClassPart core_class; 2825d522f475Smrg TekClassPart tek_class; 2826d522f475Smrg} TekClassRec; 2827d522f475Smrg 2828d522f475Smrgextern WidgetClass tekWidgetClass; 2829d522f475Smrg 2830d522f475Smrg#define IsTekWidget(w) (XtClass(w) == tekWidgetClass) 2831d522f475Smrg 2832d522f475Smrg#endif 2833d522f475Smrg 2834d522f475Smrg/* define masks for keyboard.flags */ 2835fa3f02f3Smrg#define MODE_KAM xBIT(0) /* mode 2: keyboard action mode */ 2836d522f475Smrg#define MODE_DECKPAM xBIT(1) /* keypad application mode */ 2837fa3f02f3Smrg#define MODE_DECCKM xBIT(2) /* private mode 1: cursor keys */ 2838fa3f02f3Smrg#define MODE_SRM xBIT(3) /* mode 12: send-receive mode */ 2839fa3f02f3Smrg#define MODE_DECBKM xBIT(4) /* private mode 67: backarrow */ 2840fa3f02f3Smrg#define MODE_DECSDM xBIT(5) /* private mode 80: sixel scrolling mode */ 2841d522f475Smrg 2842d522f475Smrg#define N_MARGINBELL 10 2843d522f475Smrg 2844d522f475Smrg#define TAB_BITS_SHIFT 5 /* FIXME: 2**5 == 32 (should derive) */ 2845d522f475Smrg#define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) 2846d522f475Smrg#define TAB_ARRAY_SIZE (1024 / TAB_BITS_WIDTH) 2847d522f475Smrg#define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) 2848d522f475Smrg 2849d522f475Smrgtypedef unsigned Tabs [TAB_ARRAY_SIZE]; 2850d522f475Smrg 2851d522f475Smrgtypedef struct _XtermWidgetRec { 2852d522f475Smrg CorePart core; 2853d522f475Smrg XSizeHints hints; 2854fa3f02f3Smrg XVisualInfo *visInfo; 2855fa3f02f3Smrg int numVisuals; 2856d522f475Smrg Bool init_menu; 2857d522f475Smrg TKeyboard keyboard; /* terminal keyboard */ 2858d522f475Smrg TScreen screen; /* terminal screen */ 28599a64e1c5Smrg IFlags flags; /* mode flags */ 2860d522f475Smrg int cur_foreground; /* current foreground color */ 2861d522f475Smrg int cur_background; /* current background color */ 2862d522f475Smrg Pixel dft_foreground; /* default foreground color */ 2863d522f475Smrg Pixel dft_background; /* default background color */ 2864712a7ff4Smrg Pixel old_foreground; /* original foreground color */ 2865712a7ff4Smrg Pixel old_background; /* original background color */ 2866d522f475Smrg#if OPT_ISO_COLORS 2867d522f475Smrg int sgr_foreground; /* current SGR foreground color */ 2868d522f475Smrg int sgr_background; /* current SGR background color */ 2869d522f475Smrg Boolean sgr_extended; /* SGR set with extended codes? */ 2870d522f475Smrg#endif 28719a64e1c5Smrg IFlags initflags; /* initial mode flags */ 2872d522f475Smrg Tabs tabs; /* tabstops of the terminal */ 2873d522f475Smrg Misc misc; /* miscellaneous parameters */ 28743367019cSmrg Work work; /* workspace (no resources) */ 2875d522f475Smrg} XtermWidgetRec, *XtermWidget; 2876d522f475Smrg 2877d522f475Smrg#if OPT_TEK4014 2878d522f475Smrgtypedef struct _TekWidgetRec { 2879d522f475Smrg CorePart core; 2880dfb07bc7Smrg XtermWidget vt; /* main widget has border, etc. */ 2881d522f475Smrg TekPart tek; /* contains resources */ 2882d522f475Smrg TekScreen screen; /* contains working data (no resources) */ 2883d522f475Smrg Bool init_menu; 2884d522f475Smrg XSizeHints hints; 2885d522f475Smrg} TekWidgetRec, *TekWidget; 2886d522f475Smrg#endif /* OPT_TEK4014 */ 2887d522f475Smrg 2888d522f475Smrg/* 2889d522f475Smrg * terminal flags 2890d522f475Smrg * There are actually two namespaces mixed together here. 2891d522f475Smrg * One is the set of flags that can go in screen->visbuf attributes 2892d522f475Smrg * and which must fit in a char (see OFF_ATTRS). 2893d522f475Smrg * The other is the global setting stored in 2894d522f475Smrg * term->flags and screen->save_modes. This need only fit in an unsigned. 2895d522f475Smrg */ 2896d522f475Smrg 2897d522f475Smrg#define AttrBIT(n) xBIT(n) /* text-attributes */ 2898d522f475Smrg#define MiscBIT(n) xBIT(n + 16) /* miscellaneous state flags */ 2899d522f475Smrg 2900d522f475Smrg/* global flags and character flags (visible character attributes) */ 2901d522f475Smrg#define INVERSE AttrBIT(0) /* invert the characters to be output */ 2902d522f475Smrg#define UNDERLINE AttrBIT(1) /* true if underlining */ 2903d522f475Smrg#define BOLD AttrBIT(2) 2904d522f475Smrg#define BLINK AttrBIT(3) 2905d522f475Smrg/* global flags (also character attributes) */ 2906d522f475Smrg#define BG_COLOR AttrBIT(4) /* true if background set */ 2907d522f475Smrg#define FG_COLOR AttrBIT(5) /* true if foreground set */ 2908d522f475Smrg 2909d522f475Smrg/* character flags (internal attributes) */ 2910d522f475Smrg#define PROTECTED AttrBIT(6) /* a character that cannot be erased */ 2911d522f475Smrg#define CHARDRAWN AttrBIT(7) /* a character has been drawn here on 2912d522f475Smrg the screen. Used to distinguish 2913d522f475Smrg blanks from empty parts of the 2914d522f475Smrg screen when selecting */ 2915d522f475Smrg 29169a64e1c5Smrg#if OPT_WIDE_ATTRS 29179a64e1c5Smrg#define ATR_FAINT AttrBIT(8) 29189a64e1c5Smrg#define ATR_ITALIC AttrBIT(9) 29199a64e1c5Smrg#define ATR_STRIKEOUT AttrBIT(10) 29209a64e1c5Smrg#define ATR_DBL_UNDER AttrBIT(11) 29219a64e1c5Smrg#define SGR_MASK2 (ATR_FAINT | ATR_ITALIC | ATR_STRIKEOUT | ATR_DBL_UNDER) 29229a64e1c5Smrg#else 29239a64e1c5Smrg#define SGR_MASK2 0 29249a64e1c5Smrg#endif 2925d522f475Smrg 2926d522f475Smrg/* 2927d522f475Smrg * Other flags 2928d522f475Smrg */ 2929d522f475Smrg#define WRAPAROUND MiscBIT(0) /* true if auto wraparound mode */ 2930d522f475Smrg#define REVERSEWRAP MiscBIT(1) /* true if reverse wraparound mode */ 2931d522f475Smrg#define REVERSE_VIDEO MiscBIT(2) /* true if screen white on black */ 2932d522f475Smrg#define LINEFEED MiscBIT(3) /* true if in auto linefeed mode */ 2933d522f475Smrg#define ORIGIN MiscBIT(4) /* true if in origin mode */ 2934d522f475Smrg#define INSERT MiscBIT(5) /* true if in insert mode */ 2935d522f475Smrg#define SMOOTHSCROLL MiscBIT(6) /* true if in smooth scroll mode */ 2936d522f475Smrg#define IN132COLUMNS MiscBIT(7) /* true if in 132 column mode */ 2937d522f475Smrg#define INVISIBLE MiscBIT(8) /* true if writing invisible text */ 2938d522f475Smrg#define NATIONAL MiscBIT(9) /* true if writing national charset */ 29393367019cSmrg#define LEFT_RIGHT MiscBIT(10) /* true if left/right margin mode */ 29403367019cSmrg#define NOCLEAR_COLM MiscBIT(11) /* true if no clear on DECCOLM change */ 2941d522f475Smrg 29429a64e1c5Smrg#define DrawBIT(n) xBIT(n + 8) /* drawXtermText flags */ 29439a64e1c5Smrg/* The following attributes are used in the argument of drawXtermText() */ 29449a64e1c5Smrg#define NOBACKGROUND DrawBIT(0) /* Used for overstrike */ 29459a64e1c5Smrg#define NOTRANSLATION DrawBIT(1) /* No scan for chars missing in font */ 29469a64e1c5Smrg#define DOUBLEWFONT DrawBIT(2) /* The actual X-font is double-width */ 29479a64e1c5Smrg#define DOUBLEHFONT DrawBIT(3) /* The actual X-font is double-height */ 29489a64e1c5Smrg#define CHARBYCHAR DrawBIT(4) /* Draw chars one-by-one */ 29499a64e1c5Smrg 29509a64e1c5Smrg/* The following attribute is used in the argument of xtermSpecialFont etc */ 29519a64e1c5Smrg#define NORESOLUTION DrawBIT(5) /* find the font without resolution */ 29529a64e1c5Smrg 29539a64e1c5Smrg 2954d522f475Smrg/* 2955d522f475Smrg * Groups of attributes 2956d522f475Smrg */ 2957d522f475Smrg /* mask for video-attributes only */ 2958d522f475Smrg#define SGR_MASK (BOLD | BLINK | UNDERLINE | INVERSE) 2959d522f475Smrg 2960d522f475Smrg /* mask: user-visible attributes */ 29619a64e1c5Smrg#define ATTRIBUTES (SGR_MASK | SGR_MASK2 | BG_COLOR | FG_COLOR | INVISIBLE | PROTECTED) 2962d522f475Smrg 2963d522f475Smrg/* The toplevel-call to drawXtermText() should have text-attributes guarded: */ 2964d522f475Smrg#define DRAWX_MASK (ATTRIBUTES | CHARDRAWN) 2965d522f475Smrg 2966712a7ff4Smrg/* 2967712a7ff4Smrg * BOLDATTR is not only nonzero when we will use bold font, but uses the bits 2968712a7ff4Smrg * for BOLD/BLINK to match against the video attributes which were originally 2969712a7ff4Smrg * requested. 2970712a7ff4Smrg */ 2971712a7ff4Smrg#define USE_BOLD(screen) ((screen)->allowBoldFonts) 2972712a7ff4Smrg 2973d522f475Smrg#if OPT_BLINK_TEXT 2974712a7ff4Smrg#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) : 0) 2975d522f475Smrg#else 2976712a7ff4Smrg#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | BLINK) : 0) 2977d522f475Smrg#endif 2978d522f475Smrg 2979d522f475Smrg/* 2980d522f475Smrg * Per-line flags 2981d522f475Smrg */ 2982b7c89284Ssnj#define LINEWRAPPED AttrBIT(0) 2983b7c89284Ssnj/* used once per line to indicate that it wraps onto the next line so we can 2984b7c89284Ssnj * tell the difference between lines that have wrapped around and lines that 2985b7c89284Ssnj * have ended naturally with a CR at column max_col. 2986b7c89284Ssnj */ 2987b7c89284Ssnj#define LINEBLINKED AttrBIT(1) 2988b7c89284Ssnj/* set when the line contains blinking text. 2989b7c89284Ssnj */ 2990d522f475Smrg 2991d522f475Smrg#if OPT_ZICONBEEP || OPT_TOOLBAR 2992d522f475Smrg#define HANDLE_STRUCT_NOTIFY 1 2993d522f475Smrg#else 2994d522f475Smrg#define HANDLE_STRUCT_NOTIFY 0 2995d522f475Smrg#endif 2996d522f475Smrg 2997d522f475Smrg/* 2998d522f475Smrg * If we've set protected attributes with the DEC-style DECSCA, then we'll have 2999d522f475Smrg * to use DECSED or DECSEL to erase preserving protected text. (The normal ED, 3000d522f475Smrg * EL won't preserve protected-text). If we've used SPA, then normal ED and EL 3001d522f475Smrg * will preserve protected-text. To keep things simple, just remember the last 3002d522f475Smrg * control that was used to begin protected-text, and use that to determine how 3003d522f475Smrg * erases are performed (otherwise we'd need 2 bits per protected character). 3004d522f475Smrg */ 3005d522f475Smrg#define OFF_PROTECT 0 3006d522f475Smrg#define DEC_PROTECT 1 3007d522f475Smrg#define ISO_PROTECT 2 3008d522f475Smrg 3009d522f475Smrg#define TScreenOf(xw) (&(xw)->screen) 3010d522f475Smrg#define TekScreenOf(tw) (&(tw)->screen) 3011d522f475Smrg 3012712a7ff4Smrg#define PrinterOf(screen) (screen)->printer_state 3013712a7ff4Smrg 3014d522f475Smrg#ifdef SCROLLBAR_RIGHT 3015d522f475Smrg#define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) 3016d522f475Smrg#else 3017d522f475Smrg#define OriginX(screen) (ScrollbarWidth(screen) + screen->border) 3018d522f475Smrg#endif 3019d522f475Smrg 3020d522f475Smrg#define OriginY(screen) (screen->border) 3021d522f475Smrg 3022d522f475Smrg#define CursorMoved(screen) \ 3023d522f475Smrg ((screen)->cursor_moved || \ 3024d522f475Smrg ((screen)->cursorp.col != (screen)->cur_col || \ 3025d522f475Smrg (screen)->cursorp.row != (screen)->cur_row)) 3026d522f475Smrg 30273367019cSmrg#define CursorX2(screen,col,fw) ((col) * (int)(fw) + OriginX(screen)) 30283367019cSmrg#define CursorX(screen,col) CursorX2(screen, col, FontWidth(screen)) 30293367019cSmrg#define CursorY2(screen,row) (((row) * FontHeight(screen)) + screen->border) 30303367019cSmrg#define CursorY(screen,row) CursorY2(screen, INX2ROW(screen, row)) 3031d522f475Smrg 3032d522f475Smrg/* 3033d522f475Smrg * These definitions depend on whether xterm supports active-icon. 3034d522f475Smrg */ 3035d522f475Smrg#ifndef NO_ACTIVE_ICON 3036d522f475Smrg#define IsIconWin(screen,win) ((win) == &(screen)->iconVwin) 3037d522f475Smrg#define IsIcon(screen) (WhichVWin(screen) == &(screen)->iconVwin) 3038d522f475Smrg#define WhichVWin(screen) ((screen)->whichVwin) 3039d522f475Smrg#define WhichTWin(screen) ((screen)->whichTwin) 3040d522f475Smrg 3041dfb07bc7Smrg#define WhichVFont(screen,name) (IsIcon(screen) ? getIconicFont(screen) \ 3042dfb07bc7Smrg : getNormalFont(screen, name))->fs 3043dfb07bc7Smrg#define FontAscent(screen) (IsIcon(screen) ? getIconicFont(screen)->fs->ascent \ 3044d522f475Smrg : WhichVWin(screen)->f_ascent) 3045dfb07bc7Smrg#define FontDescent(screen) (IsIcon(screen) ? getIconicFont(screen)->fs->descent \ 3046d522f475Smrg : WhichVWin(screen)->f_descent) 3047d522f475Smrg#else /* NO_ACTIVE_ICON */ 3048d522f475Smrg 3049d522f475Smrg#define IsIconWin(screen,win) (False) 3050d522f475Smrg#define IsIcon(screen) (False) 3051d522f475Smrg#define WhichVWin(screen) (&((screen)->fullVwin)) 3052d522f475Smrg#define WhichTWin(screen) (&((screen)->fullTwin)) 3053d522f475Smrg 3054dfb07bc7Smrg#define WhichVFont(screen,name) getNormalFont(screen, name)->fs 3055d522f475Smrg#define FontAscent(screen) WhichVWin(screen)->f_ascent 3056d522f475Smrg#define FontDescent(screen) WhichVWin(screen)->f_descent 3057d522f475Smrg 3058d522f475Smrg#endif /* NO_ACTIVE_ICON */ 3059d522f475Smrg 3060d522f475Smrg#define okFont(font) ((font) != 0 && (font)->fid != 0) 3061d522f475Smrg 3062d522f475Smrg/* 3063d522f475Smrg * Macro to check if we are iconified; do not use render for that case. 3064d522f475Smrg */ 30653367019cSmrg#define UsingRenderFont(xw) (((xw)->work.render_font == True) && !IsIcon(TScreenOf(xw))) 3066d522f475Smrg 3067d522f475Smrg/* 3068d522f475Smrg * These definitions do not depend on whether xterm supports active-icon. 3069d522f475Smrg */ 3070d522f475Smrg#define VWindow(screen) WhichVWin(screen)->window 3071c219fbebSmrg#define VShellWindow(xw) XtWindow(SHELL_OF(xw)) 3072d522f475Smrg#define TWindow(screen) WhichTWin(screen)->window 3073d522f475Smrg#define TShellWindow XtWindow(SHELL_OF(tekWidget)) 3074d522f475Smrg 30753367019cSmrg#if OPT_DOUBLE_BUFFER 30763367019cSmrg#define VDrawable(screen) (((screen)->needSwap=1), WhichVWin(screen)->drawable) 30773367019cSmrg#else 30783367019cSmrg#define VDrawable(screen) VWindow(screen) 30793367019cSmrg#endif 30803367019cSmrg 3081d522f475Smrg#define Width(screen) WhichVWin(screen)->width 3082d522f475Smrg#define Height(screen) WhichVWin(screen)->height 3083d522f475Smrg#define FullWidth(screen) WhichVWin(screen)->fullwidth 3084d522f475Smrg#define FullHeight(screen) WhichVWin(screen)->fullheight 3085d522f475Smrg#define FontWidth(screen) WhichVWin(screen)->f_width 3086d522f475Smrg#define FontHeight(screen) WhichVWin(screen)->f_height 3087d522f475Smrg 3088dfb07bc7Smrg#define NormalFont(screen) WhichVFont(screen, fNorm) 3089dfb07bc7Smrg#define BoldFont(screen) WhichVFont(screen, fBold) 3090d522f475Smrg 3091d522f475Smrg#if OPT_WIDE_CHARS 3092dfb07bc7Smrg#define NormalWFont(screen) WhichVFont(screen, fWide) 3093dfb07bc7Smrg#define BoldWFont(screen) WhichVFont(screen, fWBold) 3094d522f475Smrg#endif 3095d522f475Smrg 3096d522f475Smrg#define ScrollbarWidth(screen) WhichVWin(screen)->sb_info.width 3097d522f475Smrg 3098d522f475Smrg#define NormalGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNorm) 3099d522f475Smrg#define ReverseGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNormReverse) 3100d522f475Smrg#define NormalBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBold) 3101d522f475Smrg#define ReverseBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBoldReverse) 3102d522f475Smrg 3103d522f475Smrg#define TWidth(screen) WhichTWin(screen)->width 3104d522f475Smrg#define THeight(screen) WhichTWin(screen)->height 3105d522f475Smrg#define TFullWidth(screen) WhichTWin(screen)->fullwidth 3106d522f475Smrg#define TFullHeight(screen) WhichTWin(screen)->fullheight 3107d522f475Smrg#define TekScale(screen) WhichTWin(screen)->tekscale 3108d522f475Smrg 3109dfb07bc7Smrg/* use these before tek4014 is realized, good enough for default "9x15" font */ 3110dfb07bc7Smrg#define TDefaultRows 37 3111dfb07bc7Smrg#define TDefaultCols 75 3112dfb07bc7Smrg 3113d522f475Smrg#define BorderWidth(w) ((w)->core.border_width) 3114d522f475Smrg#define BorderPixel(w) ((w)->core.border_pixel) 3115d522f475Smrg 3116cd3331d0Smrg#define AllowXtermOps(w,name) (TScreenOf(w)->name && !TScreenOf(w)->allowSendEvents) 3117cd3331d0Smrg 3118cd3331d0Smrg#define AllowColorOps(w,name) (AllowXtermOps(w, allowColorOps) || \ 3119cd3331d0Smrg !TScreenOf(w)->disallow_color_ops[name]) 3120cd3331d0Smrg 3121cd3331d0Smrg#define AllowFontOps(w,name) (AllowXtermOps(w, allowFontOps) || \ 3122cd3331d0Smrg !TScreenOf(w)->disallow_font_ops[name]) 3123cd3331d0Smrg 3124dfb07bc7Smrg#define AllowMouseOps(w,name) (AllowXtermOps(w, allowMouseOps) || \ 3125dfb07bc7Smrg !TScreenOf(w)->disallow_mouse_ops[name]) 3126dfb07bc7Smrg 3127cd3331d0Smrg#define AllowTcapOps(w,name) (AllowXtermOps(w, allowTcapOps) || \ 3128cd3331d0Smrg !TScreenOf(w)->disallow_tcap_ops[name]) 3129cd3331d0Smrg 3130b7c89284Ssnj#define AllowTitleOps(w) AllowXtermOps(w, allowTitleOps) 3131cd3331d0Smrg 31323367019cSmrg#define SpecialWindowOps(w,name) (!TScreenOf(w)->disallow_win_ops[name]) 3133cd3331d0Smrg#define AllowWindowOps(w,name) (AllowXtermOps(w, allowWindowOps) || \ 31343367019cSmrg SpecialWindowOps(w,name)) 3135b7c89284Ssnj 3136d522f475Smrg#if OPT_TOOLBAR 3137d522f475Smrg#define ToolbarHeight(w) ((resource.toolBar) \ 3138c219fbebSmrg ? ((w)->VT100_TB_INFO(menu_height) \ 3139c219fbebSmrg + (w)->VT100_TB_INFO(menu_border) * 2) \ 3140d522f475Smrg : 0) 3141d522f475Smrg#else 3142d522f475Smrg#define ToolbarHeight(w) 0 3143d522f475Smrg#endif 3144d522f475Smrg 3145d522f475Smrg#if OPT_TEK4014 3146d522f475Smrg#define TEK_LINK_BLOCK_SIZE 1024 3147d522f475Smrg 3148d522f475Smrgtypedef struct Tek_Link 3149d522f475Smrg{ 3150d522f475Smrg struct Tek_Link *next; /* pointer to next TekLink in list 3151d522f475Smrg NULL <=> this is last TekLink */ 3152d522f475Smrg unsigned short fontsize;/* character size, 0-3 */ 3153d522f475Smrg unsigned short count; /* number of chars in data */ 3154d522f475Smrg char *ptr; /* current pointer into data */ 3155d522f475Smrg char data [TEK_LINK_BLOCK_SIZE]; 3156d522f475Smrg} TekLink; 3157d522f475Smrg#endif /* OPT_TEK4014 */ 3158d522f475Smrg 3159d522f475Smrg/* flags for cursors */ 3160d522f475Smrg#define OFF 0 3161d522f475Smrg#define ON 1 3162d522f475Smrg#define BLINKED_OFF 2 3163d522f475Smrg#define CLEAR 0 3164d522f475Smrg#define TOGGLE 1 3165d522f475Smrg 3166d522f475Smrg/* flags for inhibit */ 3167d522f475Smrg#ifdef ALLOWLOGGING 3168d522f475Smrg#define I_LOG 0x01 3169d522f475Smrg#endif 3170d522f475Smrg#define I_SIGNAL 0x02 3171d522f475Smrg#define I_TEK 0x04 3172d522f475Smrg 3173d522f475Smrg/***====================================================================***/ 3174d522f475Smrg 3175d522f475Smrg#if OPT_TRACE 3176d522f475Smrg#undef NDEBUG /* turn on assert's */ 3177d522f475Smrg#else 3178d522f475Smrg#ifndef NDEBUG 3179d522f475Smrg#define NDEBUG /* not debugging, don't do assert's */ 3180d522f475Smrg#endif 3181d522f475Smrg#endif 3182d522f475Smrg 31830d92cbfdSchristos#include <trace.h> 31840d92cbfdSchristos 3185d522f475Smrg#ifndef TRACE 3186d522f475Smrg#define TRACE(p) /*nothing*/ 3187d522f475Smrg#endif 3188d522f475Smrg 3189cd3331d0Smrg#ifndef TRACE_CLOSE 3190cd3331d0Smrg#define TRACE_CLOSE() /*nothing*/ 3191cd3331d0Smrg#endif 3192cd3331d0Smrg 3193d522f475Smrg#ifndef TRACE_ARGV 3194d522f475Smrg#define TRACE_ARGV(tag,argv) /*nothing*/ 3195d522f475Smrg#endif 3196d522f475Smrg 3197d522f475Smrg#ifndef TRACE_CHILD 3198d522f475Smrg#define TRACE_CHILD /*nothing*/ 3199d522f475Smrg#endif 3200d522f475Smrg 3201cd3331d0Smrg#ifndef TRACE_FOCUS 3202cd3331d0Smrg#define TRACE_FOCUS(w,e) /*nothing*/ 3203cd3331d0Smrg#endif 3204cd3331d0Smrg 3205d522f475Smrg#ifndef TRACE_HINTS 3206d522f475Smrg#define TRACE_HINTS(hints) /*nothing*/ 3207d522f475Smrg#endif 3208d522f475Smrg 3209d522f475Smrg#ifndef TRACE_IDS 3210d522f475Smrg#define TRACE_IDS /*nothing*/ 3211d522f475Smrg#endif 3212d522f475Smrg 3213d522f475Smrg#ifndef TRACE_OPTS 3214d522f475Smrg#define TRACE_OPTS(opts,ress,lens) /*nothing*/ 3215d522f475Smrg#endif 3216d522f475Smrg 3217d522f475Smrg#ifndef TRACE_TRANS 3218d522f475Smrg#define TRACE_TRANS(name,w) /*nothing*/ 3219d522f475Smrg#endif 3220d522f475Smrg 32213367019cSmrg#ifndef TRACE_WIN_ATTRS 32223367019cSmrg#define TRACE_WIN_ATTRS(w) /*nothing*/ 32233367019cSmrg#endif 32243367019cSmrg 3225d522f475Smrg#ifndef TRACE_WM_HINTS 3226d522f475Smrg#define TRACE_WM_HINTS(w) /*nothing*/ 3227d522f475Smrg#endif 3228d522f475Smrg 3229d522f475Smrg#ifndef TRACE_XRES 3230d522f475Smrg#define TRACE_XRES() /*nothing*/ 3231d522f475Smrg#endif 3232d522f475Smrg 3233d522f475Smrg#ifndef TRACE2 3234d522f475Smrg#define TRACE2(p) /*nothing*/ 3235d522f475Smrg#endif 3236d522f475Smrg 32373367019cSmrg#if OPT_TRACE && !defined(DEBUG) 32383367019cSmrg#define DEBUG 1 32393367019cSmrg#endif 32403367019cSmrg 32413367019cSmrg#ifdef DEBUG 32423367019cSmrg#define if_DEBUG(code) if(debug) code 32433367019cSmrg#else 32443367019cSmrg#define if_DEBUG(code) /*nothing*/ 32453367019cSmrg#endif 32463367019cSmrg 32473367019cSmrg#define DEBUG_MSG(text) if_DEBUG({ IGNORE_RC(write(2, text, sizeof(text) - 1)); }) 32483367019cSmrg 3249c219fbebSmrg/* *INDENT-ON* */ 3250c219fbebSmrg 3251d522f475Smrg#endif /* included_ptyx_h */ 3252