diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index a88e3fb86d..bf6a9eae6b 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -144,7 +144,7 @@ int main(int argc, char const* const* argv) myform = new cmCursesMainForm(args, x); if (myform->LoadCache(cacheDir.c_str())) { - curses_clear(); + clear(); touchwin(stdscr); endwin(); delete myform; @@ -184,7 +184,7 @@ int main(int argc, char const* const* argv) } // Need to clean-up better - curses_clear(); + clear(); touchwin(stdscr); endwin(); delete cmCursesForm::CurrentForm; diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 8608c37580..2607ec0e2d 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -89,11 +89,11 @@ void cmCursesLongMessageForm::UpdateStatusBar() version[width] = '\0'; char fmt_s[] = "%s"; - curses_move(y - 4, 0); + move(y - 4, 0); attron(A_STANDOUT); printw(fmt_s, bar); attroff(A_STANDOUT); - curses_move(y - 3, 0); + move(y - 3, 0); printw(fmt_s, version); pos_form_cursor(this->Form); } @@ -110,7 +110,7 @@ void cmCursesLongMessageForm::PrintKeys() snprintf(firstLine, sizeof(firstLine), "Press [e] to exit screen"); char fmt_s[] = "%s"; - curses_move(y - 2, 0); + move(y - 2, 0); printw(fmt_s, firstLine); pos_form_cursor(this->Form); } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 6678550baa..6b465c1512 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -337,17 +337,17 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) " [h] Help [q] Quit without generating"); } - curses_move(y - 4, 0); + move(y - 4, 0); char fmt[512] = "Keys: [enter] Edit an entry [d] Delete an entry"; if (process) { memset(fmt, ' ', 57); } printw(fmt_s, fmt); - curses_move(y - 3, 0); + move(y - 3, 0); printw(fmt_s, firstLine); - curses_move(y - 2, 0); + move(y - 2, 0); printw(fmt_s, secondLine); - curses_move(y - 1, 0); + move(y - 1, 0); printw(fmt_s, thirdLine); } @@ -355,7 +355,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) char pageLine[512] = ""; snprintf(pageLine, sizeof(pageLine), "Page %d of %d", cw->GetPage(), this->NumberOfPages); - curses_move(0, 65 - static_cast(strlen(pageLine)) - 1); + move(0, 65 - static_cast(strlen(pageLine)) - 1); printw(fmt_s, pageLine); } @@ -372,8 +372,8 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional message) // If window size is too small, display error and return if (x < cmCursesMainForm::MIN_WIDTH || x < this->InitialWidth || y < cmCursesMainForm::MIN_HEIGHT) { - curses_clear(); - curses_move(0, 0); + clear(); + move(0, 0); char fmt[] = "Window is too small. A size of at least %dx%d is required."; printw(fmt, (cmCursesMainForm::MIN_WIDTH < this->InitialWidth @@ -416,7 +416,7 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional message) // Pad with spaces to erase any previous text, // or truncate as necessary to fit the screen bar.resize(x, ' '); - curses_move(y - 5, 0); + move(y - 5, 0); attron(A_STANDOUT); char fmt_s[] = "%s"; printw(fmt_s, bar.c_str()); @@ -438,7 +438,7 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional message) std::string version = "CMake Version "; version += cmVersion::GetCMakeVersion(); version.resize(std::min(x, version.size())); - curses_move(y - 4, x - static_cast(version.size())); + move(y - 4, x - static_cast(version.size())); printw(fmt_s, version.c_str()); pos_form_cursor(this->Form); @@ -690,8 +690,8 @@ void cmCursesMainForm::HandleInput() std::string searchstr = "Search: " + this->SearchString; this->UpdateStatusBar(searchstr); this->PrintKeys(1); - curses_move(y - 5, static_cast(searchstr.size())); - // curses_move(1,1); + move(y - 5, static_cast(searchstr.size())); + // move(1,1); touchwin(stdscr); refresh(); } diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index 9797306095..e61a6ececc 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -4,39 +4,16 @@ #include "cmConfigure.h" // IWYU pragma: keep -// Record whether __attribute__ is currently defined. See purpose below. -#ifndef __attribute__ -# define cm_no__attribute__ -#endif - #if defined(__hpux) # define _BOOL_DEFINED # include #endif -#include - -// on some machines move erase and clear conflict with stl -// so remove them from the namespace -inline void curses_move(unsigned int x, unsigned int y) -{ - move(x, y); -} - -inline void curses_clear() -{ - erase(); - clearok(stdscr, TRUE); -} - -#undef move -#undef erase -#undef clear - -// The curses headers on some platforms (e.g. Solaris) may -// define __attribute__ as a macro. This breaks C++ headers -// in some cases, so undefine it now. -#if defined(cm_no__attribute__) && defined(__attribute__) -# undef __attribute__ +// Tell curses headers on Solaris to not define macros +// that conflict with C++ standard library interfaces. +#if defined(__sun__) +# define NOMACROS +# define NCURSES_NOMACROS #endif -#undef cm_no__attribute__ + +#include diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index eb801ca826..29759cc1aa 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -197,15 +197,15 @@ bool cmCursesStringWidget::PrintKeys() if (this->InEdit) { char fmt_s[] = "%s"; // Clean the toolbar - curses_move(y - 4, 0); + move(y - 4, 0); clrtoeol(); - curses_move(y - 3, 0); + move(y - 3, 0); printw(fmt_s, "Editing option, press [enter] to confirm"); clrtoeol(); - curses_move(y - 2, 0); + move(y - 2, 0); printw(fmt_s, " press [esc] to cancel"); clrtoeol(); - curses_move(y - 1, 0); + move(y - 1, 0); clrtoeol(); return true;