.clang-format updates
This commit is contained in:
@@ -16,76 +16,63 @@
|
||||
#define LUA_ERRFILE (LUA_ERRERR + 1)
|
||||
|
||||
typedef struct luaL_Reg {
|
||||
const char *name;
|
||||
const char* name;
|
||||
lua_CFunction func;
|
||||
} luaL_Reg;
|
||||
|
||||
LUALIB_API void(luaL_openlib)(lua_State *L, const char *libname,
|
||||
const luaL_Reg *l, int nup);
|
||||
LUALIB_API void(luaL_register)(lua_State *L, const char *libname,
|
||||
const luaL_Reg *l);
|
||||
LUALIB_API int(luaL_getmetafield)(lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int(luaL_callmeta)(lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int(luaL_typerror)(lua_State *L, int narg, const char *tname);
|
||||
LUALIB_API int(luaL_argerror)(lua_State *L, int numarg, const char *extramsg);
|
||||
LUALIB_API const char *(luaL_checklstring)(lua_State * L, int numArg,
|
||||
size_t *l);
|
||||
LUALIB_API const char *(luaL_optlstring)(lua_State * L, int numArg,
|
||||
const char *def, size_t *l);
|
||||
LUALIB_API lua_Number(luaL_checknumber)(lua_State *L, int numArg);
|
||||
LUALIB_API lua_Number(luaL_optnumber)(lua_State *L, int nArg, lua_Number def);
|
||||
LUALIB_API void(luaL_openlib)(lua_State* L, const char* libname, const luaL_Reg* l, int nup);
|
||||
LUALIB_API void(luaL_register)(lua_State* L, const char* libname, const luaL_Reg* l);
|
||||
LUALIB_API int(luaL_getmetafield)(lua_State* L, int obj, const char* e);
|
||||
LUALIB_API int(luaL_callmeta)(lua_State* L, int obj, const char* e);
|
||||
LUALIB_API int(luaL_typerror)(lua_State* L, int narg, const char* tname);
|
||||
LUALIB_API int(luaL_argerror)(lua_State* L, int numarg, const char* extramsg);
|
||||
LUALIB_API const char*(luaL_checklstring)(lua_State * L, int numArg, size_t* l);
|
||||
LUALIB_API const char*(luaL_optlstring)(lua_State * L, int numArg, const char* def, size_t* l);
|
||||
LUALIB_API lua_Number(luaL_checknumber)(lua_State* L, int numArg);
|
||||
LUALIB_API lua_Number(luaL_optnumber)(lua_State* L, int nArg, lua_Number def);
|
||||
|
||||
LUALIB_API lua_Integer(luaL_checkinteger)(lua_State *L, int numArg);
|
||||
LUALIB_API lua_Integer(luaL_optinteger)(lua_State *L, int nArg,
|
||||
lua_Integer def);
|
||||
LUALIB_API lua_Integer(luaL_checkinteger)(lua_State* L, int numArg);
|
||||
LUALIB_API lua_Integer(luaL_optinteger)(lua_State* L, int nArg, lua_Integer def);
|
||||
|
||||
LUALIB_API void(luaL_checkstack)(lua_State *L, int sz, const char *msg);
|
||||
LUALIB_API void(luaL_checktype)(lua_State *L, int narg, int t);
|
||||
LUALIB_API void(luaL_checkany)(lua_State *L, int narg);
|
||||
LUALIB_API void(luaL_checkstack)(lua_State* L, int sz, const char* msg);
|
||||
LUALIB_API void(luaL_checktype)(lua_State* L, int narg, int t);
|
||||
LUALIB_API void(luaL_checkany)(lua_State* L, int narg);
|
||||
|
||||
LUALIB_API int(luaL_newmetatable)(lua_State *L, const char *tname);
|
||||
LUALIB_API void *(luaL_checkudata)(lua_State * L, int ud, const char *tname);
|
||||
LUALIB_API int(luaL_newmetatable)(lua_State* L, const char* tname);
|
||||
LUALIB_API void*(luaL_checkudata)(lua_State * L, int ud, const char* tname);
|
||||
|
||||
LUALIB_API void(luaL_where)(lua_State *L, int lvl);
|
||||
LUALIB_API int(luaL_error)(lua_State *L, const char *fmt, ...);
|
||||
LUALIB_API void(luaL_where)(lua_State* L, int lvl);
|
||||
LUALIB_API int(luaL_error)(lua_State* L, const char* fmt, ...);
|
||||
|
||||
LUALIB_API int(luaL_checkoption)(lua_State *L, int narg, const char *def,
|
||||
const char *const lst[]);
|
||||
LUALIB_API int(luaL_checkoption)(lua_State* L, int narg, const char* def, const char* const lst[]);
|
||||
|
||||
/* pre-defined references */
|
||||
#define LUA_NOREF (-2)
|
||||
#define LUA_REFNIL (-1)
|
||||
|
||||
LUALIB_API int(luaL_ref)(lua_State *L, int t);
|
||||
LUALIB_API void(luaL_unref)(lua_State *L, int t, int ref);
|
||||
LUALIB_API int(luaL_ref)(lua_State* L, int t);
|
||||
LUALIB_API void(luaL_unref)(lua_State* L, int t, int ref);
|
||||
|
||||
LUALIB_API int(luaL_loadfile)(lua_State *L, const char *filename);
|
||||
LUALIB_API int(luaL_loadbuffer)(lua_State *L, const char *buff, size_t sz,
|
||||
const char *name);
|
||||
LUALIB_API int(luaL_loadstring)(lua_State *L, const char *s);
|
||||
LUALIB_API int(luaL_loadfile)(lua_State* L, const char* filename);
|
||||
LUALIB_API int(luaL_loadbuffer)(lua_State* L, const char* buff, size_t sz, const char* name);
|
||||
LUALIB_API int(luaL_loadstring)(lua_State* L, const char* s);
|
||||
|
||||
LUALIB_API lua_State *(luaL_newstate)(void);
|
||||
LUALIB_API lua_State*(luaL_newstate)(void);
|
||||
|
||||
LUALIB_API const char *(luaL_gsub)(lua_State * L, 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);
|
||||
|
||||
LUALIB_API const char *(luaL_findtable)(lua_State * L, int idx,
|
||||
const char *fname, int szhint);
|
||||
LUALIB_API const char*(luaL_findtable)(lua_State * L, int idx, const char* fname, int szhint);
|
||||
|
||||
/* From Lua 5.2. */
|
||||
LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname);
|
||||
LUALIB_API int luaL_execresult(lua_State *L, int stat);
|
||||
LUALIB_API int(luaL_loadfilex)(lua_State *L, const char *filename,
|
||||
const char *mode);
|
||||
LUALIB_API int(luaL_loadbufferx)(lua_State *L, const char *buff, size_t sz,
|
||||
const char *name, const char *mode);
|
||||
LUALIB_API void luaL_traceback(lua_State *L, lua_State *L1, const char *msg,
|
||||
int level);
|
||||
LUALIB_API void(luaL_setfuncs)(lua_State *L, const luaL_Reg *l, int nup);
|
||||
LUALIB_API void(luaL_pushmodule)(lua_State *L, const char *modname,
|
||||
int sizehint);
|
||||
LUALIB_API void *(luaL_testudata)(lua_State * L, int ud, const char *tname);
|
||||
LUALIB_API void(luaL_setmetatable)(lua_State *L, const char *tname);
|
||||
LUALIB_API int luaL_fileresult(lua_State* L, int stat, const char* fname);
|
||||
LUALIB_API int luaL_execresult(lua_State* L, int stat);
|
||||
LUALIB_API int(luaL_loadfilex)(lua_State* L, const char* filename, const char* mode);
|
||||
LUALIB_API int(luaL_loadbufferx)(lua_State* L, const char* buff, size_t sz, const char* name, const char* mode);
|
||||
LUALIB_API void luaL_traceback(lua_State* L, lua_State* L1, const char* msg, int level);
|
||||
LUALIB_API void(luaL_setfuncs)(lua_State* L, const luaL_Reg* l, int nup);
|
||||
LUALIB_API void(luaL_pushmodule)(lua_State* L, const char* modname, int sizehint);
|
||||
LUALIB_API void*(luaL_testudata)(lua_State * L, int ud, const char* tname);
|
||||
LUALIB_API void(luaL_setmetatable)(lua_State* L, const char* tname);
|
||||
|
||||
/*
|
||||
** ===============================================================
|
||||
@@ -93,8 +80,7 @@ LUALIB_API void(luaL_setmetatable)(lua_State *L, const char *tname);
|
||||
** ===============================================================
|
||||
*/
|
||||
|
||||
#define luaL_argcheck(L, cond, numarg, extramsg) \
|
||||
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
#define luaL_argcheck(L, cond, numarg, extramsg) ((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
#define luaL_checkstring(L, n) (luaL_checklstring(L, (n), NULL))
|
||||
#define luaL_optstring(L, n, d) (luaL_optlstring(L, (n), (d), NULL))
|
||||
#define luaL_checkint(L, n) ((int)luaL_checkinteger(L, (n)))
|
||||
@@ -104,19 +90,16 @@ LUALIB_API void(luaL_setmetatable)(lua_State *L, const char *tname);
|
||||
|
||||
#define luaL_typename(L, i) lua_typename(L, lua_type(L, (i)))
|
||||
|
||||
#define luaL_dofile(L, fn) \
|
||||
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
||||
#define luaL_dofile(L, fn) (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
||||
|
||||
#define luaL_dostring(L, s) \
|
||||
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
||||
#define luaL_dostring(L, s) (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
||||
|
||||
#define luaL_getmetatable(L, n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
|
||||
|
||||
#define luaL_opt(L, f, n, d) (lua_isnoneornil(L, (n)) ? (d) : f(L, (n)))
|
||||
|
||||
/* From Lua 5.2. */
|
||||
#define luaL_newlibtable(L, l) \
|
||||
lua_createtable(L, 0, sizeof(l) / sizeof((l)[0]) - 1)
|
||||
#define luaL_newlibtable(L, l) lua_createtable(L, 0, sizeof(l) / sizeof((l)[0]) - 1)
|
||||
#define luaL_newlib(L, l) (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0))
|
||||
|
||||
/*
|
||||
@@ -126,27 +109,26 @@ LUALIB_API void(luaL_setmetatable)(lua_State *L, const char *tname);
|
||||
*/
|
||||
|
||||
typedef struct luaL_Buffer {
|
||||
char *p; /* current position in buffer */
|
||||
char* p; /* current position in buffer */
|
||||
int lvl; /* number of strings in the stack (level) */
|
||||
lua_State *L;
|
||||
lua_State* L;
|
||||
char buffer[LUAL_BUFFERSIZE];
|
||||
} luaL_Buffer;
|
||||
|
||||
#define luaL_addchar(B, c) \
|
||||
((void)((B)->p < ((B)->buffer + LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
|
||||
(*(B)->p++ = (char)(c)))
|
||||
#define luaL_addchar(B, c) \
|
||||
((void)((B)->p < ((B)->buffer + LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), (*(B)->p++ = (char)(c)))
|
||||
|
||||
/* compatibility only */
|
||||
#define luaL_putchar(B, c) luaL_addchar(B, c)
|
||||
|
||||
#define luaL_addsize(B, n) ((B)->p += (n))
|
||||
|
||||
LUALIB_API void(luaL_buffinit)(lua_State *L, luaL_Buffer *B);
|
||||
LUALIB_API char *(luaL_prepbuffer)(luaL_Buffer * B);
|
||||
LUALIB_API void(luaL_addlstring)(luaL_Buffer *B, const char *s, size_t l);
|
||||
LUALIB_API void(luaL_addstring)(luaL_Buffer *B, const char *s);
|
||||
LUALIB_API void(luaL_addvalue)(luaL_Buffer *B);
|
||||
LUALIB_API void(luaL_pushresult)(luaL_Buffer *B);
|
||||
LUALIB_API void(luaL_buffinit)(lua_State* L, luaL_Buffer* B);
|
||||
LUALIB_API char*(luaL_prepbuffer)(luaL_Buffer * B);
|
||||
LUALIB_API void(luaL_addlstring)(luaL_Buffer* B, const char* s, size_t l);
|
||||
LUALIB_API void(luaL_addstring)(luaL_Buffer* B, const char* s);
|
||||
LUALIB_API void(luaL_addvalue)(luaL_Buffer* B);
|
||||
LUALIB_API void(luaL_pushresult)(luaL_Buffer* B);
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
200
inc/lua/lua.h
200
inc/lua/lua.h
@@ -43,19 +43,19 @@
|
||||
|
||||
typedef struct lua_State lua_State;
|
||||
|
||||
typedef int (*lua_CFunction)(lua_State *L);
|
||||
typedef int (*lua_CFunction)(lua_State* L);
|
||||
|
||||
/*
|
||||
** functions that read/write blocks when loading/dumping Lua chunks
|
||||
*/
|
||||
typedef const char *(*lua_Reader)(lua_State *L, void *ud, size_t *sz);
|
||||
typedef const char* (*lua_Reader)(lua_State* L, void* ud, size_t* sz);
|
||||
|
||||
typedef int (*lua_Writer)(lua_State *L, const void *p, size_t sz, void *ud);
|
||||
typedef int (*lua_Writer)(lua_State* L, const void* p, size_t sz, void* ud);
|
||||
|
||||
/*
|
||||
** prototype 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);
|
||||
|
||||
/*
|
||||
** basic types
|
||||
@@ -91,105 +91,103 @@ typedef LUA_INTEGER lua_Integer;
|
||||
/*
|
||||
** state manipulation
|
||||
*/
|
||||
LUA_API lua_State *(lua_newstate)(lua_Alloc f, void *ud);
|
||||
LUA_API void(lua_close)(lua_State *L);
|
||||
LUA_API lua_State *(lua_newthread)(lua_State * L);
|
||||
LUA_API lua_State*(lua_newstate)(lua_Alloc f, void* ud);
|
||||
LUA_API void(lua_close)(lua_State* L);
|
||||
LUA_API lua_State*(lua_newthread)(lua_State * L);
|
||||
|
||||
LUA_API lua_CFunction(lua_atpanic)(lua_State *L, lua_CFunction panicf);
|
||||
LUA_API lua_CFunction(lua_atpanic)(lua_State* L, lua_CFunction panicf);
|
||||
|
||||
/*
|
||||
** basic stack manipulation
|
||||
*/
|
||||
LUA_API int(lua_gettop)(lua_State *L);
|
||||
LUA_API void(lua_settop)(lua_State *L, int idx);
|
||||
LUA_API void(lua_pushvalue)(lua_State *L, int idx);
|
||||
LUA_API void(lua_remove)(lua_State *L, int idx);
|
||||
LUA_API void(lua_insert)(lua_State *L, int idx);
|
||||
LUA_API void(lua_replace)(lua_State *L, int idx);
|
||||
LUA_API int(lua_checkstack)(lua_State *L, int sz);
|
||||
LUA_API int(lua_gettop)(lua_State* L);
|
||||
LUA_API void(lua_settop)(lua_State* L, int idx);
|
||||
LUA_API void(lua_pushvalue)(lua_State* L, int idx);
|
||||
LUA_API void(lua_remove)(lua_State* L, int idx);
|
||||
LUA_API void(lua_insert)(lua_State* L, int idx);
|
||||
LUA_API void(lua_replace)(lua_State* L, int idx);
|
||||
LUA_API int(lua_checkstack)(lua_State* L, int sz);
|
||||
|
||||
LUA_API void(lua_xmove)(lua_State *from, lua_State *to, int n);
|
||||
LUA_API void(lua_xmove)(lua_State* from, lua_State* to, int n);
|
||||
|
||||
/*
|
||||
** access functions (stack -> C)
|
||||
*/
|
||||
|
||||
LUA_API int(lua_isnumber)(lua_State *L, int idx);
|
||||
LUA_API int(lua_isstring)(lua_State *L, int idx);
|
||||
LUA_API int(lua_iscfunction)(lua_State *L, int idx);
|
||||
LUA_API int(lua_isuserdata)(lua_State *L, int idx);
|
||||
LUA_API int(lua_type)(lua_State *L, int idx);
|
||||
LUA_API const char *(lua_typename)(lua_State * L, int tp);
|
||||
LUA_API int(lua_isnumber)(lua_State* L, int idx);
|
||||
LUA_API int(lua_isstring)(lua_State* L, int idx);
|
||||
LUA_API int(lua_iscfunction)(lua_State* L, int idx);
|
||||
LUA_API int(lua_isuserdata)(lua_State* L, int idx);
|
||||
LUA_API int(lua_type)(lua_State* L, int idx);
|
||||
LUA_API const char*(lua_typename)(lua_State * L, int tp);
|
||||
|
||||
LUA_API int(lua_equal)(lua_State *L, int idx1, int idx2);
|
||||
LUA_API int(lua_rawequal)(lua_State *L, int idx1, int idx2);
|
||||
LUA_API int(lua_lessthan)(lua_State *L, int idx1, int idx2);
|
||||
LUA_API int(lua_equal)(lua_State* L, int idx1, int idx2);
|
||||
LUA_API int(lua_rawequal)(lua_State* L, int idx1, int idx2);
|
||||
LUA_API int(lua_lessthan)(lua_State* L, int idx1, int idx2);
|
||||
|
||||
LUA_API lua_Number(lua_tonumber)(lua_State *L, int idx);
|
||||
LUA_API lua_Integer(lua_tointeger)(lua_State *L, int idx);
|
||||
LUA_API int(lua_toboolean)(lua_State *L, int idx);
|
||||
LUA_API const char *(lua_tolstring)(lua_State * L, int idx, size_t *len);
|
||||
LUA_API size_t(lua_objlen)(lua_State *L, int idx);
|
||||
LUA_API lua_CFunction(lua_tocfunction)(lua_State *L, int idx);
|
||||
LUA_API void *(lua_touserdata)(lua_State * L, int idx);
|
||||
LUA_API lua_State *(lua_tothread)(lua_State * L, int idx);
|
||||
LUA_API const void *(lua_topointer)(lua_State * L, int idx);
|
||||
LUA_API lua_Number(lua_tonumber)(lua_State* L, int idx);
|
||||
LUA_API lua_Integer(lua_tointeger)(lua_State* L, int idx);
|
||||
LUA_API int(lua_toboolean)(lua_State* L, int idx);
|
||||
LUA_API const char*(lua_tolstring)(lua_State * L, int idx, size_t* len);
|
||||
LUA_API size_t(lua_objlen)(lua_State* L, int idx);
|
||||
LUA_API lua_CFunction(lua_tocfunction)(lua_State* L, int idx);
|
||||
LUA_API void*(lua_touserdata)(lua_State * L, int idx);
|
||||
LUA_API lua_State*(lua_tothread)(lua_State * L, int idx);
|
||||
LUA_API const void*(lua_topointer)(lua_State * L, int idx);
|
||||
|
||||
/*
|
||||
** push functions (C -> stack)
|
||||
*/
|
||||
LUA_API void(lua_pushnil)(lua_State *L);
|
||||
LUA_API void(lua_pushnumber)(lua_State *L, lua_Number n);
|
||||
LUA_API void(lua_pushinteger)(lua_State *L, lua_Integer n);
|
||||
LUA_API void(lua_pushlstring)(lua_State *L, const char *s, size_t l);
|
||||
LUA_API void(lua_pushstring)(lua_State *L, const char *s);
|
||||
LUA_API const char *(lua_pushvfstring)(lua_State * L, const char *fmt,
|
||||
va_list argp);
|
||||
LUA_API const char *(lua_pushfstring)(lua_State * L, const char *fmt, ...);
|
||||
LUA_API void(lua_pushcclosure)(lua_State *L, lua_CFunction fn, int n);
|
||||
LUA_API void(lua_pushboolean)(lua_State *L, int b);
|
||||
LUA_API void(lua_pushlightuserdata)(lua_State *L, void *p);
|
||||
LUA_API int(lua_pushthread)(lua_State *L);
|
||||
LUA_API void(lua_pushnil)(lua_State* L);
|
||||
LUA_API void(lua_pushnumber)(lua_State* L, lua_Number n);
|
||||
LUA_API void(lua_pushinteger)(lua_State* L, lua_Integer n);
|
||||
LUA_API void(lua_pushlstring)(lua_State* L, const char* s, size_t l);
|
||||
LUA_API void(lua_pushstring)(lua_State* L, const char* s);
|
||||
LUA_API const char*(lua_pushvfstring)(lua_State * L, const char* fmt, va_list argp);
|
||||
LUA_API const char*(lua_pushfstring)(lua_State * L, const char* fmt, ...);
|
||||
LUA_API void(lua_pushcclosure)(lua_State* L, lua_CFunction fn, int n);
|
||||
LUA_API void(lua_pushboolean)(lua_State* L, int b);
|
||||
LUA_API void(lua_pushlightuserdata)(lua_State* L, void* p);
|
||||
LUA_API int(lua_pushthread)(lua_State* L);
|
||||
|
||||
/*
|
||||
** get functions (Lua -> stack)
|
||||
*/
|
||||
LUA_API void(lua_gettable)(lua_State *L, int idx);
|
||||
LUA_API void(lua_getfield)(lua_State *L, int idx, const char *k);
|
||||
LUA_API void(lua_rawget)(lua_State *L, int idx);
|
||||
LUA_API void(lua_rawgeti)(lua_State *L, int idx, int n);
|
||||
LUA_API void(lua_createtable)(lua_State *L, int narr, int nrec);
|
||||
LUA_API void *(lua_newuserdata)(lua_State * L, size_t sz);
|
||||
LUA_API int(lua_getmetatable)(lua_State *L, int objindex);
|
||||
LUA_API void(lua_getfenv)(lua_State *L, int idx);
|
||||
LUA_API void(lua_gettable)(lua_State* L, int idx);
|
||||
LUA_API void(lua_getfield)(lua_State* L, int idx, const char* k);
|
||||
LUA_API void(lua_rawget)(lua_State* L, int idx);
|
||||
LUA_API void(lua_rawgeti)(lua_State* L, int idx, int n);
|
||||
LUA_API void(lua_createtable)(lua_State* L, int narr, int nrec);
|
||||
LUA_API void*(lua_newuserdata)(lua_State * L, size_t sz);
|
||||
LUA_API int(lua_getmetatable)(lua_State* L, int objindex);
|
||||
LUA_API void(lua_getfenv)(lua_State* L, int idx);
|
||||
|
||||
/*
|
||||
** set functions (stack -> Lua)
|
||||
*/
|
||||
LUA_API void(lua_settable)(lua_State *L, int idx);
|
||||
LUA_API void(lua_setfield)(lua_State *L, int idx, const char *k);
|
||||
LUA_API void(lua_rawset)(lua_State *L, int idx);
|
||||
LUA_API void(lua_rawseti)(lua_State *L, int idx, int n);
|
||||
LUA_API int(lua_setmetatable)(lua_State *L, int objindex);
|
||||
LUA_API int(lua_setfenv)(lua_State *L, int idx);
|
||||
LUA_API void(lua_settable)(lua_State* L, int idx);
|
||||
LUA_API void(lua_setfield)(lua_State* L, int idx, const char* k);
|
||||
LUA_API void(lua_rawset)(lua_State* L, int idx);
|
||||
LUA_API void(lua_rawseti)(lua_State* L, int idx, int n);
|
||||
LUA_API int(lua_setmetatable)(lua_State* L, int objindex);
|
||||
LUA_API int(lua_setfenv)(lua_State* L, int idx);
|
||||
|
||||
/*
|
||||
** `load' and `call' functions (load and run Lua code)
|
||||
*/
|
||||
LUA_API void(lua_call)(lua_State *L, int nargs, int nresults);
|
||||
LUA_API int(lua_pcall)(lua_State *L, int nargs, int nresults, int errfunc);
|
||||
LUA_API int(lua_cpcall)(lua_State *L, lua_CFunction func, void *ud);
|
||||
LUA_API int(lua_load)(lua_State *L, lua_Reader reader, void *dt,
|
||||
const char *chunkname);
|
||||
LUA_API void(lua_call)(lua_State* L, int nargs, int nresults);
|
||||
LUA_API int(lua_pcall)(lua_State* L, int nargs, int nresults, int errfunc);
|
||||
LUA_API int(lua_cpcall)(lua_State* L, lua_CFunction func, void* ud);
|
||||
LUA_API int(lua_load)(lua_State* L, lua_Reader reader, void* dt, const char* chunkname);
|
||||
|
||||
LUA_API int(lua_dump)(lua_State *L, lua_Writer writer, void *data);
|
||||
LUA_API int(lua_dump)(lua_State* L, lua_Writer writer, void* data);
|
||||
|
||||
/*
|
||||
** coroutine functions
|
||||
*/
|
||||
LUA_API int(lua_yield)(lua_State *L, int nresults);
|
||||
LUA_API int(lua_resume)(lua_State *L, int narg);
|
||||
LUA_API int(lua_status)(lua_State *L);
|
||||
LUA_API int(lua_yield)(lua_State* L, int nresults);
|
||||
LUA_API int(lua_resume)(lua_State* L, int narg);
|
||||
LUA_API int(lua_status)(lua_State* L);
|
||||
|
||||
/*
|
||||
** garbage-collection function and options
|
||||
@@ -205,20 +203,20 @@ LUA_API int(lua_status)(lua_State *L);
|
||||
#define LUA_GCSETSTEPMUL 7
|
||||
#define LUA_GCISRUNNING 9
|
||||
|
||||
LUA_API int(lua_gc)(lua_State *L, int what, int data);
|
||||
LUA_API int(lua_gc)(lua_State* L, int what, int data);
|
||||
|
||||
/*
|
||||
** miscellaneous functions
|
||||
*/
|
||||
|
||||
LUA_API int(lua_error)(lua_State *L);
|
||||
LUA_API int(lua_error)(lua_State* L);
|
||||
|
||||
LUA_API int(lua_next)(lua_State *L, int idx);
|
||||
LUA_API int(lua_next)(lua_State* L, int idx);
|
||||
|
||||
LUA_API void(lua_concat)(lua_State *L, int n);
|
||||
LUA_API void(lua_concat)(lua_State* L, int n);
|
||||
|
||||
LUA_API lua_Alloc(lua_getallocf)(lua_State *L, void **ud);
|
||||
LUA_API void lua_setallocf(lua_State *L, lua_Alloc f, void *ud);
|
||||
LUA_API lua_Alloc(lua_getallocf)(lua_State* L, void** ud);
|
||||
LUA_API void lua_setallocf(lua_State* L, lua_Alloc f, void* ud);
|
||||
|
||||
/*
|
||||
** ===============================================================
|
||||
@@ -245,8 +243,7 @@ LUA_API void lua_setallocf(lua_State *L, lua_Alloc f, void *ud);
|
||||
#define lua_isnone(L, n) (lua_type(L, (n)) == LUA_TNONE)
|
||||
#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
|
||||
|
||||
#define lua_pushliteral(L, s) \
|
||||
lua_pushlstring(L, "" s, (sizeof(s) / sizeof(char)) - 1)
|
||||
#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, (sizeof(s) / sizeof(char)) - 1)
|
||||
|
||||
#define lua_setglobal(L, s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
|
||||
#define lua_getglobal(L, s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
|
||||
@@ -267,7 +264,7 @@ LUA_API void lua_setallocf(lua_State *L, lua_Alloc f, void *ud);
|
||||
#define lua_Chunkwriter lua_Writer
|
||||
|
||||
/* hack */
|
||||
LUA_API void lua_setlevel(lua_State *from, lua_State *to);
|
||||
LUA_API void lua_setlevel(lua_State* from, lua_State* to);
|
||||
|
||||
/*
|
||||
** {======================================================================
|
||||
@@ -295,38 +292,37 @@ LUA_API void lua_setlevel(lua_State *from, lua_State *to);
|
||||
typedef struct lua_Debug lua_Debug; /* activation record */
|
||||
|
||||
/* Functions to be called by the debuger in specific events */
|
||||
typedef void (*lua_Hook)(lua_State *L, lua_Debug *ar);
|
||||
typedef void (*lua_Hook)(lua_State* L, lua_Debug* ar);
|
||||
|
||||
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar);
|
||||
LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar);
|
||||
LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n);
|
||||
LUA_API const char *lua_setlocal(lua_State *L, const lua_Debug *ar, int n);
|
||||
LUA_API const char *lua_getupvalue(lua_State *L, int funcindex, int n);
|
||||
LUA_API const char *lua_setupvalue(lua_State *L, int funcindex, int n);
|
||||
LUA_API int lua_sethook(lua_State *L, lua_Hook func, int mask, int count);
|
||||
LUA_API lua_Hook lua_gethook(lua_State *L);
|
||||
LUA_API int lua_gethookmask(lua_State *L);
|
||||
LUA_API int lua_gethookcount(lua_State *L);
|
||||
LUA_API int lua_getstack(lua_State* L, int level, lua_Debug* ar);
|
||||
LUA_API int lua_getinfo(lua_State* L, const char* what, lua_Debug* ar);
|
||||
LUA_API const char* lua_getlocal(lua_State* L, const lua_Debug* ar, int n);
|
||||
LUA_API const char* lua_setlocal(lua_State* L, const lua_Debug* ar, int n);
|
||||
LUA_API const char* lua_getupvalue(lua_State* L, int funcindex, int n);
|
||||
LUA_API const char* lua_setupvalue(lua_State* L, int funcindex, int n);
|
||||
LUA_API int lua_sethook(lua_State* L, lua_Hook func, int mask, int count);
|
||||
LUA_API lua_Hook lua_gethook(lua_State* L);
|
||||
LUA_API int lua_gethookmask(lua_State* L);
|
||||
LUA_API int lua_gethookcount(lua_State* L);
|
||||
|
||||
/* From Lua 5.2. */
|
||||
LUA_API void *lua_upvalueid(lua_State *L, int idx, int n);
|
||||
LUA_API void lua_upvaluejoin(lua_State *L, int idx1, int n1, int idx2, int n2);
|
||||
LUA_API int lua_loadx(lua_State *L, lua_Reader reader, void *dt,
|
||||
const char *chunkname, const char *mode);
|
||||
LUA_API const lua_Number *lua_version(lua_State *L);
|
||||
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx);
|
||||
LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *isnum);
|
||||
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum);
|
||||
LUA_API void* lua_upvalueid(lua_State* L, int idx, int n);
|
||||
LUA_API void lua_upvaluejoin(lua_State* L, int idx1, int n1, int idx2, int n2);
|
||||
LUA_API int lua_loadx(lua_State* L, lua_Reader reader, void* dt, const char* chunkname, const char* mode);
|
||||
LUA_API const lua_Number* lua_version(lua_State* L);
|
||||
LUA_API void lua_copy(lua_State* L, int fromidx, int toidx);
|
||||
LUA_API lua_Number lua_tonumberx(lua_State* L, int idx, int* isnum);
|
||||
LUA_API lua_Integer lua_tointegerx(lua_State* L, int idx, int* isnum);
|
||||
|
||||
/* From Lua 5.3. */
|
||||
LUA_API int lua_isyieldable(lua_State *L);
|
||||
LUA_API int lua_isyieldable(lua_State* L);
|
||||
|
||||
struct lua_Debug {
|
||||
int event;
|
||||
const char *name; /* (n) */
|
||||
const char *namewhat; /* (n) `global', `local', `field', `method' */
|
||||
const char *what; /* (S) `Lua', `C', `main', `tail' */
|
||||
const char *source; /* (S) */
|
||||
const char* name; /* (n) */
|
||||
const char* namewhat; /* (n) `global', `local', `field', `method' */
|
||||
const char* what; /* (S) `Lua', `C', `main', `tail' */
|
||||
const char* source; /* (S) */
|
||||
int currentline; /* (l) */
|
||||
int nups; /* (u) number of upvalues */
|
||||
int linedefined; /* (S) */
|
||||
|
||||
@@ -76,9 +76,7 @@
|
||||
#define LUA_PATH_MARK "?"
|
||||
#define LUA_EXECDIR "!"
|
||||
#define LUA_IGMARK "-"
|
||||
#define LUA_PATH_CONFIG \
|
||||
LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" LUA_EXECDIR \
|
||||
"\n" LUA_IGMARK "\n"
|
||||
#define LUA_PATH_CONFIG LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" LUA_EXECDIR "\n" LUA_IGMARK "\n"
|
||||
|
||||
/* Quoting in error messages. */
|
||||
#define LUA_QL(x) "'" x "'"
|
||||
@@ -143,15 +141,15 @@
|
||||
#define lua_assert(x) assert(x)
|
||||
#endif
|
||||
#ifdef LUA_USE_APICHECK
|
||||
#define luai_apicheck(L, o) \
|
||||
{ \
|
||||
(void)L; \
|
||||
assert(o); \
|
||||
#define luai_apicheck(L, o) \
|
||||
{ \
|
||||
(void)L; \
|
||||
assert(o); \
|
||||
}
|
||||
#else
|
||||
#define luai_apicheck(L, o) \
|
||||
{ \
|
||||
(void)L; \
|
||||
#define luai_apicheck(L, o) \
|
||||
{ \
|
||||
(void)L; \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -62,16 +62,13 @@ enum {
|
||||
/* LuaJIT public C API. */
|
||||
|
||||
/* Control the JIT engine. */
|
||||
LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode);
|
||||
LUA_API int luaJIT_setmode(lua_State* L, int idx, int mode);
|
||||
|
||||
/* Low-overhead profiling API. */
|
||||
typedef void (*luaJIT_profile_callback)(void *data, lua_State *L, int samples,
|
||||
int vmstate);
|
||||
LUA_API void luaJIT_profile_start(lua_State *L, const char *mode,
|
||||
luaJIT_profile_callback cb, void *data);
|
||||
LUA_API void luaJIT_profile_stop(lua_State *L);
|
||||
LUA_API const char *luaJIT_profile_dumpstack(lua_State *L, const char *fmt,
|
||||
int depth, size_t *len);
|
||||
typedef void (*luaJIT_profile_callback)(void* data, lua_State* L, int samples, int vmstate);
|
||||
LUA_API void luaJIT_profile_start(lua_State* L, const char* mode, luaJIT_profile_callback cb, void* data);
|
||||
LUA_API void luaJIT_profile_stop(lua_State* L);
|
||||
LUA_API const char* luaJIT_profile_dumpstack(lua_State* L, const char* fmt, int depth, size_t* len);
|
||||
|
||||
/* Enforce (dynamic) linker error for version mismatches. Call from main. */
|
||||
LUA_API void LUAJIT_VERSION_SYM(void);
|
||||
|
||||
@@ -22,19 +22,19 @@
|
||||
#define LUA_JITLIBNAME "jit"
|
||||
#define LUA_FFILIBNAME "ffi"
|
||||
|
||||
LUALIB_API int luaopen_base(lua_State *L);
|
||||
LUALIB_API int luaopen_math(lua_State *L);
|
||||
LUALIB_API int luaopen_string(lua_State *L);
|
||||
LUALIB_API int luaopen_table(lua_State *L);
|
||||
LUALIB_API int luaopen_io(lua_State *L);
|
||||
LUALIB_API int luaopen_os(lua_State *L);
|
||||
LUALIB_API int luaopen_package(lua_State *L);
|
||||
LUALIB_API int luaopen_debug(lua_State *L);
|
||||
LUALIB_API int luaopen_bit(lua_State *L);
|
||||
LUALIB_API int luaopen_jit(lua_State *L);
|
||||
LUALIB_API int luaopen_ffi(lua_State *L);
|
||||
LUALIB_API int luaopen_base(lua_State* L);
|
||||
LUALIB_API int luaopen_math(lua_State* L);
|
||||
LUALIB_API int luaopen_string(lua_State* L);
|
||||
LUALIB_API int luaopen_table(lua_State* L);
|
||||
LUALIB_API int luaopen_io(lua_State* L);
|
||||
LUALIB_API int luaopen_os(lua_State* L);
|
||||
LUALIB_API int luaopen_package(lua_State* L);
|
||||
LUALIB_API int luaopen_debug(lua_State* L);
|
||||
LUALIB_API int luaopen_bit(lua_State* L);
|
||||
LUALIB_API int luaopen_jit(lua_State* L);
|
||||
LUALIB_API int luaopen_ffi(lua_State* L);
|
||||
|
||||
LUALIB_API void luaL_openlibs(lua_State *L);
|
||||
LUALIB_API void luaL_openlibs(lua_State* L);
|
||||
|
||||
#ifndef lua_assert
|
||||
#define lua_assert(x) ((void)0)
|
||||
|
||||
Reference in New Issue
Block a user