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