1 /*
2     Copyright © 2013 Free Software Foundation, Inc
3     See licensing in LICENSE file
4 
5     File: lib.rs
6     Author: Jesse 'Jeaye' Wilkerson
7     Description:
8       Safe wrappers for ncurses functions.
9 */
10 
11 #![allow(non_camel_case_types)]
12 #![allow(non_snake_case)]
13 #![warn(missing_debug_implementations)]
14 
15 extern crate libc;
16 
17 use std::mem;
18 use std::{ char, ptr };
19 use std::ffi::{CString, CStr};
20 use self::ll::{FILE_p};
21 pub use self::constants::*;
22 pub use self::panel::wrapper::*;
23 pub use self::menu::wrapper::*;
24 pub use self::menu::constants::*;
25 
26 pub type chtype = self::ll::chtype;
27 pub type winttype = u32;
28 
29 pub type mmask_t = chtype;
30 pub type attr_t = chtype;
31 pub type NCURSES_ATTR_T = attr_t;
32 
33 pub mod ll;
34 pub mod constants;
35 pub mod panel;
36 pub mod menu;
37 
38 trait FromCStr {
from_c_str(s: *const libc::c_char) -> Self39     unsafe fn from_c_str(s: *const libc::c_char) -> Self;
40 }
41 
42 impl FromCStr for String {
from_c_str(s: *const libc::c_char) -> String43     unsafe fn from_c_str(s: *const libc::c_char) -> String {
44         let bytes = CStr::from_ptr(s).to_bytes();
45         String::from_utf8_unchecked(bytes.to_vec())
46     }
47 }
48 
49 impl FromCStr for Option<String> {
from_c_str(s: *const libc::c_char) -> Option<String>50     unsafe fn from_c_str(s: *const libc::c_char) -> Option<String> {
51         if s.is_null() {
52             None
53         } else {
54             Some(FromCStr::from_c_str(s))
55         }
56     }
57 }
58 
59 trait ToCStr {
to_c_str(&self) -> CString60     fn to_c_str(&self) -> CString;
61 }
62 
63 impl <'a>ToCStr for &'a str {
to_c_str(&self) -> CString64     fn to_c_str(&self) -> CString {
65         CString::new(*self).unwrap()
66     }
67 }
68 
69 #[derive(Debug, Clone, Copy)]
70 pub enum CURSOR_VISIBILITY
71 {
72   CURSOR_INVISIBLE = 0,
73   CURSOR_VISIBLE,
74   CURSOR_VERY_VISIBLE
75 }
76 
77 pub type WINDOW = self::ll::WINDOW;
78 pub type SCREEN = self::ll::SCREEN;
79 pub type mmaskt = self::ll::mmask_t;
80 pub type MEVENT = self::ll::MEVENT;
81 
addch(ch: chtype) -> i3282 pub fn addch(ch: chtype) -> i32
83 { unsafe { ll::addch(ch) } }
84 
85 
addchnstr(s: &[chtype], n: i32) -> i3286 pub fn addchnstr(s: &[chtype], n: i32) -> i32
87 { unsafe { ll::addchnstr(s.as_ptr(), n) } }
88 
89 
addchstr(s: &[chtype]) -> i3290 pub fn addchstr(s: &[chtype]) -> i32
91 { unsafe { ll::addchstr(s.as_ptr()) } }
92 
93 
addnstr(s: &str, n: i32) -> i3294 pub fn addnstr(s: &str, n: i32) -> i32
95 { unsafe { ll::addnstr(s.to_c_str().as_ptr(), n) } }
96 
97 
addstr(s: &str) -> i3298 pub fn addstr(s: &str) -> i32
99 { unsafe { ll::addstr(s.to_c_str().as_ptr()) } }
100 
101 
assume_default_colors(fg: i32, bg: i32) -> i32102 pub fn assume_default_colors(fg: i32, bg: i32) -> i32
103 { unsafe { ll::assume_default_colors(fg, bg) } }
104 
105 
attroff(a: NCURSES_ATTR_T) -> i32106 pub fn attroff(a: NCURSES_ATTR_T) -> i32
107 { unsafe { ll::attroff(a) } }
108 
109 
attron(a: NCURSES_ATTR_T) -> i32110 pub fn attron(a: NCURSES_ATTR_T) -> i32
111 { unsafe { ll::attron(a) } }
112 
113 
attrset(a: NCURSES_ATTR_T) -> i32114 pub fn attrset(a: NCURSES_ATTR_T) -> i32
115 { unsafe { ll::attrset(a) } }
116 
117 
attr_get(attrs: &mut attr_t, pair: &mut i16) -> i32118 pub fn attr_get(attrs: &mut attr_t, pair: &mut i16) -> i32
119 {
120   unsafe
121   {
122     ll::attr_get(&mut* attrs as *mut attr_t,
123                  &mut* pair as *mut i16,
124                  ptr::null())
125   }
126 }
127 
128 
attr_off(a: attr_t) -> i32129 pub fn attr_off(a: attr_t) -> i32
130 { unsafe { ll::attr_off(a, ptr::null()) } }
131 
132 
attr_on(a: attr_t) -> i32133 pub fn attr_on(a: attr_t) -> i32
134 { unsafe { ll::attr_on(a, ptr::null()) } }
135 
136 
attr_set(attr: attr_t, pair: i16) -> i32137 pub fn attr_set(attr: attr_t, pair: i16) -> i32
138 { unsafe { ll::attr_set(attr, pair, ptr::null()) } }
139 
140 
baudrate() -> i32141 pub fn baudrate() -> i32
142 { unsafe { ll::baudrate() } }
143 
144 
beep() -> i32145 pub fn beep() -> i32
146 { unsafe { ll::beep() } }
147 
148 
bkgd(ch: chtype) -> i32149 pub fn bkgd(ch: chtype) -> i32
150 { unsafe { ll::bkgd(ch) } }
151 
152 
bkgdset(ch: chtype)153 pub fn bkgdset(ch: chtype)
154 { unsafe { ll::bkgdset(ch) } }
155 
156 
border(ls: chtype, rs: chtype, ts: chtype, bs: chtype, tl: chtype, tr: chtype, bl: chtype, br: chtype) -> i32157 pub fn border(ls: chtype, rs: chtype, ts: chtype, bs: chtype, tl: chtype, tr: chtype, bl: chtype, br: chtype) -> i32
158 { unsafe { ll::border(ls, rs, ts, bs, tl, tr, bl, br) } }
159 
160 
box_(w: WINDOW, v: chtype, h: chtype) -> i32161 #[link_name="box"] pub fn box_(w: WINDOW, v: chtype, h: chtype) -> i32
162 { wborder(w, v, v, h, h, 0, 0, 0, 0) }
163 
164 
can_change_color() -> bool165 pub fn can_change_color() -> bool
166 { unsafe { ll::can_change_color() == TRUE } }
167 
168 
cbreak() -> i32169 pub fn cbreak() -> i32
170 { unsafe { ll::cbreak() } }
171 
172 
chgat(n: i32, attr: attr_t, color: i16) -> i32173 pub fn chgat(n: i32, attr: attr_t, color: i16) -> i32
174 { unsafe { ll::chgat(n, attr, color, ptr::null()) } }
175 
176 
clear() -> i32177 pub fn clear() -> i32
178 { unsafe { ll::clear() } }
179 
180 
clearok(w: WINDOW, ok: bool) -> i32181 pub fn clearok(w: WINDOW, ok: bool) -> i32
182 { unsafe { ll::clearok(w, ok as ll::c_bool) } }
183 
184 
clrtobot() -> i32185 pub fn clrtobot() -> i32
186 { unsafe { ll::clrtobot() } }
187 
188 
clrtoeol() -> i32189 pub fn clrtoeol() -> i32
190 { unsafe { ll::clrtoeol() } }
191 
192 
color_content(color: i16, r: &mut i16, g: &mut i16, b: &mut i16) -> i32193 pub fn color_content(color: i16, r: &mut i16, g: &mut i16, b: &mut i16) -> i32
194 {
195   unsafe
196   {
197     ll::color_content(color,
198                       &mut*r as *mut i16,
199                       &mut*g as *mut i16,
200                       &mut*b as *mut i16)
201   }
202 }
203 
204 
color_set(pair: i16) -> i32205 pub fn color_set(pair: i16) -> i32
206 { unsafe { ll::color_set(pair, ptr::null()) } }
207 
208 
copywin(src_win: WINDOW, dest_win: WINDOW, src_min_row: i32, src_min_col: i32, dest_min_row: i32, dest_min_col: i32, dest_max_row: i32, dest_max_col: i32, overlay: i32) -> i32209 pub fn copywin(src_win: WINDOW, dest_win: WINDOW, src_min_row: i32,
210                src_min_col: i32, dest_min_row: i32, dest_min_col: i32,
211                dest_max_row: i32, dest_max_col: i32, overlay: i32) -> i32
212 {
213   unsafe
214   {
215     ll::copywin(src_win, dest_win, src_min_row, src_min_col,
216                 dest_min_row, dest_min_col, dest_max_row,
217                 dest_max_col, overlay)
218   }
219 }
220 
221 
curs_set(visibility: CURSOR_VISIBILITY) -> Option<CURSOR_VISIBILITY>222 pub fn curs_set(visibility: CURSOR_VISIBILITY) -> Option<CURSOR_VISIBILITY>
223 {
224   unsafe
225   {
226     match ll::curs_set(visibility as i32)
227     {
228       ERR => None,
229       ret => Some(mem::transmute::<i8, CURSOR_VISIBILITY>(ret as i8)),
230     }
231   }
232 }
233 
234 
def_prog_mode() -> i32235 pub fn def_prog_mode() -> i32
236 { unsafe { ll::def_prog_mode() } }
237 
238 
def_shell_mode() -> i32239 pub fn def_shell_mode() -> i32
240 { unsafe { ll::def_shell_mode() } }
241 
242 
delay_output(ms: i32) -> i32243 pub fn delay_output(ms: i32) -> i32
244 { unsafe { ll::delay_output(ms) } }
245 
246 
delch() -> i32247 pub fn delch() -> i32
248 { unsafe { ll::delch() } }
249 
250 
delscreen(s: SCREEN)251 pub fn delscreen(s: SCREEN)
252 { unsafe { ll::delscreen(s) } }
253 
254 
delwin(w: WINDOW) -> i32255 pub fn delwin(w: WINDOW) -> i32
256 { unsafe { ll::delwin(w) } }
257 
258 
deleteln() -> i32259 pub fn deleteln() -> i32
260 { unsafe { ll::deleteln() } }
261 
262 
derwin(w: WINDOW, lines: i32, cols: i32, x: i32, y: i32) -> WINDOW263 pub fn derwin(w: WINDOW, lines: i32, cols: i32, x: i32, y: i32) -> WINDOW
264 { unsafe { ll::derwin(w, lines, cols, x, y) } }
265 
266 
doupdate() -> i32267 pub fn doupdate() -> i32
268 { unsafe { ll::doupdate() } }
269 
270 
dupwin(w: WINDOW) -> WINDOW271 pub fn dupwin(w: WINDOW) -> WINDOW
272 { unsafe { ll::dupwin(w) } }
273 
274 
echo() -> i32275 pub fn echo() -> i32
276 { unsafe { ll::echo() } }
277 
278 
echochar(c: chtype) -> i32279 pub fn echochar(c: chtype) -> i32
280 { unsafe { ll::echochar(c) } }
281 
282 
erase() -> i32283 pub fn erase() -> i32
284 { unsafe { ll::erase() } }
285 
286 
endwin() -> i32287 pub fn endwin() -> i32
288 { unsafe { ll::endwin() } }
289 
290 
erasechar() -> char291 pub fn erasechar() -> char
292 { unsafe { char::from_u32(ll::erasechar() as u32).expect("Invalid char") } }
293 
294 
filter()295 pub fn filter()
296 { unsafe { ll::filter() } }
297 
298 
flash() -> i32299 pub fn flash() -> i32
300 { unsafe { ll::flash() } }
301 
302 
flushinp() -> i32303 pub fn flushinp() -> i32
304 { unsafe { ll::flushinp() } }
305 
306 
getbkgd(w: WINDOW) -> chtype307 pub fn getbkgd(w: WINDOW) -> chtype
308 { unsafe { ll::getbkgd(w) } }
309 
310 
getch() -> i32311 pub fn getch() -> i32
312 { unsafe { ll::getch() } }
313 
314 #[derive(Debug)]
315 pub enum WchResult {
316     KeyCode(i32),
317     Char(winttype),
318 }
319 
get_wch() -> Option<WchResult>320 pub fn get_wch() -> Option<WchResult> {
321     unsafe {
322         let mut x = 0;
323         match ll::get_wch(&mut x) {
324             OK => {
325                 Some(WchResult::Char(x))
326             }
327             KEY_CODE_YES => {
328                 Some(WchResult::KeyCode(x as i32))
329             }
330             _ => {
331                 None
332             }
333         }
334     }
335 }
336 
mvget_wch(y: i32, x: i32) -> Option<WchResult>337 pub fn mvget_wch(y: i32, x: i32) -> Option<WchResult> {
338     unsafe {
339         let mut result = 0;
340         match ll::mvget_wch(y, x, &mut result) {
341             OK => {
342                 Some(WchResult::Char(result))
343             }
344             KEY_CODE_YES => {
345                 Some(WchResult::KeyCode(result as i32))
346             }
347             _ => {
348                 None
349             }
350         }
351     }
352 }
353 
354 #[cfg(feature = "wide")]
wget_wch(w: WINDOW) -> Option<WchResult>355 pub fn wget_wch(w: WINDOW) -> Option<WchResult> {
356     unsafe {
357         let mut result = 0;
358         match ll::wget_wch(w, &mut result) {
359             OK => {
360                 Some(WchResult::Char(result))
361             }
362             KEY_CODE_YES => {
363                 Some(WchResult::KeyCode(result as i32))
364             }
365             _ => {
366                 None
367             }
368         }
369     }
370 }
371 
372 #[cfg(feature = "wide")]
mvwget_wch(w: WINDOW, y: i32, x: i32) -> Option<WchResult>373 pub fn mvwget_wch(w: WINDOW, y: i32, x: i32) -> Option<WchResult> {
374     unsafe {
375         let mut result = 0;
376         match ll::mvwget_wch(w, y, x, &mut result) {
377             OK => {
378                 Some(WchResult::Char(result))
379             }
380             KEY_CODE_YES => {
381                 Some(WchResult::KeyCode(result as i32))
382             }
383             _ => {
384                 None
385             }
386         }
387     }
388 }
389 
unget_wch(ch: u32) -> i32390 pub fn unget_wch(ch: u32) -> i32 {
391     unsafe {
392         ll::unget_wch(ch)
393     }
394 }
395 
396 
getnstr(s: &mut String, n: i32) -> i32397 pub fn getnstr(s: &mut String, n: i32) -> i32
398 { wgetnstr(stdscr(), s, n) }
399 
400 
getstr(s: &mut String) -> i32401 pub fn getstr(s: &mut String) -> i32
402 {
403   /* XXX: This is probably broken. */
404   let mut ch = getch();
405   while ch != '\n' as i32 && ch != '\r' as i32
406   {
407     unsafe { s.as_mut_vec().push(ch as u8); }
408     ch = getch();
409   }
410   OK
411 }
412 
413 
getwin(reader: *mut libc::FILE) -> WINDOW414 pub fn getwin(reader: *mut libc::FILE) -> WINDOW
415 { unsafe { ll::getwin(reader) } } /* TODO: Make this safe. */
416 
417 
getattrs(w: WINDOW) -> i32418 pub fn getattrs(w: WINDOW) -> i32
419 { unsafe { ll::getattrs(w) } }
420 
421 
getcurx(w: WINDOW) -> i32422 pub fn getcurx(w: WINDOW) -> i32
423 { unsafe { ll::getcurx(w) } }
424 
425 
getcury(w: WINDOW) -> i32426 pub fn getcury(w: WINDOW) -> i32
427 { unsafe { ll::getcury(w) } }
428 
429 
getbegx(w: WINDOW) -> i32430 pub fn getbegx(w: WINDOW) -> i32
431 { unsafe { ll::getbegx(w) } }
432 
433 
getbegy(w: WINDOW) -> i32434 pub fn getbegy(w: WINDOW) -> i32
435 { unsafe { ll::getbegy(w) } }
436 
437 
getmaxx(w: WINDOW) -> i32438 pub fn getmaxx(w: WINDOW) -> i32
439 { unsafe { ll::getmaxx(w) } }
440 
441 
getmaxy(w: WINDOW) -> i32442 pub fn getmaxy(w: WINDOW) -> i32
443 { unsafe { ll::getmaxy(w) } }
444 
445 
getparx(w: WINDOW) -> i32446 pub fn getparx(w: WINDOW) -> i32
447 { unsafe { ll::getparx(w) } }
448 
449 
getpary(w: WINDOW) -> i32450 pub fn getpary(w: WINDOW) -> i32
451 { unsafe { ll::getpary(w) } }
452 
453 
halfdelay(tenths: i32) -> i32454 pub fn halfdelay(tenths: i32) -> i32
455 { unsafe { ll::halfdelay(tenths) } }
456 
457 
has_colors() -> bool458 pub fn has_colors() -> bool
459 { unsafe { ll::has_colors() == TRUE } }
460 
461 
has_ic() -> bool462 pub fn has_ic() -> bool
463 { unsafe { ll::has_ic() == TRUE } }
464 
465 
has_il() -> bool466 pub fn has_il() -> bool
467 { unsafe { ll::has_il() == TRUE } }
468 
469 
hline(ch: chtype, n: i32) -> i32470 pub fn hline(ch: chtype, n: i32) -> i32
471 { unsafe { ll::hline(ch, n) } }
472 
473 
idcok(w: WINDOW, bf: bool)474 pub fn idcok(w: WINDOW, bf: bool)
475 { unsafe { ll::idcok(w, bf as ll::c_bool) } }
476 
477 
idlok(w: WINDOW, bf: bool) -> i32478 pub fn idlok(w: WINDOW, bf: bool) -> i32
479 { unsafe { ll::idlok(w, bf as ll::c_bool) } }
480 
481 
immedok(w: WINDOW, bf: bool)482 pub fn immedok(w: WINDOW, bf: bool)
483 { unsafe { ll::immedok(w, bf as ll::c_bool) } }
484 
485 
inch() -> chtype486 pub fn inch() -> chtype
487 { unsafe { ll::inch() } }
488 
489 
inchnstr(s: &mut Vec<chtype>, n: i32) -> i32490 pub fn inchnstr(s: &mut Vec<chtype>, n: i32) -> i32
491 {
492   /* XXX: This is probably broken. */
493   s.clear();
494   s.reserve(n as usize);
495   unsafe
496   {
497     let ret = ll::inchnstr(s.as_ptr(), n);
498 
499     let capacity = s.capacity();
500     match s.iter().position(|x| *x == 0)
501     {
502       Some(index) => s.set_len(index as usize),
503       None => s.set_len(capacity),
504     }
505 
506     ret
507   }
508 }
509 
510 
inchstr(s: &mut Vec<chtype>) -> i32511 pub fn inchstr(s: &mut Vec<chtype>) -> i32
512 {
513   /* XXX: This is probably broken. */
514   unsafe
515   {
516     let ret = ll::inchstr(s.as_ptr());
517 
518     let capacity = s.capacity();
519     match s.iter().position(|x| *x == 0)
520     {
521       Some(index) => s.set_len(index as usize),
522       None => s.set_len(capacity),
523     }
524 
525     ret
526   }
527 }
528 
529 
initscr() -> WINDOW530 pub fn initscr() -> WINDOW
531 { unsafe { ll::initscr() } }
532 
533 
init_color(color: i16, r: i16, g: i16, b: i16) -> i32534 pub fn init_color(color: i16, r: i16, g: i16, b: i16) -> i32
535 { unsafe { ll::init_color(color, r, g, b) } }
536 
537 
init_pair(pair: i16, f: i16, b: i16) -> i32538 pub fn init_pair(pair: i16, f: i16, b: i16) -> i32
539 { unsafe { ll::init_pair(pair, f, b) } }
540 
541 
innstr(s: &mut String, n: i32) -> i32542 pub fn innstr(s: &mut String, n: i32) -> i32
543 {
544   /* XXX: This is probably broken. */
545   unsafe
546   {
547     s.as_mut_vec().clear();
548     s.reserve(n as usize);
549     let buf = s.as_bytes().as_ptr();
550     let ret = ll::innstr(mem::transmute(buf), n);
551 
552     let capacity = s.capacity();
553     match s.find('\0')
554     {
555       Some(index) => s.as_mut_vec().set_len(index as usize),
556       None => s.as_mut_vec().set_len(capacity),
557     }
558 
559     ret
560   }
561 }
562 
563 
insch(ch: chtype) -> i32564 pub fn insch(ch: chtype) -> i32
565 { unsafe { ll::insch(ch) } }
566 
567 
insdelln(n: i32) -> i32568 pub fn insdelln(n: i32) -> i32
569 { unsafe { ll::insdelln(n) } }
570 
571 
insertln() -> i32572 pub fn insertln() -> i32
573 { unsafe { ll::insertln() } }
574 
575 
insnstr(s: &str, n: i32) -> i32576 pub fn insnstr(s: &str, n: i32) -> i32
577 {
578   unsafe
579   {
580     let buf = s.as_ptr();
581     ll::insnstr(mem::transmute(buf), n)
582   }
583 }
584 
585 
insstr(s: &str) -> i32586 pub fn insstr(s: &str) -> i32
587 {
588   unsafe
589   {
590     let buf = s.as_ptr();
591     ll::insstr(mem::transmute(buf))
592   }
593 }
594 
595 
instr(s: &mut String) -> i32596 pub fn instr(s: &mut String) -> i32
597 {
598   /* XXX: This is probably broken. */
599   unsafe
600   {
601     let buf = s.as_bytes().as_ptr();
602     let ret = ll::instr(mem::transmute(buf));
603 
604     let capacity = s.capacity();
605     match s.find('\0')
606     {
607       Some(index) => s.as_mut_vec().set_len(index as usize),
608       None => s.as_mut_vec().set_len(capacity),
609     }
610 
611     ret
612   }
613 }
614 
615 
intrflush(w: WINDOW, bf: bool) -> i32616 pub fn intrflush(w: WINDOW, bf: bool) -> i32
617 { unsafe { ll::intrflush(w, bf as ll::c_bool) } }
618 
619 
isendwin() -> bool620 pub fn isendwin() -> bool
621 { unsafe { ll::isendwin() == TRUE } }
622 
623 
is_linetouched(w: WINDOW, l: i32) -> bool624 pub fn is_linetouched(w: WINDOW, l: i32) -> bool
625 { unsafe { ll::is_linetouched(w, l) == TRUE } }
626 
627 
is_wintouched(w: WINDOW) -> bool628 pub fn is_wintouched(w: WINDOW) -> bool
629 { unsafe { ll::is_wintouched(w) == TRUE } }
630 
631 
is_term_resized(lines: i32, cols: i32) -> bool632 pub fn is_term_resized(lines: i32, cols: i32) -> bool
633 { unsafe { ll::is_term_resized(lines, cols) == TRUE } }
634 
635 
is_cleared(w: WINDOW) -> bool636 pub fn is_cleared(w: WINDOW) -> bool
637 { unsafe { ll::is_cleared(w) == TRUE } }
638 
639 
is_idcok(w: WINDOW) -> bool640 pub fn is_idcok(w: WINDOW) -> bool
641 { unsafe { ll::is_idcok(w) == TRUE } }
642 
643 
is_idlok(w: WINDOW) -> bool644 pub fn is_idlok(w: WINDOW) -> bool
645 { unsafe { ll::is_idlok(w) == TRUE } }
646 
647 
is_immedok(w: WINDOW) -> bool648 pub fn is_immedok(w: WINDOW) -> bool
649 { unsafe { ll::is_immedok(w) == TRUE } }
650 
651 
is_keypad(w: WINDOW) -> bool652 pub fn is_keypad(w: WINDOW) -> bool
653 { unsafe { ll::is_keypad(w) == TRUE } }
654 
655 
is_leaveok(w: WINDOW) -> bool656 pub fn is_leaveok(w: WINDOW) -> bool
657 { unsafe { ll::is_leaveok(w) == TRUE } }
658 
659 
is_nodelay(w: WINDOW) -> bool660 pub fn is_nodelay(w: WINDOW) -> bool
661 { unsafe { ll::is_nodelay(w) == TRUE } }
662 
663 
is_notimeout(w: WINDOW) -> bool664 pub fn is_notimeout(w: WINDOW) -> bool
665 { unsafe { ll::is_notimeout(w) == TRUE } }
666 
667 
is_scrollok(w: WINDOW) -> bool668 pub fn is_scrollok(w: WINDOW) -> bool
669 { unsafe { ll::is_scrollok(w) == TRUE } }
670 
671 
is_syncok(w: WINDOW) -> bool672 pub fn is_syncok(w: WINDOW) -> bool
673 { unsafe { ll::is_syncok(w) == TRUE }}
674 
675 
keyname(c: i32) -> Option<String>676 pub fn keyname(c: i32) -> Option<String>
677 { unsafe { FromCStr::from_c_str(ll::keyname(c)) } }
678 
679 
keypad(w: WINDOW, bf: bool) -> i32680 pub fn keypad(w: WINDOW, bf: bool) -> i32
681 { unsafe { ll::keypad(w, bf as ll::c_bool) } }
682 
683 
killchar() -> char684 pub fn killchar() -> char
685 { unsafe { char::from_u32(ll::killchar() as u32).expect("Invalid char") } }
686 
687 
leaveok(w: WINDOW, bf: bool) -> i32688 pub fn leaveok(w: WINDOW, bf: bool) -> i32
689 { unsafe { ll::leaveok(w, bf as ll::c_bool) } }
690 
691 
longname() -> String692 pub fn longname() -> String
693 { unsafe { FromCStr::from_c_str(ll::longname()) } }
694 
695 
meta(w: WINDOW, bf: bool) -> i32696 pub fn meta(w: WINDOW, bf: bool) -> i32
697 { unsafe { ll::meta(w, bf as ll::c_bool) } }
698 
699 
mv(y: i32, x: i32) -> i32700 pub fn mv(y: i32, x: i32) -> i32
701 { unsafe { ll::mv(y, x) } }
702 
703 
mvaddch(y: i32, x: i32, c: chtype) -> i32704 pub fn mvaddch(y: i32, x: i32, c: chtype) -> i32
705 { unsafe { ll::mvaddch(y, x, c) } }
706 
707 
mvaddchnstr(y: i32, x: i32, s: &[chtype], n: i32) -> i32708 pub fn mvaddchnstr(y: i32, x: i32, s: &[chtype], n: i32) -> i32
709 {
710   if mv(y, x) == ERR
711   { return ERR; }
712   addchnstr(s, n)
713 }
714 
715 
mvaddchstr(y: i32, x: i32, s: &[chtype]) -> i32716 pub fn mvaddchstr(y: i32, x: i32, s: &[chtype]) -> i32
717 {
718   if mv(y, x) == ERR
719   { return ERR; }
720   addchstr(s)
721 }
722 
723 
mvaddnstr(y: i32, x: i32, s: &str, n: i32) -> i32724 pub fn mvaddnstr(y: i32, x: i32, s: &str, n: i32) -> i32
725 {
726   if mv(y, x) == ERR
727   { return ERR; }
728   addnstr(s, n)
729 }
730 
731 
mvaddstr(y: i32, x: i32, s: &str) -> i32732 pub fn mvaddstr(y: i32, x: i32, s: &str) -> i32
733 {
734   if mv(y, x) == ERR
735   { return ERR; }
736   addstr(s)
737 }
738 
739 
mvchgat(y: i32, x: i32, n: i32, attr: attr_t, color: i16) -> i32740 pub fn mvchgat(y: i32, x: i32, n: i32, attr: attr_t, color: i16) -> i32
741 { unsafe { ll::mvchgat(y, x, n, attr, color, ptr::null()) } }
742 
743 
mvcur(old_y: i32, old_x: i32, new_y: i32, new_x: i32) -> i32744 pub fn mvcur(old_y: i32, old_x: i32, new_y: i32, new_x: i32) -> i32
745 { unsafe { ll::mvcur(old_y, old_x, new_y, new_x) } }
746 
747 
mvdelch(y: i32, x: i32) -> i32748 pub fn mvdelch(y: i32, x: i32) -> i32
749 { unsafe { ll::mvdelch(y, x) } }
750 
751 
mvderwin(w: WINDOW, y: i32, x: i32) -> i32752 pub fn mvderwin(w: WINDOW, y: i32, x: i32) -> i32
753 { unsafe { ll::mvderwin(w, y, x) } }
754 
755 
mvgetch(y: i32, x: i32) -> i32756 pub fn mvgetch(y: i32, x: i32) -> i32
757 { unsafe { ll::mvgetch(y, x) } }
758 
759 
mvgetnstr(y: i32, x: i32, s: &mut String, n: i32) -> i32760 pub fn mvgetnstr(y: i32, x: i32, s: &mut String, n: i32) -> i32
761 {
762   match mv(y, x)
763   {
764     OK => getnstr(s, n),
765     _ => ERR,
766   }
767 }
768 
769 
mvgetstr(y: i32, x: i32, s: &mut String) -> i32770 pub fn mvgetstr(y: i32, x: i32, s: &mut String) -> i32
771 {
772   if mv(y, x) == ERR
773   { return ERR; }
774   getstr(s)
775 }
776 
777 
mvhline(y: i32, x: i32, ch: chtype, n: i32) -> i32778 pub fn mvhline(y: i32, x: i32, ch: chtype, n: i32) -> i32
779 { unsafe { ll::mvhline(y, x, ch, n) } }
780 
781 
mvinch(y: i32, x: i32) -> chtype782 pub fn mvinch(y: i32, x: i32) -> chtype
783 { unsafe { ll::mvinch(y, x) } }
784 
785 
mvinchnstr(y: i32, x: i32, s: &mut Vec<chtype>, n: i32) -> i32786 pub fn mvinchnstr(y: i32, x: i32, s: &mut Vec<chtype>, n: i32) -> i32
787 {
788   if mv(y, x) == ERR
789   { return ERR; }
790   inchnstr(s, n)
791 }
792 
793 
mvinchstr(y: i32, x: i32, s: &mut Vec<chtype>) -> i32794 pub fn mvinchstr(y: i32, x: i32, s: &mut Vec<chtype>) -> i32
795 {
796   if mv(y, x) == ERR
797   { return ERR; }
798   inchstr(s)
799 }
800 
801 
mvinnstr(y: i32, x: i32, s: &mut String, n: i32) -> i32802 pub fn mvinnstr(y: i32, x: i32, s: &mut String, n: i32) -> i32
803 {
804   if mv(y, x) == ERR
805   { return ERR; }
806   innstr(s, n)
807 }
808 
809 
mvinsch(y: i32, x: i32, ch: chtype) -> i32810 pub fn mvinsch(y: i32, x: i32, ch: chtype) -> i32
811 { unsafe { ll::mvinsch(y, x, ch) } }
812 
813 
mvinsnstr(y: i32, x: i32, s: &str, n: i32) -> i32814 pub fn mvinsnstr(y: i32, x: i32, s: &str, n: i32) -> i32
815 {
816   if mv(y, x) == ERR
817   { return ERR; }
818   insnstr(s, n)
819 }
820 
821 
mvinsstr(y: i32, x: i32, s: &str) -> i32822 pub fn mvinsstr(y: i32, x: i32, s: &str) -> i32
823 {
824   if mv(y, x) == ERR
825   { return ERR; }
826   insstr(s)
827 }
828 
829 
mvinstr(y: i32, x: i32, s: &mut String) -> i32830 pub fn mvinstr(y: i32, x: i32, s: &mut String) -> i32
831 {
832   if mv(y, x) == ERR
833   { return ERR; }
834   instr(s)
835 }
836 
837 
mvprintw(y: i32, x: i32, s: &str) -> i32838 pub fn mvprintw(y: i32, x: i32, s: &str) -> i32
839 {
840   if mv(y, x) == ERR
841   { return ERR; }
842   printw(s)
843 }
844 
845 
mvvline(y: i32, x: i32, ch: chtype, n: i32) -> i32846 pub fn mvvline(y: i32, x: i32, ch: chtype, n: i32) -> i32
847 { unsafe { ll::mvvline(y, x, ch, n) } }
848 
849 
mvwaddch(w: WINDOW, y: i32, x: i32, ch: chtype) -> i32850 pub fn mvwaddch(w: WINDOW, y: i32, x: i32, ch: chtype) -> i32
851 { unsafe { ll::mvwaddch(w, y, x, ch) } }
852 
853 
mvwaddchnstr(w: WINDOW, y: i32, x: i32, s: &[chtype], n: i32) -> i32854 pub fn mvwaddchnstr(w: WINDOW, y: i32, x: i32, s: &[chtype], n: i32) -> i32
855 { unsafe { ll::mvwaddchnstr(w, y, x, s.as_ptr(), n) } }
856 
857 
mvwaddchstr(w: WINDOW, y: i32, x: i32, s: &[chtype]) -> i32858 pub fn mvwaddchstr(w: WINDOW, y: i32, x: i32, s: &[chtype]) -> i32
859 { unsafe { ll::mvwaddchstr(w, y, x, s.as_ptr()) } }
860 
861 
mvwaddnstr(w: WINDOW, y: i32, x: i32, s: &str, n: i32) -> i32862 pub fn mvwaddnstr(w: WINDOW, y: i32, x: i32, s: &str, n: i32) -> i32
863 { unsafe { ll::mvwaddnstr(w, y, x, s.to_c_str().as_ptr(), n) } }
864 
865 
mvwaddstr(w: WINDOW, y: i32, x: i32, s: &str) -> i32866 pub fn mvwaddstr(w: WINDOW, y: i32, x: i32, s: &str) -> i32
867 { unsafe { ll::mvwaddstr(w, y, x, s.to_c_str().as_ptr()) } }
868 
869 
mvwchgat(w: WINDOW, y: i32, x: i32, n: i32, attr: attr_t, color: i16) -> i32870 pub fn mvwchgat(w: WINDOW, y: i32, x: i32, n: i32, attr: attr_t, color: i16) -> i32
871 { unsafe { ll::mvwchgat(w, y, x, n, attr, color, ptr::null()) } }
872 
873 
mvwdelch(w: WINDOW, y: i32, x: i32) -> i32874 pub fn mvwdelch(w: WINDOW, y: i32, x: i32) -> i32
875 { unsafe { ll::mvwdelch(w, y, x) } }
876 
877 
mvwgetch(w: WINDOW, y: i32, x: i32) -> i32878 pub fn mvwgetch(w: WINDOW, y: i32, x: i32) -> i32
879 { unsafe { ll::mvwgetch(w, y, x) } }
880 
881 
mvwgetnstr(w: WINDOW, y: i32, x: i32, s: &mut String, n: i32) -> i32882 pub fn mvwgetnstr(w: WINDOW, y: i32, x: i32, s: &mut String, n: i32) -> i32
883 {
884   match wmove(w, y, x)
885   {
886     OK => wgetnstr(w, s, n),
887     _ => ERR,
888   }
889 }
890 
891 
mvwgetstr(w: WINDOW, y: i32, x: i32, s: &mut String) -> i32892 pub fn mvwgetstr(w: WINDOW, y: i32, x: i32, s: &mut String) -> i32
893 {
894   if mv(y, x) == ERR
895   { return ERR; }
896 
897   /* XXX: This is probably broken. */
898   let mut ch = wgetch(w);
899   while ch != '\n' as i32 && ch != '\r' as i32
900   {
901     unsafe { s.as_mut_vec().push(ch as u8); }
902     ch = wgetch(w);
903   }
904   OK
905 }
906 
907 
mvwhline(w: WINDOW, y: i32, x: i32, ch: chtype, n: i32) -> i32908 pub fn mvwhline(w: WINDOW, y: i32, x: i32, ch: chtype, n: i32) -> i32
909 { unsafe { ll::mvwhline(w, y, x, ch, n) } }
910 
911 
mvwin(w: WINDOW, y: i32, x: i32) -> i32912 pub fn mvwin(w: WINDOW, y: i32, x: i32) -> i32
913 { unsafe { ll::mvwin(w, y, x) } }
914 
915 
mvwinch(w: WINDOW, y: i32, x: i32) -> chtype916 pub fn mvwinch(w: WINDOW, y: i32, x: i32) -> chtype
917 { unsafe { ll::mvwinch(w, y, x) } }
918 
919 
mvwinchnstr(w: WINDOW, y: i32, x: i32, s: &mut Vec<chtype>, n: i32) -> i32920 pub fn mvwinchnstr(w: WINDOW, y: i32, x: i32, s: &mut Vec<chtype>, n: i32) -> i32
921 {
922   /* XXX: This is probably broken. */
923   s.clear();
924   s.reserve(n as usize);
925   unsafe
926   {
927     let ret = ll::mvwinchnstr(w, y, x, s.as_ptr(), n);
928 
929     let capacity = s.capacity();
930     match s.iter().position(|x| *x == 0)
931     {
932       Some(index) => s.set_len(index as usize),
933       None => s.set_len(capacity),
934     }
935 
936     ret
937   }
938 }
939 
940 
mvwinchstr(w: WINDOW, y: i32, x: i32, s: &mut Vec<chtype>) -> i32941 pub fn mvwinchstr(w: WINDOW, y: i32, x: i32, s: &mut Vec<chtype>) -> i32
942 {
943   /* XXX: This is probably broken. */
944   unsafe
945   {
946     let ret = ll::mvwinchstr(w, y, x, s.as_ptr());
947 
948     let capacity = s.capacity();
949     match s.iter().position(|x| *x == 0)
950     {
951       Some(index) => s.set_len(index as usize),
952       None => s.set_len(capacity),
953     }
954 
955     ret
956   }
957 }
958 
959 
mvwinnstr(w: WINDOW, y: i32, x: i32, s: &mut String, n: i32) -> i32960 pub fn mvwinnstr(w: WINDOW, y: i32, x: i32, s: &mut String, n: i32) -> i32
961 {
962   /* XXX: This is probably broken. */
963   unsafe
964   {
965     s.as_mut_vec().clear();
966     s.reserve(n as usize);
967     let buf = s.as_bytes().as_ptr();
968     let ret = ll::mvwinnstr(w, y, x, mem::transmute(buf), n);
969 
970     let capacity = s.capacity();
971     match s.find('\0')
972     {
973       Some(index) => s.as_mut_vec().set_len(index as usize),
974       None => s.as_mut_vec().set_len(capacity),
975     }
976 
977     ret
978   }
979 }
980 
981 
mvwinsch(w: WINDOW, y: i32, x: i32, ch: chtype) -> i32982 pub fn mvwinsch(w: WINDOW, y: i32, x: i32, ch: chtype) -> i32
983 { unsafe { ll::mvwinsch(w, y, x, ch) } }
984 
985 
mvwinsnstr(w: WINDOW, y: i32, x: i32, s: &str, n: i32) -> i32986 pub fn mvwinsnstr(w: WINDOW, y: i32, x: i32, s: &str, n: i32) -> i32
987 { unsafe { ll::mvwinsnstr(w, y, x, s.to_c_str().as_ptr(), n) } }
988 
989 
mvwinsstr(w: WINDOW, y: i32, x: i32, s: &str) -> i32990 pub fn mvwinsstr(w: WINDOW, y: i32, x: i32, s: &str) -> i32
991 { unsafe { ll::mvwinsstr(w, y, x, s.to_c_str().as_ptr()) } }
992 
993 
mvwinstr(w: WINDOW, y: i32, x: i32, s: &mut String) -> i32994 pub fn mvwinstr(w: WINDOW, y: i32, x: i32, s: &mut String) -> i32
995 {
996   /* XXX: This is probably broken. */
997   unsafe
998   {
999     let buf = s.as_bytes().as_ptr();
1000     let ret = ll::mvwinstr(w, y, x, mem::transmute(buf));
1001 
1002     let capacity = s.capacity();
1003     match s.find('\0')
1004     {
1005       Some(index) => s.as_mut_vec().set_len(index as usize),
1006       None => s.as_mut_vec().set_len(capacity),
1007     }
1008 
1009     ret
1010   }
1011 }
1012 
1013 
mvwprintw(w: WINDOW, y: i32, x: i32, s: &str) -> i321014 pub fn mvwprintw(w: WINDOW, y: i32, x: i32, s: &str) -> i32
1015 { unsafe { ll::mvwprintw(w, y, x, s.to_c_str().as_ptr()) } }
1016 
1017 
mvwvline(w: WINDOW, y: i32, x: i32, ch: chtype, n: i32) -> i321018 pub fn mvwvline(w: WINDOW, y: i32, x: i32, ch: chtype, n: i32) -> i32
1019 { unsafe { ll::mvwvline(w, y, x, ch, n) } }
1020 
1021 
napms(ms: i32) -> i321022 pub fn napms(ms: i32) -> i32
1023 { unsafe { ll::napms(ms) } }
1024 
1025 
newpad(lines: i32, cols: i32) -> WINDOW1026 pub fn newpad(lines: i32, cols: i32) -> WINDOW
1027 { unsafe { ll::newpad(lines, cols) } }
1028 
1029 
newterm(ty: Option<&str>, out_fd: FILE_p, in_fd: FILE_p) -> SCREEN1030 pub fn newterm(ty: Option<&str>, out_fd: FILE_p, in_fd: FILE_p) -> SCREEN
1031 {
1032   unsafe
1033   {
1034     match ty {
1035       Some(s) => ll::newterm(s.to_c_str().as_ptr(), out_fd, in_fd),
1036       None    => ll::newterm(std::ptr::null(), out_fd, in_fd),
1037     }
1038   }
1039 }
1040 
1041 
newwin(lines: i32, cols: i32, y: i32, x: i32) -> WINDOW1042 pub fn newwin(lines: i32, cols: i32, y: i32, x: i32) -> WINDOW
1043 { unsafe { ll::newwin(lines, cols, y, x) } }
1044 
1045 
nl() -> i321046 pub fn nl() -> i32
1047 { unsafe { ll::nl() } }
1048 
1049 
nocbreak() -> i321050 pub fn nocbreak() -> i32
1051 { unsafe { ll::nocbreak() } }
1052 
1053 
nodelay(w: WINDOW, bf: bool) -> i321054 pub fn nodelay(w: WINDOW, bf: bool) -> i32
1055 { unsafe { ll::nodelay(w, bf as ll::c_bool) } }
1056 
1057 
noecho() -> i321058 pub fn noecho() -> i32
1059 { unsafe { ll::noecho() } }
1060 
1061 
nonl() -> i321062 pub fn nonl() -> i32
1063 { unsafe { ll::nonl() } }
1064 
1065 
noqiflush()1066 pub fn noqiflush()
1067 { unsafe { ll::noqiflush() } }
1068 
1069 
noraw() -> i321070 pub fn noraw() -> i32
1071 { unsafe { ll::noraw() } }
1072 
1073 
notimeout(w: WINDOW, bf: bool) -> i321074 pub fn notimeout(w: WINDOW, bf: bool) -> i32
1075 { unsafe { ll::notimeout(w, bf as ll::c_bool) } }
1076 
1077 
overlay(src: WINDOW, dst: WINDOW) -> i321078 pub fn overlay(src: WINDOW, dst: WINDOW) -> i32
1079 { unsafe { ll::overlay(src, dst) } }
1080 
1081 
overwrite(src: WINDOW, dst: WINDOW) -> i321082 pub fn overwrite(src: WINDOW, dst: WINDOW) -> i32
1083 { unsafe { ll::overwrite(src, dst) } }
1084 
1085 
pair_content(pair: i16, f: &mut i16, b: &mut i16) -> i321086 pub fn pair_content(pair: i16, f: &mut i16, b: &mut i16) -> i32
1087 { unsafe { ll::pair_content(pair, &mut*f as *mut i16, &mut*b as *mut i16) } }
1088 
1089 
PAIR_NUMBER(attr: i32) -> i321090 pub fn PAIR_NUMBER(attr: i32) -> i32
1091 { unsafe { ll::PAIR_NUMBER(attr) } }
1092 
1093 
pechochar(pad: WINDOW, ch: chtype) -> i321094 pub fn pechochar(pad: WINDOW, ch: chtype) -> i32
1095 { unsafe { ll::pechochar(pad, ch) } }
1096 
1097 
pnoutrefresh(pad: WINDOW, pmin_row: i32, pmin_col: i32, smin_row: i32, smin_col: i32, smax_row: i32, smax_col: i32) -> i321098 pub fn pnoutrefresh(pad: WINDOW, pmin_row: i32, pmin_col: i32, smin_row: i32, smin_col: i32, smax_row: i32, smax_col: i32) -> i32
1099 { unsafe { ll::pnoutrefresh(pad, pmin_row, pmin_col, smin_row, smin_col, smax_row, smax_col) } }
1100 
1101 
prefresh(pad: WINDOW, pmin_row: i32, pmin_col: i32, smin_row: i32, smin_col: i32, smax_row: i32, smax_col: i32) -> i321102 pub fn prefresh(pad: WINDOW, pmin_row: i32, pmin_col: i32, smin_row: i32, smin_col: i32, smax_row: i32, smax_col: i32) -> i32
1103 { unsafe { ll::prefresh(pad, pmin_row, pmin_col, smin_row, smin_col, smax_row, smax_col) } }
1104 
1105 
printw(s: &str) -> i321106 pub fn printw(s: &str) -> i32
1107 { unsafe { ll::printw(s.to_c_str().as_ptr()) } }
1108 
1109 
putp(s: &str) -> i321110 pub fn putp(s: &str) -> i32
1111 { unsafe { ll::putp(s.to_c_str().as_ptr()) } }
1112 
1113 
putwin(w: WINDOW, f: FILE_p) -> i321114 pub fn putwin(w: WINDOW, f: FILE_p) -> i32
1115 { unsafe { ll::putwin(w, f) } }
1116 
1117 
qiflush()1118 pub fn qiflush()
1119 { unsafe { ll::qiflush() } }
1120 
1121 
raw() -> i321122 pub fn raw() -> i32
1123 { unsafe { ll::raw() } }
1124 
1125 
redrawwin(w: WINDOW) -> i321126 pub fn redrawwin(w: WINDOW) -> i32
1127 { unsafe { ll::redrawwin(w) } }
1128 
1129 
refresh() -> i321130 pub fn refresh() -> i32
1131 { unsafe { ll::refresh() } }
1132 
1133 
resetty() -> i321134 pub fn resetty() -> i32
1135 { unsafe { ll::resetty() } }
1136 
1137 
reset_prog_mode() -> i321138 pub fn reset_prog_mode() -> i32
1139 { unsafe { ll::reset_prog_mode() } }
1140 
1141 
reset_shell_mode() -> i321142 pub fn reset_shell_mode() -> i32
1143 { unsafe { ll::reset_shell_mode() } }
1144 
1145 
resizeterm(lines: i32, cols: i32) -> i321146 pub fn resizeterm(lines: i32, cols: i32) -> i32
1147 { unsafe { ll::resizeterm(lines, cols) } }
1148 
1149 
resize_term(lines: i32, cols: i32) -> i321150 pub fn resize_term(lines: i32, cols: i32) -> i32
1151 { unsafe { ll::resize_term(lines, cols) } }
1152 
1153 
savetty() -> i321154 pub fn savetty() -> i32
1155 { unsafe { ll::savetty() } }
1156 
1157 
scr_dump(filename: &str) -> i321158 pub fn scr_dump(filename: &str) -> i32
1159 { unsafe { ll::scr_dump(filename.to_c_str().as_ptr()) } }
1160 
1161 
scr_init(filename: &str) -> i321162 pub fn scr_init(filename: &str) -> i32
1163 { unsafe { ll::scr_init(filename.to_c_str().as_ptr()) } }
1164 
1165 
scrl(n: i32) -> i321166 pub fn scrl(n: i32) -> i32
1167 { unsafe { ll::scrl(n) } }
1168 
1169 
scroll(w: WINDOW) -> i321170 pub fn scroll(w: WINDOW) -> i32
1171 { unsafe { ll::scroll(w) } }
1172 
1173 
scrollok(w: WINDOW, bf: bool) -> i321174 pub fn scrollok(w: WINDOW, bf: bool) -> i32
1175 { unsafe { ll::scrollok(w, bf as ll::c_bool) } }
1176 
1177 
scr_restore(filename: &str) -> i321178 pub fn scr_restore(filename: &str) -> i32
1179 { unsafe { ll::scr_restore(filename.to_c_str().as_ptr()) } }
1180 
1181 
scr_set(filename: &str) -> i321182 pub fn scr_set(filename: &str) -> i32
1183 { unsafe { ll::scr_set(filename.to_c_str().as_ptr()) } }
1184 
setlocale(lc: LcCategory, locale: &str) -> String1185 pub fn setlocale(lc: LcCategory, locale: &str) -> String
1186 {
1187   unsafe {
1188     let buf = locale.to_c_str().as_ptr();
1189     let ret = ll::setlocale(lc as libc::c_int, buf);
1190     if ret == ptr::null() {
1191         String::new()
1192     } else {
1193         // The clone is necessary, as the returned pointer
1194         // can change at any time
1195         CStr::from_ptr(ret).to_string_lossy().into_owned()
1196     }
1197   }
1198 }
1199 
setscrreg(top: i32, bot: i32) -> i321200 pub fn setscrreg(top: i32, bot: i32) -> i32
1201 { unsafe { ll::setscrreg(top, bot) } }
1202 
1203 
set_term(s: SCREEN) -> SCREEN1204 pub fn set_term(s: SCREEN) -> SCREEN
1205 { unsafe { ll::set_term(s) } }
1206 
set_escdelay(size: i32) -> i321207 pub fn set_escdelay(size: i32) -> i32
1208 { unsafe { ll::set_escdelay(size) } }
1209 
set_tabsize(size: i32) -> i321210 pub fn set_tabsize(size: i32) -> i32
1211 { unsafe { ll::set_tabsize(size) } }
1212 
slk_attroff(ch: chtype) -> i321213 pub fn slk_attroff(ch: chtype) -> i32
1214 { unsafe { ll::slk_attroff(ch) } }
1215 
1216 //
1217 //pub fn slk_attr_off(ch: attr_t) -> i32
1218 //{ unsafe { ll::slk_attr_off(ch, ptr::null()) } }
1219 
1220 
slk_attron(ch: chtype) -> i321221 pub fn slk_attron(ch: chtype) -> i32
1222 { unsafe { ll::slk_attron(ch) } }
1223 
1224 //
1225 //pub fn slk_attr_on(ch: attr_t) -> i32
1226 //{ unsafe { ll::slk_attr_on(ch, ptr::null()) } }
1227 
1228 
slk_attrset(ch: chtype) -> i321229 pub fn slk_attrset(ch: chtype) -> i32
1230 { unsafe { ll::slk_attrset(ch) } }
1231 
1232 
slk_attr() -> attr_t1233 pub fn slk_attr() -> attr_t
1234 { unsafe { ll::slk_attr() } }
1235 
1236 
slk_attr_set(attrs: attr_t, pair: i16) -> i321237 pub fn slk_attr_set(attrs: attr_t, pair: i16) -> i32
1238 { unsafe { ll::slk_attr_set(attrs, pair, ptr::null()) } }
1239 
1240 
slk_clear() -> i321241 pub fn slk_clear() -> i32
1242 { unsafe { ll::slk_clear() } }
1243 
1244 
slk_color(pair: i16) -> i321245 pub fn slk_color(pair: i16) -> i32
1246 { unsafe { ll::slk_color(pair) } }
1247 
1248 
slk_init(fmt: i32) -> i321249 pub fn slk_init(fmt: i32) -> i32
1250 { unsafe { ll::slk_init(fmt) } }
1251 
1252 
slk_label(n: i32) -> String1253 pub fn slk_label(n: i32) -> String
1254 { unsafe { FromCStr::from_c_str(ll::slk_label(n)) } }
1255 
1256 
slk_noutrefresh() -> i321257 pub fn slk_noutrefresh() -> i32
1258 { unsafe { ll::slk_noutrefresh() } }
1259 
1260 
slk_refresh() -> i321261 pub fn slk_refresh() -> i32
1262 { unsafe { ll::slk_refresh() } }
1263 
1264 
slk_restore() -> i321265 pub fn slk_restore() -> i32
1266 { unsafe { ll::slk_restore() } }
1267 
1268 
slk_set(n: i32, s: &str, fmt: i32) -> i321269 pub fn slk_set(n: i32, s: &str, fmt: i32) -> i32
1270 { unsafe { ll::slk_set(n, s.to_c_str().as_ptr(), fmt) } }
1271 
1272 
slk_touch() -> i321273 pub fn slk_touch() -> i32
1274 { unsafe { ll::slk_touch() }}
1275 
1276 
standout() -> i321277 pub fn standout() -> i32
1278 { unsafe { ll::standout() } }
1279 
1280 
standend() -> i321281 pub fn standend() -> i32
1282 { unsafe { ll::standend() } }
1283 
1284 
start_color() -> i321285 pub fn start_color() -> i32
1286 { unsafe { ll::start_color() } }
1287 
1288 
subpad(w: WINDOW, lines: i32, cols: i32, y: i32, x: i32) -> WINDOW1289 pub fn subpad(w: WINDOW, lines: i32, cols: i32, y: i32, x: i32) -> WINDOW
1290 { unsafe { ll::subpad(w, lines, cols, y, x) } }
1291 
1292 
subwin(w: WINDOW, lines: i32, cols: i32, y: i32, x: i32) -> WINDOW1293 pub fn subwin(w: WINDOW, lines: i32, cols: i32, y: i32, x: i32) -> WINDOW
1294 { unsafe { ll::subwin(w, lines, cols, y, x) } }
1295 
1296 
syncok(w: WINDOW, bf: bool) -> i321297 pub fn syncok(w: WINDOW, bf: bool) -> i32
1298 { unsafe { ll::syncok(w, bf as ll::c_bool) } }
1299 
1300 
termattrs() -> chtype1301 pub fn termattrs() -> chtype
1302 { unsafe { ll::termattrs() } }
1303 
1304 
termname() -> String1305 pub fn termname() -> String
1306 { unsafe { FromCStr::from_c_str(ll::termname()) } }
1307 
1308 
timeout(delay: i32)1309 pub fn timeout(delay: i32)
1310 { unsafe { ll::timeout(delay) } }
1311 
1312 
touchline(w: WINDOW, start: i32, count: i32) -> i321313 pub fn touchline(w: WINDOW, start: i32, count: i32) -> i32
1314 { unsafe { ll::touchline(w, start, count) } }
1315 
1316 
touchwin(w: WINDOW) -> i321317 pub fn touchwin(w: WINDOW) -> i32
1318 { unsafe { ll::touchwin(w) } }
1319 
1320 
typeahead(fd: i32) -> i321321 pub fn typeahead(fd: i32) -> i32
1322 { unsafe { ll::typeahead(fd) } }
1323 
1324 
tigetflag(capname: &str) -> i321325 pub fn tigetflag(capname: &str) -> i32
1326 { unsafe { ll::tigetflag(capname.to_c_str().as_ptr()) } }
1327 
1328 
tigetnum(capname: &str) -> i321329 pub fn tigetnum(capname: &str) -> i32
1330 { unsafe { ll::tigetnum(capname.to_c_str().as_ptr()) } }
1331 
1332 
tigetstr(capname: &str) -> String1333 pub fn tigetstr(capname: &str) -> String
1334 { unsafe { { FromCStr::from_c_str(ll::tigetstr(capname.to_c_str().as_ptr())) } } }
1335 
1336 
tparm(s: &str) -> String1337 pub fn tparm(s: &str) -> String
1338 { unsafe { { FromCStr::from_c_str(ll::tparm(s.to_c_str().as_ptr())) } } }
1339 
1340 
ungetch(ch: i32) -> i321341 pub fn ungetch(ch: i32) -> i32
1342 { unsafe { ll::ungetch(ch) } }
1343 
1344 
untouchwin(w: WINDOW) -> i321345 pub fn untouchwin(w: WINDOW) -> i32
1346 { unsafe { ll::untouchwin(w) } }
1347 
1348 
use_env(f: bool)1349 pub fn use_env(f: bool)
1350 { unsafe { ll::use_env(f as ll::c_bool) } }
1351 
1352 
use_default_colors() -> i321353 pub fn use_default_colors() -> i32
1354 { unsafe { ll::use_default_colors() } }
1355 
1356 
vidattr(attrs: chtype) -> i321357 pub fn vidattr(attrs: chtype) -> i32
1358 { unsafe { ll::vidattr(attrs) } }
1359 
1360 
vline(ch: chtype, n: i32) -> i321361 pub fn vline(ch: chtype, n: i32) -> i32
1362 { unsafe { ll::vline(ch, n) } }
1363 
1364 
waddch(w: WINDOW, ch: chtype) -> i321365 pub fn waddch(w: WINDOW, ch: chtype) -> i32
1366 { unsafe { ll::waddch(w, ch) } }
1367 
1368 
waddchnstr(w: WINDOW, s: &[chtype], n: i32) -> i321369 pub fn waddchnstr(w: WINDOW, s: &[chtype], n: i32) -> i32
1370 { unsafe { ll::waddchnstr(w, s.as_ptr(), n) } }
1371 
1372 
waddchstr(w: WINDOW, s: &[chtype]) -> i321373 pub fn waddchstr(w: WINDOW, s: &[chtype]) -> i32
1374 { unsafe { ll::waddchstr(w, s.as_ptr()) } }
1375 
1376 
waddnstr(w: WINDOW, s: &str, n: i32) -> i321377 pub fn waddnstr(w: WINDOW, s: &str, n: i32) -> i32
1378 { unsafe { ll::waddnstr(w, s.to_c_str().as_ptr(), n) } }
1379 
1380 
waddstr(w: WINDOW, s: &str) -> i321381 pub fn waddstr(w: WINDOW, s: &str) -> i32
1382 { unsafe { ll::waddstr(w, s.to_c_str().as_ptr()) } }
1383 
1384 
wattron(w: WINDOW, attr: NCURSES_ATTR_T) -> i321385 pub fn wattron(w: WINDOW, attr: NCURSES_ATTR_T) -> i32
1386 { unsafe { ll::wattron(w, attr) } }
1387 
1388 
wattroff(w: WINDOW, attr: NCURSES_ATTR_T) -> i321389 pub fn wattroff(w: WINDOW, attr: NCURSES_ATTR_T) -> i32
1390 { unsafe { ll::wattroff(w, attr) } }
1391 
1392 
wattrset(w: WINDOW, attr: NCURSES_ATTR_T) -> i321393 pub fn wattrset(w: WINDOW, attr: NCURSES_ATTR_T) -> i32
1394 { unsafe { ll::wattrset(w, attr) } }
1395 
1396 
wattr_get(w: WINDOW, attrs: &mut attr_t, pair: &mut i16) -> i321397 pub fn wattr_get(w: WINDOW, attrs: &mut attr_t, pair: &mut i16) -> i32
1398 { unsafe { ll::wattr_get(w, &mut*attrs as *mut attr_t, &mut*pair as *mut i16, ptr::null()) } }
1399 
1400 
wattr_on(w: WINDOW, attr: attr_t) -> i321401 pub fn wattr_on(w: WINDOW, attr: attr_t) -> i32
1402 { unsafe { ll::wattr_on(w, attr, ptr::null()) } }
1403 
1404 
wattr_off(w: WINDOW, attr: attr_t) -> i321405 pub fn wattr_off(w: WINDOW, attr: attr_t) -> i32
1406 { unsafe { ll::wattr_off(w, attr, ptr::null()) } }
1407 
1408 
wattr_set(w: WINDOW, attrs: attr_t, pair: i16) -> i321409 pub fn wattr_set(w: WINDOW, attrs: attr_t, pair: i16) -> i32
1410 { unsafe { ll::wattr_set(w, attrs, pair, ptr::null()) } }
1411 
1412 
wbkgd(w: WINDOW, ch: chtype) -> i321413 pub fn wbkgd(w: WINDOW, ch: chtype) -> i32
1414 { unsafe { ll::wbkgd(w, ch) } }
1415 
1416 
wbkgdset(w: WINDOW, ch: chtype)1417 pub fn wbkgdset(w: WINDOW, ch: chtype)
1418 { unsafe { ll::wbkgdset(w, ch) } }
1419 
1420 
wborder(w: WINDOW, ls: chtype, rs: chtype, ts: chtype, bs: chtype, tl: chtype, tr: chtype, bl: chtype, br: chtype) -> i321421 pub fn wborder(w: WINDOW, ls: chtype, rs: chtype, ts: chtype, bs: chtype, tl: chtype, tr: chtype, bl: chtype, br: chtype) -> i32
1422 { unsafe { ll::wborder(w, ls, rs, ts, bs, tl, tr, bl, br) } }
1423 
1424 
wchgat(w: WINDOW, n: i32, attr: attr_t, color: i16) -> i321425 pub fn wchgat(w: WINDOW, n: i32, attr: attr_t, color: i16) -> i32
1426 { unsafe { ll::wchgat(w, n, attr, color, ptr::null()) } }
1427 
1428 
wclear(w: WINDOW) -> i321429 pub fn wclear(w: WINDOW) -> i32
1430 { unsafe { ll::wclear(w) } }
1431 
1432 
wclrtobot(w: WINDOW) -> i321433 pub fn wclrtobot(w: WINDOW) -> i32
1434 { unsafe { ll::wclrtobot(w) } }
1435 
1436 
wclrtoeol(w: WINDOW) -> i321437 pub fn wclrtoeol(w: WINDOW) -> i32
1438 { unsafe { ll::wclrtoeol(w) } }
1439 
1440 
wcolor_set(w: WINDOW, pair: i16) -> i321441 pub fn wcolor_set(w: WINDOW, pair: i16) -> i32
1442 { unsafe { ll::wcolor_set(w, pair, ptr::null()) } }
1443 
1444 
wcursyncup(w: WINDOW)1445 pub fn wcursyncup(w: WINDOW)
1446 { unsafe { ll::wcursyncup(w) } }
1447 
1448 
wdelch(w: WINDOW) -> i321449 pub fn wdelch(w: WINDOW) -> i32
1450 { unsafe { ll::wdelch(w) } }
1451 
1452 
wdeleteln(w: WINDOW) -> i321453 pub fn wdeleteln(w: WINDOW) -> i32
1454 { unsafe { ll::wdeleteln(w) } }
1455 
1456 
wechochar(w: WINDOW, ch: chtype) -> i321457 pub fn wechochar(w: WINDOW, ch: chtype) -> i32
1458 { unsafe { ll::wechochar(w, ch) } }
1459 
1460 
werase(w: WINDOW) -> i321461 pub fn werase(w: WINDOW) -> i32
1462 { unsafe { ll::werase(w) } }
1463 
1464 
wgetch(w: WINDOW) -> i321465 pub fn wgetch(w: WINDOW) -> i32
1466 { unsafe { ll::wgetch(w) } }
1467 
1468 
wgetnstr(w: WINDOW, s: &mut String, n: i32) -> i321469 pub fn wgetnstr(w: WINDOW, s: &mut String, n: i32) -> i32
1470 {
1471   let mut buff: Vec<u8> = Vec::with_capacity(n as usize);
1472   unsafe { buff.set_len(n as usize); }
1473 
1474   match unsafe { ll::wgetnstr(w, buff.as_ptr(), n) }
1475   {
1476     OK => {
1477       *s = buff.iter()
1478         .take_while(|ch| **ch != '\0' as u8 )
1479         .map(|ch| *ch as char )
1480         .collect();
1481 
1482       OK
1483     },
1484 
1485     _ => ERR,
1486   }
1487 }
1488 
1489 
wgetstr(w: WINDOW, s: &mut String) -> i321490 pub fn wgetstr(w: WINDOW, s: &mut String) -> i32
1491 {
1492   /* XXX: This is probably broken. */
1493   let mut ch = wgetch(w);
1494   while ch != '\n' as i32 && ch != '\r' as i32
1495   {
1496     unsafe { s.as_mut_vec().push(ch as u8); }
1497     ch = wgetch(w);
1498   }
1499   OK
1500 }
1501 
1502 
whline(w: WINDOW, ch: chtype, n: i32) -> i321503 pub fn whline(w: WINDOW, ch: chtype, n: i32) -> i32
1504 { unsafe { ll::whline(w, ch, n) } }
1505 
1506 
winch(w: WINDOW) -> chtype1507 pub fn winch(w: WINDOW) -> chtype
1508 { unsafe { ll::winch(w) } }
1509 
1510 
winchnstr(w: WINDOW, s: &mut Vec<chtype>, n: i32) -> i321511 pub fn winchnstr(w: WINDOW, s: &mut Vec<chtype>, n: i32) -> i32
1512 {
1513   /* XXX: This is probably broken. */
1514   s.clear();
1515   s.reserve(n as usize);
1516   unsafe
1517   {
1518     let ret = ll::winchnstr(w, s.as_ptr(), n);
1519 
1520     let capacity = s.capacity();
1521     match s.iter().position(|x| *x == 0)
1522     {
1523       Some(index) => s.set_len(index as usize),
1524       None => s.set_len(capacity),
1525     }
1526 
1527     ret
1528   }
1529 }
1530 
1531 
winchstr(w: WINDOW, s: &mut Vec<chtype>) -> i321532 pub fn winchstr(w: WINDOW, s: &mut Vec<chtype>) -> i32
1533 {
1534   /* XXX: This is probably broken. */
1535   unsafe
1536   {
1537     let ret = ll::winchstr(w, s.as_ptr());
1538 
1539     let capacity = s.capacity();
1540     match s.iter().position(|x| *x == 0)
1541     {
1542       Some(index) => s.set_len(index as usize),
1543       None => s.set_len(capacity),
1544     }
1545 
1546     ret
1547   }
1548 }
1549 
1550 
winnstr(w: WINDOW, s: &mut String, n: i32) -> i321551 pub fn winnstr(w: WINDOW, s: &mut String, n: i32) -> i32
1552 {
1553   /* XXX: This is probably broken. */
1554   unsafe
1555   {
1556     s.as_mut_vec().clear();
1557     s.reserve(n as usize);
1558     let buf = s.as_bytes().as_ptr();
1559     let ret = ll::winnstr(w, mem::transmute(buf), n);
1560 
1561     let capacity = s.capacity();
1562     match s.find('\0')
1563     {
1564       Some(index) => s.as_mut_vec().set_len(index as usize),
1565       None => s.as_mut_vec().set_len(capacity),
1566     }
1567 
1568     ret
1569   }
1570 }
1571 
1572 
winsch(w: WINDOW, ch: chtype) -> i321573 pub fn winsch(w: WINDOW, ch: chtype) -> i32
1574 { unsafe { ll::winsch(w, ch) } }
1575 
1576 
winsdelln(w: WINDOW, n: i32) -> i321577 pub fn winsdelln(w: WINDOW, n: i32) -> i32
1578 { unsafe { ll::winsdelln(w, n) } }
1579 
1580 
winsertln(w: WINDOW) -> i321581 pub fn winsertln(w: WINDOW) -> i32
1582 { unsafe { ll::winsertln(w) } }
1583 
1584 
winsnstr(w: WINDOW, s: &str, n: i32) -> i321585 pub fn winsnstr(w: WINDOW, s: &str, n: i32) -> i32
1586 {
1587   unsafe
1588   {
1589     let buf = s.as_ptr();
1590     ll::winsnstr(w, mem::transmute(buf), n)
1591   }
1592 }
1593 
1594 
winsstr(w: WINDOW, s: &str) -> i321595 pub fn winsstr(w: WINDOW, s: &str) -> i32
1596 {
1597   unsafe
1598   {
1599     let buf = s.as_ptr();
1600     ll::winsstr(w, mem::transmute(buf))
1601   }
1602 }
1603 
1604 
winstr(w: WINDOW, s: &mut String) -> i321605 pub fn winstr(w: WINDOW, s: &mut String) -> i32
1606 {
1607   /* XXX: This is probably broken. */
1608   unsafe
1609   {
1610     let buf = s.as_bytes().as_ptr();
1611     let ret = ll::winstr(w, mem::transmute(buf));
1612 
1613     let capacity = s.capacity();
1614     match s.find('\0')
1615     {
1616       Some(index) => s.as_mut_vec().set_len(index as usize),
1617       None => s.as_mut_vec().set_len(capacity),
1618     }
1619 
1620     ret
1621   }
1622 }
1623 
1624 
wmove(w: WINDOW, y: i32, x: i32) -> i321625 pub fn wmove(w: WINDOW, y: i32, x: i32) -> i32
1626 { unsafe { ll::wmove(w, y, x) } }
1627 
1628 
wnoutrefresh(w: WINDOW) -> i321629 pub fn wnoutrefresh(w: WINDOW) -> i32
1630 { unsafe { ll::wnoutrefresh(w) } }
1631 
1632 
wprintw(w: WINDOW, s: &str) -> i321633 pub fn wprintw(w: WINDOW, s: &str) -> i32
1634 { unsafe { ll::wprintw(w, s.to_c_str().as_ptr()) } }
1635 
1636 
wredrawln(w: WINDOW, start: i32, n: i32) -> i321637 pub fn wredrawln(w: WINDOW, start: i32, n: i32) -> i32
1638 { unsafe { ll::wredrawln(w, start, n) } }
1639 
1640 
wrefresh(w: WINDOW) -> i321641 pub fn wrefresh(w: WINDOW) -> i32
1642 { unsafe { ll::wrefresh(w) } }
1643 
1644 
wresize(w: WINDOW, lines: i32, cols: i32) -> i321645 pub fn wresize(w: WINDOW, lines: i32, cols: i32) -> i32
1646 { unsafe { ll::wresize(w, lines, cols) } }
1647 
1648 
wscrl(w: WINDOW, n: i32) -> i321649 pub fn wscrl(w: WINDOW, n: i32) -> i32
1650 { unsafe { ll::wscrl(w, n) } }
1651 
1652 
wsetscrreg(w: WINDOW, top: i32, bot: i32) -> i321653 pub fn wsetscrreg(w: WINDOW, top: i32, bot: i32) -> i32
1654 { unsafe { ll::wsetscrreg(w, top, bot) } }
1655 
1656 
wstandout(w: WINDOW) -> i321657 pub fn wstandout(w: WINDOW) -> i32
1658 { unsafe { ll::wstandout(w) } }
1659 
1660 
wstandend(w: WINDOW) -> i321661 pub fn wstandend(w: WINDOW) -> i32
1662 { unsafe { ll::wstandend(w) } }
1663 
1664 
wsyncdown(w: WINDOW)1665 pub fn wsyncdown(w: WINDOW)
1666 { unsafe { ll::wsyncdown(w) } }
1667 
1668 
wsyncup(w: WINDOW)1669 pub fn wsyncup(w: WINDOW)
1670 { unsafe { ll::wsyncup(w) } }
1671 
1672 
wtimeout(w: WINDOW, delay: i32)1673 pub fn wtimeout(w: WINDOW, delay: i32)
1674 { unsafe { ll::wtimeout(w, delay) } }
1675 
1676 
wtouchln(w: WINDOW, y: i32, n: i32, changed: i32) -> i321677 pub fn wtouchln(w: WINDOW, y: i32, n: i32, changed: i32) -> i32
1678 { unsafe { ll::wtouchln(w, y, n, changed) } }
1679 
1680 
wvline(w: WINDOW, ch: chtype, n: i32) -> i321681 pub fn wvline(w: WINDOW, ch: chtype, n: i32) -> i32
1682 { unsafe { ll::wvline(w, ch, n) } }
1683 
1684 
wgetparent(w: WINDOW) -> WINDOW1685 pub fn wgetparent(w: WINDOW) -> WINDOW
1686 { unsafe { ll::wgetparent(w) } }
1687 
1688 
wgetscrreg(w: WINDOW, top: &mut i32, bot: &mut i32) -> i321689 pub fn wgetscrreg(w: WINDOW, top: &mut i32, bot: &mut i32) -> i32
1690 { unsafe { ll::wgetscrreg(w, &mut*top as *mut i32, &mut*bot as *mut i32) } }
1691 
1692 /* Attributes */
NCURSES_BITS(mask: u32, shift: u32) -> u321693 pub fn NCURSES_BITS(mask: u32, shift: u32) -> u32
1694 { mask << (shift + NCURSES_ATTR_SHIFT) as usize }
1695 
A_NORMAL() -> attr_t1696 pub fn A_NORMAL() -> attr_t
1697 { (1u32 - 1u32) as attr_t }
1698 
A_ATTRIBUTES() -> attr_t1699 pub fn A_ATTRIBUTES() -> attr_t
1700 { NCURSES_BITS(!(1u32 - 1u32), 0u32) as attr_t }
1701 
A_CHARTEXT() -> attr_t1702 pub fn A_CHARTEXT() -> attr_t
1703 {(NCURSES_BITS(1u32, 0u32) - 1u32) as attr_t }
1704 
A_COLOR() -> attr_t1705 pub fn A_COLOR() -> attr_t
1706 { NCURSES_BITS(((1u32) << 8) - 1u32, 0u32) as attr_t }
1707 
A_STANDOUT() -> attr_t1708 pub fn A_STANDOUT() -> attr_t
1709 { NCURSES_BITS(1u32, 8u32) as attr_t }
1710 
A_UNDERLINE() -> attr_t1711 pub fn A_UNDERLINE() -> attr_t
1712 { NCURSES_BITS(1u32, 9u32) as attr_t }
1713 
A_REVERSE() -> attr_t1714 pub fn A_REVERSE() -> attr_t
1715 { NCURSES_BITS(1u32, 10u32) as attr_t }
1716 
A_BLINK() -> attr_t1717 pub fn A_BLINK() -> attr_t
1718 { NCURSES_BITS(1u32, 11u32) as attr_t }
1719 
A_DIM() -> attr_t1720 pub fn A_DIM() -> attr_t
1721 { NCURSES_BITS(1u32, 12u32) as attr_t }
1722 
A_BOLD() -> attr_t1723 pub fn A_BOLD() -> attr_t
1724 { NCURSES_BITS(1u32, 13u32) as attr_t }
1725 
A_ALTCHARSET() -> attr_t1726 pub fn A_ALTCHARSET() -> attr_t
1727 { NCURSES_BITS(1u32, 14u32) as attr_t }
1728 
A_INVIS() -> attr_t1729 pub fn A_INVIS() -> attr_t
1730 { NCURSES_BITS(1u32, 15u32) as attr_t }
1731 
A_PROTECT() -> attr_t1732 pub fn A_PROTECT() -> attr_t
1733 { NCURSES_BITS(1u32, 16u32) as attr_t }
1734 
A_HORIZONTAL() -> attr_t1735 pub fn A_HORIZONTAL() -> attr_t
1736 { NCURSES_BITS(1u32, 17u32) as attr_t }
1737 
A_LEFT() -> attr_t1738 pub fn A_LEFT() -> attr_t
1739 { NCURSES_BITS(1u32, 18u32) as attr_t }
1740 
A_LOW() -> attr_t1741 pub fn A_LOW() -> attr_t
1742 { NCURSES_BITS(1u32, 19u32) as attr_t }
1743 
A_RIGHT() -> attr_t1744 pub fn A_RIGHT() -> attr_t
1745 { NCURSES_BITS(1u32, 20u32) as attr_t }
1746 
A_TOP() -> attr_t1747 pub fn A_TOP() -> attr_t
1748 { NCURSES_BITS(1u32, 21u32) as attr_t }
1749 
A_VERTICAL() -> attr_t1750 pub fn A_VERTICAL() -> attr_t
1751 { NCURSES_BITS(1u32, 22u32) as attr_t }
1752 
A_ITALIC() -> attr_t1753 pub fn A_ITALIC() -> attr_t
1754 { NCURSES_BITS(1u32, 23u32) as attr_t }
1755 
1756 /* Colors. */
COLOR_PAIR(n: i16) -> attr_t1757 pub fn COLOR_PAIR(n: i16) -> attr_t
1758 { NCURSES_BITS(n as u32, 0u32) as attr_t }
1759 
1760 /*
1761  * Most of the pseudo functions are macros that either provide compatibility
1762  * with older versions of curses, or provide inline functionality to improve
1763  * performance.
1764  */
1765 
getyx(win: WINDOW, y: &mut i32, x: &mut i32)1766 pub fn getyx(win: WINDOW, y: &mut i32, x: &mut i32)
1767 { unsafe { *y = ll::getcury(win); *x = ll::getcurx(win); } }
1768 
1769 
getbegyx(win: WINDOW, y: &mut i32, x: &mut i32)1770 pub fn getbegyx(win: WINDOW, y: &mut i32, x: &mut i32)
1771 { unsafe { *y = ll::getbegy(win); *x = ll::getbegx(win) } }
1772 
1773 
getmaxyx(win: WINDOW, y: &mut i32, x: &mut i32)1774 pub fn getmaxyx(win: WINDOW, y: &mut i32, x: &mut i32)
1775 { unsafe { *y = ll::getmaxy(win); *x = ll::getmaxx(win) } }
1776 
1777 
getparyx(win: WINDOW, y: &mut i32, x: &mut i32)1778 pub fn getparyx(win: WINDOW, y: &mut i32, x: &mut i32)
1779 { unsafe { *y = ll::getpary(win); *x = ll::getparx(win) } }
1780 
1781 
getsyx(y: &mut i32, x: &mut i32)1782 pub fn getsyx(y: &mut i32, x: &mut i32)
1783 {
1784   unsafe
1785   {
1786     if newscr() != ptr::null_mut()
1787     {
1788       if ll::is_leaveok(newscr()) == TRUE
1789       {
1790         *x = -1 as i32;
1791         *y = -1 as i32;
1792       }
1793       else
1794       { getyx(newscr(), y, x); }
1795     }
1796   }
1797 }
1798 
1799 
setsyx(y: &mut i32, x: &mut i32)1800 pub fn setsyx(y: &mut i32, x: &mut i32)
1801 {
1802   unsafe
1803   {
1804     if newscr() !=(0 as WINDOW)
1805     {
1806       if *y == -1 && *x == -1
1807       {
1808         ll::leaveok(newscr(), 1);
1809       }
1810       else
1811       {
1812         ll::leaveok(newscr(), 0);
1813         ll::wmove(newscr(), *y, *x);
1814       }
1815     }
1816   }
1817 }
1818 
1819 /* Line graphics */
NCURSES_ACS(c: char) -> chtype1820 pub fn NCURSES_ACS(c: char) -> chtype {
1821     unsafe { *acs_map().offset((c as libc::c_uchar) as isize) as chtype }
1822 }
1823 
1824 /* VT100 symbols begin here */
ACS_ULCORNER() -> chtype1825 pub fn ACS_ULCORNER() -> chtype
1826 { NCURSES_ACS('l') } /* upper left corner */
1827 
ACS_LLCORNER() -> chtype1828 pub fn ACS_LLCORNER() -> chtype
1829 { NCURSES_ACS('m') } /* lower left corner */
1830 
ACS_URCORNER() -> chtype1831 pub fn ACS_URCORNER() -> chtype
1832 { NCURSES_ACS('k') } /* upper right corner */
1833 
ACS_LRCORNER() -> chtype1834 pub fn ACS_LRCORNER() -> chtype
1835 { NCURSES_ACS('j') } /* lower right corner */
1836 
ACS_LTEE() -> chtype1837 pub fn ACS_LTEE() -> chtype
1838 { NCURSES_ACS('t') } /* tee pointing right */
1839 
ACS_RTEE() -> chtype1840 pub fn ACS_RTEE() -> chtype
1841 { NCURSES_ACS('u') } /* tee pointing left */
1842 
ACS_BTEE() -> chtype1843 pub fn ACS_BTEE() -> chtype
1844 { NCURSES_ACS('v') } /* tee pointing up */
1845 
ACS_TTEE() -> chtype1846 pub fn ACS_TTEE() -> chtype
1847 { NCURSES_ACS('w') } /* tee pointing down */
1848 
ACS_HLINE() -> chtype1849 pub fn ACS_HLINE() -> chtype
1850 { NCURSES_ACS('q') } /* horizontal line */
1851 
ACS_VLINE() -> chtype1852 pub fn ACS_VLINE() -> chtype
1853 { NCURSES_ACS('x') } /* vertical line */
1854 
ACS_PLUS() -> chtype1855 pub fn ACS_PLUS() -> chtype
1856 { NCURSES_ACS('n') } /* large plus or crossover */
1857 
ACS_S1() -> chtype1858 pub fn ACS_S1() -> chtype
1859 { NCURSES_ACS('o') } /* scan line 1 */
1860 
ACS_S9() -> chtype1861 pub fn ACS_S9() -> chtype
1862 { NCURSES_ACS('s') } /* scan line 9 */
1863 
ACS_DIAMOND() -> chtype1864 pub fn ACS_DIAMOND() -> chtype
1865 { NCURSES_ACS('`') } /* diamond */
1866 
ACS_CKBOARD() -> chtype1867 pub fn ACS_CKBOARD() -> chtype
1868 { NCURSES_ACS('a') } /* checker board(stipple) */
1869 
ACS_DEGREE() -> chtype1870 pub fn ACS_DEGREE() -> chtype
1871 { NCURSES_ACS('f') } /* degree symbol */
1872 
ACS_PLMINUS() -> chtype1873 pub fn ACS_PLMINUS() -> chtype
1874 { NCURSES_ACS('g') } /* plus/minus */
1875 
ACS_BULLET() -> chtype1876 pub fn ACS_BULLET() -> chtype
1877 { NCURSES_ACS('~') } /* bullet */
1878 
1879 /* Teletype 5410v1 symbols begin here */
ACS_LARROW() -> chtype1880 pub fn ACS_LARROW() -> chtype
1881 { NCURSES_ACS(',') } /* arrow pointing left */
1882 
ACS_RARROW() -> chtype1883 pub fn ACS_RARROW() -> chtype
1884 { NCURSES_ACS('+') } /* arrow pointing right */
1885 
ACS_DARROW() -> chtype1886 pub fn ACS_DARROW() -> chtype
1887 { NCURSES_ACS('.') } /* arrow pointing down */
1888 
ACS_UARROW() -> chtype1889 pub fn ACS_UARROW() -> chtype
1890 { NCURSES_ACS('-') } /* arrow pointing up */
1891 
ACS_BOARD() -> chtype1892 pub fn ACS_BOARD() -> chtype
1893 { NCURSES_ACS('h') } /* board of squares */
1894 
ACS_LANTERN() -> chtype1895 pub fn ACS_LANTERN() -> chtype
1896 { NCURSES_ACS('i') } /* lantern symbol */
1897 
ACS_BLOCK() -> chtype1898 pub fn ACS_BLOCK() -> chtype
1899 { NCURSES_ACS('0') } /* solid square block */
1900 
1901 /*
1902  * These aren't documented, but a lot of System Vs have them anyway
1903  * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
1904  * The ACS_names may not match AT&T's, our source didn't know them.
1905  */
ACS_S3() -> chtype1906 pub fn ACS_S3() -> chtype
1907 { NCURSES_ACS('p') } /* scan line 3 */
1908 
ACS_S7() -> chtype1909 pub fn ACS_S7() -> chtype
1910 { NCURSES_ACS('r') } /* scan line 7 */
1911 
ACS_LEQUAL() -> chtype1912 pub fn ACS_LEQUAL() -> chtype
1913 { NCURSES_ACS('y') } /* less/equal */
1914 
ACS_GEQUAL() -> chtype1915 pub fn ACS_GEQUAL() -> chtype
1916 { NCURSES_ACS('z') } /* greater/equal */
1917 
ACS_PI() -> chtype1918 pub fn ACS_PI() -> chtype
1919 { NCURSES_ACS('{') } /* Pi */
1920 
ACS_NEQUAL() -> chtype1921 pub fn ACS_NEQUAL() -> chtype
1922 { NCURSES_ACS('|') } /* not equal */
1923 
ACS_STERLING() -> chtype1924 pub fn ACS_STERLING() -> chtype
1925 { NCURSES_ACS('}') } /* UK pound sign */
1926 
1927 /*
1928  * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
1929  * is the right, b is the bottom, and l is the left. t, r, b, and l might
1930  * be B(blank), S(single), D(double), or T(thick). The subset defined
1931  * here only uses B and S.
1932  */
ACS_BSSB() -> chtype1933 pub fn ACS_BSSB() -> chtype
1934 { ACS_ULCORNER() }
1935 
ACS_SSBB() -> chtype1936 pub fn ACS_SSBB() -> chtype
1937 { ACS_LLCORNER() }
1938 
ACS_BBSS() -> chtype1939 pub fn ACS_BBSS() -> chtype
1940 { ACS_URCORNER() }
1941 
ACS_SBBS() -> chtype1942 pub fn ACS_SBBS() -> chtype
1943 { ACS_LRCORNER() }
1944 
ACS_SBSS() -> chtype1945 pub fn ACS_SBSS() -> chtype
1946 { ACS_RTEE() }
1947 
ACS_SSSB() -> chtype1948 pub fn ACS_SSSB() -> chtype
1949 { ACS_LTEE() }
1950 
ACS_SSBS() -> chtype1951 pub fn ACS_SSBS() -> chtype
1952 { ACS_BTEE() }
1953 
ACS_BSSS() -> chtype1954 pub fn ACS_BSSS() -> chtype
1955 { ACS_TTEE() }
1956 
ACS_BSBS() -> chtype1957 pub fn ACS_BSBS() -> chtype
1958 { ACS_HLINE() }
1959 
ACS_SBSB() -> chtype1960 pub fn ACS_SBSB() -> chtype
1961 { ACS_VLINE() }
1962 
ACS_SSSS() -> chtype1963 pub fn ACS_SSSS() -> chtype
1964 { ACS_PLUS() }
1965 
KEY_F(n: u8) -> i321966 pub fn KEY_F(n: u8) -> i32
1967 {
1968   assert!(n < 16);
1969   KEY_F0 + n as i32
1970 }
1971 
1972 /*
1973  * Added mouse support
1974  */
1975 
has_mouse() -> bool1976 pub fn has_mouse() -> bool
1977 { unsafe { ll::has_mouse() == TRUE } }
1978 
getmouse(event: *mut MEVENT) -> i321979 pub fn getmouse(event: *mut MEVENT) -> i32
1980 { unsafe { ll::getmouse(event) } }
1981 
ungetmouse(event: *mut MEVENT) -> i321982 pub fn ungetmouse(event: *mut MEVENT) -> i32
1983 { unsafe { ll::ungetmouse(event) } }
1984 
mouseinterval(n: i32) -> i321985 pub fn mouseinterval(n: i32) -> i32
1986 { unsafe { ll::mouseinterval(n) } }
1987 
mousemask(newmask: mmask_t, oldmask: Option<&mut mmask_t>) -> mmask_t1988 pub fn mousemask(newmask: mmask_t, oldmask: Option<&mut mmask_t>) -> mmask_t
1989 {
1990     if oldmask.is_none() { unsafe { ll::mousemask(newmask, ptr::null_mut()) } }
1991     else { unsafe { ll::mousemask(newmask, oldmask.unwrap()) } }
1992 }
1993 
wenclose(w: WINDOW, y: i32, x: i32) -> bool1994 pub fn wenclose(w: WINDOW, y: i32, x: i32) -> bool
1995 { unsafe { ll::wenclose(w, y as libc::c_int, x as libc::c_int) == TRUE } }
1996 
wmouse_trafo(w: WINDOW, y: &mut[i32], x: &mut[i32], to_screen: bool) -> bool1997 pub fn wmouse_trafo(w: WINDOW, y: &mut[i32], x: &mut[i32], to_screen: bool) -> bool
1998 { unsafe { ll::wmouse_trafo(w, y.as_mut_ptr(), x.as_mut_ptr(), to_screen as ll::c_bool) == TRUE } }
1999 
mouse_trafo(y: &mut[i32], x: &mut[i32], to_screen: bool) -> bool2000 pub fn mouse_trafo(y: &mut[i32], x: &mut[i32], to_screen: bool) -> bool
2001 { unsafe { ll::mouse_trafo(y.as_mut_ptr(), x.as_mut_ptr(), to_screen as ll::c_bool) == TRUE } }
2002 
2003 #[cfg(feature = "extended_colors")]
init_extended_color(color: i32, r: i32, g: i32, b: i32) -> i322004 pub fn init_extended_color(color: i32, r: i32, g: i32, b: i32) -> i32 {
2005     unsafe { ll::init_extended_color(color, r, g, b) }
2006 }
2007 
2008 #[cfg(feature = "extended_colors")]
init_extended_pair(color: i32, f: i32, b: i32) -> i322009 pub fn init_extended_pair(color: i32, f: i32, b: i32) -> i32 {
2010     unsafe { ll::init_extended_pair(color, f, b) }
2011 }
2012 
2013 #[cfg(feature = "extended_colors")]
extended_color_content(color: i32, r: &mut i32, g: &mut i32, b: &mut i32) -> i322014 pub fn extended_color_content(color: i32, r: &mut i32, g: &mut i32, b: &mut i32) -> i32 {
2015     unsafe { ll::extended_color_content(color, r, g, b) }
2016 }
2017 
2018 #[cfg(feature = "extended_colors")]
extended_pair_content(pair: i32, f: &mut i32, b: &mut i32) -> i322019 pub fn extended_pair_content(pair: i32, f: &mut i32, b: &mut i32) -> i32 {
2020     unsafe { ll::extended_pair_content(pair, f, b) }
2021 }
2022