1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
use libc::{ c_char, c_int };
use super::ll::*;
extern
{
pub static curscr: WINDOW;
pub static newscr: WINDOW;
pub static stdscr: WINDOW;
pub static ttytype: *mut c_char;
pub static COLORS: c_int;
pub static COLOR_PAIRS: c_int;
pub static COLS: c_int;
pub static ESCDELAY: c_int;
pub static LINES: c_int;
pub static TABSIZE: c_int;
pub static acs_map: [chtype; 0];
}
pub const ERR: i32 = -1;
pub const OK: i32 = 0;
pub const TRUE: i32 = 1;
pub const FALSE: i32 = 0;
pub const NCURSES_ATTR_SHIFT: u32 = 8u32;
pub const COLOR_BLACK: i16 = 0;
pub const COLOR_RED: i16 = 1;
pub const COLOR_GREEN: i16 = 2;
pub const COLOR_YELLOW: i16 = 3;
pub const COLOR_BLUE: i16 = 4;
pub const COLOR_MAGENTA: i16 = 5;
pub const COLOR_CYAN: i16 = 6;
pub const COLOR_WHITE: i16 = 7;
pub const _SUBWIN: i32 = 0x01;
pub const _ENDLINE: i32 = 0x02;
pub const _FULLWIN: i32 = 0x04;
pub const _SCROLLWIN: i32 = 0x08;
pub const _ISPAD: i32 = 0x10;
pub const _HASMOVED: i32 = 0x20;
pub const _WRAPPED: i32 = 0x40;
pub const _NOCHANGE: i32 = -1;
pub const _NEWINDEX: i32 = -1;
pub const KEY_CODE_YES: i32 = 0x100;
pub const KEY_MIN: i32 = 0x101;
pub const KEY_BREAK: i32 = 0x101;
pub const KEY_SRESET: i32 = 0x158;
pub const KEY_RESET: i32 = 0x159;
pub const KEY_DOWN: i32 = 0x102;
pub const KEY_UP: i32= 0x103;
pub const KEY_LEFT: i32= 0x104;
pub const KEY_RIGHT: i32= 0x105;
pub const KEY_HOME: i32= 0x106;
pub const KEY_BACKSPACE: i32= 0x107;
pub const KEY_F0: i32= 0x108;
pub const KEY_F1: i32= 0x109;
pub const KEY_F2: i32= 0x10a;
pub const KEY_F3: i32= 0x10b;
pub const KEY_F4: i32= 0x10c;
pub const KEY_F5: i32= 0x10d;
pub const KEY_F6: i32= 0x10e;
pub const KEY_F7: i32= 0x10f;
pub const KEY_F8: i32= 0x110;
pub const KEY_F9: i32= 0x111;
pub const KEY_F10: i32= 0x112;
pub const KEY_F11: i32= 0x113;
pub const KEY_F12: i32= 0x114;
pub const KEY_F13: i32= 0x115;
pub const KEY_F14: i32= 0x116;
pub const KEY_F15: i32= 0x117;
pub const KEY_DL: i32= 0x148;
pub const KEY_IL: i32= 0x149;
pub const KEY_DC: i32= 0x150;
pub const KEY_IC: i32= 0x151;
pub const KEY_EIC: i32= 0x152;
pub const KEY_CLEAR: i32= 0x14d;
pub const KEY_EOS: i32= 0x14e;
pub const KEY_EOL: i32= 0x14f;
pub const KEY_SF: i32= 0x150;
pub const KEY_SR: i32= 0x151;
pub const KEY_NPAGE: i32= 0x152;
pub const KEY_PPAGE: i32= 0x153;
pub const KEY_STAB: i32= 0x154;
pub const KEY_CTAB: i32= 0x155;
pub const KEY_CATAB: i32= 0x156;
pub const KEY_ENTER: i32= 0x157;
pub const KEY_PRINT: i32= 0x15a;
pub const KEY_LL: i32= 0x15b;
pub const KEY_A1: i32= 0x15c;
pub const KEY_A3: i32= 0x15d;
pub const KEY_B2: i32= 0x15e;
pub const KEY_C1: i32= 0x15f;
pub const KEY_C3: i32= 0x160;
pub const KEY_BTAB: i32= 0x161;
pub const KEY_BEG: i32= 0x162;
pub const KEY_CANCEL: i32= 0x163;
pub const KEY_CLOSE: i32= 0x164;
pub const KEY_COMMAND: i32= 0x165;
pub const KEY_COPY: i32= 0x166;
pub const KEY_CREATE: i32= 0x167;
pub const KEY_END: i32= 0x168;
pub const KEY_EXIT: i32= 0x169;
pub const KEY_FIND: i32= 0x16a;
pub const KEY_HELP: i32= 0x16b;
pub const KEY_MARK: i32= 0x16c;
pub const KEY_MESSAGE: i32= 0x16d;
pub const KEY_MOVE: i32= 0x16e;
pub const KEY_NEXT: i32= 0x16f;
pub const KEY_OPEN: i32= 0x170;
pub const KEY_OPTIONS: i32= 0x171;
pub const KEY_PREVIOUS: i32= 0x172;
pub const KEY_REDO: i32= 0x173;
pub const KEY_REFERENCE: i32= 0x174;
pub const KEY_REFRESH: i32= 0x175;
pub const KEY_REPLACE: i32= 0x176;
pub const KEY_RESTART: i32= 0x177;
pub const KEY_RESUME: i32= 0x178;
pub const KEY_SAVE: i32= 0x179;
pub const KEY_SBEG: i32= 0x17a;
pub const KEY_SCANCEL: i32= 0x17b;
pub const KEY_SCOMMAND: i32= 0x17c;
pub const KEY_SCOPY: i32= 0x17d;
pub const KEY_SCREATE: i32= 0x17e;
pub const KEY_SDC : i32= 0x17f;
pub const KEY_SDL : i32= 0x180;
pub const KEY_SELECT: i32= 0x181;
pub const KEY_SEND: i32= 0x182;
pub const KEY_SEOL: i32= 0x183;
pub const KEY_SEXIT: i32= 0x184;
pub const KEY_SFIND: i32= 0x185;
pub const KEY_SHELP: i32= 0x186;
pub const KEY_SHOME: i32= 0x187;
pub const KEY_SIC : i32= 0x188;
pub const KEY_SLEFT: i32= 0x189;
pub const KEY_SMESSAGE: i32= 0x18a;
pub const KEY_SMOVE: i32= 0x18b;
pub const KEY_SNEXT: i32= 0x18c;
pub const KEY_SOPTIONS: i32= 0x18d;
pub const KEY_SPREVIOUS: i32= 0x18e;
pub const KEY_SPRINT: i32= 0x18f;
pub const KEY_SREDO: i32= 0x190;
pub const KEY_SREPLACE: i32= 0x191;
pub const KEY_SRIGHT: i32= 0x192;
pub const KEY_SRSUME: i32= 0x193;
pub const KEY_SSAVE: i32= 0x194;
pub const KEY_SSUSPEND: i32= 0x195;
pub const KEY_SUNDO: i32= 0x196;
pub const KEY_SUSPEND: i32= 0x197;
pub const KEY_UNDO: i32= 0x198;
pub const KEY_MOUSE: i32= 0x199;
pub const KEY_RESIZE: i32= 0x19a;
pub const KEY_EVENT: i32= 0x19b;
pub const KEY_MAX: i32= 0x1ff;
macro_rules! ncurses_mouse_mask( ($b:expr, $m:expr) => ($m << (($b - 1) * 5)); );
pub const NCURSES_BUTTON_RELEASED: i32= 0x001;
pub const NCURSES_BUTTON_PRESSED: i32= 0x002;
pub const NCURSES_BUTTON_CLICKED: i32= 0x004;
pub const NCURSES_DOUBLE_CLICKED: i32= 0x008;
pub const NCURSES_TRIPLE_CLICKED: i32= 0x010;
pub const NCURSES_RESERVED_EVENT: i32= 0x020;
pub const BUTTON1_RELEASED: i32= ncurses_mouse_mask!(1, NCURSES_BUTTON_RELEASED);
pub const BUTTON1_PRESSED: i32= ncurses_mouse_mask!(1, NCURSES_BUTTON_PRESSED);
pub const BUTTON1_CLICKED: i32= ncurses_mouse_mask!(1, NCURSES_BUTTON_CLICKED);
pub const BUTTON1_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(1, NCURSES_DOUBLE_CLICKED);
pub const BUTTON1_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(1, NCURSES_TRIPLE_CLICKED);
pub const BUTTON2_RELEASED: i32= ncurses_mouse_mask!(2, NCURSES_BUTTON_RELEASED);
pub const BUTTON2_PRESSED: i32= ncurses_mouse_mask!(2, NCURSES_BUTTON_PRESSED);
pub const BUTTON2_CLICKED: i32= ncurses_mouse_mask!(2, NCURSES_BUTTON_CLICKED);
pub const BUTTON2_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(2, NCURSES_DOUBLE_CLICKED);
pub const BUTTON2_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(2, NCURSES_TRIPLE_CLICKED);
pub const BUTTON3_RELEASED: i32= ncurses_mouse_mask!(3, NCURSES_BUTTON_RELEASED);
pub const BUTTON3_PRESSED: i32= ncurses_mouse_mask!(3, NCURSES_BUTTON_PRESSED);
pub const BUTTON3_CLICKED: i32= ncurses_mouse_mask!(3, NCURSES_BUTTON_CLICKED);
pub const BUTTON3_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(3, NCURSES_DOUBLE_CLICKED);
pub const BUTTON3_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(3, NCURSES_TRIPLE_CLICKED);
pub const BUTTON4_RELEASED: i32= ncurses_mouse_mask!(4, NCURSES_BUTTON_RELEASED);
pub const BUTTON4_PRESSED: i32= ncurses_mouse_mask!(4, NCURSES_BUTTON_PRESSED);
pub const BUTTON4_CLICKED: i32= ncurses_mouse_mask!(4, NCURSES_BUTTON_CLICKED);
pub const BUTTON4_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(4, NCURSES_DOUBLE_CLICKED);
pub const BUTTON4_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(4, NCURSES_TRIPLE_CLICKED);
pub const BUTTON5_RELEASED: i32= ncurses_mouse_mask!(5, NCURSES_BUTTON_RELEASED);
pub const BUTTON5_PRESSED: i32= ncurses_mouse_mask!(5, NCURSES_BUTTON_PRESSED);
pub const BUTTON5_CLICKED: i32= ncurses_mouse_mask!(5, NCURSES_BUTTON_CLICKED);
pub const BUTTON5_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(5, NCURSES_DOUBLE_CLICKED);
pub const BUTTON5_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(5, NCURSES_TRIPLE_CLICKED);
pub const BUTTON_CTRL: i32= ncurses_mouse_mask!(6, 0x001);
pub const BUTTON_SHIFT: i32= ncurses_mouse_mask!(6, 0x002);
pub const BUTTON_ALT: i32= ncurses_mouse_mask!(6, 0x004);
pub const REPORT_MOUSE_POSITION: i32= ncurses_mouse_mask!(6, 0x008);
pub const ALL_MOUSE_EVENTS: i32= REPORT_MOUSE_POSITION - 1;
macro_rules! button_release( ($e: expr, $x: expr) => (e & ncurses_mouse_mask!(x, 0x001)); );
macro_rules! button_press( ($e: expr, $x: expr) => (e & ncurses_mouse_mask!(x, 0x002)); );
macro_rules! button_click( ($e: expr, $x: expr) => (e & ncurses_mouse_mask!(x, 0x004)); );
macro_rules! button_double_click( ($e: expr, $x: expr) => (e & ncurses_mouse_mask!(x, 0x008)); );
macro_rules! button_triple_click( ($e: expr, $x: expr) => (e & ncurses_mouse_mask!(x, 0x010)); );
macro_rules! button_reserved_event( ($e: expr, $x: expr) => (e & ncurses_mouse_mask!(x, 0x020)); );
pub const LC_ALL: c_int = 0;
pub const LC_COLLATE: c_int = 1;
pub const LC_CTYPE: c_int = 2;
pub const LC_MONETARY: c_int = 3;
pub const LC_NUMERIC: c_int = 4;
pub const LC_TIME: c_int = 5;
pub const LC_MESSAGES: c_int = 6;
#[repr(i32)]
pub enum LcCategory {
all = LC_ALL,
collate = LC_COLLATE,
ctype = LC_CTYPE,
monetary = LC_MONETARY,
numeric = LC_NUMERIC,
time = LC_TIME,
messages = LC_MESSAGES,
}