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