Home | History | Annotate | Line # | Download | only in libcurses
curses_private.h revision 1.2
      1  1.2    jdc /*	$NetBSD: curses_private.h,v 1.2 2000/04/12 21:46:27 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.1  blymn };
     48  1.1  blymn 
     49  1.1  blymn #define __LDATASIZE	(sizeof(__LDATA))
     50  1.1  blymn 
     51  1.1  blymn struct __line {
     52  1.1  blymn #define	__ISDIRTY	0x01		/* Line is dirty. */
     53  1.1  blymn #define __ISPASTEOL	0x02		/* Cursor is past end of line */
     54  1.1  blymn #define __FORCEPAINT	0x04		/* Force a repaint of the line */
     55  1.1  blymn 	unsigned int flags;
     56  1.1  blymn 	unsigned int hash;		/* Hash value for the line. */
     57  1.1  blymn 	int *firstchp, *lastchp;	/* First and last chngd columns ptrs */
     58  1.1  blymn 	int firstch, lastch;		/* First and last changed columns. */
     59  1.1  blymn 	__LDATA *line;			/* Pointer to the line text. */
     60  1.1  blymn };
     61  1.1  blymn 
     62  1.1  blymn struct __window {		/* Window structure. */
     63  1.1  blymn 	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
     64  1.1  blymn 	int begy, begx;			/* Window home. */
     65  1.1  blymn 	int cury, curx;			/* Current x, y coordinates. */
     66  1.1  blymn 	int maxy, maxx;			/* Maximum values for curx, cury. */
     67  1.1  blymn 	short ch_off;			/* x offset for firstch/lastch. */
     68  1.1  blymn 	__LINE **lines;			/* Array of pointers to the lines */
     69  1.1  blymn 	__LINE  *lspace;		/* line space (for cleanup) */
     70  1.1  blymn 	__LDATA *wspace;		/* window space (for cleanup) */
     71  1.1  blymn 
     72  1.1  blymn #define	__ENDLINE	0x00000001	/* End of screen. */
     73  1.1  blymn #define	__FLUSH		0x00000002	/* Fflush(stdout) after refresh. */
     74  1.1  blymn #define	__FULLWIN	0x00000004	/* Window is a screen. */
     75  1.1  blymn #define	__IDLINE	0x00000008	/* Insert/delete sequences. */
     76  1.1  blymn #define	__SCROLLWIN	0x00000010	/* Last char will scroll window. */
     77  1.1  blymn #define	__SCROLLOK	0x00000020	/* Scrolling ok. */
     78  1.1  blymn #define	__CLEAROK	0x00000040	/* Clear on next refresh. */
     79  1.1  blymn #define	__LEAVEOK	0x00000100	/* If cursor left */
     80  1.1  blymn #define	__KEYPAD	0x00010000	/* If interpreting keypad codes */
     81  1.1  blymn #define	__NOTIMEOUT	0x00020000	/* Wait indefinitely for func keys */
     82  1.1  blymn 	unsigned int flags;
     83  1.1  blymn 	int	delay;			/* delay for getch() */
     84  1.1  blymn 	attr_t	wattr;			/* Character attributes */
     85  1.2    jdc 	wchar_t	bchar;			/* Background character */
     86  1.2    jdc 	attr_t	battr;			/* Background attributes */
     87  1.1  blymn };
     88  1.2    jdc 
     89  1.2    jdc /* Private functions. */
     90  1.2    jdc #ifdef DEBUG
     91  1.2    jdc void	 __CTRACE __P((const char *, ...));
     92  1.2    jdc #endif
     93  1.2    jdc int	 __delay __P((void));
     94  1.2    jdc unsigned int __hash __P((char *, int));
     95  1.2    jdc void	 __id_subwins __P((WINDOW *));
     96  1.2    jdc void	 __init_getch __P((char *));
     97  1.2    jdc void	 __init_acs __P((void));
     98  1.2    jdc char	*__longname __P((char *, char *));	/* Original BSD version */
     99  1.2    jdc int	 __mvcur __P((int, int, int, int, int));
    100  1.2    jdc int	 __nodelay __P((void));
    101  1.2    jdc int	 __notimeout __P((void));
    102  1.2    jdc char	*__parse_cap __P((const char *, ...));
    103  1.2    jdc void	 __restartwin __P((void));
    104  1.2    jdc void	 __restore_colors __P((void));
    105  1.2    jdc void	 __restore_termios __P((void));
    106  1.2    jdc void	 __restore_stophandler __P((void));
    107  1.2    jdc void	 __save_termios __P((void));
    108  1.2    jdc void	 __set_color __P((attr_t));
    109  1.2    jdc void	 __set_stophandler __P((void));
    110  1.2    jdc void	 __set_subwin __P((WINDOW *, WINDOW *));
    111  1.2    jdc void	 __startwin __P((void));
    112  1.2    jdc void	 __stop_signal_handler __P((int));
    113  1.2    jdc int	 __stopwin __P((void));
    114  1.2    jdc void	 __swflags __P((WINDOW *));
    115  1.2    jdc int	 __timeout __P((int));
    116  1.2    jdc int	 __touchline __P((WINDOW *, int, int, int, int));
    117  1.2    jdc int	 __touchwin __P((WINDOW *));
    118  1.2    jdc char	*__tscroll __P((const char *, int, int));
    119  1.2    jdc int	 __waddch __P((WINDOW *, __LDATA *));
    120  1.2    jdc 
    121  1.2    jdc /* Private #defines. */
    122  1.2    jdc #define	min(a,b)	(a < b ? a : b)
    123  1.2    jdc #define	max(a,b)	(a > b ? a : b)
    124  1.2    jdc 
    125  1.2    jdc /* Private externs. */
    126  1.2    jdc extern int	 __echoit;
    127  1.2    jdc extern int	 __endwin;
    128  1.2    jdc extern int	 __pfast;
    129  1.2    jdc extern int	 __rawmode;
    130  1.2    jdc extern int	 __noqch;
    131  1.2    jdc extern attr_t	 __nca;
    132