c/lua:remove redundant

This commit is contained in:
luoliwoshang
2024-09-16 09:51:55 +08:00
parent 9f8b9ea806
commit e5a9af9a31

View File

@@ -10,18 +10,18 @@ const (
LLGoPackage = "link: $(pkg-config --libs lua); -llua -lm" LLGoPackage = "link: $(pkg-config --libs lua); -llua -lm"
) )
// /* mark for precompiled code ('<esc>Lua') */ /* mark for precompiled code ('<esc>Lua') */
// /* option for multiple returns in 'lua_pcall' and 'lua_call' */ /* option for multiple returns in 'lua_pcall' and 'lua_call' */
const ( const (
MULTRET = -1 MULTRET = -1
) )
// /* /*
// ** Pseudo-indices * Pseudo-indices
// ** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty * (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
// ** space after that to help overflow detection) * space after that to help overflow detection)
// */ */
const ( const (
REGISTRYINDEX = -MAXSTACK - 1000 REGISTRYINDEX = -MAXSTACK - 1000
@@ -31,7 +31,7 @@ func Upvalueindex(i c.Int) c.Int {
return c.Int(REGISTRYINDEX) - i return c.Int(REGISTRYINDEX) - i
} }
// /* thread status */ /* thread status */
const ( const (
OK = 0 OK = 0
YIELD = 1 YIELD = 1
@@ -45,9 +45,9 @@ type State struct {
Unused [8]byte Unused [8]byte
} }
// /* /*
// ** basic types * basic types
// */ */
const ( const (
NONE c.Int = -1 NONE c.Int = -1
NIL c.Int = 0 NIL c.Int = 0
@@ -62,47 +62,47 @@ const (
UMTYPES c.Int = 9 UMTYPES c.Int = 9
) )
// /* minimum Lua stack available to a C function */ /* minimum Lua stack available to a C function */
const ( const (
MINSTACK = 20 MINSTACK = 20
) )
// /* predefined values in the registry */ /* predefined values in the registry */
const ( const (
RIDX_MAINTHREAD = 1 RIDX_MAINTHREAD = 1
RIDX_GLOBALS = 2 RIDX_GLOBALS = 2
RIDX_LAST = RIDX_GLOBALS RIDX_LAST = RIDX_GLOBALS
) )
// /* type of numbers in Lua */ /* type of numbers in Lua */
type Number = c.Double type Number = c.Double
// /* type for integer functions */ /* type for integer functions */
type Integer = c.Int type Integer = c.Int
// /* unsigned integer type */ /* unsigned integer type */
type Unsigned = c.Uint type Unsigned = c.Uint
// /* type for continuation-function contexts */ /* type for continuation-function contexts */
type KContext = c.Pointer type KContext = c.Pointer
// /* /*
// ** Type for C functions registered with Lua * Type for C functions registered with Lua
// */ */
// llgo:type C // llgo:type C
type CFunction func(L *State) c.Int type CFunction func(L *State) c.Int
// /* /*
// ** Type for continuation functions * Type for continuation functions
// */ */
// llgo:type C // llgo:type C
type KFunction func(L *State, status c.Int, ctx KContext) c.Int type KFunction func(L *State, status c.Int, ctx KContext) c.Int
// /* /*
// ** Type for functions that read/write blocks when loading/dumping Lua chunks * Type for functions that read/write blocks when loading/dumping Lua chunks
// */ */
// llgo:type C // llgo:type C
type Reader func(L *State, ud c.Pointer, sz *c.Ulong) *c.Char type Reader func(L *State, ud c.Pointer, sz *c.Ulong) *c.Char
@@ -110,47 +110,48 @@ type Reader func(L *State, ud c.Pointer, sz *c.Ulong) *c.Char
// llgo:type C // llgo:type C
type Writer func(L *State, p c.Pointer, sz c.Ulong, ud c.Pointer) c.Int type Writer func(L *State, p c.Pointer, sz c.Ulong, ud c.Pointer) c.Int
// /* /*
// ** Type for memory-allocation functions * Type for memory-allocation functions
// */ */
// typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); // typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
// /* /*
// ** Type for warning functions * Type for warning functions
// */ */
// typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont); // typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
// /* /*
// ** Type used by the debug API to collect debug information * Type used by the debug API to collect debug information
// */ */
// typedef struct lua_Debug lua_Debug; // typedef struct lua_Debug lua_Debug;
// /* /*
// ** Functions to be called by the debugger in specific events * Functions to be called by the debugger in specific events
// */ */
// typedef void (*lua_Hook) (State *L, lua_Debug *ar); // typedef void (*lua_Hook) (State *L, lua_Debug *ar);
// /* /*
// ** generic extra include file * generic extra include file
// */ */
// #if defined(LUA_USER_H) // #if defined(LUA_USER_H)
// #include LUA_USER_H // #include LUA_USER_H
// #endif // #endif
// /* /*
// ** RCS ident string * RCS ident string
// */ */
// extern const char lua_ident[]; // extern const char lua_ident[];
// /* /*
// ** state manipulation ** state manipulation
// */ */
// llgo:link (*State).Close C.lua_close // llgo:link (*State).Close C.lua_close
func (L *State) Close() {} func (L *State) Close() {}
@@ -171,9 +172,9 @@ func (L *State) Atpanic(panicf CFunction) CFunction { return nil }
// llgo:link (*State).Version C.lua_version // llgo:link (*State).Version C.lua_version
func (L *State) Version() Number { return 0 } func (L *State) Version() Number { return 0 }
// /* /*
// ** basic stack manipulation * basic stack manipulation
// */ */
// llgo:link (*State).Absindex C.lua_absindex // llgo:link (*State).Absindex C.lua_absindex
func (L *State) Absindex(idx c.Int) c.Int { return 0 } func (L *State) Absindex(idx c.Int) c.Int { return 0 }
@@ -199,9 +200,9 @@ func (L *State) Checkstack(n c.Int) c.Int { return 0 }
// llgo:link (*State).Xmove C.lua_xmove // llgo:link (*State).Xmove C.lua_xmove
func (L *State) Xmove(to *State, n c.Int) {} func (L *State) Xmove(to *State, n c.Int) {}
// /* /*
// ** access functions (stack -> C) * access functions (stack -> C)
// */ */
// llgo:link (*State).Isnumber C.lua_isnumber // llgo:link (*State).Isnumber C.lua_isnumber
func (L *State) Isnumber(idx c.Int) c.Int { return 0 } func (L *State) Isnumber(idx c.Int) c.Int { return 0 }
@@ -249,13 +250,14 @@ func (L *State) Tothread(idx c.Int) *State { return nil }
// LUA_API const void *(lua_topointer) (State *L, int idx); // LUA_API const void *(lua_topointer) (State *L, int idx);
// /* /*
// ** Comparison and arithmetic functions * Comparison and arithmetic functions
// */ */
/*
* push functions (C -> stack)
*/
// /*
// ** push functions (C -> stack)
// */
// llgo:link (*State).Pushnil C.lua_pushnil // llgo:link (*State).Pushnil C.lua_pushnil
func (L *State) Pushnil() {} func (L *State) Pushnil() {}
@@ -286,9 +288,9 @@ func (L *State) Pushlightuserdata(p c.Pointer) {}
// llgo:link (*State).Pushthread C.lua_pushthread // llgo:link (*State).Pushthread C.lua_pushthread
func (L *State) Pushthread() c.Int { return 0 } func (L *State) Pushthread() c.Int { return 0 }
// /* /*
// ** get functions (Lua -> stack) * get functions (Lua -> stack)
// */ */
// llgo:link (*State).Getglobal C.lua_getglobal // llgo:link (*State).Getglobal C.lua_getglobal
func (L *State) Getglobal(name *c.Char) c.Int { return 0 } func (L *State) Getglobal(name *c.Char) c.Int { return 0 }
@@ -315,9 +317,9 @@ func (L *State) Getmetatable(objindex c.Int) c.Int { return 0 }
// LUA_API int (lua_getiuservalue) (State *L, int idx, int n); // LUA_API int (lua_getiuservalue) (State *L, int idx, int n);
// /* /*
// ** set functions (stack -> Lua) * set functions (stack -> Lua)
// */ */
// llgo:link (*State).Setglobal C.lua_setglobal // llgo:link (*State).Setglobal C.lua_setglobal
func (L *State) Setglobal(name *c.Char) {} func (L *State) Setglobal(name *c.Char) {}
@@ -338,9 +340,9 @@ func (L *State) Setmetatable(objindex c.Int) c.Int { return 0 }
//int (lua_setiuservalue) (State *L, int idx, int n); //int (lua_setiuservalue) (State *L, int idx, int n);
// /* /*
// ** 'load' and 'call' functions (load and run Lua code) * 'load' and 'call' functions (load and run Lua code)
// */ */
// llgo:link (*State).Callk C.lua_callk // llgo:link (*State).Callk C.lua_callk
func (L *State) Callk(nargs c.Int, nresults c.Int, ctx KContext, k KFunction) c.Int { func (L *State) Callk(nargs c.Int, nresults c.Int, ctx KContext, k KFunction) c.Int {
@@ -366,9 +368,9 @@ func (L *State) Load(reader Reader, dt c.Pointer, chunkname *c.Char, mode *c.Cha
// llgo:link (*State).Dump C.lua_dump // llgo:link (*State).Dump C.lua_dump
func (L *State) Dump(writer Writer, data c.Pointer, strip c.Int) c.Int { return 0 } func (L *State) Dump(writer Writer, data c.Pointer, strip c.Int) c.Int { return 0 }
// /* /*
// ** coroutine functions * coroutine functions
// */ */
// llgo:link (*State).Resume C.lua_resume // llgo:link (*State).Resume C.lua_resume
func (L *State) Resume(from *State, narg c.Int, nres *c.Int) c.Int { return 0 } func (L *State) Resume(from *State, narg c.Int, nres *c.Int) c.Int { return 0 }
@@ -383,16 +385,16 @@ func (L *State) Isyieldable() c.Int { return 0 }
func (L *State) Yieldk(nresults c.Int, ctx KContext, k KFunction) c.Int { return 0 } func (L *State) Yieldk(nresults c.Int, ctx KContext, k KFunction) c.Int { return 0 }
func (L *State) Yield(nresults c.Int) c.Int { return L.Yieldk(nresults, nil, nil) } func (L *State) Yield(nresults c.Int) c.Int { return L.Yieldk(nresults, nil, nil) }
// /* /*
// ** Warning-related functions * Warning-related functions
// */ */
//void (lua_setwarnf) (State *L, lua_WarnFunction f, void *ud); //void (lua_setwarnf) (State *L, lua_WarnFunction f, void *ud);
//void (lua_warning) (State *L, const char *msg, int tocont); //void (lua_warning) (State *L, const char *msg, int tocont);
// /* /*
// ** garbage-collection function and options * garbage-collection function and options
// */ */
const ( const (
GCSTOP = 0 GCSTOP = 0
@@ -410,9 +412,9 @@ const (
// LUA_API int (lua_gc) (State *L, int what, ...); // LUA_API int (lua_gc) (State *L, int what, ...);
// /* /*
// ** miscellaneous functions * miscellaneous functions
// */ */
// llgo:link (*State).Next C.lua_next // llgo:link (*State).Next C.lua_next
func (L *State) Next(idx c.Int) c.Int { return 0 } func (L *State) Next(idx c.Int) c.Int { return 0 }
@@ -430,11 +432,11 @@ func (L *State) Error() c.Int { return 0 }
// LUA_API void (lua_toclose) (State *L, int idx); // LUA_API void (lua_toclose) (State *L, int idx);
// LUA_API void (lua_closeslot) (State *L, int idx); // LUA_API void (lua_closeslot) (State *L, int idx);
// /* /*
// ** {============================================================== ** {==============================================================
// ** some useful macros ** some useful macros
// ** =============================================================== ** ===============================================================
// */ */
// #define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) // #define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE))
@@ -476,13 +478,13 @@ func (L *State) Replace(idx c.Int) {
L.Pop(1) L.Pop(1)
} }
// /* }============================================================== */ /* }============================================================== */
// /* /*
// ** {============================================================== ** {==============================================================
// ** compatibility macros ** compatibility macros
// ** =============================================================== ** ===============================================================
// */ */
func (L *State) Newuserdata(sz uintptr) c.Pointer { func (L *State) Newuserdata(sz uintptr) c.Pointer {
return L.Newuserdatauv(sz, 1) return L.Newuserdatauv(sz, 1)
@@ -493,16 +495,17 @@ func (L *State) Newuserdata(sz uintptr) c.Pointer {
// #define LUA_NUMTAGS LUA_NUMTYPES // #define LUA_NUMTAGS LUA_NUMTYPES
// /* }============================================================== */ /* }============================================================== */
// /* /*
// ** {====================================================================== ** {======================================================================
// ** Debug API ** Debug API
// ** ======================================================================= ** =======================================================================
// */ */
// /*
// ** Event codes /*
// */ * Event codes
*/
const ( const (
HOOKCALL = 0 HOOKCALL = 0
@@ -512,9 +515,9 @@ const (
HOOKTAILCALL = 4 HOOKTAILCALL = 4
) )
// /* /*
// ** Event masks * Event masks
// */ */
const ( const (
MASKCALL = 1 << HOOKCOUNT MASKCALL = 1 << HOOKCOUNT
@@ -541,4 +544,4 @@ const (
// LUA_API int (lua_setcstacklimit) (State *L, unsigned int limit); // LUA_API int (lua_setcstacklimit) (State *L, unsigned int limit);
// struct lua_Debug // struct lua_Debug
// /* }====================================================================== */ /* }====================================================================== */