]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 5.7 - patch 20100619
[ncurses.git] / ncurses / curses.priv.h
index 47b3e95e7f62fe7b4e105d2d1bedf1ef61d776ce..9c01c92e588deb66cc2b7242a59cbeb52dfe74bf 100644 (file)
@@ -35,7 +35,7 @@
 
 
 /*
- * $Id: curses.priv.h,v 1.457 2010/03/31 23:42:32 tom Exp $
+ * $Id: curses.priv.h,v 1.463 2010/05/20 23:22:46 tom Exp $
  *
  *     curses.priv.h
  *
@@ -365,7 +365,7 @@ color_t;
 #define if_EXT_COLORS(stmt)    stmt
 #define SetPair(value,p)       SetPair2((value).ext_color, AttrOf(value), p)
 #define SetPair2(c,a,p)                c = (p), \
-                               a = unColor2(a) | (A_COLOR & ColorPair(oldColor(c)))
+                               a = (unColor2(a) | (A_COLOR & ColorPair(oldColor(c))))
 #define GetPair(value)         GetPair2((value).ext_color, AttrOf(value))
 #define GetPair2(c,a)          ((c) ? (c) : PairNumber(a))
 #define oldColor(p)            (((p) > 255) ? 255 : (p))
@@ -457,6 +457,19 @@ NCURSES_EXPORT(int *)        _nc_ptr_Escdelay (SCREEN *);
            data.__data.__nusers)
 #define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name)
 
+#if USE_WEAK_SYMBOLS
+#if defined(__GNUC__)
+#  if defined __USE_ISOC99
+#    define _cat_pragma(exp)   _Pragma(#exp)
+#    define _weak_pragma(exp)  _cat_pragma(weak name)
+#  else
+#    define _weak_pragma(exp)
+#  endif
+#  define _declare(name)       __extension__ extern __typeof__(name) name
+#  define weak_symbol(name)    _weak_pragma(name) _declare(name) __attribute__((weak))
+#endif
+#endif
+
 #ifdef USE_PTHREADS
 
 #if USE_REENTRANT
@@ -474,19 +487,6 @@ extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
 #error POSIX threads requires --enable-reentrant option
 #endif
 
-#if USE_WEAK_SYMBOLS
-#if defined(__GNUC__)
-#  if defined __USE_ISOC99
-#    define _cat_pragma(exp)   _Pragma(#exp)
-#    define _weak_pragma(exp)  _cat_pragma(weak name)
-#  else
-#    define _weak_pragma(exp)
-#  endif
-#  define _declare(name)       __extension__ extern __typeof__(name) name
-#  define weak_symbol(name)    _weak_pragma(name) _declare(name) __attribute__((weak))
-#endif
-#endif
-
 #ifdef USE_PTHREADS
 #  if USE_WEAK_SYMBOLS
 weak_symbol(pthread_sigmask);
@@ -511,6 +511,19 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
 
 #else /* !USE_PTHREADS */
 
+#if USE_PTHREADS_EINTR
+#  if USE_WEAK_SYMBOLS
+#include <pthread.h>
+weak_symbol(pthread_sigmask);
+weak_symbol(pthread_kill);
+weak_symbol(pthread_self);
+weak_symbol(pthread_equal);
+extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
+#    undef  sigprocmask
+#    define sigprocmask _nc_sigprocmask
+#  endif
+#endif /* USE_PTHREADS_EINTR */
+
 #define _nc_init_pthreads()    /* nothing */
 #define _nc_mutex_init(obj)    /* nothing */
 
@@ -564,7 +577,7 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
 typedef unsigned colorpair_t;  /* type big enough to store PAIR_OF() */
 #define C_SHIFT 9              /* we need more bits than there are colors */
 #define C_MASK                 ((1 << C_SHIFT) - 1)
-#define PAIR_OF(fg, bg)                ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
+#define PAIR_OF(fg, bg)                (colorpair_t) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
 #define FORE_OF(c)             (((c) >> C_SHIFT) & C_MASK)
 #define BACK_OF(c)             ((c) & C_MASK)
 #define isDefaultColor(c)      ((c) >= COLOR_DEFAULT || (c) < 0)
