curspriv.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* Public Domain Curses */
  2. /* $Id: curspriv.h,v 1.158 2008/07/13 16:08:16 wmcbrine Exp $ */
  3. /* Private definitions and declarations for use within PDCurses.
  4. These should generally not be referenced by applications. */
  5. #ifndef __CURSES_INTERNALS__
  6. #define __CURSES_INTERNALS__ 1
  7. #ifdef HAVE_CONFIG_H
  8. # include <config.h>
  9. #endif
  10. #define CURSES_LIBRARY
  11. #include <curses.h>
  12. #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \
  13. defined(__CYGWIN32__) || defined(__MINGW32__) || \
  14. defined(__WATCOMC__) || defined(__PACIFIC__)
  15. # ifndef HAVE_VSSCANF
  16. # define HAVE_VSSCANF /* have vsscanf() */
  17. # endif
  18. #endif
  19. #if defined(__CYGWIN32__) || defined(__MINGW32__) || \
  20. defined(__LCC__) || defined(__WATCOMC__)
  21. # ifndef HAVE_VSNPRINTF
  22. # define HAVE_VSNPRINTF /* have vsnprintf() */
  23. # endif
  24. #endif
  25. #if defined(_MSC_VER) && defined(_WIN32) && !defined(_CRT_SECURE_NO_DEPRECATE)
  26. # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */
  27. #endif
  28. /*----------------------------------------------------------------------*/
  29. typedef struct /* structure for ripped off lines */
  30. {
  31. int line;
  32. int (*init)(WINDOW *, int);
  33. } RIPPEDOFFLINE;
  34. /* Window properties */
  35. #define _SUBWIN 0x01 /* window is a subwindow */
  36. #define _PAD 0x10 /* X/Open Pad. */
  37. #define _SUBPAD 0x20 /* X/Open subpad. */
  38. /* Miscellaneous */
  39. #define _NO_CHANGE -1 /* flags line edge unchanged */
  40. #define _ECHAR 0x08 /* Erase char (^H) */
  41. #define _DWCHAR 0x17 /* Delete Word char (^W) */
  42. #define _DLCHAR 0x15 /* Delete Line char (^U) */
  43. extern WINDOW *pdc_lastscr;
  44. extern bool pdc_trace_on; /* tracing flag */
  45. extern bool pdc_color_started;
  46. extern unsigned long pdc_key_modifiers;
  47. extern MOUSE_STATUS pdc_mouse_status;
  48. /*----------------------------------------------------------------------*/
  49. /* Platform implementation functions */
  50. void PDC_beep(void);
  51. bool PDC_can_change_color(void);
  52. int PDC_color_content(short, short *, short *, short *);
  53. bool PDC_check_key(void);
  54. int PDC_curs_set(int);
  55. void PDC_flushinp(void);
  56. int PDC_get_columns(void);
  57. int PDC_get_cursor_mode(void);
  58. int PDC_get_key(void);
  59. int PDC_get_rows(void);
  60. void PDC_gotoyx(int, int);
  61. int PDC_init_color(short, short, short, short);
  62. void PDC_init_pair(short, short, short);
  63. int PDC_modifiers_set(void);
  64. int PDC_mouse_set(void);
  65. void PDC_napms(int);
  66. int PDC_pair_content(short, short *, short *);
  67. void PDC_reset_prog_mode(void);
  68. void PDC_reset_shell_mode(void);
  69. int PDC_resize_screen(int, int);
  70. void PDC_restore_screen_mode(int);
  71. void PDC_save_screen_mode(int);
  72. void PDC_scr_close(void);
  73. void PDC_scr_free(void);
  74. int PDC_scr_open(int, char **);
  75. void PDC_set_keyboard_binary(bool);
  76. void PDC_transform_line(int, int, int, const chtype *);
  77. const char *PDC_sysname(void);
  78. /* Internal cross-module functions */
  79. void PDC_init_atrtab(void);
  80. WINDOW *PDC_makelines(WINDOW *);
  81. WINDOW *PDC_makenew(int, int, int, int);
  82. int PDC_mouse_in_slk(int, int);
  83. void PDC_slk_free(void);
  84. void PDC_slk_initialize(void);
  85. void PDC_sync(WINDOW *);
  86. #ifdef PDC_WIDE
  87. int PDC_mbtowc(wchar_t *, const char *, size_t);
  88. size_t PDC_mbstowcs(wchar_t *, const char *, size_t);
  89. size_t PDC_wcstombs(char *, const wchar_t *, size_t);
  90. #endif
  91. #ifdef PDCDEBUG
  92. # define PDC_LOG(x) if (pdc_trace_on) PDC_debug x
  93. # define RCSID(x) static const char *rcsid = x;
  94. #else
  95. # define PDC_LOG(x)
  96. # define RCSID(x)
  97. #endif
  98. /* Internal macros for attributes */
  99. #ifdef CHTYPE_LONG
  100. # define PDC_COLOR_PAIRS 256
  101. #else
  102. # define PDC_COLOR_PAIRS 32
  103. #endif
  104. #ifndef max
  105. # define max(a,b) (((a) > (b)) ? (a) : (b))
  106. #endif
  107. #ifndef min
  108. # define min(a,b) (((a) < (b)) ? (a) : (b))
  109. #endif
  110. #define DIVROUND(num, divisor) ((num) + ((divisor) >> 1)) / (divisor)
  111. #define PDC_CLICK_PERIOD 150 /* time to wait for a click, if
  112. not set by mouseinterval() */
  113. #endif /* __CURSES_INTERNALS__*/