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"
)
// /* 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 (
MULTRET = -1
)
// /*
// ** Pseudo-indices
// ** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
// ** space after that to help overflow detection)
// */
/*
* Pseudo-indices
* (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
* space after that to help overflow detection)
*/
const (
REGISTRYINDEX = -MAXSTACK - 1000
@@ -31,7 +31,7 @@ func Upvalueindex(i c.Int) c.Int {
return c.Int(REGISTRYINDEX) - i
}
// /* thread status */
/* thread status */
const (
OK = 0
YIELD = 1
@@ -45,9 +45,9 @@ type State struct {
Unused [8]byte
}
// /*
// ** basic types
// */
/*
* basic types
*/
const (
NONE c.Int = -1
NIL c.Int = 0
@@ -62,47 +62,47 @@ const (
UMTYPES c.Int = 9
)
// /* minimum Lua stack available to a C function */
/* minimum Lua stack available to a C function */
const (
MINSTACK = 20
)
// /* predefined values in the registry */
/* predefined values in the registry */
const (
RIDX_MAINTHREAD = 1
RIDX_GLOBALS = 2
RIDX_LAST = RIDX_GLOBALS
)
// /* type of numbers in Lua */
/* type of numbers in Lua */
type Number = c.Double
// /* type for integer functions */
/* type for integer functions */
type Integer = c.Int
// /* unsigned integer type */
/* unsigned integer type */
type Unsigned = c.Uint
// /* type for continuation-function contexts */
/* type for continuation-function contexts */
type KContext = c.Pointer
// /*
// ** Type for C functions registered with Lua
// */
/*
* Type for C functions registered with Lua
*/
// llgo:type C
type CFunction func(L *State) c.Int
// /*
// ** Type for continuation functions
// */
/*
* Type for continuation functions
*/
// llgo:type C
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
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
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);
// /*
// ** Type for warning functions
// */
/*
* Type for warning functions
*/
// 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;
// /*
// ** 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);
// /*
// ** generic extra include file
// */
/*
* generic extra include file
*/
// #if defined(LUA_USER_H)
// #include LUA_USER_H
// #endif
// /*
// ** RCS ident string
// */
/*
* RCS ident string
*/
// extern const char lua_ident[];
// /*
// ** state manipulation
// */
/*
** state manipulation
*/
// llgo:link (*State).Close C.lua_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
func (L *State) Version() Number { return 0 }
// /*
// ** basic stack manipulation
// */
/*
* basic stack manipulation
*/
// llgo:link (*State).Absindex C.lua_absindex
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
func (L *State) Xmove(to *State, n c.Int) {}
// /*
// ** access functions (stack -> C)
// */
/*
* access functions (stack -> C)
*/
// llgo:link (*State).Isnumber C.lua_isnumber
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);
// /*
// ** Comparison and arithmetic functions
// */
/*
* Comparison and arithmetic functions
*/
/*
* push functions (C -> stack)
*/
// /*
// ** push functions (C -> stack)
// */
// llgo:link (*State).Pushnil C.lua_pushnil
func (L *State) Pushnil() {}
@@ -286,9 +288,9 @@ func (L *State) Pushlightuserdata(p c.Pointer) {}
// llgo:link (*State).Pushthread C.lua_pushthread
func (L *State) Pushthread() c.Int { return 0 }
// /*
// ** get functions (Lua -> stack)
// */
/*
* get functions (Lua -> stack)
*/
// llgo:link (*State).Getglobal C.lua_getglobal
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);
// /*
// ** set functions (stack -> Lua)
// */
/*
* set functions (stack -> Lua)
*/
// llgo:link (*State).Setglobal C.lua_setglobal
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);
// /*
// ** '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
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
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
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) 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_warning) (State *L, const char *msg, int tocont);
// /*
// ** garbage-collection function and options
// */
/*
* garbage-collection function and options
*/
const (
GCSTOP = 0
@@ -410,9 +412,9 @@ const (
// LUA_API int (lua_gc) (State *L, int what, ...);
// /*
// ** miscellaneous functions
// */
/*
* miscellaneous functions
*/
// llgo:link (*State).Next C.lua_next
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_closeslot) (State *L, int idx);
// /*
// ** {==============================================================
// ** some useful macros
// ** ===============================================================
// */
/*
** {==============================================================
** some useful macros
** ===============================================================
*/
// #define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE))
@@ -476,13 +478,13 @@ func (L *State) Replace(idx c.Int) {
L.Pop(1)
}
// /* }============================================================== */
/* }============================================================== */
// /*
// ** {==============================================================
// ** compatibility macros
// ** ===============================================================
// */
/*
** {==============================================================
** compatibility macros
** ===============================================================
*/
func (L *State) Newuserdata(sz uintptr) c.Pointer {
return L.Newuserdatauv(sz, 1)
@@ -493,16 +495,17 @@ func (L *State) Newuserdata(sz uintptr) c.Pointer {
// #define LUA_NUMTAGS LUA_NUMTYPES
// /* }============================================================== */
/* }============================================================== */
// /*
// ** {======================================================================
// ** Debug API
// ** =======================================================================
// */
// /*
// ** Event codes
// */
/*
** {======================================================================
** Debug API
** =======================================================================
*/
/*
* Event codes
*/
const (
HOOKCALL = 0
@@ -512,9 +515,9 @@ const (
HOOKTAILCALL = 4
)
// /*
// ** Event masks
// */
/*
* Event masks
*/
const (
MASKCALL = 1 << HOOKCOUNT
@@ -541,4 +544,4 @@ const (
// LUA_API int (lua_setcstacklimit) (State *L, unsigned int limit);
// struct lua_Debug
// /* }====================================================================== */
/* }====================================================================== */