]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 6.0 - patch 20180106
[ncurses.git] / ncurses / curses.priv.h
index f6c4879f40c4a92df81c08cc0ac7d13094417bf6..01866cc5a8c3ef34f6ba5e25b58c54367c05a5f3 100644 (file)
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.573 2017/06/02 23:19:52 tom Exp $
+ * $Id: curses.priv.h,v 1.585 2017/09/20 00:34:16 tom Exp $
  *
  *     curses.priv.h
  *
@@ -332,6 +332,15 @@ typedef struct
 }
 color_t;
 
+typedef union {
+    struct {
+       unsigned char red;
+       unsigned char green;
+       unsigned char blue;
+    } bits;                    /* bits per color-value in RGB */
+    unsigned value;
+} rgb_bits_t;
+
 /*
  * If curses.h did not expose the SCREEN-functions, then we do not need the
  * parameter in the corresponding unextended functions.
@@ -394,6 +403,11 @@ color_t;
 #define TerminalType(tp)     (tp)->type
 #endif
 
+#ifdef CUR
+#undef CUR
+#define CUR TerminalType(cur_term).
+#endif
+
 /*
  * Reduce dependency on cur_term global by using terminfo data from SCREEN's
  * pointer to this data.
@@ -402,7 +416,7 @@ color_t;
 #undef CUR
 #endif
 
-#define SP_TERMTYPE TerminalOf(sp)->type.
+#define SP_TERMTYPE TerminalType(TerminalOf(sp)).
 
 #include <term_entry.h>
 
@@ -411,10 +425,11 @@ color_t;
 /*
  * Simplify ifdef's for the "*_ATTR" macros in case italics are not configured.
  */
-#ifdef A_ITALIC
+#if defined(A_ITALIC) && defined(exit_italics_mode)
 #define USE_ITALIC 1
 #else
 #define USE_ITALIC 0
+#undef  A_ITALIC
 #define A_ITALIC 0
 #endif
 
