]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 5.9 - patch 20110625
[ncurses.git] / ncurses / curses.priv.h
index 3d357777acebd6da65bd9555a362d80f16acbb1b..a9d2e128b1e558b54669027532aaea2ce73303b0 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 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            *
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.470 2010/12/25 23:45:09 tom Exp $
+ * $Id: curses.priv.h,v 1.480 2011/06/25 20:36:52 tom Exp $
  *
  *     curses.priv.h
  *
@@ -61,10 +61,15 @@ extern "C" {
 #define MODULE_ID(id) /*nothing*/
 #endif
 
+#if !(defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))
+#define _POSIX_SOURCE
+#endif
+
 #include <stddef.h>            /* for offsetof */
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -191,6 +196,18 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
 #define end_va_copy(dst)       /* nothing */
 #endif
 
+/*
+ * Either/both S_ISxxx and/or S_IFxxx are defined in sys/types.h; some systems
+ * lack one or the other.
+ */
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG)
+#endif
+
 /*
  * Scroll hints are useless when hashmap is used
  */
@@ -325,6 +342,7 @@ color_t;
 #endif
 
 #include <term.h>
+#include <nc_termios.h>
 
 /*
  * Reduce dependency on cur_term global by using terminfo data from SCREEN's
@@ -490,6 +508,7 @@ extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
 #ifdef USE_PTHREADS
 #  if USE_WEAK_SYMBOLS
 weak_symbol(pthread_sigmask);
+weak_symbol(pthread_kill);
 weak_symbol(pthread_self);
 weak_symbol(pthread_equal);
 weak_symbol(pthread_mutex_init);
@@ -1014,6 +1033,7 @@ struct screen {
        int             _pair_count;    /* count of color pairs              */
        int             _pair_limit;    /* actual limit of color-pairs       */
 #if NCURSES_EXT_FUNCS
+       bool            _assumed_color; /* use assumed colors                */
        bool            _default_color; /* use default colors                */
        bool            _has_sgr_39_49; /* has ECMA default color support    */
        int             _default_fg;    /* assumed default foreground        */
@@ -1411,25 +1431,25 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
 
 #define CHANGED_CELL(line,col) \
        if (line->firstchar == _NOCHANGE) \
-               line->firstchar = line->lastchar = (NCURSES_SIZE_T) col; \
+               line->firstchar = line->lastchar = (NCURSES_SIZE_T) (col); \
        else if ((col) < line->firstchar) \
-               line->firstchar = (NCURSES_SIZE_T) col; \
+               line->firstchar = (NCURSES_SIZE_T) (col); \
        else if ((col) > line->lastchar) \
-               line->lastchar = (NCURSES_SIZE_T) col
+               line->lastchar = (NCURSES_SIZE_T) (col)
 
 #define CHANGED_RANGE(line,start,end) \
        if (line->firstchar == _NOCHANGE \
         || line->firstchar > (start)) \
-               line->firstchar = (NCURSES_SIZE_T) start; \
+               line->firstchar = (NCURSES_SIZE_T) (start); \
        if (line->lastchar == _NOCHANGE \
         || line->lastchar < (end)) \
-               line->lastchar = (NCURSES_SIZE_T) end
+               line->lastchar = (NCURSES_SIZE_T) (end)
 
 #define CHANGED_TO_EOL(line,start,end) \
        if (line->firstchar == _NOCHANGE \
         || line->firstchar > (start)) \
-               line->firstchar = (NCURSES_SIZE_T) start; \
-       line->lastchar = (NCURSES_SIZE_T) end
+               line->firstchar = (NCURSES_SIZE_T) (start); \
+       line->lastchar = (NCURSES_SIZE_T) (end)
 
 #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
 
@@ -1505,7 +1525,9 @@ extern NCURSES_EXPORT(void)       _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
 
 #define TR(n, a)       if (USE_TRACEF(n)) _nc_locked_tracef a
 #define T(a)           TR(TRACE_CALLS, a)
-#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
+#define TRACE_RETURN(value,type)     return _nc_retrace_##type(value)
+#define TRACE_RETURN2(value,dst,src) return _nc_retrace_##dst##_##src(value)
+#define TRACE_RETURN_SP(value,type)  return _nc_retrace_##type(SP_PARM, value)
 
 #define NonNull(s)     ((s) != 0 ? s : "<null>")
 
@@ -1517,6 +1539,8 @@ extern NCURSES_EXPORT(void)       _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
 #define returnChar(code)       TRACE_RETURN(code,char)
 #define returnChtype(code)     TRACE_RETURN(code,chtype)
 #define returnCode(code)       TRACE_RETURN(code,int)
+#define returnIntAttr(code)    TRACE_RETURN2(code,int,attr_t)
+#define returnMMask(code)      TRACE_RETURN_SP(code,mmask_t)
 #define returnPtr(code)                TRACE_RETURN(code,ptr)
 #define returnSP(code)         TRACE_RETURN(code,sp)
 #define returnVoid             T((T_RETURN(""))); return
@@ -1536,6 +1560,8 @@ extern NCURSES_EXPORT(const char *)     _nc_altcharset_name(attr_t, chtype);
 extern NCURSES_EXPORT(const char *)     _nc_retrace_cptr (const char *);
 extern NCURSES_EXPORT(char)             _nc_retrace_char (char);
 extern NCURSES_EXPORT(int)              _nc_retrace_int (int);
+extern NCURSES_EXPORT(int)              _nc_retrace_int_attr_t (attr_t);
+extern NCURSES_EXPORT(mmask_t)          _nc_retrace_mmask_t (SCREEN *, mmask_t);
 extern NCURSES_EXPORT(unsigned)         _nc_retrace_unsigned (unsigned);
 extern NCURSES_EXPORT(void *)           _nc_retrace_void_ptr (void *);
 extern NCURSES_EXPORT(void)             _nc_fifo_dump (SCREEN *);
@@ -1578,6 +1604,8 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
 #define returnChar(code)       return ((char) code)
 #define returnChtype(code)     return code
 #define returnCode(code)       return code
+#define returnIntAttr(code)    return code
+#define returnMMask(code)      return code
 #define returnPtr(code)                return code
 #define returnSP(code)         return code
 #define returnVoid             return
@@ -1702,7 +1730,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_InsCharCost) (NCURSES_SP_DCLx int
 #undef  UpdateAttrs
 #define UpdateAttrs(sp,c) NCURSES_SP_NAME(_nc_UpdateAttrs)(NCURSES_SP_ARGx CHREF(c))
 
-#if defined(NEED_NCURSES_CH_T)
+#if USE_WIDEC_SUPPORT || defined(NEED_NCURSES_CH_T)
 extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx CARG_CH_T _c);
 #else
 extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx chtype c);