diff --git a/.circleci/config.yml b/.circleci/config.yml index bdf11641..f6b36ab3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: jobs: build-default: docker: - - image: circleci/rust:latest + - image: cimg/rust:1.69.0 steps: - checkout - run: @@ -32,9 +32,9 @@ jobs: - run: name: Check bindgen command: | - cargo install bindgen + cargo install bindgen-cli scripts/update-bindgen.sh - git diff --exit-code + scripts/check-bindgen.sh - run: name: Check Formatting command: | @@ -50,7 +50,7 @@ jobs: key: cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} build-no-oslib: docker: - - image: circleci/rust:latest + - image: cimg/rust:1.69.0 steps: - checkout - run: @@ -82,7 +82,7 @@ jobs: key: cargo-cache-no-oslib-{{ arch }}-{{ checksum "Cargo.lock" }} build-lua53: docker: - - image: circleci/rust:latest + - image: cimg/rust:1.69.0 steps: - checkout - run: @@ -108,9 +108,9 @@ jobs: - run: name: Check bindgen command: | - cargo install bindgen + cargo install bindgen-cli scripts/update-bindgen.sh - git diff --exit-code + scripts/check-bindgen.sh - run: name: Check Formatting command: | @@ -126,7 +126,7 @@ jobs: key: cargo-cache-lua53-{{ arch }}-{{ checksum "Cargo.lock" }} build-lua51: docker: - - image: circleci/rust:latest + - image: cimg/rust:1.69.0 steps: - checkout - run: @@ -158,9 +158,9 @@ jobs: - run: name: Check bindgen command: | - cargo install bindgen + cargo install bindgen-cli scripts/update-bindgen.sh - git diff --exit-code + scripts/check-bindgen.sh - run: name: Check Formatting command: | diff --git a/CHANGELOG.md b/CHANGELOG.md index d64cf1e9..6c104ee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [0.19.5] +- Update to Lua 5.4.4. + ## [0.19.4] - Fix the `lua-no-oslib` feature introduced with a bug in 0.19.3. diff --git a/Cargo.toml b/Cargo.toml index 23bd5339..2f3db367 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rlua" -version = "0.19.4" +version = "0.19.5" authors = ["kyren "] edition = "2018" description = "High level bindings to Lua 5.x" @@ -35,7 +35,7 @@ libc = { version = "0.2" } num-traits = { version = "0.2.14" } bitflags = { version = "1.0.4" } bstr = {version = "0.2", features = ["std"], default_features = false } -rlua-lua54-sys = { version = "0.1.3", optional = true } +rlua-lua54-sys = { version = "0.1.4", optional = true } rlua-lua53-sys = { version = "0.1.2", optional = true } rlua-lua51-sys = { version = "0.1.2", optional = true } diff --git a/crates/rlua-lua51-sys/src/bindings.rs b/crates/rlua-lua51-sys/src/bindings.rs index f4f6c07e..92a54993 100644 --- a/crates/rlua-lua51-sys/src/bindings.rs +++ b/crates/rlua-lua51-sys/src/bindings.rs @@ -1,5 +1,227 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.65.1 */ +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type wchar_t = ::std::os::raw::c_int; +pub type lua_CFunction = + ::std::option::Option ::std::os::raw::c_int>; +pub type lua_Reader = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + ud: *mut ::std::os::raw::c_void, + sz: *mut usize, + ) -> *const ::std::os::raw::c_char, +>; +pub type lua_Writer = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + p: *const ::std::os::raw::c_void, + sz: usize, + ud: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +pub type lua_Alloc = ::std::option::Option< + unsafe extern "C" fn( + ud: *mut ::std::os::raw::c_void, + ptr: *mut ::std::os::raw::c_void, + osize: usize, + nsize: usize, + ) -> *mut ::std::os::raw::c_void, +>; +pub type lua_Number = f64; +pub type lua_Integer = isize; +pub type lua_Hook = + ::std::option::Option; +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type __fpos_t = _G_fpos_t; +pub type __fpos64_t = _G_fpos64_t; +pub type __FILE = _IO_FILE; +pub type FILE = _IO_FILE; +pub type _IO_lock_t = ::std::os::raw::c_void; +pub type off_t = __off_t; +pub type fpos_t = __fpos_t; +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_State { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_Debug { + pub event: ::std::os::raw::c_int, + pub name: *const ::std::os::raw::c_char, + pub namewhat: *const ::std::os::raw::c_char, + pub what: *const ::std::os::raw::c_char, + pub source: *const ::std::os::raw::c_char, + pub currentline: ::std::os::raw::c_int, + pub nups: ::std::os::raw::c_int, + pub linedefined: ::std::os::raw::c_int, + pub lastlinedefined: ::std::os::raw::c_int, + pub short_src: [::std::os::raw::c_char; 60usize], + pub i_ci: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __mbstate_t { + pub __count: ::std::os::raw::c_int, + pub __value: __mbstate_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos_t { + pub __pos: __off_t, + pub __state: __mbstate_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos64_t { + pub __pos: __off64_t, + pub __state: __mbstate_t, +} +#[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], +} +#[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 _flags2: ::std::os::raw::c_int, + 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 __pad5: usize, + pub _mode: ::std::os::raw::c_int, + pub _unused2: [::std::os::raw::c_char; 20usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Reg { + pub name: *const ::std::os::raw::c_char, + pub func: lua_CFunction, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Buffer { + pub p: *mut ::std::os::raw::c_char, + pub lvl: ::std::os::raw::c_int, + pub L: *mut lua_State, + pub buffer: [::std::os::raw::c_char; 8192usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} pub const __GNUC_VA_LIST: u32 = 1; pub const _LIBC_LIMITS_H_: u32 = 1; pub const _FEATURES_H: u32 = 1; @@ -239,96 +461,788 @@ pub const FOPEN_MAX: u32 = 16; pub const LUA_ERRFILE: u32 = 6; pub const LUA_NOREF: i32 = -2; pub const LUA_REFNIL: i32 = -1; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, +#[test] +fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +#[test] +fn bindgen_test_layout_lua_Debug() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 120usize, + concat!("Size of: ", stringify!(lua_Debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lua_Debug)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(event) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).namewhat) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(namewhat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).what) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(source) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentline) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(currentline) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nups) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(nups) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).linedefined) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(linedefined) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lastlinedefined) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(lastlinedefined) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).short_src) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(short_src) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).i_ci) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(i_ci) + ) + ); +} +#[test] +fn bindgen_test_layout___fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__fsid_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__fsid_t), + "::", + stringify!(__val) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wch) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wchb) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t>(), + 8usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__count) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__value) + ) + ); +} +#[test] +fn bindgen_test_layout__G_fpos_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__state) + ) + ); +} +#[test] +fn bindgen_test_layout__G_fpos64_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos64_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos64_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__state) + ) + ); +} +#[test] +fn bindgen_test_layout__IO_FILE() { + const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_IO_FILE>(), + 216usize, + concat!("Size of: ", stringify!(_IO_FILE)) + ); + assert_eq!( + ::std::mem::align_of::<_IO_FILE>(), + 8usize, + concat!("Alignment of ", stringify!(_IO_FILE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_backup_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_markers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_chain) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_fileno) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_old_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_cur_column) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_vtable_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize }, + 131usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_shortbuf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_lock) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_codecvt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_wide_data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_list) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_buf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(__pad5) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_mode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize }, + 196usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_unused2) + ) + ); } #[test] -fn bindgen_test_layout_max_align_t() { +fn bindgen_test_layout_luaL_Reg() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(luaL_Reg)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Reg)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(func) + ) + ); +} +#[test] +fn bindgen_test_layout_luaL_Buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8216usize, + concat!("Size of: ", stringify!(luaL_Buffer)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Buffer)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).p) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(p) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lvl) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(lvl) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).L) as usize - ptr as usize }, 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(L) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(buffer) + ) + ); +} +#[test] +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) ); - fn test_field___clang_max_align_nonce1() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - } - test_field___clang_max_align_nonce1(); - fn test_field___clang_max_align_nonce2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); - } - test_field___clang_max_align_nonce2(); } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lua_State { - _unused: [u8; 0], +#[derive(Copy, Clone)] +pub union __mbstate_t__bindgen_ty_1 { + pub __wch: ::std::os::raw::c_uint, + pub __wchb: [::std::os::raw::c_char; 4usize], } -pub type lua_CFunction = - ::std::option::Option ::std::os::raw::c_int>; -pub type lua_Reader = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - ud: *mut ::std::os::raw::c_void, - sz: *mut usize, - ) -> *const ::std::os::raw::c_char, ->; -pub type lua_Writer = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - p: *const ::std::os::raw::c_void, - sz: usize, - ud: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, ->; -pub type lua_Alloc = ::std::option::Option< - unsafe extern "C" fn( - ud: *mut ::std::os::raw::c_void, - ptr: *mut ::std::os::raw::c_void, - osize: usize, - nsize: usize, - ) -> *mut ::std::os::raw::c_void, ->; -pub type lua_Number = f64; -pub type lua_Integer = isize; extern "C" { pub fn lua_newstate(f: lua_Alloc, ud: *mut ::std::os::raw::c_void) -> *mut lua_State; } @@ -616,8 +1530,6 @@ extern "C" { extern "C" { pub fn lua_setlevel(from: *mut lua_State, to: *mut lua_State); } -pub type lua_Hook = - ::std::option::Option; extern "C" { pub fn lua_getstack( L: *mut lua_State, @@ -654,1140 +1566,56 @@ extern "C" { ) -> *const ::std::os::raw::c_char; } extern "C" { - pub fn lua_setupvalue( - L: *mut lua_State, - funcindex: ::std::os::raw::c_int, - n: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn lua_sethook( - L: *mut lua_State, - func: lua_Hook, - mask: ::std::os::raw::c_int, - count: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lua_gethook(L: *mut lua_State) -> lua_Hook; -} -extern "C" { - pub fn lua_gethookmask(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lua_gethookcount(L: *mut lua_State) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lua_Debug { - pub event: ::std::os::raw::c_int, - pub name: *const ::std::os::raw::c_char, - pub namewhat: *const ::std::os::raw::c_char, - pub what: *const ::std::os::raw::c_char, - pub source: *const ::std::os::raw::c_char, - pub currentline: ::std::os::raw::c_int, - pub nups: ::std::os::raw::c_int, - pub linedefined: ::std::os::raw::c_int, - pub lastlinedefined: ::std::os::raw::c_int, - pub short_src: [::std::os::raw::c_char; 60usize], - pub i_ci: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_lua_Debug() { - assert_eq!( - ::std::mem::size_of::(), - 120usize, - concat!("Size of: ", stringify!(lua_Debug)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(lua_Debug)) - ); - fn test_field_event() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(event) - ) - ); - } - test_field_event(); - fn test_field_name() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(name) - ) - ); - } - test_field_name(); - fn test_field_namewhat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).namewhat) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(namewhat) - ) - ); - } - test_field_namewhat(); - fn test_field_what() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).what) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(what) - ) - ); - } - test_field_what(); - fn test_field_source() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(source) - ) - ); - } - test_field_source(); - fn test_field_currentline() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).currentline) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(currentline) - ) - ); - } - test_field_currentline(); - fn test_field_nups() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nups) as usize - ptr as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(nups) - ) - ); - } - test_field_nups(); - fn test_field_linedefined() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).linedefined) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(linedefined) - ) - ); - } - test_field_linedefined(); - fn test_field_lastlinedefined() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).lastlinedefined) as usize - ptr as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(lastlinedefined) - ) - ); - } - test_field_lastlinedefined(); - fn test_field_short_src() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).short_src) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(short_src) - ) - ); - } - test_field_short_src(); - fn test_field_i_ci() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).i_ci) as usize - ptr as usize - }, - 116usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(i_ci) - ) - ); - } - test_field_i_ci(); -} -extern "C" { - pub fn luaopen_base(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_table(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_io(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_os(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_string(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_math(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_debug(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaopen_package(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn luaL_openlibs(L: *mut lua_State); -} -pub type __u_char = ::std::os::raw::c_uchar; -pub type __u_short = ::std::os::raw::c_ushort; -pub type __u_int = ::std::os::raw::c_uint; -pub type __u_long = ::std::os::raw::c_ulong; -pub type __int8_t = ::std::os::raw::c_schar; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __int16_t = ::std::os::raw::c_short; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; -pub type __uint64_t = ::std::os::raw::c_ulong; -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = ::std::os::raw::c_long; -pub type __u_quad_t = ::std::os::raw::c_ulong; -pub type __intmax_t = ::std::os::raw::c_long; -pub type __uintmax_t = ::std::os::raw::c_ulong; -pub type __dev_t = ::std::os::raw::c_ulong; -pub type __uid_t = ::std::os::raw::c_uint; -pub type __gid_t = ::std::os::raw::c_uint; -pub type __ino_t = ::std::os::raw::c_ulong; -pub type __ino64_t = ::std::os::raw::c_ulong; -pub type __mode_t = ::std::os::raw::c_uint; -pub type __nlink_t = ::std::os::raw::c_ulong; -pub type __off_t = ::std::os::raw::c_long; -pub type __off64_t = ::std::os::raw::c_long; -pub type __pid_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [::std::os::raw::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::std::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::std::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - fn test_field___val() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__fsid_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); - } - test_field___val(); + pub fn lua_setupvalue( + L: *mut lua_State, + funcindex: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char; } -pub type __clock_t = ::std::os::raw::c_long; -pub type __rlim_t = ::std::os::raw::c_ulong; -pub type __rlim64_t = ::std::os::raw::c_ulong; -pub type __id_t = ::std::os::raw::c_uint; -pub type __time_t = ::std::os::raw::c_long; -pub type __useconds_t = ::std::os::raw::c_uint; -pub type __suseconds_t = ::std::os::raw::c_long; -pub type __daddr_t = ::std::os::raw::c_int; -pub type __key_t = ::std::os::raw::c_int; -pub type __clockid_t = ::std::os::raw::c_int; -pub type __timer_t = *mut ::std::os::raw::c_void; -pub type __blksize_t = ::std::os::raw::c_long; -pub type __blkcnt_t = ::std::os::raw::c_long; -pub type __blkcnt64_t = ::std::os::raw::c_long; -pub type __fsblkcnt_t = ::std::os::raw::c_ulong; -pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; -pub type __fsword_t = ::std::os::raw::c_long; -pub type __ssize_t = ::std::os::raw::c_long; -pub type __syscall_slong_t = ::std::os::raw::c_long; -pub type __syscall_ulong_t = ::std::os::raw::c_ulong; -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut ::std::os::raw::c_char; -pub type __intptr_t = ::std::os::raw::c_long; -pub type __socklen_t = ::std::os::raw::c_uint; -pub type __sig_atomic_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: ::std::os::raw::c_int, - pub __value: __mbstate_t__bindgen_ty_1, +extern "C" { + pub fn lua_sethook( + L: *mut lua_State, + func: lua_Hook, + mask: ::std::os::raw::c_int, + count: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: ::std::os::raw::c_uint, - pub __wchb: [::std::os::raw::c_char; 4usize], +extern "C" { + pub fn lua_gethook(L: *mut lua_State) -> lua_Hook; } -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - fn test_field___wch() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t__bindgen_ty_1>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - } - test_field___wch(); - fn test_field___wchb() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t__bindgen_ty_1>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); - } - test_field___wchb(); +extern "C" { + pub fn lua_gethookmask(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::std::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - fn test_field___count() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - } - test_field___count(); - fn test_field___value() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); - } - test_field___value(); +extern "C" { + pub fn lua_gethookcount(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, +extern "C" { + pub fn luaopen_base(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::std::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - fn test_field___pos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - } - test_field___pos(); - fn test_field___state() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); - } - test_field___state(); +extern "C" { + pub fn luaopen_table(L: *mut lua_State) -> ::std::os::raw::c_int; } -pub type __fpos_t = _G_fpos_t; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, +extern "C" { + pub fn luaopen_io(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::std::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - fn test_field___pos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos64_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - } - test_field___pos(); - fn test_field___state() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos64_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); - } - test_field___state(); +extern "C" { + pub fn luaopen_os(L: *mut lua_State) -> ::std::os::raw::c_int; } -pub type __fpos64_t = _G_fpos64_t; -pub type __FILE = _IO_FILE; -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], +extern "C" { + pub fn luaopen_string(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], +extern "C" { + pub fn luaopen_math(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], +extern "C" { + pub fn luaopen_debug(L: *mut lua_State) -> ::std::os::raw::c_int; } -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 _flags2: ::std::os::raw::c_int, - 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 __pad5: usize, - pub _mode: ::std::os::raw::c_int, - pub _unused2: [::std::os::raw::c_char; 20usize], +extern "C" { + pub fn luaopen_package(L: *mut lua_State) -> ::std::os::raw::c_int; } -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::std::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::std::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - fn test_field__flags() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - } - test_field__flags(); - fn test_field__IO_read_ptr() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - } - test_field__IO_read_ptr(); - fn test_field__IO_read_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - } - test_field__IO_read_end(); - fn test_field__IO_read_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - } - test_field__IO_read_base(); - fn test_field__IO_write_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - } - test_field__IO_write_base(); - fn test_field__IO_write_ptr() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - } - test_field__IO_write_ptr(); - fn test_field__IO_write_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - } - test_field__IO_write_end(); - fn test_field__IO_buf_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - } - test_field__IO_buf_base(); - fn test_field__IO_buf_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - } - test_field__IO_buf_end(); - fn test_field__IO_save_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - } - test_field__IO_save_base(); - fn test_field__IO_backup_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - } - test_field__IO_backup_base(); - fn test_field__IO_save_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - } - test_field__IO_save_end(); - fn test_field__markers() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - } - test_field__markers(); - fn test_field__chain() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - } - test_field__chain(); - fn test_field__fileno() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - } - test_field__fileno(); - fn test_field__flags2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize - }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - } - test_field__flags2(); - fn test_field__old_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - } - test_field__old_offset(); - fn test_field__cur_column() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize - }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - } - test_field__cur_column(); - fn test_field__vtable_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize - }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - } - test_field__vtable_offset(); - fn test_field__shortbuf() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize - }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - } - test_field__shortbuf(); - fn test_field__lock() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize - }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - } - test_field__lock(); - fn test_field__offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - } - test_field__offset(); - fn test_field__codecvt() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize - }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - } - test_field__codecvt(); - fn test_field__wide_data() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize - }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - } - test_field__wide_data(); - fn test_field__freeres_list() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize - }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - } - test_field__freeres_list(); - fn test_field__freeres_buf() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize - }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - } - test_field__freeres_buf(); - fn test_field___pad5() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize - }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - } - test_field___pad5(); - fn test_field__mode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize - }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - } - test_field__mode(); - fn test_field__unused2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize - }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); - } - test_field__unused2(); +extern "C" { + pub fn luaL_openlibs(L: *mut lua_State); } -pub type off_t = __off_t; -pub type fpos_t = __fpos_t; extern "C" { pub static mut stdin: *mut FILE; } @@ -2200,7 +2028,7 @@ extern "C" { pub static mut sys_nerr: ::std::os::raw::c_int; } extern "C" { - pub static mut sys_errlist: [*const ::std::os::raw::c_char; 0usize]; + pub static sys_errlist: [*const ::std::os::raw::c_char; 0usize]; } extern "C" { pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; @@ -2235,59 +2063,6 @@ extern "C" { extern "C" { pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Reg { - pub name: *const ::std::os::raw::c_char, - pub func: lua_CFunction, -} -#[test] -fn bindgen_test_layout_luaL_Reg() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(luaL_Reg)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Reg)) - ); - fn test_field_name() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(name) - ) - ); - } - test_field_name(); - fn test_field_func() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(func) - ) - ); - } - test_field_func(); -} extern "C" { pub fn luaL_openlib( L: *mut lua_State, @@ -2455,95 +2230,6 @@ extern "C" { szhint: ::std::os::raw::c_int, ) -> *const ::std::os::raw::c_char; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Buffer { - pub p: *mut ::std::os::raw::c_char, - pub lvl: ::std::os::raw::c_int, - pub L: *mut lua_State, - pub buffer: [::std::os::raw::c_char; 8192usize], -} -#[test] -fn bindgen_test_layout_luaL_Buffer() { - assert_eq!( - ::std::mem::size_of::(), - 8216usize, - concat!("Size of: ", stringify!(luaL_Buffer)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Buffer)) - ); - fn test_field_p() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).p) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(p) - ) - ); - } - test_field_p(); - fn test_field_lvl() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).lvl) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(lvl) - ) - ); - } - test_field_lvl(); - fn test_field_L() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).L) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(L) - ) - ); - } - test_field_L(); - fn test_field_buffer() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(buffer) - ) - ); - } - test_field_buffer(); -} extern "C" { pub fn luaL_buffinit(L: *mut lua_State, B: *mut luaL_Buffer); } @@ -2562,93 +2248,3 @@ extern "C" { extern "C" { pub fn luaL_pushresult(B: *mut luaL_Buffer); } -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: ::std::os::raw::c_uint, - pub fp_offset: ::std::os::raw::c_uint, - pub overflow_arg_area: *mut ::std::os::raw::c_void, - pub reg_save_area: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout___va_list_tag() { - assert_eq!( - ::std::mem::size_of::<__va_list_tag>(), - 24usize, - concat!("Size of: ", stringify!(__va_list_tag)) - ); - assert_eq!( - ::std::mem::align_of::<__va_list_tag>(), - 8usize, - concat!("Alignment of ", stringify!(__va_list_tag)) - ); - fn test_field_gp_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(gp_offset) - ) - ); - } - test_field_gp_offset(); - fn test_field_fp_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(fp_offset) - ) - ); - } - test_field_fp_offset(); - fn test_field_overflow_arg_area() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(overflow_arg_area) - ) - ); - } - test_field_overflow_arg_area(); - fn test_field_reg_save_area() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(reg_save_area) - ) - ); - } - test_field_reg_save_area(); -} diff --git a/crates/rlua-lua53-sys/src/bindings.rs b/crates/rlua-lua53-sys/src/bindings.rs index c4979ef6..0ea9378f 100644 --- a/crates/rlua-lua53-sys/src/bindings.rs +++ b/crates/rlua-lua53-sys/src/bindings.rs @@ -1,5 +1,269 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.65.1 */ +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type wchar_t = ::std::os::raw::c_int; +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +pub type lua_Number = f64; +pub type lua_Integer = ::std::os::raw::c_longlong; +pub type lua_Unsigned = ::std::os::raw::c_ulonglong; +pub type lua_KContext = isize; +pub type lua_CFunction = + ::std::option::Option ::std::os::raw::c_int>; +pub type lua_KFunction = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + status: ::std::os::raw::c_int, + ctx: lua_KContext, + ) -> ::std::os::raw::c_int, +>; +pub type lua_Reader = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + ud: *mut ::std::os::raw::c_void, + sz: *mut usize, + ) -> *const ::std::os::raw::c_char, +>; +pub type lua_Writer = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + p: *const ::std::os::raw::c_void, + sz: usize, + ud: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +pub type lua_Alloc = ::std::option::Option< + unsafe extern "C" fn( + ud: *mut ::std::os::raw::c_void, + ptr: *mut ::std::os::raw::c_void, + osize: usize, + nsize: usize, + ) -> *mut ::std::os::raw::c_void, +>; +pub type lua_Hook = + ::std::option::Option; +pub type __fpos_t = _G_fpos_t; +pub type __fpos64_t = _G_fpos64_t; +pub type __FILE = _IO_FILE; +pub type FILE = _IO_FILE; +pub type _IO_lock_t = ::std::os::raw::c_void; +pub type off_t = __off_t; +pub type fpos_t = __fpos_t; +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_State { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_Debug { + pub event: ::std::os::raw::c_int, + pub name: *const ::std::os::raw::c_char, + pub namewhat: *const ::std::os::raw::c_char, + pub what: *const ::std::os::raw::c_char, + pub source: *const ::std::os::raw::c_char, + pub currentline: ::std::os::raw::c_int, + pub linedefined: ::std::os::raw::c_int, + pub lastlinedefined: ::std::os::raw::c_int, + pub nups: ::std::os::raw::c_uchar, + pub nparams: ::std::os::raw::c_uchar, + pub isvararg: ::std::os::raw::c_char, + pub istailcall: ::std::os::raw::c_char, + pub short_src: [::std::os::raw::c_char; 60usize], + pub i_ci: *mut CallInfo, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __mbstate_t { + pub __count: ::std::os::raw::c_int, + pub __value: __mbstate_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos_t { + pub __pos: __off_t, + pub __state: __mbstate_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos64_t { + pub __pos: __off64_t, + pub __state: __mbstate_t, +} +#[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], +} +#[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 _flags2: ::std::os::raw::c_int, + 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 __pad5: usize, + pub _mode: ::std::os::raw::c_int, + pub _unused2: [::std::os::raw::c_char; 20usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Reg { + pub name: *const ::std::os::raw::c_char, + pub func: lua_CFunction, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Buffer { + pub b: *mut ::std::os::raw::c_char, + pub size: usize, + pub n: usize, + pub L: *mut lua_State, + pub initb: [::std::os::raw::c_char; 8192usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Stream { + pub f: *mut FILE, + pub closef: lua_CFunction, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CallInfo { + pub _address: u8, +} pub const __GNUC_VA_LIST: u32 = 1; pub const _LIBC_LIMITS_H_: u32 = 1; pub const _FEATURES_H: u32 = 1; @@ -299,221 +563,865 @@ pub const LUA_PRELOAD_TABLE: &[u8; 9usize] = b"_PRELOAD\0"; pub const LUA_NOREF: i32 = -2; pub const LUA_REFNIL: i32 = -1; pub const LUA_FILEHANDLE: &[u8; 6usize] = b"FILE*\0"; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, +#[test] +fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +#[test] +fn bindgen_test_layout___fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__fsid_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__fsid_t), + "::", + stringify!(__val) + ) + ); +} +#[test] +fn bindgen_test_layout_lua_Debug() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(lua_Debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lua_Debug)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(event) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).namewhat) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(namewhat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).what) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(source) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentline) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(currentline) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).linedefined) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(linedefined) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lastlinedefined) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(lastlinedefined) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nups) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(nups) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nparams) as usize - ptr as usize }, + 53usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(nparams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).isvararg) as usize - ptr as usize }, + 54usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(isvararg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).istailcall) as usize - ptr as usize }, + 55usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(istailcall) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).short_src) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(short_src) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).i_ci) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(i_ci) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wch) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wchb) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t>(), + 8usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__count) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__value) + ) + ); +} +#[test] +fn bindgen_test_layout__G_fpos_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__state) + ) + ); +} +#[test] +fn bindgen_test_layout__G_fpos64_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos64_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos64_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__state) + ) + ); +} +#[test] +fn bindgen_test_layout__IO_FILE() { + const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_IO_FILE>(), + 216usize, + concat!("Size of: ", stringify!(_IO_FILE)) + ); + assert_eq!( + ::std::mem::align_of::<_IO_FILE>(), + 8usize, + concat!("Alignment of ", stringify!(_IO_FILE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_backup_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_markers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_chain) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_fileno) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_old_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_cur_column) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_vtable_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize }, + 131usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_shortbuf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_lock) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_codecvt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_wide_data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_list) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_buf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(__pad5) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_mode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize }, + 196usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_unused2) + ) + ); +} +#[test] +fn bindgen_test_layout_luaL_Reg() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(luaL_Reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Reg)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(func) + ) + ); } #[test] -fn bindgen_test_layout_max_align_t() { +fn bindgen_test_layout_luaL_Buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) + ::std::mem::size_of::(), + 8224usize, + concat!("Size of: ", stringify!(luaL_Buffer)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Buffer)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(b) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize }, 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).L) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(L) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).initb) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(initb) + ) ); - fn test_field___clang_max_align_nonce1() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - } - test_field___clang_max_align_nonce1(); - fn test_field___clang_max_align_nonce2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); - } - test_field___clang_max_align_nonce2(); } -pub type __u_char = ::std::os::raw::c_uchar; -pub type __u_short = ::std::os::raw::c_ushort; -pub type __u_int = ::std::os::raw::c_uint; -pub type __u_long = ::std::os::raw::c_ulong; -pub type __int8_t = ::std::os::raw::c_schar; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __int16_t = ::std::os::raw::c_short; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; -pub type __uint64_t = ::std::os::raw::c_ulong; -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = ::std::os::raw::c_long; -pub type __u_quad_t = ::std::os::raw::c_ulong; -pub type __intmax_t = ::std::os::raw::c_long; -pub type __uintmax_t = ::std::os::raw::c_ulong; -pub type __dev_t = ::std::os::raw::c_ulong; -pub type __uid_t = ::std::os::raw::c_uint; -pub type __gid_t = ::std::os::raw::c_uint; -pub type __ino_t = ::std::os::raw::c_ulong; -pub type __ino64_t = ::std::os::raw::c_ulong; -pub type __mode_t = ::std::os::raw::c_uint; -pub type __nlink_t = ::std::os::raw::c_ulong; -pub type __off_t = ::std::os::raw::c_long; -pub type __off64_t = ::std::os::raw::c_long; -pub type __pid_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [::std::os::raw::c_int; 2usize], +#[test] +fn bindgen_test_layout_luaL_Stream() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(luaL_Stream)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Stream)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Stream), + "::", + stringify!(f) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).closef) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Stream), + "::", + stringify!(closef) + ) + ); } #[test] -fn bindgen_test_layout___fsid_t() { +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__fsid_t>(), + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), 8usize, - concat!("Size of: ", stringify!(__fsid_t)) + concat!("Alignment of ", stringify!(__va_list_tag)) ); assert_eq!( - ::std::mem::align_of::<__fsid_t>(), + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) ); - fn test_field___val() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__fsid_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); - } - test_field___val(); } -pub type __clock_t = ::std::os::raw::c_long; -pub type __rlim_t = ::std::os::raw::c_ulong; -pub type __rlim64_t = ::std::os::raw::c_ulong; -pub type __id_t = ::std::os::raw::c_uint; -pub type __time_t = ::std::os::raw::c_long; -pub type __useconds_t = ::std::os::raw::c_uint; -pub type __suseconds_t = ::std::os::raw::c_long; -pub type __daddr_t = ::std::os::raw::c_int; -pub type __key_t = ::std::os::raw::c_int; -pub type __clockid_t = ::std::os::raw::c_int; -pub type __timer_t = *mut ::std::os::raw::c_void; -pub type __blksize_t = ::std::os::raw::c_long; -pub type __blkcnt_t = ::std::os::raw::c_long; -pub type __blkcnt64_t = ::std::os::raw::c_long; -pub type __fsblkcnt_t = ::std::os::raw::c_ulong; -pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; -pub type __fsword_t = ::std::os::raw::c_long; -pub type __ssize_t = ::std::os::raw::c_long; -pub type __syscall_slong_t = ::std::os::raw::c_long; -pub type __syscall_ulong_t = ::std::os::raw::c_ulong; -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut ::std::os::raw::c_char; -pub type __intptr_t = ::std::os::raw::c_long; -pub type __socklen_t = ::std::os::raw::c_uint; -pub type __sig_atomic_t = ::std::os::raw::c_int; -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -pub type int_fast8_t = ::std::os::raw::c_schar; -pub type int_fast16_t = ::std::os::raw::c_long; -pub type int_fast32_t = ::std::os::raw::c_long; -pub type int_fast64_t = ::std::os::raw::c_long; -pub type uint_fast8_t = ::std::os::raw::c_uchar; -pub type uint_fast16_t = ::std::os::raw::c_ulong; -pub type uint_fast32_t = ::std::os::raw::c_ulong; -pub type uint_fast64_t = ::std::os::raw::c_ulong; -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lua_State { - _unused: [u8; 0], +#[derive(Copy, Clone)] +pub union __mbstate_t__bindgen_ty_1 { + pub __wch: ::std::os::raw::c_uint, + pub __wchb: [::std::os::raw::c_char; 4usize], } -pub type lua_Number = f64; -pub type lua_Integer = ::std::os::raw::c_longlong; -pub type lua_Unsigned = ::std::os::raw::c_ulonglong; -pub type lua_KContext = isize; -pub type lua_CFunction = - ::std::option::Option ::std::os::raw::c_int>; -pub type lua_KFunction = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - status: ::std::os::raw::c_int, - ctx: lua_KContext, - ) -> ::std::os::raw::c_int, ->; -pub type lua_Reader = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - ud: *mut ::std::os::raw::c_void, - sz: *mut usize, - ) -> *const ::std::os::raw::c_char, ->; -pub type lua_Writer = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - p: *const ::std::os::raw::c_void, - sz: usize, - ud: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, ->; -pub type lua_Alloc = ::std::option::Option< - unsafe extern "C" fn( - ud: *mut ::std::os::raw::c_void, - ptr: *mut ::std::os::raw::c_void, - osize: usize, - nsize: usize, - ) -> *mut ::std::os::raw::c_void, ->; extern "C" { - pub static mut lua_ident: [::std::os::raw::c_char; 0usize]; + pub static lua_ident: [::std::os::raw::c_char; 0usize]; } extern "C" { pub fn lua_newstate(f: lua_Alloc, ud: *mut ::std::os::raw::c_void) -> *mut lua_State; @@ -876,8 +1784,6 @@ extern "C" { extern "C" { pub fn lua_setallocf(L: *mut lua_State, f: lua_Alloc, ud: *mut ::std::os::raw::c_void); } -pub type lua_Hook = - ::std::option::Option; extern "C" { pub fn lua_getstack( L: *mut lua_State, @@ -929,298 +1835,29 @@ extern "C" { } extern "C" { pub fn lua_upvaluejoin( - L: *mut lua_State, - fidx1: ::std::os::raw::c_int, - n1: ::std::os::raw::c_int, - fidx2: ::std::os::raw::c_int, - n2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn lua_sethook( - L: *mut lua_State, - func: lua_Hook, - mask: ::std::os::raw::c_int, - count: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn lua_gethook(L: *mut lua_State) -> lua_Hook; -} -extern "C" { - pub fn lua_gethookmask(L: *mut lua_State) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lua_gethookcount(L: *mut lua_State) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lua_Debug { - pub event: ::std::os::raw::c_int, - pub name: *const ::std::os::raw::c_char, - pub namewhat: *const ::std::os::raw::c_char, - pub what: *const ::std::os::raw::c_char, - pub source: *const ::std::os::raw::c_char, - pub currentline: ::std::os::raw::c_int, - pub linedefined: ::std::os::raw::c_int, - pub lastlinedefined: ::std::os::raw::c_int, - pub nups: ::std::os::raw::c_uchar, - pub nparams: ::std::os::raw::c_uchar, - pub isvararg: ::std::os::raw::c_char, - pub istailcall: ::std::os::raw::c_char, - pub short_src: [::std::os::raw::c_char; 60usize], - pub i_ci: *mut CallInfo, -} -#[test] -fn bindgen_test_layout_lua_Debug() { - assert_eq!( - ::std::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(lua_Debug)) + L: *mut lua_State, + fidx1: ::std::os::raw::c_int, + n1: ::std::os::raw::c_int, + fidx2: ::std::os::raw::c_int, + n2: ::std::os::raw::c_int, ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(lua_Debug)) +} +extern "C" { + pub fn lua_sethook( + L: *mut lua_State, + func: lua_Hook, + mask: ::std::os::raw::c_int, + count: ::std::os::raw::c_int, ); - fn test_field_event() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(event) - ) - ); - } - test_field_event(); - fn test_field_name() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(name) - ) - ); - } - test_field_name(); - fn test_field_namewhat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).namewhat) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(namewhat) - ) - ); - } - test_field_namewhat(); - fn test_field_what() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).what) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(what) - ) - ); - } - test_field_what(); - fn test_field_source() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(source) - ) - ); - } - test_field_source(); - fn test_field_currentline() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).currentline) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(currentline) - ) - ); - } - test_field_currentline(); - fn test_field_linedefined() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).linedefined) as usize - ptr as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(linedefined) - ) - ); - } - test_field_linedefined(); - fn test_field_lastlinedefined() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).lastlinedefined) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(lastlinedefined) - ) - ); - } - test_field_lastlinedefined(); - fn test_field_nups() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nups) as usize - ptr as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(nups) - ) - ); - } - test_field_nups(); - fn test_field_nparams() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nparams) as usize - ptr as usize - }, - 53usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(nparams) - ) - ); - } - test_field_nparams(); - fn test_field_isvararg() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).isvararg) as usize - ptr as usize - }, - 54usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(isvararg) - ) - ); - } - test_field_isvararg(); - fn test_field_istailcall() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).istailcall) as usize - ptr as usize - }, - 55usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(istailcall) - ) - ); - } - test_field_istailcall(); - fn test_field_short_src() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).short_src) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(short_src) - ) - ); - } - test_field_short_src(); - fn test_field_i_ci() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).i_ci) as usize - ptr as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(i_ci) - ) - ); - } - test_field_i_ci(); +} +extern "C" { + pub fn lua_gethook(L: *mut lua_State) -> lua_Hook; +} +extern "C" { + pub fn lua_gethookmask(L: *mut lua_State) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lua_gethookcount(L: *mut lua_State) -> ::std::os::raw::c_int; } extern "C" { pub fn luaopen_base(L: *mut lua_State) -> ::std::os::raw::c_int; @@ -1258,779 +1895,6 @@ extern "C" { extern "C" { pub fn luaL_openlibs(L: *mut lua_State); } -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: ::std::os::raw::c_int, - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: ::std::os::raw::c_uint, - pub __wchb: [::std::os::raw::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - fn test_field___wch() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t__bindgen_ty_1>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - } - test_field___wch(); - fn test_field___wchb() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t__bindgen_ty_1>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); - } - test_field___wchb(); -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::std::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - fn test_field___count() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - } - test_field___count(); - fn test_field___value() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); - } - test_field___value(); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::std::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - fn test_field___pos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - } - test_field___pos(); - fn test_field___state() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); - } - test_field___state(); -} -pub type __fpos_t = _G_fpos_t; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::std::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - fn test_field___pos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos64_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - } - test_field___pos(); - fn test_field___state() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos64_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); - } - test_field___state(); -} -pub type __fpos64_t = _G_fpos64_t; -pub type __FILE = _IO_FILE; -pub type FILE = _IO_FILE; -#[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 _flags2: ::std::os::raw::c_int, - 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 __pad5: usize, - pub _mode: ::std::os::raw::c_int, - pub _unused2: [::std::os::raw::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::std::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::std::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - fn test_field__flags() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - } - test_field__flags(); - fn test_field__IO_read_ptr() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - } - test_field__IO_read_ptr(); - fn test_field__IO_read_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - } - test_field__IO_read_end(); - fn test_field__IO_read_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - } - test_field__IO_read_base(); - fn test_field__IO_write_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - } - test_field__IO_write_base(); - fn test_field__IO_write_ptr() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - } - test_field__IO_write_ptr(); - fn test_field__IO_write_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - } - test_field__IO_write_end(); - fn test_field__IO_buf_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - } - test_field__IO_buf_base(); - fn test_field__IO_buf_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - } - test_field__IO_buf_end(); - fn test_field__IO_save_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - } - test_field__IO_save_base(); - fn test_field__IO_backup_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - } - test_field__IO_backup_base(); - fn test_field__IO_save_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - } - test_field__IO_save_end(); - fn test_field__markers() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - } - test_field__markers(); - fn test_field__chain() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - } - test_field__chain(); - fn test_field__fileno() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - } - test_field__fileno(); - fn test_field__flags2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize - }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - } - test_field__flags2(); - fn test_field__old_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - } - test_field__old_offset(); - fn test_field__cur_column() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize - }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - } - test_field__cur_column(); - fn test_field__vtable_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize - }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - } - test_field__vtable_offset(); - fn test_field__shortbuf() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize - }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - } - test_field__shortbuf(); - fn test_field__lock() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize - }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - } - test_field__lock(); - fn test_field__offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - } - test_field__offset(); - fn test_field__codecvt() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize - }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - } - test_field__codecvt(); - fn test_field__wide_data() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize - }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - } - test_field__wide_data(); - fn test_field__freeres_list() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize - }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - } - test_field__freeres_list(); - fn test_field__freeres_buf() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize - }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - } - test_field__freeres_buf(); - fn test_field___pad5() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize - }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - } - test_field___pad5(); - fn test_field__mode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize - }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - } - test_field__mode(); - fn test_field__unused2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize - }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); - } - test_field__unused2(); -} -pub type off_t = __off_t; -pub type fpos_t = __fpos_t; extern "C" { pub static mut stdin: *mut FILE; } @@ -2443,7 +2307,7 @@ extern "C" { pub static mut sys_nerr: ::std::os::raw::c_int; } extern "C" { - pub static mut sys_errlist: [*const ::std::os::raw::c_char; 0usize]; + pub static sys_errlist: [*const ::std::os::raw::c_char; 0usize]; } extern "C" { pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; @@ -2478,59 +2342,6 @@ extern "C" { extern "C" { pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Reg { - pub name: *const ::std::os::raw::c_char, - pub func: lua_CFunction, -} -#[test] -fn bindgen_test_layout_luaL_Reg() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(luaL_Reg)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Reg)) - ); - fn test_field_name() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(name) - ) - ); - } - test_field_name(); - fn test_field_func() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(func) - ) - ); - } - test_field_func(); -} extern "C" { pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number, sz: usize); } @@ -2730,113 +2541,6 @@ extern "C" { glb: ::std::os::raw::c_int, ); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Buffer { - pub b: *mut ::std::os::raw::c_char, - pub size: usize, - pub n: usize, - pub L: *mut lua_State, - pub initb: [::std::os::raw::c_char; 8192usize], -} -#[test] -fn bindgen_test_layout_luaL_Buffer() { - assert_eq!( - ::std::mem::size_of::(), - 8224usize, - concat!("Size of: ", stringify!(luaL_Buffer)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Buffer)) - ); - fn test_field_b() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(b) - ) - ); - } - test_field_b(); - fn test_field_size() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(size) - ) - ); - } - test_field_size(); - fn test_field_n() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(n) - ) - ); - } - test_field_n(); - fn test_field_L() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).L) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(L) - ) - ); - } - test_field_L(); - fn test_field_initb() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).initb) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(initb) - ) - ); - } - test_field_initb(); -} extern "C" { pub fn luaL_buffinit(L: *mut lua_State, B: *mut luaL_Buffer); } @@ -2865,151 +2569,3 @@ extern "C" { sz: usize, ) -> *mut ::std::os::raw::c_char; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Stream { - pub f: *mut FILE, - pub closef: lua_CFunction, -} -#[test] -fn bindgen_test_layout_luaL_Stream() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(luaL_Stream)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Stream)) - ); - fn test_field_f() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Stream), - "::", - stringify!(f) - ) - ); - } - test_field_f(); - fn test_field_closef() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).closef) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Stream), - "::", - stringify!(closef) - ) - ); - } - test_field_closef(); -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: ::std::os::raw::c_uint, - pub fp_offset: ::std::os::raw::c_uint, - pub overflow_arg_area: *mut ::std::os::raw::c_void, - pub reg_save_area: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout___va_list_tag() { - assert_eq!( - ::std::mem::size_of::<__va_list_tag>(), - 24usize, - concat!("Size of: ", stringify!(__va_list_tag)) - ); - assert_eq!( - ::std::mem::align_of::<__va_list_tag>(), - 8usize, - concat!("Alignment of ", stringify!(__va_list_tag)) - ); - fn test_field_gp_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(gp_offset) - ) - ); - } - test_field_gp_offset(); - fn test_field_fp_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(fp_offset) - ) - ); - } - test_field_fp_offset(); - fn test_field_overflow_arg_area() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(overflow_arg_area) - ) - ); - } - test_field_overflow_arg_area(); - fn test_field_reg_save_area() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(reg_save_area) - ) - ); - } - test_field_reg_save_area(); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CallInfo { - pub _address: u8, -} diff --git a/crates/rlua-lua54-sys/Cargo.toml b/crates/rlua-lua54-sys/Cargo.toml index 43224c49..2b1c6a40 100644 --- a/crates/rlua-lua54-sys/Cargo.toml +++ b/crates/rlua-lua54-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rlua-lua54-sys" -version = "0.1.3" +version = "0.1.4" keywords = ["bindings", "lua"] categories = ["external-ffi-bindings"] description = "Bindings to lua's C API" diff --git a/crates/rlua-lua54-sys/build.rs b/crates/rlua-lua54-sys/build.rs index 47c7621d..0d9a182f 100644 --- a/crates/rlua-lua54-sys/build.rs +++ b/crates/rlua-lua54-sys/build.rs @@ -4,7 +4,7 @@ use std::env; use std::path::PathBuf; fn main() { - let lua_folder = "lua-5.4.3"; + let lua_folder = "lua-5.4.4"; let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/Makefile b/crates/rlua-lua54-sys/lua-5.4.4/Makefile similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/Makefile rename to crates/rlua-lua54-sys/lua-5.4.4/Makefile index fed75b3c..fef1af48 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/Makefile +++ b/crates/rlua-lua54-sys/lua-5.4.4/Makefile @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.4 -R= $V.3 +R= $V.4 # Targets start here. all: $(PLAT) diff --git a/crates/rlua-lua54-sys/lua-5.4.3/README b/crates/rlua-lua54-sys/lua-5.4.4/README similarity index 70% rename from crates/rlua-lua54-sys/lua-5.4.3/README rename to crates/rlua-lua54-sys/lua-5.4.4/README index ebd4db08..c394c698 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/README +++ b/crates/rlua-lua54-sys/lua-5.4.4/README @@ -1,5 +1,5 @@ -This is Lua 5.4.3, released on 15 Mar 2021. +This is Lua 5.4.4, released on 13 Jan 2022. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/contents.html b/crates/rlua-lua54-sys/lua-5.4.4/doc/contents.html similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/contents.html rename to crates/rlua-lua54-sys/lua-5.4.4/doc/contents.html index 7ecf1c7c..ab82eb4a 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/doc/contents.html +++ b/crates/rlua-lua54-sys/lua-5.4.4/doc/contents.html @@ -32,7 +32,7 @@