@@ -958,9 +973,15 @@ typedef struct {
        int             nested_tracef;
 #endif
 #endif /* TRACE */
+#if NO_LEAKS
+       bool            leak_checking;
+#endif
 
 #ifdef USE_PTHREADS
        pthread_mutex_t mutex_curses;
+       pthread_mutex_t mutex_prescreen;
+       pthread_mutex_t mutex_screen;
+       pthread_mutex_t mutex_update;
        pthread_mutex_t mutex_tst_tracef;
        pthread_mutex_t mutex_tracef;
        int             nested_tracef;
@@ -979,12 +1000,24 @@ extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
 
 #define N_RIPS 5
 
+#ifdef USE_PTHREADS
+typedef struct _prescreen_list {
+       struct _prescreen_list *next;
+       pthread_t id;
+       struct screen *sp;
+} PRESCREEN_LIST;
+#endif
+
 /*
  * Global data which can be swept up into a SCREEN when one is created.
  * It may be modified before the next SCREEN is created.
  */
 typedef struct {
+#ifdef USE_PTHREADS
+       PRESCREEN_LIST *allocated;
+#else
        struct screen * allocated;
+#endif
        bool            use_env;
        bool            filter_mode;
        attr_t          previous_attr;
@@ -1026,6 +1059,12 @@ typedef struct {
 
 extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
 
+typedef enum {
+    ewInitial = 0,
+    ewRunning,
+    ewSuspend
+} ENDWIN;
+
 /*
  * The SCREEN structure.
  */
@@ -1131,11 +1170,13 @@ struct screen {
        int             _scrolling;     /* 1 if terminal's smart enough to  */
 
        /* used in lib_color.c */
+       rgb_bits_t      _direct_color;  /* RGB overrides color-table         */
        color_t         *_color_table;  /* screen's color palette            */
        int             _color_count;   /* count of colors in palette        */
        colorpair_t     *_color_pairs;  /* screen's color pair list          */
        int             _pair_count;    /* same as COLOR_PAIRS               */
        int             _pair_limit;    /* actual limit of color-pairs       */
+       int             _pair_alloc;    /* current table-size of color-pairs */
 #if NCURSES_EXT_FUNCS
        bool            _assumed_color; /* use assumed colors                */
        bool            _default_color; /* use default colors                */
@@ -1335,7 +1376,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
     sp->_cbreak = 0;                            \
     sp->_echo = TRUE;                           \
     sp->_fifohead = -1;                         \
-    sp->_endwin = TRUE;                         \
+    sp->_endwin = ewSuspend;                    \
     sp->_cursor = -1;                           \
     SP_INIT_WINDOWLIST(sp);                     \
     sp->_outch = NCURSES_OUTC_FUNC;             \
@@ -1453,6 +1494,8 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
                       && (a).chars[3] == (b).chars[3] \
                       && (a).chars[4] == (b).chars[4] \
                        if_EXT_COLORS(&& (a).ext_color == (b).ext_color))
+#elif CCHARW_MAX > 0
+#error Inconsistent values for CCHARW_MAX
 #else
 #define CharEq(a,b)    (!memcmp(&(a), &(b), sizeof(a)))
 #endif
@@ -1680,7 +1723,7 @@ extern NCURSES_EXPORT(void)       _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
 
 typedef void VoidFunc(void);
 
-#define TR_FUNC(value)          ((const char*) &(value))
+#define TR_FUNC(value)          ((const char*) (value))
 #define NonNull(s)             ((s) != 0 ? s : "<null>")
 
 #define returnAttr(code)       TRACE_RETURN(code,attr_t)
@@ -1918,6 +1961,14 @@ extern NCURSES_EXPORT(void) _nc_expanded (void);
 #define getcwd(buf,len) getwd(buf)
 #endif
 
+#define save_ttytype(termp) \
+       if (TerminalType(termp).term_names != 0) { \
+           _nc_STRNCPY(ttytype, \
+                       TerminalType(termp).term_names, \
+                       NAMESIZE - 1); \
+           ttytype[NAMESIZE - 1] = '\0'; \
+       }
+
 /* charable.c */
 #if USE_WIDEC_SUPPORT
 extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t);
@@ -1969,6 +2020,7 @@ extern NCURSES_EXPORT(int) _nc_init_color(SCREEN *, int, int, int, int);
 extern NCURSES_EXPORT(int) _nc_init_pair(SCREEN *, int, int, int);
 extern NCURSES_EXPORT(int) _nc_pair_content(SCREEN *, int, int *, int *);
 extern NCURSES_EXPORT(bool) _nc_reset_colors(void);
+extern NCURSES_EXPORT(colorpair_t *) _nc_reserve_pairs(SCREEN *, int);
 extern NCURSES_EXPORT(void) _nc_change_pair(SCREEN *, int);
 
 /* lib_getch.c */
@@ -2006,17 +2058,32 @@ extern NCURSES_EXPORT(int)    _nc_locale_breaks_acs(TERMINAL *);
 extern NCURSES_EXPORT(int)    _nc_setupterm(NCURSES_CONST char *, int, int *, int);
 extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, int);
 
+#ifdef USE_PTHREADS
+extern NCURSES_EXPORT(SCREEN *) _nc_find_prescr(void);
+extern NCURSES_EXPORT(void)   _nc_forget_prescr(void);
+#else
+#define _nc_find_prescr()     _nc_prescreen.allocated
+#define _nc_forget_prescr()   _nc_prescreen.allocated = 0
+#endif
+
 /* lib_set_term.c */
 extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
 
 /* lib_setup.c */
+#if NO_LEAKS
+#define ExitTerminfo(code)    _nc_free_tinfo(code)
+#else
+#define ExitTerminfo(code)    exit(code)
+#endif
+
 #define SETUP_FAIL ERR
+
 #define ret_error(code, fmt, arg)      if (errret) {\
                                            *errret = code;\
                                            returnCode(SETUP_FAIL);\
                                        } else {\
                                            fprintf(stderr, fmt, arg);\
-                                           exit(EXIT_FAILURE);\
+                                           ExitTerminfo(EXIT_FAILURE);\
                                        }
 
 #define ret_error1(code, fmt, arg)     ret_error(code, "'%s': " fmt, arg)
@@ -2026,7 +2093,7 @@ extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
                                            returnCode(SETUP_FAIL);\
                                        } else {\
                                            fprintf(stderr, msg);\
-                                           exit(EXIT_FAILURE);\
+                                           ExitTerminfo(EXIT_FAILURE);\
                                        }
 
 /* lib_tstp.c */
@@ -2125,6 +2192,8 @@ extern NCURSES_EXPORT(void) _nc_import_termtype2(TERMTYPE2 *, const TERMTYPE *);
 #define _nc_export_termtype2(dst,src) /* nothing */
 #define _nc_import_termtype2(dst,src) /* nothing */
 #define _nc_free_termtype2(t) _nc_free_termtype(t)
+/* also... */
+#define _nc_read_entry2 _nc_read_entry
 #endif
 
 #if NO_LEAKS