summaryrefslogtreecommitdiff
path: root/xtermcap.h
blob: 66aa08088c4e8f73b950306ff4229bac8cc4e5a1 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* $XTermId: xtermcap.h,v 1.18 2011/09/11 14:59:33 tom Exp $ */

/*
 * Copyright 2007-2010,2011 by Thomas E. Dickey
 *
 *                         All Rights Reserved
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name(s) of the above copyright
 * holders shall not be used in advertising or otherwise to promote the
 * sale, use or other dealings in this Software without prior written
 * authorization.
 */

/*
 * Common/useful definitions for XTERM termcap interface.
 */
#ifndef included_xtermcap_h
#define included_xtermcap_h

#include <xterm.h>

#include <ptyx.h>

#ifndef HAVE_TIGETSTR
#undef USE_TERMINFO
#endif

#ifndef USE_TERMINFO
#define USE_TERMINFO 0
#endif

#if !USE_TERMINFO
#undef HAVE_TIGETSTR
#ifndef USE_TERMCAP
#define USE_TERMCAP 1
#endif
#endif

#undef ERR			/* workaround for glibc 2.1.3 */

#ifdef HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h>
#else
#include <curses.h>
#endif

#ifndef NCURSES_VERSION
#ifdef HAVE_TERMCAP_H
#include <termcap.h>
#endif
#endif

#ifdef HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#elif defined(HAVE_TERM_H)
#include <term.h>		/* tgetent() */
#endif

/*
 * Get rid of conflicting symbols from term.h
 */
#undef bell

/***====================================================================***/

#ifdef __cplusplus
extern "C" {
#endif

#define	MOD_NONE	1
#define	MOD_SHIFT	1
#define	MOD_ALT		2
#define	MOD_CTRL	4
#define	MOD_META	8

#define MODIFIER_NAME(parm, name) \
	(((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "")

/* xtermcap.c */
extern Bool get_termcap(XtermWidget /* xw */, char * /* name */);
extern void set_termcap(XtermWidget /* xw */, const char * /* name */);
extern void free_termcap(XtermWidget /* xw */);

extern char *get_tcap_buffer(XtermWidget /* xw */);
extern char *get_tcap_erase(XtermWidget /* xw */);

#if OPT_TCAP_FKEYS
extern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */);
#endif

#if OPT_TCAP_QUERY
extern int xtermcapKeycode(XtermWidget /* xw */, const char ** /* params */, unsigned * /* state */, Bool * /* fkey */);
#endif

#ifdef __cplusplus
	}
#endif

#endif	/* included_xtermcap_h */