#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FILE { _unused: [u8; 0] }
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
storage: Storage,
}
impl<Storage> __BindgenBitfieldUnit<Storage> {
#[inline]
pub const fn new(storage: Storage) -> Self {
Self { storage }
}
}
impl<Storage> __BindgenBitfieldUnit<Storage>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
fn extract_bit(byte: u8, index: usize) -> bool {
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
byte & mask == mask
}
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = self.storage.as_ref()[byte_index];
Self::extract_bit(byte, index)
}
#[inline]
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
Self::extract_bit(byte, index)
}
#[inline]
fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
if val {
byte | mask
} else {
byte & !mask
}
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = &mut self.storage.as_mut()[byte_index];
*byte = Self::change_bit(*byte, index, val);
}
#[inline]
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
let mut val = 0;
for i in 0..(bit_width as usize) {
if self.get_bit(i + bit_offset) {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
#[inline]
pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
}
}
}
pub const CC_NORM: u32 = 0;
pub const CC_NEWLINE: u32 = 1;
pub const CC_EOF: u32 = 2;
pub const CC_ARGHACK: u32 = 3;
pub const CC_REFRESH: u32 = 4;
pub const CC_CURSOR: u32 = 5;
pub const CC_ERROR: u32 = 6;
pub const CC_FATAL: u32 = 7;
pub const CC_REDISPLAY: u32 = 8;
pub const CC_REFRESH_BEEP: u32 = 9;
pub const EL_PROMPT: u32 = 0;
pub const EL_TERMINAL: u32 = 1;
pub const EL_EDITOR: u32 = 2;
pub const EL_SIGNAL: u32 = 3;
pub const EL_BIND: u32 = 4;
pub const EL_TELLTC: u32 = 5;
pub const EL_SETTC: u32 = 6;
pub const EL_ECHOTC: u32 = 7;
pub const EL_SETTY: u32 = 8;
pub const EL_ADDFN: u32 = 9;
pub const EL_HIST: u32 = 10;
pub const EL_EDITMODE: u32 = 11;
pub const EL_RPROMPT: u32 = 12;
pub const EL_GETCFN: u32 = 13;
pub const EL_CLIENTDATA: u32 = 14;
pub const EL_UNBUFFERED: u32 = 15;
pub const EL_PREP_TERM: u32 = 16;
pub const EL_GETTC: u32 = 17;
pub const EL_GETFP: u32 = 18;
pub const EL_SETFP: u32 = 19;
pub const EL_REFRESH: u32 = 20;
pub const EL_PROMPT_ESC: u32 = 21;
pub const EL_RPROMPT_ESC: u32 = 22;
pub const EL_RESIZE: u32 = 23;
pub const EL_ALIAS_TEXT: u32 = 24;
pub const EL_SAFEREAD: u32 = 25;
pub const H_FUNC: u32 = 0;
pub const H_SETSIZE: u32 = 1;
pub const H_GETSIZE: u32 = 2;
pub const H_FIRST: u32 = 3;
pub const H_LAST: u32 = 4;
pub const H_PREV: u32 = 5;
pub const H_NEXT: u32 = 6;
pub const H_CURR: u32 = 8;
pub const H_SET: u32 = 7;
pub const H_ADD: u32 = 9;
pub const H_ENTER: u32 = 10;
pub const H_APPEND: u32 = 11;
pub const H_END: u32 = 12;
pub const H_NEXT_STR: u32 = 13;
pub const H_PREV_STR: u32 = 14;
pub const H_NEXT_EVENT: u32 = 15;
pub const H_PREV_EVENT: u32 = 16;
pub const H_LOAD: u32 = 17;
pub const H_SAVE: u32 = 18;
pub const H_CLEAR: u32 = 19;
pub const H_SETUNIQUE: u32 = 20;
pub const H_GETUNIQUE: u32 = 21;
pub const H_DEL: u32 = 22;
pub const H_NEXT_EVDATA: u32 = 23;
pub const H_DELDATA: u32 = 24;
pub const H_REPLACE: u32 = 25;
pub const H_SAVE_FP: u32 = 26;
pub const H_NSAVE_FP: u32 = 27;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_marker {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_codecvt {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_wide_data {
_unused: [u8; 0],
}
pub type _IO_lock_t = ::std::os::raw::c_void;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_FILE {
pub _flags: ::std::os::raw::c_int,
pub _IO_read_ptr: *mut ::std::os::raw::c_char,
pub _IO_read_end: *mut ::std::os::raw::c_char,
pub _IO_read_base: *mut ::std::os::raw::c_char,
pub _IO_write_base: *mut ::std::os::raw::c_char,
pub _IO_write_ptr: *mut ::std::os::raw::c_char,
pub _IO_write_end: *mut ::std::os::raw::c_char,
pub _IO_buf_base: *mut ::std::os::raw::c_char,
pub _IO_buf_end: *mut ::std::os::raw::c_char,
pub _IO_save_base: *mut ::std::os::raw::c_char,
pub _IO_backup_base: *mut ::std::os::raw::c_char,
pub _IO_save_end: *mut ::std::os::raw::c_char,
pub _markers: *mut _IO_marker,
pub _chain: *mut _IO_FILE,
pub _fileno: ::std::os::raw::c_int,
pub _bitfield_align_1: [u32; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>,
pub _short_backupbuf: [::std::os::raw::c_char; 1usize],
pub _old_offset: __off_t,
pub _cur_column: ::std::os::raw::c_ushort,
pub _vtable_offset: ::std::os::raw::c_schar,
pub _shortbuf: [::std::os::raw::c_char; 1usize],
pub _lock: *mut _IO_lock_t,
pub _offset: __off64_t,
pub _codecvt: *mut _IO_codecvt,
pub _wide_data: *mut _IO_wide_data,
pub _freeres_list: *mut _IO_FILE,
pub _freeres_buf: *mut ::std::os::raw::c_void,
pub _prevchain: *mut *mut _IO_FILE,
pub _mode: ::std::os::raw::c_int,
pub _unused2: [::std::os::raw::c_char; 20usize],
}
impl Default for _IO_FILE {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl _IO_FILE {
#[inline]
pub fn _flags2(&self) -> ::std::os::raw::c_int {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) }
}
#[inline]
pub fn set__flags2(&mut self, val: ::std::os::raw::c_int) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 24u8, val as u64)
}
}
#[inline]
pub unsafe fn _flags2_raw(this: *const Self) -> ::std::os::raw::c_int {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 3usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
0usize,
24u8,
) as u32)
}
}
#[inline]
pub unsafe fn set__flags2_raw(this: *mut Self, val: ::std::os::raw::c_int) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 3usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
0usize,
24u8,
val as u64,
)
}
}
#[inline]
pub fn new_bitfield_1(_flags2: ::std::os::raw::c_int) -> __BindgenBitfieldUnit<[u8; 3usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 24u8, {
let _flags2: u32 = unsafe { ::std::mem::transmute(_flags2) };
_flags2 as u64
});
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct editline {
_unused: [u8; 0],
}
pub type EditLine = editline;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct lineinfo {
pub buffer: *const ::std::os::raw::c_char,
pub cursor: *const ::std::os::raw::c_char,
pub lastchar: *const ::std::os::raw::c_char,
}
impl Default for lineinfo {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type LineInfo = lineinfo;
unsafe extern "C" {
pub fn el_init(
arg1: *const ::std::os::raw::c_char,
arg2: *mut FILE,
arg3: *mut FILE,
arg4: *mut FILE,
) -> *mut EditLine;
}
#[cfg(not(target_os = "macos"))]
unsafe extern "C" {
pub fn el_init_fd(
arg1: *const ::std::os::raw::c_char,
arg2: *mut FILE,
arg3: *mut FILE,
arg4: *mut FILE,
arg5: ::std::os::raw::c_int,
arg6: ::std::os::raw::c_int,
arg7: ::std::os::raw::c_int,
) -> *mut EditLine;
}
unsafe extern "C" {
pub fn el_end(arg1: *mut EditLine);
}
unsafe extern "C" {
pub fn el_reset(arg1: *mut EditLine);
}
unsafe extern "C" {
pub fn el_gets(
arg1: *mut EditLine,
arg2: *mut ::std::os::raw::c_int,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn el_getc(arg1: *mut EditLine, arg2: *mut ::std::os::raw::c_char)
-> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_push(arg1: *mut EditLine, arg2: *const ::std::os::raw::c_char);
}
unsafe extern "C" {
pub fn el_beep(arg1: *mut EditLine);
}
unsafe extern "C" {
pub fn el_parse(
arg1: *mut EditLine,
arg2: ::std::os::raw::c_int,
arg3: *mut *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_set(arg1: *mut EditLine, arg2: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_get(arg1: *mut EditLine, arg2: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_source(
arg1: *mut EditLine,
arg2: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_resize(arg1: *mut EditLine);
}
unsafe extern "C" {
pub fn el_line(arg1: *mut EditLine) -> *const LineInfo;
}
unsafe extern "C" {
pub fn el_insertstr(
arg1: *mut EditLine,
arg2: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_deletestr(arg1: *mut EditLine, arg2: ::std::os::raw::c_int);
}
unsafe extern "C" {
pub fn el_replacestr(
arg1: *mut EditLine,
arg2: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_deletestr1(
arg1: *mut EditLine,
arg2: ::std::os::raw::c_int,
arg3: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct history {
_unused: [u8; 0],
}
pub type History = history;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct HistEvent {
pub num: ::std::os::raw::c_int,
pub str_: *const ::std::os::raw::c_char,
}
impl Default for HistEvent {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
unsafe extern "C" {
pub fn history_init() -> *mut History;
}
unsafe extern "C" {
pub fn history_end(arg1: *mut History);
}
unsafe extern "C" {
pub fn history(
arg1: *mut History,
arg2: *mut HistEvent,
arg3: ::std::os::raw::c_int,
...
) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tokenizer {
_unused: [u8; 0],
}
pub type Tokenizer = tokenizer;
unsafe extern "C" {
pub fn tok_init(arg1: *const ::std::os::raw::c_char) -> *mut Tokenizer;
}
unsafe extern "C" {
pub fn tok_end(arg1: *mut Tokenizer);
}
unsafe extern "C" {
pub fn tok_reset(arg1: *mut Tokenizer);
}
unsafe extern "C" {
pub fn tok_line(
arg1: *mut Tokenizer,
arg2: *const LineInfo,
arg3: *mut ::std::os::raw::c_int,
arg4: *mut *mut *const ::std::os::raw::c_char,
arg5: *mut ::std::os::raw::c_int,
arg6: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn tok_str(
arg1: *mut Tokenizer,
arg2: *const ::std::os::raw::c_char,
arg3: *mut ::std::os::raw::c_int,
arg4: *mut *mut *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
pub type wchar_t = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct lineinfow {
pub buffer: *const wchar_t,
pub cursor: *const wchar_t,
pub lastchar: *const wchar_t,
}
impl Default for lineinfow {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type LineInfoW = lineinfow;
pub type el_rfunc_t = ::std::option::Option<
unsafe extern "C" fn(arg1: *mut EditLine, arg2: *mut wchar_t) -> ::std::os::raw::c_int,
>;
unsafe extern "C" {
pub fn el_wgets(arg1: *mut EditLine, arg2: *mut ::std::os::raw::c_int) -> *const wchar_t;
}
unsafe extern "C" {
pub fn el_wgetc(arg1: *mut EditLine, arg2: *mut wchar_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_wpush(arg1: *mut EditLine, arg2: *const wchar_t);
}
unsafe extern "C" {
pub fn el_wparse(
arg1: *mut EditLine,
arg2: ::std::os::raw::c_int,
arg3: *mut *const wchar_t,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_wset(arg1: *mut EditLine, arg2: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_wget(arg1: *mut EditLine, arg2: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_cursor(arg1: *mut EditLine, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_wline(arg1: *mut EditLine) -> *const LineInfoW;
}
unsafe extern "C" {
pub fn el_winsertstr(arg1: *mut EditLine, arg2: *const wchar_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn el_wreplacestr(arg1: *mut EditLine, arg2: *const wchar_t) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct histeventW {
pub num: ::std::os::raw::c_int,
pub str_: *const wchar_t,
}
impl Default for histeventW {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type HistEventW = histeventW;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct historyW {
_unused: [u8; 0],
}
pub type HistoryW = historyW;
unsafe extern "C" {
pub fn history_winit() -> *mut HistoryW;
}
unsafe extern "C" {
pub fn history_wend(arg1: *mut HistoryW);
}
unsafe extern "C" {
pub fn history_w(
arg1: *mut HistoryW,
arg2: *mut HistEventW,
arg3: ::std::os::raw::c_int,
...
) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tokenizerW {
_unused: [u8; 0],
}
pub type TokenizerW = tokenizerW;
unsafe extern "C" {
pub fn tok_winit(arg1: *const wchar_t) -> *mut TokenizerW;
}
unsafe extern "C" {
pub fn tok_wend(arg1: *mut TokenizerW);
}
unsafe extern "C" {
pub fn tok_wreset(arg1: *mut TokenizerW);
}
unsafe extern "C" {
pub fn tok_wline(
arg1: *mut TokenizerW,
arg2: *const LineInfoW,
arg3: *mut ::std::os::raw::c_int,
arg4: *mut *mut *const wchar_t,
arg5: *mut ::std::os::raw::c_int,
arg6: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn tok_wstr(
arg1: *mut TokenizerW,
arg2: *const wchar_t,
arg3: *mut ::std::os::raw::c_int,
arg4: *mut *mut *const wchar_t,
) -> ::std::os::raw::c_int;
}