curses_private.h revision 1.11 1 1.11 jdc /* $NetBSD: curses_private.h,v 1.11 2000/12/19 21:34:25 jdc Exp $ */
2 1.1 blymn
3 1.1 blymn /*-
4 1.1 blymn * Copyright (c) 1998-2000 Brett Lymn
5 1.1 blymn * (blymn (at) baea.com.au, brett_lymn (at) yahoo.com.au)
6 1.1 blymn * All rights reserved.
7 1.1 blymn *
8 1.1 blymn * This code has been donated to The NetBSD Foundation by the Author.
9 1.1 blymn *
10 1.1 blymn * Redistribution and use in source and binary forms, with or without
11 1.1 blymn * modification, are permitted provided that the following conditions
12 1.1 blymn * are met:
13 1.1 blymn * 1. Redistributions of source code must retain the above copyright
14 1.1 blymn * notice, this list of conditions and the following disclaimer.
15 1.1 blymn * 2. The name of the author may not be used to endorse or promote products
16 1.1 blymn * derived from this software withough specific prior written permission
17 1.1 blymn *
18 1.1 blymn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.1 blymn * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.1 blymn * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.1 blymn * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 1.1 blymn * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 1.1 blymn * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 1.1 blymn * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 1.1 blymn * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 1.1 blymn * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 1.1 blymn * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 1.1 blymn *
29 1.1 blymn *
30 1.1 blymn */
31 1.1 blymn
32 1.1 blymn /* Private structure definitions for curses. */
33 1.1 blymn /*
34 1.1 blymn * A window an array of __LINE structures pointed to by the 'lines' pointer.
35 1.1 blymn * A line is an array of __LDATA structures pointed to by the 'line' pointer.
36 1.1 blymn *
37 1.1 blymn * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
38 1.1 blymn * fields are added -- padding fields with *constant values* should ensure
39 1.1 blymn * that the compiler will not generate any padding when storing an array of
40 1.1 blymn * __LDATA structures. This is to enable consistent use of memcmp, and memcpy
41 1.1 blymn * for comparing and copying arrays.
42 1.1 blymn */
43 1.1 blymn
44 1.1 blymn struct __ldata {
45 1.1 blymn wchar_t ch; /* Character */
46 1.1 blymn attr_t attr; /* Attributes */
47 1.5 jdc wchar_t bch; /* Background character */
48 1.5 jdc attr_t battr; /* Background attributes */
49 1.1 blymn };
50 1.1 blymn
51 1.1 blymn #define __LDATASIZE (sizeof(__LDATA))
52 1.1 blymn
53 1.1 blymn struct __line {
54 1.1 blymn #define __ISDIRTY 0x01 /* Line is dirty. */
55 1.1 blymn #define __ISPASTEOL 0x02 /* Cursor is past end of line */
56 1.1 blymn unsigned int flags;
57 1.1 blymn unsigned int hash; /* Hash value for the line. */
58 1.1 blymn int *firstchp, *lastchp; /* First and last chngd columns ptrs */
59 1.1 blymn int firstch, lastch; /* First and last changed columns. */
60 1.1 blymn __LDATA *line; /* Pointer to the line text. */
61 1.1 blymn };
62 1.1 blymn
63 1.1 blymn struct __window { /* Window structure. */
64 1.1 blymn struct __window *nextp, *orig; /* Subwindows list and parent. */
65 1.1 blymn int begy, begx; /* Window home. */
66 1.1 blymn int cury, curx; /* Current x, y coordinates. */
67 1.1 blymn int maxy, maxx; /* Maximum values for curx, cury. */
68 1.1 blymn short ch_off; /* x offset for firstch/lastch. */
69 1.1 blymn __LINE **lines; /* Array of pointers to the lines */
70 1.1 blymn __LINE *lspace; /* line space (for cleanup) */
71 1.1 blymn __LDATA *wspace; /* window space (for cleanup) */
72 1.1 blymn
73 1.1 blymn #define __ENDLINE 0x00000001 /* End of screen. */
74 1.1 blymn #define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */
75 1.1 blymn #define __FULLWIN 0x00000004 /* Window is a screen. */
76 1.1 blymn #define __IDLINE 0x00000008 /* Insert/delete sequences. */
77 1.1 blymn #define __SCROLLWIN 0x00000010 /* Last char will scroll window. */
78 1.1 blymn #define __SCROLLOK 0x00000020 /* Scrolling ok. */
79 1.1 blymn #define __CLEAROK 0x00000040 /* Clear on next refresh. */
80 1.1 blymn #define __LEAVEOK 0x00000100 /* If cursor left */
81 1.1 blymn #define __KEYPAD 0x00010000 /* If interpreting keypad codes */
82 1.1 blymn #define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */
83 1.1 blymn unsigned int flags;
84 1.1 blymn int delay; /* delay for getch() */
85 1.1 blymn attr_t wattr; /* Character attributes */
86 1.5 jdc wchar_t bch; /* Background character */
87 1.2 jdc attr_t battr; /* Background attributes */
88 1.1 blymn };
89 1.5 jdc
90 1.5 jdc /* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */
91 1.5 jdc #define __TERMATTR \
92 1.5 jdc (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT)
93 1.2 jdc
94 1.3 jdc struct __winlist {
95 1.3 jdc struct __window *winp; /* The window. */
96 1.3 jdc struct __winlist *nextp; /* Next window. */
97 1.3 jdc };
98 1.3 jdc
99 1.11 jdc /* Private variables. */
100 1.11 jdc extern char __GT; /* Gtty indicates tabs. */
101 1.11 jdc extern char __NONL; /* Term can't hack LF doing a CR. */
102 1.11 jdc extern char __UPPERCASE; /* Terminal is uppercase only. */
103 1.11 jdc
104 1.11 jdc extern int My_term; /* Use Def_term regardless. */
105 1.11 jdc extern const char *Def_term; /* Default terminal type. */
106 1.11 jdc
107 1.11 jdc /* Termcap capabilities. */
108 1.11 jdc extern char __tc_pc;
109 1.11 jdc extern char __tc_am, __tc_bs, __tc_cc, __tc_da, __tc_eo,
110 1.11 jdc __tc_hc, __tc_hl, __tc_in, __tc_mi, __tc_ms,
111 1.11 jdc __tc_nc, __tc_ns, __tc_os, __tc_ul, __tc_ut,
112 1.11 jdc __tc_xb, __tc_xn, __tc_xt, __tc_xs, __tc_xx;
113 1.11 jdc extern char __CA;
114 1.11 jdc extern int __tc_pa, __tc_Co, __tc_NC;
115 1.11 jdc extern char *__tc_ac, *__tc_AB, *__tc_ae, *__tc_AF, *__tc_AL,
116 1.11 jdc *__tc_al, *__tc_as, *__tc_bc, *__tc_bl, *__tc_bt,
117 1.11 jdc *__tc_cd, *__tc_ce, *__tc_cl, *__tc_cm, *__tc_cr,
118 1.11 jdc *__tc_cs, *__tc_dc, *__tc_DL, *__tc_dl, *__tc_dm,
119 1.11 jdc *__tc_DO, *__tc_do, *__tc_eA, *__tc_ed, *__tc_ei,
120 1.11 jdc *__tc_ho, *__tc_Ic, *__tc_ic, *__tc_im, *__tc_Ip,
121 1.11 jdc *__tc_ip, *__tc_k0, *__tc_k1, *__tc_k2, *__tc_k3,
122 1.11 jdc *__tc_k4, *__tc_k5, *__tc_k6, *__tc_k7, *__tc_k8,
123 1.11 jdc *__tc_k9, *__tc_kd, *__tc_ke, *__tc_kh, *__tc_kl,
124 1.11 jdc *__tc_kr, *__tc_ks, *__tc_ku, *__tc_LE, *__tc_ll,
125 1.11 jdc *__tc_ma, *__tc_mb, *__tc_md, *__tc_me, *__tc_mh,
126 1.11 jdc *__tc_mk, *__tc_mm, *__tc_mo, *__tc_mp, *__tc_mr,
127 1.11 jdc *__tc_nd, *__tc_nl, *__tc_oc, *__tc_op,
128 1.11 jdc *__tc_rc, *__tc_RI, *__tc_Sb, *__tc_sc, *__tc_se,
129 1.11 jdc *__tc_SF, *__tc_Sf, *__tc_sf, *__tc_so, *__tc_sp,
130 1.11 jdc *__tc_SR, *__tc_sr, *__tc_ta, *__tc_te, *__tc_ti,
131 1.11 jdc *__tc_uc, *__tc_ue, *__tc_UP, *__tc_up, *__tc_us,
132 1.11 jdc *__tc_vb, *__tc_ve, *__tc_vi, *__tc_vs;
133 1.11 jdc
134 1.2 jdc /* Private functions. */
135 1.2 jdc #ifdef DEBUG
136 1.4 blymn void __CTRACE(const char *fmt, ...);
137 1.2 jdc #endif
138 1.4 blymn int __delay(void);
139 1.4 blymn unsigned int __hash(char *s, int len);
140 1.4 blymn void __id_subwins(WINDOW *orig);
141 1.9 blymn void __init_getch(void);
142 1.4 blymn void __init_acs(void);
143 1.4 blymn char *__longname(char *bp, char *def); /* Original BSD version */
144 1.4 blymn int __mvcur(int ly, int lx, int y, int x, int in_refresh);
145 1.4 blymn int __nodelay(void);
146 1.4 blymn int __notimeout(void);
147 1.4 blymn char *__parse_cap(const char *, ...);
148 1.4 blymn void __restartwin(void);
149 1.4 blymn void __restore_colors(void);
150 1.6 blymn void __restore_cursor_vis(void);
151 1.6 blymn void __restore_meta_state(void);
152 1.4 blymn void __restore_termios(void);
153 1.4 blymn void __restore_stophandler(void);
154 1.4 blymn void __save_termios(void);
155 1.4 blymn void __set_color(attr_t attr);
156 1.4 blymn void __set_stophandler(void);
157 1.4 blymn void __set_subwin(WINDOW *orig, WINDOW *win);
158 1.4 blymn void __startwin(void);
159 1.4 blymn void __stop_signal_handler(int signo);
160 1.4 blymn int __stopwin(void);
161 1.4 blymn void __swflags(WINDOW *win);
162 1.4 blymn int __timeout(int delay);
163 1.10 mycroft int __touchline(WINDOW *win, int y, int sx, int ex);
164 1.4 blymn int __touchwin(WINDOW *win);
165 1.4 blymn char *__tscroll(const char *cap, int n1, int n2);
166 1.7 jdc void __unsetattr(int);
167 1.4 blymn int __waddch(WINDOW *win, __LDATA *dp);
168 1.2 jdc
169 1.2 jdc /* Private #defines. */
170 1.2 jdc #define min(a,b) (a < b ? a : b)
171 1.2 jdc #define max(a,b) (a > b ? a : b)
172 1.2 jdc
173 1.2 jdc /* Private externs. */
174 1.3 jdc extern int __echoit;
175 1.3 jdc extern int __endwin;
176 1.3 jdc extern int __pfast;
177 1.3 jdc extern int __rawmode;
178 1.3 jdc extern int __noqch;
179 1.3 jdc extern attr_t __nca;
180 1.11 jdc extern attr_t __mask_op, __mask_me, __mask_ue, __mask_se;
181 1.3 jdc extern struct __winlist *__winlistp;
182 1.7 jdc extern WINDOW *__virtscr;
183