-Copyright © 2020–2021 Lua.org, PUC-Rio. +Copyright © 2020–2022 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -664,10 +664,10 @@

constants

diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/index.css b/crates/rlua-lua54-sys/lua-5.4.4/doc/index.css similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/index.css rename to crates/rlua-lua54-sys/lua-5.4.4/doc/index.css diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/logo.gif b/crates/rlua-lua54-sys/lua-5.4.4/doc/logo.gif similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/logo.gif rename to crates/rlua-lua54-sys/lua-5.4.4/doc/logo.gif diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/lua.1 b/crates/rlua-lua54-sys/lua-5.4.4/doc/lua.1 similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/lua.1 rename to crates/rlua-lua54-sys/lua-5.4.4/doc/lua.1 diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/lua.css b/crates/rlua-lua54-sys/lua-5.4.4/doc/lua.css similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/lua.css rename to crates/rlua-lua54-sys/lua-5.4.4/doc/lua.css diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/luac.1 b/crates/rlua-lua54-sys/lua-5.4.4/doc/luac.1 similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/luac.1 rename to crates/rlua-lua54-sys/lua-5.4.4/doc/luac.1 diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/manual.css b/crates/rlua-lua54-sys/lua-5.4.4/doc/manual.css similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/manual.css rename to crates/rlua-lua54-sys/lua-5.4.4/doc/manual.css diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/manual.html b/crates/rlua-lua54-sys/lua-5.4.4/doc/manual.html similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/manual.html rename to crates/rlua-lua54-sys/lua-5.4.4/doc/manual.html index b7f5d719..61a8220d 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/doc/manual.html +++ b/crates/rlua-lua54-sys/lua-5.4.4/doc/manual.html @@ -19,7 +19,7 @@

