mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
ccmake: Suppress curses macros on Solaris that conflict with C++ std APIs
Also revert previous workarounds from * commit3b7be02480(ccmake: Fix compilation with ncurses on Solaris, 2018-03-20, v3.12.0-rc1~335^2), and * commit572e5146f8(define hacks and such for the dec compiler, 2001-11-20, v2.4.0~6229)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<unsigned int>(strlen(pageLine)) - 1);
|
||||
move(0, 65 - static_cast<unsigned int>(strlen(pageLine)) - 1);
|
||||
printw(fmt_s, pageLine);
|
||||
}
|
||||
|
||||
@@ -372,8 +372,8 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional<std::string> 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<std::string> 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<std::string> message)
|
||||
std::string version = "CMake Version ";
|
||||
version += cmVersion::GetCMakeVersion();
|
||||
version.resize(std::min<std::string::size_type>(x, version.size()));
|
||||
curses_move(y - 4, x - static_cast<int>(version.size()));
|
||||
move(y - 4, x - static_cast<int>(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<unsigned int>(searchstr.size()));
|
||||
// curses_move(1,1);
|
||||
move(y - 5, static_cast<unsigned int>(searchstr.size()));
|
||||
// move(1,1);
|
||||
touchwin(stdscr);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@@ -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 <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <form.h>
|
||||
|
||||
// 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 <form.h>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user