| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | #ifndef included_ptyx_h |
|---|
| 56 | #define included_ptyx_h 1 |
|---|
| 57 | |
|---|
| 58 | #ifdef HAVE_CONFIG_H |
|---|
| 59 | #include <xtermcfg.h> |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | #include <X11/IntrinsicP.h> |
|---|
| 66 | #include <X11/Shell.h> |
|---|
| 67 | #include <X11/StringDefs.h> |
|---|
| 68 | #include <X11/Xmu/Misc.h> |
|---|
| 69 | #include <X11/Xfuncs.h> |
|---|
| 70 | #include <X11/Xosdefs.h> |
|---|
| 71 | #include <X11/Xmu/Converters.h> |
|---|
| 72 | #ifdef XRENDERFONT |
|---|
| 73 | #include <X11/Xft/Xft.h> |
|---|
| 74 | #endif |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | #define MyStackAlloc(size, stack_cache_array) \ |
|---|
| 78 | ((size) <= sizeof(stack_cache_array) \ |
|---|
| 79 | ? (XtPointer)(stack_cache_array) \ |
|---|
| 80 | : (XtPointer)malloc((unsigned)(size))) |
|---|
| 81 | |
|---|
| 82 | #define MyStackFree(pointer, stack_cache_array) \ |
|---|
| 83 | if ((pointer) != ((char *)(stack_cache_array))) free(pointer) |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | #define TypeCallocN(type,n) (type *)calloc((n), sizeof(type)) |
|---|
| 87 | #define TypeCalloc(type) TypeCalloc(type,1) |
|---|
| 88 | |
|---|
| 89 | #define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (n)) |
|---|
| 90 | #define TypeMalloc(type) TypeMallocN(type,1) |
|---|
| 91 | |
|---|
| 92 | #define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | #define CastMallocN(type,n) (type *)malloc(sizeof(type) + (n)) |
|---|
| 96 | #define CastMalloc(type) CastMallocN(type,0) |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | #ifdef att |
|---|
| 103 | #define ATT |
|---|
| 104 | #endif |
|---|
| 105 | |
|---|
| 106 | #ifdef SVR4 |
|---|
| 107 | #undef SYSV |
|---|
| 108 | #define SYSV |
|---|
| 109 | #define ATT |
|---|
| 110 | #endif |
|---|
| 111 | |
|---|
| 112 | #ifdef SYSV |
|---|
| 113 | #ifdef X_NOT_POSIX |
|---|
| 114 | #if !defined(CRAY) && !defined(SVR4) |
|---|
| 115 | #define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ |
|---|
| 116 | (close(fd2), fcntl(fd1, F_DUPFD, fd2))) |
|---|
| 117 | #endif |
|---|
| 118 | #endif |
|---|
| 119 | #endif |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | #if defined(XRENDERFONT) && defined(XFT_VERSION) && XFT_VERSION >= 20100 |
|---|
| 126 | #define HAVE_TYPE_FCCHAR32 1 |
|---|
| 127 | #define HAVE_TYPE_XFTCHARSPEC 1 |
|---|
| 128 | #endif |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | #define USE_PTY_DEVICE 1 |
|---|
| 134 | #define USE_PTY_SEARCH 1 |
|---|
| 135 | |
|---|
| 136 | #if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) |
|---|
| 137 | #undef USE_PTY_DEVICE |
|---|
| 138 | #undef USE_PTY_SEARCH |
|---|
| 139 | #define USE_PTS_DEVICE 1 |
|---|
| 140 | #elif defined(VMS) |
|---|
| 141 | #undef USE_PTY_DEVICE |
|---|
| 142 | #undef USE_PTY_SEARCH |
|---|
| 143 | #elif defined(PUCC_PTYD) |
|---|
| 144 | #undef USE_PTY_SEARCH |
|---|
| 145 | #elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__) |
|---|
| 146 | #undef USE_PTY_SEARCH |
|---|
| 147 | #endif |
|---|
| 148 | |
|---|
| 149 | #if defined(SYSV) && defined(i386) && !defined(SVR4) |
|---|
| 150 | #define ATT |
|---|
| 151 | #define USE_HANDSHAKE 1 |
|---|
| 152 | #define USE_ISPTS_FLAG 1 |
|---|
| 153 | #endif |
|---|
| 154 | |
|---|
| 155 | #if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) |
|---|
| 156 | #define USE_USG_PTYS |
|---|
| 157 | #define USE_HANDSHAKE 0 |
|---|
| 158 | #elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386)) |
|---|
| 159 | #define USE_USG_PTYS |
|---|
| 160 | #else |
|---|
| 161 | #define USE_HANDSHAKE 1 |
|---|
| 162 | #endif |
|---|
| 163 | |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | #ifndef USE_HANDSHAKE |
|---|
| 168 | #define USE_HANDSHAKE 1 |
|---|
| 169 | #endif |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | |
|---|
| 174 | #ifndef PTYDEV |
|---|
| 175 | #if defined(__hpux) |
|---|
| 176 | #define PTYDEV "/dev/ptym/ptyxx" |
|---|
| 177 | #elif defined(__MVS__) |
|---|
| 178 | #define PTYDEV "/dev/ptypxxxx" |
|---|
| 179 | #else |
|---|
| 180 | #define PTYDEV "/dev/ptyxx" |
|---|
| 181 | #endif |
|---|
| 182 | #endif |
|---|
| 183 | |
|---|
| 184 | #ifndef TTYDEV |
|---|
| 185 | #if defined(__hpux) |
|---|
| 186 | #define TTYDEV "/dev/pty/ttyxx" |
|---|
| 187 | #elif defined(__MVS__) |
|---|
| 188 | #define TTYDEV "/dev/ptypxxxx" |
|---|
| 189 | #elif defined(USE_PTS_DEVICE) |
|---|
| 190 | #define TTYDEV "/dev/pts/0" |
|---|
| 191 | #else |
|---|
| 192 | #define TTYDEV "/dev/ttyxx" |
|---|
| 193 | #endif |
|---|
| 194 | #endif |
|---|
| 195 | |
|---|
| 196 | #ifndef PTYCHAR1 |
|---|
| 197 | #ifdef __hpux |
|---|
| 198 | #define PTYCHAR1 "zyxwvutsrqp" |
|---|
| 199 | #else |
|---|
| 200 | #ifdef __UNIXOS2__ |
|---|
| 201 | #define PTYCHAR1 "pq" |
|---|
| 202 | #else |
|---|
| 203 | #define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" |
|---|
| 204 | #endif |
|---|
| 205 | #endif |
|---|
| 206 | #endif |
|---|
| 207 | |
|---|
| 208 | #ifndef PTYCHAR2 |
|---|
| 209 | #ifdef __hpux |
|---|
| 210 | #define PTYCHAR2 "fedcba9876543210" |
|---|
| 211 | #else |
|---|
| 212 | #if defined(__DragonFly__) || defined(__FreeBSD__) |
|---|
| 213 | #define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" |
|---|
| 214 | #else |
|---|
| 215 | #define PTYCHAR2 "0123456789abcdef" |
|---|
| 216 | #endif |
|---|
| 217 | #endif |
|---|
| 218 | #endif |
|---|
| 219 | |
|---|
| 220 | #ifndef TTYFORMAT |
|---|
| 221 | #if defined(CRAY) |
|---|
| 222 | #define TTYFORMAT "/dev/ttyp%03d" |
|---|
| 223 | #elif defined(__MVS__) |
|---|
| 224 | #define TTYFORMAT "/dev/ttyp%04d" |
|---|
| 225 | #else |
|---|
| 226 | #define TTYFORMAT "/dev/ttyp%d" |
|---|
| 227 | #endif |
|---|
| 228 | #endif |
|---|
| 229 | |
|---|
| 230 | #ifndef PTYFORMAT |
|---|
| 231 | #ifdef CRAY |
|---|
| 232 | #define PTYFORMAT "/dev/pty/%03d" |
|---|
| 233 | #elif defined(__MVS__) |
|---|
| 234 | #define PTYFORMAT "/dev/ptyp%04d" |
|---|
| 235 | #else |
|---|
| 236 | #define PTYFORMAT "/dev/ptyp%d" |
|---|
| 237 | #endif |
|---|
| 238 | #endif |
|---|
| 239 | |
|---|
| 240 | #ifndef PTYCHARLEN |
|---|
| 241 | #ifdef CRAY |
|---|
| 242 | #define PTYCHARLEN 3 |
|---|
| 243 | #elif defined(__MVS__) |
|---|
| 244 | #define PTYCHARLEN 8 |
|---|
| 245 | #else |
|---|
| 246 | #define PTYCHARLEN 2 |
|---|
| 247 | #endif |
|---|
| 248 | #endif |
|---|
| 249 | |
|---|
| 250 | #ifndef MAXPTTYS |
|---|
| 251 | #ifdef CRAY |
|---|
| 252 | #define MAXPTTYS 256 |
|---|
| 253 | #else |
|---|
| 254 | #define MAXPTTYS 2048 |
|---|
| 255 | #endif |
|---|
| 256 | #endif |
|---|
| 257 | |
|---|
| 258 | |
|---|
| 259 | |
|---|
| 260 | |
|---|
| 261 | typedef enum { |
|---|
| 262 | NORMAL = 0 |
|---|
| 263 | , LEFTEXTENSION |
|---|
| 264 | , RIGHTEXTENSION |
|---|
| 265 | } EventMode; |
|---|
| 266 | |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | #define MaxCols(screen) ((screen)->max_col + 1) |
|---|
| 272 | #define MaxRows(screen) ((screen)->max_row + 1) |
|---|
| 273 | |
|---|
| 274 | typedef unsigned char Char; |
|---|
| 275 | typedef Char *ScrnPtr; |
|---|
| 276 | typedef ScrnPtr *ScrnBuf; |
|---|
| 277 | |
|---|
| 278 | #define CharOf(n) ((unsigned char)(n)) |
|---|
| 279 | |
|---|
| 280 | typedef struct { |
|---|
| 281 | int row; |
|---|
| 282 | int col; |
|---|
| 283 | } CELL; |
|---|
| 284 | |
|---|
| 285 | #define isSameRow(a,b) ((a)->row == (b)->row) |
|---|
| 286 | #define isSameCol(a,b) ((a)->col == (b)->col) |
|---|
| 287 | #define isSameCELL(a,b) (isSameRow(a,b) && isSameCol(a,b)) |
|---|
| 288 | |
|---|
| 289 | #define xBIT(n) (1 << (n)) |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | |
|---|
| 294 | #define ANSI_BEL 0x07 |
|---|
| 295 | #define ANSI_FF 0x0C |
|---|
| 296 | #define ANSI_NAK 0x15 |
|---|
| 297 | #define ANSI_CAN 0x18 |
|---|
| 298 | #define ANSI_ESC 0x1B |
|---|
| 299 | #define ANSI_SPA 0x20 |
|---|
| 300 | #define XTERM_POUND 0x1E |
|---|
| 301 | #define ANSI_DEL 0x7F |
|---|
| 302 | #define ANSI_SS2 0x8E |
|---|
| 303 | #define ANSI_SS3 0x8F |
|---|
| 304 | #define ANSI_DCS 0x90 |
|---|
| 305 | #define ANSI_SOS 0x98 |
|---|
| 306 | #define ANSI_CSI 0x9B |
|---|
| 307 | #define ANSI_ST 0x9C |
|---|
| 308 | #define ANSI_OSC 0x9D |
|---|
| 309 | #define ANSI_PM 0x9E |
|---|
| 310 | #define ANSI_APC 0x9F |
|---|
| 311 | |
|---|
| 312 | #define MIN_DECID 52 |
|---|
| 313 | #define MAX_DECID 420 |
|---|
| 314 | |
|---|
| 315 | #ifndef DFT_DECID |
|---|
| 316 | #define DFT_DECID "vt100" |
|---|
| 317 | #endif |
|---|
| 318 | |
|---|
| 319 | #ifndef DFT_KBD_DIALECT |
|---|
| 320 | #define DFT_KBD_DIALECT "B" |
|---|
| 321 | #endif |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | #define UCS_REPL 0xfffd |
|---|
| 325 | #define UCS_LIMIT 0x80000000U |
|---|
| 326 | |
|---|
| 327 | #define TERMCAP_SIZE 1500 |
|---|
| 328 | |
|---|
| 329 | #define NMENUFONTS 9 |
|---|
| 330 | |
|---|
| 331 | #define NBOX 5 |
|---|
| 332 | #define NPARAM 30 |
|---|
| 333 | |
|---|
| 334 | typedef struct { |
|---|
| 335 | char *opt; |
|---|
| 336 | char *desc; |
|---|
| 337 | } OptionHelp; |
|---|
| 338 | |
|---|
| 339 | typedef struct { |
|---|
| 340 | unsigned char a_type; |
|---|
| 341 | unsigned char a_pintro; |
|---|
| 342 | unsigned char a_inters; |
|---|
| 343 | unsigned char a_final; |
|---|
| 344 | short a_nparam; |
|---|
| 345 | short a_param[NPARAM]; |
|---|
| 346 | } ANSI; |
|---|
| 347 | |
|---|
| 348 | #define TEK_FONT_LARGE 0 |
|---|
| 349 | #define TEK_FONT_2 1 |
|---|
| 350 | #define TEK_FONT_3 2 |
|---|
| 351 | #define TEK_FONT_SMALL 3 |
|---|
| 352 | #define TEKNUMFONTS 4 |
|---|
| 353 | |
|---|
| 354 | |
|---|
| 355 | #define TEKNUMLINES 4 |
|---|
| 356 | |
|---|
| 357 | typedef struct { |
|---|
| 358 | int x; |
|---|
| 359 | int y; |
|---|
| 360 | int fontsize; |
|---|
| 361 | unsigned linetype; |
|---|
| 362 | } Tmodes; |
|---|
| 363 | |
|---|
| 364 | typedef struct { |
|---|
| 365 | int Twidth; |
|---|
| 366 | int Theight; |
|---|
| 367 | } T_fontsize; |
|---|
| 368 | |
|---|
| 369 | typedef struct { |
|---|
| 370 | short *bits; |
|---|
| 371 | int x; |
|---|
| 372 | int y; |
|---|
| 373 | int width; |
|---|
| 374 | int height; |
|---|
| 375 | } BitmapBits; |
|---|
| 376 | |
|---|
| 377 | #define SAVELINES 64 |
|---|
| 378 | #define SCROLLLINES 1 |
|---|
| 379 | |
|---|
| 380 | #define EXCHANGE(a,b,tmp) tmp = a; a = b; b = tmp |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | |
|---|
| 384 | #if (XtSpecificationRelease < 6) |
|---|
| 385 | #ifndef NO_ACTIVE_ICON |
|---|
| 386 | #define NO_ACTIVE_ICON 1 |
|---|
| 387 | #endif |
|---|
| 388 | #endif |
|---|
| 389 | |
|---|
| 390 | #ifndef OPT_AIX_COLORS |
|---|
| 391 | #define OPT_AIX_COLORS 1 |
|---|
| 392 | #endif |
|---|
| 393 | |
|---|
| 394 | #ifndef OPT_BLINK_CURS |
|---|
| 395 | #define OPT_BLINK_CURS 1 |
|---|
| 396 | #endif |
|---|
| 397 | |
|---|
| 398 | #ifndef OPT_BLINK_TEXT |
|---|
| 399 | #define OPT_BLINK_TEXT OPT_BLINK_CURS |
|---|
| 400 | #endif |
|---|
| 401 | |
|---|
| 402 | #ifndef OPT_BOX_CHARS |
|---|
| 403 | #define OPT_BOX_CHARS 1 |
|---|
| 404 | #endif |
|---|
| 405 | |
|---|
| 406 | #ifndef OPT_BROKEN_OSC |
|---|
| 407 | #ifdef linux |
|---|
| 408 | #define OPT_BROKEN_OSC 1 |
|---|
| 409 | #else |
|---|
| 410 | #define OPT_BROKEN_OSC 0 |
|---|
| 411 | #endif |
|---|
| 412 | #endif |
|---|
| 413 | |
|---|
| 414 | #ifndef OPT_BROKEN_ST |
|---|
| 415 | #define OPT_BROKEN_ST 1 |
|---|
| 416 | #endif |
|---|
| 417 | |
|---|
| 418 | #ifndef OPT_C1_PRINT |
|---|
| 419 | #define OPT_C1_PRINT 1 |
|---|
| 420 | #endif |
|---|
| 421 | |
|---|
| 422 | #ifndef OPT_CLIP_BOLD |
|---|
| 423 | #define OPT_CLIP_BOLD 1 |
|---|
| 424 | #endif |
|---|
| 425 | |
|---|
| 426 | #ifndef OPT_COLOR_CLASS |
|---|
| 427 | #define OPT_COLOR_CLASS 1 |
|---|
| 428 | #endif |
|---|
| 429 | |
|---|
| 430 | #ifndef OPT_COLOR_RES |
|---|
| 431 | #define OPT_COLOR_RES 1 |
|---|
| 432 | #undef OPT_COLOR_RES2 |
|---|
| 433 | #endif |
|---|
| 434 | |
|---|
| 435 | #ifndef OPT_COLOR_RES2 |
|---|
| 436 | #define OPT_COLOR_RES2 OPT_COLOR_RES |
|---|
| 437 | #endif |
|---|
| 438 | |
|---|
| 439 | #ifndef OPT_DABBREV |
|---|
| 440 | #define OPT_DABBREV 0 |
|---|
| 441 | #endif |
|---|
| 442 | |
|---|
| 443 | #ifndef OPT_DEC_CHRSET |
|---|
| 444 | #define OPT_DEC_CHRSET 1 |
|---|
| 445 | #endif |
|---|
| 446 | |
|---|
| 447 | #ifndef OPT_DEC_LOCATOR |
|---|
| 448 | #define OPT_DEC_LOCATOR 0 |
|---|
| 449 | #endif |
|---|
| 450 | |
|---|
| 451 | #ifndef OPT_DEC_RECTOPS |
|---|
| 452 | #define OPT_DEC_RECTOPS 0 |
|---|
| 453 | #endif |
|---|
| 454 | |
|---|
| 455 | #ifndef OPT_DEC_SOFTFONT |
|---|
| 456 | #define OPT_DEC_SOFTFONT 0 |
|---|
| 457 | #endif |
|---|
| 458 | |
|---|
| 459 | #ifndef OPT_EBCDIC |
|---|
| 460 | #ifdef __MVS__ |
|---|
| 461 | #define OPT_EBCDIC 1 |
|---|
| 462 | #else |
|---|
| 463 | #define OPT_EBCDIC 0 |
|---|
| 464 | #endif |
|---|
| 465 | #endif |
|---|
| 466 | |
|---|
| 467 | #ifndef OPT_EXEC_XTERM |
|---|
| 468 | #define OPT_EXEC_XTERM 0 |
|---|
| 469 | #endif |
|---|
| 470 | |
|---|
| 471 | #ifndef OPT_EXTRA_PASTE |
|---|
| 472 | #define OPT_EXTRA_PASTE 1 |
|---|
| 473 | #endif |
|---|
| 474 | |
|---|
| 475 | #ifndef OPT_FOCUS_EVENT |
|---|
| 476 | #define OPT_FOCUS_EVENT 1 |
|---|
| 477 | #endif |
|---|
| 478 | |
|---|
| 479 | #ifndef OPT_HP_FUNC_KEYS |
|---|
| 480 | #define OPT_HP_FUNC_KEYS 0 |
|---|
| 481 | #endif |
|---|
| 482 | |
|---|
| 483 | #ifndef OPT_I18N_SUPPORT |
|---|
| 484 | #if (XtSpecificationRelease >= 5) |
|---|
| 485 | #define OPT_I18N_SUPPORT 1 |
|---|
| 486 | #else |
|---|
| 487 | #define OPT_I18N_SUPPORT 0 |
|---|
| 488 | #endif |
|---|
| 489 | #endif |
|---|
| 490 | |
|---|
| 491 | #ifndef OPT_INITIAL_ERASE |
|---|
| 492 | #define OPT_INITIAL_ERASE 1 |
|---|
| 493 | #endif |
|---|
| 494 | |
|---|
| 495 | #ifndef OPT_INPUT_METHOD |
|---|
| 496 | #if (XtSpecificationRelease >= 6) |
|---|
| 497 | #define OPT_INPUT_METHOD 1 |
|---|
| 498 | #else |
|---|
| 499 | #define OPT_INPUT_METHOD 0 |
|---|
| 500 | #endif |
|---|
| 501 | #endif |
|---|
| 502 | |
|---|
| 503 | #ifndef OPT_ISO_COLORS |
|---|
| 504 | #define OPT_ISO_COLORS 1 |
|---|
| 505 | #endif |
|---|
| 506 | |
|---|
| 507 | #ifndef OPT_256_COLORS |
|---|
| 508 | #define OPT_256_COLORS 0 |
|---|
| 509 | #endif |
|---|
| 510 | |
|---|
| 511 | #ifndef OPT_88_COLORS |
|---|
| 512 | #define OPT_88_COLORS 0 |
|---|
| 513 | #endif |
|---|
| 514 | |
|---|
| 515 | #ifndef OPT_HIGHLIGHT_COLOR |
|---|
| 516 | #define OPT_HIGHLIGHT_COLOR 1 |
|---|
| 517 | #endif |
|---|
| 518 | |
|---|
| 519 | #ifndef OPT_LOAD_VTFONTS |
|---|
| 520 | #define OPT_LOAD_VTFONTS 0 |
|---|
| 521 | #endif |
|---|
| 522 | |
|---|
| 523 | #ifndef OPT_LUIT_PROG |
|---|
| 524 | #define OPT_LUIT_PROG 0 |
|---|
| 525 | #endif |
|---|
| 526 | |
|---|
| 527 | #ifndef OPT_MAXIMIZE |
|---|
| 528 | #define OPT_MAXIMIZE 1 |
|---|
| 529 | #endif |
|---|
| 530 | |
|---|
| 531 | #ifndef OPT_MINI_LUIT |
|---|
| 532 | #define OPT_MINI_LUIT 0 |
|---|
| 533 | #endif |
|---|
| 534 | |
|---|
| 535 | #ifndef OPT_MOD_FKEYS |
|---|
| 536 | #define OPT_MOD_FKEYS 1 |
|---|
| 537 | #endif |
|---|
| 538 | |
|---|
| 539 | #ifndef OPT_NUM_LOCK |
|---|
| 540 | #define OPT_NUM_LOCK 1 |
|---|
| 541 | #endif |
|---|
| 542 | |
|---|
| 543 | #ifndef OPT_PASTE64 |
|---|
| 544 | #define OPT_PASTE64 0 |
|---|
| 545 | #endif |
|---|
| 546 | |
|---|
| 547 | #ifndef OPT_PC_COLORS |
|---|
| 548 | #define OPT_PC_COLORS 1 |
|---|
| 549 | #endif |
|---|
| 550 | |
|---|
| 551 | #ifndef OPT_PTY_HANDSHAKE |
|---|
| 552 | #define OPT_PTY_HANDSHAKE USE_HANDSHAKE |
|---|
| 553 | #endif |
|---|
| 554 | |
|---|
| 555 | #ifndef OPT_PRINT_COLORS |
|---|
| 556 | #define OPT_PRINT_COLORS 1 |
|---|
| 557 | #endif |
|---|
| 558 | |
|---|
| 559 | #ifndef OPT_READLINE |
|---|
| 560 | #define OPT_READLINE 0 |
|---|
| 561 | #endif |
|---|
| 562 | |
|---|
| 563 | #ifndef OPT_RENDERFONT |
|---|
| 564 | #ifdef XRENDERFONT |
|---|
| 565 | #define OPT_RENDERFONT 1 |
|---|
| 566 | #else |
|---|
| 567 | #define OPT_RENDERFONT 0 |
|---|
| 568 | #endif |
|---|
| 569 | #endif |
|---|
| 570 | |
|---|
| 571 | #ifndef OPT_RENDERWIDE |
|---|
| 572 | #if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) |
|---|
| 573 | #define OPT_RENDERWIDE 1 |
|---|
| 574 | #else |
|---|
| 575 | #define OPT_RENDERWIDE 0 |
|---|
| 576 | #endif |
|---|
| 577 | #endif |
|---|
| 578 | |
|---|
| 579 | #ifndef OPT_SAME_NAME |
|---|
| 580 | #define OPT_SAME_NAME 1 |
|---|
| 581 | #endif |
|---|
| 582 | |
|---|
| 583 | #ifndef OPT_SCO_FUNC_KEYS |
|---|
| 584 | #define OPT_SCO_FUNC_KEYS 0 |
|---|
| 585 | #endif |
|---|
| 586 | |
|---|
| 587 | #ifndef OPT_SUN_FUNC_KEYS |
|---|
| 588 | #define OPT_SUN_FUNC_KEYS 1 |
|---|
| 589 | #endif |
|---|
| 590 | |
|---|
| 591 | #ifndef OPT_SELECT_REGEX |
|---|
| 592 | #define OPT_SELECT_REGEX 0 |
|---|
| 593 | #endif |
|---|
| 594 | |
|---|
| 595 | #ifndef OPT_SESSION_MGT |
|---|
| 596 | #if defined(XtNdieCallback) && defined(XtNsaveCallback) |
|---|
| 597 | #define OPT_SESSION_MGT 1 |
|---|
| 598 | #else |
|---|
| 599 | #define OPT_SESSION_MGT 0 |
|---|
| 600 | #endif |
|---|
| 601 | #endif |
|---|
| 602 | |
|---|
| 603 | #ifndef OPT_SHIFT_FONTS |
|---|
| 604 | #define OPT_SHIFT_FONTS 1 |
|---|
| 605 | #endif |
|---|
| 606 | |
|---|
| 607 | #ifndef OPT_SUNPC_KBD |
|---|
| 608 | #define OPT_SUNPC_KBD 1 |
|---|
| 609 | #endif |
|---|
| 610 | |
|---|
| 611 | #ifndef OPT_TCAP_FKEYS |
|---|
| 612 | #define OPT_TCAP_FKEYS 0 |
|---|
| 613 | #endif |
|---|
| 614 | |
|---|
| 615 | #ifndef OPT_TCAP_QUERY |
|---|
| 616 | #define OPT_TCAP_QUERY 0 |
|---|
| 617 | #endif |
|---|
| 618 | |
|---|
| 619 | #ifndef OPT_TEK4014 |
|---|
| 620 | #define OPT_TEK4014 1 |
|---|
| 621 | #endif |
|---|
| 622 | |
|---|
| 623 | #ifndef OPT_TOOLBAR |
|---|
| 624 | #define OPT_TOOLBAR 0 |
|---|
| 625 | #endif |
|---|
| 626 | |
|---|
| 627 | #ifndef OPT_TRACE |
|---|
| 628 | #define OPT_TRACE 0 |
|---|
| 629 | #endif |
|---|
| 630 | |
|---|
| 631 | #ifndef OPT_TRACE_FLAGS |
|---|
| 632 | #define OPT_TRACE_FLAGS 0 |
|---|
| 633 | #endif |
|---|
| 634 | |
|---|
| 635 | #ifndef OPT_VT52_MODE |
|---|
| 636 | #define OPT_VT52_MODE 1 |
|---|
| 637 | #endif |
|---|
| 638 | |
|---|
| 639 | #ifndef OPT_WIDE_CHARS |
|---|
| 640 | #define OPT_WIDE_CHARS 0 |
|---|
| 641 | #endif |
|---|
| 642 | |
|---|
| 643 | #ifndef OPT_XMC_GLITCH |
|---|
| 644 | #define OPT_XMC_GLITCH 0 |
|---|
| 645 | #endif |
|---|
| 646 | |
|---|
| 647 | #ifndef OPT_ZICONBEEP |
|---|
| 648 | #define OPT_ZICONBEEP 1 |
|---|
| 649 | #endif |
|---|
| 650 | |
|---|
| 651 | |
|---|
| 652 | |
|---|
| 653 | #if OPT_AIX_COLORS && !OPT_ISO_COLORS |
|---|
| 654 | |
|---|
| 655 | #undef OPT_AIX_COLORS |
|---|
| 656 | #define OPT_AIX_COLORS 0 |
|---|
| 657 | #endif |
|---|
| 658 | |
|---|
| 659 | #if OPT_COLOR_RES && !OPT_ISO_COLORS |
|---|
| 660 | |
|---|
| 661 | #undef OPT_COLOR_RES |
|---|
| 662 | #define OPT_COLOR_RES 0 |
|---|
| 663 | #endif |
|---|
| 664 | |
|---|
| 665 | #if OPT_COLOR_RES2 && !(OPT_256_COLORS || OPT_88_COLORS) |
|---|
| 666 | |
|---|
| 667 | #undef OPT_COLOR_RES2 |
|---|
| 668 | #define OPT_COLOR_RES2 0 |
|---|
| 669 | #endif |
|---|
| 670 | |
|---|
| 671 | #if OPT_PASTE64 && !OPT_READLINE |
|---|
| 672 | |
|---|
| 673 | #undef OPT_READLINE |
|---|
| 674 | #define OPT_READLINE 1 |
|---|
| 675 | #endif |
|---|
| 676 | |
|---|
| 677 | #if OPT_PC_COLORS && !OPT_ISO_COLORS |
|---|
| 678 | |
|---|
| 679 | #undef OPT_PC_COLORS |
|---|
| 680 | #define OPT_PC_COLORS 0 |
|---|
| 681 | #endif |
|---|
| 682 | |
|---|
| 683 | #if OPT_PRINT_COLORS && !OPT_ISO_COLORS |
|---|
| 684 | |
|---|
| 685 | #undef OPT_PRINT_COLORS |
|---|
| 686 | #define OPT_PRINT_COLORS 0 |
|---|
| 687 | #endif |
|---|
| 688 | |
|---|
| 689 | #if OPT_256_COLORS && !OPT_ISO_COLORS |
|---|
| 690 | |
|---|
| 691 | #undef OPT_256_COLORS |
|---|
| 692 | #define OPT_256_COLORS 0 |
|---|
| 693 | #endif |
|---|
| 694 | |
|---|
| 695 | #if OPT_88_COLORS && !OPT_ISO_COLORS |
|---|
| 696 | |
|---|
| 697 | #undef OPT_88_COLORS |
|---|
| 698 | #define OPT_88_COLORS 0 |
|---|
| 699 | #endif |
|---|
| 700 | |
|---|
| 701 | #if OPT_88_COLORS && OPT_256_COLORS |
|---|
| 702 | |
|---|
| 703 | #undef OPT_88_COLORS |
|---|
| 704 | #define OPT_88_COLORS 0 |
|---|
| 705 | #endif |
|---|
| 706 | |
|---|
| 707 | |
|---|
| 708 | |
|---|
| 709 | |
|---|
| 710 | |
|---|
| 711 | |
|---|
| 712 | typedef enum { |
|---|
| 713 | fNorm = 0 |
|---|
| 714 | , fBold |
|---|
| 715 | #if OPT_WIDE_CHARS |
|---|
| 716 | , fWide |
|---|
| 717 | , fWBold |
|---|
| 718 | #endif |
|---|
| 719 | , fMAX |
|---|
| 720 | } VTFontEnum; |
|---|
| 721 | |
|---|
| 722 | |
|---|
| 723 | |
|---|
| 724 | |
|---|
| 725 | typedef enum { |
|---|
| 726 | gcNorm = 0 |
|---|
| 727 | , gcBold |
|---|
| 728 | , gcNormReverse |
|---|
| 729 | , gcBoldReverse |
|---|
| 730 | #if OPT_BOX_CHARS |
|---|
| 731 | , gcLine |
|---|
| 732 | , gcDots |
|---|
| 733 | #endif |
|---|
| 734 | #if OPT_DEC_CHRSET |
|---|
| 735 | , gcCNorm |
|---|
| 736 | , gcCBold |
|---|
| 737 | #endif |
|---|
| 738 | #if OPT_WIDE_CHARS |
|---|
| 739 | , gcWide |
|---|
| 740 | , gcWBold |
|---|
| 741 | , gcWideReverse |
|---|
| 742 | , gcWBoldReverse |
|---|
| 743 | #endif |
|---|
| 744 | , gcVTcursNormal |
|---|
| 745 | , gcVTcursFilled |
|---|
| 746 | , gcVTcursReverse |
|---|
| 747 | , gcVTcursOutline |
|---|
| 748 | #if OPT_TEK4014 |
|---|
| 749 | , gcTKcurs |
|---|
| 750 | #endif |
|---|
| 751 | , gcMAX |
|---|
| 752 | } CgsEnum; |
|---|
| 753 | |
|---|
| 754 | #define for_each_text_gc(n) for (n = gcNorm; n < gcVTcursNormal; ++n) |
|---|
| 755 | #define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) |
|---|
| 756 | #define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) |
|---|
| 757 | |
|---|
| 758 | |
|---|
| 759 | typedef enum { |
|---|
| 760 | TEXT_FG = 0 |
|---|
| 761 | , TEXT_BG |
|---|
| 762 | , TEXT_CURSOR |
|---|
| 763 | , MOUSE_FG |
|---|
| 764 | , MOUSE_BG |
|---|
| 765 | #if OPT_TEK4014 |
|---|
| 766 | , TEK_FG |
|---|
| 767 | , TEK_BG |
|---|
| 768 | , TEK_CURSOR |
|---|
| 769 | #endif |
|---|
| 770 | #if OPT_HIGHLIGHT_COLOR |
|---|
| 771 | , HIGHLIGHT_BG |
|---|
| 772 | , HIGHLIGHT_FG |
|---|
| 773 | #endif |
|---|
| 774 | , NCOLORS |
|---|
| 775 | } TermColors; |
|---|
| 776 | |
|---|
| 777 | |
|---|
| 778 | typedef enum { |
|---|
| 779 | Select_CHAR=0 |
|---|
| 780 | ,Select_WORD |
|---|
| 781 | ,Select_LINE |
|---|
| 782 | ,Select_GROUP |
|---|
| 783 | ,Select_PAGE |
|---|
| 784 | ,Select_ALL |
|---|
| 785 | #if OPT_SELECT_REGEX |
|---|
| 786 | ,Select_REGEX |
|---|
| 787 | #endif |
|---|
| 788 | ,NSELECTUNITS |
|---|
| 789 | } SelectUnit; |
|---|
| 790 | |
|---|
| 791 | #define COLOR_DEFINED(s,w) ((s)->which & (1<<(w))) |
|---|
| 792 | #define COLOR_VALUE(s,w) ((s)->colors[w]) |
|---|
| 793 | #define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), ((s)->which |= (1<<(w)))) |
|---|
| 794 | |
|---|
| 795 | #define COLOR_NAME(s,w) ((s)->names[w]) |
|---|
| 796 | #define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (1<<(w)))) |
|---|
| 797 | |
|---|
| 798 | #define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1))) |
|---|
| 799 | |
|---|
| 800 | |
|---|
| 801 | |
|---|
| 802 | #if OPT_ISO_COLORS |
|---|
| 803 | #define if_OPT_ISO_COLORS(screen, code) if(screen->colorMode) code |
|---|
| 804 | #define TERM_COLOR_FLAGS(xw) ((xw)->flags & (FG_COLOR|BG_COLOR)) |
|---|
| 805 | #define COLOR_0 0 |
|---|
| 806 | #define COLOR_1 1 |
|---|
| 807 | #define COLOR_2 2 |
|---|
| 808 | #define COLOR_3 3 |
|---|
| 809 | #define COLOR_4 4 |
|---|
| 810 | #define COLOR_5 5 |
|---|
| 811 | #define COLOR_6 6 |
|---|
| 812 | #define COLOR_7 7 |
|---|
| 813 | #define COLOR_8 8 |
|---|
| 814 | #define COLOR_9 9 |
|---|
| 815 | #define COLOR_10 10 |
|---|
| 816 | #define COLOR_11 11 |
|---|
| 817 | #define COLOR_12 12 |
|---|
| 818 | #define COLOR_13 13 |
|---|
| 819 | #define COLOR_14 14 |
|---|
| 820 | #define COLOR_15 15 |
|---|
| 821 | #define MIN_ANSI_COLORS 16 |
|---|
| 822 | |
|---|
| 823 | #if OPT_256_COLORS |
|---|
| 824 | # define NUM_ANSI_COLORS 256 |
|---|
| 825 | #elif OPT_88_COLORS |
|---|
| 826 | # define NUM_ANSI_COLORS 88 |
|---|
| 827 | #else |
|---|
| 828 | # define NUM_ANSI_COLORS MIN_ANSI_COLORS |
|---|
| 829 | #endif |
|---|
| 830 | |
|---|
| 831 | #if NUM_ANSI_COLORS > MIN_ANSI_COLORS |
|---|
| 832 | # define OPT_EXT_COLORS 1 |
|---|
| 833 | #else |
|---|
| 834 | # define OPT_EXT_COLORS 0 |
|---|
| 835 | #endif |
|---|
| 836 | |
|---|
| 837 | #define COLOR_BD (NUM_ANSI_COLORS) |
|---|
| 838 | #define COLOR_UL (NUM_ANSI_COLORS+1) |
|---|
| 839 | #define COLOR_BL (NUM_ANSI_COLORS+2) |
|---|
| 840 | #define COLOR_RV (NUM_ANSI_COLORS+3) |
|---|
| 841 | #define MAXCOLORS (NUM_ANSI_COLORS+4) |
|---|
| 842 | #ifndef DFT_COLORMODE |
|---|
| 843 | #define DFT_COLORMODE True |
|---|
| 844 | #endif |
|---|
| 845 | |
|---|
| 846 | #define ReverseOrHilite(screen,flags,hilite) \ |
|---|
| 847 | (( screen->colorRVMode && hilite ) || \ |
|---|
| 848 | ( !screen->colorRVMode && \ |
|---|
| 849 | (( (flags & INVERSE) && !hilite) || \ |
|---|
| 850 | (!(flags & INVERSE) && hilite)) )) |
|---|
| 851 | |
|---|
| 852 | |
|---|
| 853 | |
|---|
| 854 | #if OPT_TCAP_QUERY && OPT_ISO_COLORS |
|---|
| 855 | # define XK_COLORS 0x0003 |
|---|
| 856 | #endif |
|---|
| 857 | |
|---|
| 858 | #else |
|---|
| 859 | |
|---|
| 860 | #define if_OPT_ISO_COLORS(screen, code) |
|---|
| 861 | #define TERM_COLOR_FLAGS(xw) 0 |
|---|
| 862 | |
|---|
| 863 | #define ReverseOrHilite(screen,flags,hilite) \ |
|---|
| 864 | (( (flags & INVERSE) && !hilite) || \ |
|---|
| 865 | (!(flags & INVERSE) && hilite)) |
|---|
| 866 | |
|---|
| 867 | #endif |
|---|
| 868 | |
|---|
| 869 | #if OPT_AIX_COLORS |
|---|
| 870 | #define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code |
|---|
| 871 | #else |
|---|
| 872 | #define if_OPT_AIX_COLORS(screen, code) |
|---|
| 873 | #endif |
|---|
| 874 | |
|---|
| 875 | #if OPT_256_COLORS || OPT_88_COLORS |
|---|
| 876 | # define if_OPT_EXT_COLORS(screen, code) if(screen->colorMode) code |
|---|
| 877 | # define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) |
|---|
| 878 | #elif OPT_ISO_COLORS |
|---|
| 879 | # define if_OPT_EXT_COLORS(screen, code) |
|---|
| 880 | # define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) if(screen->colorMode) code |
|---|
| 881 | #else |
|---|
| 882 | # define if_OPT_EXT_COLORS(screen, code) |
|---|
| 883 | # define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) |
|---|
| 884 | #endif |
|---|
| 885 | |
|---|
| 886 | #define COLOR_RES_NAME(root) "color" root |
|---|
| 887 | |
|---|
| 888 | #if OPT_COLOR_CLASS |
|---|
| 889 | #define COLOR_RES_CLASS(root) "Color" root |
|---|
| 890 | #else |
|---|
| 891 | #define COLOR_RES_CLASS(root) XtCForeground |
|---|
| 892 | #endif |
|---|
| 893 | |
|---|
| 894 | #if OPT_COLOR_RES |
|---|
| 895 | #define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) |
|---|
| 896 | #define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) |
|---|
| 897 | #else |
|---|
| 898 | #define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) |
|---|
| 899 | #define COLOR_RES2(name,class,offset,value) Cres(name, class, offset, value) |
|---|
| 900 | #endif |
|---|
| 901 | |
|---|
| 902 | #define CLICK_RES_NAME(count) "on" count "Clicks" |
|---|
| 903 | #define CLICK_RES_CLASS(count) "On" count "Clicks" |
|---|
| 904 | #define CLICK_RES(count,offset,value) Sres(CLICK_RES_NAME(count), CLICK_RES_CLASS(count), offset, value) |
|---|
| 905 | |
|---|
| 906 | |
|---|
| 907 | |
|---|
| 908 | #if OPT_DEC_CHRSET |
|---|
| 909 | #define if_OPT_DEC_CHRSET(code) code |
|---|
| 910 | |
|---|
| 911 | #define CSET_SWL 0 |
|---|
| 912 | #define CSET_DHL_TOP 1 |
|---|
| 913 | #define CSET_DHL_BOT 2 |
|---|
| 914 | #define CSET_DWL 3 |
|---|
| 915 | #define NUM_CHRSET 8 |
|---|
| 916 | |
|---|
| 917 | #define CSET_NORMAL(code) ((code) == CSET_SWL) |
|---|
| 918 | #define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) |
|---|
| 919 | #define CSET_EXTEND(code) ((code) > CSET_DWL) |
|---|
| 920 | |
|---|
| 921 | #define SCRN_ROW_CSET(screen,row) (SCRN_BUF_CSETS((screen), row)[0]) |
|---|
| 922 | #define CurMaxCol(screen, row) \ |
|---|
| 923 | (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ |
|---|
| 924 | ? (screen->max_col / 2) \ |
|---|
| 925 | : (screen->max_col)) |
|---|
| 926 | #define CurCursorX(screen, row, col) \ |
|---|
| 927 | (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ |
|---|
| 928 | ? CursorX(screen, 2*(col)) \ |
|---|
| 929 | : CursorX(screen, (col))) |
|---|
| 930 | #define CurFontWidth(screen, row) \ |
|---|
| 931 | (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ |
|---|
| 932 | ? 2*FontWidth(screen) \ |
|---|
| 933 | : FontWidth(screen)) |
|---|
| 934 | #else |
|---|
| 935 | #define if_OPT_DEC_CHRSET(code) |
|---|
| 936 | #define CurMaxCol(screen, row) screen->max_col |
|---|
| 937 | #define CurCursorX(screen, row, col) CursorX(screen, col) |
|---|
| 938 | #define CurFontWidth(screen, row) FontWidth(screen) |
|---|
| 939 | #endif |
|---|
| 940 | |
|---|
| 941 | #if OPT_LUIT_PROG && !OPT_WIDE_CHARS |
|---|
| 942 | #error Luit requires the wide-chars configuration |
|---|
| 943 | #endif |
|---|
| 944 | |
|---|
| 945 | |
|---|
| 946 | #if OPT_WIDE_CHARS |
|---|
| 947 | #define MAX_PTRS term->num_ptrs |
|---|
| 948 | #else |
|---|
| 949 | #define MAX_PTRS (OFF_FINAL) |
|---|
| 950 | #endif |
|---|
| 951 | |
|---|
| 952 | #define BUF_HEAD 1 |
|---|
| 953 | |
|---|
| 954 | #define BUF_PTRS (MAX_PTRS - BUF_HEAD) |
|---|
| 955 | |
|---|
| 956 | |
|---|
| 957 | |
|---|
| 958 | #if OPT_EBCDIC |
|---|
| 959 | extern int E2A(int); |
|---|
| 960 | extern int A2E(int); |
|---|
| 961 | #else |
|---|
| 962 | #define E2A(a) (a) |
|---|
| 963 | #define A2E(a) (a) |
|---|
| 964 | #endif |
|---|
| 965 | |
|---|
| 966 | #define CONTROL(a) (A2E(E2A(a)&037)) |
|---|
| 967 | |
|---|
| 968 | |
|---|
| 969 | |
|---|
| 970 | #if OPT_TEK4014 |
|---|
| 971 | #define TEK4014_ACTIVE(xw) ((xw)->misc.TekEmu) |
|---|
| 972 | #define TEK4014_SHOWN(xw) ((xw)->misc.Tshow) |
|---|
| 973 | #define CURRENT_EMU_VAL(tek,vt) (TEK4014_ACTIVE(term) ? tek : vt) |
|---|
| 974 | #define CURRENT_EMU() CURRENT_EMU_VAL((Widget)tekWidget, (Widget)term) |
|---|
| 975 | #else |
|---|
| 976 | #define TEK4014_ACTIVE(screen) 0 |
|---|
| 977 | #define TEK4014_SHOWN(xw) 0 |
|---|
| 978 | #define CURRENT_EMU_VAL(tek,vt) (vt) |
|---|
| 979 | #define CURRENT_EMU() ((Widget)term) |
|---|
| 980 | #endif |
|---|
| 981 | |
|---|
| 982 | |
|---|
| 983 | |
|---|
| 984 | #if OPT_TOOLBAR |
|---|
| 985 | #define SHELL_OF(widget) XtParent(XtParent(widget)) |
|---|
| 986 | #else |
|---|
| 987 | #define SHELL_OF(widget) XtParent(widget) |
|---|
| 988 | #endif |
|---|
| 989 | |
|---|
| 990 | |
|---|
| 991 | |
|---|
| 992 | #if OPT_VT52_MODE |
|---|
| 993 | #define if_OPT_VT52_MODE(screen, code) if(screen->vtXX_level == 0) code |
|---|
| 994 | #else |
|---|
| 995 | #define if_OPT_VT52_MODE(screen, code) |
|---|
| 996 | #endif |
|---|
| 997 | |
|---|
| 998 | |
|---|
| 999 | |
|---|
| 1000 | #if OPT_XMC_GLITCH |
|---|
| 1001 | #define if_OPT_XMC_GLITCH(screen, code) if(screen->xmc_glitch) code |
|---|
| 1002 | #define XMC_GLITCH 1 |
|---|
| 1003 | #define XMC_FLAGS (INVERSE|UNDERLINE|BOLD|BLINK) |
|---|
| 1004 | #else |
|---|
| 1005 | #define if_OPT_XMC_GLITCH(screen, code) |
|---|
| 1006 | #endif |
|---|
| 1007 | |
|---|
| 1008 | |
|---|
| 1009 | |
|---|
| 1010 | #define LO_BYTE(ch) ((ch) & 0xff) |
|---|
| 1011 | #define HI_BYTE(ch) ((ch) >> 8) |
|---|
| 1012 | |
|---|
| 1013 | #if OPT_WIDE_CHARS |
|---|
| 1014 | #define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code |
|---|
| 1015 | #define if_WIDE_OR_NARROW(screen, wide, narrow) if(screen->wide_chars) wide else narrow |
|---|
| 1016 | #define PAIRED_CHARS(lo,hi) lo,hi |
|---|
| 1017 | #define PACK_PAIR(lo,hi,n) (lo[n] | (hi ? (hi[n] << 8) : 0)) |
|---|
| 1018 | typedef unsigned IChar; |
|---|
| 1019 | #else |
|---|
| 1020 | #define if_OPT_WIDE_CHARS(screen, code) |
|---|
| 1021 | #define if_WIDE_OR_NARROW(screen, wide, narrow) narrow |
|---|
| 1022 | #define PAIRED_CHARS(lo,hi) lo |
|---|
| 1023 | #define PACK_PAIR(lo,hi,n) lo[n] |
|---|
| 1024 | typedef unsigned char IChar; |
|---|
| 1025 | #endif |
|---|
| 1026 | |
|---|
| 1027 | |
|---|
| 1028 | |
|---|
| 1029 | #ifndef RES_OFFSET |
|---|
| 1030 | #define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset) |
|---|
| 1031 | #endif |
|---|
| 1032 | |
|---|
| 1033 | #define RES_NAME(name) name |
|---|
| 1034 | #define RES_CLASS(name) name |
|---|
| 1035 | |
|---|
| 1036 | #define Bres(name, class, offset, dftvalue) \ |
|---|
| 1037 | {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ |
|---|
| 1038 | RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} |
|---|
| 1039 | |
|---|
| 1040 | #define Cres(name, class, offset, dftvalue) \ |
|---|
| 1041 | {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ |
|---|
| 1042 | RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} |
|---|
| 1043 | |
|---|
| 1044 | #define Tres(name, class, offset, dftvalue) \ |
|---|
| 1045 | COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \ |
|---|
| 1046 | |
|---|
| 1047 | #define Fres(name, class, offset, dftvalue) \ |
|---|
| 1048 | {RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \ |
|---|
| 1049 | RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} |
|---|
| 1050 | |
|---|
| 1051 | #define Ires(name, class, offset, dftvalue) \ |
|---|
| 1052 | {RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \ |
|---|
| 1053 | RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} |
|---|
| 1054 | |
|---|
| 1055 | #define Dres(name, class, offset, dftvalue) \ |
|---|
| 1056 | {RES_NAME(name), RES_CLASS(class), XtRFloat, sizeof(float), \ |
|---|
| 1057 | RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} |
|---|
| 1058 | |
|---|
| 1059 | #define Sres(name, class, offset, dftvalue) \ |
|---|
| 1060 | {RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \ |
|---|
| 1061 | RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} |
|---|
| 1062 | |
|---|
| 1063 | #define Wres(name, class, offset, dftvalue) \ |
|---|
| 1064 | {RES_NAME(name), RES_CLASS(class), XtRWidget, sizeof(Widget), \ |
|---|
| 1065 | RES_OFFSET(offset), XtRWidget, (XtPointer) dftvalue} |
|---|
| 1066 | |
|---|
| 1067 | |
|---|
| 1068 | |
|---|
| 1069 | #define FRG_SIZE resource.minBufSize |
|---|
| 1070 | #define BUF_SIZE resource.maxBufSize |
|---|
| 1071 | |
|---|
| 1072 | typedef struct { |
|---|
| 1073 | Char * next; |
|---|
| 1074 | Char * last; |
|---|
| 1075 | int update; |
|---|
| 1076 | #if OPT_WIDE_CHARS |
|---|
| 1077 | IChar utf_data; |
|---|
| 1078 | int utf_size; |
|---|
| 1079 | Char *write_buf; |
|---|
| 1080 | unsigned write_len; |
|---|
| 1081 | #endif |
|---|
| 1082 | Char buffer[1]; |
|---|
| 1083 | } PtyData; |
|---|
| 1084 | |
|---|
| 1085 | |
|---|
| 1086 | |
|---|
| 1087 | |
|---|
| 1088 | typedef enum { |
|---|
| 1089 | OFF_FLAGS = 0 |
|---|
| 1090 | , OFF_ATTRS |
|---|
| 1091 | #if OPT_ISO_COLORS |
|---|
| 1092 | #if OPT_256_COLORS || OPT_88_COLORS |
|---|
| 1093 | , OFF_FGRND |
|---|
| 1094 | , OFF_BGRND |
|---|
| 1095 | #else |
|---|
| 1096 | , OFF_COLOR |
|---|
| 1097 | #endif |
|---|
| 1098 | #endif |
|---|
| 1099 | #if OPT_DEC_CHRSET |
|---|
| 1100 | , OFF_CSETS |
|---|
| 1101 | #endif |
|---|
| 1102 | |
|---|
| 1103 | , OFF_CHARS |
|---|
| 1104 | #if OPT_WIDE_CHARS |
|---|
| 1105 | , OFF_WIDEC |
|---|
| 1106 | #endif |
|---|
| 1107 | , OFF_FINAL |
|---|
| 1108 | } BufOffsets; |
|---|
| 1109 | |
|---|
| 1110 | |
|---|
| 1111 | |
|---|
| 1112 | |
|---|
| 1113 | |
|---|
| 1114 | #define ROW2INX(screen, row) ((row) + (screen)->topline) |
|---|
| 1115 | #define INX2ROW(screen, inx) ((inx) - (screen)->topline) |
|---|
| 1116 | |
|---|
| 1117 | #define ROW2ABS(screen, row) ((row) + (screen)->savedlines) |
|---|
| 1118 | #define INX2ABS(screen, inx) ROW2ABS(screen, INX2ROW(screen, inx)) |
|---|
| 1119 | |
|---|
| 1120 | #define okScrnRow(screen, row) \ |
|---|
| 1121 | ((row) <= (screen)->max_row \ |
|---|
| 1122 | && (row) >= -((screen)->savedlines)) |
|---|
| 1123 | |
|---|
| 1124 | |
|---|
| 1125 | #define BUFFER_PTR(buf, row, off) (buf[MAX_PTRS * (row) + off]) |
|---|
| 1126 | |
|---|
| 1127 | #define BUF_FLAGS(buf, row) BUFFER_PTR(buf, row, OFF_FLAGS) |
|---|
| 1128 | #define BUF_CHARS(buf, row) BUFFER_PTR(buf, row, OFF_CHARS) |
|---|
| 1129 | #define BUF_ATTRS(buf, row) BUFFER_PTR(buf, row, OFF_ATTRS) |
|---|
| 1130 | #define BUF_COLOR(buf, row) BUFFER_PTR(buf, row, OFF_COLOR) |
|---|
| 1131 | #define BUF_FGRND(buf, row) BUFFER_PTR(buf, row, OFF_FGRND) |
|---|
| 1132 | #define BUF_BGRND(buf, row) BUFFER_PTR(buf, row, OFF_BGRND) |
|---|
| 1133 | #define BUF_CSETS(buf, row) BUFFER_PTR(buf, row, OFF_CSETS) |
|---|
| 1134 | #define BUF_WIDEC(buf, row) BUFFER_PTR(buf, row, OFF_WIDEC) |
|---|
| 1135 | |
|---|
| 1136 | |
|---|
| 1137 | #define SCREEN_PTR(screen, row, off) BUFFER_PTR(screen->visbuf, row, off) |
|---|
| 1138 | |
|---|
| 1139 | #define SCRN_BUF_FLAGS(screen, row) SCREEN_PTR(screen, row, OFF_FLAGS) |
|---|
| 1140 | #define SCRN_BUF_CHARS(screen, row) SCREEN_PTR(screen, row, OFF_CHARS) |
|---|
| 1141 | #define SCRN_BUF_ATTRS(screen, row) SCREEN_PTR(screen, row, OFF_ATTRS) |
|---|
| 1142 | #define SCRN_BUF_COLOR(screen, row) SCREEN_PTR(screen, row, OFF_COLOR) |
|---|
| 1143 | #define SCRN_BUF_FGRND(screen, row) SCREEN_PTR(screen, row, OFF_FGRND) |
|---|
| 1144 | #define SCRN_BUF_BGRND(screen, row) SCREEN_PTR(screen, row, OFF_BGRND) |
|---|
| 1145 | #define SCRN_BUF_CSETS(screen, row) SCREEN_PTR(screen, row, OFF_CSETS) |
|---|
| 1146 | #define SCRN_BUF_WIDEC(screen, row) SCREEN_PTR(screen, row, OFF_WIDEC) |
|---|
| 1147 | |
|---|
| 1148 | typedef struct { |
|---|
| 1149 | unsigned chrset; |
|---|
| 1150 | unsigned flags; |
|---|
| 1151 | XFontStruct * fs; |
|---|
| 1152 | char * fn; |
|---|
| 1153 | } XTermFonts; |
|---|
| 1154 | |
|---|
| 1155 | typedef struct { |
|---|
| 1156 | int top; |
|---|
| 1157 | int left; |
|---|
| 1158 | int bottom; |
|---|
| 1159 | int right; |
|---|
| 1160 | } XTermRect; |
|---|
| 1161 | |
|---|
| 1162 | |
|---|
| 1163 | typedef enum { |
|---|
| 1164 | DP_CRS_VISIBLE, |
|---|
| 1165 | DP_DECANM, |
|---|
| 1166 | DP_DECARM, |
|---|
| 1167 | DP_DECAWM, |
|---|
| 1168 | DP_DECBKM, |
|---|
| 1169 | DP_DECCKM, |
|---|
| 1170 | DP_DECCOLM, |
|---|
| 1171 | DP_DECOM, |
|---|
| 1172 | DP_DECPEX, |
|---|
| 1173 | DP_DECPFF, |
|---|
| 1174 | DP_DECSCLM, |
|---|
| 1175 | DP_DECSCNM, |
|---|
| 1176 | DP_DECTCEM, |
|---|
| 1177 | DP_DECTEK, |
|---|
| 1178 | DP_PRN_EXTENT, |
|---|
| 1179 | DP_PRN_FORMFEED, |
|---|
| 1180 | DP_X_ALTSCRN, |
|---|
| 1181 | DP_X_DECCOLM, |
|---|
| 1182 | DP_X_LOGGING, |
|---|
| 1183 | DP_X_MARGIN, |
|---|
| 1184 | DP_X_MORE, |
|---|
| 1185 | DP_X_MOUSE, |
|---|
| 1186 | DP_X_REVWRAP, |
|---|
| 1187 | DP_X_X10MSE, |
|---|
| 1188 | #if OPT_BLINK_CURS |
|---|
| 1189 | DP_CRS_BLINK, |
|---|
| 1190 | #endif |
|---|
| 1191 | #if OPT_FOCUS_EVENT |
|---|
| 1192 | DP_X_FOCUS, |
|---|
| 1193 | #endif |
|---|
| 1194 | #if OPT_TOOLBAR |
|---|
| 1195 | DP_TOOLBAR, |
|---|
| 1196 | #endif |
|---|
| 1197 | DP_LAST |
|---|
| 1198 | } SaveModes; |
|---|
| 1199 | |
|---|
| 1200 | #define DoSM(code,value) screen->save_modes[code] = value |
|---|
| 1201 | #define DoRM(code,value) value = screen->save_modes[code] |
|---|
| 1202 | |
|---|
| 1203 | |
|---|
| 1204 | typedef enum { |
|---|
| 1205 | noMenu = -1, |
|---|
| 1206 | mainMenu, |
|---|
| 1207 | vtMenu, |
|---|
| 1208 | fontMenu, |
|---|
| 1209 | tekMenu |
|---|
| 1210 | } MenuIndex; |
|---|
| 1211 | |
|---|
| 1212 | #define NUM_POPUP_MENUS 4 |
|---|
| 1213 | |
|---|
| 1214 | #if OPT_COLOR_RES |
|---|
| 1215 | typedef struct { |
|---|
| 1216 | String resource; |
|---|
| 1217 | Pixel value; |
|---|
| 1218 | int mode; |
|---|
| 1219 | } ColorRes; |
|---|
| 1220 | #else |
|---|
| 1221 | #define ColorRes Pixel |
|---|
| 1222 | #endif |
|---|
| 1223 | |
|---|
| 1224 | typedef struct { |
|---|
| 1225 | unsigned which; |
|---|
| 1226 | Pixel colors[NCOLORS]; |
|---|
| 1227 | char *names[NCOLORS]; |
|---|
| 1228 | } ScrnColors; |
|---|
| 1229 | |
|---|
| 1230 | typedef struct { |
|---|
| 1231 | Boolean saved; |
|---|
| 1232 | int row; |
|---|
| 1233 | int col; |
|---|
| 1234 | unsigned flags; |
|---|
| 1235 | char curgl; |
|---|
| 1236 | char curgr; |
|---|
| 1237 | char gsets[4]; |
|---|
| 1238 | #if OPT_ISO_COLORS |
|---|
| 1239 | int cur_foreground; |
|---|
| 1240 | int cur_background; |
|---|
| 1241 | int sgr_foreground; |
|---|
| 1242 | int sgr_background; |
|---|
| 1243 | Boolean sgr_extended; |
|---|
| 1244 | #endif |
|---|
| 1245 | } SavedCursor; |
|---|
| 1246 | |
|---|
| 1247 | #define SAVED_CURSORS 2 |
|---|
| 1248 | |
|---|
| 1249 | typedef struct { |
|---|
| 1250 | int width; |
|---|
| 1251 | |
|---|
| 1252 | Boolean rv_cached; |
|---|
| 1253 | int rv_active; |
|---|
| 1254 | Pixel bg; |
|---|
| 1255 | Pixel fg; |
|---|
| 1256 | Pixel bdr; |
|---|
| 1257 | Pixmap bdpix; |
|---|
| 1258 | } SbInfo; |
|---|
| 1259 | |
|---|
| 1260 | #if OPT_TOOLBAR |
|---|
| 1261 | typedef struct { |
|---|
| 1262 | Widget menu_bar; |
|---|
| 1263 | Dimension menu_height; |
|---|
| 1264 | Dimension menu_border; |
|---|
| 1265 | } TbInfo; |
|---|
| 1266 | #define VT100_TB_INFO(name) screen.fullVwin.tb_info.name |
|---|
| 1267 | #endif |
|---|
| 1268 | |
|---|
| 1269 | typedef struct { |
|---|
| 1270 | Window window; |
|---|
| 1271 | int width; |
|---|
| 1272 | int height; |
|---|
| 1273 | Dimension fullwidth; |
|---|
| 1274 | Dimension fullheight; |
|---|
| 1275 | int f_width; |
|---|
| 1276 | int f_height; |
|---|
| 1277 | int f_ascent; |
|---|
| 1278 | int f_descent; |
|---|
| 1279 | SbInfo sb_info; |
|---|
| 1280 | #if OPT_TOOLBAR |
|---|
| 1281 | Boolean active; |
|---|
| 1282 | TbInfo tb_info; |
|---|
| 1283 | #endif |
|---|
| 1284 | } VTwin; |
|---|
| 1285 | |
|---|
| 1286 | typedef struct { |
|---|
| 1287 | Window window; |
|---|
| 1288 | int width; |
|---|
| 1289 | int height; |
|---|
| 1290 | Dimension fullwidth; |
|---|
| 1291 | Dimension fullheight; |
|---|
| 1292 | double tekscale; |
|---|
| 1293 | } TKwin; |
|---|
| 1294 | |
|---|
| 1295 | typedef struct { |
|---|
| 1296 | |
|---|
| 1297 | Display *display; |
|---|
| 1298 | int respond; |
|---|
| 1299 | |
|---|
| 1300 | |
|---|
| 1301 | IChar unparse_bfr[256]; |
|---|
| 1302 | unsigned unparse_len; |
|---|
| 1303 | |
|---|
| 1304 | #if OPT_TCAP_QUERY |
|---|
| 1305 | int tc_query_code; |
|---|
| 1306 | Bool tc_query_fkey; |
|---|
| 1307 | #endif |
|---|
| 1308 | pid_t pid; |
|---|
| 1309 | uid_t uid; |
|---|
| 1310 | gid_t gid; |
|---|
| 1311 | ColorRes Tcolors[NCOLORS]; |
|---|
| 1312 | #if OPT_HIGHLIGHT_COLOR |
|---|
| 1313 | Boolean hilite_color; |
|---|
| 1314 | Boolean hilite_reverse; |
|---|
| 1315 | #endif |
|---|
| 1316 | #if OPT_ISO_COLORS |
|---|
| 1317 | ColorRes Acolors[MAXCOLORS]; |
|---|
| 1318 | int veryBoldColors; |
|---|
| 1319 | Boolean boldColors; |
|---|
| 1320 | Boolean colorMode; |
|---|
| 1321 | Boolean colorULMode; |
|---|
| 1322 | Boolean italicULMode; |
|---|
| 1323 | Boolean colorBDMode; |
|---|
| 1324 | Boolean colorBLMode; |
|---|
| 1325 | Boolean colorRVMode; |
|---|
| 1326 | Boolean colorAttrMode; |
|---|
| 1327 | #endif |
|---|
| 1328 | #if OPT_DEC_CHRSET |
|---|
| 1329 | Boolean font_doublesize; |
|---|
| 1330 | int cache_doublesize; |
|---|
| 1331 | Char cur_chrset; |
|---|
| 1332 | int fonts_used; |
|---|
| 1333 | XTermFonts double_fonts[NUM_CHRSET]; |
|---|
| 1334 | #endif |
|---|
| 1335 | #if OPT_DEC_RECTOPS |
|---|
| 1336 | int cur_decsace; |
|---|
| 1337 | #endif |
|---|
| 1338 | #if OPT_WIDE_CHARS |
|---|
| 1339 | Boolean wide_chars; |
|---|
| 1340 | Boolean vt100_graphics; |
|---|
| 1341 | Boolean utf8_inparse; |
|---|
| 1342 | int utf8_mode; |
|---|
| 1343 | int max_combining; |
|---|
| 1344 | Boolean utf8_latin1; |
|---|
| 1345 | Boolean utf8_title; |
|---|
| 1346 | int latin9_mode; |
|---|
| 1347 | int unicode_font; |
|---|
| 1348 | int utf_count; |
|---|
| 1349 | IChar utf_char; |
|---|
| 1350 | int last_written_col; |
|---|
| 1351 | int last_written_row; |
|---|
| 1352 | XChar2b *draw_buf; |
|---|
| 1353 | Cardinal draw_len; |
|---|
| 1354 | #endif |
|---|
| 1355 | #if OPT_BROKEN_OSC |
|---|
| 1356 | Boolean brokenLinuxOSC; |
|---|
| 1357 | #endif |
|---|
| 1358 | #if OPT_BROKEN_ST |
|---|
| 1359 | Boolean brokenStringTerm; |
|---|
| 1360 | #endif |
|---|
| 1361 | #if OPT_C1_PRINT || OPT_WIDE_CHARS |
|---|
| 1362 | Boolean c1_printable; |
|---|
| 1363 | #endif |
|---|
| 1364 | int border; |
|---|
| 1365 | int scrollBarBorder; |
|---|
| 1366 | unsigned long event_mask; |
|---|
| 1367 | unsigned short send_mouse_pos; |
|---|
| 1368 | |
|---|
| 1369 | Boolean send_focus_pos; |
|---|
| 1370 | Boolean quiet_grab; |
|---|
| 1371 | #if OPT_PASTE64 |
|---|
| 1372 | int base64_paste; |
|---|
| 1373 | int base64_final; |
|---|
| 1374 | |
|---|
| 1375 | |
|---|
| 1376 | |
|---|
| 1377 | |
|---|
| 1378 | int base64_accu; |
|---|
| 1379 | int base64_count; |
|---|
| 1380 | int base64_pad; |
|---|
| 1381 | #endif |
|---|
| 1382 | #if OPT_READLINE |
|---|
| 1383 | unsigned click1_moves; |
|---|
| 1384 | unsigned paste_moves; |
|---|
| 1385 | unsigned dclick3_deletes; |
|---|
| 1386 | unsigned paste_brackets; |
|---|
| 1387 | unsigned paste_quotes; |
|---|
| 1388 | unsigned paste_literal_nl; |
|---|
| 1389 | #endif |
|---|
| 1390 | #if OPT_DEC_LOCATOR |
|---|
| 1391 | Boolean locator_reset; |
|---|
| 1392 | Boolean locator_pixels; |
|---|
| 1393 | |
|---|
| 1394 | unsigned short locator_events; |
|---|
| 1395 | Boolean loc_filter; |
|---|
| 1396 | int loc_filter_top; |
|---|
| 1397 | int loc_filter_left; |
|---|
| 1398 | int loc_filter_bottom; |
|---|
| 1399 | int loc_filter_right; |
|---|
| 1400 | #endif |
|---|
| 1401 | int mouse_button; |
|---|
| 1402 | int mouse_row; |
|---|
| 1403 | int mouse_col; |
|---|
| 1404 | int select; |
|---|
| 1405 | Boolean bellOnReset; |
|---|
| 1406 | Boolean visualbell; |
|---|
| 1407 | Boolean poponbell; |
|---|
| 1408 | Boolean allowSendEvents; |
|---|
| 1409 | Boolean allowTitleOps; |
|---|
| 1410 | Boolean allowWindowOps; |
|---|
| 1411 | Boolean allowSendEvent0; |
|---|
| 1412 | Boolean allowTitleOp0; |
|---|
| 1413 | Boolean allowWindowOp0; |
|---|
| 1414 | Boolean awaitInput; |
|---|
| 1415 | Boolean grabbedKbd; |
|---|
| 1416 | #ifdef ALLOWLOGGING |
|---|
| 1417 | int logging; |
|---|
| 1418 | int logfd; |
|---|
| 1419 | char *logfile; |
|---|
| 1420 | Char *logstart; |
|---|
| 1421 | #endif |
|---|
| 1422 | int inhibit; |
|---|
| 1423 | |
|---|
| 1424 | |
|---|
| 1425 | Boolean Vshow; |
|---|
| 1426 | VTwin fullVwin; |
|---|
| 1427 | #ifndef NO_ACTIVE_ICON |
|---|
| 1428 | VTwin iconVwin; |
|---|
| 1429 | VTwin *whichVwin; |
|---|
| 1430 | #endif |
|---|
| 1431 | |
|---|
| 1432 | int pointer_mode; |
|---|
| 1433 | Boolean hide_pointer; |
|---|
| 1434 | Cursor pointer_cursor; |
|---|
| 1435 | Cursor hidden_cursor; |
|---|
| 1436 | |
|---|
| 1437 | String answer_back; |
|---|
| 1438 | String printer_command; |
|---|
| 1439 | Boolean printer_autoclose; |
|---|
| 1440 | Boolean printer_extent; |
|---|
| 1441 | Boolean printer_formfeed; |
|---|
| 1442 | int printer_controlmode; |
|---|
| 1443 | int print_attributes; |
|---|
| 1444 | |
|---|
| 1445 | Boolean fnt_prop; |
|---|
| 1446 | Boolean fnt_boxes; |
|---|
| 1447 | #if OPT_BOX_CHARS |
|---|
| 1448 | Boolean force_box_chars; |
|---|
| 1449 | Boolean force_all_chars; |
|---|
| 1450 | #endif |
|---|
| 1451 | Dimension fnt_wide; |
|---|
| 1452 | Dimension fnt_high; |
|---|
| 1453 | XTermFonts fnts[fMAX]; |
|---|
| 1454 | Boolean free_bold_box; |
|---|
| 1455 | #ifndef NO_ACTIVE_ICON |
|---|
| 1456 | XTermFonts fnt_icon; |
|---|
| 1457 | #endif |
|---|
| 1458 | int enbolden; |
|---|
| 1459 | XPoint *box; |
|---|
| 1460 | |
|---|
| 1461 | int cursor_state; |
|---|
| 1462 | int cursor_busy; |
|---|
| 1463 | #if OPT_BLINK_CURS |
|---|
| 1464 | Boolean cursor_blink; |
|---|
| 1465 | Boolean cursor_blink_res; |
|---|
| 1466 | Boolean cursor_blink_esc; |
|---|
| 1467 | #endif |
|---|
| 1468 | #if OPT_BLINK_TEXT |
|---|
| 1469 | Boolean blink_as_bold; |
|---|
| 1470 | #endif |
|---|
| 1471 | #if OPT_BLINK_CURS || OPT_BLINK_TEXT |
|---|
| 1472 | int blink_state; |
|---|
| 1473 | int blink_on; |
|---|
| 1474 | int blink_off; |
|---|
| 1475 | XtIntervalId blink_timer; |
|---|
| 1476 | #endif |
|---|
| 1477 | #if OPT_ZICONBEEP |
|---|
| 1478 | Boolean zIconBeep_flagged; |
|---|
| 1479 | #endif |
|---|
| 1480 | int cursor_GC; |
|---|
| 1481 | int cursor_set; |
|---|
| 1482 | CELL cursorp; |
|---|
| 1483 | int cur_col; |
|---|
| 1484 | int cur_row; |
|---|
| 1485 | int max_col; |
|---|
| 1486 | int max_row; |
|---|
| 1487 | int top_marg; |
|---|
| 1488 | int bot_marg; |
|---|
| 1489 | Widget scrollWidget; |
|---|
| 1490 | |
|---|
| 1491 | |
|---|
| 1492 | |
|---|
| 1493 | |
|---|
| 1494 | int topline; |
|---|
| 1495 | int savedlines; |
|---|
| 1496 | int savelines; |
|---|
| 1497 | int scroll_amt; |
|---|
| 1498 | int refresh_amt; |
|---|
| 1499 | |
|---|
| 1500 | |
|---|
| 1501 | |
|---|
| 1502 | ScrnBuf visbuf; |
|---|
| 1503 | |
|---|
| 1504 | |
|---|
| 1505 | |
|---|
| 1506 | |
|---|
| 1507 | ScrnBuf allbuf; |
|---|
| 1508 | |
|---|
| 1509 | Char *sbuf_address; |
|---|
| 1510 | Boolean is_running; |
|---|
| 1511 | |
|---|
| 1512 | |
|---|
| 1513 | |
|---|
| 1514 | ScrnBuf altbuf; |
|---|
| 1515 | Char *abuf_address; |
|---|
| 1516 | Boolean alternate; |
|---|
| 1517 | |
|---|
| 1518 | |
|---|
| 1519 | |
|---|
| 1520 | Char **save_ptr; |
|---|
| 1521 | size_t save_len; |
|---|
| 1522 | |
|---|
| 1523 | int scrolllines; |
|---|
| 1524 | Boolean scrollttyoutput; |
|---|
| 1525 | Boolean scrollkey; |
|---|
| 1526 | Boolean cursor_moved; |
|---|
| 1527 | |
|---|
| 1528 | unsigned short do_wrap; |
|---|
| 1529 | |
|---|
| 1530 | |
|---|
| 1531 | int incopy; |
|---|
| 1532 | |
|---|
| 1533 | |
|---|
| 1534 | int copy_src_x; |
|---|
| 1535 | int copy_src_y; |
|---|
| 1536 | unsigned int copy_width; |
|---|
| 1537 | unsigned int copy_height; |
|---|
| 1538 | int copy_dest_x; |
|---|
| 1539 | int copy_dest_y; |
|---|
| 1540 | |
|---|
| 1541 | Boolean c132; |
|---|
| 1542 | Boolean curses; |
|---|
| 1543 | Boolean hp_ll_bc; |
|---|
| 1544 | Boolean marginbell; |
|---|
| 1545 | int nmarginbell; |
|---|
| 1546 | int bellarmed; |
|---|
| 1547 | Boolean multiscroll; |
|---|
| 1548 | int scrolls; |
|---|
| 1549 | |
|---|
| 1550 | SavedCursor sc[SAVED_CURSORS]; |
|---|
| 1551 | unsigned char save_modes[DP_LAST]; |
|---|
| 1552 | |
|---|
| 1553 | |
|---|
| 1554 | String keyboard_dialect; |
|---|
| 1555 | char gsets[4]; |
|---|
| 1556 | Char curgl; |
|---|
| 1557 | Char curgr; |
|---|
| 1558 | Char curss; |
|---|
| 1559 | String term_id; |
|---|
| 1560 | int terminal_id; |
|---|
| 1561 | int vtXX_level; |
|---|
| 1562 | int ansi_level; |
|---|
| 1563 | int protected_mode; |
|---|
| 1564 | Boolean always_bold_mode; |
|---|
| 1565 | Boolean always_highlight; |
|---|
| 1566 | Boolean bold_mode; |
|---|
| 1567 | Boolean delete_is_del; |
|---|
| 1568 | Boolean jumpscroll; |
|---|
| 1569 | Boolean old_fkeys; |
|---|
| 1570 | Boolean underline; |
|---|
| 1571 | |
|---|
| 1572 | #if OPT_MAXIMIZE |
|---|
| 1573 | Boolean restore_data; |
|---|
| 1574 | int restore_x; |
|---|
| 1575 | int restore_y; |
|---|
| 1576 | unsigned restore_width; |
|---|
| 1577 | unsigned restore_height; |
|---|
| 1578 | #endif |
|---|
| 1579 | |
|---|
| 1580 | #if OPT_VT52_MODE |
|---|
| 1581 | int vt52_save_level; |
|---|
| 1582 | char vt52_save_curgl; |
|---|
| 1583 | char vt52_save_curgr; |
|---|
| 1584 | char vt52_save_curss; |
|---|
| 1585 | char vt52_save_gsets[4]; |
|---|
| 1586 | #endif |
|---|
| 1587 | |
|---|
| 1588 | #if OPT_XMC_GLITCH |
|---|
| 1589 | unsigned xmc_glitch; |
|---|
| 1590 | int xmc_attributes; |
|---|
| 1591 | Boolean xmc_inline; |
|---|
| 1592 | Boolean move_sgr_ok; |
|---|
| 1593 | #endif |
|---|
| 1594 | |
|---|
| 1595 | |
|---|
| 1596 | |
|---|
| 1597 | |
|---|
| 1598 | int visualBellDelay; |
|---|
| 1599 | int bellSuppressTime; |
|---|
| 1600 | Boolean bellInProgress; |
|---|
| 1601 | Boolean bellIsUrgent; |
|---|
| 1602 | |
|---|
| 1603 | |
|---|
| 1604 | |
|---|
| 1605 | Boolean selectToClipboard; |
|---|
| 1606 | String *mappedSelect; |
|---|
| 1607 | |
|---|
| 1608 | Boolean waitingForTrackInfo; |
|---|
| 1609 | int numberOfClicks; |
|---|
| 1610 | int maxClicks; |
|---|
| 1611 | int multiClickTime; |
|---|
| 1612 | SelectUnit selectUnit; |
|---|
| 1613 | SelectUnit selectMap[NSELECTUNITS]; |
|---|
| 1614 | String onClick[NSELECTUNITS + 1]; |
|---|
| 1615 | |
|---|
| 1616 | char *charClass; |
|---|
| 1617 | Boolean cutNewline; |
|---|
| 1618 | Boolean cutToBeginningOfLine; |
|---|
| 1619 | Boolean highlight_selection; |
|---|
| 1620 | Boolean trim_selection; |
|---|
| 1621 | Boolean i18nSelections; |
|---|
| 1622 | Boolean brokenSelections; |
|---|
| 1623 | Boolean keepSelection; |
|---|
| 1624 | Boolean replyToEmacs; |
|---|
| 1625 | Char *selection_data; |
|---|
| 1626 | int selection_size; |
|---|
| 1627 | int selection_length; |
|---|
| 1628 | EventMode eventMode; |
|---|
| 1629 | Time selection_time; |
|---|
| 1630 | Time lastButtonUpTime; |
|---|
| 1631 | unsigned lastButton; |
|---|
| 1632 | |
|---|
| 1633 | CELL rawPos; |
|---|
| 1634 | CELL startRaw; |
|---|
| 1635 | CELL endRaw; |
|---|
| 1636 | CELL startSel; |
|---|
| 1637 | CELL endSel; |
|---|
| 1638 | CELL startH; |
|---|
| 1639 | CELL endH; |
|---|
| 1640 | CELL saveStartW; |
|---|
| 1641 | CELL startExt; |
|---|
| 1642 | CELL endExt; |
|---|
| 1643 | CELL saveStartR; |
|---|
| 1644 | CELL saveEndR; |
|---|
| 1645 | int startHCoord, endHCoord; |
|---|
| 1646 | int firstValidRow; |
|---|
| 1647 | int lastValidRow; |
|---|
| 1648 | |
|---|
| 1649 | Atom* selection_atoms; |
|---|
| 1650 | Cardinal sel_atoms_size; |
|---|
| 1651 | Cardinal selection_count; |
|---|
| 1652 | #if OPT_SELECT_REGEX |
|---|
| 1653 | char * selectExpr[NSELECTUNITS]; |
|---|
| 1654 | #endif |
|---|
| 1655 | |
|---|
| 1656 | |
|---|
| 1657 | |
|---|
| 1658 | Boolean input_eight_bits; |
|---|
| 1659 | Boolean output_eight_bits; |
|---|
| 1660 | Boolean control_eight_bits; |
|---|
| 1661 | Boolean backarrow_key; |
|---|
| 1662 | Boolean alt_is_not_meta; |
|---|
| 1663 | Boolean alt_sends_esc; |
|---|
| 1664 | Boolean meta_sends_esc; |
|---|
| 1665 | |
|---|
| 1666 | |
|---|
| 1667 | |
|---|
| 1668 | Pixmap menu_item_bitmap; |
|---|
| 1669 | String initial_font; |
|---|
| 1670 | String menu_font_names[NMENUFONTS][fMAX]; |
|---|
| 1671 | #define MenuFontName(n) menu_font_names[n][fNorm] |
|---|
| 1672 | long menu_font_sizes[NMENUFONTS]; |
|---|
| 1673 | int menu_font_number; |
|---|
| 1674 | #if OPT_CLIP_BOLD |
|---|
| 1675 | Boolean use_clipping; |
|---|
| 1676 | #endif |
|---|
| 1677 | void * main_cgs_cache; |
|---|
| 1678 | #ifndef NO_ACTIVE_ICON |
|---|
| 1679 | void * icon_cgs_cache; |
|---|
| 1680 | #endif |
|---|
| 1681 | #if OPT_RENDERFONT |
|---|
| 1682 | XftFont * renderFontNorm[NMENUFONTS]; |
|---|
| 1683 | XftFont * renderFontBold[NMENUFONTS]; |
|---|
| 1684 | XftFont * renderFontItal[NMENUFONTS]; |
|---|
| 1685 | XftFont * renderWideNorm[NMENUFONTS]; |
|---|
| 1686 | XftFont * renderWideBold[NMENUFONTS]; |
|---|
| 1687 | XftFont * renderWideItal[NMENUFONTS]; |
|---|
| 1688 | XftDraw * renderDraw; |
|---|
| 1689 | #endif |
|---|
| 1690 | #if OPT_INPUT_METHOD |
|---|
| 1691 | XIM xim; |
|---|
| 1692 | XFontSet fs; |
|---|
| 1693 | int fs_ascent; |
|---|
| 1694 | #endif |
|---|
| 1695 | XIC xic; |
|---|
| 1696 | #if OPT_DABBREV |
|---|
| 1697 | int dabbrev_working; |
|---|
| 1698 | unsigned char dabbrev_erase_char; |
|---|
| 1699 | #endif |
|---|
| 1700 | char tcapbuf[TERMCAP_SIZE]; |
|---|
| 1701 | #if OPT_TCAP_FKEYS |
|---|
| 1702 | char ** tcap_fkeys; |
|---|
| 1703 | char tcap_area[TERMCAP_SIZE]; |
|---|
| 1704 | #endif |
|---|
| 1705 | } TScreen; |
|---|
| 1706 | |
|---|
| 1707 | typedef struct _TekPart { |
|---|
| 1708 | XFontStruct * Tfont[TEKNUMFONTS]; |
|---|
| 1709 | int tobaseline[TEKNUMFONTS]; |
|---|
| 1710 | char * initial_font; |
|---|
| 1711 | char * gin_terminator_str; |
|---|
| 1712 | #if OPT_TOOLBAR |
|---|
| 1713 | TbInfo tb_info; |
|---|
| 1714 | #endif |
|---|
| 1715 | } TekPart; |
|---|
| 1716 | |
|---|
| 1717 | |
|---|
| 1718 | typedef struct _TekScreen { |
|---|
| 1719 | GC TnormalGC; |
|---|
| 1720 | GC TcursorGC; |
|---|
| 1721 | |
|---|
| 1722 | Boolean waitrefresh; |
|---|
| 1723 | TKwin fullTwin; |
|---|
| 1724 | #ifndef NO_ACTIVE_ICON |
|---|
| 1725 | TKwin iconTwin; |
|---|
| 1726 | TKwin *whichTwin; |
|---|
| 1727 | #endif |
|---|
| 1728 | |
|---|
| 1729 | Cursor arrow; |
|---|
| 1730 | GC linepat[TEKNUMLINES]; |
|---|
| 1731 | int cur_X; |
|---|
| 1732 | int cur_Y; |
|---|
| 1733 | Tmodes cur; |
|---|
| 1734 | Tmodes page; |
|---|
| 1735 | int margin; |
|---|
| 1736 | int pen; |
|---|
| 1737 | char *TekGIN; |
|---|
| 1738 | int gin_terminator; |
|---|
| 1739 | char tcapbuf[TERMCAP_SIZE]; |
|---|
| 1740 | } TekScreen; |
|---|
| 1741 | |
|---|
| 1742 | #if OPT_READLINE |
|---|
| 1743 | #define SCREEN_FLAG(screenp,f) (1&(screenp)->f) |
|---|
| 1744 | #define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) |
|---|
| 1745 | #define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= ~1L) |
|---|
| 1746 | #define SCREEN_FLAG_save(screenp,f) \ |
|---|
| 1747 | ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) |
|---|
| 1748 | #define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) |
|---|
| 1749 | #else |
|---|
| 1750 | #define SCREEN_FLAG(screenp,f) (0) |
|---|
| 1751 | #endif |
|---|
| 1752 | |
|---|
| 1753 | |
|---|
| 1754 | #define INWINDOW 01 |
|---|
| 1755 | #define FOCUS 02 |
|---|
| 1756 | |
|---|
| 1757 | #define MULTICLICKTIME 250 |
|---|
| 1758 | |
|---|
| 1759 | typedef enum { |
|---|
| 1760 | keyboardIsLegacy, |
|---|
| 1761 | keyboardIsDefault, |
|---|
| 1762 | keyboardIsHP, |
|---|
| 1763 | keyboardIsSCO, |
|---|
| 1764 | keyboardIsSun, |
|---|
| 1765 | keyboardIsTermcap, |
|---|
| 1766 | keyboardIsVT220 |
|---|
| 1767 | } xtermKeyboardType; |
|---|
| 1768 | |
|---|
| 1769 | typedef enum { |
|---|
| 1770 | pNever = 0, |
|---|
| 1771 | pNoMouse = 1, |
|---|
| 1772 | pAlways = 2 |
|---|
| 1773 | } pointerModeTypes; |
|---|
| 1774 | |
|---|
| 1775 | typedef enum { |
|---|
| 1776 | uFalse = 0, |
|---|
| 1777 | uTrue = 1, |
|---|
| 1778 | uAlways = 2, |
|---|
| 1779 | uDefault = 3 |
|---|
| 1780 | } utf8ModeTypes; |
|---|
| 1781 | |
|---|
| 1782 | #if OPT_HP_FUNC_KEYS |
|---|
| 1783 | #define NAME_HP_KT " hp" |
|---|
| 1784 | #else |
|---|
| 1785 | #define NAME_HP_KT |
|---|
| 1786 | #endif |
|---|
| 1787 | |
|---|
| 1788 | #if OPT_SCO_FUNC_KEYS |
|---|
| 1789 | #define NAME_SCO_KT " sco" |
|---|
| 1790 | #else |
|---|
| 1791 | #define NAME_SCO_KT |
|---|
| 1792 | #endif |
|---|
| 1793 | |
|---|
| 1794 | #if OPT_SUN_FUNC_KEYS |
|---|
| 1795 | #define NAME_SUN_KT " sun" |
|---|
| 1796 | #else |
|---|
| 1797 | #define NAME_SUN_KT |
|---|
| 1798 | #endif |
|---|
| 1799 | |
|---|
| 1800 | #if OPT_SUNPC_KBD |
|---|
| 1801 | #define NAME_VT220_KT " vt220" |
|---|
| 1802 | #else |
|---|
| 1803 | #define NAME_VT220_KT |
|---|
| 1804 | #endif |
|---|
| 1805 | |
|---|
| 1806 | #if OPT_TCAP_FKEYS |
|---|
| 1807 | #define NAME_TCAP_KT " tcap" |
|---|
| 1808 | #else |
|---|
| 1809 | #define NAME_TCAP_KT |
|---|
| 1810 | #endif |
|---|
| 1811 | |
|---|
| 1812 | #define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT |
|---|
| 1813 | |
|---|
| 1814 | #if OPT_TRACE |
|---|
| 1815 | extern const char * visibleKeyboardType(xtermKeyboardType); |
|---|
| 1816 | #endif |
|---|
| 1817 | |
|---|
| 1818 | typedef struct |
|---|
| 1819 | { |
|---|
| 1820 | int cursor_keys; |
|---|
| 1821 | int function_keys; |
|---|
| 1822 | int keypad_keys; |
|---|
| 1823 | int other_keys; |
|---|
| 1824 | int string_keys; |
|---|
| 1825 | } TModify; |
|---|
| 1826 | |
|---|
| 1827 | typedef struct |
|---|
| 1828 | { |
|---|
| 1829 | xtermKeyboardType type; |
|---|
| 1830 | unsigned flags; |
|---|
| 1831 | char *shell_translations; |
|---|
| 1832 | char *xterm_translations; |
|---|
| 1833 | char *extra_translations; |
|---|
| 1834 | #if OPT_INITIAL_ERASE |
|---|
| 1835 | int reset_DECBKM; |
|---|
| 1836 | #endif |
|---|
| 1837 | #if OPT_MOD_FKEYS |
|---|
| 1838 | TModify modify_now; |
|---|
| 1839 | TModify modify_1st; |
|---|
| 1840 | int format_keys; |
|---|
| 1841 | #endif |
|---|
| 1842 | } TKeyboard; |
|---|
| 1843 | |
|---|
| 1844 | typedef struct { |
|---|
| 1845 | char *f_n; |
|---|
| 1846 | char *f_b; |
|---|
| 1847 | #if OPT_WIDE_CHARS |
|---|
| 1848 | char *f_w; |
|---|
| 1849 | char *f_wb; |
|---|
| 1850 | #endif |
|---|
| 1851 | } VTFontNames; |
|---|
| 1852 | |
|---|
| 1853 | typedef struct _Misc { |
|---|
| 1854 | VTFontNames default_font; |
|---|
| 1855 | char *geo_metry; |
|---|
| 1856 | char *T_geometry; |
|---|
| 1857 | #if OPT_WIDE_CHARS |
|---|
| 1858 | Boolean cjk_width; |
|---|
| 1859 | Boolean mk_width; |
|---|
| 1860 | int mk_samplesize; |
|---|
| 1861 | int mk_samplepass; |
|---|
| 1862 | #endif |
|---|
| 1863 | #if OPT_LUIT_PROG |
|---|
| 1864 | Boolean callfilter; |
|---|
| 1865 | Boolean use_encoding; |
|---|
| 1866 | char *locale_str; |
|---|
| 1867 | char *localefilter; |
|---|
| 1868 | #endif |
|---|
| 1869 | #if OPT_INPUT_METHOD |
|---|
| 1870 | char *f_x; |
|---|
| 1871 | #endif |
|---|
| 1872 | int limit_resize; |
|---|
| 1873 | #ifdef ALLOWLOGGING |
|---|
| 1874 | Boolean log_on; |
|---|
| 1875 | #endif |
|---|
| 1876 | Boolean login_shell; |
|---|
| 1877 | Boolean re_verse; |
|---|
| 1878 | Boolean re_verse0; |
|---|
| 1879 | XtGravity resizeGravity; |
|---|
| 1880 | Boolean reverseWrap; |
|---|
| 1881 | Boolean autoWrap; |
|---|
| 1882 | Boolean logInhibit; |
|---|
| 1883 | Boolean signalInhibit; |
|---|
| 1884 | #if OPT_TEK4014 |
|---|
| 1885 | Boolean tekInhibit; |
|---|
| 1886 | Boolean tekSmall; |
|---|
| 1887 | Boolean TekEmu; |
|---|
| 1888 | Boolean Tshow; |
|---|
| 1889 | #endif |
|---|
| 1890 | Boolean scrollbar; |
|---|
| 1891 | #ifdef SCROLLBAR_RIGHT |
|---|
| 1892 | Boolean useRight; |
|---|
| 1893 | #endif |
|---|
| 1894 | Boolean titeInhibit; |
|---|
| 1895 | Boolean tiXtraScroll; |
|---|
| 1896 | Boolean appcursorDefault; |
|---|
| 1897 | Boolean appkeypadDefault; |
|---|
| 1898 | #if OPT_INPUT_METHOD |
|---|
| 1899 | char* input_method; |
|---|
| 1900 | char* preedit_type; |
|---|
| 1901 | Boolean open_im; |
|---|
| 1902 | Boolean cannot_im; |
|---|
| 1903 | #endif |
|---|
| 1904 | Boolean dynamicColors; |
|---|
| 1905 | Boolean shared_ic; |
|---|
| 1906 | #ifndef NO_ACTIVE_ICON |
|---|
| 1907 | Boolean active_icon; |
|---|
| 1908 | unsigned icon_border_width; |
|---|
| 1909 | Pixel icon_border_pixel; |
|---|
| 1910 | #endif |
|---|
| 1911 | #if OPT_DEC_SOFTFONT |
|---|
| 1912 | Boolean font_loadable; |
|---|
| 1913 | #endif |
|---|
| 1914 | #if OPT_SHIFT_FONTS |
|---|
| 1915 | Boolean shift_fonts; |
|---|
| 1916 | #endif |
|---|
| 1917 | #if OPT_SUNPC_KBD |
|---|
| 1918 | int ctrl_fkeys; |
|---|
| 1919 | #endif |
|---|
| 1920 | #if OPT_NUM_LOCK |
|---|
| 1921 | Boolean real_NumLock; |
|---|
| 1922 | Boolean alwaysUseMods; |
|---|
| 1923 | unsigned long num_lock; |
|---|
| 1924 | unsigned long alt_mods; |
|---|
| 1925 | unsigned long meta_mods; |
|---|
| 1926 | unsigned long other_mods; |
|---|
| 1927 | #endif |
|---|
| 1928 | #if OPT_RENDERFONT |
|---|
| 1929 | char *face_name; |
|---|
| 1930 | char *face_wide_name; |
|---|
| 1931 | float face_size[NMENUFONTS]; |
|---|
| 1932 | Boolean render_font; |
|---|
| 1933 | #endif |
|---|
| 1934 | } Misc; |
|---|
| 1935 | |
|---|
| 1936 | typedef struct {int foo;} XtermClassPart, TekClassPart; |
|---|
| 1937 | |
|---|
| 1938 | typedef struct _XtermClassRec { |
|---|
| 1939 | CoreClassPart core_class; |
|---|
| 1940 | XtermClassPart xterm_class; |
|---|
| 1941 | } XtermClassRec; |
|---|
| 1942 | |
|---|
| 1943 | extern WidgetClass xtermWidgetClass; |
|---|
| 1944 | |
|---|
| 1945 | #define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass) |
|---|
| 1946 | |
|---|
| 1947 | #if OPT_TEK4014 |
|---|
| 1948 | typedef struct _TekClassRec { |
|---|
| 1949 | CoreClassPart core_class; |
|---|
| 1950 | TekClassPart tek_class; |
|---|
| 1951 | } TekClassRec; |
|---|
| 1952 | |
|---|
| 1953 | extern WidgetClass tekWidgetClass; |
|---|
| 1954 | |
|---|
| 1955 | #define IsTekWidget(w) (XtClass(w) == tekWidgetClass) |
|---|
| 1956 | |
|---|
| 1957 | #endif |
|---|
| 1958 | |
|---|
| 1959 | |
|---|
| 1960 | #define MODE_KAM xBIT(0) |
|---|
| 1961 | #define MODE_DECKPAM xBIT(1) |
|---|
| 1962 | #define MODE_DECCKM xBIT(2) |
|---|
| 1963 | #define MODE_SRM xBIT(3) |
|---|
| 1964 | #define MODE_DECBKM xBIT(4) |
|---|
| 1965 | |
|---|
| 1966 | |
|---|
| 1967 | #define N_MARGINBELL 10 |
|---|
| 1968 | |
|---|
| 1969 | #define TAB_BITS_SHIFT 5 |
|---|
| 1970 | #define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) |
|---|
| 1971 | #define TAB_ARRAY_SIZE (1024 / TAB_BITS_WIDTH) |
|---|
| 1972 | #define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) |
|---|
| 1973 | |
|---|
| 1974 | typedef unsigned Tabs [TAB_ARRAY_SIZE]; |
|---|
| 1975 | |
|---|
| 1976 | typedef struct _XtermWidgetRec { |
|---|
| 1977 | CorePart core; |
|---|
| 1978 | XSizeHints hints; |
|---|
| 1979 | Bool init_menu; |
|---|
| 1980 | TKeyboard keyboard; |
|---|
| 1981 | TScreen screen; |
|---|
| 1982 | unsigned flags; |
|---|
| 1983 | int cur_foreground; |
|---|
| 1984 | int cur_background; |
|---|
| 1985 | Pixel dft_foreground; |
|---|
| 1986 | Pixel dft_background; |
|---|
| 1987 | #if OPT_ISO_COLORS |
|---|
| 1988 | int sgr_foreground; |
|---|
| 1989 | int sgr_background; |
|---|
| 1990 | Boolean sgr_extended; |
|---|
| 1991 | #endif |
|---|
| 1992 | #if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS |
|---|
| 1993 | int num_ptrs; |
|---|
| 1994 | #endif |
|---|
| 1995 | unsigned initflags; |
|---|
| 1996 | Tabs tabs; |
|---|
| 1997 | Misc misc; |
|---|
| 1998 | } XtermWidgetRec, *XtermWidget; |
|---|
| 1999 | |
|---|
| 2000 | #if OPT_TEK4014 |
|---|
| 2001 | typedef struct _TekWidgetRec { |
|---|
| 2002 | CorePart core; |
|---|
| 2003 | TekPart tek; |
|---|
| 2004 | TekScreen screen; |
|---|
| 2005 | Bool init_menu; |
|---|
| 2006 | XSizeHints hints; |
|---|
| 2007 | } TekWidgetRec, *TekWidget; |
|---|
| 2008 | #endif |
|---|
| 2009 | |
|---|
| 2010 | |
|---|
| 2011 | |
|---|
| 2012 | |
|---|
| 2013 | |
|---|
| 2014 | |
|---|
| 2015 | |
|---|
| 2016 | |
|---|
| 2017 | |
|---|
| 2018 | |
|---|
| 2019 | #define AttrBIT(n) xBIT(n) |
|---|
| 2020 | #define DrawBIT(n) xBIT(n + 8) |
|---|
| 2021 | #define MiscBIT(n) xBIT(n + 16) |
|---|
| 2022 | |
|---|
| 2023 | |
|---|
| 2024 | #define INVERSE AttrBIT(0) |
|---|
| 2025 | #define UNDERLINE AttrBIT(1) |
|---|
| 2026 | #define BOLD AttrBIT(2) |
|---|
| 2027 | #define BLINK AttrBIT(3) |
|---|
| 2028 | |
|---|
| 2029 | #define BG_COLOR AttrBIT(4) |
|---|
| 2030 | #define FG_COLOR AttrBIT(5) |
|---|
| 2031 | |
|---|
| 2032 | |
|---|
| 2033 | #define PROTECTED AttrBIT(6) |
|---|
| 2034 | #define CHARDRAWN AttrBIT(7) |
|---|
| 2035 | |
|---|
| 2036 | |
|---|
| 2037 | |
|---|
| 2038 | |
|---|
| 2039 | |
|---|
| 2040 | #define NOBACKGROUND DrawBIT(0) |
|---|
| 2041 | #define NOTRANSLATION DrawBIT(1) |
|---|
| 2042 | #define DOUBLEWFONT DrawBIT(2) |
|---|
| 2043 | #define DOUBLEHFONT DrawBIT(3) |
|---|
| 2044 | #define CHARBYCHAR DrawBIT(4) |
|---|
| 2045 | |
|---|
| 2046 | |
|---|
| 2047 | #define NORESOLUTION DrawBIT(5) |
|---|
| 2048 | |
|---|
| 2049 | |
|---|
| 2050 | |
|---|
| 2051 | |
|---|
| 2052 | #define WRAPAROUND MiscBIT(0) |
|---|
| 2053 | #define REVERSEWRAP MiscBIT(1) |
|---|
| 2054 | #define REVERSE_VIDEO MiscBIT(2) |
|---|
| 2055 | #define LINEFEED MiscBIT(3) |
|---|
| 2056 | #define ORIGIN MiscBIT(4) |
|---|
| 2057 | #define INSERT MiscBIT(5) |
|---|
| 2058 | #define SMOOTHSCROLL MiscBIT(6) |
|---|
| 2059 | #define IN132COLUMNS MiscBIT(7) |
|---|
| 2060 | #define INVISIBLE MiscBIT(8) |
|---|
| 2061 | #define NATIONAL MiscBIT(9) |
|---|
| 2062 | |
|---|
| 2063 | |
|---|
| 2064 | |
|---|
| 2065 | |
|---|
| 2066 | |
|---|
| 2067 | #define SGR_MASK (BOLD | BLINK | UNDERLINE | INVERSE) |
|---|
| 2068 | |
|---|
| 2069 | |
|---|
| 2070 | #define ATTRIBUTES (SGR_MASK | BG_COLOR | FG_COLOR | INVISIBLE | PROTECTED) |
|---|
| 2071 | |
|---|
| 2072 | |
|---|
| 2073 | #define DRAWX_MASK (ATTRIBUTES | CHARDRAWN) |
|---|
| 2074 | |
|---|
| 2075 | #if OPT_BLINK_TEXT |
|---|
| 2076 | #define BOLDATTR(screen) (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) |
|---|
| 2077 | #else |
|---|
| 2078 | #define BOLDATTR(screen) (BOLD | BLINK) |
|---|
| 2079 | #endif |
|---|
| 2080 | |
|---|
| 2081 | |
|---|
| 2082 | |
|---|
| 2083 | |
|---|
| 2084 | #define LINEWRAPPED 0x01 |
|---|
| 2085 | |
|---|
| 2086 | |
|---|
| 2087 | |
|---|
| 2088 | |
|---|
| 2089 | |
|---|
| 2090 | |
|---|
| 2091 | #if OPT_ZICONBEEP || OPT_TOOLBAR |
|---|
| 2092 | #define HANDLE_STRUCT_NOTIFY 1 |
|---|
| 2093 | #else |
|---|
| 2094 | #define HANDLE_STRUCT_NOTIFY 0 |
|---|
| 2095 | #endif |
|---|
| 2096 | |
|---|
| 2097 | |
|---|
| 2098 | |
|---|
| 2099 | |
|---|
| 2100 | |
|---|
| 2101 | |
|---|
| 2102 | |
|---|
| 2103 | |
|---|
| 2104 | |
|---|
| 2105 | #define OFF_PROTECT 0 |
|---|
| 2106 | #define DEC_PROTECT 1 |
|---|
| 2107 | #define ISO_PROTECT 2 |
|---|
| 2108 | |
|---|
| 2109 | #define TScreenOf(xw) (&(xw)->screen) |
|---|
| 2110 | #define TekScreenOf(tw) (&(tw)->screen) |
|---|
| 2111 | |
|---|
| 2112 | #ifdef SCROLLBAR_RIGHT |
|---|
| 2113 | #define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) |
|---|
| 2114 | #else |
|---|
| 2115 | #define OriginX(screen) (ScrollbarWidth(screen) + screen->border) |
|---|
| 2116 | #endif |
|---|
| 2117 | |
|---|
| 2118 | #define OriginY(screen) (screen->border) |
|---|
| 2119 | |
|---|
| 2120 | #define CursorMoved(screen) \ |
|---|
| 2121 | ((screen)->cursor_moved || \ |
|---|
| 2122 | ((screen)->cursorp.col != (screen)->cur_col || \ |
|---|
| 2123 | (screen)->cursorp.row != (screen)->cur_row)) |
|---|
| 2124 | |
|---|
| 2125 | #define CursorX(screen,col) ((col) * FontWidth(screen) + OriginX(screen)) |
|---|
| 2126 | #define CursorY(screen,row) ((INX2ROW(screen, row) * FontHeight(screen)) \ |
|---|
| 2127 | + screen->border) |
|---|
| 2128 | |
|---|
| 2129 | |
|---|
| 2130 | |
|---|
| 2131 | |
|---|
| 2132 | #ifndef NO_ACTIVE_ICON |
|---|
| 2133 | #define IsIconWin(screen,win) ((win) == &(screen)->iconVwin) |
|---|
| 2134 | #define IsIcon(screen) (WhichVWin(screen) == &(screen)->iconVwin) |
|---|
| 2135 | #define WhichVWin(screen) ((screen)->whichVwin) |
|---|
| 2136 | #define WhichTWin(screen) ((screen)->whichTwin) |
|---|
| 2137 | |
|---|
| 2138 | #define WhichVFont(screen,name) (IsIcon(screen) ? (screen)->fnt_icon.fs \ |
|---|
| 2139 | : (screen)->name) |
|---|
| 2140 | #define FontAscent(screen) (IsIcon(screen) ? (screen)->fnt_icon.fs->ascent \ |
|---|
| 2141 | : WhichVWin(screen)->f_ascent) |
|---|
| 2142 | #define FontDescent(screen) (IsIcon(screen) ? (screen)->fnt_icon.fs->descent \ |
|---|
| 2143 | : WhichVWin(screen)->f_descent) |
|---|
| 2144 | #else |
|---|
| 2145 | |
|---|
| 2146 | #define IsIconWin(screen,win) (False) |
|---|
| 2147 | #define IsIcon(screen) (False) |
|---|
| 2148 | #define WhichVWin(screen) (&((screen)->fullVwin)) |
|---|
| 2149 | #define WhichTWin(screen) (&((screen)->fullTwin)) |
|---|
| 2150 | |
|---|
| 2151 | #define WhichVFont(screen,name) ((screen)->name) |
|---|
| 2152 | #define FontAscent(screen) WhichVWin(screen)->f_ascent |
|---|
| 2153 | #define FontDescent(screen) WhichVWin(screen)->f_descent |
|---|
| 2154 | |
|---|
| 2155 | #endif |
|---|
| 2156 | |
|---|
| 2157 | #define okFont(font) ((font) != 0 && (font)->fid != 0) |
|---|
| 2158 | |
|---|
| 2159 | |
|---|
| 2160 | |
|---|
| 2161 | |
|---|
| 2162 | #define UsingRenderFont(xw) ((xw)->misc.render_font && !IsIcon(&((xw)->screen))) |
|---|
| 2163 | |
|---|
| 2164 | |
|---|
| 2165 | |
|---|
| 2166 | |
|---|
| 2167 | #define VWindow(screen) WhichVWin(screen)->window |
|---|
| 2168 | #define VShellWindow XtWindow(SHELL_OF(term)) |
|---|
| 2169 | #define TWindow(screen) WhichTWin(screen)->window |
|---|
| 2170 | #define TShellWindow XtWindow(SHELL_OF(tekWidget)) |
|---|
| 2171 | |
|---|
| 2172 | #define Width(screen) WhichVWin(screen)->width |
|---|
| 2173 | #define Height(screen) WhichVWin(screen)->height |
|---|
| 2174 | #define FullWidth(screen) WhichVWin(screen)->fullwidth |
|---|
| 2175 | #define FullHeight(screen) WhichVWin(screen)->fullheight |
|---|
| 2176 | #define FontWidth(screen) WhichVWin(screen)->f_width |
|---|
| 2177 | #define FontHeight(screen) WhichVWin(screen)->f_height |
|---|
| 2178 | |
|---|
| 2179 | #define NormalFont(screen) WhichVFont(screen, fnts[fNorm].fs) |
|---|
| 2180 | #define BoldFont(screen) WhichVFont(screen, fnts[fBold].fs) |
|---|
| 2181 | |
|---|
| 2182 | #if OPT_WIDE_CHARS |
|---|
| 2183 | #define NormalWFont(screen) WhichVFont(screen, fnts[fWide].fs) |
|---|
| 2184 | #define BoldWFont(screen) WhichVFont(screen, fnts[fWBold].fs) |
|---|
| 2185 | #endif |
|---|
| 2186 | |
|---|
| 2187 | #define ScrollbarWidth(screen) WhichVWin(screen)->sb_info.width |
|---|
| 2188 | |
|---|
| 2189 | #define NormalGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNorm) |
|---|
| 2190 | #define ReverseGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNormReverse) |
|---|
| 2191 | #define NormalBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBold) |
|---|
| 2192 | #define ReverseBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBoldReverse) |
|---|
| 2193 | |
|---|
| 2194 | #define TWidth(screen) WhichTWin(screen)->width |
|---|
| 2195 | #define THeight(screen) WhichTWin(screen)->height |
|---|
| 2196 | #define TFullWidth(screen) WhichTWin(screen)->fullwidth |
|---|
| 2197 | #define TFullHeight(screen) WhichTWin(screen)->fullheight |
|---|
| 2198 | #define TekScale(screen) WhichTWin(screen)->tekscale |
|---|
| 2199 | |
|---|
| 2200 | #define BorderWidth(w) ((w)->core.border_width) |
|---|
| 2201 | #define BorderPixel(w) ((w)->core.border_pixel) |
|---|
| 2202 | |
|---|
| 2203 | #if OPT_TOOLBAR |
|---|
| 2204 | #define ToolbarHeight(w) ((resource.toolBar) \ |
|---|
| 2205 | ? (term->VT100_TB_INFO(menu_height) \ |
|---|
| 2206 | + term->VT100_TB_INFO(menu_border) * 2) \ |
|---|
| 2207 | : 0) |
|---|
| 2208 | #else |
|---|
| 2209 | #define ToolbarHeight(w) 0 |
|---|
| 2210 | #endif |
|---|
| 2211 | |
|---|
| 2212 | #if OPT_TEK4014 |
|---|
| 2213 | #define TEK_LINK_BLOCK_SIZE 1024 |
|---|
| 2214 | |
|---|
| 2215 | typedef struct Tek_Link |
|---|
| 2216 | { |
|---|
| 2217 | struct Tek_Link *next; |
|---|
| 2218 | |
|---|
| 2219 | unsigned short fontsize; |
|---|
| 2220 | unsigned short count; |
|---|
| 2221 | char *ptr; |
|---|
| 2222 | char data [TEK_LINK_BLOCK_SIZE]; |
|---|
| 2223 | } TekLink; |
|---|
| 2224 | #endif |
|---|
| 2225 | |
|---|
| 2226 | |
|---|
| 2227 | #define OFF 0 |
|---|
| 2228 | #define ON 1 |
|---|
| 2229 | #define BLINKED_OFF 2 |
|---|
| 2230 | #define CLEAR 0 |
|---|
| 2231 | #define TOGGLE 1 |
|---|
| 2232 | |
|---|
| 2233 | |
|---|
| 2234 | #ifdef ALLOWLOGGING |
|---|
| 2235 | #define I_LOG 0x01 |
|---|
| 2236 | #endif |
|---|
| 2237 | #define I_SIGNAL 0x02 |
|---|
| 2238 | #define I_TEK 0x04 |
|---|
| 2239 | |
|---|
| 2240 | |
|---|
| 2241 | |
|---|
| 2242 | #if OPT_TRACE |
|---|
| 2243 | #include <trace.h> |
|---|
| 2244 | #undef NDEBUG |
|---|
| 2245 | #else |
|---|
| 2246 | #ifndef NDEBUG |
|---|
| 2247 | #define NDEBUG |
|---|
| 2248 | #endif |
|---|
| 2249 | #endif |
|---|
| 2250 | |
|---|
| 2251 | #ifndef TRACE |
|---|
| 2252 | #define TRACE(p) |
|---|
| 2253 | #endif |
|---|
| 2254 | |
|---|
| 2255 | #ifndef TRACE_ARGV |
|---|
| 2256 | #define TRACE_ARGV(tag,argv) |
|---|
| 2257 | #endif |
|---|
| 2258 | |
|---|
| 2259 | #ifndef TRACE_CHILD |
|---|
| 2260 | #define TRACE_CHILD |
|---|
| 2261 | #endif |
|---|
| 2262 | |
|---|
| 2263 | #ifndef TRACE_HINTS |
|---|
| 2264 | #define TRACE_HINTS(hints) |
|---|
| 2265 | #endif |
|---|
| 2266 | |
|---|
| 2267 | #ifndef TRACE_IDS |
|---|
| 2268 | #define TRACE_IDS |
|---|
| 2269 | #endif |
|---|
| 2270 | |
|---|
| 2271 | #ifndef TRACE_OPTS |
|---|
| 2272 | #define TRACE_OPTS(opts,ress,lens) |
|---|
| 2273 | #endif |
|---|
| 2274 | |
|---|
| 2275 | #ifndef TRACE_TRANS |
|---|
| 2276 | #define TRACE_TRANS(name,w) |
|---|
| 2277 | #endif |
|---|
| 2278 | |
|---|
| 2279 | #ifndef TRACE_WM_HINTS |
|---|
| 2280 | #define TRACE_WM_HINTS(w) |
|---|
| 2281 | #endif |
|---|
| 2282 | |
|---|
| 2283 | #ifndef TRACE_XRES |
|---|
| 2284 | #define TRACE_XRES() |
|---|
| 2285 | #endif |
|---|
| 2286 | |
|---|
| 2287 | #ifndef TRACE2 |
|---|
| 2288 | #define TRACE2(p) |
|---|
| 2289 | #endif |
|---|
| 2290 | |
|---|
| 2291 | #endif |
|---|