-Copyright © 2020–2021 Lua.org, PUC-Rio. +Copyright © 2020–2022 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -961,11 +961,8 @@

2.5.3 – Garbage-Collection Metamethods

-Finalizers cannot yield. -Except for that, they can do anything, -such as raise errors, create new objects, -or even run the garbage collector. -However, because they can run in unpredictable times, +Finalizers cannot yield nor run the garbage collector. +Because they can run in unpredictable times, it is good practice to restrict each finalizer to the minimum necessary to properly release its associated resource. @@ -1636,8 +1633,10 @@

3.3.3 – Assignment

-The assignment statement first evaluates all its expressions -and only then the assignments are performed. +If a variable is both assigned and read +inside a multiple assignment, +Lua ensures all reads get the value of the variable +before the assignment. Thus the code

@@ -1661,6 +1660,14 @@ 

3.3.3 – Assignment

cyclically permutes the values of x, y, and z. +

+Note that this guarantee covers only accesses +syntactically inside the assignment statement. +If a function or a metamethod called during the assignment +changes the value of a variable, +Lua gives no guarantees about the order of that access. + +

An assignment to a global name x = val is equivalent to the assignment @@ -2416,16 +2423,21 @@

3.4.7 – The Length Operator

The length operator applied on a table returns a border in that table. -A border in a table t is any natural number +A border in a table t is any non-negative integer that satisfies the following condition:

-     (border == 0 or t[border] ~= nil) and t[border + 1] == nil
+     (border == 0 or t[border] ~= nil) and
+     (t[border + 1] == nil or border == math.maxinteger)
 

In words, -a border is any (natural) index present in the table -that is followed by an absent index -(or zero, when index 1 is absent). +a border is any positive integer index present in the table +that is followed by an absent index, +plus two limit cases: +zero, when index 1 is absent; +and the maximum value for an integer, when that index is present. +Note that keys that are not positive integers +do not interfere with borders.

@@ -2436,12 +2448,9 @@

3.4.7 – The Length Operator

and therefore it is not a sequence. (The nil at index 4 is called a hole.) The table {nil, 20, 30, nil, nil, 60, nil} -has three borders (0, 3, and 6) and three holes -(at indices 1, 4, and 5), +has three borders (0, 3, and 6), so it is not a sequence, too. The table {} is a sequence with border 0. -Note that non-natural keys do not interfere -with whether a table is a sequence.

@@ -2459,7 +2468,7 @@

3.4.7 – The Length Operator

The computation of the length of a table has a guaranteed worst time of O(log n), -where n is the largest natural key in the table. +where n is the largest integer key in the table.

@@ -3979,6 +3988,10 @@

4.6 – Functions and Types

see collectgarbage. +

+This function should not be called by a finalizer. + + @@ -5933,7 +5946,10 @@

4.7 – The Debug Interface

lua_getstack fills only the private part of this structure, for later use. To fill the other fields of lua_Debug with useful information, -you must call lua_getinfo. +you must call lua_getinfo with an appropriate parameter. +(Specifically, to get a field, +you must add the letter between parentheses in the field's comment +to the parameter what of lua_getinfo.)

@@ -6110,11 +6126,25 @@

4.7 – The Debug Interface

Each character in the string what selects some fields of the structure ar to be filled or -a value to be pushed on the stack: +a value to be pushed on the stack. +(These characters are also documented in the declaration of +the structure lua_Debug, +between parentheses in the comments following each field.)

    -
  • 'n': fills in the field name and namewhat; +
  • 'f': +pushes onto the stack the function that is +running at the given level; +
  • + +
  • 'l': fills in the field currentline; +
  • + +
  • 'n': fills in the fields name and namewhat; +
  • + +
  • 'r': fills in the fields ftransfer and ntransfer;
  • 'S': @@ -6122,9 +6152,6 @@

    4.7 – The Debug Interface

    linedefined, lastlinedefined, and what;
  • -
  • 'l': fills in the field currentline; -
  • -
  • 't': fills in the field istailcall;
  • @@ -6132,25 +6159,13 @@

    4.7 – The Debug Interface

    nups, nparams, and isvararg; -
  • 'f': -pushes onto the stack the function that is -running at the given level; -
  • -
  • 'L': -pushes onto the stack a table whose indices are the -numbers of the lines that are valid on the function. -(A valid line is a line with some associated code, -that is, a line where you can put a break point. -Non-valid lines include empty lines and comments.) - - -

    +pushes onto the stack a table whose indices are +the lines on the function with some associated code, +that is, the lines where you can put a break point. +(Lines with no code include empty lines and comments.) If this option is given together with option 'f', its table is pushed after the function. - - -

    This is the only option that can raise a memory error.

  • @@ -6508,7 +6523,7 @@

    5.1 – Functions and Types


    luaL_addgsub

    -[-0, +0, m] +[-?, +?, m]

    const void luaL_addgsub (luaL_Buffer *B, const char *s,
                              const char *p, const char *r);
    @@ -6562,7 +6577,7 @@

    5.1 – Functions and Types


    luaL_addvalue

    -[-1, +?, m] +[-?, +?, m]

    void luaL_addvalue (luaL_Buffer *B);

    @@ -6716,7 +6731,7 @@

    5.1 – Functions and Types


    luaL_buffinit

    -[-0, +0, –] +[-0, +?, –]

    void luaL_buffinit (lua_State *L, luaL_Buffer *B);

    @@ -6754,7 +6769,7 @@

    5.1 – Functions and Types


    luaL_buffsub

    -[-0, +0, –] +[-?, +?, –]

    void luaL_buffsub (luaL_Buffer *B, int n);

    @@ -7557,6 +7572,11 @@

    5.1 – Functions and Types

    These values are popped from the stack after the registration. +

    +A function with a NULL value represents a placeholder, +which is filled with false. + + @@ -7919,6 +7939,10 @@

    6.1 – Basic Functions

    and some of these options. +

    +This function should not be called by a finalizer. + +

    @@ -7936,7 +7960,7 @@

    6.1 – Basic Functions


    error (message [, level])

    -Raises an error (see §2.3) with @{message} as the error object. +Raises an error (see §2.3) with message as the error object. This function never returns. @@ -8111,9 +8135,8 @@

    6.1 – Basic Functions

    -The behavior of next is undefined if, -during the traversal, -you assign any value to a non-existent field in the table. +You should not assign any value to a non-existent field in a table +during its traversal. You may however modify existing fields. In particular, you may set existing fields to nil. @@ -8159,7 +8182,7 @@

    6.1 – Basic Functions

    instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), -which is true if the call succeeds without errors. +which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error object. @@ -8439,7 +8462,7 @@

    6.2 – Coroutine Manipulation

    -Returns true when the coroutine co can yield. +Returns true when the coroutine co can yield. The default for co is the running coroutine. @@ -8483,7 +8506,7 @@

    6.2 – Coroutine Manipulation

    Returns the running coroutine plus a boolean, -true when the running coroutine is the main one. +true when the running coroutine is the main one. @@ -9021,7 +9044,7 @@

    6.4 – String Manipulation

    A third, optional numeric argument init specifies where to start the search; its default value is 1 and can be negative. -A value of true as a fourth, optional argument plain +A true as a fourth, optional argument plain turns off the pattern matching facilities, so the function does a plain "find substring" operation, with no characters in pattern being considered magic. @@ -9046,8 +9069,10 @@

    6.4 – String Manipulation

    which must be a string. The format string follows the same rules as the ISO C function sprintf. The only differences are that the conversion specifiers and modifiers -*, h, L, l, and n are not supported +F, n, *, h, L, and l are not supported and that there is an extra specifier, q. +Both width and precision, when present, +are limited to two digits.

    @@ -9071,7 +9096,7 @@

    6.4 – String Manipulation

    "a string with \"quotes\" and \ new line"

-This specifier does not support modifiers (flags, width, length). +This specifier does not support modifiers (flags, width, precision).

@@ -10362,7 +10387,7 @@

6.7 – Mathematical Functions

Returns a boolean, -true if and only if integer m is below integer n when +true if and only if integer m is below integer n when they are compared as unsigned integers. @@ -11924,10 +11949,10 @@

9 – The Complete Syntax of Lua

diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/osi-certified-72x60.png b/crates/rlua-lua54-sys/lua-5.4.4/doc/osi-certified-72x60.png similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/osi-certified-72x60.png rename to crates/rlua-lua54-sys/lua-5.4.4/doc/osi-certified-72x60.png diff --git a/crates/rlua-lua54-sys/lua-5.4.3/doc/readme.html b/crates/rlua-lua54-sys/lua-5.4.4/doc/readme.html similarity index 98% rename from crates/rlua-lua54-sys/lua-5.4.3/doc/readme.html rename to crates/rlua-lua54-sys/lua-5.4.4/doc/readme.html index f9aef58e..8afe38de 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/doc/readme.html +++ b/crates/rlua-lua54-sys/lua-5.4.4/doc/readme.html @@ -110,7 +110,7 @@

