X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fcurses.priv.h;h=621167f8120613f2bbecf71f57b81b18b2af3a45;hp=2c0ef2122790d761b8725b11799854f754608f3e;hb=d6c65d287166c3105ece4a5e3f3ec7af5a5f26a3;hpb=02f1dee48fe8af6ce054388fba739aa4f975004e diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 2c0ef212..621167f8 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2017,2018 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 +35,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.627 2019/12/14 22:36:12 tom Exp $ + * $Id: curses.priv.h,v 1.638 2020/09/12 17:58:55 tom Exp $ * * curses.priv.h * @@ -71,10 +72,6 @@ extern "C" { #include #endif -#if HAVE_SYS_BSDTYPES_H && !(defined(_WIN32) || defined(_WIN64)) -#include /* needed for ISC */ -#endif - #if HAVE_LIMITS_H # include #elif HAVE_SYS_PARAM_H @@ -106,6 +103,24 @@ extern "C" { extern int errno; #endif +/* Some Windows related defines */ +#undef _NC_WINDOWS +#if (defined(_WIN32) || defined(_WIN64)) +#define _NC_WINDOWS +#else +#undef EXP_WIN32_DRIVER +#endif + +#undef _NC_MINGW +#if (defined(__MINGW32__) || defined(__MINGW64__)) +#define _NC_MINGW +#endif + +#undef _NC_MSC +#ifdef _MSC_VER +#define _NC_MSC +#endif + /* Some systems have a broken 'select()', but workable 'poll()'. Use that */ #if HAVE_WORKING_POLL #define USE_FUNC_POLL 1 @@ -184,7 +199,7 @@ extern int errno; * the path separator in configure doesn't work properly. So, if building * for MinGW, we enforce the correct Windows PATH separator */ -#ifdef _WIN32 +#if defined(_NC_WINDOWS) # ifdef NCURSES_PATHSEP # undef NCURSES_PATHSEP # endif @@ -274,11 +289,20 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t); * Options for terminal drivers, etc... */ #ifdef USE_TERM_DRIVER +#define NO_TERMINAL "unknown" #define USE_SP_RIPOFF 1 #define USE_SP_TERMTYPE 1 #define USE_SP_WINDOWLIST 1 +#else +#define NO_TERMINAL 0 #endif +#define VALID_TERM_ENV(term_env, no_terminal) \ + (term_env = (NonEmpty(term_env) \ + ? term_env \ + : no_terminal), \ + NonEmpty(term_env)) + /* * Note: ht/cbt expansion flakes out randomly under Linux 1.1.47, but only * when we're throwing control codes at the screen at high volume. To see @@ -336,6 +360,10 @@ typedef TRIES { #include /* we'll use -Ipath directive to get the right one! */ +#if !(defined(NCURSES_WGETCH_EVENTS) && defined(NEED_KEY_EVENT)) +#undef KEY_EVENT /* reduce compiler-warnings with Visual C++ */ +#endif + typedef struct { int red, green, blue; /* what color_content() returns */ @@ -952,6 +980,11 @@ typedef struct { time_t dbd_time; /* cache last updated */ ITERATOR_VARS dbd_vars[dbdLAST]; +#if HAVE_TSEARCH + void *cached_tparm; + int count_tparm; +#endif /* HAVE_TSEARCH */ + #ifdef USE_TERM_DRIVER int (*term_driver)(struct DriverTCB*, const char*, int*); #endif @@ -1333,7 +1366,7 @@ struct screen { int _sysmouse_new_buttons; #endif -#ifdef USE_TERM_DRIVER +#if defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER) MEVENT _drv_mouse_fifo[FIFO_SIZE]; int _drv_mouse_head; int _drv_mouse_tail; @@ -2342,11 +2375,10 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *); */ #if USE_WIDEC_SUPPORT -#if defined(_WIN32) +#if defined(_NC_WINDOWS) && !defined(_NC_MSC) && !defined(EXP_WIN32_DRIVER) /* * MinGW has wide-character functions, but they do not work correctly. */ - extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t); #define wctomb(s,wc) _nc_wctomb(s,wc) #define wcrtomb(s,wc,n) _nc_wctomb(s,wc) @@ -2357,7 +2389,7 @@ extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t); extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); #define mblen(s,n) _nc_mblen(s, n) -#endif /* _WIN32 */ +#endif /* _NC_WINDOWS && !_NC_MSC */ #if HAVE_MBTOWC && HAVE_MBLEN #define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0)) @@ -2579,6 +2611,10 @@ extern NCURSES_EXPORT(int) TINFO_MVCUR(SCREEN*, int, int, int, int); #define TINFO_MVCUR NCURSES_SP_NAME(_nc_mvcur) #endif +#if defined(EXP_WIN32_DRIVER) +#include +#endif + /* * Entrypoints using an extra parameter with the terminal driver. */ @@ -2601,6 +2637,9 @@ extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *); _nc_setupterm(name, fd, err, reuse) #endif /* !USE_TERM_DRIVER */ +#ifdef EXP_WIN32_DRIVER +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER; +#else #ifdef USE_TERM_DRIVER #if defined(USE_WIN32CON_DRIVER) #include @@ -2618,9 +2657,12 @@ extern NCURSES_EXPORT(int) _nc_mingw_testmouse( #else #endif extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER; -#endif +#endif /* USE_TERM_DRIVER */ +#endif /* EXP_WIN32_DRIVER */ -#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER) +#if defined(USE_TERM_DRIVER) && defined(EXP_WIN32_DRIVER) +#define NC_ISATTY(fd) (0 != _nc_console_isatty(fd)) +#elif defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER) #define NC_ISATTY(fd) _nc_mingw_isatty(fd) #else #define NC_ISATTY(fd) isatty(fd) @@ -2629,15 +2671,21 @@ 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)) -# if defined(USE_WIN32CON_DRIVER) +# if defined(EXP_WIN32_DRIVER) +# define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_console_test(TerminalOf(sp)->Filedes)) +# elif defined(USE_WIN32CON_DRIVER) # define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_mingw_isconsole(TerminalOf(sp)->Filedes)) -#else +# else # define IsTermInfoOnConsole(sp) FALSE # endif #else # define IsTermInfo(sp) TRUE # define HasTInfoTerminal(sp) (0 != TerminalOf(sp)) -# define IsTermInfoOnConsole(sp) FALSE +# if defined(EXP_WIN32_DRIVER) +# define IsTermInfoOnConsole(sp) _nc_console_test(TerminalOf(sp)->Filedes) +# else +# define IsTermInfoOnConsole(sp) FALSE +# endif #endif #define IsValidTIScreen(sp) (HasTInfoTerminal(sp))