]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 5.9 - patch 20110917
[ncurses.git] / ncurses / curses.priv.h
index 0db05ddf986b946a5bcfb9dfc68b082f7cbf8c6f..309c3e82a3fd75238376e0d26df8cf42fb8efc77 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.472 2011/01/01 23:01:40 tom Exp $
+ * $Id: curses.priv.h,v 1.483 2011/09/17 19:08:20 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);
@@ -775,7 +794,7 @@ typedef struct {
        bool            init_signals;
        bool            init_screen;
 
-       const char      *comp_sourcename;
+       char            *comp_sourcename;
        char            *comp_termtype;
 
        bool            have_tic_directory;
@@ -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        */
@@ -1055,6 +1075,7 @@ struct screen {
        int             _mouse_fd;      /* file-descriptor, if any */
        bool            _mouse_active;  /* true if initialized */
        mmask_t         _mouse_mask;
+       mmask_t         _mouse_bstate;
        NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */
        MEVENT          _mouse_events[EV_MAX];  /* hold the last mouse event seen */
        MEVENT          *_mouse_eventp; /* next free slot in event queue */
@@ -1411,25 +1432,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]))
 
@@ -1710,7 +1731,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);
@@ -1821,6 +1842,25 @@ extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, char);
 /* lib_set_term.c */
 extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
 
+/* lib_setup.c */
+#define ret_error(code, fmt, arg)      if (errret) {\
+                                           *errret = code;\
+                                           returnCode(ERR);\
+                                       } else {\
+                                           fprintf(stderr, fmt, arg);\
+                                           exit(EXIT_FAILURE);\
+                                       }
+
+#define ret_error1(code, fmt, arg)     ret_error(code, "'%s': " fmt, arg)
+
+#define ret_error0(code, msg)          if (errret) {\
+                                           *errret = code;\
+                                           returnCode(ERR);\
+                                       } else {\
+                                           fprintf(stderr, msg);\
+                                           exit(EXIT_FAILURE);\
+                                       }
+
 /* lib_tstp.c */
 #if USE_SIGWINCH
 extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);