Building Lua

  1. Open a terminal window and move to -the top-level directory, which is named lua-5.4.3. +the top-level directory, which is named lua-5.4.4. The Makefile there controls both the build process and the installation process.

  2. @@ -303,7 +303,7 @@

    License

    this.
    -Copyright © 1994–2021 Lua.org, PUC-Rio. +Copyright © 1994–2022 Lua.org, PUC-Rio.

    Permission is hereby granted, free of charge, to any person obtaining a copy @@ -330,10 +330,10 @@

    License

    diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/Makefile b/crates/rlua-lua54-sys/lua-5.4.4/src/Makefile similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/Makefile rename to crates/rlua-lua54-sys/lua-5.4.4/src/Makefile index f78c0b83..1907381f 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/Makefile +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/Makefile @@ -79,7 +79,7 @@ echo: @echo "PLAT= $(PLAT)" @echo "CC= $(CC)" @echo "CFLAGS= $(CFLAGS)" - @echo "LDFLAGS= $(SYSLDFLAGS)" + @echo "LDFLAGS= $(LDFLAGS)" @echo "LIBS= $(LIBS)" @echo "AR= $(AR)" @echo "RANLIB= $(RANLIB)" diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lapi.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lapi.c similarity index 96% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lapi.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lapi.c index f8f70cd0..5ee65792 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lapi.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lapi.c @@ -53,6 +53,10 @@ const char lua_ident[] = #define isupvalue(i) ((i) < LUA_REGISTRYINDEX) +/* +** Convert an acceptable index to a pointer to its respective value. +** Non-valid indices return the special nil value 'G(L)->nilvalue'. +*/ static TValue *index2value (lua_State *L, int idx) { CallInfo *ci = L->ci; if (idx > 0) { @@ -70,22 +74,28 @@ static TValue *index2value (lua_State *L, int idx) { else { /* upvalues */ idx = LUA_REGISTRYINDEX - idx; api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); - if (ttislcf(s2v(ci->func))) /* light C function? */ - return &G(L)->nilvalue; /* it has no upvalues */ - else { + if (ttisCclosure(s2v(ci->func))) { /* C closure? */ CClosure *func = clCvalue(s2v(ci->func)); return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : &G(L)->nilvalue; } + else { /* light C function or Lua function (through a hook)?) */ + api_check(L, ttislcf(s2v(ci->func)), "caller not a C function"); + return &G(L)->nilvalue; /* no upvalues */ + } } } -static StkId index2stack (lua_State *L, int idx) { + +/* +** Convert a valid actual index (not a pseudo-index) to its address. +*/ +l_sinline StkId index2stack (lua_State *L, int idx) { CallInfo *ci = L->ci; if (idx > 0) { StkId o = ci->func + idx; - api_check(L, o < L->top, "unacceptable index"); + api_check(L, o < L->top, "invalid index"); return o; } else { /* non-positive index */ @@ -218,7 +228,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) { ** Note that we move(copy) only the value inside the stack. ** (We do not move additional fields that may exist.) */ -static void reverse (lua_State *L, StkId from, StkId to) { +l_sinline void reverse (lua_State *L, StkId from, StkId to) { for (; from < to; from++, to--) { TValue temp; setobj(L, &temp, s2v(from)); @@ -438,7 +448,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { } -static void *touserdata (const TValue *o) { +l_sinline void *touserdata (const TValue *o) { switch (ttype(o)) { case LUA_TUSERDATA: return getudatamem(uvalue(o)); case LUA_TLIGHTUSERDATA: return pvalue(o); @@ -630,7 +640,7 @@ LUA_API int lua_pushthread (lua_State *L) { */ -static int auxgetstr (lua_State *L, const TValue *t, const char *k) { +l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) { const TValue *slot; TString *str = luaS_new(L, k); if (luaV_fastget(L, t, str, slot, luaH_getstr)) { @@ -705,7 +715,7 @@ LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { } -static int finishrawget (lua_State *L, const TValue *val) { +l_sinline int finishrawget (lua_State *L, const TValue *val) { if (isempty(val)) /* avoid copying empty items to the stack */ setnilvalue(s2v(L->top)); else @@ -1126,18 +1136,19 @@ LUA_API int lua_status (lua_State *L) { LUA_API int lua_gc (lua_State *L, int what, ...) { va_list argp; int res = 0; - global_State *g; + global_State *g = G(L); + if (g->gcstp & GCSTPGC) /* internal stop? */ + return -1; /* all options are invalid when stopped */ lua_lock(L); - g = G(L); va_start(argp, what); switch (what) { case LUA_GCSTOP: { - g->gcrunning = 0; + g->gcstp = GCSTPUSR; /* stopped by the user */ break; } case LUA_GCRESTART: { luaE_setdebt(g, 0); - g->gcrunning = 1; + g->gcstp = 0; /* (GCSTPGC must be already zero here) */ break; } case LUA_GCCOLLECT: { @@ -1156,8 +1167,8 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { case LUA_GCSTEP: { int data = va_arg(argp, int); l_mem debt = 1; /* =1 to signal that it did an actual step */ - lu_byte oldrunning = g->gcrunning; - g->gcrunning = 1; /* allow GC to run */ + lu_byte oldstp = g->gcstp; + g->gcstp = 0; /* allow GC to run (GCSTPGC must be zero here) */ if (data == 0) { luaE_setdebt(g, 0); /* do a basic step */ luaC_step(L); @@ -1167,7 +1178,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { luaE_setdebt(g, debt); luaC_checkGC(L); } - g->gcrunning = oldrunning; /* restore previous state */ + g->gcstp = oldstp; /* restore previous state */ if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ res = 1; /* signal it */ break; @@ -1185,7 +1196,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { break; } case LUA_GCISRUNNING: { - res = g->gcrunning; + res = gcrunning(g); break; } case LUA_GCGEN: { diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lapi.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lapi.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lapi.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lapi.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lauxlib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lauxlib.c similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lauxlib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lauxlib.c index 94835ef9..8ed1da11 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lauxlib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lauxlib.c @@ -881,6 +881,7 @@ LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { + idx = lua_absindex(L,idx); if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ if (!lua_isstring(L, -1)) luaL_error(L, "'__tostring' must return a string"); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lauxlib.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lauxlib.h similarity index 97% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lauxlib.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lauxlib.h index 72f70e7d..5b977e2a 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lauxlib.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lauxlib.h @@ -102,7 +102,7 @@ LUALIB_API lua_State *(luaL_newstate) (void); LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); -LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, +LUALIB_API void (luaL_addgsub) (luaL_Buffer *b, const char *s, const char *p, const char *r); LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, const char *r); @@ -154,6 +154,14 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, #define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) +/* +** Perform arithmetic operations on lua_Integer values with wrap-around +** semantics, as the Lua core does. +*/ +#define luaL_intop(op,v1,v2) \ + ((lua_Integer)((lua_Unsigned)(v1) op (lua_Unsigned)(v2))) + + /* push the value used to represent failure/error */ #define luaL_pushfail(L) lua_pushnil(L) diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lbaselib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lbaselib.c similarity index 94% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lbaselib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lbaselib.c index 83ad306d..1d60c9de 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lbaselib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lbaselib.c @@ -182,12 +182,20 @@ static int luaB_rawset (lua_State *L) { static int pushmode (lua_State *L, int oldmode) { - lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental" - : "generational"); + if (oldmode == -1) + luaL_pushfail(L); /* invalid call to 'lua_gc' */ + else + lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental" + : "generational"); return 1; } +/* +** check whether call to 'lua_gc' was valid (not inside a finalizer) +*/ +#define checkvalres(res) { if (res == -1) break; } + static int luaB_collectgarbage (lua_State *L) { static const char *const opts[] = {"stop", "restart", "collect", "count", "step", "setpause", "setstepmul", @@ -200,12 +208,14 @@ static int luaB_collectgarbage (lua_State *L) { case LUA_GCCOUNT: { int k = lua_gc(L, o); int b = lua_gc(L, LUA_GCCOUNTB); + checkvalres(k); lua_pushnumber(L, (lua_Number)k + ((lua_Number)b/1024)); return 1; } case LUA_GCSTEP: { int step = (int)luaL_optinteger(L, 2, 0); int res = lua_gc(L, o, step); + checkvalres(res); lua_pushboolean(L, res); return 1; } @@ -213,11 +223,13 @@ static int luaB_collectgarbage (lua_State *L) { case LUA_GCSETSTEPMUL: { int p = (int)luaL_optinteger(L, 2, 0); int previous = lua_gc(L, o, p); + checkvalres(previous); lua_pushinteger(L, previous); return 1; } case LUA_GCISRUNNING: { int res = lua_gc(L, o); + checkvalres(res); lua_pushboolean(L, res); return 1; } @@ -234,10 +246,13 @@ static int luaB_collectgarbage (lua_State *L) { } default: { int res = lua_gc(L, o); + checkvalres(res); lua_pushinteger(L, res); return 1; } } + luaL_pushfail(L); /* invalid call (inside a finalizer) */ + return 1; } @@ -261,6 +276,11 @@ static int luaB_next (lua_State *L) { } +static int pairscont (lua_State *L, int status, lua_KContext k) { + (void)L; (void)status; (void)k; /* unused */ + return 3; +} + static int luaB_pairs (lua_State *L) { luaL_checkany(L, 1); if (luaL_getmetafield(L, 1, "__pairs") == LUA_TNIL) { /* no metamethod? */ @@ -270,7 +290,7 @@ static int luaB_pairs (lua_State *L) { } else { lua_pushvalue(L, 1); /* argument 'self' to metamethod */ - lua_call(L, 1, 3); /* get 3 values from metamethod */ + lua_callk(L, 1, 3, 0, pairscont); /* get 3 values from metamethod */ } return 3; } @@ -280,7 +300,8 @@ static int luaB_pairs (lua_State *L) { ** Traversal function for 'ipairs' */ static int ipairsaux (lua_State *L) { - lua_Integer i = luaL_checkinteger(L, 2) + 1; + lua_Integer i = luaL_checkinteger(L, 2); + i = luaL_intop(+, i, 1); lua_pushinteger(L, i); return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; } diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lcode.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lcode.c similarity index 97% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lcode.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lcode.c index 80d975cb..06425a1d 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lcode.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lcode.c @@ -10,6 +10,7 @@ #include "lprefix.h" +#include #include #include #include @@ -580,24 +581,41 @@ static int stringK (FuncState *fs, TString *s) { /* ** Add an integer to list of constants and return its index. -** Integers use userdata as keys to avoid collision with floats with -** same value; conversion to 'void*' is used only for hashing, so there -** are no "precision" problems. */ static int luaK_intK (FuncState *fs, lua_Integer n) { - TValue k, o; - setpvalue(&k, cast_voidp(cast_sizet(n))); + TValue o; setivalue(&o, n); - return addk(fs, &k, &o); + return addk(fs, &o, &o); /* use integer itself as key */ } /* -** Add a float to list of constants and return its index. +** Add a float to list of constants and return its index. Floats +** with integral values need a different key, to avoid collision +** with actual integers. To that, we add to the number its smaller +** power-of-two fraction that is still significant in its scale. +** For doubles, that would be 1/2^52. +** (This method is not bulletproof: there may be another float +** with that value, and for floats larger than 2^53 the result is +** still an integer. At worst, this only wastes an entry with +** a duplicate.) */ static int luaK_numberK (FuncState *fs, lua_Number r) { TValue o; + lua_Integer ik; setfltvalue(&o, r); - return addk(fs, &o, &o); /* use number itself as key */ + if (!luaV_flttointeger(r, &ik, F2Ieq)) /* not an integral value? */ + return addk(fs, &o, &o); /* use number itself as key */ + else { /* must build an alternative key */ + const int nbm = l_floatatt(MANT_DIG); + const lua_Number q = l_mathop(ldexp)(l_mathop(1.0), -nbm + 1); + const lua_Number k = (ik == 0) ? q : r + r*q; /* new key */ + TValue kv; + setfltvalue(&kv, k); + /* result is not an integral value, unless value is too large */ + lua_assert(!luaV_flttointeger(k, &ik, F2Ieq) || + l_mathop(fabs)(r) >= l_mathop(1e6)); + return addk(fs, &kv, &o); + } } diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lcode.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lcode.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lcode.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lcode.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lcorolib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lcorolib.c similarity index 97% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lcorolib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lcorolib.c index fedbebec..785a1e81 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lcorolib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lcorolib.c @@ -78,7 +78,7 @@ static int luaB_auxwrap (lua_State *L) { if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ stat = lua_resetthread(co); /* close its tbc variables */ lua_assert(stat != LUA_OK); - lua_xmove(co, L, 1); /* copy error message */ + lua_xmove(co, L, 1); /* move error message to the caller */ } if (stat != LUA_ERRMEM && /* not a memory error and ... */ lua_type(L, -1) == LUA_TSTRING) { /* ... error object is a string? */ @@ -179,7 +179,7 @@ static int luaB_close (lua_State *L) { } else { lua_pushboolean(L, 0); - lua_xmove(co, L, 1); /* copy error message */ + lua_xmove(co, L, 1); /* move error message */ return 2; } } diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lctype.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lctype.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lctype.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lctype.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lctype.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lctype.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lctype.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lctype.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ldblib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ldblib.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ldblib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ldblib.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ldebug.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ldebug.c similarity index 91% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ldebug.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ldebug.c index 1feaab22..a716d95e 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/ldebug.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/ldebug.c @@ -34,8 +34,8 @@ #define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_VCCL) -static const char *funcnamefromcode (lua_State *L, CallInfo *ci, - const char **name); +static const char *funcnamefromcall (lua_State *L, CallInfo *ci, + const char **name); static int currentpc (CallInfo *ci) { @@ -64,7 +64,7 @@ static int getbaseline (const Proto *f, int pc, int *basepc) { } else { int i = cast_uint(pc) / MAXIWTHABS - 1; /* get an estimate */ - /* estimate must be a lower bond of the correct base */ + /* estimate must be a lower bound of the correct base */ lua_assert(i < 0 || (i < f->sizeabslineinfo && f->abslineinfo[i].pc <= pc)); while (i + 1 < f->sizeabslineinfo && pc >= f->abslineinfo[i + 1].pc) @@ -301,7 +301,14 @@ static void collectvalidlines (lua_State *L, Closure *f) { sethvalue2s(L, L->top, t); /* push it on stack */ api_incr_top(L); setbtvalue(&v); /* boolean 'true' to be the value of all indices */ - for (i = 0; i < p->sizelineinfo; i++) { /* for all instructions */ + if (!p->is_vararg) /* regular function? */ + i = 0; /* consider all instructions */ + else { /* vararg function */ + lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP); + currentline = nextline(p, currentline, 0); + i = 1; /* skip first instruction (OP_VARARGPREP) */ + } + for (; i < p->sizelineinfo; i++) { /* for each instruction */ currentline = nextline(p, currentline, i); /* get its line */ luaH_setint(L, t, currentline, &v); /* table[line] = true */ } @@ -310,15 +317,9 @@ static void collectvalidlines (lua_State *L, Closure *f) { static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { - if (ci == NULL) /* no 'ci'? */ - return NULL; /* no info */ - else if (ci->callstatus & CIST_FIN) { /* is this a finalizer? */ - *name = "__gc"; - return "metamethod"; /* report it as such */ - } - /* calling function is a known Lua function? */ - else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) - return funcnamefromcode(L, ci->previous, name); + /* calling function is a known function? */ + if (ci != NULL && !(ci->callstatus & CIST_TAIL)) + return funcnamefromcall(L, ci->previous, name); else return NULL; /* no way to find a name */ } @@ -590,16 +591,10 @@ static const char *getobjname (const Proto *p, int lastpc, int reg, ** Returns what the name is (e.g., "for iterator", "method", ** "metamethod") and sets '*name' to point to the name. */ -static const char *funcnamefromcode (lua_State *L, CallInfo *ci, - const char **name) { +static const char *funcnamefromcode (lua_State *L, const Proto *p, + int pc, const char **name) { TMS tm = (TMS)0; /* (initial value avoids warnings) */ - const Proto *p = ci_func(ci)->p; /* calling function */ - int pc = currentpc(ci); /* calling instruction index */ Instruction i = p->code[pc]; /* calling instruction */ - if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ - *name = "?"; - return "hook"; - } switch (GET_OPCODE(i)) { case OP_CALL: case OP_TAILCALL: @@ -636,6 +631,26 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci, return "metamethod"; } + +/* +** Try to find a name for a function based on how it was called. +*/ +static const char *funcnamefromcall (lua_State *L, CallInfo *ci, + const char **name) { + if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ + *name = "?"; + return "hook"; + } + else if (ci->callstatus & CIST_FIN) { /* was it called as a finalizer? */ + *name = "__gc"; + return "metamethod"; /* report it as such */ + } + else if (isLua(ci)) + return funcnamefromcode(L, ci_func(ci)->p, currentpc(ci), name); + else + return NULL; +} + /* }====================================================== */ @@ -675,9 +690,21 @@ static const char *getupvalname (CallInfo *ci, const TValue *o, } +static const char *formatvarinfo (lua_State *L, const char *kind, + const char *name) { + if (kind == NULL) + return ""; /* no information */ + else + return luaO_pushfstring(L, " (%s '%s')", kind, name); +} + +/* +** Build a string with a "description" for the value 'o', such as +** "variable 'x'" or "upvalue 'y'". +*/ static const char *varinfo (lua_State *L, const TValue *o) { - const char *name = NULL; /* to avoid warnings */ CallInfo *ci = L->ci; + const char *name = NULL; /* to avoid warnings */ const char *kind = NULL; if (isLua(ci)) { kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ @@ -685,26 +712,40 @@ static const char *varinfo (lua_State *L, const TValue *o) { kind = getobjname(ci_func(ci)->p, currentpc(ci), cast_int(cast(StkId, o) - (ci->func + 1)), &name); } - return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; + return formatvarinfo(L, kind, name); } -l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { +/* +** Raise a type error +*/ +static l_noret typeerror (lua_State *L, const TValue *o, const char *op, + const char *extra) { const char *t = luaT_objtypename(L, o); - luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o)); + luaG_runerror(L, "attempt to %s a %s value%s", op, t, extra); } +/* +** Raise a type error with "standard" information about the faulty +** object 'o' (using 'varinfo'). +*/ +l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + typeerror(L, o, op, varinfo(L, o)); +} + + +/* +** Raise an error for calling a non-callable object. Try to find a name +** for the object based on how it was called ('funcnamefromcall'); if it +** cannot get a name there, try 'varinfo'. +*/ l_noret luaG_callerror (lua_State *L, const TValue *o) { CallInfo *ci = L->ci; const char *name = NULL; /* to avoid warnings */ - const char *what = (isLua(ci)) ? funcnamefromcode(L, ci, &name) : NULL; - if (what != NULL) { - const char *t = luaT_objtypename(L, o); - luaG_runerror(L, "%s '%s' is not callable (a %s value)", what, name, t); - } - else - luaG_typeerror(L, o, "call"); + const char *kind = funcnamefromcall(L, ci, &name); + const char *extra = kind ? formatvarinfo(L, kind, name) : varinfo(L, o); + typeerror(L, o, "call", extra); } diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ldebug.h b/crates/rlua-lua54-sys/lua-5.4.4/src/ldebug.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ldebug.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/ldebug.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ldo.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ldo.c similarity index 90% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ldo.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ldo.c index 7135079b..a48e35f9 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/ldo.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/ldo.c @@ -387,15 +387,18 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) { ** stack, below original 'func', so that 'luaD_precall' can call it. Raise ** an error if there is no '__call' metafield. */ -void luaD_tryfuncTM (lua_State *L, StkId func) { - const TValue *tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); +StkId luaD_tryfuncTM (lua_State *L, StkId func) { + const TValue *tm; StkId p; + checkstackGCp(L, 1, func); /* space for metamethod */ + tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */ if (l_unlikely(ttisnil(tm))) luaG_callerror(L, s2v(func)); /* nothing to call */ for (p = L->top; p > func; p--) /* open space for metamethod */ setobjs2s(L, p, p-1); L->top++; /* stack space pre-allocated by the caller */ setobj2s(L, func, tm); /* metamethod is the new function to be called */ + return func; } @@ -405,7 +408,7 @@ void luaD_tryfuncTM (lua_State *L, StkId func) { ** expressions, multiple results for tail calls/single parameters) ** separated. */ -static void moveresults (lua_State *L, StkId res, int nres, int wanted) { +l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) { StkId firstresult; int i; switch (wanted) { /* handle typical cases separately */ @@ -473,27 +476,81 @@ void luaD_poscall (lua_State *L, CallInfo *ci, int nres) { #define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L)) +l_sinline CallInfo *prepCallInfo (lua_State *L, StkId func, int nret, + int mask, StkId top) { + CallInfo *ci = L->ci = next_ci(L); /* new frame */ + ci->func = func; + ci->nresults = nret; + ci->callstatus = mask; + ci->top = top; + return ci; +} + + +/* +** precall for C functions +*/ +l_sinline int precallC (lua_State *L, StkId func, int nresults, + lua_CFunction f) { + int n; /* number of returns */ + CallInfo *ci; + checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, + L->top + LUA_MINSTACK); + lua_assert(ci->top <= L->stack_last); + if (l_unlikely(L->hookmask & LUA_MASKCALL)) { + int narg = cast_int(L->top - func) - 1; + luaD_hook(L, LUA_HOOKCALL, -1, 1, narg); + } + lua_unlock(L); + n = (*f)(L); /* do the actual call */ + lua_lock(L); + api_checknelems(L, n); + luaD_poscall(L, ci, n); + return n; +} + + /* ** Prepare a function for a tail call, building its call info on top ** of the current call info. 'narg1' is the number of arguments plus 1 -** (so that it includes the function itself). +** (so that it includes the function itself). Return the number of +** results, if it was a C function, or -1 for a Lua function. */ -void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int narg1) { - Proto *p = clLvalue(s2v(func))->p; - int fsize = p->maxstacksize; /* frame size */ - int nfixparams = p->numparams; - int i; - for (i = 0; i < narg1; i++) /* move down function and arguments */ - setobjs2s(L, ci->func + i, func + i); - checkstackGC(L, fsize); - func = ci->func; /* moved-down function */ - for (; narg1 <= nfixparams; narg1++) - setnilvalue(s2v(func + narg1)); /* complete missing arguments */ - ci->top = func + 1 + fsize; /* top for new function */ - lua_assert(ci->top <= L->stack_last); - ci->u.l.savedpc = p->code; /* starting point */ - ci->callstatus |= CIST_TAIL; - L->top = func + narg1; /* set top */ +int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, + int narg1, int delta) { + retry: + switch (ttypetag(s2v(func))) { + case LUA_VCCL: /* C closure */ + return precallC(L, func, LUA_MULTRET, clCvalue(s2v(func))->f); + case LUA_VLCF: /* light C function */ + return precallC(L, func, LUA_MULTRET, fvalue(s2v(func))); + case LUA_VLCL: { /* Lua function */ + Proto *p = clLvalue(s2v(func))->p; + int fsize = p->maxstacksize; /* frame size */ + int nfixparams = p->numparams; + int i; + checkstackGCp(L, fsize - delta, func); + ci->func -= delta; /* restore 'func' (if vararg) */ + for (i = 0; i < narg1; i++) /* move down function and arguments */ + setobjs2s(L, ci->func + i, func + i); + func = ci->func; /* moved-down function */ + for (; narg1 <= nfixparams; narg1++) + setnilvalue(s2v(func + narg1)); /* complete missing arguments */ + ci->top = func + 1 + fsize; /* top for new function */ + lua_assert(ci->top <= L->stack_last); + ci->u.l.savedpc = p->code; /* starting point */ + ci->callstatus |= CIST_TAIL; + L->top = func + narg1; /* set top */ + return -1; + } + default: { /* not a function */ + func = luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */ + /* return luaD_pretailcall(L, ci, func, narg1 + 1, delta); */ + narg1++; + goto retry; /* try again */ + } + } } @@ -506,35 +563,14 @@ void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int narg1) { ** original function position. */ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { - lua_CFunction f; retry: switch (ttypetag(s2v(func))) { case LUA_VCCL: /* C closure */ - f = clCvalue(s2v(func))->f; - goto Cfunc; + precallC(L, func, nresults, clCvalue(s2v(func))->f); + return NULL; case LUA_VLCF: /* light C function */ - f = fvalue(s2v(func)); - Cfunc: { - int n; /* number of returns */ - CallInfo *ci; - checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ - L->ci = ci = next_ci(L); - ci->nresults = nresults; - ci->callstatus = CIST_C; - ci->top = L->top + LUA_MINSTACK; - ci->func = func; - lua_assert(ci->top <= L->stack_last); - if (l_unlikely(L->hookmask & LUA_MASKCALL)) { - int narg = cast_int(L->top - func) - 1; - luaD_hook(L, LUA_HOOKCALL, -1, 1, narg); - } - lua_unlock(L); - n = (*f)(L); /* do the actual call */ - lua_lock(L); - api_checknelems(L, n); - luaD_poscall(L, ci, n); + precallC(L, func, nresults, fvalue(s2v(func))); return NULL; - } case LUA_VLCL: { /* Lua function */ CallInfo *ci; Proto *p = clLvalue(s2v(func))->p; @@ -542,20 +578,16 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { int nfixparams = p->numparams; int fsize = p->maxstacksize; /* frame size */ checkstackGCp(L, fsize, func); - L->ci = ci = next_ci(L); - ci->nresults = nresults; + L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); ci->u.l.savedpc = p->code; /* starting point */ - ci->top = func + 1 + fsize; - ci->func = func; - L->ci = ci; for (; narg < nfixparams; narg++) setnilvalue(s2v(L->top++)); /* complete missing arguments */ lua_assert(ci->top <= L->stack_last); return ci; } default: { /* not a function */ - checkstackGCp(L, 1, func); /* space for metamethod */ - luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */ + func = luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */ + /* return luaD_precall(L, func, nresults); */ goto retry; /* try again with metamethod */ } } @@ -567,7 +599,7 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { ** number of recursive invocations in the C stack) or nyci (the same ** plus increment number of non-yieldable calls). */ -static void ccall (lua_State *L, StkId func, int nResults, int inc) { +l_sinline void ccall (lua_State *L, StkId func, int nResults, int inc) { CallInfo *ci; L->nCcalls += inc; if (l_unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) @@ -728,11 +760,10 @@ static void resume (lua_State *L, void *ud) { StkId firstArg = L->top - n; /* first argument */ CallInfo *ci = L->ci; if (L->status == LUA_OK) /* starting a coroutine? */ - ccall(L, firstArg - 1, LUA_MULTRET, 1); /* just call its body */ + ccall(L, firstArg - 1, LUA_MULTRET, 0); /* just call its body */ else { /* resuming from previous yield */ lua_assert(L->status == LUA_YIELD); L->status = LUA_OK; /* mark that it is running (again) */ - luaE_incCstack(L); /* control the C stack */ if (isLua(ci)) { /* yielded inside a hook? */ L->top = firstArg; /* discard arguments */ luaV_execute(L, ci); /* just continue running Lua code */ @@ -783,6 +814,9 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, else if (L->status != LUA_YIELD) /* ended with errors? */ return resume_error(L, "cannot resume dead coroutine", nargs); L->nCcalls = (from) ? getCcalls(from) : 0; + if (getCcalls(L) >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow", nargs); + L->nCcalls++; luai_userstateresume(L, nargs); api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); status = luaD_rawrunprotected(L, resume, &nargs); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ldo.h b/crates/rlua-lua54-sys/lua-5.4.4/src/ldo.h similarity index 93% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ldo.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/ldo.h index 6bf0ed86..911e67f6 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/ldo.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/ldo.h @@ -58,11 +58,11 @@ LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, int fTransfer, int nTransfer); LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); -LUAI_FUNC void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n); +LUAI_FUNC int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int narg1, int delta); LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nResults); LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); -LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func); +LUAI_FUNC StkId luaD_tryfuncTM (lua_State *L, StkId func); LUAI_FUNC int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status); LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t oldtop, ptrdiff_t ef); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ldump.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ldump.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ldump.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ldump.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lfunc.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lfunc.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lfunc.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lfunc.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lfunc.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lfunc.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lfunc.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lfunc.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lgc.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lgc.c similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lgc.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lgc.c index b360eed0..42a73d81 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lgc.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lgc.c @@ -906,18 +906,18 @@ static void GCTM (lua_State *L) { if (!notm(tm)) { /* is there a finalizer? */ int status; lu_byte oldah = L->allowhook; - int running = g->gcrunning; + int oldgcstp = g->gcstp; + g->gcstp |= GCSTPGC; /* avoid GC steps */ L->allowhook = 0; /* stop debug hooks during GC metamethod */ - g->gcrunning = 0; /* avoid GC steps */ setobj2s(L, L->top++, tm); /* push finalizer... */ setobj2s(L, L->top++, &v); /* ... and its argument */ L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ L->allowhook = oldah; /* restore hooks */ - g->gcrunning = running; /* restore state */ + g->gcstp = oldgcstp; /* restore state */ if (l_unlikely(status != LUA_OK)) { /* error while running __gc? */ - luaE_warnerror(L, "__gc metamethod"); + luaE_warnerror(L, "__gc"); L->top--; /* pops error object */ } } @@ -1011,7 +1011,8 @@ static void correctpointers (global_State *g, GCObject *o) { void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { global_State *g = G(L); if (tofinalize(o) || /* obj. is already marked... */ - gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ + gfasttm(g, mt, TM_GC) == NULL || /* or has no finalizer... */ + (g->gcstp & GCSTPCLS)) /* or closing state? */ return; /* nothing to be done */ else { /* move 'o' to 'finobj' list */ GCObject **p; @@ -1502,12 +1503,13 @@ static void deletelist (lua_State *L, GCObject *p, GCObject *limit) { */ void luaC_freeallobjects (lua_State *L) { global_State *g = G(L); + g->gcstp = GCSTPCLS; /* no extra finalizers after here */ luaC_changemode(L, KGC_INC); separatetobefnz(g, 1); /* separate all objects with finalizers */ lua_assert(g->finobj == NULL); callallpendingfinalizers(L); deletelist(L, g->allgc, obj2gco(g->mainthread)); - deletelist(L, g->finobj, NULL); + lua_assert(g->finobj == NULL); /* no new finalizers */ deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ lua_assert(g->strt.nuse == 0); } @@ -1647,6 +1649,7 @@ void luaC_runtilstate (lua_State *L, int statesmask) { } + /* ** Performs a basic incremental step. The debt and step size are ** converted from bytes to "units of work"; then the function loops @@ -1678,7 +1681,7 @@ static void incstep (lua_State *L, global_State *g) { void luaC_step (lua_State *L) { global_State *g = G(L); lua_assert(!g->gcemergency); - if (g->gcrunning) { /* running? */ + if (gcrunning(g)) { /* running? */ if(isdecGCmodegen(g)) genstep(L, g); else diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lgc.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lgc.h similarity index 95% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lgc.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lgc.h index 073e2a40..4a125634 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lgc.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lgc.h @@ -148,6 +148,16 @@ */ #define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0) + +/* +** Control when GC is running: +*/ +#define GCSTPUSR 1 /* bit true when GC stopped by user */ +#define GCSTPGC 2 /* bit true when GC stopped by itself */ +#define GCSTPCLS 4 /* bit true when closing Lua state */ +#define gcrunning(g) ((g)->gcstp == 0) + + /* ** Does one step of collection when debt becomes positive. 'pre'/'pos' ** allows some adjustments to be done only when needed. macro diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/linit.c b/crates/rlua-lua54-sys/lua-5.4.4/src/linit.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/linit.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/linit.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/liolib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/liolib.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/liolib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/liolib.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ljumptab.h b/crates/rlua-lua54-sys/lua-5.4.4/src/ljumptab.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ljumptab.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/ljumptab.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/llex.c b/crates/rlua-lua54-sys/lua-5.4.4/src/llex.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/llex.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/llex.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/llex.h b/crates/rlua-lua54-sys/lua-5.4.4/src/llex.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/llex.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/llex.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/llimits.h b/crates/rlua-lua54-sys/lua-5.4.4/src/llimits.h similarity index 96% rename from crates/rlua-lua54-sys/lua-5.4.3/src/llimits.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/llimits.h index 025f1c82..52a32f92 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/llimits.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/llimits.h @@ -165,6 +165,20 @@ typedef LUAI_UACINT l_uacInt; #endif +/* +** Inline functions +*/ +#if !defined(LUA_USE_C89) +#define l_inline inline +#elif defined(__GNUC__) +#define l_inline __inline__ +#else +#define l_inline /* empty */ +#endif + +#define l_sinline static l_inline + + /* ** type for virtual-machine instructions; ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) @@ -347,7 +361,7 @@ typedef l_uint32 Instruction; #define condchangemem(L,pre,pos) ((void)0) #else #define condchangemem(L,pre,pos) \ - { if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } } + { if (gcrunning(G(L))) { pre; luaC_fullgc(L, 0); pos; } } #endif #endif diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lmathlib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lmathlib.c similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lmathlib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lmathlib.c index 5f5983a4..e0c61a16 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lmathlib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lmathlib.c @@ -475,7 +475,7 @@ static lua_Number I2d (Rand64 x) { /* 2^(-FIGS) = 1.0 / 2^30 / 2^3 / 2^(FIGS-33) */ #define scaleFIG \ - ((lua_Number)1.0 / (UONE << 30) / 8.0 / (UONE << (FIGS - 33))) + (l_mathop(1.0) / (UONE << 30) / l_mathop(8.0) / (UONE << (FIGS - 33))) /* ** use FIGS - 32 bits from lower half, throwing out the other @@ -486,7 +486,7 @@ static lua_Number I2d (Rand64 x) { /* ** higher 32 bits go after those (FIGS - 32) bits: shiftHI = 2^(FIGS - 32) */ -#define shiftHI ((lua_Number)(UONE << (FIGS - 33)) * 2.0) +#define shiftHI ((lua_Number)(UONE << (FIGS - 33)) * l_mathop(2.0)) static lua_Number I2d (Rand64 x) { diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lmem.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lmem.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lmem.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lmem.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lmem.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lmem.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lmem.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lmem.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/loadlib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/loadlib.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/loadlib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/loadlib.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lobject.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lobject.c similarity index 98% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lobject.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lobject.c index 0e504be0..301aa900 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lobject.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lobject.c @@ -164,7 +164,7 @@ static int isneg (const char **s) { */ static lua_Number lua_strx2number (const char *s, char **endptr) { int dot = lua_getlocaledecpoint(); - lua_Number r = 0.0; /* result (accumulator) */ + lua_Number r = l_mathop(0.0); /* result (accumulator) */ int sigdig = 0; /* number of significant digits */ int nosigdig = 0; /* number of non-significant digits */ int e = 0; /* exponent correction */ @@ -174,7 +174,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ neg = isneg(&s); /* check sign */ if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ - return 0.0; /* invalid format (no '0x') */ + return l_mathop(0.0); /* invalid format (no '0x') */ for (s += 2; ; s++) { /* skip '0x' and read numeral */ if (*s == dot) { if (hasdot) break; /* second dot? stop loop */ @@ -184,14 +184,14 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ nosigdig++; else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ - r = (r * cast_num(16.0)) + luaO_hexavalue(*s); + r = (r * l_mathop(16.0)) + luaO_hexavalue(*s); else e++; /* too many digits; ignore, but still count for exponent */ if (hasdot) e--; /* decimal digit? correct exponent */ } else break; /* neither a dot nor a digit */ } if (nosigdig + sigdig == 0) /* no digits? */ - return 0.0; /* invalid format */ + return l_mathop(0.0); /* invalid format */ *endptr = cast_charp(s); /* valid up to here */ e *= 4; /* each digit multiplies/divides value by 2^4 */ if (*s == 'p' || *s == 'P') { /* exponent part? */ @@ -200,7 +200,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { s++; /* skip 'p' */ neg1 = isneg(&s); /* sign */ if (!lisdigit(cast_uchar(*s))) - return 0.0; /* invalid; must have at least one digit */ + return l_mathop(0.0); /* invalid; must have at least one digit */ while (lisdigit(cast_uchar(*s))) /* read exponent */ exp1 = exp1 * 10 + *(s++) - '0'; if (neg1) exp1 = -exp1; diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lobject.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lobject.h similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lobject.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lobject.h index 950bebbd..0e05b3e4 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lobject.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lobject.h @@ -68,7 +68,7 @@ typedef struct TValue { #define val_(o) ((o)->value_) -#define valraw(o) (&val_(o)) +#define valraw(o) (val_(o)) /* raw type tag of a TValue */ @@ -112,7 +112,7 @@ typedef struct TValue { #define settt_(o,t) ((o)->tt_=(t)) -/* main macro to copy values (from 'obj1' to 'obj2') */ +/* main macro to copy values (from 'obj2' to 'obj1') */ #define setobj(L,obj1,obj2) \ { TValue *io1=(obj1); const TValue *io2=(obj2); \ io1->value_ = io2->value_; settt_(io1, io2->tt_); \ diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lopcodes.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lopcodes.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lopcodes.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lopcodes.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lopcodes.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lopcodes.h similarity index 94% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lopcodes.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lopcodes.h index d6a47e5a..7c274515 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lopcodes.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lopcodes.h @@ -190,7 +190,8 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ /* -** grep "ORDER OP" if you change these enums +** Grep "ORDER OP" if you change these enums. Opcodes marked with a (*) +** has extra descriptions in the notes after the enumeration. */ typedef enum { @@ -203,7 +204,7 @@ OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */ OP_LOADK,/* A Bx R[A] := K[Bx] */ OP_LOADKX,/* A R[A] := K[extra arg] */ OP_LOADFALSE,/* A R[A] := false */ -OP_LFALSESKIP,/*A R[A] := false; pc++ */ +OP_LFALSESKIP,/*A R[A] := false; pc++ (*) */ OP_LOADTRUE,/* A R[A] := true */ OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */ OP_GETUPVAL,/* A B R[A] := UpValue[B] */ @@ -254,7 +255,7 @@ OP_BXOR,/* A B C R[A] := R[B] ~ R[C] */ OP_SHL,/* A B C R[A] := R[B] << R[C] */ OP_SHR,/* A B C R[A] := R[B] >> R[C] */ -OP_MMBIN,/* A B C call C metamethod over R[A] and R[B] */ +OP_MMBIN,/* A B C call C metamethod over R[A] and R[B] (*) */ OP_MMBINI,/* A sB C k call C metamethod over R[A] and sB */ OP_MMBINK,/* A B C k call C metamethod over R[A] and K[B] */ @@ -280,7 +281,7 @@ OP_GTI,/* A sB k if ((R[A] > sB) ~= k) then pc++ */ OP_GEI,/* A sB k if ((R[A] >= sB) ~= k) then pc++ */ OP_TEST,/* A k if (not R[A] == k) then pc++ */ -OP_TESTSET,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] */ +OP_TESTSET,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] (*) */ OP_CALL,/* A B C R[A], ... ,R[A+C-2] := R[A](R[A+1], ... ,R[A+B-1]) */ OP_TAILCALL,/* A B C k return R[A](R[A+1], ... ,R[A+B-1]) */ @@ -315,6 +316,18 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ /*=========================================================================== Notes: + + (*) Opcode OP_LFALSESKIP is used to convert a condition to a boolean + value, in a code equivalent to (not cond ? false : true). (It + produces false and skips the next instruction producing true.) + + (*) Opcodes OP_MMBIN and variants follow each arithmetic and + bitwise opcode. If the operation succeeds, it skips this next + opcode. Otherwise, this opcode calls the corresponding metamethod. + + (*) Opcode OP_TESTSET is used in short-circuit expressions that need + both to jump and to produce a value, such as (a = b or c). + (*) In OP_CALL, if (B == 0) then B = top - A. If (C == 0), then 'top' is set to last_result+1, so next open instruction (OP_CALL, OP_RETURN*, OP_SETLIST) may use 'top'. diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lopnames.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lopnames.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lopnames.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lopnames.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/loslib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/loslib.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/loslib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/loslib.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lparser.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lparser.c similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lparser.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lparser.c index 284ef1f0..3abe3d75 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lparser.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lparser.c @@ -416,6 +416,17 @@ static void markupval (FuncState *fs, int level) { } +/* +** Mark that current block has a to-be-closed variable. +*/ +static void marktobeclosed (FuncState *fs) { + BlockCnt *bl = fs->bl; + bl->upval = 1; + bl->insidetbc = 1; + fs->needclose = 1; +} + + /* ** Find a variable with the given name 'n'. If it is an upvalue, add ** this upvalue into all intermediate functions. If it is a global, set @@ -1599,7 +1610,7 @@ static void forlist (LexState *ls, TString *indexname) { line = ls->linenumber; adjust_assign(ls, 4, explist(ls, &e), &e); adjustlocalvars(ls, 4); /* control variables */ - markupval(fs, fs->nactvar); /* last control var. must be closed */ + marktobeclosed(fs); /* last control var. must be closed */ luaK_checkstack(fs, 3); /* extra space to call generator */ forbody(ls, base, line, nvars - 4, 1); } @@ -1703,11 +1714,9 @@ static int getlocalattribute (LexState *ls) { } -static void checktoclose (LexState *ls, int level) { +static void checktoclose (FuncState *fs, int level) { if (level != -1) { /* is there a to-be-closed variable? */ - FuncState *fs = ls->fs; - markupval(fs, level + 1); - fs->bl->insidetbc = 1; /* in the scope of a to-be-closed variable */ + marktobeclosed(fs); luaK_codeABC(fs, OP_TBC, reglevel(fs, level), 0, 0); } } @@ -1751,7 +1760,7 @@ static void localstat (LexState *ls) { adjust_assign(ls, nvars, nexps, &e); adjustlocalvars(ls, nvars); } - checktoclose(ls, toclose); + checktoclose(fs, toclose); } @@ -1776,6 +1785,7 @@ static void funcstat (LexState *ls, int line) { luaX_next(ls); /* skip FUNCTION */ ismethod = funcname(ls, &v); body(ls, &b, ismethod, line); + check_readonly(ls, &v); luaK_storevar(ls->fs, &v, &b); luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ } diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lparser.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lparser.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lparser.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lparser.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lprefix.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lprefix.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lprefix.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lprefix.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lstate.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lstate.c similarity index 97% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lstate.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lstate.c index c5e3b437..1ffe1a0f 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lstate.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lstate.c @@ -166,7 +166,7 @@ void luaE_checkcstack (lua_State *L) { if (getCcalls(L) == LUAI_MAXCCALLS) luaG_runerror(L, "C stack overflow"); else if (getCcalls(L) >= (LUAI_MAXCCALLS / 10 * 11)) - luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + luaD_throw(L, LUA_ERRERR); /* error while handling stack error */ } @@ -236,7 +236,7 @@ static void f_luaopen (lua_State *L, void *ud) { luaS_init(L); luaT_init(L); luaX_init(L); - g->gcrunning = 1; /* allow gc */ + g->gcstp = 0; /* allow gc */ setnilvalue(&g->nilvalue); /* now state is complete */ luai_userstateopen(L); } @@ -269,8 +269,9 @@ static void preinit_thread (lua_State *L, global_State *g) { static void close_state (lua_State *L) { global_State *g = G(L); if (!completestate(g)) /* closing a partially built state? */ - luaC_freeallobjects(L); /* jucst collect its objects */ + luaC_freeallobjects(L); /* just collect its objects */ else { /* closing a fully built state */ + L->ci = &L->base_ci; /* unwind CallInfo list */ luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */ luaC_freeallobjects(L); /* collect all objects */ luai_userstateclose(L); @@ -330,13 +331,13 @@ int luaE_resetthread (lua_State *L, int status) { ci->callstatus = CIST_C; if (status == LUA_YIELD) status = LUA_OK; + L->status = LUA_OK; /* so it can run __close metamethods */ status = luaD_closeprotected(L, 1, status); if (status != LUA_OK) /* errors? */ luaD_seterrorobj(L, status, L->stack + 1); else L->top = L->stack + 1; ci->top = L->top + LUA_MINSTACK; - L->status = cast_byte(status); luaD_reallocstack(L, cast_int(ci->top - L->stack), 0); return status; } @@ -372,7 +373,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { g->ud_warn = NULL; g->mainthread = L; g->seed = luai_makeseed(L); - g->gcrunning = 0; /* no GC while building state */ + g->gcstp = GCSTPGC; /* no GC while building state */ g->strt.size = g->strt.nuse = 0; g->strt.hash = NULL; setnilvalue(&g->l_registry); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lstate.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lstate.h similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lstate.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lstate.h index c1283bb6..61e82cde 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lstate.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lstate.h @@ -165,7 +165,7 @@ typedef struct stringtable { ** - field 'nyield' is used only while a function is "doing" an ** yield (from the yield until the next resume); ** - field 'nres' is used only while closing tbc variables when -** returning from a C function; +** returning from a function; ** - field 'transferinfo' is used only during call/returnhooks, ** before the function starts or after it ends. */ @@ -209,7 +209,7 @@ typedef struct CallInfo { #define CIST_YPCALL (1<<4) /* doing a yieldable protected call */ #define CIST_TAIL (1<<5) /* call was tail called */ #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ -#define CIST_FIN (1<<7) /* call is running a finalizer */ +#define CIST_FIN (1<<7) /* function "called" a finalizer */ #define CIST_TRAN (1<<8) /* 'ci' has transfer information */ #define CIST_CLSRET (1<<9) /* function is closing tbc variables */ /* Bits 10-12 are used for CIST_RECST (see below) */ @@ -263,7 +263,7 @@ typedef struct global_State { lu_byte gcstopem; /* stops emergency collections */ lu_byte genminormul; /* control for minor generational collections */ lu_byte genmajormul; /* control for major generational collections */ - lu_byte gcrunning; /* true if GC is running */ + lu_byte gcstp; /* control whether GC is running */ lu_byte gcemergency; /* true if this is an emergency collection */ lu_byte gcpause; /* size of pause between successive GCs */ lu_byte gcstepmul; /* GC "speed" */ diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lstring.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lstring.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lstring.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lstring.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lstring.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lstring.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lstring.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lstring.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lstrlib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lstrlib.c similarity index 94% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lstrlib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lstrlib.c index 47e5b27a..0b4fdbb7 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lstrlib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lstrlib.c @@ -1090,13 +1090,31 @@ static int lua_number2strx (lua_State *L, char *buff, int sz, /* valid flags in a format specification */ -#if !defined(L_FMTFLAGS) -#define L_FMTFLAGS "-+ #0" +#if !defined(L_FMTFLAGSF) + +/* valid flags for a, A, e, E, f, F, g, and G conversions */ +#define L_FMTFLAGSF "-+#0 " + +/* valid flags for o, x, and X conversions */ +#define L_FMTFLAGSX "-#0" + +/* valid flags for d and i conversions */ +#define L_FMTFLAGSI "-+0 " + +/* valid flags for u conversions */ +#define L_FMTFLAGSU "-0" + +/* valid flags for c, p, and s conversions */ +#define L_FMTFLAGSC "-" + #endif /* -** maximum size of each format specification (such as "%-099.99d") +** Maximum size of each format specification (such as "%-099.99d"): +** Initial '%', flags (up to 5), width (2), period, precision (2), +** length modifier (8), conversion specifier, and final '\0', plus some +** extra. */ #define MAX_FORMAT 32 @@ -1189,25 +1207,53 @@ static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { } -static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { - const char *p = strfrmt; - while (*p != '\0' && strchr(L_FMTFLAGS, *p) != NULL) p++; /* skip flags */ - if ((size_t)(p - strfrmt) >= sizeof(L_FMTFLAGS)/sizeof(char)) - luaL_error(L, "invalid format (repeated flags)"); - if (isdigit(uchar(*p))) p++; /* skip width */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - if (*p == '.') { - p++; - if (isdigit(uchar(*p))) p++; /* skip precision */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ +static const char *get2digits (const char *s) { + if (isdigit(uchar(*s))) { + s++; + if (isdigit(uchar(*s))) s++; /* (2 digits at most) */ + } + return s; +} + + +/* +** Check whether a conversion specification is valid. When called, +** first character in 'form' must be '%' and last character must +** be a valid conversion specifier. 'flags' are the accepted flags; +** 'precision' signals whether to accept a precision. +*/ +static void checkformat (lua_State *L, const char *form, const char *flags, + int precision) { + const char *spec = form + 1; /* skip '%' */ + spec += strspn(spec, flags); /* skip flags */ + if (*spec != '0') { /* a width cannot start with '0' */ + spec = get2digits(spec); /* skip width */ + if (*spec == '.' && precision) { + spec++; + spec = get2digits(spec); /* skip precision */ + } } - if (isdigit(uchar(*p))) - luaL_error(L, "invalid format (width or precision too long)"); + if (!isalpha(uchar(*spec))) /* did not go to the end? */ + luaL_error(L, "invalid conversion specification: '%s'", form); +} + + +/* +** Get a conversion specification and copy it to 'form'. +** Return the address of its last character. +*/ +static const char *getformat (lua_State *L, const char *strfrmt, + char *form) { + /* spans flags, width, and precision ('0' is included as a flag) */ + size_t len = strspn(strfrmt, L_FMTFLAGSF "123456789."); + len++; /* adds following character (should be the specifier) */ + /* still needs space for '%', '\0', plus a length modifier */ + if (len >= MAX_FORMAT - 10) + luaL_error(L, "invalid format (too long)"); *(form++) = '%'; - memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char)); - form += (p - strfrmt) + 1; - *form = '\0'; - return p; + memcpy(form, strfrmt, len * sizeof(char)); + *(form + len) = '\0'; + return strfrmt + len - 1; } @@ -1230,6 +1276,7 @@ static int str_format (lua_State *L) { size_t sfl; const char *strfrmt = luaL_checklstring(L, arg, &sfl); const char *strfrmt_end = strfrmt+sfl; + const char *flags; luaL_Buffer b; luaL_buffinit(L, &b); while (strfrmt < strfrmt_end) { @@ -1239,25 +1286,35 @@ static int str_format (lua_State *L) { luaL_addchar(&b, *strfrmt++); /* %% */ else { /* format item */ char form[MAX_FORMAT]; /* to store the format ('%...') */ - int maxitem = MAX_ITEM; - char *buff = luaL_prepbuffsize(&b, maxitem); /* to put formatted item */ - int nb = 0; /* number of bytes in added item */ + int maxitem = MAX_ITEM; /* maximum length for the result */ + char *buff = luaL_prepbuffsize(&b, maxitem); /* to put result */ + int nb = 0; /* number of bytes in result */ if (++arg > top) return luaL_argerror(L, arg, "no value"); - strfrmt = scanformat(L, strfrmt, form); + strfrmt = getformat(L, strfrmt, form); switch (*strfrmt++) { case 'c': { + checkformat(L, form, L_FMTFLAGSC, 0); nb = l_sprintf(buff, maxitem, form, (int)luaL_checkinteger(L, arg)); break; } case 'd': case 'i': - case 'o': case 'u': case 'x': case 'X': { + flags = L_FMTFLAGSI; + goto intcase; + case 'u': + flags = L_FMTFLAGSU; + goto intcase; + case 'o': case 'x': case 'X': + flags = L_FMTFLAGSX; + intcase: { lua_Integer n = luaL_checkinteger(L, arg); + checkformat(L, form, flags, 1); addlenmod(form, LUA_INTEGER_FRMLEN); nb = l_sprintf(buff, maxitem, form, (LUAI_UACINT)n); break; } case 'a': case 'A': + checkformat(L, form, L_FMTFLAGSF, 1); addlenmod(form, LUA_NUMBER_FRMLEN); nb = lua_number2strx(L, buff, maxitem, form, luaL_checknumber(L, arg)); @@ -1268,12 +1325,14 @@ static int str_format (lua_State *L) { /* FALLTHROUGH */ case 'e': case 'E': case 'g': case 'G': { lua_Number n = luaL_checknumber(L, arg); + checkformat(L, form, L_FMTFLAGSF, 1); addlenmod(form, LUA_NUMBER_FRMLEN); nb = l_sprintf(buff, maxitem, form, (LUAI_UACNUMBER)n); break; } case 'p': { const void *p = lua_topointer(L, arg); + checkformat(L, form, L_FMTFLAGSC, 0); if (p == NULL) { /* avoid calling 'printf' with argument NULL */ p = "(null)"; /* result */ form[strlen(form) - 1] = 's'; /* format it as a string */ @@ -1294,7 +1353,8 @@ static int str_format (lua_State *L) { luaL_addvalue(&b); /* keep entire string */ else { luaL_argcheck(L, l == strlen(s), arg, "string contains zeros"); - if (!strchr(form, '.') && l >= 100) { + checkformat(L, form, L_FMTFLAGSC, 1); + if (strchr(form, '.') == NULL && l >= 100) { /* no precision and string is too long to be formatted */ luaL_addvalue(&b); /* keep entire string */ } @@ -1352,15 +1412,6 @@ static const union { } nativeendian = {1}; -/* dummy structure to get native alignment requirements */ -struct cD { - char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; -}; - -#define MAXALIGN (offsetof(struct cD, u)) - - /* ** information to pack/unpack stuff */ @@ -1435,6 +1486,8 @@ static void initheader (lua_State *L, Header *h) { ** Read and classify next option. 'size' is filled with option's size. */ static KOption getoption (Header *h, const char **fmt, int *size) { + /* dummy structure to get native alignment requirements */ + struct cD { char c; union { LUAI_MAXALIGN; } u; }; int opt = *((*fmt)++); *size = 0; /* default */ switch (opt) { @@ -1465,7 +1518,11 @@ static KOption getoption (Header *h, const char **fmt, int *size) { case '<': h->islittle = 1; break; case '>': h->islittle = 0; break; case '=': h->islittle = nativeendian.little; break; - case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; + case '!': { + const int maxalign = offsetof(struct cD, u); + h->maxalign = getnumlimit(h, fmt, maxalign); + break; + } default: luaL_error(h->L, "invalid format option '%c'", opt); } return Knop; diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ltable.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ltable.c similarity index 96% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ltable.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ltable.c index 33c1ab30..1b1cd241 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/ltable.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/ltable.c @@ -84,8 +84,6 @@ #define hashstr(t,str) hashpow2(t, (str)->hash) #define hashboolean(t,p) hashpow2(t, p) -#define hashint(t,i) hashpow2(t, i) - #define hashpointer(t,p) hashmod(t, point2uint(p)) @@ -101,6 +99,20 @@ static const Node dummynode_ = { static const TValue absentkey = {ABSTKEYCONSTANT}; +/* +** Hash for integers. To allow a good hash, use the remainder operator +** ('%'). If integer fits as a non-negative int, compute an int +** remainder, which is faster. Otherwise, use an unsigned-integer +** remainder, which uses all bits and ensures a non-negative result. +*/ +static Node *hashint (const Table *t, lua_Integer i) { + lua_Unsigned ui = l_castS2U(i); + if (ui <= (unsigned int)INT_MAX) + return hashmod(t, cast_int(ui)); + else + return hashmod(t, ui); +} + /* ** Hash for floating-point numbers. @@ -134,26 +146,24 @@ static int l_hashfloat (lua_Number n) { /* ** returns the 'main' position of an element in a table (that is, -** the index of its hash value). The key comes broken (tag in 'ktt' -** and value in 'vkl') so that we can call it on keys inserted into -** nodes. +** the index of its hash value). */ -static Node *mainposition (const Table *t, int ktt, const Value *kvl) { - switch (withvariant(ktt)) { +static Node *mainpositionTV (const Table *t, const TValue *key) { + switch (ttypetag(key)) { case LUA_VNUMINT: { - lua_Integer key = ivalueraw(*kvl); - return hashint(t, key); + lua_Integer i = ivalue(key); + return hashint(t, i); } case LUA_VNUMFLT: { - lua_Number n = fltvalueraw(*kvl); + lua_Number n = fltvalue(key); return hashmod(t, l_hashfloat(n)); } case LUA_VSHRSTR: { - TString *ts = tsvalueraw(*kvl); + TString *ts = tsvalue(key); return hashstr(t, ts); } case LUA_VLNGSTR: { - TString *ts = tsvalueraw(*kvl); + TString *ts = tsvalue(key); return hashpow2(t, luaS_hashlongstr(ts)); } case LUA_VFALSE: @@ -161,26 +171,25 @@ static Node *mainposition (const Table *t, int ktt, const Value *kvl) { case LUA_VTRUE: return hashboolean(t, 1); case LUA_VLIGHTUSERDATA: { - void *p = pvalueraw(*kvl); + void *p = pvalue(key); return hashpointer(t, p); } case LUA_VLCF: { - lua_CFunction f = fvalueraw(*kvl); + lua_CFunction f = fvalue(key); return hashpointer(t, f); } default: { - GCObject *o = gcvalueraw(*kvl); + GCObject *o = gcvalue(key); return hashpointer(t, o); } } } -/* -** Returns the main position of an element given as a 'TValue' -*/ -static Node *mainpositionTV (const Table *t, const TValue *key) { - return mainposition(t, rawtt(key), valraw(key)); +l_sinline Node *mainpositionfromnode (const Table *t, Node *nd) { + TValue key; + getnodekey(cast(lua_State *, NULL), &key, nd); + return mainpositionTV(t, &key); } @@ -679,7 +688,7 @@ void luaH_newkey (lua_State *L, Table *t, const TValue *key, TValue *value) { return; } lua_assert(!isdummy(t)); - othern = mainposition(t, keytt(mp), &keyval(mp)); + othern = mainpositionfromnode(t, mp); if (othern != mp) { /* is colliding node out of its main position? */ /* yes; move colliding node into free position */ while (othern + gnext(othern) != mp) /* find previous */ diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ltable.h b/crates/rlua-lua54-sys/lua-5.4.4/src/ltable.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ltable.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/ltable.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ltablib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ltablib.c similarity index 98% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ltablib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ltablib.c index d80eb801..868d78fd 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/ltablib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/ltablib.c @@ -59,8 +59,9 @@ static void checktab (lua_State *L, int arg, int what) { static int tinsert (lua_State *L) { - lua_Integer e = aux_getn(L, 1, TAB_RW) + 1; /* first empty element */ lua_Integer pos; /* where to insert new element */ + lua_Integer e = aux_getn(L, 1, TAB_RW); + e = luaL_intop(+, e, 1); /* first empty element */ switch (lua_gettop(L)) { case 2: { /* called with only 2 arguments */ pos = e; /* insert new element at the end */ @@ -147,7 +148,7 @@ static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) { lua_geti(L, 1, i); if (l_unlikely(!lua_isstring(L, -1))) luaL_error(L, "invalid value (%s) at index %I in table for 'concat'", - luaL_typename(L, -1), i); + luaL_typename(L, -1), (LUAI_UACINT)i); luaL_addvalue(b); } diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ltm.c b/crates/rlua-lua54-sys/lua-5.4.4/src/ltm.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ltm.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/ltm.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/ltm.h b/crates/rlua-lua54-sys/lua-5.4.4/src/ltm.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/ltm.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/ltm.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lua.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lua.c similarity index 94% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lua.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lua.c index 46b48dba..0f190044 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lua.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lua.c @@ -89,14 +89,15 @@ static void print_usage (const char *badoption) { lua_writestringerror( "usage: %s [options] [script [args]]\n" "Available options are:\n" - " -e stat execute string 'stat'\n" - " -i enter interactive mode after executing 'script'\n" - " -l name require library 'name' into global 'name'\n" - " -v show version information\n" - " -E ignore environment variables\n" - " -W turn warnings on\n" - " -- stop handling options\n" - " - stop handling options and execute stdin\n" + " -e stat execute string 'stat'\n" + " -i enter interactive mode after executing 'script'\n" + " -l mod require library 'mod' into global 'mod'\n" + " -l g=mod require library 'mod' into global 'g'\n" + " -v show version information\n" + " -E ignore environment variables\n" + " -W turn warnings on\n" + " -- stop handling options\n" + " - stop handling options and execute stdin\n" , progname); } @@ -207,16 +208,22 @@ static int dostring (lua_State *L, const char *s, const char *name) { /* -** Calls 'require(name)' and stores the result in a global variable -** with the given name. +** Receives 'globname[=modname]' and runs 'globname = require(modname)'. */ -static int dolibrary (lua_State *L, const char *name) { +static int dolibrary (lua_State *L, char *globname) { int status; + char *modname = strchr(globname, '='); + if (modname == NULL) /* no explicit name? */ + modname = globname; /* module name is equal to global name */ + else { + *modname = '\0'; /* global name ends here */ + modname++; /* module name starts after the '=' */ + } lua_getglobal(L, "require"); - lua_pushstring(L, name); - status = docall(L, 1, 1); /* call 'require(name)' */ + lua_pushstring(L, modname); + status = docall(L, 1, 1); /* call 'require(modname)' */ if (status == LUA_OK) - lua_setglobal(L, name); /* global[name] = require return */ + lua_setglobal(L, globname); /* globname = require(modname) */ return report(L, status); } @@ -327,7 +334,7 @@ static int runargs (lua_State *L, char **argv, int n) { switch (option) { case 'e': case 'l': { int status; - const char *extra = argv[i] + 2; /* both options need an argument */ + char *extra = argv[i] + 2; /* both options need an argument */ if (*extra == '\0') extra = argv[++i]; lua_assert(extra != NULL); status = (option == 'e') diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lua.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lua.h similarity index 98% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lua.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lua.h index 820535b9..e6618392 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lua.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lua.h @@ -18,14 +18,14 @@ #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MINOR "4" -#define LUA_VERSION_RELEASE "3" +#define LUA_VERSION_RELEASE "4" #define LUA_VERSION_NUM 504 -#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 0) +#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 4) #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE -#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2021 Lua.org, PUC-Rio" +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2022 Lua.org, PUC-Rio" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" @@ -492,7 +492,7 @@ struct lua_Debug { /****************************************************************************** -* Copyright (C) 1994-2021 Lua.org, PUC-Rio. +* Copyright (C) 1994-2022 Lua.org, PUC-Rio. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lua.hpp b/crates/rlua-lua54-sys/lua-5.4.4/src/lua.hpp similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lua.hpp rename to crates/rlua-lua54-sys/lua-5.4.4/src/lua.hpp diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/luac.c b/crates/rlua-lua54-sys/lua-5.4.4/src/luac.c similarity index 98% rename from crates/rlua-lua54-sys/lua-5.4.3/src/luac.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/luac.c index 56ddc414..f6db9cf6 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/luac.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/luac.c @@ -155,6 +155,7 @@ static const Proto* combine(lua_State* L, int n) f->p[i]=toproto(L,i-n-1); if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; } + luaM_freearray(L,f->lineinfo,f->sizelineinfo); f->sizelineinfo=0; return f; } @@ -600,11 +601,11 @@ static void PrintCode(const Proto* f) if (c==0) printf("all out"); else printf("%d out",c-1); break; case OP_TAILCALL: - printf("%d %d %d",a,b,c); + printf("%d %d %d%s",a,b,c,ISK); printf(COMMENT "%d in",b-1); break; case OP_RETURN: - printf("%d %d %d",a,b,c); + printf("%d %d %d%s",a,b,c,ISK); printf(COMMENT); if (b==0) printf("all out"); else printf("%d out",b-1); break; @@ -619,7 +620,7 @@ static void PrintCode(const Proto* f) break; case OP_FORPREP: printf("%d %d",a,bx); - printf(COMMENT "to %d",pc+bx+2); + printf(COMMENT "exit to %d",pc+bx+3); break; case OP_TFORPREP: printf("%d %d",a,bx); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/luaconf.h b/crates/rlua-lua54-sys/lua-5.4.4/src/luaconf.h similarity index 99% rename from crates/rlua-lua54-sys/lua-5.4.3/src/luaconf.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/luaconf.h index e64d2ee3..d42d14b7 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/luaconf.h +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/luaconf.h @@ -485,7 +485,6 @@ @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. @@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. -@@ LUA_UNSIGNEDBITS is the number of bits in a LUA_UNSIGNED. @@ lua_integer2str converts an integer to a string. */ @@ -506,9 +505,6 @@ #define LUA_UNSIGNED unsigned LUAI_UACINT -#define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT) - - /* now the variable definitions */ #if LUA_INT_TYPE == LUA_INT_INT /* { int */ diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lualib.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lualib.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lualib.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lualib.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lundump.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lundump.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lundump.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lundump.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lundump.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lundump.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lundump.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lundump.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lutf8lib.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lutf8lib.c similarity index 96% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lutf8lib.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lutf8lib.c index 901d985f..e7bf098f 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lutf8lib.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lutf8lib.c @@ -224,14 +224,11 @@ static int byteoffset (lua_State *L) { static int iter_aux (lua_State *L, int strict) { size_t len; const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = lua_tointeger(L, 2) - 1; - if (n < 0) /* first iteration? */ - n = 0; /* start from here */ - else if (n < (lua_Integer)len) { - n++; /* skip current byte */ - while (iscont(s + n)) n++; /* and its continuations */ + lua_Unsigned n = (lua_Unsigned)lua_tointeger(L, 2); + if (n < len) { + while (iscont(s + n)) n++; /* skip continuation bytes */ } - if (n >= (lua_Integer)len) + if (n >= len) /* (also handles original 'n' being negative) */ return 0; /* no more codepoints */ else { utfint code; diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lvm.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lvm.c similarity index 97% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lvm.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lvm.c index c9729bcc..2ec34400 100644 --- a/crates/rlua-lua54-sys/lua-5.4.3/src/lvm.c +++ b/crates/rlua-lua54-sys/lua-5.4.4/src/lvm.c @@ -406,7 +406,7 @@ static int l_strcmp (const TString *ls, const TString *rs) { ** from float to int.) ** When 'f' is NaN, comparisons must result in false. */ -static int LTintfloat (lua_Integer i, lua_Number f) { +l_sinline int LTintfloat (lua_Integer i, lua_Number f) { if (l_intfitsf(i)) return luai_numlt(cast_num(i), f); /* compare them as floats */ else { /* i < f <=> i < ceil(f) */ @@ -423,7 +423,7 @@ static int LTintfloat (lua_Integer i, lua_Number f) { ** Check whether integer 'i' is less than or equal to float 'f'. ** See comments on previous function. */ -static int LEintfloat (lua_Integer i, lua_Number f) { +l_sinline int LEintfloat (lua_Integer i, lua_Number f) { if (l_intfitsf(i)) return luai_numle(cast_num(i), f); /* compare them as floats */ else { /* i <= f <=> i <= floor(f) */ @@ -440,7 +440,7 @@ static int LEintfloat (lua_Integer i, lua_Number f) { ** Check whether float 'f' is less than integer 'i'. ** See comments on previous function. */ -static int LTfloatint (lua_Number f, lua_Integer i) { +l_sinline int LTfloatint (lua_Number f, lua_Integer i) { if (l_intfitsf(i)) return luai_numlt(f, cast_num(i)); /* compare them as floats */ else { /* f < i <=> floor(f) < i */ @@ -457,7 +457,7 @@ static int LTfloatint (lua_Number f, lua_Integer i) { ** Check whether float 'f' is less than or equal to integer 'i'. ** See comments on previous function. */ -static int LEfloatint (lua_Number f, lua_Integer i) { +l_sinline int LEfloatint (lua_Number f, lua_Integer i) { if (l_intfitsf(i)) return luai_numle(f, cast_num(i)); /* compare them as floats */ else { /* f <= i <=> ceil(f) <= i */ @@ -473,7 +473,7 @@ static int LEfloatint (lua_Number f, lua_Integer i) { /* ** Return 'l < r', for numbers. */ -static int LTnum (const TValue *l, const TValue *r) { +l_sinline int LTnum (const TValue *l, const TValue *r) { lua_assert(ttisnumber(l) && ttisnumber(r)); if (ttisinteger(l)) { lua_Integer li = ivalue(l); @@ -495,7 +495,7 @@ static int LTnum (const TValue *l, const TValue *r) { /* ** Return 'l <= r', for numbers. */ -static int LEnum (const TValue *l, const TValue *r) { +l_sinline int LEnum (const TValue *l, const TValue *r) { lua_assert(ttisnumber(l) && ttisnumber(r)); if (ttisinteger(l)) { lua_Integer li = ivalue(l); @@ -766,7 +766,8 @@ lua_Number luaV_modf (lua_State *L, lua_Number m, lua_Number n) { /* ** Shift left operation. (Shift right just negates 'y'.) */ -#define luaV_shiftr(x,y) luaV_shiftl(x,-(y)) +#define luaV_shiftr(x,y) luaV_shiftl(x,intop(-, 0, y)) + lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { if (y < 0) { /* shift right? */ @@ -847,10 +848,19 @@ void luaV_finishOp (lua_State *L) { luaV_concat(L, total); /* concat them (may yield again) */ break; } - case OP_CLOSE: case OP_RETURN: { /* yielded closing variables */ + case OP_CLOSE: { /* yielded closing variables */ ci->u.l.savedpc--; /* repeat instruction to close other vars. */ break; } + case OP_RETURN: { /* yielded closing variables */ + StkId ra = base + GETARG_A(inst); + /* adjust top to signal correct number of returns, in case the + return is "up to top" ('isIT') */ + L->top = ra + ci->u2.nres; + /* repeat instruction to close other vars. and complete the return */ + ci->u.l.savedpc--; + break; + } default: { /* only these other opcodes can yield */ lua_assert(op == OP_TFORCALL || op == OP_CALL || @@ -1099,7 +1109,7 @@ void luaV_finishOp (lua_State *L) { #define ProtectNT(exp) (savepc(L), (exp), updatetrap(ci)) /* -** Protect code that can only raise errors. (That is, it cannnot change +** Protect code that can only raise errors. (That is, it cannot change ** the stack or hooks.) */ #define halfProtect(exp) (savestate(L,ci), (exp)) @@ -1156,8 +1166,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) { Instruction i; /* instruction being executed */ StkId ra; /* instruction's A register */ vmfetch(); -// low-level line tracing for debugging Lua -// printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); + #if 0 + /* low-level line tracing for debugging Lua */ + printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); + #endif lua_assert(base == ci->func + 1); lua_assert(base <= L->top && L->top < L->stack_last); /* invalidate top for instructions not expecting it */ @@ -1625,13 +1637,13 @@ void luaV_execute (lua_State *L, CallInfo *ci) { updatetrap(ci); /* C call; nothing else to be done */ else { /* Lua call: run function in this same C frame */ ci = newci; - ci->callstatus = 0; /* call re-uses 'luaV_execute' */ goto startfunc; } vmbreak; } vmcase(OP_TAILCALL) { int b = GETARG_B(i); /* number of arguments + 1 (function) */ + int n; /* number of results when calling a C function */ int nparams1 = GETARG_C(i); /* delta is virtual 'func' - real 'func' (vararg functions) */ int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; @@ -1645,23 +1657,14 @@ void luaV_execute (lua_State *L, CallInfo *ci) { lua_assert(L->tbclist < base); /* no pending tbc variables */ lua_assert(base == ci->func + 1); } - while (!ttisfunction(s2v(ra))) { /* not a function? */ - luaD_tryfuncTM(L, ra); /* try '__call' metamethod */ - b++; /* there is now one extra argument */ - checkstackGCp(L, 1, ra); - } - if (!ttisLclosure(s2v(ra))) { /* C function? */ - luaD_precall(L, ra, LUA_MULTRET); /* call it */ - updatetrap(ci); - updatestack(ci); /* stack may have been relocated */ + if ((n = luaD_pretailcall(L, ci, ra, b, delta)) < 0) /* Lua function? */ + goto startfunc; /* execute the callee */ + else { /* C function? */ ci->func -= delta; /* restore 'func' (if vararg) */ - luaD_poscall(L, ci, cast_int(L->top - ra)); /* finish caller */ + luaD_poscall(L, ci, n); /* finish caller */ updatetrap(ci); /* 'luaD_poscall' can change hooks */ goto ret; /* caller returns after the tail call */ } - ci->func -= delta; /* restore 'func' (if vararg) */ - luaD_pretailcall(L, ci, ra, b); /* prepare call frame */ - goto startfunc; /* execute the callee */ } vmcase(OP_RETURN) { int n = GETARG_B(i) - 1; /* number of results */ @@ -1670,6 +1673,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { n = cast_int(L->top - ra); /* get what is available */ savepc(ci); if (TESTARG_k(i)) { /* may there be open upvalues? */ + ci->u2.nres = n; /* save number of returns */ if (L->top < ci->top) L->top = ci->top; luaF_close(L, base, CLOSEKTOP, 1); diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lvm.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lvm.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lvm.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lvm.h diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lzio.c b/crates/rlua-lua54-sys/lua-5.4.4/src/lzio.c similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lzio.c rename to crates/rlua-lua54-sys/lua-5.4.4/src/lzio.c diff --git a/crates/rlua-lua54-sys/lua-5.4.3/src/lzio.h b/crates/rlua-lua54-sys/lua-5.4.4/src/lzio.h similarity index 100% rename from crates/rlua-lua54-sys/lua-5.4.3/src/lzio.h rename to crates/rlua-lua54-sys/lua-5.4.4/src/lzio.h diff --git a/crates/rlua-lua54-sys/src/bindings.rs b/crates/rlua-lua54-sys/src/bindings.rs index 1a8f0c8c..fc1879fc 100644 --- a/crates/rlua-lua54-sys/src/bindings.rs +++ b/crates/rlua-lua54-sys/src/bindings.rs @@ -1,5 +1,279 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.65.1 */ +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type wchar_t = ::std::os::raw::c_int; +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +pub type lua_Number = f64; +pub type lua_Integer = ::std::os::raw::c_longlong; +pub type lua_Unsigned = ::std::os::raw::c_ulonglong; +pub type lua_KContext = isize; +pub type lua_CFunction = + ::std::option::Option ::std::os::raw::c_int>; +pub type lua_KFunction = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + status: ::std::os::raw::c_int, + ctx: lua_KContext, + ) -> ::std::os::raw::c_int, +>; +pub type lua_Reader = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + ud: *mut ::std::os::raw::c_void, + sz: *mut usize, + ) -> *const ::std::os::raw::c_char, +>; +pub type lua_Writer = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + p: *const ::std::os::raw::c_void, + sz: usize, + ud: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +pub type lua_Alloc = ::std::option::Option< + unsafe extern "C" fn( + ud: *mut ::std::os::raw::c_void, + ptr: *mut ::std::os::raw::c_void, + osize: usize, + nsize: usize, + ) -> *mut ::std::os::raw::c_void, +>; +pub type lua_WarnFunction = ::std::option::Option< + unsafe extern "C" fn( + ud: *mut ::std::os::raw::c_void, + msg: *const ::std::os::raw::c_char, + tocont: ::std::os::raw::c_int, + ), +>; +pub type lua_Hook = + ::std::option::Option; +pub type __fpos_t = _G_fpos_t; +pub type __fpos64_t = _G_fpos64_t; +pub type __FILE = _IO_FILE; +pub type FILE = _IO_FILE; +pub type _IO_lock_t = ::std::os::raw::c_void; +pub type off_t = __off_t; +pub type fpos_t = __fpos_t; +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_State { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_Debug { + pub event: ::std::os::raw::c_int, + pub name: *const ::std::os::raw::c_char, + pub namewhat: *const ::std::os::raw::c_char, + pub what: *const ::std::os::raw::c_char, + pub source: *const ::std::os::raw::c_char, + pub srclen: usize, + pub currentline: ::std::os::raw::c_int, + pub linedefined: ::std::os::raw::c_int, + pub lastlinedefined: ::std::os::raw::c_int, + pub nups: ::std::os::raw::c_uchar, + pub nparams: ::std::os::raw::c_uchar, + pub isvararg: ::std::os::raw::c_char, + pub istailcall: ::std::os::raw::c_char, + pub ftransfer: ::std::os::raw::c_ushort, + pub ntransfer: ::std::os::raw::c_ushort, + pub short_src: [::std::os::raw::c_char; 60usize], + pub i_ci: *mut CallInfo, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __mbstate_t { + pub __count: ::std::os::raw::c_int, + pub __value: __mbstate_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos_t { + pub __pos: __off_t, + pub __state: __mbstate_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _G_fpos64_t { + pub __pos: __off64_t, + pub __state: __mbstate_t, +} +#[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], +} +#[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 _flags2: ::std::os::raw::c_int, + 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 __pad5: usize, + pub _mode: ::std::os::raw::c_int, + pub _unused2: [::std::os::raw::c_char; 20usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Reg { + pub name: *const ::std::os::raw::c_char, + pub func: lua_CFunction, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct luaL_Buffer { + pub b: *mut ::std::os::raw::c_char, + pub size: usize, + pub n: usize, + pub L: *mut lua_State, + pub init: luaL_Buffer__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct luaL_Stream { + pub f: *mut FILE, + pub closef: lua_CFunction, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CallInfo { + pub _address: u8, +} pub const __GNUC_VA_LIST: u32 = 1; pub const _LIBC_LIMITS_H_: u32 = 1; pub const _FEATURES_H: u32 = 1; @@ -194,12 +468,12 @@ pub const LUAI_MAXSTACK: u32 = 1000000; pub const LUA_IDSIZE: u32 = 60; pub const LUA_VERSION_MAJOR: &[u8; 2usize] = b"5\0"; pub const LUA_VERSION_MINOR: &[u8; 2usize] = b"4\0"; -pub const LUA_VERSION_RELEASE: &[u8; 2usize] = b"3\0"; +pub const LUA_VERSION_RELEASE: &[u8; 2usize] = b"4\0"; pub const LUA_VERSION_NUM: u32 = 504; -pub const LUA_VERSION_RELEASE_NUM: u32 = 50400; +pub const LUA_VERSION_RELEASE_NUM: u32 = 50404; pub const LUA_VERSION: &[u8; 8usize] = b"Lua 5.4\0"; -pub const LUA_RELEASE: &[u8; 10usize] = b"Lua 5.4.3\0"; -pub const LUA_COPYRIGHT: &[u8; 52usize] = b"Lua 5.4.3 Copyright (C) 1994-2021 Lua.org, PUC-Rio\0"; +pub const LUA_RELEASE: &[u8; 10usize] = b"Lua 5.4.4\0"; +pub const LUA_COPYRIGHT: &[u8; 52usize] = b"Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio\0"; pub const LUA_AUTHORS: &[u8; 48usize] = b"R. Ierusalimschy, L. H. de Figueiredo, W. Celes\0"; pub const LUA_SIGNATURE: &[u8; 5usize] = b"\x1BLua\0"; pub const LUA_MULTRET: i32 = -1; @@ -305,228 +579,981 @@ pub const LUA_PRELOAD_TABLE: &[u8; 9usize] = b"_PRELOAD\0"; pub const LUA_NOREF: i32 = -2; pub const LUA_REFNIL: i32 = -1; pub const LUA_FILEHANDLE: &[u8; 6usize] = b"FILE*\0"; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, +#[test] +fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +#[test] +fn bindgen_test_layout___fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__fsid_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__fsid_t), + "::", + stringify!(__val) + ) + ); +} +#[test] +fn bindgen_test_layout_lua_Debug() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!("Size of: ", stringify!(lua_Debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lua_Debug)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(event) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).namewhat) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(namewhat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).what) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(source) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).srclen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(srclen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).currentline) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(currentline) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).linedefined) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(linedefined) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lastlinedefined) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(lastlinedefined) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nups) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(nups) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nparams) as usize - ptr as usize }, + 61usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(nparams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).isvararg) as usize - ptr as usize }, + 62usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(isvararg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).istailcall) as usize - ptr as usize }, + 63usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(istailcall) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ftransfer) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(ftransfer) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ntransfer) as usize - ptr as usize }, + 66usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(ntransfer) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).short_src) as usize - ptr as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(short_src) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).i_ci) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(i_ci) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wch) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wchb) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t>(), + 8usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__count) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__value) + ) + ); +} +#[test] +fn bindgen_test_layout__G_fpos_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__state) + ) + ); +} +#[test] +fn bindgen_test_layout__G_fpos64_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos64_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos64_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__state) + ) + ); +} +#[test] +fn bindgen_test_layout__IO_FILE() { + const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_IO_FILE>(), + 216usize, + concat!("Size of: ", stringify!(_IO_FILE)) + ); + assert_eq!( + ::std::mem::align_of::<_IO_FILE>(), + 8usize, + concat!("Alignment of ", stringify!(_IO_FILE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_backup_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_markers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_chain) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_fileno) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_old_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_cur_column) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_vtable_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize }, + 131usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_shortbuf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_lock) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_codecvt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_wide_data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_list) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_buf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(__pad5) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_mode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize }, + 196usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_unused2) + ) + ); +} +#[test] +fn bindgen_test_layout_luaL_Reg() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(luaL_Reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Reg)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(func) + ) + ); +} +#[test] +fn bindgen_test_layout_luaL_Buffer__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 1024usize, + concat!("Size of: ", stringify!(luaL_Buffer__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Buffer__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer__bindgen_ty_1), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer__bindgen_ty_1), + "::", + stringify!(u) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer__bindgen_ty_1), + "::", + stringify!(s) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer__bindgen_ty_1), + "::", + stringify!(i) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).l) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer__bindgen_ty_1), + "::", + stringify!(l) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer__bindgen_ty_1), + "::", + stringify!(b) + ) + ); } #[test] -fn bindgen_test_layout_max_align_t() { +fn bindgen_test_layout_luaL_Buffer() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) + ::std::mem::size_of::(), + 1056usize, + concat!("Size of: ", stringify!(luaL_Buffer)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Buffer)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(b) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize }, 16usize, - concat!("Alignment of ", stringify!(max_align_t)) + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).L) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(L) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).init) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(init) + ) ); - fn test_field___clang_max_align_nonce1() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - } - test_field___clang_max_align_nonce1(); - fn test_field___clang_max_align_nonce2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); - } - test_field___clang_max_align_nonce2(); } -pub type __u_char = ::std::os::raw::c_uchar; -pub type __u_short = ::std::os::raw::c_ushort; -pub type __u_int = ::std::os::raw::c_uint; -pub type __u_long = ::std::os::raw::c_ulong; -pub type __int8_t = ::std::os::raw::c_schar; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __int16_t = ::std::os::raw::c_short; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; -pub type __uint64_t = ::std::os::raw::c_ulong; -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = ::std::os::raw::c_long; -pub type __u_quad_t = ::std::os::raw::c_ulong; -pub type __intmax_t = ::std::os::raw::c_long; -pub type __uintmax_t = ::std::os::raw::c_ulong; -pub type __dev_t = ::std::os::raw::c_ulong; -pub type __uid_t = ::std::os::raw::c_uint; -pub type __gid_t = ::std::os::raw::c_uint; -pub type __ino_t = ::std::os::raw::c_ulong; -pub type __ino64_t = ::std::os::raw::c_ulong; -pub type __mode_t = ::std::os::raw::c_uint; -pub type __nlink_t = ::std::os::raw::c_ulong; -pub type __off_t = ::std::os::raw::c_long; -pub type __off64_t = ::std::os::raw::c_long; -pub type __pid_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [::std::os::raw::c_int; 2usize], +#[test] +fn bindgen_test_layout_luaL_Stream() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(luaL_Stream)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Stream)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Stream), + "::", + stringify!(f) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).closef) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Stream), + "::", + stringify!(closef) + ) + ); } #[test] -fn bindgen_test_layout___fsid_t() { +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - ::std::mem::size_of::<__fsid_t>(), + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), 8usize, - concat!("Size of: ", stringify!(__fsid_t)) + concat!("Alignment of ", stringify!(__va_list_tag)) ); assert_eq!( - ::std::mem::align_of::<__fsid_t>(), + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) ); - fn test_field___val() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__fsid_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); - } - test_field___val(); } -pub type __clock_t = ::std::os::raw::c_long; -pub type __rlim_t = ::std::os::raw::c_ulong; -pub type __rlim64_t = ::std::os::raw::c_ulong; -pub type __id_t = ::std::os::raw::c_uint; -pub type __time_t = ::std::os::raw::c_long; -pub type __useconds_t = ::std::os::raw::c_uint; -pub type __suseconds_t = ::std::os::raw::c_long; -pub type __daddr_t = ::std::os::raw::c_int; -pub type __key_t = ::std::os::raw::c_int; -pub type __clockid_t = ::std::os::raw::c_int; -pub type __timer_t = *mut ::std::os::raw::c_void; -pub type __blksize_t = ::std::os::raw::c_long; -pub type __blkcnt_t = ::std::os::raw::c_long; -pub type __blkcnt64_t = ::std::os::raw::c_long; -pub type __fsblkcnt_t = ::std::os::raw::c_ulong; -pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; -pub type __fsword_t = ::std::os::raw::c_long; -pub type __ssize_t = ::std::os::raw::c_long; -pub type __syscall_slong_t = ::std::os::raw::c_long; -pub type __syscall_ulong_t = ::std::os::raw::c_ulong; -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut ::std::os::raw::c_char; -pub type __intptr_t = ::std::os::raw::c_long; -pub type __socklen_t = ::std::os::raw::c_uint; -pub type __sig_atomic_t = ::std::os::raw::c_int; -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -pub type int_fast8_t = ::std::os::raw::c_schar; -pub type int_fast16_t = ::std::os::raw::c_long; -pub type int_fast32_t = ::std::os::raw::c_long; -pub type int_fast64_t = ::std::os::raw::c_long; -pub type uint_fast8_t = ::std::os::raw::c_uchar; -pub type uint_fast16_t = ::std::os::raw::c_ulong; -pub type uint_fast32_t = ::std::os::raw::c_ulong; -pub type uint_fast64_t = ::std::os::raw::c_ulong; -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lua_State { - _unused: [u8; 0], +#[derive(Copy, Clone)] +pub union __mbstate_t__bindgen_ty_1 { + pub __wch: ::std::os::raw::c_uint, + pub __wchb: [::std::os::raw::c_char; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union luaL_Buffer__bindgen_ty_1 { + pub n: lua_Number, + pub u: f64, + pub s: *mut ::std::os::raw::c_void, + pub i: lua_Integer, + pub l: ::std::os::raw::c_long, + pub b: [::std::os::raw::c_char; 1024usize], } -pub type lua_Number = f64; -pub type lua_Integer = ::std::os::raw::c_longlong; -pub type lua_Unsigned = ::std::os::raw::c_ulonglong; -pub type lua_KContext = isize; -pub type lua_CFunction = - ::std::option::Option ::std::os::raw::c_int>; -pub type lua_KFunction = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - status: ::std::os::raw::c_int, - ctx: lua_KContext, - ) -> ::std::os::raw::c_int, ->; -pub type lua_Reader = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - ud: *mut ::std::os::raw::c_void, - sz: *mut usize, - ) -> *const ::std::os::raw::c_char, ->; -pub type lua_Writer = ::std::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - p: *const ::std::os::raw::c_void, - sz: usize, - ud: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, ->; -pub type lua_Alloc = ::std::option::Option< - unsafe extern "C" fn( - ud: *mut ::std::os::raw::c_void, - ptr: *mut ::std::os::raw::c_void, - osize: usize, - nsize: usize, - ) -> *mut ::std::os::raw::c_void, ->; -pub type lua_WarnFunction = ::std::option::Option< - unsafe extern "C" fn( - ud: *mut ::std::os::raw::c_void, - msg: *const ::std::os::raw::c_char, - tocont: ::std::os::raw::c_int, - ), ->; extern "C" { - pub static mut lua_ident: [::std::os::raw::c_char; 0usize]; + pub static lua_ident: [::std::os::raw::c_char; 0usize]; } extern "C" { pub fn lua_newstate(f: lua_Alloc, ud: *mut ::std::os::raw::c_void) -> *mut lua_State; @@ -916,8 +1943,6 @@ extern "C" { extern "C" { pub fn lua_closeslot(L: *mut lua_State, idx: ::std::os::raw::c_int); } -pub type lua_Hook = - ::std::option::Option; extern "C" { pub fn lua_getstack( L: *mut lua_State, @@ -996,331 +2021,8 @@ extern "C" { extern "C" { pub fn lua_setcstacklimit( L: *mut lua_State, - limit: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lua_Debug { - pub event: ::std::os::raw::c_int, - pub name: *const ::std::os::raw::c_char, - pub namewhat: *const ::std::os::raw::c_char, - pub what: *const ::std::os::raw::c_char, - pub source: *const ::std::os::raw::c_char, - pub srclen: usize, - pub currentline: ::std::os::raw::c_int, - pub linedefined: ::std::os::raw::c_int, - pub lastlinedefined: ::std::os::raw::c_int, - pub nups: ::std::os::raw::c_uchar, - pub nparams: ::std::os::raw::c_uchar, - pub isvararg: ::std::os::raw::c_char, - pub istailcall: ::std::os::raw::c_char, - pub ftransfer: ::std::os::raw::c_ushort, - pub ntransfer: ::std::os::raw::c_ushort, - pub short_src: [::std::os::raw::c_char; 60usize], - pub i_ci: *mut CallInfo, -} -#[test] -fn bindgen_test_layout_lua_Debug() { - assert_eq!( - ::std::mem::size_of::(), - 136usize, - concat!("Size of: ", stringify!(lua_Debug)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(lua_Debug)) - ); - fn test_field_event() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(event) - ) - ); - } - test_field_event(); - fn test_field_name() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(name) - ) - ); - } - test_field_name(); - fn test_field_namewhat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).namewhat) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(namewhat) - ) - ); - } - test_field_namewhat(); - fn test_field_what() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).what) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(what) - ) - ); - } - test_field_what(); - fn test_field_source() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(source) - ) - ); - } - test_field_source(); - fn test_field_srclen() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).srclen) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(srclen) - ) - ); - } - test_field_srclen(); - fn test_field_currentline() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).currentline) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(currentline) - ) - ); - } - test_field_currentline(); - fn test_field_linedefined() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).linedefined) as usize - ptr as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(linedefined) - ) - ); - } - test_field_linedefined(); - fn test_field_lastlinedefined() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).lastlinedefined) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(lastlinedefined) - ) - ); - } - test_field_lastlinedefined(); - fn test_field_nups() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nups) as usize - ptr as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(nups) - ) - ); - } - test_field_nups(); - fn test_field_nparams() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nparams) as usize - ptr as usize - }, - 61usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(nparams) - ) - ); - } - test_field_nparams(); - fn test_field_isvararg() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).isvararg) as usize - ptr as usize - }, - 62usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(isvararg) - ) - ); - } - test_field_isvararg(); - fn test_field_istailcall() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).istailcall) as usize - ptr as usize - }, - 63usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(istailcall) - ) - ); - } - test_field_istailcall(); - fn test_field_ftransfer() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ftransfer) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(ftransfer) - ) - ); - } - test_field_ftransfer(); - fn test_field_ntransfer() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ntransfer) as usize - ptr as usize - }, - 66usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(ntransfer) - ) - ); - } - test_field_ntransfer(); - fn test_field_short_src() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).short_src) as usize - ptr as usize - }, - 68usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(short_src) - ) - ); - } - test_field_short_src(); - fn test_field_i_ci() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).i_ci) as usize - ptr as usize - }, - 128usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(i_ci) - ) - ); - } - test_field_i_ci(); + limit: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn luaopen_base(L: *mut lua_State) -> ::std::os::raw::c_int; @@ -1355,779 +2057,6 @@ extern "C" { extern "C" { pub fn luaL_openlibs(L: *mut lua_State); } -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: ::std::os::raw::c_int, - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: ::std::os::raw::c_uint, - pub __wchb: [::std::os::raw::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - fn test_field___wch() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t__bindgen_ty_1>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - } - test_field___wch(); - fn test_field___wchb() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t__bindgen_ty_1>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); - } - test_field___wchb(); -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::std::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - fn test_field___count() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - } - test_field___count(); - fn test_field___value() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__mbstate_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); - } - test_field___value(); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::std::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - fn test_field___pos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - } - test_field___pos(); - fn test_field___state() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); - } - test_field___state(); -} -pub type __fpos_t = _G_fpos_t; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::std::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - fn test_field___pos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos64_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - } - test_field___pos(); - fn test_field___state() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_G_fpos64_t>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); - } - test_field___state(); -} -pub type __fpos64_t = _G_fpos64_t; -pub type __FILE = _IO_FILE; -pub type FILE = _IO_FILE; -#[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 _flags2: ::std::os::raw::c_int, - 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 __pad5: usize, - pub _mode: ::std::os::raw::c_int, - pub _unused2: [::std::os::raw::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::std::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::std::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - fn test_field__flags() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - } - test_field__flags(); - fn test_field__IO_read_ptr() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - } - test_field__IO_read_ptr(); - fn test_field__IO_read_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - } - test_field__IO_read_end(); - fn test_field__IO_read_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - } - test_field__IO_read_base(); - fn test_field__IO_write_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - } - test_field__IO_write_base(); - fn test_field__IO_write_ptr() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - } - test_field__IO_write_ptr(); - fn test_field__IO_write_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - } - test_field__IO_write_end(); - fn test_field__IO_buf_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - } - test_field__IO_buf_base(); - fn test_field__IO_buf_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - } - test_field__IO_buf_end(); - fn test_field__IO_save_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - } - test_field__IO_save_base(); - fn test_field__IO_backup_base() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - } - test_field__IO_backup_base(); - fn test_field__IO_save_end() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - } - test_field__IO_save_end(); - fn test_field__markers() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - } - test_field__markers(); - fn test_field__chain() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - } - test_field__chain(); - fn test_field__fileno() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - } - test_field__fileno(); - fn test_field__flags2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize - }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - } - test_field__flags2(); - fn test_field__old_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - } - test_field__old_offset(); - fn test_field__cur_column() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize - }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - } - test_field__cur_column(); - fn test_field__vtable_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize - }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - } - test_field__vtable_offset(); - fn test_field__shortbuf() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize - }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - } - test_field__shortbuf(); - fn test_field__lock() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize - }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - } - test_field__lock(); - fn test_field__offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - } - test_field__offset(); - fn test_field__codecvt() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize - }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - } - test_field__codecvt(); - fn test_field__wide_data() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize - }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - } - test_field__wide_data(); - fn test_field__freeres_list() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize - }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - } - test_field__freeres_list(); - fn test_field__freeres_buf() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize - }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - } - test_field__freeres_buf(); - fn test_field___pad5() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize - }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - } - test_field___pad5(); - fn test_field__mode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize - }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - } - test_field__mode(); - fn test_field__unused2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<_IO_FILE>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize - }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); - } - test_field__unused2(); -} -pub type off_t = __off_t; -pub type fpos_t = __fpos_t; extern "C" { pub static mut stdin: *mut FILE; } @@ -2540,7 +2469,7 @@ extern "C" { pub static mut sys_nerr: ::std::os::raw::c_int; } extern "C" { - pub static mut sys_errlist: [*const ::std::os::raw::c_char; 0usize]; + pub static sys_errlist: [*const ::std::os::raw::c_char; 0usize]; } extern "C" { pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; @@ -2575,59 +2504,6 @@ extern "C" { extern "C" { pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Reg { - pub name: *const ::std::os::raw::c_char, - pub func: lua_CFunction, -} -#[test] -fn bindgen_test_layout_luaL_Reg() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(luaL_Reg)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Reg)) - ); - fn test_field_name() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(name) - ) - ); - } - test_field_name(); - fn test_field_func() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(func) - ) - ); - } - test_field_func(); -} extern "C" { pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number, sz: usize); } @@ -2842,238 +2718,6 @@ extern "C" { glb: ::std::os::raw::c_int, ); } -#[repr(C)] -#[derive(Copy, Clone)] -pub struct luaL_Buffer { - pub b: *mut ::std::os::raw::c_char, - pub size: usize, - pub n: usize, - pub L: *mut lua_State, - pub init: luaL_Buffer__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union luaL_Buffer__bindgen_ty_1 { - pub n: lua_Number, - pub u: f64, - pub s: *mut ::std::os::raw::c_void, - pub i: lua_Integer, - pub l: ::std::os::raw::c_long, - pub b: [::std::os::raw::c_char; 1024usize], -} -#[test] -fn bindgen_test_layout_luaL_Buffer__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(luaL_Buffer__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Buffer__bindgen_ty_1)) - ); - fn test_field_n() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer__bindgen_ty_1), - "::", - stringify!(n) - ) - ); - } - test_field_n(); - fn test_field_u() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer__bindgen_ty_1), - "::", - stringify!(u) - ) - ); - } - test_field_u(); - fn test_field_s() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer__bindgen_ty_1), - "::", - stringify!(s) - ) - ); - } - test_field_s(); - fn test_field_i() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer__bindgen_ty_1), - "::", - stringify!(i) - ) - ); - } - test_field_i(); - fn test_field_l() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).l) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer__bindgen_ty_1), - "::", - stringify!(l) - ) - ); - } - test_field_l(); - fn test_field_b() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer__bindgen_ty_1), - "::", - stringify!(b) - ) - ); - } - test_field_b(); -} -#[test] -fn bindgen_test_layout_luaL_Buffer() { - assert_eq!( - ::std::mem::size_of::(), - 1056usize, - concat!("Size of: ", stringify!(luaL_Buffer)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Buffer)) - ); - fn test_field_b() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(b) - ) - ); - } - test_field_b(); - fn test_field_size() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(size) - ) - ); - } - test_field_size(); - fn test_field_n() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(n) - ) - ); - } - test_field_n(); - fn test_field_L() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).L) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(L) - ) - ); - } - test_field_L(); - fn test_field_init() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).init) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(init) - ) - ); - } - test_field_init(); -} extern "C" { pub fn luaL_buffinit(L: *mut lua_State, B: *mut luaL_Buffer); } @@ -3102,151 +2746,3 @@ extern "C" { sz: usize, ) -> *mut ::std::os::raw::c_char; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct luaL_Stream { - pub f: *mut FILE, - pub closef: lua_CFunction, -} -#[test] -fn bindgen_test_layout_luaL_Stream() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(luaL_Stream)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Stream)) - ); - fn test_field_f() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Stream), - "::", - stringify!(f) - ) - ); - } - test_field_f(); - fn test_field_closef() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).closef) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Stream), - "::", - stringify!(closef) - ) - ); - } - test_field_closef(); -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: ::std::os::raw::c_uint, - pub fp_offset: ::std::os::raw::c_uint, - pub overflow_arg_area: *mut ::std::os::raw::c_void, - pub reg_save_area: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout___va_list_tag() { - assert_eq!( - ::std::mem::size_of::<__va_list_tag>(), - 24usize, - concat!("Size of: ", stringify!(__va_list_tag)) - ); - assert_eq!( - ::std::mem::align_of::<__va_list_tag>(), - 8usize, - concat!("Alignment of ", stringify!(__va_list_tag)) - ); - fn test_field_gp_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(gp_offset) - ) - ); - } - test_field_gp_offset(); - fn test_field_fp_offset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(fp_offset) - ) - ); - } - test_field_fp_offset(); - fn test_field_overflow_arg_area() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(overflow_arg_area) - ) - ); - } - test_field_overflow_arg_area(); - fn test_field_reg_save_area() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<__va_list_tag>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(reg_save_area) - ) - ); - } - test_field_reg_save_area(); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CallInfo { - pub _address: u8, -} diff --git a/scripts/check-bindgen.sh b/scripts/check-bindgen.sh new file mode 100755 index 00000000..02958884 --- /dev/null +++ b/scripts/check-bindgen.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -ex + +for crate in crates/rlua-lua??-sys ; do + # The bindings are not consistently ordered on different machines, which + # seems to be to do with the system headers, so we compare the sorted + # output. + HASH_ORIG=$(git show HEAD:${crate}/src/bindings.rs | sort | sha256sum) + HASH_NEW=$(sort < ${crate}/src/bindings.rs | sha256sum) + if [ "$HASH_ORIG" != "$HASH_NEW" ] ; then + echo "Error, ${crate}/src/bindings.rs differs." + exit 1 + fi +done diff --git a/scripts/update-bindgen.sh b/scripts/update-bindgen.sh index e003fa16..efab3286 100755 --- a/scripts/update-bindgen.sh +++ b/scripts/update-bindgen.sh @@ -1,5 +1,5 @@ #!/bin/bash for crate in crates/rlua-lua??-sys ; do - bindgen --size_t-is-usize ${crate}/wrapper_lua*.h -o ${crate}/src/bindings.rs -- -I ${crate}/lua-5.*/src/ + bindgen --sort-semantically ${crate}/wrapper_lua*.h -o ${crate}/src/bindings.rs -- -I ${crate}/lua-5.*/src/ done diff --git a/src/lua.rs b/src/lua.rs index b6d37900..d3796af9 100644 --- a/src/lua.rs +++ b/src/lua.rs @@ -102,7 +102,8 @@ impl Drop for Lua { ); *rlua_expect!((*extra).registry_unref_list.lock(), "unref list poisoned") = None; ffi::lua_close(self.main_state); - Box::from_raw(extra); + // Recreate the box so that it will be freed. + let _ = Box::from_raw(extra); } } } diff --git a/tests/compile-fail/context_invariance_inner.rs b/tests/compile-fail/context_invariance_inner.rs index 74484b57..d404806c 100644 --- a/tests/compile-fail/context_invariance_inner.rs +++ b/tests/compile-fail/context_invariance_inner.rs @@ -6,8 +6,8 @@ fn main() { Lua::new().context(|lua1| { Lua::new().context(|lua2| { let t = lua2.create_table().unwrap(); - //~^ error: cannot infer an appropriate lifetime for lifetime parameter `'lua` due to - // conflicting requirements + //~^ error: 8:21: 8:40: borrowed data escapes outside of closure [E0521] + //~^^ error: 8:21: 8:40: borrowed data escapes outside of closure [E0521] lua1.globals().set("t", t).unwrap(); }); }); diff --git a/tests/compile-fail/context_invariance_outer.rs b/tests/compile-fail/context_invariance_outer.rs index 280978ae..2e8c3716 100644 --- a/tests/compile-fail/context_invariance_outer.rs +++ b/tests/compile-fail/context_invariance_outer.rs @@ -5,10 +5,10 @@ use rlua::Lua; fn main() { Lua::new().context(|lua1| { let t = lua1.create_table().unwrap(); - //~^ error: cannot infer an appropriate lifetime for lifetime parameter `'lua` due to - // conflicting requirements + //~^ error: borrowed data escapes outside of closure [E0521] Lua::new().context(|lua2| { lua2.globals().set("t", t).unwrap(); + //~^ error: borrowed data escapes outside of closure [E0521] }); }); } diff --git a/tests/compile-fail/static_context_lifetime.rs b/tests/compile-fail/static_context_lifetime.rs index d11dbb17..72688da7 100644 --- a/tests/compile-fail/static_context_lifetime.rs +++ b/tests/compile-fail/static_context_lifetime.rs @@ -12,8 +12,7 @@ fn main() { let lua = Box::leak(Box::new(Lua::new())); lua.context(|lua| { lua.create_function(|_, table: Table| { - //~^ error: cannot infer an appropriate lifetime for lifetime parameter `'lua` due to - // conflicting requirements + //~^ error: borrowed data escapes outside of closure BAD_TIME.with(|bt| { *bt.borrow_mut() = Some(table); });