Merge from vendor branch LIBPCAP:
[dragonfly.git] / contrib / nvi / tk / tki.h
1 /*-
2  * Copyright (c) 1993, 1994
3  *      The Regents of the University of California.  All rights reserved.
4  * Copyright (c) 1993, 1994, 1995, 1996
5  *      Keith Bostic.  All rights reserved.
6  *
7  * See the LICENSE file for redistribution information.
8  *
9  *      @(#)tki.h       8.6 (Berkeley) 4/27/96
10  */
11
12 #include <tcl.h>
13 #include <tk.h>
14
15 typedef struct _tk_private {
16         Tcl_Interp      *interp;/* Tcl interpreter cookie. */
17
18                                 /* Shared variables. */
19         int     tk_cursor_row;  /* Current cursor row. */
20         int     tk_cursor_col;  /* Current cursor col. */
21         int     tk_ssize_row;   /* Screen rows. */
22         int     tk_ssize_col;   /* Screen columns. */
23
24         struct termios orig;    /* Original terminal values. */
25
26         CHAR_T  ibuf[64];       /* Input keys. */
27         int     ibuf_cnt;       /* Number of input keys. */
28
29                                 /* Event queue. */
30         TAILQ_HEAD(_eventh, _event) evq;
31
32         int      killersig;     /* Killer signal. */
33 #define INDX_HUP        0
34 #define INDX_INT        1
35 #define INDX_TERM       2
36 #define INDX_WINCH      3
37 #define INDX_MAX        4       /* Original signal information. */
38         struct sigaction oact[INDX_MAX];
39
40 #define TK_LLINE_IV     0x0001  /* Last line is in inverse video. */
41 #define TK_SCR_VI_INIT  0x0002  /* Vi screen initialized. */
42 #define TK_SIGHUP       0x0004  /* SIGHUP arrived. */
43 #define TK_SIGINT       0x0008  /* SIGINT arrived. */
44 #define TK_SIGTERM      0x0010  /* SIGTERM arrived. */
45 #define TK_SIGWINCH     0x0020  /* SIGWINCH arrived. */
46         u_int16_t flags;
47 } TK_PRIVATE;
48
49 extern GS *__global_list;
50 #define TKP(sp)         ((TK_PRIVATE *)((sp)->gp->tk_private))
51 #define GTKP(gp)        ((TK_PRIVATE *)gp->tk_private)
52
53 /* Return possibilities from the keyboard read routine. */
54 typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t;
55
56 /* The screen line relative to a specific window. */
57 #define RLNO(sp, lno)   (sp)->woff + (lno)
58
59 /* Some functions can be safely ignored until the screen is running. */
60 #define VI_INIT_IGNORE(sp)                                              \
61         if (F_ISSET(sp, SC_VI) && !F_ISSET(TKP(sp), TK_SCR_VI_INIT))    \
62                 return (0);
63
64 #include "tk_extern.h"