****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.531 2014/03/08 19:58:54 tom Exp $
+ * $Id: curses.priv.h,v 1.540 2014/09/27 21:44:28 tom Exp $
*
* curses.priv.h
*
#define USE_SIGWINCH 0
#endif
+/*
+ * When building in the MSYS2 environment, the automatic discovery of
+ * the path separator in configure doesn't work properly. So, if building
+ * for MinGW, we enforce the correct Windows PATH separator
+ */
+#ifdef __MINGW32__
+# ifdef NCURSES_PATHSEP
+# undef NCURSES_PATHSEP
+# endif
+# define NCURSES_PATHSEP ';'
+#endif
+
/*
* If desired, one can configure this, disabling environment variables that
* point to custom terminfo/termcap locations.
#undef _XOPEN_SOURCE_EXTENDED
#undef _XPG5
#define _nc_bkgd _bkgd
-#define wgetbkgrnd(win, wch) *wch = win->_bkgd
+#define wgetbkgrnd(win, wch) ((*wch = win->_bkgd) != 0 ? OK : ERR)
#define wbkgrnd wbkgd
#endif
AttrOf(dst) |= (attr_t) (ext + 1)
#define if_WIDEC(code) code
-#define Charable(ch) ((SP_PARM->_legacy_coding) \
+#define Charable(ch) (((SP_PARM->_legacy_coding) \
|| (AttrOf(ch) & A_ALTCHARSET) \
- || (!isWidecExt(ch) && \
+ || (!isWidecExt(ch))) && \
(ch).chars[1] == L'\0' && \
- _nc_is_charable(CharOf(ch))))
+ _nc_is_charable(CharOf(ch)))
#define L(ch) L ## ch
#else /* }{ */
sp->jump = outc
#ifdef USE_TERM_DRIVER
-typedef void* TERM_HANDLE;
typedef struct _termInfo
{
typedef struct term_driver {
bool isTerminfo;
+ const char* (*td_name)(struct DriverTCB*);
bool (*td_CanHandle)(struct DriverTCB*, const char*, int*);
void (*td_init)(struct DriverTCB*);
void (*td_release)(struct DriverTCB*);
int (*td_kpad)(struct DriverTCB*, int);
int (*td_kyOk)(struct DriverTCB*, int, int);
bool (*td_kyExist)(struct DriverTCB*, int);
+ int (*td_cursorSet)(struct DriverTCB*, int);
} TERM_DRIVER;
typedef struct DriverTCB
{
TERMINAL term; /* needs to be the first Element !!! */
- TERM_HANDLE inp; /* The input handle of the Terminal */
- TERM_HANDLE out; /* The output handle of the Terminal in shell mode */
- TERM_HANDLE hdl; /* The output handle of the Terminal in prog mode */
TERM_DRIVER* drv; /* The driver for that Terminal */
SCREEN* csp; /* The screen that owns that Terminal */
TerminalInfo info; /* Driver independent core capabilities of the Terminal */
#ifdef __MINGW32__
#include <nc_mingw.h>
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
+extern NCURSES_EXPORT(int) _nc_mingw_isatty(int fd);
+extern NCURSES_EXPORT(int) _nc_mingw_isconsole(int fd);
+extern NCURSES_EXPORT(int) _nc_mingw_console_read(
+ SCREEN *sp,
+ HANDLE fd,
+ int *buf);
+extern NCURSES_EXPORT(int) _nc_mingw_testmouse(
+ SCREEN * sp,
+ HANDLE fd,
+ int delay);
+#else
#endif
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
#endif
+#if defined(USE_TERM_DRIVER) && defined(__MINGW32__)
+#define NC_ISATTY(fd) _nc_mingw_isatty(fd)
+#else
+#define NC_ISATTY(fd) isatty(fd)
+#endif
+
#ifdef USE_TERM_DRIVER
-#define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo)))
-#define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
+# define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo)))
+# define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
+# ifdef __MINGW32__
+# define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_mingw_isconsole(TerminalOf(sp)->Filedes))
+#else
+# define IsTermInfoOnConsole(sp) FALSE
+# endif
#else
-#define IsTermInfo(sp) TRUE
-#define HasTInfoTerminal(sp) (0 != TerminalOf(sp))
+# define IsTermInfo(sp) TRUE
+# define HasTInfoTerminal(sp) (0 != TerminalOf(sp))
+# define IsTermInfoOnConsole(sp) FALSE
#endif
#define IsValidTIScreen(sp) (HasTInfoTerminal(sp))