ncurses 6.0 - patch 20161210
[ncurses.git] / ncurses / curses.priv.h
index 01539d8d62000530e05360f1a328c3d85a3f7782..d60e6ad9c4cf5ffd0ca8924700de5c556199b2e6 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2015,2016 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.544 2014/10/11 19:30:58 tom Exp $
+ * $Id: curses.priv.h,v 1.554 2016/11/21 23:28:54 tom Exp $
  *
  *     curses.priv.h
  *
@@ -561,7 +561,7 @@ weak_symbol(pthread_mutexattr_settype);
 weak_symbol(pthread_mutexattr_init);
 extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
 #    undef  sigprocmask
-#    define sigprocmask _nc_sigprocmask
+#    define sigprocmask(a, b, c) _nc_sigprocmask(a, b, c)
 #  endif
 #endif
 
@@ -581,7 +581,7 @@ 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
+#    define sigprocmask(a, b, c) _nc_sigprocmask(a, b, c)
 #  endif
 #endif /* USE_PTHREADS_EINTR */
 
@@ -901,10 +901,10 @@ typedef struct {
 #endif
 
 #ifdef TRACE
-       bool            init_trace;
        char            trace_fname[PATH_MAX];
        int             trace_level;
        FILE            *trace_fp;
+       int             trace_fd;
 
        char            *tracearg_buf;
        size_t          tracearg_used;
@@ -1428,11 +1428,11 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
                            NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
                            COUNT_OUTCHARS(1);                                      \
                        } else {                                                    \
-                           PUTC_INIT;                                              \
                            for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {       \
                                PUTC_ch = (ch).chars[PUTC_i];                       \
                                if (PUTC_ch == L'\0')                               \
                                    break;                                          \
+                               PUTC_INIT;                                                  \
                                PUTC_n = (int) wcrtomb(PUTC_buf,                    \
                                                       (ch).chars[PUTC_i], &PUT_st); \
                                if (PUTC_n <= 0) {                                  \
@@ -1625,27 +1625,31 @@ 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((type)(value))
+#define TRACE_RETURN1(value,dst)     return _nc_retrace_##dst(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>")
+typedef void VoidFunc(void);
+
+#define TR_FUNC(value)          ((const char*) &(value))
+#define NonNull(s)             ((s) != 0 ? s : "<null>")
 
 #define returnAttr(code)       TRACE_RETURN(code,attr_t)
 #define returnBits(code)       TRACE_RETURN(code,unsigned)
 #define returnBool(code)       TRACE_RETURN(code,bool)
-#define returnCPtr(code)       TRACE_RETURN(code,cptr)
-#define returnCVoidPtr(code)   TRACE_RETURN(code,cvoid_ptr)
+#define returnCPtr(code)       TRACE_RETURN1(code,cptr)
+#define returnCVoidPtr(code)   TRACE_RETURN1(code,cvoid_ptr)
 #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 returnPtr(code)                TRACE_RETURN1(code,ptr)
+#define returnSP(code)         TRACE_RETURN1(code,sp)
 #define returnVoid             T((T_RETURN(""))); return
-#define returnVoidPtr(code)    TRACE_RETURN(code,void_ptr)
-#define returnWin(code)                TRACE_RETURN(code,win)
+#define returnVoidPtr(code)    TRACE_RETURN1(code,void_ptr)
+#define returnWin(code)                TRACE_RETURN1(code,win)
 
 extern NCURSES_EXPORT(NCURSES_BOOL)     _nc_retrace_bool (int);
 extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *);
@@ -1680,6 +1684,10 @@ extern NCURSES_EXPORT_VAR(long)         _nc_outchars;
 
 extern NCURSES_EXPORT_VAR(unsigned)     _nc_tracing;
 
+extern NCURSES_EXPORT(char *) _nc_tracebits (void);
+extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);
+extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);
+
 #if USE_WIDEC_SUPPORT
 extern NCURSES_EXPORT(const char *) _nc_viswbuf2 (int, const wchar_t *);
 extern NCURSES_EXPORT(const char *) _nc_viswbufn (const wchar_t *, int);
@@ -1946,9 +1954,10 @@ extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, int);
 extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
 
 /* lib_setup.c */
+#define SETUP_FAIL ERR
 #define ret_error(code, fmt, arg)      if (errret) {\
                                            *errret = code;\
-                                           returnCode(ERR);\
+                                           returnCode(SETUP_FAIL);\
                                        } else {\
                                            fprintf(stderr, fmt, arg);\
                                            exit(EXIT_FAILURE);\
@@ -1958,7 +1967,7 @@ extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
 
 #define ret_error0(code, msg)          if (errret) {\
                                            *errret = code;\
-                                           returnCode(ERR);\
+                                           returnCode(SETUP_FAIL);\
                                        } else {\
                                            fprintf(stderr, msg);\
                                            exit(EXIT_FAILURE);\
@@ -2354,7 +2363,7 @@ extern NCURSES_EXPORT(void)   _nc_get_screensize(SCREEN *, int *, int *);
 #endif /* !USE_TERM_DRIVER */
 
 #ifdef USE_TERM_DRIVER
-#ifdef __MINGW32__
+#if defined(USE_WIN32CON_DRIVER)
 #include <nc_mingw.h>
 extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
 extern NCURSES_EXPORT(int)  _nc_mingw_isatty(int fd);
@@ -2372,7 +2381,7 @@ extern NCURSES_EXPORT(int) _nc_mingw_testmouse(
 extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
 #endif
 
-#if defined(USE_TERM_DRIVER) && defined(__MINGW32__)
+#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER)
 #define NC_ISATTY(fd) _nc_mingw_isatty(fd)
 #else
 #define NC_ISATTY(fd) isatty(fd)
@@ -2381,7 +2390,7 @@ extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
 #ifdef USE_TERM_DRIVER
 #  define IsTermInfo(sp)       ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo)))
 #  define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
-#  ifdef __MINGW32__
+#  if defined(USE_WIN32CON_DRIVER)
 #    define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_mingw_isconsole(TerminalOf(sp)->Filedes))
 #else
 #    define IsTermInfoOnConsole(sp) FALSE