@@ -838,6 +851,9 @@ typedef struct {
        int             use_pthreads;
 #define _nc_use_pthreads       _nc_globals.use_pthreads
 #endif
+#if USE_PTHREADS_EINTR
+       pthread_t       read_thread;            /* The reading thread */
+#endif
 } NCURSES_GLOBALS;
 
 extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
@@ -1249,6 +1265,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
 #define RESET_OUTCHARS() COUNT_OUTCHARS(-_nc_outchars)
 
 #define UChar(c)       ((unsigned char)(c))
+#define UShort(c)      ((unsigned short)(c))
 #define ChCharOf(c)    ((c) & (chtype)A_CHARTEXT)
 #define ChAttrOf(c)    ((c) & (chtype)A_ATTRIBUTES)
 
@@ -1341,7 +1358,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
 #define isWidecBase(ch)        (WidecExt(ch) == 1)
 #define isWidecExt(ch) (WidecExt(ch) > 1 && WidecExt(ch) < 32)
 #define SetWidecExt(dst, ext)  AttrOf(dst) &= ~A_CHARTEXT,             \
-                               AttrOf(dst) |= (ext + 1)
+                               AttrOf(dst) |= (attr_t) (ext + 1)
 
 #define if_WIDEC(code)  code
 #define Charable(ch)   ((SP_PARM != 0 && SP_PARM->_legacy_coding)      \
@@ -1394,11 +1411,11 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
 
 #define CHANGED_CELL(line,col) \
        if (line->firstchar == _NOCHANGE) \
-               line->firstchar = line->lastchar = col; \
+               line->firstchar = line->lastchar = (NCURSES_SIZE_T) col; \
        else if ((col) < line->firstchar) \
-               line->firstchar = col; \
+               line->firstchar = (NCURSES_SIZE_T) col; \
        else if ((col) > line->lastchar) \
-               line->lastchar = col
+               line->lastchar = (NCURSES_SIZE_T) col
 
 #define CHANGED_RANGE(line,start,end) \
        if (line->firstchar == _NOCHANGE \
@@ -1655,10 +1672,12 @@ extern  NCURSES_EXPORT(void) name (void); \
 #define EVENTLIST_0th(param) param
 #define EVENTLIST_1st(param) param
 #define EVENTLIST_2nd(param) , param
+#define TWAIT_MASK (TW_ANY | TW_EVENT)
 #else
 #define EVENTLIST_0th(param) void
 #define EVENTLIST_1st(param) /* nothing */
 #define EVENTLIST_2nd(param) /* nothing */
+#define TWAIT_MASK TW_ANY
 #endif
 
 #if NCURSES_EXPANDED && NCURSES_EXT_FUNCS
@@ -1956,6 +1975,7 @@ extern NCURSES_EXPORT_VAR(int *) _nc_oldnums;
 #define _nc_alloc_screen_sp() typeCalloc(SCREEN, 1)
 
 #if BROKEN_LINKER
+#define SP _nc_screen()
 extern NCURSES_EXPORT(SCREEN *) _nc_screen (void);
 extern NCURSES_EXPORT(int)      _nc_alloc_screen (void);
 extern NCURSES_EXPORT(void)     _nc_set_screen (SCREEN *);
@@ -2044,6 +2064,7 @@ typedef struct _termInfo
     int  maxpairs;
     int  nocolorvideo;
 
+    int  numbuttons;
     int  numlabels;
     int  labelwidth;
     int  labelheight;
@@ -2069,6 +2090,7 @@ typedef struct term_driver {
     void   (*initcolor)(struct DriverTCB*,short,short,short,short);
     void   (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int));
     void   (*initmouse)(struct DriverTCB*);
+    int    (*testmouse)(struct DriverTCB*,int);
     void   (*setfilter)(struct DriverTCB*);
     void   (*hwlabel)(struct DriverTCB*,int,char*);
     void   (*hwlabelOnOff)(struct DriverTCB*,bool);