1e0b8e63eSJohn Marino /*- 2e0b8e63eSJohn Marino * Copyright (c) 1993, 1994 3e0b8e63eSJohn Marino * The Regents of the University of California. All rights reserved. 4e0b8e63eSJohn Marino * Copyright (c) 1993, 1994, 1995, 1996 5e0b8e63eSJohn Marino * Keith Bostic. All rights reserved. 6e0b8e63eSJohn Marino * 7e0b8e63eSJohn Marino * See the LICENSE file for redistribution information. 8e0b8e63eSJohn Marino */ 9e0b8e63eSJohn Marino 10e0b8e63eSJohn Marino #ifdef USE_WIDECHAR 11e0b8e63eSJohn Marino #define _XOPEN_SOURCE_EXTENDED 12e0b8e63eSJohn Marino #endif 13*b1ac2ebbSDaniel Fojt #ifdef HAVE_NCURSESW_NCURSES_H 14*b1ac2ebbSDaniel Fojt #include <ncursesw/ncurses.h> 15*b1ac2ebbSDaniel Fojt #elif defined HAVE_NCURSES_H 16e0b8e63eSJohn Marino #include <ncurses.h> 17e0b8e63eSJohn Marino #else 18e0b8e63eSJohn Marino #include <curses.h> 19e0b8e63eSJohn Marino #endif 20e0b8e63eSJohn Marino 21e0b8e63eSJohn Marino typedef struct _cl_private { 22e0b8e63eSJohn Marino char ibuf[256]; /* Input keys. */ 23e0b8e63eSJohn Marino 24e0b8e63eSJohn Marino size_t skip; /* Remaining keys. */ 25e0b8e63eSJohn Marino 26e0b8e63eSJohn Marino CONVWIN cw; /* Conversion buffer. */ 27e0b8e63eSJohn Marino 28e0b8e63eSJohn Marino int eof_count; /* EOF count. */ 29e0b8e63eSJohn Marino 30e0b8e63eSJohn Marino struct termios orig; /* Original terminal values. */ 31e0b8e63eSJohn Marino struct termios ex_enter;/* Terminal values to enter ex. */ 32e0b8e63eSJohn Marino struct termios vi_enter;/* Terminal values to enter vi. */ 33e0b8e63eSJohn Marino 34e0b8e63eSJohn Marino char *el; /* Clear to EOL terminal string. */ 35e0b8e63eSJohn Marino char *cup; /* Cursor movement terminal string. */ 36e0b8e63eSJohn Marino char *cuu1; /* Cursor up terminal string. */ 37e0b8e63eSJohn Marino char *rmso, *smso; /* Inverse video terminal strings. */ 38e0b8e63eSJohn Marino char *smcup, *rmcup; /* Terminal start/stop strings. */ 39e0b8e63eSJohn Marino 40e0b8e63eSJohn Marino char *oname; /* Original screen window name. */ 41e0b8e63eSJohn Marino 42e0b8e63eSJohn Marino SCR *focus; /* Screen that has the "focus". */ 43e0b8e63eSJohn Marino 44e0b8e63eSJohn Marino int killersig; /* Killer signal. */ 45e0b8e63eSJohn Marino #define INDX_HUP 0 46e0b8e63eSJohn Marino #define INDX_INT 1 47e0b8e63eSJohn Marino #define INDX_TERM 2 48e0b8e63eSJohn Marino #define INDX_WINCH 3 49e0b8e63eSJohn Marino #define INDX_MAX 4 /* Original signal information. */ 50e0b8e63eSJohn Marino struct sigaction oact[INDX_MAX]; 51e0b8e63eSJohn Marino 52e0b8e63eSJohn Marino enum { /* Tty group write mode. */ 53e0b8e63eSJohn Marino TGW_UNKNOWN=0, TGW_SET, TGW_UNSET } tgw; 54e0b8e63eSJohn Marino 55e0b8e63eSJohn Marino enum { /* Terminal initialization strings. */ 56e0b8e63eSJohn Marino TE_SENT=0, TI_SENT } ti_te; 57e0b8e63eSJohn Marino 58e0b8e63eSJohn Marino #define CL_IN_EX 0x0001 /* Currently running ex. */ 59e0b8e63eSJohn Marino #define CL_LAYOUT 0x0002 /* Screen layout changed. */ 60e0b8e63eSJohn Marino #define CL_RENAME 0x0004 /* X11 xterm icon/window renamed. */ 61e0b8e63eSJohn Marino #define CL_RENAME_OK 0x0008 /* User wants the windows renamed. */ 62e0b8e63eSJohn Marino #define CL_SCR_EX_INIT 0x0010 /* Ex screen initialized. */ 63e0b8e63eSJohn Marino #define CL_SCR_VI_INIT 0x0020 /* Vi screen initialized. */ 64e0b8e63eSJohn Marino #define CL_SIGHUP 0x0040 /* SIGHUP arrived. */ 65e0b8e63eSJohn Marino #define CL_SIGINT 0x0080 /* SIGINT arrived. */ 66e0b8e63eSJohn Marino #define CL_SIGTERM 0x0100 /* SIGTERM arrived. */ 67e0b8e63eSJohn Marino #define CL_SIGWINCH 0x0200 /* SIGWINCH arrived. */ 68e0b8e63eSJohn Marino #define CL_STDIN_TTY 0x0400 /* Talking to a terminal. */ 69e0b8e63eSJohn Marino u_int32_t flags; 70e0b8e63eSJohn Marino } CL_PRIVATE; 71e0b8e63eSJohn Marino 72e0b8e63eSJohn Marino #define CLP(sp) ((CL_PRIVATE *)((sp)->gp->cl_private)) 73e0b8e63eSJohn Marino #define GCLP(gp) ((CL_PRIVATE *)gp->cl_private) 74e0b8e63eSJohn Marino #define CLSP(sp) ((WINDOW *)((sp)->cl_private)) 75e0b8e63eSJohn Marino 76e0b8e63eSJohn Marino /* Return possibilities from the keyboard read routine. */ 77e0b8e63eSJohn Marino typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t; 78e0b8e63eSJohn Marino 79e0b8e63eSJohn Marino /* The screen position relative to a specific window. */ 80e0b8e63eSJohn Marino #define RCNO(sp, cno) (cno) 81e0b8e63eSJohn Marino #define RLNO(sp, lno) (lno) 82e0b8e63eSJohn Marino 83c5dc3490SJohn Marino #include "cl_extern.h" 84