-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.onyx
615 lines (550 loc) · 21.4 KB
/
module.onyx
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
package ncurses
use core {package, cptr, conv, string}
use runtime
#local Building_Library :: #defined (runtime.Generated_Foreign_Info)
#if Building_Library {
// "Forward" the foreign block info to the public scope
// if foreign block information was generated.
foreign_block :: __foreign_block
} else {
// Otherwise, require the library to be included.
#library "onyx_ncurses"
}
#local __foreign_block :: #foreign "onyx_ncurses" {
// initscr
initscr :: () -> WINDOW ---
endwin :: () -> i32 ---
isendwin :: () -> bool ---
newterm :: (type: cstr, out_fd, in_fd: ^u32) -> SCREEN ---
set_term :: (new: SCREEN) -> SCREEN ---
delscreen :: (sp: SCREEN) -> void ---
exit_curses :: (code: i32) -> void ---
// color
start_color :: () -> i32 ---
has_colors :: () -> bool ---
can_change_color :: () -> bool ---
init_pair :: (pair: i32, foreground: i32, background: i32) -> i32 ---
init_color :: (color: i32, r, g, b: i32) -> i32 ---
color_content :: (color: i32, r, g, b: ^i32) -> i32 ---
pair_content :: (pair: i32, f, b: ^i32) -> i32 ---
reset_color_pairs :: () -> void ---
COLOR_PAIR :: (color: i32) -> i32 ---
PAIR_NUMBER :: (pair: i32) -> i32 ---
// inopts
cbreak :: () -> i32 ---
nocbreak :: () -> i32 ---
echo :: () -> i32 ---
noecho :: () -> i32 ---
intrflush :: (w: WINDOW, bf: bool) -> i32 ---
keypad :: (w: WINDOW, bf: bool) -> i32 ---
meta :: (w: WINDOW, bf: bool) -> i32 ---
nodelay :: (w: WINDOW, bf: bool) -> i32 ---
notimeout :: (w: WINDOW, bf: bool) -> i32 ---
nl :: () -> i32 ---
nonl :: () -> i32 ---
raw :: () -> i32 ---
noraw :: () -> i32 ---
qiflush :: () -> void ---
noqiflush :: () -> void ---
halfdelay :: (tenths: i32) -> i32 ---
timeout :: (delay: i32) -> void ---
wtimeout :: (w: WINDOW, delay: i32) -> void ---
typeahead :: (fd: i32) -> i32 ---
// outopts
clearkok :: (w: WINDOW, bf: bool) -> i32 ---
idlok :: (w: WINDOW, bf: bool) -> i32 ---
idcok :: (w: WINDOW, bf: bool) -> void ---
immedok :: (w: WINDOW, bf: bool) -> void ---
leaveok :: (w: WINDOW, bf: bool) -> i32 ---
scrollok :: (w: WINDOW, bf: bool) -> i32 ---
setscrreg :: (top, bot: i32) -> i32 ---
wsetscrreg :: (w: WINDOW, top, bot: i32) -> i32 ---
// attr
attr_get :: (attr: ^attr_t, pair: ^u16, opts: ^void) -> i32 ---
wattr_get :: (w: WINDOW, attr: ^attr_t, pair: ^u16, opts: ^void) -> i32 ---
attr_set :: (attr: ^attr_t, pair: u16, opts: ^void) -> i32 ---
wattr_set :: (w: WINDOW, attr: attr_t, pair: u16, opts: ^void) -> i32 ---
attr_off :: (attr: attr_t, opts: ^void) -> i32 ---
wattr_off :: (w: WINDOW, attr: attr_t, opts: ^void) -> i32 ---
attr_on :: (attr: attr_t, opts: ^void) -> i32 ---
wattr_on :: (w: WINDOW, attr: attr_t, opts: ^void) -> i32 ---
attroff :: (attr: attr_t) -> i32 ---
wattroff :: (w: WINDOW, attr: attr_t) -> i32 ---
attron :: (attr: attr_t) -> i32 ---
wattron :: (w: WINDOW, attr: attr_t) -> i32 ---
attrset :: (attr: attr_t) -> i32 ---
wattrset :: (w: WINDOW, attr: attr_t) -> i32 ---
chgat :: (n: i32, attr: attr_t, pair: u16, opts: ^void) -> i32 ---
wchgat :: (w: WINDOW, n: i32, attr: attr_t, pair: u16, opts: ^void) -> i32 ---
mvchgat :: (y, x: i32, n: i32, attr: attr_t, pair: u16, opts: ^void) -> i32 ---
mvmchgat :: (w: WINDOW, y, x: i32, n: i32, attr: attr_t, pair: u16, opts: ^void) -> i32 ---
color_set :: (pair: u16, opts: ^void) -> i32 ---
wcolor_set :: (w: WINDOW, pair: u16, opts: ^void) -> i32 ---
standend :: () -> i32 ---
wstandend :: (w: WINDOW) -> i32 ---
standout :: () -> i32 ---
wstandout :: (w: WINDOW) -> i32 ---
// util
unctrl :: (c: chtype) -> cptr(u8) ---
// wunctrl :: (c: ^u8) -> cptr(u8) ---
keyname :: (c: i32) -> cptr(u8) ---
key_name :: (w: i32) -> cptr(u8) ---
filter :: () -> void ---
nofilter :: () -> void ---
use_env :: (f: bool) -> void ---
use_tioctl :: (f: bool) -> void ---
// putwin :: (w: WINDOW, filep: u32) -> i32 ---
getwin :: (filep: u32) -> WINDOW ---
delay_output :: (ms: i32) -> i32 ---
flushinp :: () -> i32 ---
// kernel
def_prog_mode :: () -> i32 ---
def_shell_mode :: () -> i32 ---
reset_prog_mode :: () -> i32 ---
reset_shell_mode :: () -> i32 ---
resetty :: () -> i32 ---
savetty :: () -> i32 ---
getsyx :: (y, x: i32) -> void ---
setsyx :: (y, x: i32) -> void ---
// ripoffline :: (line: i32, init: (WINDOW, i32) -> i32) -> i32 ---
curs_set :: (visibility: i32) -> i32 ---
napms :: (ms: i32) -> i32 ---
// refresh
refresh :: () -> i32 ---
wrefresh :: (w: WINDOW) -> i32 ---
wnoutrefresh :: (w: WINDOW) -> i32 ---
doupdate :: () -> i32 ---
redrawwin :: (w: WINDOW) -> i32 ---
wredrawln :: (w: WINDOW, beg_line, num_lines: i32) -> i32 ---
// addch
addch :: (ch: chtype) -> i32 ---
waddch :: (w: WINDOW, ch: chtype) -> i32 ---
mvaddch :: (y, x: i32, ch: chtype) -> i32 ---
mvwaddch :: (w: WINDOW, y, x: i32, ch: chtype) -> i32 ---
echochar :: (ch: chtype) -> i32 ---
wechochar :: (w: WINDOW, ch: chtype) -> i32 ---
// addchstr
addchstr :: (chstr: ^chtype) -> i32 ---
addchnstr :: (chstr: [] chtype) -> i32 ---
waddchstr :: (w: WINDOW, chstr: ^chtype) -> i32 ---
waddchnstr :: (w: WINDOW, chstr: [] chtype) -> i32 ---
mvaddchstr :: (y, x: i32, chstr: ^chtype) -> i32 ---
mvaddchnstr :: (y, x: i32, chstr: [] chtype) -> i32 ---
mvwaddchstr :: (w: WINDOW, y, x: i32, chstr: ^chtype) -> i32 ---
mvwaddchnstr :: (w: WINDOW, y, x: i32, chstr: [] chtype) -> i32 ---
// addstr
addstr :: (chstr: cstr) -> i32 ---
addnstr :: (chstr: str) -> i32 ---
waddstr :: (w: WINDOW, chstr: cstr) -> i32 ---
waddnstr :: (w: WINDOW, chstr: str) -> i32 ---
mvaddstr :: (y, x: i32, chstr: cstr) -> i32 ---
mvaddnstr :: (y, x: i32, chstr: str) -> i32 ---
mvwaddstr :: (w: WINDOW, y, x: i32, chstr: cstr) -> i32 ---
mvwaddnstr :: (w: WINDOW, y, x: i32, chstr: str) -> i32 ---
// clear
erase :: () -> i32 ---
werase :: (w: WINDOW) -> i32 ---
clear :: () -> i32 ---
wclear :: (w: WINDOW) -> i32 ---
clrtobot :: () -> i32 ---
wclrtobot :: (w: WINDOW) -> i32 ---
clrtoeol :: () -> i32 ---
wclrtoeol :: (w: WINDOW) -> i32 ---
// opaque
is_cleared :: (w: WINDOW) -> bool ---
is_idcok :: (w: WINDOW) -> bool ---
is_idlok :: (w: WINDOW) -> bool ---
is_immedok :: (w: WINDOW) -> bool ---
is_keypad :: (w: WINDOW) -> bool ---
is_leaveok :: (w: WINDOW) -> bool ---
is_nodelay :: (w: WINDOW) -> bool ---
is_notimeout :: (w: WINDOW) -> bool ---
is_pad :: (w: WINDOW) -> bool ---
is_scrollok :: (w: WINDOW) -> bool ---
is_subwin :: (w: WINDOW) -> bool ---
is_syncok :: (w: WINDOW) -> bool ---
wgetparent :: (w: WINDOW) -> WINDOW ---
wgetdelay :: (w: WINDOW) -> i32 ---
// Why doesn't this one work?
// wgetscrreg :: (w: WINDOW, top, bottom: ^i32) -> void ---
// window
newwin :: (nlines, ncols, y, x: i32) -> WINDOW ---
delwin :: (w: WINDOW) -> i32 ---
mvwin :: (w: WINDOW, y, x: i32) -> i32 ---
subwin :: (w: WINDOW, nlines, ncols, y, x: i32) -> WINDOW ---
derwin :: (w: WINDOW, nlines, ncols, y, x: i32) -> WINDOW ---
mvderwin :: (w: WINDOW, parent_y, parent_x: i32) -> i32 ---
dupwin :: (w: WINDOW) -> WINDOW ---
wsyncup :: (w: WINDOW) -> void ---
syncok :: (w: WINDOW, bf: bool) -> i32 ---
wcursyncup :: (w: WINDOW) -> void ---
wsyncdown :: (w: WINDOW) -> void ---
// touch
touchline :: (w: WINDOW, start, count: i32) -> i32 ---
touchwin :: (w: WINDOW) -> i32 ---
wtouchln :: (w: WINDOW, y, b, changed: i32) -> i32 ---
untouchwin :: (w: WINDOW) -> i32 ---
is_linetouched :: (w: WINDOW, line: i32) -> bool ---
is_wintouched :: (w: WINDOW) -> bool ---
// bkgd
bkgdset :: (ch: chtype) -> void ---
wbkgdset :: (w: WINDOW, ch: chtype) -> void ---
bkgd :: (bh: chtype) -> i32 ---
wbkgd :: (w: WINDOW, ch: chtype) -> i32 ---
getbkgd :: (w: WINDOW) -> chtype ---
// inch
inch :: () -> chtype ---
winch :: (w: WINDOW) -> chtype ---
mvinch :: (y, x: i32) -> chtype ---
mvwinch :: (w: WINDOW, y, x: i32) -> chtype ---
// getch
getch :: () -> i32 ---
wgetch :: (w: WINDOW) -> i32 ---
mvgetch :: (y, x: i32) -> i32 ---
mvwgetch :: (y, x: i32, w: WINDOW) -> i32 ---
ungetch :: (ch: i32) -> i32 ---
has_key :: (ch: i32) -> i32 ---
// getyx
__get_yx :: (w: WINDOW, y, x: ^i32) -> void ---
__get_par_yx :: (w: WINDOW, y, x: ^i32) -> void ---
__get_beg_yx :: (w: WINDOW, y, x: ^i32) -> void ---
__get_max_yx :: (w: WINDOW, y, x: ^i32) -> void ---
// getstr
// The API for these is horrible for use in Onyx.
// Use ogetstr and family for a better API.
getstr :: (s: cstr) -> i32 --- // Wildly unsafe!
getnstr :: (s: str) -> i32 ---
wgetstr :: (w: WINDOW, s: cstr) -> i32 ---
wgetnstr :: (w: WINDOW, s: str) -> i32 ---
mvgetstr :: (y, x: i32, s: cstr) -> i32 --- // Wildly unsafe!
mvgetnstr :: (y, x: i32, s: str) -> i32 ---
mvwgetstr :: (w: WINDOW, y, x: i32, s: cstr) -> i32 ---
mvwgetnstr :: (w: WINDOW, y, x: i32, s: str) -> i32 ---
// border
border :: (ls, rs, ts, bs, tl, tr, bl, br: chtype) -> i32 ---
wborder :: (w: WINDOW, ls, rs, ts, bs, tl, tr, bl, br: chtype) -> i32 ---
box :: (w: WINDOW, verch, horch: chtype) -> i32 ---
hline :: (ch: chtype, n: i32) -> i32 ---
whline :: (w: WINDOW, ch: chtype, n: i32) -> i32 ---
vline :: (ch: chtype, n: i32) -> i32 ---
wvline :: (w: WINDOW, ch: chtype, n: i32) -> i32 ---
mvhline :: (y, x: i32, ch: chtype, n: i32) -> i32 ---
mvwhline :: (w: WINDOW, y, x: i32, ch: chtype, n: i32) -> i32 ---
mvvline :: (y, x: i32, ch: chtype, n: i32) -> i32 ---
mvwvline :: (w: WINDOW, y, x: i32, ch: chtype, n: i32) -> i32 ---
// new_pair
allow_pair :: (fg, bg: i32) -> i32 ---
find_pair :: (fg, bg: i32) -> i32 ---
free_pair :: (pair: i32) -> i32 ---
// default_colors
use_default_colors :: () -> i32 ---
assume_default_colors :: (fg, bg: i32) -> i32 ---
// termattrs
buadrate :: () -> i32 ---
erasechar :: () -> u8 ---
has_ic :: () -> bool ---
has_il :: () -> bool ---
killchar :: () -> u8 ---
longname :: () -> cptr(u8) ---
term_attrs :: () -> attr_t ---
termattrs :: () -> chtype ---
termname :: () -> void ---
// beep
beep :: () -> void ---
flash :: () -> void ---
// overlay
overlay :: (srcwin: WINDOW, dstwin: WINDOW) -> i32 ---
overwrite :: (srcwin: WINDOW, dstwin: WINDOW) -> i32 ---
copywin :: (srcwin: WINDOW, dstwin: WINDOW, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, overlay: i32) -> i32 ---
// pad
newpad :: (nlines, ncols: i32) -> WINDOW ---
subpad :: (orig: WINDOW, nlines, ncols: i32, begin_y, begin_x: i32) -> WINDOW ---
prefresh :: (pad: WINDOW, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol: i32) -> i32 ---
pnoutrefresh :: (pad: WINDOW, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol: i32) -> i32 ---
pechochar :: (pad: WINDOW, ch: chtype) -> i32 ---
// define_key
define_key :: (definition: cstr, keycode: i32) -> i32 ---
keyok :: (keycode: i32, enable: bool) -> i32 ---
key_defined :: (definition: cstr) -> i32 ---
// delch
delch :: () -> i32 ---
wdelch :: (w: WINDOW) -> i32 ---
mvdelch :: (y, x: i32) -> i32 ---
mvwdelch :: (w: WINDOW, y, x: i32) -> i32 ---
// deleteln
deleteln :: () -> i32 ---
wdeleteln :: (w: WINDOW) -> i32 ---
insdelln :: (n: i32) -> i32 ---
winsdelln :: (w: WINDOW, n: i32) -> i32 ---
insertln :: () -> i32 ---
winsertln :: (w: WINDOW) -> i32 ---
// slk
slk_init :: (fmt: i32) -> i32 ---
slk_set :: (labnum: i32, label: cstr, fmt: i32) -> i32 ---
slk_label :: (labnum: i32) -> cptr(u8) ---
slk_refresh :: () -> i32 ---
slk_noutrefresh :: () -> i32 ---
slk_clear :: () -> i32 ---
slk_restore :: () -> i32 ---
slk_touch :: () -> i32 ---
slk_attron :: (attrs: chtype) -> i32 ---
slk_attroff :: (attrs: chtype) -> i32 ---
slk_attrset :: (attrs: chtype) -> i32 ---
slk_attr :: () -> attr_t ---
slk_color :: (pair: i32) -> i32 ---
// legacy
getattrs :: (w: WINDOW) -> i32 ---
getbegx :: (w: WINDOW) -> i32 ---
getbegy :: (w: WINDOW) -> i32 ---
getcurx :: (w: WINDOW) -> i32 ---
getcury :: (w: WINDOW) -> i32 ---
getmaxx :: (w: WINDOW) -> i32 ---
getmaxy :: (w: WINDOW) -> i32 ---
getparx :: (w: WINDOW) -> i32 ---
getpary :: (w: WINDOW) -> i32 ---
// mouse
has_mouse :: () -> bool ---
getmouse :: (event: ^MEvent) -> i32 ---
ungetmouse :: (event: ^MEvent) -> i32 ---
mousemask :: (newmask: mmask_t, oldmask: ^mmask_t) -> mmask_t ---
wenclose :: (w: WINDOW, y, x: i32) -> bool ---
mouse_trafo :: (py, px: ^i32, to_screen: bool) -> bool ---
wmouse_trafo :: (w: WINDOW, py, px: ^i32, to_screen: bool) -> bool ---
mouseinterval :: (erval: i32) -> i32 ---
// resizeterm
is_term_resized :: (lines, columns: i32) -> bool ---
resize_term :: (lines, columns: i32) -> bool ---
resizeterm :: (lines, columns: i32) -> bool ---
// scroll
scroll :: (w: WINDOW) -> i32 ---
scrl :: (n: i32) -> i32 ---
wscrl :: (w: WINDOW, n: i32) -> i32 ---
// variables
__get_stdscr :: () -> WINDOW ---
NCURSES_ACS :: (a: i32) -> chtype ---
// locale
setlocale :: (category: u32, locale: cstr) -> cptr(u8) ---
}
// Types have to always be included
WINDOW :: #distinct u64
SCREEN :: #distinct u64
chtype :: u32
attr_t :: u32
mmask_t :: u64
MEvent :: struct {
id: u16;
x, y, z: i32;
bstate: mmask_t;
}
#if !Building_Library {
stdscr :: __get_stdscr
getyx :: __get_yx
getparyx :: __get_par_yx
getbegyx :: __get_beg_yx
getmaxyx :: __get_max_yx
ogetstr :: ($max_length: i32 = 1024) => {
buf: [max_length] u8;
err := getnstr(buf);
return string.alloc_copy(string.from_cstr(~~ buf));
}
mvogetstr :: (y, x: i32, $max_length: i32 = 1024) => {
buf: [max_length] u8;
err := mvgetnstr(y, x, buf);
return string.alloc_copy(string.from_cstr(~~ buf));
}
wogetstr :: (w: WINDOW, $max_length: i32 = 1024) => {
buf: [max_length] u8;
err := wgetnstr(w, buf);
return string.alloc_copy(string.from_cstr(~~ buf));
}
mvwogetstr :: (w: WINDOW, y, x: i32, $max_length: i32 = 1024) => {
buf: [max_length] u8;
err := mvwgetnstr(w, y, x, buf);
return string.alloc_copy(string.from_cstr(~~ buf));
}
printw :: (fmt: str, args: ..any) {
buf: [1024] u8;
to_output := conv.format_va(buf, fmt, args);
addnstr(to_output);
}
wprintw :: (w: WINDOW, fmt: str, args: ..any) {
buf: [1024] u8;
to_output := conv.format_va(buf, fmt, args);
waddnstr(w, to_output);
}
mvprintw :: (y, x: i32, fmt: str, args: ..any) {
buf: [1024] u8;
to_output := conv.format_va(buf, fmt, args);
mvaddnstr(y, x, to_output);
}
mvwprintw :: (w: WINDOW, y, x: i32, fmt: str, args: ..any) {
buf: [1024] u8;
to_output := conv.format_va(buf, fmt, args);
mvwaddnstr(w, y, x, to_output);
}
BUTTON1_RELEASED :: 0x01 << (0 * 6)
BUTTON1_PRESSED :: 0x02 << (0 * 6)
BUTTON1_CLICKED :: 0x04 << (0 * 6)
BUTTON1_DOUBLE_CLICKED :: 0x08 << (0 * 6)
BUTTON1_TRIPLE_CLICKED :: 0x10 << (0 * 6)
BUTTON2_RELEASED :: 0x01 << (1 * 6)
BUTTON2_PRESSED :: 0x02 << (1 * 6)
BUTTON2_CLICKED :: 0x04 << (1 * 6)
BUTTON2_DOUBLE_CLICKED :: 0x08 << (1 * 6)
BUTTON2_TRIPLE_CLICKED :: 0x10 << (1 * 6)
BUTTON3_RELEASED :: 0x01 << (2 * 6)
BUTTON3_PRESSED :: 0x02 << (2 * 6)
BUTTON3_CLICKED :: 0x04 << (2 * 6)
BUTTON3_DOUBLE_CLICKED :: 0x08 << (2 * 6)
BUTTON3_TRIPLE_CLICKED :: 0x10 << (2 * 6)
BUTTON4_RELEASED :: 0x01 << (3 * 6)
BUTTON4_PRESSED :: 0x02 << (3 * 6)
BUTTON4_CLICKED :: 0x04 << (3 * 6)
BUTTON4_DOUBLE_CLICKED :: 0x08 << (3 * 6)
BUTTON4_TRIPLE_CLICKED :: 0x10 << (3 * 6)
BUTTON5_RELEASED :: 0x01 << (4 * 6)
BUTTON5_PRESSED :: 0x02 << (4 * 6)
BUTTON5_CLICKED :: 0x04 << (4 * 6)
BUTTON5_DOUBLE_CLICKED :: 0x08 << (4 * 6)
BUTTON5_TRIPLE_CLICKED :: 0x10 << (4 * 6)
BUTTON_CTRL :: 0x01 << (6 * 6)
BUTTON_SHIFT :: 0x02 << (6 * 6)
BUTTON_ALT :: 0x04 << (6 * 6)
REPORT_MOUSE_POSITION :: 0x08 << (6 * 6)
BUTTON_RELEASE :: macro (e: mmask_t, button: i32) => (e & (1 << (button * 6))) != 0;
BUTTON_PRESS :: macro (e: mmask_t, button: i32) => (e & (2 << (button * 6))) != 0;
BUTTON_CLICK :: macro (e: mmask_t, button: i32) => (e & (4 << (button * 6))) != 0;
BUTTON_DOUBLE_CLICK :: macro (e: mmask_t, button: i32) => (e & (8 << (button * 6))) != 0;
BUTTON_TRIPLE_CLICK :: macro (e: mmask_t, button: i32) => (e & (16 << (button * 6))) != 0;
ALL_MOUSE_EVENTS :: (1 << (7 * 6)) - 1
A_NORMAL :: 0
A_ATTRIBUTES :: 0xffffff00
A_CHARTEXT :: 0xff
A_COLOR :: 0xff00
A_STANDOUT :: 0x00010000
A_UNDERLINE :: 0x00020000
A_REVERSE :: 0x00040000
A_BLINK :: 0x00080000
A_DIM :: 0x00100000
A_BOLD :: 0x00200000
A_ALTCHARSET :: 0x00400000
A_INVIS :: 0x00800000
A_PROTECT :: 0x01000000
A_HORIZONTAL :: 0x02000000
A_LEFT :: 0x04000000
A_LOW :: 0x08000000
A_RIGHT :: 0x10000000
A_TOP :: 0x20000000
A_VERTICAL :: 0x40000000
A_ITALIC :: 0x80000000
COLOR_BLACK :: 0
COLOR_RED :: 1
COLOR_GREEN :: 2
COLOR_YELLOW :: 3
COLOR_BLUE :: 4
COLOR_MAGENTA :: 5
COLOR_CYAN :: 6
COLOR_WHITE :: 7
KEY_DOWN :: 0402 /* down-arrow key */
KEY_UP :: 0403 /* up-arrow key */
KEY_LEFT :: 0404 /* left-arrow key */
KEY_RIGHT :: 0405 /* right-arrow key */
KEY_HOME :: 0406 /* home key */
KEY_BACKSPACE :: 0407 /* backspace key */
KEY_F0 :: 0410 /* Function keys. Space for 64 */
KEY_F :: macro (n) => #this_package.KEY_F0 + n /* Value of function key n */
KEY_DL :: 0510 /* delete-line key */
KEY_IL :: 0511 /* insert-line key */
KEY_DC :: 0512 /* delete-character key */
KEY_IC :: 0513 /* insert-character key */
KEY_EIC :: 0514 /* sent by rmir or smir in insert mode */
KEY_CLEAR :: 0515 /* clear-screen or erase key */
KEY_EOS :: 0516 /* clear-to-end-of-screen key */
KEY_EOL :: 0517 /* clear-to-end-of-line key */
KEY_SF :: 0520 /* scroll-forward key */
KEY_SR :: 0521 /* scroll-backward key */
KEY_NPAGE :: 0522 /* next-page key */
KEY_PPAGE :: 0523 /* previous-page key */
KEY_STAB :: 0524 /* set-tab key */
KEY_CTAB :: 0525 /* clear-tab key */
KEY_CATAB :: 0526 /* clear-all-tabs key */
KEY_ENTER :: 0527 /* enter/send key */
KEY_PRINT :: 0532 /* print key */
KEY_LL :: 0533 /* lower-left key (home down) */
KEY_A1 :: 0534 /* upper left of keypad */
KEY_A3 :: 0535 /* upper right of keypad */
KEY_B2 :: 0536 /* center of keypad */
KEY_C1 :: 0537 /* lower left of keypad */
KEY_C3 :: 0540 /* lower right of keypad */
KEY_BTAB :: 0541 /* back-tab key */
KEY_BEG :: 0542 /* begin key */
KEY_CANCEL :: 0543 /* cancel key */
KEY_CLOSE :: 0544 /* close key */
KEY_COMMAND :: 0545 /* command key */
KEY_COPY :: 0546 /* copy key */
KEY_CREATE :: 0547 /* create key */
KEY_END :: 0550 /* end key */
KEY_EXIT :: 0551 /* exit key */
KEY_FIND :: 0552 /* find key */
KEY_HELP :: 0553 /* help key */
KEY_MARK :: 0554 /* mark key */
KEY_MESSAGE :: 0555 /* message key */
KEY_MOVE :: 0556 /* move key */
KEY_NEXT :: 0557 /* next key */
KEY_OPEN :: 0560 /* open key */
KEY_OPTIONS :: 0561 /* options key */
KEY_PREVIOUS :: 0562 /* previous key */
KEY_REDO :: 0563 /* redo key */
KEY_REFERENCE :: 0564 /* reference key */
KEY_REFRESH :: 0565 /* refresh key */
KEY_REPLACE :: 0566 /* replace key */
KEY_RESTART :: 0567 /* restart key */
KEY_RESUME :: 0570 /* resume key */
KEY_SAVE :: 0571 /* save key */
KEY_SBEG :: 0572 /* shifted begin key */
KEY_SCANCEL :: 0573 /* shifted cancel key */
KEY_SCOMMAND :: 0574 /* shifted command key */
KEY_SCOPY :: 0575 /* shifted copy key */
KEY_SCREATE :: 0576 /* shifted create key */
KEY_SDC :: 0577 /* shifted delete-character key */
KEY_SDL :: 0600 /* shifted delete-line key */
KEY_SELECT :: 0601 /* select key */
KEY_SEND :: 0602 /* shifted end key */
KEY_SEOL :: 0603 /* shifted clear-to-end-of-line key */
KEY_SEXIT :: 0604 /* shifted exit key */
KEY_SFIND :: 0605 /* shifted find key */
KEY_SHELP :: 0606 /* shifted help key */
KEY_SHOME :: 0607 /* shifted home key */
KEY_SIC :: 0610 /* shifted insert-character key */
KEY_SLEFT :: 0611 /* shifted left-arrow key */
KEY_SMESSAGE :: 0612 /* shifted message key */
KEY_SMOVE :: 0613 /* shifted move key */
KEY_SNEXT :: 0614 /* shifted next key */
KEY_SOPTIONS :: 0615 /* shifted options key */
KEY_SPREVIOUS :: 0616 /* shifted previous key */
KEY_SPRINT :: 0617 /* shifted print key */
KEY_SREDO :: 0620 /* shifted redo key */
KEY_SREPLACE :: 0621 /* shifted replace key */
KEY_SRIGHT :: 0622 /* shifted right-arrow key */
KEY_SRSUME :: 0623 /* shifted resume key */
KEY_SSAVE :: 0624 /* shifted save key */
KEY_SSUSPEND :: 0625 /* shifted suspend key */
KEY_SUNDO :: 0626 /* shifted undo key */
KEY_SUSPEND :: 0627 /* suspend key */
KEY_UNDO :: 0630 /* undo key */
KEY_MOUSE :: 0631 /* Mouse event has occurred */
// Locales
LC_CTYPE :: 0
LC_NUMERIC :: 1
LC_TIME :: 2
LC_COLLATE :: 3
LC_MONETARY :: 4
LC_MESSAGES :: 5
LC_ALL :: 6
LC_PAPER :: 7
LC_NAME :: 8
LC_ADDRESS :: 9
LC_TELEPHONE :: 10
LC_MEASUREMENT :: 11
LC_IDENTIFICATION :: 12
} // !Building_Library