lua_sys/
ldebug.rs

1use crate::*;
2
3// //////////////////////////////////////////// //
4// Lua types                                    //
5// //////////////////////////////////////////// //
6
7#[repr(C)]
8pub struct lua_Debug {
9    pub event: libc::c_int,
10    pub name: *const libc::c_char,
11    pub namewhat: *const libc::c_char,
12    pub what: *const libc::c_char,
13    pub source: *const libc::c_char,
14    pub currentline: libc::c_int,
15    pub linedefined: libc::c_int,
16    pub lastlinedefined: libc::c_int,
17    pub nups: libc::c_uchar,
18    pub nparams: libc::c_uchar,
19    pub isvararg: libc::c_char,
20    pub istailcall: libc::c_char,
21    pub short_src: [libc::c_char; LUA_IDSIZE],
22    /* private part */
23    _private: private::lua_Debug,
24}
25
26pub type lua_Hook = Option<unsafe extern "C" fn(L: *mut lua_State, ar: *mut lua_Debug)>;
27
28#[allow(unused)]
29mod private {
30    use super::*;
31
32    #[repr(C)]
33    pub struct lua_Debug {
34        i_ci: *mut CallInfo,
35    }
36
37    #[repr(C)]
38    struct CallInfo {
39        _private: [u8; 0],
40    }
41}
42
43// //////////////////////////////////////////// //
44// Lua Functions                                //
45// //////////////////////////////////////////// //
46
47extern "C" {
48    pub fn lua_gethook(L: *mut lua_State) -> lua_Hook;
49    pub fn lua_gethookcount(L: *mut lua_State) -> libc::c_int;
50    pub fn lua_gethookmask(L: *mut lua_State) -> libc::c_int;
51    pub fn lua_getinfo(
52        L: *mut lua_State,
53        what: *const libc::c_char,
54        ar: *mut lua_Debug,
55    ) -> libc::c_int;
56    pub fn lua_getlocal(
57        L: *mut lua_State,
58        ar: *const lua_Debug,
59        n: libc::c_int,
60    ) -> *const libc::c_char;
61    pub fn lua_getstack(L: *mut lua_State, level: libc::c_int, ar: *mut lua_Debug) -> libc::c_int;
62    pub fn lua_getupvalue(
63        L: *mut lua_State,
64        funcindex: libc::c_int,
65        n: libc::c_int,
66    ) -> *const libc::c_char;
67    pub fn lua_sethook(L: *mut lua_State, func: lua_Hook, mask: libc::c_int, count: libc::c_int);
68    pub fn lua_setlocal(
69        L: *mut lua_State,
70        ar: *const lua_Debug,
71        n: libc::c_int,
72    ) -> *const libc::c_char;
73    pub fn lua_setupvalue(
74        L: *mut lua_State,
75        funcindex: libc::c_int,
76        n: libc::c_int,
77    ) -> *const libc::c_char;
78    pub fn lua_upvalueid(L: *mut lua_State, fidx: libc::c_int, n: libc::c_int)
79        -> *mut libc::c_void;
80    pub fn lua_upvaluejoin(
81        L: *mut lua_State,
82        fidx1: libc::c_int,
83        n1: libc::c_int,
84        fidx2: libc::c_int,
85        n2: libc::c_int,
86    );
87}