cmCursesStandardIncludes.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCursesStandardIncludes_h
  11. #define cmCursesStandardIncludes_h
  12. #if defined(__sun__) && defined(__GNUC__)
  13. #define _MSE_INT_H
  14. #endif
  15. #include <cmFormConfigure.h>
  16. #if defined(__hpux)
  17. # define _BOOL_DEFINED
  18. # include <sys/time.h>
  19. # define _XOPEN_SOURCE_EXTENDED
  20. # include <curses.h>
  21. # include <form.h>
  22. # undef _XOPEN_SOURCE_EXTENDED
  23. #else
  24. /* figure out which curses.h to include */
  25. # if defined(CURSES_HAVE_NCURSES_H)
  26. # include <ncurses.h>
  27. # elif defined(CURSES_HAVE_NCURSES_NCURSES_H)
  28. # include <ncurses/ncurses.h>
  29. # elif defined(CURSES_HAVE_NCURSES_CURSES_H)
  30. # include <ncurses/curses.h>
  31. # else
  32. # include <curses.h>
  33. # endif
  34. # include <form.h>
  35. #endif
  36. // This is a hack to prevent warnings about these functions being
  37. // declared but not referenced.
  38. #if defined(__sgi) && !defined(__GNUC__)
  39. class cmCursesStandardIncludesHack
  40. {
  41. public:
  42. enum
  43. {
  44. Ref1 = sizeof(cfgetospeed(0)),
  45. Ref2 = sizeof(cfgetispeed(0)),
  46. Ref3 = sizeof(tcgetattr(0, 0)),
  47. Ref4 = sizeof(tcsetattr(0, 0, 0)),
  48. Ref5 = sizeof(cfsetospeed(0,0)),
  49. Ref6 = sizeof(cfsetispeed(0,0))
  50. };
  51. };
  52. #endif
  53. #ifndef getmaxyx
  54. #define getmaxyx(w,y,x) ((y) = getmaxy(w), (x) = getmaxx(w))
  55. #endif
  56. // on some machines move erase and clear conflict with stl
  57. // so remove them from the namespace
  58. inline void curses_move(unsigned int x, unsigned int y)
  59. {
  60. move(x,y);
  61. }
  62. inline void curses_clear()
  63. {
  64. erase();
  65. clearok(stdscr, TRUE);
  66. }
  67. #undef move
  68. #undef erase
  69. #undef clear
  70. #endif // cmCursesStandardIncludes_h