xtermcap.h revision d522f475
1d522f475Smrg/* $XTermId: xtermcap.h,v 1.5 2007/12/06 00:09:44 tom Exp $ */
2d522f475Smrg
3d522f475Smrg/************************************************************
4d522f475Smrg
5d522f475SmrgCopyright 2007 by Thomas E. Dickey
6d522f475Smrg
7d522f475Smrg                        All Rights Reserved
8d522f475Smrg
9d522f475SmrgPermission is hereby granted, free of charge, to any person obtaining a
10d522f475Smrgcopy of this software and associated documentation files (the
11d522f475Smrg"Software"), to deal in the Software without restriction, including
12d522f475Smrgwithout limitation the rights to use, copy, modify, merge, publish,
13d522f475Smrgdistribute, sublicense, and/or sell copies of the Software, and to
14d522f475Smrgpermit persons to whom the Software is furnished to do so, subject to
15d522f475Smrgthe following conditions:
16d522f475Smrg
17d522f475SmrgThe above copyright notice and this permission notice shall be included
18d522f475Smrgin all copies or substantial portions of the Software.
19d522f475Smrg
20d522f475SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21d522f475SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22d522f475SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23d522f475SmrgIN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
24d522f475SmrgCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25d522f475SmrgTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26d522f475SmrgSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27d522f475Smrg
28d522f475SmrgExcept as contained in this notice, the name(s) of the above copyright
29d522f475Smrgholders shall not be used in advertising or otherwise to promote the
30d522f475Smrgsale, use or other dealings in this Software without prior written
31d522f475Smrgauthorization.
32d522f475Smrg
33d522f475Smrg********************************************************/
34d522f475Smrg
35d522f475Smrg/*
36d522f475Smrg * Common/useful definitions for XTERM termcap interface.
37d522f475Smrg */
38d522f475Smrg#ifndef included_xtermcap_h
39d522f475Smrg#define included_xtermcap_h
40d522f475Smrg
41d522f475Smrg#include <xterm.h>
42d522f475Smrg
43d522f475Smrg#include <ptyx.h>
44d522f475Smrg
45d522f475Smrg#ifdef HAVE_TERMCAP_H
46d522f475Smrg#include <termcap.h>
47d522f475Smrg#if defined(NCURSES_VERSION)
48d522f475Smrg	/* The tgetent emulation function in SVr4-style curses implementations
49d522f475Smrg	 * (e.g., ncurses) ignores the buffer, so TERMCAP can't be set from it.
50d522f475Smrg	 * Instead, just use terminfo.
51d522f475Smrg	 */
52d522f475Smrg#undef USE_TERMCAP
53d522f475Smrg#include <curses.h>
54d522f475Smrg#endif
55d522f475Smrg#else
56d522f475Smrg#undef ERR			/* workaround for glibc 2.1.3 */
57d522f475Smrg#include <curses.h>
58d522f475Smrg#ifdef HAVE_NCURSES_TERM_H
59d522f475Smrg#include <ncurses/term.h>
60d522f475Smrg#elif defined(HAVE_TERM_H)
61d522f475Smrg#include <term.h>		/* tgetent() */
62d522f475Smrg#endif /*CYGWIN */
63d522f475Smrg#endif /* HAVE_TERMCAP_H  */
64d522f475Smrg
65d522f475Smrg/***====================================================================***/
66d522f475Smrg
67d522f475Smrg#ifdef __cplusplus
68d522f475Smrgextern "C" {
69d522f475Smrg#endif
70d522f475Smrg
71d522f475Smrg#define MAX_FKEY 64
72d522f475Smrg#define MAX_FMOD 16
73d522f475Smrg
74d522f475Smrg#define CodeToXkey(code) (XK_Fn(MAX_FKEY) - (int) code)
75d522f475Smrg
76d522f475Smrg/*
77d522f475Smrg * Store Xkey-data internally as a negative value, past the last values used
78d522f475Smrg * for function keys.
79d522f475Smrg */
80d522f475Smrg#define XkeyData(code,mods) (-((mods-1) + (code*MAX_FMOD) + MAX_FKEY))
81d522f475Smrg
82d522f475Smrg/* xtermcap.c */
83d522f475Smrgextern Bool get_termcap(char * /* name */, char * /* buffer */);
84d522f475Smrg
85d522f475Smrg#if OPT_TCAP_FKEYS
86d522f475Smrgextern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */);
87d522f475Smrg#endif
88d522f475Smrg
89d522f475Smrg#if OPT_TCAP_QUERY
90d522f475Smrgextern int xtermcapKeycode(XtermWidget /* xw */, char ** /* params */, unsigned * /* state */, Bool * /* fkey */);
91d522f475Smrg#endif
92d522f475Smrg
93d522f475Smrg#ifdef __cplusplus
94d522f475Smrg	}
95d522f475Smrg#endif
96d522f475Smrg
97d522f475Smrg#endif	/* included_xtermcap_h */
98