1/* $NetBSD: cl.h,v 1.3 2015/11/25 20:25:20 christos Exp $ */ 2/*- 3 * Copyright (c) 1993, 1994 4 * The Regents of the University of California. All rights reserved. 5 * Copyright (c) 1993, 1994, 1995, 1996 6 * Keith Bostic. All rights reserved. 7 * 8 * See the LICENSE file for redistribution information. 9 * 10 * Id: cl.h,v 10.32 2001/08/28 11:33:40 skimo Exp (Berkeley) Date: 2001/08/28 11:33:40 11 */ 12 13/* Avoid clash on OSF1 */ 14#undef DB 15 16#ifdef USE_SLANG_CURSES 17#include <slcurses.h> 18#else 19#ifdef HAVE_NCURSESW_NCURSES_H /* { */ 20#include <ncursesw/ncurses.h> 21#else /* } { */ 22#ifdef HAVE_NCURSES_H /* { */ 23#include <ncurses.h> 24#else /* } { */ 25#include <curses.h> 26#include <term.h> 27#include <termcap.h> 28#endif /* } */ 29#endif 30#endif 31 32typedef struct _cl_private { 33 char ibuf[256]; /* Input keys. */ 34 35 size_t skip; /* Remaining keys. */ 36 37 CONVWIN cw; /* Conversion buffer. */ 38 39 int eof_count; /* EOF count. */ 40 41 struct termios orig; /* Original terminal values. */ 42 struct termios ex_enter;/* Terminal values to enter ex. */ 43 struct termios vi_enter;/* Terminal values to enter vi. */ 44 45 SCREEN *screen; /* Curses screen. */ 46 47 char *el; /* Clear to EOL terminal string. */ 48 char *cup; /* Cursor movement terminal string. */ 49 char *cuu1; /* Cursor up terminal string. */ 50 char *rmso, *smso; /* Inverse video terminal strings. */ 51 char *smcup, *rmcup; /* Terminal start/stop strings. */ 52 53 char *oname; /* Original screen window name. */ 54 55 SCR *focus; /* Screen that has the "focus". */ 56 57 int killersig; /* Killer signal. */ 58#define INDX_HUP 0 59#define INDX_INT 1 60#define INDX_TERM 2 61#define INDX_WINCH 3 62#define INDX_MAX 4 /* Original signal information. */ 63 struct sigaction oact[INDX_MAX]; 64 65 enum { /* Tty group write mode. */ 66 TGW_UNKNOWN=0, TGW_SET, TGW_UNSET } tgw; 67 68 enum { /* Terminal initialization strings. */ 69 TE_SENT=0, TI_SENT } ti_te; 70 71#define CL_IN_EX 0x0001 /* Currently running ex. */ 72#define CL_LAYOUT 0x0002 /* Screen layout changed. */ 73#define CL_RENAME 0x0004 /* X11 xterm icon/window renamed. */ 74#define CL_RENAME_OK 0x0008 /* User wants the windows renamed. */ 75#define CL_SCR_EX_INIT 0x0010 /* Ex screen initialized. */ 76#define CL_SCR_VI_INIT 0x0020 /* Vi screen initialized. */ 77#define CL_SIGHUP 0x0040 /* SIGHUP arrived. */ 78#define CL_SIGINT 0x0080 /* SIGINT arrived. */ 79#define CL_SIGTERM 0x0100 /* SIGTERM arrived. */ 80#define CL_SIGWINCH 0x0200 /* SIGWINCH arrived. */ 81#define CL_STDIN_TTY 0x0400 /* Talking to a terminal. */ 82#define CL_SETUPTERM 0x0800 /* Terminal initialized. */ 83#define CL_CHANGE_TERM 0x1000 /* Terminal changed. */ 84 u_int32_t flags; 85} CL_PRIVATE; 86 87#define CLP(sp) ((CL_PRIVATE *)((sp)->gp->cl_private)) 88#define GCLP(gp) ((CL_PRIVATE *)gp->cl_private) 89#define CLSP(sp) ((WINDOW *)((sp)->cl_private)) 90 91/* Return possibilities from the keyboard read routine. */ 92typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t; 93 94/* The screen position relative to a specific window. */ 95/* 96#define RCNO(sp, cno) (sp)->coff + (cno) 97#define RLNO(sp, lno) (sp)->roff + (lno) 98*/ 99#define RCNO(sp, cno) (cno) 100#define RLNO(sp, lno) (lno) 101 102/* 103 * XXX 104 * Some implementations of curses.h don't define these for us. Used for 105 * compatibility only. 106 */ 107#ifndef TRUE 108#define TRUE 1 109#endif 110#ifndef FALSE 111#define FALSE 0 112#endif 113 114#include "cl_extern.h" 115 116#ifdef USE_PERL_SETENV 117#include "perl_api_extern.h" 118#define cl_setenv(sp,name,val) perl_setenv(sp,name,val) 119#define cl_unsetenv(sp,name) perl_setenv(sp,name,NULL) 120#else 121#define cl_setenv(sp,name,val) setenv(name,val,1) 122#define cl_unsetenv(sp,name) unsetenv(name) 123#endif 124