xtermcap.h revision d522f475
1/* $XTermId: xtermcap.h,v 1.5 2007/12/06 00:09:44 tom Exp $ */ 2 3/************************************************************ 4 5Copyright 2007 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#ifdef HAVE_TERMCAP_H 46#include <termcap.h> 47#if defined(NCURSES_VERSION) 48 /* The tgetent emulation function in SVr4-style curses implementations 49 * (e.g., ncurses) ignores the buffer, so TERMCAP can't be set from it. 50 * Instead, just use terminfo. 51 */ 52#undef USE_TERMCAP 53#include <curses.h> 54#endif 55#else 56#undef ERR /* workaround for glibc 2.1.3 */ 57#include <curses.h> 58#ifdef HAVE_NCURSES_TERM_H 59#include <ncurses/term.h> 60#elif defined(HAVE_TERM_H) 61#include <term.h> /* tgetent() */ 62#endif /*CYGWIN */ 63#endif /* HAVE_TERMCAP_H */ 64 65/***====================================================================***/ 66 67#ifdef __cplusplus 68extern "C" { 69#endif 70 71#define MAX_FKEY 64 72#define MAX_FMOD 16 73 74#define CodeToXkey(code) (XK_Fn(MAX_FKEY) - (int) code) 75 76/* 77 * Store Xkey-data internally as a negative value, past the last values used 78 * for function keys. 79 */ 80#define XkeyData(code,mods) (-((mods-1) + (code*MAX_FMOD) + MAX_FKEY)) 81 82/* xtermcap.c */ 83extern Bool get_termcap(char * /* name */, char * /* buffer */); 84 85#if OPT_TCAP_FKEYS 86extern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */); 87#endif 88 89#if OPT_TCAP_QUERY 90extern int xtermcapKeycode(XtermWidget /* xw */, char ** /* params */, unsigned * /* state */, Bool * /* fkey */); 91#endif 92 93#ifdef __cplusplus 94 } 95#endif 96 97#endif /* included_xtermcap_h */ 98