104b94745Smrg/* $XTermId: xtermcap.h,v 1.20 2013/06/23 15:34:37 tom Exp $ */
2d522f475Smrg
30bd37d32Smrg/*
4e0a2b6dfSmrg * Copyright 2007-2011,2013 by Thomas E. Dickey
50bd37d32Smrg *
60bd37d32Smrg *                         All Rights Reserved
70bd37d32Smrg *
80bd37d32Smrg * Permission is hereby granted, free of charge, to any person obtaining a
90bd37d32Smrg * copy of this software and associated documentation files (the
100bd37d32Smrg * "Software"), to deal in the Software without restriction, including
110bd37d32Smrg * without limitation the rights to use, copy, modify, merge, publish,
120bd37d32Smrg * distribute, sublicense, and/or sell copies of the Software, and to
130bd37d32Smrg * permit persons to whom the Software is furnished to do so, subject to
140bd37d32Smrg * the following conditions:
150bd37d32Smrg *
160bd37d32Smrg * The above copyright notice and this permission notice shall be included
170bd37d32Smrg * in all copies or substantial portions of the Software.
180bd37d32Smrg *
190bd37d32Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
200bd37d32Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
210bd37d32Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
220bd37d32Smrg * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
230bd37d32Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
240bd37d32Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
250bd37d32Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
260bd37d32Smrg *
270bd37d32Smrg * Except as contained in this notice, the name(s) of the above copyright
280bd37d32Smrg * holders shall not be used in advertising or otherwise to promote the
290bd37d32Smrg * sale, use or other dealings in this Software without prior written
300bd37d32Smrg * authorization.
310bd37d32Smrg */
32d522f475Smrg
33d522f475Smrg/*
34d522f475Smrg * Common/useful definitions for XTERM termcap interface.
35d522f475Smrg */
36d522f475Smrg#ifndef included_xtermcap_h
37d522f475Smrg#define included_xtermcap_h
38e0a2b6dfSmrg/* *INDENT-OFF* */
39d522f475Smrg
40d522f475Smrg#include <xterm.h>
41d522f475Smrg
42d522f475Smrg#include <ptyx.h>
43d522f475Smrg
4420d2c4d2Smrg#ifndef HAVE_TIGETSTR
4520d2c4d2Smrg#undef USE_TERMINFO
46d522f475Smrg#endif
4720d2c4d2Smrg
4820d2c4d2Smrg#ifndef USE_TERMINFO
4920d2c4d2Smrg#define USE_TERMINFO 0
5020d2c4d2Smrg#endif
5120d2c4d2Smrg
5220d2c4d2Smrg#if !USE_TERMINFO
5320d2c4d2Smrg#undef HAVE_TIGETSTR
5420d2c4d2Smrg#ifndef USE_TERMCAP
5520d2c4d2Smrg#define USE_TERMCAP 1
5620d2c4d2Smrg#endif
5720d2c4d2Smrg#endif
5820d2c4d2Smrg
59d522f475Smrg#undef ERR			/* workaround for glibc 2.1.3 */
6020d2c4d2Smrg
610bd37d32Smrg#ifdef HAVE_NCURSES_CURSES_H
620bd37d32Smrg#include <ncurses/curses.h>
630bd37d32Smrg#else
64d522f475Smrg#include <curses.h>
650bd37d32Smrg#endif
6620d2c4d2Smrg
6720d2c4d2Smrg#ifndef NCURSES_VERSION
6820d2c4d2Smrg#ifdef HAVE_TERMCAP_H
6920d2c4d2Smrg#include <termcap.h>
7020d2c4d2Smrg#endif
7120d2c4d2Smrg#endif
7220d2c4d2Smrg
73d522f475Smrg#ifdef HAVE_NCURSES_TERM_H
74d522f475Smrg#include <ncurses/term.h>
75d522f475Smrg#elif defined(HAVE_TERM_H)
76d522f475Smrg#include <term.h>		/* tgetent() */
7720d2c4d2Smrg#endif
7820d2c4d2Smrg
7920d2c4d2Smrg/*
8020d2c4d2Smrg * Get rid of conflicting symbols from term.h
8120d2c4d2Smrg */
8220d2c4d2Smrg#undef bell
83d522f475Smrg
84d522f475Smrg/***====================================================================***/
85d522f475Smrg
86d522f475Smrg#ifdef __cplusplus
87d522f475Smrgextern "C" {
88d522f475Smrg#endif
89d522f475Smrg
90956cc18dSsnj#define	MOD_NONE	1
91956cc18dSsnj#define	MOD_SHIFT	1
92956cc18dSsnj#define	MOD_ALT		2
93956cc18dSsnj#define	MOD_CTRL	4
94956cc18dSsnj#define	MOD_META	8
95d522f475Smrg
96956cc18dSsnj#define MODIFIER_NAME(parm, name) \
97956cc18dSsnj	(((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "")
98d522f475Smrg
99d522f475Smrg/* xtermcap.c */
10020d2c4d2Smrgextern Bool get_termcap(XtermWidget /* xw */, char * /* name */);
10120d2c4d2Smrgextern void set_termcap(XtermWidget /* xw */, const char * /* name */);
10220d2c4d2Smrgextern void free_termcap(XtermWidget /* xw */);
10320d2c4d2Smrg
10420d2c4d2Smrgextern char *get_tcap_buffer(XtermWidget /* xw */);
10520d2c4d2Smrgextern char *get_tcap_erase(XtermWidget /* xw */);
106d522f475Smrg
107d522f475Smrg#if OPT_TCAP_FKEYS
108d522f475Smrgextern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */);
109d522f475Smrg#endif
110d522f475Smrg
111d522f475Smrg#if OPT_TCAP_QUERY
11220d2c4d2Smrgextern int xtermcapKeycode(XtermWidget /* xw */, const char ** /* params */, unsigned * /* state */, Bool * /* fkey */);
113d522f475Smrg#endif
114d522f475Smrg
115d522f475Smrg#ifdef __cplusplus
116d522f475Smrg	}
117d522f475Smrg#endif
118d522f475Smrg
119e0a2b6dfSmrg/* *INDENT-ON* */
120d522f475Smrg#endif	/* included_xtermcap_h */
121