Annotation of src/lib/libcurses/curses_private.h, Revision 1.6
1.6 ! blymn 1: /* $NetBSD: curses_private.h,v 1.5 2000/04/18 22:43:25 jdc 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: #define __FORCEPAINT 0x04 /* Force a repaint of the line */
57: unsigned int flags;
58: unsigned int hash; /* Hash value for the line. */
59: int *firstchp, *lastchp; /* First and last chngd columns ptrs */
60: int firstch, lastch; /* First and last changed columns. */
61: __LDATA *line; /* Pointer to the line text. */
62: };
63:
64: struct __window { /* Window structure. */
65: struct __window *nextp, *orig; /* Subwindows list and parent. */
66: int begy, begx; /* Window home. */
67: int cury, curx; /* Current x, y coordinates. */
68: int maxy, maxx; /* Maximum values for curx, cury. */
69: short ch_off; /* x offset for firstch/lastch. */
70: __LINE **lines; /* Array of pointers to the lines */
71: __LINE *lspace; /* line space (for cleanup) */
72: __LDATA *wspace; /* window space (for cleanup) */
73:
74: #define __ENDLINE 0x00000001 /* End of screen. */
75: #define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */
76: #define __FULLWIN 0x00000004 /* Window is a screen. */
77: #define __IDLINE 0x00000008 /* Insert/delete sequences. */
78: #define __SCROLLWIN 0x00000010 /* Last char will scroll window. */
79: #define __SCROLLOK 0x00000020 /* Scrolling ok. */
80: #define __CLEAROK 0x00000040 /* Clear on next refresh. */
81: #define __LEAVEOK 0x00000100 /* If cursor left */
82: #define __KEYPAD 0x00010000 /* If interpreting keypad codes */
83: #define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */
84: unsigned int flags;
85: int delay; /* delay for getch() */
86: attr_t wattr; /* Character attributes */
1.5 jdc 87: wchar_t bch; /* Background character */
1.2 jdc 88: attr_t battr; /* Background attributes */
1.1 blymn 89: };
1.5 jdc 90:
91: /* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */
92: #define __TERMATTR \
93: (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT)
1.2 jdc 94:
1.3 jdc 95: struct __winlist {
96: struct __window *winp; /* The window. */
97: struct __winlist *nextp; /* Next window. */
98: };
99:
1.2 jdc 100: /* Private functions. */
101: #ifdef DEBUG
1.4 blymn 102: void __CTRACE(const char *fmt, ...);
1.2 jdc 103: #endif
1.4 blymn 104: int __delay(void);
105: unsigned int __hash(char *s, int len);
106: void __id_subwins(WINDOW *orig);
107: void __init_getch(char *sp);
108: void __init_acs(void);
109: char *__longname(char *bp, char *def); /* Original BSD version */
110: int __mvcur(int ly, int lx, int y, int x, int in_refresh);
111: int __nodelay(void);
112: int __notimeout(void);
113: char *__parse_cap(const char *, ...);
114: void __restartwin(void);
115: void __restore_colors(void);
1.6 ! blymn 116: void __restore_cursor_vis(void);
! 117: void __restore_meta_state(void);
1.4 blymn 118: void __restore_termios(void);
119: void __restore_stophandler(void);
120: void __save_termios(void);
121: void __set_color(attr_t attr);
122: void __set_stophandler(void);
123: void __set_subwin(WINDOW *orig, WINDOW *win);
124: void __startwin(void);
125: void __stop_signal_handler(int signo);
126: int __stopwin(void);
127: void __swflags(WINDOW *win);
128: int __timeout(int delay);
129: int __touchline(WINDOW *win, int y, int sx, int ex, int force);
130: int __touchwin(WINDOW *win);
131: char *__tscroll(const char *cap, int n1, int n2);
132: int __waddch(WINDOW *win, __LDATA *dp);
1.2 jdc 133:
134: /* Private #defines. */
135: #define min(a,b) (a < b ? a : b)
136: #define max(a,b) (a > b ? a : b)
137:
138: /* Private externs. */
1.3 jdc 139: extern int __echoit;
140: extern int __endwin;
141: extern int __pfast;
142: extern int __rawmode;
143: extern int __noqch;
144: extern attr_t __nca;
145: extern struct __winlist *__winlistp;
CVSweb <webmaster@jp.NetBSD.org>