Require ncursesw to provide waddwstr and waddnwstr

This commit is contained in:
Andrzej Rybczak
2016-12-16 07:17:10 +01:00
parent 5c62072713
commit 50ec522726
2 changed files with 2 additions and 20 deletions

View File

@@ -186,8 +186,6 @@ AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread",
dnl ========================= dnl =========================
dnl = checking for ncursesw = dnl = checking for ncursesw =
dnl ========================= dnl =========================
AH_TEMPLATE([NCURSES_WADDWSTR], [ncursesw has waddwstr function])
AH_TEMPLATE([NCURSES_WADDNWSTR], [ncursesw has waddnwstr function])
PKG_CHECK_MODULES([ncursesw], [ncursesw], [ PKG_CHECK_MODULES([ncursesw], [ncursesw], [
AC_SUBST(ncursesw_CFLAGS) AC_SUBST(ncursesw_CFLAGS)
AC_SUBST(ncursesw_LIBS) AC_SUBST(ncursesw_LIBS)
@@ -198,12 +196,8 @@ PKG_CHECK_MODULES([ncursesw], [ncursesw], [
AC_MSG_ERROR([missing curses.h header]) AC_MSG_ERROR([missing curses.h header])
) )
AC_CHECK_LIB(ncursesw, initscr, , AC_MSG_ERROR([ncursesw doesn't provide initscr])) AC_CHECK_LIB(ncursesw, initscr, , AC_MSG_ERROR([ncursesw doesn't provide initscr]))
AC_CHECK_LIB(ncursesw, waddwstr, AC_CHECK_LIB(ncursesw, waddwstr, , AC_MSG_ERROR([ncursesw doesn't provide waddwstr]))
AC_DEFINE([NCURSES_WADDWSTR], [1], []), AC_CHECK_LIB(ncursesw, waddnwstr, , AC_MSG_ERROR([ncursesw doesn't provide waddnwstr]))
AC_DEFINE([NCURSES_WADDWSTR], [0], []))
AC_CHECK_LIB(ncursesw, waddnwstr,
AC_DEFINE([NCURSES_WADDNWSTR], [1], []),
AC_DEFINE([NCURSES_WADDNWSTR], [0], []))
], ],
AC_MSG_ERROR([ncursesw is required!]) AC_MSG_ERROR([ncursesw is required!])
) )

View File

@@ -1345,21 +1345,13 @@ Window &Window::operator<<(char c)
Window &Window::operator<<(const wchar_t *ws) Window &Window::operator<<(const wchar_t *ws)
{ {
#if NCURSES_WADDWSTR
waddwstr(m_window, ws); waddwstr(m_window, ws);
#else
wprintw(m_window, "%ls", ws);
#endif // NCURSES_WADDWSTR
return *this; return *this;
} }
Window &Window::operator<<(wchar_t wc) Window &Window::operator<<(wchar_t wc)
{ {
#if NCURSES_WADDNWSTR
waddnwstr(m_window, &wc, 1); waddnwstr(m_window, &wc, 1);
#else
wprintw(m_window, "%lc", wc);
#endif // NCURSES_WADDNWSTR
return *this; return *this;
} }
@@ -1383,11 +1375,7 @@ Window &Window::operator<<(const std::string &s)
Window &Window::operator<<(const std::wstring &ws) Window &Window::operator<<(const std::wstring &ws)
{ {
#if NCURSES_WADDNWSTR
waddnwstr(m_window, ws.c_str(), ws.length()); waddnwstr(m_window, ws.c_str(), ws.length());
#else
wprintw(m_window, "%lc", ws.c_str());
#endif // NCURSES_WADDNWSTR
return *this; return *this;
} }