xtermcap.h revision 20d2c4d2
1/* $XTermId: xtermcap.h,v 1.16 2010/01/06 21:20:40 tom Exp $ */
2
3/************************************************************
4
5Copyright 2007-2009,2010 by Thomas E. Dickey
6
7                        All Rights Reserved
8
9Permission is hereby granted, free of charge, to any person obtaining a
10copy of this software and associated documentation files (the
11"Software"), to deal in the Software without restriction, including
12without limitation the rights to use, copy, modify, merge, publish,
13distribute, sublicense, and/or sell copies of the Software, and to
14permit persons to whom the Software is furnished to do so, subject to
15the following conditions:
16
17The above copyright notice and this permission notice shall be included
18in all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
24CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28Except as contained in this notice, the name(s) of the above copyright
29holders shall not be used in advertising or otherwise to promote the
30sale, use or other dealings in this Software without prior written
31authorization.
32
33********************************************************/
34
35/*
36 * Common/useful definitions for XTERM termcap interface.
37 */
38#ifndef included_xtermcap_h
39#define included_xtermcap_h
40
41#include <xterm.h>
42
43#include <ptyx.h>
44
45#ifndef HAVE_TIGETSTR
46#undef USE_TERMINFO
47#endif
48
49#ifndef USE_TERMINFO
50#define USE_TERMINFO 0
51#endif
52
53#if !USE_TERMINFO
54#undef HAVE_TIGETSTR
55#ifndef USE_TERMCAP
56#define USE_TERMCAP 1
57#endif
58#endif
59
60#undef ERR			/* workaround for glibc 2.1.3 */
61
62#include <curses.h>
63
64#ifndef NCURSES_VERSION
65#ifdef HAVE_TERMCAP_H
66#include <termcap.h>
67#endif
68#endif
69
70#ifdef HAVE_NCURSES_TERM_H
71#include <ncurses/term.h>
72#elif defined(HAVE_TERM_H)
73#include <term.h>		/* tgetent() */
74#endif
75
76/*
77 * Get rid of conflicting symbols from term.h
78 */
79#undef bell
80
81/***====================================================================***/
82
83#ifdef __cplusplus
84extern "C" {
85#endif
86
87#define	MOD_NONE	1
88#define	MOD_SHIFT	1
89#define	MOD_ALT		2
90#define	MOD_CTRL	4
91#define	MOD_META	8
92
93#define MODIFIER_NAME(parm, name) \
94	(((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "")
95
96/* xtermcap.c */
97extern Bool get_termcap(XtermWidget /* xw */, char * /* name */);
98extern void set_termcap(XtermWidget /* xw */, const char * /* name */);
99extern void free_termcap(XtermWidget /* xw */);
100
101extern char *get_tcap_buffer(XtermWidget /* xw */);
102extern char *get_tcap_erase(XtermWidget /* xw */);
103
104#if OPT_TCAP_FKEYS
105extern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */);
106#endif
107
108#if OPT_TCAP_QUERY
109extern int xtermcapKeycode(XtermWidget /* xw */, const char ** /* params */, unsigned * /* state */, Bool * /* fkey */);
110#endif
111
112#ifdef __cplusplus
113	}
114#endif
115
116#endif	/* included_xtermcap_h */
117