1 /* $XTermId: xtermcap.h,v 1.20 2013/06/23 15:34:37 tom Exp $ */
2 
3 /*
4  * Copyright 2007-2011,2013 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 termcap interface.
35  */
36 #ifndef included_xtermcap_h
37 #define included_xtermcap_h
38 /* *INDENT-OFF* */
39 
40 #include <xterm.h>
41 
42 #include <ptyx.h>
43 
44 #ifndef HAVE_TIGETSTR
45 #undef USE_TERMINFO
46 #endif
47 
48 #ifndef USE_TERMINFO
49 #define USE_TERMINFO 0
50 #endif
51 
52 #if !USE_TERMINFO
53 #undef HAVE_TIGETSTR
54 #ifndef USE_TERMCAP
55 #define USE_TERMCAP 1
56 #endif
57 #endif
58 
59 #undef ERR			/* workaround for glibc 2.1.3 */
60 
61 #ifdef HAVE_NCURSES_CURSES_H
62 #include <ncurses/curses.h>
63 #else
64 #include <curses.h>
65 #endif
66 
67 #ifndef NCURSES_VERSION
68 #ifdef HAVE_TERMCAP_H
69 #include <termcap.h>
70 #endif
71 #endif
72 
73 #ifdef HAVE_NCURSES_TERM_H
74 #include <ncurses/term.h>
75 #elif defined(HAVE_TERM_H)
76 #include <term.h>		/* tgetent() */
77 #endif
78 
79 /*
80  * Get rid of conflicting symbols from term.h
81  */
82 #undef bell
83 
84 /***====================================================================***/
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
90 #define	MOD_NONE	1
91 #define	MOD_SHIFT	1
92 #define	MOD_ALT		2
93 #define	MOD_CTRL	4
94 #define	MOD_META	8
95 
96 #define MODIFIER_NAME(parm, name) \
97 	(((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "")
98 
99 /* xtermcap.c */
100 extern Bool get_termcap(XtermWidget /* xw */, char * /* name */);
101 extern void set_termcap(XtermWidget /* xw */, const char * /* name */);
102 extern void free_termcap(XtermWidget /* xw */);
103 
104 extern char *get_tcap_buffer(XtermWidget /* xw */);
105 extern char *get_tcap_erase(XtermWidget /* xw */);
106 
107 #if OPT_TCAP_FKEYS
108 extern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */);
109 #endif
110 
111 #if OPT_TCAP_QUERY
112 extern int xtermcapKeycode(XtermWidget /* xw */, const char ** /* params */, unsigned * /* state */, Bool * /* fkey */);
113 #endif
114 
115 #ifdef __cplusplus
116 	}
117 #endif
118 
119 /* *INDENT-ON* */
120 #endif	/* included_xtermcap_h */
121