Home | History | Annotate | Line # | Download | only in libcurses
curses_private.h revision 1.1
      1 /*	$NetBSD: curses_private.h,v 1.1 2000/04/11 13:57:09 blymn Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1998-2000 Brett Lymn
      5  *                         (blymn (at) baea.com.au, brett_lymn (at) 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 #define __CHARTEXT	0x000000ff	/* bits for 8-bit characters */
     46 	wchar_t	ch;			/* Character */
     47 #define __NORMAL	0x00000000	/* Added characters are normal. */
     48 #define __STANDOUT	0x00010000	/* Added characters are standout. */
     49 #define __UNDERSCORE	0x00020000	/* Added characters are underscored. */
     50 #define __REVERSE	0x00040000	/* Added characters are reverse
     51 					   video. */
     52 #define __BLINK		0x00080000	/* Added characters are blinking. */
     53 #define __DIM		0x00100000	/* Added characters are dim. */
     54 #define __BOLD		0x00200000	/* Added characters are bold. */
     55 #define __BLANK		0x00400000	/* Added characters are blanked. */
     56 #define __PROTECT	0x00800000	/* Added characters are protected. */
     57 #define __ALTCHARSET	0x01000000	/* Added characters are ACS */
     58 #define __COLOR		0xee000000	/* Color bits */
     59 #define __ATTRIBUTES	0xefff0000	/* All 8-bit attribute bits */
     60 #define __TERMATTR	0x00fc0000	/* Termcap attribute modes
     61 					   (reverse, blinking, dim, bold,
     62 					   blanked & protected */
     63 	attr_t	attr;			/* Attributes */
     64 };
     65 
     66 #define __LDATASIZE	(sizeof(__LDATA))
     67 
     68 struct __line {
     69 #define	__ISDIRTY	0x01		/* Line is dirty. */
     70 #define __ISPASTEOL	0x02		/* Cursor is past end of line */
     71 #define __FORCEPAINT	0x04		/* Force a repaint of the line */
     72 	unsigned int flags;
     73 	unsigned int hash;		/* Hash value for the line. */
     74 	int *firstchp, *lastchp;	/* First and last chngd columns ptrs */
     75 	int firstch, lastch;		/* First and last changed columns. */
     76 	__LDATA *line;			/* Pointer to the line text. */
     77 };
     78 
     79 struct __window {		/* Window structure. */
     80 	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
     81 	int begy, begx;			/* Window home. */
     82 	int cury, curx;			/* Current x, y coordinates. */
     83 	int maxy, maxx;			/* Maximum values for curx, cury. */
     84 	short ch_off;			/* x offset for firstch/lastch. */
     85 	__LINE **lines;			/* Array of pointers to the lines */
     86 	__LINE  *lspace;		/* line space (for cleanup) */
     87 	__LDATA *wspace;		/* window space (for cleanup) */
     88 
     89 #define	__ENDLINE	0x00000001	/* End of screen. */
     90 #define	__FLUSH		0x00000002	/* Fflush(stdout) after refresh. */
     91 #define	__FULLWIN	0x00000004	/* Window is a screen. */
     92 #define	__IDLINE	0x00000008	/* Insert/delete sequences. */
     93 #define	__SCROLLWIN	0x00000010	/* Last char will scroll window. */
     94 #define	__SCROLLOK	0x00000020	/* Scrolling ok. */
     95 #define	__CLEAROK	0x00000040	/* Clear on next refresh. */
     96 #define	__LEAVEOK	0x00000100	/* If cursor left */
     97 #define	__KEYPAD	0x00010000	/* If interpreting keypad codes */
     98 #define	__NOTIMEOUT	0x00020000	/* Wait indefinitely for func keys */
     99 	unsigned int flags;
    100 	int	delay;			/* delay for getch() */
    101 	attr_t	wattr;			/* Character attributes */
    102 };
    103