1 /* $XTermId: xterm.h,v 1.902 2021/09/19 18:27:35 tom Exp $ */
2 
3 /*
4  * Copyright 1999-2020,2021 by Thomas E. Dickey
5  *
6  *                         All Rights Reserved
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
23  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name(s) of the above copyright
28  * holders shall not be used in advertising or otherwise to promote the
29  * sale, use or other dealings in this Software without prior written
30  * authorization.
31  */
32 
33 /*
34  * Common/useful definitions for XTERM application.
35  *
36  * This is also where we put the fallback definitions if we do not build using
37  * the configure script.
38  */
39 #ifndef included_xterm_h
40 #define included_xterm_h
41 /* *INDENT-OFF* */
42 
43 #ifdef HAVE_CONFIG_H
44 #include <xtermcfg.h>
45 #endif
46 
47 #undef bcopy
48 #include <X11/Xos.h>
49 
50 #ifndef HAVE_CONFIG_H
51 
52 #define HAVE_LIB_XAW 1
53 
54 #ifdef CSRG_BASED
55 /* Get definition of BSD */
56 #include <sys/param.h>
57 #endif
58 
59 #ifndef DFT_TERMTYPE
60 #define DFT_TERMTYPE "xterm"
61 #endif
62 
63 #ifndef X_NOT_POSIX
64 #define HAVE_WAITPID 1
65 #define HAVE_SYS_WAIT_H 1
66 #define HAVE_UNISTD_H 1
67 #endif
68 
69 #define HAVE_STDLIB_H 1
70 
71 #if defined(sun)
72 /* errno is declared in <errno.h> */
73 #else
74 #define DECL_ERRNO 1
75 #endif
76 
77 #undef DECL_PTSNAME		/* ptsname() is normally in stdlib.h */
78 
79 #ifndef NOPUTENV
80 #define HAVE_PUTENV 1
81 #endif
82 
83 #if defined(CSRG_BASED) || defined(__GNU__) || defined(__minix)
84 #define USE_POSIX_TERMIOS 1
85 #endif
86 
87 #ifdef __FreeBSD__
88 #if __FreeBSD_version >= 900000
89 #define USE_SYSV_UTMP 1
90 #define UTMPX_FOR_UTMP 1
91 #define HAVE_UTMP_UT_HOST 1
92 #define HAVE_UTMP_UT_XTIME 1
93 #define ut_name ut_user
94 #define ut_xtime ut_tv.tv_sec
95 #endif
96 #endif
97 
98 #ifdef __NetBSD__
99 #if __NetBSD_Version__ >= 106030000	/* 1.6C */
100 #define BSD_UTMPX 1
101 #define ut_xtime ut_tv.tv_sec
102 #endif
103 #endif
104 
105 #if defined(hpux) && !defined(__hpux)
106 #define __hpux 1		/* HPUX 11.0 does not define this */
107 #endif
108 
109 #if !defined(__SCO__) && (defined(SCO) || defined(sco) || defined(SCO325))
110 #define __SCO__ 1
111 #endif
112 
113 #ifdef USE_POSIX_TERMIOS
114 #define HAVE_TERMIOS_H 1
115 #define HAVE_TCGETATTR 1
116 #endif
117 
118 #if defined(__SCO__) || defined(__UNIXWARE__) || defined(__minix)
119 #define USE_TERMCAP 1
120 #endif
121 
122 #if defined(UTMP)
123 #define HAVE_UTMP 1
124 #endif
125 
126 #if (defined(__MVS__) || defined(SVR4) || defined(__SCO__) || defined(BSD_UTMPX)) && !defined(__CYGWIN__)
127 #define UTMPX_FOR_UTMP 1
128 #endif
129 
130 #if !defined(ISC) && !defined(__QNX__)
131 #define HAVE_UTMP_UT_HOST 1
132 #endif
133 
134 #if defined(UTMPX_FOR_UTMP) && !(defined(__MVS__) || defined(__hpux) || defined(__FreeBSD__))
135 #define HAVE_UTMP_UT_SESSION 1
136 #endif
137 
138 #if !(defined(linux) && (!defined(__GLIBC__) || (__GLIBC__ < 2))) && !defined(SVR4) && !defined(__FreeBSD__)
139 #define ut_xstatus ut_exit.e_exit
140 #endif
141 
142 #if defined(SVR4) || defined(__SCO__) || defined(BSD_UTMPX) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)))
143 #define HAVE_UTMP_UT_XTIME 1
144 #endif
145 
146 #if defined(linux) || defined(__CYGWIN__)
147 #define USE_LASTLOG
148 #define HAVE_LASTLOG_H
149 #define USE_STRUCT_LASTLOG
150 #elif defined(BSD) && (BSD >= 199103)
151 #ifdef BSD_UTMPX
152 #define USE_LASTLOGX
153 #elif defined(USE_SYSV_UTMP)
154 #else
155 #define USE_LASTLOG
156 #define USE_STRUCT_LASTLOG
157 #endif
158 #endif
159 
160 #if defined(__OpenBSD__)
161 #define DEFDELETE_DEL True
162 #define DEF_BACKARO_ERASE True
163 #define DEF_INITIAL_ERASE True
164 #endif
165 
166 #if defined(__SCO__) || defined(__UNIXWARE__)
167 #define DEFDELETE_DEL True
168 #define OPT_SCO_FUNC_KEYS 1
169 #endif
170 
171 #if defined(__SCO__) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(__QNX__) || defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || defined(__CYGWIN__)
172 #define USE_POSIX_WAIT
173 #endif
174 
175 #if defined(AIXV3) || defined(CRAY) || defined(__SCO__) || defined(SVR4) || (defined(SYSV) && defined(i386)) || defined(__MVS__) || defined(__hpux) || defined(__osf__) || defined(linux) || defined(macII) || defined(BSD_UTMPX)
176 #define USE_SYSV_UTMP
177 #endif
178 
179 #if defined(__GNU__) || defined(__MVS__) || defined(__osf__)
180 #define USE_TTY_GROUP
181 #endif
182 
183 #if defined(__CYGWIN__)
184 #define HAVE_NCURSES_TERM_H 1
185 #endif
186 
187 #ifdef __osf__
188 #define TTY_GROUP_NAME "terminal"
189 #endif
190 
191 #if defined(__MVS__)
192 #undef ut_xstatus
193 #define ut_name ut_user
194 #define ut_xstatus ut_exit.ut_e_exit
195 #define ut_xtime ut_tv.tv_sec
196 #endif
197 
198 #if defined(ut_xstatus)
199 #define HAVE_UTMP_UT_XSTATUS 1
200 #endif
201 
202 #if defined(XKB)
203 #define HAVE_XKB_BELL_EXT 1
204 #endif
205 
206 #if (defined(SVR4) && !defined(__CYGWIN__)) || defined(linux) || (defined(BSD) && (BSD >= 199103))
207 #define HAVE_POSIX_SAVED_IDS
208 #endif
209 
210 #if defined(linux) || defined(__GLIBC__) || (defined(SYSV) && (defined(CRAY) || defined(macII) || defined(__hpux) || defined(__osf__) || defined(__sgi))) || !(defined(SYSV) || defined(__QNX__) || defined(VMS) || defined(__INTERIX))
211 #define HAVE_INITGROUPS
212 #endif
213 
214 #endif /* HAVE_CONFIG_H */
215 
216 #ifndef HAVE_X11_DECKEYSYM_H
217 #define HAVE_X11_DECKEYSYM_H 1
218 #endif
219 
220 #ifndef HAVE_X11_SUNKEYSYM_H
221 #define HAVE_X11_SUNKEYSYM_H 1
222 #endif
223 
224 #ifndef HAVE_X11_XF86KEYSYM_H
225 #define HAVE_X11_XF86KEYSYM_H 0
226 #endif
227 
228 #if defined(HAVE_X11_EXTENSIONS_XDBE_H) && defined(HAVE_XDBESWAPBUFFERS)
229 #define USE_DOUBLE_BUFFER 1
230 #else
231 #define USE_DOUBLE_BUFFER 0
232 #endif
233 
234 /***====================================================================***/
235 
236 /* if compiling with gcc -ansi -pedantic, we must fix POSIX definitions */
237 #if defined(SVR4) && defined(sun)
238 #ifndef __EXTENSIONS__
239 #define __EXTENSIONS__ 1
240 #endif
241 #ifndef _POSIX_C_SOURCE
242 #define _POSIX_C_SOURCE 1
243 #endif
244 #endif
245 
246 /***====================================================================***/
247 
248 #ifdef HAVE_STDLIB_H
249 #include <stdlib.h>
250 #else
251 extern char *calloc();
252 extern char *getenv();
253 extern char *malloc();
254 extern char *realloc();
255 extern void exit();
256 extern void free();
257 #endif
258 
259 #ifdef HAVE_UNISTD_H
260 #include <unistd.h>
261 #endif
262 
263 #ifdef HAVE_SYS_WAIT_H
264 #include <sys/wait.h>
265 #endif
266 
267 #include <errno.h>
268 #if defined(DECL_ERRNO) && !defined(errno)
269 extern int errno;
270 #endif
271 
272 #include <X11/Xlocale.h>
273 
274 #ifdef HAVE_STDNORETURN_H
275 #include <stdnoreturn.h>
276 #undef GCC_NORETURN
277 #define GCC_NORETURN STDC_NORETURN
278 #endif
279 
280 /*
281  * FIXME:  Toggling logging from xterm hangs under Linux 2.0.29 with libc5 if
282  * we use 'waitpid()', while 'wait()' seems to work properly.
283  */
284 #ifdef linux
285 #undef HAVE_WAITPID
286 #endif
287 
288 #ifndef OPT_WIDE_CHARS
289 #define OPT_WIDE_CHARS 0
290 #endif
291 
292 #if OPT_WIDE_CHARS
293 #define HIDDEN_CHAR 0xffff
294 #endif
295 
296 /***====================================================================***/
297 
298 #define PROTO_XT_ACTIONS_ARGS \
299 	(Widget w, XEvent *event, String *params, Cardinal *num_params)
300 
301 #define PROTO_XT_CALLBACK_ARGS \
302 	(Widget gw, XtPointer closure, XtPointer data)
303 
304 #define PROTO_XT_CVT_SELECT_ARGS \
305 	(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format)
306 
307 #define PROTO_XT_EV_HANDLER_ARGS \
308 	(Widget w, XtPointer closure, XEvent *event, Boolean *cont)
309 
310 #define PROTO_XT_SEL_CB_ARGS \
311 	(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format)
312 
313 #include <ptyx.h>
314 
315 /***====================================================================***/
316 
317 #ifndef GCC_PRINTFLIKE
318 #ifdef _X_ATTRIBUTE_PRINTF
319 #define GCC_PRINTFLIKE(f,n)	_X_ATTRIBUTE_PRINTF(f,n)
320 #else
321 #define GCC_PRINTFLIKE(f,n)	/* nothing */
322 #endif
323 #endif
324 
325 #ifndef GCC_UNUSED
326 #ifdef _X_UNUSED
327 #define GCC_UNUSED		_X_UNUSED
328 #else
329 #define GCC_UNUSED		/* nothing */
330 #endif
331 #endif
332 
333 #ifndef GCC_NORETURN
334 #ifdef _X_NORETURN
335 #define GCC_NORETURN		_X_NORETURN
336 #else
337 #define GCC_NORETURN		/* nothing */
338 #endif
339 #endif
340 
341 /***====================================================================***/
342 
343 #if defined(__GNUC__) && defined(_FORTIFY_SOURCE)
344 #define USE_IGNORE_RC
345 #define IGNORE_RC(func) ignore_unused = (int) func
346 #else
347 #define IGNORE_RC(func) (void) func
348 #endif /* gcc workarounds */
349 #if (XtSpecificationRelease >= 6) && !defined(NO_XPOLL_H) && !defined(sun)
350 #include <X11/Xpoll.h>
351 #define USE_XPOLL_H 1
352 #else
353 #define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval *)t)
354 #define XFD_COPYSET(src,dst) memcpy((dst)->fds_bits, (src)->fds_bits, sizeof(fd_set))
355 #if defined(__MVS__) && !defined(TIME_WITH_SYS_TIME)
356 #define TIME_WITH_SYS_TIME
357 #endif
358 #endif
359 
360 #ifdef TIME_WITH_SYS_TIME
361 # include <sys/time.h>
362 # include <time.h>
363 #else
364 # ifdef HAVE_SYS_TIME_H
365 #  include <sys/time.h>
366 # else
367 #  include <time.h>
368 # endif
369 #endif
370 
371 /* these may be needed for sig_atomic_t */
372 #include <sys/types.h>
373 #include <signal.h>
374 
375 #ifdef USE_SYS_SELECT_H
376 
377 #if defined(USE_XPOLL_H) && defined(AIXV3) && defined(NFDBITS)
378 #undef NFDBITS			/* conflict between X11/Xpoll.h and sys/select.h */
379 #endif
380 
381 #include <sys/select.h>
382 
383 #endif /* USE_SYS_SELECT_H */
384 
385 #include <setjmp.h>
386 
387 #if !defined(VMS) && !(defined(linux) && defined(__USE_GNU)) && !defined(__hpux) && !defined(_ALL_SOURCE) && !defined(__osf__)
388 extern char **environ;
389 #endif
390 
391 #ifndef _Xconst
392 #define _Xconst const		/* Solaris 7 workaround */
393 #endif /* _Xconst */
394 
395 #define XK_Fn(n)	(XK_F1 + (n) - 1)
396 
397 #define Maybe		2
398 
399 #define ALLOC_STRING(name) \
400 	if (name != 0) \
401 	    name = x_strdup(name)
402 #define FREE_STRING(name) \
403 	    free_string(name)
404 
405 /* strftime format and length of the result */
406 #define FMT_TIMESTAMP ".%Y.%m.%d.%H.%M.%S"
407 #define LEN_TIMESTAMP sizeof(".YYYY.MM.DD.hh.mm.ss")
408 
409 /***====================================================================***/
410 
411 #if OPT_TRACE
412 #undef NDEBUG			/* turn on assert's */
413 #else
414 #ifndef NDEBUG
415 #define NDEBUG			/* not debugging, don't do assert's */
416 #endif
417 #endif
418 
419 #include <trace.h>
420 
421 #if OPT_TRACE && !defined(DEBUG)
422 #define DEBUG 1
423 #endif
424 
425 #ifdef DEBUG
426 #define if_DEBUG(code) if(debug) code
427 #else
428 #define if_DEBUG(code) /*nothing*/
429 #endif
430 
431 #define DEBUG_MSG(text) if_DEBUG({ IGNORE_RC(write(2, text, sizeof(text) - 1)); })
432 
433 /***====================================================================***/
434 
435 #define XtNallowBoldFonts	"allowBoldFonts"
436 #define XtNallowC1Printable	"allowC1Printable"
437 #define XtNallowColorOps	"allowColorOps"
438 #define XtNallowFontOps		"allowFontOps"
439 #define XtNallowMouseOps	"allowMouseOps"
440 #define XtNallowPasteControls	"allowPasteControls"
441 #define XtNallowScrollLock	"allowScrollLock"
442 #define XtNallowSendEvents	"allowSendEvents"
443 #define XtNallowTcapOps		"allowTcapOps"
444 #define XtNallowTitleOps	"allowTitleOps"
445 #define XtNallowWindowOps	"allowWindowOps"
446 #define XtNaltIsNotMeta		"altIsNotMeta"
447 #define XtNaltSendsEscape	"altSendsEscape"
448 #define XtNalternateScroll	"alternateScroll"
449 #define XtNalwaysBoldMode	"alwaysBoldMode"
450 #define XtNalwaysHighlight	"alwaysHighlight"
451 #define XtNalwaysUseMods	"alwaysUseMods"
452 #define XtNanswerbackString	"answerbackString"
453 #define XtNappcursorDefault	"appcursorDefault"
454 #define XtNappkeypadDefault	"appkeypadDefault"
455 #define XtNassumeAllChars	"assumeAllChars"
456 #define XtNautoWrap		"autoWrap"
457 #define XtNautoScrollLock	"autoScrollLock"
458 #define XtNawaitInput		"awaitInput"
459 #define XtNbackarrowKey		"backarrowKey"
460 #define XtNbellIsUrgent		"bellIsUrgent"
461 #define XtNbellOnReset		"bellOnReset"
462 #define XtNbellSuppressTime	"bellSuppressTime"
463 #define XtNboldColors		"boldColors"
464 #define XtNboldFont		"boldFont"
465 #define XtNboldMode		"boldMode"
466 #define XtNbrokenLinuxOSC	"brokenLinuxOSC"
467 #define XtNbrokenSelections	"brokenSelections"
468 #define XtNbrokenStringTerm	"brokenStringTerm"
469 #define XtNbuffered		"buffered"
470 #define XtNbufferedFPS		"bufferedFPS"
471 #define XtNc132			"c132"
472 #define XtNcacheDoublesize	"cacheDoublesize"
473 #define XtNcdXtraScroll		"cdXtraScroll"
474 #define XtNcharClass		"charClass"
475 #define XtNchecksumExtension	"checksumExtension"
476 #define XtNcjkWidth		"cjkWidth"
477 #define XtNcolorAttrMode	"colorAttrMode"
478 #define XtNcolorBDMode		"colorBDMode"
479 #define XtNcolorBLMode		"colorBLMode"
480 #define XtNcolorITMode		"colorITMode"
481 #define XtNcolorInnerBorder	"colorInnerBorder"
482 #define XtNcolorMode		"colorMode"
483 #define XtNcolorRVMode		"colorRVMode"
484 #define XtNcolorULMode		"colorULMode"
485 #define XtNcombiningChars	"combiningChars"
486 #define XtNctrlFKeys		"ctrlFKeys"
487 #define XtNcurses		"curses"
488 #define XtNcursorBlink		"cursorBlink"
489 #define XtNcursorBlinkXOR	"cursorBlinkXOR"
490 #define XtNcursorColor		"cursorColor"
491 #define XtNcursorOffTime	"cursorOffTime"
492 #define XtNcursorOnTime		"cursorOnTime"
493 #define XtNcursorUnderLine	"cursorUnderLine"
494 #define XtNcutNewline		"cutNewline"
495 #define XtNcutToBeginningOfLine	"cutToBeginningOfLine"
496 #define XtNdecGraphicsID	"decGraphicsID"
497 #define XtNdecTerminalID	"decTerminalID"
498 #define XtNdefaultString	"defaultString"
499 #define XtNdeleteIsDEL		"deleteIsDEL"
500 #define XtNdirectColor		"directColor"
501 #define XtNdisallowedColorOps	"disallowedColorOps"
502 #define XtNdisallowedFontOps	"disallowedFontOps"
503 #define XtNdisallowedMouseOps	"disallowedMouseOps"
504 #define XtNdisallowedPasteControls "disallowedPasteControls"
505 #define XtNdisallowedTcapOps	"disallowedTcapOps"
506 #define XtNdisallowedWindowOps	"disallowedWindowOps"
507 #define XtNdynamicColors	"dynamicColors"
508 #define XtNeightBitControl	"eightBitControl"
509 #define XtNeightBitInput	"eightBitInput"
510 #define XtNeightBitMeta		"eightBitMeta"
511 #define XtNeightBitOutput	"eightBitOutput"
512 #define XtNeightBitSelectTypes	"eightBitSelectTypes"
513 #define XtNeraseSavedLines	"eraseSavedLines"
514 #define XtNfaceName		"faceName"
515 #define XtNfaceNameDoublesize	"faceNameDoublesize"
516 #define XtNfaceSize		"faceSize"
517 #define XtNfastScroll		"fastScroll"
518 #define XtNfont1		"font1"
519 #define XtNfont2		"font2"
520 #define XtNfont3		"font3"
521 #define XtNfont4		"font4"
522 #define XtNfont5		"font5"
523 #define XtNfont6		"font6"
524 #define XtNfont7		"font7"
525 #define XtNfontDoublesize	"fontDoublesize"
526 #define XtNfontWarnings		"fontWarnings"
527 #define XtNforceBoxChars	"forceBoxChars"
528 #define XtNforcePackedFont	"forcePackedFont"
529 #define XtNforceXftHeight	"forceXftHeight"
530 #define XtNformatOtherKeys	"formatOtherKeys"
531 #define XtNfreeBoldBox		"freeBoldBox"
532 #define XtNfullscreen		"fullscreen"
533 #define XtNhighlightColor	"highlightColor"
534 #define XtNhighlightColorMode	"highlightColorMode"
535 #define XtNhighlightReverse	"highlightReverse"
536 #define XtNhighlightSelection	"highlightSelection"
537 #define XtNhighlightTextColor	"highlightTextColor"
538 #define XtNhpLowerleftBugCompat	"hpLowerleftBugCompat"
539 #define XtNi18nSelections	"i18nSelections"
540 #define XtNiconHint		"iconHint"
541 #define XtNinitialFont		"initialFont"
542 #define XtNinternalBorder	"internalBorder"
543 #define XtNitalicULMode		"italicULMode"
544 #define XtNjumpScroll		"jumpScroll"
545 #define XtNkeepClipboard	"keepClipboard"
546 #define XtNkeepSelection	"keepSelection"
547 #define XtNkeyboardDialect	"keyboardDialect"
548 #define XtNlimitFontsets	"limitFontsets"
549 #define XtNlimitResize		"limitResize"
550 #define XtNlimitResponse	"limitResponse"
551 #define XtNlocale		"locale"
552 #define XtNlocaleFilter		"localeFilter"
553 #define XtNlogFile		"logFile"
554 #define XtNlogInhibit		"logInhibit"
555 #define XtNlogging		"logging"
556 #define XtNloginShell		"loginShell"
557 #define XtNmarginBell		"marginBell"
558 #define XtNmaxGraphicSize	"maxGraphicSize"
559 #define XtNmaximized		"maximized"
560 #define XtNmenuBar		"menuBar"	/* internal */
561 #define XtNmenuHeight		"menuHeight"
562 #define XtNmetaSendsEscape	"metaSendsEscape"
563 #define XtNmkSamplePass		"mkSamplePass"
564 #define XtNmkSampleSize		"mkSampleSize"
565 #define XtNmkWidth		"mkWidth"
566 #define XtNmodifyCursorKeys	"modifyCursorKeys"
567 #define XtNmodifyFunctionKeys	"modifyFunctionKeys"
568 #define XtNmodifyKeyboard	"modifyKeyboard"
569 #define XtNmodifyKeypadKeys	"modifyKeypadKeys"
570 #define XtNmodifyOtherKeys	"modifyOtherKeys"
571 #define XtNmodifyStringKeys	"modifyStringKeys"
572 #define XtNmultiClickTime	"multiClickTime"
573 #define XtNmultiScroll		"multiScroll"
574 #define XtNnMarginBell		"nMarginBell"
575 #define XtNnextEventDelay	"nextEventDelay"
576 #define XtNnumColorRegisters	"numColorRegisters"
577 #define XtNnumLock		"numLock"
578 #define XtNoldXtermFKeys	"oldXtermFKeys"
579 #define XtNpointerColor		"pointerColor"
580 #define XtNpointerColorBackground "pointerColorBackground"
581 #define XtNpointerFont		"pointerFont"
582 #define XtNpointerMode		"pointerMode"
583 #define XtNpointerShape		"pointerShape"
584 #define XtNpopOnBell		"popOnBell"
585 #define XtNprecompose		"precompose"
586 #define XtNprintAttributes	"printAttributes"
587 #define XtNprinterAutoClose	"printerAutoClose"
588 #define XtNprinterCommand	"printerCommand"
589 #define XtNprinterControlMode	"printerControlMode"
590 #define XtNprinterExtent	"printerExtent"
591 #define XtNprinterFormFeed	"printerFormFeed"
592 #define XtNprinterNewLine	"printerNewLine"
593 #define XtNprivateColorRegisters "privateColorRegisters"
594 #define XtNquietGrab		"quietGrab"
595 #define XtNregisDefaultFont	"regisDefaultFont"
596 #define XtNregisScreenSize	"regisScreenSize"
597 #define XtNrenderFont		"renderFont"
598 #define XtNresizeByPixel	"resizeByPixel"
599 #define XtNresizeGravity	"resizeGravity"
600 #define XtNretryInputMethod	"retryInputMethod"
601 #define XtNreverseWrap		"reverseWrap"
602 #define XtNrightScrollBar	"rightScrollBar"
603 #define XtNsaveLines		"saveLines"
604 #define XtNscaleHeight		"scaleHeight"
605 #define XtNscrollBar		"scrollBar"
606 #define XtNscrollBarBorder	"scrollBarBorder"
607 #define XtNscrollKey		"scrollKey"
608 #define XtNscrollLines		"scrollLines"
609 #define XtNscrollTtyOutput	"scrollTtyOutput"
610 #define XtNselectToClipboard	"selectToClipboard"
611 #define XtNshiftEscape		"shiftEscape"
612 #define XtNshiftFonts		"shiftFonts"
613 #define XtNshowBlinkAsBold	"showBlinkAsBold"
614 #define XtNshowMissingGlyphs	"showMissingGlyphs"
615 #define XtNshowWrapMarks	"showWrapMarks"
616 #define XtNsignalInhibit	"signalInhibit"
617 #define XtNsixelScrolling	"sixelScrolling"
618 #define XtNsixelScrollsRight	"sixelScrollsRight"
619 #define XtNtekGeometry		"tekGeometry"
620 #define XtNtekInhibit		"tekInhibit"
621 #define XtNtekSmall		"tekSmall"
622 #define XtNtekStartup		"tekStartup"
623 #define XtNtiXtraScroll		"tiXtraScroll"
624 #define XtNtiteInhibit		"titeInhibit"
625 #define XtNtitleModes		"titleModes"
626 #define XtNtoolBar		"toolBar"
627 #define XtNtrimSelection	"trimSelection"
628 #define XtNunderLine		"underLine"
629 #define XtNuseBorderClipping	"useBorderClipping"
630 #define XtNuseClipping		"useClipping"
631 #define XtNutf8			"utf8"
632 #define XtNutf8Fonts		"utf8Fonts"
633 #define XtNutf8Latin1		"utf8Latin1"
634 #define XtNutf8SelectTypes	"utf8SelectTypes"
635 #define XtNutf8Title		"utf8Title"
636 #define XtNutf8Weblike		"utf8Weblike"
637 #define XtNveryBoldColors	"veryBoldColors"
638 #define XtNvisualBell		"visualBell"
639 #define XtNvisualBellDelay	"visualBellDelay"
640 #define XtNvisualBellLine	"visualBellLine"
641 #define XtNvt100Graphics	"vt100Graphics"
642 #define XtNwideBoldFont		"wideBoldFont"
643 #define XtNwideChars		"wideChars"
644 #define XtNwideFont		"wideFont"
645 #define XtNximFont		"ximFont"
646 #define XtNxmcAttributes	"xmcAttributes"	/* ncurses-testing */
647 #define XtNxmcGlitch		"xmcGlitch"	/* ncurses-testing */
648 #define XtNxmcInline		"xmcInline"	/* ncurses-testing */
649 #define XtNxmcMoveSGR		"xmcMoveSGR"	/* ncurses-testing */
650 
651 #define XtCAllowBoldFonts	"AllowBoldFonts"
652 #define XtCAllowC1Printable	"AllowC1Printable"
653 #define XtCAllowColorOps	"AllowColorOps"
654 #define XtCAllowFontOps		"AllowFontOps"
655 #define XtCAllowMouseOps	"AllowMouseOps"
656 #define XtCAllowPasteControls	"AllowPasteControls"
657 #define XtCAllowScrollLock	"AllowScrollLock"
658 #define XtCAllowSendEvents	"AllowSendEvents"
659 #define XtCAllowTcapOps		"AllowTcapOps"
660 #define XtCAllowTitleOps	"AllowTitleOps"
661 #define XtCAllowWindowOps	"AllowWindowOps"
662 #define XtCAltIsNotMeta		"AltIsNotMeta"
663 #define XtCAltSendsEscape	"AltSendsEscape"
664 #define XtCAlwaysBoldMode	"AlwaysBoldMode"
665 #define XtCAlwaysHighlight	"AlwaysHighlight"
666 #define XtCAlwaysUseMods	"AlwaysUseMods"
667 #define XtCAnswerbackString	"AnswerbackString"
668 #define XtCAppcursorDefault	"AppcursorDefault"
669 #define XtCAppkeypadDefault	"AppkeypadDefault"
670 #define XtCAssumeAllChars	"AssumeAllChars"
671 #define XtCAutoWrap		"AutoWrap"
672 #define XtCAutoScrollLock	"AutoScrollLock"
673 #define XtCAwaitInput		"AwaitInput"
674 #define XtCBackarrowKey		"BackarrowKey"
675 #define XtCBellIsUrgent		"BellIsUrgent"
676 #define XtCBellOnReset		"BellOnReset"
677 #define XtCBellSuppressTime	"BellSuppressTime"
678 #define XtCBoldFont		"BoldFont"
679 #define XtCBoldMode		"BoldMode"
680 #define XtCBrokenLinuxOSC	"BrokenLinuxOSC"
681 #define XtCBrokenSelections	"BrokenSelections"
682 #define XtCBrokenStringTerm	"BrokenStringTerm"
683 #define XtCBuffered		"Buffered"
684 #define XtCBufferedFPS		"BufferedFPS"
685 #define XtCC132			"C132"
686 #define XtCCacheDoublesize	"CacheDoublesize"
687 #define XtCCdXtraScroll		"CdXtraScroll"
688 #define XtCCharClass		"CharClass"
689 #define XtCChecksumExtension	"ChecksumExtension"
690 #define XtCCjkWidth		"CjkWidth"
691 #define XtCColorAttrMode	"ColorAttrMode"
692 #define XtCColorInnerBorder	"ColorInnerBorder"
693 #define XtCColorMode		"ColorMode"
694 #define XtCColumn		"Column"
695 #define XtCCombiningChars	"CombiningChars"
696 #define XtCCtrlFKeys		"CtrlFKeys"
697 #define XtCCurses		"Curses"
698 #define XtCCursorBlink		"CursorBlink"
699 #define XtCCursorBlinkXOR	"CursorBlinkXOR"
700 #define XtCCursorOffTime	"CursorOffTime"
701 #define XtCCursorOnTime		"CursorOnTime"
702 #define XtCCursorUnderLine	"CursorUnderLine"
703 #define XtCCutNewline		"CutNewline"
704 #define XtCCutToBeginningOfLine	"CutToBeginningOfLine"
705 #define XtCDecGraphicsID	"DecGraphicsID"
706 #define XtCDecTerminalID	"DecTerminalID"
707 #define XtCDefaultString	"DefaultString"
708 #define XtCDeleteIsDEL		"DeleteIsDEL"
709 #define XtCDirectColor		"DirectColor"
710 #define XtCDisallowedColorOps	"DisallowedColorOps"
711 #define XtCDisallowedFontOps	"DisallowedFontOps"
712 #define XtCDisallowedMouseOps	"DisallowedMouseOps"
713 #define XtCDisallowedPasteControls "DisallowedPasteControls"
714 #define XtCDisallowedTcapOps	"DisallowedTcapOps"
715 #define XtCDisallowedWindowOps	"DisallowedWindowOps"
716 #define XtCDynamicColors	"DynamicColors"
717 #define XtCEightBitControl	"EightBitControl"
718 #define XtCEightBitInput	"EightBitInput"
719 #define XtCEightBitMeta		"EightBitMeta"
720 #define XtCEightBitOutput	"EightBitOutput"
721 #define XtCEightBitSelectTypes	"EightBitSelectTypes"
722 #define XtCEraseSavedLines	"EraseSavedLines"
723 #define XtCFaceName		"FaceName"
724 #define XtCFaceNameDoublesize	"FaceNameDoublesize"
725 #define XtCFaceSize		"FaceSize"
726 #define XtCFastScroll		"FastScroll"
727 #define XtCFont1		"Font1"
728 #define XtCFont2		"Font2"
729 #define XtCFont3		"Font3"
730 #define XtCFont4		"Font4"
731 #define XtCFont5		"Font5"
732 #define XtCFont6		"Font6"
733 #define XtCFont7		"Font7"
734 #define XtCFontDoublesize	"FontDoublesize"
735 #define XtCFontWarnings		"FontWarnings"
736 #define XtCForceBoxChars	"ForceBoxChars"
737 #define XtCForcePackedFont	"ForcePackedFont"
738 #define XtCForceXftHeight	"ForceXftHeight"
739 #define XtCFormatOtherKeys	"FormatOtherKeys"
740 #define XtCFreeBoldBox		"FreeBoldBox"
741 #define XtCFullscreen		"Fullscreen"
742 #define XtCHighlightColorMode	"HighlightColorMode"
743 #define XtCHighlightReverse	"HighlightReverse"
744 #define XtCHighlightSelection	"HighlightSelection"
745 #define XtCHpLowerleftBugCompat	"HpLowerleftBugCompat"
746 #define XtCI18nSelections	"I18nSelections"
747 #define XtCIconHint		"IconHint"
748 #define XtCInitialFont		"InitialFont"
749 #define XtCJumpScroll		"JumpScroll"
750 #define XtCKeepClipboard	"KeepClipboard"
751 #define XtCKeepSelection	"KeepSelection"
752 #define XtCKeyboardDialect	"KeyboardDialect"
753 #define XtCLimitFontsets	"LimitFontsets"
754 #define XtCLimitResize		"LimitResize"
755 #define XtCLimitResponse	"LimitResponse"
756 #define XtCLocale		"Locale"
757 #define XtCLocaleFilter		"LocaleFilter"
758 #define XtCLogInhibit		"LogInhibit"
759 #define XtCLogfile		"Logfile"
760 #define XtCLogging		"Logging"
761 #define XtCLoginShell		"LoginShell"
762 #define XtCMarginBell		"MarginBell"
763 #define XtCMaxGraphicSize	"MaxGraphicSize"
764 #define XtCMaximized		"Maximized"
765 #define XtCMenuBar		"MenuBar"	/* internal */
766 #define XtCMenuHeight		"MenuHeight"
767 #define XtCMetaSendsEscape	"MetaSendsEscape"
768 #define XtCMkSamplePass		"MkSamplePass"
769 #define XtCMkSampleSize		"MkSampleSize"
770 #define XtCMkWidth		"MkWidth"
771 #define XtCModifyCursorKeys	"ModifyCursorKeys"
772 #define XtCModifyFunctionKeys	"ModifyFunctionKeys"
773 #define XtCModifyKeyboard	"ModifyKeyboard"
774 #define XtCModifyKeypadKeys	"ModifyKeypadKeys"
775 #define XtCModifyOtherKeys	"ModifyOtherKeys"
776 #define XtCModifyStringKeys	"ModifyStringKeys"
777 #define XtCMultiClickTime	"MultiClickTime"
778 #define XtCMultiScroll		"MultiScroll"
779 #define XtCNextEventDelay	"NextEventDelay"
780 #define XtCNumColorRegisters	"NumColorRegisters"
781 #define XtCNumLock		"NumLock"
782 #define XtCOldXtermFKeys	"OldXtermFKeys"
783 #define XtCPointerFont		"PointerFont"
784 #define XtCPointerMode		"PointerMode"
785 #define XtCPopOnBell		"PopOnBell"
786 #define XtCPrecompose		"Precompose"
787 #define XtCPrintAttributes	"PrintAttributes"
788 #define XtCPrinterAutoClose	"PrinterAutoClose"
789 #define XtCPrinterCommand	"PrinterCommand"
790 #define XtCPrinterControlMode	"PrinterControlMode"
791 #define XtCPrinterExtent	"PrinterExtent"
792 #define XtCPrinterFormFeed	"PrinterFormFeed"
793 #define XtCPrinterNewLine	"PrinterNewLine"
794 #define XtCPrivateColorRegisters "PrivateColorRegisters"
795 #define XtCQuietGrab		"QuietGrab"
796 #define XtCRegisDefaultFont	"RegisDefaultFont"
797 #define XtCRegisScreenSize	"RegisScreenSize"
798 #define XtCRenderFont		"RenderFont"
799 #define XtCResizeByPixel	"ResizeByPixel"
800 #define XtCResizeGravity	"ResizeGravity"
801 #define XtCRetryInputMethod	"RetryInputMethod"
802 #define XtCReverseWrap		"ReverseWrap"
803 #define XtCRightScrollBar	"RightScrollBar"
804 #define XtCSaveLines		"SaveLines"
805 #define XtCScaleHeight		"ScaleHeight"
806 #define XtCScrollBar		"ScrollBar"
807 #define XtCScrollBarBorder	"ScrollBarBorder"
808 #define XtCScrollCond		"ScrollCond"
809 #define XtCScrollLines		"ScrollLines"
810 #define XtCSelectToClipboard	"SelectToClipboard"
811 #define XtCShiftEscape		"ShiftEscape"
812 #define XtCShiftFonts		"ShiftFonts"
813 #define XtCShowBlinkAsBold	"ShowBlinkAsBold"
814 #define XtCShowMissingGlyphs	"ShowMissingGlyphs"
815 #define XtCShowWrapMarks	"ShowWrapMarks"
816 #define XtCSignalInhibit	"SignalInhibit"
817 #define XtCSixelScrolling	"SixelScrolling"
818 #define XtCSixelScrollsRight	"SixelScrollsRight"
819 #define XtCTekInhibit		"TekInhibit"
820 #define XtCTekSmall		"TekSmall"
821 #define XtCTekStartup		"TekStartup"
822 #define XtCTiXtraScroll		"TiXtraScroll"
823 #define XtCTiteInhibit		"TiteInhibit"
824 #define XtCTitleModes		"TitleModes"
825 #define XtCToolBar		"ToolBar"
826 #define XtCTrimSelection	"TrimSelection"
827 #define XtCUnderLine		"UnderLine"
828 #define XtCUseBorderClipping	"UseBorderClipping"
829 #define XtCUseClipping		"UseClipping"
830 #define XtCUtf8			"Utf8"
831 #define XtCUtf8Fonts		"Utf8Fonts"
832 #define XtCUtf8Latin1		"Utf8Latin1"
833 #define XtCUtf8SelectTypes	"Utf8SelectTypes"
834 #define XtCUtf8Title		"Utf8Title"
835 #define XtCUtf8Weblike		"Utf8Weblike"
836 #define XtCVT100Graphics	"VT100Graphics"
837 #define XtCVeryBoldColors	"VeryBoldColors"
838 #define XtCVisualBell		"VisualBell"
839 #define XtCVisualBellDelay	"VisualBellDelay"
840 #define XtCVisualBellLine	"VisualBellLine"
841 #define XtCWideBoldFont		"WideBoldFont"
842 #define XtCWideChars		"WideChars"
843 #define XtCWideFont		"WideFont"
844 #define XtCXimFont		"XimFont"
845 #define XtCXmcAttributes	"XmcAttributes"	/* ncurses-testing */
846 #define XtCXmcGlitch		"XmcGlitch"	/* ncurses-testing */
847 #define XtCXmcInline		"XmcInline"	/* ncurses-testing */
848 #define XtCXmcMoveSGR		"XmcMoveSGR"	/* ncurses-testing */
849 
850 #if defined(NO_ACTIVE_ICON) && !defined(XtNgeometry)
851 #define XtNgeometry		"geometry"
852 #define XtCGeometry		"Geometry"
853 #endif
854 
855 #if OPT_COLOR_CLASS
856 #define XtCCursorColor		"CursorColor"
857 #define XtCPointerColor		"PointerColor"
858 #define XtCHighlightColor	"HighlightColor"
859 #define XtCHighlightTextColor	"HighlightTextColor"
860 #else
861 #define XtCCursorColor		XtCForeground
862 #define XtCPointerColor		XtCForeground
863 #define XtCHighlightColor	XtCForeground
864 #define XtCHighlightTextColor	XtCBackground
865 #endif
866 
867 /***====================================================================***/
868 
869 #ifdef __cplusplus
870 extern "C" {
871 #endif
872 
873 struct XTERM_RESOURCE;
874 
875 /* Tekproc.c */
876 #if OPT_TEK4014
877 extern TekWidget getTekWidget(Widget /* w */);
878 extern int TekGetFontSize (const char * /* param */);
879 extern int TekInit (void);
880 extern void ChangeTekColors (TekWidget /* tw */, TScreen * /* screen */, ScrnColors * /* pNew */);
881 extern void HandleGINInput             PROTO_XT_ACTIONS_ARGS;
882 extern void TCursorToggle (TekWidget /* tw */, int /* toggle */);
883 extern void TekCopy (TekWidget /* tw */);
884 extern void TekEnqMouse (TekWidget /* tw */, int /* c */);
885 extern void TekExpose (Widget  /* w */, XEvent * /* event */, Region  /* region */);
886 extern void TekGINoff (TekWidget /* tw */);
887 extern void TekRefresh (TekWidget /* tw */);
888 extern void TekRepaint (TekWidget /* xw */);
889 extern void TekReverseVideo (XtermWidget /* xw */, TekWidget /* tw */);
890 extern void TekRun (void);
891 extern void TekSetFontSize (TekWidget /* tw */, Bool /* fromMenu */, int  /* newitem */);
892 extern void TekSetWinSize (TekWidget /* tw */);
893 extern void TekSimulatePageButton (TekWidget /* tw */, Bool /* reset */);
894 #endif
895 
896 /* button.c */
897 #define	MotionOff( s, t ) if (!(screen->hide_pointer)) {		\
898 	    (s)->event_mask |= ButtonMotionMask;			\
899 	    (s)->event_mask &= ~PointerMotionMask;			\
900 	    XSelectInput(XtDisplay((t)), XtWindow((t)), (long) (s)->event_mask); }
901 
902 #define	MotionOn( s, t ) {						\
903 	    (s)->event_mask &= ~ButtonMotionMask;			\
904 	    (s)->event_mask |= PointerMotionMask;			\
905 	    XSelectInput(XtDisplay((t)), XtWindow((t)), (long) (s)->event_mask); }
906 
907 extern Bool SendMousePosition (XtermWidget  /* w */, XEvent*  /* event */);
908 extern XtermMouseModes okSendMousePos(XtermWidget /* xw */);
909 extern void DiredButton                PROTO_XT_ACTIONS_ARGS;
910 extern void DisownSelection (XtermWidget  /* xw */);
911 extern void UnhiliteSelection (XtermWidget  /* xw */);
912 extern void HandleCopySelection        PROTO_XT_ACTIONS_ARGS;
913 extern void HandleInsertSelection      PROTO_XT_ACTIONS_ARGS;
914 extern void HandleKeyboardSelectEnd    PROTO_XT_ACTIONS_ARGS;
915 extern void HandleKeyboardSelectExtend PROTO_XT_ACTIONS_ARGS;
916 extern void HandleKeyboardSelectStart  PROTO_XT_ACTIONS_ARGS;
917 extern void HandleKeyboardStartExtend  PROTO_XT_ACTIONS_ARGS;
918 extern void HandlePointerMotion        PROTO_XT_ACTIONS_ARGS;
919 extern void HandlePointerButton        PROTO_XT_ACTIONS_ARGS;
920 extern void HandleSelectEnd            PROTO_XT_ACTIONS_ARGS;
921 extern void HandleSelectExtend         PROTO_XT_ACTIONS_ARGS;
922 extern void HandleSelectSet            PROTO_XT_ACTIONS_ARGS;
923 extern void HandleSelectStart          PROTO_XT_ACTIONS_ARGS;
924 extern void HandleStartExtend          PROTO_XT_ACTIONS_ARGS;
925 extern void ResizeSelection (TScreen * /* screen */, int  /* rows */, int  /* cols */);
926 extern void ScrollSelection (TScreen * /* screen */, int  /* amount */,  Bool /* always */);
927 extern void TrackMouse (XtermWidget /* xw */, int /* func */, CELL * /* start */, int /* firstrow */, int /* lastrow */);
928 extern void ViButton                   PROTO_XT_ACTIONS_ARGS;
929 
930 extern void UnmapSelections (XtermWidget /* xw */);
931 extern int xtermUtf8ToTextList (XtermWidget /* xw */, XTextProperty * /* text_prop */, char *** /* text_list */, int * /* text_list_count */);
932 extern void xtermButtonInit (XtermWidget /* xw */);
933 
934 #if OPT_DEC_LOCATOR
935 extern void GetLocatorPosition (XtermWidget  /* w */);
936 extern void InitLocatorFilter (XtermWidget  /* w */);
937 #endif	/* OPT_DEC_LOCATOR */
938 
939 #if OPT_FOCUS_EVENT
940 extern void SendFocusButton(XtermWidget /* xw */, XFocusChangeEvent * /* event */);
941 #else
942 #define SendFocusBotton(xw, event) /* nothing */
943 #endif
944 
945 #if OPT_PASTE64
946 extern void AppendToSelectionBuffer (TScreen * /* screen */, unsigned  /* c */, String /* selection */);
947 extern void ClearSelectionBuffer (TScreen * /* screen */, String /* selection */);
948 extern void CompleteSelection (XtermWidget  /* xw */, String * /* args */, Cardinal  /* len */);
949 extern void xtermGetSelection (Widget  /* w */, Time  /* ev_time */, String * /* params */, Cardinal  /* num_params */, Atom * /* targets */);
950 #endif
951 
952 #if OPT_READLINE
953 extern void ReadLineButton             PROTO_XT_ACTIONS_ARGS;
954 #endif
955 
956 #if OPT_REPORT_CCLASS
957 extern void report_char_class(XtermWidget);
958 #endif
959 
960 #define IsLatin1(n)  (((n) >= 32 && (n) <= 126) || ((n) >= 160 && (n) <= 255))
961 
962 #if OPT_WIDE_CHARS
963 #define WideCells(n) (((IChar)(n) >= first_widechar) ? my_wcwidth((wchar_t) (n)) : 1)
964 #define isWideFrg(n) (((n) == HIDDEN_CHAR) || (WideCells((n)) == 2))
965 #define isWide(n)    (((IChar)(n) >= first_widechar) && isWideFrg(n))
966 #define CharWidth(screen, n) ((!((screen)->utf8_mode) && ((n) < 256)) \
967 			      ? (IsLatin1(n) ? 1 : 0) \
968 			      : my_wcwidth((wchar_t) (n)))
969 #else
970 #define WideCells(n) 1
971 #define CharWidth(screen, n) (IsLatin1(n) ? 1 : 0)
972 #endif
973 
974 /* cachedCgs.c */
975 extern CgsEnum getCgsId(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/);
976 extern GC freeCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/);
977 extern GC getCgsGC(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/);
978 extern Pixel getCgsBack(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/);
979 extern Pixel getCgsFore(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/);
980 extern XTermFonts * getCgsFont(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/);
981 extern void clrCgsFonts(XtermWidget /*xw*/, VTwin * /*cgsWin*/, XTermFonts * /*font*/);
982 extern void copyCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*dstCgsId*/, CgsEnum /*srcCgsId*/);
983 extern void redoCgs(XtermWidget /*xw*/, Pixel /*fg*/, Pixel /*bg*/, CgsEnum /*cgsId*/);
984 extern void setCgsBack(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, Pixel /*bg*/);
985 extern void setCgsCSet(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, unsigned /*cset*/);
986 extern void setCgsFont(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, XTermFonts * /*font*/);
987 extern void setCgsFont2(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, XTermFonts * /*font*/, unsigned /*which*/);
988 extern void setCgsFore(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, Pixel /*fg*/);
989 extern void swapCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*dstCgsId*/, CgsEnum /*srcCgsId*/);
990 
991 #ifdef NO_LEAKS
992 extern void noleaks_cachedCgs (XtermWidget /* xw */);
993 #endif
994 
995 /* charproc.c */
996 extern Bool CheckBufPtrs (TScreen * /* screen */);
997 extern Bool set_cursor_gcs (XtermWidget /* xw */);
998 extern char * vt100ResourceToString (XtermWidget /* xw */, const char * /* name */);
999 extern int VTInit (XtermWidget /* xw */);
1000 extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool  /* justprobe */);
1001 extern void HideCursor (XtermWidget /* xw */);
1002 extern void RestartBlinking(XtermWidget /* xw */);
1003 extern void ShowCursor (XtermWidget /* xw */);
1004 extern void SwitchBufPtrs (TScreen * /* screen */, int /* toBuf */);
1005 extern void ToggleAlternate (XtermWidget /* xw */);
1006 extern void VTInitTranslations (void);
1007 extern GCC_NORETURN void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */);
1008 extern void VTRun (XtermWidget /* xw */);
1009 extern void dotext (XtermWidget /* xw */, DECNRCM_codes /* charset */, IChar * /* buf */, Cardinal  /* len */);
1010 extern void getKeymapResources(Widget /* w */, const char * /*mapName */, const char * /* mapClass */, const char * /* type */, void * /* result */, size_t /* size */);
1011 extern void initBorderGC (XtermWidget /* xw */, VTwin * /* win */);
1012 extern void lookupSelectUnit(XtermWidget /* xw */, Cardinal /* item */, String /* value */);
1013 extern void releaseCursorGCs(XtermWidget /*xw*/);
1014 extern void releaseWindowGCs(XtermWidget /*xw*/, VTwin * /*win*/);
1015 extern void resetCharsets (TScreen * /* screen */);
1016 extern void resetMargins (XtermWidget /* xw */);
1017 extern void restoreCharsets (TScreen * /* screen */, DECNRCM_codes * /* source */);
1018 extern void saveCharsets (TScreen * /* screen */, DECNRCM_codes * /* target */);
1019 extern void set_max_col(TScreen *  /* screen */, int  /* cols */);
1020 extern void set_max_row(TScreen *  /* screen */, int  /* rows */);
1021 extern void unparse_end (XtermWidget /* xw */);
1022 extern void unparseputc (XtermWidget /* xw */, int  /* c */);
1023 extern void unparseputc1 (XtermWidget /* xw */, int  /* c */);
1024 extern void unparseputn (XtermWidget /* xw */, unsigned /* n */);
1025 extern void unparseputs (XtermWidget /* xw */, const char * /* s */);
1026 extern void unparseseq (XtermWidget /* xw */, ANSI * /* ap */);
1027 extern void v_write (int  /* f */, const Char * /* d */, unsigned  /* len */);
1028 extern void xtermAddInput (Widget  /* w */);
1029 extern void xtermDecodeSCS (XtermWidget /* xw */, int /* which */, int /* sgroup */, int /* prefix */, int /* suffix */);
1030 
1031 #if OPT_BLINK_CURS
1032 extern void ToggleCursorBlink(XtermWidget /* xw */);
1033 #endif
1034 
1035 #if OPT_BLINK_TEXT
1036 extern Bool LineHasBlinking(TScreen * /* screen */, CLineData * /* ld */);
1037 #endif
1038 
1039 #if OPT_INPUT_METHOD
1040 extern TInput *lookupTInput (XtermWidget /* xw */, Widget /* w */);
1041 #endif
1042 
1043 #if OPT_ISO_COLORS
1044 extern void SGR_Background (XtermWidget /* xw */, int  /* color */);
1045 extern void SGR_Foreground (XtermWidget /* xw */, int  /* color */);
1046 extern void setExtendedColors (XtermWidget /* xw */);
1047 #endif
1048 
1049 #ifdef NO_LEAKS
1050 extern void noleaks_charproc (void);
1051 #endif
1052 
1053 /* charsets.c */
1054 extern unsigned xtermCharSetIn (XtermWidget /* xw */, unsigned  /* code */, DECNRCM_codes /* charset */);
1055 extern int xtermCharSetOut (XtermWidget /* xw */, IChar * /* buf */, IChar * /* ptr */, DECNRCM_codes /* charset */);
1056 
1057 /* cursor.c */
1058 extern int CursorCol (XtermWidget /* xw */);
1059 extern int CursorRow (XtermWidget /* xw */);
1060 extern void AdjustSavedCursor (XtermWidget /* xw */, int /* adjust */);
1061 extern void CarriageReturn (XtermWidget /* xw */);
1062 extern void CursorBack (XtermWidget /* xw */, int /* n */);
1063 extern void CursorDown (TScreen * /* screen */, int /* n */);
1064 extern void CursorForward (XtermWidget /* xw */, int /* n */);
1065 extern void CursorNextLine (XtermWidget /* xw */, int /* count */);
1066 extern void CursorPrevLine (XtermWidget /* xw */, int /* count */);
1067 extern void CursorRestore (XtermWidget  /* xw */);
1068 extern void CursorSave (XtermWidget  /* xw */);
1069 extern void CursorSet (TScreen * /* screen */, int  /* row */, int  /* col */, unsigned  /* flags */);
1070 extern void CursorUp (TScreen * /* screen */, int   /* n */);
1071 extern void RevIndex (XtermWidget /* xw */, int  /* amount */);
1072 extern void xtermIndex (XtermWidget /* xw */, int  /* amount */);
1073 
1074 #if OPT_TRACE
1075 extern int set_cur_col(TScreen * /* screen */, int  /* value */);
1076 extern int set_cur_row(TScreen * /* screen */, int  /* value */);
1077 #else
1078 #define set_cur_col(screen, value) screen->cur_col = value
1079 #define set_cur_row(screen, value) screen->cur_row = value
1080 #endif
1081 
1082 /* cursorfont.c */
1083 extern Cursor CreateAlternateCursorFontCursor(Display * /* dpy */, char const * /* cursorfont */, unsigned int  /* which */);
1084 extern int CursorFontIndexFromShapeName(char const * /* shapename */);
1085 
1086 /* doublechr.c */
1087 extern void xterm_DECDHL (XtermWidget /* xw */, Bool  /* top */);
1088 extern void xterm_DECSWL (XtermWidget /* xw */);
1089 extern void xterm_DECDWL (XtermWidget /* xw */);
1090 extern void xterm_ResetDouble(XtermWidget /* xw */);
1091 #if OPT_DEC_CHRSET
1092 extern GC xterm_DoubleGC(XTermDraw * /* params */, GC /* old_gc */, int * /* inxp */);
1093 #if OPT_RENDERFONT
1094 extern XftFont * xterm_DoubleFT(XTermDraw * /* params */, unsigned /* chrset */, unsigned /* attr_flags */);
1095 extern void freeall_DoubleFT(XtermWidget /* xw */);
1096 #endif
1097 #endif
1098 
1099 /* input.c */
1100 extern unsigned xtermParamToState (XtermWidget /* xw */, unsigned /* param */);
1101 extern unsigned xtermStateToParam (XtermWidget /* xw */, unsigned /* state */);
1102 extern Bool xtermDeleteIsDEL (XtermWidget /* xw */);
1103 extern void Input (XtermWidget /* xw */, XKeyEvent */* event */, Bool /* eightbit */);
1104 extern void StringInput (XtermWidget /* xw */, const Char * /* string */, size_t  /* nbytes */);
1105 
1106 #if OPT_NUM_LOCK
1107 extern void VTInitModifiers(XtermWidget /* xw */);
1108 #else
1109 #define VTInitModifiers(xw) /* nothing */
1110 #endif
1111 
1112 /* linedata.c */
1113 extern LineData *getLineData(TScreen * /* screen */, int /* row */);
1114 extern void copyLineData(LineData * /* dst */, CLineData * /* src */);
1115 extern void initLineData(XtermWidget /* xw */);
1116 
1117 extern CellData *newCellData(XtermWidget /* xw */, Cardinal /* count */);
1118 extern void saveCellData(TScreen * /* screen */, CellData * /* data */, Cardinal /* cell */, CLineData * /* ld */, XTermRect * /* limits */, int /* column */);
1119 extern void restoreCellData(TScreen * /* screen */, const CellData * /* data */, Cardinal /* cell */, LineData * /* ld */, XTermRect * /* limits */, int /* column */);
1120 
1121 /* main.c */
1122 #define ENVP_ARG /**/
1123 
1124 extern int main (int  /* argc */, char ** /* argv */ ENVP_ARG);
1125 extern int GetBytesAvailable (int  /* fd */);
1126 extern int kill_process_group (int  /* pid */, int  /* sig */);
1127 extern int nonblocking_wait (void);
1128 
1129 #if OPT_PTY_HANDSHAKE
1130 extern void first_map_occurred (void);
1131 #else
1132 #define first_map_occurred() /* nothing */
1133 #endif
1134 
1135 extern GCC_NORETURN void Exit (int /* n */);
1136 
1137 #ifndef SIG_ATOMIC_T
1138 #define SIG_ATOMIC_T int
1139 #endif
1140 
1141 #if OPT_WIDE_CHARS
1142 extern unsigned first_widechar;
1143 extern int (*my_wcwidth)(wchar_t);
1144 #endif
1145 
1146 /* menu.c */
1147 extern void do_hangup          PROTO_XT_CALLBACK_ARGS;
1148 extern void repairSizeHints    (void);
1149 extern void show_8bit_control  (Bool /* value */);
1150 
1151 /* misc.c */
1152 
1153 #define TIMESTAMP_LEN 20	/* length of TIMESTAMP_FMT */
1154 
1155 extern Bool AllocateTermColor(XtermWidget, ScrnColors *, int, const char *, Bool);
1156 extern Boolean allocateBestRGB(XtermWidget /* xw */, XColor * /* def */);
1157 extern Boolean validProgram(const char * /* pathname */);
1158 extern Boolean xtermGetWinAttrs(Display * /* dpy */, Window /* win */, XWindowAttributes * /* attrs */);
1159 extern Boolean xtermGetWinProp(Display * /* dpy */, Window /* win */, Atom /* property */, long /* long_offset */, long /* long_length */, Atom /* req_type */, Atom * /* actual_type_return */, int * /* actual_format_return */, unsigned long * /* nitems_return */, unsigned long * /* bytes_after_return */, unsigned char ** /* prop_return */);
1160 extern Boolean xtermIsIconified (XtermWidget /* xw */);
1161 extern Cursor make_colored_cursor (unsigned /* cursorindex */, unsigned long /* fg */, unsigned long /* bg */);
1162 extern FILE * create_printfile(XtermWidget /* xw */, const char * /* suffix */);
1163 extern OptionHelp * sortedOpts(OptionHelp *, XrmOptionDescRec *, Cardinal);
1164 extern String xtermEnvLocale (void);
1165 extern Widget xtermOpenApplication (XtAppContext * /* app_context_return */, String /* application_class */, XrmOptionDescRec */* options */, Cardinal /* num_options */, int * /* argc_in_out */, char **/* argv_in_out */, String * /* fallback_resources */, WidgetClass /* widget_class */, ArgList /* args */, Cardinal /* num_args */);
1166 extern Window WMFrameWindow (XtermWidget /* xw */);
1167 extern XtInputMask xtermAppPending (void);
1168 extern XrmOptionDescRec * sortedOptDescs (XrmOptionDescRec *, Cardinal);
1169 extern XtermWidget getXtermWidget (Widget /* w */);
1170 extern XVisualInfo *getVisualInfo (XtermWidget /* xw */);
1171 extern char *udk_lookup (XtermWidget /* xw */, int /* keycode */, int * /* len */);
1172 extern char *xtermEnvEncoding (void);
1173 extern char *xtermFindShell (char * /* leaf */, Bool /* warning */);
1174 extern char *xtermFormatSGR (XtermWidget /* xw */, char * /* target */, unsigned /* attrs */, int /* fg */, int /* bg */);
1175 extern const char *SysErrorMsg (int /* n */);
1176 extern const char *SysReasonMsg (int /* n */);
1177 extern int ResetAnsiColorRequest (XtermWidget, char *, int);
1178 extern int XStrCmp (char * /* s1 */, char * /* s2 */);
1179 extern int creat_as (uid_t /* uid */, gid_t /* gid */, Bool /* append */, char * /* pathname */, unsigned /* mode */);
1180 extern int getVisualDepth (XtermWidget /* xw */);
1181 extern int ignore_x11_error(Display * /* dpy */, XErrorEvent * /* event */);
1182 extern int open_userfile (uid_t /* uid */, gid_t /* gid */, char * /* path */, Bool /* append */);
1183 extern int update_winsize(int /* fd */, int /* rows */, int /* cols */, int /* height */, int /* width */);
1184 extern int xerror (Display * /* d */, XErrorEvent * /* ev */);
1185 extern int xioerror (Display * /* dpy */);
1186 extern int xtermClosestColor (XtermWidget /* xw */, int /* red */, int /* green */, int /* blue */);
1187 extern int xtermResetIds (TScreen * /* screen */);
1188 extern void Bell (XtermWidget /* xw */, int /* which */, int /* percent */);
1189 extern void ChangeGroup(XtermWidget /* xw */, const char * /* attribute */, char * /* value */);
1190 extern void ChangeIconName (XtermWidget /* xw */, char * /* name */);
1191 extern void ChangeTitle (XtermWidget /* xw */, char * /* name */);
1192 extern void ChangeXprop (char * /* name */);
1193 extern GCC_NORETURN void Cleanup (int /* code */);
1194 extern void HandleBellPropertyChange   PROTO_XT_EV_HANDLER_ARGS;
1195 extern void HandleEightBitKeyPressed   PROTO_XT_ACTIONS_ARGS;
1196 extern void HandleEnterWindow          PROTO_XT_EV_HANDLER_ARGS;
1197 extern void HandleFocusChange          PROTO_XT_EV_HANDLER_ARGS;
1198 extern void HandleInterpret            PROTO_XT_ACTIONS_ARGS;
1199 extern void HandleKeyPressed           PROTO_XT_ACTIONS_ARGS;
1200 extern void HandleLeaveWindow          PROTO_XT_EV_HANDLER_ARGS;
1201 extern void HandleSpawnTerminal        PROTO_XT_ACTIONS_ARGS;
1202 extern void HandleStringEvent          PROTO_XT_ACTIONS_ARGS;
1203 extern void NormalExit (void);
1204 extern void Panic (const char * /* s */, int /* a */);
1205 extern void Redraw (void);
1206 extern void ReverseOldColors (XtermWidget /* xw */);
1207 extern GCC_NORETURN void SysError (int /* i */);
1208 extern void VisualBell (void);
1209 extern void cleanup_colored_cursor (void);
1210 extern void do_ansi_rqm (XtermWidget /* xw */, int /* nparam */, int * /* params */);
1211 extern void do_dcs (XtermWidget /* xw */, Char * /* buf */, size_t /* len */);
1212 extern void do_dec_rqm (XtermWidget /* xw */, int /* nparam */, int * /* params */);
1213 extern void do_osc (XtermWidget /* xw */, Char * /* buf */, size_t /* len */, int /* final */);
1214 extern void do_xevents (XtermWidget /* xw */);
1215 extern void end_tek_mode (void);
1216 extern void end_vt_mode (void);
1217 extern void free_string(String value);
1218 extern void hide_tek_window (void);
1219 extern void hide_vt_window (void);
1220 extern GCC_NORETURN void ice_error (IceConn /* iceConn */);
1221 extern void init_colored_cursor (Display * /* dpy */);
1222 extern void reset_decudk (XtermWidget /* xw */);
1223 extern void set_tek_visibility (Bool /* on */);
1224 extern void set_vt_visibility (Bool /* on */);
1225 extern void switch_modes (Bool /* tovt */);
1226 extern void timestamp_filename(char * /* dst */, const char * /* src */);
1227 extern void xevents (XtermWidget /* xw */);
1228 extern GCC_NORETURN void xt_error (String /* message */);
1229 extern void xtermBell(XtermWidget /* xw */, int /* which */, int /* percent */);
1230 extern void xtermCopyEnv (char ** /* oldenv */);
1231 extern void xtermDisplayPointer (XtermWidget /* xw */);
1232 extern void xtermDeiconify (XtermWidget /* xw */);
1233 extern void xtermEmbedWindow (Window /* winToEmbedInfo */);
1234 extern void xtermIconify (XtermWidget /* xw */);
1235 extern void xtermLoadIcon (XtermWidget /* xw */, const char * /* icon_hint */);
1236 extern void xtermPerror (const char * /*fmt*/,...) GCC_PRINTFLIKE(1,2);
1237 extern void xtermSetenv (const char * /* var */, const char * /* value */);
1238 extern void xtermSetupPointer (XtermWidget /* xw */, const char * /* theShape */);
1239 extern void xtermSetWinSize (XtermWidget /* xw */);
1240 extern void xtermShowPointer (XtermWidget /* xw */, Bool /* enable */);
1241 extern void xtermUnsetenv (const char * /* var */);
1242 extern void xtermWarning (const char * /*fmt*/,...) GCC_PRINTFLIKE(1,2);
1243 
1244 #if OPT_DABBREV
1245 extern void HandleDabbrevExpand        PROTO_XT_ACTIONS_ARGS;
1246 #endif
1247 
1248 #if OPT_DIRECT_COLOR
1249 extern int getDirectColor(XtermWidget /* xw */, int /* red */, int /* green */, int /* blue */);
1250 #endif /* OPT_DIRECT_COLOR */
1251 
1252 #if USE_DOUBLE_BUFFER
1253 extern void xtermFlushDbe(XtermWidget /* xw */);
1254 extern void xtermTimedDbe(XtermWidget /* xw */);
1255 #define xtermNeedSwap(xw,why)	TScreenOf(xw)->needSwap |= (why)
1256 #else
1257 #define xtermFlushDbe(xw)	/* nothing */
1258 #define xtermTimedDbe(xw)	/* nothing */
1259 #define xtermNeedSwap(xw,why)	/* nothing */
1260 #endif /* USE_DOUBLE_BUFFER */
1261 
1262 #if OPT_EXEC_XTERM
1263 extern char *ProcGetCWD(pid_t /* pid */);
1264 #else
1265 #define ProcGetCWD(pid) NULL
1266 #endif
1267 
1268 #if OPT_ISO_COLORS
1269 extern Boolean AllocOneColor(XtermWidget /* xw */, XColor * /* def */);
1270 extern Boolean QueryOneColor(XtermWidget /* xw */, XColor * /* def */);
1271 #else
1272 #define AllocOneColor(xw, def) ((def)->pixel = 0)
1273 #define QueryOneColor(xw, def) ((def)->red = (def)->green = (def)->blue = 0)
1274 #endif
1275 
1276 #if OPT_MAXIMIZE
1277 extern int QueryMaximize (XtermWidget  /* xw */, unsigned * /* width */, unsigned * /* height */);
1278 extern void HandleDeIconify            PROTO_XT_ACTIONS_ARGS;
1279 extern void HandleIconify              PROTO_XT_ACTIONS_ARGS;
1280 extern void HandleMaximize             PROTO_XT_ACTIONS_ARGS;
1281 extern void HandleRestoreSize          PROTO_XT_ACTIONS_ARGS;
1282 extern void RequestMaximize (XtermWidget  /* xw */, int  /* maximize */);
1283 #endif
1284 
1285 #if OPT_REPORT_ICONS
1286 extern void report_icons(const char *fmt,...) GCC_PRINTFLIKE(1,2);
1287 #define ReportIcons(params)	report_icons params
1288 #else
1289 #define ReportIcons(params)	TRACE(params)
1290 #endif
1291 
1292 #if OPT_SCROLL_LOCK
1293 extern void GetScrollLock (TScreen * /* screen */);
1294 extern void HandleScrollLock           PROTO_XT_ACTIONS_ARGS;
1295 extern void ShowScrollLock (TScreen * /* screen */, Bool /* enable */);
1296 extern void SetScrollLock (TScreen * /* screen */, Bool /* enable */);
1297 extern void xtermShowLED (TScreen * /* screen */, Cardinal /* led_number */, Bool /* enable */);
1298 extern void xtermClearLEDs (TScreen * /* screen */);
1299 #else
1300 #define ShowScrollLock(screen, enable) /* nothing */
1301 #define SetScrollLock(screen, enable) /* nothing */
1302 #define GetScrollLock(screen) /* nothing */
1303 #endif
1304 
1305 #if OPT_SELECTION_OPS
1306 extern void HandleExecFormatted        PROTO_XT_ACTIONS_ARGS;
1307 extern void HandleExecSelectable       PROTO_XT_ACTIONS_ARGS;
1308 extern void HandleInsertFormatted      PROTO_XT_ACTIONS_ARGS;
1309 extern void HandleInsertSelectable     PROTO_XT_ACTIONS_ARGS;
1310 #endif
1311 
1312 #if OPT_SESSION_MGT
1313 extern void xtermCloseSession (void);
1314 extern void xtermOpenSession (void);
1315 extern void xtermUpdateRestartCommand(XtermWidget /* xw */);
1316 #else
1317 #define xtermCloseSession() /* nothing */
1318 #define xtermOpenSession() /* nothing */
1319 #define xtermUpdateRestartCommand(xw) /* nothing */
1320 #endif
1321 
1322 #if OPT_WIDE_CHARS
1323 extern Bool xtermEnvUTF8(void);
1324 #else
1325 #define xtermEnvUTF8() False
1326 #endif
1327 
1328 #if OPT_XTERM_SGR
1329 extern void xtermPushSGR (XtermWidget /* xw */, int /* value */);
1330 extern void xtermPopSGR (XtermWidget /* xw */);
1331 extern void xtermReportSGR (XtermWidget /* xw */, XTermRect * /* value */);
1332 extern void xtermPushColors (XtermWidget /* xw */, int /* value */);
1333 extern void xtermPopColors (XtermWidget /* xw */, int /* value */);
1334 extern void xtermReportColors (XtermWidget /* xw */);
1335 #endif
1336 
1337 #ifdef ALLOWLOGGING
1338 extern void StartLog (XtermWidget /* xw */);
1339 extern void CloseLog (XtermWidget /* xw */);
1340 extern void FlushLog (XtermWidget /* xw */);
1341 #else
1342 #define FlushLog(xw) /*nothing*/
1343 #endif
1344 
1345 /* print.c */
1346 extern Bool xtermHasPrinter (XtermWidget /* xw */);
1347 extern PrinterFlags *getPrinterFlags (XtermWidget /* xw */, String * /* params */, Cardinal * /* param_count */);
1348 extern int xtermPrinterControl (XtermWidget /* xw */, int /* chr */);
1349 extern void setPrinterControlMode (XtermWidget /* xw */, int /* mode */);
1350 extern void xtermAutoPrint (XtermWidget /* xw */, unsigned /* chr */);
1351 extern void xtermMediaControl (XtermWidget /* xw */, int  /* param */, int  /* private_seq */);
1352 extern void xtermPrintScreen (XtermWidget /* xw */, Bool  /* use_DECPEX */, PrinterFlags * /* p */);
1353 extern void xtermPrintEverything (XtermWidget /* xw */, PrinterFlags * /* p */);
1354 extern void xtermPrintImmediately (XtermWidget /* xw */, String /* filename */, int /* opts */, int /* attributes */);
1355 extern void xtermPrintOnXError (XtermWidget /* xw */, int /* n */);
1356 
1357 #if OPT_SCREEN_DUMPS
1358 /* html.c */
1359 extern void xtermDumpHtml (XtermWidget /* xw */);
1360 extern char *PixelToCSSColor(XtermWidget /* xw */, Pixel /* p */);
1361 /* svg.c */
1362 extern void xtermDumpSvg (XtermWidget /* xw */);
1363 #endif
1364 
1365 /* ptydata.c */
1366 #ifdef VMS
1367 #define PtySelect int
1368 #else
1369 #define PtySelect fd_set
1370 #endif
1371 
1372 extern Bool decodeUtf8 (TScreen * /* screen */, PtyData * /* data */);
1373 extern int readPtyData (XtermWidget /* xw */, PtySelect * /* select_mask */, PtyData * /* data */);
1374 extern void fillPtyData (XtermWidget /* xw */, PtyData * /* data */, const char * /* value */, int  /* length */);
1375 extern void initPtyData (PtyData ** /* data */);
1376 extern void trimPtyData (XtermWidget /* xw */, PtyData * /* data */);
1377 
1378 #ifdef NO_LEAKS
1379 extern void noleaks_ptydata ( void );
1380 #endif
1381 
1382 #if OPT_WIDE_CHARS
1383 extern Boolean isValidUTF8 (Char * /* lp */);
1384 extern Char *convertToUTF8 (Char * /* lp */, unsigned  /* c */);
1385 extern Char *convertFromUTF8 (Char * /* lp */, unsigned * /* cp */);
1386 extern IChar nextPtyData (TScreen * /* screen */, PtyData * /* data */);
1387 extern PtyData * fakePtyData (PtyData * /* result */, Char * /* next */, Char * /* last */);
1388 extern void switchPtyData (TScreen * /* screen */, int  /* f */);
1389 extern void writePtyData (int  /* f */, IChar * /* d */, unsigned  /* len */);
1390 
1391 #define morePtyData(screen, data) \
1392 	(((data)->last > (data)->next) \
1393 	 ? (((screen)->utf8_inparse && !(data)->utf_size) \
1394 	    ? decodeUtf8(screen, data) \
1395 	    : True) \
1396 	 : False)
1397 
1398 #define skipPtyData(data, result) \
1399 	do { \
1400 	    result = (data)->utf_data; \
1401 	    (data)->next += (data)->utf_size; \
1402 	    (data)->utf_size = 0; \
1403 	} while (0)
1404 #else
1405 #define morePtyData(screen, data) ((data)->last > (data)->next)
1406 #define nextPtyData(screen, data) (IChar) (*((data)->next++) & \
1407 					   (screen->output_eight_bits \
1408 					    ? 0xff \
1409 					    : 0x7f))
1410 #define writePtyData(f,d,len) v_write(f,d,len)
1411 #endif
1412 
1413 /* screen.c */
1414 
1415 /*
1416  * See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
1417  */
1418 #define _NET_WM_STATE_REMOVE	0	/* remove/unset property */
1419 #define _NET_WM_STATE_ADD	1	/* add/set property */
1420 #define _NET_WM_STATE_TOGGLE	2	/* toggle property */
1421 
1422 extern Bool non_blank_line (TScreen */* screen */, int  /* row */, int  /* col */, int  /* len */);
1423 extern Char * allocScrnData (TScreen * /* screen */, unsigned /* nrow */, unsigned /* ncol */);
1424 extern ScrnBuf allocScrnBuf (XtermWidget /* xw */, unsigned  /* nrow */, unsigned  /* ncol */, ScrnPtr * /* addr */);
1425 extern ScrnBuf scrnHeadAddr (TScreen * /* screen */, ScrnBuf /* base */, unsigned /* offset */);
1426 extern int ScreenResize (XtermWidget /* xw */, int  /* width */, int  /* height */, unsigned * /* flags */);
1427 extern size_t ScrnPointers (TScreen * /* screen */, size_t  /* len */);
1428 extern void ClearBufRows (XtermWidget /* xw */, int  /* first */, int  /* last */);
1429 extern void ClearCells (XtermWidget /* xw */, int /* flags */, unsigned /* len */, int /* row */, int /* col */);
1430 extern void CopyCells (TScreen * /* screen */, LineData * /* src */, LineData * /* dst */, int /* col */, int /* len */, Bool /* down */);
1431 extern void FullScreen (XtermWidget /* xw */, int /* mode */);
1432 extern void FreeMarkGCs (XtermWidget /* xw */);
1433 extern void ScrnAllocBuf (XtermWidget /* xw */);
1434 extern void ScrnClearCells (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */);
1435 extern void ScrnDeleteChar (XtermWidget /* xw */, unsigned  /* n */);
1436 extern void ScrnDeleteCol (XtermWidget /* xw */, unsigned  /* n */);
1437 extern void ScrnDeleteLine (XtermWidget /* xw */, ScrnBuf  /* sb */, int  /* n */, int  /* last */, unsigned /* where */);
1438 extern void ScrnDisownSelection (XtermWidget /* xw */);
1439 extern void ScrnFillRectangle (XtermWidget /* xw */, XTermRect *,  int ,  unsigned /* flags */, Bool /* keepColors */);
1440 extern void ScrnInsertChar (XtermWidget /* xw */, unsigned  /* n */);
1441 extern void ScrnInsertCol (XtermWidget /* xw */, unsigned  /* n */);
1442 extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int  /* last */, int  /* where */, unsigned  /* n */);
1443 extern void ScrnRefresh (XtermWidget /* xw */, int  /* toprow */, int  /* leftcol */, int  /* nrows */, int  /* ncols */, Bool  /* force */);
1444 extern void ScrnUpdate (XtermWidget /* xw */, int  /* toprow */, int  /* leftcol */, int  /* nrows */, int  /* ncols */, Bool  /* force */);
1445 extern void ScrnWriteText (XtermWidget /* xw */, IChar * /* str */, unsigned  /* flags */, CellColor /* cur_fg_bg */, unsigned  /* length */);
1446 extern void ShowWrapMarks (XtermWidget /* xw */, int /* row */, CLineData * /* ld */);
1447 extern void setupLineData (TScreen * /* screen */, ScrnBuf /* base */, Char * /* data */, unsigned /* nrow */, unsigned /* ncol */);
1448 extern void xtermParseRect (XtermWidget /* xw */, int, int *, XTermRect *);
1449 
1450 #if OPT_TRACE && OPT_TRACE_FLAGS
1451 extern int  LineTstFlag(LineData /* ld */, int /* flag */);
1452 extern void LineClrFlag(LineData /* ld */, int /* flag */);
1453 extern void LineSetFlag(LineData /* ld */, int /* flag */);
1454 #else
1455 
1456 #define LineFlags(ld)         GetLineFlags(ld)
1457 
1458 #define LineClrFlag(ld, flag) SetLineFlags(ld, (GetLineFlags(ld) & ~ (flag)))
1459 #define LineSetFlag(ld, flag) SetLineFlags(ld, (GetLineFlags(ld) | (flag)))
1460 #define LineTstFlag(ld, flag) ((GetLineFlags(ld) & flag) != 0)
1461 
1462 #endif /* OPT_TRACE && OPT_TRACE_FLAGS */
1463 
1464 #define LineClrBlinked(ld) LineClrFlag(ld, LINEBLINKED)
1465 #define LineSetBlinked(ld) LineSetFlag(ld, LINEBLINKED)
1466 #define LineTstBlinked(ld) LineTstFlag(ld, LINEBLINKED)
1467 
1468 #define LineClrWrapped(ld) LineClrFlag(ld, LINEWRAPPED)
1469 #define LineSetWrapped(ld) LineSetFlag(ld, LINEWRAPPED)
1470 #define LineTstWrapped(ld) LineTstFlag(ld, LINEWRAPPED)
1471 
1472 #define ScrnHaveSelection(screen) \
1473 			((screen)->startH.row != (screen)->endH.row \
1474 			|| (screen)->startH.col != (screen)->endH.col)
1475 
1476 #define ScrnAreRowsInSelection(screen, first, last) \
1477 	((last) >= (screen)->startH.row && (first) <= (screen)->endH.row)
1478 
1479 #define ScrnIsRowInSelection(screen, line) \
1480 	((line) >= (screen)->startH.row && (line) <= (screen)->endH.row)
1481 
1482 #define ScrnHaveRowMargins(screen) \
1483 			((screen)->top_marg != 0 \
1484 			|| ((screen)->bot_marg != screen->max_row))
1485 
1486 #define ScrnIsRowInMargins(screen, line) \
1487 	((line) >= (screen)->top_marg && (line) <= (screen)->bot_marg)
1488 
1489 #define ScrnHaveColMargins(screen) \
1490 			((screen)->rgt_marg > (screen)->max_col)
1491 
1492 #define ScrnIsColInMargins(screen, col) \
1493 	((col) >= (screen)->lft_marg && (col) <= (screen)->rgt_marg)
1494 
1495 /*
1496  * If the vertical scrolling margins are active, they will be something other
1497  * than the first/last row of the visible screen, as well as being distinct.
1498  */
1499 #define IsTopBottomMode(xw)	(ScrnTopMargin(xw) < ScrnBottomMargin(xw))
1500 #define ScrnTopMargin(xw)	TScreenOf(xw)->top_marg
1501 #define ScrnBottomMargin(xw)	TScreenOf(xw)->bot_marg
1502 
1503 /*
1504  * Left/right horizontal scrolling margins are only active when DECLRMM is.
1505  */
1506 #define IsLeftRightMode(xw) ((xw)->flags & LEFT_RIGHT)
1507 #define ScrnLeftMargin(xw)  (IsLeftRightMode(xw) \
1508 			     ? TScreenOf(xw)->lft_marg \
1509 			     : 0)
1510 #define ScrnRightMargin(xw) (IsLeftRightMode(xw) \
1511 			     ? TScreenOf(xw)->rgt_marg \
1512 			     : MaxCols(TScreenOf(xw)) - 1)
1513 
1514 #if OPT_DEC_RECTOPS
1515 extern void ScrnCopyRectangle (XtermWidget /* xw */, XTermRect *, int, int *);
1516 extern void ScrnMarkRectangle (XtermWidget /* xw */, XTermRect *, Bool, int, int *);
1517 extern void ScrnWipeRectangle (XtermWidget /* xw */, XTermRect *);
1518 extern void xtermCheckRect(XtermWidget /* xw */, int /* nparam */, int */* params */, int * /* result */);
1519 #endif
1520 
1521 #if OPT_WIDE_CHARS
1522 extern void ChangeToWide(XtermWidget /* xw */);
1523 #endif
1524 
1525 /* scrollback.c */
1526 extern LineData *getScrollback (TScreen * /* screen */, int /* row */);
1527 extern LineData *addScrollback (TScreen * /* screen */);
1528 extern void deleteScrollback (TScreen * /* screen */);
1529 
1530 /* scrollbar.c */
1531 extern void DoResizeScreen (XtermWidget /* xw */);
1532 extern void HandleScrollBack           PROTO_XT_ACTIONS_ARGS;
1533 extern void HandleScrollForward        PROTO_XT_ACTIONS_ARGS;
1534 extern void HandleScrollTo             PROTO_XT_ACTIONS_ARGS;
1535 extern void ResizeScrollBar (XtermWidget  /* xw */);
1536 extern void ScrollBarDrawThumb (XtermWidget  /* xw */, int /* mode */);
1537 extern void ScrollBarOff (XtermWidget  /* xw */);
1538 extern void ScrollBarOn (XtermWidget  /* xw */, Bool /* init */);
1539 extern void ScrollBarReverseVideo (Widget  /* scrollWidget */);
1540 extern void ToggleScrollBar (XtermWidget  /* xw */);
1541 extern void WindowScroll (XtermWidget /* xw */, int  /* top */, Bool /* always */);
1542 
1543 #ifdef SCROLLBAR_RIGHT
1544 extern void updateRightScrollbar(XtermWidget  /* xw */);
1545 #else
1546 #define updateRightScrollbar(xw) /* nothing */
1547 #endif
1548 
1549 /* tabs.c */
1550 extern Bool TabToNextStop (XtermWidget /* xw */);
1551 extern Bool TabToPrevStop (XtermWidget /* xw */);
1552 extern void TabClear (Tabs /* tabs */, int /* col */);
1553 extern void TabReset (Tabs /* tabs */);
1554 extern void TabSet (Tabs /* tabs */, int /* col */);
1555 extern void TabZonk (Tabs /* tabs */);
1556 extern Bool TabIsSet (Tabs /* tabs */, int /* col */);
1557 
1558 /* util.c */
1559 extern Boolean isDefaultBackground (const char * /* name */);
1560 extern Boolean isDefaultForeground (const char * /* name */);
1561 extern CgsEnum whichXtermCgs (XtermWidget /* xw */, unsigned /* attr_flags */, Bool /* hilite */);
1562 extern GC updatedXtermGC (XtermWidget /* xw */, unsigned  /* flags */, CellColor /* fg_bg */, Bool  /* hilite */);
1563 extern Pixel getXtermBackground (XtermWidget /* xw */, unsigned /* flags */, int /* color */);
1564 extern Pixel getXtermForeground (XtermWidget /* xw */, unsigned /* flags */, int /* color */);
1565 extern char * xtermSetLocale (int /* category */, String /* after */);
1566 extern int ClearInLine (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */);
1567 extern int HandleExposure (XtermWidget /* xw */, XEvent * /* event */);
1568 extern int dimRound (double /* value */);
1569 extern int drawXtermText (XTermDraw * /* param */, GC /* gc */, int /* x */, int /* y */, const IChar * /* text */, Cardinal /* len */);
1570 extern int extendedBoolean (const char * /* value */, const FlagList * /* table */, Cardinal /* limit */);
1571 extern void ChangeColors (XtermWidget  /* xw */, ScrnColors * /* pNew */);
1572 extern void ClearRight (XtermWidget /* xw */, int /* n */);
1573 extern void ClearScreen (XtermWidget /* xw */);
1574 extern void DeleteChar (XtermWidget /* xw */, unsigned /* n */);
1575 extern void DeleteLine (XtermWidget /* xw */, int /* n */, Bool /* canSave */);
1576 extern void FlushScroll (XtermWidget /* xw */);
1577 extern void GetColors (XtermWidget  /* xw */, ScrnColors * /* pColors */);
1578 extern void InsertChar (XtermWidget /* xw */, unsigned /* n */);
1579 extern void InsertLine (XtermWidget /* xw */, int  /* n */);
1580 extern void RevScroll (XtermWidget /* xw */, int  /* amount */);
1581 extern void ReverseVideo (XtermWidget /* xw */);
1582 extern void WriteText (XtermWidget /* xw */, IChar * /* str */, Cardinal /* len */);
1583 extern void decode_keyboard_type (XtermWidget /* xw */, struct XTERM_RESOURCE * /* rp */);
1584 extern void decode_wcwidth (XtermWidget  /* xw */);
1585 extern void do_cd_xtra_scroll (XtermWidget /* xw */, int /* param */);
1586 extern void do_erase_display (XtermWidget /* xw */, int  /* param */, int  /* mode */);
1587 extern void do_erase_char (XtermWidget /* xw */, int  /* param */, int  /* mode */);
1588 extern void do_erase_line (XtermWidget /* xw */, int  /* param */, int  /* mode */);
1589 extern void do_ti_xtra_scroll (XtermWidget /* xw */);
1590 extern void getXtermSizeHints (XtermWidget /* xw */);
1591 extern void recolor_cursor (TScreen * /* screen */, Cursor  /* cursor */, unsigned long  /* fg */, unsigned long  /* bg */);
1592 extern void resetXtermGC (XtermWidget /* xw */, unsigned  /* flags */, Bool  /* hilite */);
1593 extern void scrolling_copy_area (XtermWidget /* xw */, int  /* firstline */, int  /* nlines */, int  /* amount */);
1594 extern void set_keyboard_type (XtermWidget /* xw */, xtermKeyboardType  /* type */, Bool  /* set */);
1595 extern void toggle_keyboard_type (XtermWidget /* xw */, xtermKeyboardType  /* type */);
1596 extern void update_keyboard_type (void);
1597 extern void xtermClear (XtermWidget /* xw */);
1598 extern void xtermClear2 (XtermWidget /* xw */, int /* x */, int /* y */, unsigned /* width */, unsigned /* height */);
1599 extern void xtermColIndex (XtermWidget /* xw */, Bool /* toLeft */);
1600 extern void xtermColScroll (XtermWidget /* xw */, int /* amount */, Bool /* toLeft */, int /* at_col */);
1601 extern void xtermRepaint (XtermWidget /* xw */);
1602 extern void xtermResetLocale (int /* category */, char * /* before */);
1603 extern void xtermScroll (XtermWidget /* xw */, int /* amount */);
1604 extern void xtermScrollLR (XtermWidget /* xw */, int /* amount */, Bool /* toLeft */);
1605 extern void xtermSizeHints (XtermWidget  /* xw */, int /* scrollbarWidth */);
1606 
1607 struct Xinerama_geometry {
1608     int x;
1609     int y;
1610     unsigned w;
1611     unsigned h;
1612     int scr_x;
1613     int scr_y;
1614     int scr_w;
1615     int scr_h;
1616 };
1617 extern int XParseXineramaGeometry(Display * /* display */, char * /* parsestring */, struct Xinerama_geometry * /* ret */);
1618 
1619 #if OPT_ISO_COLORS
1620 
1621 extern Pixel extract_fg (XtermWidget /* xw */, CellColor /* color */, unsigned  /* flags */);
1622 extern Pixel extract_bg (XtermWidget /* xw */, CellColor /* color */, unsigned  /* flags */);
1623 extern CellColor makeColorPair (XtermWidget /* xw */);
1624 extern void ClearCurBackground (XtermWidget /* xw */, int  /* top */, int  /* left */, unsigned  /* height */, unsigned  /* width */, unsigned /* fw */);
1625 
1626 #define xtermColorPair(xw) makeColorPair(xw)
1627 
1628 #define GET_COLOR_RES(xw, res) xtermGetColorRes(xw, &(res))
1629 #define SET_COLOR_RES(res,color) (res)->value = color
1630 #define EQL_COLOR_RES(res,color) (res)->value == color
1631 #define T_COLOR(v,n) (v)->Tcolors[n].value
1632 extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */);
1633 
1634 #define ExtractForeground(color) (unsigned) GetCellColorFG(color)
1635 #define ExtractBackground(color) (unsigned) GetCellColorBG(color)
1636 
1637 #if OPT_RENDERFONT
1638 extern void discardRenderDraw(TScreen * /* screen */);
1639 #else
1640 #define discardRenderDraw(screen) /* nothing */
1641 #endif
1642 
1643 #if OPT_WIDE_ATTRS
1644 #define MapToWideColorMode(fg, screen, flags) \
1645 	(((screen)->colorITMode && ((flags) & ATR_ITALIC)) \
1646 	 ? COLOR_IT \
1647 	 : fg)
1648 #else
1649 #define MapToWideColorMode(fg, screen, flags) fg
1650 #endif
1651 
1652 #define MapToColorMode(fg, screen, flags) \
1653 	(((screen)->colorBLMode && ((flags) & BLINK)) \
1654 	 ? COLOR_BL \
1655 	 : (((screen)->colorBDMode && ((flags) & BOLD)) \
1656 	    ? COLOR_BD \
1657 	    : (((screen)->colorULMode && ((flags) & UNDERLINE)) \
1658 	       ? COLOR_UL \
1659 	       : MapToWideColorMode(fg, screen, flags))))
1660 
1661 #define checkVeryBoldAttr(flags, fg, code, attr) \
1662 	if ((flags & FG_COLOR) != 0 \
1663 	 && (screen->veryBoldColors & attr) == 0 \
1664 	 && (flags & attr) != 0 \
1665 	 && (fg == code)) \
1666 		 UIntClr(flags, attr)
1667 
1668 #if OPT_WIDE_ATTRS
1669 #define checkVeryBoldWideAttr(flags, fg, it, atr) \
1670 	    checkVeryBoldAttr(flags, fg, it, atr)
1671 #else
1672 #define checkVeryBoldWideAttr(flags, fg, it, atr) (void) flags
1673 #endif
1674 
1675 #define checkVeryBoldColors(flags, fg) \
1676 	checkVeryBoldAttr(flags, fg, COLOR_RV, INVERSE); \
1677 	checkVeryBoldAttr(flags, fg, COLOR_UL, UNDERLINE); \
1678 	checkVeryBoldAttr(flags, fg, COLOR_BD, BOLD); \
1679 	checkVeryBoldAttr(flags, fg, COLOR_BL, BLINK); \
1680 	checkVeryBoldWideAttr(flags, fg, COLOR_IT, ATR_ITALIC)
1681 
1682 #else /* !OPT_ISO_COLORS */
1683 
1684 #define MapToColorMode(fg, screen, flags) fg
1685 
1686 #define ClearCurBackground(xw, top, left, height, width, fw) \
1687 	XClearArea (TScreenOf(xw)->display, \
1688 		    VDrawable(TScreenOf(xw)), \
1689 		    CursorX2(TScreenOf(xw), left, fw), \
1690 		    CursorY2(TScreenOf(xw), top), \
1691 		    ((width) * (unsigned) fw), \
1692 		    ((height) * (unsigned) FontHeight(TScreenOf(xw))), \
1693 		    False)
1694 
1695 #define extract_fg(xw, color, flags) (unsigned) (xw)->cur_foreground
1696 #define extract_bg(xw, color, flags) (unsigned) (xw)->cur_background
1697 
1698 		/* FIXME: Reverse-Video? */
1699 #define T_COLOR(v,n) (v)->Tcolors[n].value
1700 #define xtermColorPair(xw) 0
1701 
1702 #define checkVeryBoldColors(flags, fg) /* nothing */
1703 #define discardRenderDraw(screen) /* nothing */
1704 
1705 #endif	/* OPT_ISO_COLORS */
1706 
1707 #define getXtermFG(xw, flags, color) getXtermForeground(xw, flags, color)
1708 #define getXtermBG(xw, flags, color) getXtermBackground(xw, flags, color)
1709 
1710 #if OPT_ZICONBEEP
1711 extern void initZIconBeep(void);
1712 extern void resetZIconBeep(XtermWidget /* xw */);
1713 extern Boolean showZIconBeep(XtermWidget /* xw */, char * /* name */);
1714 #else
1715 #define initZIconBeep() /* nothing */
1716 #define resetZIconBeep(xw) /* nothing */
1717 #define showZIconBeep(xw, name) False
1718 #endif
1719 
1720 #define XTERM_CELL(row,col)    getXtermCell(screen,     ROW2INX(screen, row), col)
1721 
1722 extern unsigned getXtermCell (TScreen * /* screen */, int  /* row */, int  /* col */);
1723 extern unsigned getXtermCombining(TScreen * /* screen */, int /* row */, int /* col */, int /* off */);
1724 extern void putXtermCell (TScreen * /* screen */, int  /* row */, int  /* col */, int  /* ch */);
1725 
1726 #define IsCellCombined(screen, row, col) (getXtermCombining(screen, row, col, 0) != 0)
1727 
1728 #if OPT_HIGHLIGHT_COLOR
1729 #define isNotForeground(xw, fg, bg, sel) \
1730 		(Boolean) ((sel) != T_COLOR(TScreenOf(xw), TEXT_FG) \
1731 			   && (sel) != (fg) \
1732 			   && (sel) != (bg) \
1733 			   && (sel) != (xw)->dft_foreground)
1734 #define isNotBackground(xw, fg, bg, sel) \
1735 		(Boolean) ((sel) != T_COLOR(TScreenOf(xw), TEXT_BG) \
1736 			   && (sel) != (fg) \
1737 			   && (sel) != (bg) \
1738 			   && (sel) != (xw)->dft_background)
1739 #endif
1740 
1741 #if OPT_WIDE_CHARS
1742 extern Boolean isWideControl(unsigned /* ch */);
1743 extern int DamagedCells(TScreen * /* screen */, unsigned /* n */, int * /* klp */, int * /* krp */, int /* row */, int /* col */);
1744 extern int DamagedCurCells(TScreen * /* screen */, unsigned /* n */, int * /* klp */, int * /* krp */);
1745 extern unsigned AsciiEquivs(unsigned /* ch */);
1746 extern void addXtermCombining (TScreen * /* screen */, int  /* row */, int  /* col */, unsigned  /* ch */);
1747 extern void allocXtermChars(ScrnPtr * /* buffer */, Cardinal /* length */);
1748 #endif
1749 
1750 #if OPT_XMC_GLITCH
1751 extern void Mark_XMC (XtermWidget /* xw */, int  /* param */);
1752 extern void Jump_XMC (XtermWidget /* xw */);
1753 extern void Resolve_XMC (XtermWidget /* xw */);
1754 #endif
1755 
1756 #if OPT_WIDE_CHARS
1757 unsigned visual_width(const IChar * /* str */, Cardinal  /* len */);
1758 #else
1759 #define visual_width(a, b) (b)
1760 #endif
1761 
1762 #define BtoS(b)    ((b) ? "on" : "off")
1763 #define MtoS(b)    (((b) == Maybe) ? "maybe" : BtoS(b))
1764 #define NonNull(s) ((s) ? (s) : "<null>")
1765 
1766 #define UIntSet(dst,bits) dst = dst | (unsigned) (bits)
1767 #define UIntClr(dst,bits) dst = dst & (unsigned) ~(bits)
1768 
1769 #ifdef __cplusplus
1770 	}
1771 #endif
1772 /* *INDENT-ON* */
1773 
1774 #endif /* included_xterm_h */
1775