xtermcap.h revision 956cc18d
1956cc18dSsnj/* $XTermId: xtermcap.h,v 1.7 2009/03/15 18:18:11 tom Exp $ */ 2d522f475Smrg 3d522f475Smrg/************************************************************ 4d522f475Smrg 5956cc18dSsnjCopyright 2007,2009 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 71956cc18dSsnj#define MOD_NONE 1 72956cc18dSsnj#define MOD_SHIFT 1 73956cc18dSsnj#define MOD_ALT 2 74956cc18dSsnj#define MOD_CTRL 4 75956cc18dSsnj#define MOD_META 8 76d522f475Smrg 77956cc18dSsnj#define MODIFIER_NAME(parm, name) \ 78956cc18dSsnj (((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "") 79d522f475Smrg 80d522f475Smrg/* xtermcap.c */ 81d522f475Smrgextern Bool get_termcap(char * /* name */, char * /* buffer */); 82d522f475Smrg 83d522f475Smrg#if OPT_TCAP_FKEYS 84d522f475Smrgextern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */); 85d522f475Smrg#endif 86d522f475Smrg 87d522f475Smrg#if OPT_TCAP_QUERY 88d522f475Smrgextern int xtermcapKeycode(XtermWidget /* xw */, char ** /* params */, unsigned * /* state */, Bool * /* fkey */); 89d522f475Smrg#endif 90d522f475Smrg 91d522f475Smrg#ifdef __cplusplus 92d522f475Smrg } 93d522f475Smrg#endif 94d522f475Smrg 95d522f475Smrg#endif /* included_xtermcap_h */ 96