X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=include%2Fcurses.h.in;h=9e9077f0414777ac3764670d1699b095cad434f6;hp=3b8696014d211c3f7f2711bb78cdb606467159f7;hb=55ccd2b959766810cf7db8d1c4462f338ce0afc8;hpb=a8987e73ec254703634802b4f7ee30d3a485524d;ds=sidebyside diff --git a/include/curses.h.in b/include/curses.h.in index 3b869601..9e9077f0 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,10 +29,10 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-on * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.148 2004/01/14 23:50:12 tom Exp $ */ +/* $Id: curses.h.in,v 1.157 2005/07/02 16:58:28 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -55,8 +55,23 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION @NCURSES_MOUSE_VERSION@ + +/* + * Definitions to facilitate DLL's. + */ #include +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H @cf_cv_header_stdbool_h@ +#endif + /* * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses * configured using --disable-macros. @@ -96,7 +111,13 @@ #undef NCURSES_CH_T #define NCURSES_CH_T @NCURSES_CH_T@ +#if @cf_cv_enable_lp64@ && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else typedef unsigned @cf_cv_typeof_chtype@ chtype; +typedef unsigned @cf_cv_typeof_mmask_t@ mmask_t; +#endif #include #include @@ -132,7 +153,7 @@ typedef @cf_cv_type_of_bool@ NCURSES_BOOL; #else /* c89, c99, etc. */ -#if @cf_cv_header_stdbool_h@ +#if NCURSES_ENABLE_STDBOOL_H #include /* use whatever the C compiler decides bool really is */ #define NCURSES_BOOL bool @@ -146,6 +167,9 @@ typedef @cf_cv_type_of_bool@ NCURSES_BOOL; #ifdef __cplusplus extern "C" { +#define NCURSES_CAST(type,value) static_cast(value) +#else +#define NCURSES_CAST(type,value) (type)(value) #endif /* @@ -192,7 +216,7 @@ extern NCURSES_EXPORT_VAR(chtype*) _nc_acs_map(void); extern NCURSES_EXPORT_VAR(chtype) acs_map[]; #endif -#define NCURSES_ACS(c) (acs_map[(unsigned char)c]) +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,c)]) /* VT100 symbols begin here */ #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ @@ -310,6 +334,9 @@ typedef struct { attr_t attr; wchar_t chars[CCHARW_MAX]; +#if @NCURSES_EXT_COLORS@ + int ext_color; /* color pair, must be more than 16-bits */ +#endif } cchar_t; @@ -366,6 +393,9 @@ struct _win_st #ifdef _XOPEN_SOURCE_EXTENDED cchar_t _bkgrnd; /* current background char/attribute pair */ +#if @NCURSES_EXT_COLORS@ + int _color; /* current color-pair for non-space character */ +#endif #endif }; @@ -788,7 +818,7 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define NCURSES_ATTR_SHIFT 8 #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) -#define A_NORMAL 0L +#define A_NORMAL (@cf_cv_1UL@ - @cf_cv_1UL@) #define A_ATTRIBUTES NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0) #define A_CHARTEXT (NCURSES_BITS(@cf_cv_1UL@,0) - @cf_cv_1UL@) #define A_COLOR NCURSES_BITS(((@cf_cv_1UL@) << 8) - @cf_cv_1UL@,0) @@ -808,8 +838,11 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define A_TOP NCURSES_BITS(@cf_cv_1UL@,21) #define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22) +/* + * These apply to the first 256 color pairs. + */ #define COLOR_PAIR(n) NCURSES_BITS(n, 0) -#define PAIR_NUMBER(a) ((int)(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)) +#define PAIR_NUMBER(a) (NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT))) /* * pseudo functions @@ -851,11 +884,16 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define wstandout(win) (wattrset(win,A_STANDOUT)) #define wstandend(win) (wattrset(win,A_NORMAL)) -#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) -#define wattron(win,at) wattr_on(win, (attr_t) at, (void *)0) -#define wattroff(win,at) wattr_off(win, (attr_t) at, (void *)0) +#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if @NCURSES_EXT_COLORS@ +#define wattrset(win,at) ((win)->_color = PAIR_NUMBER(at), \ + (win)->_attrs = (at)) +#else #define wattrset(win,at) ((win)->_attrs = (at)) +#endif #define scroll(win) wscrl(win,1) @@ -940,7 +978,7 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) #define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) #define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) -#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win)) +#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) #define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) #define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) #define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) @@ -972,16 +1010,26 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) /* - * Some wide-character functions do not depend on the extensions. + * Some wide-character functions can be implemented without the extensions. */ #define getbkgd(win) ((win)->_bkgd) #define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) #define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) +#if @NCURSES_EXT_COLORS@ +#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \ + (win)->_color = (p), \ + OK) +#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ + (void)((p) != 0 && (*(p) = (win)->_color)), \ + OK) +#else +#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) #define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ OK) +#endif /* * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use